summaryrefslogtreecommitdiffstats
path: root/sys/boot/ofw/libofw/ofw_memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/boot/ofw/libofw/ofw_memory.c')
-rw-r--r--sys/boot/ofw/libofw/ofw_memory.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/sys/boot/ofw/libofw/ofw_memory.c b/sys/boot/ofw/libofw/ofw_memory.c
index ebf01af..60cc904 100644
--- a/sys/boot/ofw/libofw/ofw_memory.c
+++ b/sys/boot/ofw/libofw/ofw_memory.c
@@ -118,13 +118,19 @@ ofw_memmap(int acells)
void *
ofw_alloc_heap(unsigned int size)
{
- phandle_t memoryp;
- struct ofw_reg available;
+ phandle_t memoryp, root;
+ cell_t available[4];
+ cell_t acells;
+
+ root = OF_finddevice("/");
+ acells = 1;
+ OF_getprop(root, "#address-cells", &acells, sizeof(acells));
memoryp = OF_instance_to_package(memory);
- OF_getprop(memoryp, "available", &available, sizeof(available));
+ OF_getprop(memoryp, "available", available, sizeof(available));
- heap_base = OF_claim((void *)available.base, size, sizeof(register_t));
+ heap_base = OF_claim((void *)available[acells-1], size,
+ sizeof(register_t));
if (heap_base != (void *)-1) {
heap_size = size;
OpenPOWER on IntegriCloud