diff --git a/headers/os/drivers/ACPI.h b/headers/os/drivers/ACPI.h index 32a5341aa6..73a6b075a1 100644 --- a/headers/os/drivers/ACPI.h +++ b/headers/os/drivers/ACPI.h @@ -145,6 +145,8 @@ typedef uint32 acpi_status; typedef uint32 (*acpi_event_handler)(void *Context); +typedef uint32 (*acpi_gpe_handler) (acpi_handle GpeDevice, uint32 GpeNumber, + void *Context); typedef acpi_status (*acpi_adr_space_handler)(uint32 function, acpi_physical_address address, uint32 bitWidth, int *value, @@ -178,13 +180,17 @@ struct acpi_module_info { /* GPE Handler */ + status_t (*update_all_gpes)(); status_t (*enable_gpe)(acpi_handle handle, uint32 gpeNumber); + status_t (*disable_gpe)(acpi_handle handle, uint32 gpeNumber); + status_t (*clear_gpe)(acpi_handle handle, uint32 gpeNumber); status_t (*set_gpe)(acpi_handle handle, uint32 gpeNumber, uint8 action); + status_t (*finish_gpe)(acpi_handle handle, uint32 gpeNumber); status_t (*install_gpe_handler)(acpi_handle handle, uint32 gpeNumber, - uint32 type, acpi_event_handler handler, void *data); + uint32 type, acpi_gpe_handler handler, void *data); status_t (*remove_gpe_handler)(acpi_handle handle, uint32 gpeNumber, - acpi_event_handler address); + acpi_gpe_handler address); /* Address Space Handler */ diff --git a/src/add-ons/kernel/bus_managers/acpi/Jamfile b/src/add-ons/kernel/bus_managers/acpi/Jamfile index fdc8a4aa76..f1a82e530a 100644 --- a/src/add-ons/kernel/bus_managers/acpi/Jamfile +++ b/src/add-ons/kernel/bus_managers/acpi/Jamfile @@ -13,6 +13,8 @@ local common_src = ; local dispatcher_src = + dsargs.c + dscontrol.c dsfield.c dsinit.c dsmethod.c @@ -22,12 +24,14 @@ local dispatcher_src = dsutils.c dswexec.c dswload.c + dswload2.c dswscope.c dswstate.c ; local events_src = evevent.c + evglock.c evgpe.c evgpeblk.c evgpeinit.c @@ -38,6 +42,7 @@ local events_src = evsci.c evxface.c evxfevnt.c + evxfgpe.c evxfregn.c ; @@ -142,6 +147,7 @@ local utilities_src = utcache.c utclib.c utcopy.c + utdecode.c utdebug.c utdelete.c uteval.c diff --git a/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c b/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c index 35fafba3fc..8dc0361e51 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c @@ -270,6 +270,13 @@ remove_notify_handler(acpi_handle device, uint32 handlerType, } +status_t +update_all_gpes() +{ + return AcpiUpdateAllGpes() == AE_OK ? B_OK : B_ERROR; +} + + status_t enable_gpe(acpi_handle handle, uint32 gpeNumber) { @@ -277,6 +284,20 @@ enable_gpe(acpi_handle handle, uint32 gpeNumber) } +status_t +disable_gpe(acpi_handle handle, uint32 gpeNumber) +{ + return AcpiDisableGpe(handle, gpeNumber) == AE_OK ? B_OK : B_ERROR; +} + + +status_t +clear_gpe(acpi_handle handle, uint32 gpeNumber) +{ + return AcpiClearGpe(handle, gpeNumber) == AE_OK ? B_OK : B_ERROR; +} + + status_t set_gpe(acpi_handle handle, uint32 gpeNumber, uint8 action) { @@ -284,20 +305,27 @@ set_gpe(acpi_handle handle, uint32 gpeNumber, uint8 action) } +status_t +finish_gpe(acpi_handle handle, uint32 gpeNumber) +{ + return AcpiFinishGpe(handle, gpeNumber) == AE_OK ? B_OK : B_ERROR; +} + + status_t install_gpe_handler(acpi_handle handle, uint32 gpeNumber, uint32 type, - acpi_event_handler handler, void *data) + acpi_gpe_handler handler, void *data) { return AcpiInstallGpeHandler(handle, gpeNumber, type, - (ACPI_EVENT_HANDLER)handler, data) == AE_OK ? B_OK : B_ERROR; + (ACPI_GPE_HANDLER)handler, data) == AE_OK ? B_OK : B_ERROR; } status_t remove_gpe_handler(acpi_handle handle, uint32 gpeNumber, - acpi_event_handler address) + acpi_gpe_handler address) { - return AcpiRemoveGpeHandler(handle, gpeNumber, (ACPI_EVENT_HANDLER)address) + return AcpiRemoveGpeHandler(handle, gpeNumber, (ACPI_GPE_HANDLER)address) == AE_OK ? B_OK : B_ERROR; } @@ -701,8 +729,12 @@ struct acpi_module_info gACPIModule = { release_global_lock, install_notify_handler, remove_notify_handler, + update_all_gpes, enable_gpe, + disable_gpe, + clear_gpe, set_gpe, + finish_gpe, install_gpe_handler, remove_gpe_handler, install_address_space_handler, 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 a9ae6b44a9..92ed85b012 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 @@ -197,7 +197,7 @@ embedded_controller_free(void* cookie) // #pragma mark - driver module API -int32 +static int32 acpi_get_type(device_node* dev) { const char *bus; @@ -481,12 +481,30 @@ struct device_module_info embedded_controller_device_module = { // #pragma mark - +static acpi_status +EcCheckStatus(struct acpi_ec_cookie* sc, const char* msg, EC_EVENT event) +{ + acpi_status status = AE_NO_HARDWARE_RESPONSE; + EC_STATUS ec_status = EC_GET_CSR(sc); + + if (sc->ec_burstactive && !(ec_status & EC_FLAG_BURST_MODE)) { + TRACE("burst disabled in waitevent (%s)\n", msg); + sc->ec_burstactive = false; + } + if (EVENT_READY(event, ec_status)) { + TRACE("%s wait ready, status %#x\n", msg, ec_status); + status = AE_OK; + } + return status; +} + + static void EcGpeQueryHandler(void* context) { struct acpi_ec_cookie* sc = (struct acpi_ec_cookie*)context; - ASSERT(context != NULL);//, ("EcGpeQueryHandler called with NULL")); + ASSERT(context != NULL); // Serialize user access with EcSpaceHandler(). status_t status = EcLock(sc); @@ -500,7 +518,17 @@ 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. - acpi_status acpi_status = EcCommand(sc, EC_COMMAND_QUERY); + int sci_enqueued = sc->ec_sci_pending; + acpi_status acpi_status; + for (uint8 retry = 0; retry < 2; retry++) { + acpi_status = EcCommand(sc, EC_COMMAND_QUERY); + if (acpi_status == AE_OK) + break; + if (EcCheckStatus(sc, "retr_check", + EC_EVENT_INPUT_BUFFER_EMPTY) != AE_OK) + break; + } + sc->ec_sci_pending = FALSE; if (acpi_status != AE_OK) { EcUnlock(sc); @@ -527,6 +555,14 @@ EcGpeQueryHandler(void* context) if (status != B_OK) { TRACE("evaluation of query method %s failed\n", qxx); } + + // Reenable runtime GPE if its execution was deferred. + if (sci_enqueued) { + status = sc->ec_acpi_module->finish_gpe(sc->ec_gpehandle, sc->ec_gpebit); + if (status != B_OK) + ERROR("reenabling runtime GPE failed.\n"); + } + } @@ -534,7 +570,7 @@ EcGpeQueryHandler(void* context) called from an unknown lock context. */ static uint32 -EcGpeHandler(void* context) +EcGpeHandler(acpi_handle gpeDevice, uint32 gpeNumber, void* context) { struct acpi_ec_cookie* sc = (acpi_ec_cookie*)context; @@ -550,10 +586,10 @@ EcGpeHandler(void* context) // If the EC_SCI bit of the status register is set, queue a query handler. // It will run the query and _Qxx method later, under the lock. - EC_STATUS EcStatus = EC_GET_CSR(sc); - if ((EcStatus & EC_EVENT_SCI) && !sc->ec_sci_pending) { + EC_STATUS ecStatus = EC_GET_CSR(sc); + if ((ecStatus & EC_EVENT_SCI) && !sc->ec_sci_pending) { TRACE("gpe queueing query handler\n"); - ACPI_STATUS status = AcpiOsExecute(OSL_GPE_HANDLER, EcGpeQueryHandler, + acpi_status status = AcpiOsExecute(OSL_GPE_HANDLER, EcGpeQueryHandler, context); if (status == AE_OK) sc->ec_sci_pending = TRUE; @@ -585,23 +621,16 @@ EcSpaceHandler(uint32 function, acpi_physical_address address, uint32 width, { TRACE("enter EcSpaceHandler\n"); struct acpi_ec_cookie* sc = (struct acpi_ec_cookie*)context; - uint8 ecData; + if (function != ACPI_READ && function != ACPI_WRITE) return AE_BAD_PARAMETER; if (width % 8 != 0 || value == NULL || context == NULL) return AE_BAD_PARAMETER; - if (address + (width / 8) - 1 > 0xFF) + if (address + width / 8 > 256) return AE_BAD_ADDRESS; - if (function == ACPI_READ) - *value = 0; - uint8 ecAddr = address; - acpi_status status = AE_ERROR; - - /* - * If booting, check if we need to run the query handler. If so, we - * we call it directly here as scheduling and dpc might not be up yet. - * (Not sure if it's needed) - */ + // If booting, check if we need to run the query handler. If so, we + // we call it directly here as scheduling and dpc might not be up yet. + // (Not sure if it's needed) if (gKernelStartup || gKernelShutdown || sc->ec_suspending) { if ((EC_GET_CSR(sc) & EC_EVENT_SCI)) { @@ -611,29 +640,43 @@ EcSpaceHandler(uint32 function, acpi_physical_address address, uint32 width, } // Serialize with EcGpeQueryHandler() at transaction granularity. - status = EcLock(sc); + acpi_status status = EcLock(sc); if (status != B_OK) return AE_NOT_ACQUIRED; + // If we can't start burst mode, continue anyway. + status = EcCommand(sc, EC_COMMAND_BURST_ENABLE); + if (status == B_OK) { + if (EC_GET_DATA(sc) == EC_BURST_ACK) { + TRACE("burst enabled.\n"); + sc->ec_burstactive = TRUE; + } + } + // Perform the transaction(s), based on width. - for (uint32 i = 0; i < width; i += 8, ecAddr++) { + acpi_physical_address ecAddr = address; + uint8* ecData = (uint8 *) value; + if (function == ACPI_READ) + *value = 0; + do { switch (function) { case ACPI_READ: - status = EcRead(sc, ecAddr, &ecData); - if (status == AE_OK) - *value |= ((int) ecData) << i; + status = EcRead(sc, ecAddr, ecData); break; case ACPI_WRITE: - ecData = (uint8)((*value) >> i); - status = EcWrite(sc, ecAddr, &ecData); - break; - default: - TRACE("invalid EcSpaceHandler function\n"); - status = AE_BAD_PARAMETER; + status = EcWrite(sc, ecAddr, *ecData); break; } if (status != AE_OK) break; + ecAddr++; + ecData++; + } while (ecAddr < address + width / 8); + + if (sc->ec_burstactive) { + sc->ec_burstactive = FALSE; + if (EcCommand(sc, EC_COMMAND_BURST_DISABLE) == AE_OK) + TRACE("disabled burst ok."); } EcUnlock(sc); @@ -641,24 +684,6 @@ EcSpaceHandler(uint32 function, acpi_physical_address address, uint32 width, } -static acpi_status -EcCheckStatus(struct acpi_ec_cookie* sc, const char* msg, EC_EVENT event) -{ - acpi_status status = AE_NO_HARDWARE_RESPONSE; - EC_STATUS ec_status = EC_GET_CSR(sc); - - if (sc->ec_burstactive && !(ec_status & EC_FLAG_BURST_MODE)) { - TRACE("burst disabled in waitevent (%s)\n", msg); - sc->ec_burstactive = false; - } - if (EVENT_READY(event, ec_status)) { - TRACE("%s wait ready, status %#x\n", msg, ec_status); - status = AE_OK; - } - return status; -} - - static acpi_status EcWaitEvent(struct acpi_ec_cookie* sc, EC_EVENT event, int32 generationCount) { @@ -668,7 +693,7 @@ EcWaitEvent(struct acpi_ec_cookie* sc, EC_EVENT event, int32 generationCount) // int need_poll = cold || rebooting || ec_polled_mode || sc->ec_suspending; int needPoll = ec_polled_mode || sc->ec_suspending || gKernelStartup || gKernelShutdown; - // The main CPU should be much faster than the EC. So the status should + // Wait for event by polling or GPE (interrupt). // be "not ready" when we start waiting. But if the main CPU is really // slow, it's possible we see the current "ready" response. Since that // can't be distinguished from the previous response in polled mode, @@ -695,7 +720,6 @@ EcWaitEvent(struct acpi_ec_cookie* sc, EC_EVENT event, int32 generationCount) count = (ec_timeout * 1000) / EC_POLL_DELAY; if (count == 0) count = 1; - for (i = 0; i < count; i++) { status = EcCheckStatus(sc, "poll", event); if (status == AE_OK) @@ -727,7 +751,7 @@ EcWaitEvent(struct acpi_ec_cookie* sc, EC_EVENT event, int32 generationCount) // We finished waiting for the GPE and it never arrived. Try to // read the register once and trust whatever value we got. This is - // the best we can do at this point. Then, force polled mode on + // the best we can do at this point. // since this system doesn't appear to generate GPEs. if (status != AE_OK) { status = EcCheckStatus(sc, "sleep_end", event); @@ -736,6 +760,8 @@ EcWaitEvent(struct acpi_ec_cookie* sc, EC_EVENT event, int32 generationCount) ec_polled_mode = TRUE; } } + + if (status != AE_OK) TRACE("error: ec wait timed out\n"); @@ -767,11 +793,17 @@ EcCommand(struct acpi_ec_cookie* sc, EC_COMMAND cmd) return AE_BAD_PARAMETER; } + // Ensure empty input buffer before issuing command. + // Use generation count of zero to force a quick check. + acpi_status status = EcWaitEvent(sc, EC_EVENT_INPUT_BUFFER_EMPTY, 0); + if (status != AE_OK) + return status; + // Run the command and wait for the chosen event. TRACE("running command %#x\n", cmd); - u_int gen_count = sc->ec_gencount; + int32 generationCount = sc->ec_gencount; EC_SET_CSR(sc, cmd); - acpi_status status = EcWaitEvent(sc, event, gen_count); + status = EcWaitEvent(sc, event, generationCount); if (status == AE_OK) { // If we succeeded, burst flag should now be present. if (cmd == EC_COMMAND_BURST_ENABLE) { @@ -791,60 +823,39 @@ EcRead(struct acpi_ec_cookie* sc, uint8 address, uint8* readData) { TRACE("read from %#x\n", address); - // If we can't start burst mode, continue anyway. - acpi_status status = EcCommand(sc, EC_COMMAND_BURST_ENABLE); - if (status == AE_OK) { - uint8 data = EC_GET_DATA(sc); - if (data == EC_BURST_ACK) { - TRACE("burst enabled\n"); - sc->ec_burstactive = TRUE; - } - } - - status = EcCommand(sc, EC_COMMAND_READ); - if (status != AE_OK) - return status; - - u_int generationCount = sc->ec_gencount; - - EC_SET_DATA(sc, address); - status = EcWaitEvent(sc, EC_EVENT_OUTPUT_BUFFER_FULL, generationCount); - if (status != AE_OK) { - TRACE("EcRead: failed waiting to get data\n"); - return status; - } - *readData = EC_GET_DATA(sc); - - if (sc->ec_burstactive) { - sc->ec_burstactive = FALSE; - status = EcCommand(sc, EC_COMMAND_BURST_DISABLE); + acpi_status status; + for (uint8 retry = 0; retry < 2; retry++) { + acpi_status status = EcCommand(sc, EC_COMMAND_READ); if (status != AE_OK) return status; - TRACE("disabled burst ok\n"); + + int32 generationCount = sc->ec_gencount; + EC_SET_DATA(sc, address); + status = EcWaitEvent(sc, EC_EVENT_OUTPUT_BUFFER_FULL, generationCount); + if (status != AE_OK) { + if (EcCheckStatus(sc, "retr_check", + EC_EVENT_INPUT_BUFFER_EMPTY) == AE_OK) + continue; + else + break; + } + *readData = EC_GET_DATA(sc); + return AE_OK; } - return AE_OK; + TRACE("EcRead: failed waiting to get data\n"); + return status; } static acpi_status -EcWrite(struct acpi_ec_cookie* sc, uint8 address, uint8* writeData) +EcWrite(struct acpi_ec_cookie* sc, uint8 address, uint8 writeData) { - /* If we can't start burst mode, continue anyway. */ - acpi_status status = EcCommand(sc, EC_COMMAND_BURST_ENABLE); - if (status == AE_OK) { - uint8 data = EC_GET_DATA(sc); - if (data == EC_BURST_ACK) { - TRACE("burst enabled\n"); - sc->ec_burstactive = TRUE; - } - } - - status = EcCommand(sc, EC_COMMAND_WRITE); + acpi_status status = EcCommand(sc, EC_COMMAND_WRITE); if (status != AE_OK) return status; - u_int generationCount = sc->ec_gencount; + int32 generationCount = sc->ec_gencount; EC_SET_DATA(sc, address); status = EcWaitEvent(sc, EC_EVENT_INPUT_BUFFER_EMPTY, generationCount); if (status != AE_OK) { @@ -853,20 +864,12 @@ EcWrite(struct acpi_ec_cookie* sc, uint8 address, uint8* writeData) } generationCount = sc->ec_gencount; - EC_SET_DATA(sc, *writeData); + EC_SET_DATA(sc, writeData); status = EcWaitEvent(sc, EC_EVENT_INPUT_BUFFER_EMPTY, generationCount); if (status != AE_OK) { TRACE("EcWrite: failed waiting for sent data\n"); return status; } - if (sc->ec_burstactive) { - sc->ec_burstactive = FALSE; - status = EcCommand(sc, EC_COMMAND_BURST_DISABLE); - if (status != AE_OK) - return (status); - TRACE("disabled burst ok\n"); - } - return AE_OK; } diff --git a/src/add-ons/kernel/bus_managers/acpi/acpi_embedded_controller.h b/src/add-ons/kernel/bus_managers/acpi/acpi_embedded_controller.h index bc5f9cfaf2..e8e1ef2cf3 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpi_embedded_controller.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpi_embedded_controller.h @@ -43,6 +43,7 @@ extern "C" { # include "acpi.h" # include "accommon.h" # include "acnamesp.h" +# include "actypes.h" # include "acpi_priv.h" } @@ -54,11 +55,8 @@ extern "C" { # define TRACE(x...) #endif +#define ERROR(x...) dprintf("EC: " x) -#define ACPI_REGION_DEACTIVATE 1 - -#define ACPI_READ 0 -#define ACPI_WRITE 1 typedef uint8 EC_COMMAND; @@ -128,12 +126,10 @@ typedef uint8 EC_EVENT; #define EC_SET_CSR(sc, v) \ bus_space_write_1((sc)->ec_csr_pci_address, (v)) - #define ACPI_PKG_VALID(pkg, size) \ ((pkg) != NULL && (pkg)->object_type == ACPI_TYPE_PACKAGE && \ (pkg)->data.package.count >= (size)) -int32 acpi_get_type(device_node* dev); /* * Driver cookie. @@ -213,7 +209,8 @@ EcUnlock(struct acpi_ec_cookie *sc) } -static uint32 EcGpeHandler(void *context); +static uint32 EcGpeHandler(acpi_handle gpeDevice, uint32 gpeNumber, + void *context); static acpi_status EcSpaceSetup(acpi_handle region, uint32 function, void *context, void **return_Context); @@ -227,7 +224,7 @@ static acpi_status EcCommand(struct acpi_ec_cookie *sc, EC_COMMAND cmd); static acpi_status EcRead(struct acpi_ec_cookie *sc, uint8 address, uint8 *readData); static acpi_status EcWrite(struct acpi_ec_cookie *sc, uint8 address, - uint8 *writeData); + uint8 writeData); #endif // ACPI_EMBEDDED_CONTROLLER_H diff --git a/src/add-ons/kernel/bus_managers/acpi/acpi_module.c b/src/add-ons/kernel/bus_managers/acpi/acpi_module.c index b4a384c7de..fbddef1228 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpi_module.c +++ b/src/add-ons/kernel/bus_managers/acpi/acpi_module.c @@ -192,8 +192,12 @@ static struct acpi_root_info sACPIRootModule = { release_global_lock, install_notify_handler, remove_notify_handler, + update_all_gpes, enable_gpe, + disable_gpe, + clear_gpe, set_gpe, + finish_gpe, install_gpe_handler, remove_gpe_handler, install_address_space_handler, diff --git a/src/add-ons/kernel/bus_managers/acpi/acpi_priv.h b/src/add-ons/kernel/bus_managers/acpi/acpi_priv.h index a4d4462bc0..ec8b7a7849 100644 --- a/src/add-ons/kernel/bus_managers/acpi/acpi_priv.h +++ b/src/add-ons/kernel/bus_managers/acpi/acpi_priv.h @@ -60,14 +60,17 @@ typedef struct acpi_root_info { uint32 handlerType, acpi_notify_handler handler); /* GPE Handler */ - + status_t (*update_all_gpes)(); status_t (*enable_gpe)(acpi_handle handle, uint32 gpeNumber); + status_t (*disable_gpe)(acpi_handle handle, uint32 gpeNumber); + status_t (*clear_gpe)(acpi_handle handle, uint32 gpeNumber); status_t (*set_gpe)(acpi_handle handle, uint32 gpeNumber, uint8 action); + status_t (*finish_gpe)(acpi_handle handle, uint32 gpeNumber); status_t (*install_gpe_handler)(acpi_handle handle, uint32 gpeNumber, - uint32 type, acpi_event_handler handler, void *data); + uint32 type, acpi_gpe_handler handler, void *data); status_t (*remove_gpe_handler)(acpi_handle handle, uint32 gpeNumber, - acpi_event_handler address); + acpi_gpe_handler address); /* Address Space Handler */ @@ -162,12 +165,16 @@ status_t install_notify_handler(acpi_handle device, uint32 handlerType, status_t remove_notify_handler(acpi_handle device, uint32 handlerType, acpi_notify_handler handler); +status_t update_all_gpes(); status_t enable_gpe(acpi_handle handle, uint32 gpeNumber); +status_t disable_gpe(acpi_handle handle, uint32 gpeNumber); +status_t clear_gpe(acpi_handle handle, uint32 gpeNumber); status_t set_gpe(acpi_handle handle, uint32 gpeNumber, uint8 action); +status_t finish_gpe(acpi_handle handle, uint32 gpeNumber); status_t install_gpe_handler(acpi_handle handle, uint32 gpeNumber, uint32 type, - acpi_event_handler handler, void* data); + acpi_gpe_handler handler, void* data); status_t remove_gpe_handler(acpi_handle handle, uint32 gpeNumber, - acpi_event_handler address); + acpi_gpe_handler address); status_t install_address_space_handler(acpi_handle handle, uint32 spaceID, acpi_adr_space_handler handler, acpi_adr_space_setup setup, void* data); diff --git a/src/add-ons/kernel/bus_managers/acpi/common/adfile.c b/src/add-ons/kernel/bus_managers/acpi/common/adfile.c index 629bd535c4..a7020cb9c2 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/adfile.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/adfile.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/common/adisasm.c b/src/add-ons/kernel/bus_managers/acpi/common/adisasm.c index 99f91ba050..748561f708 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/adisasm.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/adisasm.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -667,7 +667,7 @@ AdCreateTableHeader ( if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_DSDT)) { - AcpiOsPrintf (" **** ACPI 1.0, no 64-bit math support"); + AcpiOsPrintf (" **** 32-bit table (V1), no 64-bit math support"); } break; diff --git a/src/add-ons/kernel/bus_managers/acpi/common/adwalk.c b/src/add-ons/kernel/bus_managers/acpi/common/adwalk.c index e8f580c1c1..b4e227daba 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/adwalk.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/adwalk.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/common/dmextern.c b/src/add-ons/kernel/bus_managers/acpi/common/dmextern.c index 393de1d53b..b2e2acbc80 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/dmextern.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/dmextern.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/common/dmrestag.c b/src/add-ons/kernel/bus_managers/acpi/common/dmrestag.c index 184a856ed6..827dc26684 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/dmrestag.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/dmrestag.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/common/dmtable.c b/src/add-ons/kernel/bus_managers/acpi/common/dmtable.c index 05bd5e4945..a9e6a1de63 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/dmtable.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/dmtable.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -134,6 +134,13 @@ AcpiDmCheckAscii ( UINT32 Count); +/* Common format strings for commented values */ + +#define UINT8_FORMAT "%2.2X [%s]\n" +#define UINT16_FORMAT "%4.4X [%s]\n" +#define UINT32_FORMAT "%8.8X [%s]\n" +#define STRING_FORMAT "[%s]\n" + /* These tables map a subtable type to a description string */ static const char *AcpiDmAsfSubnames[] = @@ -264,6 +271,13 @@ static const char *AcpiDmMadtSubnames[] = "Unknown SubTable Type" /* Reserved */ }; +static const char *AcpiDmSlicSubnames[] = +{ + "Public Key Structure", + "Windows Marker Structure", + "Unknown SubTable Type" /* Reserved */ +}; + static const char *AcpiDmSratSubnames[] = { "Processor Local APIC/SAPIC Affinity", @@ -295,6 +309,19 @@ static const char *AcpiDmFadtProfiles[] = "Unknown Profile Type" }; +#define ACPI_GAS_WIDTH_RESERVED 5 + +static const char *AcpiDmGasAccessWidth[] = +{ + "Undefined/Legacy", + "Byte Access:8", + "Word Access:16", + "DWord Access:32", + "QWord Access:64", + "Unknown Width Encoding" +}; + + /******************************************************************************* * * ACPI Table Data, indexed by signature. @@ -329,13 +356,13 @@ ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, TemplateMsct, "Maximum System Characteristics Table"}, {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt, "Root System Description Table"}, {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst, "Smart Battery Specification Table"}, - {ACPI_SIG_SLIC, AcpiDmTableInfoSlic, NULL, NULL, NULL, "Software Licensing Description Table"}, + {ACPI_SIG_SLIC, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateSlic, "Software Licensing Description Table"}, {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, TemplateSlit, "System Locality Information Table"}, {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, TemplateSpcr, "Serial Port Console Redirection table"}, {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, TemplateSpmi, "Server Platform Management Interface table"}, {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat, "System Resource Affinity Table"}, {ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, NULL, TemplateTcpa, "Trusted Computing Platform Alliance table"}, - {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, NULL, TemplateUefi, "UEFI Boot Optimization Table"}, + {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi, "UEFI Boot Optimization Table"}, {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet, "Windows ACPI Emulated Devices Table"}, {ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, TemplateWdat, "Watchdog Action Table"}, {ACPI_SIG_WDDT, AcpiDmTableInfoWddt, NULL, NULL, TemplateWddt, "Watchdog Description Table"}, @@ -503,7 +530,8 @@ AcpiDmDumpDataTable ( { /* Dump the raw table data */ - AcpiOsPrintf ("\nRaw Table Data\n\n"); + AcpiOsPrintf ("\n%s: Length %d (0x%X)\n\n", + ACPI_RAW_TABLE_DATA_HEADER, Length, Length); AcpiUtDumpBuffer2 (ACPI_CAST_PTR (UINT8, Table), Length, DB_BYTE_DISPLAY); } } @@ -533,30 +561,48 @@ AcpiDmLineHeader ( char *Name) { + /* Allow a null name for fields that span multiple lines (large buffers) */ + + if (!Name) + { + Name = ""; + } + if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */ { if (ByteLength) { - AcpiOsPrintf ("[%.3d] %34s : ", - ByteLength, Name); + AcpiOsPrintf ("[%.4d] %34s : ", ByteLength, Name); } else { - AcpiOsPrintf ("%40s : ", - Name); + if (*Name) + { + AcpiOsPrintf ("%41s : ", Name); + } + else + { + AcpiOsPrintf ("%41s ", Name); + } } } else /* Normal disassembler or verbose template */ { if (ByteLength) { - AcpiOsPrintf ("[%3.3Xh %4.4d% 3d] %28s : ", + AcpiOsPrintf ("[%3.3Xh %4.4d% 4d] %28s : ", Offset, Offset, ByteLength, Name); } else { - AcpiOsPrintf ("%43s : ", - Name); + if (*Name) + { + AcpiOsPrintf ("%44s : ", Name); + } + else + { + AcpiOsPrintf ("%44s ", Name); + } } } } @@ -573,7 +619,7 @@ AcpiDmLineHeader2 ( { if (ByteLength) { - AcpiOsPrintf ("[%.3d] %30s % 3d : ", + AcpiOsPrintf ("[%.4d] %30s %3d : ", ByteLength, Name, Value); } else @@ -586,12 +632,12 @@ AcpiDmLineHeader2 ( { if (ByteLength) { - AcpiOsPrintf ("[%3.3Xh %4.4d% 3d] %24s % 3d : ", + AcpiOsPrintf ("[%3.3Xh %4.4d %3d] %24s %3d : ", Offset, Offset, ByteLength, Name, Value); } else { - AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s % 3d : ", + AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s %3d : ", Offset, Offset, Name, Value); } } @@ -669,6 +715,7 @@ AcpiDmDumpTable ( case ACPI_DMT_UINT8: case ACPI_DMT_CHKSUM: case ACPI_DMT_SPACEID: + case ACPI_DMT_ACCWIDTH: case ACPI_DMT_IVRS: case ACPI_DMT_MADT: case ACPI_DMT_SRAT: @@ -692,12 +739,14 @@ AcpiDmDumpTable ( case ACPI_DMT_UINT32: case ACPI_DMT_NAME4: case ACPI_DMT_SIG: + case ACPI_DMT_SLIC: ByteLength = 4; break; case ACPI_DMT_NAME6: ByteLength = 6; break; case ACPI_DMT_UINT56: + case ACPI_DMT_BUF7: ByteLength = 7; break; case ACPI_DMT_UINT64: @@ -705,8 +754,12 @@ AcpiDmDumpTable ( ByteLength = 8; break; case ACPI_DMT_BUF16: + case ACPI_DMT_UUID: ByteLength = 16; break; + case ACPI_DMT_BUF128: + ByteLength = 128; + break; case ACPI_DMT_STRING: ByteLength = ACPI_STRLEN (ACPI_CAST_PTR (char, Target)) + 1; break; @@ -807,21 +860,43 @@ AcpiDmDumpTable ( ACPI_FORMAT_UINT64 (ACPI_GET64 (Target))); break; + case ACPI_DMT_BUF7: case ACPI_DMT_BUF16: + case ACPI_DMT_BUF128: - /* Buffer of length 16 */ - - for (Temp8 = 0; Temp8 < 16; Temp8++) + /* + * Buffer: Size depends on the opcode and was set above. + * Each hex byte is separated with a space. + * Multiple lines are separated by line continuation char. + */ + for (Temp16 = 0; Temp16 < ByteLength; Temp16++) { - AcpiOsPrintf ("%2.2X", Target[Temp8]); - if ((Temp8 + 1) < 16) + AcpiOsPrintf ("%2.2X", Target[Temp16]); + if ((UINT32) (Temp16 + 1) < ByteLength) { - AcpiOsPrintf (","); + if ((Temp16 > 0) && (!((Temp16+1) % 16))) + { + AcpiOsPrintf (" \\\n"); /* Line continuation */ + AcpiDmLineHeader (0, 0, NULL); + } + else + { + AcpiOsPrintf (" "); + } } } AcpiOsPrintf ("\n"); break; + case ACPI_DMT_UUID: + + /* Convert 16-byte UUID buffer to 36-byte formatted UUID string */ + + (void) AuConvertUuidToString ((char *) Target, MsgBuffer); + + AcpiOsPrintf ("%s\n", MsgBuffer); + break; + case ACPI_DMT_STRING: AcpiOsPrintf ("\"%s\"\n", ACPI_CAST_PTR (char, Target)); @@ -836,9 +911,12 @@ AcpiDmDumpTable ( TableData = AcpiDmGetTableData (ACPI_CAST_PTR (char, Target)); if (TableData) { - AcpiOsPrintf ("/* %s */", TableData->Name); + AcpiOsPrintf (STRING_FORMAT, TableData->Name); + } + else + { + AcpiOsPrintf ("\n"); } - AcpiOsPrintf ("\n"); break; case ACPI_DMT_NAME4: @@ -881,14 +959,27 @@ AcpiDmDumpTable ( /* Address Space ID */ - AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiUtGetRegionName (*Target)); + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiUtGetRegionName (*Target)); + break; + + case ACPI_DMT_ACCWIDTH: + + /* Encoded Access Width */ + + Temp8 = *Target; + if (Temp8 > ACPI_GAS_WIDTH_RESERVED) + { + Temp8 = ACPI_GAS_WIDTH_RESERVED; + } + + AcpiOsPrintf (UINT8_FORMAT, Temp8, AcpiDmGasAccessWidth[Temp8]); break; case ACPI_DMT_GAS: /* Generic Address Structure */ - AcpiOsPrintf ("\n"); + AcpiOsPrintf (STRING_FORMAT, "Generic Address Structure"); AcpiDmDumpTable (TableLength, CurrentOffset, Target, sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas); AcpiOsPrintf ("\n"); @@ -905,7 +996,7 @@ AcpiDmDumpTable ( Temp16 = ACPI_ASF_TYPE_RESERVED; } - AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmAsfSubnames[Temp16]); + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmAsfSubnames[Temp16]); break; case ACPI_DMT_DMAR: @@ -918,7 +1009,7 @@ AcpiDmDumpTable ( Temp16 = ACPI_DMAR_TYPE_RESERVED; } - AcpiOsPrintf ("%4.4X <%s>\n", ACPI_GET16 (Target), AcpiDmDmarSubnames[Temp16]); + AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), AcpiDmDmarSubnames[Temp16]); break; case ACPI_DMT_EINJACT: @@ -931,7 +1022,7 @@ AcpiDmDumpTable ( Temp8 = ACPI_EINJ_ACTION_RESERVED; } - AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmEinjActions[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmEinjActions[Temp8]); break; case ACPI_DMT_EINJINST: @@ -944,7 +1035,7 @@ AcpiDmDumpTable ( Temp8 = ACPI_EINJ_INSTRUCTION_RESERVED; } - AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmEinjInstructions[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmEinjInstructions[Temp8]); break; case ACPI_DMT_ERSTACT: @@ -957,7 +1048,7 @@ AcpiDmDumpTable ( Temp8 = ACPI_ERST_ACTION_RESERVED; } - AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmErstActions[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmErstActions[Temp8]); break; case ACPI_DMT_ERSTINST: @@ -970,7 +1061,7 @@ AcpiDmDumpTable ( Temp8 = ACPI_ERST_INSTRUCTION_RESERVED; } - AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmErstInstructions[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmErstInstructions[Temp8]); break; case ACPI_DMT_HEST: @@ -983,12 +1074,12 @@ AcpiDmDumpTable ( Temp16 = ACPI_HEST_TYPE_RESERVED; } - AcpiOsPrintf ("%4.4X (%s)\n", ACPI_GET16 (Target), AcpiDmHestSubnames[Temp16]); + AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), AcpiDmHestSubnames[Temp16]); break; case ACPI_DMT_HESTNTFY: - AcpiOsPrintf ("\n"); + AcpiOsPrintf (STRING_FORMAT, "Hardware Error Notification Structure"); AcpiDmDumpTable (TableLength, CurrentOffset, Target, sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify); AcpiOsPrintf ("\n"); @@ -1005,7 +1096,7 @@ AcpiDmDumpTable ( Temp8 = ACPI_HEST_NOTIFY_RESERVED; } - AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmHestNotifySubnames[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmHestNotifySubnames[Temp8]); break; case ACPI_DMT_MADT: @@ -1018,7 +1109,20 @@ AcpiDmDumpTable ( Temp8 = ACPI_MADT_TYPE_RESERVED; } - AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmMadtSubnames[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmMadtSubnames[Temp8]); + break; + + case ACPI_DMT_SLIC: + + /* SLIC subtable types */ + + Temp8 = *Target; + if (Temp8 > ACPI_SLIC_TYPE_RESERVED) + { + Temp8 = ACPI_SLIC_TYPE_RESERVED; + } + + AcpiOsPrintf (UINT32_FORMAT, *Target, AcpiDmSlicSubnames[Temp8]); break; case ACPI_DMT_SRAT: @@ -1031,7 +1135,7 @@ AcpiDmDumpTable ( Temp8 = ACPI_SRAT_TYPE_RESERVED; } - AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmSratSubnames[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmSratSubnames[Temp8]); break; case ACPI_DMT_FADTPM: @@ -1044,7 +1148,7 @@ AcpiDmDumpTable ( Temp8 = ACPI_FADT_PM_RESERVED; } - AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmFadtProfiles[Temp8]); + AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmFadtProfiles[Temp8]); break; case ACPI_DMT_IVRS: @@ -1069,7 +1173,7 @@ AcpiDmDumpTable ( break; } - AcpiOsPrintf ("%2.2X <%s>\n", *Target, Name); + AcpiOsPrintf (UINT8_FORMAT, *Target, Name); break; case ACPI_DMT_EXIT: diff --git a/src/add-ons/kernel/bus_managers/acpi/common/dmtbdump.c b/src/add-ons/kernel/bus_managers/acpi/common/dmtbdump.c index 8bbaf663fb..2102bab469 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/dmtbdump.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/dmtbdump.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -124,6 +124,12 @@ ACPI_MODULE_NAME ("dmtbdump") +static void +AcpiDmValidateFadtLength ( + UINT32 Revision, + UINT32 Length); + + /******************************************************************************* * * FUNCTION: AcpiDmDumpRsdp @@ -273,6 +279,10 @@ AcpiDmDumpXsdt ( * * DESCRIPTION: Format the contents of a FADT * + * NOTE: We cannot depend on the FADT version to indicate the actual + * contents of the FADT because of BIOS bugs. The table length + * is the only reliable indicator. + * ******************************************************************************/ void @@ -280,20 +290,21 @@ AcpiDmDumpFadt ( ACPI_TABLE_HEADER *Table) { - /* Common ACPI 1.0 portion of FADT */ + /* Always dump the minimum FADT revision 1 fields (ACPI 1.0) */ AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt1); - /* Check for ACPI 1.0B MS extensions (FADT revision 2) */ + /* Check for FADT revision 2 fields (ACPI 1.0B MS extensions) */ - if (Table->Revision == 2) + if ((Table->Length > ACPI_FADT_V1_SIZE) && + (Table->Length <= ACPI_FADT_V2_SIZE)) { AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt2); } - /* Check for ACPI 2.0+ extended data (FADT revision 3+) */ + /* Check for FADT revision 3 fields and up (ACPI 2.0+ extended data) */ - else if (Table->Length >= sizeof (ACPI_TABLE_FADT)) + else if (Table->Length > ACPI_FADT_V2_SIZE) { AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt3); } @@ -301,6 +312,68 @@ AcpiDmDumpFadt ( /* Validate various fields in the FADT, including length */ AcpiTbCreateLocalFadt (Table, Table->Length); + + /* Validate FADT length against the revision */ + + AcpiDmValidateFadtLength (Table->Revision, Table->Length); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmValidateFadtLength + * + * PARAMETERS: Revision - FADT revision (Header->Revision) + * Length - FADT length (Header->Length + * + * RETURN: None + * + * DESCRIPTION: Check the FADT revision against the expected table length for + * that revision. Issue a warning if the length is not what was + * expected. This seems to be such a common BIOS bug that the + * FADT revision has been rendered virtually meaningless. + * + ******************************************************************************/ + +static void +AcpiDmValidateFadtLength ( + UINT32 Revision, + UINT32 Length) +{ + UINT32 ExpectedLength; + + + switch (Revision) + { + case 0: + AcpiOsPrintf ("// ACPI Warning: Invalid FADT revision: 0\n"); + return; + + case 1: + ExpectedLength = ACPI_FADT_V1_SIZE; + break; + + case 2: + ExpectedLength = ACPI_FADT_V2_SIZE; + break; + + case 3: + case 4: + ExpectedLength = ACPI_FADT_V3_SIZE; + break; + + default: + return; + } + + if (Length == ExpectedLength) + { + return; + } + + AcpiOsPrintf ( + "\n// ACPI Warning: FADT revision %X does not match length: found %X expected %X\n", + Revision, Length, ExpectedLength); } @@ -1272,6 +1345,81 @@ AcpiDmDumpMsct ( } +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpSlic + * + * PARAMETERS: Table - A SLIC table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a SLIC + * + ******************************************************************************/ + +void +AcpiDmDumpSlic ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + UINT32 Offset = sizeof (ACPI_TABLE_SLIC); + ACPI_SLIC_HEADER *SubTable; + ACPI_DMTABLE_INFO *InfoTable; + + + /* There is no main SLIC table, only subtables */ + + SubTable = ACPI_ADD_PTR (ACPI_SLIC_HEADER, Table, Offset); + while (Offset < Table->Length) + { + /* Common sub-table header */ + + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + SubTable->Length, AcpiDmTableInfoSlicHdr); + if (ACPI_FAILURE (Status)) + { + return; + } + + switch (SubTable->Type) + { + case ACPI_SLIC_TYPE_PUBLIC_KEY: + InfoTable = AcpiDmTableInfoSlic0; + break; + case ACPI_SLIC_TYPE_WINDOWS_MARKER: + InfoTable = AcpiDmTableInfoSlic1; + break; + default: + AcpiOsPrintf ("\n**** Unknown SLIC sub-table type 0x%X\n", SubTable->Type); + + /* Attempt to continue */ + + if (!SubTable->Length) + { + AcpiOsPrintf ("Invalid zero length subtable\n"); + return; + } + goto NextSubTable; + } + + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + SubTable->Length, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } + +NextSubTable: + /* Point to next sub-table */ + + Offset += SubTable->Length; + SubTable = ACPI_ADD_PTR (ACPI_SLIC_HEADER, SubTable, SubTable->Length); + } +} + + /******************************************************************************* * * FUNCTION: AcpiDmDumpSlit @@ -1332,12 +1480,12 @@ AcpiDmDumpSlit ( if ((j+1) < Localities) { - AcpiOsPrintf (","); + AcpiOsPrintf (" "); if (j && (((j+1) % 16) == 0)) { - AcpiOsPrintf ("\n"); - AcpiDmLineHeader (Offset, 0, ""); + AcpiOsPrintf ("\\\n"); /* With line continuation char */ + AcpiDmLineHeader (Offset, 0, NULL); } } } diff --git a/src/add-ons/kernel/bus_managers/acpi/common/dmtbinfo.c b/src/add-ons/kernel/bus_managers/acpi/common/dmtbinfo.c index 9abf586b3f..05e5709c46 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/dmtbinfo.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/dmtbinfo.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -122,6 +122,31 @@ #define _COMPONENT ACPI_CA_DISASSEMBLER ACPI_MODULE_NAME ("dmtbinfo") +/* + * How to add a new table: + * + * - Add the C table definition to the actbl1.h or actbl2.h header. + * - Add ACPI_xxxx_OFFSET macro(s) for the table (and subtables) to list below. + * - Define the table in this file (for the disassembler). If any + * new data types are required (ACPI_DMT_*), see below. + * - Add an external declaration for the new table definition (AcpiDmTableInfo*) + * in acdisam.h + * - Add new table definition to the dispatch table in dmtable.c (AcpiDmTableData) + * If a simple table (with no subtables), no disassembly code is needed. + * Otherwise, create the AcpiDmDump* function for to disassemble the table + * and add it to the dmtbdump.c file. + * - Add an external declaration for the new AcpiDmDump* function in acdisasm.h + * - Add the new AcpiDmDump* function to the dispatch table in dmtable.c + * - Create a template for the new table + * - Add data table compiler support + * + * How to add a new data type (ACPI_DMT_*): + * + * - Add new type at the end of the ACPI_DMT list in acdisasm.h + * - Add length and implementation cases in dmtable.c (disassembler) + * - Add type and length cases in dtutils.c (DT compiler) + */ + /* * Macros used to generate offsets to specific table fields */ @@ -203,6 +228,9 @@ #define ACPI_MADTH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f) #define ACPI_MCFG0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MCFG_ALLOCATION,f) #define ACPI_MSCT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MSCT_PROXIMITY,f) +#define ACPI_SLICH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SLIC_HEADER,f) +#define ACPI_SLIC0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SLIC_KEY,f) +#define ACPI_SLIC1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SLIC_MARKER,f) #define ACPI_SRATH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f) #define ACPI_SRAT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SRAT_CPU_AFFINITY,f) #define ACPI_SRAT1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SRAT_MEM_AFFINITY,f) @@ -282,7 +310,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoGas[] = {ACPI_DMT_SPACEID, ACPI_GAS_OFFSET (SpaceId), "Space ID", 0}, {ACPI_DMT_UINT8, ACPI_GAS_OFFSET (BitWidth), "Bit Width", 0}, {ACPI_DMT_UINT8, ACPI_GAS_OFFSET (BitOffset), "Bit Offset", 0}, - {ACPI_DMT_UINT8, ACPI_GAS_OFFSET (AccessWidth), "Access Width", 0}, + {ACPI_DMT_ACCWIDTH, ACPI_GAS_OFFSET (AccessWidth), "Encoded Access Width", 0}, {ACPI_DMT_UINT64, ACPI_GAS_OFFSET (Address), "Address", 0}, ACPI_DMT_TERMINATOR }; @@ -549,7 +577,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoAsf2a[] = ACPI_DMTABLE_INFO AcpiDmTableInfoAsf3[] = { - {ACPI_DMT_UINT56, ACPI_ASF3_OFFSET (Capabilities[0]), "Capabilities", 0}, + {ACPI_DMT_BUF7, ACPI_ASF3_OFFSET (Capabilities[0]), "Capabilities", 0}, {ACPI_DMT_UINT8, ACPI_ASF3_OFFSET (CompletionCode), "Completion Code", 0}, {ACPI_DMT_UINT32, ACPI_ASF3_OFFSET (EnterpriseId), "Enterprise ID", 0}, {ACPI_DMT_UINT8, ACPI_ASF3_OFFSET (Command), "Command", 0}, @@ -1328,13 +1356,42 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSbst[] = /******************************************************************************* * - * SLIC - Software Licensing Description Table. NOT FULLY IMPLEMENTED, do not - * have the table definition. + * SLIC - Software Licensing Description Table. There is no common table, just + * the standard ACPI header and then subtables. * ******************************************************************************/ -ACPI_DMTABLE_INFO AcpiDmTableInfoSlic[] = +/* Common Subtable header (one per Subtable) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoSlicHdr[] = { + {ACPI_DMT_SLIC, ACPI_SLICH_OFFSET (Type), "Subtable Type", 0}, + {ACPI_DMT_UINT32, ACPI_SLICH_OFFSET (Length), "Length", DT_LENGTH}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoSlic0[] = +{ + {ACPI_DMT_UINT8, ACPI_SLIC0_OFFSET (KeyType), "Key Type", 0}, + {ACPI_DMT_UINT8, ACPI_SLIC0_OFFSET (Version), "Version", 0}, + {ACPI_DMT_UINT16, ACPI_SLIC0_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_SLIC0_OFFSET (Algorithm), "Algorithm", 0}, + {ACPI_DMT_NAME4, ACPI_SLIC0_OFFSET (Magic), "Magic", 0}, + {ACPI_DMT_UINT32, ACPI_SLIC0_OFFSET (BitLength), "BitLength", 0}, + {ACPI_DMT_UINT32, ACPI_SLIC0_OFFSET (Exponent), "Exponent", 0}, + {ACPI_DMT_BUF128, ACPI_SLIC0_OFFSET (Modulus[0]), "Modulus", 0}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoSlic1[] = +{ + {ACPI_DMT_UINT32, ACPI_SLIC1_OFFSET (Version), "Version", 0}, + {ACPI_DMT_NAME6, ACPI_SLIC1_OFFSET (OemId[0]), "Oem ID", 0}, + {ACPI_DMT_NAME8, ACPI_SLIC1_OFFSET (OemTableId[0]), "Oem Table ID", 0}, + {ACPI_DMT_NAME8, ACPI_SLIC1_OFFSET (WindowsFlag[0]), "Windows Flag", 0}, + {ACPI_DMT_UINT32, ACPI_SLIC1_OFFSET (SlicVersion), "SLIC Version", 0}, + {ACPI_DMT_BUF16, ACPI_SLIC1_OFFSET (Reserved[0]), "Reserved", 0}, + {ACPI_DMT_BUF128, ACPI_SLIC1_OFFSET (Signature[0]), "Signature", 0}, ACPI_DMT_TERMINATOR }; @@ -1503,7 +1560,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoTcpa[] = ACPI_DMTABLE_INFO AcpiDmTableInfoUefi[] = { - {ACPI_DMT_BUF16, ACPI_UEFI_OFFSET (Identifier[0]), "UUID Identifier", 0}, + {ACPI_DMT_UUID, ACPI_UEFI_OFFSET (Identifier[0]), "UUID Identifier", 0}, {ACPI_DMT_UINT16, ACPI_UEFI_OFFSET (DataOffset), "Data Offset", 0}, ACPI_DMT_TERMINATOR }; @@ -1623,3 +1680,43 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoWdrt[] = {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (Units), "Counter Units", 0}, ACPI_DMT_TERMINATOR }; + +/* + * Generic types (used in UEFI) + * + * Examples: + * + * Buffer : cc 04 ff bb + * UINT8 : 11 + * UINT16 : 1122 + * UINT24 : 112233 + * UINT32 : 11223344 + * UINT56 : 11223344556677 + * UINT64 : 1122334455667788 + * + * String : "This is string" + * Unicode : "This string encoded to Unicode" + * + * GUID : 11223344-5566-7788-99aa-bbccddeeff00 + * DevicePath : "\PciRoot(0)\Pci(0x1f,1)\Usb(0,0)" + */ + +#define ACPI_DM_GENERIC_ENTRY(FieldType, FieldName)\ + {{FieldType, 0, FieldName, 0}, ACPI_DMT_TERMINATOR} + +ACPI_DMTABLE_INFO AcpiDmTableInfoGeneric[][2] = +{ + ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UINT8, "UINT8"), + ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UINT16, "UINT16"), + ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UINT24, "UINT24"), + ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UINT32, "UINT32"), + ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UINT56, "UINT56"), + ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UINT64, "UINT64"), + ACPI_DM_GENERIC_ENTRY (ACPI_DMT_STRING, "String"), + ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UNICODE, "Unicode"), + ACPI_DM_GENERIC_ENTRY (ACPI_DMT_BUFFER, "Buffer"), + ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UUID, "GUID"), + ACPI_DM_GENERIC_ENTRY (ACPI_DMT_STRING, "DevicePath"), + ACPI_DM_GENERIC_ENTRY (ACPI_DMT_LABEL, "Label"), + {ACPI_DMT_TERMINATOR} +}; diff --git a/src/add-ons/kernel/bus_managers/acpi/common/getopt.c b/src/add-ons/kernel/bus_managers/acpi/common/getopt.c index 9a8589c995..aaca1ffe27 100644 --- a/src/add-ons/kernel/bus_managers/acpi/common/getopt.c +++ b/src/add-ons/kernel/bus_managers/acpi/common/getopt.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsargs.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsargs.c new file mode 100644 index 0000000000..44cc41b339 --- /dev/null +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsargs.c @@ -0,0 +1,502 @@ +/****************************************************************************** + * + * Module Name: dsargs - Support for execution of dynamic arguments for static + * objects (regions, fields, buffer fields, etc.) + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#define __DSARGS_C__ + +#include "acpi.h" +#include "accommon.h" +#include "acparser.h" +#include "amlcode.h" +#include "acdispat.h" +#include "acnamesp.h" + +#define _COMPONENT ACPI_DISPATCHER + ACPI_MODULE_NAME ("dsargs") + +/* Local prototypes */ + +static ACPI_STATUS +AcpiDsExecuteArguments ( + ACPI_NAMESPACE_NODE *Node, + ACPI_NAMESPACE_NODE *ScopeNode, + UINT32 AmlLength, + UINT8 *AmlStart); + + +/******************************************************************************* + * + * FUNCTION: AcpiDsExecuteArguments + * + * PARAMETERS: Node - Object NS node + * ScopeNode - Parent NS node + * AmlLength - Length of executable AML + * AmlStart - Pointer to the AML + * + * RETURN: Status. + * + * DESCRIPTION: Late (deferred) execution of region or field arguments + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDsExecuteArguments ( + ACPI_NAMESPACE_NODE *Node, + ACPI_NAMESPACE_NODE *ScopeNode, + UINT32 AmlLength, + UINT8 *AmlStart) +{ + ACPI_STATUS Status; + ACPI_PARSE_OBJECT *Op; + ACPI_WALK_STATE *WalkState; + + + ACPI_FUNCTION_TRACE (DsExecuteArguments); + + + /* Allocate a new parser op to be the root of the parsed tree */ + + Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP); + if (!Op) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + /* Save the Node for use in AcpiPsParseAml */ + + Op->Common.Node = ScopeNode; + + /* Create and initialize a new parser state */ + + WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); + if (!WalkState) + { + Status = AE_NO_MEMORY; + goto Cleanup; + } + + Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart, + AmlLength, NULL, ACPI_IMODE_LOAD_PASS1); + if (ACPI_FAILURE (Status)) + { + AcpiDsDeleteWalkState (WalkState); + goto Cleanup; + } + + /* Mark this parse as a deferred opcode */ + + WalkState->ParseFlags = ACPI_PARSE_DEFERRED_OP; + WalkState->DeferredNode = Node; + + /* Pass1: Parse the entire declaration */ + + Status = AcpiPsParseAml (WalkState); + if (ACPI_FAILURE (Status)) + { + goto Cleanup; + } + + /* Get and init the Op created above */ + + Op->Common.Node = Node; + AcpiPsDeleteParseTree (Op); + + /* Evaluate the deferred arguments */ + + Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP); + if (!Op) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + Op->Common.Node = ScopeNode; + + /* Create and initialize a new parser state */ + + WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); + if (!WalkState) + { + Status = AE_NO_MEMORY; + goto Cleanup; + } + + /* Execute the opcode and arguments */ + + Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart, + AmlLength, NULL, ACPI_IMODE_EXECUTE); + if (ACPI_FAILURE (Status)) + { + AcpiDsDeleteWalkState (WalkState); + goto Cleanup; + } + + /* Mark this execution as a deferred opcode */ + + WalkState->DeferredNode = Node; + Status = AcpiPsParseAml (WalkState); + +Cleanup: + AcpiPsDeleteParseTree (Op); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDsGetBufferFieldArguments + * + * PARAMETERS: ObjDesc - A valid BufferField object + * + * RETURN: Status. + * + * DESCRIPTION: Get BufferField Buffer and Index. This implements the late + * evaluation of these field attributes. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsGetBufferFieldArguments ( + ACPI_OPERAND_OBJECT *ObjDesc) +{ + ACPI_OPERAND_OBJECT *ExtraDesc; + ACPI_NAMESPACE_NODE *Node; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE_PTR (DsGetBufferFieldArguments, ObjDesc); + + + if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) + { + return_ACPI_STATUS (AE_OK); + } + + /* Get the AML pointer (method object) and BufferField node */ + + ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc); + Node = ObjDesc->BufferField.Node; + + ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_BUFFER_FIELD, + Node, NULL)); + + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BufferField Arg Init\n", + AcpiUtGetNodeName (Node))); + + /* Execute the AML code for the TermArg arguments */ + + Status = AcpiDsExecuteArguments (Node, Node->Parent, + ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDsGetBankFieldArguments + * + * PARAMETERS: ObjDesc - A valid BankField object + * + * RETURN: Status. + * + * DESCRIPTION: Get BankField BankValue. This implements the late + * evaluation of these field attributes. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsGetBankFieldArguments ( + ACPI_OPERAND_OBJECT *ObjDesc) +{ + ACPI_OPERAND_OBJECT *ExtraDesc; + ACPI_NAMESPACE_NODE *Node; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE_PTR (DsGetBankFieldArguments, ObjDesc); + + + if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) + { + return_ACPI_STATUS (AE_OK); + } + + /* Get the AML pointer (method object) and BankField node */ + + ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc); + Node = ObjDesc->BankField.Node; + + ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_LOCAL_BANK_FIELD, + Node, NULL)); + + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BankField Arg Init\n", + AcpiUtGetNodeName (Node))); + + /* Execute the AML code for the TermArg arguments */ + + Status = AcpiDsExecuteArguments (Node, Node->Parent, + ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDsGetBufferArguments + * + * PARAMETERS: ObjDesc - A valid Buffer object + * + * RETURN: Status. + * + * DESCRIPTION: Get Buffer length and initializer byte list. This implements + * the late evaluation of these attributes. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsGetBufferArguments ( + ACPI_OPERAND_OBJECT *ObjDesc) +{ + ACPI_NAMESPACE_NODE *Node; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE_PTR (DsGetBufferArguments, ObjDesc); + + + if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) + { + return_ACPI_STATUS (AE_OK); + } + + /* Get the Buffer node */ + + Node = ObjDesc->Buffer.Node; + if (!Node) + { + ACPI_ERROR ((AE_INFO, + "No pointer back to namespace node in buffer object %p", ObjDesc)); + return_ACPI_STATUS (AE_AML_INTERNAL); + } + + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Buffer Arg Init\n")); + + /* Execute the AML code for the TermArg arguments */ + + Status = AcpiDsExecuteArguments (Node, Node, + ObjDesc->Buffer.AmlLength, ObjDesc->Buffer.AmlStart); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDsGetPackageArguments + * + * PARAMETERS: ObjDesc - A valid Package object + * + * RETURN: Status. + * + * DESCRIPTION: Get Package length and initializer byte list. This implements + * the late evaluation of these attributes. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsGetPackageArguments ( + ACPI_OPERAND_OBJECT *ObjDesc) +{ + ACPI_NAMESPACE_NODE *Node; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE_PTR (DsGetPackageArguments, ObjDesc); + + + if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) + { + return_ACPI_STATUS (AE_OK); + } + + /* Get the Package node */ + + Node = ObjDesc->Package.Node; + if (!Node) + { + ACPI_ERROR ((AE_INFO, + "No pointer back to namespace node in package %p", ObjDesc)); + return_ACPI_STATUS (AE_AML_INTERNAL); + } + + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Package Arg Init\n")); + + /* Execute the AML code for the TermArg arguments */ + + Status = AcpiDsExecuteArguments (Node, Node, + ObjDesc->Package.AmlLength, ObjDesc->Package.AmlStart); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDsGetRegionArguments + * + * PARAMETERS: ObjDesc - A valid region object + * + * RETURN: Status. + * + * DESCRIPTION: Get region address and length. This implements the late + * evaluation of these region attributes. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsGetRegionArguments ( + ACPI_OPERAND_OBJECT *ObjDesc) +{ + ACPI_NAMESPACE_NODE *Node; + ACPI_STATUS Status; + ACPI_OPERAND_OBJECT *ExtraDesc; + + + ACPI_FUNCTION_TRACE_PTR (DsGetRegionArguments, ObjDesc); + + + if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID) + { + return_ACPI_STATUS (AE_OK); + } + + ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc); + if (!ExtraDesc) + { + return_ACPI_STATUS (AE_NOT_EXIST); + } + + /* Get the Region node */ + + Node = ObjDesc->Region.Node; + + ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_REGION, Node, NULL)); + + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] OpRegion Arg Init at AML %p\n", + AcpiUtGetNodeName (Node), ExtraDesc->Extra.AmlStart)); + + /* Execute the argument AML */ + + Status = AcpiDsExecuteArguments (Node, Node->Parent, + ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); + return_ACPI_STATUS (Status); +} diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dscontrol.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dscontrol.c new file mode 100644 index 0000000000..41435e072c --- /dev/null +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dscontrol.c @@ -0,0 +1,496 @@ +/****************************************************************************** + * + * Module Name: dscontrol - Support for execution control opcodes - + * if/else/while/return + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#define __DSCONTROL_C__ + +#include "acpi.h" +#include "accommon.h" +#include "amlcode.h" +#include "acdispat.h" +#include "acinterp.h" + +#define _COMPONENT ACPI_DISPATCHER + ACPI_MODULE_NAME ("dscontrol") + + +/******************************************************************************* + * + * FUNCTION: AcpiDsExecBeginControlOp + * + * PARAMETERS: WalkList - The list that owns the walk stack + * Op - The control Op + * + * RETURN: Status + * + * DESCRIPTION: Handles all control ops encountered during control method + * execution. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsExecBeginControlOp ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op) +{ + ACPI_STATUS Status = AE_OK; + ACPI_GENERIC_STATE *ControlState; + + + ACPI_FUNCTION_NAME (DsExecBeginControlOp); + + + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", + Op, Op->Common.AmlOpcode, WalkState)); + + switch (Op->Common.AmlOpcode) + { + case AML_WHILE_OP: + + /* + * If this is an additional iteration of a while loop, continue. + * There is no need to allocate a new control state. + */ + if (WalkState->ControlState) + { + if (WalkState->ControlState->Control.AmlPredicateStart == + (WalkState->ParserState.Aml - 1)) + { + /* Reset the state to start-of-loop */ + + WalkState->ControlState->Common.State = + ACPI_CONTROL_CONDITIONAL_EXECUTING; + break; + } + } + + /*lint -fallthrough */ + + case AML_IF_OP: + + /* + * IF/WHILE: Create a new control state to manage these + * constructs. We need to manage these as a stack, in order + * to handle nesting. + */ + ControlState = AcpiUtCreateControlState (); + if (!ControlState) + { + Status = AE_NO_MEMORY; + break; + } + /* + * Save a pointer to the predicate for multiple executions + * of a loop + */ + ControlState->Control.AmlPredicateStart = WalkState->ParserState.Aml - 1; + ControlState->Control.PackageEnd = WalkState->ParserState.PkgEnd; + ControlState->Control.Opcode = Op->Common.AmlOpcode; + + + /* Push the control state on this walk's control stack */ + + AcpiUtPushGenericState (&WalkState->ControlState, ControlState); + break; + + case AML_ELSE_OP: + + /* Predicate is in the state object */ + /* If predicate is true, the IF was executed, ignore ELSE part */ + + if (WalkState->LastPredicate) + { + Status = AE_CTRL_TRUE; + } + + break; + + case AML_RETURN_OP: + + break; + + default: + break; + } + + return (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDsExecEndControlOp + * + * PARAMETERS: WalkList - The list that owns the walk stack + * Op - The control Op + * + * RETURN: Status + * + * DESCRIPTION: Handles all control ops encountered during control method + * execution. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsExecEndControlOp ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op) +{ + ACPI_STATUS Status = AE_OK; + ACPI_GENERIC_STATE *ControlState; + + + ACPI_FUNCTION_NAME (DsExecEndControlOp); + + + switch (Op->Common.AmlOpcode) + { + case AML_IF_OP: + + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[IF_OP] Op=%p\n", Op)); + + /* + * Save the result of the predicate in case there is an + * ELSE to come + */ + WalkState->LastPredicate = + (BOOLEAN) WalkState->ControlState->Common.Value; + + /* + * Pop the control state that was created at the start + * of the IF and free it + */ + ControlState = AcpiUtPopGenericState (&WalkState->ControlState); + AcpiUtDeleteGenericState (ControlState); + break; + + + case AML_ELSE_OP: + + break; + + + case AML_WHILE_OP: + + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", Op)); + + ControlState = WalkState->ControlState; + if (ControlState->Common.Value) + { + /* Predicate was true, the body of the loop was just executed */ + + /* + * This loop counter mechanism allows the interpreter to escape + * possibly infinite loops. This can occur in poorly written AML + * when the hardware does not respond within a while loop and the + * loop does not implement a timeout. + */ + ControlState->Control.LoopCount++; + if (ControlState->Control.LoopCount > ACPI_MAX_LOOP_ITERATIONS) + { + Status = AE_AML_INFINITE_LOOP; + break; + } + + /* + * Go back and evaluate the predicate and maybe execute the loop + * another time + */ + Status = AE_CTRL_PENDING; + WalkState->AmlLastWhile = ControlState->Control.AmlPredicateStart; + break; + } + + /* Predicate was false, terminate this while loop */ + + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "[WHILE_OP] termination! Op=%p\n",Op)); + + /* Pop this control state and free it */ + + ControlState = AcpiUtPopGenericState (&WalkState->ControlState); + AcpiUtDeleteGenericState (ControlState); + break; + + + case AML_RETURN_OP: + + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "[RETURN_OP] Op=%p Arg=%p\n",Op, Op->Common.Value.Arg)); + + /* + * One optional operand -- the return value + * It can be either an immediate operand or a result that + * has been bubbled up the tree + */ + if (Op->Common.Value.Arg) + { + /* Since we have a real Return(), delete any implicit return */ + + AcpiDsClearImplicitReturn (WalkState); + + /* Return statement has an immediate operand */ + + Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* + * If value being returned is a Reference (such as + * an arg or local), resolve it now because it may + * cease to exist at the end of the method. + */ + Status = AcpiExResolveToValue (&WalkState->Operands [0], WalkState); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* + * Get the return value and save as the last result + * value. This is the only place where WalkState->ReturnDesc + * is set to anything other than zero! + */ + WalkState->ReturnDesc = WalkState->Operands[0]; + } + else if (WalkState->ResultCount) + { + /* Since we have a real Return(), delete any implicit return */ + + AcpiDsClearImplicitReturn (WalkState); + + /* + * The return value has come from a previous calculation. + * + * If value being returned is a Reference (such as + * an arg or local), resolve it now because it may + * cease to exist at the end of the method. + * + * Allow references created by the Index operator to return + * unchanged. + */ + if ((ACPI_GET_DESCRIPTOR_TYPE (WalkState->Results->Results.ObjDesc[0]) == ACPI_DESC_TYPE_OPERAND) && + ((WalkState->Results->Results.ObjDesc [0])->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) && + ((WalkState->Results->Results.ObjDesc [0])->Reference.Class != ACPI_REFCLASS_INDEX)) + { + Status = AcpiExResolveToValue (&WalkState->Results->Results.ObjDesc [0], WalkState); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + } + + WalkState->ReturnDesc = WalkState->Results->Results.ObjDesc [0]; + } + else + { + /* No return operand */ + + if (WalkState->NumOperands) + { + AcpiUtRemoveReference (WalkState->Operands [0]); + } + + WalkState->Operands [0] = NULL; + WalkState->NumOperands = 0; + WalkState->ReturnDesc = NULL; + } + + + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "Completed RETURN_OP State=%p, RetVal=%p\n", + WalkState, WalkState->ReturnDesc)); + + /* End the control method execution right now */ + + Status = AE_CTRL_TERMINATE; + break; + + + case AML_NOOP_OP: + + /* Just do nothing! */ + break; + + + case AML_BREAK_POINT_OP: + + /* + * Set the single-step flag. This will cause the debugger (if present) + * to break to the console within the AML debugger at the start of the + * next AML instruction. + */ + ACPI_DEBUGGER_EXEC ( + AcpiGbl_CmSingleStep = TRUE); + ACPI_DEBUGGER_EXEC ( + AcpiOsPrintf ("**break** Executed AML BreakPoint opcode\n")); + + /* Call to the OSL in case OS wants a piece of the action */ + + Status = AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT, + "Executed AML Breakpoint opcode"); + break; + + + case AML_BREAK_OP: + case AML_CONTINUE_OP: /* ACPI 2.0 */ + + + /* Pop and delete control states until we find a while */ + + while (WalkState->ControlState && + (WalkState->ControlState->Control.Opcode != AML_WHILE_OP)) + { + ControlState = AcpiUtPopGenericState (&WalkState->ControlState); + AcpiUtDeleteGenericState (ControlState); + } + + /* No while found? */ + + if (!WalkState->ControlState) + { + return (AE_AML_NO_WHILE); + } + + /* Was: WalkState->AmlLastWhile = WalkState->ControlState->Control.AmlPredicateStart; */ + + WalkState->AmlLastWhile = WalkState->ControlState->Control.PackageEnd; + + /* Return status depending on opcode */ + + if (Op->Common.AmlOpcode == AML_BREAK_OP) + { + Status = AE_CTRL_BREAK; + } + else + { + Status = AE_CTRL_CONTINUE; + } + break; + + + default: + + ACPI_ERROR ((AE_INFO, "Unknown control opcode=0x%X Op=%p", + Op->Common.AmlOpcode, Op)); + + Status = AE_AML_BAD_OPCODE; + break; + } + + return (Status); +} diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsfield.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsfield.c index 23e33782d5..39d2e885a0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsfield.c +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsfield.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsinit.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsinit.c index a75bf91dda..f9d1e2498b 100644 --- a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsinit.c +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsinit.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsmethod.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsmethod.c index 37d5f206e6..8f7d6bd15d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsmethod.c +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsmethod.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -117,7 +117,6 @@ #include "acpi.h" #include "accommon.h" -#include "amlcode.h" #include "acdispat.h" #include "acinterp.h" #include "acnamesp.h" @@ -291,7 +290,7 @@ AcpiDsBeginMethodExecution ( /* * If this method is serialized, we need to acquire the method mutex. */ - if (ObjDesc->Method.MethodFlags & AML_METHOD_SERIALIZED) + if (ObjDesc->Method.InfoFlags & ACPI_METHOD_SERIALIZED) { /* * Create a mutex for the method if it is defined to be Serialized @@ -517,9 +516,9 @@ AcpiDsCallControlMethod ( /* Invoke an internal method if necessary */ - if (ObjDesc->Method.MethodFlags & AML_METHOD_INTERNAL_ONLY) + if (ObjDesc->Method.InfoFlags & ACPI_METHOD_INTERNAL_ONLY) { - Status = ObjDesc->Method.Extra.Implementation (NextWalkState); + Status = ObjDesc->Method.Dispatch.Implementation (NextWalkState); if (Status == AE_OK) { Status = AE_CTRL_TERMINATE; @@ -694,11 +693,14 @@ AcpiDsTerminateControlMethod ( /* * Delete any namespace objects created anywhere within the - * namespace by the execution of this method. Unless this method - * is a module-level executable code method, in which case we - * want make the objects permanent. + * namespace by the execution of this method. Unless: + * 1) This method is a module-level executable code method, in which + * case we want make the objects permanent. + * 2) There are other threads executing the method, in which case we + * will wait until the last thread has completed. */ - if (!(MethodDesc->Method.Flags & AOPOBJ_MODULE_LEVEL)) + if (!(MethodDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL) && + (MethodDesc->Method.ThreadCount == 1)) { /* Delete any direct children of (created by) this method */ @@ -707,10 +709,14 @@ AcpiDsTerminateControlMethod ( /* * Delete any objects that were created by this method * elsewhere in the namespace (if any were created). + * Use of the ACPI_METHOD_MODIFIED_NAMESPACE optimizes the + * deletion such that we don't have to perform an entire + * namespace walk for every control method execution. */ - if (MethodDesc->Method.Flags & AOPOBJ_MODIFIED_NAMESPACE) + if (MethodDesc->Method.InfoFlags & ACPI_METHOD_MODIFIED_NAMESPACE) { AcpiNsDeleteNamespaceByOwner (MethodDesc->Method.OwnerId); + MethodDesc->Method.InfoFlags &= ~ACPI_METHOD_MODIFIED_NAMESPACE; } } } @@ -748,20 +754,39 @@ AcpiDsTerminateControlMethod ( * Serialized if it appears that the method is incorrectly written and * does not support multiple thread execution. The best example of this * is if such a method creates namespace objects and blocks. A second - * thread will fail with an AE_ALREADY_EXISTS exception + * thread will fail with an AE_ALREADY_EXISTS exception. * * This code is here because we must wait until the last thread exits - * before creating the synchronization semaphore. + * before marking the method as serialized. */ - if ((MethodDesc->Method.MethodFlags & AML_METHOD_SERIALIZED) && - (!MethodDesc->Method.Mutex)) + if (MethodDesc->Method.InfoFlags & ACPI_METHOD_SERIALIZED_PENDING) { - (void) AcpiDsCreateMethodMutex (MethodDesc); + if (WalkState) + { + ACPI_INFO ((AE_INFO, + "Marking method %4.4s as Serialized because of AE_ALREADY_EXISTS error", + WalkState->MethodNode->Name.Ascii)); + } + + /* + * Method tried to create an object twice and was marked as + * "pending serialized". The probable cause is that the method + * cannot handle reentrancy. + * + * The method was created as NotSerialized, but it tried to create + * a named object and then blocked, causing the second thread + * entrance to begin and then fail. Workaround this problem by + * marking the method permanently as Serialized when the last + * thread exits here. + */ + MethodDesc->Method.InfoFlags &= ~ACPI_METHOD_SERIALIZED_PENDING; + MethodDesc->Method.InfoFlags |= ACPI_METHOD_SERIALIZED; + MethodDesc->Method.SyncLevel = 0; } /* No more threads, we can free the OwnerId */ - if (!(MethodDesc->Method.Flags & AOPOBJ_MODULE_LEVEL)) + if (!(MethodDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL)) { AcpiUtReleaseOwnerId (&MethodDesc->Method.OwnerId); } diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsmthdat.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsmthdat.c index 3d17763cf1..a264b3aba1 100644 --- a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsmthdat.c +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsmthdat.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsobject.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsobject.c index 9963bd3b80..abf8672f2e 100644 --- a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsobject.c +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsobject.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsopcode.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsopcode.c index 9d0941d8d5..0f5164e96f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsopcode.c +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsopcode.c @@ -1,7 +1,6 @@ /****************************************************************************** * - * Module Name: dsopcode - Dispatcher Op Region support and handling of - * "control" opcodes + * Module Name: dsopcode - Dispatcher suport for regions and fields * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -131,13 +130,6 @@ /* Local prototypes */ -static ACPI_STATUS -AcpiDsExecuteArguments ( - ACPI_NAMESPACE_NODE *Node, - ACPI_NAMESPACE_NODE *ScopeNode, - UINT32 AmlLength, - UINT8 *AmlStart); - static ACPI_STATUS AcpiDsInitBufferField ( UINT16 AmlOpcode, @@ -148,369 +140,6 @@ AcpiDsInitBufferField ( ACPI_OPERAND_OBJECT *ResultDesc); -/******************************************************************************* - * - * FUNCTION: AcpiDsExecuteArguments - * - * PARAMETERS: Node - Object NS node - * ScopeNode - Parent NS node - * AmlLength - Length of executable AML - * AmlStart - Pointer to the AML - * - * RETURN: Status. - * - * DESCRIPTION: Late (deferred) execution of region or field arguments - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiDsExecuteArguments ( - ACPI_NAMESPACE_NODE *Node, - ACPI_NAMESPACE_NODE *ScopeNode, - UINT32 AmlLength, - UINT8 *AmlStart) -{ - ACPI_STATUS Status; - ACPI_PARSE_OBJECT *Op; - ACPI_WALK_STATE *WalkState; - - - ACPI_FUNCTION_TRACE (DsExecuteArguments); - - - /* - * Allocate a new parser op to be the root of the parsed tree - */ - Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP); - if (!Op) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Save the Node for use in AcpiPsParseAml */ - - Op->Common.Node = ScopeNode; - - /* Create and initialize a new parser state */ - - WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); - if (!WalkState) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart, - AmlLength, NULL, ACPI_IMODE_LOAD_PASS1); - if (ACPI_FAILURE (Status)) - { - AcpiDsDeleteWalkState (WalkState); - goto Cleanup; - } - - /* Mark this parse as a deferred opcode */ - - WalkState->ParseFlags = ACPI_PARSE_DEFERRED_OP; - WalkState->DeferredNode = Node; - - /* Pass1: Parse the entire declaration */ - - Status = AcpiPsParseAml (WalkState); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - /* Get and init the Op created above */ - - Op->Common.Node = Node; - AcpiPsDeleteParseTree (Op); - - /* Evaluate the deferred arguments */ - - Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP); - if (!Op) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - Op->Common.Node = ScopeNode; - - /* Create and initialize a new parser state */ - - WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); - if (!WalkState) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - /* Execute the opcode and arguments */ - - Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart, - AmlLength, NULL, ACPI_IMODE_EXECUTE); - if (ACPI_FAILURE (Status)) - { - AcpiDsDeleteWalkState (WalkState); - goto Cleanup; - } - - /* Mark this execution as a deferred opcode */ - - WalkState->DeferredNode = Node; - Status = AcpiPsParseAml (WalkState); - -Cleanup: - AcpiPsDeleteParseTree (Op); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsGetBufferFieldArguments - * - * PARAMETERS: ObjDesc - A valid BufferField object - * - * RETURN: Status. - * - * DESCRIPTION: Get BufferField Buffer and Index. This implements the late - * evaluation of these field attributes. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsGetBufferFieldArguments ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - ACPI_OPERAND_OBJECT *ExtraDesc; - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE_PTR (DsGetBufferFieldArguments, ObjDesc); - - - if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) - { - return_ACPI_STATUS (AE_OK); - } - - /* Get the AML pointer (method object) and BufferField node */ - - ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc); - Node = ObjDesc->BufferField.Node; - - ACPI_DEBUG_EXEC(AcpiUtDisplayInitPathname (ACPI_TYPE_BUFFER_FIELD, Node, NULL)); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BufferField Arg Init\n", - AcpiUtGetNodeName (Node))); - - /* Execute the AML code for the TermArg arguments */ - - Status = AcpiDsExecuteArguments (Node, Node->Parent, - ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsGetBankFieldArguments - * - * PARAMETERS: ObjDesc - A valid BankField object - * - * RETURN: Status. - * - * DESCRIPTION: Get BankField BankValue. This implements the late - * evaluation of these field attributes. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsGetBankFieldArguments ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - ACPI_OPERAND_OBJECT *ExtraDesc; - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE_PTR (DsGetBankFieldArguments, ObjDesc); - - - if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) - { - return_ACPI_STATUS (AE_OK); - } - - /* Get the AML pointer (method object) and BankField node */ - - ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc); - Node = ObjDesc->BankField.Node; - - ACPI_DEBUG_EXEC(AcpiUtDisplayInitPathname (ACPI_TYPE_LOCAL_BANK_FIELD, Node, NULL)); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BankField Arg Init\n", - AcpiUtGetNodeName (Node))); - - /* Execute the AML code for the TermArg arguments */ - - Status = AcpiDsExecuteArguments (Node, Node->Parent, - ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsGetBufferArguments - * - * PARAMETERS: ObjDesc - A valid Buffer object - * - * RETURN: Status. - * - * DESCRIPTION: Get Buffer length and initializer byte list. This implements - * the late evaluation of these attributes. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsGetBufferArguments ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE_PTR (DsGetBufferArguments, ObjDesc); - - - if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) - { - return_ACPI_STATUS (AE_OK); - } - - /* Get the Buffer node */ - - Node = ObjDesc->Buffer.Node; - if (!Node) - { - ACPI_ERROR ((AE_INFO, - "No pointer back to namespace node in buffer object %p", ObjDesc)); - return_ACPI_STATUS (AE_AML_INTERNAL); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Buffer Arg Init\n")); - - /* Execute the AML code for the TermArg arguments */ - - Status = AcpiDsExecuteArguments (Node, Node, - ObjDesc->Buffer.AmlLength, ObjDesc->Buffer.AmlStart); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsGetPackageArguments - * - * PARAMETERS: ObjDesc - A valid Package object - * - * RETURN: Status. - * - * DESCRIPTION: Get Package length and initializer byte list. This implements - * the late evaluation of these attributes. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsGetPackageArguments ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE_PTR (DsGetPackageArguments, ObjDesc); - - - if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) - { - return_ACPI_STATUS (AE_OK); - } - - /* Get the Package node */ - - Node = ObjDesc->Package.Node; - if (!Node) - { - ACPI_ERROR ((AE_INFO, - "No pointer back to namespace node in package %p", ObjDesc)); - return_ACPI_STATUS (AE_AML_INTERNAL); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Package Arg Init\n")); - - /* Execute the AML code for the TermArg arguments */ - - Status = AcpiDsExecuteArguments (Node, Node, - ObjDesc->Package.AmlLength, ObjDesc->Package.AmlStart); - return_ACPI_STATUS (Status); -} - - -/***************************************************************************** - * - * FUNCTION: AcpiDsGetRegionArguments - * - * PARAMETERS: ObjDesc - A valid region object - * - * RETURN: Status. - * - * DESCRIPTION: Get region address and length. This implements the late - * evaluation of these region attributes. - * - ****************************************************************************/ - -ACPI_STATUS -AcpiDsGetRegionArguments ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *ExtraDesc; - - - ACPI_FUNCTION_TRACE_PTR (DsGetRegionArguments, ObjDesc); - - - if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID) - { - return_ACPI_STATUS (AE_OK); - } - - ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc); - if (!ExtraDesc) - { - return_ACPI_STATUS (AE_NOT_EXIST); - } - - /* Get the Region node */ - - Node = ObjDesc->Region.Node; - - ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_REGION, Node, NULL)); - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] OpRegion Arg Init at AML %p\n", - AcpiUtGetNodeName (Node), ExtraDesc->Extra.AmlStart)); - - /* Execute the argument AML */ - - Status = AcpiDsExecuteArguments (Node, Node->Parent, - ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); - return_ACPI_STATUS (Status); -} - - /******************************************************************************* * * FUNCTION: AcpiDsInitializeRegion @@ -942,8 +571,9 @@ AcpiDsEvalRegionOperands ( * * RETURN: Status * - * DESCRIPTION: Get region address and length - * Called from AcpiDsExecEndOp during DataTableRegion parse tree walk + * DESCRIPTION: Get region address and length. + * Called from AcpiDsExecEndOp during DataTableRegion parse + * tree walk. * ******************************************************************************/ @@ -1249,371 +879,3 @@ AcpiDsEvalBankFieldOperands ( return_ACPI_STATUS (Status); } - -/******************************************************************************* - * - * FUNCTION: AcpiDsExecBeginControlOp - * - * PARAMETERS: WalkList - The list that owns the walk stack - * Op - The control Op - * - * RETURN: Status - * - * DESCRIPTION: Handles all control ops encountered during control method - * execution. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsExecBeginControlOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op) -{ - ACPI_STATUS Status = AE_OK; - ACPI_GENERIC_STATE *ControlState; - - - ACPI_FUNCTION_NAME (DsExecBeginControlOp); - - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", Op, - Op->Common.AmlOpcode, WalkState)); - - switch (Op->Common.AmlOpcode) - { - case AML_WHILE_OP: - - /* - * If this is an additional iteration of a while loop, continue. - * There is no need to allocate a new control state. - */ - if (WalkState->ControlState) - { - if (WalkState->ControlState->Control.AmlPredicateStart == - (WalkState->ParserState.Aml - 1)) - { - /* Reset the state to start-of-loop */ - - WalkState->ControlState->Common.State = ACPI_CONTROL_CONDITIONAL_EXECUTING; - break; - } - } - - /*lint -fallthrough */ - - case AML_IF_OP: - - /* - * IF/WHILE: Create a new control state to manage these - * constructs. We need to manage these as a stack, in order - * to handle nesting. - */ - ControlState = AcpiUtCreateControlState (); - if (!ControlState) - { - Status = AE_NO_MEMORY; - break; - } - /* - * Save a pointer to the predicate for multiple executions - * of a loop - */ - ControlState->Control.AmlPredicateStart = WalkState->ParserState.Aml - 1; - ControlState->Control.PackageEnd = WalkState->ParserState.PkgEnd; - ControlState->Control.Opcode = Op->Common.AmlOpcode; - - - /* Push the control state on this walk's control stack */ - - AcpiUtPushGenericState (&WalkState->ControlState, ControlState); - break; - - case AML_ELSE_OP: - - /* Predicate is in the state object */ - /* If predicate is true, the IF was executed, ignore ELSE part */ - - if (WalkState->LastPredicate) - { - Status = AE_CTRL_TRUE; - } - - break; - - case AML_RETURN_OP: - - break; - - default: - break; - } - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsExecEndControlOp - * - * PARAMETERS: WalkList - The list that owns the walk stack - * Op - The control Op - * - * RETURN: Status - * - * DESCRIPTION: Handles all control ops encountered during control method - * execution. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsExecEndControlOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op) -{ - ACPI_STATUS Status = AE_OK; - ACPI_GENERIC_STATE *ControlState; - - - ACPI_FUNCTION_NAME (DsExecEndControlOp); - - - switch (Op->Common.AmlOpcode) - { - case AML_IF_OP: - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[IF_OP] Op=%p\n", Op)); - - /* - * Save the result of the predicate in case there is an - * ELSE to come - */ - WalkState->LastPredicate = - (BOOLEAN) WalkState->ControlState->Common.Value; - - /* - * Pop the control state that was created at the start - * of the IF and free it - */ - ControlState = AcpiUtPopGenericState (&WalkState->ControlState); - AcpiUtDeleteGenericState (ControlState); - break; - - - case AML_ELSE_OP: - - break; - - - case AML_WHILE_OP: - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", Op)); - - ControlState = WalkState->ControlState; - if (ControlState->Common.Value) - { - /* Predicate was true, the body of the loop was just executed */ - - /* - * This loop counter mechanism allows the interpreter to escape - * possibly infinite loops. This can occur in poorly written AML - * when the hardware does not respond within a while loop and the - * loop does not implement a timeout. - */ - ControlState->Control.LoopCount++; - if (ControlState->Control.LoopCount > ACPI_MAX_LOOP_ITERATIONS) - { - Status = AE_AML_INFINITE_LOOP; - break; - } - - /* - * Go back and evaluate the predicate and maybe execute the loop - * another time - */ - Status = AE_CTRL_PENDING; - WalkState->AmlLastWhile = ControlState->Control.AmlPredicateStart; - break; - } - - /* Predicate was false, terminate this while loop */ - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "[WHILE_OP] termination! Op=%p\n",Op)); - - /* Pop this control state and free it */ - - ControlState = AcpiUtPopGenericState (&WalkState->ControlState); - AcpiUtDeleteGenericState (ControlState); - break; - - - case AML_RETURN_OP: - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "[RETURN_OP] Op=%p Arg=%p\n",Op, Op->Common.Value.Arg)); - - /* - * One optional operand -- the return value - * It can be either an immediate operand or a result that - * has been bubbled up the tree - */ - if (Op->Common.Value.Arg) - { - /* Since we have a real Return(), delete any implicit return */ - - AcpiDsClearImplicitReturn (WalkState); - - /* Return statement has an immediate operand */ - - Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* - * If value being returned is a Reference (such as - * an arg or local), resolve it now because it may - * cease to exist at the end of the method. - */ - Status = AcpiExResolveToValue (&WalkState->Operands [0], WalkState); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* - * Get the return value and save as the last result - * value. This is the only place where WalkState->ReturnDesc - * is set to anything other than zero! - */ - WalkState->ReturnDesc = WalkState->Operands[0]; - } - else if (WalkState->ResultCount) - { - /* Since we have a real Return(), delete any implicit return */ - - AcpiDsClearImplicitReturn (WalkState); - - /* - * The return value has come from a previous calculation. - * - * If value being returned is a Reference (such as - * an arg or local), resolve it now because it may - * cease to exist at the end of the method. - * - * Allow references created by the Index operator to return unchanged. - */ - if ((ACPI_GET_DESCRIPTOR_TYPE (WalkState->Results->Results.ObjDesc[0]) == ACPI_DESC_TYPE_OPERAND) && - ((WalkState->Results->Results.ObjDesc [0])->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) && - ((WalkState->Results->Results.ObjDesc [0])->Reference.Class != ACPI_REFCLASS_INDEX)) - { - Status = AcpiExResolveToValue (&WalkState->Results->Results.ObjDesc [0], WalkState); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - - WalkState->ReturnDesc = WalkState->Results->Results.ObjDesc [0]; - } - else - { - /* No return operand */ - - if (WalkState->NumOperands) - { - AcpiUtRemoveReference (WalkState->Operands [0]); - } - - WalkState->Operands [0] = NULL; - WalkState->NumOperands = 0; - WalkState->ReturnDesc = NULL; - } - - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Completed RETURN_OP State=%p, RetVal=%p\n", - WalkState, WalkState->ReturnDesc)); - - /* End the control method execution right now */ - - Status = AE_CTRL_TERMINATE; - break; - - - case AML_NOOP_OP: - - /* Just do nothing! */ - break; - - - case AML_BREAK_POINT_OP: - - /* - * Set the single-step flag. This will cause the debugger (if present) - * to break to the console within the AML debugger at the start of the - * next AML instruction. - */ - ACPI_DEBUGGER_EXEC ( - AcpiGbl_CmSingleStep = TRUE); - ACPI_DEBUGGER_EXEC ( - AcpiOsPrintf ("**break** Executed AML BreakPoint opcode\n")); - - /* Call to the OSL in case OS wants a piece of the action */ - - Status = AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT, - "Executed AML Breakpoint opcode"); - break; - - - case AML_BREAK_OP: - case AML_CONTINUE_OP: /* ACPI 2.0 */ - - - /* Pop and delete control states until we find a while */ - - while (WalkState->ControlState && - (WalkState->ControlState->Control.Opcode != AML_WHILE_OP)) - { - ControlState = AcpiUtPopGenericState (&WalkState->ControlState); - AcpiUtDeleteGenericState (ControlState); - } - - /* No while found? */ - - if (!WalkState->ControlState) - { - return (AE_AML_NO_WHILE); - } - - /* Was: WalkState->AmlLastWhile = WalkState->ControlState->Control.AmlPredicateStart; */ - - WalkState->AmlLastWhile = WalkState->ControlState->Control.PackageEnd; - - /* Return status depending on opcode */ - - if (Op->Common.AmlOpcode == AML_BREAK_OP) - { - Status = AE_CTRL_BREAK; - } - else - { - Status = AE_CTRL_CONTINUE; - } - break; - - - default: - - ACPI_ERROR ((AE_INFO, "Unknown control opcode=0x%X Op=%p", - Op->Common.AmlOpcode, Op)); - - Status = AE_AML_BAD_OPCODE; - break; - } - - return (Status); -} - diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsutils.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsutils.c index 7eb0637266..22bd0bf900 100644 --- a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsutils.c +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dsutils.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswexec.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswexec.c index 3c1f85e261..e243c7f769 100644 --- a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswexec.c +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswexec.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -400,10 +400,26 @@ AcpiDsExecBeginOp ( * we must enter this object into the namespace. The created * object is temporary and will be deleted upon completion of * the execution of this method. + * + * Note 10/2010: Except for the Scope() op. This opcode does + * not actually create a new object, it refers to an existing + * object. However, for Scope(), we want to indeed open a + * new scope. */ - Status = AcpiDsLoad2BeginOp (WalkState, NULL); + if (Op->Common.AmlOpcode != AML_SCOPE_OP) + { + Status = AcpiDsLoad2BeginOp (WalkState, NULL); + } + else + { + Status = AcpiDsScopeStackPush (Op->Named.Node, + Op->Named.Node->Type, WalkState); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } } - break; diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswload.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswload.c index 1a02f9f1c8..f30bbfc193 100644 --- a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswload.c +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswload.c @@ -1,6 +1,6 @@ /****************************************************************************** * - * Module Name: dswload - Dispatcher namespace load callbacks + * Module Name: dswload - Dispatcher first pass namespace load callbacks * *****************************************************************************/ @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -122,7 +122,6 @@ #include "acdispat.h" #include "acinterp.h" #include "acnamesp.h" -#include "acevents.h" #ifdef ACPI_ASL_COMPILER #include "acdisasm.h" @@ -539,7 +538,7 @@ AcpiDsLoad1EndOp ( else if (Op->Common.AmlOpcode == AML_DATA_REGION_OP) { Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length, - REGION_DATA_TABLE, WalkState); + ACPI_ADR_SPACE_DATA_TABLE, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -622,695 +621,3 @@ AcpiDsLoad1EndOp ( return_ACPI_STATUS (Status); } - - -/******************************************************************************* - * - * FUNCTION: AcpiDsLoad2BeginOp - * - * PARAMETERS: WalkState - Current state of the parse tree walk - * OutOp - Wher to return op if a new one is created - * - * RETURN: Status - * - * DESCRIPTION: Descending callback used during the loading of ACPI tables. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsLoad2BeginOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT **OutOp) -{ - ACPI_PARSE_OBJECT *Op; - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - ACPI_OBJECT_TYPE ObjectType; - char *BufferPtr; - UINT32 Flags; - - - ACPI_FUNCTION_TRACE (DsLoad2BeginOp); - - - Op = WalkState->Op; - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState)); - - if (Op) - { - if ((WalkState->ControlState) && - (WalkState->ControlState->Common.State == - ACPI_CONTROL_CONDITIONAL_EXECUTING)) - { - /* We are executing a while loop outside of a method */ - - Status = AcpiDsExecBeginOp (WalkState, OutOp); - return_ACPI_STATUS (Status); - } - - /* We only care about Namespace opcodes here */ - - if ((!(WalkState->OpInfo->Flags & AML_NSOPCODE) && - (WalkState->Opcode != AML_INT_NAMEPATH_OP)) || - (!(WalkState->OpInfo->Flags & AML_NAMED))) - { - return_ACPI_STATUS (AE_OK); - } - - /* Get the name we are going to enter or lookup in the namespace */ - - if (WalkState->Opcode == AML_INT_NAMEPATH_OP) - { - /* For Namepath op, get the path string */ - - BufferPtr = Op->Common.Value.String; - if (!BufferPtr) - { - /* No name, just exit */ - - return_ACPI_STATUS (AE_OK); - } - } - else - { - /* Get name from the op */ - - BufferPtr = ACPI_CAST_PTR (char, &Op->Named.Name); - } - } - else - { - /* Get the namestring from the raw AML */ - - BufferPtr = AcpiPsGetNextNamestring (&WalkState->ParserState); - } - - /* Map the opcode into an internal object type */ - - ObjectType = WalkState->OpInfo->ObjectType; - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "State=%p Op=%p Type=%X\n", WalkState, Op, ObjectType)); - - switch (WalkState->Opcode) - { - case AML_FIELD_OP: - case AML_BANK_FIELD_OP: - case AML_INDEX_FIELD_OP: - - Node = NULL; - Status = AE_OK; - break; - - case AML_INT_NAMEPATH_OP: - /* - * The NamePath is an object reference to an existing object. - * Don't enter the name into the namespace, but look it up - * for use later. - */ - Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, - ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, - WalkState, &(Node)); - break; - - case AML_SCOPE_OP: - - /* Special case for Scope(\) -> refers to the Root node */ - - if (Op && (Op->Named.Node == AcpiGbl_RootNode)) - { - Node = Op->Named.Node; - - Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - else - { - /* - * The Path is an object reference to an existing object. - * Don't enter the name into the namespace, but look it up - * for use later. - */ - Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, - ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, - WalkState, &(Node)); - if (ACPI_FAILURE (Status)) - { -#ifdef ACPI_ASL_COMPILER - if (Status == AE_NOT_FOUND) - { - Status = AE_OK; - } - else - { - ACPI_ERROR_NAMESPACE (BufferPtr, Status); - } -#else - ACPI_ERROR_NAMESPACE (BufferPtr, Status); -#endif - return_ACPI_STATUS (Status); - } - } - - /* - * We must check to make sure that the target is - * one of the opcodes that actually opens a scope - */ - switch (Node->Type) - { - case ACPI_TYPE_ANY: - case ACPI_TYPE_LOCAL_SCOPE: /* Scope */ - case ACPI_TYPE_DEVICE: - case ACPI_TYPE_POWER: - case ACPI_TYPE_PROCESSOR: - case ACPI_TYPE_THERMAL: - - /* These are acceptable types */ - break; - - case ACPI_TYPE_INTEGER: - case ACPI_TYPE_STRING: - case ACPI_TYPE_BUFFER: - - /* - * These types we will allow, but we will change the type. - * This enables some existing code of the form: - * - * Name (DEB, 0) - * Scope (DEB) { ... } - */ - ACPI_WARNING ((AE_INFO, - "Type override - [%4.4s] had invalid type (%s) " - "for Scope operator, changed to type ANY\n", - AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type))); - - Node->Type = ACPI_TYPE_ANY; - WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY; - break; - - default: - - /* All other types are an error */ - - ACPI_ERROR ((AE_INFO, - "Invalid type (%s) for target of " - "Scope operator [%4.4s] (Cannot override)", - AcpiUtGetTypeName (Node->Type), AcpiUtGetNodeName (Node))); - - return (AE_AML_OPERAND_TYPE); - } - break; - - default: - - /* All other opcodes */ - - if (Op && Op->Common.Node) - { - /* This op/node was previously entered into the namespace */ - - Node = Op->Common.Node; - - if (AcpiNsOpensScope (ObjectType)) - { - Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - return_ACPI_STATUS (AE_OK); - } - - /* - * Enter the named type into the internal namespace. We enter the name - * as we go downward in the parse tree. Any necessary subobjects that - * involve arguments to the opcode must be created as we go back up the - * parse tree later. - * - * Note: Name may already exist if we are executing a deferred opcode. - */ - if (WalkState->DeferredNode) - { - /* This name is already in the namespace, get the node */ - - Node = WalkState->DeferredNode; - Status = AE_OK; - break; - } - - Flags = ACPI_NS_NO_UPSEARCH; - if (WalkState->PassNumber == ACPI_IMODE_EXECUTE) - { - /* Execution mode, node cannot already exist, node is temporary */ - - Flags |= ACPI_NS_ERROR_IF_FOUND; - - if (!(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL)) - { - Flags |= ACPI_NS_TEMPORARY; - } - } - - /* Add new entry or lookup existing entry */ - - Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, - ACPI_IMODE_LOAD_PASS2, Flags, WalkState, &Node); - - if (ACPI_SUCCESS (Status) && (Flags & ACPI_NS_TEMPORARY)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "***New Node [%4.4s] %p is temporary\n", - AcpiUtGetNodeName (Node), Node)); - } - break; - } - - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR_NAMESPACE (BufferPtr, Status); - return_ACPI_STATUS (Status); - } - - if (!Op) - { - /* Create a new op */ - - Op = AcpiPsAllocOp (WalkState->Opcode); - if (!Op) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Initialize the new op */ - - if (Node) - { - Op->Named.Name = Node->Name.Integer; - } - *OutOp = Op; - } - - /* - * Put the Node in the "op" object that the parser uses, so we - * can get it again quickly when this scope is closed - */ - Op->Common.Node = Node; - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsLoad2EndOp - * - * PARAMETERS: WalkState - Current state of the parse tree walk - * - * RETURN: Status - * - * DESCRIPTION: Ascending callback used during the loading of the namespace, - * both control methods and everything else. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsLoad2EndOp ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_PARSE_OBJECT *Op; - ACPI_STATUS Status = AE_OK; - ACPI_OBJECT_TYPE ObjectType; - ACPI_NAMESPACE_NODE *Node; - ACPI_PARSE_OBJECT *Arg; - ACPI_NAMESPACE_NODE *NewNode; -#ifndef ACPI_NO_METHOD_EXECUTION - UINT32 i; - UINT8 RegionSpace; -#endif - - - ACPI_FUNCTION_TRACE (DsLoad2EndOp); - - Op = WalkState->Op; - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n", - WalkState->OpInfo->Name, Op, WalkState)); - - /* Check if opcode had an associated namespace object */ - - if (!(WalkState->OpInfo->Flags & AML_NSOBJECT)) - { - return_ACPI_STATUS (AE_OK); - } - - if (Op->Common.AmlOpcode == AML_SCOPE_OP) - { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Ending scope Op=%p State=%p\n", Op, WalkState)); - } - - ObjectType = WalkState->OpInfo->ObjectType; - - /* - * Get the Node/name from the earlier lookup - * (It was saved in the *op structure) - */ - Node = Op->Common.Node; - - /* - * Put the Node on the object stack (Contains the ACPI Name of - * this object) - */ - WalkState->Operands[0] = (void *) Node; - WalkState->NumOperands = 1; - - /* Pop the scope stack */ - - if (AcpiNsOpensScope (ObjectType) && - (Op->Common.AmlOpcode != AML_INT_METHODCALL_OP)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", - AcpiUtGetTypeName (ObjectType), Op)); - - Status = AcpiDsScopeStackPop (WalkState); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - } - - /* - * Named operations are as follows: - * - * AML_ALIAS - * AML_BANKFIELD - * AML_CREATEBITFIELD - * AML_CREATEBYTEFIELD - * AML_CREATEDWORDFIELD - * AML_CREATEFIELD - * AML_CREATEQWORDFIELD - * AML_CREATEWORDFIELD - * AML_DATA_REGION - * AML_DEVICE - * AML_EVENT - * AML_FIELD - * AML_INDEXFIELD - * AML_METHOD - * AML_METHODCALL - * AML_MUTEX - * AML_NAME - * AML_NAMEDFIELD - * AML_OPREGION - * AML_POWERRES - * AML_PROCESSOR - * AML_SCOPE - * AML_THERMALZONE - */ - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Create-Load [%s] State=%p Op=%p NamedObj=%p\n", - AcpiPsGetOpcodeName (Op->Common.AmlOpcode), WalkState, Op, Node)); - - /* Decode the opcode */ - - Arg = Op->Common.Value.Arg; - - switch (WalkState->OpInfo->Type) - { -#ifndef ACPI_NO_METHOD_EXECUTION - - case AML_TYPE_CREATE_FIELD: - /* - * Create the field object, but the field buffer and index must - * be evaluated later during the execution phase - */ - Status = AcpiDsCreateBufferField (Op, WalkState); - break; - - - case AML_TYPE_NAMED_FIELD: - /* - * If we are executing a method, initialize the field - */ - if (WalkState->MethodNode) - { - Status = AcpiDsInitFieldObjects (Op, WalkState); - } - - switch (Op->Common.AmlOpcode) - { - case AML_INDEX_FIELD_OP: - - Status = AcpiDsCreateIndexField (Op, (ACPI_HANDLE) Arg->Common.Node, - WalkState); - break; - - case AML_BANK_FIELD_OP: - - Status = AcpiDsCreateBankField (Op, Arg->Common.Node, WalkState); - break; - - case AML_FIELD_OP: - - Status = AcpiDsCreateField (Op, Arg->Common.Node, WalkState); - break; - - default: - /* All NAMED_FIELD opcodes must be handled above */ - break; - } - break; - - - case AML_TYPE_NAMED_SIMPLE: - - Status = AcpiDsCreateOperands (WalkState, Arg); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - switch (Op->Common.AmlOpcode) - { - case AML_PROCESSOR_OP: - - Status = AcpiExCreateProcessor (WalkState); - break; - - case AML_POWER_RES_OP: - - Status = AcpiExCreatePowerResource (WalkState); - break; - - case AML_MUTEX_OP: - - Status = AcpiExCreateMutex (WalkState); - break; - - case AML_EVENT_OP: - - Status = AcpiExCreateEvent (WalkState); - break; - - - case AML_ALIAS_OP: - - Status = AcpiExCreateAlias (WalkState); - break; - - default: - /* Unknown opcode */ - - Status = AE_OK; - goto Cleanup; - } - - /* Delete operands */ - - for (i = 1; i < WalkState->NumOperands; i++) - { - AcpiUtRemoveReference (WalkState->Operands[i]); - WalkState->Operands[i] = NULL; - } - - break; -#endif /* ACPI_NO_METHOD_EXECUTION */ - - case AML_TYPE_NAMED_COMPLEX: - - switch (Op->Common.AmlOpcode) - { -#ifndef ACPI_NO_METHOD_EXECUTION - case AML_REGION_OP: - case AML_DATA_REGION_OP: - - if (Op->Common.AmlOpcode == AML_REGION_OP) - { - RegionSpace = (ACPI_ADR_SPACE_TYPE) - ((Op->Common.Value.Arg)->Common.Value.Integer); - } - else - { - RegionSpace = REGION_DATA_TABLE; - } - - /* - * The OpRegion is not fully parsed at this time. The only valid - * argument is the SpaceId. (We must save the address of the - * AML of the address and length operands) - * - * If we have a valid region, initialize it. The namespace is - * unlocked at this point. - * - * Need to unlock interpreter if it is locked (if we are running - * a control method), in order to allow _REG methods to be run - * during AcpiEvInitializeRegion. - */ - if (WalkState->MethodNode) - { - /* - * Executing a method: initialize the region and unlock - * the interpreter - */ - Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length, - RegionSpace, WalkState); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - AcpiExExitInterpreter (); - } - - Status = AcpiEvInitializeRegion (AcpiNsGetAttachedObject (Node), - FALSE); - if (WalkState->MethodNode) - { - AcpiExEnterInterpreter (); - } - - if (ACPI_FAILURE (Status)) - { - /* - * If AE_NOT_EXIST is returned, it is not fatal - * because many regions get created before a handler - * is installed for said region. - */ - if (AE_NOT_EXIST == Status) - { - Status = AE_OK; - } - } - break; - - - case AML_NAME_OP: - - Status = AcpiDsCreateNode (WalkState, Node, Op); - break; - - - case AML_METHOD_OP: - /* - * MethodOp PkgLength NameString MethodFlags TermList - * - * Note: We must create the method node/object pair as soon as we - * see the method declaration. This allows later pass1 parsing - * of invocations of the method (need to know the number of - * arguments.) - */ - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "LOADING-Method: State=%p Op=%p NamedObj=%p\n", - WalkState, Op, Op->Named.Node)); - - if (!AcpiNsGetAttachedObject (Op->Named.Node)) - { - WalkState->Operands[0] = ACPI_CAST_PTR (void, Op->Named.Node); - WalkState->NumOperands = 1; - - Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg); - if (ACPI_SUCCESS (Status)) - { - Status = AcpiExCreateMethod (Op->Named.Data, - Op->Named.Length, WalkState); - } - WalkState->Operands[0] = NULL; - WalkState->NumOperands = 0; - - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - break; - -#endif /* ACPI_NO_METHOD_EXECUTION */ - - default: - /* All NAMED_COMPLEX opcodes must be handled above */ - break; - } - break; - - - case AML_CLASS_INTERNAL: - - /* case AML_INT_NAMEPATH_OP: */ - break; - - - case AML_CLASS_METHOD_CALL: - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n", - WalkState, Op, Node)); - - /* - * Lookup the method name and save the Node - */ - Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, - ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2, - ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, - WalkState, &(NewNode)); - if (ACPI_SUCCESS (Status)) - { - /* - * Make sure that what we found is indeed a method - * We didn't search for a method on purpose, to see if the name - * would resolve - */ - if (NewNode->Type != ACPI_TYPE_METHOD) - { - Status = AE_AML_OPERAND_TYPE; - } - - /* We could put the returned object (Node) on the object stack for - * later, but for now, we will put it in the "op" object that the - * parser uses, so we can get it again at the end of this scope - */ - Op->Common.Node = NewNode; - } - else - { - ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); - } - break; - - - default: - break; - } - -Cleanup: - - /* Remove the Node pushed at the very beginning */ - - WalkState->Operands[0] = NULL; - WalkState->NumOperands = 0; - return_ACPI_STATUS (Status); -} - - diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswload2.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswload2.c new file mode 100644 index 0000000000..8eba533977 --- /dev/null +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswload2.c @@ -0,0 +1,819 @@ +/****************************************************************************** + * + * Module Name: dswload2 - Dispatcher second pass namespace load callbacks + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#define __DSWLOAD2_C__ + +#include "acpi.h" +#include "accommon.h" +#include "acparser.h" +#include "amlcode.h" +#include "acdispat.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "acevents.h" + +#define _COMPONENT ACPI_DISPATCHER + ACPI_MODULE_NAME ("dswload2") + + +/******************************************************************************* + * + * FUNCTION: AcpiDsLoad2BeginOp + * + * PARAMETERS: WalkState - Current state of the parse tree walk + * OutOp - Wher to return op if a new one is created + * + * RETURN: Status + * + * DESCRIPTION: Descending callback used during the loading of ACPI tables. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsLoad2BeginOp ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT **OutOp) +{ + ACPI_PARSE_OBJECT *Op; + ACPI_NAMESPACE_NODE *Node; + ACPI_STATUS Status; + ACPI_OBJECT_TYPE ObjectType; + char *BufferPtr; + UINT32 Flags; + + + ACPI_FUNCTION_TRACE (DsLoad2BeginOp); + + + Op = WalkState->Op; + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState)); + + if (Op) + { + if ((WalkState->ControlState) && + (WalkState->ControlState->Common.State == + ACPI_CONTROL_CONDITIONAL_EXECUTING)) + { + /* We are executing a while loop outside of a method */ + + Status = AcpiDsExecBeginOp (WalkState, OutOp); + return_ACPI_STATUS (Status); + } + + /* We only care about Namespace opcodes here */ + + if ((!(WalkState->OpInfo->Flags & AML_NSOPCODE) && + (WalkState->Opcode != AML_INT_NAMEPATH_OP)) || + (!(WalkState->OpInfo->Flags & AML_NAMED))) + { + return_ACPI_STATUS (AE_OK); + } + + /* Get the name we are going to enter or lookup in the namespace */ + + if (WalkState->Opcode == AML_INT_NAMEPATH_OP) + { + /* For Namepath op, get the path string */ + + BufferPtr = Op->Common.Value.String; + if (!BufferPtr) + { + /* No name, just exit */ + + return_ACPI_STATUS (AE_OK); + } + } + else + { + /* Get name from the op */ + + BufferPtr = ACPI_CAST_PTR (char, &Op->Named.Name); + } + } + else + { + /* Get the namestring from the raw AML */ + + BufferPtr = AcpiPsGetNextNamestring (&WalkState->ParserState); + } + + /* Map the opcode into an internal object type */ + + ObjectType = WalkState->OpInfo->ObjectType; + + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "State=%p Op=%p Type=%X\n", WalkState, Op, ObjectType)); + + switch (WalkState->Opcode) + { + case AML_FIELD_OP: + case AML_BANK_FIELD_OP: + case AML_INDEX_FIELD_OP: + + Node = NULL; + Status = AE_OK; + break; + + case AML_INT_NAMEPATH_OP: + /* + * The NamePath is an object reference to an existing object. + * Don't enter the name into the namespace, but look it up + * for use later. + */ + Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, + ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, + WalkState, &(Node)); + break; + + case AML_SCOPE_OP: + + /* Special case for Scope(\) -> refers to the Root node */ + + if (Op && (Op->Named.Node == AcpiGbl_RootNode)) + { + Node = Op->Named.Node; + + Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } + else + { + /* + * The Path is an object reference to an existing object. + * Don't enter the name into the namespace, but look it up + * for use later. + */ + Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, + ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, + WalkState, &(Node)); + if (ACPI_FAILURE (Status)) + { +#ifdef ACPI_ASL_COMPILER + if (Status == AE_NOT_FOUND) + { + Status = AE_OK; + } + else + { + ACPI_ERROR_NAMESPACE (BufferPtr, Status); + } +#else + ACPI_ERROR_NAMESPACE (BufferPtr, Status); +#endif + return_ACPI_STATUS (Status); + } + } + + /* + * We must check to make sure that the target is + * one of the opcodes that actually opens a scope + */ + switch (Node->Type) + { + case ACPI_TYPE_ANY: + case ACPI_TYPE_LOCAL_SCOPE: /* Scope */ + case ACPI_TYPE_DEVICE: + case ACPI_TYPE_POWER: + case ACPI_TYPE_PROCESSOR: + case ACPI_TYPE_THERMAL: + + /* These are acceptable types */ + break; + + case ACPI_TYPE_INTEGER: + case ACPI_TYPE_STRING: + case ACPI_TYPE_BUFFER: + + /* + * These types we will allow, but we will change the type. + * This enables some existing code of the form: + * + * Name (DEB, 0) + * Scope (DEB) { ... } + */ + ACPI_WARNING ((AE_INFO, + "Type override - [%4.4s] had invalid type (%s) " + "for Scope operator, changed to type ANY\n", + AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type))); + + Node->Type = ACPI_TYPE_ANY; + WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY; + break; + + default: + + /* All other types are an error */ + + ACPI_ERROR ((AE_INFO, + "Invalid type (%s) for target of " + "Scope operator [%4.4s] (Cannot override)", + AcpiUtGetTypeName (Node->Type), AcpiUtGetNodeName (Node))); + + return (AE_AML_OPERAND_TYPE); + } + break; + + default: + + /* All other opcodes */ + + if (Op && Op->Common.Node) + { + /* This op/node was previously entered into the namespace */ + + Node = Op->Common.Node; + + if (AcpiNsOpensScope (ObjectType)) + { + Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } + + return_ACPI_STATUS (AE_OK); + } + + /* + * Enter the named type into the internal namespace. We enter the name + * as we go downward in the parse tree. Any necessary subobjects that + * involve arguments to the opcode must be created as we go back up the + * parse tree later. + * + * Note: Name may already exist if we are executing a deferred opcode. + */ + if (WalkState->DeferredNode) + { + /* This name is already in the namespace, get the node */ + + Node = WalkState->DeferredNode; + Status = AE_OK; + break; + } + + Flags = ACPI_NS_NO_UPSEARCH; + if (WalkState->PassNumber == ACPI_IMODE_EXECUTE) + { + /* Execution mode, node cannot already exist, node is temporary */ + + Flags |= ACPI_NS_ERROR_IF_FOUND; + + if (!(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL)) + { + Flags |= ACPI_NS_TEMPORARY; + } + } + + /* Add new entry or lookup existing entry */ + + Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, + ACPI_IMODE_LOAD_PASS2, Flags, WalkState, &Node); + + if (ACPI_SUCCESS (Status) && (Flags & ACPI_NS_TEMPORARY)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "***New Node [%4.4s] %p is temporary\n", + AcpiUtGetNodeName (Node), Node)); + } + break; + } + + if (ACPI_FAILURE (Status)) + { + ACPI_ERROR_NAMESPACE (BufferPtr, Status); + return_ACPI_STATUS (Status); + } + + if (!Op) + { + /* Create a new op */ + + Op = AcpiPsAllocOp (WalkState->Opcode); + if (!Op) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + /* Initialize the new op */ + + if (Node) + { + Op->Named.Name = Node->Name.Integer; + } + *OutOp = Op; + } + + /* + * Put the Node in the "op" object that the parser uses, so we + * can get it again quickly when this scope is closed + */ + Op->Common.Node = Node; + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDsLoad2EndOp + * + * PARAMETERS: WalkState - Current state of the parse tree walk + * + * RETURN: Status + * + * DESCRIPTION: Ascending callback used during the loading of the namespace, + * both control methods and everything else. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsLoad2EndOp ( + ACPI_WALK_STATE *WalkState) +{ + ACPI_PARSE_OBJECT *Op; + ACPI_STATUS Status = AE_OK; + ACPI_OBJECT_TYPE ObjectType; + ACPI_NAMESPACE_NODE *Node; + ACPI_PARSE_OBJECT *Arg; + ACPI_NAMESPACE_NODE *NewNode; +#ifndef ACPI_NO_METHOD_EXECUTION + UINT32 i; + UINT8 RegionSpace; +#endif + + + ACPI_FUNCTION_TRACE (DsLoad2EndOp); + + Op = WalkState->Op; + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n", + WalkState->OpInfo->Name, Op, WalkState)); + + /* Check if opcode had an associated namespace object */ + + if (!(WalkState->OpInfo->Flags & AML_NSOBJECT)) + { + return_ACPI_STATUS (AE_OK); + } + + if (Op->Common.AmlOpcode == AML_SCOPE_OP) + { + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "Ending scope Op=%p State=%p\n", Op, WalkState)); + } + + ObjectType = WalkState->OpInfo->ObjectType; + + /* + * Get the Node/name from the earlier lookup + * (It was saved in the *op structure) + */ + Node = Op->Common.Node; + + /* + * Put the Node on the object stack (Contains the ACPI Name of + * this object) + */ + WalkState->Operands[0] = (void *) Node; + WalkState->NumOperands = 1; + + /* Pop the scope stack */ + + if (AcpiNsOpensScope (ObjectType) && + (Op->Common.AmlOpcode != AML_INT_METHODCALL_OP)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", + AcpiUtGetTypeName (ObjectType), Op)); + + Status = AcpiDsScopeStackPop (WalkState); + if (ACPI_FAILURE (Status)) + { + goto Cleanup; + } + } + + /* + * Named operations are as follows: + * + * AML_ALIAS + * AML_BANKFIELD + * AML_CREATEBITFIELD + * AML_CREATEBYTEFIELD + * AML_CREATEDWORDFIELD + * AML_CREATEFIELD + * AML_CREATEQWORDFIELD + * AML_CREATEWORDFIELD + * AML_DATA_REGION + * AML_DEVICE + * AML_EVENT + * AML_FIELD + * AML_INDEXFIELD + * AML_METHOD + * AML_METHODCALL + * AML_MUTEX + * AML_NAME + * AML_NAMEDFIELD + * AML_OPREGION + * AML_POWERRES + * AML_PROCESSOR + * AML_SCOPE + * AML_THERMALZONE + */ + + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "Create-Load [%s] State=%p Op=%p NamedObj=%p\n", + AcpiPsGetOpcodeName (Op->Common.AmlOpcode), WalkState, Op, Node)); + + /* Decode the opcode */ + + Arg = Op->Common.Value.Arg; + + switch (WalkState->OpInfo->Type) + { +#ifndef ACPI_NO_METHOD_EXECUTION + + case AML_TYPE_CREATE_FIELD: + /* + * Create the field object, but the field buffer and index must + * be evaluated later during the execution phase + */ + Status = AcpiDsCreateBufferField (Op, WalkState); + break; + + + case AML_TYPE_NAMED_FIELD: + /* + * If we are executing a method, initialize the field + */ + if (WalkState->MethodNode) + { + Status = AcpiDsInitFieldObjects (Op, WalkState); + } + + switch (Op->Common.AmlOpcode) + { + case AML_INDEX_FIELD_OP: + + Status = AcpiDsCreateIndexField (Op, (ACPI_HANDLE) Arg->Common.Node, + WalkState); + break; + + case AML_BANK_FIELD_OP: + + Status = AcpiDsCreateBankField (Op, Arg->Common.Node, WalkState); + break; + + case AML_FIELD_OP: + + Status = AcpiDsCreateField (Op, Arg->Common.Node, WalkState); + break; + + default: + /* All NAMED_FIELD opcodes must be handled above */ + break; + } + break; + + + case AML_TYPE_NAMED_SIMPLE: + + Status = AcpiDsCreateOperands (WalkState, Arg); + if (ACPI_FAILURE (Status)) + { + goto Cleanup; + } + + switch (Op->Common.AmlOpcode) + { + case AML_PROCESSOR_OP: + + Status = AcpiExCreateProcessor (WalkState); + break; + + case AML_POWER_RES_OP: + + Status = AcpiExCreatePowerResource (WalkState); + break; + + case AML_MUTEX_OP: + + Status = AcpiExCreateMutex (WalkState); + break; + + case AML_EVENT_OP: + + Status = AcpiExCreateEvent (WalkState); + break; + + + case AML_ALIAS_OP: + + Status = AcpiExCreateAlias (WalkState); + break; + + default: + /* Unknown opcode */ + + Status = AE_OK; + goto Cleanup; + } + + /* Delete operands */ + + for (i = 1; i < WalkState->NumOperands; i++) + { + AcpiUtRemoveReference (WalkState->Operands[i]); + WalkState->Operands[i] = NULL; + } + + break; +#endif /* ACPI_NO_METHOD_EXECUTION */ + + case AML_TYPE_NAMED_COMPLEX: + + switch (Op->Common.AmlOpcode) + { +#ifndef ACPI_NO_METHOD_EXECUTION + case AML_REGION_OP: + case AML_DATA_REGION_OP: + + if (Op->Common.AmlOpcode == AML_REGION_OP) + { + RegionSpace = (ACPI_ADR_SPACE_TYPE) + ((Op->Common.Value.Arg)->Common.Value.Integer); + } + else + { + RegionSpace = ACPI_ADR_SPACE_DATA_TABLE; + } + + /* + * The OpRegion is not fully parsed at this time. The only valid + * argument is the SpaceId. (We must save the address of the + * AML of the address and length operands) + * + * If we have a valid region, initialize it. The namespace is + * unlocked at this point. + * + * Need to unlock interpreter if it is locked (if we are running + * a control method), in order to allow _REG methods to be run + * during AcpiEvInitializeRegion. + */ + if (WalkState->MethodNode) + { + /* + * Executing a method: initialize the region and unlock + * the interpreter + */ + Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length, + RegionSpace, WalkState); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + AcpiExExitInterpreter (); + } + + Status = AcpiEvInitializeRegion (AcpiNsGetAttachedObject (Node), + FALSE); + if (WalkState->MethodNode) + { + AcpiExEnterInterpreter (); + } + + if (ACPI_FAILURE (Status)) + { + /* + * If AE_NOT_EXIST is returned, it is not fatal + * because many regions get created before a handler + * is installed for said region. + */ + if (AE_NOT_EXIST == Status) + { + Status = AE_OK; + } + } + break; + + + case AML_NAME_OP: + + Status = AcpiDsCreateNode (WalkState, Node, Op); + break; + + + case AML_METHOD_OP: + /* + * MethodOp PkgLength NameString MethodFlags TermList + * + * Note: We must create the method node/object pair as soon as we + * see the method declaration. This allows later pass1 parsing + * of invocations of the method (need to know the number of + * arguments.) + */ + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "LOADING-Method: State=%p Op=%p NamedObj=%p\n", + WalkState, Op, Op->Named.Node)); + + if (!AcpiNsGetAttachedObject (Op->Named.Node)) + { + WalkState->Operands[0] = ACPI_CAST_PTR (void, Op->Named.Node); + WalkState->NumOperands = 1; + + Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg); + if (ACPI_SUCCESS (Status)) + { + Status = AcpiExCreateMethod (Op->Named.Data, + Op->Named.Length, WalkState); + } + WalkState->Operands[0] = NULL; + WalkState->NumOperands = 0; + + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } + break; + +#endif /* ACPI_NO_METHOD_EXECUTION */ + + default: + /* All NAMED_COMPLEX opcodes must be handled above */ + break; + } + break; + + + case AML_CLASS_INTERNAL: + + /* case AML_INT_NAMEPATH_OP: */ + break; + + + case AML_CLASS_METHOD_CALL: + + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n", + WalkState, Op, Node)); + + /* + * Lookup the method name and save the Node + */ + Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, + ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2, + ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, + WalkState, &(NewNode)); + if (ACPI_SUCCESS (Status)) + { + /* + * Make sure that what we found is indeed a method + * We didn't search for a method on purpose, to see if the name + * would resolve + */ + if (NewNode->Type != ACPI_TYPE_METHOD) + { + Status = AE_AML_OPERAND_TYPE; + } + + /* We could put the returned object (Node) on the object stack for + * later, but for now, we will put it in the "op" object that the + * parser uses, so we can get it again at the end of this scope + */ + Op->Common.Node = NewNode; + } + else + { + ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); + } + break; + + + default: + break; + } + +Cleanup: + + /* Remove the Node pushed at the very beginning */ + + WalkState->Operands[0] = NULL; + WalkState->NumOperands = 0; + return_ACPI_STATUS (Status); +} + diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswscope.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswscope.c index 5ab611ec67..b95c42746c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswscope.c +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswscope.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswstate.c b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswstate.c index 91f019f6d1..07ed6d4d71 100644 --- a/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswstate.c +++ b/src/add-ons/kernel/bus_managers/acpi/dispatcher/dswstate.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evevent.c b/src/add-ons/kernel/bus_managers/acpi/events/evevent.c index d9715a8232..a85588f105 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evevent.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evevent.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -178,54 +178,6 @@ AcpiEvInitializeEvents ( } -/******************************************************************************* - * - * FUNCTION: AcpiEvInstallFadtGpes - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Completes initialization of the FADT-defined GPE blocks - * (0 and 1). This causes the _PRW methods to be run, so the HW - * must be fully initialized at this point, including global lock - * support. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvInstallFadtGpes ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (EvInstallFadtGpes); - - - /* Namespace must be locked */ - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* FADT GPE Block 0 */ - - (void) AcpiEvInitializeGpeBlock ( - AcpiGbl_FadtGpeDevice, AcpiGbl_GpeFadtBlocks[0]); - - /* FADT GPE Block 1 */ - - (void) AcpiEvInitializeGpeBlock ( - AcpiGbl_FadtGpeDevice, AcpiGbl_GpeFadtBlocks[1]); - - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (AE_OK); -} - - /******************************************************************************* * * FUNCTION: AcpiEvInstallXruptHandlers @@ -366,9 +318,17 @@ AcpiEvFixedEventDetect ( if ((FixedStatus & AcpiGbl_FixedEventInfo[i].StatusBitMask) && (FixedEnable & AcpiGbl_FixedEventInfo[i].EnableBitMask)) { - /* Found an active (signalled) event */ - + /* + * Found an active (signalled) event. Invoke global event + * handler if present. + */ AcpiFixedEventCount[i]++; + if (AcpiGbl_GlobalEventHandler) + { + AcpiGbl_GlobalEventHandler (ACPI_EVENT_TYPE_FIXED, NULL, + i, AcpiGbl_GlobalEventHandlerContext); + } + IntStatus |= AcpiEvFixedEventDispatch (i); } } diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evglock.c b/src/add-ons/kernel/bus_managers/acpi/events/evglock.c new file mode 100644 index 0000000000..a7a585a0eb --- /dev/null +++ b/src/add-ons/kernel/bus_managers/acpi/events/evglock.c @@ -0,0 +1,439 @@ +/****************************************************************************** + * + * Module Name: evglock - Global Lock support + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#include "acpi.h" +#include "accommon.h" +#include "acevents.h" +#include "acinterp.h" + +#define _COMPONENT ACPI_EVENTS + ACPI_MODULE_NAME ("evglock") + + +/* Local prototypes */ + +static UINT32 +AcpiEvGlobalLockHandler ( + void *Context); + + +/******************************************************************************* + * + * FUNCTION: AcpiEvInitGlobalLockHandler + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Install a handler for the global lock release event + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEvInitGlobalLockHandler ( + void) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (EvInitGlobalLockHandler); + + + /* Attempt installation of the global lock handler */ + + Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL, + AcpiEvGlobalLockHandler, NULL); + + /* + * If the global lock does not exist on this platform, the attempt to + * enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick). + * Map to AE_OK, but mark global lock as not present. Any attempt to + * actually use the global lock will be flagged with an error. + */ + AcpiGbl_GlobalLockPresent = FALSE; + if (Status == AE_NO_HARDWARE_RESPONSE) + { + ACPI_ERROR ((AE_INFO, + "No response from Global Lock hardware, disabling lock")); + + return_ACPI_STATUS (AE_OK); + } + + Status = AcpiOsCreateLock (&AcpiGbl_GlobalLockPendingLock); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + AcpiGbl_GlobalLockPending = FALSE; + AcpiGbl_GlobalLockPresent = TRUE; + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiEvRemoveGlobalLockHandler + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Remove the handler for the Global Lock + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEvRemoveGlobalLockHandler ( + void) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (EvRemoveGlobalLockHandler); + + AcpiGbl_GlobalLockPresent = FALSE; + Status = AcpiRemoveFixedEventHandler (ACPI_EVENT_GLOBAL, + AcpiEvGlobalLockHandler); + + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiEvGlobalLockHandler + * + * PARAMETERS: Context - From thread interface, not used + * + * RETURN: ACPI_INTERRUPT_HANDLED + * + * DESCRIPTION: Invoked directly from the SCI handler when a global lock + * release interrupt occurs. If there is actually a pending + * request for the lock, signal the waiting thread. + * + ******************************************************************************/ + +static UINT32 +AcpiEvGlobalLockHandler ( + void *Context) +{ + ACPI_STATUS Status; + ACPI_CPU_FLAGS Flags; + + + Flags = AcpiOsAcquireLock (AcpiGbl_GlobalLockPendingLock); + + /* + * If a request for the global lock is not actually pending, + * we are done. This handles "spurious" global lock interrupts + * which are possible (and have been seen) with bad BIOSs. + */ + if (!AcpiGbl_GlobalLockPending) + { + goto CleanupAndExit; + } + + /* + * Send a unit to the global lock semaphore. The actual acquisition + * of the global lock will be performed by the waiting thread. + */ + Status = AcpiOsSignalSemaphore (AcpiGbl_GlobalLockSemaphore, 1); + if (ACPI_FAILURE (Status)) + { + ACPI_ERROR ((AE_INFO, "Could not signal Global Lock semaphore")); + } + + AcpiGbl_GlobalLockPending = FALSE; + + +CleanupAndExit: + + AcpiOsReleaseLock (AcpiGbl_GlobalLockPendingLock, Flags); + return (ACPI_INTERRUPT_HANDLED); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiEvAcquireGlobalLock + * + * PARAMETERS: Timeout - Max time to wait for the lock, in millisec. + * + * RETURN: Status + * + * DESCRIPTION: Attempt to gain ownership of the Global Lock. + * + * MUTEX: Interpreter must be locked + * + * Note: The original implementation allowed multiple threads to "acquire" the + * Global Lock, and the OS would hold the lock until the last thread had + * released it. However, this could potentially starve the BIOS out of the + * lock, especially in the case where there is a tight handshake between the + * Embedded Controller driver and the BIOS. Therefore, this implementation + * allows only one thread to acquire the HW Global Lock at a time, and makes + * the global lock appear as a standard mutex on the OS side. + * + *****************************************************************************/ + +ACPI_STATUS +AcpiEvAcquireGlobalLock ( + UINT16 Timeout) +{ + ACPI_CPU_FLAGS Flags; + ACPI_STATUS Status; + BOOLEAN Acquired = FALSE; + + + ACPI_FUNCTION_TRACE (EvAcquireGlobalLock); + + + /* + * Only one thread can acquire the GL at a time, the GlobalLockMutex + * enforces this. This interface releases the interpreter if we must wait. + */ + Status = AcpiExSystemWaitMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex, + Timeout); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* + * Update the global lock handle and check for wraparound. The handle is + * only used for the external global lock interfaces, but it is updated + * here to properly handle the case where a single thread may acquire the + * lock via both the AML and the AcpiAcquireGlobalLock interfaces. The + * handle is therefore updated on the first acquire from a given thread + * regardless of where the acquisition request originated. + */ + AcpiGbl_GlobalLockHandle++; + if (AcpiGbl_GlobalLockHandle == 0) + { + AcpiGbl_GlobalLockHandle = 1; + } + + /* + * Make sure that a global lock actually exists. If not, just + * treat the lock as a standard mutex. + */ + if (!AcpiGbl_GlobalLockPresent) + { + AcpiGbl_GlobalLockAcquired = TRUE; + return_ACPI_STATUS (AE_OK); + } + + Flags = AcpiOsAcquireLock (AcpiGbl_GlobalLockPendingLock); + + do + { + /* Attempt to acquire the actual hardware lock */ + + ACPI_ACQUIRE_GLOBAL_LOCK (AcpiGbl_FACS, Acquired); + if (Acquired) + { + AcpiGbl_GlobalLockAcquired = TRUE; + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Acquired hardware Global Lock\n")); + break; + } + + /* + * Did not get the lock. The pending bit was set above, and + * we must now wait until we receive the global lock + * released interrupt. + */ + AcpiGbl_GlobalLockPending = TRUE; + AcpiOsReleaseLock (AcpiGbl_GlobalLockPendingLock, Flags); + + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Waiting for hardware Global Lock\n")); + + /* + * Wait for handshake with the global lock interrupt handler. + * This interface releases the interpreter if we must wait. + */ + Status = AcpiExSystemWaitSemaphore (AcpiGbl_GlobalLockSemaphore, + ACPI_WAIT_FOREVER); + + Flags = AcpiOsAcquireLock (AcpiGbl_GlobalLockPendingLock); + + } while (ACPI_SUCCESS (Status)); + + AcpiGbl_GlobalLockPending = FALSE; + AcpiOsReleaseLock (AcpiGbl_GlobalLockPendingLock, Flags); + + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiEvReleaseGlobalLock + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Releases ownership of the Global Lock. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEvReleaseGlobalLock ( + void) +{ + BOOLEAN Pending = FALSE; + ACPI_STATUS Status = AE_OK; + + + ACPI_FUNCTION_TRACE (EvReleaseGlobalLock); + + + /* Lock must be already acquired */ + + if (!AcpiGbl_GlobalLockAcquired) + { + ACPI_WARNING ((AE_INFO, + "Cannot release the ACPI Global Lock, it has not been acquired")); + return_ACPI_STATUS (AE_NOT_ACQUIRED); + } + + if (AcpiGbl_GlobalLockPresent) + { + /* Allow any thread to release the lock */ + + ACPI_RELEASE_GLOBAL_LOCK (AcpiGbl_FACS, Pending); + + /* + * If the pending bit was set, we must write GBL_RLS to the control + * register + */ + if (Pending) + { + Status = AcpiWriteBitRegister ( + ACPI_BITREG_GLOBAL_LOCK_RELEASE, ACPI_ENABLE_EVENT); + } + + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Released hardware Global Lock\n")); + } + + AcpiGbl_GlobalLockAcquired = FALSE; + + /* Release the local GL mutex */ + + AcpiOsReleaseMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex); + return_ACPI_STATUS (Status); +} diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evgpe.c b/src/add-ons/kernel/bus_managers/acpi/events/evgpe.c index f7ab160084..59e5d55879 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evgpe.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evgpe.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -202,12 +202,13 @@ AcpiEvEnableGpe ( /* - * We will only allow a GPE to be enabled if it has either an - * associated method (_Lxx/_Exx) or a handler. Otherwise, the - * GPE will be immediately disabled by AcpiEvGpeDispatch the - * first time it fires. + * We will only allow a GPE to be enabled if it has either an associated + * method (_Lxx/_Exx) or a handler, or is using the implicit notify + * feature. Otherwise, the GPE will be immediately disabled by + * AcpiEvGpeDispatch the first time it fires. */ - if (!(GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK)) + if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == + ACPI_GPE_DISPATCH_NONE) { return_ACPI_STATUS (AE_NO_HANDLER); } @@ -227,6 +228,104 @@ AcpiEvEnableGpe ( } +/******************************************************************************* + * + * FUNCTION: AcpiEvAddGpeReference + * + * PARAMETERS: GpeEventInfo - Add a reference to this GPE + * + * RETURN: Status + * + * DESCRIPTION: Add a reference to a GPE. On the first reference, the GPE is + * hardware-enabled. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEvAddGpeReference ( + ACPI_GPE_EVENT_INFO *GpeEventInfo) +{ + ACPI_STATUS Status = AE_OK; + + + ACPI_FUNCTION_TRACE (EvAddGpeReference); + + + if (GpeEventInfo->RuntimeCount == ACPI_UINT8_MAX) + { + return_ACPI_STATUS (AE_LIMIT); + } + + GpeEventInfo->RuntimeCount++; + if (GpeEventInfo->RuntimeCount == 1) + { + /* Enable on first reference */ + + Status = AcpiEvUpdateGpeEnableMask (GpeEventInfo); + if (ACPI_SUCCESS (Status)) + { + Status = AcpiEvEnableGpe (GpeEventInfo); + } + + if (ACPI_FAILURE (Status)) + { + GpeEventInfo->RuntimeCount--; + } + } + + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiEvRemoveGpeReference + * + * PARAMETERS: GpeEventInfo - Remove a reference to this GPE + * + * RETURN: Status + * + * DESCRIPTION: Remove a reference to a GPE. When the last reference is + * removed, the GPE is hardware-disabled. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEvRemoveGpeReference ( + ACPI_GPE_EVENT_INFO *GpeEventInfo) +{ + ACPI_STATUS Status = AE_OK; + + + ACPI_FUNCTION_TRACE (EvRemoveGpeReference); + + + if (!GpeEventInfo->RuntimeCount) + { + return_ACPI_STATUS (AE_LIMIT); + } + + GpeEventInfo->RuntimeCount--; + if (!GpeEventInfo->RuntimeCount) + { + /* Disable on last reference */ + + Status = AcpiEvUpdateGpeEnableMask (GpeEventInfo); + if (ACPI_SUCCESS (Status)) + { + Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE); + } + + if (ACPI_FAILURE (Status)) + { + GpeEventInfo->RuntimeCount++; + } + } + + return_ACPI_STATUS (Status); +} + + /******************************************************************************* * * FUNCTION: AcpiEvLowGetGpeInfo @@ -395,6 +494,16 @@ AcpiEvGpeDetect ( GpeRegisterInfo = &GpeBlock->RegisterInfo[i]; + /* + * Optimization: If there are no GPEs enabled within this + * register, we can safely ignore the entire register. + */ + if (!(GpeRegisterInfo->EnableForRun | + GpeRegisterInfo->EnableForWake)) + { + continue; + } + /* Read the Status Register */ Status = AcpiHwRead (&StatusReg, &GpeRegisterInfo->StatusAddress); @@ -412,7 +521,7 @@ AcpiEvGpeDetect ( } ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, - "Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n", + "Read GPE Register at GPE%02X: Status=%02X, Enable=%02X\n", GpeRegisterInfo->BaseGpeNumber, StatusReg, EnableReg)); /* Check if there is anything active at all in this register */ @@ -437,7 +546,7 @@ AcpiEvGpeDetect ( * Found an active GPE. Dispatch the event to a handler * or method. */ - IntStatus |= AcpiEvGpeDispatch ( + IntStatus |= AcpiEvGpeDispatch (GpeBlock->Node, &GpeBlock->EventInfo[((ACPI_SIZE) i * ACPI_GPE_REGISTER_WIDTH) + j], j + GpeRegisterInfo->BaseGpeNumber); @@ -521,13 +630,27 @@ AcpiEvAsynchExecuteGpeMethod ( return_VOID; } - /* - * Must check for control method type dispatch one more time to avoid a - * race with EvGpeInstallHandler - */ - if ((LocalGpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == - ACPI_GPE_DISPATCH_METHOD) + /* Do the correct dispatch - normal method or implicit notify */ + + switch (LocalGpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) { + case ACPI_GPE_DISPATCH_NOTIFY: + + /* + * Implicit notify. + * Dispatch a DEVICE_WAKE notify to the appropriate handler. + * NOTE: the request is queued for execution after this method + * completes. The notify handlers are NOT invoked synchronously + * from this thread -- because handlers may in turn run other + * control methods. + */ + Status = AcpiEvQueueNotifyRequest ( + LocalGpeEventInfo->Dispatch.DeviceNode, + ACPI_NOTIFY_DEVICE_WAKE); + break; + + case ACPI_GPE_DISPATCH_METHOD: + /* Allocate the evaluation information block */ Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO)); @@ -538,8 +661,8 @@ AcpiEvAsynchExecuteGpeMethod ( else { /* - * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx - * control method that corresponds to this GPE + * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the + * _Lxx/_Exx control method that corresponds to this GPE */ Info->PrefixNode = LocalGpeEventInfo->Dispatch.MethodNode; Info->Flags = ACPI_IGNORE_RETURN_VALUE; @@ -554,6 +677,11 @@ AcpiEvAsynchExecuteGpeMethod ( "while evaluating GPE method [%4.4s]", AcpiUtGetNodeName (LocalGpeEventInfo->Dispatch.MethodNode))); } + + break; + + default: + return_VOID; /* Should never happen */ } /* Defer enabling of GPE until all notify handlers are done */ @@ -573,6 +701,7 @@ AcpiEvAsynchExecuteGpeMethod ( * FUNCTION: AcpiEvAsynchEnableGpe * * PARAMETERS: Context (GpeEventInfo) - Info for this GPE + * Callback from AcpiOsExecute * * RETURN: None * @@ -586,41 +715,66 @@ AcpiEvAsynchEnableGpe ( void *Context) { ACPI_GPE_EVENT_INFO *GpeEventInfo = Context; - ACPI_STATUS Status; - if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) == - ACPI_GPE_LEVEL_TRIGGERED) - { - /* - * GPE is level-triggered, we clear the GPE status bit after handling - * the event. - */ - Status = AcpiHwClearGpe (GpeEventInfo); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - } + (void) AcpiEvFinishGpe (GpeEventInfo); - /* - * Enable this GPE, conditionally. This means that the GPE will only be - * physically enabled if the EnableForRun bit is set in the EventInfo - */ - (void) AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_CONDITIONAL_ENABLE); - -Exit: ACPI_FREE (GpeEventInfo); return; } +/******************************************************************************* + * + * FUNCTION: AcpiEvFinishGpe + * + * PARAMETERS: GpeEventInfo - Info for this GPE + * + * RETURN: Status + * + * DESCRIPTION: Clear/Enable a GPE. Common code that is used after execution + * of a GPE method or a synchronous or asynchronous GPE handler. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEvFinishGpe ( + ACPI_GPE_EVENT_INFO *GpeEventInfo) +{ + ACPI_STATUS Status; + + + if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) == + ACPI_GPE_LEVEL_TRIGGERED) + { + /* + * GPE is level-triggered, we clear the GPE status bit after + * handling the event. + */ + Status = AcpiHwClearGpe (GpeEventInfo); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + } + + /* + * Enable this GPE, conditionally. This means that the GPE will + * only be physically enabled if the EnableForRun bit is set + * in the EventInfo. + */ + (void) AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_CONDITIONAL_ENABLE); + return (AE_OK); +} + + /******************************************************************************* * * FUNCTION: AcpiEvGpeDispatch * - * PARAMETERS: GpeEventInfo - Info for this GPE - * GpeNumber - Number relative to the parent GPE block + * PARAMETERS: GpeDevice - Device node. NULL for GPE0/GPE1 + * GpeEventInfo - Info for this GPE + * GpeNumber - Number relative to the parent GPE block * * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED * @@ -633,16 +787,25 @@ Exit: UINT32 AcpiEvGpeDispatch ( + ACPI_NAMESPACE_NODE *GpeDevice, ACPI_GPE_EVENT_INFO *GpeEventInfo, UINT32 GpeNumber) { ACPI_STATUS Status; + UINT32 ReturnValue; ACPI_FUNCTION_TRACE (EvGpeDispatch); + /* Invoke global event handler if present */ + AcpiGpeCount++; + if (AcpiGbl_GlobalEventHandler) + { + AcpiGbl_GlobalEventHandler (ACPI_EVENT_TYPE_GPE, GpeDevice, + GpeNumber, AcpiGbl_GlobalEventHandlerContext); + } /* * If edge-triggered, clear the GPE status bit now. Note that @@ -655,58 +818,55 @@ AcpiEvGpeDispatch ( if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, - "Unable to clear GPE[0x%2X]", GpeNumber)); + "Unable to clear GPE%02X", GpeNumber)); return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED); } } /* - * Dispatch the GPE to either an installed handler, or the control method - * associated with this GPE (_Lxx or _Exx). If a handler exists, we invoke - * it and do not attempt to run the method. If there is neither a handler - * nor a method, we disable this GPE to prevent further such pointless - * events from firing. + * Always disable the GPE so that it does not keep firing before + * any asynchronous activity completes (either from the execution + * of a GPE method or an asynchronous GPE handler.) + * + * If there is no handler or method to run, just disable the + * GPE and leave it disabled permanently to prevent further such + * pointless events from firing. + */ + Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, + "Unable to disable GPE%02X", GpeNumber)); + return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED); + } + + /* + * Dispatch the GPE to either an installed handler or the control + * method associated with this GPE (_Lxx or _Exx). If a handler + * exists, we invoke it and do not attempt to run the method. + * If there is neither a handler nor a method, leave the GPE + * disabled. */ switch (GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) { case ACPI_GPE_DISPATCH_HANDLER: - /* - * Invoke the installed handler (at interrupt level) - * Ignore return status for now. - * TBD: leave GPE disabled on error? - */ - (void) GpeEventInfo->Dispatch.Handler->Address ( - GpeEventInfo->Dispatch.Handler->Context); + /* Invoke the installed handler (at interrupt level) */ - /* It is now safe to clear level-triggered events. */ + ReturnValue = GpeEventInfo->Dispatch.Handler->Address ( + GpeDevice, GpeNumber, + GpeEventInfo->Dispatch.Handler->Context); - if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) == - ACPI_GPE_LEVEL_TRIGGERED) + /* If requested, clear (if level-triggered) and reenable the GPE */ + + if (ReturnValue & ACPI_REENABLE_GPE) { - Status = AcpiHwClearGpe (GpeEventInfo); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Unable to clear GPE[0x%2X]", GpeNumber)); - return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED); - } + (void) AcpiEvFinishGpe (GpeEventInfo); } break; case ACPI_GPE_DISPATCH_METHOD: - - /* - * Disable the GPE, so it doesn't keep firing before the method has a - * chance to run (it runs asynchronously with interrupts enabled). - */ - Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Unable to disable GPE[0x%2X]", GpeNumber)); - return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED); - } + case ACPI_GPE_DISPATCH_NOTIFY: /* * Execute the method associated with the GPE @@ -717,7 +877,7 @@ AcpiEvGpeDispatch ( if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, - "Unable to queue handler for GPE[0x%2X] - event disabled", + "Unable to queue handler for GPE%02X - event disabled", GpeNumber)); } break; @@ -730,20 +890,8 @@ AcpiEvGpeDispatch ( * a GPE to be enabled if it has no handler or method. */ ACPI_ERROR ((AE_INFO, - "No handler or method for GPE[0x%2X], disabling event", + "No handler or method for GPE%02X, disabling event", GpeNumber)); - - /* - * Disable the GPE. The GPE will remain disabled until a handler - * is installed or ACPICA is restarted. - */ - Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Unable to disable GPE[0x%2X]", GpeNumber)); - return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED); - } break; } diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evgpeblk.c b/src/add-ons/kernel/bus_managers/acpi/events/evgpeblk.c index 7aaff53150..c3ea571ca4 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evgpeblk.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evgpeblk.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -467,6 +467,7 @@ AcpiEvCreateGpeBlock ( GpeBlock->Node = GpeDevice; GpeBlock->GpeCount = (UINT16) (RegisterCount * ACPI_GPE_REGISTER_WIDTH); + GpeBlock->Initialized = FALSE; GpeBlock->RegisterCount = RegisterCount; GpeBlock->BlockBaseNumber = GpeBlockBaseNumber; @@ -493,11 +494,12 @@ AcpiEvCreateGpeBlock ( return_ACPI_STATUS (Status); } + AcpiGbl_AllGpesInitialized = FALSE; + /* Find all GPE methods (_Lxx or_Exx) for this block */ WalkInfo.GpeBlock = GpeBlock; WalkInfo.GpeDevice = GpeDevice; - WalkInfo.EnableThisGpe = FALSE; WalkInfo.ExecuteByOwnerId = FALSE; Status = AcpiNsWalkNamespace (ACPI_TYPE_METHOD, GpeDevice, @@ -529,30 +531,26 @@ AcpiEvCreateGpeBlock ( * * FUNCTION: AcpiEvInitializeGpeBlock * - * PARAMETERS: GpeDevice - Handle to the parent GPE block - * GpeBlock - Gpe Block info + * PARAMETERS: ACPI_GPE_CALLBACK * * RETURN: Status * - * DESCRIPTION: Initialize and enable a GPE block. First find and run any - * _PRT methods associated with the block, then enable the - * appropriate GPEs. + * DESCRIPTION: Initialize and enable a GPE block. Enable GPEs that have + * associated methods. * Note: Assumes namespace is locked. * ******************************************************************************/ ACPI_STATUS AcpiEvInitializeGpeBlock ( - ACPI_NAMESPACE_NODE *GpeDevice, - ACPI_GPE_BLOCK_INFO *GpeBlock) + ACPI_GPE_XRUPT_INFO *GpeXruptInfo, + ACPI_GPE_BLOCK_INFO *GpeBlock, + void *Ignored) { ACPI_STATUS Status; ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_GPE_WALK_INFO WalkInfo; - UINT32 WakeGpeCount; UINT32 GpeEnabledCount; UINT32 GpeIndex; - UINT32 GpeNumber; UINT32 i; UINT32 j; @@ -560,51 +558,22 @@ AcpiEvInitializeGpeBlock ( ACPI_FUNCTION_TRACE (EvInitializeGpeBlock); - /* Ignore a null GPE block (e.g., if no GPE block 1 exists) */ - - if (!GpeBlock) + /* + * Ignore a null GPE block (e.g., if no GPE block 1 exists), and + * any GPE blocks that have been initialized already. + */ + if (!GpeBlock || GpeBlock->Initialized) { return_ACPI_STATUS (AE_OK); } /* - * Runtime option: Should wake GPEs be enabled at runtime? The default - * is no, they should only be enabled just as the machine goes to sleep. + * Enable all GPEs that have a corresponding method and have the + * ACPI_GPE_CAN_WAKE flag unset. Any other GPEs within this block + * must be enabled via the acpi_enable_gpe() interface. */ - if (AcpiGbl_LeaveWakeGpesDisabled) - { - /* - * Differentiate runtime vs wake GPEs, via the _PRW control methods. - * Each GPE that has one or more _PRWs that reference it is by - * definition a wake GPE and will not be enabled while the machine - * is running. - */ - WalkInfo.GpeBlock = GpeBlock; - WalkInfo.GpeDevice = GpeDevice; - WalkInfo.ExecuteByOwnerId = FALSE; - - Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, - AcpiEvMatchPrwAndGpe, NULL, &WalkInfo, NULL); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, "While executing _PRW methods")); - } - } - - /* - * Enable all GPEs that have a corresponding method and are not - * capable of generating wakeups. Any other GPEs within this block - * must be enabled via the AcpiEnableGpe interface. - */ - WakeGpeCount = 0; GpeEnabledCount = 0; - if (GpeDevice == AcpiGbl_FadtGpeDevice) - { - GpeDevice = NULL; - } - for (i = 0; i < GpeBlock->RegisterCount; i++) { for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) @@ -613,45 +582,24 @@ AcpiEvInitializeGpeBlock ( GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j; GpeEventInfo = &GpeBlock->EventInfo[GpeIndex]; - GpeNumber = GpeIndex + GpeBlock->BlockBaseNumber; /* - * If the GPE has already been enabled for runtime - * signalling, make sure that it remains enabled, but - * do not increment its reference count. + * Ignore GPEs that have no corresponding _Lxx/_Exx method + * and GPEs that are used to wake the system */ - if (GpeEventInfo->RuntimeCount) - { - Status = AcpiEvEnableGpe (GpeEventInfo); - goto Enabled; - } - - /* Ignore GPEs that can wake the system */ - - if (GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE) - { - WakeGpeCount++; - if (AcpiGbl_LeaveWakeGpesDisabled) - { - continue; - } - } - - /* Ignore GPEs that have no corresponding _Lxx/_Exx method */ - - if (!(GpeEventInfo->Flags & ACPI_GPE_DISPATCH_METHOD)) + if (((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_NONE) || + ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER) || + (GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE)) { continue; } - /* Enable this GPE */ - - Status = AcpiEnableGpe (GpeDevice, GpeNumber); -Enabled: + Status = AcpiEvAddGpeReference (GpeEventInfo); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, - "Could not enable GPE 0x%02X", GpeNumber)); + "Could not enable GPE 0x%02X", + GpeIndex + GpeBlock->BlockBaseNumber)); continue; } @@ -659,13 +607,13 @@ Enabled: } } - if (GpeEnabledCount || WakeGpeCount) + if (GpeEnabledCount) { ACPI_DEBUG_PRINT ((ACPI_DB_INIT, - "Enabled %u Runtime GPEs, added %u Wake GPEs in this block\n", - GpeEnabledCount, WakeGpeCount)); + "Enabled %u GPEs in this block\n", GpeEnabledCount)); } + GpeBlock->Initialized = TRUE; return_ACPI_STATUS (AE_OK); } diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evgpeinit.c b/src/add-ons/kernel/bus_managers/acpi/events/evgpeinit.c index be38f0cfcd..8bba11166c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evgpeinit.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evgpeinit.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -118,12 +118,28 @@ #include "accommon.h" #include "acevents.h" #include "acnamesp.h" -#include "acinterp.h" #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME ("evgpeinit") +/* + * Note: History of _PRW support in ACPICA + * + * Originally (2000 - 2010), the GPE initialization code performed a walk of + * the entire namespace to execute the _PRW methods and detect all GPEs + * capable of waking the system. + * + * As of 10/2010, the _PRW method execution has been removed since it is + * actually unnecessary. The host OS must in fact execute all _PRW methods + * in order to identify the device/power-resource dependencies. We now put + * the onus on the host OS to identify the wake GPEs as part of this process + * and to inform ACPICA of these GPEs via the AcpiSetupGpeForWake interface. This + * not only reduces the complexity of the ACPICA initialization code, but in + * some cases (on systems with very large namespaces) it should reduce the + * kernel boot time as well. + */ + /******************************************************************************* * * FUNCTION: AcpiEvGpeInitialize @@ -288,10 +304,7 @@ Cleanup: * * DESCRIPTION: Check for new GPE methods (_Lxx/_Exx) made available as a * result of a Load() or LoadTable() operation. If new GPE - * methods have been installed, register the new methods and - * enable and runtime GPEs that are associated with them. Also, - * run any newly loaded _PRW methods in order to discover any - * new CAN_WAKE GPEs. + * methods have been installed, register the new methods. * ******************************************************************************/ @@ -303,49 +316,13 @@ AcpiEvUpdateGpes ( ACPI_GPE_BLOCK_INFO *GpeBlock; ACPI_GPE_WALK_INFO WalkInfo; ACPI_STATUS Status = AE_OK; - UINT32 NewWakeGpeCount = 0; - /* We will examine only _PRW/_Lxx/_Exx methods owned by this table */ - - WalkInfo.OwnerId = TableOwnerId; - WalkInfo.ExecuteByOwnerId = TRUE; - WalkInfo.Count = 0; - - if (AcpiGbl_LeaveWakeGpesDisabled) - { - /* - * 1) Run any newly-loaded _PRW methods to find any GPEs that - * can now be marked as CAN_WAKE GPEs. Note: We must run the - * _PRW methods before we process the _Lxx/_Exx methods because - * we will enable all runtime GPEs associated with the new - * _Lxx/_Exx methods at the time we process those methods. - * - * Unlock interpreter so that we can run the _PRW methods. - */ - WalkInfo.GpeBlock = NULL; - WalkInfo.GpeDevice = NULL; - - AcpiExExitInterpreter (); - - Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, - AcpiEvMatchPrwAndGpe, NULL, &WalkInfo, NULL); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "While executing _PRW methods")); - } - - AcpiExEnterInterpreter (); - NewWakeGpeCount = WalkInfo.Count; - } - /* - * 2) Find any _Lxx/_Exx GPE methods that have just been loaded. + * Find any _Lxx/_Exx GPE methods that have just been loaded. * - * Any GPEs that correspond to new _Lxx/_Exx methods and are not - * marked as CAN_WAKE are immediately enabled. + * Any GPEs that correspond to new _Lxx/_Exx methods are immediately + * enabled. * * Examine the namespace underneath each GpeDevice within the * GpeBlock lists. @@ -357,7 +334,8 @@ AcpiEvUpdateGpes ( } WalkInfo.Count = 0; - WalkInfo.EnableThisGpe = TRUE; + WalkInfo.OwnerId = TableOwnerId; + WalkInfo.ExecuteByOwnerId = TRUE; /* Walk the interrupt level descriptor list */ @@ -388,11 +366,9 @@ AcpiEvUpdateGpes ( GpeXruptInfo = GpeXruptInfo->Next; } - if (WalkInfo.Count || NewWakeGpeCount) + if (WalkInfo.Count) { - ACPI_INFO ((AE_INFO, - "Enabled %u new runtime GPEs, added %u new wakeup GPEs", - WalkInfo.Count, NewWakeGpeCount)); + ACPI_INFO ((AE_INFO, "Enabled %u new GPEs", WalkInfo.Count)); } (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); @@ -422,9 +398,7 @@ AcpiEvUpdateGpes ( * xx - is the GPE number [in HEX] * * If WalkInfo->ExecuteByOwnerId is TRUE, we only execute examine GPE methods - * with that owner. - * If WalkInfo->EnableThisGpe is TRUE, the GPE that is referred to by a GPE - * method is immediately enabled (Used for Load/LoadTable operators) + * with that owner. * ******************************************************************************/ @@ -438,8 +412,6 @@ AcpiEvMatchGpeMethod ( ACPI_NAMESPACE_NODE *MethodNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle); ACPI_GPE_WALK_INFO *WalkInfo = ACPI_CAST_PTR (ACPI_GPE_WALK_INFO, Context); ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_NAMESPACE_NODE *GpeDevice; - ACPI_STATUS Status; UINT32 GpeNumber; char Name[ACPI_NAME_SIZE + 1]; UINT8 Type; @@ -474,9 +446,6 @@ AcpiEvMatchGpeMethod ( /* * 3) Edge/Level determination is based on the 2nd character * of the method name - * - * NOTE: Default GPE type is RUNTIME only. Later, if a _PRW object is - * found that points to this GPE, the ACPI_GPE_CAN_WAKE flag is set. */ switch (Name[1]) { @@ -551,212 +520,12 @@ AcpiEvMatchGpeMethod ( * Add the GPE information from above to the GpeEventInfo block for * use during dispatch of this GPE. */ + GpeEventInfo->Flags &= ~(ACPI_GPE_DISPATCH_MASK); GpeEventInfo->Flags |= (UINT8) (Type | ACPI_GPE_DISPATCH_METHOD); GpeEventInfo->Dispatch.MethodNode = MethodNode; - /* - * Enable this GPE if requested. This only happens when during the - * execution of a Load or LoadTable operator. We have found a new - * GPE method and want to immediately enable the GPE if it is a - * runtime GPE. - */ - if (WalkInfo->EnableThisGpe) - { - /* Ignore GPEs that can wake the system */ - - if (!(GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE) || - !AcpiGbl_LeaveWakeGpesDisabled) - { - WalkInfo->Count++; - GpeDevice = WalkInfo->GpeDevice; - - if (GpeDevice == AcpiGbl_FadtGpeDevice) - { - GpeDevice = NULL; - } - - Status = AcpiEnableGpe (GpeDevice, GpeNumber); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not enable GPE 0x%02X", GpeNumber)); - } - } - } - ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Registered GPE method %s as GPE number 0x%.2X\n", Name, GpeNumber)); return_ACPI_STATUS (AE_OK); } - - -/******************************************************************************* - * - * FUNCTION: AcpiEvMatchPrwAndGpe - * - * PARAMETERS: Callback from WalkNamespace - * - * RETURN: Status. NOTE: We ignore errors so that the _PRW walk is - * not aborted on a single _PRW failure. - * - * DESCRIPTION: Called from AcpiWalkNamespace. Expects each object to be a - * Device. Run the _PRW method. If present, extract the GPE - * number and mark the GPE as a CAN_WAKE GPE. Allows a - * per-OwnerId execution if ExecuteByOwnerId is TRUE in the - * WalkInfo parameter block. - * - * If WalkInfo->ExecuteByOwnerId is TRUE, we only execute _PRWs with that - * owner. - * If WalkInfo->GpeDevice is NULL, we execute every _PRW found. Otherwise, - * we only execute _PRWs that refer to the input GpeDevice. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvMatchPrwAndGpe ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue) -{ - ACPI_GPE_WALK_INFO *WalkInfo = ACPI_CAST_PTR (ACPI_GPE_WALK_INFO, Context); - ACPI_NAMESPACE_NODE *GpeDevice; - ACPI_GPE_BLOCK_INFO *GpeBlock; - ACPI_NAMESPACE_NODE *TargetGpeDevice; - ACPI_NAMESPACE_NODE *PrwNode; - ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_OPERAND_OBJECT *PkgDesc; - ACPI_OPERAND_OBJECT *ObjDesc; - UINT32 GpeNumber; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (EvMatchPrwAndGpe); - - - /* Check for a _PRW method under this device */ - - Status = AcpiNsGetNode (ObjHandle, METHOD_NAME__PRW, - ACPI_NS_NO_UPSEARCH, &PrwNode); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (AE_OK); - } - - /* Check if requested OwnerId matches this OwnerId */ - - if ((WalkInfo->ExecuteByOwnerId) && - (PrwNode->OwnerId != WalkInfo->OwnerId)) - { - return_ACPI_STATUS (AE_OK); - } - - /* Execute the _PRW */ - - Status = AcpiUtEvaluateObject (PrwNode, NULL, - ACPI_BTYPE_PACKAGE, &PkgDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (AE_OK); - } - - /* The returned _PRW package must have at least two elements */ - - if (PkgDesc->Package.Count < 2) - { - goto Cleanup; - } - - /* Extract pointers from the input context */ - - GpeDevice = WalkInfo->GpeDevice; - GpeBlock = WalkInfo->GpeBlock; - - /* - * The _PRW object must return a package, we are only interested - * in the first element - */ - ObjDesc = PkgDesc->Package.Elements[0]; - - if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) - { - /* Use FADT-defined GPE device (from definition of _PRW) */ - - TargetGpeDevice = NULL; - if (GpeDevice) - { - TargetGpeDevice = AcpiGbl_FadtGpeDevice; - } - - /* Integer is the GPE number in the FADT described GPE blocks */ - - GpeNumber = (UINT32) ObjDesc->Integer.Value; - } - else if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE) - { - /* Package contains a GPE reference and GPE number within a GPE block */ - - if ((ObjDesc->Package.Count < 2) || - ((ObjDesc->Package.Elements[0])->Common.Type != - ACPI_TYPE_LOCAL_REFERENCE) || - ((ObjDesc->Package.Elements[1])->Common.Type != - ACPI_TYPE_INTEGER)) - { - goto Cleanup; - } - - /* Get GPE block reference and decode */ - - TargetGpeDevice = ObjDesc->Package.Elements[0]->Reference.Node; - GpeNumber = (UINT32) ObjDesc->Package.Elements[1]->Integer.Value; - } - else - { - /* Unknown type, just ignore it */ - - goto Cleanup; - } - - /* Get the GpeEventInfo for this GPE */ - - if (GpeDevice) - { - /* - * Is this GPE within this block? - * - * TRUE if and only if these conditions are true: - * 1) The GPE devices match. - * 2) The GPE index(number) is within the range of the Gpe Block - * associated with the GPE device. - */ - if (GpeDevice != TargetGpeDevice) - { - goto Cleanup; - } - - GpeEventInfo = AcpiEvLowGetGpeInfo (GpeNumber, GpeBlock); - } - else - { - /* GpeDevice is NULL, just match the TargetDevice and GpeNumber */ - - GpeEventInfo = AcpiEvGetGpeEventInfo (TargetGpeDevice, GpeNumber); - } - - if (GpeEventInfo) - { - if (!(GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE)) - { - /* This GPE can wake the system */ - - GpeEventInfo->Flags |= ACPI_GPE_CAN_WAKE; - WalkInfo->Count++; - } - } - -Cleanup: - AcpiUtRemoveReference (PkgDesc); - return_ACPI_STATUS (AE_OK); -} - diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evgpeutil.c b/src/add-ons/kernel/bus_managers/acpi/events/evgpeutil.c index 1bd42b2cac..eb422a17c6 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evgpeutil.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evgpeutil.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -239,6 +239,51 @@ AcpiEvValidGpeEvent ( } +/******************************************************************************* + * + * FUNCTION: AcpiEvGetGpeDevice + * + * PARAMETERS: GPE_WALK_CALLBACK + * + * RETURN: Status + * + * DESCRIPTION: Matches the input GPE index (0-CurrentGpeCount) with a GPE + * block device. NULL if the GPE is one of the FADT-defined GPEs. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEvGetGpeDevice ( + ACPI_GPE_XRUPT_INFO *GpeXruptInfo, + ACPI_GPE_BLOCK_INFO *GpeBlock, + void *Context) +{ + ACPI_GPE_DEVICE_INFO *Info = Context; + + + /* Increment Index by the number of GPEs in this block */ + + Info->NextBlockBaseIndex += GpeBlock->GpeCount; + + if (Info->Index < Info->NextBlockBaseIndex) + { + /* + * The GPE index is within this block, get the node. Leave the node + * NULL for the FADT-defined GPEs + */ + if ((GpeBlock->Node)->Type == ACPI_TYPE_DEVICE) + { + Info->GpeDevice = GpeBlock->Node; + } + + Info->Status = AE_OK; + return (AE_CTRL_END); + } + + return (AE_OK); +} + + /******************************************************************************* * * FUNCTION: AcpiEvGetGpeXruptBlock diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evmisc.c b/src/add-ons/kernel/bus_managers/acpi/events/evmisc.c index b0e1cac144..69d6c79ded 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evmisc.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evmisc.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -117,7 +117,6 @@ #include "accommon.h" #include "acevents.h" #include "acnamesp.h" -#include "acinterp.h" #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME ("evmisc") @@ -129,14 +128,6 @@ static void ACPI_SYSTEM_XFACE AcpiEvNotifyDispatch ( void *Context); -static UINT32 -AcpiEvGlobalLockHandler ( - void *Context); - -static ACPI_STATUS -AcpiEvRemoveGlobalLockHandler ( - void); - /******************************************************************************* * @@ -372,292 +363,6 @@ AcpiEvNotifyDispatch ( } -/******************************************************************************* - * - * FUNCTION: AcpiEvGlobalLockHandler - * - * PARAMETERS: Context - From thread interface, not used - * - * RETURN: ACPI_INTERRUPT_HANDLED - * - * DESCRIPTION: Invoked directly from the SCI handler when a global lock - * release interrupt occurs. Attempt to acquire the global lock, - * if successful, signal the thread waiting for the lock. - * - * NOTE: Assumes that the semaphore can be signaled from interrupt level. If - * this is not possible for some reason, a separate thread will have to be - * scheduled to do this. - * - ******************************************************************************/ - -static UINT32 -AcpiEvGlobalLockHandler ( - void *Context) -{ - BOOLEAN Acquired = FALSE; - ACPI_STATUS Status; - - - /* - * Attempt to get the lock. - * - * If we don't get it now, it will be marked pending and we will - * take another interrupt when it becomes free. - */ - ACPI_ACQUIRE_GLOBAL_LOCK (AcpiGbl_FACS, Acquired); - if (Acquired) - { - /* Got the lock, now wake the thread waiting for it */ - - AcpiGbl_GlobalLockAcquired = TRUE; - - /* Send a unit to the semaphore */ - - Status = AcpiOsSignalSemaphore (AcpiGbl_GlobalLockSemaphore, 1); - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR ((AE_INFO, "Could not signal Global Lock semaphore")); - } - } - - return (ACPI_INTERRUPT_HANDLED); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvInitGlobalLockHandler - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Install a handler for the global lock release event - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvInitGlobalLockHandler ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (EvInitGlobalLockHandler); - - - /* Attempt installation of the global lock handler */ - - Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL, - AcpiEvGlobalLockHandler, NULL); - - /* - * If the global lock does not exist on this platform, the attempt to - * enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick). - * Map to AE_OK, but mark global lock as not present. Any attempt to - * actually use the global lock will be flagged with an error. - */ - if (Status == AE_NO_HARDWARE_RESPONSE) - { - ACPI_ERROR ((AE_INFO, - "No response from Global Lock hardware, disabling lock")); - - AcpiGbl_GlobalLockPresent = FALSE; - return_ACPI_STATUS (AE_OK); - } - - AcpiGbl_GlobalLockPresent = TRUE; - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvRemoveGlobalLockHandler - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Remove the handler for the Global Lock - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiEvRemoveGlobalLockHandler ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (EvRemoveGlobalLockHandler); - - AcpiGbl_GlobalLockPresent = FALSE; - Status = AcpiRemoveFixedEventHandler (ACPI_EVENT_GLOBAL, - AcpiEvGlobalLockHandler); - - return_ACPI_STATUS (Status); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiEvAcquireGlobalLock - * - * PARAMETERS: Timeout - Max time to wait for the lock, in millisec. - * - * RETURN: Status - * - * DESCRIPTION: Attempt to gain ownership of the Global Lock. - * - * MUTEX: Interpreter must be locked - * - * Note: The original implementation allowed multiple threads to "acquire" the - * Global Lock, and the OS would hold the lock until the last thread had - * released it. However, this could potentially starve the BIOS out of the - * lock, especially in the case where there is a tight handshake between the - * Embedded Controller driver and the BIOS. Therefore, this implementation - * allows only one thread to acquire the HW Global Lock at a time, and makes - * the global lock appear as a standard mutex on the OS side. - * - *****************************************************************************/ - -ACPI_STATUS -AcpiEvAcquireGlobalLock ( - UINT16 Timeout) -{ - ACPI_STATUS Status = AE_OK; - BOOLEAN Acquired = FALSE; - - - ACPI_FUNCTION_TRACE (EvAcquireGlobalLock); - - - /* - * Only one thread can acquire the GL at a time, the GlobalLockMutex - * enforces this. This interface releases the interpreter if we must wait. - */ - Status = AcpiExSystemWaitMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex, - Timeout); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * Update the global lock handle and check for wraparound. The handle is - * only used for the external global lock interfaces, but it is updated - * here to properly handle the case where a single thread may acquire the - * lock via both the AML and the AcpiAcquireGlobalLock interfaces. The - * handle is therefore updated on the first acquire from a given thread - * regardless of where the acquisition request originated. - */ - AcpiGbl_GlobalLockHandle++; - if (AcpiGbl_GlobalLockHandle == 0) - { - AcpiGbl_GlobalLockHandle = 1; - } - - /* - * Make sure that a global lock actually exists. If not, just treat the - * lock as a standard mutex. - */ - if (!AcpiGbl_GlobalLockPresent) - { - AcpiGbl_GlobalLockAcquired = TRUE; - return_ACPI_STATUS (AE_OK); - } - - /* Attempt to acquire the actual hardware lock */ - - ACPI_ACQUIRE_GLOBAL_LOCK (AcpiGbl_FACS, Acquired); - if (Acquired) - { - /* We got the lock */ - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Acquired hardware Global Lock\n")); - - AcpiGbl_GlobalLockAcquired = TRUE; - return_ACPI_STATUS (AE_OK); - } - - /* - * Did not get the lock. The pending bit was set above, and we must now - * wait until we get the global lock released interrupt. - */ - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Waiting for hardware Global Lock\n")); - - /* - * Wait for handshake with the global lock interrupt handler. - * This interface releases the interpreter if we must wait. - */ - Status = AcpiExSystemWaitSemaphore (AcpiGbl_GlobalLockSemaphore, - ACPI_WAIT_FOREVER); - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEvReleaseGlobalLock - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Releases ownership of the Global Lock. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEvReleaseGlobalLock ( - void) -{ - BOOLEAN Pending = FALSE; - ACPI_STATUS Status = AE_OK; - - - ACPI_FUNCTION_TRACE (EvReleaseGlobalLock); - - - /* Lock must be already acquired */ - - if (!AcpiGbl_GlobalLockAcquired) - { - ACPI_WARNING ((AE_INFO, - "Cannot release the ACPI Global Lock, it has not been acquired")); - return_ACPI_STATUS (AE_NOT_ACQUIRED); - } - - if (AcpiGbl_GlobalLockPresent) - { - /* Allow any thread to release the lock */ - - ACPI_RELEASE_GLOBAL_LOCK (AcpiGbl_FACS, Pending); - - /* - * If the pending bit was set, we must write GBL_RLS to the control - * register - */ - if (Pending) - { - Status = AcpiWriteBitRegister ( - ACPI_BITREG_GLOBAL_LOCK_RELEASE, ACPI_ENABLE_EVENT); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Released hardware Global Lock\n")); - } - - AcpiGbl_GlobalLockAcquired = FALSE; - - /* Release the local GL mutex */ - - AcpiOsReleaseMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex); - return_ACPI_STATUS (Status); -} - - /****************************************************************************** * * FUNCTION: AcpiEvTerminate @@ -737,4 +442,3 @@ AcpiEvTerminate ( } return_VOID; } - diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evregion.c b/src/add-ons/kernel/bus_managers/acpi/events/evregion.c index f3e10bec8b..bd50228df3 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evregion.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evregion.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -133,6 +133,10 @@ AcpiEvHasDefaultHandler ( ACPI_NAMESPACE_NODE *Node, ACPI_ADR_SPACE_TYPE SpaceId); +static void +AcpiEvOrphanEcRegMethod ( + void); + static ACPI_STATUS AcpiEvRegRun ( ACPI_HANDLE ObjHandle, @@ -334,6 +338,8 @@ AcpiEvInitializeOpRegions ( } } + AcpiGbl_RegMethodsExecuted = TRUE; + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return_ACPI_STATUS (Status); } @@ -681,7 +687,7 @@ AcpiEvDetachRegion( /* Now stop region accesses by executing the _REG method */ - Status = AcpiEvExecuteRegMethod (RegionObj, 0); + Status = AcpiEvExecuteRegMethod (RegionObj, ACPI_REG_DISCONNECT); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "from region _REG, [%s]", @@ -1212,6 +1218,13 @@ AcpiEvExecuteRegMethods ( ACPI_NS_WALK_UNLOCK, AcpiEvRegRun, NULL, &SpaceId, NULL); + /* Special case for EC: handle "orphan" _REG methods with no region */ + + if (SpaceId == ACPI_ADR_SPACE_EC) + { + AcpiEvOrphanEcRegMethod (); + } + return_ACPI_STATUS (Status); } @@ -1278,7 +1291,122 @@ AcpiEvRegRun ( return (AE_OK); } - Status = AcpiEvExecuteRegMethod (ObjDesc, 1); + Status = AcpiEvExecuteRegMethod (ObjDesc, ACPI_REG_CONNECT); return (Status); } + +/******************************************************************************* + * + * FUNCTION: AcpiEvOrphanEcRegMethod + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Execute an "orphan" _REG method that appears under the EC + * device. This is a _REG method that has no corresponding region + * within the EC device scope. The orphan _REG method appears to + * have been enabled by the description of the ECDT in the ACPI + * specification: "The availability of the region space can be + * detected by providing a _REG method object underneath the + * Embedded Controller device." + * + * To quickly access the EC device, we use the EC_ID that appears + * within the ECDT. Otherwise, we would need to perform a time- + * consuming namespace walk, executing _HID methods to find the + * EC device. + * + ******************************************************************************/ + +static void +AcpiEvOrphanEcRegMethod ( + void) +{ + ACPI_TABLE_ECDT *Table; + ACPI_STATUS Status; + ACPI_OBJECT_LIST Args; + ACPI_OBJECT Objects[2]; + ACPI_NAMESPACE_NODE *EcDeviceNode; + ACPI_NAMESPACE_NODE *RegMethod; + ACPI_NAMESPACE_NODE *NextNode; + + + ACPI_FUNCTION_TRACE (EvOrphanEcRegMethod); + + + /* Get the ECDT (if present in system) */ + + Status = AcpiGetTable (ACPI_SIG_ECDT, 0, + ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Table)); + if (ACPI_FAILURE (Status)) + { + return_VOID; + } + + /* We need a valid EC_ID string */ + + if (!(*Table->Id)) + { + return_VOID; + } + + /* Namespace is currently locked, must release */ + + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + + /* Get a handle to the EC device referenced in the ECDT */ + + Status = AcpiGetHandle (NULL, + ACPI_CAST_PTR (char, Table->Id), + ACPI_CAST_PTR (ACPI_HANDLE, &EcDeviceNode)); + if (ACPI_FAILURE (Status)) + { + goto Exit; + } + + /* Get a handle to a _REG method immediately under the EC device */ + + Status = AcpiGetHandle (EcDeviceNode, + METHOD_NAME__REG, ACPI_CAST_PTR (ACPI_HANDLE, &RegMethod)); + if (ACPI_FAILURE (Status)) + { + goto Exit; + } + + /* + * Execute the _REG method only if there is no Operation Region in + * this scope with the Embedded Controller space ID. Otherwise, it + * will already have been executed. Note, this allows for Regions + * with other space IDs to be present; but the code below will then + * execute the _REG method with the EC space ID argument. + */ + NextNode = AcpiNsGetNextNode (EcDeviceNode, NULL); + while (NextNode) + { + if ((NextNode->Type == ACPI_TYPE_REGION) && + (NextNode->Object) && + (NextNode->Object->Region.SpaceId == ACPI_ADR_SPACE_EC)) + { + goto Exit; /* Do not execute _REG */ + } + NextNode = AcpiNsGetNextNode (EcDeviceNode, NextNode); + } + + /* Evaluate the _REG(EC,Connect) method */ + + Args.Count = 2; + Args.Pointer = Objects; + Objects[0].Type = ACPI_TYPE_INTEGER; + Objects[0].Integer.Value = ACPI_ADR_SPACE_EC; + Objects[1].Type = ACPI_TYPE_INTEGER; + Objects[1].Integer.Value = ACPI_REG_CONNECT; + + Status = AcpiEvaluateObject (RegMethod, NULL, &Args, NULL); + +Exit: + /* We ignore all errors from above, don't care */ + + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + return_VOID; +} diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evrgnini.c b/src/add-ons/kernel/bus_managers/acpi/events/evrgnini.c index 9fdda23a58..cb9a2fdcd0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evrgnini.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evrgnini.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -729,9 +729,9 @@ AcpiEvInitializeRegion ( * * See AcpiNsExecModuleCode */ - if (ObjDesc->Method.Flags & AOPOBJ_MODULE_LEVEL) + if (ObjDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL) { - HandlerObj = ObjDesc->Method.Extra.Handler; + HandlerObj = ObjDesc->Method.Dispatch.Handler; } break; @@ -768,7 +768,7 @@ AcpiEvInitializeRegion ( } } - Status = AcpiEvExecuteRegMethod (RegionObj, 1); + Status = AcpiEvExecuteRegMethod (RegionObj, ACPI_REG_CONNECT); if (AcpiNsLocked) { diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evsci.c b/src/add-ons/kernel/bus_managers/acpi/events/evsci.c index ec622d4f82..e0d9261acf 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evsci.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evsci.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evxface.c b/src/add-ons/kernel/bus_managers/acpi/events/evxface.c index 5019b66315..990ddfb0b8 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evxface.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evxface.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -175,6 +175,66 @@ Cleanup: ACPI_EXPORT_SYMBOL (AcpiInstallExceptionHandler) +/******************************************************************************* + * + * FUNCTION: AcpiInstallGlobalEventHandler + * + * PARAMETERS: Handler - Pointer to the global event handler function + * Context - Value passed to the handler on each event + * + * RETURN: Status + * + * DESCRIPTION: Saves the pointer to the handler function. The global handler + * is invoked upon each incoming GPE and Fixed Event. It is + * invoked at interrupt level at the time of the event dispatch. + * Can be used to update event counters, etc. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiInstallGlobalEventHandler ( + ACPI_GBL_EVENT_HANDLER Handler, + void *Context) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (AcpiInstallGlobalEventHandler); + + + /* Parameter validation */ + + if (!Handler) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Don't allow two handlers. */ + + if (AcpiGbl_GlobalEventHandler) + { + Status = AE_ALREADY_EXISTS; + goto Cleanup; + } + + AcpiGbl_GlobalEventHandler = Handler; + AcpiGbl_GlobalEventHandlerContext = Context; + + +Cleanup: + (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiInstallGlobalEventHandler) + + /******************************************************************************* * * FUNCTION: AcpiInstallFixedEventHandler @@ -691,11 +751,11 @@ AcpiInstallGpeHandler ( ACPI_HANDLE GpeDevice, UINT32 GpeNumber, UINT32 Type, - ACPI_EVENT_HANDLER Address, + ACPI_GPE_HANDLER Address, void *Context) { ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_HANDLER_INFO *Handler; + ACPI_GPE_HANDLER_INFO *Handler; ACPI_STATUS Status; ACPI_CPU_FLAGS Flags; @@ -716,13 +776,24 @@ AcpiInstallGpeHandler ( return_ACPI_STATUS (Status); } + /* Allocate and init handler object (before lock) */ + + Handler = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_HANDLER_INFO)); + if (!Handler) + { + Status = AE_NO_MEMORY; + goto UnlockAndExit; + } + + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + /* Ensure that we have a valid GPE number */ GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); if (!GpeEventInfo) { Status = AE_BAD_PARAMETER; - goto UnlockAndExit; + goto FreeAndExit; } /* Make sure that there isn't a handler there already */ @@ -731,28 +802,40 @@ AcpiInstallGpeHandler ( ACPI_GPE_DISPATCH_HANDLER) { Status = AE_ALREADY_EXISTS; - goto UnlockAndExit; + goto FreeAndExit; } - /* Allocate and init handler object */ - - Handler = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_HANDLER_INFO)); - if (!Handler) - { - Status = AE_NO_MEMORY; - goto UnlockAndExit; - } - - Handler->Address = Address; - Handler->Context = Context; + Handler->Address = Address; + Handler->Context = Context; Handler->MethodNode = GpeEventInfo->Dispatch.MethodNode; + Handler->OriginalFlags = (UINT8) (GpeEventInfo->Flags & + (ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK)); + + /* + * If the GPE is associated with a method, it may have been enabled + * automatically during initialization, in which case it has to be + * disabled now to avoid spurious execution of the handler. + */ + if (((Handler->OriginalFlags & ACPI_GPE_DISPATCH_METHOD) || + (Handler->OriginalFlags & ACPI_GPE_DISPATCH_NOTIFY)) && + GpeEventInfo->RuntimeCount) + { + Handler->OriginallyEnabled = TRUE; + (void) AcpiEvRemoveGpeReference (GpeEventInfo); + + /* Sanity check of original type against new type */ + + if (Type != (UINT32) (GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK)) + { + ACPI_WARNING ((AE_INFO, "GPE type mismatch (level/edge)")); + } + } /* Install the handler */ - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); GpeEventInfo->Dispatch.Handler = Handler; - /* Setup up dispatch flags to indicate handler (vs. method) */ + /* Setup up dispatch flags to indicate handler (vs. method/notify) */ GpeEventInfo->Flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); GpeEventInfo->Flags |= (UINT8) (Type | ACPI_GPE_DISPATCH_HANDLER); @@ -763,6 +846,11 @@ AcpiInstallGpeHandler ( UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); return_ACPI_STATUS (Status); + +FreeAndExit: + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + ACPI_FREE (Handler); + goto UnlockAndExit; } ACPI_EXPORT_SYMBOL (AcpiInstallGpeHandler) @@ -787,10 +875,10 @@ ACPI_STATUS AcpiRemoveGpeHandler ( ACPI_HANDLE GpeDevice, UINT32 GpeNumber, - ACPI_EVENT_HANDLER Address) + ACPI_GPE_HANDLER Address) { ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_HANDLER_INFO *Handler; + ACPI_GPE_HANDLER_INFO *Handler; ACPI_STATUS Status; ACPI_CPU_FLAGS Flags; @@ -811,6 +899,8 @@ AcpiRemoveGpeHandler ( return_ACPI_STATUS (Status); } + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + /* Ensure that we have a valid GPE number */ GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); @@ -839,18 +929,25 @@ AcpiRemoveGpeHandler ( /* Remove the handler */ - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); Handler = GpeEventInfo->Dispatch.Handler; /* Restore Method node (if any), set dispatch flags */ GpeEventInfo->Dispatch.MethodNode = Handler->MethodNode; - GpeEventInfo->Flags &= ~ACPI_GPE_DISPATCH_MASK; /* Clear bits */ - if (Handler->MethodNode) + GpeEventInfo->Flags &= + ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); + GpeEventInfo->Flags |= Handler->OriginalFlags; + + /* + * If the GPE was previously associated with a method and it was + * enabled, it should be enabled at this point to restore the + * post-initialization configuration. + */ + if ((Handler->OriginalFlags & ACPI_GPE_DISPATCH_METHOD) && + Handler->OriginallyEnabled) { - GpeEventInfo->Flags |= ACPI_GPE_DISPATCH_METHOD; + (void) AcpiEvAddGpeReference (GpeEventInfo); } - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); /* Now we can free the handler object */ @@ -858,6 +955,7 @@ AcpiRemoveGpeHandler ( UnlockAndExit: + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); return_ACPI_STATUS (Status); } diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evxfevnt.c b/src/add-ons/kernel/bus_managers/acpi/events/evxfevnt.c index 9c0e9b9ee3..437f6e3137 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evxfevnt.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evxfevnt.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -118,21 +118,11 @@ #include "acpi.h" #include "accommon.h" -#include "acevents.h" -#include "acnamesp.h" #include "actables.h" #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME ("evxfevnt") -/* Local prototypes */ - -static ACPI_STATUS -AcpiEvGetGpeDevice ( - ACPI_GPE_XRUPT_INFO *GpeXruptInfo, - ACPI_GPE_BLOCK_INFO *GpeBlock, - void *Context); - /******************************************************************************* * @@ -305,292 +295,11 @@ AcpiEnableEvent ( ACPI_EXPORT_SYMBOL (AcpiEnableEvent) -/******************************************************************************* - * - * FUNCTION: AcpiGpeWakeup - * - * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 - * GpeNumber - GPE level within the GPE block - * Action - Enable or Disable - * - * RETURN: Status - * - * DESCRIPTION: Set or clear the GPE's wakeup enable mask bit. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGpeWakeup ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - UINT8 Action) -{ - ACPI_STATUS Status = AE_OK; - ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; - ACPI_CPU_FLAGS Flags; - UINT32 RegisterBit; - - - ACPI_FUNCTION_TRACE (AcpiGpeWakeup); - - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - - /* Ensure that we have a valid GPE number */ - - GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); - if (!GpeEventInfo) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - GpeRegisterInfo = GpeEventInfo->RegisterInfo; - if (!GpeRegisterInfo) - { - Status = AE_NOT_EXIST; - goto UnlockAndExit; - } - - RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo); - - /* Perform the action */ - - switch (Action) - { - case ACPI_GPE_ENABLE: - ACPI_SET_BIT (GpeRegisterInfo->EnableForWake, (UINT8) RegisterBit); - break; - - case ACPI_GPE_DISABLE: - ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForWake, (UINT8) RegisterBit); - break; - - default: - ACPI_ERROR ((AE_INFO, "%u, Invalid action", Action)); - Status = AE_BAD_PARAMETER; - break; - } - -UnlockAndExit: - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiGpeWakeup) - - -/******************************************************************************* - * - * FUNCTION: AcpiEnableGpe - * - * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 - * GpeNumber - GPE level within the GPE block - * - * RETURN: Status - * - * DESCRIPTION: Add a reference to a GPE. On the first reference, the GPE is - * hardware-enabled. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEnableGpe ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber) -{ - ACPI_STATUS Status = AE_OK; - ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_CPU_FLAGS Flags; - - - ACPI_FUNCTION_TRACE (AcpiEnableGpe); - - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - - /* Ensure that we have a valid GPE number */ - - GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); - if (!GpeEventInfo) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - if (GpeEventInfo->RuntimeCount == ACPI_UINT8_MAX) - { - Status = AE_LIMIT; /* Too many references */ - goto UnlockAndExit; - } - - GpeEventInfo->RuntimeCount++; - if (GpeEventInfo->RuntimeCount == 1) - { - Status = AcpiEvUpdateGpeEnableMask (GpeEventInfo); - if (ACPI_SUCCESS (Status)) - { - Status = AcpiEvEnableGpe (GpeEventInfo); - } - if (ACPI_FAILURE (Status)) - { - GpeEventInfo->RuntimeCount--; - } - } - -UnlockAndExit: - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiEnableGpe) - - -/******************************************************************************* - * - * FUNCTION: AcpiDisableGpe - * - * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 - * GpeNumber - GPE level within the GPE block - * - * RETURN: Status - * - * DESCRIPTION: Remove a reference to a GPE. When the last reference is - * removed, only then is the GPE disabled (for runtime GPEs), or - * the GPE mask bit disabled (for wake GPEs) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDisableGpe ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber) -{ - ACPI_STATUS Status = AE_OK; - ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_CPU_FLAGS Flags; - - - ACPI_FUNCTION_TRACE (AcpiDisableGpe); - - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - - /* Ensure that we have a valid GPE number */ - - GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); - if (!GpeEventInfo) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - /* Hardware-disable a runtime GPE on removal of the last reference */ - - if (!GpeEventInfo->RuntimeCount) - { - Status = AE_LIMIT; /* There are no references to remove */ - goto UnlockAndExit; - } - - GpeEventInfo->RuntimeCount--; - if (!GpeEventInfo->RuntimeCount) - { - Status = AcpiEvUpdateGpeEnableMask (GpeEventInfo); - if (ACPI_SUCCESS (Status)) - { - Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE); - } - if (ACPI_FAILURE (Status)) - { - GpeEventInfo->RuntimeCount++; - } - } - -UnlockAndExit: - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiDisableGpe) - - -/******************************************************************************* - * - * FUNCTION: AcpiSetGpe - * - * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 - * GpeNumber - GPE level within the GPE block - * Action - ACPI_GPE_ENABLE or ACPI_GPE_DISABLE - * - * RETURN: Status - * - * DESCRIPTION: Enable or disable an individual GPE. This function bypasses - * the reference count mechanism used in the AcpiEnableGpe and - * AcpiDisableGpe interfaces -- and should be used with care. - * - * Note: Typically used to disable a runtime GPE for short period of time, - * then re-enable it, without disturbing the existing reference counts. This - * is useful, for example, in the Embedded Controller (EC) driver. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiSetGpe ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - UINT8 Action) -{ - ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_STATUS Status; - ACPI_CPU_FLAGS Flags; - - - ACPI_FUNCTION_TRACE (AcpiSetGpe); - - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - - /* Ensure that we have a valid GPE number */ - - GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); - if (!GpeEventInfo) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - /* Perform the action */ - - switch (Action) - { - case ACPI_GPE_ENABLE: - Status = AcpiEvEnableGpe (GpeEventInfo); - break; - - case ACPI_GPE_DISABLE: - Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE); - break; - - default: - Status = AE_BAD_PARAMETER; - break; - } - -UnlockAndExit: - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiSetGpe) - - /******************************************************************************* * * FUNCTION: AcpiDisableEvent * - * PARAMETERS: Event - The fixed eventto be enabled + * PARAMETERS: Event - The fixed event to be disabled * Flags - Reserved * * RETURN: Status @@ -693,53 +402,6 @@ AcpiClearEvent ( ACPI_EXPORT_SYMBOL (AcpiClearEvent) -/******************************************************************************* - * - * FUNCTION: AcpiClearGpe - * - * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 - * GpeNumber - GPE level within the GPE block - * - * RETURN: Status - * - * DESCRIPTION: Clear an ACPI event (general purpose) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiClearGpe ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber) -{ - ACPI_STATUS Status = AE_OK; - ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_CPU_FLAGS Flags; - - - ACPI_FUNCTION_TRACE (AcpiClearGpe); - - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - - /* Ensure that we have a valid GPE number */ - - GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); - if (!GpeEventInfo) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - Status = AcpiHwClearGpe (GpeEventInfo); - -UnlockAndExit: - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiClearGpe) - - /******************************************************************************* * * FUNCTION: AcpiGetEventStatus @@ -788,400 +450,3 @@ AcpiGetEventStatus ( ACPI_EXPORT_SYMBOL (AcpiGetEventStatus) -/******************************************************************************* - * - * FUNCTION: AcpiGetGpeStatus - * - * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 - * GpeNumber - GPE level within the GPE block - * EventStatus - Where the current status of the event will - * be returned - * - * RETURN: Status - * - * DESCRIPTION: Get status of an event (general purpose) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetGpeStatus ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - ACPI_EVENT_STATUS *EventStatus) -{ - ACPI_STATUS Status = AE_OK; - ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_CPU_FLAGS Flags; - - - ACPI_FUNCTION_TRACE (AcpiGetGpeStatus); - - - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - - /* Ensure that we have a valid GPE number */ - - GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); - if (!GpeEventInfo) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - /* Obtain status on the requested GPE number */ - - Status = AcpiHwGetGpeStatus (GpeEventInfo, EventStatus); - -UnlockAndExit: - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiGetGpeStatus) - - -/******************************************************************************* - * - * FUNCTION: AcpiInstallGpeBlock - * - * PARAMETERS: GpeDevice - Handle to the parent GPE Block Device - * GpeBlockAddress - Address and SpaceID - * RegisterCount - Number of GPE register pairs in the block - * InterruptNumber - H/W interrupt for the block - * - * RETURN: Status - * - * DESCRIPTION: Create and Install a block of GPE registers - * - ******************************************************************************/ - -ACPI_STATUS -AcpiInstallGpeBlock ( - ACPI_HANDLE GpeDevice, - ACPI_GENERIC_ADDRESS *GpeBlockAddress, - UINT32 RegisterCount, - UINT32 InterruptNumber) -{ - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_NAMESPACE_NODE *Node; - ACPI_GPE_BLOCK_INFO *GpeBlock; - - - ACPI_FUNCTION_TRACE (AcpiInstallGpeBlock); - - - if ((!GpeDevice) || - (!GpeBlockAddress) || - (!RegisterCount)) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - Node = AcpiNsValidateHandle (GpeDevice); - if (!Node) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - /* - * For user-installed GPE Block Devices, the GpeBlockBaseNumber - * is always zero - */ - Status = AcpiEvCreateGpeBlock (Node, GpeBlockAddress, RegisterCount, - 0, InterruptNumber, &GpeBlock); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - - /* Install block in the DeviceObject attached to the node */ - - ObjDesc = AcpiNsGetAttachedObject (Node); - if (!ObjDesc) - { - /* - * No object, create a new one (Device nodes do not always have - * an attached object) - */ - ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_DEVICE); - if (!ObjDesc) - { - Status = AE_NO_MEMORY; - goto UnlockAndExit; - } - - Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_DEVICE); - - /* Remove local reference to the object */ - - AcpiUtRemoveReference (ObjDesc); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - } - - /* Now install the GPE block in the DeviceObject */ - - ObjDesc->Device.GpeBlock = GpeBlock; - - /* Run the _PRW methods and enable the runtime GPEs in the new block */ - - Status = AcpiEvInitializeGpeBlock (Node, GpeBlock); - - -UnlockAndExit: - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiInstallGpeBlock) - - -/******************************************************************************* - * - * FUNCTION: AcpiRemoveGpeBlock - * - * PARAMETERS: GpeDevice - Handle to the parent GPE Block Device - * - * RETURN: Status - * - * DESCRIPTION: Remove a previously installed block of GPE registers - * - ******************************************************************************/ - -ACPI_STATUS -AcpiRemoveGpeBlock ( - ACPI_HANDLE GpeDevice) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; - - - ACPI_FUNCTION_TRACE (AcpiRemoveGpeBlock); - - - if (!GpeDevice) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - Node = AcpiNsValidateHandle (GpeDevice); - if (!Node) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - /* Get the DeviceObject attached to the node */ - - ObjDesc = AcpiNsGetAttachedObject (Node); - if (!ObjDesc || - !ObjDesc->Device.GpeBlock) - { - return_ACPI_STATUS (AE_NULL_OBJECT); - } - - /* Delete the GPE block (but not the DeviceObject) */ - - Status = AcpiEvDeleteGpeBlock (ObjDesc->Device.GpeBlock); - if (ACPI_SUCCESS (Status)) - { - ObjDesc->Device.GpeBlock = NULL; - } - -UnlockAndExit: - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiRemoveGpeBlock) - - -/******************************************************************************* - * - * FUNCTION: AcpiGetGpeDevice - * - * PARAMETERS: Index - System GPE index (0-CurrentGpeCount) - * GpeDevice - Where the parent GPE Device is returned - * - * RETURN: Status - * - * DESCRIPTION: Obtain the GPE device associated with the input index. A NULL - * gpe device indicates that the gpe number is contained in one of - * the FADT-defined gpe blocks. Otherwise, the GPE block device. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetGpeDevice ( - UINT32 Index, - ACPI_HANDLE *GpeDevice) -{ - ACPI_GPE_DEVICE_INFO Info; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiGetGpeDevice); - - - if (!GpeDevice) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - if (Index >= AcpiCurrentGpeCount) - { - return_ACPI_STATUS (AE_NOT_EXIST); - } - - /* Setup and walk the GPE list */ - - Info.Index = Index; - Info.Status = AE_NOT_EXIST; - Info.GpeDevice = NULL; - Info.NextBlockBaseIndex = 0; - - Status = AcpiEvWalkGpeList (AcpiEvGetGpeDevice, &Info); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - *GpeDevice = ACPI_CAST_PTR (ACPI_HANDLE, Info.GpeDevice); - return_ACPI_STATUS (Info.Status); -} - -ACPI_EXPORT_SYMBOL (AcpiGetGpeDevice) - - -/******************************************************************************* - * - * FUNCTION: AcpiEvGetGpeDevice - * - * PARAMETERS: GPE_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Matches the input GPE index (0-CurrentGpeCount) with a GPE - * block device. NULL if the GPE is one of the FADT-defined GPEs. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiEvGetGpeDevice ( - ACPI_GPE_XRUPT_INFO *GpeXruptInfo, - ACPI_GPE_BLOCK_INFO *GpeBlock, - void *Context) -{ - ACPI_GPE_DEVICE_INFO *Info = Context; - - - /* Increment Index by the number of GPEs in this block */ - - Info->NextBlockBaseIndex += GpeBlock->GpeCount; - - if (Info->Index < Info->NextBlockBaseIndex) - { - /* - * The GPE index is within this block, get the node. Leave the node - * NULL for the FADT-defined GPEs - */ - if ((GpeBlock->Node)->Type == ACPI_TYPE_DEVICE) - { - Info->GpeDevice = GpeBlock->Node; - } - - Info->Status = AE_OK; - return (AE_CTRL_END); - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiDisableAllGpes - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Disable and clear all GPEs in all GPE blocks - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDisableAllGpes ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiDisableAllGpes); - - - Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiHwDisableAllGpes (); - (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); - - return_ACPI_STATUS (Status); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiEnableAllRuntimeGpes - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEnableAllRuntimeGpes ( - void) -{ - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiEnableAllRuntimeGpes); - - - Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiHwEnableAllRuntimeGpes (); - (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); - - return_ACPI_STATUS (Status); -} - - diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evxfgpe.c b/src/add-ons/kernel/bus_managers/acpi/events/evxfgpe.c new file mode 100644 index 0000000000..8cd73b3648 --- /dev/null +++ b/src/add-ons/kernel/bus_managers/acpi/events/evxfgpe.c @@ -0,0 +1,972 @@ +/****************************************************************************** + * + * Module Name: evxfgpe - External Interfaces for General Purpose Events (GPEs) + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + + +#define __EVXFGPE_C__ + +#include "acpi.h" +#include "accommon.h" +#include "acevents.h" +#include "acnamesp.h" + +#define _COMPONENT ACPI_EVENTS + ACPI_MODULE_NAME ("evxfgpe") + + +/******************************************************************************* + * + * FUNCTION: AcpiUpdateAllGpes + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Complete GPE initialization and enable all GPEs that have + * associated _Lxx or _Exx methods and are not pointed to by any + * device _PRW methods (this indicates that these GPEs are + * generally intended for system or device wakeup. Such GPEs + * have to be enabled directly when the devices whose _PRW + * methods point to them are set up for wakeup signaling.) + * + * NOTE: Should be called after any GPEs are added to the system. Primarily, + * after the system _PRW methods have been run, but also after a GPE Block + * Device has been added or if any new GPE methods have been added via a + * dynamic table load. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUpdateAllGpes ( + void) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (AcpiUpdateGpes); + + + Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + if (AcpiGbl_AllGpesInitialized) + { + goto UnlockAndExit; + } + + Status = AcpiEvWalkGpeList (AcpiEvInitializeGpeBlock, NULL); + if (ACPI_SUCCESS (Status)) + { + AcpiGbl_AllGpesInitialized = TRUE; + } + +UnlockAndExit: + (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiUpdateAllGpes) + + +/******************************************************************************* + * + * FUNCTION: AcpiEnableGpe + * + * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 + * GpeNumber - GPE level within the GPE block + * + * RETURN: Status + * + * DESCRIPTION: Add a reference to a GPE. On the first reference, the GPE is + * hardware-enabled. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEnableGpe ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber) +{ + ACPI_STATUS Status = AE_BAD_PARAMETER; + ACPI_GPE_EVENT_INFO *GpeEventInfo; + ACPI_CPU_FLAGS Flags; + + + ACPI_FUNCTION_TRACE (AcpiEnableGpe); + + + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + + /* Ensure that we have a valid GPE number */ + + GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); + if (GpeEventInfo) + { + Status = AcpiEvAddGpeReference (GpeEventInfo); + } + + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiEnableGpe) + + +/******************************************************************************* + * + * FUNCTION: AcpiDisableGpe + * + * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 + * GpeNumber - GPE level within the GPE block + * + * RETURN: Status + * + * DESCRIPTION: Remove a reference to a GPE. When the last reference is + * removed, only then is the GPE disabled (for runtime GPEs), or + * the GPE mask bit disabled (for wake GPEs) + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDisableGpe ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber) +{ + ACPI_STATUS Status = AE_BAD_PARAMETER; + ACPI_GPE_EVENT_INFO *GpeEventInfo; + ACPI_CPU_FLAGS Flags; + + + ACPI_FUNCTION_TRACE (AcpiDisableGpe); + + + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + + /* Ensure that we have a valid GPE number */ + + GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); + if (GpeEventInfo) + { + Status = AcpiEvRemoveGpeReference (GpeEventInfo); + } + + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiDisableGpe) + + +/******************************************************************************* + * + * FUNCTION: AcpiSetGpe + * + * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 + * GpeNumber - GPE level within the GPE block + * Action - ACPI_GPE_ENABLE or ACPI_GPE_DISABLE + * + * RETURN: Status + * + * DESCRIPTION: Enable or disable an individual GPE. This function bypasses + * the reference count mechanism used in the AcpiEnableGpe and + * AcpiDisableGpe interfaces -- and should be used with care. + * + * Note: Typically used to disable a runtime GPE for short period of time, + * then re-enable it, without disturbing the existing reference counts. This + * is useful, for example, in the Embedded Controller (EC) driver. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiSetGpe ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber, + UINT8 Action) +{ + ACPI_GPE_EVENT_INFO *GpeEventInfo; + ACPI_STATUS Status; + ACPI_CPU_FLAGS Flags; + + + ACPI_FUNCTION_TRACE (AcpiSetGpe); + + + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + + /* Ensure that we have a valid GPE number */ + + GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); + if (!GpeEventInfo) + { + Status = AE_BAD_PARAMETER; + goto UnlockAndExit; + } + + /* Perform the action */ + + switch (Action) + { + case ACPI_GPE_ENABLE: + Status = AcpiEvEnableGpe (GpeEventInfo); + break; + + case ACPI_GPE_DISABLE: + Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE); + break; + + default: + Status = AE_BAD_PARAMETER; + break; + } + +UnlockAndExit: + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiSetGpe) + + +/******************************************************************************* + * + * FUNCTION: AcpiSetupGpeForWake + * + * PARAMETERS: WakeDevice - Device associated with the GPE (via _PRW) + * GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 + * GpeNumber - GPE level within the GPE block + * + * RETURN: Status + * + * DESCRIPTION: Mark a GPE as having the ability to wake the system. This + * interface is intended to be used as the host executes the + * _PRW methods (Power Resources for Wake) in the system tables. + * Each _PRW appears under a Device Object (The WakeDevice), and + * contains the info for the wake GPE associated with the + * WakeDevice. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiSetupGpeForWake ( + ACPI_HANDLE WakeDevice, + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber) +{ + ACPI_STATUS Status = AE_BAD_PARAMETER; + ACPI_GPE_EVENT_INFO *GpeEventInfo; + ACPI_NAMESPACE_NODE *DeviceNode; + ACPI_CPU_FLAGS Flags; + + + ACPI_FUNCTION_TRACE (AcpiSetupGpeForWake); + + + /* Parameter Validation */ + + if (!WakeDevice) + { + /* + * By forcing WakeDevice to be valid, we automatically enable the + * implicit notify feature on all hosts. + */ + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + /* Handle root object case */ + + if (WakeDevice == ACPI_ROOT_OBJECT) + { + DeviceNode = AcpiGbl_RootNode; + } + else + { + DeviceNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, WakeDevice); + } + + /* Validate WakeDevice is of type Device */ + + if (DeviceNode->Type != ACPI_TYPE_DEVICE) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + + /* Ensure that we have a valid GPE number */ + + GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); + if (GpeEventInfo) + { + /* + * If there is no method or handler for this GPE, then the + * WakeDevice will be notified whenever this GPE fires (aka + * "implicit notify") Note: The GPE is assumed to be + * level-triggered (for windows compatibility). + */ + if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == + ACPI_GPE_DISPATCH_NONE) + { + GpeEventInfo->Flags = + (ACPI_GPE_DISPATCH_NOTIFY | ACPI_GPE_LEVEL_TRIGGERED); + GpeEventInfo->Dispatch.DeviceNode = DeviceNode; + } + + GpeEventInfo->Flags |= ACPI_GPE_CAN_WAKE; + Status = AE_OK; + } + + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiSetupGpeForWake) + + +/******************************************************************************* + * + * FUNCTION: AcpiSetGpeWakeMask + * + * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 + * GpeNumber - GPE level within the GPE block + * Action - Enable or Disable + * + * RETURN: Status + * + * DESCRIPTION: Set or clear the GPE's wakeup enable mask bit. The GPE must + * already be marked as a WAKE GPE. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiSetGpeWakeMask ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber, + UINT8 Action) +{ + ACPI_STATUS Status = AE_OK; + ACPI_GPE_EVENT_INFO *GpeEventInfo; + ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; + ACPI_CPU_FLAGS Flags; + UINT32 RegisterBit; + + + ACPI_FUNCTION_TRACE (AcpiSetGpeWakeMask); + + + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + + /* + * Ensure that we have a valid GPE number and that this GPE is in + * fact a wake GPE + */ + GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); + if (!GpeEventInfo) + { + Status = AE_BAD_PARAMETER; + goto UnlockAndExit; + } + + if (!(GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE)) + { + Status = AE_TYPE; + goto UnlockAndExit; + } + + GpeRegisterInfo = GpeEventInfo->RegisterInfo; + if (!GpeRegisterInfo) + { + Status = AE_NOT_EXIST; + goto UnlockAndExit; + } + + RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo); + + /* Perform the action */ + + switch (Action) + { + case ACPI_GPE_ENABLE: + ACPI_SET_BIT (GpeRegisterInfo->EnableForWake, (UINT8) RegisterBit); + break; + + case ACPI_GPE_DISABLE: + ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForWake, (UINT8) RegisterBit); + break; + + default: + ACPI_ERROR ((AE_INFO, "%u, Invalid action", Action)); + Status = AE_BAD_PARAMETER; + break; + } + +UnlockAndExit: + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiSetGpeWakeMask) + + +/******************************************************************************* + * + * FUNCTION: AcpiClearGpe + * + * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 + * GpeNumber - GPE level within the GPE block + * + * RETURN: Status + * + * DESCRIPTION: Clear an ACPI event (general purpose) + * + ******************************************************************************/ + +ACPI_STATUS +AcpiClearGpe ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber) +{ + ACPI_STATUS Status = AE_OK; + ACPI_GPE_EVENT_INFO *GpeEventInfo; + ACPI_CPU_FLAGS Flags; + + + ACPI_FUNCTION_TRACE (AcpiClearGpe); + + + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + + /* Ensure that we have a valid GPE number */ + + GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); + if (!GpeEventInfo) + { + Status = AE_BAD_PARAMETER; + goto UnlockAndExit; + } + + Status = AcpiHwClearGpe (GpeEventInfo); + +UnlockAndExit: + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiClearGpe) + + +/******************************************************************************* + * + * FUNCTION: AcpiGetGpeStatus + * + * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1 + * GpeNumber - GPE level within the GPE block + * EventStatus - Where the current status of the event + * will be returned + * + * RETURN: Status + * + * DESCRIPTION: Get the current status of a GPE (signalled/not_signalled) + * + ******************************************************************************/ + +ACPI_STATUS +AcpiGetGpeStatus ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber, + ACPI_EVENT_STATUS *EventStatus) +{ + ACPI_STATUS Status = AE_OK; + ACPI_GPE_EVENT_INFO *GpeEventInfo; + ACPI_CPU_FLAGS Flags; + + + ACPI_FUNCTION_TRACE (AcpiGetGpeStatus); + + + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + + /* Ensure that we have a valid GPE number */ + + GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); + if (!GpeEventInfo) + { + Status = AE_BAD_PARAMETER; + goto UnlockAndExit; + } + + /* Obtain status on the requested GPE number */ + + Status = AcpiHwGetGpeStatus (GpeEventInfo, EventStatus); + +UnlockAndExit: + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiGetGpeStatus) + + +/******************************************************************************* + * + * FUNCTION: AcpiFinishGpe + * + * PARAMETERS: GpeDevice - Namespace node for the GPE Block + * (NULL for FADT defined GPEs) + * GpeNumber - GPE level within the GPE block + * + * RETURN: Status + * + * DESCRIPTION: Clear and conditionally reenable a GPE. This completes the GPE + * processing. Intended for use by asynchronous host-installed + * GPE handlers. The GPE is only reenabled if the EnableForRun bit + * is set in the GPE info. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiFinishGpe ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber) +{ + ACPI_GPE_EVENT_INFO *GpeEventInfo; + ACPI_STATUS Status; + ACPI_CPU_FLAGS Flags; + + + ACPI_FUNCTION_TRACE (AcpiFinishGpe); + + + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + + /* Ensure that we have a valid GPE number */ + + GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); + if (!GpeEventInfo) + { + Status = AE_BAD_PARAMETER; + goto UnlockAndExit; + } + + Status = AcpiEvFinishGpe (GpeEventInfo); + +UnlockAndExit: + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiFinishGpe) + + +/****************************************************************************** + * + * FUNCTION: AcpiDisableAllGpes + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Disable and clear all GPEs in all GPE blocks + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDisableAllGpes ( + void) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (AcpiDisableAllGpes); + + + Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + Status = AcpiHwDisableAllGpes (); + (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); + + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiDisableAllGpes) + + +/****************************************************************************** + * + * FUNCTION: AcpiEnableAllRuntimeGpes + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEnableAllRuntimeGpes ( + void) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (AcpiEnableAllRuntimeGpes); + + + Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + Status = AcpiHwEnableAllRuntimeGpes (); + (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); + + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiEnableAllRuntimeGpes) + + +/******************************************************************************* + * + * FUNCTION: AcpiInstallGpeBlock + * + * PARAMETERS: GpeDevice - Handle to the parent GPE Block Device + * GpeBlockAddress - Address and SpaceID + * RegisterCount - Number of GPE register pairs in the block + * InterruptNumber - H/W interrupt for the block + * + * RETURN: Status + * + * DESCRIPTION: Create and Install a block of GPE registers. The GPEs are not + * enabled here. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiInstallGpeBlock ( + ACPI_HANDLE GpeDevice, + ACPI_GENERIC_ADDRESS *GpeBlockAddress, + UINT32 RegisterCount, + UINT32 InterruptNumber) +{ + ACPI_STATUS Status; + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_NAMESPACE_NODE *Node; + ACPI_GPE_BLOCK_INFO *GpeBlock; + + + ACPI_FUNCTION_TRACE (AcpiInstallGpeBlock); + + + if ((!GpeDevice) || + (!GpeBlockAddress) || + (!RegisterCount)) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + Node = AcpiNsValidateHandle (GpeDevice); + if (!Node) + { + Status = AE_BAD_PARAMETER; + goto UnlockAndExit; + } + + /* + * For user-installed GPE Block Devices, the GpeBlockBaseNumber + * is always zero + */ + Status = AcpiEvCreateGpeBlock (Node, GpeBlockAddress, RegisterCount, + 0, InterruptNumber, &GpeBlock); + if (ACPI_FAILURE (Status)) + { + goto UnlockAndExit; + } + + /* Install block in the DeviceObject attached to the node */ + + ObjDesc = AcpiNsGetAttachedObject (Node); + if (!ObjDesc) + { + /* + * No object, create a new one (Device nodes do not always have + * an attached object) + */ + ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_DEVICE); + if (!ObjDesc) + { + Status = AE_NO_MEMORY; + goto UnlockAndExit; + } + + Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_DEVICE); + + /* Remove local reference to the object */ + + AcpiUtRemoveReference (ObjDesc); + if (ACPI_FAILURE (Status)) + { + goto UnlockAndExit; + } + } + + /* Now install the GPE block in the DeviceObject */ + + ObjDesc->Device.GpeBlock = GpeBlock; + + +UnlockAndExit: + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiInstallGpeBlock) + + +/******************************************************************************* + * + * FUNCTION: AcpiRemoveGpeBlock + * + * PARAMETERS: GpeDevice - Handle to the parent GPE Block Device + * + * RETURN: Status + * + * DESCRIPTION: Remove a previously installed block of GPE registers + * + ******************************************************************************/ + +ACPI_STATUS +AcpiRemoveGpeBlock ( + ACPI_HANDLE GpeDevice) +{ + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_STATUS Status; + ACPI_NAMESPACE_NODE *Node; + + + ACPI_FUNCTION_TRACE (AcpiRemoveGpeBlock); + + + if (!GpeDevice) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + Node = AcpiNsValidateHandle (GpeDevice); + if (!Node) + { + Status = AE_BAD_PARAMETER; + goto UnlockAndExit; + } + + /* Get the DeviceObject attached to the node */ + + ObjDesc = AcpiNsGetAttachedObject (Node); + if (!ObjDesc || + !ObjDesc->Device.GpeBlock) + { + return_ACPI_STATUS (AE_NULL_OBJECT); + } + + /* Delete the GPE block (but not the DeviceObject) */ + + Status = AcpiEvDeleteGpeBlock (ObjDesc->Device.GpeBlock); + if (ACPI_SUCCESS (Status)) + { + ObjDesc->Device.GpeBlock = NULL; + } + +UnlockAndExit: + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiRemoveGpeBlock) + + +/******************************************************************************* + * + * FUNCTION: AcpiGetGpeDevice + * + * PARAMETERS: Index - System GPE index (0-CurrentGpeCount) + * GpeDevice - Where the parent GPE Device is returned + * + * RETURN: Status + * + * DESCRIPTION: Obtain the GPE device associated with the input index. A NULL + * gpe device indicates that the gpe number is contained in one of + * the FADT-defined gpe blocks. Otherwise, the GPE block device. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiGetGpeDevice ( + UINT32 Index, + ACPI_HANDLE *GpeDevice) +{ + ACPI_GPE_DEVICE_INFO Info; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (AcpiGetGpeDevice); + + + if (!GpeDevice) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + if (Index >= AcpiCurrentGpeCount) + { + return_ACPI_STATUS (AE_NOT_EXIST); + } + + /* Setup and walk the GPE list */ + + Info.Index = Index; + Info.Status = AE_NOT_EXIST; + Info.GpeDevice = NULL; + Info.NextBlockBaseIndex = 0; + + Status = AcpiEvWalkGpeList (AcpiEvGetGpeDevice, &Info); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + *GpeDevice = ACPI_CAST_PTR (ACPI_HANDLE, Info.GpeDevice); + return_ACPI_STATUS (Info.Status); +} + +ACPI_EXPORT_SYMBOL (AcpiGetGpeDevice) diff --git a/src/add-ons/kernel/bus_managers/acpi/events/evxfregn.c b/src/add-ons/kernel/bus_managers/acpi/events/evxfregn.c index 9803861cd1..552b0e0f47 100644 --- a/src/add-ons/kernel/bus_managers/acpi/events/evxfregn.c +++ b/src/add-ons/kernel/bus_managers/acpi/events/evxfregn.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -192,10 +192,43 @@ AcpiInstallAddressSpaceHandler ( goto UnlockAndExit; } + /* + * For the default SpaceIDs, (the IDs for which there are default region handlers + * installed) Only execute the _REG methods if the global initialization _REG + * methods have already been run (via AcpiInitializeObjects). In other words, + * we will defer the execution of the _REG methods for these SpaceIDs until + * execution of AcpiInitializeObjects. This is done because we need the handlers + * for the default spaces (mem/io/pci/table) to be installed before we can run + * any control methods (or _REG methods). There is known BIOS code that depends + * on this. + * + * For all other SpaceIDs, we can safely execute the _REG methods immediately. + * This means that for IDs like EmbeddedController, this function should be called + * only after AcpiEnableSubsystem has been called. + */ + switch (SpaceId) + { + case ACPI_ADR_SPACE_SYSTEM_MEMORY: + case ACPI_ADR_SPACE_SYSTEM_IO: + case ACPI_ADR_SPACE_PCI_CONFIG: + case ACPI_ADR_SPACE_DATA_TABLE: + + if (!AcpiGbl_RegMethodsExecuted) + { + /* We will defer execution of the _REG methods for this space */ + goto UnlockAndExit; + } + break; + + default: + break; + } + /* Run all _REG methods for this address space */ Status = AcpiEvExecuteRegMethods (Node, SpaceId); + UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return_ACPI_STATUS (Status); diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exconfig.c b/src/add-ons/kernel/bus_managers/acpi/executer/exconfig.c index ab2be8a83d..341a05bac3 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exconfig.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exconfig.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -206,8 +206,11 @@ AcpiExAddTable ( AcpiNsExecModuleCodeList (); AcpiExEnterInterpreter (); - /* Update GPEs for any new _PRW or _Lxx/_Exx methods. Ignore errors */ - + /* + * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is + * responsible for discovering any new wake GPEs by running _PRW methods + * that may have been loaded by this table. + */ Status = AcpiTbGetOwnerId (TableIndex, &OwnerId); if (ACPI_SUCCESS (Status)) { diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exconvrt.c b/src/add-ons/kernel/bus_managers/acpi/executer/exconvrt.c index d0831a32ca..67a0a26dce 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exconvrt.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exconvrt.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/excreate.c b/src/add-ons/kernel/bus_managers/acpi/executer/excreate.c index 87c4f8a8f9..a9b92c16f3 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/excreate.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/excreate.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -400,7 +400,8 @@ AcpiExCreateRegion ( * range */ if ((RegionSpace >= ACPI_NUM_PREDEFINED_REGIONS) && - (RegionSpace < ACPI_USER_REGION_BEGIN)) + (RegionSpace < ACPI_USER_REGION_BEGIN) && + (RegionSpace != ACPI_ADR_SPACE_DATA_TABLE)) { ACPI_ERROR ((AE_INFO, "Invalid AddressSpace type 0x%X", RegionSpace)); return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID); @@ -595,12 +596,10 @@ AcpiExCreateMethod ( ObjDesc->Method.AmlLength = AmlLength; /* - * Disassemble the method flags. Split off the Arg Count - * for efficiency + * Disassemble the method flags. Split off the ArgCount, Serialized + * flag, and SyncLevel for efficiency. */ MethodFlags = (UINT8) Operand[1]->Integer.Value; - - ObjDesc->Method.MethodFlags = (UINT8) (MethodFlags & ~AML_METHOD_ARG_COUNT); ObjDesc->Method.ParamCount = (UINT8) (MethodFlags & AML_METHOD_ARG_COUNT); /* @@ -609,6 +608,8 @@ AcpiExCreateMethod ( */ if (MethodFlags & AML_METHOD_SERIALIZED) { + ObjDesc->Method.InfoFlags = ACPI_METHOD_SERIALIZED; + /* * ACPI 1.0: SyncLevel = 0 * ACPI 2.0: SyncLevel = SyncLevel in method declaration diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exdebug.c b/src/add-ons/kernel/bus_managers/acpi/executer/exdebug.c index 7347c71f1d..b1d7e072de 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exdebug.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exdebug.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exdump.c b/src/add-ons/kernel/bus_managers/acpi/executer/exdump.c index 404a54351f..44f7d3ba5a 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exdump.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exdump.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -216,7 +216,7 @@ static ACPI_EXDUMP_INFO AcpiExDumpEvent[2] = static ACPI_EXDUMP_INFO AcpiExDumpMethod[9] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpMethod), NULL}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.MethodFlags), "Method Flags"}, + {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.InfoFlags), "Info Flags"}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.ParamCount), "Parameter Count"}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.SyncLevel), "Sync Level"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Method.Mutex), "Mutex"}, diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exfield.c b/src/add-ons/kernel/bus_managers/acpi/executer/exfield.c index ad1209da4f..3cec69aafc 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exfield.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exfield.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exfldio.c b/src/add-ons/kernel/bus_managers/acpi/executer/exfldio.c index 5ba1b44c55..55aacef4a4 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exfldio.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exfldio.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -370,14 +370,14 @@ AcpiExAccessRegion ( if (Status == AE_NOT_IMPLEMENTED) { ACPI_ERROR ((AE_INFO, - "Region %s(0x%X) not implemented", + "Region %s (ID=%u) not implemented", AcpiUtGetRegionName (RgnDesc->Region.SpaceId), RgnDesc->Region.SpaceId)); } else if (Status == AE_NOT_EXIST) { ACPI_ERROR ((AE_INFO, - "Region %s(0x%X) has no handler", + "Region %s (ID=%u) has no handler", AcpiUtGetRegionName (RgnDesc->Region.SpaceId), RgnDesc->Region.SpaceId)); } diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exmisc.c b/src/add-ons/kernel/bus_managers/acpi/executer/exmisc.c index fb3bec984c..41a6d3aadf 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exmisc.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exmisc.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exmutex.c b/src/add-ons/kernel/bus_managers/acpi/executer/exmutex.c index 4f7421d4a2..1ce899289b 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exmutex.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exmutex.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exnames.c b/src/add-ons/kernel/bus_managers/acpi/executer/exnames.c index 9a2b6e48f4..8fd609823b 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exnames.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exnames.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exoparg1.c b/src/add-ons/kernel/bus_managers/acpi/executer/exoparg1.c index 7a47bb102d..5b37a5e066 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exoparg1.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exoparg1.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exoparg2.c b/src/add-ons/kernel/bus_managers/acpi/executer/exoparg2.c index 6df45ea8ab..b7c19ec775 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exoparg2.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exoparg2.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exoparg3.c b/src/add-ons/kernel/bus_managers/acpi/executer/exoparg3.c index 2bdd56e7dc..e583c53697 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exoparg3.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exoparg3.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exoparg6.c b/src/add-ons/kernel/bus_managers/acpi/executer/exoparg6.c index 0c540ed281..92afffcdea 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exoparg6.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exoparg6.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exprep.c b/src/add-ons/kernel/bus_managers/acpi/executer/exprep.c index 6241404973..3355eac2e5 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exprep.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exprep.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exregion.c b/src/add-ons/kernel/bus_managers/acpi/executer/exregion.c index fb84d03000..2a308dbeee 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exregion.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exregion.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exresnte.c b/src/add-ons/kernel/bus_managers/acpi/executer/exresnte.c index 59eef550c1..494d154125 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exresnte.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exresnte.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exresolv.c b/src/add-ons/kernel/bus_managers/acpi/executer/exresolv.c index f965293c78..27a6c5273d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exresolv.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exresolv.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exresop.c b/src/add-ons/kernel/bus_managers/acpi/executer/exresop.c index b9700d6dad..3a6be3bba9 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exresop.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exresop.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exstore.c b/src/add-ons/kernel/bus_managers/acpi/executer/exstore.c index 3e55fe5b18..30414f0f7e 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exstore.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exstore.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exstoren.c b/src/add-ons/kernel/bus_managers/acpi/executer/exstoren.c index 22ccbbf6d4..cee5bc64ce 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exstoren.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exstoren.c @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exstorob.c b/src/add-ons/kernel/bus_managers/acpi/executer/exstorob.c index 0649fdf698..e9adf5f7ac 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exstorob.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exstorob.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exsystem.c b/src/add-ons/kernel/bus_managers/acpi/executer/exsystem.c index 0217ef53ff..ab36f756e5 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exsystem.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exsystem.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/executer/exutils.c b/src/add-ons/kernel/bus_managers/acpi/executer/exutils.c index d8815aa517..5a0a9a59db 100644 --- a/src/add-ons/kernel/bus_managers/acpi/executer/exutils.c +++ b/src/add-ons/kernel/bus_managers/acpi/executer/exutils.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/hardware/hwacpi.c b/src/add-ons/kernel/bus_managers/acpi/hardware/hwacpi.c index fb88f9663a..b4ceb390ef 100644 --- a/src/add-ons/kernel/bus_managers/acpi/hardware/hwacpi.c +++ b/src/add-ons/kernel/bus_managers/acpi/hardware/hwacpi.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/hardware/hwgpe.c b/src/add-ons/kernel/bus_managers/acpi/hardware/hwgpe.c index c7391b408c..b12bab6bca 100644 --- a/src/add-ons/kernel/bus_managers/acpi/hardware/hwgpe.c +++ b/src/add-ons/kernel/bus_managers/acpi/hardware/hwgpe.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/hardware/hwpci.c b/src/add-ons/kernel/bus_managers/acpi/hardware/hwpci.c index 74c5f87a96..d733b1164c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/hardware/hwpci.c +++ b/src/add-ons/kernel/bus_managers/acpi/hardware/hwpci.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/hardware/hwregs.c b/src/add-ons/kernel/bus_managers/acpi/hardware/hwregs.c index cee244450d..2e43a4af90 100644 --- a/src/add-ons/kernel/bus_managers/acpi/hardware/hwregs.c +++ b/src/add-ons/kernel/bus_managers/acpi/hardware/hwregs.c @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/hardware/hwsleep.c b/src/add-ons/kernel/bus_managers/acpi/hardware/hwsleep.c index b195512553..fe796ec273 100644 --- a/src/add-ons/kernel/bus_managers/acpi/hardware/hwsleep.c +++ b/src/add-ons/kernel/bus_managers/acpi/hardware/hwsleep.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/hardware/hwtimer.c b/src/add-ons/kernel/bus_managers/acpi/hardware/hwtimer.c index 2675dadf35..79ddb8e540 100644 --- a/src/add-ons/kernel/bus_managers/acpi/hardware/hwtimer.c +++ b/src/add-ons/kernel/bus_managers/acpi/hardware/hwtimer.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/hardware/hwvalid.c b/src/add-ons/kernel/bus_managers/acpi/hardware/hwvalid.c index 7f2271bad0..92b9a4e71e 100644 --- a/src/add-ons/kernel/bus_managers/acpi/hardware/hwvalid.c +++ b/src/add-ons/kernel/bus_managers/acpi/hardware/hwvalid.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/hardware/hwxface.c b/src/add-ons/kernel/bus_managers/acpi/hardware/hwxface.c index 9ef6286bdb..e7bcbe0ae9 100644 --- a/src/add-ons/kernel/bus_managers/acpi/hardware/hwxface.c +++ b/src/add-ons/kernel/bus_managers/acpi/hardware/hwxface.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acapps.h b/src/add-ons/kernel/bus_managers/acpi/include/acapps.h index 9670547fdc..4256ef89b2 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acapps.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acapps.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -124,7 +124,7 @@ /* Common info for tool signons */ #define ACPICA_NAME "Intel ACPI Component Architecture" -#define ACPICA_COPYRIGHT "Copyright (c) 2000 - 2010 Intel Corporation" +#define ACPICA_COPYRIGHT "Copyright (c) 2000 - 2011 Intel Corporation" #if ACPI_MACHINE_WIDTH == 64 #define ACPI_WIDTH "-64" diff --git a/src/add-ons/kernel/bus_managers/acpi/include/accommon.h b/src/add-ons/kernel/bus_managers/acpi/include/accommon.h index 36026d768e..7a5739eb0d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/accommon.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/accommon.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acconfig.h b/src/add-ons/kernel/bus_managers/acpi/include/acconfig.h index 7aa4f47f09..df826fa057 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acconfig.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acconfig.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -240,7 +240,6 @@ /* Operation regions */ -#define ACPI_NUM_PREDEFINED_REGIONS 9 #define ACPI_USER_REGION_BEGIN 0x80 /* Maximum SpaceIds for Operation Regions */ @@ -273,7 +272,8 @@ * *****************************************************************************/ -#define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */ +#define ACPI_DEBUGGER_MAX_ARGS ACPI_METHOD_NUM_ARGS + 2 /* Max command line arguments */ +#define ACPI_DB_LINE_BUFFER_SIZE 512 #define ACPI_DEBUGGER_COMMAND_PROMPT '-' #define ACPI_DEBUGGER_EXECUTE_PROMPT '%' diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acdebug.h b/src/add-ons/kernel/bus_managers/acpi/include/acdebug.h index 7103e4fdab..05f9aa3e21 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acdebug.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acdebug.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -117,7 +117,7 @@ #define __ACDEBUG_H__ -#define ACPI_DEBUG_BUFFER_SIZE 4196 +#define ACPI_DEBUG_BUFFER_SIZE 0x4000 /* 16K buffer for return objects */ typedef struct CommandInfo { @@ -170,9 +170,9 @@ AcpiDbSingleStep ( /* * dbcmds - debug commands and output routines */ -ACPI_STATUS -AcpiDbDisassembleMethod ( - char *Name); +ACPI_NAMESPACE_NODE * +AcpiDbConvertToNode ( + char *InString); void AcpiDbDisplayTableInfo ( @@ -183,72 +183,20 @@ AcpiDbUnloadAcpiTable ( char *TableArg, char *InstanceArg); -void -AcpiDbSetMethodBreakpoint ( - char *Location, - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op); - -void -AcpiDbSetMethodCallBreakpoint ( - ACPI_PARSE_OBJECT *Op); - -void -AcpiDbGetBusInfo ( - void); - -void -AcpiDbDisassembleAml ( - char *Statements, - ACPI_PARSE_OBJECT *Op); - -void -AcpiDbDumpNamespace ( - char *StartArg, - char *DepthArg); - -void -AcpiDbDumpNamespaceByOwner ( - char *OwnerArg, - char *DepthArg); - void AcpiDbSendNotify ( char *Name, UINT32 Value); -void -AcpiDbSetMethodData ( - char *TypeArg, - char *IndexArg, - char *ValueArg); - -ACPI_STATUS -AcpiDbDisplayObjects ( - char *ObjTypeArg, - char *DisplayCountArg); - void AcpiDbDisplayInterfaces ( char *ActionArg, char *InterfaceNameArg); -ACPI_STATUS -AcpiDbFindNameInNamespace ( - char *NameArg); - -void -AcpiDbSetScope ( - char *Name); - ACPI_STATUS AcpiDbSleep ( char *ObjectArg); -void -AcpiDbFindReferences ( - char *ObjectArg); - void AcpiDbDisplayLocks ( void); @@ -262,7 +210,7 @@ AcpiDbDisplayGpes ( void); void -AcpiDbCheckIntegrity ( +AcpiDbDisplayHandlers ( void); void @@ -270,14 +218,83 @@ AcpiDbGenerateGpe ( char *GpeArg, char *BlockArg); + +/* + * dbmethod - control method commands + */ void -AcpiDbCheckPredefinedNames ( - void); +AcpiDbSetMethodBreakpoint ( + char *Location, + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op); + +void +AcpiDbSetMethodCallBreakpoint ( + ACPI_PARSE_OBJECT *Op); + +void +AcpiDbSetMethodData ( + char *TypeArg, + char *IndexArg, + char *ValueArg); + +ACPI_STATUS +AcpiDbDisassembleMethod ( + char *Name); + +void +AcpiDbDisassembleAml ( + char *Statements, + ACPI_PARSE_OBJECT *Op); void AcpiDbBatchExecute ( char *CountArg); + +/* + * dbnames - namespace commands + */ +void +AcpiDbSetScope ( + char *Name); + +void +AcpiDbDumpNamespace ( + char *StartArg, + char *DepthArg); + +void +AcpiDbDumpNamespaceByOwner ( + char *OwnerArg, + char *DepthArg); + +ACPI_STATUS +AcpiDbFindNameInNamespace ( + char *NameArg); + +void +AcpiDbCheckPredefinedNames ( + void); + +ACPI_STATUS +AcpiDbDisplayObjects ( + char *ObjTypeArg, + char *DisplayCountArg); + +void +AcpiDbCheckIntegrity ( + void); + +void +AcpiDbFindReferences ( + char *ObjectArg); + +void +AcpiDbGetBusInfo ( + void); + + /* * dbdisply - debug display commands */ @@ -332,6 +349,7 @@ void AcpiDbExecute ( char *Name, char **Args, + ACPI_OBJECT_TYPE *Types, UINT32 Flags); void @@ -412,6 +430,12 @@ AcpiDbUserCommands ( char Prompt, ACPI_PARSE_OBJECT *Op); +char * +AcpiDbGetNextToken ( + char *String, + char **Next, + ACPI_OBJECT_TYPE *ReturnType); + /* * dbstats - Generation and display of ACPI table statistics diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acdisasm.h b/src/add-ons/kernel/bus_managers/acpi/include/acdisasm.h index 7e7cea00aa..b151ecdfa7 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acdisasm.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acdisasm.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -125,6 +125,12 @@ #define BLOCK_COMMA_LIST 4 #define ACPI_DEFAULT_RESNAME *(UINT32 *) "__RD" +/* + * Raw table data header. Used by disassembler and data table compiler. + * Do not change. + */ +#define ACPI_RAW_TABLE_DATA_HEADER "Raw Table Data" + typedef const struct acpi_dmtable_info { @@ -189,7 +195,14 @@ typedef const struct acpi_dmtable_info #define ACPI_DMT_EINJINST 38 #define ACPI_DMT_ERSTACT 39 #define ACPI_DMT_ERSTINST 40 - +#define ACPI_DMT_ACCWIDTH 41 +#define ACPI_DMT_UNICODE 42 +#define ACPI_DMT_UUID 43 +#define ACPI_DMT_DEVICE_PATH 44 +#define ACPI_DMT_LABEL 45 +#define ACPI_DMT_BUF7 46 +#define ACPI_DMT_BUF128 47 +#define ACPI_DMT_SLIC 48 typedef void (*ACPI_DMTABLE_HANDLER) ( @@ -322,7 +335,9 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoMsct0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSbst[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoSlic[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoSlicHdr[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoSlic0[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoSlic1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSlit[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSpcr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSpmi[]; @@ -339,6 +354,8 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoWdat0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoWddt[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoWdrt[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoGeneric[][2]; + /* * dmtable @@ -436,6 +453,10 @@ void AcpiDmDumpRsdt ( ACPI_TABLE_HEADER *Table); +void +AcpiDmDumpSlic ( + ACPI_TABLE_HEADER *Table); + void AcpiDmDumpSlit ( ACPI_TABLE_HEADER *Table); diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acdispat.h b/src/add-ons/kernel/bus_managers/acpi/include/acdispat.h index d7af8003df..9a47d1dbe6 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acdispat.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acdispat.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -123,7 +123,7 @@ /* - * dsopcode - support for late evaluation + * dsargs - execution of dynamic arguments for static objects */ ACPI_STATUS AcpiDsGetBufferFieldArguments ( @@ -145,6 +145,24 @@ ACPI_STATUS AcpiDsGetPackageArguments ( ACPI_OPERAND_OBJECT *ObjDesc); + +/* + * dscontrol - support for execution control opcodes + */ +ACPI_STATUS +AcpiDsExecBeginControlOp ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op); + +ACPI_STATUS +AcpiDsExecEndControlOp ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op); + + +/* + * dsopcode - support for late operand evaluation + */ ACPI_STATUS AcpiDsEvalBufferFieldOperands ( ACPI_WALK_STATE *WalkState, @@ -176,20 +194,6 @@ AcpiDsInitializeRegion ( ACPI_HANDLE ObjHandle); -/* - * dsctrl - Parser/Interpreter interface, control stack routines - */ -ACPI_STATUS -AcpiDsExecBeginControlOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op); - -ACPI_STATUS -AcpiDsExecEndControlOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op); - - /* * dsexec - Parser/Interpreter interface, method execution callbacks */ @@ -241,9 +245,14 @@ AcpiDsInitFieldObjects ( /* - * dsload - Parser/Interpreter interface, namespace load callbacks + * dsload - Parser/Interpreter interface, pass 1 namespace load callbacks */ ACPI_STATUS +AcpiDsInitCallbacks ( + ACPI_WALK_STATE *WalkState, + UINT32 PassNumber); + +ACPI_STATUS AcpiDsLoad1BeginOp ( ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT **OutOp); @@ -252,6 +261,10 @@ ACPI_STATUS AcpiDsLoad1EndOp ( ACPI_WALK_STATE *WalkState); + +/* + * dsload - Parser/Interpreter interface, pass 2 namespace load callbacks + */ ACPI_STATUS AcpiDsLoad2BeginOp ( ACPI_WALK_STATE *WalkState, @@ -261,11 +274,6 @@ ACPI_STATUS AcpiDsLoad2EndOp ( ACPI_WALK_STATE *WalkState); -ACPI_STATUS -AcpiDsInitCallbacks ( - ACPI_WALK_STATE *WalkState, - UINT32 PassNumber); - /* * dsmthdat - method data (locals/args) diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acevents.h b/src/add-ons/kernel/bus_managers/acpi/include/acevents.h index c03e9e3657..9944e329d8 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acevents.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acevents.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -128,10 +128,6 @@ ACPI_STATUS AcpiEvInstallXruptHandlers ( void); -ACPI_STATUS -AcpiEvInstallFadtGpes ( - void); - UINT32 AcpiEvFixedEventDetect ( void); @@ -144,6 +140,23 @@ BOOLEAN AcpiEvIsNotifyObject ( ACPI_NAMESPACE_NODE *Node); +UINT32 +AcpiEvGetGpeNumberIndex ( + UINT32 GpeNumber); + +ACPI_STATUS +AcpiEvQueueNotifyRequest ( + ACPI_NAMESPACE_NODE *Node, + UINT32 NotifyValue); + + +/* + * evglock - Global Lock support + */ +ACPI_STATUS +AcpiEvInitGlobalLockHandler ( + void); + ACPI_STATUS AcpiEvAcquireGlobalLock( UINT16 Timeout); @@ -153,18 +166,9 @@ AcpiEvReleaseGlobalLock( void); ACPI_STATUS -AcpiEvInitGlobalLockHandler ( +AcpiEvRemoveGlobalLockHandler ( void); -UINT32 -AcpiEvGetGpeNumberIndex ( - UINT32 GpeNumber); - -ACPI_STATUS -AcpiEvQueueNotifyRequest ( - ACPI_NAMESPACE_NODE *Node, - UINT32 NotifyValue); - /* * evgpe - Low-level GPE support @@ -181,6 +185,14 @@ ACPI_STATUS AcpiEvEnableGpe ( ACPI_GPE_EVENT_INFO *GpeEventInfo); +ACPI_STATUS +AcpiEvAddGpeReference ( + ACPI_GPE_EVENT_INFO *GpeEventInfo); + +ACPI_STATUS +AcpiEvRemoveGpeReference ( + ACPI_GPE_EVENT_INFO *GpeEventInfo); + ACPI_GPE_EVENT_INFO * AcpiEvGetGpeEventInfo ( ACPI_HANDLE GpeDevice, @@ -191,6 +203,10 @@ AcpiEvLowGetGpeInfo ( UINT32 GpeNumber, ACPI_GPE_BLOCK_INFO *GpeBlock); +ACPI_STATUS +AcpiEvFinishGpe ( + ACPI_GPE_EVENT_INFO *GpeEventInfo); + /* * evgpeblk - Upper-level GPE block support @@ -206,8 +222,9 @@ AcpiEvCreateGpeBlock ( ACPI_STATUS AcpiEvInitializeGpeBlock ( - ACPI_NAMESPACE_NODE *GpeDevice, - ACPI_GPE_BLOCK_INFO *GpeBlock); + ACPI_GPE_XRUPT_INFO *GpeXruptInfo, + ACPI_GPE_BLOCK_INFO *GpeBlock, + void *Context); ACPI_STATUS AcpiEvDeleteGpeBlock ( @@ -215,6 +232,7 @@ AcpiEvDeleteGpeBlock ( UINT32 AcpiEvGpeDispatch ( + ACPI_NAMESPACE_NODE *GpeDevice, ACPI_GPE_EVENT_INFO *GpeEventInfo, UINT32 GpeNumber); @@ -236,13 +254,6 @@ AcpiEvMatchGpeMethod ( void *Context, void **ReturnValue); -ACPI_STATUS -AcpiEvMatchPrwAndGpe ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue); - /* * evgpeutil - GPE utilities */ @@ -255,6 +266,12 @@ BOOLEAN AcpiEvValidGpeEvent ( ACPI_GPE_EVENT_INFO *GpeEventInfo); +ACPI_STATUS +AcpiEvGetGpeDevice ( + ACPI_GPE_XRUPT_INFO *GpeXruptInfo, + ACPI_GPE_BLOCK_INFO *GpeBlock, + void *Context); + ACPI_GPE_XRUPT_INFO * AcpiEvGetGpeXruptBlock ( UINT32 InterruptNumber); diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acexcep.h b/src/add-ons/kernel/bus_managers/acpi/include/acexcep.h index 693c61f18b..0985258f97 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acexcep.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acexcep.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acglobal.h b/src/add-ons/kernel/bus_managers/acpi/include/acglobal.h index 2e158fbf79..1d55d7e986 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acglobal.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acglobal.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -173,13 +173,6 @@ UINT8 ACPI_INIT_GLOBAL (AcpiGbl_AllMethodsSerialized, FALSE); */ UINT8 ACPI_INIT_GLOBAL (AcpiGbl_CreateOsiMethod, TRUE); -/* - * Disable wakeup GPEs during runtime? Default is TRUE because WAKE and - * RUNTIME GPEs should never be shared, and WAKE GPEs should typically only - * be enabled just before going to sleep. - */ -UINT8 ACPI_INIT_GLOBAL (AcpiGbl_LeaveWakeGpesDisabled, TRUE); - /* * Optionally use default values for the ACPI register widths. Set this to * TRUE to use the defaults, if an FADT contains incorrect widths/lengths. @@ -207,6 +200,12 @@ UINT8 ACPI_INIT_GLOBAL (AcpiGbl_CopyDsdtLocally, FALSE); */ UINT8 ACPI_INIT_GLOBAL (AcpiGbl_TruncateIoAddresses, FALSE); +/* + * Disable runtime checking and repair of values returned by control methods. + * Use only if the repair is causing a problem on a particular machine. + */ +UINT8 ACPI_INIT_GLOBAL (AcpiGbl_DisableAutoRepair, FALSE); + /* AcpiGbl_FADT is a local copy of the FADT, converted to a common format. */ @@ -269,13 +268,16 @@ ACPI_EXTERN ACPI_MUTEX_INFO AcpiGbl_MutexInfo[ACPI_NUM_MUTEX]; /* * Global lock mutex is an actual AML mutex object - * Global lock semaphore works in conjunction with the HW global lock + * Global lock semaphore works in conjunction with the actual global lock + * Global lock spinlock is used for "pending" handshake */ ACPI_EXTERN ACPI_OPERAND_OBJECT *AcpiGbl_GlobalLockMutex; ACPI_EXTERN ACPI_SEMAPHORE AcpiGbl_GlobalLockSemaphore; +ACPI_EXTERN ACPI_SPINLOCK AcpiGbl_GlobalLockPendingLock; ACPI_EXTERN UINT16 AcpiGbl_GlobalLockHandle; ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockAcquired; ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockPresent; +ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockPending; /* * Spinlocks are used for interfaces that can be possibly called at @@ -324,6 +326,10 @@ ACPI_EXTERN UINT32 AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MAS ACPI_EXTERN UINT8 AcpiGbl_LastOwnerIdIndex; ACPI_EXTERN UINT8 AcpiGbl_NextOwnerIdOffset; +/* Initialization sequencing */ + +ACPI_EXTERN BOOLEAN AcpiGbl_RegMethodsExecuted; + /* Misc */ ACPI_EXTERN UINT32 AcpiGbl_OriginalMode; @@ -434,10 +440,13 @@ ACPI_EXTERN UINT8 AcpiGbl_SleepTypeB; * ****************************************************************************/ -extern ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS]; -ACPI_EXTERN ACPI_FIXED_EVENT_HANDLER AcpiGbl_FixedEventHandlers[ACPI_NUM_FIXED_EVENTS]; +ACPI_EXTERN UINT8 AcpiGbl_AllGpesInitialized; ACPI_EXTERN ACPI_GPE_XRUPT_INFO *AcpiGbl_GpeXruptListHead; ACPI_EXTERN ACPI_GPE_BLOCK_INFO *AcpiGbl_GpeFadtBlocks[ACPI_MAX_GPE_BLOCKS]; +ACPI_EXTERN ACPI_GBL_EVENT_HANDLER AcpiGbl_GlobalEventHandler; +ACPI_EXTERN void *AcpiGbl_GlobalEventHandlerContext; +ACPI_EXTERN ACPI_FIXED_EVENT_HANDLER AcpiGbl_FixedEventHandlers[ACPI_NUM_FIXED_EVENTS]; +extern ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS]; /***************************************************************************** @@ -494,10 +503,11 @@ ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_ini_methods; ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_NoRegionSupport; ACPI_EXTERN char *AcpiGbl_DbArgs[ACPI_DEBUGGER_MAX_ARGS]; -ACPI_EXTERN char AcpiGbl_DbLineBuf[80]; -ACPI_EXTERN char AcpiGbl_DbParsedBuf[80]; -ACPI_EXTERN char AcpiGbl_DbScopeBuf[40]; -ACPI_EXTERN char AcpiGbl_DbDebugFilename[40]; +ACPI_EXTERN ACPI_OBJECT_TYPE AcpiGbl_DbArgTypes[ACPI_DEBUGGER_MAX_ARGS]; +ACPI_EXTERN char AcpiGbl_DbLineBuf[ACPI_DB_LINE_BUFFER_SIZE]; +ACPI_EXTERN char AcpiGbl_DbParsedBuf[ACPI_DB_LINE_BUFFER_SIZE]; +ACPI_EXTERN char AcpiGbl_DbScopeBuf[80]; +ACPI_EXTERN char AcpiGbl_DbDebugFilename[80]; ACPI_EXTERN BOOLEAN AcpiGbl_DbOutputToFile; ACPI_EXTERN char *AcpiGbl_DbBuffer; ACPI_EXTERN char *AcpiGbl_DbFilename; diff --git a/src/add-ons/kernel/bus_managers/acpi/include/achware.h b/src/add-ons/kernel/bus_managers/acpi/include/achware.h index e63fe3f215..32b9a0110a 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/achware.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/achware.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acinterp.h b/src/add-ons/kernel/bus_managers/acpi/include/acinterp.h index e3fa940a10..8cb1e3b1d0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acinterp.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acinterp.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/aclocal.h b/src/add-ons/kernel/bus_managers/acpi/include/aclocal.h index 062972f8e1..22b5dd36b2 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/aclocal.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/aclocal.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -165,25 +165,6 @@ union acpi_parse_object; #define ACPI_MAX_MUTEX 7 #define ACPI_NUM_MUTEX ACPI_MAX_MUTEX+1 -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) -#ifdef DEFINE_ACPI_GLOBALS - -/* Debug names for the mutexes above */ - -static char *AcpiGbl_MutexNames[ACPI_NUM_MUTEX] = -{ - "ACPI_MTX_Interpreter", - "ACPI_MTX_Namespace", - "ACPI_MTX_Tables", - "ACPI_MTX_Events", - "ACPI_MTX_Caches", - "ACPI_MTX_Memory", - "ACPI_MTX_CommandComplete", - "ACPI_MTX_CommandReady" -}; - -#endif -#endif /* Lock structure for reader/writer interfaces */ @@ -502,6 +483,7 @@ typedef struct acpi_predefined_data char *Pathname; const ACPI_PREDEFINED_INFO *Predefined; union acpi_operand_object *ParentPackage; + ACPI_NAMESPACE_NODE *Node; UINT32 Flags; UINT8 NodeFlags; @@ -537,18 +519,25 @@ typedef struct acpi_predefined_data /* Dispatch info for each GPE -- either a method or handler, cannot be both */ -typedef struct acpi_handler_info +typedef struct acpi_gpe_handler_info { - ACPI_EVENT_HANDLER Address; /* Address of handler, if any */ + ACPI_GPE_HANDLER Address; /* Address of handler, if any */ void *Context; /* Context to be passed to handler */ ACPI_NAMESPACE_NODE *MethodNode; /* Method node for this GPE level (saved) */ + UINT8 OriginalFlags; /* Original (pre-handler) GPE info */ + BOOLEAN OriginallyEnabled; /* True if GPE was originally enabled */ -} ACPI_HANDLER_INFO; +} ACPI_GPE_HANDLER_INFO; +/* + * GPE dispatch info. At any time, the GPE can have at most one type + * of dispatch - Method, Handler, or Implicit Notify. + */ typedef union acpi_gpe_dispatch_info { ACPI_NAMESPACE_NODE *MethodNode; /* Method node for this GPE level */ - struct acpi_handler_info *Handler; + struct acpi_gpe_handler_info *Handler; /* Installed GPE handler */ + ACPI_NAMESPACE_NODE *DeviceNode; /* Parent _PRW device for implicit notify */ } ACPI_GPE_DISPATCH_INFO; @@ -594,6 +583,7 @@ typedef struct acpi_gpe_block_info UINT32 RegisterCount; /* Number of register pairs in block */ UINT16 GpeCount; /* Number of individual GPEs in block */ UINT8 BlockBaseNumber;/* Base GPE number for this block */ + BOOLEAN Initialized; /* TRUE if this block is initialized */ } ACPI_GPE_BLOCK_INFO; @@ -614,7 +604,6 @@ typedef struct acpi_gpe_walk_info ACPI_GPE_BLOCK_INFO *GpeBlock; UINT16 Count; ACPI_OWNER_ID OwnerId; - BOOLEAN EnableThisGpe; BOOLEAN ExecuteByOwnerId; } ACPI_GPE_WALK_INFO; @@ -1282,6 +1271,7 @@ typedef struct acpi_db_method_info UINT32 NumLoops; char Pathname[128]; char **Args; + ACPI_OBJECT_TYPE *Types; /* * Arguments to be passed to method for the command @@ -1290,6 +1280,7 @@ typedef struct acpi_db_method_info * Index of current thread inside all them created. */ char InitArgs; + ACPI_OBJECT_TYPE ArgTypes[4]; char *Arguments[4]; char NumThreadsStr[11]; char IdOfThreadStr[11]; diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acmacros.h b/src/add-ons/kernel/bus_managers/acpi/include/acmacros.h index 417cdc3b00..5cc284efdf 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acmacros.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acmacros.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acnames.h b/src/add-ons/kernel/bus_managers/acpi/include/acnames.h index 12dd89ce14..3fbc61cc9b 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acnames.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acnames.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acnamesp.h b/src/add-ons/kernel/bus_managers/acpi/include/acnamesp.h index 5840bbc586..0437a277fe 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acnamesp.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acnamesp.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acobject.h b/src/add-ons/kernel/bus_managers/acpi/include/acobject.h index ebb656a1b4..6a6ad334e7 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acobject.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acobject.h @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -170,8 +170,6 @@ #define AOPOBJ_OBJECT_INITIALIZED 0x08 /* Region is initialized, _REG was run */ #define AOPOBJ_SETUP_COMPLETE 0x10 /* Region setup is complete */ #define AOPOBJ_INVALID 0x20 /* Host OS won't allow a Region address */ -#define AOPOBJ_MODULE_LEVEL 0x40 /* Method is actually module-level code */ -#define AOPOBJ_MODIFIED_NAMESPACE 0x80 /* Method modified the namespace */ /****************************************************************************** @@ -284,7 +282,7 @@ typedef struct acpi_object_region typedef struct acpi_object_method { ACPI_OBJECT_COMMON_HEADER - UINT8 MethodFlags; + UINT8 InfoFlags; UINT8 ParamCount; UINT8 SyncLevel; union acpi_operand_object *Mutex; @@ -293,7 +291,7 @@ typedef struct acpi_object_method { ACPI_INTERNAL_METHOD Implementation; union acpi_operand_object *Handler; - } Extra; + } Dispatch; UINT32 AmlLength; UINT8 ThreadCount; @@ -301,6 +299,14 @@ typedef struct acpi_object_method } ACPI_OBJECT_METHOD; +/* Flags for InfoFlags field above */ + +#define ACPI_METHOD_MODULE_LEVEL 0x01 /* Method is actually module-level code */ +#define ACPI_METHOD_INTERNAL_ONLY 0x02 /* Method is implemented internally (_OSI) */ +#define ACPI_METHOD_SERIALIZED 0x04 /* Method is serialized */ +#define ACPI_METHOD_SERIALIZED_PENDING 0x08 /* Method is to be marked serialized */ +#define ACPI_METHOD_MODIFIED_NAMESPACE 0x10 /* Method modified the namespace */ + /****************************************************************************** * diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acopcode.h b/src/add-ons/kernel/bus_managers/acpi/include/acopcode.h index 94d585d227..5e42cc5b80 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acopcode.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acopcode.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acoutput.h b/src/add-ons/kernel/bus_managers/acpi/include/acoutput.h index 61884f14d2..0b319c8b10 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acoutput.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acoutput.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -258,13 +258,19 @@ #if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES) /* - * Module name is included in both debug and non-debug versions primarily for - * error messages. The __FILE__ macro is not very useful for this, because it - * often includes the entire pathname to the module + * The module name is used primarily for error and debug messages. + * The __FILE__ macro is not very useful for this, because it + * usually includes the entire pathname to the module making the + * debug output difficult to read. */ #define ACPI_MODULE_NAME(Name) static const char ACPI_UNUSED_VAR _AcpiModuleName[] = Name; #else +/* + * For the no-debug and no-error-msg cases, we must at least define + * a null module name. + */ #define ACPI_MODULE_NAME(Name) +#define _AcpiModuleName "" #endif /* diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acparser.h b/src/add-ons/kernel/bus_managers/acpi/include/acparser.h index 35fe0060f1..3ea2096c9c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acparser.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acparser.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acpi.h b/src/add-ons/kernel/bus_managers/acpi/include/acpi.h index fa7cec4568..fcc027d9ae 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acpi.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acpi.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acpiosxf.h b/src/add-ons/kernel/bus_managers/acpi/include/acpiosxf.h index 9187a4ab34..9f7fc4207c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acpiosxf.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acpiosxf.h @@ -12,7 +12,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -449,9 +449,11 @@ AcpiOsRedirectOutput ( /* * Debug input */ -UINT32 +ACPI_STATUS AcpiOsGetLine ( - char *Buffer); + char *Buffer, + UINT32 BufferLength, + UINT32 *BytesRead); /* diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acpixf.h b/src/add-ons/kernel/bus_managers/acpi/include/acpixf.h index e2f310d3ee..ca90112409 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acpixf.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acpixf.h @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -120,7 +120,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20101013 +#define ACPI_CA_VERSION 0x20110623 #include "actypes.h" #include "actbl.h" @@ -142,17 +142,17 @@ extern UINT32 AcpiDbgLayer; extern UINT8 AcpiGbl_EnableInterpreterSlack; extern UINT8 AcpiGbl_AllMethodsSerialized; extern UINT8 AcpiGbl_CreateOsiMethod; -extern UINT8 AcpiGbl_LeaveWakeGpesDisabled; extern UINT8 AcpiGbl_UseDefaultRegisterWidths; extern ACPI_NAME AcpiGbl_TraceMethodName; extern UINT32 AcpiGbl_TraceFlags; extern UINT8 AcpiGbl_EnableAmlDebugObject; extern UINT8 AcpiGbl_CopyDsdtLocally; extern UINT8 AcpiGbl_TruncateIoAddresses; +extern UINT8 AcpiGbl_DisableAutoRepair; /* - * Global interfaces + * Initialization */ ACPI_STATUS AcpiInitializeTables ( @@ -176,10 +176,10 @@ ACPI_STATUS AcpiTerminate ( void); -ACPI_STATUS -AcpiSubsystemStatus ( - void); +/* + * Miscellaneous global interfaces + */ ACPI_STATUS AcpiEnable ( void); @@ -188,6 +188,10 @@ ACPI_STATUS AcpiDisable ( void); +ACPI_STATUS +AcpiSubsystemStatus ( + void); + ACPI_STATUS AcpiGetSystemInfo ( ACPI_BUFFER *RetBuffer); @@ -212,6 +216,7 @@ ACPI_STATUS AcpiRemoveInterface ( ACPI_STRING InterfaceName); + /* * ACPI Memory management */ @@ -380,6 +385,11 @@ AcpiInstallInitializationHandler ( ACPI_INIT_HANDLER Handler, UINT32 Function); +ACPI_STATUS +AcpiInstallGlobalEventHandler ( + ACPI_GBL_EVENT_HANDLER Handler, + void *Context); + ACPI_STATUS AcpiInstallFixedEventHandler ( UINT32 AcpiEvent, @@ -391,6 +401,20 @@ AcpiRemoveFixedEventHandler ( UINT32 AcpiEvent, ACPI_EVENT_HANDLER Handler); +ACPI_STATUS +AcpiInstallGpeHandler ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber, + UINT32 Type, + ACPI_GPE_HANDLER Address, + void *Context); + +ACPI_STATUS +AcpiRemoveGpeHandler ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber, + ACPI_GPE_HANDLER Address); + ACPI_STATUS AcpiInstallNotifyHandler ( ACPI_HANDLE Device, @@ -418,20 +442,6 @@ AcpiRemoveAddressSpaceHandler ( ACPI_ADR_SPACE_TYPE SpaceId, ACPI_ADR_SPACE_HANDLER Handler); -ACPI_STATUS -AcpiInstallGpeHandler ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - UINT32 Type, - ACPI_EVENT_HANDLER Address, - void *Context); - -ACPI_STATUS -AcpiRemoveGpeHandler ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - ACPI_EVENT_HANDLER Address); - ACPI_STATUS AcpiInstallExceptionHandler ( ACPI_EXCEPTION_HANDLER Handler); @@ -442,7 +452,7 @@ AcpiInstallInterfaceHandler ( /* - * Event interfaces + * Global Lock interfaces */ ACPI_STATUS AcpiAcquireGlobalLock ( @@ -453,6 +463,10 @@ ACPI_STATUS AcpiReleaseGlobalLock ( UINT32 Handle); + +/* + * Fixed Event interfaces + */ ACPI_STATUS AcpiEnableEvent ( UINT32 Event, @@ -474,13 +488,11 @@ AcpiGetEventStatus ( /* - * GPE Interfaces + * General Purpose Event (GPE) Interfaces */ ACPI_STATUS -AcpiSetGpe ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - UINT8 Action); +AcpiUpdateAllGpes ( + void); ACPI_STATUS AcpiEnableGpe ( @@ -498,7 +510,24 @@ AcpiClearGpe ( UINT32 GpeNumber); ACPI_STATUS -AcpiGpeWakeup ( +AcpiSetGpe ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber, + UINT8 Action); + +ACPI_STATUS +AcpiFinishGpe ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber); + +ACPI_STATUS +AcpiSetupGpeForWake ( + ACPI_HANDLE ParentDevice, + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber); + +ACPI_STATUS +AcpiSetGpeWakeMask ( ACPI_HANDLE GpeDevice, UINT32 GpeNumber, UINT8 Action); diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acpredef.h b/src/add-ons/kernel/bus_managers/acpi/include/acpredef.h index eb3b646e47..5b3227083f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acpredef.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acpredef.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -542,6 +542,7 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] = {{"_SWS", 0, ACPI_RTYPE_INTEGER}}, {{"_TC1", 0, ACPI_RTYPE_INTEGER}}, {{"_TC2", 0, ACPI_RTYPE_INTEGER}}, + {{"_TDL", 0, ACPI_RTYPE_INTEGER}}, {{"_TIP", 1, ACPI_RTYPE_INTEGER}}, {{"_TIV", 1, ACPI_RTYPE_INTEGER}}, {{"_TMP", 0, ACPI_RTYPE_INTEGER}}, diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acresrc.h b/src/add-ons/kernel/bus_managers/acpi/include/acresrc.h index 323d040bd0..05ff90c0c1 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acresrc.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acresrc.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acrestyp.h b/src/add-ons/kernel/bus_managers/acpi/include/acrestyp.h index 0a85d29f5a..d85e4a9b30 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acrestyp.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acrestyp.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acstruct.h b/src/add-ons/kernel/bus_managers/acpi/include/acstruct.h index 53cbea4216..e90d8ecedf 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acstruct.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acstruct.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/actables.h b/src/add-ons/kernel/bus_managers/acpi/include/actables.h index 9f1c4f00e5..d19e6845d7 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/actables.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/actables.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/actbl.h b/src/add-ons/kernel/bus_managers/acpi/include/actbl.h index e45e2368fc..3cec93028f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/actbl.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/actbl.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -469,4 +469,20 @@ typedef struct acpi_table_desc #define ACPI_FADT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_FADT, f) +/* + * Sizes of the various flavors of FADT. We need to look closely + * at the FADT length because the version number essentially tells + * us nothing because of many BIOS bugs where the version does not + * match the expected length. In other words, the length of the + * FADT is the bottom line as to what the version really is. + * + * For reference, the values below are as follows: + * FADT V1 size: 0x74 + * FADT V2 size: 0x84 + * FADT V3+ size: 0xF4 + */ +#define ACPI_FADT_V1_SIZE (UINT32) (ACPI_FADT_OFFSET (Flags) + 4) +#define ACPI_FADT_V2_SIZE (UINT32) (ACPI_FADT_OFFSET (Reserved4[0]) + 3) +#define ACPI_FADT_V3_SIZE (UINT32) (sizeof (ACPI_TABLE_FADT)) + #endif /* __ACTBL_H__ */ diff --git a/src/add-ons/kernel/bus_managers/acpi/include/actbl1.h b/src/add-ons/kernel/bus_managers/acpi/include/actbl1.h index ac11a3fe6b..a593f44170 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/actbl1.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/actbl1.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/actbl2.h b/src/add-ons/kernel/bus_managers/acpi/include/actbl2.h index 881d5ad758..a093e85847 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/actbl2.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/actbl2.h @@ -1,6 +1,6 @@ /****************************************************************************** * - * Name: actbl2.h - ACPI Specification Revision 2.0 Tables + * Name: actbl2.h - ACPI Table Definitions (tables not in ACPI spec) * *****************************************************************************/ @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -901,6 +901,81 @@ typedef struct acpi_table_mchi } ACPI_TABLE_MCHI; +/******************************************************************************* + * + * SLIC - Software Licensing Description Table + * Version 1 + * + * Conforms to "OEM Activation 2.0 for Windows Vista Operating Systems", + * Copyright 2006 + * + ******************************************************************************/ + +/* Basic SLIC table is only the common ACPI header */ + +typedef struct acpi_table_slic +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + +} ACPI_TABLE_SLIC; + + +/* Common SLIC subtable header */ + +typedef struct acpi_slic_header +{ + UINT32 Type; + UINT32 Length; + +} ACPI_SLIC_HEADER; + +/* Values for Type field above */ + +enum AcpiSlicType +{ + ACPI_SLIC_TYPE_PUBLIC_KEY = 0, + ACPI_SLIC_TYPE_WINDOWS_MARKER = 1, + ACPI_SLIC_TYPE_RESERVED = 2 /* 2 and greater are reserved */ +}; + + +/* + * SLIC Sub-tables, correspond to Type in ACPI_SLIC_HEADER + */ + +/* 0: Public Key Structure */ + +typedef struct acpi_slic_key +{ + ACPI_SLIC_HEADER Header; + UINT8 KeyType; + UINT8 Version; + UINT16 Reserved; + UINT32 Algorithm; + char Magic[4]; + UINT32 BitLength; + UINT32 Exponent; + UINT8 Modulus[128]; + +} ACPI_SLIC_KEY; + + +/* 1: Windows Marker Structure */ + +typedef struct acpi_slic_marker +{ + ACPI_SLIC_HEADER Header; + UINT32 Version; + char OemId[ACPI_OEM_ID_SIZE]; /* ASCII OEM identification */ + char OemTableId[ACPI_OEM_TABLE_ID_SIZE]; /* ASCII OEM table identification */ + char WindowsFlag[8]; + UINT32 SlicVersion; + UINT8 Reserved[16]; + UINT8 Signature[128]; + +} ACPI_SLIC_MARKER; + + /******************************************************************************* * * SPCR - Serial Port Console Redirection table diff --git a/src/add-ons/kernel/bus_managers/acpi/include/actypes.h b/src/add-ons/kernel/bus_managers/acpi/include/actypes.h index e4290ae55d..10b1e67e18 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/actypes.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/actypes.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -738,25 +738,26 @@ typedef UINT32 ACPI_EVENT_STATUS; /* * GPE info flags - Per GPE - * +-------+---+-+-+ - * | 7:4 |3:2|1|0| - * +-------+---+-+-+ - * | | | | - * | | | +--- Interrupt type: edge or level triggered - * | | +----- GPE can wake the system - * | +-------- Type of dispatch:to method, handler, or none - * +-------------- + * +-------+-+-+---+ + * | 7:4 |3|2|1:0| + * +-------+-+-+---+ + * | | | | + * | | | +-- Type of dispatch:to method, handler, notify, or none + * | | +----- Interrupt type: edge or level triggered + * | +------- Is a Wake GPE + * +------------ */ -#define ACPI_GPE_XRUPT_TYPE_MASK (UINT8) 0x01 -#define ACPI_GPE_LEVEL_TRIGGERED (UINT8) 0x01 +#define ACPI_GPE_DISPATCH_NONE (UINT8) 0x00 +#define ACPI_GPE_DISPATCH_METHOD (UINT8) 0x01 +#define ACPI_GPE_DISPATCH_HANDLER (UINT8) 0x02 +#define ACPI_GPE_DISPATCH_NOTIFY (UINT8) 0x03 +#define ACPI_GPE_DISPATCH_MASK (UINT8) 0x03 + +#define ACPI_GPE_LEVEL_TRIGGERED (UINT8) 0x04 #define ACPI_GPE_EDGE_TRIGGERED (UINT8) 0x00 +#define ACPI_GPE_XRUPT_TYPE_MASK (UINT8) 0x04 -#define ACPI_GPE_CAN_WAKE (UINT8) 0x02 - -#define ACPI_GPE_DISPATCH_MASK (UINT8) 0x0C -#define ACPI_GPE_DISPATCH_HANDLER (UINT8) 0x04 -#define ACPI_GPE_DISPATCH_METHOD (UINT8) 0x08 -#define ACPI_GPE_DISPATCH_NOT_USED (UINT8) 0x00 +#define ACPI_GPE_CAN_WAKE (UINT8) 0x08 /* * Flags for GPE and Lock interfaces @@ -787,9 +788,24 @@ typedef UINT8 ACPI_ADR_SPACE_TYPE; #define ACPI_ADR_SPACE_CMOS (ACPI_ADR_SPACE_TYPE) 5 #define ACPI_ADR_SPACE_PCI_BAR_TARGET (ACPI_ADR_SPACE_TYPE) 6 #define ACPI_ADR_SPACE_IPMI (ACPI_ADR_SPACE_TYPE) 7 -#define ACPI_ADR_SPACE_DATA_TABLE (ACPI_ADR_SPACE_TYPE) 8 -#define ACPI_ADR_SPACE_FIXED_HARDWARE (ACPI_ADR_SPACE_TYPE) 127 +#define ACPI_NUM_PREDEFINED_REGIONS 8 + +/* + * Special Address Spaces + * + * Note: A Data Table region is a special type of operation region + * that has its own AML opcode. However, internally, the AML + * interpreter simply creates an operation region with an an address + * space type of ACPI_ADR_SPACE_DATA_TABLE. + */ +#define ACPI_ADR_SPACE_DATA_TABLE (ACPI_ADR_SPACE_TYPE) 0x7E /* Internal to ACPICA only */ +#define ACPI_ADR_SPACE_FIXED_HARDWARE (ACPI_ADR_SPACE_TYPE) 0x7F + +/* Values for _REG connection code */ + +#define ACPI_REG_DISCONNECT 0 +#define ACPI_REG_CONNECT 1 /* * BitRegister IDs @@ -1014,10 +1030,26 @@ typedef void /* * Various handlers and callback procedures */ +typedef +void (*ACPI_GBL_EVENT_HANDLER) ( + UINT32 EventType, + ACPI_HANDLE Device, + UINT32 EventNumber, + void *Context); + +#define ACPI_EVENT_TYPE_GPE 0 +#define ACPI_EVENT_TYPE_FIXED 1 + typedef UINT32 (*ACPI_EVENT_HANDLER) ( void *Context); +typedef +UINT32 (*ACPI_GPE_HANDLER) ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber, + void *Context); + typedef void (*ACPI_NOTIFY_HANDLER) ( ACPI_HANDLE Device, @@ -1098,6 +1130,11 @@ UINT32 (*ACPI_INTERFACE_HANDLER) ( #define ACPI_INTERRUPT_NOT_HANDLED 0x00 #define ACPI_INTERRUPT_HANDLED 0x01 +/* GPE handler return values */ + +#define ACPI_REENABLE_GPE 0x80 + + /* Length of 32-bit EISAID values when converted back to a string */ #define ACPI_EISAID_STRING_SIZE 8 /* Includes null terminator */ diff --git a/src/add-ons/kernel/bus_managers/acpi/include/acutils.h b/src/add-ons/kernel/bus_managers/acpi/include/acutils.h index 2d73da64fa..cef6ab3e6f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/acutils.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/acutils.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/amlcode.h b/src/add-ons/kernel/bus_managers/acpi/include/amlcode.h index d6fc7d00ce..c6c62ea9f0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/amlcode.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/amlcode.h @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -474,24 +474,6 @@ #define AML_CLASS_UNKNOWN 0x0A -/* Predefined Operation Region SpaceIDs */ - -typedef enum -{ - REGION_MEMORY = 0, - REGION_IO, - REGION_PCI_CONFIG, - REGION_EC, - REGION_SMBUS, - REGION_CMOS, - REGION_PCI_BAR, - REGION_IPMI, - REGION_DATA_TABLE, /* Internal use only */ - REGION_FIXED_HW = 0x7F - -} AML_REGION_TYPES; - - /* Comparison operation codes for MatchOp operator */ typedef enum @@ -579,17 +561,11 @@ typedef enum } AML_ACCESS_ATTRIBUTE; -/* Bit fields in MethodFlags byte */ +/* Bit fields in the AML MethodFlags byte */ #define AML_METHOD_ARG_COUNT 0x07 #define AML_METHOD_SERIALIZED 0x08 #define AML_METHOD_SYNC_LEVEL 0xF0 -/* METHOD_FLAGS_ARG_COUNT is not used internally, define additional flags */ - -#define AML_METHOD_INTERNAL_ONLY 0x01 -#define AML_METHOD_RESERVED1 0x02 -#define AML_METHOD_RESERVED2 0x04 - #endif /* __AMLCODE_H__ */ diff --git a/src/add-ons/kernel/bus_managers/acpi/include/amlresrc.h b/src/add-ons/kernel/bus_managers/acpi/include/amlresrc.h index 4cd2617e22..ba0e324f13 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/amlresrc.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/amlresrc.h @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/platform/acefi.h b/src/add-ons/kernel/bus_managers/acpi/include/platform/acefi.h index 5c900ef9cf..6ecda765dd 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/platform/acefi.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/platform/acefi.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/platform/acenv.h b/src/add-ons/kernel/bus_managers/acpi/include/platform/acenv.h index cd58839b60..e5b39a17b9 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/platform/acenv.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/platform/acenv.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -151,7 +151,7 @@ #define ACPI_SINGLE_THREADED #endif -/* AcpiExec and AcpiBin configuration */ +/* AcpiExec configuration. Multithreaded with full AML debugger */ #ifdef ACPI_EXEC_APP #define ACPI_APPLICATION @@ -160,7 +160,26 @@ #define ACPI_DBG_TRACK_ALLOCATIONS #endif -#ifdef ACPI_BIN_APP +/* AcpiNames configuration. Single threaded with debugger output enabled. */ + +#ifdef ACPI_NAMES_APP +#define ACPI_DEBUGGER +#define ACPI_APPLICATION +#define ACPI_SINGLE_THREADED +#endif + +/* + * AcpiBin/AcpiHelp/AcpiSrc configuration. All single threaded, with + * no debug output. + */ +#if (defined ACPI_BIN_APP) || \ + (defined ACPI_SRC_APP) +#define ACPI_APPLICATION +#define ACPI_SINGLE_THREADED +#endif + +#ifdef ACPI_HELP_APP +#define ACPI_DEBUG_OUTPUT #define ACPI_APPLICATION #define ACPI_SINGLE_THREADED #endif diff --git a/src/add-ons/kernel/bus_managers/acpi/include/platform/acgcc.h b/src/add-ons/kernel/bus_managers/acpi/include/platform/acgcc.h index 9c7c9b9444..8743a8f045 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/platform/acgcc.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/platform/acgcc.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/platform/acintel.h b/src/add-ons/kernel/bus_managers/acpi/include/platform/acintel.h index 415e9b00df..a93ccf8976 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/platform/acintel.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/platform/acintel.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/include/platform/acmsvc.h b/src/add-ons/kernel/bus_managers/acpi/include/platform/acmsvc.h index 28a072780f..860869331c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/include/platform/acmsvc.h +++ b/src/add-ons/kernel/bus_managers/acpi/include/platform/acmsvc.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -116,6 +116,40 @@ #ifndef __ACMSVC_H__ #define __ACMSVC_H__ + +/* + * Map low I/O functions for MS. This allows us to disable MS language + * extensions for maximum portability. + */ +#define open _open +#define read _read +#define write _write +#define close _close +#define stat _stat +#define fstat _fstat +#define mkdir _mkdir +#define strlwr _strlwr +#define O_RDONLY _O_RDONLY +#define O_BINARY _O_BINARY +#define O_CREAT _O_CREAT +#define O_WRONLY _O_WRONLY +#define O_TRUNC _O_TRUNC +#define S_IREAD _S_IREAD +#define S_IWRITE _S_IWRITE +#define S_IFDIR _S_IFDIR + +/* Eliminate warnings for "old" (non-secure) versions of clib functions */ + +#ifndef _CRT_SECURE_NO_WARNINGS +#define _CRT_SECURE_NO_WARNINGS +#endif + +/* Eliminate warnings for POSIX clib function names (open, write, etc.) */ + +#ifndef _CRT_NONSTDC_NO_DEPRECATE +#define _CRT_NONSTDC_NO_DEPRECATE +#endif + #define COMPILER_DEPENDENT_INT64 __int64 #define COMPILER_DEPENDENT_UINT64 unsigned __int64 #define ACPI_INLINE __inline @@ -180,4 +214,8 @@ /* warn C4131: uses old-style declarator (iASL compiler only) */ #pragma warning(disable:4131) +#if _MSC_VER > 1200 /* Versions above VC++ 6 */ +#pragma warning( disable : 4295 ) /* needed for acpredef.h array */ +#endif + #endif /* __ACMSVC_H__ */ diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsaccess.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsaccess.c index b2af47f215..e098e52b0e 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsaccess.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsaccess.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -250,8 +250,8 @@ AcpiNsRootInitialize ( #else /* Mark this as a very SPECIAL method */ - ObjDesc->Method.MethodFlags = AML_METHOD_INTERNAL_ONLY; - ObjDesc->Method.Extra.Implementation = AcpiUtOsiImplementation; + ObjDesc->Method.InfoFlags = ACPI_METHOD_INTERNAL_ONLY; + ObjDesc->Method.Dispatch.Implementation = AcpiUtOsiImplementation; #endif break; diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsalloc.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsalloc.c index a879fc1ea8..de9f2293b0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsalloc.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsalloc.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -341,7 +341,7 @@ AcpiNsInstallNode ( * modified the namespace. This is used for cleanup when the * method exits. */ - WalkState->MethodDesc->Method.Flags |= AOPOBJ_MODIFIED_NAMESPACE; + WalkState->MethodDesc->Method.InfoFlags |= ACPI_METHOD_MODIFIED_NAMESPACE; } } @@ -459,6 +459,7 @@ AcpiNsDeleteNamespaceSubtree ( { ACPI_NAMESPACE_NODE *ChildNode = NULL; UINT32 Level = 1; + ACPI_STATUS Status; ACPI_FUNCTION_TRACE (NsDeleteNamespaceSubtree); @@ -469,6 +470,14 @@ AcpiNsDeleteNamespaceSubtree ( return_VOID; } + /* Lock namespace for possible update */ + + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + return_VOID; + } + /* * Traverse the tree of objects until we bubble back up * to where we started. @@ -521,6 +530,7 @@ AcpiNsDeleteNamespaceSubtree ( } } + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return_VOID; } diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsdump.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsdump.c index 242033126f..2bc0eba9a0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsdump.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsdump.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -725,11 +725,25 @@ AcpiNsDumpObjects ( ACPI_HANDLE StartHandle) { ACPI_WALK_INFO Info; + ACPI_STATUS Status; ACPI_FUNCTION_ENTRY (); + /* + * Just lock the entire namespace for the duration of the dump. + * We don't want any changes to the namespace during this time, + * especially the temporary nodes since we are going to display + * them also. + */ + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not acquire namespace mutex\n"); + return; + } + Info.DebugLevel = ACPI_LV_TABLES; Info.OwnerId = OwnerId; Info.DisplayType = DisplayType; @@ -737,6 +751,8 @@ AcpiNsDumpObjects ( (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES, AcpiNsDumpOneObject, NULL, (void *) &Info, NULL); + + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); } diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsdumpdv.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsdumpdv.c index deabaaee03..98fb8bd0a6 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsdumpdv.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsdumpdv.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nseval.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nseval.c index 200a957089..c200e92b05 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nseval.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nseval.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -486,7 +486,7 @@ AcpiNsExecModuleCode ( */ if ((Type == ACPI_TYPE_DEVICE) && ParentNode->Object) { - MethodObj->Method.Extra.Handler = + MethodObj->Method.Dispatch.Handler = ParentNode->Object->Device.Handler; } diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsinit.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsinit.c index 39067bb440..d5f9daafbb 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsinit.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsinit.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsload.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsload.c index bf20ac5f06..45ab0dfc2d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsload.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsload.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsnames.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsnames.c index f05288e417..59ecfd69a8 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsnames.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsnames.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsobject.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsobject.c index af5df1983e..d2747f32a9 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsobject.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsobject.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsparse.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsparse.c index d97c9af702..cd4794079c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsparse.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsparse.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nspredef.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nspredef.c index ef76930b51..4c0cc821cf 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nspredef.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nspredef.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -288,14 +288,20 @@ AcpiNsCheckPredefinedNames ( } /* - * 1) We have a return value, but if one wasn't expected, just exit, this is - * not a problem. For example, if the "Implicit Return" feature is - * enabled, methods will always return a value. + * Return value validation and possible repair. * - * 2) If the return value can be of any type, then we cannot perform any - * validation, exit. + * 1) Don't perform return value validation/repair if this feature + * has been disabled via a global option. + * + * 2) We have a return value, but if one wasn't expected, just exit, + * this is not a problem. For example, if the "Implicit Return" + * feature is enabled, methods will always return a value. + * + * 3) If the return value can be of any type, then we cannot perform + * any validation, just exit. */ - if ((!Predefined->Info.ExpectedBtypes) || + if (AcpiGbl_DisableAutoRepair || + (!Predefined->Info.ExpectedBtypes) || (Predefined->Info.ExpectedBtypes == ACPI_RTYPE_ALL)) { goto Cleanup; @@ -309,6 +315,7 @@ AcpiNsCheckPredefinedNames ( goto Cleanup; } Data->Predefined = Predefined; + Data->Node = Node; Data->NodeFlags = Node->Flags; Data->Pathname = Pathname; diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsrepair.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsrepair.c index 3bc3660da0..702e53e84f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsrepair.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsrepair.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -149,7 +149,6 @@ * * Additional possible repairs: * - * Optional/unnecessary NULL package elements removed * Required package elements that are NULL replaced by Integer/String/Buffer * Incorrect standalone package wrapped with required outer package * @@ -756,17 +755,13 @@ AcpiNsRemoveNullElements ( /* - * PTYPE1 packages contain no subpackages. - * PTYPE2 packages contain a variable number of sub-packages. We can - * safely remove all NULL elements from the PTYPE2 packages. + * We can safely remove all NULL elements from these package types: + * PTYPE1_VAR packages contain a variable number of simple data types. + * PTYPE2 packages contain a variable number of sub-packages. */ switch (PackageType) { - case ACPI_PTYPE1_FIXED: case ACPI_PTYPE1_VAR: - case ACPI_PTYPE1_OPTION: - return; - case ACPI_PTYPE2: case ACPI_PTYPE2_COUNT: case ACPI_PTYPE2_PKG_COUNT: @@ -776,6 +771,8 @@ AcpiNsRemoveNullElements ( break; default: + case ACPI_PTYPE1_FIXED: + case ACPI_PTYPE1_OPTION: return; } diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsrepair2.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsrepair2.c index 1464a3b2b5..7f8862dc5f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsrepair2.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsrepair2.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -627,8 +627,23 @@ AcpiNsRepair_TSS ( { ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; ACPI_STATUS Status; + ACPI_NAMESPACE_NODE *Node; + /* + * We can only sort the _TSS return package if there is no _PSS in the + * same scope. This is because if _PSS is present, the ACPI specification + * dictates that the _TSS Power Dissipation field is to be ignored, and + * therefore some BIOSs leave garbage values in the _TSS Power field(s). + * In this case, it is best to just return the _TSS package as-is. + * (May, 2011) + */ + Status = AcpiNsGetNode (Data->Node, "^_PSS", ACPI_NS_NO_UPSEARCH, &Node); + if (ACPI_SUCCESS (Status)) + { + return (AE_OK); + } + Status = AcpiNsCheckSortedList (Data, ReturnObject, 5, 1, ACPI_SORT_DESCENDING, "PowerDissipation"); diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nssearch.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nssearch.c index 3bee106f2d..c1ba96ede5 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nssearch.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nssearch.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsutils.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsutils.c index aee9adcde9..603a00ffe7 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsutils.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsutils.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nswalk.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nswalk.c index 2863926060..c7d95e89cf 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nswalk.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nswalk.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfeval.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfeval.c index 945690a7c1..c3b96e30b8 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfeval.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfeval.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfname.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfname.c index 8fd3d4c7ea..911fad4086 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfname.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfname.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -738,11 +738,10 @@ AcpiInstallMethod ( MethodObj->Method.ParamCount = (UINT8) (MethodFlags & AML_METHOD_ARG_COUNT); - MethodObj->Method.MethodFlags = (UINT8) - (MethodFlags & ~AML_METHOD_ARG_COUNT); - if (MethodFlags & AML_METHOD_SERIALIZED) { + MethodObj->Method.InfoFlags = ACPI_METHOD_SERIALIZED; + MethodObj->Method.SyncLevel = (UINT8) ((MethodFlags & AML_METHOD_SYNC_LEVEL) >> 4); } @@ -751,8 +750,7 @@ AcpiInstallMethod ( * Now that it is complete, we can attach the new method object to * the method Node (detaches/deletes any existing object) */ - Status = AcpiNsAttachObject (Node, MethodObj, - ACPI_TYPE_METHOD); + Status = AcpiNsAttachObject (Node, MethodObj, ACPI_TYPE_METHOD); /* * Flag indicates AML buffer is dynamic, must be deleted later. diff --git a/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfobj.c b/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfobj.c index 8e6ed643e7..5dca29cd81 100644 --- a/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfobj.c +++ b/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfobj.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/parser/psargs.c b/src/add-ons/kernel/bus_managers/acpi/parser/psargs.c index 35cc45188a..1dcb1b77b0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/parser/psargs.c +++ b/src/add-ons/kernel/bus_managers/acpi/parser/psargs.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/parser/psloop.c b/src/add-ons/kernel/bus_managers/acpi/parser/psloop.c index e3e2d0ca6b..9791efcc78 100644 --- a/src/add-ons/kernel/bus_managers/acpi/parser/psloop.c +++ b/src/add-ons/kernel/bus_managers/acpi/parser/psloop.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -767,7 +767,7 @@ AcpiPsLinkModuleCode ( MethodObj->Method.AmlStart = AmlStart; MethodObj->Method.AmlLength = AmlLength; MethodObj->Method.OwnerId = OwnerId; - MethodObj->Method.Flags |= AOPOBJ_MODULE_LEVEL; + MethodObj->Method.InfoFlags |= ACPI_METHOD_MODULE_LEVEL; /* * Save the parent node in NextObject. This is cheating, but we diff --git a/src/add-ons/kernel/bus_managers/acpi/parser/psopcode.c b/src/add-ons/kernel/bus_managers/acpi/parser/psopcode.c index e3e32ea555..30a393f1ef 100644 --- a/src/add-ons/kernel/bus_managers/acpi/parser/psopcode.c +++ b/src/add-ons/kernel/bus_managers/acpi/parser/psopcode.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/parser/psparse.c b/src/add-ons/kernel/bus_managers/acpi/parser/psparse.c index 4a1c29d2f4..59af839bec 100644 --- a/src/add-ons/kernel/bus_managers/acpi/parser/psparse.c +++ b/src/add-ons/kernel/bus_managers/acpi/parser/psparse.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -128,7 +128,6 @@ #include "acparser.h" #include "acdispat.h" #include "amlcode.h" -#include "acnamesp.h" #include "acinterp.h" #define _COMPONENT ACPI_PARSER @@ -635,23 +634,16 @@ AcpiPsParseAml ( /* Check for possible multi-thread reentrancy problem */ if ((Status == AE_ALREADY_EXISTS) && - (!WalkState->MethodDesc->Method.Mutex)) + (!(WalkState->MethodDesc->Method.InfoFlags & ACPI_METHOD_SERIALIZED))) { - ACPI_INFO ((AE_INFO, - "Marking method %4.4s as Serialized because of AE_ALREADY_EXISTS error", - WalkState->MethodNode->Name.Ascii)); - /* - * Method tried to create an object twice. The probable cause is - * that the method cannot handle reentrancy. - * - * The method is marked NotSerialized, but it tried to create - * a named object, causing the second thread entrance to fail. - * Workaround this problem by marking the method permanently - * as Serialized. + * Method is not serialized and tried to create an object + * twice. The probable cause is that the method cannot + * handle reentrancy. Mark as "pending serialized" now, and + * then mark "serialized" when the last thread exits. */ - WalkState->MethodDesc->Method.MethodFlags |= AML_METHOD_SERIALIZED; - WalkState->MethodDesc->Method.SyncLevel = 0; + WalkState->MethodDesc->Method.InfoFlags |= + ACPI_METHOD_SERIALIZED_PENDING; } } diff --git a/src/add-ons/kernel/bus_managers/acpi/parser/psscope.c b/src/add-ons/kernel/bus_managers/acpi/parser/psscope.c index bb7e149390..10fe18690f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/parser/psscope.c +++ b/src/add-ons/kernel/bus_managers/acpi/parser/psscope.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/parser/pstree.c b/src/add-ons/kernel/bus_managers/acpi/parser/pstree.c index 6a425e9cf4..950dedf6c2 100644 --- a/src/add-ons/kernel/bus_managers/acpi/parser/pstree.c +++ b/src/add-ons/kernel/bus_managers/acpi/parser/pstree.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/parser/psutils.c b/src/add-ons/kernel/bus_managers/acpi/parser/psutils.c index 17be364a27..e676a4023a 100644 --- a/src/add-ons/kernel/bus_managers/acpi/parser/psutils.c +++ b/src/add-ons/kernel/bus_managers/acpi/parser/psutils.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/parser/pswalk.c b/src/add-ons/kernel/bus_managers/acpi/parser/pswalk.c index 81310ba09f..0de366c4a0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/parser/pswalk.c +++ b/src/add-ons/kernel/bus_managers/acpi/parser/pswalk.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/parser/psxface.c b/src/add-ons/kernel/bus_managers/acpi/parser/psxface.c index 6cc5f413b9..54af318284 100644 --- a/src/add-ons/kernel/bus_managers/acpi/parser/psxface.c +++ b/src/add-ons/kernel/bus_managers/acpi/parser/psxface.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -121,7 +121,6 @@ #include "acdispat.h" #include "acinterp.h" #include "actables.h" -#include "amlcode.h" #define _COMPONENT ACPI_PARSER @@ -399,16 +398,16 @@ AcpiPsExecuteMethod ( goto Cleanup; } - if (Info->ObjDesc->Method.Flags & AOPOBJ_MODULE_LEVEL) + if (Info->ObjDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL) { WalkState->ParseFlags |= ACPI_PARSE_MODULE_LEVEL; } /* Invoke an internal method if necessary */ - if (Info->ObjDesc->Method.MethodFlags & AML_METHOD_INTERNAL_ONLY) + if (Info->ObjDesc->Method.InfoFlags & ACPI_METHOD_INTERNAL_ONLY) { - Status = Info->ObjDesc->Method.Extra.Implementation (WalkState); + Status = Info->ObjDesc->Method.Dispatch.Implementation (WalkState); Info->ReturnObject = WalkState->ReturnDesc; /* Cleanup states */ diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rsaddr.c b/src/add-ons/kernel/bus_managers/acpi/resources/rsaddr.c index eeed1dffdb..0ee032c799 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rsaddr.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rsaddr.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rscalc.c b/src/add-ons/kernel/bus_managers/acpi/resources/rscalc.c index 3215c9ecdb..ceb8cd9215 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rscalc.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rscalc.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rscreate.c b/src/add-ons/kernel/bus_managers/acpi/resources/rscreate.c index 5f78b9e5ee..11db3a44f1 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rscreate.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rscreate.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rsdump.c b/src/add-ons/kernel/bus_managers/acpi/resources/rsdump.c index 3c1275f52f..d2db725b2e 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rsdump.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rsdump.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rsinfo.c b/src/add-ons/kernel/bus_managers/acpi/resources/rsinfo.c index 8f6aa0aa35..5fca428e3d 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rsinfo.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rsinfo.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rsio.c b/src/add-ons/kernel/bus_managers/acpi/resources/rsio.c index a29c655c48..26e7988644 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rsio.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rsio.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rsirq.c b/src/add-ons/kernel/bus_managers/acpi/resources/rsirq.c index 21120f6edb..d424d1215c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rsirq.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rsirq.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rslist.c b/src/add-ons/kernel/bus_managers/acpi/resources/rslist.c index 75f50487a3..58bd395114 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rslist.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rslist.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rsmemory.c b/src/add-ons/kernel/bus_managers/acpi/resources/rsmemory.c index f4d1cca436..708e604c51 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rsmemory.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rsmemory.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rsmisc.c b/src/add-ons/kernel/bus_managers/acpi/resources/rsmisc.c index 191c7a91c9..89c59a531b 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rsmisc.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rsmisc.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rsutils.c b/src/add-ons/kernel/bus_managers/acpi/resources/rsutils.c index b5c2ab5a73..f3c73f8fd4 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rsutils.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rsutils.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/resources/rsxface.c b/src/add-ons/kernel/bus_managers/acpi/resources/rsxface.c index 2a019d1844..6646ef18ed 100644 --- a/src/add-ons/kernel/bus_managers/acpi/resources/rsxface.c +++ b/src/add-ons/kernel/bus_managers/acpi/resources/rsxface.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/tables/tbfadt.c b/src/add-ons/kernel/bus_managers/acpi/tables/tbfadt.c index a86a55cdaa..fae6428582 100644 --- a/src/add-ons/kernel/bus_managers/acpi/tables/tbfadt.c +++ b/src/add-ons/kernel/bus_managers/acpi/tables/tbfadt.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -482,8 +482,11 @@ AcpiTbConvertFadt ( * * The ACPI 1.0 reserved fields that will be zeroed are the bytes located * at offset 45, 55, 95, and the word located at offset 109, 110. + * + * Note: The FADT revision value is unreliable. Only the length can be + * trusted. */ - if (AcpiGbl_FADT.Header.Revision < 3) + if (AcpiGbl_FADT.Header.Length <= ACPI_FADT_V2_SIZE) { AcpiGbl_FADT.PreferredProfile = 0; AcpiGbl_FADT.PstateControl = 0; diff --git a/src/add-ons/kernel/bus_managers/acpi/tables/tbfind.c b/src/add-ons/kernel/bus_managers/acpi/tables/tbfind.c index 4fd988ef9e..48ef81756c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/tables/tbfind.c +++ b/src/add-ons/kernel/bus_managers/acpi/tables/tbfind.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/tables/tbinstal.c b/src/add-ons/kernel/bus_managers/acpi/tables/tbinstal.c index 2179b6bf7b..da3ccf497a 100644 --- a/src/add-ons/kernel/bus_managers/acpi/tables/tbinstal.c +++ b/src/add-ons/kernel/bus_managers/acpi/tables/tbinstal.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -216,12 +216,28 @@ AcpiTbAddTable ( } /* - * Originally, we checked the table signature for "SSDT" or "PSDT" here. - * Next, we added support for OEMx tables, signature "OEM". - * Valid tables were encountered with a null signature, so we've just - * given up on validating the signature, since it seems to be a waste - * of code. The original code was removed (05/2008). + * Validate the incoming table signature. + * + * 1) Originally, we checked the table signature for "SSDT" or "PSDT". + * 2) We added support for OEMx tables, signature "OEM". + * 3) Valid tables were encountered with a null signature, so we just + * gave up on validating the signature, (05/2008). + * 4) We encountered non-AML tables such as the MADT, which caused + * interpreter errors and kernel faults. So now, we once again allow + * only "SSDT", "OEMx", and now, also a null signature. (05/2011). */ + if ((TableDesc->Pointer->Signature[0] != 0x00) && + (!ACPI_COMPARE_NAME (TableDesc->Pointer->Signature, ACPI_SIG_SSDT)) && + (ACPI_STRNCMP (TableDesc->Pointer->Signature, "OEM", 3))) + { + ACPI_ERROR ((AE_INFO, + "Table has invalid signature [%4.4s] (0x%8.8X), must be SSDT or OEMx", + AcpiUtValidAcpiName (*(UINT32 *) TableDesc->Pointer->Signature) ? + TableDesc->Pointer->Signature : "????", + *(UINT32 *) TableDesc->Pointer->Signature)); + + return_ACPI_STATUS (AE_BAD_SIGNATURE); + } (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); diff --git a/src/add-ons/kernel/bus_managers/acpi/tables/tbutils.c b/src/add-ons/kernel/bus_managers/acpi/tables/tbutils.c index 100a91d9e5..3cb3cc204c 100644 --- a/src/add-ons/kernel/bus_managers/acpi/tables/tbutils.c +++ b/src/add-ons/kernel/bus_managers/acpi/tables/tbutils.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/tables/tbxface.c b/src/add-ons/kernel/bus_managers/acpi/tables/tbxface.c index ba1a026e86..507ea0bd68 100644 --- a/src/add-ons/kernel/bus_managers/acpi/tables/tbxface.c +++ b/src/add-ons/kernel/bus_managers/acpi/tables/tbxface.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/tables/tbxfroot.c b/src/add-ons/kernel/bus_managers/acpi/tables/tbxfroot.c index 6f120063b7..7319a18376 100644 --- a/src/add-ons/kernel/bus_managers/acpi/tables/tbxfroot.c +++ b/src/add-ons/kernel/bus_managers/acpi/tables/tbxfroot.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utalloc.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utalloc.c index f2478b2962..7a276f8203 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utalloc.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utalloc.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utcache.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utcache.c index 2cee9a13ce..ba131014b6 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utcache.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utcache.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utclib.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utclib.c index fd7796fee5..340e5b5d4a 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utclib.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utclib.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utcopy.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utcopy.c index c1fccaefe1..64484ad023 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utcopy.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utcopy.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utdebug.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utdebug.c index ad158465e0..b21f07fc9e 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utdebug.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utdebug.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utdecode.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utdecode.c new file mode 100644 index 0000000000..94b53d80d2 --- /dev/null +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utdecode.c @@ -0,0 +1,702 @@ +/****************************************************************************** + * + * Module Name: utdecode - Utility decoding routines (value-to-string) + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#define __UTDECODE_C__ + +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" + +#define _COMPONENT ACPI_UTILITIES + ACPI_MODULE_NAME ("utdecode") + + +/******************************************************************************* + * + * FUNCTION: AcpiFormatException + * + * PARAMETERS: Status - The ACPI_STATUS code to be formatted + * + * RETURN: A string containing the exception text. A valid pointer is + * always returned. + * + * DESCRIPTION: This function translates an ACPI exception into an ASCII string + * It is here instead of utxface.c so it is always present. + * + ******************************************************************************/ + +const char * +AcpiFormatException ( + ACPI_STATUS Status) +{ + const char *Exception = NULL; + + + ACPI_FUNCTION_ENTRY (); + + + Exception = AcpiUtValidateException (Status); + if (!Exception) + { + /* Exception code was not recognized */ + + ACPI_ERROR ((AE_INFO, + "Unknown exception code: 0x%8.8X", Status)); + + Exception = "UNKNOWN_STATUS_CODE"; + } + + return (ACPI_CAST_PTR (const char, Exception)); +} + +ACPI_EXPORT_SYMBOL (AcpiFormatException) + + +/* + * Properties of the ACPI Object Types, both internal and external. + * The table is indexed by values of ACPI_OBJECT_TYPE + */ +const UINT8 AcpiGbl_NsProperties[ACPI_NUM_NS_TYPES] = +{ + ACPI_NS_NORMAL, /* 00 Any */ + ACPI_NS_NORMAL, /* 01 Number */ + ACPI_NS_NORMAL, /* 02 String */ + ACPI_NS_NORMAL, /* 03 Buffer */ + ACPI_NS_NORMAL, /* 04 Package */ + ACPI_NS_NORMAL, /* 05 FieldUnit */ + ACPI_NS_NEWSCOPE, /* 06 Device */ + ACPI_NS_NORMAL, /* 07 Event */ + ACPI_NS_NEWSCOPE, /* 08 Method */ + ACPI_NS_NORMAL, /* 09 Mutex */ + ACPI_NS_NORMAL, /* 10 Region */ + ACPI_NS_NEWSCOPE, /* 11 Power */ + ACPI_NS_NEWSCOPE, /* 12 Processor */ + ACPI_NS_NEWSCOPE, /* 13 Thermal */ + ACPI_NS_NORMAL, /* 14 BufferField */ + ACPI_NS_NORMAL, /* 15 DdbHandle */ + ACPI_NS_NORMAL, /* 16 Debug Object */ + ACPI_NS_NORMAL, /* 17 DefField */ + ACPI_NS_NORMAL, /* 18 BankField */ + ACPI_NS_NORMAL, /* 19 IndexField */ + ACPI_NS_NORMAL, /* 20 Reference */ + ACPI_NS_NORMAL, /* 21 Alias */ + ACPI_NS_NORMAL, /* 22 MethodAlias */ + ACPI_NS_NORMAL, /* 23 Notify */ + ACPI_NS_NORMAL, /* 24 Address Handler */ + ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Desc */ + ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 26 Resource Field */ + ACPI_NS_NEWSCOPE, /* 27 Scope */ + ACPI_NS_NORMAL, /* 28 Extra */ + ACPI_NS_NORMAL, /* 29 Data */ + ACPI_NS_NORMAL /* 30 Invalid */ +}; + + +/******************************************************************************* + * + * FUNCTION: AcpiUtHexToAsciiChar + * + * PARAMETERS: Integer - Contains the hex digit + * Position - bit position of the digit within the + * integer (multiple of 4) + * + * RETURN: The converted Ascii character + * + * DESCRIPTION: Convert a hex digit to an Ascii character + * + ******************************************************************************/ + +/* Hex to ASCII conversion table */ + +static const char AcpiGbl_HexToAscii[] = +{ + '0','1','2','3','4','5','6','7', + '8','9','A','B','C','D','E','F' +}; + +char +AcpiUtHexToAsciiChar ( + UINT64 Integer, + UINT32 Position) +{ + + return (AcpiGbl_HexToAscii[(Integer >> Position) & 0xF]); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtGetRegionName + * + * PARAMETERS: Space ID - ID for the region + * + * RETURN: Decoded region SpaceId name + * + * DESCRIPTION: Translate a Space ID into a name string (Debug only) + * + ******************************************************************************/ + +/* Region type decoding */ + +const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] = +{ + "SystemMemory", + "SystemIO", + "PCI_Config", + "EmbeddedControl", + "SMBus", + "SystemCMOS", + "PCIBARTarget", + "IPMI" +}; + + +char * +AcpiUtGetRegionName ( + UINT8 SpaceId) +{ + + if (SpaceId >= ACPI_USER_REGION_BEGIN) + { + return ("UserDefinedRegion"); + } + else if (SpaceId == ACPI_ADR_SPACE_DATA_TABLE) + { + return ("DataTable"); + } + else if (SpaceId == ACPI_ADR_SPACE_FIXED_HARDWARE) + { + return ("FunctionalFixedHW"); + } + else if (SpaceId >= ACPI_NUM_PREDEFINED_REGIONS) + { + return ("InvalidSpaceId"); + } + + return (ACPI_CAST_PTR (char, AcpiGbl_RegionTypes[SpaceId])); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtGetEventName + * + * PARAMETERS: EventId - Fixed event ID + * + * RETURN: Decoded event ID name + * + * DESCRIPTION: Translate a Event ID into a name string (Debug only) + * + ******************************************************************************/ + +/* Event type decoding */ + +static const char *AcpiGbl_EventTypes[ACPI_NUM_FIXED_EVENTS] = +{ + "PM_Timer", + "GlobalLock", + "PowerButton", + "SleepButton", + "RealTimeClock", +}; + + +char * +AcpiUtGetEventName ( + UINT32 EventId) +{ + + if (EventId > ACPI_EVENT_MAX) + { + return ("InvalidEventID"); + } + + return (ACPI_CAST_PTR (char, AcpiGbl_EventTypes[EventId])); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtGetTypeName + * + * PARAMETERS: Type - An ACPI object type + * + * RETURN: Decoded ACPI object type name + * + * DESCRIPTION: Translate a Type ID into a name string (Debug only) + * + ******************************************************************************/ + +/* + * Elements of AcpiGbl_NsTypeNames below must match + * one-to-one with values of ACPI_OBJECT_TYPE + * + * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; + * when stored in a table it really means that we have thus far seen no + * evidence to indicate what type is actually going to be stored for this entry. + */ +static const char AcpiGbl_BadType[] = "UNDEFINED"; + +/* Printable names of the ACPI object types */ + +static const char *AcpiGbl_NsTypeNames[] = +{ + /* 00 */ "Untyped", + /* 01 */ "Integer", + /* 02 */ "String", + /* 03 */ "Buffer", + /* 04 */ "Package", + /* 05 */ "FieldUnit", + /* 06 */ "Device", + /* 07 */ "Event", + /* 08 */ "Method", + /* 09 */ "Mutex", + /* 10 */ "Region", + /* 11 */ "Power", + /* 12 */ "Processor", + /* 13 */ "Thermal", + /* 14 */ "BufferField", + /* 15 */ "DdbHandle", + /* 16 */ "DebugObject", + /* 17 */ "RegionField", + /* 18 */ "BankField", + /* 19 */ "IndexField", + /* 20 */ "Reference", + /* 21 */ "Alias", + /* 22 */ "MethodAlias", + /* 23 */ "Notify", + /* 24 */ "AddrHandler", + /* 25 */ "ResourceDesc", + /* 26 */ "ResourceFld", + /* 27 */ "Scope", + /* 28 */ "Extra", + /* 29 */ "Data", + /* 30 */ "Invalid" +}; + + +char * +AcpiUtGetTypeName ( + ACPI_OBJECT_TYPE Type) +{ + + if (Type > ACPI_TYPE_INVALID) + { + return (ACPI_CAST_PTR (char, AcpiGbl_BadType)); + } + + return (ACPI_CAST_PTR (char, AcpiGbl_NsTypeNames[Type])); +} + + +char * +AcpiUtGetObjectTypeName ( + ACPI_OPERAND_OBJECT *ObjDesc) +{ + + if (!ObjDesc) + { + return ("[NULL Object Descriptor]"); + } + + return (AcpiUtGetTypeName (ObjDesc->Common.Type)); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtGetNodeName + * + * PARAMETERS: Object - A namespace node + * + * RETURN: ASCII name of the node + * + * DESCRIPTION: Validate the node and return the node's ACPI name. + * + ******************************************************************************/ + +char * +AcpiUtGetNodeName ( + void *Object) +{ + ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) Object; + + + /* Must return a string of exactly 4 characters == ACPI_NAME_SIZE */ + + if (!Object) + { + return ("NULL"); + } + + /* Check for Root node */ + + if ((Object == ACPI_ROOT_OBJECT) || + (Object == AcpiGbl_RootNode)) + { + return ("\"\\\" "); + } + + /* Descriptor must be a namespace node */ + + if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) + { + return ("####"); + } + + /* + * Ensure name is valid. The name was validated/repaired when the node + * was created, but make sure it has not been corrupted. + */ + AcpiUtRepairName (Node->Name.Ascii); + + /* Return the name */ + + return (Node->Name.Ascii); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtGetDescriptorName + * + * PARAMETERS: Object - An ACPI object + * + * RETURN: Decoded name of the descriptor type + * + * DESCRIPTION: Validate object and return the descriptor type + * + ******************************************************************************/ + +/* Printable names of object descriptor types */ + +static const char *AcpiGbl_DescTypeNames[] = +{ + /* 00 */ "Not a Descriptor", + /* 01 */ "Cached", + /* 02 */ "State-Generic", + /* 03 */ "State-Update", + /* 04 */ "State-Package", + /* 05 */ "State-Control", + /* 06 */ "State-RootParseScope", + /* 07 */ "State-ParseScope", + /* 08 */ "State-WalkScope", + /* 09 */ "State-Result", + /* 10 */ "State-Notify", + /* 11 */ "State-Thread", + /* 12 */ "Walk", + /* 13 */ "Parser", + /* 14 */ "Operand", + /* 15 */ "Node" +}; + + +char * +AcpiUtGetDescriptorName ( + void *Object) +{ + + if (!Object) + { + return ("NULL OBJECT"); + } + + if (ACPI_GET_DESCRIPTOR_TYPE (Object) > ACPI_DESC_TYPE_MAX) + { + return ("Not a Descriptor"); + } + + return (ACPI_CAST_PTR (char, + AcpiGbl_DescTypeNames[ACPI_GET_DESCRIPTOR_TYPE (Object)])); + +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtGetReferenceName + * + * PARAMETERS: Object - An ACPI reference object + * + * RETURN: Decoded name of the type of reference + * + * DESCRIPTION: Decode a reference object sub-type to a string. + * + ******************************************************************************/ + +/* Printable names of reference object sub-types */ + +static const char *AcpiGbl_RefClassNames[] = +{ + /* 00 */ "Local", + /* 01 */ "Argument", + /* 02 */ "RefOf", + /* 03 */ "Index", + /* 04 */ "DdbHandle", + /* 05 */ "Named Object", + /* 06 */ "Debug" +}; + +const char * +AcpiUtGetReferenceName ( + ACPI_OPERAND_OBJECT *Object) +{ + + if (!Object) + { + return ("NULL Object"); + } + + if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND) + { + return ("Not an Operand object"); + } + + if (Object->Common.Type != ACPI_TYPE_LOCAL_REFERENCE) + { + return ("Not a Reference object"); + } + + if (Object->Reference.Class > ACPI_REFCLASS_MAX) + { + return ("Unknown Reference class"); + } + + return (AcpiGbl_RefClassNames[Object->Reference.Class]); +} + + +#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) +/* + * Strings and procedures used for debug only + */ + +/******************************************************************************* + * + * FUNCTION: AcpiUtGetMutexName + * + * PARAMETERS: MutexId - The predefined ID for this mutex. + * + * RETURN: Decoded name of the internal mutex + * + * DESCRIPTION: Translate a mutex ID into a name string (Debug only) + * + ******************************************************************************/ + +/* Names for internal mutex objects, used for debug output */ + +static char *AcpiGbl_MutexNames[ACPI_NUM_MUTEX] = +{ + "ACPI_MTX_Interpreter", + "ACPI_MTX_Namespace", + "ACPI_MTX_Tables", + "ACPI_MTX_Events", + "ACPI_MTX_Caches", + "ACPI_MTX_Memory", + "ACPI_MTX_CommandComplete", + "ACPI_MTX_CommandReady" +}; + +char * +AcpiUtGetMutexName ( + UINT32 MutexId) +{ + + if (MutexId > ACPI_MAX_MUTEX) + { + return ("Invalid Mutex ID"); + } + + return (AcpiGbl_MutexNames[MutexId]); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtGetNotifyName + * + * PARAMETERS: NotifyValue - Value from the Notify() request + * + * RETURN: Decoded name for the notify value + * + * DESCRIPTION: Translate a Notify Value to a notify namestring. + * + ******************************************************************************/ + +/* Names for Notify() values, used for debug output */ + +static const char *AcpiGbl_NotifyValueNames[] = +{ + "Bus Check", + "Device Check", + "Device Wake", + "Eject Request", + "Device Check Light", + "Frequency Mismatch", + "Bus Mode Mismatch", + "Power Fault", + "Capabilities Check", + "Device PLD Check", + "Reserved", + "System Locality Update" +}; + +const char * +AcpiUtGetNotifyName ( + UINT32 NotifyValue) +{ + + if (NotifyValue <= ACPI_NOTIFY_MAX) + { + return (AcpiGbl_NotifyValueNames[NotifyValue]); + } + else if (NotifyValue <= ACPI_MAX_SYS_NOTIFY) + { + return ("Reserved"); + } + else /* Greater or equal to 0x80 */ + { + return ("**Device Specific**"); + } +} +#endif + + +/******************************************************************************* + * + * FUNCTION: AcpiUtValidObjectType + * + * PARAMETERS: Type - Object type to be validated + * + * RETURN: TRUE if valid object type, FALSE otherwise + * + * DESCRIPTION: Validate an object type + * + ******************************************************************************/ + +BOOLEAN +AcpiUtValidObjectType ( + ACPI_OBJECT_TYPE Type) +{ + + if (Type > ACPI_TYPE_LOCAL_MAX) + { + /* Note: Assumes all TYPEs are contiguous (external/local) */ + + return (FALSE); + } + + return (TRUE); +} diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utdelete.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utdelete.c index 7ef61f8b06..801f957d49 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utdelete.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utdelete.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/uteval.c b/src/add-ons/kernel/bus_managers/acpi/utilities/uteval.c index 080bd4c820..eeaaebbbe0 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/uteval.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/uteval.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utglobal.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utglobal.c index a7e1baa2e8..30da582a98 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utglobal.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utglobal.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -118,7 +118,6 @@ #include "acpi.h" #include "accommon.h" -#include "acnamesp.h" #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utglobal") @@ -190,47 +189,6 @@ const char *AcpiGbl_HighestDstateNames[ACPI_NUM_SxD_METHODS] = }; -/******************************************************************************* - * - * FUNCTION: AcpiFormatException - * - * PARAMETERS: Status - The ACPI_STATUS code to be formatted - * - * RETURN: A string containing the exception text. A valid pointer is - * always returned. - * - * DESCRIPTION: This function translates an ACPI exception into an ASCII string - * It is here instead of utxface.c so it is always present. - * - ******************************************************************************/ - -const char * -AcpiFormatException ( - ACPI_STATUS Status) -{ - const char *Exception = NULL; - - - ACPI_FUNCTION_ENTRY (); - - - Exception = AcpiUtValidateException (Status); - if (!Exception) - { - /* Exception code was not recognized */ - - ACPI_ERROR ((AE_INFO, - "Unknown exception code: 0x%8.8X", Status)); - - Exception = "UNKNOWN_STATUS_CODE"; - } - - return (ACPI_CAST_PTR (const char, Exception)); -} - -ACPI_EXPORT_SYMBOL (AcpiFormatException) - - /******************************************************************************* * * Namespace globals @@ -268,78 +226,6 @@ const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] = {NULL, ACPI_TYPE_ANY, NULL} }; -/* - * Properties of the ACPI Object Types, both internal and external. - * The table is indexed by values of ACPI_OBJECT_TYPE - */ -const UINT8 AcpiGbl_NsProperties[ACPI_NUM_NS_TYPES] = -{ - ACPI_NS_NORMAL, /* 00 Any */ - ACPI_NS_NORMAL, /* 01 Number */ - ACPI_NS_NORMAL, /* 02 String */ - ACPI_NS_NORMAL, /* 03 Buffer */ - ACPI_NS_NORMAL, /* 04 Package */ - ACPI_NS_NORMAL, /* 05 FieldUnit */ - ACPI_NS_NEWSCOPE, /* 06 Device */ - ACPI_NS_NORMAL, /* 07 Event */ - ACPI_NS_NEWSCOPE, /* 08 Method */ - ACPI_NS_NORMAL, /* 09 Mutex */ - ACPI_NS_NORMAL, /* 10 Region */ - ACPI_NS_NEWSCOPE, /* 11 Power */ - ACPI_NS_NEWSCOPE, /* 12 Processor */ - ACPI_NS_NEWSCOPE, /* 13 Thermal */ - ACPI_NS_NORMAL, /* 14 BufferField */ - ACPI_NS_NORMAL, /* 15 DdbHandle */ - ACPI_NS_NORMAL, /* 16 Debug Object */ - ACPI_NS_NORMAL, /* 17 DefField */ - ACPI_NS_NORMAL, /* 18 BankField */ - ACPI_NS_NORMAL, /* 19 IndexField */ - ACPI_NS_NORMAL, /* 20 Reference */ - ACPI_NS_NORMAL, /* 21 Alias */ - ACPI_NS_NORMAL, /* 22 MethodAlias */ - ACPI_NS_NORMAL, /* 23 Notify */ - ACPI_NS_NORMAL, /* 24 Address Handler */ - ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Desc */ - ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 26 Resource Field */ - ACPI_NS_NEWSCOPE, /* 27 Scope */ - ACPI_NS_NORMAL, /* 28 Extra */ - ACPI_NS_NORMAL, /* 29 Data */ - ACPI_NS_NORMAL /* 30 Invalid */ -}; - - -/* Hex to ASCII conversion table */ - -static const char AcpiGbl_HexToAscii[] = -{ - '0','1','2','3','4','5','6','7', - '8','9','A','B','C','D','E','F' -}; - - -/******************************************************************************* - * - * FUNCTION: AcpiUtHexToAsciiChar - * - * PARAMETERS: Integer - Contains the hex digit - * Position - bit position of the digit within the - * integer (multiple of 4) - * - * RETURN: The converted Ascii character - * - * DESCRIPTION: Convert a hex digit to an Ascii character - * - ******************************************************************************/ - -char -AcpiUtHexToAsciiChar ( - UINT64 Integer, - UINT32 Position) -{ - - return (AcpiGbl_HexToAscii[(Integer >> Position) & 0xF]); -} - /****************************************************************************** * @@ -386,451 +272,6 @@ ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] = /* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, ACPI_BITREG_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_ENABLE}, }; -/******************************************************************************* - * - * FUNCTION: AcpiUtGetRegionName - * - * PARAMETERS: None. - * - * RETURN: Status - * - * DESCRIPTION: Translate a Space ID into a name string (Debug only) - * - ******************************************************************************/ - -/* Region type decoding */ - -const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] = -{ - "SystemMemory", - "SystemIO", - "PCI_Config", - "EmbeddedControl", - "SMBus", - "SystemCMOS", - "PCIBARTarget", - "IPMI", - "DataTable" -}; - - -char * -AcpiUtGetRegionName ( - UINT8 SpaceId) -{ - - if (SpaceId >= ACPI_USER_REGION_BEGIN) - { - return ("UserDefinedRegion"); - } - else if (SpaceId >= ACPI_NUM_PREDEFINED_REGIONS) - { - return ("InvalidSpaceId"); - } - - return (ACPI_CAST_PTR (char, AcpiGbl_RegionTypes[SpaceId])); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetEventName - * - * PARAMETERS: None. - * - * RETURN: Status - * - * DESCRIPTION: Translate a Event ID into a name string (Debug only) - * - ******************************************************************************/ - -/* Event type decoding */ - -static const char *AcpiGbl_EventTypes[ACPI_NUM_FIXED_EVENTS] = -{ - "PM_Timer", - "GlobalLock", - "PowerButton", - "SleepButton", - "RealTimeClock", -}; - - -char * -AcpiUtGetEventName ( - UINT32 EventId) -{ - - if (EventId > ACPI_EVENT_MAX) - { - return ("InvalidEventID"); - } - - return (ACPI_CAST_PTR (char, AcpiGbl_EventTypes[EventId])); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetTypeName - * - * PARAMETERS: None. - * - * RETURN: Status - * - * DESCRIPTION: Translate a Type ID into a name string (Debug only) - * - ******************************************************************************/ - -/* - * Elements of AcpiGbl_NsTypeNames below must match - * one-to-one with values of ACPI_OBJECT_TYPE - * - * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; - * when stored in a table it really means that we have thus far seen no - * evidence to indicate what type is actually going to be stored for this entry. - */ -static const char AcpiGbl_BadType[] = "UNDEFINED"; - -/* Printable names of the ACPI object types */ - -static const char *AcpiGbl_NsTypeNames[] = -{ - /* 00 */ "Untyped", - /* 01 */ "Integer", - /* 02 */ "String", - /* 03 */ "Buffer", - /* 04 */ "Package", - /* 05 */ "FieldUnit", - /* 06 */ "Device", - /* 07 */ "Event", - /* 08 */ "Method", - /* 09 */ "Mutex", - /* 10 */ "Region", - /* 11 */ "Power", - /* 12 */ "Processor", - /* 13 */ "Thermal", - /* 14 */ "BufferField", - /* 15 */ "DdbHandle", - /* 16 */ "DebugObject", - /* 17 */ "RegionField", - /* 18 */ "BankField", - /* 19 */ "IndexField", - /* 20 */ "Reference", - /* 21 */ "Alias", - /* 22 */ "MethodAlias", - /* 23 */ "Notify", - /* 24 */ "AddrHandler", - /* 25 */ "ResourceDesc", - /* 26 */ "ResourceFld", - /* 27 */ "Scope", - /* 28 */ "Extra", - /* 29 */ "Data", - /* 30 */ "Invalid" -}; - - -char * -AcpiUtGetTypeName ( - ACPI_OBJECT_TYPE Type) -{ - - if (Type > ACPI_TYPE_INVALID) - { - return (ACPI_CAST_PTR (char, AcpiGbl_BadType)); - } - - return (ACPI_CAST_PTR (char, AcpiGbl_NsTypeNames[Type])); -} - - -char * -AcpiUtGetObjectTypeName ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - - if (!ObjDesc) - { - return ("[NULL Object Descriptor]"); - } - - return (AcpiUtGetTypeName (ObjDesc->Common.Type)); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetNodeName - * - * PARAMETERS: Object - A namespace node - * - * RETURN: Pointer to a string - * - * DESCRIPTION: Validate the node and return the node's ACPI name. - * - ******************************************************************************/ - -char * -AcpiUtGetNodeName ( - void *Object) -{ - ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) Object; - - - /* Must return a string of exactly 4 characters == ACPI_NAME_SIZE */ - - if (!Object) - { - return ("NULL"); - } - - /* Check for Root node */ - - if ((Object == ACPI_ROOT_OBJECT) || - (Object == AcpiGbl_RootNode)) - { - return ("\"\\\" "); - } - - /* Descriptor must be a namespace node */ - - if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) - { - return ("####"); - } - - /* - * Ensure name is valid. The name was validated/repaired when the node - * was created, but make sure it has not been corrupted. - */ - AcpiUtRepairName (Node->Name.Ascii); - - /* Return the name */ - - return (Node->Name.Ascii); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetDescriptorName - * - * PARAMETERS: Object - An ACPI object - * - * RETURN: Pointer to a string - * - * DESCRIPTION: Validate object and return the descriptor type - * - ******************************************************************************/ - -/* Printable names of object descriptor types */ - -static const char *AcpiGbl_DescTypeNames[] = -{ - /* 00 */ "Not a Descriptor", - /* 01 */ "Cached", - /* 02 */ "State-Generic", - /* 03 */ "State-Update", - /* 04 */ "State-Package", - /* 05 */ "State-Control", - /* 06 */ "State-RootParseScope", - /* 07 */ "State-ParseScope", - /* 08 */ "State-WalkScope", - /* 09 */ "State-Result", - /* 10 */ "State-Notify", - /* 11 */ "State-Thread", - /* 12 */ "Walk", - /* 13 */ "Parser", - /* 14 */ "Operand", - /* 15 */ "Node" -}; - - -char * -AcpiUtGetDescriptorName ( - void *Object) -{ - - if (!Object) - { - return ("NULL OBJECT"); - } - - if (ACPI_GET_DESCRIPTOR_TYPE (Object) > ACPI_DESC_TYPE_MAX) - { - return ("Not a Descriptor"); - } - - return (ACPI_CAST_PTR (char, - AcpiGbl_DescTypeNames[ACPI_GET_DESCRIPTOR_TYPE (Object)])); - -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetReferenceName - * - * PARAMETERS: Object - An ACPI reference object - * - * RETURN: Pointer to a string - * - * DESCRIPTION: Decode a reference object sub-type to a string. - * - ******************************************************************************/ - -/* Printable names of reference object sub-types */ - -static const char *AcpiGbl_RefClassNames[] = -{ - /* 00 */ "Local", - /* 01 */ "Argument", - /* 02 */ "RefOf", - /* 03 */ "Index", - /* 04 */ "DdbHandle", - /* 05 */ "Named Object", - /* 06 */ "Debug" -}; - -const char * -AcpiUtGetReferenceName ( - ACPI_OPERAND_OBJECT *Object) -{ - - if (!Object) - { - return ("NULL Object"); - } - - if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND) - { - return ("Not an Operand object"); - } - - if (Object->Common.Type != ACPI_TYPE_LOCAL_REFERENCE) - { - return ("Not a Reference object"); - } - - if (Object->Reference.Class > ACPI_REFCLASS_MAX) - { - return ("Unknown Reference class"); - } - - return (AcpiGbl_RefClassNames[Object->Reference.Class]); -} - - -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) -/* - * Strings and procedures used for debug only - */ - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetMutexName - * - * PARAMETERS: MutexId - The predefined ID for this mutex. - * - * RETURN: String containing the name of the mutex. Always returns a valid - * pointer. - * - * DESCRIPTION: Translate a mutex ID into a name string (Debug only) - * - ******************************************************************************/ - -char * -AcpiUtGetMutexName ( - UINT32 MutexId) -{ - - if (MutexId > ACPI_MAX_MUTEX) - { - return ("Invalid Mutex ID"); - } - - return (AcpiGbl_MutexNames[MutexId]); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtGetNotifyName - * - * PARAMETERS: NotifyValue - Value from the Notify() request - * - * RETURN: String corresponding to the Notify Value. - * - * DESCRIPTION: Translate a Notify Value to a notify namestring. - * - ******************************************************************************/ - -/* Names for Notify() values, used for debug output */ - -static const char *AcpiGbl_NotifyValueNames[] = -{ - "Bus Check", - "Device Check", - "Device Wake", - "Eject Request", - "Device Check Light", - "Frequency Mismatch", - "Bus Mode Mismatch", - "Power Fault", - "Capabilities Check", - "Device PLD Check", - "Reserved", - "System Locality Update" -}; - -const char * -AcpiUtGetNotifyName ( - UINT32 NotifyValue) -{ - - if (NotifyValue <= ACPI_NOTIFY_MAX) - { - return (AcpiGbl_NotifyValueNames[NotifyValue]); - } - else if (NotifyValue <= ACPI_MAX_SYS_NOTIFY) - { - return ("Reserved"); - } - else /* Greater or equal to 0x80 */ - { - return ("**Device Specific**"); - } -} -#endif - - -/******************************************************************************* - * - * FUNCTION: AcpiUtValidObjectType - * - * PARAMETERS: Type - Object type to be validated - * - * RETURN: TRUE if valid object type, FALSE otherwise - * - * DESCRIPTION: Validate an object type - * - ******************************************************************************/ - -BOOLEAN -AcpiUtValidObjectType ( - ACPI_OBJECT_TYPE Type) -{ - - if (Type > ACPI_TYPE_LOCAL_MAX) - { - /* Note: Assumes all TYPEs are contiguous (external/local) */ - - return (FALSE); - } - - return (TRUE); -} - /******************************************************************************* * @@ -840,7 +281,7 @@ AcpiUtValidObjectType ( * * RETURN: Status * - * DESCRIPTION: Init library globals. All globals that require specific + * DESCRIPTION: Init ACPICA globals. All globals that require specific * initialization should be initialized here! * ******************************************************************************/ @@ -895,6 +336,7 @@ AcpiUtInitGlobals ( /* GPE support */ + AcpiGbl_AllGpesInitialized = FALSE; AcpiGbl_GpeXruptListHead = NULL; AcpiGbl_GpeFadtBlocks[0] = NULL; AcpiGbl_GpeFadtBlocks[1] = NULL; @@ -908,6 +350,7 @@ AcpiUtInitGlobals ( AcpiGbl_InitHandler = NULL; AcpiGbl_TableHandler = NULL; AcpiGbl_InterfaceHandler = NULL; + AcpiGbl_GlobalEventHandler = NULL; /* Global Lock support */ @@ -935,6 +378,7 @@ AcpiUtInitGlobals ( AcpiGbl_DbOutputFlags = ACPI_DB_CONSOLE_OUTPUT; AcpiGbl_OsiData = 0; AcpiGbl_OsiMutex = NULL; + AcpiGbl_RegMethodsExecuted = FALSE; /* Hardware oriented */ @@ -977,5 +421,3 @@ ACPI_EXPORT_SYMBOL (AcpiDbgLevel) ACPI_EXPORT_SYMBOL (AcpiDbgLayer) ACPI_EXPORT_SYMBOL (AcpiGpeCount) ACPI_EXPORT_SYMBOL (AcpiCurrentGpeCount) - - diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utids.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utids.c index 4b52fe4341..c24541da86 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utids.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utids.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utinit.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utinit.c index 4cb083bd7a..9e06711f47 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utinit.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utinit.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utlock.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utlock.c index e17ca3e7d7..6e68ec0043 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utlock.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utlock.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utmath.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utmath.c index 90f3cd58cc..5c6d20e3c9 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utmath.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utmath.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utmisc.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utmisc.c index 1867a31fa9..d379a220d3 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utmisc.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utmisc.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utmutex.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utmutex.c index 92a95e15af..01a2422e93 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utmutex.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utmutex.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utobject.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utobject.c index 0a9f1e7f6f..f62ebe01a8 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utobject.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utobject.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utosi.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utosi.c index 26d143260a..2b64d674b2 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utosi.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utosi.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utresrc.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utresrc.c index 02bb1dbfe6..a6b6d9c810 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utresrc.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utresrc.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utstate.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utstate.c index 08218d11c9..c23c701787 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utstate.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utstate.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/uttrack.c b/src/add-ons/kernel/bus_managers/acpi/utilities/uttrack.c index 38dba03ad8..f5599b792f 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/uttrack.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/uttrack.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utxface.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utxface.c index 9e520174f1..d65c8210e1 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utxface.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utxface.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License @@ -411,27 +411,6 @@ AcpiInitializeObjects ( } } - /* - * Initialize the GPE blocks defined in the FADT (GPE block 0 and 1). - * The runtime GPEs are enabled here. - * - * This is where the _PRW methods are executed for the GPEs. These - * methods can only be executed after the SCI and Global Lock handlers are - * installed and initialized. - * - * GPEs can only be enabled after the _REG, _STA, and _INI methods have - * been run. This ensures that all Operation Regions and all Devices have - * been initialized and are ready. - */ - if (!(Flags & ACPI_NO_EVENT_INIT)) - { - Status = AcpiEvInstallFadtGpes (); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - /* * Empty the caches (delete the cached objects) on the assumption that * the table load filled them up more than they will be at runtime -- diff --git a/src/add-ons/kernel/bus_managers/acpi/utilities/utxferror.c b/src/add-ons/kernel/bus_managers/acpi/utilities/utxferror.c index b397a40c2a..60e6217135 100644 --- a/src/add-ons/kernel/bus_managers/acpi/utilities/utxferror.c +++ b/src/add-ons/kernel/bus_managers/acpi/utilities/utxferror.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. * All rights reserved. * * 2. License