]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
spl: Add a name to the SPL load-image methods
authorSimon Glass <sjg@chromium.org>
Wed, 30 Nov 2016 22:30:50 +0000 (15:30 -0700)
committerTom Rini <trini@konsulko.com>
Fri, 9 Dec 2016 13:40:13 +0000 (08:40 -0500)
It is useful to name each method so that we can print out this name when
using the method. Currently this happens using a separate function. In
preparation for unifying this, add a name to each method.

The name is only available if we have libcommon support (i.e can use
printf()).

Signed-off-by: Simon Glass <sjg@chromium.org>
16 files changed:
arch/arm/mach-sunxi/board.c
arch/arm/mach-uniphier/boot-mode/spl_board.c
arch/sandbox/cpu/spl.c
common/spl/spl.c
common/spl/spl_mmc.c
common/spl/spl_nand.c
common/spl/spl_net.c
common/spl/spl_nor.c
common/spl/spl_onenand.c
common/spl/spl_sata.c
common/spl/spl_spi.c
common/spl/spl_ubi.c
common/spl/spl_usb.c
common/spl/spl_ymodem.c
drivers/mtd/spi/sunxi_spi_spl.c
include/spl.h

index 0f8ead980cdc03a30765f330cd46be402a7310ee..205236d5ece3f62463adba29aacb9b4d5116e640 100644 (file)
@@ -142,7 +142,7 @@ static int spl_board_load_image(struct spl_image_info *spl_image,
 
        return 0;
 }
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_BOARD, spl_board_load_image);
+SPL_LOAD_IMAGE_METHOD("FEL", 0, BOOT_DEVICE_BOARD, spl_board_load_image);
 #endif
 
 void s_init(void)
index 854ab056dad4abcac5d0b976b5deb706db44f38c..ba840873ed788a7bd0aa0b8c36424b996b6106fd 100644 (file)
@@ -127,4 +127,4 @@ static int spl_board_load_image(struct spl_image_info *spl_image,
 
        return 0;
 }
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_BOARD, spl_board_load_image);
+SPL_LOAD_IMAGE_METHOD("eMMC", 0, BOOT_DEVICE_BOARD, spl_board_load_image);
index 1ad7fb6c60e8641878684490e909cea1030e81cb..632446b2cde6a4036079231b768858e0eace74cd 100644 (file)
@@ -51,7 +51,7 @@ static int spl_board_load_image(struct spl_image_info *spl_image,
        /* Hopefully this will not return */
        return os_spl_to_uboot(fname);
 }
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_BOARD, spl_board_load_image);
+SPL_LOAD_IMAGE_METHOD("sandbox", 0, BOOT_DEVICE_BOARD, spl_board_load_image);
 
 void spl_board_init(void)
 {
index 9bcbd09ff380516f0a5ad042f68c8b47e3670f8d..30b4c50251cfc594ea627ddd6f063c33bf73da84 100644 (file)
@@ -221,10 +221,10 @@ static int spl_ram_load_image(struct spl_image_info *spl_image,
        return 0;
 }
 #if defined(CONFIG_SPL_RAM_DEVICE)
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_RAM, spl_ram_load_image);
+SPL_LOAD_IMAGE_METHOD("RAM", 0, BOOT_DEVICE_RAM, spl_ram_load_image);
 #endif
 #if defined(CONFIG_SPL_DFU_SUPPORT)
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_DFU, spl_ram_load_image);
+SPL_LOAD_IMAGE_METHOD("USB DFU", 0, BOOT_DEVICE_DFU, spl_ram_load_image);
 #endif
 #endif
 
