Skip to contentSkip to conversation

Add proper module ID tables to Adaptec aic7[9x]xx drivers

PATCH Michael Tokarev 4 participants 9 messages Oct 6, 2004 – Oct 7, 2004 1 message not in the archive SCSI

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

[Answering to an old post -- rehashing the topic.
I didn't trim the email. See my comments below.]

Quoted 30 lines · Sergey Vlasov
Quoted 14 lines · Andi Kleen
Quoted 11 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_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.

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.

Quoted 5 lines

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.

I found several "OEM" (on-board) aic79xx controllers (mostly on HP boxes) that breaks after the above-mentioned change, which found it's way into 2.6.8 kernel. For example, HP ProLiant ML machines and others. The end-result is that the driver, which worked just fine before, does not "detect" the card anymore.

On one of such machines, AIC7902 U320 (rev 03) card is shown as device=9005:801f (identified by the driver), but subsystem id is 103c:103c, wich gets interpreted by pci.ids as "Hewlett-Packard Company: Unknown device 103c". It does not look like a right thing to do, but HP knows better it seems.

Also, I tried to guess what all those new PCI ID macros does in the driver, but that's quite a challenge: deeply-nested
macros with non-obvious bit manipulation... ;) So I can't
produce a patch right now for this problem. Either way, the resulting PCI table does not look right:

$ fgrep aic79xx /lib/modules/`uname -r`/modules.pcimap | wc -l
32
$ fgrep aic79xx /lib/modules/`uname -r`/modules.pcimap | sort -u | wc -l
15

Devices 9005:800f and 9005:801e are listed with *:* subsystem, while the rest (incl. 9005:801f -- the one shown above) specifies several non-wildcard subsystem entries, nothing to match 103c (HP).

Maybe just list all subsystems as wildcards?

Thanks.

/mjt

#2 lore raw
Quoted 41 lines · Michael Tokarev

[Answering to an old post -- rehashing the topic.
I didn't trim the email. See my comments below.]

Quoted 31 lines · Sergey Vlasov
Quoted 15 lines · Andi Kleen
Quoted 12 lines · On Mon, 21 Jun 2004 17:44:08 +0400 Sergey Vlasov <[email protected]> wrote:
Quoted 6 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_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.

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.

Quoted 5 lines

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.

Quoted 3 lines

I found several "OEM" (on-board) aic79xx controllers (mostly on HP boxes) that breaks after the above-mentioned change, which found it's way into 2.6.8 kernel. For example, HP ProLiant ML

I don't think it's merged in mainline, no. Or at least 2.6.9rc3 doesn't have it.

Quoted 10 lines

machines and others. The end-result is that the driver, which worked just fine before, does not "detect" the card anymore.

On one of such machines, AIC7902 U320 (rev 03) card is shown as device=9005:801f (identified by the driver), but subsystem id is 103c:103c, wich gets interpreted by pci.ids as "Hewlett-Packard Company: Unknown device 103c". It does not look like a right thing to do, but HP knows better it seems.

Quoted 3 lines

Also, I tried to guess what all those new PCI ID macros does in the driver, but that's quite a challenge: deeply-nested
macros with non-obvious bit manipulation... ;) So I can't

They just try to match large groups without too much typing....

Quoted 8 lines

produce a patch right now for this problem. Either way, the resulting PCI table does not look right:

$ fgrep aic79xx /lib/modules/`uname -r`/modules.pcimap | wc -l
32
$ fgrep aic79xx /lib/modules/`uname -r`/modules.pcimap | sort -u | wc -l
15
Quoted 4 lines

Devices 9005:800f and 9005:801e are listed with *:* subsystem, while the rest (incl. 9005:801f -- the one shown above) specifies several non-wildcard subsystem entries, nothing to match 103c (HP).

If I remember the patch correctly it only matches the Adaptec vendor id.

For HP there will need to be an special entry (probably needs some reverse engineering from the original code)

Quoted 1 line

Maybe just list all subsystems as wildcards?

No, i don't think that's a good idea.

At least the vendors should be listed explicitely. Otherwise hotplug autoloading is unhappy because bogus modules get loaded all the time.

I can go over it again at some point, but currently I don't have too much time, so it would be good if someone else would tackle it.

Luben, can you just do a proper pci_id table please? You probably know the requirements best.

-Andi

#3 lore raw
Quoted 1 line · Andi Kleen

On Wed, Oct 06, 2004 at 11:47:33PM +0400, Michael Tokarev wrote:

[]

