From aa39961e379130af8ca7299a6ed4f6b55f101427 Mon Sep 17 00:00:00 2001 From: Benno Rice Date: Thu, 18 Jul 2002 12:43:08 +0000 Subject: [PATCH] Remove the statically allocated array that holds OpenFirmware memory mappings during pmap_bootstrap. Instead, temporarily help ourselves to some memory from phys_avail since we won't need it post-boostrap. --- sys/powerpc/aim/mmu_oea.c | 12 ++++++++---- sys/powerpc/powerpc/mmu_oea.c | 12 ++++++++---- sys/powerpc/powerpc/pmap.c | 12 ++++++++---- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/sys/powerpc/aim/mmu_oea.c b/sys/powerpc/aim/mmu_oea.c index 50e3f1201c1f..789f40ba3601 100644 --- a/sys/powerpc/aim/mmu_oea.c +++ b/sys/powerpc/aim/mmu_oea.c @@ -211,8 +211,7 @@ u_int phys_avail_count; static struct mem_region *regions; static struct mem_region *pregions; int regions_sz, pregions_sz; -static struct ofw_map translations[128]; -static int translations_size; +static struct ofw_map *translations; /* * First and last available kernel virtual addresses. @@ -688,8 +687,13 @@ pmap_bootstrap(vm_offset_t kernelstart, vm_offset_t kernelend) panic("pmap_bootstrap: can't get mmu package"); if ((sz = OF_getproplen(mmu, "translations")) == -1) panic("pmap_bootstrap: can't get ofw translation count"); - if (sizeof(translations) < sz) - panic("pmap_bootstrap: translations too small"); + translations = NULL; + for (i = 0; phys_avail[i + 2] != 0; i += 2) { + if (phys_avail[i + 1] >= sz) + translations = (struct ofw_map *)phys_avail[i]; + } + if (translations == NULL) + panic("pmap_bootstrap: no space to copy translations"); bzero(translations, sz); if (OF_getprop(mmu, "translations", translations, sz) == -1) panic("pmap_bootstrap: can't get ofw translations"); diff --git a/sys/powerpc/powerpc/mmu_oea.c b/sys/powerpc/powerpc/mmu_oea.c index 50e3f1201c1f..789f40ba3601 100644 --- a/sys/powerpc/powerpc/mmu_oea.c +++ b/sys/powerpc/powerpc/mmu_oea.c @@ -211,8 +211,7 @@ u_int phys_avail_count; static struct mem_region *regions; static struct mem_region *pregions; int regions_sz, pregions_sz; -static struct ofw_map translations[128]; -static int translations_size; +static struct ofw_map *translations; /* * First and last available kernel virtual addresses. @@ -688,8 +687,13 @@ pmap_bootstrap(vm_offset_t kernelstart, vm_offset_t kernelend) panic("pmap_bootstrap: can't get mmu package"); if ((sz = OF_getproplen(mmu, "translations")) == -1) panic("pmap_bootstrap: can't get ofw translation count"); - if (sizeof(translations) < sz) - panic("pmap_bootstrap: translations too small"); + translations = NULL; + for (i = 0; phys_avail[i + 2] != 0; i += 2) { + if (phys_avail[i + 1] >= sz) + translations = (struct ofw_map *)phys_avail[i]; + } + if (translations == NULL) + panic("pmap_bootstrap: no space to copy translations"); bzero(translations, sz); if (OF_getprop(mmu, "translations", translations, sz) == -1) panic("pmap_bootstrap: can't get ofw translations"); diff --git a/sys/powerpc/powerpc/pmap.c b/sys/powerpc/powerpc/pmap.c index 50e3f1201c1f..789f40ba3601 100644 --- a/sys/powerpc/powerpc/pmap.c +++ b/sys/powerpc/powerpc/pmap.c @@ -211,8 +211,7 @@ u_int phys_avail_count; static struct mem_region *regions; static struct mem_region *pregions; int regions_sz, pregions_sz; -static struct ofw_map translations[128]; -static int translations_size; +static struct ofw_map *translations; /* * First and last available kernel virtual addresses. @@ -688,8 +687,13 @@ pmap_bootstrap(vm_offset_t kernelstart, vm_offset_t kernelend) panic("pmap_bootstrap: can't get mmu package"); if ((sz = OF_getproplen(mmu, "translations")) == -1) panic("pmap_bootstrap: can't get ofw translation count"); - if (sizeof(translations) < sz) - panic("pmap_bootstrap: translations too small"); + translations = NULL; + for (i = 0; phys_avail[i + 2] != 0; i += 2) { + if (phys_avail[i + 1] >= sz) + translations = (struct ofw_map *)phys_avail[i]; + } + if (translations == NULL) + panic("pmap_bootstrap: no space to copy translations"); bzero(translations, sz); if (OF_getprop(mmu, "translations", translations, sz) == -1) panic("pmap_bootstrap: can't get ofw translations");