acpi/resource: Use legacy_intr_find to detect invalid IRQ configure
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Tue, 28 Aug 2012 06:12:10 +0000 (14:12 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Tue, 28 Aug 2012 06:12:10 +0000 (14:12 +0800)
sys/dev/acpica5/acpi_resource.c

index b9c705d..eae8e53 100644 (file)
@@ -112,6 +112,9 @@ acpi_config_intr(device_t dev, ACPI_RESOURCE *res)
 {
     u_int irq;
     int pol, trig;
+    enum intr_trigger trigger;
+    enum intr_polarity polarity;
+
     switch (res->Type) {
     case ACPI_RESOURCE_TYPE_IRQ:
        KASSERT(res->Data.Irq.InterruptCount == 1,
@@ -131,15 +134,22 @@ acpi_config_intr(device_t dev, ACPI_RESOURCE *res)
        panic("%s: bad resource type %u", __func__, res->Type);
     }
 
-    if (irq == AcpiGbl_FADT.SciInterrupt) {
+    if (trig == ACPI_EDGE_SENSITIVE)
+       trigger = INTR_TRIGGER_EDGE;
+    else
+       trigger = INTR_TRIGGER_LEVEL;
+
+    if (pol == ACPI_ACTIVE_HIGH)
+       polarity = INTR_POLARITY_HIGH;
+    else
+       polarity = INTR_POLARITY_LOW;
+
+    if (machintr_legacy_intr_find(irq, trigger, polarity) < 0) {
        if (bootverbose)
-               kprintf("acpi_config_intr: Skip SCI config\n");
-       return;
+               kprintf("acpi_config_intr: Skip irq %d config\n", irq);
+    } else {
+       BUS_CONFIG_INTR(dev, dev, irq, trigger, polarity);
     }
-
-    BUS_CONFIG_INTR(dev, dev, irq, (trig == ACPI_EDGE_SENSITIVE) ?
-       INTR_TRIGGER_EDGE : INTR_TRIGGER_LEVEL, (pol == ACPI_ACTIVE_HIGH) ?
-       INTR_POLARITY_HIGH : INTR_POLARITY_LOW);
 }
 
 /*