@@ -15,6 +15,7 @@
#include <devicetree.h>
#include <alloc.h>
#include <alloc_phys.h>
+#include <alloc_page.h>
#include <argv.h>
#include <asm/setup.h>
#include <asm/page.h>
@@ -111,6 +112,7 @@ static void mem_init(phys_addr_t freemem_start)
struct mem_region primary, mem = {
.start = (phys_addr_t)-1,
};
+ phys_addr_t base, top;
int nr_regs, i;
nr_regs = dt_get_memory_params(regs, NR_MEM_REGIONS);
@@ -146,9 +148,10 @@ static void mem_init(phys_addr_t freemem_start)
__physical_start = mem.start; /* PHYSICAL_START */
__physical_end = mem.end; /* PHYSICAL_END */
- phys_alloc_init(freemem_start, primary.end - freemem_start);
- phys_alloc_set_minimum_alignment(__icache_bytes > __dcache_bytes
- ? __icache_bytes : __dcache_bytes);
+ base = PAGE_ALIGN(freemem_start) >> PAGE_SHIFT;
+ top = primary.end >> PAGE_SHIFT;
+ page_alloc_init_area(0, base, top);
+ page_alloc_ops_enable();
}
void setup(const void *fdt)
@@ -34,6 +34,7 @@ include $(SRCDIR)/scripts/asm-offsets.mak
cflatobjs += lib/util.o
cflatobjs += lib/getchar.o
cflatobjs += lib/alloc_phys.o
+cflatobjs += lib/alloc_page.o
cflatobjs += lib/alloc.o
cflatobjs += lib/devicetree.o
cflatobjs += lib/migrate.o
@@ -8,6 +8,7 @@
#include <libcflat.h>
#include <util.h>
#include <alloc.h>
+#include <alloc_page.h>
#include <asm/hcall.h>
#include <asm/processor.h>
@@ -58,8 +59,8 @@ static void test_h_page_init(int argc, char **argv)
if (argc > 1)
report_abort("Unsupported argument: '%s'", argv[1]);
- dst = memalign(PAGE_SIZE, PAGE_SIZE);
- src = memalign(PAGE_SIZE, PAGE_SIZE);
+ dst = alloc_page();
+ src = alloc_page();
if (!dst || !src)
report_abort("Failed to alloc memory");