diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-02-10 08:56:29 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-02-10 08:56:29 +0000 |
commit | 72991b730a41018e0dc85d41d6a9e21219404c40 (patch) | |
tree | 96b911560f6913ef2189fa925e72c40be0ea536a /sys/arch | |
parent | 8e4028c51b5f186530f1b56134916a24ee79dc48 (diff) |
Correctly parse memory regions from the firmware on 64bit machines.
With miod@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/macppc/macppc/ofw_machdep.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/arch/macppc/macppc/ofw_machdep.c b/sys/arch/macppc/macppc/ofw_machdep.c index 1c342e88e29..75edebc88a9 100644 --- a/sys/arch/macppc/macppc/ofw_machdep.c +++ b/sys/arch/macppc/macppc/ofw_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ofw_machdep.c,v 1.46 2014/04/01 20:27:14 mpi Exp $ */ +/* $OpenBSD: ofw_machdep.c,v 1.47 2015/02/10 08:56:28 mpi Exp $ */ /* $NetBSD: ofw_machdep.c,v 1.1 1996/09/30 16:34:50 ws Exp $ */ /* @@ -76,7 +76,7 @@ static struct mem_region OFmem[OFMEM_REGIONS + 1], OFavail[OFMEM_REGIONS + 3]; struct mem_region64 { uint64_t start; uint32_t size; -}; +} __packed; static struct mem_region64 OFmem64[OFMEM_REGIONS + 1]; @@ -114,9 +114,9 @@ ppc_mem_regions(struct mem_region **memp, struct mem_region **availp) panic("no memory?"); rhandle = OF_parent(phandle); - if (OF_getprop(phandle, "#address-cells", &address_cells, 4) <= 0) + if (OF_getprop(rhandle, "#address-cells", &address_cells, 4) <= 0) address_cells = 1; - if (OF_getprop(phandle, "#size-cells", &size_cells, 4) <= 0) + if (OF_getprop(rhandle, "#size-cells", &size_cells, 4) <= 0) size_cells = 1; if (size_cells != 1) @@ -130,7 +130,7 @@ ppc_mem_regions(struct mem_region **memp, struct mem_region **availp) sizeof(OFmem[0]) * OFMEM_REGIONS) / sizeof(OFmem[0]); break; case 2: - nreg = OF_getprop(phandle, "reg", OFmem, + nreg = OF_getprop(phandle, "reg", OFmem64, sizeof(OFmem64[0]) * OFMEM_REGIONS) / sizeof(OFmem64[0]); break; } |