Skip to contentSkip to conversation

Adding PCI ID tables to aic7xxx and aic79xxx

PATCH In review Luben Tuikov 4 participants 6 messages Oct 12, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Adding PCI ID tables to aic7xxx and aic79xxx

Adding proper PCI ID tables to aic7xxx and aic79xx.

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/10/12 13:35:39-04:00 [email protected]
# Adding proper PCI ID tables to aic7xxx and aic79xx drivers.
#

# drivers/scsi/aic7xxx/aiclib.h
#   2004/10/12 13:35:25-04:00 [email protected] +39 -0
#   Adding macros for generating the elements of PCI ID tables.
#
# drivers/scsi/aic7xxx/aic7xxx_pci.h
#   2004/10/12 13:35:25-04:00 [email protected] +45 -13
#   Adding copyright and proper macro declarations.
#
# drivers/scsi/aic7xxx/aic7xxx_pci.c
#   2004/10/12 13:35:25-04:00 [email protected] +13 -0
#   No need of this static function in this header file.
#
# drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
#   2004/10/12 13:35:25-04:00 [email protected] +18 -15
#   Adding proper PCI ID table.
#
# drivers/scsi/aic7xxx/aic79xx_pci.c
#   2004/10/12 13:35:25-04:00 [email protected] +2 -24
#   Moving ID definitions out of this file into their own.
#
# drivers/scsi/aic7xxx/aic79xx_osm_pci.c
#   2004/10/12 13:35:25-04:00 [email protected] +25 -9
#   Adding PCI ID table.
#
# drivers/scsi/aic7xxx/aic79xx_osm.h
#   2004/10/12 13:35:25-04:00 [email protected] +1 -0
#   Cosmetic.
#
# drivers/scsi/aic7xxx/aic79xx_pci.h
#   2004/10/12 11:09:00-04:00 [email protected] +70 -0
#
# drivers/scsi/aic7xxx/aic79xx_pci.h
#   2004/10/12 11:08:59-04:00 [email protected] +0 -0
#   BitKeeper file /home/luben/projects/scsi-misc-2.6/drivers/scsi/aic7xxx/aic79xx_pci.h
#
# drivers/scsi/aic7xxx/aic79xx_pci.c
#   2004/10/08 17:44:32-04:00 [email protected] +0 -0
#   *** empty log message ***
#
diff -Nru a/drivers/scsi/aic7xxx/aic79xx_osm.h b/drivers/scsi/aic7xxx/aic79xx_osm.h
--- a/drivers/scsi/aic7xxx/aic79xx_osm.h	2004-10-12 13:37:14 -04:00
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.h	2004-10-12 13:37:14 -04:00
@@ -1143,4 +1143,5 @@
 #endif
 #define bootverbose aic79xx_verbose
 extern uint32_t aic79xx_verbose;
+
 #endif /* _AIC79XX_LINUX_H_ */
diff -Nru a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
--- a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c	2004-10-12 13:37:14 -04:00
+++ b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c	2004-10-12 13:37:14 -04:00
@@ -41,6 +41,7 @@

#include "aic79xx_osm.h"
#include "aic79xx_inline.h"
+#include "aic79xx_pci.h"

static int ahd_linux_pci_dev_probe(struct pci_dev *pdev,
const struct pci_device_id *ent);
@@ -51,16 +52,31 @@
uint8_t **maddr);
static void ahd_linux_pci_dev_remove(struct pci_dev *pdev);

-/* We do our own ID filtering. So, grab all SCSI storage class devices. */ +/* Define the macro locally since it's different for different class of chips.
+ */
+#define ID(x) \
+ ID2C(x), \
+ ID2C(IDIROC(x))
+
static struct pci_device_id ahd_linux_pci_id_table[] = {
- {
- 0x9005, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
- PCI_CLASS_STORAGE_SCSI << 8, 0xFFFF00, 0
- },
- {
- 0x9005, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
- PCI_CLASS_STORAGE_RAID << 8, 0xFFFF00, 0
- },
+ /* aic7901 based controllers */
+ ID(ID_AHA_29320A),
+ ID(ID_AHA_29320ALP),
+ /* aic7902 based controllers */
+ ID(ID_AHA_29320),
+ ID(ID_AHA_29320B),
+ ID(ID_AHA_29320LP),
+ ID(ID_AHA_39320),
+ ID(ID_AHA_39320_B),
+ ID(ID_AHA_39320A),
+ ID(ID_AHA_39320D),
+ ID(ID_AHA_39320D_HP),
+ ID(ID_AHA_39320D_B),
+ ID(ID_AHA_39320D_B_HP),
+ /* Generic chip probes for devices we don't know exactly. */
+ ID16(ID_AIC7901 & ID_9005_GENERIC_MASK),
+ ID(ID_AIC7901A & ID_DEV_VENDOR_MASK),
+ ID16(ID_AIC7902 & ID_9005_GENERIC_MASK),
{ 0 }
};

drivers/scsi/aic7xxx/aic79xx_pci.c +2 -24
diff -Nru a/drivers/scsi/aic7xxx/aic79xx_pci.c b/drivers/scsi/aic7xxx/aic79xx_pci.c
@@ -51,6 +51,8 @@
 #include <dev/aic7xxx/aic79xx_inline.h>
 #endif
 
+#include "aic79xx_pci.h"
+
 static __inline uint64_t
 ahd_compose_id(u_int device, u_int vendor, u_int subdevice, u_int subvendor)
 {
@@ -64,30 +66,6 @@
 	return (id);
 }
 
-#define ID_ALL_MASK			0xFFFFFFFFFFFFFFFFull
-#define ID_ALL_IROC_MASK		0xFF7FFFFFFFFFFFFFull
-#define ID_DEV_VENDOR_MASK		0xFFFFFFFF00000000ull
-#define ID_9005_GENERIC_MASK		0xFFF0FFFF00000000ull
-#define ID_9005_GENERIC_IROC_MASK	0xFF70FFFF00000000ull
-
-#define ID_AIC7901			0x800F9005FFFF9005ull
-#define ID_AHA_29320A			0x8000900500609005ull
-#define ID_AHA_29320ALP			0x8017900500449005ull
-
-#define ID_AIC7901A			0x801E9005FFFF9005ull
-#define ID_AHA_29320			0x8012900500429005ull
-#define ID_AHA_29320B			0x8013900500439005ull
-#define ID_AHA_29320LP			0x8014900500449005ull
-
-#define ID_AIC7902			0x801F9005FFFF9005ull
-#define ID_AIC7902_B			0x801D9005FFFF9005ull
-#define ID_AHA_39320			0x8010900500409005ull
-#define ID_AHA_39320_B			0x8015900500409005ull
-#define ID_AHA_39320A			0x8016900500409005ull
-#define ID_AHA_39320D			0x8011900500419005ull
-#define ID_AHA_39320D_B			0x801C900500419005ull
-#define ID_AHA_39320D_HP		0x8011900500AC0E11ull
-#define ID_AHA_39320D_B_HP		0x801C900500AC0E11ull
 #define ID_AIC7902_PCI_REV_A4		0x3
 #define ID_AIC7902_PCI_REV_B0		0x10
 #define SUBID_HP			0x0E11
drivers/scsi/aic7xxx/aic79xx_pci.h new file +70 -0

70 lines not on this page · raw message

drivers/scsi/aic7xxx/aic7xxx_osm_pci.c +18 -15
diff -Nru a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
@@ -58,29 +58,27 @@
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 static void	ahc_linux_pci_dev_remove(struct pci_dev *pdev);
 
