Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 32568
b: refs/heads/master
c: e1a4e46
h: refs/heads/master
v: v3
  • Loading branch information
Ralf Baechle committed Jul 13, 2006
1 parent 32ff0e8 commit f7cd152
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 25 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6fe725c01c0c547c4287ba3de5ebc8f884178409
refs/heads/master: e1a4e469d77297fd006a3cf2b605fc6f782a8d26
50 changes: 26 additions & 24 deletions trunk/arch/mips/mips-boards/generic/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,43 +47,45 @@ static char *mtypes[3] = {
};
#endif

/* determined physical memory size, not overridden by command line args */
unsigned long physical_memsize = 0L;

struct prom_pmemblock * __init prom_getmdesc(void)
{
char *memsize_str;
unsigned int memsize;
char cmdline[CL_SIZE], *ptr;

/* Check the command line first for a memsize directive */
strcpy(cmdline, arcs_cmdline);
ptr = strstr(cmdline, "memsize=");
if (ptr && (ptr != cmdline) && (*(ptr - 1) != ' '))
ptr = strstr(ptr, " memsize=");

if (ptr) {
memsize = memparse(ptr + 8, &ptr);
}
else {
/* otherwise look in the environment */
memsize_str = prom_getenv("memsize");
if (!memsize_str) {
prom_printf("memsize not set in boot prom, set to default (32Mb)\n");
memsize = 0x02000000;
} else {
/* otherwise look in the environment */
memsize_str = prom_getenv("memsize");
if (!memsize_str) {
prom_printf("memsize not set in boot prom, set to default (32Mb)\n");
physical_memsize = 0x02000000;
} else {
#ifdef DEBUG
prom_printf("prom_memsize = %s\n", memsize_str);
prom_printf("prom_memsize = %s\n", memsize_str);
#endif
memsize = simple_strtol(memsize_str, NULL, 0);
}
physical_memsize = simple_strtol(memsize_str, NULL, 0);
}

#ifdef CONFIG_CPU_BIG_ENDIAN
/*
* SOC-it swaps, or perhaps doesn't swap, when DMA'ing the last
* word of physical memory
*/
memsize -= PAGE_SIZE;
/* SOC-it swaps, or perhaps doesn't swap, when DMA'ing the last
word of physical memory */
physical_memsize -= PAGE_SIZE;
#endif

/* Check the command line for a memsize directive that overrides
the physical/default amount */
strcpy(cmdline, arcs_cmdline);
ptr = strstr(cmdline, "memsize=");
if (ptr && (ptr != cmdline) && (*(ptr - 1) != ' '))
ptr = strstr(ptr, " memsize=");

if (ptr)
memsize = memparse(ptr + 8, &ptr);
else
memsize = physical_memsize;

memset(mdesc, 0, sizeof(mdesc));

mdesc[0].type = yamon_dontuse;
Expand Down

0 comments on commit f7cd152

Please sign in to comment.