void acpi_sci_config(void) { const struct acpi_sci_mode *mode; 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, acpi_sci_trig, acpi_sci_pola); return; } kprintf("ACPI FADT: SCI testing interrupt mode ...\n"); for (mode = acpi_sci_modes; mode->sci_trig != INTR_TRIGGER_CONFORM; ++mode) { void *sci_desc; long last_cnt; FADT_VPRINTF("SCI testing %s/%s\n", intr_str_trigger(mode->sci_trig), intr_str_polarity(mode->sci_pola)); last_cnt = get_interrupt_counter(acpi_sci_irq); machintr_intr_config(acpi_sci_irq, mode->sci_trig, mode->sci_pola); sci_desc = register_int(acpi_sci_irq, acpi_sci_dummy_intr, NULL, "sci", NULL, INTR_EXCL | INTR_CLOCK | INTR_NOPOLL | INTR_MPSAFE | INTR_NOENTROPY); DELAY(100 * 1000); unregister_int(sci_desc); if (get_interrupt_counter(acpi_sci_irq) - last_cnt < 20) { acpi_sci_trig = mode->sci_trig; acpi_sci_pola = mode->sci_pola; kprintf("ACPI FADT: SCI select %s/%s\n", intr_str_trigger(acpi_sci_trig), intr_str_polarity(acpi_sci_pola)); return; } } kprintf("ACPI FADT: no suitable interrupt mode for SCI, disable\n"); acpi_sci_irq = -1; }
static int nexus_config_intr(device_t bus, device_t chile, int irq, enum intr_trigger trig, enum intr_polarity pola) { machintr_intr_config(irq, trig, pola); return 0; }