m68k: add malloc memory for early malloc
PATCH v3 1/2 m68k: add malloc memory for early malloc
To use serial uclass and DM, CONFIG_SYS_MALLOC_F must be used. So CONFIG_SYS_GENERIC_GLOBAL_DATA has been undefined and call to board_init_f_mem() is added for all cpu's.
---
Changes for v2:
- none
Changes for v3:
- fix start.S using new board_init_f_alloc_reserve
--- arch/m68k/cpu/mcf5227x/start.S | 16 ++++++++++++++++ arch/m68k/cpu/mcf523x/start.S | 16 ++++++++++++++++ arch/m68k/cpu/mcf52x2/start.S | 16 ++++++++++++++++ arch/m68k/cpu/mcf530x/cpu_init.c | 2 +- arch/m68k/cpu/mcf530x/start.S | 16 ++++++++++++++++ arch/m68k/cpu/mcf532x/start.S | 16 ++++++++++++++++ arch/m68k/cpu/mcf5445x/start.S | 16 ++++++++++++++++ arch/m68k/cpu/mcf547x_8x/start.S | 16 ++++++++++++++++ 8 files changed, 113 insertions(+), 1 deletion(-)
arch/m68k/cpu/mcf5227x/start.S +16 -0
@@ -379,6 +379,22 @@ _start: move.l #__got_start, %a5 /* put relocation table address to a5 */ +#if defined(CONFIG_SYS_MALLOC_F) + move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE), %sp + + /* allocate reserved area from current top of stack */ + move.l %sp, -(%sp) + bsr board_init_f_alloc_reserve + + /* update stack and frame-pointers */ + move.l %d0, %sp + move.l %sp, %fp + + /* initialize reserved area */ + move.l %d0, -(%sp) + bsr board_init_f_init_reserve +#endif + bsr cpu_init_f /* run low-level CPU init code (from flash) */ bsr board_init_f /* run low-level board init code (from flash) */
arch/m68k/cpu/mcf523x/start.S +16 -0
@@ -141,6 +141,22 @@ _start: move.l #__got_start, %a5 /* put relocation table address to a5 */ +#if defined(CONFIG_SYS_MALLOC_F) + move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE), %sp + + /* allocate reserved area from current top of stack */ + move.l %sp, -(%sp) + bsr board_init_f_alloc_reserve + + /* update stack and frame-pointers */ + move.l %d0, %sp + move.l %sp, %fp + + /* initialize reserved area */ + move.l %d0, -(%sp) + bsr board_init_f_init_reserve +#endif + /* run low-level CPU init code (from flash) */ move.l #cpu_init_f, %a1 jsr (%a1)
arch/m68k/cpu/mcf52x2/start.S +16 -0
@@ -198,6 +198,22 @@ _after_flashbar_copy: move.l #__got_start, %a5 /* put relocation table address to a5 */ +#if defined(CONFIG_SYS_MALLOC_F) + move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE), %sp + + /* allocate reserved area from current top of stack */ + move.l %sp, -(%sp) + bsr board_init_f_alloc_reserve + + /* update stack and frame-pointers */ + move.l %d0, %sp + move.l %sp, %fp + + /* initialize reserved area */ + move.l %d0, -(%sp) + bsr board_init_f_init_reserve +#endif + /* run low-level CPU init code (from flash) */ move.l #cpu_init_f, %a1 jsr (%a1)
arch/m68k/cpu/mcf530x/cpu_init.c +1 -1
@@ -142,7 +142,7 @@ int cpu_init_r(void)return 0 ; } -void uart_port_conf (void ) +void uart_port_conf (int port) { }
arch/m68k/cpu/mcf530x/start.S +16 -0
@@ -137,6 +137,22 @@ _start: /* put relocation table address to a5 */ move.l #__got_start, %a5 +#if defined(CONFIG_SYS_MALLOC_F) + move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE), %sp + + /* allocate reserved area from current top of stack */ + move.l %sp, -(%sp) + bsr board_init_f_alloc_reserve + + /* update stack and frame-pointers */ + move.l %d0, %sp + move.l %sp, %fp + + /* initialize reserved area */ + move.l %d0, -(%sp) + bsr board_init_f_init_reserve +#endif + /* run low-level CPU init code (from flash) */ bsr cpu_init_f
arch/m68k/cpu/mcf532x/start.S +16 -0
@@ -155,6 +155,22 @@ _start: move.l #__got_start, %a5 /* put relocation table address to a5 */ +#if defined(CONFIG_SYS_MALLOC_F) + move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE), %sp + + /* allocate reserved area from current top of stack */ + move.l %sp, -(%sp) + bsr board_init_f_alloc_reserve + + /* update stack and frame-pointers */ + move.l %d0, %sp + move.l %sp, %fp + + /* initialize reserved area */ + move.l %d0, -(%sp) + bsr board_init_f_init_reserve +#endif + /* run low-level CPU init code (from flash) */ move.l #cpu_init_f, %a1 jsr (%a1)
arch/m68k/cpu/mcf5445x/start.S +16 -0
@@ -664,6 +664,22 @@ _start: move.l #__got_start, %a5 /* put relocation table address to a5 */ +#if defined(CONFIG_SYS_MALLOC_F) + move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE), %sp + + /* allocate reserved area from current top of stack */ + move.l %sp, -(%sp) + bsr board_init_f_alloc_reserve + + /* update stack and frame-pointers */ + move.l %d0, %sp + move.l %sp, %fp + + /* initialize reserved area */ + move.l %d0, -(%sp) + bsr board_init_f_init_reserve +#endif + /* run low-level CPU init code (from flash) */ move.l #cpu_init_f, %a1 jsr (%a1)
arch/m68k/cpu/mcf547x_8x/start.S +16 -0
@@ -148,6 +148,22 @@ _start: move.l #__got_start, %a5 /* put relocation table address to a5 */ +#if defined(CONFIG_SYS_MALLOC_F) + move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE), %sp + + /* allocate reserved area from current top of stack */ + move.l %sp, -(%sp) + bsr board_init_f_alloc_reserve + + /* update stack and frame-pointers */ + move.l %d0, %sp + move.l %sp, %fp + + /* initialize reserved area */ + move.l %d0, -(%sp) + bsr board_init_f_init_reserve +#endif + jbsr cpu_init_f /* run low-level CPU init code (from flash) */ jbsr board_init_f /* run low-level board init code (from flash) */
Signature · 1 line
2.7.0.rc3
PATCH v3 1/2 m68k: add malloc memory for early malloc
Hi Simon,
noticed just after sending the patch an issue with my tests, please freeze the patch, there are possible issues in it.
Will confirm this v3 in case after re-testing or will issue a v4.
thanks,
regards,
Angelo Dureghello
Quoted 225 lines · Angelo Dureghello
To use serial uclass and DM,
CONFIG_SYS_MALLOC_Fmust be used. SoCONFIG_SYS_GENERIC_GLOBAL_DATAhas been undefined and call toboard_init_f_mem()is added for all cpu's.Signed-off-by Angelo Dureghello <[email protected]>---
Changes for v2:
- none
Changes for v3:
- fixstart.Susing newboard_init_f_alloc_reserve--- arch/m68k/cpu/mcf5227x/start.S | 16 ++++++++++++++++ arch/m68k/cpu/mcf523x/start.S | 16 ++++++++++++++++ arch/m68k/cpu/mcf52x2/start.S | 16 ++++++++++++++++ arch/m68k/cpu/mcf530x/cpu_init.c | 2 +- arch/m68k/cpu/mcf530x/start.S | 16 ++++++++++++++++ arch/m68k/cpu/mcf532x/start.S | 16 ++++++++++++++++ arch/m68k/cpu/mcf5445x/start.S | 16 ++++++++++++++++ arch/m68k/cpu/mcf547x_8x/start.S | 16 ++++++++++++++++ 8 files changed, 113 insertions(+), 1 deletion(-)arch/m68k/cpu/mcf5227x/start.S +16
-0@@ -379,6 +379,22 @@ _start: move.l #__got_start, %a5 /* put relocation table address to a5 */ +#if defined(CONFIG_SYS_MALLOC_F) + move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE), %sp + + /* allocate reserved area from current top of stack */ + move.l %sp, -(%sp) + bsr board_init_f_alloc_reserve + + /* update stack and frame-pointers */ + move.l %d0, %sp + move.l %sp, %fp + + /* initialize reserved area */ + move.l %d0, -(%sp) + bsr board_init_f_init_reserve +#endif + bsr cpu_init_f /* run low-level CPU init code (from flash) */ bsr board_init_f /* run low-level board init code (from flash) */arch/m68k/cpu/mcf523x/start.S +16
-0@@ -141,6 +141,22 @@ _start: move.l #__got_start, %a5 /* put relocation table address to a5 */ +#if defined(CONFIG_SYS_MALLOC_F) + move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE), %sp + + /* allocate reserved area from current top of stack */ + move.l %sp, -(%sp) + bsr board_init_f_alloc_reserve + + /* update stack and frame-pointers */ + move.l %d0, %sp + move.l %sp, %fp + + /* initialize reserved area */ + move.l %d0, -(%sp) + bsr board_init_f_init_reserve +#endif + /* run low-level CPU init code (from flash) */ move.l #cpu_init_f, %a1 jsr (%a1)arch/m68k/cpu/mcf52x2/start.S +16
-0@@ -198,6 +198,22 @@ _after_flashbar_copy: move.l #__got_start, %a5 /* put relocation table address to a5 */ +#if defined(CONFIG_SYS_MALLOC_F) + move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE), %sp + + /* allocate reserved area from current top of stack */ + move.l %sp, -(%sp) + bsr board_init_f_alloc_reserve + + /* update stack and frame-pointers */ + move.l %d0, %sp + move.l %sp, %fp + + /* initialize reserved area */ + move.l %d0, -(%sp) + bsr board_init_f_init_reserve +#endif + /* run low-level CPU init code (from flash) */ move.l #cpu_init_f, %a1 jsr (%a1)arch/m68k/cpu/mcf530x/cpu_init.c +1
-1@@ -142,7 +142,7 @@ int cpu_init_r(void)return 0 ; } -void uart_port_conf (void ) +void uart_port_conf (int port) { }arch/m68k/cpu/mcf530x/start.S +16
-0@@ -137,6 +137,22 @@ _start: /* put relocation table address to a5 */ move.l #__got_start, %a5 +#if defined(CONFIG_SYS_MALLOC_F) + move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE), %sp + + /* allocate reserved area from current top of stack */ + move.l %sp, -(%sp) + bsr board_init_f_alloc_reserve + + /* update stack and frame-pointers */ + move.l %d0, %sp + move.l %sp, %fp + + /* initialize reserved area */ + move.l %d0, -(%sp) + bsr board_init_f_init_reserve +#endif + /* run low-level CPU init code (from flash) */ bsr cpu_init_farch/m68k/cpu/mcf532x/start.S +16
-0@@ -155,6 +155,22 @@ _start: move.l #__got_start, %a5 /* put relocation table address to a5 */ +#if defined(CONFIG_SYS_MALLOC_F) + move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE), %sp + + /* allocate reserved area from current top of stack */ + move.l %sp, -(%sp) + bsr board_init_f_alloc_reserve + + /* update stack and frame-pointers */ + move.l %d0, %sp + move.l %sp, %fp + + /* initialize reserved area */ + move.l %d0, -(%sp) + bsr board_init_f_init_reserve +#endif + /* run low-level CPU init code (from flash) */ move.l #cpu_init_f, %a1 jsr (%a1)arch/m68k/cpu/mcf5445x/start.S +16
-0@@ -664,6 +664,22 @@ _start: move.l #__got_start, %a5 /* put relocation table address to a5 */ +#if defined(CONFIG_SYS_MALLOC_F) + move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE), %sp + + /* allocate reserved area from current top of stack */ + move.l %sp, -(%sp) + bsr board_init_f_alloc_reserve + + /* update stack and frame-pointers */ + move.l %d0, %sp + move.l %sp, %fp + + /* initialize reserved area */ + move.l %d0, -(%sp) + bsr board_init_f_init_reserve +#endif + /* run low-level CPU init code (from flash) */ move.l #cpu_init_f, %a1 jsr (%a1)arch/m68k/cpu/mcf547x_8x/start.S +16
-0@@ -148,6 +148,22 @@ _start: move.l #__got_start, %a5 /* put relocation table address to a5 */ +#if defined(CONFIG_SYS_MALLOC_F) + move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE), %sp + + /* allocate reserved area from current top of stack */ + move.l %sp, -(%sp) + bsr board_init_f_alloc_reserve + + /* update stack and frame-pointers */ + move.l %d0, %sp + move.l %sp, %fp + + /* initialize reserved area */ + move.l %d0, -(%sp) + bsr board_init_f_init_reserve +#endif + jbsr cpu_init_f /* run low-level CPU init code (from flash) */ jbsr board_init_f /* run low-level board init code (from flash) */