Commit ebc4ef61d76fc182773fe225151adc9b913c62eb
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
- 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
... | ... | @@ -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 |
... | ... | @@ -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); |
... | ... | @@ -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 |
... | ... | @@ -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); |
... | ... | @@ -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, |
-
mentioned in commit a64893
-
mentioned in commit a64893
-
mentioned in commit a64893
-
mentioned in commit a64893
-
mentioned in commit a64893
-
mentioned in commit a64893
-
mentioned in commit a64893
-
mentioned in commit a64893
-
mentioned in commit a64893
-
mentioned in commit a64893
-
mentioned in commit a64893
-
mentioned in commit a64893
-
mentioned in commit a64893
-
mentioned in commit a64893
-
mentioned in commit a64893
-
mentioned in commit a64893
-
mentioned in commit a64893
-
mentioned in commit a64893
-
mentioned in commit a64893
-
mentioned in commit a64893
-
mentioned in commit a64893
-
mentioned in commit a64893
-
mentioned in commit a64893
-
mentioned in commit a64893
-
mentioned in commit a64893
-
mentioned in commit a64893