summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorStefan Reinauer <reinauer@chromium.org>2011-08-18 11:41:05 -0700
committerSimon Glass <sjg@chromium.org>2011-08-29 10:59:36 -0700
commit4ece311f73d912affcf6c0471d836147eadb3167 (patch)
treedd1411cc8ff973212cdb2419d24b4ec84048dc67 /lib
parentd91f8c4b97ffc8fcd1ddf6ee78172323cddf1652 (diff)
Look for an IDE boot device on non-MMC systems.
This is a rewrite of http://gerrit.chromium.org/gerrit/#change,5547 which tries to integrate more transparently into vbexport's code and at the same time removes some (false) assumptions about always booting from MMC. BUG=none TEST=none Change-Id: I18f3b91f307b16622de9ced97ab00454c29941fe Reviewed-on: http://gerrit.chromium.org/gerrit/6232 Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Stefan Reinauer <reinauer@google.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/vbexport/boot_device.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/lib/vbexport/boot_device.c b/lib/vbexport/boot_device.c
index bd378e5b8f..b26ce46b25 100644
--- a/lib/vbexport/boot_device.c
+++ b/lib/vbexport/boot_device.c
@@ -67,8 +67,9 @@ static void init_usb_storage(void)
usb_stor_scan(/*mode=*/1);
}
-block_dev_desc_t *iterate_mmc_device(int *index_ptr)
+block_dev_desc_t *iterate_internal_devices(int *index_ptr)
{
+#ifdef CONFIG_MMC
struct mmc *mmc;
int index;
@@ -85,7 +86,22 @@ block_dev_desc_t *iterate_mmc_device(int *index_ptr)
*/
*index_ptr = index + 1;
- return mmc ? &mmc->block_dev : NULL;
+ if (mmc)
+ return &mmc->block_dev;
+#endif
+#ifdef CONFIG_CMD_IDE
+#ifdef CONFIG_MMC
+ /* TODO(reinauer) Fix index handling first */
+#error "MMC and IDE can not be enabled at the same time right now."
+#endif
+ block_dev_desc_t *ide;
+ ide = ide_get_dev(*index_ptr);
+ *index_ptr = *index_ptr + 1;
+
+ if (ide)
+ return ide;
+#endif
+ return NULL;
}
block_dev_desc_t *iterate_usb_device(int *index_ptr)
@@ -141,7 +157,7 @@ VbError_t VbExDiskGetInfo(VbDiskInfo** infos_ptr, uint32_t* count_ptr,
count = 0;
iterator_state = 0;
- while (count < max_count && (dev = iterate_mmc_device(&iterator_state)))
+ while (count < max_count && (dev = iterate_internal_devices(&iterator_state)))
add_device_if_flags_match(dev, disk_flags,
infos + count, &count);