Page MenuHomeFreeBSD

Detect invalid PCI devices more correctly in PCI interrupt router drivers.
ClosedPublic

Authored by jhb on Aug 3 2019, 1:46 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Jan 10, 10:56 PM
Unknown Object (File)
Dec 11 2024, 5:56 PM
Unknown Object (File)
Dec 11 2024, 5:53 PM
Unknown Object (File)
Sep 30 2024, 6:15 AM
Unknown Object (File)
Sep 21 2024, 7:17 PM
Unknown Object (File)
Sep 18 2024, 12:33 AM
Unknown Object (File)
Sep 4 2024, 11:31 PM
Unknown Object (File)
Aug 25 2024, 5:45 AM
Subscribers
None

Details

Summary
  • Check for an invalid device (vendor is invalid) before reading the header type register when examining function 0 of a possible device.
  • When iterating over functions of a device, reject any device whose 16-bit vendor is invalid rather than requiring the full 32-bit vendor+device to be all 1's. In practice the latter check is probably fine, but checking the vendor is what the PCI spec recommends.
Test Plan
  • have booted this in some VMs

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

this is fine as it is, but would be better with a centralized function...

sys/dev/acpica/acpi_pci_link.c
583 โ†—(On Diff #60413)

Would it make sense to create a function to do this since we recite this same code over and over. And we've changed this several times over the history of this code...

This revision is now accepted and ready to land.Aug 5 2019, 5:42 AM
sys/dev/acpica/acpi_pci_link.c
583 โ†—(On Diff #60413)

It's hard to make a centralized version as different places use different methods to read the config register (e.g. the PCI bus invokes a kobj method on the parent PCI bridge whereas this is doing an end-run around new-bus (which it perhaps shouldn't be, but I didn't think to (ab)use the pcib_if.m interface of the parent nexus at the time I first wrote this)). We did at least gain the PCIV_INVALID constant in the last year or so which replaces the 0xffff magic number.