Commit e6ca4e5b authored by Markos Chandras's avatar Markos Chandras Committed by Ralf Baechle

MIPS: malta: malta-memory: Add support for the 'ememsize' variable

The 'ememsize' variable is used to denote the real RAM which is
present on the Malta board. This is different compared to 'memsize'
which is capped to 256MB. The 'ememsize' is used to get the actual
physical memory when setting up the Malta memory layout. This only
makes sense in case the core operates in the EVA mode, and it's
ignored otherwise.
Signed-off-by: default avatarMarkos Chandras <markos.chandras@imgtec.com>
parent c9fede2a
...@@ -38,7 +38,7 @@ extern int *_fw_envp; ...@@ -38,7 +38,7 @@ extern int *_fw_envp;
extern void fw_init_cmdline(void); extern void fw_init_cmdline(void);
extern char *fw_getcmdline(void); extern char *fw_getcmdline(void);
extern fw_memblock_t *fw_getmdesc(void); extern fw_memblock_t *fw_getmdesc(int);
extern void fw_meminit(void); extern void fw_meminit(void);
extern char *fw_getenv(char *name); extern char *fw_getenv(char *name);
extern unsigned long fw_getenvl(char *name); extern unsigned long fw_getenvl(char *name);
......
...@@ -24,22 +24,30 @@ static fw_memblock_t mdesc[FW_MAX_MEMBLOCKS]; ...@@ -24,22 +24,30 @@ static fw_memblock_t mdesc[FW_MAX_MEMBLOCKS];
/* determined physical memory size, not overridden by command line args */ /* determined physical memory size, not overridden by command line args */
unsigned long physical_memsize = 0L; unsigned long physical_memsize = 0L;
fw_memblock_t * __init fw_getmdesc(void) fw_memblock_t * __init fw_getmdesc(int eva)
{ {
char *memsize_str, *ptr; char *memsize_str, *ememsize_str __maybe_unused = NULL, *ptr;
unsigned int memsize; unsigned long memsize, ememsize __maybe_unused = 0;
static char cmdline[COMMAND_LINE_SIZE] __initdata; static char cmdline[COMMAND_LINE_SIZE] __initdata;
long val;
int tmp; int tmp;
/* otherwise look in the environment */ /* otherwise look in the environment */
memsize_str = fw_getenv("memsize"); memsize_str = fw_getenv("memsize");
if (!memsize_str) { if (memsize_str)
tmp = kstrtol(memsize_str, 0, &memsize);
if (eva) {
/* Look for ememsize for EVA */
ememsize_str = fw_getenv("ememsize");
if (ememsize_str)
tmp = kstrtol(ememsize_str, 0, &ememsize);
}
if (!memsize && !ememsize) {
pr_warn("memsize not set in YAMON, set to default (32Mb)\n"); pr_warn("memsize not set in YAMON, set to default (32Mb)\n");
physical_memsize = 0x02000000; physical_memsize = 0x02000000;
} else { } else {
tmp = kstrtol(memsize_str, 0, &val); /* If ememsize is set, then set physical_memsize to that */
physical_memsize = (unsigned long)val; physical_memsize = ememsize ? : memsize;
} }
#ifdef CONFIG_CPU_BIG_ENDIAN #ifdef CONFIG_CPU_BIG_ENDIAN
...@@ -54,12 +62,22 @@ fw_memblock_t * __init fw_getmdesc(void) ...@@ -54,12 +62,22 @@ fw_memblock_t * __init fw_getmdesc(void)
ptr = strstr(cmdline, "memsize="); ptr = strstr(cmdline, "memsize=");
if (ptr && (ptr != cmdline) && (*(ptr - 1) != ' ')) if (ptr && (ptr != cmdline) && (*(ptr - 1) != ' '))
ptr = strstr(ptr, " memsize="); ptr = strstr(ptr, " memsize=");
/* And now look for ememsize */
if (eva) {
ptr = strstr(cmdline, "ememsize=");
if (ptr && (ptr != cmdline) && (*(ptr - 1) != ' '))
ptr = strstr(ptr, " ememsize=");
}
if (ptr) if (ptr)
memsize = memparse(ptr + 8, &ptr); memsize = memparse(ptr + 8 + (eva ? 1 : 0), &ptr);
else else
memsize = physical_memsize; memsize = physical_memsize;
/* Last 64K for HIGHMEM arithmetics */
if (memsize > 0x7fff0000)
memsize = 0x7fff0000;
memset(mdesc, 0, sizeof(mdesc)); memset(mdesc, 0, sizeof(mdesc));
mdesc[0].type = fw_dontuse; mdesc[0].type = fw_dontuse;
...@@ -109,7 +127,7 @@ void __init fw_meminit(void) ...@@ -109,7 +127,7 @@ void __init fw_meminit(void)
{ {
fw_memblock_t *p; fw_memblock_t *p;
p = fw_getmdesc(); p = fw_getmdesc(config_enabled(CONFIG_EVA));
while (p->size) { while (p->size) {
long type; long type;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment