[PATCH v3 2/4] scsi: Implement get_blk() function

Tom Rini trini at konsulko.com
Wed May 7 18:55:40 CEST 2025


On Wed, May 07, 2025 at 01:57:11PM +0200, Casey Connolly wrote:
> 
> 
> On 5/7/25 13:28, Varadarajan Narayanan wrote:
> > Add a function to obtain the block device for SCSI.
> > 
> > Signed-off-by: Varadarajan Narayanan <quic_varada at quicinc.com>
> > ---
> > v3: * s/scsi_get_blk/scsi_get_blk_by_uuid
> >      * s/partition_name/uuid
> > ---
> >   drivers/scsi/scsi-uclass.c | 30 ++++++++++++++++++++++++++++++
> >   include/scsi.h             | 10 ++++++++++
> >   2 files changed, 40 insertions(+)
> > 
> > diff --git a/drivers/scsi/scsi-uclass.c b/drivers/scsi/scsi-uclass.c
> > index 1ee8236c05c..3eb6069649f 100644
> > --- a/drivers/scsi/scsi-uclass.c
> > +++ b/drivers/scsi/scsi-uclass.c
> > @@ -10,7 +10,9 @@
> >   #define LOG_CATEGORY UCLASS_SCSI
> > +#include <blk.h>
> >   #include <dm.h>
> > +#include <part.h>
> >   #include <scsi.h>
> >   int scsi_exec(struct udevice *dev, struct scsi_cmd *pccb)
> > @@ -23,6 +25,34 @@ int scsi_exec(struct udevice *dev, struct scsi_cmd *pccb)
> >   	return ops->exec(dev, pccb);
> >   }
> > +int scsi_get_blk_by_uuid(const char *uuid,
> > +			 struct blk_desc **blk_desc_ptr,
> > +			 struct disk_partition *part_info_ptr)
> > +{
> > +	static int is_scsi_scanned;
> > +	struct blk_desc *blk;
> > +	int i, ret;
> > +
> > +	if (!is_scsi_scanned) {
> > +		scsi_scan(false /* no verbose */);
> > +		is_scsi_scanned = 1;
> 
> At this point I think we should just unconditionally scsi_scan() like we do
> with MMC... Tom (others?) any thoughts on this? Anyhow this is probably
> fine.

It's certainly something to talk about stand-alone, yeah.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20250507/9e17bf5c/attachment.sig>


More information about the U-Boot mailing list