From e427cb78f7ae0e222bbbd4b915f0b9aecb6160ca Mon Sep 17 00:00:00 2001 From: Fredrik Holmqvist Date: Sat, 22 May 2010 09:45:18 +0000 Subject: [PATCH] * Fixing acpi_embedded_controller to work with the acpi 20100428. * Fixed one instance where ACPI and BeOS status codes was not handled right. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36897 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../acpi/acpi_embedded_controller.cpp | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/add-ons/kernel/bus_managers/acpi/acpi_embedded_controller.cpp b/src/add-ons/kernel/bus_managers/acpi/acpi_embedded_controller.cpp index 11f355f3f4..3bf86385b1 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpi_embedded_controller.cpp +++ b/src/add-ons/kernel/bus_managers/acpi/acpi_embedded_controller.cpp @@ -374,14 +374,8 @@ embedded_controller_init_driver(device_node* dev, void** _driverCookie) } // Enable runtime GPEs for the handler. - status = sc->ec_acpi_module->set_gpe(sc->ec_gpehandle, sc->ec_gpebit, - ACPI_GPE_ENABLE); - if (status != B_OK) { - TRACE("AcpiSetGpeType failed.\n"); - goto error; - } status = sc->ec_acpi_module->enable_gpe(sc->ec_gpehandle, sc->ec_gpebit, - ACPI_NOT_ISR); + ACPI_GPE_TYPE_RUNTIME); if (status != B_OK) { TRACE("AcpiEnableGpe failed.\n"); goto error; @@ -507,9 +501,9 @@ EcGpeQueryHandler(void* context) // interrupt source since we are edge-triggered. To prevent the GPE // that may arise from running the query from causing another query // to be queued, we clear the pending flag only after running it. - status = EcCommand(sc, EC_COMMAND_QUERY); + acpi_status acpi_status = EcCommand(sc, EC_COMMAND_QUERY); sc->ec_sci_pending = FALSE; - if (status != B_OK) { + if (acpi_status != AE_OK) { EcUnlock(sc); TRACE("GPE query failed.\n"); return; @@ -606,15 +600,16 @@ EcSpaceHandler(uint32 function, acpi_physical_address address, uint32 width, /* * If booting, check if we need to run the query handler. If so, we - * we call it directly here since our thread taskq is not active yet. + * we call it directly here as scheduling and dpc might not be up yet. + * (Not sure if it's needed) */ - /* - if (cold || rebooting || sc->ec_suspending) { + + if (gKernelStartup || sc->ec_suspending) { if ((EC_GET_CSR(sc) & EC_EVENT_SCI)) { //CTR0(KTR_ACPI, "ec running gpe handler directly"); EcGpeQueryHandler(sc); } - } */ + } // Serialize with EcGpeQueryHandler() at transaction granularity. status = EcLock(sc); @@ -854,7 +849,7 @@ EcWrite(struct acpi_ec_cookie* sc, uint8 address, uint8* writeData) EC_SET_DATA(sc, address); status = EcWaitEvent(sc, EC_EVENT_INPUT_BUFFER_EMPTY, generationCount); if (status != AE_OK) { - TRACE("EcRead: failed waiting for sent address\n"); + TRACE("EcWrite: failed waiting for sent address\n"); return status; }