diff options
author | Ian Moffett <ian@osmora.org> | 2024-07-11 11:04:16 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2024-07-11 11:04:16 -0400 |
commit | 45ad7c0c7b86f7abbc5ce0d13fb947dca1645316 (patch) | |
tree | e8f199b8710756a1eefed78976d47e7f5428d724 | |
parent | bf9ad82ee961b839654e2322f083c13532f2c0c6 (diff) |
kernel: pci: Fix cap offset handling
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r-- | sys/dev/pci/pci.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 65f315d..a7b8bac 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -110,6 +110,7 @@ static void pci_set_device_info(struct pci_device *dev) { uint32_t classrev; + int capoff; dev->vendor_id = pci_readl(dev, PCIREG_VENDOR_ID) & 0xFFFF; dev->device_id = pci_readl(dev, PCIREG_DEVICE_ID) & 0xFFFF; @@ -127,7 +128,8 @@ pci_set_device_info(struct pci_device *dev) dev->bar[5] = pci_readl(dev, PCIREG_BAR5); dev->irq_line = pci_readl(dev, PCIREG_IRQLINE) & 0xFF; - dev->msix_capoff = pci_get_cap(dev, PCI_CAP_MSIX); + capoff = pci_get_cap(dev, PCI_CAP_MSIX); + dev->msix_capoff = (capoff < 0) ? 0 : capoff; } /* |