diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2019-05-10 18:15:50 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2019-05-10 18:15:50 +0200 |
commit | 65cfdbebb19f0b1c8d322a3eb9ec464d669a4d3f (patch) | |
tree | c279915875be7850298cfe1ccd3b96c149373590 /arch/mips/boot | |
parent | e7dad8c88a19e7130b4241bfe1f251620850ce4b (diff) | |
parent | 113c2bc244649430200bf51df7ffd122fd260c24 (diff) | |
download | barebox-65cfdbebb19f0b1c8d322a3eb9ec464d669a4d3f.tar.gz barebox-65cfdbebb19f0b1c8d322a3eb9ec464d669a4d3f.tar.xz |
Merge branch 'for-next/mips'
Diffstat (limited to 'arch/mips/boot')
-rw-r--r-- | arch/mips/boot/dtb.c | 4 | ||||
-rw-r--r-- | arch/mips/boot/main_entry-pbl.c | 13 | ||||
-rw-r--r-- | arch/mips/boot/main_entry.c | 17 | ||||
-rw-r--r-- | arch/mips/boot/start.S | 4 |
4 files changed, 25 insertions, 13 deletions
diff --git a/arch/mips/boot/dtb.c b/arch/mips/boot/dtb.c index ea30e16f21..5e316270f6 100644 --- a/arch/mips/boot/dtb.c +++ b/arch/mips/boot/dtb.c @@ -29,10 +29,6 @@ void of_add_memory_bank(struct device_node *node, bool dump, int r, if (dump) pr_info("%s: %s: 0x%llx@0x%llx\n", node->name, str, size, base); - - if (glob_fdt && glob_fdt_size) - request_sdram_region("fdt", (resource_size_t)glob_fdt, - glob_fdt_size); } extern char __dtb_start[]; diff --git a/arch/mips/boot/main_entry-pbl.c b/arch/mips/boot/main_entry-pbl.c index b40887b064..02ddd5ec24 100644 --- a/arch/mips/boot/main_entry-pbl.c +++ b/arch/mips/boot/main_entry-pbl.c @@ -18,14 +18,14 @@ extern void *input_data_end; unsigned long free_mem_ptr; unsigned long free_mem_end_ptr; -void pbl_main_entry(void *fdt, void *fdt_end); +void pbl_main_entry(void *fdt, void *fdt_end, u32 ram_size); static unsigned long *ttb; static void barebox_uncompress(void *compressed_start, unsigned int len) { /* set 128 KiB at the end of the MALLOC_BASE for early malloc */ - free_mem_ptr = MALLOC_BASE + MALLOC_SIZE - SZ_128K; + free_mem_ptr = TEXT_BASE - SZ_128K; free_mem_end_ptr = free_mem_ptr + SZ_128K; ttb = (void *)((free_mem_ptr - 0x4000) & ~0x3fff); @@ -33,11 +33,12 @@ static void barebox_uncompress(void *compressed_start, unsigned int len) pbl_barebox_uncompress((void*)TEXT_BASE, compressed_start, len); } -void __section(.text_entry) pbl_main_entry(void *fdt, void *fdt_end) +void __section(.text_entry) pbl_main_entry(void *fdt, void *fdt_end, + u32 ram_size) { u32 pg_start, pg_end, pg_len, fdt_len; void *fdt_new; - void (*barebox)(void *fdt, u32 fdt_len); + void (*barebox)(void *fdt, u32 fdt_len, u32 ram_size); puts_ll("pbl_main_entry()\n"); @@ -51,9 +52,9 @@ void __section(.text_entry) pbl_main_entry(void *fdt, void *fdt_end) barebox_uncompress(&input_data, pg_len); fdt_len = (u32)fdt_end - (u32)fdt; - fdt_new = (void *)PAGE_ALIGN_DOWN(STACK_BASE - fdt_len); + fdt_new = (void *)PAGE_ALIGN_DOWN(TEXT_BASE - MALLOC_SIZE - STACK_SIZE - fdt_len); memcpy(fdt_new, fdt, fdt_len); barebox = (void *)TEXT_BASE; - barebox(fdt_new, fdt_len); + barebox(fdt_new, fdt_len, ram_size); } diff --git a/arch/mips/boot/main_entry.c b/arch/mips/boot/main_entry.c index 84325da93a..5b88730b07 100644 --- a/arch/mips/boot/main_entry.c +++ b/arch/mips/boot/main_entry.c @@ -12,6 +12,7 @@ #include <asm/cpu-features.h> #include <asm/mipsregs.h> #include <asm/addrspace.h> +#include <linux/sizes.h> extern void handle_reserved(void); @@ -61,6 +62,7 @@ static void trap_init(void) extern void *glob_fdt; extern u32 glob_fdt_size; +extern unsigned long mips_stack_top; /** * Called plainly from assembler code @@ -69,6 +71,7 @@ extern u32 glob_fdt_size; */ void __bare_init main_entry(void *fdt, u32 fdt_size) { + unsigned long malloc_start, malloc_end; /* clear the BSS first */ memset(__bss_start, 0x00, __bss_stop - __bss_start); @@ -82,8 +85,18 @@ void __bare_init main_entry(void *fdt, u32 fdt_size) trap_init(); - mem_malloc_init((void *)MALLOC_BASE, - (void *)(MALLOC_BASE + MALLOC_SIZE - 1)); + malloc_end = _stext; + + if (MALLOC_SIZE > 0) + malloc_start = malloc_end - MALLOC_SIZE; + else + malloc_start = malloc_end - SZ_8M; + + pr_debug("initializing malloc pool at 0x%08lx (size 0x%08lx)\n", + malloc_start, malloc_end - malloc_start); + + mem_malloc_init((void *)malloc_start, (void *)_stext - 1); + mips_stack_top = malloc_start; glob_fdt = fdt; glob_fdt_size = fdt_size; diff --git a/arch/mips/boot/start.S b/arch/mips/boot/start.S index 6efe03e98d..c1cd2d9dd5 100644 --- a/arch/mips/boot/start.S +++ b/arch/mips/boot/start.S @@ -18,6 +18,7 @@ EXPORT(_start) /* save dtb pointer */ move s0, a0 move s1, a1 + move s2, a2 /* disable watchpoints */ mtc0 zero, CP0_WATCHLO @@ -32,7 +33,8 @@ EXPORT(_start) /* restore dtb pointer */ move a0, s0 move a1, s1 - la v0, main_entry + move a2, s2 + la v0, relocate_code jal v0 nop |