+/* Define the macro locally since it's different for different class of chips.
+*/
+#define ID(x)	ID_C(x, PCI_CLASS_STORAGE_SCSI)
+
 static struct pci_device_id ahc_linux_pci_id_table[] = {
-#define LINUXID(x,s) (unsigned)((((x) >> s) & 0xffff) ?: PCI_ANY_ID)
-#define ID(x) \
-	{ \
-		LINUXID(x,32), LINUXID(x,48), LINUXID(x,0), LINUXID(x,16), \
-		PCI_CLASS_STORAGE_SCSI << 8, 0xFFFF00, 0 \
-	}
-#define ID4(x,y) \
-	ID(x | ((y+0)<<48)), ID(x | ((y+1)<<48)), ID(x | ((y+2)<<48)), \
-	ID(x | ((y+3)<<48))
-#define ID16(x) ID4(x,0ULL), ID4(x,4ULL), ID4(x,8ULL), ID4(x,12ULL)
+	/* aic7850 based controllers */
 	ID(ID_AHA_2902_04_10_15_20C_30C),
+	/* aic7860 based controllers */
 	ID(ID_AHA_2930CU),
 	ID(ID_AHA_1480A & ID_DEV_VENDOR_MASK),
 	ID(ID_AHA_2940AU_0 & ID_DEV_VENDOR_MASK),
 	ID(ID_AHA_2940AU_CN & ID_DEV_VENDOR_MASK),
 	ID(ID_AHA_2930C_VAR & ID_DEV_VENDOR_MASK),
+	/* aic7870 based controllers */
 	ID(ID_AHA_2940),
 	ID(ID_AHA_3940),
 	ID(ID_AHA_398X),
 	ID(ID_AHA_2944),
 	ID(ID_AHA_3944),
 	ID(ID_AHA_4944),
+	/* aic7880 based controllers */
 	ID(ID_AHA_2940U & ID_DEV_VENDOR_MASK),
 	ID(ID_AHA_3940U & ID_DEV_VENDOR_MASK),
 	ID(ID_AHA_2944U & ID_DEV_VENDOR_MASK),
@@ -90,13 +88,15 @@
 	ID(ID_AHA_2930U & ID_DEV_VENDOR_MASK),
 	ID(ID_AHA_2940U_PRO & ID_DEV_VENDOR_MASK),
 	ID(ID_AHA_2940U_CN & ID_DEV_VENDOR_MASK),
+	/* aic7890 based controllers */
 	ID(ID_AHA_2930U2),
 	ID(ID_AHA_2940U2B),
 	ID(ID_AHA_2940U2_OEM),
 	ID(ID_AHA_2940U2),
 	ID(ID_AHA_2950U2B),
-	ID(ID_AIC7890_ARO),
+	ID16(ID_AIC7890_ARO & ID_AIC7895_ARO_MASK),
 	ID(ID_AAA_131U2),
+	/* aic7890 based controllers */
 	ID(ID_AHA_29160),
 	ID(ID_AHA_29160_CPQ),
 	ID(ID_AHA_29160N),
@@ -104,6 +104,7 @@
 	ID(ID_AHA_29160B),
 	ID(ID_AHA_19160B),
 	ID(ID_AIC7892_ARO),
+	/* aic7892 based controllers */
 	ID(ID_AHA_2940U_DUAL),
 	ID(ID_AHA_3940AU),
 	ID(ID_AHA_3944AU),
@@ -113,20 +114,22 @@
 	ID(ID_AHA_3950U2D_0),
 	ID(ID_AHA_3950U2D_1),
 	ID(ID_AIC7896_ARO),
+	/* aic7899 based controllers */
 	ID(ID_AHA_3960D),
 	ID(ID_AHA_3960D_CPQ),
 	ID(ID_AIC7899_ARO),
+	/* Generic chip probes for devices we don't know exactly. */
 	ID(ID_AIC7850 & ID_DEV_VENDOR_MASK),
 	ID(ID_AIC7855 & ID_DEV_VENDOR_MASK),
 	ID(ID_AIC7859 & ID_DEV_VENDOR_MASK),
 	ID(ID_AIC7860 & ID_DEV_VENDOR_MASK),
 	ID(ID_AIC7870 & ID_DEV_VENDOR_MASK),
 	ID(ID_AIC7880 & ID_DEV_VENDOR_MASK),
-	ID16(ID_AIC7890),
-	ID16(ID_AIC7892),
+ 	ID16(ID_AIC7890 & ID_9005_GENERIC_MASK),
+ 	ID16(ID_AIC7892 & ID_9005_GENERIC_MASK),
 	ID(ID_AIC7895 & ID_DEV_VENDOR_MASK),
-	ID(ID_AIC7896),
-	ID(ID_AIC7899),
+	ID16(ID_AIC7896 & ID_9005_GENERIC_MASK),
+	ID16(ID_AIC7899 & ID_9005_GENERIC_MASK),
 	ID(ID_AIC7810 & ID_DEV_VENDOR_MASK),
 	ID(ID_AIC7815 & ID_DEV_VENDOR_MASK),
 	{ 0 }
drivers/scsi/aic7xxx/aic7xxx_pci.c +13 -0
diff -Nru a/drivers/scsi/aic7xxx/aic7xxx_pci.c b/drivers/scsi/aic7xxx/aic7xxx_pci.c
@@ -56,6 +56,19 @@
 
 #include "aic7xxx_pci.h"
 
+static __inline uint64_t
+ahc_compose_id(u_int device, u_int vendor, u_int subdevice, u_int subvendor)
+{
+	uint64_t id;
+
+	id = subvendor
+	   | (subdevice << 16)
+	   | ((uint64_t)vendor << 32)
+	   | ((uint64_t)device << 48);
+
+	return (id);
+}
+
 #define AHC_PCI_IOADDR	PCIR_MAPS	/* I/O Address */
 #define AHC_PCI_MEMADDR	(PCIR_MAPS + 4)	/* Mem I/O Address */
 
drivers/scsi/aic7xxx/aic7xxx_pci.h +45 -13

64 lines not on this page · raw message

drivers/scsi/aic7xxx/aiclib.h +39 -0
diff -Nru a/drivers/scsi/aic7xxx/aiclib.h b/drivers/scsi/aic7xxx/aiclib.h
@@ -1043,4 +1043,43 @@
 	return (rv);
 }
 
