diff options
author | des <des@FreeBSD.org> | 2005-03-05 18:57:30 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2005-03-05 18:57:30 +0000 |
commit | 7427eb62d695f711aeb0877a431da5220d2834f3 (patch) | |
tree | b9697907eded4245f1de17fc0c96c57d0a5bae6d | |
parent | a2e81fc93f4273fc79567fc60405bfcf7d210748 (diff) | |
download | FreeBSD-src-7427eb62d695f711aeb0877a431da5220d2834f3.zip FreeBSD-src-7427eb62d695f711aeb0877a431da5220d2834f3.tar.gz |
MFi386: use TUNABLE_ULONG_FETCH to retrieve hw.physmem.
-rw-r--r-- | sys/amd64/amd64/machdep.c | 38 |
1 files changed, 3 insertions, 35 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 2a2b147..da9e5fd 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -866,8 +866,8 @@ getmemsize(caddr_t kmdp, u_int64_t first) { int i, physmap_idx, pa_indx; vm_paddr_t pa, physmap[PHYSMAP_SIZE]; + u_long physmem_tunable; pt_entry_t *pte; - char *cp; struct bios_smap *smapbase, *smap, *smapend; u_int32_t smapsize; quad_t dcons_addr, dcons_size; @@ -956,40 +956,8 @@ getmemsize(caddr_t kmdp, u_int64_t first) Maxmem = MAXMEM / 4; #endif - /* - * hw.physmem is a size in bytes; we also allow k, m, and g suffixes - * for the appropriate modifiers. This overrides MAXMEM. - */ - cp = getenv("hw.physmem"); - if (cp != NULL) { - u_int64_t AllowMem, sanity; - char *ep; - - sanity = AllowMem = strtouq(cp, &ep, 0); - if ((ep != cp) && (*ep != 0)) { - switch(*ep) { - case 'g': - case 'G': - AllowMem <<= 10; - case 'm': - case 'M': - AllowMem <<= 10; - case 'k': - case 'K': - AllowMem <<= 10; - break; - default: - AllowMem = sanity = 0; - } - if (AllowMem < sanity) - AllowMem = 0; - } - if (AllowMem == 0) - printf("Ignoring invalid memory size of '%s'\n", cp); - else - Maxmem = atop(AllowMem); - freeenv(cp); - } + if (TUNABLE_ULONG_FETCH("hw.physmem", &physmem_tunable)) + Maxmem = atop(physmem_tunable); if (atop(physmap[physmap_idx + 1]) != Maxmem && (boothowto & RB_VERBOSE)) |