Quoted 5 lines
Quoted 3 lines

I found several "OEM" (on-board) aic79xx controllers (mostly on HP boxes) that breaks after the above-mentioned change, which found it's way into 2.6.8 kernel. For example, HP ProLiant ML

I don't think it's merged in mainline, no. Or at least 2.6.9rc3 doesn't have it.

Interesting. Well... looks like it's debian stuff. I'm sorry about this - should have looked better. So, that's even better:
the change like this should generate quite some breakage, and it's good it isn't applied.

And now as I see the problem is debian-specific, the more "interesting" debian patch looks, here's the description:

## DP: Description: Export proper PCI ID table to hotplug in aic7xxx/aic79xx ## DP: Patch author: Andi Kleen <[email protected]>
## DP: Upstream status: submitted (long ago, aic7xx maintaince is horrible)

oh well... :(

(original message (with patch) can be found at
http://groups.google.com/groups?selm=linux.scsi.20040621182440.0743036f.ak%40suse.de
)

[]

Quoted 5 lines
Quoted 3 lines

Also, I tried to guess what all those new PCI ID macros does in the driver, but that's quite a challenge: deeply-nested
macros with non-obvious bit manipulation... ;) So I can't

They just try to match large groups without too much typing....

Figured that much ;)

Quoted 2 lines

If I remember the patch correctly it only matches the Adaptec vendor id.

Well not really. Or, rather, it indeed only matches by 0x9005 as vendor, but there's also _subsytem_ vendor and _subsystem_ device which does not match now. Device reports:

device=9005:801f, subsystem=103c:103c (Hewlett-Packard) device=9005:801f, subsystem=1025:002a (Acer Labs)

etc. The pci_table correctly matches the device part, but only accepts subsystem=9005:ffff (which seems to be wrong).

Quoted 2 lines

For HP there will need to be an special entry (probably needs some reverse engineering from the original code)

Note again it isn't main vendor_id, it's subsystem vendor_id. Main vendor_id is still 0x9005.

Quoted 3 lines
Quoted 1 line

Maybe just list all subsystems as wildcards?

No, i don't think that's a good idea.

Now I've 4 different variations of 9005:801f - the same card, but with different subsystem ids. Several of other AIC97xx cards actually uses wildcarded *sub*system_{vendor,id}, eg 9005:800f. And there are actually 16 different devices which where mentioned by Luden in that thread (0x80xx) -- the driver code basically just ignores subsystem identifiers for almost all of them.

Quoted 1 line

At least the vendors should be listed explicitely. Otherwise hotplug autoloading is unhappy because bogus modules get loaded all the time.

Yes -- vendor_id, but not subvendor_id.

/mjt

Quoted 7 lines

I can go over it again at some point, but currently I don't have too much time, so it would be good if someone else would tackle it.

Luben, can you just do a proper pci_id table please? You probably know the requirements best.

-Andi

#4 lore raw
In reply to Andi Kleen
Quoted 98 lines · Andi Kleen
Quoted 44 lines · Michael Tokarev

[Answering to an old post -- rehashing the topic.
I didn't trim the email. See my comments below.]

Quoted 33 lines · Sergey Vlasov
Quoted 16 lines · Andi Kleen
Quoted 12 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_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.

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.

Quoted 5 lines

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.

Quoted 3 lines

I found several "OEM" (on-board) aic79xx controllers (mostly on HP boxes) that breaks after the above-mentioned change, which found it's way into 2.6.8 kernel. For example, HP ProLiant ML

I don't think it's merged in mainline, no. Or at least 2.6.9rc3 doesn't have it.

Quoted 10 lines

machines and others. The end-result is that the driver, which worked just fine before, does not "detect" the card anymore.

On one of such machines, AIC7902 U320 (rev 03) card is shown as device=9005:801f (identified by the driver), but subsystem id is 103c:103c, wich gets interpreted by pci.ids as "Hewlett-Packard Company: Unknown device 103c". It does not look like a right thing to do, but HP knows better it seems.

Quoted 3 lines

Also, I tried to guess what all those new PCI ID macros does in the driver, but that's quite a challenge: deeply-nested
macros with non-obvious bit manipulation... ;) So I can't

They just try to match large groups without too much typing....

Quoted 8 lines

produce a patch right now for this problem. Either way, the resulting PCI table does not look right:

$ fgrep aic79xx /lib/modules/`uname -r`/modules.pcimap | wc -l
32
$ fgrep aic79xx /lib/modules/`uname -r`/modules.pcimap | sort -u | wc -l
15
Quoted 4 lines