+/* Macros for generating the elements of the PCI ID tables. */
+
+#define GETID(v, s) (unsigned)(((v) >> (s)) & 0xFFFF ?: PCI_ANY_ID)
+
+#define ID_C(x, c)						\
+{								\
+	GETID(x,32), GETID(x,48), GETID(x,0), GETID(x,16),	\
+	(c) << 8, 0xFFFF00, 0					\
+}
+
+#define ID2C(x)                          \
+	ID_C(x, PCI_CLASS_STORAGE_SCSI), \
+	ID_C(x, PCI_CLASS_STORAGE_RAID)
+
+#define IDIROC(x)  ((x) | ~ID_ALL_IROC_MASK)
+
+/* Generate IDs for all 16 possibilites.
+ * The argument has already masked out
+ * the 4 least significant bits of the device id.
+ * (e.g., mask: ID_9005_GENERIC_MASK).
+ */
+#define ID16(x)                          \
+	ID(x),                           \
+	ID((x) | 0x0001000000000000ull), \
+	ID((x) | 0x0002000000000000ull), \
+	ID((x) | 0x0003000000000000ull), \
+	ID((x) | 0x0004000000000000ull), \
+	ID((x) | 0x0005000000000000ull), \
+	ID((x) | 0x0006000000000000ull), \
+	ID((x) | 0x0007000000000000ull), \
+	ID((x) | 0x0008000000000000ull), \
+	ID((x) | 0x0009000000000000ull), \
+	ID((x) | 0x000A000000000000ull), \
+	ID((x) | 0x000B000000000000ull), \
+	ID((x) | 0x000C000000000000ull), \
+	ID((x) | 0x000D000000000000ull), \
+	ID((x) | 0x000E000000000000ull), \
+	ID((x) | 0x000F000000000000ull)
+
 #endif /*_AICLIB_H */
#1 lore raw

Any chance you could

a) use normal constanst instead of taking apart the "wrong" (aka FreeBSDish) constants and put them back together
b) remove the double-matching

aka try to hack something like my last two untested patches. While the this patch is a functional improvement over what we have it's still totally obsfucated.

#2 lore raw
In reply to Luben Tuikov
Quoted 1 line · Luben Tuikov

Adding proper PCI ID tables to aic7xxx and aic79xx.

ACK, but I wonder if (long term) a follow-up patch to split up the IDs into their individual components wouldn't be nice? That would make the driver much more consistent with other Linux PCI drivers.

Regards,

Jeff

#3 lore raw
Quoted 7 lines · Jeff Garzik
Quoted 1 line · Luben Tuikov

Adding proper PCI ID tables to aic7xxx and aic79xx.

