acpi/fadt: Make sure that SCI IRQ is valid
[dragonfly.git] / sys / platform / pc64 / acpica5 / acpi_fadt.c
index 6822bea..6918f25 100644 (file)
@@ -184,12 +184,20 @@ acpi_sci_config(void)
 
        KKASSERT(mycpuid == 0);
 
+       if (machintr_legacy_intr_find(acpi_sci_irq,
+           INTR_TRIGGER_CONFORM, INTR_POLARITY_CONFORM) < 0) {
+               kprintf("ACPI FADT: SCI irq %d is invalid, disable\n",
+                   acpi_sci_irq);
+               acpi_sci_irq = -1;
+               return;
+       }
+
        if (acpi_sci_irq < 0)
                return;
 
        if (acpi_sci_trig != INTR_TRIGGER_CONFORM) {
                KKASSERT(acpi_sci_pola != INTR_POLARITY_CONFORM);
-               machintr_intr_config(acpi_sci_irq,
+               machintr_legacy_intr_config(acpi_sci_irq,
                    acpi_sci_trig, acpi_sci_pola);
                return;
        }
@@ -204,9 +212,9 @@ acpi_sci_config(void)
                    intr_str_trigger(mode->sci_trig),
                    intr_str_polarity(mode->sci_pola));
 
-               last_cnt = get_interrupt_counter(acpi_sci_irq);
+               last_cnt = get_interrupt_counter(acpi_sci_irq, 0);
 
-               machintr_intr_config(acpi_sci_irq,
+               machintr_legacy_intr_config(acpi_sci_irq,
                    mode->sci_trig, mode->sci_pola);
 
                sci_desc = register_int(acpi_sci_irq,
@@ -218,7 +226,7 @@ acpi_sci_config(void)
 
                unregister_int(sci_desc, 0);
 
-               if (get_interrupt_counter(acpi_sci_irq) - last_cnt < 20) {
+               if (get_interrupt_counter(acpi_sci_irq, 0) - last_cnt < 20) {
                        acpi_sci_trig = mode->sci_trig;
                        acpi_sci_pola = mode->sci_pola;