Return-Path: jes@wildopensource.com
Delivery-Date: Sat Apr 13 16:37:02 2002
Return-Path: <jes@wildopensource.com>
Delivered-To: grundler@parisc-linux.org
Received: from trained-monkey.org (trained-monkey.org [209.217.122.11])
	by dsl2.external.hp.com (Postfix) with ESMTP id 32D5E482A
	for <grundler@parisc-linux.org>; Sat, 13 Apr 2002 16:37:01 -0600 (MDT)
Received: (from jes@localhost)
	by trained-monkey.org (8.11.6/8.9.3) id g3DMadQ29494;
	Sat, 13 Apr 2002 18:36:39 -0400
Date: Sat, 13 Apr 2002 18:36:39 -0400
Message-Id: <200204132236.g3DMadQ29494@trained-monkey.org>
X-Authentication-Warning: trained-monkey.org: jes set sender to jes@wildopensource.com using -f
From: Jes Sorensen <jes@wildopensource.com>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Grant Grundler <grundler@parisc-linux.org>,
	Martin Kasper Petersen <mkp@mkp.net>,
	Marcelo Tosatti <marcelo@conectiva.com.br>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>, fibrechannel@compaq.com
Subject: [patch] cpqfc.o

Hi

Please find attached a patch that makes the cpqfc driver recognize the
HP Tachyon. I moved the device list to an __initdata structure so the
driver doesn't build it at runtime and changed it to use the proper
PCI_DEVICE_ID_* names.

With this patch applied, the driver happily detects the disks attached
to my HP Tachyon.

Patch is relative to 2.5.8-pre3, however I would expect it to apply
cleanly to 2.4.x as well.

Thanks,
Jes

--- ../torvalds/linux-2.5.8-pre3/drivers/scsi/cpqfcTSinit.c	Thu Mar  7 21:18:08 2002
+++ drivers/scsi/cpqfcTSinit.c	Sat Apr 13 20:01:12 2002
@@ -261,10 +261,22 @@
 /* "Entry" point to discover if any supported PCI 
    bus adapter can be found
 */
-// We're supporting:
-// Compaq 64-bit, 66MHz HBA with Tachyon TS
-// Agilent XL2 
-#define HBA_TYPES 2
+/* We're supporting:
+ * Compaq 64-bit, 66MHz HBA with Tachyon TS
+ * Agilent XL2 
+ * HP Tachyon
+ */
+#define HBA_TYPES 3
+
+#ifndef PCI_DEVICE_ID_COMPAQ_
+#define PCI_DEVICE_ID_COMPAQ_TACHYON	0xa0fc
+#endif
+
+static struct SupportedPCIcards cpqfc_boards[] __initdata = {
+	{PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_TACHYON},
+	{PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_TACHLITE},
+	{PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_TACHYON},
+};
 
 
 int cpqfcTS_detect(Scsi_Host_Template *ScsiHostTemplate)
@@ -274,35 +286,28 @@
   struct Scsi_Host *HostAdapter = NULL;
   CPQFCHBA *cpqfcHBAdata = NULL; 
   struct timer_list *cpqfcTStimer = NULL;
-  SupportedPCIcards PCIids[HBA_TYPES];
   int i;
-  
+
   ENTER("cpqfcTS_detect");
-  
+
 #if LINUX_VERSION_CODE < LinuxVersionCode(2,3,27)
   ScsiHostTemplate->proc_dir = &proc_scsi_cpqfcTS;
 #else
   ScsiHostTemplate->proc_name = "cpqfcTS";
 #endif
-  
+
   if( pci_present() == 0) // no PCI busses?
   {
     printk( "  no PCI bus?@#!\n");
     return NumberOfAdapters;
   }
 
-  // what HBA adapters are we supporting?
-  PCIids[0].vendor_id = PCI_VENDOR_ID_COMPAQ;
-  PCIids[0].device_id = CPQ_DEVICE_ID;
-  PCIids[1].vendor_id = PCI_VENDOR_ID_HP; // i.e. 103Ch (Agilent == HP for now)
-  PCIids[1].device_id = AGILENT_XL2_ID;   // i.e. 1029h
-
   for( i=0; i < HBA_TYPES; i++)
   {
     // look for all HBAs of each type
 
-    while( (PciDev =
-      pci_find_device( PCIids[i].vendor_id, PCIids[i].device_id, PciDev) ))
+    while((PciDev = pci_find_device(cpqfc_boards[i].vendor_id,
+				    cpqfc_boards[i].device_id, PciDev)))
     {
 
       if (pci_set_dma_mask(PciDev, CPQFCTS_DMA_MASK) != 0) {
--- ../torvalds/linux-2.5.8-pre3/drivers/scsi/cpqfcTSstructs.h	Thu Mar  7 21:18:28 2002
+++ drivers/scsi/cpqfcTSstructs.h	Sat Apr 13 20:01:34 2002
@@ -95,14 +95,11 @@
 
 #define DEV_NAME "cpqfcTS"
 
-#define CPQ_DEVICE_ID     0xA0FC
-#define AGILENT_XL2_ID    0x1029
-
-typedef struct
+struct SupportedPCIcards
 {
   __u16 vendor_id;
   __u16 device_id;
-} SupportedPCIcards;
+};
 			 
 // nn:nn denotes bit field
                             // TachyonHeader struct def.
--- ../torvalds/linux-2.5.8-pre3/include/linux/pci_ids.h	Thu Apr 11 23:23:30 2002
+++ include/linux/pci_ids.h	Sat Apr 13 20:01:22 2002
@@ -133,6 +133,7 @@
 #define PCI_DEVICE_ID_COMPAQ_1280	0x3033
 #define PCI_DEVICE_ID_COMPAQ_TRIFLEX	0x4000
 #define PCI_DEVICE_ID_COMPAQ_6010	0x6010
+#define PCI_DEVICE_ID_COMPAQ_TACHYON	0xa0fc
 #define PCI_DEVICE_ID_COMPAQ_SMART2P	0xae10
 #define PCI_DEVICE_ID_COMPAQ_NETEL100	0xae32
 #define PCI_DEVICE_ID_COMPAQ_NETEL10	0xae34