index 32d7c2a84b44399e5584045362484a69a1b343b5..85e3de8f23053a7d93ca36f3514a3f77a162356d 100644 (file)
@@ -355,6 +355,6 @@ int spl_mmc_load_image(struct spl_image_info *spl_image,
        return err;
 }
 
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_MMC1, spl_mmc_load_image);
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_MMC2, spl_mmc_load_image);
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_MMC2_2, spl_mmc_load_image);
+SPL_LOAD_IMAGE_METHOD("MMC1", 0, BOOT_DEVICE_MMC1, spl_mmc_load_image);
+SPL_LOAD_IMAGE_METHOD("MMC2", 0, BOOT_DEVICE_MMC2, spl_mmc_load_image);
+SPL_LOAD_IMAGE_METHOD("MMC2_2", 0, BOOT_DEVICE_MMC2_2, spl_mmc_load_image);
index d1abda6e4ce1f555defbf3463bcda9b767b13d00..cd39f9be9d3caa0fea49f5e6ece7255f1ddbbd69 100644 (file)
@@ -151,4 +151,4 @@ static int spl_nand_load_image(struct spl_image_info *spl_image,
 }
 #endif
 /* Use priorty 1 so that Ubi can override this */
-SPL_LOAD_IMAGE_METHOD(1, BOOT_DEVICE_NAND, spl_nand_load_image);
+SPL_LOAD_IMAGE_METHOD("NAND", 1, BOOT_DEVICE_NAND, spl_nand_load_image);
index f4b4bc483397fc6104922f56de014c5408e2435c..0fba0172ea4d78c9a70e829c1e89e50bef4312f3 100644 (file)
@@ -51,7 +51,8 @@ int spl_net_load_image_cpgmac(struct spl_image_info *spl_image,
 
        return spl_net_load_image(spl_image, bootdev);
 }
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_CPGMAC, spl_net_load_image_cpgmac);
+SPL_LOAD_IMAGE_METHOD("eth device", 0, BOOT_DEVICE_CPGMAC,
+                     spl_net_load_image_cpgmac);
 #endif
 
 #ifdef CONFIG_SPL_USBETH_SUPPORT
@@ -62,5 +63,5 @@ int spl_net_load_image_usb(struct spl_image_info *spl_image,
 
        return spl_net_load_image(spl_image, bootdev);
 }
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_USBETH, spl_net_load_image_usb);
+SPL_LOAD_IMAGE_METHOD("USB eth", 0, BOOT_DEVICE_USBETH, spl_net_load_image_usb);
 #endif
index 6bfa399bacef083ab5ff6c83eec70b140d2918ae..d07ca84382468278e066f69598b6c490f3b68661 100644 (file)
@@ -71,4 +71,4 @@ static int spl_nor_load_image(struct spl_image_info *spl_image,
 
        return 0;
 }
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_NOR, spl_nor_load_image);
+SPL_LOAD_IMAGE_METHOD("NOR", 0, BOOT_DEVICE_NOR, spl_nor_load_image);
index f076e2c7c8846902c526ad3481c0d923e98af5bd..fc98e9cbe5806bbe376bb09993747dd2e540924d 100644 (file)
@@ -36,4 +36,5 @@ static int spl_onenand_load_image(struct spl_image_info *spl_image,
        return 0;
 }
 /* Use priorty 1 so that Ubi can override this */
-SPL_LOAD_IMAGE_METHOD(1, BOOT_DEVICE_ONENAND, spl_onenand_load_image);
+SPL_LOAD_IMAGE_METHOD("OneNAND", 1, BOOT_DEVICE_ONENAND,
+                     spl_onenand_load_image);
index a3c07cd9cee2a3e6f15fc62da49f9583b9337545..5476206131debb3e51e85fe36734b8813442be2d 100644 (file)
@@ -57,4 +57,4 @@ static int spl_sata_load_image(struct spl_image_info *spl_image,
 
        return 0;
 }
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_SATA, spl_sata_load_image);
+SPL_LOAD_IMAGE_METHOD("SATA", 0, BOOT_DEVICE_SATA, spl_sata_load_image);
index 78b8cd16bb8361f50ff7a160c8bb2a95febbede1..cd1d6b285ef02a6cac36defcc485c899b5b2db8f 100644 (file)
@@ -125,4 +125,4 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
        return err;
 }
 /* Use priorty 1 so that boards can override this */