ACK, but I wonder if (long term) a follow-up patch to split up the IDs into their individual components wouldn't be nice? That would make the driver much more consistent with other Linux PCI drivers.

Possibly in the future. I just wanted to provide working aic drivers for 2.6.9-rc3 over Andi's patch, so ppl can boot their machines.

The patch applies over HOL scsi-misc-2.6.

Luben

#4 lore raw
In reply to Luben Tuikov
Quoted 1 line · Luben Tuikov

Adding proper PCI ID tables to aic7xxx and aic79xx.

This rejects comprehensively and completely. I think there's a mailer mangling issue with leading spaces ... could you fix your mailer or resend as an attachment.

Thanks,

James

#5 lore raw

The patch is attached to this email.

Thanks,
Luben

P.S. No idea what is wrong with my mailer.

Quoted 5 lines · James Bottomley
Quoted 1 line · Luben Tuikov

Adding proper PCI ID tables to aic7xxx and aic79xx.

Quoted 9 lines

This rejects comprehensively and completely. I think there's a mailer mangling issue with leading spaces ... could you fix your mailer or resend as an attachment.

Thanks,

James

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/10/12 13:35:39-04:00 [email protected]
# Adding proper PCI ID tables to aic7xxx and aic79xx drivers.
#

# drivers/scsi/aic7xxx/aiclib.h
#   2004/10/12 13:35:25-04:00 [email protected] +39 -0
#   Adding macros for generating the elements of PCI ID tables.
# 
# drivers/scsi/aic7xxx/aic7xxx_pci.h
#   2004/10/12 13:35:25-04:00 [email protected] +45 -13
#   Adding copyright and proper macro declarations.
# 
# drivers/scsi/aic7xxx/aic7xxx_pci.c
#   2004/10/12 13:35:25-04:00 [email protected] +13 -0
#   No need of this static function in this header file.
# 
# drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
#   2004/10/12 13:35:25-04:00 [email protected] +18 -15
#   Adding proper PCI ID table.
# 
# drivers/scsi/aic7xxx/aic79xx_pci.c
#   2004/10/12 13:35:25-04:00 [email protected] +2 -24
#   Moving ID definitions out of this file into their own.
# 
# drivers/scsi/aic7xxx/aic79xx_osm_pci.c
#   2004/10/12 13:35:25-04:00 [email protected] +25 -9
#   Adding PCI ID table.
# 
# drivers/scsi/aic7xxx/aic79xx_osm.h
#   2004/10/12 13:35:25-04:00 [email protected] +1 -0
#   Cosmetic.
# 
# drivers/scsi/aic7xxx/aic79xx_pci.h
#   2004/10/12 11:09:00-04:00 [email protected] +70 -0
# 
# drivers/scsi/aic7xxx/aic79xx_pci.h
#   2004/10/12 11:08:59-04:00 [email protected] +0 -0
#   BitKeeper file /home/luben/projects/scsi-misc-2.6/drivers/scsi/aic7xxx/aic79xx_pci.h
# 
# drivers/scsi/aic7xxx/aic79xx_pci.c
#   2004/10/08 17:44:32-04:00 [email protected] +0 -0
#   *** empty log message ***
# 
diff -Nru a/drivers/scsi/aic7xxx/aic79xx_osm.h b/drivers/scsi/aic7xxx/aic79xx_osm.h
--- a/drivers/scsi/aic7xxx/aic79xx_osm.h	2004-10-12 13:37:14 -04:00
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.h	2004-10-12 13:37:14 -04:00
@@ -1143,4 +1143,5 @@
 #endif
 #define bootverbose aic79xx_verbose
 extern uint32_t aic79xx_verbose;
+
 #endif /* _AIC79XX_LINUX_H_ */
diff -Nru a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
--- a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c	2004-10-12 13:37:14 -04:00
+++ b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c	2004-10-12 13:37:14 -04:00
@@ -41,6 +41,7 @@

#include "aic79xx_osm.h"
#include "aic79xx_inline.h"
+#include "aic79xx_pci.h"

static int ahd_linux_pci_dev_probe(struct pci_dev *pdev,
const struct pci_device_id *ent);
@@ -51,16 +52,31 @@
uint8_t **maddr);
static void ahd_linux_pci_dev_remove(struct pci_dev *pdev);

