scsi: Add function and env var to report number of scsi drives
authorStefan Reinauer <reinauer@chromium.org>
Mon, 29 Oct 2012 05:23:48 +0000 (05:23 +0000)
committerTom Rini <trini@ti.com>
Fri, 2 Nov 2012 22:20:40 +0000 (15:20 -0700)
Add a new function to find out the number of available SCSI disks. Also
set the 'scsidevs' environment variable after each scan.

Signed-off-by: Stefan Reinauer <reinauer@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
README
common/cmd_scsi.c
include/scsi.h

diff --git a/README b/README
index 06c1b15e98ab8f7f4d343bf23f50091715af07a1..8141068e4f71d7a41385b22b28219fbdc848b73c 100644 (file)
--- a/README
+++ b/README
@@ -1041,6 +1041,9 @@ The following options need to be configured:
                devices.
                CONFIG_SYS_SCSI_SYM53C8XX_CCF to fix clock timing (80Mhz)
 
+                The environment variable 'scsidevs' is set to the number of
+                SCSI devices found during the last scan.
+
 - NETWORK Support (PCI):
                CONFIG_E1000
                Support for Intel 8254x/8257x gigabit chips.
index 31ea78845ceb5ac8e42f4e1d723d4550187f35d9..9bd8ec9ecb967b7d1516f3114112f532430b6547 100644 (file)
@@ -184,6 +184,14 @@ removable:
                scsi_curr_dev=0;
        else
                scsi_curr_dev = -1;
+
+       printf("Found %d device(s).\n", scsi_max_devs);
+       setenv_ulong("scsidevs", scsi_max_devs);
+}
+
+int scsi_get_disk_count(void)
+{
+       return scsi_max_devs;
 }
 
 #ifdef CONFIG_PCI
index 89ae45f8e8bcae06770ca7dee35f9b68416e61f4..9681d198dff64e7e05bd56e2189eeb0b0384552d 100644 (file)
@@ -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 */