summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2011-09-02 17:31:33 -0700
committerVadim Bendebury <vbendeb@chromium.org>2011-09-06 10:12:59 -0700
commitf3d075964621ba7a80ae89ce0a15a8e40811f09a (patch)
tree648966a03a96a33d8019c60ba19e822606993473 /lib
parentc5bd6cfa3276c8711c443d5d9f0bfe67639e8d21 (diff)
Add SATA interface for vbexport.
Copy device_ide.c into device_scsi.c, editing as appropriate along the way. Ensure that the new file is included if CONFIG_AHCI_SCSI is defined fro the platform. BUG=chromium-os:19837 TEST=manual . program updated image (including AHCI fixes and configuration changes) on an Alex. . restart the machine and enter `vboot_twostop' at u-boot prompt. Observe it boot up all the way to ChromeOs login screen. Change-Id: I146591c53f61722cc33f7261a1921aa07e861ee3 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: http://gerrit.chromium.org/gerrit/7234 Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/vbexport/Makefile1
-rw-r--r--lib/vbexport/boot_device.c3
-rw-r--r--lib/vbexport/boot_device.h1
-rw-r--r--lib/vbexport/boot_device_ide.c2
-rw-r--r--lib/vbexport/boot_device_scsi.c49
5 files changed, 54 insertions, 2 deletions
diff --git a/lib/vbexport/Makefile b/lib/vbexport/Makefile
index 974dd43488..dac7d521be 100644
--- a/lib/vbexport/Makefile
+++ b/lib/vbexport/Makefile
@@ -16,6 +16,7 @@ COBJS-$(CONFIG_CHROMEOS) += boot_device.o
COBJS-$(CONFIG_CHROMEOS_IDE) += boot_device_ide.o
COBJS-$(CONFIG_MMC) += boot_device_mmc.o
COBJS-$(CONFIG_CHROMEOS_USB) += boot_device_usb.o
+COBJS-$(CONFIG_SCSI_AHCI) += boot_device_scsi.o
COBJS-$(CONFIG_CHROMEOS) += display.o
COBJS-$(CONFIG_CHROMEOS) += keyboard.o
COBJS-$(CONFIG_CHROMEOS) += load_firmware.o
diff --git a/lib/vbexport/boot_device.c b/lib/vbexport/boot_device.c
index d3c43ba946..5392c73e43 100644
--- a/lib/vbexport/boot_device.c
+++ b/lib/vbexport/boot_device.c
@@ -202,5 +202,8 @@ int boot_device_init(void)
#ifdef CONFIG_CHROMEOS_IDE
err |= boot_device_ide_probe();
#endif
+#ifdef CONFIG_SCSI_AHCI
+ err |= boot_device_scsi_probe();
+#endif
return err;
}
diff --git a/lib/vbexport/boot_device.h b/lib/vbexport/boot_device.h
index f32fe1a6ec..1a0a69480a 100644
--- a/lib/vbexport/boot_device.h
+++ b/lib/vbexport/boot_device.h
@@ -66,6 +66,7 @@ int boot_device_matches(const block_dev_desc_t *dev, uint32_t disk_flags,
int boot_device_usb_probe(void);
int boot_device_mmc_probe(void);
int boot_device_ide_probe(void);
+int boot_device_scsi_probe(void);
/**
* Register all the available boot devices.
diff --git a/lib/vbexport/boot_device_ide.c b/lib/vbexport/boot_device_ide.c
index 7e8ee922b4..df948c6307 100644
--- a/lib/vbexport/boot_device_ide.c
+++ b/lib/vbexport/boot_device_ide.c
@@ -13,8 +13,6 @@
#include "boot_device.h"
-#include <vboot_api.h>
-
static int boot_device_ide_start(uint32_t disk_flags)
{
/* We expect to have at least one IDE device */
diff --git a/lib/vbexport/boot_device_scsi.c b/lib/vbexport/boot_device_scsi.c
new file mode 100644
index 0000000000..a70d6262fe
--- /dev/null
+++ b/lib/vbexport/boot_device_scsi.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ */
+
+#include <common.h>
+#include <scsi.h>
+
+#include "boot_device.h"
+
+static int boot_device_scsi_start(uint32_t disk_flags)
+{
+ /* We expect to have at least one SCSI device */
+ return 1;
+}
+
+static int boot_device_scsi_scan(block_dev_desc_t **desc, int max_devs,
+ uint32_t disk_flags)
+{
+ int index, found;
+
+ for (index = found = 0; index < max_devs; index++) {
+ block_dev_desc_t *scsi;
+
+ scsi = scsi_get_dev(index);
+ if (!scsi)
+ continue;
+
+ desc[found++] = scsi;
+ }
+ return found;
+}
+
+static struct boot_interface scsi_interface = {
+ .name = "scsi",
+ .type = IF_TYPE_SCSI,
+ .start = boot_device_scsi_start,
+ .scan = boot_device_scsi_scan,
+};
+
+int boot_device_scsi_probe(void)
+{
+ return boot_device_register_interface(&scsi_interface);
+}