[U-Boot] [PATCH 04/20] scsi: Add function to report number of scsi drives

Simon Glass sjg at chromium.org
Tue Oct 23 07:35:22 CEST 2012


Hi Rob,

On Fri, Oct 19, 2012 at 5:16 AM, Rob Herring <robherring2 at gmail.com> wrote:
> On 10/18/2012 10:45 PM, Simon Glass wrote:
>> From: Stefan Reinauer <reinauer at chromium.org>
>>
>> Add a new function to find out the number of available SCSI disks.
>
> Wouldn't setting an environment variable be more useful? Then we can
> loop over devices in boot scripts.

Yes that's a good idea - will add that too. The idea with this patch
is to provide an internal API to read this info within U-Boot.

Regards,
Simon

>
> Rob
>
>>
>> Signed-off-by: Stefan Reinauer <reinauer at chromium.org>
>> Signed-off-by: Simon Glass <sjg at chromium.org>
>> ---
>>  common/cmd_scsi.c |    7 +++++++
>>  include/scsi.h    |    2 ++
>>  2 files changed, 9 insertions(+), 0 deletions(-)
>>
>> diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c
>> index 30d8d12..f64d6f4 100644
>> --- a/common/cmd_scsi.c
>> +++ b/common/cmd_scsi.c
>> @@ -182,6 +182,13 @@ removable:
>>               scsi_curr_dev=0;
>>       else
>>               scsi_curr_dev = -1;
>> +
>> +     printf("Found %d device(s).\n", scsi_max_devs);
>> +}
>> +
>> +int scsi_get_disk_count(void)
>> +{
>> +     return scsi_max_devs;
>>  }
>>
>>  #ifdef CONFIG_PCI
>> diff --git a/include/scsi.h b/include/scsi.h
>> index 89ae45f..9681d19 100644
>> --- a/include/scsi.h
>> +++ b/include/scsi.h
>> @@ -189,6 +189,8 @@ void scsi_low_level_init(int busdevfunc);
>>  void scsi_init(void);
>>  void scsi_scan(int mode);
>>
>> +/** @return the number of scsi disks */
>> +int scsi_get_disk_count(void);
>>
>>  #define SCSI_IDENTIFY                                        0xC0  /* not used */
>>
>>


More information about the U-Boot mailing list