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>
master
Simon Glass 8 years ago committed by Tom Rini
parent 0d3b059131
commit ebc4ef61d7
  1. 2
      arch/arm/mach-sunxi/board.c
  2. 2
      arch/arm/mach-uniphier/boot-mode/spl_board.c
  3. 2
      arch/sandbox/cpu/spl.c
  4. 4
      common/spl/spl.c
  5. 6
      common/spl/spl_mmc.c
  6. 2
      common/spl/spl_nand.c
  7. 5
      common/spl/spl_net.c
  8. 2
      common/spl/spl_nor.c
  9. 3
      common/spl/spl_onenand.c
  10. 2
      common/spl/spl_sata.c
  11. 2
      common/spl/spl_spi.c
  12. 4
      common/spl/spl_ubi.c
  13. 2
      common/spl/spl_usb.c
  14. 2
      common/spl/spl_ymodem.c
  15. 2
      drivers/mtd/spi/sunxi_spi_spl.c
  16. 15
      include/spl.h

@ -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)

@ -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);

@ -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)
{

@ -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

@ -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);

@ -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);

@ -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

@ -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);

@ -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);

@ -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);

@ -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);

@ -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);

@ -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);

@ -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);

@ -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);

@ -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,

Loading…
Cancel
Save