diff options
author | njl <njl@FreeBSD.org> | 2003-07-20 21:12:21 +0000 |
---|---|---|
committer | njl <njl@FreeBSD.org> | 2003-07-20 21:12:21 +0000 |
commit | 6d201c6f71fac3e288a6c52e28186f84237bdb36 (patch) | |
tree | c9e7c7d81742552196bf15312c30132d01b593d2 | |
parent | 6418f5291b52b67bb4500603d0dc313f266f9ebe (diff) | |
download | FreeBSD-src-6d201c6f71fac3e288a6c52e28186f84237bdb36.zip FreeBSD-src-6d201c6f71fac3e288a6c52e28186f84237bdb36.tar.gz |
Do not call acpi_MatchHid() for all probe cases since it accesses the
namespace. To compensate for it only being used in the !ECDT case, use
a more robust approach to indicate a device was probed via ECDT by setting
the private ivar to be &acpi_ec_devclass. Without the acpi_MatchHid() call
now, it might have been possible for a non-EC device to have had its magic
match our previous flag.
Pointed out by: takawata
-rw-r--r-- | sys/dev/acpica/acpi_ec.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/sys/dev/acpica/acpi_ec.c b/sys/dev/acpica/acpi_ec.c index 1f9e4a3..c09fb0b 100644 --- a/sys/dev/acpica/acpi_ec.c +++ b/sys/dev/acpica/acpi_ec.c @@ -232,7 +232,7 @@ typedef struct { } ACPI_TABLE_ECDT; /* Indicate that this device has already been probed via ECDT. */ -#define DEV_ECDT_FLAG 0x80000000 +#define DEV_ECDT(x) (acpi_get_private(x) == &acpi_ec_devclass) /* Indicate that this device should use the global lock. */ #define DEV_GLK_FLAG 0x40000000 @@ -401,7 +401,8 @@ acpi_ec_ecdt_probe(device_t parent) * We'll determine whether we really want to use the global lock * in a later call to attach. */ - magic = DEV_ECDT_FLAG | DEV_GLK_FLAG; + acpi_set_private(child, &acpi_ec_devclass); + magic = DEV_GLK_FLAG; DEV_SET_GPEBIT(magic, ecdt->gpe_bit); acpi_set_magic(child, magic); @@ -419,11 +420,9 @@ acpi_ec_probe(device_t dev) char desc[64]; int magic, uid, glk, gpebit, ret = ENXIO; - /* Check that this is an EC device and it's not disabled. */ - if (acpi_get_type(dev) != ACPI_TYPE_DEVICE || acpi_disabled("ec") || - !acpi_MatchHid(dev, "PNP0C09")) { + /* Check that this is a device and that EC is not disabled. */ + if (acpi_get_type(dev) != ACPI_TYPE_DEVICE || acpi_disabled("ec")) return (ENXIO); - } /* * If probed via ECDT, set description and continue. Otherwise, @@ -431,12 +430,12 @@ acpi_ec_probe(device_t dev) * duplicate probe. */ magic = acpi_get_magic(dev); - if ((magic & DEV_ECDT_FLAG) != 0) { + if (DEV_ECDT(dev)) { snprintf(desc, sizeof(desc), "embedded controller: ECDT, GPE %#x, GLK", DEV_GET_GPEBIT(magic)); device_set_desc_copy(dev, desc); ret = 0; - } else { + } else if (acpi_MatchHid(dev, "PNP0C09")) { h = acpi_get_handle(dev); /* |