*/
-#include <common.h>
+#include <config.h>
#include <api.h>
#include <bootstage.h>
#include <cpu_func.h>
#ifdef __ARM__
monitor_flash_len = _end - __image_copy_start;
#elif defined(CONFIG_RISCV)
- monitor_flash_len = (ulong)&_end - (ulong)&_start;
+ monitor_flash_len = (ulong)_end - (ulong)_start;
#elif !defined(CONFIG_SANDBOX) && !defined(CONFIG_NIOS2)
- monitor_flash_len = (ulong)&__init_end - gd->relocaddr;
+ monitor_flash_len = (ulong)__init_end - gd->relocaddr;
#endif
#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
/*
*/
gd->env_addr += gd->reloc_off;
#endif
- /*
- * The fdt_blob needs to be moved to new relocation address
- * incase of FDT blob is embedded with in image
- */
- 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).
static int initr_malloc(void)
{
- ulong malloc_start;
+ ulong start;
-#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+#if CONFIG_IS_ENABLED(SYS_MALLOC_F)
debug("Pre-reloc malloc() used %#lx bytes (%ld KB)\n", gd->malloc_ptr,
gd->malloc_ptr / 1024);
#endif
* This value MUST match the value of gd->start_addr_sp in board_f.c:
* reserve_noncached().
*/
- malloc_start = gd->relocaddr - TOTAL_MALLOC_LEN;
- mem_malloc_init((ulong)map_sysmem(malloc_start, TOTAL_MALLOC_LEN),
+ start = gd->relocaddr - TOTAL_MALLOC_LEN;
+ gd_set_malloc_start(start);
+ mem_malloc_init((ulong)map_sysmem(start, TOTAL_MALLOC_LEN),
TOTAL_MALLOC_LEN);
return 0;
}
return 0;
}
-#ifdef CONFIG_NEEDS_MANUAL_RELOC
-static int initr_manual_reloc_cmdtable(void)
-{
- fixup_cmdtable(ll_entry_start(struct cmd_tbl, cmd),
- ll_entry_count(struct cmd_tbl, cmd));
- return 0;
-}
-#endif
-
static int initr_binman(void)
{
int ret;
* NOTE: Maybe we should add some schedule()? XXX
*/
if (env_get_yesno("flashchecksum") == 1) {
- const uchar *flash_base = (const uchar *)CONFIG_SYS_FLASH_BASE;
+ const uchar *flash_base = (const uchar *)CFG_SYS_FLASH_BASE;
printf(" CRC: %08X", crc32(0,
flash_base,
putc('\n');
/* update start of FLASH memory */
-#ifdef CONFIG_SYS_FLASH_BASE
- bd->bi_flashstart = CONFIG_SYS_FLASH_BASE;
+#ifdef CFG_SYS_FLASH_BASE
+ bd->bi_flashstart = CFG_SYS_FLASH_BASE;
#endif
/* size of FLASH memory (final value) */
bd->bi_flashsize = flash_size;
#if defined(CONFIG_OXC) || defined(CONFIG_RMU)
/* flash mapped at end of memory map */
bd->bi_flashoffset = CONFIG_TEXT_BASE + flash_size;
-#elif CONFIG_SYS_MONITOR_BASE == CONFIG_SYS_FLASH_BASE
+#elif CONFIG_SYS_MONITOR_BASE == CFG_SYS_FLASH_BASE
bd->bi_flashoffset = monitor_flash_len; /* reserved area for monitor */
#endif
return 0;
env_set_hex("fdtcontroladdr",
(unsigned long)map_to_sysmem(gd->fdt_blob));
- #if (CONFIG_IS_ENABLED(SAVE_PREV_BL_INITRAMFS_START_ADDR) || \
- CONFIG_IS_ENABLED(SAVE_PREV_BL_FDT_ADDR))
+ #if (IS_ENABLED(CONFIG_SAVE_PREV_BL_INITRAMFS_START_ADDR) || \
+ IS_ENABLED(CONFIG_SAVE_PREV_BL_FDT_ADDR))
save_prev_bl_data();
#endif
}
#endif
-#if defined(CONFIG_SCSI) && !defined(CONFIG_DM_SCSI)
-static int initr_scsi(void)
-{
- puts("SCSI: ");
- scsi_init();
- puts("\n");
-
- return 0;
-}
-#endif
-
#ifdef CONFIG_CMD_NET
static int initr_net(void)
{
}
#endif
-#if defined(CONFIG_IDE) && !defined(CONFIG_BLK)
-static int initr_ide(void)
-{
- puts("IDE: ");
-#if defined(CONFIG_START_IDE)
- if (board_start_ide())
- ide_init();
-#else
- ide_init();
-#endif
- return 0;
-}
-#endif
-
-#if defined(CONFIG_PRAM)
+#if defined(CFG_PRAM)
/*
* Export available size of memory for Linux, taking into account the
* protected RAM at top of memory
ulong pram = 0;
char memsz[32];
- pram = env_get_ulong("pram", 10, CONFIG_PRAM);
+ pram = env_get_ulong("pram", 10, CFG_PRAM);
sprintf(memsz, "%ldk", (long int)((gd->ram_size / 1024) - pram));
env_set("mem", memsz);
printf("Warning: Unexpected devicetree source (not from a prior stage)");
printf("Warning: U-Boot may not function properly\n");
}
+ if (IS_ENABLED(CONFIG_OF_TAG_MIGRATE) &&
+ (gd->flags & GD_FLG_OF_TAG_MIGRATE))
+ /*
+ * U-Boot will silently fail to work after 2023.07 if
+ * there are old tags present
+ */
+ printf("Warning: Device tree includes old 'u-boot,dm-' tags: please fix by 2023.07!\n");
}
return 0;
#ifdef CONFIG_SANDBOX
sandbox_main_loop_init();
#endif
+
+ event_notify_null(EVT_MAIN_LOOP);
+
/* main_loop() can return to retry autoboot, if so just run it again */
for (;;)
main_loop();
}
/*
- * We hope to remove most of the driver-related init and do it if/when
+ * Over time we hope to remove these functions with code fragments and
+ * stub functions, and instead call the relevant function directly.
+ *
+ * We also hope to remove most of the driver-related init and do it if/when
* the driver is later used.
*
* TODO: perhaps reset the watchdog in the initcall function after each call?
*/
#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)
initr_watchdog,
#endif
INIT_FUNC_WATCHDOG_RESET
-#if defined(CONFIG_NEEDS_MANUAL_RELOC) && defined(CONFIG_BLOCK_CACHE)
- blkcache_init,
-#endif
-#ifdef CONFIG_NEEDS_MANUAL_RELOC
- initr_manual_reloc_cmdtable,
-#endif
arch_initr_trap,
#if defined(CONFIG_BOARD_EARLY_INIT_R)
board_early_init_r,
/* initialize higher level parts of CPU like time base and timers */
cpu_init_r,
#endif
-#ifdef CONFIG_EFI_SETUP_EARLY
+#ifdef CONFIG_EFI_LOADER
efi_init_early,
#endif
#ifdef CONFIG_CMD_NAND
#if defined(CONFIG_ID_EEPROM)
mac_read_from_eeprom,
#endif
+ INITCALL_EVENT(EVT_SETTINGS_R),
INIT_FUNC_WATCHDOG_RESET
#if defined(CONFIG_PCI_INIT_R) && !defined(CONFIG_SYS_EARLY_PCI_INIT)
/*
initr_status_led,
#endif
/* PPC has a udelay(20) here dating from 2002. Why? */
-#if defined(CONFIG_GPIO_HOG)
- gpio_hog_probe_all,
-#endif
#ifdef CONFIG_BOARD_LATE_INIT
board_late_init,
#endif
-#if defined(CONFIG_SCSI) && !defined(CONFIG_DM_SCSI)
- INIT_FUNC_WATCHDOG_RESET
- initr_scsi,
-#endif
#ifdef CONFIG_BITBANGMII
bb_miiphy_init,
#endif
#ifdef CONFIG_POST
initr_post,
#endif
-#if defined(CONFIG_IDE) && !defined(CONFIG_BLK)
- initr_ide,
-#endif
-#ifdef CONFIG_LAST_STAGE_INIT
INIT_FUNC_WATCHDOG_RESET
- /*
- * Some parts can be only initialized if all others (like
- * Interrupts) are up and running (i.e. the PC-style ISA
- * keyboard).
- */
- last_stage_init,
-#endif
-#if defined(CONFIG_PRAM)
+ INITCALL_EVENT(EVT_LAST_STAGE_INIT),
+#if defined(CFG_PRAM)
initr_mem,
#endif
run_main_loop,
void board_init_r(gd_t *new_gd, ulong dest_addr)
{
+ /*
+ * The pre-relocation drivers may be using memory that has now gone
+ * away. Mark serial as unavailable - this will fall back to the debug
+ * UART if available.
+ *
+ * Do the same with log drivers since the memory may not be available.
+ */
+ gd->flags &= ~(GD_FLG_SERIAL_READY | GD_FLG_LOG_READY);
+
/*
* Set up the new global data pointer. So far only x86 does this
* here.
#endif
gd->flags &= ~GD_FLG_LOG_READY;
- 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();