diff options
author | grehan <grehan@FreeBSD.org> | 2005-03-07 07:31:20 +0000 |
---|---|---|
committer | grehan <grehan@FreeBSD.org> | 2005-03-07 07:31:20 +0000 |
commit | d3c3434c1cc5d8a3a7efde19b203447a56837ea0 (patch) | |
tree | e6e0298bb52439736fb2d84b762d3820019284b8 /sys/powerpc | |
parent | a5d845fec654f4b43610ba376ae17fa9309853b0 (diff) | |
download | FreeBSD-src-d3c3434c1cc5d8a3a7efde19b203447a56837ea0.zip FreeBSD-src-d3c3434c1cc5d8a3a7efde19b203447a56837ea0.tar.gz |
Replaced previous hw.physmem extraction with des's mods to
getenv_ulong() - much simpler.
Pointed out by: des
Diffstat (limited to 'sys/powerpc')
-rw-r--r-- | sys/powerpc/aim/mmu_oea.c | 52 | ||||
-rw-r--r-- | sys/powerpc/powerpc/mmu_oea.c | 52 | ||||
-rw-r--r-- | sys/powerpc/powerpc/pmap.c | 52 |
3 files changed, 6 insertions, 150 deletions
diff --git a/sys/powerpc/aim/mmu_oea.c b/sys/powerpc/aim/mmu_oea.c index 14409a0..8c6808c 100644 --- a/sys/powerpc/aim/mmu_oea.c +++ b/sys/powerpc/aim/mmu_oea.c @@ -524,55 +524,6 @@ om_cmp(const void *a, const void *b) return (0); } -static vm_size_t -pmap_tunable_physmem(void) -{ - char *cp; - vm_size_t retval; - - retval = 0; - - if ((cp = getenv("hw.physmem")) != 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': - /* - * Can't have more than 4G of RAM - */ - if (allowmem > 4) { - printf("Invalid memory size '%s'\n", - cp); - return (0); - } - 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 - retval = allowmem; - freeenv(cp); - } - - return (retval); -} - void pmap_bootstrap(vm_offset_t kernelstart, vm_offset_t kernelend) { @@ -679,7 +630,8 @@ pmap_bootstrap(vm_offset_t kernelstart, vm_offset_t kernelend) qsort(regions, regions_sz, sizeof(*regions), mr_cmp); phys_avail_count = 0; physsz = 0; - hwphyssz = pmap_tunable_physmem(); + hwphyssz = 0; + TUNABLE_ULONG_FETCH("hw.physmem", (u_long *) &hwphyssz); for (i = 0, j = 0; i < regions_sz; i++, j += 2) { CTR3(KTR_PMAP, "region: %#x - %#x (%#x)", regions[i].mr_start, regions[i].mr_start + regions[i].mr_size, diff --git a/sys/powerpc/powerpc/mmu_oea.c b/sys/powerpc/powerpc/mmu_oea.c index 14409a0..8c6808c 100644 --- a/sys/powerpc/powerpc/mmu_oea.c +++ b/sys/powerpc/powerpc/mmu_oea.c @@ -524,55 +524,6 @@ om_cmp(const void *a, const void *b) return (0); } -static vm_size_t -pmap_tunable_physmem(void) -{ - char *cp; - vm_size_t retval; - - retval = 0; - - if ((cp = getenv("hw.physmem")) != 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': - /* - * Can't have more than 4G of RAM - */ - if (allowmem > 4) { - printf("Invalid memory size '%s'\n", - cp); - return (0); - } - 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 - retval = allowmem; - freeenv(cp); - } - - return (retval); -} - void pmap_bootstrap(vm_offset_t kernelstart, vm_offset_t kernelend) { @@ -679,7 +630,8 @@ pmap_bootstrap(vm_offset_t kernelstart, vm_offset_t kernelend) qsort(regions, regions_sz, sizeof(*regions), mr_cmp); phys_avail_count = 0; physsz = 0; - hwphyssz = pmap_tunable_physmem(); + hwphyssz = 0; + TUNABLE_ULONG_FETCH("hw.physmem", (u_long *) &hwphyssz); for (i = 0, j = 0; i < regions_sz; i++, j += 2) { CTR3(KTR_PMAP, "region: %#x - %#x (%#x)", regions[i].mr_start, regions[i].mr_start + regions[i].mr_size, diff --git a/sys/powerpc/powerpc/pmap.c b/sys/powerpc/powerpc/pmap.c index 14409a0..8c6808c 100644 --- a/sys/powerpc/powerpc/pmap.c +++ b/sys/powerpc/powerpc/pmap.c @@ -524,55 +524,6 @@ om_cmp(const void *a, const void *b) return (0); } -static vm_size_t -pmap_tunable_physmem(void) -{ - char *cp; - vm_size_t retval; - - retval = 0; - - if ((cp = getenv("hw.physmem")) != 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': - /* - * Can't have more than 4G of RAM - */ - if (allowmem > 4) { - printf("Invalid memory size '%s'\n", - cp); - return (0); - } - 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 - retval = allowmem; - freeenv(cp); - } - - return (retval); -} - void pmap_bootstrap(vm_offset_t kernelstart, vm_offset_t kernelend) { @@ -679,7 +630,8 @@ pmap_bootstrap(vm_offset_t kernelstart, vm_offset_t kernelend) qsort(regions, regions_sz, sizeof(*regions), mr_cmp); phys_avail_count = 0; physsz = 0; - hwphyssz = pmap_tunable_physmem(); + hwphyssz = 0; + TUNABLE_ULONG_FETCH("hw.physmem", (u_long *) &hwphyssz); for (i = 0, j = 0; i < regions_sz; i++, j += 2) { CTR3(KTR_PMAP, "region: %#x - %#x (%#x)", regions[i].mr_start, regions[i].mr_start + regions[i].mr_size, |