summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica/acpi_ec.c
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2004-05-13 03:17:08 +0000
committernjl <njl@FreeBSD.org>2004-05-13 03:17:08 +0000
commit14070ec7f16e04e47540cfc00b0e31d23769ae3e (patch)
tree2fd030e3990f8044bef8fbbebbd5e4d3351b0a30 /sys/dev/acpica/acpi_ec.c
parentd885fb87b4518682f321d26ac18cc00132077080 (diff)
downloadFreeBSD-src-14070ec7f16e04e47540cfc00b0e31d23769ae3e.zip
FreeBSD-src-14070ec7f16e04e47540cfc00b0e31d23769ae3e.tar.gz
Add support for retrieving _GLK in the ECDT probe. Now we no longer always
use the global lock at the beginning of the ECDT probe. Instead, we use the handle from the ECDT to call _GLK. Also, unify the device description.
Diffstat (limited to 'sys/dev/acpica/acpi_ec.c')
-rw-r--r--sys/dev/acpica/acpi_ec.c55
1 files changed, 20 insertions, 35 deletions
diff --git a/sys/dev/acpica/acpi_ec.c b/sys/dev/acpica/acpi_ec.c
index ea2bd1b..586d28b 100644
--- a/sys/dev/acpica/acpi_ec.c
+++ b/sys/dev/acpica/acpi_ec.c
@@ -367,7 +367,7 @@ acpi_ec_ecdt_probe(device_t parent)
ACPI_STATUS status;
device_t child;
ACPI_HANDLE h;
- int magic;
+ int glk, magic;
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
@@ -404,12 +404,12 @@ acpi_ec_ecdt_probe(device_t parent)
/*
* Store values for the probe/attach routines to use. Store the
- * ECDT GPE bit and set the global lock flag (just to be safe).
- * We'll determine whether we really want to use the global lock
- * in a later call to attach.
+ * ECDT GPE bit and set the global lock flag according to _GLK.
*/
acpi_set_private(child, &acpi_ec_devclass);
- magic = DEV_GLK_FLAG;
+ magic = 0;
+ if (ACPI_SUCCESS(acpi_GetInteger(h, "_GLK", &glk)) && glk != 0)
+ magic = DEV_GLK_FLAG;
DEV_SET_GPEBIT(magic, ecdt->gpe_bit);
acpi_set_magic(child, magic);
@@ -437,12 +437,9 @@ acpi_ec_probe(device_t dev)
* duplicate probe.
*/
magic = acpi_get_magic(dev);
- if (DEV_ECDT(dev)) {
- snprintf(desc, sizeof(desc), "Embedded Controller: ECDT, GPE %#x, GLK",
- DEV_GET_GPEBIT(magic));
- device_set_desc_copy(dev, desc);
+ if (DEV_ECDT(dev))
ret = 0;
- } else if (acpi_MatchHid(dev, "PNP0C09")) {
+ else if (acpi_MatchHid(dev, "PNP0C09")) {
h = acpi_get_handle(dev);
/*
@@ -470,39 +467,27 @@ acpi_ec_probe(device_t dev)
}
/* Store the values we got from the namespace for attach. */
- magic = glk != 0 ? DEV_GLK_FLAG : 0;
+ magic = (glk != 0) ? DEV_GLK_FLAG : 0;
DEV_SET_GPEBIT(magic, gpebit);
acpi_set_magic(dev, magic);
/*
* Check for a duplicate probe. This can happen when a probe
- * via ECDT succeeded already. If there is a duplicate, override
- * its value for GLK in the peer's softc since the ECDT case
- * always enables the global lock to be safe. Otherwise, just
- * continue on to attach.
+ * via ECDT succeeded already. If this is a duplicate, disable
+ * this device.
*/
peer = devclass_get_device(acpi_ec_devclass, uid);
- if (peer == NULL || !device_is_alive(peer)) {
- snprintf(desc, sizeof(desc), "Embedded Controller: GPE %#x%s",
- gpebit, glk != 0 ? ", GLK" : "");
- device_set_desc_copy(dev, desc);
+ if (peer == NULL || !device_is_alive(peer))
ret = 0;
- } else {
- struct acpi_ec_softc *sc;
-
- /*
- * Set the peer's sc->ec_glk with locks held so we won't
- * override it between another thread's lock/unlock calls.
- */
- sc = device_get_softc(peer);
- if (sc->ec_glk != glk) {
- ACPI_VPRINT(peer, acpi_device_get_parent_softc(peer),
- "Changing GLK from %d to %d\n", sc->ec_glk, glk);
- mtx_lock(&sc->ec_mtx);
- sc->ec_glk = glk != 0 ? 1 : 0;
- mtx_unlock(&sc->ec_mtx);
- }
- }
+ else
+ device_disable(dev);
+ }
+
+ if (ret == 0) {
+ snprintf(desc, sizeof(desc), "Embedded Controller: GPE %#x%s%s",
+ DEV_GET_GPEBIT(magic), (magic & DEV_GLK_FLAG) ? ", GLK" : "",
+ DEV_ECDT(dev) ? ", ECDT" : "");
+ device_set_desc_copy(dev, desc);
}
return (ret);
OpenPOWER on IntegriCloud