diff options
author | jhb <jhb@FreeBSD.org> | 2001-02-26 20:36:56 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2001-02-26 20:36:56 +0000 |
commit | c402b432478979088c527a093a3e40880bb4a6f0 (patch) | |
tree | a45123809417eae229e6ccf431c3b651de672469 /sys/dev/acpica | |
parent | 91c34bffe746c6d5b4c5d24b948402a56625d87d (diff) | |
download | FreeBSD-src-c402b432478979088c527a093a3e40880bb4a6f0.zip FreeBSD-src-c402b432478979088c527a093a3e40880bb4a6f0.tar.gz |
- Use a loop to read consecutive bytes from the embedded controller to
handle read and write requests for widths of multiple bytes. This
can be used to read 16-bit battery status registers for example.
- Remove some unused variables and #if 0'd debugging cruft.
- Don't complain about a GPE query that fails due to AE_NOT_FOUND if the
query method was _Q00.
Diffstat (limited to 'sys/dev/acpica')
-rw-r--r-- | sys/dev/acpica/acpi_ec.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/sys/dev/acpica/acpi_ec.c b/sys/dev/acpica/acpi_ec.c index 8a838e8..a0833e9 100644 --- a/sys/dev/acpica/acpi_ec.c +++ b/sys/dev/acpica/acpi_ec.c @@ -284,8 +284,6 @@ static int acpi_ec_attach(device_t dev) { struct acpi_ec_softc *sc; - ACPI_BUFFER *bufp; - UINT32 *param; ACPI_STATUS Status; FUNCTION_TRACE(__FUNCTION__); @@ -355,10 +353,6 @@ acpi_ec_attach(device_t dev) * Install address space handler */ DEBUG_PRINT(TRACE_RESOURCES, ("attaching address space handler\n")); -#if 0 - AcpiDbgLayer = ALL_COMPONENTS; - AcpiDbgLevel = ACPI_ALL | TRACE_ALL | VERBOSE_ALL; -#endif if ((Status = AcpiInstallAddressSpaceHandler(sc->ec_handle, ADDRESS_SPACE_EC, EcSpaceHandler, EcSpaceSetup, sc)) != AE_OK) { device_printf(dev, "can't install address space handler - %s\n", acpi_strerror(Status)); @@ -413,7 +407,11 @@ EcGpeQueryHandler(void *Context) */ sprintf(qxx, "_Q%02x", Data); strupr(qxx); - if ((Status = AcpiEvaluateObject(sc->ec_handle, qxx, NULL, NULL)) != AE_OK) { + Status = AcpiEvaluateObject(sc->ec_handle, qxx, NULL, NULL); + /* + * Ignore spurious query requests. + */ + if (Status != AE_OK && (Data != 0 || Status != AE_NOT_FOUND)) { device_printf(sc->ec_dev, "evaluation of GPE query method %s failed - %s\n", qxx, acpi_strerror(Status)); } @@ -474,10 +472,11 @@ EcSpaceHandler(UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 width, UIN struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context; ACPI_STATUS Status = AE_OK; EC_REQUEST EcRequest; + int i; FUNCTION_TRACE_U32(__FUNCTION__, (UINT32)Address); - if ((Address > 0xFF) || (width != 8) || (Value == NULL) || (Context == NULL)) + if ((Address > 0xFF) || (width % 8 != 0) || (Value == NULL) || (Context == NULL)) return_ACPI_STATUS(AE_BAD_PARAMETER); switch (Function) { @@ -501,8 +500,18 @@ EcSpaceHandler(UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 width, UIN /* * Perform the transaction. */ - if ((Status = EcTransaction(sc, &EcRequest)) == AE_OK) - (*Value) = (UINT32)EcRequest.Data; + (*Value) = 0; + for (i = 0; i < width; i += 8) { + if (Function == ADDRESS_SPACE_READ) + EcRequest.Data = 0; + else + EcRequest.Data = (UINT8)((*Value) >> i); + if ((Status = EcTransaction(sc, &EcRequest)) != AE_OK) + break; + (*Value) |= (UINT32)EcRequest.Data << i; + if (++EcRequest.Address == 0) + return_ACPI_STATUS(AE_BAD_PARAMETER); + } return_ACPI_STATUS(Status); } |