-/* We do our own ID filtering. So, grab all SCSI storage class devices. */ +/* Define the macro locally since it's different for different class of chips.
+ */
+#define ID(x) \
+ ID2C(x), \
+ ID2C(IDIROC(x))
+
static struct pci_device_id ahd_linux_pci_id_table[] = {
- {
- 0x9005, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
- PCI_CLASS_STORAGE_SCSI << 8, 0xFFFF00, 0
- },
- {
- 0x9005, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
- PCI_CLASS_STORAGE_RAID << 8, 0xFFFF00, 0
- },
+ /* aic7901 based controllers */
+ ID(ID_AHA_29320A),
+ ID(ID_AHA_29320ALP),
+ /* aic7902 based controllers */
+ ID(ID_AHA_29320),
+ ID(ID_AHA_29320B),
+ ID(ID_AHA_29320LP),
+ ID(ID_AHA_39320),
+ ID(ID_AHA_39320_B),
+ ID(ID_AHA_39320A),
+ ID(ID_AHA_39320D),
+ ID(ID_AHA_39320D_HP),
+ ID(ID_AHA_39320D_B),
+ ID(ID_AHA_39320D_B_HP),
+ /* Generic chip probes for devices we don't know exactly. */
+ ID16(ID_AIC7901 & ID_9005_GENERIC_MASK),
+ ID(ID_AIC7901A & ID_DEV_VENDOR_MASK),
+ ID16(ID_AIC7902 & ID_9005_GENERIC_MASK),
{ 0 }
};

drivers/scsi/aic7xxx/aic79xx_pci.c +2 -24
diff -Nru a/drivers/scsi/aic7xxx/aic79xx_pci.c b/drivers/scsi/aic7xxx/aic79xx_pci.c
@@ -51,6 +51,8 @@
 #include <dev/aic7xxx/aic79xx_inline.h>
 #endif
 
+#include "aic79xx_pci.h"
+
 static __inline uint64_t
 ahd_compose_id(u_int device, u_int vendor, u_int subdevice, u_int subvendor)
 {
@@ -64,30 +66,6 @@
 	return (id);
 }
 
-#define ID_ALL_MASK			0xFFFFFFFFFFFFFFFFull
-#define ID_ALL_IROC_MASK		0xFF7FFFFFFFFFFFFFull
-#define ID_DEV_VENDOR_MASK		0xFFFFFFFF00000000ull
-#define ID_9005_GENERIC_MASK		0xFFF0FFFF00000000ull
-#define ID_9005_GENERIC_IROC_MASK	0xFF70FFFF00000000ull
-
-#define ID_AIC7901			0x800F9005FFFF9005ull
-#define ID_AHA_29320A			0x8000900500609005ull
-#define ID_AHA_29320ALP			0x8017900500449005ull
-
-#define ID_AIC7901A			0x801E9005FFFF9005ull
-#define ID_AHA_29320			0x8012900500429005ull
-#define ID_AHA_29320B			0x8013900500439005ull
-#define ID_AHA_29320LP			0x8014900500449005ull
-
-#define ID_AIC7902			0x801F9005FFFF9005ull
-#define ID_AIC7902_B			0x801D9005FFFF9005ull
-#define ID_AHA_39320			0x8010900500409005ull
-#define ID_AHA_39320_B			0x8015900500409005ull
-#define ID_AHA_39320A			0x8016900500409005ull
-#define ID_AHA_39320D			0x8011900500419005ull
-#define ID_AHA_39320D_B			0x801C900500419005ull
-#define ID_AHA_39320D_HP		0x8011900500AC0E11ull
-#define ID_AHA_39320D_B_HP		0x801C900500AC0E11ull
 #define ID_AIC7902_PCI_REV_A4		0x3
 #define ID_AIC7902_PCI_REV_B0		0x10
 #define SUBID_HP			0x0E11
drivers/scsi/aic7xxx/aic79xx_pci.h new file +70 -0

70 lines not on this page · raw message

drivers/scsi/aic7xxx/aic7xxx_osm_pci.c +18 -15
diff -Nru a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
@@ -58,29 +58,27 @@
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 static void	ahc_linux_pci_dev_remove(struct pci_dev *pdev);
 
