common: board_f: Print information for all sysresets
[platform/kernel/u-boot.git] / common / board_r.c
index 7d0281f..92ca206 100644 (file)
 #include <api.h>
 #include <bootstage.h>
 #include <cpu_func.h>
+#include <cyclic.h>
+#include <display_options.h>
 #include <exports.h>
+#ifdef CONFIG_MTD_NOR_FLASH
 #include <flash.h>
+#endif
 #include <hang.h>
 #include <image.h>
 #include <irq_func.h>
@@ -61,6 +65,7 @@
 #include <wdt.h>
 #include <asm-generic/gpio.h>
 #include <efi_loader.h>
+#include <relocate.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -120,7 +125,7 @@ static int initr_reloc_global_data(void)
 {
 #ifdef __ARM__
        monitor_flash_len = _end - __image_copy_start;
-#elif defined(CONFIG_NDS32) || defined(CONFIG_RISCV)
+#elif defined(CONFIG_RISCV)
        monitor_flash_len = (ulong)&_end - (ulong)&_start;
 #elif !defined(CONFIG_SANDBOX) && !defined(CONFIG_NIOS2)
        monitor_flash_len = (ulong)&__init_end - gd->relocaddr;
@@ -146,13 +151,13 @@ static int initr_reloc_global_data(void)
         */
        gd->env_addr += gd->reloc_off;
 #endif
-#ifdef CONFIG_OF_EMBED
        /*
         * The fdt_blob needs to be moved to new relocation address
         * incase of FDT blob is embedded with in image
         */
-       gd->fdt_blob += gd->reloc_off;
-#endif
+       if (CONFIG_IS_ENABLED(OF_EMBED) && CONFIG_IS_ENABLED(NEEDS_MANUAL_RELOC))
+               gd->fdt_blob += gd->reloc_off;
+
 #ifdef CONFIG_EFI_LOADER
        /*
         * On the ARM architecture gd is mapped to a fixed register (r9 or x18).
@@ -229,6 +234,8 @@ static int initr_dm(void)
 {
        int ret;
 
+       oftree_reset();
+
        /* Save the pre-reloc driver model and start a new one */
        gd->dm_root_f = gd->dm_root;
        gd->dm_root = NULL;
@@ -336,7 +343,7 @@ static int initr_flash(void)
        /*
         * Compute and print flash CRC if flashchecksum is set to 'y'
         *
-        * NOTE: Maybe we should add some WATCHDOG_RESET()? XXX
+        * NOTE: Maybe we should add some schedule()? XXX
         */
        if (env_get_yesno("flashchecksum") == 1) {
                const uchar *flash_base = (const uchar *)CONFIG_SYS_FLASH_BASE;
@@ -456,7 +463,7 @@ static int initr_env(void)
        return 0;
 }
 
-#ifdef CONFIG_SYS_BOOTPARAMS_LEN
+#ifdef CONFIG_SYS_MALLOC_BOOTPARAMS
 static int initr_malloc_bootparams(void)
 {
        gd->bd->bi_boot_params = (ulong)malloc(CONFIG_SYS_BOOTPARAMS_LEN);
@@ -468,18 +475,6 @@ static int initr_malloc_bootparams(void)
 }
 #endif
 
-#ifdef CONFIG_CMD_NET
-static int initr_ethaddr(void)
-{
-       struct bd_info *bd = gd->bd;
-
-       /* kept around for legacy kernels only ... ignore the next section */
-       eth_env_get_enetaddr("ethaddr", bd->bi_enetaddr);
-
-       return 0;
-}
-#endif /* CONFIG_CMD_NET */
-
 #if defined(CONFIG_LED_STATUS)
 static int initr_status_led(void)
 {
@@ -611,11 +606,15 @@ static init_fnc_t init_sequence_r[] = {
         */
 #endif
        initr_reloc_global_data,
+#if CONFIG_IS_ENABLED(NEEDS_MANUAL_RELOC) && CONFIG_IS_ENABLED(EVENT)
+       event_manual_reloc,
+#endif
 #if defined(CONFIG_SYS_INIT_RAM_LOCK) && defined(CONFIG_E500)
        initr_unlock_ram_in_cache,
 #endif
        initr_barrier,
        initr_malloc,
+       cyclic_init,
        log_init,
        initr_bootstage,        /* Needs malloc() but has its own timer */
 #if defined(CONFIG_CONSOLE_RECORD)
@@ -631,8 +630,7 @@ static init_fnc_t init_sequence_r[] = {
 #ifdef CONFIG_ADDR_MAP
        init_addr_map,
 #endif
-#if defined(CONFIG_ARM) || defined(CONFIG_NDS32) || defined(CONFIG_RISCV) || \
-       defined(CONFIG_SANDBOX)
+#if defined(CONFIG_ARM) || defined(CONFIG_RISCV) || defined(CONFIG_SANDBOX)
        board_init,     /* Setup chipselects */
 #endif
        /*
@@ -694,6 +692,9 @@ static init_fnc_t init_sequence_r[] = {
        /* initialize higher level parts of CPU like time base and timers */
        cpu_init_r,
 #endif
+#ifdef CONFIG_EFI_SETUP_EARLY
+       efi_init_early,
+#endif
 #ifdef CONFIG_CMD_NAND
        initr_nand,
 #endif
@@ -710,7 +711,7 @@ static init_fnc_t init_sequence_r[] = {
        initr_pvblock,
 #endif
        initr_env,
-#ifdef CONFIG_SYS_BOOTPARAMS_LEN
+#ifdef CONFIG_SYS_MALLOC_BOOTPARAMS
        initr_malloc_bootparams,
 #endif
        INIT_FUNC_WATCHDOG_RESET
@@ -753,9 +754,6 @@ static init_fnc_t init_sequence_r[] = {
        initr_status_led,
 #endif
        /* PPC has a udelay(20) here dating from 2002. Why? */
-#ifdef CONFIG_CMD_NET
-       initr_ethaddr,
-#endif
 #if defined(CONFIG_GPIO_HOG)
        gpio_hog_probe_all,
 #endif
@@ -794,9 +792,6 @@ static init_fnc_t init_sequence_r[] = {
 #if defined(CONFIG_PRAM)
        initr_mem,
 #endif
-#ifdef CONFIG_EFI_SETUP_EARLY
-       efi_init_early,
-#endif
        run_main_loop,
 };
 
@@ -811,19 +806,15 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
        if (CONFIG_IS_ENABLED(X86_64) && !IS_ENABLED(CONFIG_EFI_APP))
                arch_setup_gd(new_gd);
 
-#ifdef CONFIG_NEEDS_MANUAL_RELOC
-       int i;
-#endif
-
 #if !defined(CONFIG_X86) && !defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
        gd = new_gd;
 #endif
        gd->flags &= ~GD_FLG_LOG_READY;
 
-#ifdef CONFIG_NEEDS_MANUAL_RELOC
-       for (i = 0; i < ARRAY_SIZE(init_sequence_r); i++)
-               init_sequence_r[i] += gd->reloc_off;
-#endif
+       if (IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC)) {
+               for (int i = 0; i < ARRAY_SIZE(init_sequence_r); i++)
+                       MANUAL_RELOC(init_sequence_r[i]);
+       }
 
        if (initcall_run_list(init_sequence_r))
                hang();