X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=common%2Fboard_f.c;h=afafec5e4d02657926f164f7a06abaf76914e851;hb=208ecbad2ea83333e8f3c9933213867addf16f4a;hp=7f594d9eaf9d54634ce1797218659f42a3b4d24c;hpb=fb4413295c765aa8c013650984dc2d908964c81d;p=platform%2Fkernel%2Fu-boot.git diff --git a/common/board_f.c b/common/board_f.c index 7f594d9..afafec5 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (c) 2011 The Chromium OS Authors. * (C) Copyright 2002-2006 @@ -6,19 +7,16 @@ * (C) Copyright 2002 * Sysgo Real-Time Solutions, GmbH * Marius Groeger - * - * SPDX-License-Identifier: GPL-2.0+ */ #include #include -#include #include +#include #include #include #include #include -#include #include #include #include @@ -26,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -49,7 +48,7 @@ #ifdef XTRN_DECLARE_GLOBAL_DATA_PTR #undef XTRN_DECLARE_GLOBAL_DATA_PTR #define XTRN_DECLARE_GLOBAL_DATA_PTR /* empty = allocate here */ -DECLARE_GLOBAL_DATA_PTR = (gd_t *) (CONFIG_SYS_INIT_GD_ADDR); +DECLARE_GLOBAL_DATA_PTR = (gd_t *)(CONFIG_SYS_INIT_GD_ADDR); #else DECLARE_GLOBAL_DATA_PTR; #endif @@ -136,12 +135,36 @@ static int display_text_info(void) #endif debug("U-Boot code: %08lX -> %08lX BSS: -> %08lX\n", - text_base, bss_start, bss_end); + text_base, bss_start, bss_end); #endif return 0; } +#ifdef CONFIG_SYSRESET +static int print_resetinfo(void) +{ + struct udevice *dev; + char status[256]; + int ret; + + ret = uclass_first_device_err(UCLASS_SYSRESET, &dev); + if (ret) { + debug("%s: No sysreset device found (error: %d)\n", + __func__, ret); + /* Not all boards have sysreset drivers available during early + * boot, so don't fail if one can't be found. + */ + return 0; + } + + if (!sysreset_get_status(dev, status, sizeof(status))) + printf("%s", status); + + return 0; +} +#endif + static int announce_dram_init(void) { puts("DRAM: "); @@ -283,9 +306,9 @@ static int setup_dest_addr(void) gd->ram_size -= CONFIG_SYS_MEM_TOP_HIDE; #endif #ifdef CONFIG_SYS_SDRAM_BASE - gd->ram_top = CONFIG_SYS_SDRAM_BASE; + gd->ram_base = CONFIG_SYS_SDRAM_BASE; #endif - gd->ram_top += get_effective_memsize(); + gd->ram_top = gd->ram_base + get_effective_memsize(); gd->ram_top = board_get_usable_ram_top(gd->mon_len); gd->relocaddr = gd->ram_top; debug("Ram top: %08lX\n", (ulong)gd->ram_top); @@ -396,19 +419,21 @@ static int reserve_trace(void) static int reserve_uboot(void) { - /* - * reserve memory for U-Boot code, data & bss - * round down to next 4 kB limit - */ - gd->relocaddr -= gd->mon_len; - gd->relocaddr &= ~(4096 - 1); -#if defined(CONFIG_E500) || defined(CONFIG_MIPS) - /* round down to next 64 kB limit so that IVPR stays aligned */ - gd->relocaddr &= ~(65536 - 1); -#endif - - debug("Reserving %ldk for U-Boot at: %08lx\n", gd->mon_len >> 10, - gd->relocaddr); + if (!(gd->flags & GD_FLG_SKIP_RELOC)) { + /* + * reserve memory for U-Boot code, data & bss + * round down to next 4 kB limit + */ + gd->relocaddr -= gd->mon_len; + gd->relocaddr &= ~(4096 - 1); + #if defined(CONFIG_E500) || defined(CONFIG_MIPS) + /* round down to next 64 kB limit so that IVPR stays aligned */ + gd->relocaddr &= ~(65536 - 1); + #endif + + debug("Reserving %ldk for U-Boot at: %08lx\n", + gd->mon_len >> 10, gd->relocaddr); + } gd->start_addr_sp = gd->relocaddr; @@ -420,7 +445,7 @@ static int reserve_malloc(void) { gd->start_addr_sp = gd->start_addr_sp - TOTAL_MALLOC_LEN; debug("Reserving %dk for malloc() at: %08lx\n", - TOTAL_MALLOC_LEN >> 10, gd->start_addr_sp); + TOTAL_MALLOC_LEN >> 10, gd->start_addr_sp); return 0; } @@ -450,7 +475,7 @@ static int reserve_global_data(void) gd->start_addr_sp -= sizeof(gd_t); gd->new_gd = (gd_t *)map_sysmem(gd->start_addr_sp, sizeof(gd_t)); debug("Reserving %zu Bytes for Global Data at: %08lx\n", - sizeof(gd_t), gd->start_addr_sp); + sizeof(gd_t), gd->start_addr_sp); return 0; } @@ -489,7 +514,7 @@ static int reserve_bootstage(void) return 0; } -int arch_reserve_stacks(void) +__weak int arch_reserve_stacks(void) { return 0; } @@ -787,10 +812,12 @@ static const init_fnc_t init_sequence_f[] = { console_init_f, /* stage 1 init of console */ display_options, /* say that we are here */ display_text_info, /* show debugging info if required */ -#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_SH) || \ - defined(CONFIG_X86) +#if defined(CONFIG_PPC) || defined(CONFIG_SH) || defined(CONFIG_X86) checkcpu, #endif +#if defined(CONFIG_SYSRESET) + print_resetinfo, +#endif #if defined(CONFIG_DISPLAY_CPUINFO) print_cpuinfo, /* display cpu info (and speed) */ #endif @@ -902,7 +929,8 @@ void board_init_f(ulong boot_flags) hang(); #if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX) && \ - !defined(CONFIG_EFI_APP) && !CONFIG_IS_ENABLED(X86_64) + !defined(CONFIG_EFI_APP) && !CONFIG_IS_ENABLED(X86_64) && \ + !defined(CONFIG_ARC) /* NOTREACHED - jump_to_copy() does not return */ hang(); #endif