Esempio n. 1
0
static boolean_t
acpi_sci_test(const struct acpi_sci_mode *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, 0);

	machintr_legacy_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, 0);

	DELAY(100 * 1000);

	unregister_int(sci_desc, 0);

	if (get_interrupt_counter(acpi_sci_irq, 0) - 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 TRUE;
	}
	return FALSE;
}
Esempio n. 2
0
void
acpi_sci_config(void)
{
	const struct acpi_sci_mode *mode;

	KKASSERT(mycpuid == 0);

	if (acpi_sci_irq < 0)
		return;

	if (acpi_sci_trig != INTR_TRIGGER_CONFORM) {
		KKASSERT(acpi_sci_pola != INTR_POLARITY_CONFORM);
		machintr_legacy_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, 0);

		machintr_legacy_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, 0);

		DELAY(100 * 1000);

		unregister_int(sci_desc, 0);

		if (get_interrupt_counter(acpi_sci_irq, 0) - 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;
}