aboutsummaryrefslogtreecommitdiff
path: root/sys/powerpc/aim/ofw_machdep.c
diff options
context:
space:
mode:
authorBenno Rice <benno@FreeBSD.org>2002-05-27 11:18:12 +0000
committerBenno Rice <benno@FreeBSD.org>2002-05-27 11:18:12 +0000
commit31c82d03324c58747d453f5aee13a817f3be0e96 (patch)
tree4fb595dbcc9d21d42fc1930294cad2de52da3176 /sys/powerpc/aim/ofw_machdep.c
parentfb08c0489dd83c63aeaa50abb450fdf891c6f098 (diff)
downloadsrc-31c82d03324c58747d453f5aee13a817f3be0e96.tar.gz
src-31c82d03324c58747d453f5aee13a817f3be0e96.zip
Get the correct memory regions from OpenFirmware. We were getting the
"available" ranges, not the "physical" ranges. Clean up some of the bootstrap code in the process. Submitted by: Peter Grehan <peterg@ptree32.com.au>
Notes
Notes: svn path=/head/; revision=97346
Diffstat (limited to 'sys/powerpc/aim/ofw_machdep.c')
-rw-r--r--sys/powerpc/aim/ofw_machdep.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/sys/powerpc/aim/ofw_machdep.c b/sys/powerpc/aim/ofw_machdep.c
index 135917b21648..c818902e3b73 100644
--- a/sys/powerpc/aim/ofw_machdep.c
+++ b/sys/powerpc/aim/ofw_machdep.c
@@ -70,23 +70,27 @@ static int (*ofwcall)(void *);
* to provide space for two additional entry beyond the terminating one.
*/
void
-mem_regions(struct mem_region **memp, struct mem_region **availp)
+mem_regions(struct mem_region **memp, int *memsz,
+ struct mem_region **availp, int *availsz)
{
- int phandle /*, i, j, cnt*/;
+ int phandle;
+ int asz, msz;
/*
* Get memory.
*/
if ((phandle = OF_finddevice("/memory")) == -1
- || OF_getprop(phandle, "reg",
- OFmem, sizeof OFmem[0] * OFMEM_REGIONS)
+ || (msz = OF_getprop(phandle, "reg",
+ OFmem, sizeof OFmem[0] * OFMEM_REGIONS))
<= 0
- || OF_getprop(phandle, "available",
- OFavail, sizeof OFavail[0] * OFMEM_REGIONS)
+ || (asz = OF_getprop(phandle, "available",
+ OFavail, sizeof OFavail[0] * OFMEM_REGIONS))
<= 0)
panic("no memory?");
*memp = OFmem;
+ *memsz = msz / sizeof(struct mem_region);
*availp = OFavail;
+ *availsz = asz / sizeof(struct mem_region);
}
void
@@ -139,8 +143,6 @@ openfirmware(void *args)
__asm __volatile("mtsr 15,%0" :: "r"(ofw_pmap.pm_sr[15]));
}
- ofmsr |= PSL_RI|PSL_EE;
-
__asm __volatile( "\t"
"sync\n\t"
"mfmsr %0\n\t"