Fix ioapic acpi id matching on PCI attach and rid calculation.

Sponsored by:	The FreeBSD Foundation
MFC after:	11 days
This commit is contained in:
Konstantin Belousov 2017-09-11 18:29:09 +00:00
parent e8be4e41c6
commit 809f2d8b8b

View File

@ -997,7 +997,7 @@ ioapic_pci_attach(device_t dev)
} }
/* Then by apic id */ /* Then by apic id */
STAILQ_FOREACH(io, &ioapic_list, io_next) { STAILQ_FOREACH(io, &ioapic_list, io_next) {
if (io->io_id == apic_id) if (io->io_apic_id == apic_id)
goto found; goto found;
} }
mtx_unlock_spin(&icu_lock); mtx_unlock_spin(&icu_lock);
@ -1017,13 +1017,13 @@ found:
io->pci_dev = dev; io->pci_dev = dev;
io->pci_wnd = res; io->pci_wnd = res;
if (bootverbose && (io->io_paddr != (vm_paddr_t)rman_get_start(res) || if (bootverbose && (io->io_paddr != (vm_paddr_t)rman_get_start(res) ||
io->io_id != apic_id)) { io->io_apic_id != apic_id)) {
device_printf(dev, "pci%d:%d:%d:%d pci BAR0@%jx id %d " device_printf(dev, "pci%d:%d:%d:%d pci BAR0@%jx id %d "
"MADT id %d paddr@%jx\n", "MADT id %d paddr@%jx\n",
pci_get_domain(dev), pci_get_bus(dev), pci_get_domain(dev), pci_get_bus(dev),
pci_get_slot(dev), pci_get_function(dev), pci_get_slot(dev), pci_get_function(dev),
(uintmax_t)rman_get_start(res), apic_id, (uintmax_t)rman_get_start(res), apic_id,
io->io_id, (uintmax_t)io->io_paddr); io->io_apic_id, (uintmax_t)io->io_paddr);
} }
mtx_unlock_spin(&icu_lock); mtx_unlock_spin(&icu_lock);
return (0); return (0);
@ -1051,7 +1051,7 @@ ioapic_get_rid(u_int apic_id, uint16_t *ridp)
mtx_lock_spin(&icu_lock); mtx_lock_spin(&icu_lock);
STAILQ_FOREACH(io, &ioapic_list, io_next) { STAILQ_FOREACH(io, &ioapic_list, io_next) {
if (io->io_id == apic_id) if (io->io_apic_id == apic_id)
break; break;
} }
mtx_unlock_spin(&icu_lock); mtx_unlock_spin(&icu_lock);