kernel: Treat 255 as an invalid interrupt line on x86.

From mmlr's analysis in #13370 comment:22: "We actually do ignore a missing
routing in case the interrupt line is 0. In this case it isn't 0 but 0xff,
which is invalid and generally treated the same as 0 in the rest of the code.
Ignoring the missing routing on 0xff seems like the way to go here."

Indeed, I managed to locate a footnote in the PCI 3.0 specification which
confirms that this is the case on x86, and a commit in the Linux kernel
which essentially does the same thing this change does:
https://github.com/torvalds/linux/commit/e237a5518425155faa508a087f2826
Interestingly, that commit is only from 2016, while PCI 3.0 is from 2004.

This probably fixes #13370 ("Haiku doesn't MBR boot on Ryzen"), and potentially
other interrupt-routing-related boot failures.

Change-Id: I88129f6507c62d24cb50cf5c78597ca7bd7872d7
Reviewed-on: https://review.haiku-os.org/590
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
Augustin Cavalier 2018-09-22 16:42:34 -04:00 committed by waddlesplash
parent 2ba2d60351
commit 7d8b7501ba

View File

@ -578,8 +578,11 @@ ensure_all_functions_matched(pci_module_info* pci, uint8 bus,
}
if (!matched) {
if (pci->read_pci_config(bus, device, function,
PCI_interrupt_line, 1) == 0) {
uint32 interrupt_line = pci->read_pci_config(bus, device,
function, PCI_interrupt_line, 1);
// On x86, interrupt line 255 means "unknown" or "no connection"
// (PCI Local Bus spec 3.0, section 6.2.4 / page 223, footnote.)
if (interrupt_line == 0 || interrupt_line == 255) {
dprintf("assuming no interrupt use on PCI device"
" %u:%u:%u (bios irq 0, no routing information)\n",
bus, device, function);