Devices 9005:800f and 9005:801e are listed with *:* subsystem, while the rest (incl. 9005:801f -- the one shown above) specifies several non-wildcard subsystem entries, nothing to match 103c (HP).

If I remember the patch correctly it only matches the Adaptec vendor id.

For HP there will need to be an special entry (probably needs some reverse engineering from the original code)

Quoted 1 line

Maybe just list all subsystems as wildcards?

No, i don't think that's a good idea.

Quoted 7 lines

At least the vendors should be listed explicitely. Otherwise hotplug autoloading is unhappy because bogus modules get loaded all the time.

I can go over it again at some point, but currently I don't have too much time, so it would be good if someone else would tackle it.

Luben, can you just do a proper pci_id table please? You probably know the requirements best.

Yes, no problem. (It'd be tricky but I'll try to augment it properly.)

Luben

Quoted 2 lines

-Andi

#5 lore raw
Quoted 2 lines · Luben Tuikov

Andi Kleen wrote:

[]

Quoted 4 lines
Quoted 2 lines

Luben, can you just do a proper pci_id table please? You probably know the requirements best.

Yes, no problem. (It'd be tricky but I'll try to augment it properly.)

Christoph Hellwig already did that, it seems --
see his post to linux-scsi dated Sep-12,
http://marc.theaimsgroup.com/?m=109500574722283

/mjt

#6 lore raw
Quoted 10 lines · Michael Tokarev
Quoted 2 lines · Luben Tuikov

Andi Kleen wrote:

[]

Quoted 4 lines
Quoted 2 lines

Luben, can you just do a proper pci_id table please? You probably know the requirements best.

Quoted 6 lines
Quoted 1 line

Yes, no problem. (It'd be tricky but I'll try to augment it properly.)

Christoph Hellwig already did that, it seems --
see his post to linux-scsi dated Sep-12,
http://marc.theaimsgroup.com/?m=109500574722283

Yes, I forgot about this one -- this is pretty much what I had intended to do.

Thanks for pointing it out,
Luben

#7 lore raw
Quoted 14 lines · Luben Tuikov
Quoted 13 lines · Michael Tokarev
Quoted 2 lines · Luben Tuikov

Andi Kleen wrote:

[]

Quoted 5 lines
Quoted 2 lines

Luben, can you just do a proper pci_id table please? You probably know the requirements best.

Yes, no problem. (It'd be tricky but I'll try to augment it properly.)

Quoted 6 lines
Quoted 3 lines

Christoph Hellwig already did that, it seems --
see his post to linux-scsi dated Sep-12,
http://marc.theaimsgroup.com/?m=109500574722283

Yes, I forgot about this one -- this is pretty much what I had intended to do.

The version had a few bugs unfortunately. For various HP boards I mixed up vendor and subvendor id, and the raid boards are completely missing. I tried to fix that up but got totally lost in the various ids.

If there's a completely list of AIC79XX board variants I could try again.

#8 lore raw
Quoted 28 lines · Christoph Hellwig
Quoted 18 lines · Luben Tuikov
Quoted 16 lines · Michael Tokarev
Quoted 2 lines · Luben Tuikov

Andi Kleen wrote:

[]

Quoted 5 lines
Quoted 2 lines

Luben, can you just do a proper pci_id table please? You probably know the requirements best.

Yes, no problem. (It'd be tricky but I'll try to augment it properly.)

Quoted 6 lines
Quoted 3 lines

Christoph Hellwig already did that, it seems --
see his post to linux-scsi dated Sep-12,
http://marc.theaimsgroup.com/?m=109500574722283

Yes, I forgot about this one -- this is pretty much what I had intended to do.

Quoted 5 lines

The version had a few bugs unfortunately. For various HP boards I mixed up vendor and subvendor id, and the raid boards are completely missing. I tried to fix that up but got totally lost in the various ids.

If there's a completely list of AIC79XX board variants I could try again.

Ah, ok -- I was wondering.

Well, it's not as easy as dumping the list into a table. Let me try to come up with something here.

Luben

#9 lore raw
Quoted 4 lines · Luben Tuikov

Ah, ok -- I was wondering.

Well, it's not as easy as dumping the list into a table. Let me try to come up with something here.

I think best would be to kill all subvendor/subdevice id matching so we can just live with the generic ids. This would simplify things a lot if Adaptec doesn't plan to introduce random incompatiblities for devices only differing in subvendor/subdevice id.