* Updated ACPICA to 20110623.
See http://www.acpica.org/download/changes.txt done after 2010-10-13 for info on ACPI changes. * Adapted the embedded controller to match current FreeBSD one. There will probably be some issues with these changes initially. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42637 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -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 */
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 ("<Generic Address Structure>\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 ("<Hardware Error Notification Structure>\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:
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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}
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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)
|
||||
@@ -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);
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"},
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 '%'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
/*
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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}},
|
||||
|
||||
@@ -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
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user