summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Reinauer <reinauer@chromium.org>2012-01-24 16:44:35 -0800
committerGerrit <chrome-bot@google.com>2012-01-25 15:06:01 -0800
commitcf11fae2e4367bd2287b063217321efd10c5f189 (patch)
tree579a35fb6bf509ee81f573d74b325250a630bfd6
parentd0076d861920a2aa12ec007b29acca869c7d0cfd (diff)
vbexport: report correct number of scsi drives
Right now our code makes the assumption that there always is one SCSI drive in the system (the AHCI attached SDD). However, this might not be the case. This patch prevents vboot from using an uninitialized disk entry when instead it should go into recovery mode. BUG=chrome-os-partner:7716 TEST=none Signed-off-by: Stefan Reinauer <reinauer@google.com> Change-Id: I761bbb3c92a60d4205a217c7b025f699deed83b0 Reviewed-on: https://gerrit.chromium.org/gerrit/14753 Tested-by: Stefan Reinauer <reinauer@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Ready: Stefan Reinauer <reinauer@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
-rw-r--r--common/cmd_scsi.c6
-rw-r--r--include/scsi.h1
-rw-r--r--lib/vbexport/boot_device_scsi.c6
3 files changed, 11 insertions, 2 deletions
diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c
index 7f6d744123..7bfb3b421b 100644
--- a/common/cmd_scsi.c
+++ b/common/cmd_scsi.c
@@ -186,8 +186,14 @@ 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;
+}
void scsi_init(void)
{
diff --git a/include/scsi.h b/include/scsi.h
index aaafc9ca79..b00b517c4b 100644
--- a/include/scsi.h
+++ b/include/scsi.h
@@ -185,6 +185,7 @@ void scsi_low_level_init(int busdevfunc);
* functions residing inside cmd_scsi.c
*/
void scsi_init(void);
+int scsi_get_disk_count(void);
#define SCSI_IDENTIFY 0xC0 /* not used */
diff --git a/lib/vbexport/boot_device_scsi.c b/lib/vbexport/boot_device_scsi.c
index a70d6262fe..6afbd25dca 100644
--- a/lib/vbexport/boot_device_scsi.c
+++ b/lib/vbexport/boot_device_scsi.c
@@ -15,8 +15,10 @@
static int boot_device_scsi_start(uint32_t disk_flags)
{
- /* We expect to have at least one SCSI device */
- return 1;
+ /* boot_interface->start() returns the number of
+ * hard drives/boot devices for that interface
+ */
+ return scsi_get_disk_count();
}
static int boot_device_scsi_scan(block_dev_desc_t **desc, int max_devs,