Index: head/sys/x86/iommu/intel_drv.c =================================================================== --- head/sys/x86/iommu/intel_drv.c +++ head/sys/x86/iommu/intel_drv.c @@ -71,6 +71,9 @@ #ifdef DEV_APIC #include "pcib_if.h" +#include +#include +#include #endif #define DMAR_FAULT_IRQ_RID 0 @@ -788,6 +791,9 @@ ACPI_DMAR_DEVICE_SCOPE *devscope; ACPI_DMAR_PCI_PATH *path; char *ptr, *ptrend; +#ifdef DEV_APIC + int error; +#endif int i; for (i = 0; i < dmar_devcnt; i++) { @@ -809,6 +815,17 @@ continue; if (devscope->EnumerationId != id) continue; +#ifdef DEV_APIC + if (entry_type == ACPI_DMAR_SCOPE_TYPE_IOAPIC) { + error = ioapic_get_rid(id, rid); + /* + * If our IOAPIC has PCI bindings then + * use the PCI device rid. + */ + if (error == 0) + return (unit); + } +#endif if (devscope->Length - sizeof(ACPI_DMAR_DEVICE_SCOPE) == 2) { if (rid != NULL) { @@ -818,12 +835,11 @@ path->Device, path->Function); } return (unit); - } else { - /* XXXKIB */ - printf( - "dmar_find_nonpci: id %d type %d path length != 2\n", - id, entry_type); } + printf( + "dmar_find_nonpci: id %d type %d path length != 2\n", + id, entry_type); + break; } } return (NULL);