From ecdfd69a4be55363589e8185ff151b02e6c36cfa Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 24 Sep 2016 18:19:57 -0600 Subject: spl: Convert boot_device into a struct At present some spl_xxx_load_image() functions take a parameter and some don't. Of those that do, most take an integer but one takes a string. Convert this parameter into a struct so that we can pass all functions the same thing. This will allow us to use a common function signature. Signed-off-by: Simon Glass Reviewed-by: Tom Rini --- include/spl.h | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/include/spl.h b/include/spl.h index f700955..4435089 100644 --- a/include/spl.h +++ b/include/spl.h @@ -131,35 +131,53 @@ int spl_start_uboot(void); */ void spl_display_print(void); +/** + * struct spl_boot_device - Describes a boot device used by SPL + * + * @boot_device: A number indicating the BOOT_DEVICE type. There are various + * BOOT_DEVICE... #defines and enums in U-Boot and they are not consistently + * numbered. + * @boot_device_name: Named boot device, or NULL if none. + * + * Note: Additional fields can be added here, bearing in mind that SPL is + * size-sensitive and common fields will be present on all boards. This + * struct can also be used to return additional information about the load + * process if that becomes useful. + */ +struct spl_boot_device { + uint boot_device; + const char *boot_device_name; +}; + /* NAND SPL functions */ -int spl_nand_load_image(void); +int spl_nand_load_image(struct spl_boot_device *bootdev); /* OneNAND SPL functions */ -int spl_onenand_load_image(void); +int spl_onenand_load_image(struct spl_boot_device *bootdev); /* NOR SPL functions */ -int spl_nor_load_image(void); +int spl_nor_load_image(struct spl_boot_device *bootdev); /* UBI SPL functions */ -int spl_ubi_load_image(u32 boot_device); +int spl_ubi_load_image(struct spl_boot_device *bootdev); /* MMC SPL functions */ -int spl_mmc_load_image(u32 boot_device); +int spl_mmc_load_image(struct spl_boot_device *bootdev); /* YMODEM SPL functions */ -int spl_ymodem_load_image(void); +int spl_ymodem_load_image(struct spl_boot_device *bootdev); /* SPI SPL functions */ -int spl_spi_load_image(void); +int spl_spi_load_image(struct spl_boot_device *bootdev); /* Ethernet SPL functions */ -int spl_net_load_image(const char *device); +int spl_net_load_image(struct spl_boot_device *bootdev); /* USB SPL functions */ -int spl_usb_load_image(void); +int spl_usb_load_image(struct spl_boot_device *bootdev); /* SATA SPL functions */ -int spl_sata_load_image(void); +int spl_sata_load_image(struct spl_boot_device *bootdev); /* SPL FAT image functions */ int spl_load_image_fat(struct blk_desc *block_dev, int partition, @@ -214,6 +232,6 @@ int spl_dfu_cmd(int usbctrl, char *dfu_alt_info, char *interface, char *devstr); * * @return 0 on success, negative errno value on failure. */ -int spl_board_load_image(void); +int spl_board_load_image(struct spl_boot_device *bootdev); #endif -- cgit v1.1