diff options
| author | Abdelkader Boudih <guest-seuros@FreeBSD.org> | 2026-02-06 16:12:56 +0000 |
|---|---|---|
| committer | Aymeric Wibo <obiwac@FreeBSD.org> | 2026-02-06 16:13:12 +0000 |
| commit | 067ad8b31bf68b6dcf1ad571746349ed88d63d00 (patch) | |
| tree | 2b2050f36d9399fb7dbf5d1203ca17ac639a8de0 | |
| parent | 86150ed98b7903feaba942f01619e74894cd23c4 (diff) | |
thunderbolt: Fix tb_pcib device matching to check PCI class
Light Ridge and earlier Thunderbolt controllers reuse the same device ID
(0x1513) for both the NHI (class 0x088000) and PCI bridges (class
0x060400).
Without checking the PCI class, tb_pcib would incorrectly match NHI
devices, causing a panic when trying to attach bridge code to non-bridge
hardware.
Add PCI class check to tb_pcib_find_ident() to only match actual PCI-PCI
bridges (PCIC_BRIDGE/PCIS_BRIDGE_PCI).
Reviewed by: obiwac, jhb
Approved by: obiwac, jhb
Fixes: 2ed9833791f2 (thunderbolt: Import USB4 code)
Differential Revision: https://reviews.freebsd.org/D55102
| -rw-r--r-- | sys/dev/thunderbolt/tb_pcib.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/dev/thunderbolt/tb_pcib.c b/sys/dev/thunderbolt/tb_pcib.c index e6f0115364da..ffb85ebec9ae 100644 --- a/sys/dev/thunderbolt/tb_pcib.c +++ b/sys/dev/thunderbolt/tb_pcib.c @@ -119,6 +119,10 @@ tb_pcib_find_ident(device_t dev) for (n = tb_pcib_identifiers; n->vendor != 0; n++) { if ((n->vendor != v) || (n->device != d)) continue; + /* Only match actual PCI-PCI bridges to avoid conflict with NHI */ + if (pci_get_class(dev) != PCIC_BRIDGE || + pci_get_subclass(dev) != PCIS_BRIDGE_PCI) + continue; if (((n->subvendor != 0xffff) && (n->subvendor != sv)) || ((n->subdevice != 0xffff) && (n->subdevice != sd))) continue; |
