Commit ebc4ef61d76fc182773fe225151adc9b913c62eb

Authored by Simon Glass
Committed by Tom Rini
1 parent 0d3b059131

spl: Add a name to the SPL load-image methods

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>

Showing 16 changed files with 36 additions and 21 deletions Side-by-side Diff

arch/arm/mach-sunxi/board.c
... ... @@ -142,7 +142,7 @@
142 142  
143 143 return 0;
144 144 }
145   -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_BOARD, spl_board_load_image);
  145 +SPL_LOAD_IMAGE_METHOD("FEL", 0, BOOT_DEVICE_BOARD, spl_board_load_image);
146 146 #endif
147 147  
148 148 void s_init(void)
arch/arm/mach-uniphier/boot-mode/spl_board.c
... ... @@ -127,5 +127,5 @@
127 127  
128 128 return 0;
129 129 }
130   -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_BOARD, spl_board_load_image);
  130 +SPL_LOAD_IMAGE_METHOD("eMMC", 0, BOOT_DEVICE_BOARD, spl_board_load_image);
arch/sandbox/cpu/spl.c
... ... @@ -51,7 +51,7 @@
51 51 /* Hopefully this will not return */
52 52 return os_spl_to_uboot(fname);
53 53 }
54   -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_BOARD, spl_board_load_image);
  54 +SPL_LOAD_IMAGE_METHOD("sandbox", 0, BOOT_DEVICE_BOARD, spl_board_load_image);
55 55  
56 56 void spl_board_init(void)
57 57 {
... ... @@ -221,10 +221,10 @@
221 221 return 0;
222 222 }
223 223 #if defined(CONFIG_SPL_RAM_DEVICE)
224   -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_RAM, spl_ram_load_image);
  224 +SPL_LOAD_IMAGE_METHOD("RAM", 0, BOOT_DEVICE_RAM, spl_ram_load_image);
225 225 #endif
226 226 #if defined(CONFIG_SPL_DFU_SUPPORT)
227   -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_DFU, spl_ram_load_image);
  227 +SPL_LOAD_IMAGE_METHOD("USB DFU", 0, BOOT_DEVICE_DFU, spl_ram_load_image);
228 228 #endif
229 229 #endif
230 230  
common/spl/spl_mmc.c
... ... @@ -355,7 +355,7 @@
355 355 return err;
356 356 }
357 357  
358   -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_MMC1, spl_mmc_load_image);
359   -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_MMC2, spl_mmc_load_image);
360   -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_MMC2_2, spl_mmc_load_image);
  358 +SPL_LOAD_IMAGE_METHOD("MMC1", 0, BOOT_DEVICE_MMC1, spl_mmc_load_image);
  359 +SPL_LOAD_IMAGE_METHOD("MMC2", 0, BOOT_DEVICE_MMC2, spl_mmc_load_image);
  360 +SPL_LOAD_IMAGE_METHOD("MMC2_2", 0, BOOT_DEVICE_MMC2_2, spl_mmc_load_image);
common/spl/spl_nand.c
... ... @@ -151,5 +151,5 @@
151 151 }
152 152 #endif
153 153 /* Use priorty 1 so that Ubi can override this */
154   -SPL_LOAD_IMAGE_METHOD(1, BOOT_DEVICE_NAND, spl_nand_load_image);
  154 +SPL_LOAD_IMAGE_METHOD("NAND", 1, BOOT_DEVICE_NAND, spl_nand_load_image);
common/spl/spl_net.c
... ... @@ -51,7 +51,8 @@
51 51  
52 52 return spl_net_load_image(spl_image, bootdev);
53 53 }
54   -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_CPGMAC, spl_net_load_image_cpgmac);
  54 +SPL_LOAD_IMAGE_METHOD("eth device", 0, BOOT_DEVICE_CPGMAC,
  55 + spl_net_load_image_cpgmac);
55 56 #endif
56 57  
57 58 #ifdef CONFIG_SPL_USBETH_SUPPORT
... ... @@ -62,6 +63,6 @@
62 63  
63 64 return spl_net_load_image(spl_image, bootdev);
64 65 }
65   -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_USBETH, spl_net_load_image_usb);
  66 +SPL_LOAD_IMAGE_METHOD("USB eth", 0, BOOT_DEVICE_USBETH, spl_net_load_image_usb);
66 67 #endif
common/spl/spl_nor.c
... ... @@ -71,5 +71,5 @@
71 71  
72 72 return 0;
73 73 }
74   -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_NOR, spl_nor_load_image);
  74 +SPL_LOAD_IMAGE_METHOD("NOR", 0, BOOT_DEVICE_NOR, spl_nor_load_image);
