diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2011-09-06 15:33:35 -0700 |
---|---|---|
committer | Vadim Bendebury <vbendeb@chromium.org> | 2011-09-06 17:21:58 -0700 |
commit | 1b86fcbb0ce83120401ae97eaf2fa5477aa00513 (patch) | |
tree | a20dbe24fa098251e632b96fac9e24fe9aa31cba | |
parent | b10d21b57ceb1d1b10d8ea655ba2ca0711494098 (diff) |
Provide support for a list of AHCI controllers.
Many AHCI controllers are identical, the main (and often the
only) difference being the PCI Vendor ID/Device ID combination
reported by the device.
This change allows the config file to define a list of PCI vendor
ID/device ID pairs. The driver would scan the list and initialize
the first device it finds.
No actual multiple device list is introduced yet, this change
just add the framework.
BUG=chromium-os:19837
TEST=manual
. program updated image on an Alex.
. restart the machine and enter `vboot_twostop' at u-boot prompt.
Observe ChromeOS booting all the way to login screen.
Change-Id: I5253a3da798d7602dd09694fa3c029e92e1e0c65
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/7297
Reviewed-by: Gabe Black (Do Not Use) <gabeblack@google.com>
Reviewed-by: Stefan Reinauer <reinauer@google.com>
-rw-r--r-- | common/cmd_scsi.c | 44 | ||||
-rw-r--r-- | include/configs/coreboot.h | 4 |
2 files changed, 38 insertions, 10 deletions
diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c index 6e705d2486..82d049bf5d 100644 --- a/common/cmd_scsi.c +++ b/common/cmd_scsi.c @@ -34,9 +34,13 @@ #include <image.h> #include <pci.h> -#ifdef CONFIG_SCSI_VEND_ID -#define SCSI_VEND_ID CONFIG_SCSI_VEND_ID -#define SCSI_DEV_ID CONFIG_SCSI_DEV_ID +struct scsi_device { + u16 scsi_vendor_id; + u16 scsi_dev_id; +}; + +#ifdef CONFIG_SCSI_DEV_LIST +#define SCSI_DEV_LIST CONFIG_SCSI_DEV_LIST #else #ifdef CONFIG_SCSI_SYM53C8XX #define SCSI_VEND_ID 0x1000 @@ -53,9 +57,10 @@ #else #error no scsi device defined #endif +#define SCSI_DEV_LIST {SCSI_VEND_ID, SCSI_DEV_ID} #endif - +static struct scsi_device scsi_device_list[] = { SCSI_DEV_LIST }; static ccb tempccb; /* temporary scsi command buffer */ static unsigned char tempbuff[512]; /* temporary data buffer */ @@ -183,15 +188,38 @@ removable: void scsi_init(void) { int busdevfunc; + int i; + /* + * Find a device from the list, this driver will support a single + * controller. + */ + for (i = 0; i < ARRAY_SIZE(scsi_device_list); i++) { + /* get PCI Device ID */ + busdevfunc = pci_find_device(scsi_device_list[i].scsi_vendor_id, + scsi_device_list[i].scsi_dev_id, + 0); + if (busdevfunc != -1) + break; + } - busdevfunc=pci_find_device(SCSI_VEND_ID,SCSI_DEV_ID,0); /* get PCI Device ID */ - if(busdevfunc==-1) { - printf("Error SCSI Controller (%04X,%04X) not found\n",SCSI_VEND_ID,SCSI_DEV_ID); + if (busdevfunc == -1) { + printf("Error: SCSI Controller(s) "); + for (i = 0; i < ARRAY_SIZE(scsi_device_list); i++) { + printf("%04X:%04X ", + scsi_device_list[i].scsi_vendor_id, + scsi_device_list[i].scsi_dev_id); + } + printf("not found\n"); return; } #ifdef DEBUG else { - printf("SCSI Controller (%04X,%04X) found (%d:%d:%d)\n",SCSI_VEND_ID,SCSI_DEV_ID,(busdevfunc>>16)&0xFF,(busdevfunc>>11)&0x1F,(busdevfunc>>8)&0x7); + printf("SCSI Controller (%04X,%04X) found (%d:%d:%d)\n", + scsi_device_list[i].scsi_vendor_id, + scsi_device_list[i].scsi_dev_id, + (busdevfunc >> 16) & 0xFF, + (busdevfunc >> 11) & 0x1F, + (busdevfunc >> 8) & 0x7); } #endif scsi_low_level_init(busdevfunc); diff --git a/include/configs/coreboot.h b/include/configs/coreboot.h index c5b0965c4c..1de30109a8 100644 --- a/include/configs/coreboot.h +++ b/include/configs/coreboot.h @@ -55,8 +55,8 @@ #ifdef CONFIG_SCSI_AHCI #define CONFIG_SATA_INTEL 1 -#define CONFIG_SCSI_VEND_ID PCI_VENDOR_ID_INTEL -#define CONFIG_SCSI_DEV_ID PCI_DEVICE_ID_INTEL_NM10_AHCI +#define CONFIG_SCSI_DEV_LIST {PCI_VENDOR_ID_INTEL, \ + PCI_DEVICE_ID_INTEL_NM10_AHCI} #define CONFIG_SYS_SCSI_MAX_SCSI_ID 1 #define CONFIG_SYS_SCSI_MAX_LUN 1 |