Add proper module ID tables to Adaptec aic7[9x]xx drivers
Subsystems (2)
PATCH 1/1 Add proper module ID tables to Adaptec aic7[9x]xx drivers
[I didn't find an aic7xxx maintainer in MAINTAINERS, so just sending to the list]
This is needed for 2.6 hotplug where the driver is autoloaded. When you have multiple conflicting entries the hotplug module loader usually loads the first one listed, which may be correct or may be not.
With these changes the drivers announce the correct PCI IDs.
The patches are quite big (i had to move the ID tables into an include), but mostly mechanical.
I only tested it on a single 78xx, so it's possible that i made a typo somewhere. Some testing would be appreciated, especially on 79xx
There is still an conflicting entry for aic7xxx_old unfortunately. This is hard to handle in hotplug. I think the right solution would be to somehow tag drivers as obsolete so that they aren't loaded by default. This will need an extension in the module pci table mechanism. I'm thinking about a a new MODULE_OBSOLETE macro for this and a obsolete_modules table generated at modules_install time. But that's for another patch. Better would be maybe to just drop the aic7xxx_old driver. Is it really still needed?
-Andi
drivers/scsi/aic7xxx/aic79xx_pci.c renamed from drivers/scsi/aic7xxx/aic79xx_pci.c-o +1 -40
@@ -51,46 +51,7 @@#include <dev/aic7xxx/aic79xx_inline.h> #endif -static __inlineuint64_t -ahd_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 ID_ALL_MASK 0xFFFFFFFFFFFFFFFFull -#define ID_ALL_IROC_MASK 0xFFFFFF7FFFFFFFFFull -#define ID_DEV_VENDOR_MASK 0xFFFFFFFF00000000ull -#define ID_9005_GENERIC_MASK 0xFFF0FFFF00000000ull -#define ID_9005_GENERIC_IROC_MASK 0xFFF0FF7F00000000ull - -#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 +#include "aic79xx_pci.h" #define DEVID_9005_TYPE (id) ((id) & 0xF)#define DEVID_9005_TYPE_HBA 0x0/* Standard Card */
drivers/scsi/aic7xxx/aic79xx_osm_pci.c renamed from drivers/scsi/aic7xxx/aic79xx_osm_pci.c-o +24 -5
@@ -41,6 +41,7 @@#include "aic79xx_osm.h" #include "aic79xx_inline.h" +#include "aic79xx_pci.h" #if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,4 ,0 )struct pci_device_id
@@ -58,12 +59,30 @@#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,4 ,0 )static void ahd_linux_pci_dev_remove (struct pci_dev *pdev); -/* We do our own ID filtering. So, grab all SCSI storage class devices. */ 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 - }, +#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 \ + } +ID (ID_AHA_29320A ), +ID (ID_AHA_29320ALP ), +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 ), +ID (ID_AHA_29320 ), +ID (ID_AHA_29320B ), +ID (ID_AIC7901 &ID_DEV_VENDOR_MASK ), +ID (ID_AIC7901A &ID_DEV_VENDOR_MASK ), +ID (ID_AIC7902 &ID_9005_GENERIC_MASK ), {0 } };
drivers/scsi/aic7xxx/aic79xx_pci.h new file +41 -0
41 lines not on this page · raw message
drivers/scsi/aic7xxx/aic7xxx_pci.h new file +92 -0
92 lines not on this page · raw message
drivers/scsi/aic7xxx/aic7xxx_pci.c renamed from drivers/scsi/aic7xxx/aic7xxx_pci.c-o +2 -92
103 lines not on this page · raw message
drivers/scsi/aic7xxx/aic7xxx_osm_pci.c renamed from drivers/scsi/aic7xxx/aic7xxx_osm_pci.c-o +67 -9
89 lines not on this page · raw message
Quoted 5 lines · On Mon, 21 Jun 2004 16:14:41 +0200 Andi Kleen wrote:
This is needed for 2.6 hotplug where the driver is autoloaded. When you have multiple conflicting entries the hotplug module loader usually loads the first one listed, which may be correct or may be not.
With these changes the drivers announce the correct PCI IDs.
Unfortunately, the patch does not seem to be correct :(
struct pci_device_id does not have the mask field, therefore the ID_9005_GENERIC_MASK restriction cannot be specified other than by listing all 16 possible IDs as separate entries. Your patch adds only one entry, thus losing 15 other possible IDs.
Quoted 6 lines · On Mon, 21 Jun 2004 17:44:08 +0400 Sergey Vlasov <[email protected]> wrote:
Quoted 4 lines · On Mon, 21 Jun 2004 16:14:41 +0200 Andi Kleen wrote:
This is needed for 2.6 hotplug where the driver is autoloaded. When you have multiple conflicting entries the hotplug module loader usually loads the first one listed, which may be correct or may be not.
Quoted 8 lines
Quoted 1 line
With these changes the drivers announce the correct PCI IDs.
Unfortunately, the patch does not seem to be correct :(
struct
pci_device_iddoes not have the mask field, therefore theID_9005_GENERIC_MASKrestriction cannot be specified other than by listing all 16 possible IDs as separate entries. Your patch adds only one entry, thus losing 15 other possible IDs.
Hmm, good point. Thanks for catching this.
Here is a new patch. Does this one look better?
-Andi
drivers/scsi/aic7xxx/aic79xx_pci.c renamed from drivers/scsi/aic7xxx/aic79xx_pci.c-o +1 -40
@@ -51,46 +51,7 @@#include <dev/aic7xxx/aic79xx_inline.h> #endif -static __inlineuint64_t -ahd_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 ID_ALL_MASK 0xFFFFFFFFFFFFFFFFull -#define ID_ALL_IROC_MASK 0xFFFFFF7FFFFFFFFFull -#define ID_DEV_VENDOR_MASK 0xFFFFFFFF00000000ull -#define ID_9005_GENERIC_MASK 0xFFF0FFFF00000000ull -#define ID_9005_GENERIC_IROC_MASK 0xFFF0FF7F00000000ull - -#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 +#include "aic79xx_pci.h" #define DEVID_9005_TYPE (id) ((id) & 0xF)#define DEVID_9005_TYPE_HBA 0x0/* Standard Card */
drivers/scsi/aic7xxx/aic79xx_osm_pci.c renamed from drivers/scsi/aic7xxx/aic79xx_osm_pci.c-o +28 -5
@@ -41,6 +41,7 @@#include "aic79xx_osm.h" #include "aic79xx_inline.h" +#include "aic79xx_pci.h" #if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,4 ,0 )struct pci_device_id
@@ -58,12 +59,34 @@#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,4 ,0 )static void ahd_linux_pci_dev_remove (struct pci_dev *pdev); -/* We do our own ID filtering. So, grab all SCSI storage class devices. */ 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 - }, +#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) +ID (ID_AHA_29320A ), +ID (ID_AHA_29320ALP ), +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 ), +ID (ID_AHA_29320 ), +ID (ID_AHA_29320B ), +ID (ID_AIC7901 &ID_DEV_VENDOR_MASK ), +ID (ID_AIC7901A &ID_DEV_VENDOR_MASK ), +ID16 (ID_AIC7902 ), {0 } };
drivers/scsi/aic7xxx/aic79xx_pci.h new file +41 -0
41 lines not on this page · raw message
drivers/scsi/aic7xxx/aic7xxx_pci.h new file +92 -0
92 lines not on this page · raw message
drivers/scsi/aic7xxx/aic7xxx_pci.c renamed from drivers/scsi/aic7xxx/aic7xxx_pci.c-o +2 -92
103 lines not on this page · raw message
drivers/scsi/aic7xxx/aic7xxx_osm_pci.c renamed from drivers/scsi/aic7xxx/aic7xxx_osm_pci.c-o +71 -9
93 lines not on this page · raw message
Thank you Andi for the patches. aic7xxx drivers are due for update to use the new timeout infrastructure. I'll incorporate them in, and do some testing.
Thanks,
Signature · 1 line
Luben
Quoted 26 lines · Andi Kleen
[I didn't find an aic7xxx maintainer in
MAINTAINERS, so just sending to the list]This is needed for 2.6 hotplug where the driver is autoloaded. When you have multiple conflicting entries the hotplug module loader usually loads the first one listed, which may be correct or may be not.
With these changes the drivers announce the correct PCI IDs.
The patches are quite big (i had to move the ID tables into an include), but mostly mechanical.
I only tested it on a single 78xx, so it's possible that i made a typo somewhere. Some testing would be appreciated, especially on 79xx
There is still an conflicting entry for
aic7xxx_oldunfortunately. This is hard to handle in hotplug. I think the right solution would be to somehow tag drivers as obsolete so that they aren't loaded by default. This will need an extension in the module pci table mechanism. I'm thinking about a a newMODULE_OBSOLETEmacro for this and aobsolete_modulestable generated atmodules_installtime. But that's for another patch. Better would be maybe to just drop theaic7xxx_olddriver. Is it really still needed?-Andi
Quoted 3 lines · Luben Tuikov
Thank you Andi for the patches. aic7xxx drivers are due for update to use the new timeout infrastructure. I'll incorporate them in, and do some testing.
cool.
Would you please consider the update to be done in small incremental changes/steps ? Eg each separate change/bugfix a separate patch ? Would make life a lot easier for me (distro kernel guy) and for James to be able to diagnose regressions a lot better by binary searching changesets etc etc.
Greetings,
Arjan van de Ven
Quoted 3 lines · On Mon, 21 Jun 2004 11:30:04 -0400 Luben Tuikov <[email protected]>…
Thank you Andi for the patches. aic7xxx drivers are due for update to use the new timeout infrastructure. I'll incorporate them in, and do some testing.
Thanks. Please use the second patch i posted, not the first.
-Andi
Re: [PATCH] Add proper module ID tables to Adaptec aic7[9x]xxdrivers
In reply to Arjan van de VenQuoted 7 lines · Arjan van de Ven
Quoted 3 lines · Luben Tuikov
Thank you Andi for the patches. aic7xxx drivers are due for update to use the new timeout infrastructure. I'll incorporate them in, and do some testing.
Quoted 6 lines
cool.
Would you please consider the update to be done in small incremental changes/steps ? Eg each separate change/bugfix a separate patch ? Would make life a lot easier for me (distro kernel guy) and for James to be able to diagnose regressions a lot better by binary searching changesets etc etc.
Yep, no problem.
Current kernel version of, say, aic79xxx is 1.3.11, and I have 2.0.12, they are 226 patches away. Each patch is a submission into perforce. I can extract each and every one of those 226 and can post them somewhere on a website (hosting anyone? ;-) ), so that anyone can review them.
I can also provide a single patch from 1.3.11 to 2.0.11 so that a "to<-->from" picture can be seen as some patches in between may "cancel" each other out.
And I'll also provide a bk-send and a tar.gz of the whole thing as it looks in my tree.
Let me know if anything else is needed.
Thanks,
Signature · 1 line
Luben
Quoted 8 lines · Andi Kleen
Quoted 3 lines · On Mon, 21 Jun 2004 11:30:04 -0400 Luben Tuikov <[email protected]>…
Thank you Andi for the patches. aic7xxx drivers are due for update to use the new timeout infrastructure. I'll incorporate them in, and do some testing.
Thanks. Please use the second patch i posted, not the first.
No problem.
Signature · 1 line
Luben
Quoted 13 lines · Andi Kleen
Quoted 10 lines · On Mon, 21 Jun 2004 17:44:08 +0400 Sergey Vlasov <[email protected]> wrote:
Quoted 5 lines · On Mon, 21 Jun 2004 16:14:41 +0200 Andi Kleen wrote:
This is needed for 2.6 hotplug where the driver is autoloaded. When you have multiple conflicting entries the hotplug module loader usually loads the first one listed, which may be correct or may be not.
With these changes the drivers announce the correct PCI IDs.
Unfortunately, the patch does not seem to be correct :(
Quoted 8 lines
Quoted 4 lines
struct
pci_device_iddoes not have the mask field, therefore theID_9005_GENERIC_MASKrestriction cannot be specified other than by listing all 16 possible IDs as separate entries. Your patch adds only one entry, thus losing 15 other possible IDs.Hmm, good point. Thanks for catching this.
Here is a new patch. Does this one look better?
It fixes the above problem, but it's hard to say that the patch is correct without carefully checking all the tables. I'm trying to hack up something to autogenerate the pci_device_id table from the aic7xxx internal table.
BTW, ID_AIC7810 and ID_AIC7815 probably should not be in the PCI ID table at all - ahc_raid_setup() just prints "RAID functionality unsupported" for them. And some more IDs generated by ID16 are really rejected by the driver due to the (ID_9005_SISL_ID, ID_9005_SISL_MASK) exclusion entry.
Re: [PATCH] Add proper module ID tables to Adaptec aic7[9x]xxdrivers
In reply to Luben TuikovQuoted 15 lines · Luben Tuikov
Quoted 7 lines · Arjan van de Ven
Quoted 3 lines · Luben Tuikov
Thank you Andi for the patches. aic7xxx drivers are due for update to use the new timeout infrastructure. I'll incorporate them in, and do some testing.
Quoted 6 lines
cool.
Would you please consider the update to be done in small incremental changes/steps ? Eg each separate change/bugfix a separate patch ? Would make life a lot easier for me (distro kernel guy) and for James to be able to diagnose regressions a lot better by binary searching changesets etc etc.
Quoted 4 lines
Yep, no problem.
Current kernel version of, say, aic79xxx is 1.3.11, and I have 2.0.12, they are 226 patches away. Each patch is a submission
I was actually hoping you would have started from the kernel.org driver not the adaptec weird fork justin has been maintaining ;(
Quoted 3 lines
into perforce. I can extract each and every one of those 226 and can post them somewhere on a website (hosting anyone? ;-) ), so that anyone can review them.
it's not just about review, it's also about merging it in parts so that you don't need to binary chop through 226 patches if something fails, but only through like 30 or so.
And then a week later the next 30 go in etc etc