From 25fc664f408e2e78623d03071884bafc62251553 Mon Sep 17 00:00:00 2001 From: Daniel Schwierzeck Date: Wed, 14 Jan 2015 21:44:13 +0100 Subject: MIPS: bootm: refactor preparation of Linux kernel command line Move preparation of Linux kernel command line in a separate function and mark it as legacy. Add a Kconfig option to make that legacy mode configurable. Signed-off-by: Daniel Schwierzeck --- arch/mips/Kconfig | 13 +++++++++++++ arch/mips/lib/bootm.c | 16 ++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) (limited to 'arch') diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 4991da2226..a5d5a336d3 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -116,6 +116,19 @@ config CPU_MIPS64_R2 endchoice +menu "OS boot interface" + +config MIPS_BOOT_CMDLINE_LEGACY + bool "Hand over legacy command line to Linux kernel" + default y + help + Enable this option if you want U-Boot to hand over the Yamon-style + command line to the kernel. All bootargs will be prepared as argc/argv + compatible list. The argument count (argc) is stored in register $a0. + The address of the argument list (argv) is stored in register $a1. + +endmenu + config SUPPORTS_BIG_ENDIAN bool diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index e0722d20d1..a028a47ab9 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c @@ -20,6 +20,12 @@ DECLARE_GLOBAL_DATA_PTR; #define mips_boot_malta 0 #endif +#if defined(CONFIG_MIPS_BOOT_CMDLINE_LEGACY) +#define mips_boot_cmdline_legacy 1 +#else +#define mips_boot_cmdline_legacy 0 +#endif + static int linux_argc; static char **linux_argv; static char *linux_argp; @@ -92,7 +98,7 @@ static void linux_cmdline_dump(void) debug(" arg %03d: %s\n", i, linux_argv[i]); } -static void boot_cmdline_linux(bootm_headers_t *images) +static void linux_cmdline_legacy(bootm_headers_t *images) { const char *bootargs, *next, *quote; @@ -130,8 +136,14 @@ static void boot_cmdline_linux(bootm_headers_t *images) bootargs = next; } +} - linux_cmdline_dump(); +static void boot_cmdline_linux(bootm_headers_t *images) +{ + if (mips_boot_cmdline_legacy) { + linux_cmdline_legacy(images); + linux_cmdline_dump(); + } } static void linux_env_init(void) -- cgit v1.2.3 From ca65e5851fb60ae58b46e2ad76a90b39d9c378c3 Mon Sep 17 00:00:00 2001 From: Daniel Schwierzeck Date: Wed, 14 Jan 2015 21:44:13 +0100 Subject: MIPS: bootm: refactor preparation of Linux kernel environment Move preparation of Linux kernel environment in a separate function and mark it as legacy. Add a Kconfig option to make that legacy mode configurable. Signed-off-by: Daniel Schwierzeck --- arch/mips/Kconfig | 9 +++++++++ arch/mips/lib/bootm.c | 14 +++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) (limited to 'arch') diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index a5d5a336d3..9b3ecea377 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -127,6 +127,15 @@ config MIPS_BOOT_CMDLINE_LEGACY compatible list. The argument count (argc) is stored in register $a0. The address of the argument list (argv) is stored in register $a1. +config MIPS_BOOT_ENV_LEGACY + bool "Hand over legacy environment to Linux kernel" + default y + help + Enable this option if you want U-Boot to hand over the Yamon-style + environment to the kernel. Information like memory size, initrd + address and size will be prepared as zero-terminated key/value list. + The address of the enviroment is stored in register $a2. + endmenu config SUPPORTS_BIG_ENDIAN diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index a028a47ab9..fa579b36e4 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c @@ -26,6 +26,12 @@ DECLARE_GLOBAL_DATA_PTR; #define mips_boot_cmdline_legacy 0 #endif +#if defined(CONFIG_MIPS_BOOT_ENV_LEGACY) +#define mips_boot_env_legacy 1 +#else +#define mips_boot_env_legacy 0 +#endif + static int linux_argc; static char **linux_argv; static char *linux_argp; @@ -177,7 +183,7 @@ static void linux_env_set(const char *env_name, const char *env_val) } } -static void boot_prep_linux(bootm_headers_t *images) +static void linux_env_legacy(bootm_headers_t *images) { char env_buf[12]; const char *cp; @@ -225,6 +231,12 @@ static void boot_prep_linux(bootm_headers_t *images) } } +static void boot_prep_linux(bootm_headers_t *images) +{ + if (mips_boot_env_legacy) + linux_env_legacy(images); +} + static void boot_jump_linux(bootm_headers_t *images) { typedef void __noreturn (*kernel_entry_t)(int, ulong, ulong, ulong); -- cgit v1.2.3 From 8cec725ad502c955c2e8088ae1afb4e06ef80cef Mon Sep 17 00:00:00 2001 From: Daniel Schwierzeck Date: Wed, 14 Jan 2015 21:44:13 +0100 Subject: MIPS: bootm: add mem, rd_start and rd_size to kernel command line If the user wants to boot a kernel without legacy environment, information like memory size, initrd address and size should be handed over to the kernel in the command line. Signed-off-by: Daniel Schwierzeck --- arch/mips/lib/bootm.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'arch') diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index fa579b36e4..7a98f15131 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c @@ -144,10 +144,36 @@ static void linux_cmdline_legacy(bootm_headers_t *images) } } +static void linux_cmdline_append(bootm_headers_t *images) +{ + char buf[24]; + ulong mem, rd_start, rd_size; + + /* append mem */ + mem = gd->ram_size >> 20; + sprintf(buf, "mem=%luM", mem); + linux_cmdline_set(buf, strlen(buf)); + + /* append rd_start and rd_size */ + rd_start = images->initrd_start; + rd_size = images->initrd_end - images->initrd_start; + + if (rd_size) { + sprintf(buf, "rd_start=0x%08lX", rd_start); + linux_cmdline_set(buf, strlen(buf)); + sprintf(buf, "rd_size=0x%lX", rd_size); + linux_cmdline_set(buf, strlen(buf)); + } +} + static void boot_cmdline_linux(bootm_headers_t *images) { if (mips_boot_cmdline_legacy) { linux_cmdline_legacy(images); + + if (!mips_boot_env_legacy) + linux_cmdline_append(images); + linux_cmdline_dump(); } } -- cgit v1.2.3 From 5002d8cc54f5be2230c4ccf60448e8720444671c Mon Sep 17 00:00:00 2001 From: Daniel Schwierzeck Date: Wed, 14 Jan 2015 21:44:13 +0100 Subject: MIPS: bootm: prepare a flattened device tree for the kernel Add the initial code to prepare a flattened device tree for the kernel like relocating the FDT blob and fixing up the /chosen and /memory nodes. The final hand over to the kernel is not yet implemented. After the community agreed on the MIPS boot interface for device trees, the corresponding code will be added. Signed-off-by: Daniel Schwierzeck --- arch/mips/Kconfig | 11 +++++++++++ arch/mips/lib/bootm.c | 38 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 47 insertions(+), 2 deletions(-) (limited to 'arch') diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 9b3ecea377..363f5ac818 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -136,6 +136,17 @@ config MIPS_BOOT_ENV_LEGACY address and size will be prepared as zero-terminated key/value list. The address of the enviroment is stored in register $a2. +config MIPS_BOOT_FDT + bool "Hand over a flattened device tree to Linux kernel (INCOMPLETE)" + default n + help + Enable this option if you want U-Boot to hand over a flattened + device tree to the kernel. + + Note: the final hand over to the kernel is not yet implemented. After + the community agreed on the MIPS boot interface for device trees, + the corresponding code will be added. + endmenu config SUPPORTS_BIG_ENDIAN diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index 7a98f15131..426f68a990 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c @@ -7,6 +7,7 @@ #include #include +#include #include DECLARE_GLOBAL_DATA_PTR; @@ -72,9 +73,39 @@ static int boot_setup_linux(bootm_headers_t *images) if (ret) return ret; +#if defined(CONFIG_MIPS_BOOT_FDT) && defined(CONFIG_OF_LIBFDT) + if (images->ft_len) { + boot_fdt_add_mem_rsv_regions(&images->lmb, images->ft_addr); + + ret = boot_relocate_fdt(&images->lmb, &images->ft_addr, + &images->ft_len); + if (ret) + return ret; + } +#endif + return 0; } +static void boot_setup_fdt(bootm_headers_t *images) +{ +#if defined(CONFIG_MIPS_BOOT_FDT) && defined(CONFIG_OF_LIBFDT) + u64 mem_start = 0; + u64 mem_size = gd->ram_size; + + debug("## setup FDT\n"); + + fdt_chosen(images->ft_addr, 1); + fdt_fixup_memory_banks(images->ft_addr, &mem_start, &mem_size, 1); + fdt_fixup_ethernet(images->ft_addr); + fdt_initrd(images->ft_addr, images->initrd_start, images->initrd_end, 1); + +#if defined(CONFIG_OF_BOARD_SETUP) + ft_board_setup(images->ft_addr, gd->bd); +#endif +#endif +} + static void linux_cmdline_init(void) { linux_argc = 1; @@ -168,7 +199,7 @@ static void linux_cmdline_append(bootm_headers_t *images) static void boot_cmdline_linux(bootm_headers_t *images) { - if (mips_boot_cmdline_legacy) { + if (mips_boot_cmdline_legacy && !images->ft_len) { linux_cmdline_legacy(images); if (!mips_boot_env_legacy) @@ -259,8 +290,11 @@ static void linux_env_legacy(bootm_headers_t *images) static void boot_prep_linux(bootm_headers_t *images) { - if (mips_boot_env_legacy) + if (mips_boot_env_legacy && !images->ft_len) linux_env_legacy(images); + + if (images->ft_len) + boot_setup_fdt(images); } static void boot_jump_linux(bootm_headers_t *images) -- cgit v1.2.3 From e13a50b34bdda624571b4bd49722f38327c02d6a Mon Sep 17 00:00:00 2001 From: Daniel Schwierzeck Date: Wed, 14 Jan 2015 21:44:13 +0100 Subject: MIPS: bootm: add bootstage reporting Signed-off-by: Daniel Schwierzeck --- arch/mips/lib/bootm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'arch') diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index 426f68a990..d9d8396e63 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c @@ -310,8 +310,12 @@ static void boot_jump_linux(bootm_headers_t *images) if (mips_boot_malta) linux_extra = gd->ram_size; - /* we assume that the kernel is in place */ - printf("\nStarting kernel ...\n\n"); +#ifdef CONFIG_BOOTSTAGE_FDT + bootstage_fdt_add_report(); +#endif +#ifdef CONFIG_BOOTSTAGE_REPORT + bootstage_report(); +#endif kernel(linux_argc, (ulong)linux_argv, (ulong)linux_env, linux_extra); } -- cgit v1.2.3 From a18a477147ce2493ef9ee93b8981b34929fc48a5 Mon Sep 17 00:00:00 2001 From: Thomas Langer Date: Wed, 14 Jan 2015 18:44:00 +0000 Subject: MIPS: use common code from lib/time.c The common code just needs the C0_COUNT as free running counter, without the need of writing and checking C0_COMPARE. The function get_tbclk() is still implemented here instead of changing all places of CONFIG_SYS_MIPS_TIMER_FREQ to CONFIG_SYS_TIMER_RATE. The change was tested on a MIPS32 system, but as the MIPS64 code was/is the same, this should be no problem. Signed-off-by: Thomas Langer --- arch/mips/cpu/mips32/time.c | 59 +++------------------------------------------ arch/mips/cpu/mips64/time.c | 59 +++------------------------------------------ 2 files changed, 8 insertions(+), 110 deletions(-) (limited to 'arch') diff --git a/arch/mips/cpu/mips32/time.c b/arch/mips/cpu/mips32/time.c index 386f45a1b0..553da5f4ba 100644 --- a/arch/mips/cpu/mips32/time.c +++ b/arch/mips/cpu/mips32/time.c @@ -8,63 +8,12 @@ #include #include -static unsigned long timestamp; - -/* how many counter cycles in a jiffy */ -#define CYCLES_PER_JIFFY \ - (CONFIG_SYS_MIPS_TIMER_FREQ + CONFIG_SYS_HZ / 2) / CONFIG_SYS_HZ - -/* - * timer without interrupts - */ - -int timer_init(void) -{ - /* Set up the timer for the first expiration. */ - write_c0_compare(read_c0_count() + CYCLES_PER_JIFFY); - - return 0; -} - -ulong get_timer(ulong base) -{ - unsigned int count; - unsigned int expirelo = read_c0_compare(); - - /* Check to see if we have missed any timestamps. */ - count = read_c0_count(); - while ((count - expirelo) < 0x7fffffff) { - expirelo += CYCLES_PER_JIFFY; - timestamp++; - } - write_c0_compare(expirelo); - - return timestamp - base; -} - -void __udelay(unsigned long usec) +unsigned long notrace timer_read_counter(void) { - unsigned int tmo; - - tmo = read_c0_count() + (usec * (CONFIG_SYS_MIPS_TIMER_FREQ / 1000000)); - while ((tmo - read_c0_count()) < 0x7fffffff) - /*NOP*/; + return read_c0_count(); } -/* - * This function is derived from PowerPC code (read timebase as long long). - * On MIPS it just returns the timer value. - */ -unsigned long long get_ticks(void) -{ - return get_timer(0); -} - -/* - * This function is derived from PowerPC code (timebase clock frequency). - * On MIPS it returns the number of timer ticks per second. - */ -ulong get_tbclk(void) +ulong notrace get_tbclk(void) { - return CONFIG_SYS_HZ; + return CONFIG_SYS_MIPS_TIMER_FREQ; } diff --git a/arch/mips/cpu/mips64/time.c b/arch/mips/cpu/mips64/time.c index 0497acf4a1..553da5f4ba 100644 --- a/arch/mips/cpu/mips64/time.c +++ b/arch/mips/cpu/mips64/time.c @@ -8,63 +8,12 @@ #include #include -static unsigned long timestamp; - -/* how many counter cycles in a jiffy */ -#define CYCLES_PER_JIFFY \ - (CONFIG_SYS_MIPS_TIMER_FREQ + CONFIG_SYS_HZ / 2) / CONFIG_SYS_HZ - -/* - * timer without interrupts - */ - -int timer_init(void) -{ - /* Set up the timer for the first expiration. */ - write_c0_compare(read_c0_count() + CYCLES_PER_JIFFY); - - return 0; -} - -ulong get_timer(ulong base) -{ - unsigned int count; - unsigned int expirelo = read_c0_compare(); - - /* Check to see if we have missed any timestamps. */ - count = read_c0_count(); - while ((count - expirelo) < 0x7fffffff) { - expirelo += CYCLES_PER_JIFFY; - timestamp++; - } - write_c0_compare(expirelo); - - return timestamp - base; -} - -void __udelay(unsigned long usec) +unsigned long notrace timer_read_counter(void) { - unsigned int tmo; - - tmo = read_c0_count() + (usec * (CONFIG_SYS_MIPS_TIMER_FREQ / 1000000)); - while ((tmo - read_c0_count()) < 0x7fffffff) - /*NOP*/; + return read_c0_count(); } -/* - * This function is derived from PowerPC code (read timebase as long long). - * On MIPS it just returns the timer value. - */ -unsigned long long get_ticks(void) -{ - return get_timer(0); -} - -/* - * This function is derived from PowerPC code (timebase clock frequency). - * On MIPS it returns the number of timer ticks per second. - */ -ulong get_tbclk(void) +ulong notrace get_tbclk(void) { - return CONFIG_SYS_HZ; + return CONFIG_SYS_MIPS_TIMER_FREQ; } -- cgit v1.2.3 From c57dafb5b413335d397691a3d50ff33c229c272d Mon Sep 17 00:00:00 2001 From: Daniel Schwierzeck Date: Sun, 18 Jan 2015 21:59:35 +0100 Subject: MIPS: replace $(CPU) with Kconfig symbols Conditionally set head-y and lib-y with boolean Kconfig symbols for selected CPU. This deprecates the usage of the $(CPU) variable. Signed-off-by: Daniel Schwierzeck --- arch/mips/Kconfig | 8 ++++++++ arch/mips/Makefile | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'arch') diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 363f5ac818..d87cbb4637 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -167,6 +167,14 @@ config SUPPORTS_CPU_MIPS64_R1 config SUPPORTS_CPU_MIPS64_R2 bool +config CPU_MIPS32 + bool + default y if CPU_MIPS32_R1 || CPU_MIPS32_R2 + +config CPU_MIPS64 + bool + default y if CPU_MIPS64_R1 || CPU_MIPS64_R2 + config 32BIT bool diff --git a/arch/mips/Makefile b/arch/mips/Makefile index 1907b57229..0a9e7e614b 100644 --- a/arch/mips/Makefile +++ b/arch/mips/Makefile @@ -2,7 +2,9 @@ # SPDX-License-Identifier: GPL-2.0+ # -head-y := arch/mips/cpu/$(CPU)/start.o +head-$(CONFIG_CPU_MIPS32) := arch/mips/cpu/mips32/start.o +head-$(CONFIG_CPU_MIPS64) := arch/mips/cpu/mips64/start.o -libs-y += arch/mips/cpu/$(CPU)/ +libs-$(CONFIG_CPU_MIPS32) += arch/mips/cpu/mips32/ +libs-$(CONFIG_CPU_MIPS64) += arch/mips/cpu/mips64/ libs-y += arch/mips/lib/ -- cgit v1.2.3 From 9d638eeab71c506cdb7b085fa1932dad13885c02 Mon Sep 17 00:00:00 2001 From: Daniel Schwierzeck Date: Sun, 18 Jan 2015 22:00:18 +0100 Subject: MIPS: add Kconfig option for CONFIG_SWAP_IO_SPACE Signed-off-by: Daniel Schwierzeck --- arch/mips/Kconfig | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'arch') diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index d87cbb4637..ef7892975a 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -29,6 +29,7 @@ config TARGET_MALTA select SUPPORTS_LITTLE_ENDIAN select SUPPORTS_CPU_MIPS32_R1 select SUPPORTS_CPU_MIPS32_R2 + select SWAP_IO_SPACE config TARGET_VCT bool "Support vct" @@ -181,6 +182,9 @@ config 32BIT config 64BIT bool +config SWAP_IO_SPACE + bool + endif endmenu -- cgit v1.2.3 From dd82128ef5e9fc660862a0a60423aa01a03de5d4 Mon Sep 17 00:00:00 2001 From: Daniel Schwierzeck Date: Sun, 18 Jan 2015 22:18:38 +0100 Subject: MIPS: add support for CONFIG_SYS_INIT_SP_ADDR Support the existing config option CONFIG_SYS_INIT_SP_ADDR on MIPS. This allows to move the initial stack to other places than the beginning of RAM. Signed-off-by: Daniel Schwierzeck --- arch/mips/cpu/mips32/start.S | 7 ++++++- arch/mips/cpu/mips64/start.S | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'arch') diff --git a/arch/mips/cpu/mips32/start.S b/arch/mips/cpu/mips32/start.S index 384ea26022..59468590a9 100644 --- a/arch/mips/cpu/mips32/start.S +++ b/arch/mips/cpu/mips32/start.S @@ -15,6 +15,11 @@ #define CONFIG_SYS_MIPS_CACHE_MODE CONF_CM_CACHABLE_NONCOHERENT #endif +#ifndef CONFIG_SYS_INIT_SP_ADDR +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + \ + CONFIG_SYS_INIT_SP_OFFSET) +#endif + /* * For the moment disable interrupts, mark the kernel mode and * set ST0_KX so that the CPU does not spit fire when using @@ -135,7 +140,7 @@ reset: #endif /* Set up temporary stack */ - li sp, CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_INIT_SP_OFFSET + li sp, CONFIG_SYS_INIT_SP_ADDR move fp, sp la t9, board_init_f diff --git a/arch/mips/cpu/mips64/start.S b/arch/mips/cpu/mips64/start.S index 6ff714e8ed..81df923bc3 100644 --- a/arch/mips/cpu/mips64/start.S +++ b/arch/mips/cpu/mips64/start.S @@ -15,6 +15,11 @@ #define CONFIG_SYS_MIPS_CACHE_MODE CONF_CM_CACHABLE_NONCOHERENT #endif +#ifndef CONFIG_SYS_INIT_SP_ADDR +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + \ + CONFIG_SYS_INIT_SP_OFFSET) +#endif + #ifdef CONFIG_SYS_LITTLE_ENDIAN #define MIPS64_R_INFO(ssym, r_type3, r_type2, r_type) \ (((r_type) << 24) | ((r_type2) << 16) | ((r_type3) << 8) | (ssym)) @@ -129,7 +134,7 @@ reset: #endif /* Set up temporary stack */ - dli sp, CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_INIT_SP_OFFSET + dli sp, CONFIG_SYS_INIT_SP_ADDR move fp, sp dla t9, board_init_f -- cgit v1.2.3 From e520023882c7187a7cbaecfea0726ea158440aef Mon Sep 17 00:00:00 2001 From: Daniel Schwierzeck Date: Sun, 18 Jan 2015 22:18:39 +0100 Subject: MIPS: add support for pre-relocation malloc Implement MIPS specific setup of the gd_t structure to support pre-relocation malloc. If CONFIG_SYS_MALLOC_F_LEN is specified, a memory area will be reserved after the initial stack area and the gd->malloc_base pointer will be initialized. After this patch the new driver model can be used on MIPS. Signed-off-by: Daniel Schwierzeck --- arch/mips/cpu/mips32/start.S | 24 +++++++++++++++++++++++- arch/mips/cpu/mips64/start.S | 24 +++++++++++++++++++++++- arch/mips/include/asm/config.h | 2 -- 3 files changed, 46 insertions(+), 4 deletions(-) (limited to 'arch') diff --git a/arch/mips/cpu/mips32/start.S b/arch/mips/cpu/mips32/start.S index 59468590a9..36b92cc687 100644 --- a/arch/mips/cpu/mips32/start.S +++ b/arch/mips/cpu/mips32/start.S @@ -140,9 +140,31 @@ reset: #endif /* Set up temporary stack */ - li sp, CONFIG_SYS_INIT_SP_ADDR + li t0, -16 + li t1, CONFIG_SYS_INIT_SP_ADDR + and sp, t1, t0 # force 16 byte alignment + sub sp, sp, GD_SIZE # reserve space for gd + and sp, sp, t0 # force 16 byte alignment + move k0, sp # save gd pointer +#ifdef CONFIG_SYS_MALLOC_F_LEN + li t2, CONFIG_SYS_MALLOC_F_LEN + sub sp, sp, t2 # reserve space for early malloc + and sp, sp, t0 # force 16 byte alignment +#endif move fp, sp + /* Clear gd */ + move t0, k0 +1: + sw zero, 0(t0) + blt t0, t1, 1b + addi t0, 4 + +#ifdef CONFIG_SYS_MALLOC_F_LEN + addu t0, k0, GD_MALLOC_BASE # gd->malloc_base offset + sw sp, 0(t0) +#endif + la t9, board_init_f jr t9 move ra, zero diff --git a/arch/mips/cpu/mips64/start.S b/arch/mips/cpu/mips64/start.S index 81df923bc3..471bc1eb66 100644 --- a/arch/mips/cpu/mips64/start.S +++ b/arch/mips/cpu/mips64/start.S @@ -134,9 +134,31 @@ reset: #endif /* Set up temporary stack */ - dli sp, CONFIG_SYS_INIT_SP_ADDR + dli t0, -16 + dli t1, CONFIG_SYS_INIT_SP_ADDR + and sp, t1, t0 # force 16 byte alignment + dsub sp, sp, GD_SIZE # reserve space for gd + and sp, sp, t0 # force 16 byte alignment + move k0, sp # save gd pointer +#ifdef CONFIG_SYS_MALLOC_F_LEN + dli t2, CONFIG_SYS_MALLOC_F_LEN + dsub sp, sp, t2 # reserve space for early malloc + and sp, sp, t0 # force 16 byte alignment +#endif move fp, sp + /* Clear gd */ + move t0, k0 +1: + sw zero, 0(t0) + blt t0, t1, 1b + daddi t0, 4 + +#ifdef CONFIG_SYS_MALLOC_F_LEN + daddu t0, k0, GD_MALLOC_BASE # gd->malloc_base offset + sw sp, 0(t0) +#endif + dla t9, board_init_f jr t9 move ra, zero diff --git a/arch/mips/include/asm/config.h b/arch/mips/include/asm/config.h index 1c8a42bd2f..3a891ba627 100644 --- a/arch/mips/include/asm/config.h +++ b/arch/mips/include/asm/config.h @@ -7,8 +7,6 @@ #ifndef _ASM_CONFIG_H_ #define _ASM_CONFIG_H_ -#define CONFIG_SYS_GENERIC_GLOBAL_DATA - #define CONFIG_LMB #define CONFIG_SYS_BOOT_RAMDISK_HIGH -- cgit v1.2.3