summaryrefslogtreecommitdiff
path: root/sys/dev/acpi/acpi.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2013-12-24 13:23:22 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2013-12-24 13:23:22 +0000
commit76cd3108693f032a980600c931abb7a614bdfbb5 (patch)
tree37665c9846b646e138c02104829eaa79643b9a4b /sys/dev/acpi/acpi.c
parent8be85f5850c9adb577e41267cd070c25cf45b2a7 (diff)
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@
Diffstat (limited to 'sys/dev/acpi/acpi.c')
-rw-r--r--sys/dev/acpi/acpi.c30
1 files changed, 22 insertions, 8 deletions
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 <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -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)
{