common/spl/spl_onenand.c
... ... @@ -36,5 +36,6 @@
36 36 return 0;
37 37 }
38 38 /* Use priorty 1 so that Ubi can override this */
39   -SPL_LOAD_IMAGE_METHOD(1, BOOT_DEVICE_ONENAND, spl_onenand_load_image);
  39 +SPL_LOAD_IMAGE_METHOD("OneNAND", 1, BOOT_DEVICE_ONENAND,
  40 + spl_onenand_load_image);
common/spl/spl_sata.c
... ... @@ -57,5 +57,5 @@
57 57  
58 58 return 0;
59 59 }
60   -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_SATA, spl_sata_load_image);
  60 +SPL_LOAD_IMAGE_METHOD("SATA", 0, BOOT_DEVICE_SATA, spl_sata_load_image);
common/spl/spl_spi.c
... ... @@ -125,5 +125,5 @@
125 125 return err;
126 126 }
127 127 /* Use priorty 1 so that boards can override this */
128   -SPL_LOAD_IMAGE_METHOD(1, BOOT_DEVICE_SPI, spl_spi_load_image);
  128 +SPL_LOAD_IMAGE_METHOD("SPI", 1, BOOT_DEVICE_SPI, spl_spi_load_image);
common/spl/spl_ubi.c
... ... @@ -78,6 +78,6 @@
78 78 return ret;
79 79 }
80 80 /* Use priorty 0 so that Ubi will override NAND and ONENAND methods */
81   -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_NAND, spl_ubi_load_image);
82   -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_ONENAND, spl_ubi_load_image);
  81 +SPL_LOAD_IMAGE_METHOD("NAND", 0, BOOT_DEVICE_NAND, spl_ubi_load_image);
  82 +SPL_LOAD_IMAGE_METHOD("OneNAND", 0, BOOT_DEVICE_ONENAND, spl_ubi_load_image);
common/spl/spl_usb.c
... ... @@ -65,5 +65,5 @@
65 65  
66 66 return 0;
67 67 }
68   -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_USB, spl_usb_load_image);
  68 +SPL_LOAD_IMAGE_METHOD("USB", 0, BOOT_DEVICE_USB, spl_usb_load_image);
common/spl/spl_ymodem.c
... ... @@ -132,5 +132,5 @@
132 132 printf("Loaded %d bytes\n", size);
133 133 return 0;
134 134 }
135   -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_UART, spl_ymodem_load_image);
  135 +SPL_LOAD_IMAGE_METHOD("UART", 0, BOOT_DEVICE_UART, spl_ymodem_load_image);
drivers/mtd/spi/sunxi_spi_spl.c
... ... @@ -284,5 +284,5 @@
284 284 return 0;
285 285 }
286 286 /* Use priorty 0 to override the default if it happens to be linked in */
287   -SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_SPI, spl_spi_load_image);
  287 +SPL_LOAD_IMAGE_METHOD("sunxi SPI" 0, BOOT_DEVICE_SPI, spl_spi_load_image);
... ... @@ -152,10 +152,14 @@
152 152 /**
153 153 * Holds information about a way of loading an SPL image
154 154 *
  155 + * @name: User-friendly name for this method (e.g. "MMC")
155 156 * @boot_device: Boot device that this loader supports
156 157 * @load_image: Function to call to load image
157 158 */
158 159 struct spl_image_loader {
  160 +#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
  161 + const char *name;
  162 +#endif
159 163 uint boot_device;
160 164 /**
161 165 * load_image() - Load an SPL image
162 166  
163 167  
... ... @@ -177,11 +181,20 @@
177 181 * _boot_device is the BOOT_DEVICE_... value
178 182 * _method is the load_image function to call
179 183 */
180   -#define SPL_LOAD_IMAGE_METHOD(_priority, _boot_device, _method) \
  184 +#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
  185 +#define SPL_LOAD_IMAGE_METHOD(_name, _priority, _boot_device, _method) \
181 186 SPL_LOAD_IMAGE(_method ## _priority ## _boot_device) = { \
  187 + .name = _name, \
182 188 .boot_device = _boot_device, \
183 189 .load_image = _method, \
184 190 }
  191 +#else
  192 +#define SPL_LOAD_IMAGE_METHOD(_name, _priority, _boot_device, _method) \
  193 + SPL_LOAD_IMAGE(_method ## _priority ## _boot_device) = { \
  194 + .boot_device = _boot_device, \
  195 + .load_image = _method, \
  196 + }
  197 +#endif
185 198  
186 199 /* SPL FAT image functions */
187 200 int spl_load_image_fat(struct spl_image_info *spl_image,