+/* Define the macro locally since it's different for different class of chips.
+*/
+#define ID(x)	ID_C(x, PCI_CLASS_STORAGE_SCSI)
+
 static struct pci_device_id ahc_linux_pci_id_table[] = {
-#define LINUXID(x,s) (unsigned)((((x) >> s) & 0xffff) ?: PCI_ANY_ID)
-#define ID(x) \
-	{ \
-		LINUXID(x,32), LINUXID(x,48), LINUXID(x,0), LINUXID(x,16), \
-		PCI_CLASS_STORAGE_SCSI << 8, 0xFFFF00, 0 \
-	}
-#define ID4(x,y) \
-	ID(x | ((y+0)<<48)), ID(x | ((y+1)<<48)), ID(x | ((y+2)<<48)), \
-	ID(x | ((y+3)<<48))
-#define ID16(x) ID4(x,0ULL), ID4(x,4ULL), ID4(x,8ULL), ID4(x,12ULL)
+	/* aic7850 based controllers */
 	ID(ID_AHA_2902_04_10_15_20C_30C),
+	/* aic7860 based controllers */
 	ID(ID_AHA_2930CU),
 	ID(ID_AHA_1480A & ID_DEV_VENDOR_MASK),
 	ID(ID_AHA_2940AU_0 & ID_DEV_VENDOR_MASK),
 	ID(ID_AHA_2940AU_CN & ID_DEV_VENDOR_MASK),
 	ID(ID_AHA_2930C_VAR & ID_DEV_VENDOR_MASK),
+	/* aic7870 based controllers */
 	ID(ID_AHA_2940),
 	ID(ID_AHA_3940),
 	ID(ID_AHA_398X),
 	ID(ID_AHA_2944),
 	ID(ID_AHA_3944),
 	ID(ID_AHA_4944),
+	/* aic7880 based controllers */
 	ID(ID_AHA_2940U & ID_DEV_VENDOR_MASK),
 	ID(ID_AHA_3940U & ID_DEV_VENDOR_MASK),
 	ID(ID_AHA_2944U & ID_DEV_VENDOR_MASK),
@@ -90,13 +88,15 @@
 	ID(ID_AHA_2930U & ID_DEV_VENDOR_MASK),
 	ID(ID_AHA_2940U_PRO & ID_DEV_VENDOR_MASK),
 	ID(ID_AHA_2940U_CN & ID_DEV_VENDOR_MASK),
+	/* aic7890 based controllers */
 	ID(ID_AHA_2930U2),
 	ID(ID_AHA_2940U2B),
 	ID(ID_AHA_2940U2_OEM),
 	ID(ID_AHA_2940U2),
 	ID(ID_AHA_2950U2B),
-	ID(ID_AIC7890_ARO),
+	ID16(ID_AIC7890_ARO & ID_AIC7895_ARO_MASK),
 	ID(ID_AAA_131U2),
+	/* aic7890 based controllers */
 	ID(ID_AHA_29160),
 	ID(ID_AHA_29160_CPQ),
 	ID(ID_AHA_29160N),
@@ -104,6 +104,7 @@
 	ID(ID_AHA_29160B),
 	ID(ID_AHA_19160B),
 	ID(ID_AIC7892_ARO),
+	/* aic7892 based controllers */
 	ID(ID_AHA_2940U_DUAL),
 	ID(ID_AHA_3940AU),
 	ID(ID_AHA_3944AU),
@@ -113,20 +114,22 @@
 	ID(ID_AHA_3950U2D_0),
 	ID(ID_AHA_3950U2D_1),
 	ID(ID_AIC7896_ARO),
+	/* aic7899 based controllers */
 	ID(ID_AHA_3960D),
 	ID(ID_AHA_3960D_CPQ),
 	ID(ID_AIC7899_ARO),
+	/* Generic chip probes for devices we don't know exactly. */
 	ID(ID_AIC7850 & ID_DEV_VENDOR_MASK),
 	ID(ID_AIC7855 & ID_DEV_VENDOR_MASK),
 	ID(ID_AIC7859 & ID_DEV_VENDOR_MASK),
 	ID(ID_AIC7860 & ID_DEV_VENDOR_MASK),
 	ID(ID_AIC7870 & ID_DEV_VENDOR_MASK),
 	ID(ID_AIC7880 & ID_DEV_VENDOR_MASK),
-	ID16(ID_AIC7890),
-	ID16(ID_AIC7892),
+ 	ID16(ID_AIC7890 & ID_9005_GENERIC_MASK),
+ 	ID16(ID_AIC7892 & ID_9005_GENERIC_MASK),
 	ID(ID_AIC7895 & ID_DEV_VENDOR_MASK),
-	ID(ID_AIC7896),
-	ID(ID_AIC7899),
+	ID16(ID_AIC7896 & ID_9005_GENERIC_MASK),
+	ID16(ID_AIC7899 & ID_9005_GENERIC_MASK),
 	ID(ID_AIC7810 & ID_DEV_VENDOR_MASK),
 	ID(ID_AIC7815 & ID_DEV_VENDOR_MASK),
 	{ 0 }
drivers/scsi/aic7xxx/aic7xxx_pci.c +13 -0
diff -Nru a/drivers/scsi/aic7xxx/aic7xxx_pci.c b/drivers/scsi/aic7xxx/aic7xxx_pci.c
@@ -56,6 +56,19 @@
 
 #include "aic7xxx_pci.h"
 
+static __inline uint64_t
+ahc_compose_id(u_int device, u_int vendor, u_int subdevice, u_int subvendor)
+{
+	uint64_t id;
+
+	id = subvendor
+	   | (subdevice << 16)
+	   | ((uint64_t)vendor << 32)
+	   | ((uint64_t)device << 48);
+
+	return (id);
+}
+
 #define AHC_PCI_IOADDR	PCIR_MAPS	/* I/O Address */
 #define AHC_PCI_MEMADDR	(PCIR_MAPS + 4)	/* Mem I/O Address */
 
drivers/scsi/aic7xxx/aic7xxx_pci.h +45 -13

64 lines not on this page · raw message

drivers/scsi/aic7xxx/aiclib.h +39 -0
diff -Nru a/drivers/scsi/aic7xxx/aiclib.h b/drivers/scsi/aic7xxx/aiclib.h
@@ -1043,4 +1043,43 @@
 	return (rv);
 }
 
