From: kettenis Date: Tue, 24 Dec 2013 13:23:21 +0000 (+0000) Subject: If the FADT has its SMI_CMD set to zero, assume we're only ACPI-only hardware X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=64737cc57b92fa85e8e00c189a09efec2f9b0a6e;p=openbsd If the FADT has its SMI_CMD set to zero, assume we're only ACPI-only hardware and don't need to disable SMI ownership of the ACPI hardware registers. ok mlarkin@ --- diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c index 1a889be29b7..0b1914ca0e2 100644 --- a/sys/dev/acpi/acpi.c +++ b/sys/dev/acpi/acpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi.c,v 1.250 2013/12/23 10:48:43 kettenis Exp $ */ +/* $OpenBSD: acpi.c,v 1.251 2013/12/24 13:23:21 kettenis Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * Copyright (c) 2005 Jordan Hargrave @@ -93,6 +93,7 @@ int acpi_foundprt(struct aml_node *, void *); struct acpi_q *acpi_maptable(struct acpi_softc *, paddr_t, const char *, const char *, const char *, int); +int acpi_enable(struct acpi_softc *); void acpi_init_states(struct acpi_softc *); void acpi_gpe_task(void *, int); @@ -701,7 +702,6 @@ acpi_attach(struct device *parent, struct device *self, void *aux) struct acpi_rsdp *rsdp; struct acpi_q *entry; struct acpi_dsdt *p_dsdt; - int idx; #ifndef SMALL_KERNEL int wakeup_dev_ct; struct acpi_wakeq *wentry; @@ -770,7 +770,7 @@ acpi_attach(struct device *parent, struct device *self, void *aux) /* * Check if we are able to enable ACPI control */ - if (!sc->sc_fadt->smi_cmd || + if (sc->sc_fadt->smi_cmd && (!sc->sc_fadt->acpi_enable && !sc->sc_fadt->acpi_disable)) { printf(", ACPI control unavailable\n"); return; @@ -856,14 +856,12 @@ acpi_attach(struct device *parent, struct device *self, void *aux) * This may prevent thermal control on some systems where * that actually does work */ - acpi_write_pmreg(sc, ACPIREG_SMICMD, 0, sc->sc_fadt->acpi_enable); - idx = 0; - do { - if (idx++ > ACPIEN_RETRIES) { + if (sc->sc_fadt->smi_cmd) { + if (acpi_enable(sc)) { printf(", can't enable ACPI\n"); return; } - } while (!(acpi_read_pmreg(sc, ACPIREG_PM1_CNT, 0) & ACPI_PM1_SCI_EN)); + } printf("\n%s: tables", DEVNAME(sc)); SIMPLEQ_FOREACH(entry, &sc->sc_tables, q_next) { @@ -1353,6 +1351,22 @@ acpi_map_pmregs(struct acpi_softc *sc) } } +int +acpi_enable(struct acpi_softc *sc) +{ + int idx; + + acpi_write_pmreg(sc, ACPIREG_SMICMD, 0, sc->sc_fadt->acpi_enable); + idx = 0; + do { + if (idx++ > ACPIEN_RETRIES) { + return ETIMEDOUT; + } + } while (!(acpi_read_pmreg(sc, ACPIREG_PM1_CNT, 0) & ACPI_PM1_SCI_EN)); + + return 0; +} + void acpi_init_states(struct acpi_softc *sc) {