* [U-Boot] [PATCH 02/20] scsi: Provide support for a list of AHCI controllers.
2012-10-19 3:44 [U-Boot] [PATCH 0/20] AHCI / SATA Improvements Simon Glass
@ 2012-10-19 3:44 ` Simon Glass
0 siblings, 0 replies; 2+ messages in thread
From: Simon Glass @ 2012-10-19 3:44 UTC (permalink / raw)
To: u-boot
From: Vadim Bendebury <vbendeb@chromium.org>
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.
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
---
common/cmd_scsi.c | 43 ++++++++++++++++++++++++++++++++++++++-----
1 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c
index 22d0119..3890afd 100644
--- a/common/cmd_scsi.c
+++ b/common/cmd_scsi.c
@@ -34,6 +34,14 @@
#include <image.h>
#include <pci.h>
+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
#ifndef CONFIG_SCSI_DEV_ID
@@ -49,8 +57,10 @@
#elif !defined(CONFIG_SCSI_AHCI_PLAT)
#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 */
@@ -178,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);
--
1.7.7.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH 02/20] scsi: Provide support for a list of AHCI controllers.
[not found] <508699D3.4090908@omicron.at>
@ 2012-10-23 13:51 ` Mark Marshall
0 siblings, 0 replies; 2+ messages in thread
From: Mark Marshall @ 2012-10-23 13:51 UTC (permalink / raw)
To: u-boot
On 19/10/12 05:44, Simon Glass wrote:
> From: Vadim Bendebury <vbendeb@chromium.org>
>
> 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.
I've written almost exactly the same code a few weeks ago, and was
about to try to push it. I won't, but I'll make some comments below.
>
> Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> common/cmd_scsi.c | 43 ++++++++++++++++++++++++++++++++++++++-----
> 1 files changed, 38 insertions(+), 5 deletions(-)
>
> diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c
> index 22d0119..3890afd 100644
> --- a/common/cmd_scsi.c
> +++ b/common/cmd_scsi.c
> @@ -34,6 +34,14 @@
> #include <image.h>
> #include <pci.h>
>
> +struct scsi_device {
> + u16 scsi_vendor_id;
> + u16 scsi_dev_id;
> +};
This isn't needed, you should use "struct pci_device_id".
> +
> +#ifdef CONFIG_SCSI_DEV_LIST
> +#define SCSI_DEV_LIST CONFIG_SCSI_DEV_LIST
> +#else
> #ifdef CONFIG_SCSI_SYM53C8XX
> #define SCSI_VEND_ID 0x1000
> #ifndef CONFIG_SCSI_DEV_ID
> @@ -49,8 +57,10 @@
> #elif !defined(CONFIG_SCSI_AHCI_PLAT)
> #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 */
> @@ -178,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;
> + }
Again, you don't need a for loop, use "pci_find_devices"
(with an S at the end)
>
> - 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);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-10-23 13:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <508699D3.4090908@omicron.at>
2012-10-23 13:51 ` [U-Boot] [PATCH 02/20] scsi: Provide support for a list of AHCI controllers Mark Marshall
2012-10-19 3:44 [U-Boot] [PATCH 0/20] AHCI / SATA Improvements Simon Glass
2012-10-19 3:44 ` [U-Boot] [PATCH 02/20] scsi: Provide support for a list of AHCI controllers Simon Glass
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox