1561767ac9
R1-R10 audit Gap 12: redbear-iwlwifi had zero PCI quirk
consumption at Wi-Fi device detection time. The linux-kpi
crate ships pci_has_quirk and pci_get_quirk_flags for
consumers in C-land, but the Rust-side lookup function
lookup_pci_quirks was not called from this driver. Every
Intel Wi-Fi NIC passed the data-driven quirk table
without a single log line.
This change:
- Adds source/src/quirks.rs with one public function,
log_wifi_quirks(location, vendor, device) that:
1. Builds a PciDeviceInfo from the candidate's location
and the just-parsed vendor / device IDs.
2. Calls redox_driver_sys::quirks::lookup_pci_quirks.
3. Logs the resulting flag word (info-level on a hit,
debug-level on empty).
4. Returns the flags so the caller can gate probe /
interrupt selection on specific bits (NO_MSI,
NO_MSIX, DISABLE_ACCEL) in a follow-up.
- Wires the call into detect_candidates() at
src/main.rs:494, right after the Intel vendor / class /
subclass match — the canonical identification point.
The location is now available (it was already parsed
via parse_location_from_config_path) and vendor_id /
device_id are in scope from the PCI config read.
Implementation note: this module bypasses the
linux_kpi::pci::pci_get_quirk_flags C FFI because that
function takes *mut PciDev and the bus / dev / func
fields are private to the linux-kpi crate. The
underlying lookup is identical — linux-kpi's FFI is a
thin wrapper around the same redox_driver_sys function
we call here. Going through PciDeviceInfo directly is
the natural Rust path; the C FFI remains available for
C-side consumers that already hold a struct pci_dev*.
3 unit tests cover the wiring:
- zeroed device returns empty
- unmatched vendor returns empty
- real Intel NIC ID round-trips through PciQuirkFlags
without losing bits
No Cargo.toml change needed: redox-driver-sys was
already a direct dependency.