+/* Macros for generating the elements of the PCI ID tables. */
+
+#define GETID(v, s) (unsigned)(((v) >> (s)) & 0xFFFF ?: PCI_ANY_ID)
+
+#define ID_C(x, c)						\
+{								\
+	GETID(x,32), GETID(x,48), GETID(x,0), GETID(x,16),	\
+	(c) << 8, 0xFFFF00, 0					\
+}
+
+#define ID2C(x)                          \
+	ID_C(x, PCI_CLASS_STORAGE_SCSI), \
+	ID_C(x, PCI_CLASS_STORAGE_RAID)
+
+#define IDIROC(x)  ((x) | ~ID_ALL_IROC_MASK)
+
+/* Generate IDs for all 16 possibilites.
+ * The argument has already masked out
+ * the 4 least significant bits of the device id.
+ * (e.g., mask: ID_9005_GENERIC_MASK).
+ */
+#define ID16(x)                          \
+	ID(x),                           \
+	ID((x) | 0x0001000000000000ull), \
+	ID((x) | 0x0002000000000000ull), \
+	ID((x) | 0x0003000000000000ull), \
+	ID((x) | 0x0004000000000000ull), \
+	ID((x) | 0x0005000000000000ull), \
+	ID((x) | 0x0006000000000000ull), \
+	ID((x) | 0x0007000000000000ull), \
+	ID((x) | 0x0008000000000000ull), \
+	ID((x) | 0x0009000000000000ull), \
+	ID((x) | 0x000A000000000000ull), \
+	ID((x) | 0x000B000000000000ull), \
+	ID((x) | 0x000C000000000000ull), \
+	ID((x) | 0x000D000000000000ull), \
+	ID((x) | 0x000E000000000000ull), \
+	ID((x) | 0x000F000000000000ull)
+
 #endif /*_AICLIB_H */