-SPL_LOAD_IMAGE_METHOD(1, BOOT_DEVICE_SPI, spl_spi_load_image);
+SPL_LOAD_IMAGE_METHOD("SPI", 1, BOOT_DEVICE_SPI, spl_spi_load_image);
index c03910bb40809fa39462cf11d9b8a868f86101c7..24633f4766e56172b06a7c74c1e030303a647e7f 100644 (file)
@@ -78,5 +78,5 @@ out:
        return ret;
 }
 /* Use priorty 0 so that Ubi will override NAND and ONENAND methods */
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_NAND, spl_ubi_load_image);
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_ONENAND, spl_ubi_load_image);
+SPL_LOAD_IMAGE_METHOD("NAND", 0, BOOT_DEVICE_NAND, spl_ubi_load_image);
+SPL_LOAD_IMAGE_METHOD("OneNAND", 0, BOOT_DEVICE_ONENAND, spl_ubi_load_image);
index e37966ed6cefb9a71c281ec9c1939a6231b6840a..567a4505056a674343ff35d891f949a86c76988a 100644 (file)
@@ -65,4 +65,4 @@ static int spl_usb_load_image(struct spl_image_info *spl_image,
 
        return 0;
 }
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_USB, spl_usb_load_image);
+SPL_LOAD_IMAGE_METHOD("USB", 0, BOOT_DEVICE_USB, spl_usb_load_image);
index 957894dccbf22486e32c581a6d9aabd86bb56228..ff8085b795e61b82544d6c8eda3cd1ce6d64d366 100644 (file)
@@ -132,4 +132,4 @@ end_stream:
        printf("Loaded %d bytes\n", size);
        return 0;
 }
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_UART, spl_ymodem_load_image);
+SPL_LOAD_IMAGE_METHOD("UART", 0, BOOT_DEVICE_UART, spl_ymodem_load_image);
index 75023149a4d3749e3526b315104c93a7df43be00..e70064c677186cbb44fce787fa59d3369ffcc598 100644 (file)
@@ -284,4 +284,4 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
        return 0;
 }
 /* Use priorty 0 to override the default if it happens to be linked in */
-SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_SPI, spl_spi_load_image);
+SPL_LOAD_IMAGE_METHOD("sunxi SPI" 0, BOOT_DEVICE_SPI, spl_spi_load_image);
index 9d221c1b55fb4eeaed2a576d3ea9f13caac7543f..6e746b2046120a4cf2b6139e348c7373e6f6e3dc 100644 (file)
@@ -152,10 +152,14 @@ struct spl_boot_device {
 /**
  * Holds information about a way of loading an SPL image
  *
+ * @name: User-friendly name for this method (e.g. "MMC")
  * @boot_device: Boot device that this loader supports
  * @load_image: Function to call to load image
  */
 struct spl_image_loader {
+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
+       const char *name;
+#endif
        uint boot_device;
        /**
         * load_image() - Load an SPL image
@@ -177,11 +181,20 @@ struct spl_image_loader {
  * _boot_device is the BOOT_DEVICE_... value
  * _method is the load_image function to call
  */
-#define SPL_LOAD_IMAGE_METHOD(_priority, _boot_device, _method) \
+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
+#define SPL_LOAD_IMAGE_METHOD(_name, _priority, _boot_device, _method) \
        SPL_LOAD_IMAGE(_method ## _priority ## _boot_device) = { \
+               .name = _name, \
                .boot_device = _boot_device, \
                .load_image = _method, \
        }
+#else
+#define SPL_LOAD_IMAGE_METHOD(_name, _priority, _boot_device, _method) \
+       SPL_LOAD_IMAGE(_method ## _priority ## _boot_device) = { \
+               .boot_device = _boot_device, \
+               .load_image = _method, \
+       }
+#endif
 
 /* SPL FAT image functions */
 int spl_load_image_fat(struct spl_image_info *spl_image,