1 #include <linux/dmar.h>
2 #include <asm/io_apic.h>
3 #include "intel-iommu.h"
4 #include "intr_remapping.h"
6 static struct ioapic_scope ir_ioapic[MAX_IO_APICS];
7 static int ir_ioapic_num;
9 static int ir_parse_ioapic_scope(struct acpi_dmar_header *header,
10 struct intel_iommu *iommu)
12 struct acpi_dmar_hardware_unit *drhd;
13 struct acpi_dmar_device_scope *scope;
16 drhd = (struct acpi_dmar_hardware_unit *)header;
18 start = (void *)(drhd + 1);
19 end = ((void *)drhd) + header->length;
23 if (scope->entry_type == ACPI_DMAR_SCOPE_TYPE_IOAPIC) {
24 if (ir_ioapic_num == MAX_IO_APICS) {
25 printk(KERN_WARNING "Exceeded Max IO APICS\n");
29 printk(KERN_INFO "IOAPIC id %d under DRHD base"
30 " 0x%Lx\n", scope->enumeration_id,
33 ir_ioapic[ir_ioapic_num].iommu = iommu;
34 ir_ioapic[ir_ioapic_num].id = scope->enumeration_id;
37 start += scope->length;
44 * Finds the assocaition between IOAPIC's and its Interrupt-remapping
47 int __init parse_ioapics_under_ir(void)
49 struct dmar_drhd_unit *drhd;
52 for_each_drhd_unit(drhd) {
53 struct intel_iommu *iommu = drhd->iommu;
55 if (ecap_ir_support(iommu->ecap)) {
56 if (ir_parse_ioapic_scope(drhd->hdr, iommu))
63 if (ir_supported && ir_ioapic_num != nr_ioapics) {
65 "Not all IO-APIC's listed under remapping hardware\n");