From ef14c347db4ae62f964bcf36805563efe1104754 Mon Sep 17 00:00:00 2001 From: Caleb Connolly Date: Sat, 12 Oct 2024 15:57:17 +0200 Subject: dfu: add scsi backend This is extremely similar to the MMC backend, but there are some notable differences. Works with a DFU string like scsi 4=u-boot-bin part 11 Where "4" is the SCSI dev number (sequential LUN across all SCSI devices) and "11" is the partition number. Reviewed-by: Mattijs Korpershoek Acked-by: Mattijs Korpershoek Signed-off-by: Caleb Connolly --- include/dfu.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'include') diff --git a/include/dfu.h b/include/dfu.h index e25588c33cb..12f9dfcdfcd 100644 --- a/include/dfu.h +++ b/include/dfu.h @@ -24,6 +24,7 @@ enum dfu_device_type { DFU_DEV_SF, DFU_DEV_MTD, DFU_DEV_VIRT, + DFU_DEV_SCSI, }; enum dfu_layout { @@ -99,6 +100,19 @@ struct virt_internal_data { int dev_num; }; +struct scsi_internal_data { + int lun; + + /* RAW programming */ + unsigned int lba_start; + unsigned int lba_size; + unsigned int lba_blk_size; + + /* FAT/EXT */ + unsigned int dev; // Always 0??? + unsigned int part; +}; + #if defined(CONFIG_DFU_NAME_MAX_SIZE) #define DFU_NAME_SIZE CONFIG_DFU_NAME_MAX_SIZE #else @@ -126,6 +140,7 @@ struct dfu_entity { struct ram_internal_data ram; struct sf_internal_data sf; struct virt_internal_data virt; + struct scsi_internal_data scsi; } data; int (*get_medium_size)(struct dfu_entity *dfu, u64 *size); @@ -516,6 +531,18 @@ static inline int dfu_fill_entity_virt(struct dfu_entity *dfu, char *devstr, } #endif +#if CONFIG_IS_ENABLED(DFU_SCSI) +int dfu_fill_entity_scsi(struct dfu_entity *dfu, char *devstr, + char **argv, int argc); +#else +static inline int dfu_fill_entity_scsi(struct dfu_entity *dfu, char *devstr, + char **argv, int argc) +{ + puts("SCSI support not available!\n"); + return -1; +} +#endif + extern bool dfu_reinit_needed; extern bool dfu_alt_info_changed; -- cgit v1.2.3