diff --git a/stand/ofw/common/main.c b/stand/ofw/common/main.c index 607455e95153..b8c7a17bb1c1 100644 --- a/stand/ofw/common/main.c +++ b/stand/ofw/common/main.c @@ -43,22 +43,16 @@ u_int32_t acells, scells; static char bootargs[128]; #define HEAP_SIZE 0x800000 +static char heap[HEAP_SIZE]; // In BSS, so uses no space #define OF_puts(fd, text) OF_write(fd, text, strlen(text)) void init_heap(void) { - void *base; - ihandle_t stdout; + bzero(heap, HEAP_SIZE); - if ((base = ofw_alloc_heap(HEAP_SIZE)) == (void *)0xffffffff) { - OF_getprop(chosen, "stdout", &stdout, sizeof(stdout)); - OF_puts(stdout, "Heap memory claim failed!\n"); - OF_enter(); - } - - setheap(base, (void *)((int)base + HEAP_SIZE)); + setheap(heap, (void *)((int)heap + HEAP_SIZE)); } uint64_t diff --git a/stand/ofw/libofw/elf_freebsd.c b/stand/ofw/libofw/elf_freebsd.c index a2e48a7a739e..456b0cd58920 100644 --- a/stand/ofw/libofw/elf_freebsd.c +++ b/stand/ofw/libofw/elf_freebsd.c @@ -87,7 +87,6 @@ __elfN(ofw_exec)(struct preloaded_file *fp) printf("Kernel entry at 0x%lx ...\n", e->e_entry); dev_cleanup(); - ofw_release_heap(); if (dtbp != 0) { OF_quiesce(); ((int (*)(u_long, u_long, u_long, void *, u_long))entry)(dtbp, 0, 0, diff --git a/stand/ofw/libofw/libofw.h b/stand/ofw/libofw/libofw.h index b8c4014387bd..24a5d08fd77a 100644 --- a/stand/ofw/libofw/libofw.h +++ b/stand/ofw/libofw/libofw.h @@ -58,8 +58,6 @@ extern int ofw_boot(void); extern int ofw_autoload(void); void ofw_memmap(int); -void *ofw_alloc_heap(unsigned int); -void ofw_release_heap(void); struct preloaded_file; struct file_format; diff --git a/stand/ofw/libofw/ofw_copy.c b/stand/ofw/libofw/ofw_copy.c index ffd698731503..d83dbeddb577 100644 --- a/stand/ofw/libofw/ofw_copy.c +++ b/stand/ofw/libofw/ofw_copy.c @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$"); #define READIN_BUF (4 * 1024) #define PAGE_SIZE 0x1000 #define PAGE_MASK 0x0fff -#define MAPMEM_PAGE_INC 16 +#define MAPMEM_PAGE_INC 128 /* Half-MB at a time */ #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) diff --git a/stand/ofw/libofw/ofw_memory.c b/stand/ofw/libofw/ofw_memory.c index 5616184e8080..f05881ee8a19 100644 --- a/stand/ofw/libofw/ofw_memory.c +++ b/stand/ofw/libofw/ofw_memory.c @@ -35,9 +35,6 @@ __FBSDID("$FreeBSD$"); #include "libofw.h" #include "openfirm.h" -static void *heap_base = NULL; -static unsigned int heap_size = 0; - struct ofw_mapping { vm_offset_t va; int len; @@ -115,32 +112,3 @@ ofw_memmap(int acells) pager_close(); } -void * -ofw_alloc_heap(unsigned int size) -{ - 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)); - - heap_base = OF_claim((void *)available[acells-1], size, - sizeof(register_t)); - - if (heap_base != (void *)-1) { - heap_size = size; - } - - return (heap_base); -} - -void -ofw_release_heap(void) -{ - OF_release(heap_base, heap_size); -} diff --git a/stand/ofw/libofw/ppc64_elf_freebsd.c b/stand/ofw/libofw/ppc64_elf_freebsd.c index 9132e9d09d63..6d850297e03e 100644 --- a/stand/ofw/libofw/ppc64_elf_freebsd.c +++ b/stand/ofw/libofw/ppc64_elf_freebsd.c @@ -90,7 +90,6 @@ ppc64_ofw_elf_exec(struct preloaded_file *fp) printf("Kernel entry at 0x%lx ...\n", entry); dev_cleanup(); - ofw_release_heap(); if (dtbp != 0) { OF_quiesce(); diff --git a/stand/powerpc/ofw/ldscript.powerpc b/stand/powerpc/ofw/ldscript.powerpc index 3a2765047dbb..e0dc5e2614a8 100644 --- a/stand/powerpc/ofw/ldscript.powerpc +++ b/stand/powerpc/ofw/ldscript.powerpc @@ -9,7 +9,7 @@ PROVIDE (__stack = 0); SECTIONS { /* Read-only sections, merged into text segment: */ - . = 0x01c00000 + SIZEOF_HEADERS; + . = 0x02c00000 + SIZEOF_HEADERS; .interp : { *(.interp) } .hash : { *(.hash) } .dynsym : { *(.dynsym) }