@@ -178,6 +178,84 @@ int spl_init(void)
return 0;
}
+#ifdef CONFIG_SPL_BOARD_LOAD_IMAGE
+__weak void spl_board_announce_boot_device(void) { }
+#endif
+
+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
+struct boot_device_name {
+ u32 boot_dev;
+ const char *name;
+};
+
+struct boot_device_name boot_name_table[] = {
+#ifdef CONFIG_SPL_RAM_DEVICE
+ { BOOT_DEVICE_RAM, "RAM" },
+#endif
+#ifdef CONFIG_SPL_MMC_SUPPORT
+ { BOOT_DEVICE_MMC1, "MMC" },
+ { BOOT_DEVICE_MMC2, "MMC" },
+ { BOOT_DEVICE_MMC2_2, "MMC" },
+#endif
+#ifdef CONFIG_SPL_NAND_SUPPORT
+ { BOOT_DEVICE_NAND, "NAND" },
+#endif
+#ifdef CONFIG_SPL_ONENAND_SUPPORT
+ { BOOT_DEVICE_ONENAND, "OneNAND" },
+#endif
+#ifdef CONFIG_SPL_NOR_SUPPORT
+ { BOOT_DEVICE_NOR, "NOR" },
+#endif
+#ifdef CONFIG_SPL_YMODEM_SUPPORT
+ { BOOT_DEVICE_UART, "UART" },
+#endif
+#ifdef CONFIG_SPL_SPI_SUPPORT
+ { BOOT_DEVICE_SPI, "SPI" },
+#endif
+#ifdef CONFIG_SPL_ETH_SUPPORT
+#ifdef CONFIG_SPL_ETH_DEVICE
+ { BOOT_DEVICE_CPGMAC, "eth device" },
+#else
+ { BOOT_DEVICE_CPGMAC, "net" },
+#endif
+#endif
+#ifdef CONFIG_SPL_USBETH_SUPPORT
+ { BOOT_DEVICE_USBETH, "USB eth" },
+#endif
+#ifdef CONFIG_SPL_USB_SUPPORT
+ { BOOT_DEVICE_USB, "USB" },
+#endif
+#ifdef CONFIG_SPL_SATA_SUPPORT
+ { BOOT_DEVICE_SATA, "SATA" },
+#endif
+ /* Keep this entry last */
+ { BOOT_DEVICE_NONE, "unknown boot device" },
+};
+
+static void announce_boot_device(u32 boot_device)
+{
+ int i;
+
+ puts("Trying to boot from ");
+
+#ifdef CONFIG_SPL_BOARD_LOAD_IMAGE
+ if (boot_device == BOOT_DEVICE_BOARD) {
+ spl_board_announce_boot_device();
+ puts("\n");
+ return;
+ }
+#endif
+ for (i = 0; i < ARRAY_SIZE(boot_name_table) - 1; i++) {
+ if (boot_name_table[i].boot_dev == boot_device)
+ break;
+ }
+
+ printf("%s\n", boot_name_table[i].name);
+}
+#else
+static inline void announce_boot_device(u32 boot_device) { }
+#endif
+
#ifndef BOOT_DEVICE_NONE
#define BOOT_DEVICE_NONE 0xdeadbeef
#endif
@@ -292,6 +370,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
board_boot_order(spl_boot_list);
for (i = 0; i < ARRAY_SIZE(spl_boot_list) &&
spl_boot_list[i] != BOOT_DEVICE_NONE; i++) {
+ announce_boot_device(spl_boot_list[i]);
if (!spl_load_image(spl_boot_list[i]))
break;
}
Now that we support alternative boot devices, it can sometimes be unclear which boot devices was actually used. Provide a function to announce which boot devices are attempted during boot. Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il> Cc: Igor Grinberg <grinberg@compulab.co.il> Cc: Tom Rini <trini@konsulko.com> Cc: Simon Glass <sjg@chromium.org> --- Changes in V3: - Reworked announce_boot_device() to make the code less repititive by utilizing a table of boot_device --> name. Changes in V2: - No changes. common/spl/spl.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+)