Page MenuHomeFreeBSD

iwx: Look up subdevice rather than device
ClosedPublic

Authored by thj on Apr 10 2025, 2:34 PM.
Tags
None
Referenced Files
F123494773: D49759.id153506.diff
Tue, Jul 15, 8:32 AM
Unknown Object (File)
Mon, Jul 14, 10:12 AM
Unknown Object (File)
Fri, Jul 11, 3:02 PM
Unknown Object (File)
Wed, Jul 9, 8:41 AM
Unknown Object (File)
Wed, Jul 9, 8:35 AM
Unknown Object (File)
Wed, Jul 9, 5:00 AM
Unknown Object (File)
Wed, Jul 9, 4:30 AM
Unknown Object (File)
Wed, Jul 9, 12:57 AM

Details

Summary

iwx goes through a couple of steps to match devices to firmware. There is a default look up of pcie device and subdevices and then a secondary pass to find config in a table.
Previously we were not looking up the subdevice
correctly and that led to ax210 cards in some devices (Framework 13)
form being matched to the correct firmware.

Test Plan

This allows my ax210 card to attach, but I still need to check for regressions
in other hardware.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

thj requested review of this revision.Apr 10 2025, 2:34 PM

Interesting, do we not have a pci_get_subdevice() call? @jhb

PCI accessors are all there @adrian pci_get_(first column)

PCI_ACCESSOR(subvendor,         SUBVENDOR,      uint16_t)
PCI_ACCESSOR(subdevice,         SUBDEVICE,      uint16_t)
PCI_ACCESSOR(vendor,            VENDOR,         uint16_t)
PCI_ACCESSOR(device,            DEVICE,         uint16_t)
PCI_ACCESSOR(devid,             DEVID,          uint32_t)
PCI_ACCESSOR(class,             CLASS,          uint8_t)
PCI_ACCESSOR(subclass,          SUBCLASS,       uint8_t)
...

are all there.

@thj If you look at man iwlwififw.4 you can probably compare what is matched for PNP information. Or read sys/contrib/dev/iwlwifi/pcie/drv.c and you'll find that it's not just matching PCI IDs for some chipsets but also read other things beyond PCI ID to figure out what kind of device it is. It's a pain. I think the 9xxx were especially bad. For the SYSCTL I added I am actually using the entirely processed information from Intel after the driver got loaded (no need to attach to anything) to get the list half-way correct out of it.

In D49759#1134392, @bz wrote:

PCI accessors are all there @adrian pci_get_(first column)

PCI_ACCESSOR(subvendor,         SUBVENDOR,      uint16_t)
PCI_ACCESSOR(subdevice,         SUBDEVICE,      uint16_t)
PCI_ACCESSOR(vendor,            VENDOR,         uint16_t)
PCI_ACCESSOR(device,            DEVICE,         uint16_t)
PCI_ACCESSOR(devid,             DEVID,          uint32_t)
PCI_ACCESSOR(class,             CLASS,          uint8_t)
PCI_ACCESSOR(subclass,          SUBCLASS,       uint8_t)
...

are all there.

Excellent, thanks for the reference. I did a quick survey and the drivers I found just seemed to be doing whatever.

@thj If you look at man iwlwififw.4 you can probably compare what is matched for PNP information. Or read sys/contrib/dev/iwlwifi/pcie/drv.c and you'll find that it's not just matching PCI IDs for some chipsets but also read other things beyond PCI ID to figure out what kind of device it is. It's a pain. I think the 9xxx were especially bad. For the SYSCTL I added I am actually using the entirely processed information from Intel after the driver got loaded (no need to attach to anything) to get the list half-way correct out of it.

Great, I'll have a check. This solves the attach for my card, I'm a bit concerned people will get a different firmware now and it'll reproduce the "performance" I get

  • use the correct pci_get_subdevice macro
thj retitled this revision from iwx: Look up product id correctly to iwx: Look up subdevice rather than device.Apr 11 2025, 12:15 PM
thj edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Apr 11 2025, 2:38 PM
This revision was automatically updated to reflect the committed changes.