diff options
author | adrian <adrian@FreeBSD.org> | 2015-11-21 00:22:47 +0000 |
---|---|---|
committer | adrian <adrian@FreeBSD.org> | 2015-11-21 00:22:47 +0000 |
commit | b5c03ef3208538e277b986004b6685668a918325 (patch) | |
tree | 95cee520b38dd8647fcb7402970e42b027e48318 /sys/mips/malta | |
parent | 7b391bfea3d66d7426d2273e54e036303831b28e (diff) | |
download | FreeBSD-src-b5c03ef3208538e277b986004b6685668a918325.zip FreeBSD-src-b5c03ef3208538e277b986004b6685668a918325.tar.gz |
mips: teach the malta platform about extended memory.
Extended memory here is "physical memory above 256MB".
"memsize" in the environment only grows to 256MB; "ememsize" is the entire
memory range. Extended memory shows up at physical address 0x90000000.
This allows for malta64 VMs to be created with > 256MB RAM, all the way
up to 2GB RAM.
Tested:
* qemu-devel package; qemu-system-mips64 -m 2048 (and -m 256 to test the
no-ememsize case.)
TODO:
* testing mips32 with > 256MB RAM.
Reviewed by: imp
Diffstat (limited to 'sys/mips/malta')
-rw-r--r-- | sys/mips/malta/malta_machdep.c | 62 |
1 files changed, 53 insertions, 9 deletions
diff --git a/sys/mips/malta/malta_machdep.c b/sys/mips/malta/malta_machdep.c index 00f2151..85abb92 100644 --- a/sys/mips/malta/malta_machdep.c +++ b/sys/mips/malta/malta_machdep.c @@ -173,7 +173,7 @@ writertc(uint8_t addr, uint8_t val) #endif static void -mips_init(void) +mips_init(unsigned long memsize, uint64_t ememsize) { int i; @@ -181,13 +181,28 @@ mips_init(void) phys_avail[i] = 0; } + /* + * memsize is the amount of RAM available below 256MB. + * ememsize is the total amount of RAM available. + * + * The second bank starts at 0x90000000. + */ + /* phys_avail regions are in bytes */ phys_avail[0] = MIPS_KSEG0_TO_PHYS(kernel_kseg0_end); - phys_avail[1] = ctob(realmem); - + phys_avail[1] = memsize; dump_avail[0] = phys_avail[0]; dump_avail[1] = phys_avail[1]; + /* Only specify the extended region if it's set */ + if (ememsize > memsize) { + phys_avail[2] = 0x90000000; + phys_avail[3] = 0x90000000 + (ememsize - memsize); + dump_avail[2] = phys_avail[2]; + dump_avail[3] = phys_avail[3]; + } + + /* XXX realmem assigned in the caller of mips_init() */ physmem = realmem; init_param1(); @@ -272,6 +287,7 @@ platform_start(__register_t a0, __register_t a1, __register_t a2, int32_t *argv = (int32_t*)a1; int32_t *envp = (int32_t*)a2; unsigned int memsize = a3; + uint64_t ememsize = 0; int i; /* clear the BSS and SBSS segments */ @@ -289,26 +305,54 @@ platform_start(__register_t a0, __register_t a1, __register_t a2, printf("entry: platform_start()\n"); bootverbose = 1; + /* * YAMON uses 32bit pointers to strings so * convert them to proper type manually */ + if (bootverbose) { printf("cmd line: "); for (i = 0; i < argc; i++) printf("%s ", (char*)(intptr_t)argv[i]); printf("\n"); + } + if (bootverbose) printf("envp:\n"); - for (i = 0; envp[i]; i += 2) - printf("\t%s = %s\n", (char*)(intptr_t)envp[i], - (char*)(intptr_t)envp[i+1]); - printf("memsize = %08x\n", memsize); + /* + * Parse the environment for things like ememsize. + */ + for (i = 0; envp[i]; i += 2) { + const char *a, *v; + + a = (char *)(intptr_t)envp[i]; + v = (char *)(intptr_t)envp[i+1]; + + if (bootverbose) + printf("\t%s = %s\n", a, v); + + if (strcmp(a, "ememsize") == 0) { + ememsize = strtoul(v, NULL, 0); + } } - realmem = btoc(memsize); - mips_init(); + if (bootverbose) { + printf("memsize = %llu (0x%08x)\n", + (unsigned long long) memsize, memsize); + printf("ememsize = %llu\n", (unsigned long long) ememsize); + } + + /* + * For <= 256MB RAM amounts, ememsize should equal memsize. + * For > 256MB RAM amounts it's the total RAM available; + * split between two banks. + * + * XXX TODO: just push realmem assignment into mips_init() ? + */ + realmem = btoc(ememsize); + mips_init(memsize, ememsize); mips_timer_init_params(platform_counter_freq, 0); } |