- Update ACPICA from 20091214 to 20110922
- Rewrite a large portion of the OSL code
- Perform a full initialization of ACPI objects (don't skip devices and events)
- Please retest ACPI bugs after this commit

svn path=/trunk/; revision=53895
This commit is contained in:
Cameron Gutman
2011-09-29 20:57:14 +00:00
parent c92dfc36c6
commit 0b99db243f
179 changed files with 11335 additions and 7279 deletions
+15 -4
View File
@@ -8,6 +8,8 @@ if(ARCH MATCHES amd64)
endif()
add_library(acpica
acpica/dispatcher/dsargs.c
acpica/dispatcher/dscontrol.c
acpica/dispatcher/dsfield.c
acpica/dispatcher/dsinit.c
acpica/dispatcher/dsmethod.c
@@ -17,21 +19,27 @@ add_library(acpica
acpica/dispatcher/dsutils.c
acpica/dispatcher/dswexec.c
acpica/dispatcher/dswload.c
acpica/dispatcher/dswload2.c
acpica/dispatcher/dswscope.c
acpica/dispatcher/dswstate.c
acpica/events/evevent.c
acpica/events/evglock.c
acpica/events/evgpe.c
acpica/events/evgpeblk.c
acpica/events/evgpeinit.c
acpica/events/evgpeutil.c
acpica/events/evmisc.c
acpica/events/evregion.c
acpica/events/evrgnini.c
acpica/events/evsci.c
acpica/events/evxface.c
acpica/events/evxfevnt.c
acpica/events/evxfgpe.c
acpica/events/evxfregn.c
acpica/executer/exconfig.c
acpica/executer/exconvrt.c
acpica/executer/excreate.c
acpica/executer/exdebug.c
acpica/executer/exdump.c
acpica/executer/exfield.c
acpica/executer/exfldio.c
@@ -54,6 +62,7 @@ add_library(acpica
acpica/executer/exutils.c
acpica/hardware/hwacpi.c
acpica/hardware/hwgpe.c
acpica/hardware/hwpci.c
acpica/hardware/hwregs.c
acpica/hardware/hwsleep.c
acpica/hardware/hwtimer.c
@@ -110,6 +119,7 @@ add_library(acpica
acpica/utilities/utclib.c
acpica/utilities/utcopy.c
acpica/utilities/utdebug.c
acpica/utilities/utdecode.c
acpica/utilities/utdelete.c
acpica/utilities/uteval.c
acpica/utilities/utglobal.c
@@ -120,12 +130,14 @@ add_library(acpica
acpica/utilities/utmisc.c
acpica/utilities/utmutex.c
acpica/utilities/utobject.c
acpica/utilities/utosi.c
acpica/utilities/utresrc.c
acpica/utilities/utstate.c
acpica/utilities/uttrack.c
acpica/utilities/utxface.c)
acpica/utilities/utxface.c
acpica/utilities/utxferror.c)
allow_warnings(acpica)
set_target_properties(acpica PROPERTIES COMPILE_DEFINITIONS "ACPI_USE_LOCAL_CACHE")
add_dependencies(acpica bugcodes)
add_library(acpi SHARED
@@ -143,9 +155,8 @@ add_library(acpi SHARED
buspdo.c
main.c)
allow_warnings(acpi)
set_module_type(acpi kernelmodedriver)
target_link_libraries(acpi wdmguid acpica)
target_link_libraries(acpi wdmguid acpica ${PSEH_LIB})
add_importlibs(acpi ntoskrnl hal)
add_cd_file(TARGET acpi DESTINATION reactos/system32/drivers NO_CAB FOR all)
+2 -1
View File
@@ -17,7 +17,7 @@
</group>
</if>
<module name="acpi" type="kernelmodedriver" installbase="system32/drivers" installname="acpi.sys" allowwarnings="true">
<module name="acpi" type="kernelmodedriver" installbase="system32/drivers" installname="acpi.sys">
<bootstrap installbase="$(CDOUTPUT)/system32/drivers" />
<include base="acpi">include</include>
<include base="acpica">include</include>
@@ -25,6 +25,7 @@
<library>hal</library>
<library>wdmguid</library>
<library>acpica</library>
<library>pseh</library>
<directory name="busmgr">
<file>bus.c</file>
<file>button.c</file>
+14 -1
View File
@@ -1,8 +1,11 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="acpica" type="staticlibrary" allowwarnings="true">
<module name="acpica" type="staticlibrary">
<define name="ACPI_USE_LOCAL_CACHE"/>
<include base="acpica">include</include>
<directory name="dispatcher">
<file>dsargs.c</file>
<file>dscontrol.c</file>
<file>dsfield.c</file>
<file>dsinit.c</file>
<file>dsmethod.c</file>
@@ -12,25 +15,31 @@
<file>dsutils.c</file>
<file>dswexec.c</file>
<file>dswload.c</file>
<file>dswload2.c</file>
<file>dswscope.c</file>
<file>dswstate.c</file>
</directory>
<directory name="events">
<file>evevent.c</file>
<file>evglock.c</file>
<file>evgpe.c</file>
<file>evgpeblk.c</file>
<file>evgpeinit.c</file>
<file>evgpeutil.c</file>
<file>evmisc.c</file>
<file>evregion.c</file>
<file>evrgnini.c</file>
<file>evsci.c</file>
<file>evxface.c</file>
<file>evxfevnt.c</file>
<file>evxfgpe.c</file>
<file>evxfregn.c</file>
</directory>
<directory name="executer">
<file>exconfig.c</file>
<file>exconvrt.c</file>
<file>excreate.c</file>
<file>exdebug.c</file>
<file>exdump.c</file>
<file>exfield.c</file>
<file>exfldio.c</file>
@@ -55,6 +64,7 @@
<directory name="hardware">
<file>hwacpi.c</file>
<file>hwgpe.c</file>
<file>hwpci.c</file>
<file>hwregs.c</file>
<file>hwsleep.c</file>
<file>hwtimer.c</file>
@@ -121,6 +131,7 @@
<file>utclib.c</file>
<file>utcopy.c</file>
<file>utdebug.c</file>
<file>utdecode.c</file>
<file>utdelete.c</file>
<file>uteval.c</file>
<file>utglobal.c</file>
@@ -131,9 +142,11 @@
<file>utmisc.c</file>
<file>utmutex.c</file>
<file>utobject.c</file>
<file>utosi.c</file>
<file>utresrc.c</file>
<file>utstate.c</file>
<file>uttrack.c</file>
<file>utxface.c</file>
<file>utxferror.c</file>
</directory>
</module>
@@ -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 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -314,7 +314,7 @@ AcpiDsGetFieldNames (
ACPI_PARSE_OBJECT *Arg)
{
ACPI_STATUS Status;
ACPI_INTEGER Position;
UINT64 Position;
ACPI_FUNCTION_TRACE_PTR (DsGetFieldNames, Info);
@@ -338,8 +338,8 @@ AcpiDsGetFieldNames (
{
case AML_INT_RESERVEDFIELD_OP:
Position = (ACPI_INTEGER) Info->FieldBitPosition
+ (ACPI_INTEGER) Arg->Common.Value.Size;
Position = (UINT64) Info->FieldBitPosition
+ (UINT64) Arg->Common.Value.Size;
if (Position > ACPI_UINT32_MAX)
{
@@ -406,8 +406,8 @@ AcpiDsGetFieldNames (
/* Keep track of bit position for the next field */
Position = (ACPI_INTEGER) Info->FieldBitPosition
+ (ACPI_INTEGER) Arg->Common.Value.Size;
Position = (UINT64) Info->FieldBitPosition
+ (UINT64) Arg->Common.Value.Size;
if (Position > ACPI_UINT32_MAX)
{
@@ -424,7 +424,7 @@ AcpiDsGetFieldNames (
default:
ACPI_ERROR ((AE_INFO,
"Invalid opcode in field list: %X", Arg->Common.AmlOpcode));
"Invalid opcode in field list: 0x%X", Arg->Common.AmlOpcode));
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
}
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -263,12 +263,12 @@ AcpiDsInitializeObjects (
"**** Starting initialization of namespace objects ****\n"));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Parsing all Control Methods:"));
Info.MethodCount = 0;
Info.OpRegionCount = 0;
Info.ObjectCount = 0;
Info.DeviceCount = 0;
Info.TableIndex = TableIndex;
Info.OwnerId = OwnerId;
/* Set all init info to zero */
ACPI_MEMSET (&Info, 0, sizeof (ACPI_INIT_WALK_INFO));
Info.OwnerId = OwnerId;
Info.TableIndex = TableIndex;
/* Walk entire namespace from the supplied root */
@@ -297,12 +297,12 @@ AcpiDsInitializeObjects (
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
"\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
"\nTable [%4.4s](id %4.4X) - %u Objects with %u Devices %u Methods %u Regions\n",
Table->Signature, OwnerId, Info.ObjectCount,
Info.DeviceCount, Info.MethodCount, Info.OpRegionCount));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"%hd Methods, %hd Regions\n", Info.MethodCount, Info.OpRegionCount));
"%u Methods, %u Regions\n", Info.MethodCount, Info.OpRegionCount));
return_ACPI_STATUS (AE_OK);
}
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, 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
@@ -318,7 +317,7 @@ AcpiDsBeginMethodExecution (
(WalkState->Thread->CurrentSyncLevel > ObjDesc->Method.Mutex->Mutex.SyncLevel))
{
ACPI_ERROR ((AE_INFO,
"Cannot acquire Mutex for method [%4.4s], current SyncLevel is too large (%d)",
"Cannot acquire Mutex for method [%4.4s], current SyncLevel is too large (%u)",
AcpiUtGetNodeName (MethodNode),
WalkState->Thread->CurrentSyncLevel));
@@ -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,13 +693,31 @@ 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))
{
AcpiNsDeleteNamespaceByOwner (MethodDesc->Method.OwnerId);
/* Delete any direct children of (created by) this method */
AcpiNsDeleteNamespaceSubtree (WalkState->MethodNode);
/*
* 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.InfoFlags & ACPI_METHOD_MODIFIED_NAMESPACE)
{
AcpiNsDeleteNamespaceByOwner (MethodDesc->Method.OwnerId);
MethodDesc->Method.InfoFlags &= ~ACPI_METHOD_MODIFIED_NAMESPACE;
}
}
}
@@ -725,7 +742,7 @@ AcpiDsTerminateControlMethod (
* we immediately reuse it for the next thread executing this method
*/
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"*** Completed execution of one thread, %d threads remaining\n",
"*** Completed execution of one thread, %u threads remaining\n",
MethodDesc->Method.ThreadCount));
}
else
@@ -737,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 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -188,8 +188,7 @@ AcpiDsMethodDataInit (
WalkState->Arguments[i].Name.Integer |= (i << 24);
WalkState->Arguments[i].DescriptorType = ACPI_DESC_TYPE_NAMED;
WalkState->Arguments[i].Type = ACPI_TYPE_ANY;
WalkState->Arguments[i].Flags =
ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG;
WalkState->Arguments[i].Flags = ANOBJ_METHOD_ARG;
}
/* Init the method locals */
@@ -201,8 +200,7 @@ AcpiDsMethodDataInit (
WalkState->LocalVariables[i].Name.Integer |= (i << 24);
WalkState->LocalVariables[i].DescriptorType = ACPI_DESC_TYPE_NAMED;
WalkState->LocalVariables[i].Type = ACPI_TYPE_ANY;
WalkState->LocalVariables[i].Flags =
ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL;
WalkState->LocalVariables[i].Flags = ANOBJ_METHOD_LOCAL;
}
return_VOID;
@@ -238,7 +236,7 @@ AcpiDsMethodDataDeleteAll (
{
if (WalkState->LocalVariables[Index].Object)
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Local%d=%p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Local%u=%p\n",
Index, WalkState->LocalVariables[Index].Object));
/* Detach object (if present) and remove a reference */
@@ -253,7 +251,7 @@ AcpiDsMethodDataDeleteAll (
{
if (WalkState->Arguments[Index].Object)
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Arg%d=%p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Arg%u=%p\n",
Index, WalkState->Arguments[Index].Object));
/* Detach object (if present) and remove a reference */
@@ -322,7 +320,7 @@ AcpiDsMethodDataInitArgs (
Index++;
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%d args passed to method\n", Index));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%u args passed to method\n", Index));
return_ACPI_STATUS (AE_OK);
}
@@ -363,7 +361,7 @@ AcpiDsMethodDataGetNode (
if (Index > ACPI_METHOD_MAX_LOCAL)
{
ACPI_ERROR ((AE_INFO,
"Local index %d is invalid (max %d)",
"Local index %u is invalid (max %u)",
Index, ACPI_METHOD_MAX_LOCAL));
return_ACPI_STATUS (AE_AML_INVALID_INDEX);
}
@@ -378,7 +376,7 @@ AcpiDsMethodDataGetNode (
if (Index > ACPI_METHOD_MAX_ARG)
{
ACPI_ERROR ((AE_INFO,
"Arg index %d is invalid (max %d)",
"Arg index %u is invalid (max %u)",
Index, ACPI_METHOD_MAX_ARG));
return_ACPI_STATUS (AE_AML_INVALID_INDEX);
}
@@ -389,7 +387,7 @@ AcpiDsMethodDataGetNode (
break;
default:
ACPI_ERROR ((AE_INFO, "Type %d is invalid", Type));
ACPI_ERROR ((AE_INFO, "Type %u is invalid", Type));
return_ACPI_STATUS (AE_TYPE);
}
@@ -429,7 +427,7 @@ AcpiDsMethodDataSetValue (
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"NewObj %p Type %2.2X, Refs=%d [%s]\n", Object,
"NewObj %p Type %2.2X, Refs=%u [%s]\n", Object,
Type, Object->Common.ReferenceCount,
AcpiUtGetTypeName (Object->Common.Type)));
@@ -540,7 +538,7 @@ AcpiDsMethodDataGetValue (
case ACPI_REFCLASS_ARG:
ACPI_ERROR ((AE_INFO,
"Uninitialized Arg[%d] at node %p",
"Uninitialized Arg[%u] at node %p",
Index, Node));
return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG);
@@ -555,7 +553,7 @@ AcpiDsMethodDataGetValue (
default:
ACPI_ERROR ((AE_INFO, "Not a Arg/Local opcode: %X", Type));
ACPI_ERROR ((AE_INFO, "Not a Arg/Local opcode: 0x%X", Type));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
}
@@ -667,7 +665,7 @@ AcpiDsStoreObjectToLocal (
ACPI_FUNCTION_TRACE (DsStoreObjectToLocal);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Type=%2.2X Index=%d Obj=%p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Type=%2.2X Index=%u Obj=%p\n",
Type, Index, ObjDesc));
/* Parameter validation */
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -159,6 +159,7 @@ AcpiDsBuildInternalObject (
{
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_STATUS Status;
ACPI_OBJECT_TYPE Type;
ACPI_FUNCTION_TRACE (DsBuildInternalObject);
@@ -241,7 +242,20 @@ AcpiDsBuildInternalObject (
return_ACPI_STATUS (Status);
}
switch (Op->Common.Node->Type)
/*
* Special handling for Alias objects. We need to setup the type
* and the Op->Common.Node to point to the Alias target. Note,
* Alias has at most one level of indirection internally.
*/
Type = Op->Common.Node->Type;
if (Type == ACPI_TYPE_LOCAL_ALIAS)
{
Type = ObjDesc->Common.Type;
Op->Common.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE,
Op->Common.Node->Object);
}
switch (Type)
{
/*
* For these types, we need the actual node, not the subobject.
@@ -365,7 +379,7 @@ AcpiDsBuildInternalBufferObj (
if (ByteList->Common.AmlOpcode != AML_INT_BYTELIST_OP)
{
ACPI_ERROR ((AE_INFO,
"Expecting bytelist, got AML opcode %X in op %p",
"Expecting bytelist, found AML opcode 0x%X in op %p",
ByteList->Common.AmlOpcode, ByteList));
AcpiUtRemoveReference (ObjDesc);
@@ -599,7 +613,7 @@ AcpiDsBuildInternalPackageObj (
}
ACPI_INFO ((AE_INFO,
"Actual Package length (0x%X) is larger than NumElements field (0x%X), truncated\n",
"Actual Package length (%u) is larger than NumElements field (%u), truncated\n",
i, ElementCount));
}
else if (i < ElementCount)
@@ -609,7 +623,7 @@ AcpiDsBuildInternalPackageObj (
* Note: this is not an error, the package is padded out with NULLs.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Package List length (0x%X) smaller than NumElements count (0x%X), padded with null elements\n",
"Package List length (%u) smaller than NumElements count (%u), padded with null elements\n",
i, ElementCount));
}
@@ -787,7 +801,7 @@ AcpiDsInitObjectFromOp (
case AML_ONES_OP:
ObjDesc->Integer.Value = ACPI_INTEGER_MAX;
ObjDesc->Integer.Value = ACPI_UINT64_MAX;
/* Truncate value if we are executing from a 32-bit ACPI table */
@@ -804,7 +818,7 @@ AcpiDsInitObjectFromOp (
default:
ACPI_ERROR ((AE_INFO,
"Unknown constant opcode %X", Opcode));
"Unknown constant opcode 0x%X", Opcode));
Status = AE_AML_OPERAND_TYPE;
break;
}
@@ -821,7 +835,7 @@ AcpiDsInitObjectFromOp (
default:
ACPI_ERROR ((AE_INFO, "Unknown Integer type %X",
ACPI_ERROR ((AE_INFO, "Unknown Integer type 0x%X",
OpInfo->Type));
Status = AE_AML_OPERAND_TYPE;
break;
@@ -902,7 +916,7 @@ AcpiDsInitObjectFromOp (
default:
ACPI_ERROR ((AE_INFO,
"Unimplemented reference type for AML opcode: %4.4X", Opcode));
"Unimplemented reference type for AML opcode: 0x%4.4X", Opcode));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
break;
@@ -912,7 +926,7 @@ AcpiDsInitObjectFromOp (
default:
ACPI_ERROR ((AE_INFO, "Unimplemented data type: %X",
ACPI_ERROR ((AE_INFO, "Unimplemented data type: 0x%X",
ObjDesc->Common.Type));
Status = AE_AML_OPERAND_TYPE;
@@ -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 - 2009, 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, AcpiNsGetParentNode (Node),
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, AcpiNsGetParentNode (Node),
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 NS node in buffer obj %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 NS 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, AcpiNsGetParentNode (Node),
ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiDsInitializeRegion
@@ -678,7 +307,7 @@ AcpiDsInitBufferField (
default:
ACPI_ERROR ((AE_INFO,
"Unknown field creation opcode %02x",
"Unknown field creation opcode 0x%02X",
AmlOpcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
@@ -690,7 +319,7 @@ AcpiDsInitBufferField (
(8 * (UINT32) BufferDesc->Buffer.Length))
{
ACPI_ERROR ((AE_INFO,
"Field [%4.4s] at %d exceeds Buffer [%4.4s] size %d (bits)",
"Field [%4.4s] at %u exceeds Buffer [%4.4s] size %u (bits)",
AcpiUtGetNodeName (ResultDesc),
BitOffset + BitCount,
AcpiUtGetNodeName (BufferDesc->Buffer.Node),
@@ -806,7 +435,7 @@ AcpiDsEvalBufferFieldOperands (
ACPI_WALK_OPERANDS, WalkState);
if (ACPI_FAILURE (Status))
{
ACPI_ERROR ((AE_INFO, "(%s) bad operand(s) (%X)",
ACPI_ERROR ((AE_INFO, "(%s) bad operand(s), status 0x%X",
AcpiPsGetOpcodeName (Op->Common.AmlOpcode), Status));
return_ACPI_STATUS (Status);
@@ -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=%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 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -875,7 +875,7 @@ AcpiDsCreateOperands (
Index--;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%d (%p) done, Arg1=%p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%u (%p) done, Arg1=%p\n",
Index, Arg, FirstArg));
}
@@ -890,7 +890,7 @@ Cleanup:
*/
AcpiDsObjStackPopAndDelete (ArgCount, WalkState);
ACPI_EXCEPTION ((AE_INFO, Status, "While creating Arg %d", Index));
ACPI_EXCEPTION ((AE_INFO, Status, "While creating Arg %u", Index));
return_ACPI_STATUS (Status);
}
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -227,7 +227,7 @@ AcpiDsGetPredicateValue (
if (LocalObjDesc->Common.Type != ACPI_TYPE_INTEGER)
{
ACPI_ERROR ((AE_INFO,
"Bad predicate (not an integer) ObjDesc=%p State=%p Type=%X",
"Bad predicate (not an integer) ObjDesc=%p State=%p Type=0x%X",
ObjDesc, WalkState, ObjDesc->Common.Type));
Status = AE_AML_OPERAND_TYPE;
@@ -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;
@@ -463,7 +479,7 @@ AcpiDsExecEndOp (
if (OpClass == AML_CLASS_UNKNOWN)
{
ACPI_ERROR ((AE_INFO, "Unknown opcode %X", Op->Common.AmlOpcode));
ACPI_ERROR ((AE_INFO, "Unknown opcode 0x%X", Op->Common.AmlOpcode));
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
}
@@ -783,7 +799,7 @@ AcpiDsExecEndOp (
default:
ACPI_ERROR ((AE_INFO,
"Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p",
"Unimplemented opcode, class=0x%X type=0x%X Opcode=-0x%X Op=%p",
OpClass, OpType, Op->Common.AmlOpcode, Op));
Status = AE_NOT_IMPLEMENTED;
@@ -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 - 2009, 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 - 2009, 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 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -277,7 +277,7 @@ AcpiDsResultPush (
if (!Object)
{
ACPI_ERROR ((AE_INFO,
"Null Object! Obj=%p State=%p Num=%X",
"Null Object! Obj=%p State=%p Num=%u",
Object, WalkState, WalkState->ResultCount));
return (AE_BAD_PARAMETER);
}
@@ -323,7 +323,7 @@ AcpiDsResultStackPush (
if (((UINT32) WalkState->ResultSize + ACPI_RESULTS_FRAME_OBJ_NUM) >
ACPI_RESULTS_OBJ_NUM_MAX)
{
ACPI_ERROR ((AE_INFO, "Result stack overflow: State=%p Num=%X",
ACPI_ERROR ((AE_INFO, "Result stack overflow: State=%p Num=%u",
WalkState, WalkState->ResultSize));
return (AE_STACK_OVERFLOW);
}
@@ -426,7 +426,7 @@ AcpiDsObjStackPush (
if (WalkState->NumOperands >= ACPI_OBJ_NUM_OPERANDS)
{
ACPI_ERROR ((AE_INFO,
"Object stack overflow! Obj=%p State=%p #Ops=%X",
"Object stack overflow! Obj=%p State=%p #Ops=%u",
Object, WalkState, WalkState->NumOperands));
return (AE_STACK_OVERFLOW);
}
@@ -480,7 +480,7 @@ AcpiDsObjStackPop (
if (WalkState->NumOperands == 0)
{
ACPI_ERROR ((AE_INFO,
"Object stack underflow! Count=%X State=%p #Ops=%X",
"Object stack underflow! Count=%X State=%p #Ops=%u",
PopCount, WalkState, WalkState->NumOperands));
return (AE_STACK_UNDERFLOW);
}
@@ -491,7 +491,7 @@ AcpiDsObjStackPop (
WalkState->Operands [WalkState->NumOperands] = NULL;
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n",
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%u\n",
PopCount, WalkState, WalkState->NumOperands));
return (AE_OK);
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, 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);
}
}
@@ -415,7 +375,7 @@ AcpiEvFixedEventDispatch (
ACPI_DISABLE_EVENT);
ACPI_ERROR ((AE_INFO,
"No installed handler for fixed event [%08X]",
"No installed handler for fixed event [0x%08X]",
Event));
return (ACPI_INTERRUPT_NOT_HANDLED);
@@ -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);
}
+294 -291
View File
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -134,77 +134,26 @@ AcpiEvAsynchEnableGpe (
/*******************************************************************************
*
* FUNCTION: AcpiEvSetGpeType
*
* PARAMETERS: GpeEventInfo - GPE to set
* Type - New type
*
* RETURN: Status
*
* DESCRIPTION: Sets the new type for the GPE (wake, run, or wake/run)
*
******************************************************************************/
ACPI_STATUS
AcpiEvSetGpeType (
ACPI_GPE_EVENT_INFO *GpeEventInfo,
UINT8 Type)
{
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (EvSetGpeType);
/* Validate type and update register enable masks */
switch (Type)
{
case ACPI_GPE_TYPE_WAKE:
case ACPI_GPE_TYPE_RUNTIME:
case ACPI_GPE_TYPE_WAKE_RUN:
break;
default:
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Disable the GPE if currently enabled */
Status = AcpiEvDisableGpe (GpeEventInfo);
/* Clear the type bits and insert the new Type */
GpeEventInfo->Flags &= ~ACPI_GPE_TYPE_MASK;
GpeEventInfo->Flags |= Type;
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiEvUpdateGpeEnableMasks
* FUNCTION: AcpiEvUpdateGpeEnableMask
*
* PARAMETERS: GpeEventInfo - GPE to update
* Type - What to do: ACPI_GPE_DISABLE or
* ACPI_GPE_ENABLE
*
* RETURN: Status
*
* DESCRIPTION: Updates GPE register enable masks based on the GPE type
* DESCRIPTION: Updates GPE register enable mask based upon whether there are
* runtime references to this GPE
*
******************************************************************************/
ACPI_STATUS
AcpiEvUpdateGpeEnableMasks (
ACPI_GPE_EVENT_INFO *GpeEventInfo,
UINT8 Type)
AcpiEvUpdateGpeEnableMask (
ACPI_GPE_EVENT_INFO *GpeEventInfo)
{
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
UINT8 RegisterBit;
UINT32 RegisterBit;
ACPI_FUNCTION_TRACE (EvUpdateGpeEnableMasks);
ACPI_FUNCTION_TRACE (EvUpdateGpeEnableMask);
GpeRegisterInfo = GpeEventInfo->RegisterInfo;
@@ -213,39 +162,17 @@ AcpiEvUpdateGpeEnableMasks (
return_ACPI_STATUS (AE_NOT_EXIST);
}
RegisterBit = (UINT8)
(1 << (GpeEventInfo->GpeNumber - GpeRegisterInfo->BaseGpeNumber));
RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo);
/* 1) Disable case. Simply clear all enable bits */
/* Clear the run bit up front */
if (Type == ACPI_GPE_DISABLE)
ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForRun, RegisterBit);
/* Set the mask bit only if there are references to this GPE */
if (GpeEventInfo->RuntimeCount)
{
ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForWake, RegisterBit);
ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForRun, RegisterBit);
return_ACPI_STATUS (AE_OK);
}
/* 2) Enable case. Set/Clear the appropriate enable bits */
switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK)
{
case ACPI_GPE_TYPE_WAKE:
ACPI_SET_BIT (GpeRegisterInfo->EnableForWake, RegisterBit);
ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForRun, RegisterBit);
break;
case ACPI_GPE_TYPE_RUNTIME:
ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForWake, RegisterBit);
ACPI_SET_BIT (GpeRegisterInfo->EnableForRun, RegisterBit);
break;
case ACPI_GPE_TYPE_WAKE_RUN:
ACPI_SET_BIT (GpeRegisterInfo->EnableForWake, RegisterBit);
ACPI_SET_BIT (GpeRegisterInfo->EnableForRun, RegisterBit);
break;
default:
return_ACPI_STATUS (AE_BAD_PARAMETER);
ACPI_SET_BIT (GpeRegisterInfo->EnableForRun, (UINT8) RegisterBit);
}
return_ACPI_STATUS (AE_OK);
@@ -257,19 +184,16 @@ AcpiEvUpdateGpeEnableMasks (
* FUNCTION: AcpiEvEnableGpe
*
* PARAMETERS: GpeEventInfo - GPE to enable
* WriteToHardware - Enable now, or just mark data structs
* (WAKE GPEs should be deferred)
*
* RETURN: Status
*
* DESCRIPTION: Enable a GPE based on the GPE type
* DESCRIPTION: Clear a GPE of stale events and enable it.
*
******************************************************************************/
ACPI_STATUS
AcpiEvEnableGpe (
ACPI_GPE_EVENT_INFO *GpeEventInfo,
BOOLEAN WriteToHardware)
ACPI_GPE_EVENT_INFO *GpeEventInfo)
{
ACPI_STATUS Status;
@@ -277,132 +201,174 @@ AcpiEvEnableGpe (
ACPI_FUNCTION_TRACE (EvEnableGpe);
/* Make sure HW enable masks are updated */
/*
* 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) ==
ACPI_GPE_DISPATCH_NONE)
{
return_ACPI_STATUS (AE_NO_HANDLER);
}
Status = AcpiEvUpdateGpeEnableMasks (GpeEventInfo, ACPI_GPE_ENABLE);
/* Clear the GPE (of stale events) */
Status = AcpiHwClearGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Mark wake-enabled or HW enable, or both */
/* Enable the requested GPE */
switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK)
{
case ACPI_GPE_TYPE_WAKE:
ACPI_SET_BIT (GpeEventInfo->Flags, ACPI_GPE_WAKE_ENABLED);
break;
case ACPI_GPE_TYPE_WAKE_RUN:
ACPI_SET_BIT (GpeEventInfo->Flags, ACPI_GPE_WAKE_ENABLED);
/*lint -fallthrough */
case ACPI_GPE_TYPE_RUNTIME:
ACPI_SET_BIT (GpeEventInfo->Flags, ACPI_GPE_RUN_ENABLED);
if (WriteToHardware)
{
/* Clear the GPE (of stale events), then enable it */
Status = AcpiHwClearGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Enable the requested runtime GPE */
Status = AcpiHwWriteGpeEnableReg (GpeEventInfo);
}
break;
default:
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
return_ACPI_STATUS (AE_OK);
Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_ENABLE);
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiEvDisableGpe
* FUNCTION: AcpiEvAddGpeReference
*
* PARAMETERS: GpeEventInfo - GPE to disable
* PARAMETERS: GpeEventInfo - Add a reference to this GPE
*
* RETURN: Status
*
* DESCRIPTION: Disable a GPE based on the GPE type
* DESCRIPTION: Add a reference to a GPE. On the first reference, the GPE is
* hardware-enabled.
*
******************************************************************************/
ACPI_STATUS
AcpiEvDisableGpe (
AcpiEvAddGpeReference (
ACPI_GPE_EVENT_INFO *GpeEventInfo)
{
ACPI_STATUS Status;
ACPI_STATUS Status = AE_OK;
ACPI_FUNCTION_TRACE (EvDisableGpe);
ACPI_FUNCTION_TRACE (EvAddGpeReference);
/*
* Note: Always disable the GPE, even if we think that that it is already
* disabled. It is possible that the AML or some other code has enabled
* the GPE behind our back.
*/
/* Make sure HW enable masks are updated */
Status = AcpiEvUpdateGpeEnableMasks (GpeEventInfo, ACPI_GPE_DISABLE);
if (ACPI_FAILURE (Status))
if (GpeEventInfo->RuntimeCount == ACPI_UINT8_MAX)
{
return_ACPI_STATUS (Status);
return_ACPI_STATUS (AE_LIMIT);
}
/* Clear the appropriate enabled flags for this GPE */
switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK)
GpeEventInfo->RuntimeCount++;
if (GpeEventInfo->RuntimeCount == 1)
{
case ACPI_GPE_TYPE_WAKE:
/* Enable on first reference */
ACPI_CLEAR_BIT (GpeEventInfo->Flags, ACPI_GPE_WAKE_ENABLED);
break;
Status = AcpiEvUpdateGpeEnableMask (GpeEventInfo);
if (ACPI_SUCCESS (Status))
{
Status = AcpiEvEnableGpe (GpeEventInfo);
}
case ACPI_GPE_TYPE_WAKE_RUN:
ACPI_CLEAR_BIT (GpeEventInfo->Flags, ACPI_GPE_WAKE_ENABLED);
/*lint -fallthrough */
case ACPI_GPE_TYPE_RUNTIME:
/* Disable the requested runtime GPE */
ACPI_CLEAR_BIT (GpeEventInfo->Flags, ACPI_GPE_RUN_ENABLED);
break;
default:
break;
if (ACPI_FAILURE (Status))
{
GpeEventInfo->RuntimeCount--;
}
}
/*
* Always H/W disable this GPE, even if we don't know the GPE type.
* Simply clear the enable bit for this particular GPE, but do not
* write out the current GPE enable mask since this may inadvertently
* enable GPEs too early. An example is a rogue GPE that has arrived
* during ACPICA initialization - possibly because AML or other code
* has enabled the GPE.
*/
Status = AcpiHwLowDisableGpe (GpeEventInfo);
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
*
* PARAMETERS: GpeNumber - Raw GPE number
* GpeBlock - A GPE info block
*
* RETURN: A GPE EventInfo struct. NULL if not a valid GPE (The GpeNumber
* is not within the specified GPE block)
*
* DESCRIPTION: Returns the EventInfo struct associated with this GPE. This is
* the low-level implementation of EvGetGpeEventInfo.
*
******************************************************************************/
ACPI_GPE_EVENT_INFO *
AcpiEvLowGetGpeInfo (
UINT32 GpeNumber,
ACPI_GPE_BLOCK_INFO *GpeBlock)
{
UINT32 GpeIndex;
/*
* Validate that the GpeNumber is within the specified GpeBlock.
* (Two steps)
*/
if (!GpeBlock ||
(GpeNumber < GpeBlock->BlockBaseNumber))
{
return (NULL);
}
GpeIndex = GpeNumber - GpeBlock->BlockBaseNumber;
if (GpeIndex >= GpeBlock->GpeCount)
{
return (NULL);
}
return (&GpeBlock->EventInfo[GpeIndex]);
}
/*******************************************************************************
*
* FUNCTION: AcpiEvGetGpeEventInfo
@@ -426,14 +392,14 @@ AcpiEvGetGpeEventInfo (
UINT32 GpeNumber)
{
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_GPE_BLOCK_INFO *GpeBlock;
ACPI_GPE_EVENT_INFO *GpeInfo;
UINT32 i;
ACPI_FUNCTION_ENTRY ();
/* A NULL GpeBlock means use the FADT-defined GPE block(s) */
/* A NULL GpeDevice means use the FADT-defined GPE block(s) */
if (!GpeDevice)
{
@@ -441,16 +407,11 @@ AcpiEvGetGpeEventInfo (
for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++)
{
GpeBlock = AcpiGbl_GpeFadtBlocks[i];
if (GpeBlock)
GpeInfo = AcpiEvLowGetGpeInfo (GpeNumber,
AcpiGbl_GpeFadtBlocks[i]);
if (GpeInfo)
{
if ((GpeNumber >= GpeBlock->BlockBaseNumber) &&
(GpeNumber < GpeBlock->BlockBaseNumber +
(GpeBlock->RegisterCount * 8)))
{
return (&GpeBlock->EventInfo[GpeNumber -
GpeBlock->BlockBaseNumber]);
}
return (GpeInfo);
}
}
@@ -468,15 +429,7 @@ AcpiEvGetGpeEventInfo (
return (NULL);
}
GpeBlock = ObjDesc->Device.GpeBlock;
if ((GpeNumber >= GpeBlock->BlockBaseNumber) &&
(GpeNumber < GpeBlock->BlockBaseNumber + (GpeBlock->RegisterCount * 8)))
{
return (&GpeBlock->EventInfo[GpeNumber - GpeBlock->BlockBaseNumber]);
}
return (NULL);
return (AcpiEvLowGetGpeInfo (GpeNumber, ObjDesc->Device.GpeBlock));
}
@@ -505,7 +458,7 @@ AcpiEvGpeDetect (
UINT8 EnabledStatusByte;
UINT32 StatusReg;
UINT32 EnableReg;
//ACPI_CPU_FLAGS Flags;
ACPI_CPU_FLAGS Flags;
UINT32 i;
UINT32 j;
@@ -524,7 +477,7 @@ AcpiEvGpeDetect (
* Note: Not necessary to obtain the hardware lock, since the GPE
* registers are owned by the GpeLock.
*/
//Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
/* Examine all GPE blocks attached to this interrupt level */
@@ -541,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);
@@ -558,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 */
@@ -583,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);
@@ -596,7 +559,7 @@ AcpiEvGpeDetect (
UnlockAndExit:
//AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
return (IntStatus);
}
@@ -654,10 +617,6 @@ AcpiEvAsynchExecuteGpeMethod (
return_VOID;
}
/* Set the GPE flags for return to enabled state */
(void) AcpiEvEnableGpe (GpeEventInfo, FALSE);
/*
* Take a snapshot of the GPE info for this level - we copy the info to
* prevent a race condition with RemoveHandler/RemoveBlock.
@@ -671,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));
@@ -688,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;
@@ -704,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 */
@@ -723,6 +701,7 @@ AcpiEvAsynchExecuteGpeMethod (
* FUNCTION: AcpiEvAsynchEnableGpe
*
* PARAMETERS: Context (GpeEventInfo) - Info for this GPE
* Callback from AcpiOsExecute
*
* RETURN: None
*
@@ -736,39 +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 */
(void) AcpiHwWriteGpeEnableReg (GpeEventInfo);
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
*
@@ -781,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
@@ -803,58 +818,55 @@ AcpiEvGpeDispatch (
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Unable to clear GPE[%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[%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 = AcpiEvDisableGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Unable to disable GPE[%2X]", GpeNumber));
return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED);
}
case ACPI_GPE_DISPATCH_NOTIFY:
/*
* Execute the method associated with the GPE
@@ -865,30 +877,21 @@ AcpiEvGpeDispatch (
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Unable to queue handler for GPE[%2X] - event disabled",
"Unable to queue handler for GPE%02X - event disabled",
GpeNumber));
}
break;
default:
/* No handler or method to run! */
ACPI_ERROR ((AE_INFO,
"No handler or method for GPE[%2X], disabling event",
GpeNumber));
/*
* Disable the GPE. The GPE will remain disabled until the ACPICA
* Core Subsystem is restarted, or a handler is installed.
* No handler or method to run!
* 03/2010: This case should no longer be possible. We will not allow
* a GPE to be enabled if it has no handler or method.
*/
Status = AcpiEvDisableGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Unable to disable GPE[%2X]", GpeNumber));
return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED);
}
ACPI_ERROR ((AE_INFO,
"No handler or method for GPE%02X, disabling event",
GpeNumber));
break;
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,531 @@
/******************************************************************************
*
* Module Name: evgpeinit - System GPE initialization and update
*
*****************************************************************************/
/******************************************************************************
*
* 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 "acnamesp.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
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Initialize the GPE data structures and the FADT GPE 0/1 blocks
*
******************************************************************************/
ACPI_STATUS
AcpiEvGpeInitialize (
void)
{
UINT32 RegisterCount0 = 0;
UINT32 RegisterCount1 = 0;
UINT32 GpeNumberMax = 0;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (EvGpeInitialize);
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/*
* Initialize the GPE Block(s) defined in the FADT
*
* Why the GPE register block lengths are divided by 2: From the ACPI
* Spec, section "General-Purpose Event Registers", we have:
*
* "Each register block contains two registers of equal length
* GPEx_STS and GPEx_EN (where x is 0 or 1). The length of the
* GPE0_STS and GPE0_EN registers is equal to half the GPE0_LEN
* The length of the GPE1_STS and GPE1_EN registers is equal to
* half the GPE1_LEN. If a generic register block is not supported
* then its respective block pointer and block length values in the
* FADT table contain zeros. The GPE0_LEN and GPE1_LEN do not need
* to be the same size."
*/
/*
* Determine the maximum GPE number for this machine.
*
* Note: both GPE0 and GPE1 are optional, and either can exist without
* the other.
*
* If EITHER the register length OR the block address are zero, then that
* particular block is not supported.
*/
if (AcpiGbl_FADT.Gpe0BlockLength &&
AcpiGbl_FADT.XGpe0Block.Address)
{
/* GPE block 0 exists (has both length and address > 0) */
RegisterCount0 = (UINT16) (AcpiGbl_FADT.Gpe0BlockLength / 2);
GpeNumberMax = (RegisterCount0 * ACPI_GPE_REGISTER_WIDTH) - 1;
/* Install GPE Block 0 */
Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice,
&AcpiGbl_FADT.XGpe0Block, RegisterCount0, 0,
AcpiGbl_FADT.SciInterrupt, &AcpiGbl_GpeFadtBlocks[0]);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Could not create GPE Block 0"));
}
}
if (AcpiGbl_FADT.Gpe1BlockLength &&
AcpiGbl_FADT.XGpe1Block.Address)
{
/* GPE block 1 exists (has both length and address > 0) */
RegisterCount1 = (UINT16) (AcpiGbl_FADT.Gpe1BlockLength / 2);
/* Check for GPE0/GPE1 overlap (if both banks exist) */
if ((RegisterCount0) &&
(GpeNumberMax >= AcpiGbl_FADT.Gpe1Base))
{
ACPI_ERROR ((AE_INFO,
"GPE0 block (GPE 0 to %u) overlaps the GPE1 block "
"(GPE %u to %u) - Ignoring GPE1",
GpeNumberMax, AcpiGbl_FADT.Gpe1Base,
AcpiGbl_FADT.Gpe1Base +
((RegisterCount1 * ACPI_GPE_REGISTER_WIDTH) - 1)));
/* Ignore GPE1 block by setting the register count to zero */
RegisterCount1 = 0;
}
else
{
/* Install GPE Block 1 */
Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice,
&AcpiGbl_FADT.XGpe1Block, RegisterCount1,
AcpiGbl_FADT.Gpe1Base,
AcpiGbl_FADT.SciInterrupt, &AcpiGbl_GpeFadtBlocks[1]);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Could not create GPE Block 1"));
}
/*
* GPE0 and GPE1 do not have to be contiguous in the GPE number
* space. However, GPE0 always starts at GPE number zero.
*/
GpeNumberMax = AcpiGbl_FADT.Gpe1Base +
((RegisterCount1 * ACPI_GPE_REGISTER_WIDTH) - 1);
}
}
/* Exit if there are no GPE registers */
if ((RegisterCount0 + RegisterCount1) == 0)
{
/* GPEs are not required by ACPI, this is OK */
ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
"There are no GPE blocks defined in the FADT\n"));
Status = AE_OK;
goto Cleanup;
}
/* Check for Max GPE number out-of-range */
if (GpeNumberMax > ACPI_GPE_MAX)
{
ACPI_ERROR ((AE_INFO,
"Maximum GPE number from FADT is too large: 0x%X",
GpeNumberMax));
Status = AE_BAD_VALUE;
goto Cleanup;
}
Cleanup:
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiEvUpdateGpes
*
* PARAMETERS: TableOwnerId - ID of the newly-loaded ACPI table
*
* RETURN: None
*
* 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.
*
******************************************************************************/
void
AcpiEvUpdateGpes (
ACPI_OWNER_ID TableOwnerId)
{
ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
ACPI_GPE_BLOCK_INFO *GpeBlock;
ACPI_GPE_WALK_INFO WalkInfo;
ACPI_STATUS Status = AE_OK;
/*
* Find any _Lxx/_Exx GPE methods that have just been loaded.
*
* Any GPEs that correspond to new _Lxx/_Exx methods are immediately
* enabled.
*
* Examine the namespace underneath each GpeDevice within the
* GpeBlock lists.
*/
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
return;
}
WalkInfo.Count = 0;
WalkInfo.OwnerId = TableOwnerId;
WalkInfo.ExecuteByOwnerId = TRUE;
/* Walk the interrupt level descriptor list */
GpeXruptInfo = AcpiGbl_GpeXruptListHead;
while (GpeXruptInfo)
{
/* Walk all Gpe Blocks attached to this interrupt level */
GpeBlock = GpeXruptInfo->GpeBlockListHead;
while (GpeBlock)
{
WalkInfo.GpeBlock = GpeBlock;
WalkInfo.GpeDevice = GpeBlock->Node;
Status = AcpiNsWalkNamespace (ACPI_TYPE_METHOD,
WalkInfo.GpeDevice, ACPI_UINT32_MAX,
ACPI_NS_WALK_NO_UNLOCK, AcpiEvMatchGpeMethod,
NULL, &WalkInfo, NULL);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"While decoding _Lxx/_Exx methods"));
}
GpeBlock = GpeBlock->Next;
}
GpeXruptInfo = GpeXruptInfo->Next;
}
if (WalkInfo.Count)
{
ACPI_INFO ((AE_INFO, "Enabled %u new GPEs", WalkInfo.Count));
}
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
return;
}
/*******************************************************************************
*
* FUNCTION: AcpiEvMatchGpeMethod
*
* PARAMETERS: Callback from WalkNamespace
*
* RETURN: Status
*
* DESCRIPTION: Called from AcpiWalkNamespace. Expects each object to be a
* control method under the _GPE portion of the namespace.
* Extract the name and GPE type from the object, saving this
* information for quick lookup during GPE dispatch. Allows a
* per-OwnerId evaluation if ExecuteByOwnerId is TRUE in the
* WalkInfo parameter block.
*
* The name of each GPE control method is of the form:
* "_Lxx" or "_Exx", where:
* L - means that the GPE is level triggered
* E - means that the GPE is edge triggered
* xx - is the GPE number [in HEX]
*
* If WalkInfo->ExecuteByOwnerId is TRUE, we only execute examine GPE methods
* with that owner.
*
******************************************************************************/
ACPI_STATUS
AcpiEvMatchGpeMethod (
ACPI_HANDLE ObjHandle,
UINT32 Level,
void *Context,
void **ReturnValue)
{
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;
UINT32 GpeNumber;
char Name[ACPI_NAME_SIZE + 1];
UINT8 Type;
ACPI_FUNCTION_TRACE (EvMatchGpeMethod);
/* Check if requested OwnerId matches this OwnerId */
if ((WalkInfo->ExecuteByOwnerId) &&
(MethodNode->OwnerId != WalkInfo->OwnerId))
{
return_ACPI_STATUS (AE_OK);
}
/*
* Match and decode the _Lxx and _Exx GPE method names
*
* 1) Extract the method name and null terminate it
*/
ACPI_MOVE_32_TO_32 (Name, &MethodNode->Name.Integer);
Name[ACPI_NAME_SIZE] = 0;
/* 2) Name must begin with an underscore */
if (Name[0] != '_')
{
return_ACPI_STATUS (AE_OK); /* Ignore this method */
}
/*
* 3) Edge/Level determination is based on the 2nd character
* of the method name
*/
switch (Name[1])
{
case 'L':
Type = ACPI_GPE_LEVEL_TRIGGERED;
break;
case 'E':
Type = ACPI_GPE_EDGE_TRIGGERED;
break;
default:
/* Unknown method type, just ignore it */
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,
"Ignoring unknown GPE method type: %s "
"(name not of form _Lxx or _Exx)", Name));
return_ACPI_STATUS (AE_OK);
}
/* 4) The last two characters of the name are the hex GPE Number */
GpeNumber = ACPI_STRTOUL (&Name[2], NULL, 16);
if (GpeNumber == ACPI_UINT32_MAX)
{
/* Conversion failed; invalid method, just ignore it */
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,
"Could not extract GPE number from name: %s "
"(name is not of form _Lxx or _Exx)", Name));
return_ACPI_STATUS (AE_OK);
}
/* Ensure that we have a valid GPE number for this GPE block */
GpeEventInfo = AcpiEvLowGetGpeInfo (GpeNumber, WalkInfo->GpeBlock);
if (!GpeEventInfo)
{
/*
* This GpeNumber is not valid for this GPE block, just ignore it.
* However, it may be valid for a different GPE block, since GPE0
* and GPE1 methods both appear under \_GPE.
*/
return_ACPI_STATUS (AE_OK);
}
if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
ACPI_GPE_DISPATCH_HANDLER)
{
/* If there is already a handler, ignore this GPE method */
return_ACPI_STATUS (AE_OK);
}
if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
ACPI_GPE_DISPATCH_METHOD)
{
/*
* If there is already a method, ignore this method. But check
* for a type mismatch (if both the _Lxx AND _Exx exist)
*/
if (Type != (GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK))
{
ACPI_ERROR ((AE_INFO,
"For GPE 0x%.2X, found both _L%2.2X and _E%2.2X methods",
GpeNumber, GpeNumber, GpeNumber));
}
return_ACPI_STATUS (AE_OK);
}
/*
* 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;
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,
"Registered GPE method %s as GPE number 0x%.2X\n",
Name, GpeNumber));
return_ACPI_STATUS (AE_OK);
}
@@ -0,0 +1,496 @@
/******************************************************************************
*
* Module Name: evgpeutil - GPE utilities
*
*****************************************************************************/
/******************************************************************************
*
* 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"
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evgpeutil")
/*******************************************************************************
*
* FUNCTION: AcpiEvWalkGpeList
*
* PARAMETERS: GpeWalkCallback - Routine called for each GPE block
* Context - Value passed to callback
*
* RETURN: Status
*
* DESCRIPTION: Walk the GPE lists.
*
******************************************************************************/
ACPI_STATUS
AcpiEvWalkGpeList (
ACPI_GPE_CALLBACK GpeWalkCallback,
void *Context)
{
ACPI_GPE_BLOCK_INFO *GpeBlock;
ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
ACPI_STATUS Status = AE_OK;
ACPI_CPU_FLAGS Flags;
ACPI_FUNCTION_TRACE (EvWalkGpeList);
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
/* Walk the interrupt level descriptor list */
GpeXruptInfo = AcpiGbl_GpeXruptListHead;
while (GpeXruptInfo)
{
/* Walk all Gpe Blocks attached to this interrupt level */
GpeBlock = GpeXruptInfo->GpeBlockListHead;
while (GpeBlock)
{
/* One callback per GPE block */
Status = GpeWalkCallback (GpeXruptInfo, GpeBlock, Context);
if (ACPI_FAILURE (Status))
{
if (Status == AE_CTRL_END) /* Callback abort */
{
Status = AE_OK;
}
goto UnlockAndExit;
}
GpeBlock = GpeBlock->Next;
}
GpeXruptInfo = GpeXruptInfo->Next;
}
UnlockAndExit:
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiEvValidGpeEvent
*
* PARAMETERS: GpeEventInfo - Info for this GPE
*
* RETURN: TRUE if the GpeEvent is valid
*
* DESCRIPTION: Validate a GPE event. DO NOT CALL FROM INTERRUPT LEVEL.
* Should be called only when the GPE lists are semaphore locked
* and not subject to change.
*
******************************************************************************/
BOOLEAN
AcpiEvValidGpeEvent (
ACPI_GPE_EVENT_INFO *GpeEventInfo)
{
ACPI_GPE_XRUPT_INFO *GpeXruptBlock;
ACPI_GPE_BLOCK_INFO *GpeBlock;
ACPI_FUNCTION_ENTRY ();
/* No need for spin lock since we are not changing any list elements */
/* Walk the GPE interrupt levels */
GpeXruptBlock = AcpiGbl_GpeXruptListHead;
while (GpeXruptBlock)
{
GpeBlock = GpeXruptBlock->GpeBlockListHead;
/* Walk the GPE blocks on this interrupt level */
while (GpeBlock)
{
if ((&GpeBlock->EventInfo[0] <= GpeEventInfo) &&
(&GpeBlock->EventInfo[GpeBlock->GpeCount] > GpeEventInfo))
{
return (TRUE);
}
GpeBlock = GpeBlock->Next;
}
GpeXruptBlock = GpeXruptBlock->Next;
}
return (FALSE);
}
/*******************************************************************************
*
* 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
*
* PARAMETERS: InterruptNumber - Interrupt for a GPE block
*
* RETURN: A GPE interrupt block
*
* DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt
* block per unique interrupt level used for GPEs. Should be
* called only when the GPE lists are semaphore locked and not
* subject to change.
*
******************************************************************************/
ACPI_GPE_XRUPT_INFO *
AcpiEvGetGpeXruptBlock (
UINT32 InterruptNumber)
{
ACPI_GPE_XRUPT_INFO *NextGpeXrupt;
ACPI_GPE_XRUPT_INFO *GpeXrupt;
ACPI_STATUS Status;
ACPI_CPU_FLAGS Flags;
ACPI_FUNCTION_TRACE (EvGetGpeXruptBlock);
/* No need for lock since we are not changing any list elements here */
NextGpeXrupt = AcpiGbl_GpeXruptListHead;
while (NextGpeXrupt)
{
if (NextGpeXrupt->InterruptNumber == InterruptNumber)
{
return_PTR (NextGpeXrupt);
}
NextGpeXrupt = NextGpeXrupt->Next;
}
/* Not found, must allocate a new xrupt descriptor */
GpeXrupt = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_XRUPT_INFO));
if (!GpeXrupt)
{
return_PTR (NULL);
}
GpeXrupt->InterruptNumber = InterruptNumber;
/* Install new interrupt descriptor with spin lock */
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
if (AcpiGbl_GpeXruptListHead)
{
NextGpeXrupt = AcpiGbl_GpeXruptListHead;
while (NextGpeXrupt->Next)
{
NextGpeXrupt = NextGpeXrupt->Next;
}
NextGpeXrupt->Next = GpeXrupt;
GpeXrupt->Previous = NextGpeXrupt;
}
else
{
AcpiGbl_GpeXruptListHead = GpeXrupt;
}
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
/* Install new interrupt handler if not SCI_INT */
if (InterruptNumber != AcpiGbl_FADT.SciInterrupt)
{
Status = AcpiOsInstallInterruptHandler (InterruptNumber,
AcpiEvGpeXruptHandler, GpeXrupt);
if (ACPI_FAILURE (Status))
{
ACPI_ERROR ((AE_INFO,
"Could not install GPE interrupt handler at level 0x%X",
InterruptNumber));
return_PTR (NULL);
}
}
return_PTR (GpeXrupt);
}
/*******************************************************************************
*
* FUNCTION: AcpiEvDeleteGpeXrupt
*
* PARAMETERS: GpeXrupt - A GPE interrupt info block
*
* RETURN: Status
*
* DESCRIPTION: Remove and free a GpeXrupt block. Remove an associated
* interrupt handler if not the SCI interrupt.
*
******************************************************************************/
ACPI_STATUS
AcpiEvDeleteGpeXrupt (
ACPI_GPE_XRUPT_INFO *GpeXrupt)
{
ACPI_STATUS Status;
ACPI_CPU_FLAGS Flags;
ACPI_FUNCTION_TRACE (EvDeleteGpeXrupt);
/* We never want to remove the SCI interrupt handler */
if (GpeXrupt->InterruptNumber == AcpiGbl_FADT.SciInterrupt)
{
GpeXrupt->GpeBlockListHead = NULL;
return_ACPI_STATUS (AE_OK);
}
/* Disable this interrupt */
Status = AcpiOsRemoveInterruptHandler (
GpeXrupt->InterruptNumber, AcpiEvGpeXruptHandler);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Unlink the interrupt block with lock */
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
if (GpeXrupt->Previous)
{
GpeXrupt->Previous->Next = GpeXrupt->Next;
}
else
{
/* No previous, update list head */
AcpiGbl_GpeXruptListHead = GpeXrupt->Next;
}
if (GpeXrupt->Next)
{
GpeXrupt->Next->Previous = GpeXrupt->Previous;
}
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
/* Free the block */
ACPI_FREE (GpeXrupt);
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiEvDeleteGpeHandlers
*
* PARAMETERS: GpeXruptInfo - GPE Interrupt info
* GpeBlock - Gpe Block info
*
* RETURN: Status
*
* DESCRIPTION: Delete all Handler objects found in the GPE data structs.
* Used only prior to termination.
*
******************************************************************************/
ACPI_STATUS
AcpiEvDeleteGpeHandlers (
ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
ACPI_GPE_BLOCK_INFO *GpeBlock,
void *Context)
{
ACPI_GPE_EVENT_INFO *GpeEventInfo;
UINT32 i;
UINT32 j;
ACPI_FUNCTION_TRACE (EvDeleteGpeHandlers);
/* Examine each GPE Register within the block */
for (i = 0; i < GpeBlock->RegisterCount; i++)
{
/* Now look at the individual GPEs in this byte register */
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
{
GpeEventInfo = &GpeBlock->EventInfo[((ACPI_SIZE) i *
ACPI_GPE_REGISTER_WIDTH) + j];
if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
ACPI_GPE_DISPATCH_HANDLER)
{
ACPI_FREE (GpeEventInfo->Dispatch.Handler);
GpeEventInfo->Dispatch.Handler = NULL;
GpeEventInfo->Flags &= ~ACPI_GPE_DISPATCH_MASK;
}
}
}
return_ACPI_STATUS (AE_OK);
}
+2 -298
View File
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, 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
@@ -696,7 +401,7 @@ AcpiEvTerminate (
if (ACPI_FAILURE (Status))
{
ACPI_ERROR ((AE_INFO,
"Could not disable fixed event %d", (UINT32) i));
"Could not disable fixed event %u", (UINT32) i));
}
}
@@ -737,4 +442,3 @@ AcpiEvTerminate (
}
return_VOID;
}
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, 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);
}
@@ -442,7 +448,7 @@ Cleanup1:
* RegionOffset - Where in the region to read or write
* BitWidth - Field width in bits (8, 16, 32, or 64)
* Value - Pointer to in or out value, must be
* full 64-bit ACPI_INTEGER
* a full 64-bit integer
*
* RETURN: Status
*
@@ -457,7 +463,7 @@ AcpiEvAddressSpaceDispatch (
UINT32 Function,
UINT32 RegionOffset,
UINT32 BitWidth,
ACPI_INTEGER *Value)
UINT64 *Value)
{
ACPI_STATUS Status;
ACPI_ADR_SPACE_HANDLER Handler;
@@ -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 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -260,7 +260,7 @@ AcpiEvPciConfigRegionSetup (
void **RegionContext)
{
ACPI_STATUS Status = AE_OK;
ACPI_INTEGER PciValue;
UINT64 PciValue;
ACPI_PCI_ID *PciId = *RegionContext;
ACPI_OPERAND_OBJECT *HandlerObj;
ACPI_NAMESPACE_NODE *ParentNode;
@@ -294,7 +294,7 @@ AcpiEvPciConfigRegionSetup (
return_ACPI_STATUS (Status);
}
ParentNode = AcpiNsGetParentNode (RegionObj->Region.Node);
ParentNode = RegionObj->Region.Node->Parent;
/*
* Get the _SEG and _BBN values from the device upon which the handler
@@ -348,7 +348,7 @@ AcpiEvPciConfigRegionSetup (
break;
}
PciRootNode = AcpiNsGetParentNode (PciRootNode);
PciRootNode = PciRootNode->Parent;
}
/* PCI root bridge not found, use namespace root node */
@@ -385,7 +385,7 @@ AcpiEvPciConfigRegionSetup (
PciDeviceNode = RegionObj->Region.Node;
while (PciDeviceNode && (PciDeviceNode->Type != ACPI_TYPE_DEVICE))
{
PciDeviceNode = AcpiNsGetParentNode (PciDeviceNode);
PciDeviceNode = PciDeviceNode->Parent;
}
if (!PciDeviceNode)
@@ -395,8 +395,8 @@ AcpiEvPciConfigRegionSetup (
}
/*
* Get the PCI device and function numbers from the _ADR object contained
* in the parent's scope.
* Get the PCI device and function numbers from the _ADR object
* contained in the parent's scope.
*/
Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR,
PciDeviceNode, &PciValue);
@@ -429,9 +429,14 @@ AcpiEvPciConfigRegionSetup (
PciId->Bus = ACPI_LOWORD (PciValue);
}
/* Complete this device's PciId */
/* Complete/update the PCI ID for this device */
AcpiOsDerivePciId (PciRootNode, RegionObj->Region.Node, &PciId);
Status = AcpiHwDerivePciId (PciId, PciRootNode, RegionObj->Region.Node);
if (ACPI_FAILURE (Status))
{
ACPI_FREE (PciId);
return_ACPI_STATUS (Status);
}
*RegionContext = PciId;
return_ACPI_STATUS (AE_OK);
@@ -661,7 +666,7 @@ AcpiEvInitializeRegion (
return_ACPI_STATUS (AE_NOT_EXIST);
}
Node = AcpiNsGetParentNode (RegionObj->Region.Node);
Node = RegionObj->Region.Node->Parent;
SpaceId = RegionObj->Region.SpaceId;
/* Setup defaults */
@@ -724,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;
@@ -763,7 +768,7 @@ AcpiEvInitializeRegion (
}
}
Status = AcpiEvExecuteRegMethod (RegionObj, 1);
Status = AcpiEvExecuteRegMethod (RegionObj, ACPI_REG_CONNECT);
if (AcpiNsLocked)
{
@@ -785,7 +790,7 @@ AcpiEvInitializeRegion (
/* This node does not have the handler we need; Pop up one level */
Node = AcpiNsGetParentNode (Node);
Node = Node->Parent;
}
/* If we get here, there is no handler for this region */
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
+123 -41
View File
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, 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
@@ -232,7 +292,7 @@ AcpiInstallFixedEventHandler (
Status = AcpiEnableEvent (Event, 0);
if (ACPI_FAILURE (Status))
{
ACPI_WARNING ((AE_INFO, "Could not enable fixed event %X", Event));
ACPI_WARNING ((AE_INFO, "Could not enable fixed event 0x%X", Event));
/* Remove the handler */
@@ -303,7 +363,7 @@ AcpiRemoveFixedEventHandler (
if (ACPI_FAILURE (Status))
{
ACPI_WARNING ((AE_INFO,
"Could not write to fixed event enable register %X", Event));
"Could not write to fixed event enable register 0x%X", Event));
}
else
{
@@ -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;
@@ -705,7 +765,7 @@ AcpiInstallGpeHandler (
/* Parameter validation */
if ((!Address) || (Type > ACPI_GPE_XRUPT_TYPE_MASK))
if ((!Address) || (Type & ~ACPI_GPE_XRUPT_TYPE_MASK))
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
@@ -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,36 +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));
/* Disable the GPE before installing the handler */
Status = AcpiEvDisableGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
/*
* 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)
{
goto UnlockAndExit;
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);
@@ -771,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)
@@ -795,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;
@@ -819,6 +899,8 @@ AcpiRemoveGpeHandler (
return_ACPI_STATUS (Status);
}
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
/* Ensure that we have a valid GPE number */
GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
@@ -845,28 +927,27 @@ AcpiRemoveGpeHandler (
goto UnlockAndExit;
}
/* Disable the GPE before removing the handler */
Status = AcpiEvDisableGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
/* 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 */
@@ -874,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 - 2009, 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,187 +295,11 @@ AcpiEnableEvent (
ACPI_EXPORT_SYMBOL (AcpiEnableEvent)
/*******************************************************************************
*
* FUNCTION: AcpiSetGpeType
*
* PARAMETERS: GpeDevice - Parent GPE Device
* GpeNumber - GPE level within the GPE block
* Type - New GPE type
*
* RETURN: Status
*
* DESCRIPTION: Set the type of an individual GPE
*
******************************************************************************/
ACPI_STATUS
AcpiSetGpeType (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
UINT8 Type)
{
ACPI_STATUS Status = AE_OK;
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_FUNCTION_TRACE (AcpiSetGpeType);
/* Ensure that we have a valid GPE number */
GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
if (!GpeEventInfo)
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
if ((GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK) == Type)
{
return_ACPI_STATUS (AE_OK);
}
/* Set the new type (will disable GPE if currently enabled) */
Status = AcpiEvSetGpeType (GpeEventInfo, Type);
UnlockAndExit:
return_ACPI_STATUS (Status);
}
ACPI_EXPORT_SYMBOL (AcpiSetGpeType)
/*******************************************************************************
*
* FUNCTION: AcpiEnableGpe
*
* PARAMETERS: GpeDevice - Parent GPE Device
* GpeNumber - GPE level within the GPE block
* Flags - Just enable, or also wake enable?
* Called from ISR or not
*
* RETURN: Status
*
* DESCRIPTION: Enable an ACPI event (general purpose)
*
******************************************************************************/
ACPI_STATUS
AcpiEnableGpe (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
UINT32 Flags)
{
ACPI_STATUS Status = AE_OK;
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_FUNCTION_TRACE (AcpiEnableGpe);
/* Use semaphore lock if not executing at interrupt level */
if (Flags & ACPI_NOT_ISR)
{
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
/* Ensure that we have a valid GPE number */
GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
if (!GpeEventInfo)
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
/* Perform the enable */
Status = AcpiEvEnableGpe (GpeEventInfo, TRUE);
UnlockAndExit:
if (Flags & ACPI_NOT_ISR)
{
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
}
return_ACPI_STATUS (Status);
}
ACPI_EXPORT_SYMBOL (AcpiEnableGpe)
/*******************************************************************************
*
* FUNCTION: AcpiDisableGpe
*
* PARAMETERS: GpeDevice - Parent GPE Device
* GpeNumber - GPE level within the GPE block
* Flags - Just disable, or also wake disable?
* Called from ISR or not
*
* RETURN: Status
*
* DESCRIPTION: Disable an ACPI event (general purpose)
*
******************************************************************************/
ACPI_STATUS
AcpiDisableGpe (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
UINT32 Flags)
{
ACPI_STATUS Status = AE_OK;
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_FUNCTION_TRACE (AcpiDisableGpe);
/* Use semaphore lock if not executing at interrupt level */
if (Flags & ACPI_NOT_ISR)
{
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
/* Ensure that we have a valid GPE number */
GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
if (!GpeEventInfo)
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
Status = AcpiEvDisableGpe (GpeEventInfo);
UnlockAndExit:
if (Flags & ACPI_NOT_ISR)
{
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
}
return_ACPI_STATUS (Status);
}
ACPI_EXPORT_SYMBOL (AcpiDisableGpe)
/*******************************************************************************
*
* FUNCTION: AcpiDisableEvent
*
* PARAMETERS: Event - The fixed eventto be enabled
* PARAMETERS: Event - The fixed event to be disabled
* Flags - Reserved
*
* RETURN: Status
@@ -588,66 +402,6 @@ AcpiClearEvent (
ACPI_EXPORT_SYMBOL (AcpiClearEvent)
/*******************************************************************************
*
* FUNCTION: AcpiClearGpe
*
* PARAMETERS: GpeDevice - Parent GPE Device
* GpeNumber - GPE level within the GPE block
* Flags - Called from an ISR or not
*
* RETURN: Status
*
* DESCRIPTION: Clear an ACPI event (general purpose)
*
******************************************************************************/
ACPI_STATUS
AcpiClearGpe (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
UINT32 Flags)
{
ACPI_STATUS Status = AE_OK;
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_FUNCTION_TRACE (AcpiClearGpe);
/* Use semaphore lock if not executing at interrupt level */
if (Flags & ACPI_NOT_ISR)
{
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
/* Ensure that we have a valid GPE number */
GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
if (!GpeEventInfo)
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
Status = AcpiHwClearGpe (GpeEventInfo);
UnlockAndExit:
if (Flags & ACPI_NOT_ISR)
{
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
}
return_ACPI_STATUS (Status);
}
ACPI_EXPORT_SYMBOL (AcpiClearGpe)
/*******************************************************************************
*
* FUNCTION: AcpiGetEventStatus
@@ -696,417 +450,3 @@ AcpiGetEventStatus (
ACPI_EXPORT_SYMBOL (AcpiGetEventStatus)
/*******************************************************************************
*
* FUNCTION: AcpiGetGpeStatus
*
* PARAMETERS: GpeDevice - Parent GPE Device
* GpeNumber - GPE level within the GPE block
* Flags - Called from an ISR or not
* 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,
UINT32 Flags,
ACPI_EVENT_STATUS *EventStatus)
{
ACPI_STATUS Status = AE_OK;
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_FUNCTION_TRACE (AcpiGetGpeStatus);
/* Use semaphore lock if not executing at interrupt level */
if (Flags & ACPI_NOT_ISR)
{
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
/* 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:
if (Flags & ACPI_NOT_ISR)
{
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
}
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;
}
/* Run the _PRW methods and enable the GPEs */
Status = AcpiEvInitializeGpeBlock (Node, GpeBlock);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
/* Get the DeviceObject attached to the node */
ObjDesc = AcpiNsGetAttachedObject (Node);
if (!ObjDesc)
{
/* No object, create a new one */
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;
}
}
/* 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)
/*******************************************************************************
*
* 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->RegisterCount * ACPI_GPE_REGISTER_WIDTH);
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 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -139,6 +139,12 @@
*
* DESCRIPTION: Install a handler for all OpRegions of a given SpaceId.
*
* NOTE: This function should only be called after AcpiEnableSubsystem has
* been called. This is because any _REG methods associated with the Space ID
* are executed here, and these methods can only be safely executed after
* the default handlers have been installed and the hardware has been
* initialized (via AcpiEnableSubsystem.)
*
******************************************************************************/
ACPI_STATUS
@@ -186,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 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -164,8 +164,9 @@ AcpiExAddTable (
ACPI_NAMESPACE_NODE *ParentNode,
ACPI_OPERAND_OBJECT **DdbHandle)
{
ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_STATUS Status;
ACPI_OWNER_ID OwnerId;
ACPI_FUNCTION_TRACE (ExAddTable);
@@ -205,7 +206,18 @@ AcpiExAddTable (
AcpiNsExecModuleCodeList ();
AcpiExEnterInterpreter ();
return_ACPI_STATUS (Status);
/*
* 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))
{
AcpiEvUpdateGpes (OwnerId);
}
return_ACPI_STATUS (AE_OK);
}
@@ -347,9 +359,8 @@ AcpiExLoadTableOp (
Status = AcpiGetTableByIndex (TableIndex, &Table);
if (ACPI_SUCCESS (Status))
{
ACPI_INFO ((AE_INFO,
"Dynamic OEM Table Load - [%.4s] OemId [%.6s] OemTableId [%.8s]",
Table->Signature, Table->OemId, Table->OemTableId));
ACPI_INFO ((AE_INFO, "Dynamic OEM Table Load:"));
AcpiTbPrintTableHeader (0, Table);
}
/* Invoke table handler if present */
@@ -387,7 +398,7 @@ AcpiExRegionRead (
UINT8 *Buffer)
{
ACPI_STATUS Status;
ACPI_INTEGER Value;
UINT64 Value;
UINT32 RegionOffset = 0;
UINT32 i;
@@ -610,7 +621,10 @@ AcpiExLoadOp (
Status = AcpiTbAddTable (&TableDesc, &TableIndex);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
/* Delete allocated table buffer */
AcpiTbDeleteTable (&TableDesc);
return_ACPI_STATUS (Status);
}
/*
@@ -641,6 +655,9 @@ AcpiExLoadOp (
return_ACPI_STATUS (Status);
}
ACPI_INFO ((AE_INFO, "Dynamic OEM Table Load:"));
AcpiTbPrintTableHeader (0, TableDesc.Pointer);
/* Remove the reference by added by AcpiExStore above */
AcpiUtRemoveReference (DdbHandle);
@@ -653,13 +670,6 @@ AcpiExLoadOp (
AcpiGbl_TableHandlerContext);
}
Cleanup:
if (ACPI_FAILURE (Status))
{
/* Delete allocated table buffer */
AcpiTbDeleteTable (&TableDesc);
}
return_ACPI_STATUS (Status);
}
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -129,7 +129,7 @@
static UINT32
AcpiExConvertToAscii (
ACPI_INTEGER Integer,
UINT64 Integer,
UINT16 Base,
UINT8 *String,
UINT8 MaxLength);
@@ -158,7 +158,7 @@ AcpiExConvertToInteger (
{
ACPI_OPERAND_OBJECT *ReturnDesc;
UINT8 *Pointer;
ACPI_INTEGER Result;
UINT64 Result;
UINT32 i;
UINT32 Count;
ACPI_STATUS Status;
@@ -247,7 +247,7 @@ AcpiExConvertToInteger (
* Little endian is used, meaning that the first byte of the buffer
* is the LSB of the integer
*/
Result |= (((ACPI_INTEGER) Pointer[i]) << (i * 8));
Result |= (((UINT64) Pointer[i]) << (i * 8));
}
break;
@@ -389,12 +389,12 @@ AcpiExConvertToBuffer (
static UINT32
AcpiExConvertToAscii (
ACPI_INTEGER Integer,
UINT64 Integer,
UINT16 Base,
UINT8 *String,
UINT8 DataWidth)
{
ACPI_INTEGER Digit;
UINT64 Digit;
UINT32 i;
UINT32 j;
UINT32 k = 0;
@@ -659,7 +659,7 @@ AcpiExConvertToString (
for (i = 0; i < ObjDesc->Buffer.Length; i++)
{
NewBuf += AcpiExConvertToAscii (
(ACPI_INTEGER) ObjDesc->Buffer.Pointer[i], Base,
(UINT64) ObjDesc->Buffer.Pointer[i], Base,
NewBuf, 1);
*NewBuf++ = Separator; /* each separated by a comma or space */
}
@@ -786,7 +786,7 @@ AcpiExConvertToTargetType (
default:
ACPI_ERROR ((AE_INFO, "Bad destination type during conversion: %X",
ACPI_ERROR ((AE_INFO, "Bad destination type during conversion: 0x%X",
DestinationType));
Status = AE_AML_INTERNAL;
break;
@@ -803,7 +803,7 @@ AcpiExConvertToTargetType (
default:
ACPI_ERROR ((AE_INFO,
"Unknown Target type ID 0x%X AmlOpcode %X DestType %s",
"Unknown Target type ID 0x%X AmlOpcode 0x%X DestType %s",
GET_CURRENT_ARG_TYPE (WalkState->OpInfo->RuntimeArgs),
WalkState->Opcode, AcpiUtGetTypeName (DestinationType)));
Status = AE_AML_INTERNAL;
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -400,13 +400,14 @@ 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 %X", RegionSpace));
ACPI_ERROR ((AE_INFO, "Invalid AddressSpace type 0x%X", RegionSpace));
return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID);
}
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (%X)\n",
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (0x%X)\n",
AcpiUtGetRegionName (RegionSpace), RegionSpace));
/* Create the region descriptor */
@@ -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
@@ -0,0 +1,350 @@
/******************************************************************************
*
* Module Name: exdebug - Support for stores to the AML Debug Object
*
*****************************************************************************/
/******************************************************************************
*
* 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 __EXDEBUG_C__
#include "acpi.h"
#include "accommon.h"
#include "acinterp.h"
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exdebug")
#ifndef ACPI_NO_ERROR_MESSAGES
/*******************************************************************************
*
* FUNCTION: AcpiExDoDebugObject
*
* PARAMETERS: SourceDesc - Object to be output to "Debug Object"
* Level - Indentation level (used for packages)
* Index - Current package element, zero if not pkg
*
* RETURN: None
*
* DESCRIPTION: Handles stores to the AML Debug Object. For example:
* Store(INT1, Debug)
*
* This function is not compiled if ACPI_NO_ERROR_MESSAGES is set.
*
* This function is only enabled if AcpiGbl_EnableAmlDebugObject is set, or
* if ACPI_LV_DEBUG_OBJECT is set in the AcpiDbgLevel. Thus, in the normal
* operational case, stores to the debug object are ignored but can be easily
* enabled if necessary.
*
******************************************************************************/
void
AcpiExDoDebugObject (
ACPI_OPERAND_OBJECT *SourceDesc,
UINT32 Level,
UINT32 Index)
{
UINT32 i;
ACPI_FUNCTION_TRACE_PTR (ExDoDebugObject, SourceDesc);
/* Output must be enabled via the DebugObject global or the DbgLevel */
if (!AcpiGbl_EnableAmlDebugObject &&
!(AcpiDbgLevel & ACPI_LV_DEBUG_OBJECT))
{
return_VOID;
}
/*
* Print line header as long as we are not in the middle of an
* object display
*/
if (!((Level > 0) && Index == 0))
{
AcpiOsPrintf ("[ACPI Debug] %*s", Level, " ");
}
/* Display the index for package output only */
if (Index > 0)
{
AcpiOsPrintf ("(%.2u) ", Index-1);
}
if (!SourceDesc)
{
AcpiOsPrintf ("[Null Object]\n");
return_VOID;
}
if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_OPERAND)
{
AcpiOsPrintf ("%s ", AcpiUtGetObjectTypeName (SourceDesc));
if (!AcpiUtValidInternalObject (SourceDesc))
{
AcpiOsPrintf ("%p, Invalid Internal Object!\n", SourceDesc);
return_VOID;
}
}
else if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_NAMED)
{
AcpiOsPrintf ("%s: %p\n",
AcpiUtGetTypeName (((ACPI_NAMESPACE_NODE *) SourceDesc)->Type),
SourceDesc);
return_VOID;
}
else
{
return_VOID;
}
/* SourceDesc is of type ACPI_DESC_TYPE_OPERAND */
switch (SourceDesc->Common.Type)
{
case ACPI_TYPE_INTEGER:
/* Output correct integer width */
if (AcpiGbl_IntegerByteWidth == 4)
{
AcpiOsPrintf ("0x%8.8X\n",
(UINT32) SourceDesc->Integer.Value);
}
else
{
AcpiOsPrintf ("0x%8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (SourceDesc->Integer.Value));
}
break;
case ACPI_TYPE_BUFFER:
AcpiOsPrintf ("[0x%.2X]\n", (UINT32) SourceDesc->Buffer.Length);
AcpiUtDumpBuffer2 (SourceDesc->Buffer.Pointer,
(SourceDesc->Buffer.Length < 256) ?
SourceDesc->Buffer.Length : 256, DB_BYTE_DISPLAY);
break;
case ACPI_TYPE_STRING:
AcpiOsPrintf ("[0x%.2X] \"%s\"\n",
SourceDesc->String.Length, SourceDesc->String.Pointer);
break;
case ACPI_TYPE_PACKAGE:
AcpiOsPrintf ("[Contains 0x%.2X Elements]\n",
SourceDesc->Package.Count);
/* Output the entire contents of the package */
for (i = 0; i < SourceDesc->Package.Count; i++)
{
AcpiExDoDebugObject (SourceDesc->Package.Elements[i],
Level+4, i+1);
}
break;
case ACPI_TYPE_LOCAL_REFERENCE:
AcpiOsPrintf ("[%s] ", AcpiUtGetReferenceName (SourceDesc));
/* Decode the reference */
switch (SourceDesc->Reference.Class)
{
case ACPI_REFCLASS_INDEX:
AcpiOsPrintf ("0x%X\n", SourceDesc->Reference.Value);
break;
case ACPI_REFCLASS_TABLE:
/* Case for DdbHandle */
AcpiOsPrintf ("Table Index 0x%X\n", SourceDesc->Reference.Value);
return;
default:
break;
}
AcpiOsPrintf (" ");
/* Check for valid node first, then valid object */
if (SourceDesc->Reference.Node)
{
if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc->Reference.Node) !=
ACPI_DESC_TYPE_NAMED)
{
AcpiOsPrintf (" %p - Not a valid namespace node\n",
SourceDesc->Reference.Node);
}
else
{
AcpiOsPrintf ("Node %p [%4.4s] ", SourceDesc->Reference.Node,
(SourceDesc->Reference.Node)->Name.Ascii);
switch ((SourceDesc->Reference.Node)->Type)
{
/* These types have no attached object */
case ACPI_TYPE_DEVICE:
AcpiOsPrintf ("Device\n");
break;
case ACPI_TYPE_THERMAL:
AcpiOsPrintf ("Thermal Zone\n");
break;
default:
AcpiExDoDebugObject ((SourceDesc->Reference.Node)->Object,
Level+4, 0);
break;
}
}
}
else if (SourceDesc->Reference.Object)
{
if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc->Reference.Object) ==
ACPI_DESC_TYPE_NAMED)
{
AcpiExDoDebugObject (((ACPI_NAMESPACE_NODE *)
SourceDesc->Reference.Object)->Object,
Level+4, 0);
}
else
{
AcpiExDoDebugObject (SourceDesc->Reference.Object,
Level+4, 0);
}
}
break;
default:
AcpiOsPrintf ("%p\n", SourceDesc);
break;
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "\n"));
return_VOID;
}
#endif
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, 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"},
@@ -864,7 +864,7 @@ AcpiExDumpOperands (
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"**** Start operand dump for opcode [%s], %d operands\n",
"**** Start operand dump for opcode [%s], %u operands\n",
OpcodeName, NumOperands));
if (NumOperands == 0)
@@ -948,7 +948,7 @@ AcpiExDumpNamespaceNode (
AcpiOsPrintf ("%20s : %4.4s\n", "Name", AcpiUtGetNodeName (Node));
AcpiExOutString ("Type", AcpiUtGetTypeName (Node->Type));
AcpiExOutPointer ("Attached Object", AcpiNsGetAttachedObject (Node));
AcpiExOutPointer ("Parent", AcpiNsGetParentNode (Node));
AcpiExOutPointer ("Parent", Node->Parent);
AcpiExDumpObject (ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node),
AcpiExDumpNode);
@@ -1096,7 +1096,7 @@ AcpiExDumpPackageObj (
case ACPI_TYPE_PACKAGE:
AcpiOsPrintf ("[Package] Contains %d Elements:\n",
AcpiOsPrintf ("[Package] Contains %u Elements:\n",
ObjDesc->Package.Count);
for (i = 0; i < ObjDesc->Package.Count; i++)
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -217,7 +217,7 @@ AcpiExReadDataFromField (
/* Call the region handler for the read */
Status = AcpiExAccessRegion (ObjDesc, 0,
ACPI_CAST_PTR (ACPI_INTEGER, BufferDesc->Buffer.Pointer),
ACPI_CAST_PTR (UINT64, BufferDesc->Buffer.Pointer),
Function);
AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags);
goto Exit;
@@ -226,7 +226,7 @@ AcpiExReadDataFromField (
/*
* Allocate a buffer for the contents of the field.
*
* If the field is larger than the size of an ACPI_INTEGER, create
* If the field is larger than the current integer width, create
* a BUFFER to hold it. Otherwise, use an INTEGER. This allows
* the use of arithmetic operators on the returned value if the
* field size is equal or smaller than an Integer.
@@ -382,7 +382,7 @@ AcpiExWriteDataToField (
if (SourceDesc->Buffer.Length < Length)
{
ACPI_ERROR ((AE_INFO,
"SMBus or IPMI write requires Buffer of length %X, found length %X",
"SMBus or IPMI write requires Buffer of length %u, found length %u",
Length, SourceDesc->Buffer.Length));
return_ACPI_STATUS (AE_AML_BUFFER_LIMIT);
@@ -408,7 +408,7 @@ AcpiExWriteDataToField (
* same buffer)
*/
Status = AcpiExAccessRegion (ObjDesc, 0,
(ACPI_INTEGER *) Buffer, Function);
(UINT64 *) Buffer, Function);
AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags);
*ResultDesc = BufferDesc;
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -133,13 +133,13 @@ static ACPI_STATUS
AcpiExFieldDatumIo (
ACPI_OPERAND_OBJECT *ObjDesc,
UINT32 FieldDatumByteOffset,
ACPI_INTEGER *Value,
UINT64 *Value,
UINT32 ReadWrite);
static BOOLEAN
AcpiExRegisterOverflow (
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_INTEGER Value);
UINT64 Value);
static ACPI_STATUS
AcpiExSetupRegion (
@@ -181,7 +181,7 @@ AcpiExSetupRegion (
if (RgnDesc->Common.Type != ACPI_TYPE_REGION)
{
ACPI_ERROR ((AE_INFO, "Needed Region, found type %X (%s)",
ACPI_ERROR ((AE_INFO, "Needed Region, found type 0x%X (%s)",
RgnDesc->Common.Type,
AcpiUtGetObjectTypeName (RgnDesc)));
@@ -202,8 +202,8 @@ AcpiExSetupRegion (
}
/*
* Exit now for SMBus or IPMI address space, it has a non-linear address space
* and the request cannot be directly validated
* Exit now for SMBus or IPMI address space, it has a non-linear
* address space and the request cannot be directly validated
*/
if (RgnDesc->Region.SpaceId == ACPI_ADR_SPACE_SMBUS ||
RgnDesc->Region.SpaceId == ACPI_ADR_SPACE_IPMI)
@@ -233,8 +233,7 @@ AcpiExSetupRegion (
* (Region length is specified in bytes)
*/
if (RgnDesc->Region.Length <
(ObjDesc->CommonField.BaseByteOffset +
FieldDatumByteOffset +
(ObjDesc->CommonField.BaseByteOffset + FieldDatumByteOffset +
ObjDesc->CommonField.AccessByteWidth))
{
if (AcpiGbl_EnableInterpreterSlack)
@@ -262,7 +261,7 @@ AcpiExSetupRegion (
* byte, and a field with Dword access specified.
*/
ACPI_ERROR ((AE_INFO,
"Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)",
"Field [%4.4s] access width (%u bytes) too large for region [%4.4s] (length %u)",
AcpiUtGetNodeName (ObjDesc->CommonField.Node),
ObjDesc->CommonField.AccessByteWidth,
AcpiUtGetNodeName (RgnDesc->Region.Node),
@@ -274,7 +273,7 @@ AcpiExSetupRegion (
* exceeds region length, indicate an error
*/
ACPI_ERROR ((AE_INFO,
"Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)",
"Field [%4.4s] Base+Offset+Width %u+%u+%u is beyond end of region [%4.4s] (length %u)",
AcpiUtGetNodeName (ObjDesc->CommonField.Node),
ObjDesc->CommonField.BaseByteOffset,
FieldDatumByteOffset, ObjDesc->CommonField.AccessByteWidth,
@@ -296,7 +295,7 @@ AcpiExSetupRegion (
* FieldDatumByteOffset - Byte offset of this datum within the
* parent field
* Value - Where to store value (must at least
* the size of ACPI_INTEGER)
* 64 bits)
* Function - Read or Write flag plus other region-
* dependent flags
*
@@ -310,7 +309,7 @@ ACPI_STATUS
AcpiExAccessRegion (
ACPI_OPERAND_OBJECT *ObjDesc,
UINT32 FieldDatumByteOffset,
ACPI_INTEGER *Value,
UINT64 *Value,
UINT32 Function)
{
ACPI_STATUS Status;
@@ -371,14 +370,14 @@ AcpiExAccessRegion (
if (Status == AE_NOT_IMPLEMENTED)
{
ACPI_ERROR ((AE_INFO,
"Region %s(%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(%X) has no handler",
"Region %s (ID=%u) has no handler",
AcpiUtGetRegionName (RgnDesc->Region.SpaceId),
RgnDesc->Region.SpaceId));
}
@@ -408,7 +407,7 @@ AcpiExAccessRegion (
static BOOLEAN
AcpiExRegisterOverflow (
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_INTEGER Value)
UINT64 Value)
{
if (ObjDesc->CommonField.BitLength >= ACPI_INTEGER_BIT_SIZE)
@@ -420,7 +419,7 @@ AcpiExRegisterOverflow (
return (FALSE);
}
if (Value >= ((ACPI_INTEGER) 1 << ObjDesc->CommonField.BitLength))
if (Value >= ((UINT64) 1 << ObjDesc->CommonField.BitLength))
{
/*
* The Value is larger than the maximum value that can fit into
@@ -457,11 +456,11 @@ static ACPI_STATUS
AcpiExFieldDatumIo (
ACPI_OPERAND_OBJECT *ObjDesc,
UINT32 FieldDatumByteOffset,
ACPI_INTEGER *Value,
UINT64 *Value,
UINT32 ReadWrite)
{
ACPI_STATUS Status;
ACPI_INTEGER LocalValue;
UINT64 LocalValue;
ACPI_FUNCTION_TRACE_U32 (ExFieldDatumIo, FieldDatumByteOffset);
@@ -543,7 +542,7 @@ AcpiExFieldDatumIo (
* the register
*/
if (AcpiExRegisterOverflow (ObjDesc->BankField.BankObj,
(ACPI_INTEGER) ObjDesc->BankField.Value))
(UINT64) ObjDesc->BankField.Value))
{
return_ACPI_STATUS (AE_AML_REGISTER_LIMIT);
}
@@ -586,7 +585,7 @@ AcpiExFieldDatumIo (
* the register
*/
if (AcpiExRegisterOverflow (ObjDesc->IndexField.IndexObj,
(ACPI_INTEGER) ObjDesc->IndexField.Value))
(UINT64) ObjDesc->IndexField.Value))
{
return_ACPI_STATUS (AE_AML_REGISTER_LIMIT);
}
@@ -615,7 +614,7 @@ AcpiExFieldDatumIo (
"Read from Data Register\n"));
Status = AcpiExExtractFromField (ObjDesc->IndexField.DataObj,
Value, sizeof (ACPI_INTEGER));
Value, sizeof (UINT64));
}
else
{
@@ -626,14 +625,14 @@ AcpiExFieldDatumIo (
ACPI_FORMAT_UINT64 (*Value)));
Status = AcpiExInsertIntoField (ObjDesc->IndexField.DataObj,
Value, sizeof (ACPI_INTEGER));
Value, sizeof (UINT64));
}
break;
default:
ACPI_ERROR ((AE_INFO, "Wrong object type in field I/O %X",
ACPI_ERROR ((AE_INFO, "Wrong object type in field I/O %u",
ObjDesc->Common.Type));
Status = AE_AML_INTERNAL;
break;
@@ -644,14 +643,14 @@ AcpiExFieldDatumIo (
if (ReadWrite == ACPI_READ)
{
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Value Read %8.8X%8.8X, Width %d\n",
"Value Read %8.8X%8.8X, Width %u\n",
ACPI_FORMAT_UINT64 (*Value),
ObjDesc->CommonField.AccessByteWidth));
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Value Written %8.8X%8.8X, Width %d\n",
"Value Written %8.8X%8.8X, Width %u\n",
ACPI_FORMAT_UINT64 (*Value),
ObjDesc->CommonField.AccessByteWidth));
}
@@ -679,13 +678,13 @@ AcpiExFieldDatumIo (
ACPI_STATUS
AcpiExWriteWithUpdateRule (
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_INTEGER Mask,
ACPI_INTEGER FieldValue,
UINT64 Mask,
UINT64 FieldValue,
UINT32 FieldDatumByteOffset)
{
ACPI_STATUS Status = AE_OK;
ACPI_INTEGER MergedValue;
ACPI_INTEGER CurrentValue;
UINT64 MergedValue;
UINT64 CurrentValue;
ACPI_FUNCTION_TRACE_U32 (ExWriteWithUpdateRule, Mask);
@@ -697,7 +696,7 @@ AcpiExWriteWithUpdateRule (
/* If the mask is all ones, we don't need to worry about the update rule */
if (Mask != ACPI_INTEGER_MAX)
if (Mask != ACPI_UINT64_MAX)
{
/* Decode the update rule */
@@ -743,7 +742,7 @@ AcpiExWriteWithUpdateRule (
default:
ACPI_ERROR ((AE_INFO,
"Unknown UpdateRule value: %X",
"Unknown UpdateRule value: 0x%X",
(ObjDesc->CommonField.FieldFlags & AML_FIELD_UPDATE_RULE_MASK)));
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
}
@@ -787,13 +786,14 @@ AcpiExExtractFromField (
UINT32 BufferLength)
{
ACPI_STATUS Status;
ACPI_INTEGER RawDatum;
ACPI_INTEGER MergedDatum;
UINT64 RawDatum;
UINT64 MergedDatum;
UINT32 FieldOffset = 0;
UINT32 BufferOffset = 0;
UINT32 BufferTailBits;
UINT32 DatumCount;
UINT32 FieldDatumCount;
UINT32 AccessBitWidth;
UINT32 i;
@@ -803,25 +803,45 @@ AcpiExExtractFromField (
/* Validate target buffer and clear it */
if (BufferLength <
ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength))
ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength))
{
ACPI_ERROR ((AE_INFO,
"Field size %X (bits) is too large for buffer (%X)",
"Field size %u (bits) is too large for buffer (%u)",
ObjDesc->CommonField.BitLength, BufferLength));
return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
}
ACPI_MEMSET (Buffer, 0, BufferLength);
AccessBitWidth = ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth);
/* Handle the simple case here */
if ((ObjDesc->CommonField.StartFieldBitOffset == 0) &&
(ObjDesc->CommonField.BitLength == AccessBitWidth))
{
Status = AcpiExFieldDatumIo (ObjDesc, 0, Buffer, ACPI_READ);
return_ACPI_STATUS (Status);
}
/* TBD: Move to common setup code */
/* Field algorithm is limited to sizeof(UINT64), truncate if needed */
if (ObjDesc->CommonField.AccessByteWidth > sizeof (UINT64))
{
ObjDesc->CommonField.AccessByteWidth = sizeof (UINT64);
AccessBitWidth = sizeof (UINT64) * 8;
}
/* Compute the number of datums (access width data items) */
DatumCount = ACPI_ROUND_UP_TO (
ObjDesc->CommonField.BitLength,
ObjDesc->CommonField.AccessBitWidth);
ObjDesc->CommonField.BitLength, AccessBitWidth);
FieldDatumCount = ACPI_ROUND_UP_TO (
ObjDesc->CommonField.BitLength +
ObjDesc->CommonField.StartFieldBitOffset,
ObjDesc->CommonField.AccessBitWidth);
ObjDesc->CommonField.BitLength +
ObjDesc->CommonField.StartFieldBitOffset, AccessBitWidth);
/* Priming read from the field */
@@ -854,12 +874,11 @@ AcpiExExtractFromField (
* This avoids the differences in behavior between different compilers
* concerning shift values larger than the target data width.
*/
if ((ObjDesc->CommonField.AccessBitWidth -
ObjDesc->CommonField.StartFieldBitOffset) < ACPI_INTEGER_BIT_SIZE)
if (AccessBitWidth - ObjDesc->CommonField.StartFieldBitOffset <
ACPI_INTEGER_BIT_SIZE)
{
MergedDatum |= RawDatum <<
(ObjDesc->CommonField.AccessBitWidth -
ObjDesc->CommonField.StartFieldBitOffset);
(AccessBitWidth - ObjDesc->CommonField.StartFieldBitOffset);
}
if (i == DatumCount)
@@ -879,8 +898,7 @@ AcpiExExtractFromField (
/* Mask off any extra bits in the last datum */
BufferTailBits = ObjDesc->CommonField.BitLength %
ObjDesc->CommonField.AccessBitWidth;
BufferTailBits = ObjDesc->CommonField.BitLength % AccessBitWidth;
if (BufferTailBits)
{
MergedDatum &= ACPI_MASK_BITS_ABOVE (BufferTailBits);
@@ -916,19 +934,20 @@ AcpiExInsertIntoField (
void *Buffer,
UINT32 BufferLength)
{
void *NewBuffer;
ACPI_STATUS Status;
ACPI_INTEGER Mask;
ACPI_INTEGER WidthMask;
ACPI_INTEGER MergedDatum;
ACPI_INTEGER RawDatum = 0;
UINT64 Mask;
UINT64 WidthMask;
UINT64 MergedDatum;
UINT64 RawDatum = 0;
UINT32 FieldOffset = 0;
UINT32 BufferOffset = 0;
UINT32 BufferTailBits;
UINT32 DatumCount;
UINT32 FieldDatumCount;
UINT32 i;
UINT32 AccessBitWidth;
UINT32 RequiredLength;
void *NewBuffer;
UINT32 i;
ACPI_FUNCTION_TRACE (ExInsertIntoField);
@@ -965,31 +984,41 @@ AcpiExInsertIntoField (
BufferLength = RequiredLength;
}
/* TBD: Move to common setup code */
/* Algo is limited to sizeof(UINT64), so cut the AccessByteWidth */
if (ObjDesc->CommonField.AccessByteWidth > sizeof (UINT64))
{
ObjDesc->CommonField.AccessByteWidth = sizeof (UINT64);
}
AccessBitWidth = ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth);
/*
* Create the bitmasks used for bit insertion.
* Note: This if/else is used to bypass compiler differences with the
* shift operator
*/
if (ObjDesc->CommonField.AccessBitWidth == ACPI_INTEGER_BIT_SIZE)
if (AccessBitWidth == ACPI_INTEGER_BIT_SIZE)
{
WidthMask = ACPI_INTEGER_MAX;
WidthMask = ACPI_UINT64_MAX;
}
else
{
WidthMask = ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.AccessBitWidth);
WidthMask = ACPI_MASK_BITS_ABOVE (AccessBitWidth);
}
Mask = WidthMask &
ACPI_MASK_BITS_BELOW (ObjDesc->CommonField.StartFieldBitOffset);
ACPI_MASK_BITS_BELOW (ObjDesc->CommonField.StartFieldBitOffset);
/* Compute the number of datums (access width data items) */
DatumCount = ACPI_ROUND_UP_TO (ObjDesc->CommonField.BitLength,
ObjDesc->CommonField.AccessBitWidth);
AccessBitWidth);
FieldDatumCount = ACPI_ROUND_UP_TO (ObjDesc->CommonField.BitLength +
ObjDesc->CommonField.StartFieldBitOffset,
ObjDesc->CommonField.AccessBitWidth);
ObjDesc->CommonField.StartFieldBitOffset,
AccessBitWidth);
/* Get initial Datum from the input buffer */
@@ -1024,12 +1053,11 @@ AcpiExInsertIntoField (
* This avoids the differences in behavior between different compilers
* concerning shift values larger than the target data width.
*/
if ((ObjDesc->CommonField.AccessBitWidth -
ObjDesc->CommonField.StartFieldBitOffset) < ACPI_INTEGER_BIT_SIZE)
if ((AccessBitWidth - ObjDesc->CommonField.StartFieldBitOffset) <
ACPI_INTEGER_BIT_SIZE)
{
MergedDatum = RawDatum >>
(ObjDesc->CommonField.AccessBitWidth -
ObjDesc->CommonField.StartFieldBitOffset);
(AccessBitWidth - ObjDesc->CommonField.StartFieldBitOffset);
}
else
{
@@ -1048,15 +1076,15 @@ AcpiExInsertIntoField (
BufferOffset += ObjDesc->CommonField.AccessByteWidth;
ACPI_MEMCPY (&RawDatum, ((char *) Buffer) + BufferOffset,
ACPI_MIN(ObjDesc->CommonField.AccessByteWidth,
BufferLength - BufferOffset));
BufferLength - BufferOffset));
MergedDatum |= RawDatum << ObjDesc->CommonField.StartFieldBitOffset;
}
/* Mask off any extra bits in the last datum */
BufferTailBits = (ObjDesc->CommonField.BitLength +
ObjDesc->CommonField.StartFieldBitOffset) %
ObjDesc->CommonField.AccessBitWidth;
ObjDesc->CommonField.StartFieldBitOffset) % AccessBitWidth;
if (BufferTailBits)
{
Mask &= ACPI_MASK_BITS_ABOVE (BufferTailBits);
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -183,7 +183,7 @@ AcpiExGetObjectReference (
default:
ACPI_ERROR ((AE_INFO, "Unknown Reference Class %2.2X",
ACPI_ERROR ((AE_INFO, "Unknown Reference Class 0x%2.2X",
ObjDesc->Reference.Class));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
@@ -201,7 +201,7 @@ AcpiExGetObjectReference (
default:
ACPI_ERROR ((AE_INFO, "Invalid descriptor type %X",
ACPI_ERROR ((AE_INFO, "Invalid descriptor type 0x%X",
ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)));
return_ACPI_STATUS (AE_TYPE);
}
@@ -373,7 +373,7 @@ AcpiExDoConcatenate (
break;
default:
ACPI_ERROR ((AE_INFO, "Invalid object type: %X",
ACPI_ERROR ((AE_INFO, "Invalid object type: 0x%X",
Operand0->Common.Type));
Status = AE_AML_INTERNAL;
}
@@ -475,7 +475,7 @@ AcpiExDoConcatenate (
/* Invalid object type, should not happen here */
ACPI_ERROR ((AE_INFO, "Invalid object type: %X",
ACPI_ERROR ((AE_INFO, "Invalid object type: 0x%X",
Operand0->Common.Type));
Status =AE_AML_INTERNAL;
goto Cleanup;
@@ -508,11 +508,11 @@ Cleanup:
*
******************************************************************************/
ACPI_INTEGER
UINT64
AcpiExDoMathOp (
UINT16 Opcode,
ACPI_INTEGER Integer0,
ACPI_INTEGER Integer1)
UINT64 Integer0,
UINT64 Integer1)
{
ACPI_FUNCTION_ENTRY ();
@@ -615,8 +615,8 @@ AcpiExDoMathOp (
ACPI_STATUS
AcpiExDoLogicalNumericOp (
UINT16 Opcode,
ACPI_INTEGER Integer0,
ACPI_INTEGER Integer1,
UINT64 Integer0,
UINT64 Integer1,
BOOLEAN *LogicalResult)
{
ACPI_STATUS Status = AE_OK;
@@ -690,8 +690,8 @@ AcpiExDoLogicalOp (
BOOLEAN *LogicalResult)
{
ACPI_OPERAND_OBJECT *LocalOperand1 = Operand1;
ACPI_INTEGER Integer0;
ACPI_INTEGER Integer1;
UINT64 Integer0;
UINT64 Integer1;
UINT32 Length0;
UINT32 Length1;
ACPI_STATUS Status = AE_OK;
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -168,10 +168,10 @@ AcpiExUnlinkMutex (
(ObjDesc->Mutex.Prev)->Mutex.Next = ObjDesc->Mutex.Next;
/*
* Migrate the previous sync level associated with this mutex to the
* previous mutex on the list so that it may be preserved. This handles
* the case where several mutexes have been acquired at the same level,
* but are not released in opposite order.
* Migrate the previous sync level associated with this mutex to
* the previous mutex on the list so that it may be preserved.
* This handles the case where several mutexes have been acquired
* at the same level, but are not released in opposite order.
*/
(ObjDesc->Mutex.Prev)->Mutex.OriginalSyncLevel =
ObjDesc->Mutex.OriginalSyncLevel;
@@ -187,8 +187,8 @@ AcpiExUnlinkMutex (
*
* FUNCTION: AcpiExLinkMutex
*
* PARAMETERS: ObjDesc - The mutex to be linked
* Thread - Current executing thread object
* PARAMETERS: ObjDesc - The mutex to be linked
* Thread - Current executing thread object
*
* RETURN: None
*
@@ -228,9 +228,9 @@ AcpiExLinkMutex (
*
* FUNCTION: AcpiExAcquireMutexObject
*
* PARAMETERS: TimeDesc - Timeout in milliseconds
* PARAMETERS: Timeout - Timeout in milliseconds
* ObjDesc - Mutex object
* Thread - Current thread state
* ThreadId - Current thread state
*
* RETURN: Status
*
@@ -337,11 +337,12 @@ AcpiExAcquireMutex (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Must have a valid thread ID */
/* Must have a valid thread state struct */
if (!WalkState->Thread)
{
ACPI_ERROR ((AE_INFO, "Cannot acquire Mutex [%4.4s], null thread info",
ACPI_ERROR ((AE_INFO,
"Cannot acquire Mutex [%4.4s], null thread info",
AcpiUtGetNodeName (ObjDesc->Mutex.Node)));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
@@ -353,7 +354,7 @@ AcpiExAcquireMutex (
if (WalkState->Thread->CurrentSyncLevel > ObjDesc->Mutex.SyncLevel)
{
ACPI_ERROR ((AE_INFO,
"Cannot acquire Mutex [%4.4s], current SyncLevel is too large (%d)",
"Cannot acquire Mutex [%4.4s], current SyncLevel is too large (%u)",
AcpiUtGetNodeName (ObjDesc->Mutex.Node),
WalkState->Thread->CurrentSyncLevel));
return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
@@ -471,6 +472,7 @@ AcpiExReleaseMutex (
{
ACPI_STATUS Status = AE_OK;
UINT8 PreviousSyncLevel;
ACPI_THREAD_STATE *OwnerThread;
ACPI_FUNCTION_TRACE (ExReleaseMutex);
@@ -481,11 +483,14 @@ AcpiExReleaseMutex (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
OwnerThread = ObjDesc->Mutex.OwnerThread;
/* The mutex must have been previously acquired in order to release it */
if (!ObjDesc->Mutex.OwnerThread)
if (!OwnerThread)
{
ACPI_ERROR ((AE_INFO, "Cannot release Mutex [%4.4s], not acquired",
ACPI_ERROR ((AE_INFO,
"Cannot release Mutex [%4.4s], not acquired",
AcpiUtGetNodeName (ObjDesc->Mutex.Node)));
return_ACPI_STATUS (AE_AML_MUTEX_NOT_ACQUIRED);
}
@@ -494,7 +499,8 @@ AcpiExReleaseMutex (
if (!WalkState->Thread)
{
ACPI_ERROR ((AE_INFO, "Cannot release Mutex [%4.4s], null thread info",
ACPI_ERROR ((AE_INFO,
"Cannot release Mutex [%4.4s], null thread info",
AcpiUtGetNodeName (ObjDesc->Mutex.Node)));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
@@ -503,14 +509,14 @@ AcpiExReleaseMutex (
* The Mutex is owned, but this thread must be the owner.
* Special case for Global Lock, any thread can release
*/
if ((ObjDesc->Mutex.OwnerThread->ThreadId != WalkState->Thread->ThreadId) &&
if ((OwnerThread->ThreadId != WalkState->Thread->ThreadId) &&
(ObjDesc != AcpiGbl_GlobalLockMutex))
{
ACPI_ERROR ((AE_INFO,
"Thread %p cannot release Mutex [%4.4s] acquired by thread %p",
ACPI_CAST_PTR (void, WalkState->Thread->ThreadId),
"Thread %u cannot release Mutex [%4.4s] acquired by thread %u",
(UINT32) WalkState->Thread->ThreadId,
AcpiUtGetNodeName (ObjDesc->Mutex.Node),
ACPI_CAST_PTR (void, ObjDesc->Mutex.OwnerThread->ThreadId)));
(UINT32) OwnerThread->ThreadId));
return_ACPI_STATUS (AE_AML_NOT_OWNER);
}
@@ -521,10 +527,10 @@ AcpiExReleaseMutex (
* different level can only mean that the mutex ordering rule is being
* violated. This behavior is clarified in ACPI 4.0 specification.
*/
if (ObjDesc->Mutex.SyncLevel != WalkState->Thread->CurrentSyncLevel)
if (ObjDesc->Mutex.SyncLevel != OwnerThread->CurrentSyncLevel)
{
ACPI_ERROR ((AE_INFO,
"Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %d current %d",
"Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %u current %u",
AcpiUtGetNodeName (ObjDesc->Mutex.Node),
ObjDesc->Mutex.SyncLevel, WalkState->Thread->CurrentSyncLevel));
return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
@@ -536,7 +542,7 @@ AcpiExReleaseMutex (
* acquired, but are not released in reverse order.
*/
PreviousSyncLevel =
WalkState->Thread->AcquiredMutexList->Mutex.OriginalSyncLevel;
OwnerThread->AcquiredMutexList->Mutex.OriginalSyncLevel;
Status = AcpiExReleaseMutexObject (ObjDesc);
if (ACPI_FAILURE (Status))
@@ -548,8 +554,9 @@ AcpiExReleaseMutex (
{
/* Restore the previous SyncLevel */
WalkState->Thread->CurrentSyncLevel = PreviousSyncLevel;
OwnerThread->CurrentSyncLevel = PreviousSyncLevel;
}
return_ACPI_STATUS (Status);
}
@@ -558,7 +565,7 @@ AcpiExReleaseMutex (
*
* FUNCTION: AcpiExReleaseAllMutexes
*
* PARAMETERS: Thread - Current executing thread object
* PARAMETERS: Thread - Current executing thread object
*
* RETURN: Status
*
@@ -617,5 +624,3 @@ AcpiExReleaseAllMutexes (
Thread->CurrentSyncLevel = ObjDesc->Mutex.OriginalSyncLevel;
}
}
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -189,7 +189,7 @@ AcpiExAllocateNameString (
if (!NameString)
{
ACPI_ERROR ((AE_INFO,
"Could not allocate size %d", SizeNeeded));
"Could not allocate size %u", SizeNeeded));
return_PTR (NULL);
}
@@ -325,7 +325,7 @@ AcpiExNameSegment (
*/
Status = AE_AML_BAD_NAME;
ACPI_ERROR ((AE_INFO,
"Bad character %02x in name, at %p",
"Bad character 0x%02x in name, at %p",
*AmlAddress, AmlAddress));
}
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -193,7 +193,7 @@ AcpiExOpcode_0A_0T_1R (
default: /* Unknown opcode */
ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
break;
@@ -268,7 +268,7 @@ AcpiExOpcode_1A_0T_0R (
case AML_SLEEP_OP: /* Sleep (MsecTime) */
Status = AcpiExSystemDoSuspend (Operand[0]->Integer.Value);
Status = AcpiExSystemDoSleep (Operand[0]->Integer.Value);
break;
@@ -286,7 +286,7 @@ AcpiExOpcode_1A_0T_0R (
default: /* Unknown opcode */
ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
break;
@@ -332,7 +332,7 @@ AcpiExOpcode_1A_1T_0R (
default: /* Unknown opcode */
ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
@@ -368,8 +368,8 @@ AcpiExOpcode_1A_1T_1R (
ACPI_OPERAND_OBJECT *ReturnDesc2 = NULL;
UINT32 Temp32;
UINT32 i;
ACPI_INTEGER PowerOfTen;
ACPI_INTEGER Digit;
UINT64 PowerOfTen;
UINT64 Digit;
ACPI_FUNCTION_TRACE_STR (ExOpcode_1A_1T_1R,
@@ -477,7 +477,7 @@ AcpiExOpcode_1A_1T_1R (
/* Sum the digit into the result with the current power of 10 */
ReturnDesc->Integer.Value +=
(((ACPI_INTEGER) Temp32) * PowerOfTen);
(((UINT64) Temp32) * PowerOfTen);
/* Shift to next BCD digit */
@@ -506,7 +506,7 @@ AcpiExOpcode_1A_1T_1R (
* remainder from above
*/
ReturnDesc->Integer.Value |=
(((ACPI_INTEGER) Temp32) << ACPI_MUL_4 (i));
(((UINT64) Temp32) << ACPI_MUL_4 (i));
}
/* Overflow if there is any data left in Digit */
@@ -514,7 +514,7 @@ AcpiExOpcode_1A_1T_1R (
if (Digit > 0)
{
ACPI_ERROR ((AE_INFO,
"Integer too large to convert to BCD: %8.8X%8.8X",
"Integer too large to convert to BCD: 0x%8.8X%8.8X",
ACPI_FORMAT_UINT64 (Operand[0]->Integer.Value)));
Status = AE_AML_NUMERIC_OVERFLOW;
goto Cleanup;
@@ -553,7 +553,7 @@ AcpiExOpcode_1A_1T_1R (
/* The object exists in the namespace, return TRUE */
ReturnDesc->Integer.Value = ACPI_INTEGER_MAX;
ReturnDesc->Integer.Value = ACPI_UINT64_MAX;
goto Cleanup;
@@ -664,7 +664,7 @@ AcpiExOpcode_1A_1T_1R (
default: /* Unknown opcode */
ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
@@ -719,7 +719,7 @@ AcpiExOpcode_1A_0T_1R (
ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
ACPI_STATUS Status = AE_OK;
UINT32 Type;
ACPI_INTEGER Value;
UINT64 Value;
ACPI_FUNCTION_TRACE_STR (ExOpcode_1A_0T_1R,
@@ -745,7 +745,7 @@ AcpiExOpcode_1A_0T_1R (
*/
if (!Operand[0]->Integer.Value)
{
ReturnDesc->Integer.Value = ACPI_INTEGER_MAX;
ReturnDesc->Integer.Value = ACPI_UINT64_MAX;
}
break;
@@ -1116,7 +1116,7 @@ AcpiExOpcode_1A_0T_1R (
default:
ACPI_ERROR ((AE_INFO,
"Unknown Index TargetType %X in reference object %p",
"Unknown Index TargetType 0x%X in reference object %p",
Operand[0]->Reference.TargetType, Operand[0]));
Status = AE_AML_OPERAND_TYPE;
goto Cleanup;
@@ -1143,7 +1143,7 @@ AcpiExOpcode_1A_0T_1R (
default:
ACPI_ERROR ((AE_INFO,
"Unknown class in reference(%p) - %2.2X",
"Unknown class in reference(%p) - 0x%2.2X",
Operand[0], Operand[0]->Reference.Class));
Status = AE_TYPE;
@@ -1155,7 +1155,7 @@ AcpiExOpcode_1A_0T_1R (
default:
ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -206,33 +206,6 @@ AcpiExOpcode_2A_0T_0R (
break;
}
#ifdef ACPI_GPE_NOTIFY_CHECK
/*
* GPE method wake/notify check. Here, we want to ensure that we
* don't receive any "DeviceWake" Notifies from a GPE _Lxx or _Exx
* GPE method during system runtime. If we do, the GPE is marked
* as "wake-only" and disabled.
*
* 1) Is the Notify() value == DeviceWake?
* 2) Is this a GPE deferred method? (An _Lxx or _Exx method)
* 3) Did the original GPE happen at system runtime?
* (versus during wake)
*
* If all three cases are true, this is a wake-only GPE that should
* be disabled at runtime.
*/
if (Value == 2) /* DeviceWake */
{
Status = AcpiEvCheckForWakeOnlyGpe (WalkState->GpeEventInfo);
if (ACPI_FAILURE (Status))
{
/* AE_WAKE_ONLY_GPE only error, means ignore this notify */
return_ACPI_STATUS (AE_OK)
}
}
#endif
/*
* Dispatch the notify to the appropriate handler
* NOTE: the request is queued for execution after this method
@@ -246,7 +219,7 @@ AcpiExOpcode_2A_0T_0R (
default:
ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
}
@@ -319,7 +292,7 @@ AcpiExOpcode_2A_2T_1R (
default:
ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
@@ -383,7 +356,7 @@ AcpiExOpcode_2A_1T_1R (
{
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
ACPI_INTEGER Index;
UINT64 Index;
ACPI_STATUS Status = AE_OK;
ACPI_SIZE Length;
@@ -555,7 +528,7 @@ AcpiExOpcode_2A_1T_1R (
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Index (%X%8.8X) is beyond end of object",
"Index (0x%8.8X%8.8X) is beyond end of object",
ACPI_FORMAT_UINT64 (Index)));
goto Cleanup;
}
@@ -579,7 +552,7 @@ AcpiExOpcode_2A_1T_1R (
default:
ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
break;
@@ -702,7 +675,7 @@ AcpiExOpcode_2A_0T_1R (
default:
ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
@@ -716,7 +689,7 @@ StoreLogicalResult:
*/
if (LogicalResult)
{
ReturnDesc->Integer.Value = ACPI_INTEGER_MAX;
ReturnDesc->Integer.Value = ACPI_UINT64_MAX;
}
Cleanup:
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -206,7 +206,7 @@ AcpiExOpcode_3A_0T_0R (
default:
ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
@@ -239,7 +239,7 @@ AcpiExOpcode_3A_1T_1R (
ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
char *Buffer = NULL;
ACPI_STATUS Status = AE_OK;
ACPI_INTEGER Index;
UINT64 Index;
ACPI_SIZE Length;
@@ -345,7 +345,7 @@ AcpiExOpcode_3A_1T_1R (
default:
ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -305,7 +305,7 @@ AcpiExOpcode_6A_0T_1R (
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
ACPI_STATUS Status = AE_OK;
ACPI_INTEGER Index;
UINT64 Index;
ACPI_OPERAND_OBJECT *ThisElement;
@@ -337,16 +337,16 @@ AcpiExOpcode_6A_0T_1R (
if (Index >= Operand[0]->Package.Count)
{
ACPI_ERROR ((AE_INFO,
"Index (%X%8.8X) beyond package end (%X)",
"Index (0x%8.8X%8.8X) beyond package end (0x%X)",
ACPI_FORMAT_UINT64 (Index), Operand[0]->Package.Count));
Status = AE_AML_PACKAGE_LIMIT;
goto Cleanup;
}
/* Create an integer for the return value */
/* Default return value is ACPI_INTEGER_MAX if no match found */
/* Default return value is ACPI_UINT64_MAX if no match found */
ReturnDesc = AcpiUtCreateIntegerObject (ACPI_INTEGER_MAX);
ReturnDesc = AcpiUtCreateIntegerObject (ACPI_UINT64_MAX);
if (!ReturnDesc)
{
Status = AE_NO_MEMORY;
@@ -362,7 +362,7 @@ AcpiExOpcode_6A_0T_1R (
*
* Upon finding a match, the loop will terminate via "break" at
* the bottom. If it terminates "normally", MatchValue will be
* ACPI_INTEGER_MAX (Ones) (its initial value) indicating that no
* ACPI_UINT64_MAX (Ones) (its initial value) indicating that no
* match was found.
*/
for ( ; Index < Operand[0]->Package.Count; Index++)
@@ -411,7 +411,7 @@ AcpiExOpcode_6A_0T_1R (
default:
ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -193,12 +193,12 @@ AcpiExGenerateAccess (
FieldByteLength = FieldByteEndOffset - FieldByteOffset;
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Bit length %d, Bit offset %d\n",
FieldBitLength, FieldBitOffset));
"Bit length %u, Bit offset %u\n",
FieldBitLength, FieldBitOffset));
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Byte Length %d, Byte Offset %d, End Offset %d\n",
FieldByteLength, FieldByteOffset, FieldByteEndOffset));
"Byte Length %u, Byte Offset %u, End Offset %u\n",
FieldByteLength, FieldByteOffset, FieldByteEndOffset));
/*
* Iterative search for the maximum access width that is both aligned
@@ -228,18 +228,18 @@ AcpiExGenerateAccess (
Accesses = FieldEndOffset - FieldStartOffset;
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"AccessWidth %d end is within region\n", AccessByteWidth));
"AccessWidth %u end is within region\n", AccessByteWidth));
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Field Start %d, Field End %d -- requires %d accesses\n",
FieldStartOffset, FieldEndOffset, Accesses));
"Field Start %u, Field End %u -- requires %u accesses\n",
FieldStartOffset, FieldEndOffset, Accesses));
/* Single access is optimal */
if (Accesses <= 1)
{
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Entire field can be accessed with one operation of size %d\n",
"Entire field can be accessed with one operation of size %u\n",
AccessByteWidth));
return_VALUE (AccessByteWidth);
}
@@ -257,11 +257,11 @@ AcpiExGenerateAccess (
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"AccessWidth %d end is NOT within region\n", AccessByteWidth));
"AccessWidth %u end is NOT within region\n", AccessByteWidth));
if (AccessByteWidth == 1)
{
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Field goes beyond end-of-region!\n"));
"Field goes beyond end-of-region!\n"));
/* Field does not fit in the region at all */
@@ -273,8 +273,8 @@ AcpiExGenerateAccess (
* previous access
*/
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Backing off to previous optimal access width of %d\n",
MinimumAccessWidth));
"Backing off to previous optimal access width of %u\n",
MinimumAccessWidth));
return_VALUE (MinimumAccessWidth);
}
}
@@ -284,7 +284,7 @@ AcpiExGenerateAccess (
* just use max access width
*/
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Cannot access field in one operation, using width 8\n"));
"Cannot access field in one operation, using width 8\n"));
return_VALUE (8);
}
#endif /* ACPI_UNDER_DEVELOPMENT */
@@ -362,7 +362,7 @@ AcpiExDecodeFieldAccess (
/* Invalid field access type */
ACPI_ERROR ((AE_INFO,
"Unknown field access type %X",
"Unknown field access type 0x%X",
Access));
return_UINT32 (0);
}
@@ -444,18 +444,16 @@ AcpiExPrepCommonFieldObject (
* the same (equivalent) as the ByteAlignment.
*/
AccessBitWidth = AcpiExDecodeFieldAccess (ObjDesc, FieldFlags,
&ByteAlignment);
&ByteAlignment);
if (!AccessBitWidth)
{
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
}
/* Setup width (access granularity) fields */
/* Setup width (access granularity) fields (values are: 1, 2, 4, 8) */
ObjDesc->CommonField.AccessByteWidth = (UINT8)
ACPI_DIV_8 (AccessBitWidth); /* 1, 2, 4, 8 */
ObjDesc->CommonField.AccessBitWidth = (UINT8) AccessBitWidth;
ACPI_DIV_8 (AccessBitWidth);
/*
* BaseByteOffset is the address of the start of the field within the
@@ -468,9 +466,9 @@ AcpiExPrepCommonFieldObject (
* region or buffer.
*/
NearestByteAddress =
ACPI_ROUND_BITS_DOWN_TO_BYTES (FieldBitPosition);
ACPI_ROUND_BITS_DOWN_TO_BYTES (FieldBitPosition);
ObjDesc->CommonField.BaseByteOffset = (UINT32)
ACPI_ROUND_DOWN (NearestByteAddress, ByteAlignment);
ACPI_ROUND_DOWN (NearestByteAddress, ByteAlignment);
/*
* StartFieldBitOffset is the offset of the first bit of the field within
@@ -479,16 +477,6 @@ AcpiExPrepCommonFieldObject (
ObjDesc->CommonField.StartFieldBitOffset = (UINT8)
(FieldBitPosition - ACPI_MUL_8 (ObjDesc->CommonField.BaseByteOffset));
/*
* Does the entire field fit within a single field access element? (datum)
* (i.e., without crossing a datum boundary)
*/
if ((ObjDesc->CommonField.StartFieldBitOffset + FieldBitLength) <=
(UINT16) AccessBitWidth)
{
ObjDesc->Common.Flags |= AOPOBJ_SINGLE_DATUM;
}
return_ACPI_STATUS (AE_OK);
}
@@ -512,8 +500,9 @@ AcpiExPrepFieldValue (
{
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_OPERAND_OBJECT *SecondDesc = NULL;
UINT32 Type;
ACPI_STATUS Status;
UINT32 AccessByteWidth;
UINT32 Type;
ACPI_FUNCTION_TRACE (ExPrepFieldValue);
@@ -532,8 +521,7 @@ AcpiExPrepFieldValue (
Type = AcpiNsGetType (Info->RegionNode);
if (Type != ACPI_TYPE_REGION)
{
ACPI_ERROR ((AE_INFO,
"Needed Region, found type %X (%s)",
ACPI_ERROR ((AE_INFO, "Needed Region, found type 0x%X (%s)",
Type, AcpiUtGetTypeName (Type)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -551,8 +539,9 @@ AcpiExPrepFieldValue (
/* Initialize areas of the object that are common to all fields */
ObjDesc->CommonField.Node = Info->FieldNode;
Status = AcpiExPrepCommonFieldObject (ObjDesc, Info->FieldFlags,
Info->Attribute, Info->FieldBitPosition, Info->FieldBitLength);
Status = AcpiExPrepCommonFieldObject (ObjDesc,
Info->FieldFlags, Info->Attribute,
Info->FieldBitPosition, Info->FieldBitLength);
if (ACPI_FAILURE (Status))
{
AcpiUtDeleteObjectDesc (ObjDesc);
@@ -567,6 +556,22 @@ AcpiExPrepFieldValue (
ObjDesc->Field.RegionObj = AcpiNsGetAttachedObject (Info->RegionNode);
/* Allow full data read from EC address space */
if ((ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_EC) &&
(ObjDesc->CommonField.BitLength > 8))
{
AccessByteWidth = ACPI_ROUND_BITS_UP_TO_BYTES (
ObjDesc->CommonField.BitLength);
/* Maximum byte width supported is 255 */
if (AccessByteWidth < 256)
{
ObjDesc->CommonField.AccessByteWidth = (UINT8) AccessByteWidth;
}
}
/* An additional reference for the container */
AcpiUtAddReference (ObjDesc->Field.RegionObj);
@@ -580,11 +585,11 @@ AcpiExPrepFieldValue (
case ACPI_TYPE_LOCAL_BANK_FIELD:
ObjDesc->BankField.Value = Info->BankValue;
ObjDesc->BankField.RegionObj = AcpiNsGetAttachedObject (
Info->RegionNode);
ObjDesc->BankField.BankObj = AcpiNsGetAttachedObject (
Info->RegisterNode);
ObjDesc->BankField.Value = Info->BankValue;
ObjDesc->BankField.RegionObj =
AcpiNsGetAttachedObject (Info->RegionNode);
ObjDesc->BankField.BankObj =
AcpiNsGetAttachedObject (Info->RegisterNode);
/* An additional reference for the attached objects */
@@ -604,9 +609,11 @@ AcpiExPrepFieldValue (
* opcode and operands -- since the BankValue
* operands must be evaluated.
*/
SecondDesc = ObjDesc->Common.NextObject;
SecondDesc->Extra.AmlStart = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Info->DataRegisterNode)->Named.Data;
SecondDesc->Extra.AmlLength = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Info->DataRegisterNode)->Named.Length;
SecondDesc = ObjDesc->Common.NextObject;
SecondDesc->Extra.AmlStart = ACPI_CAST_PTR (ACPI_PARSE_OBJECT,
Info->DataRegisterNode)->Named.Data;
SecondDesc->Extra.AmlLength = ACPI_CAST_PTR (ACPI_PARSE_OBJECT,
Info->DataRegisterNode)->Named.Length;
break;
@@ -615,10 +622,10 @@ AcpiExPrepFieldValue (
/* Get the Index and Data registers */
ObjDesc->IndexField.IndexObj = AcpiNsGetAttachedObject (
Info->RegisterNode);
ObjDesc->IndexField.DataObj = AcpiNsGetAttachedObject (
Info->DataRegisterNode);
ObjDesc->IndexField.IndexObj =
AcpiNsGetAttachedObject (Info->RegisterNode);
ObjDesc->IndexField.DataObj =
AcpiNsGetAttachedObject (Info->DataRegisterNode);
if (!ObjDesc->IndexField.DataObj || !ObjDesc->IndexField.IndexObj)
{
@@ -673,10 +680,10 @@ AcpiExPrepFieldValue (
* preserving the current type of that NamedObj.
*/
Status = AcpiNsAttachObject (Info->FieldNode, ObjDesc,
AcpiNsGetType (Info->FieldNode));
AcpiNsGetType (Info->FieldNode));
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Set NamedObj %p [%4.4s], ObjDesc %p\n",
Info->FieldNode, AcpiUtGetNodeName (Info->FieldNode), ObjDesc));
Info->FieldNode, AcpiUtGetNodeName (Info->FieldNode), ObjDesc));
/* Remove local reference to the object */
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -149,7 +149,7 @@ AcpiExSystemMemorySpaceHandler (
UINT32 Function,
ACPI_PHYSICAL_ADDRESS Address,
UINT32 BitWidth,
ACPI_INTEGER *Value,
UINT64 *Value,
void *HandlerContext,
void *RegionContext)
{
@@ -188,7 +188,7 @@ AcpiExSystemMemorySpaceHandler (
break;
default:
ACPI_ERROR ((AE_INFO, "Invalid SystemMemory width %d",
ACPI_ERROR ((AE_INFO, "Invalid SystemMemory width %u",
BitWidth));
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
}
@@ -198,7 +198,7 @@ AcpiExSystemMemorySpaceHandler (
* Hardware does not support non-aligned data transfers, we must verify
* the request.
*/
(void) AcpiUtShortDivide ((ACPI_INTEGER) Address, Length, NULL, &Remainder);
(void) AcpiUtShortDivide ((UINT64) Address, Length, NULL, &Remainder);
if (Remainder != 0)
{
return_ACPI_STATUS (AE_AML_ALIGNMENT);
@@ -211,8 +211,8 @@ AcpiExSystemMemorySpaceHandler (
* 2) Address beyond the current mapping?
*/
if ((Address < MemInfo->MappedPhysicalAddress) ||
(((ACPI_INTEGER) Address + Length) >
((ACPI_INTEGER)
(((UINT64) Address + Length) >
((UINT64)
MemInfo->MappedPhysicalAddress + MemInfo->MappedLength)))
{
/*
@@ -265,7 +265,7 @@ AcpiExSystemMemorySpaceHandler (
if (!MemInfo->MappedLogicalAddress)
{
ACPI_ERROR ((AE_INFO,
"Could not map memory at %8.8X%8.8X, size %X",
"Could not map memory at 0x%8.8X%8.8X, size %u",
ACPI_FORMAT_NATIVE_UINT (Address), (UINT32) MapLength));
MemInfo->MappedLength = 0;
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -282,10 +282,10 @@ AcpiExSystemMemorySpaceHandler (
* access
*/
LogicalAddrPtr = MemInfo->MappedLogicalAddress +
((ACPI_INTEGER) Address - (ACPI_INTEGER) MemInfo->MappedPhysicalAddress);
((UINT64) Address - (UINT64) MemInfo->MappedPhysicalAddress);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n",
"System-Memory (width %u) R/W %u Address=%8.8X%8.8X\n",
BitWidth, Function, ACPI_FORMAT_NATIVE_UINT (Address)));
/*
@@ -304,19 +304,19 @@ AcpiExSystemMemorySpaceHandler (
switch (BitWidth)
{
case 8:
*Value = (ACPI_INTEGER) ACPI_GET8 (LogicalAddrPtr);
*Value = (UINT64) ACPI_GET8 (LogicalAddrPtr);
break;
case 16:
*Value = (ACPI_INTEGER) ACPI_GET16 (LogicalAddrPtr);
*Value = (UINT64) ACPI_GET16 (LogicalAddrPtr);
break;
case 32:
*Value = (ACPI_INTEGER) ACPI_GET32 (LogicalAddrPtr);
*Value = (UINT64) ACPI_GET32 (LogicalAddrPtr);
break;
case 64:
*Value = (ACPI_INTEGER) ACPI_GET64 (LogicalAddrPtr);
*Value = (UINT64) ACPI_GET64 (LogicalAddrPtr);
break;
default:
@@ -383,7 +383,7 @@ AcpiExSystemIoSpaceHandler (
UINT32 Function,
ACPI_PHYSICAL_ADDRESS Address,
UINT32 BitWidth,
ACPI_INTEGER *Value,
UINT64 *Value,
void *HandlerContext,
void *RegionContext)
{
@@ -395,7 +395,7 @@ AcpiExSystemIoSpaceHandler (
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"System-IO (width %d) R/W %d Address=%8.8X%8.8X\n",
"System-IO (width %u) R/W %u Address=%8.8X%8.8X\n",
BitWidth, Function, ACPI_FORMAT_NATIVE_UINT (Address)));
/* Decode the function parameter */
@@ -447,7 +447,7 @@ AcpiExPciConfigSpaceHandler (
UINT32 Function,
ACPI_PHYSICAL_ADDRESS Address,
UINT32 BitWidth,
ACPI_INTEGER *Value,
UINT64 *Value,
void *HandlerContext,
void *RegionContext)
{
@@ -475,7 +475,7 @@ AcpiExPciConfigSpaceHandler (
PciRegister = (UINT16) (UINT32) Address;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Pci-Config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n",
"Pci-Config %u (%u) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n",
Function, BitWidth, PciId->Segment, PciId->Bus, PciId->Device,
PciId->Function, PciRegister));
@@ -527,7 +527,7 @@ AcpiExCmosSpaceHandler (
UINT32 Function,
ACPI_PHYSICAL_ADDRESS Address,
UINT32 BitWidth,
ACPI_INTEGER *Value,
UINT64 *Value,
void *HandlerContext,
void *RegionContext)
{
@@ -564,7 +564,7 @@ AcpiExPciBarSpaceHandler (
UINT32 Function,
ACPI_PHYSICAL_ADDRESS Address,
UINT32 BitWidth,
ACPI_INTEGER *Value,
UINT64 *Value,
void *HandlerContext,
void *RegionContext)
{
@@ -601,15 +601,17 @@ AcpiExDataTableSpaceHandler (
UINT32 Function,
ACPI_PHYSICAL_ADDRESS Address,
UINT32 BitWidth,
ACPI_INTEGER *Value,
UINT64 *Value,
void *HandlerContext,
void *RegionContext)
{
ACPI_FUNCTION_TRACE (ExDataTableSpaceHandler);
/* Perform the memory read or write */
/*
* Perform the memory read or write. The BitWidth was already
* validated.
*/
switch (Function)
{
case ACPI_READ:
@@ -619,9 +621,14 @@ AcpiExDataTableSpaceHandler (
break;
case ACPI_WRITE:
ACPI_MEMCPY (ACPI_PHYSADDR_TO_PTR (Address), ACPI_CAST_PTR (char, Value),
ACPI_DIV_8 (BitWidth));
break;
default:
return_ACPI_STATUS (AE_SUPPORT);
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
return_ACPI_STATUS (AE_OK);
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -344,7 +344,7 @@ AcpiExResolveNodeToValue (
/* No named references are allowed here */
ACPI_ERROR ((AE_INFO,
"Unsupported Reference type %X",
"Unsupported Reference type 0x%X",
SourceDesc->Reference.Class));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -357,7 +357,7 @@ AcpiExResolveNodeToValue (
/* Default case is for unknown types */
ACPI_ERROR ((AE_INFO,
"Node %p - Unknown object type %X",
"Node %p - Unknown object type 0x%X",
Node, EntryType));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -326,7 +326,7 @@ AcpiExResolveObjectToValue (
/* Invalid reference object */
ACPI_ERROR ((AE_INFO,
"Unknown TargetType %X in Index/Reference object %p",
"Unknown TargetType 0x%X in Index/Reference object %p",
StackDesc->Reference.TargetType, StackDesc));
Status = AE_AML_INTERNAL;
break;
@@ -367,7 +367,7 @@ AcpiExResolveObjectToValue (
default:
ACPI_ERROR ((AE_INFO,
"Unknown Reference type %X in %p", RefType, StackDesc));
"Unknown Reference type 0x%X in %p", RefType, StackDesc));
Status = AE_AML_INTERNAL;
break;
}
@@ -503,7 +503,7 @@ AcpiExResolveMultiple (
if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
{
ACPI_ERROR ((AE_INFO,
"Not a NS node %p [%s]",
"Not a namespace node %p [%s]",
Node, AcpiUtGetDescriptorName (Node)));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
@@ -605,7 +605,7 @@ AcpiExResolveMultiple (
default:
ACPI_ERROR ((AE_INFO,
"Unknown Reference Class %2.2X", ObjDesc->Reference.Class));
"Unknown Reference Class 0x%2.2X", ObjDesc->Reference.Class));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
}
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -243,7 +243,7 @@ AcpiExResolveOperands (
ArgTypes = OpInfo->RuntimeArgs;
if (ArgTypes == ARGI_INVALID_OPCODE)
{
ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
Opcode));
return_ACPI_STATUS (AE_AML_INTERNAL);
@@ -309,7 +309,7 @@ AcpiExResolveOperands (
if (!AcpiUtValidObjectType (ObjectType))
{
ACPI_ERROR ((AE_INFO,
"Bad operand object type [%X]", ObjectType));
"Bad operand object type [0x%X]", ObjectType));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
@@ -342,7 +342,7 @@ AcpiExResolveOperands (
default:
ACPI_ERROR ((AE_INFO,
"Unknown Reference Class %2.2X in %p",
"Unknown Reference Class 0x%2.2X in %p",
ObjDesc->Reference.Class, ObjDesc));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -773,7 +773,7 @@ AcpiExResolveOperands (
/* Unknown type */
ACPI_ERROR ((AE_INFO,
"Internal - Unknown ARGI (required operand) type %X",
"Internal - Unknown ARGI (required operand) type 0x%X",
ThisArgType));
return_ACPI_STATUS (AE_BAD_PARAMETER);
@@ -1,4 +1,3 @@
/******************************************************************************
*
* Module Name: exstore - AML Interpreter object store support
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -129,12 +128,6 @@
/* Local prototypes */
static void
AcpiExDoDebugObject (
ACPI_OPERAND_OBJECT *SourceDesc,
UINT32 Level,
UINT32 Index);
static ACPI_STATUS
AcpiExStoreObjectToIndex (
ACPI_OPERAND_OBJECT *ValDesc,
@@ -142,218 +135,6 @@ AcpiExStoreObjectToIndex (
ACPI_WALK_STATE *WalkState);
/*******************************************************************************
*
* FUNCTION: AcpiExDoDebugObject
*
* PARAMETERS: SourceDesc - Value to be stored
* Level - Indentation level (used for packages)
* Index - Current package element, zero if not pkg
*
* RETURN: None
*
* DESCRIPTION: Handles stores to the Debug Object.
*
******************************************************************************/
static void
AcpiExDoDebugObject (
ACPI_OPERAND_OBJECT *SourceDesc,
UINT32 Level,
UINT32 Index)
{
UINT32 i;
ACPI_FUNCTION_TRACE_PTR (ExDoDebugObject, SourceDesc);
/* Print line header as long as we are not in the middle of an object display */
if (!((Level > 0) && Index == 0))
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s",
Level, " "));
}
/* Display index for package output only */
if (Index > 0)
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT,
"(%.2u) ", Index -1));
}
if (!SourceDesc)
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[Null Object]\n"));
return_VOID;
}
if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_OPERAND)
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s ",
AcpiUtGetObjectTypeName (SourceDesc)));
if (!AcpiUtValidInternalObject (SourceDesc))
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT,
"%p, Invalid Internal Object!\n", SourceDesc));
return_VOID;
}
}
else if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_NAMED)
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: %p\n",
AcpiUtGetTypeName (((ACPI_NAMESPACE_NODE *) SourceDesc)->Type),
SourceDesc));
return_VOID;
}
else
{
return_VOID;
}
/* SourceDesc is of type ACPI_DESC_TYPE_OPERAND */
switch (SourceDesc->Common.Type)
{
case ACPI_TYPE_INTEGER:
/* Output correct integer width */
if (AcpiGbl_IntegerByteWidth == 4)
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n",
(UINT32) SourceDesc->Integer.Value));
}
else
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (SourceDesc->Integer.Value)));
}
break;
case ACPI_TYPE_BUFFER:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]\n",
(UINT32) SourceDesc->Buffer.Length));
ACPI_DUMP_BUFFER (SourceDesc->Buffer.Pointer,
(SourceDesc->Buffer.Length < 256) ? SourceDesc->Buffer.Length : 256);
break;
case ACPI_TYPE_STRING:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n",
SourceDesc->String.Length, SourceDesc->String.Pointer));
break;
case ACPI_TYPE_PACKAGE:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[Contains 0x%.2X Elements]\n",
SourceDesc->Package.Count));
/* Output the entire contents of the package */
for (i = 0; i < SourceDesc->Package.Count; i++)
{
AcpiExDoDebugObject (SourceDesc->Package.Elements[i],
Level+4, i+1);
}
break;
case ACPI_TYPE_LOCAL_REFERENCE:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s] ",
AcpiUtGetReferenceName (SourceDesc)));
/* Decode the reference */
switch (SourceDesc->Reference.Class)
{
case ACPI_REFCLASS_INDEX:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%X\n",
SourceDesc->Reference.Value));
break;
case ACPI_REFCLASS_TABLE:
/* Case for DdbHandle */
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Table Index 0x%X\n",
SourceDesc->Reference.Value));
return;
default:
break;
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, " "));
/* Check for valid node first, then valid object */
if (SourceDesc->Reference.Node)
{
if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc->Reference.Node) !=
ACPI_DESC_TYPE_NAMED)
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT,
" %p - Not a valid namespace node\n",
SourceDesc->Reference.Node));
}
else
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Node %p [%4.4s] ",
SourceDesc->Reference.Node, (SourceDesc->Reference.Node)->Name.Ascii));
switch ((SourceDesc->Reference.Node)->Type)
{
/* These types have no attached object */
case ACPI_TYPE_DEVICE:
AcpiOsPrintf ("Device\n");
break;
case ACPI_TYPE_THERMAL:
AcpiOsPrintf ("Thermal Zone\n");
break;
default:
AcpiExDoDebugObject ((SourceDesc->Reference.Node)->Object,
Level+4, 0);
break;
}
}
}
else if (SourceDesc->Reference.Object)
{
if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc->Reference.Object) ==
ACPI_DESC_TYPE_NAMED)
{
AcpiExDoDebugObject (((ACPI_NAMESPACE_NODE *)
SourceDesc->Reference.Object)->Object,
Level+4, 0);
}
else
{
AcpiExDoDebugObject (SourceDesc->Reference.Object, Level+4, 0);
}
}
break;
default:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p\n",
SourceDesc));
break;
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "\n"));
return_VOID;
}
/*******************************************************************************
*
* FUNCTION: AcpiExStore
@@ -487,13 +268,13 @@ AcpiExStore (
"**** Write to Debug Object: Object %p %s ****:\n\n",
SourceDesc, AcpiUtGetObjectTypeName (SourceDesc)));
AcpiExDoDebugObject (SourceDesc, 0, 0);
ACPI_DEBUG_OBJECT (SourceDesc, 0, 0);
break;
default:
ACPI_ERROR ((AE_INFO, "Unknown Reference Class %2.2X",
ACPI_ERROR ((AE_INFO, "Unknown Reference Class 0x%2.2X",
RefDesc->Reference.Class));
ACPI_DUMP_ENTRY (RefDesc, ACPI_LV_INFO);
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, 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 - 2009, 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 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -265,7 +265,7 @@ AcpiExSystemDoStall (
* (ACPI specifies 100 usec as max, but this gives some slack in
* order to support existing BIOSs)
*/
ACPI_ERROR ((AE_INFO, "Time parameter is too large (%d)",
ACPI_ERROR ((AE_INFO, "Time parameter is too large (%u)",
HowLong));
Status = AE_AML_OPERAND_VALUE;
}
@@ -280,20 +280,20 @@ AcpiExSystemDoStall (
/*******************************************************************************
*
* FUNCTION: AcpiExSystemDoSuspend
* FUNCTION: AcpiExSystemDoSleep
*
* PARAMETERS: HowLong - The amount of time to suspend,
* PARAMETERS: HowLong - The amount of time to sleep,
* in milliseconds
*
* RETURN: None
*
* DESCRIPTION: Suspend running thread for specified amount of time.
* DESCRIPTION: Sleep the running thread for specified amount of time.
*
******************************************************************************/
ACPI_STATUS
AcpiExSystemDoSuspend (
ACPI_INTEGER HowLong)
AcpiExSystemDoSleep (
UINT64 HowLong)
{
ACPI_FUNCTION_ENTRY ();
@@ -302,6 +302,15 @@ AcpiExSystemDoSuspend (
AcpiExRelinquishInterpreter ();
/*
* For compatibility with other ACPI implementations and to prevent
* accidental deep sleeps, limit the sleep time to something reasonable.
*/
if (HowLong > ACPI_MAX_SLEEP)
{
HowLong = ACPI_MAX_SLEEP;
}
AcpiOsSleep (HowLong);
/* And now we must get the interpreter again */
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -144,7 +144,7 @@
static UINT32
AcpiExDigitsNeeded (
ACPI_INTEGER Value,
UINT64 Value,
UINT32 Base);
@@ -334,7 +334,7 @@ AcpiExTruncateFor32bitTable (
* We are running a method that exists in a 32-bit ACPI table.
* Truncate the value to 32 bits by zeroing out the upper 32-bit field
*/
ObjDesc->Integer.Value &= (ACPI_INTEGER) ACPI_UINT32_MAX;
ObjDesc->Integer.Value &= (UINT64) ACPI_UINT32_MAX;
}
}
@@ -446,17 +446,17 @@ AcpiExReleaseGlobalLock (
static UINT32
AcpiExDigitsNeeded (
ACPI_INTEGER Value,
UINT64 Value,
UINT32 Base)
{
UINT32 NumDigits;
ACPI_INTEGER CurrentValue;
UINT64 CurrentValue;
ACPI_FUNCTION_TRACE (ExDigitsNeeded);
/* ACPI_INTEGER is unsigned, so we don't worry about a '-' prefix */
/* UINT64 is unsigned, so we don't worry about a '-' prefix */
if (Value == 0)
{
@@ -497,7 +497,7 @@ AcpiExDigitsNeeded (
void
AcpiExEisaIdToString (
char *OutString,
ACPI_INTEGER CompressedId)
UINT64 CompressedId)
{
UINT32 SwappedId;
@@ -523,10 +523,10 @@ AcpiExEisaIdToString (
OutString[0] = (char) (0x40 + (((unsigned long) SwappedId >> 26) & 0x1F));
OutString[1] = (char) (0x40 + ((SwappedId >> 21) & 0x1F));
OutString[2] = (char) (0x40 + ((SwappedId >> 16) & 0x1F));
OutString[3] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) SwappedId, 12);
OutString[4] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) SwappedId, 8);
OutString[5] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) SwappedId, 4);
OutString[6] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) SwappedId, 0);
OutString[3] = AcpiUtHexToAsciiChar ((UINT64) SwappedId, 12);
OutString[4] = AcpiUtHexToAsciiChar ((UINT64) SwappedId, 8);
OutString[5] = AcpiUtHexToAsciiChar ((UINT64) SwappedId, 4);
OutString[6] = AcpiUtHexToAsciiChar ((UINT64) SwappedId, 0);
OutString[7] = 0;
}
@@ -551,7 +551,7 @@ AcpiExEisaIdToString (
void
AcpiExIntegerToString (
char *OutString,
ACPI_INTEGER Value)
UINT64 Value)
{
UINT32 Count;
UINT32 DigitsNeeded;
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, 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 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -132,23 +132,54 @@ AcpiHwEnableWakeupGpeBlock (
/******************************************************************************
*
* FUNCTION: AcpiHwLowDisableGpe
* FUNCTION: AcpiHwGetGpeRegisterBit
*
* PARAMETERS: GpeEventInfo - Info block for the GPE
* GpeRegisterInfo - Info block for the GPE register
*
* RETURN: Register mask with a one in the GPE bit position
*
* DESCRIPTION: Compute the register mask for this GPE. One bit is set in the
* correct position for the input GPE.
*
******************************************************************************/
UINT32
AcpiHwGetGpeRegisterBit (
ACPI_GPE_EVENT_INFO *GpeEventInfo,
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo)
{
return ((UINT32) 1 <<
(GpeEventInfo->GpeNumber - GpeRegisterInfo->BaseGpeNumber));
}
/******************************************************************************
*
* FUNCTION: AcpiHwLowSetGpe
*
* PARAMETERS: GpeEventInfo - Info block for the GPE to be disabled
* Action - Enable or disable
*
* RETURN: Status
*
* DESCRIPTION: Disable a single GPE in the enable register.
* DESCRIPTION: Enable or disable a single GPE in the parent enable register.
*
******************************************************************************/
ACPI_STATUS
AcpiHwLowDisableGpe (
ACPI_GPE_EVENT_INFO *GpeEventInfo)
AcpiHwLowSetGpe (
ACPI_GPE_EVENT_INFO *GpeEventInfo,
UINT32 Action)
{
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
ACPI_STATUS Status;
UINT32 EnableMask;
UINT32 RegisterBit;
ACPI_FUNCTION_ENTRY ();
/* Get the info block for the entire GPE register */
@@ -167,11 +198,34 @@ AcpiHwLowDisableGpe (
return (Status);
}
/* Clear just the bit that corresponds to this GPE */
/* Set or clear just the bit that corresponds to this GPE */
ACPI_CLEAR_BIT (EnableMask, ((UINT32) 1 <<
(GpeEventInfo->GpeNumber - GpeRegisterInfo->BaseGpeNumber)));
RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo);
switch (Action)
{
case ACPI_GPE_CONDITIONAL_ENABLE:
/* Only enable if the EnableForRun bit is set */
if (!(RegisterBit & GpeRegisterInfo->EnableForRun))
{
return (AE_BAD_PARAMETER);
}
/*lint -fallthrough */
case ACPI_GPE_ENABLE:
ACPI_SET_BIT (EnableMask, RegisterBit);
break;
case ACPI_GPE_DISABLE:
ACPI_CLEAR_BIT (EnableMask, RegisterBit);
break;
default:
ACPI_ERROR ((AE_INFO, "Invalid GPE Action, %u\n", Action));
return (AE_BAD_PARAMETER);
}
/* Write the updated enable mask */
@@ -180,48 +234,6 @@ AcpiHwLowDisableGpe (
}
/******************************************************************************
*
* FUNCTION: AcpiHwWriteGpeEnableReg
*
* PARAMETERS: GpeEventInfo - Info block for the GPE to be enabled
*
* RETURN: Status
*
* DESCRIPTION: Write a GPE enable register. Note: The bit for this GPE must
* already be cleared or set in the parent register
* EnableForRun mask.
*
******************************************************************************/
ACPI_STATUS
AcpiHwWriteGpeEnableReg (
ACPI_GPE_EVENT_INFO *GpeEventInfo)
{
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
ACPI_STATUS Status;
ACPI_FUNCTION_ENTRY ();
/* Get the info block for the entire GPE register */
GpeRegisterInfo = GpeEventInfo->RegisterInfo;
if (!GpeRegisterInfo)
{
return (AE_NOT_EXIST);
}
/* Write the entire GPE (runtime) enable register */
Status = AcpiHwWrite (GpeRegisterInfo->EnableForRun,
&GpeRegisterInfo->EnableAddress);
return (Status);
}
/******************************************************************************
*
* FUNCTION: AcpiHwClearGpe
@@ -238,22 +250,29 @@ ACPI_STATUS
AcpiHwClearGpe (
ACPI_GPE_EVENT_INFO *GpeEventInfo)
{
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
ACPI_STATUS Status;
UINT8 RegisterBit;
UINT32 RegisterBit;
ACPI_FUNCTION_ENTRY ();
/* Get the info block for the entire GPE register */
RegisterBit = (UINT8) (1 <<
(GpeEventInfo->GpeNumber - GpeEventInfo->RegisterInfo->BaseGpeNumber));
GpeRegisterInfo = GpeEventInfo->RegisterInfo;
if (!GpeRegisterInfo)
{
return (AE_NOT_EXIST);
}
/*
* Write a one to the appropriate bit in the status register to
* clear this GPE.
*/
RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo);
Status = AcpiHwWrite (RegisterBit,
&GpeEventInfo->RegisterInfo->StatusAddress);
&GpeRegisterInfo->StatusAddress);
return (Status);
}
@@ -278,10 +297,10 @@ AcpiHwGetGpeStatus (
ACPI_EVENT_STATUS *EventStatus)
{
UINT32 InByte;
UINT8 RegisterBit;
UINT32 RegisterBit;
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
ACPI_STATUS Status;
ACPI_EVENT_STATUS LocalEventStatus = 0;
ACPI_STATUS Status;
ACPI_FUNCTION_ENTRY ();
@@ -298,8 +317,7 @@ AcpiHwGetGpeStatus (
/* Get the register bitmask for this GPE */
RegisterBit = (UINT8) (1 <<
(GpeEventInfo->GpeNumber - GpeEventInfo->RegisterInfo->BaseGpeNumber));
RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo);
/* GPE currently enabled? (enabled for runtime?) */
@@ -320,7 +338,7 @@ AcpiHwGetGpeStatus (
Status = AcpiHwRead (&InByte, &GpeRegisterInfo->StatusAddress);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
return (Status);
}
if (RegisterBit & InByte)
@@ -331,10 +349,7 @@ AcpiHwGetGpeStatus (
/* Set return value */
(*EventStatus) = LocalEventStatus;
UnlockAndExit:
return (Status);
return (AE_OK);
}
@@ -0,0 +1,531 @@
/*******************************************************************************
*
* Module Name: hwpci - Obtain PCI bus, device, and function numbers
*
******************************************************************************/
/******************************************************************************
*
* 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 __HWPCI_C__
#include "acpi.h"
#include "accommon.h"
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("hwpci")
/* PCI configuration space values */
#define PCI_CFG_HEADER_TYPE_REG 0x0E
#define PCI_CFG_PRIMARY_BUS_NUMBER_REG 0x18
#define PCI_CFG_SECONDARY_BUS_NUMBER_REG 0x19
/* PCI header values */
#define PCI_HEADER_TYPE_MASK 0x7F
#define PCI_TYPE_BRIDGE 0x01
#define PCI_TYPE_CARDBUS_BRIDGE 0x02
typedef struct acpi_pci_device
{
ACPI_HANDLE Device;
struct acpi_pci_device *Next;
} ACPI_PCI_DEVICE;
/* Local prototypes */
static ACPI_STATUS
AcpiHwBuildPciList (
ACPI_HANDLE RootPciDevice,
ACPI_HANDLE PciRegion,
ACPI_PCI_DEVICE **ReturnListHead);
static ACPI_STATUS
AcpiHwProcessPciList (
ACPI_PCI_ID *PciId,
ACPI_PCI_DEVICE *ListHead);
static void
AcpiHwDeletePciList (
ACPI_PCI_DEVICE *ListHead);
static ACPI_STATUS
AcpiHwGetPciDeviceInfo (
ACPI_PCI_ID *PciId,
ACPI_HANDLE PciDevice,
UINT16 *BusNumber,
BOOLEAN *IsBridge);
/*******************************************************************************
*
* FUNCTION: AcpiHwDerivePciId
*
* PARAMETERS: PciId - Initial values for the PCI ID. May be
* modified by this function.
* RootPciDevice - A handle to a PCI device object. This
* object must be a PCI Root Bridge having a
* _HID value of either PNP0A03 or PNP0A08
* PciRegion - A handle to a PCI configuration space
* Operation Region being initialized
*
* RETURN: Status
*
* DESCRIPTION: This function derives a full PCI ID for a PCI device,
* consisting of a Segment number, Bus number, Device number,
* and function code.
*
* The PCI hardware dynamically configures PCI bus numbers
* depending on the bus topology discovered during system
* initialization. This function is invoked during configuration
* of a PCI_Config Operation Region in order to (possibly) update
* the Bus/Device/Function numbers in the PciId with the actual
* values as determined by the hardware and operating system
* configuration.
*
* The PciId parameter is initially populated during the Operation
* Region initialization. This function is then called, and is
* will make any necessary modifications to the Bus, Device, or
* Function number PCI ID subfields as appropriate for the
* current hardware and OS configuration.
*
* NOTE: Created 08/2010. Replaces the previous OSL AcpiOsDerivePciId
* interface since this feature is OS-independent. This module
* specifically avoids any use of recursion by building a local
* temporary device list.
*
******************************************************************************/
ACPI_STATUS
AcpiHwDerivePciId (
ACPI_PCI_ID *PciId,
ACPI_HANDLE RootPciDevice,
ACPI_HANDLE PciRegion)
{
ACPI_STATUS Status;
ACPI_PCI_DEVICE *ListHead = NULL;
ACPI_FUNCTION_TRACE (HwDerivePciId);
if (!PciId)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Build a list of PCI devices, from PciRegion up to RootPciDevice */
Status = AcpiHwBuildPciList (RootPciDevice, PciRegion, &ListHead);
if (ACPI_SUCCESS (Status))
{
/* Walk the list, updating the PCI device/function/bus numbers */
Status = AcpiHwProcessPciList (PciId, ListHead);
}
/* Always delete the list */
AcpiHwDeletePciList (ListHead);
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiHwBuildPciList
*
* PARAMETERS: RootPciDevice - A handle to a PCI device object. This
* object is guaranteed to be a PCI Root
* Bridge having a _HID value of either
* PNP0A03 or PNP0A08
* PciRegion - A handle to the PCI configuration space
* Operation Region
* ReturnListHead - Where the PCI device list is returned
*
* RETURN: Status
*
* DESCRIPTION: Builds a list of devices from the input PCI region up to the
* Root PCI device for this namespace subtree.
*
******************************************************************************/
static ACPI_STATUS
AcpiHwBuildPciList (
ACPI_HANDLE RootPciDevice,
ACPI_HANDLE PciRegion,
ACPI_PCI_DEVICE **ReturnListHead)
{
ACPI_HANDLE CurrentDevice;
ACPI_HANDLE ParentDevice;
ACPI_STATUS Status;
ACPI_PCI_DEVICE *ListElement;
ACPI_PCI_DEVICE *ListHead = NULL;
/*
* Ascend namespace branch until the RootPciDevice is reached, building
* a list of device nodes. Loop will exit when either the PCI device is
* found, or the root of the namespace is reached.
*/
CurrentDevice = PciRegion;
while (1)
{
Status = AcpiGetParent (CurrentDevice, &ParentDevice);
if (ACPI_FAILURE (Status))
{
return (Status);
}
/* Finished when we reach the PCI root device (PNP0A03 or PNP0A08) */
if (ParentDevice == RootPciDevice)
{
*ReturnListHead = ListHead;
return (AE_OK);
}
ListElement = ACPI_ALLOCATE (sizeof (ACPI_PCI_DEVICE));
if (!ListElement)
{
return (AE_NO_MEMORY);
}
/* Put new element at the head of the list */
ListElement->Next = ListHead;
ListElement->Device = ParentDevice;
ListHead = ListElement;
CurrentDevice = ParentDevice;
}
}
/*******************************************************************************
*
* FUNCTION: AcpiHwProcessPciList
*
* PARAMETERS: PciId - Initial values for the PCI ID. May be
* modified by this function.
* ListHead - Device list created by
* AcpiHwBuildPciList
*
* RETURN: Status
*
* DESCRIPTION: Walk downward through the PCI device list, getting the device
* info for each, via the PCI configuration space and updating
* the PCI ID as necessary. Deletes the list during traversal.
*
******************************************************************************/
static ACPI_STATUS
AcpiHwProcessPciList (
ACPI_PCI_ID *PciId,
ACPI_PCI_DEVICE *ListHead)
{
ACPI_STATUS Status = AE_OK;
ACPI_PCI_DEVICE *Info;
UINT16 BusNumber;
BOOLEAN IsBridge = TRUE;
ACPI_FUNCTION_NAME (HwProcessPciList);
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
"Input PciId: Seg %4.4X Bus %4.4X Dev %4.4X Func %4.4X\n",
PciId->Segment, PciId->Bus, PciId->Device, PciId->Function));
BusNumber = PciId->Bus;
/*
* Descend down the namespace tree, collecting PCI device, function,
* and bus numbers. BusNumber is only important for PCI bridges.
* Algorithm: As we descend the tree, use the last valid PCI device,
* function, and bus numbers that are discovered, and assign them
* to the PCI ID for the target device.
*/
Info = ListHead;
while (Info)
{
Status = AcpiHwGetPciDeviceInfo (PciId, Info->Device,
&BusNumber, &IsBridge);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
Info = Info->Next;
}
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
"Output PciId: Seg %4.4X Bus %4.4X Dev %4.4X Func %4.4X "
"Status %X BusNumber %X IsBridge %X\n",
PciId->Segment, PciId->Bus, PciId->Device, PciId->Function,
Status, BusNumber, IsBridge));
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiHwDeletePciList
*
* PARAMETERS: ListHead - Device list created by
* AcpiHwBuildPciList
*
* RETURN: None
*
* DESCRIPTION: Free the entire PCI list.
*
******************************************************************************/
static void
AcpiHwDeletePciList (
ACPI_PCI_DEVICE *ListHead)
{
ACPI_PCI_DEVICE *Next;
ACPI_PCI_DEVICE *Previous;
Next = ListHead;
while (Next)
{
Previous = Next;
Next = Previous->Next;
ACPI_FREE (Previous);
}
}
/*******************************************************************************
*
* FUNCTION: AcpiHwGetPciDeviceInfo
*
* PARAMETERS: PciId - Initial values for the PCI ID. May be
* modified by this function.
* PciDevice - Handle for the PCI device object
* BusNumber - Where a PCI bridge bus number is returned
* IsBridge - Return value, indicates if this PCI
* device is a PCI bridge
*
* RETURN: Status
*
* DESCRIPTION: Get the device info for a single PCI device object. Get the
* _ADR (contains PCI device and function numbers), and for PCI
* bridge devices, get the bus number from PCI configuration
* space.
*
******************************************************************************/
static ACPI_STATUS
AcpiHwGetPciDeviceInfo (
ACPI_PCI_ID *PciId,
ACPI_HANDLE PciDevice,
UINT16 *BusNumber,
BOOLEAN *IsBridge)
{
ACPI_STATUS Status;
ACPI_OBJECT_TYPE ObjectType;
UINT64 ReturnValue;
UINT64 PciValue;
/* We only care about objects of type Device */
Status = AcpiGetType (PciDevice, &ObjectType);
if (ACPI_FAILURE (Status))
{
return (Status);
}
if (ObjectType != ACPI_TYPE_DEVICE)
{
return (AE_OK);
}
/* We need an _ADR. Ignore device if not present */
Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR,
PciDevice, &ReturnValue);
if (ACPI_FAILURE (Status))
{
return (AE_OK);
}
/*
* From _ADR, get the PCI Device and Function and
* update the PCI ID.
*/
PciId->Device = ACPI_HIWORD (ACPI_LODWORD (ReturnValue));
PciId->Function = ACPI_LOWORD (ACPI_LODWORD (ReturnValue));
/*
* If the previous device was a bridge, use the previous
* device bus number
*/
if (*IsBridge)
{
PciId->Bus = *BusNumber;
}
/*
* Get the bus numbers from PCI Config space:
*
* First, get the PCI HeaderType
*/
*IsBridge = FALSE;
Status = AcpiOsReadPciConfiguration (PciId,
PCI_CFG_HEADER_TYPE_REG, &PciValue, 8);
if (ACPI_FAILURE (Status))
{
return (Status);
}
/* We only care about bridges (1=PciBridge, 2=CardBusBridge) */
PciValue &= PCI_HEADER_TYPE_MASK;
if ((PciValue != PCI_TYPE_BRIDGE) &&
(PciValue != PCI_TYPE_CARDBUS_BRIDGE))
{
return (AE_OK);
}
/* Bridge: Get the Primary BusNumber */
Status = AcpiOsReadPciConfiguration (PciId,
PCI_CFG_PRIMARY_BUS_NUMBER_REG, &PciValue, 8);
if (ACPI_FAILURE (Status))
{
return (Status);
}
*IsBridge = TRUE;
PciId->Bus = (UINT16) PciValue;
/* Bridge: Get the Secondary BusNumber */
Status = AcpiOsReadPciConfiguration (PciId,
PCI_CFG_SECONDARY_BUS_NUMBER_REG, &PciValue, 8);
if (ACPI_FAILURE (Status))
{
return (Status);
}
*BusNumber = (UINT16) PciValue;
return (AE_OK);
}
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -412,7 +412,7 @@ AcpiHwGetBitRegisterInfo (
if (RegisterId > ACPI_BITREG_MAX)
{
ACPI_ERROR ((AE_INFO, "Invalid BitRegister ID: %X", RegisterId));
ACPI_ERROR ((AE_INFO, "Invalid BitRegister ID: 0x%X", RegisterId));
return (NULL);
}
@@ -539,7 +539,7 @@ AcpiHwRegisterRead (
default:
ACPI_ERROR ((AE_INFO, "Unknown Register ID: %X",
ACPI_ERROR ((AE_INFO, "Unknown Register ID: 0x%X",
RegisterId));
Status = AE_BAD_PARAMETER;
break;
@@ -682,7 +682,7 @@ AcpiHwRegisterWrite (
default:
ACPI_ERROR ((AE_INFO, "Unknown Register ID: %X",
ACPI_ERROR ((AE_INFO, "Unknown Register ID: 0x%X",
RegisterId));
Status = AE_BAD_PARAMETER;
break;
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -319,7 +319,7 @@ AcpiEnterSleepState (
if ((AcpiGbl_SleepTypeA > ACPI_SLEEP_TYPE_MAX) ||
(AcpiGbl_SleepTypeB > ACPI_SLEEP_TYPE_MAX))
{
ACPI_ERROR ((AE_INFO, "Sleep values out of range: A=%X B=%X",
ACPI_ERROR ((AE_INFO, "Sleep values out of range: A=0x%X B=0x%X",
AcpiGbl_SleepTypeA, AcpiGbl_SleepTypeB));
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
}
@@ -396,7 +396,7 @@ AcpiEnterSleepState (
return_ACPI_STATUS (Status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
"Entering sleep state [S%d]\n", SleepState));
"Entering sleep state [S%u]\n", SleepState));
/* Clear the SLP_EN and SLP_TYP fields */
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -232,7 +232,7 @@ AcpiGetTimerDuration (
{
ACPI_STATUS Status;
UINT32 DeltaTicks;
ACPI_INTEGER Quotient;
UINT64 Quotient;
ACPI_FUNCTION_TRACE (AcpiGetTimerDuration);
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -237,7 +237,7 @@ AcpiHwValidateIoRequest (
if (LastAddress > ACPI_UINT16_MAX)
{
ACPI_ERROR ((AE_INFO,
"Illegal I/O port address/length above 64K: 0x%p/%X",
"Illegal I/O port address/length above 64K: %p/0x%X",
ACPI_CAST_PTR (void, Address), ByteWidth));
return_ACPI_STATUS (AE_LIMIT);
}
@@ -316,6 +316,13 @@ AcpiHwReadPort (
UINT32 i;
/* Truncate address to 16 bits if requested */
if (AcpiGbl_TruncateIoAddresses)
{
Address &= ACPI_UINT16_MAX;
}
/* Validate the entire request and perform the I/O */
Status = AcpiHwValidateIoRequest (Address, Width);
@@ -383,6 +390,13 @@ AcpiHwWritePort (
UINT32 i;
/* Truncate address to 16 bits if requested */
if (AcpiGbl_TruncateIoAddresses)
{
Address &= ACPI_UINT16_MAX;
}
/* Validate the entire request and perform the I/O */
Status = AcpiHwValidateIoRequest (Address, Width);
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, 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 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -121,6 +121,47 @@
#pragma warning(disable:4100) /* warning C4100: unreferenced formal parameter */
#endif
/* Common info for tool signons */
#define ACPICA_NAME "Intel ACPI Component Architecture"
#define ACPICA_COPYRIGHT "Copyright (c) 2000 - 2011 Intel Corporation"
#if ACPI_MACHINE_WIDTH == 64
#define ACPI_WIDTH "-64"
#elif ACPI_MACHINE_WIDTH == 32
#define ACPI_WIDTH "-32"
#else
#error unknown ACPI_MACHINE_WIDTH
#define ACPI_WIDTH "-??"
#endif
/* Macros for signons and file headers */
#define ACPI_COMMON_SIGNON(UtilityName) \
"\n%s\n%s version %8.8X%s [%s]\n%s\n\n", \
ACPICA_NAME, \
UtilityName, ((UINT32) ACPI_CA_VERSION), ACPI_WIDTH, __DATE__, \
ACPICA_COPYRIGHT
#define ACPI_COMMON_HEADER(UtilityName, Prefix) \
"%s%s\n%s%s version %8.8X%s [%s]\n%s%s\n%s\n", \
Prefix, ACPICA_NAME, \
Prefix, UtilityName, ((UINT32) ACPI_CA_VERSION), ACPI_WIDTH, __DATE__, \
Prefix, ACPICA_COPYRIGHT, \
Prefix
/* Macros for usage messages */
#define ACPI_USAGE_HEADER(Usage) \
printf ("Usage: %s\nOptions:\n", Usage);
#define ACPI_OPTION(Name, Description) \
printf (" %-18s%s\n", Name, Description);
#define FILE_SUFFIX_DISASSEMBLY "dsl"
#define ACPI_TABLE_FILE_SUFFIX ".dat"
@@ -135,6 +176,7 @@ AcpiGetopt(
char *opts);
extern int AcpiGbl_Optind;
extern int AcpiGbl_Opterr;
extern char *AcpiGbl_Optarg;
@@ -231,11 +273,6 @@ FlSplitInputPathname (
char **OutDirectoryPath,
char **OutFilename);
char *
FlGenerateFilename (
char *InputFilename,
char *Suffix);
char *
AdGenerateFilename (
char *Prefix,
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, 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 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -193,6 +193,10 @@
#define ACPI_MAX_LOOP_ITERATIONS 0xFFFF
/* Maximum sleep allowed via Sleep() operator */
#define ACPI_MAX_SLEEP 2000 /* 2000 millisec == two seconds */
/******************************************************************************
*
@@ -236,7 +240,6 @@
/* Operation regions */
#define ACPI_NUM_PREDEFINED_REGIONS 9
#define ACPI_USER_REGION_BEGIN 0x80
/* Maximum SpaceIds for Operation Regions */
@@ -269,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 - 2009, 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,67 +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);
ACPI_STATUS
AcpiDbFindNameInNamespace (
char *NameArg);
void
AcpiDbSetScope (
char *Name);
AcpiDbDisplayInterfaces (
char *ActionArg,
char *InterfaceNameArg);
ACPI_STATUS
AcpiDbSleep (
char *ObjectArg);
void
AcpiDbFindReferences (
char *ObjectArg);
void
AcpiDbDisplayLocks (
void);
@@ -257,7 +210,7 @@ AcpiDbDisplayGpes (
void);
void
AcpiDbCheckIntegrity (
AcpiDbDisplayHandlers (
void);
void
@@ -265,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
*/
@@ -327,6 +349,7 @@ void
AcpiDbExecute (
char *Name,
char **Args,
ACPI_OBJECT_TYPE *Types,
UINT32 Flags);
void
@@ -407,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 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,15 +125,31 @@
#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
{
UINT8 Opcode;
UINT8 Offset;
char *Name;
UINT8 Flags;
} ACPI_DMTABLE_INFO;
#define DT_LENGTH 0x01 /* Field is a subtable length */
#define DT_FLAG 0x02 /* Field is a flag value */
#define DT_NON_ZERO 0x04 /* Field must be non-zero */
/* TBD: Not used at this time */
#define DT_OPTIONAL 0x08
#define DT_COUNT 0x10
/*
* Values for Opcode above.
* Note: 0-7 must not change, used as a flag shift value
@@ -173,17 +189,36 @@ typedef const struct acpi_dmtable_info
#define ACPI_DMT_FADTPM 32
#define ACPI_DMT_BUF16 33
#define ACPI_DMT_IVRS 34
#define ACPI_DMT_BUFFER 35
#define ACPI_DMT_PCI_PATH 36
#define ACPI_DMT_EINJACT 37
#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) (
ACPI_TABLE_HEADER *Table);
typedef
ACPI_STATUS (*ACPI_CMTABLE_HANDLER) (
void **PFieldList);
typedef struct acpi_dmtable_data
{
char *Signature;
ACPI_DMTABLE_INFO *TableInfo;
ACPI_DMTABLE_HANDLER TableHandler;
ACPI_CMTABLE_HANDLER CmTableHandler;
const unsigned char *Template;
char *Name;
} ACPI_DMTABLE_DATA;
@@ -200,11 +235,18 @@ typedef struct acpi_op_walk_info
} ACPI_OP_WALK_INFO;
/*
* TBD - another copy of this is in asltypes.h, fix
*/
#ifndef ASL_WALK_CALLBACK_DEFINED
typedef
ACPI_STATUS (*ASL_WALK_CALLBACK) (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context);
#define ASL_WALK_CALLBACK_DEFINED
#endif
typedef struct acpi_resource_tag
{
@@ -246,6 +288,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoEcdt[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoEinj[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoEinj0[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoErst[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoErst0[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoFacs[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt1[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt2[];
@@ -286,12 +329,15 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt10[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadtHdr[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg0[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoMchi[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoMsct[];
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[];
@@ -305,12 +351,27 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoUefi[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoWaet[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoWdat[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoWdat0[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoWddt[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoWdrt[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoGeneric[][2];
/*
* dmtable
*/
extern ACPI_DMTABLE_DATA AcpiDmTableData[];
UINT8
AcpiDmGenerateChecksum (
void *Table,
UINT32 Length,
UINT8 OriginalChecksum);
ACPI_DMTABLE_DATA *
AcpiDmGetTableData (
char *Signature);
void
AcpiDmDumpDataTable (
ACPI_TABLE_HEADER *Table);
@@ -392,6 +453,10 @@ void
AcpiDmDumpRsdt (
ACPI_TABLE_HEADER *Table);
void
AcpiDmDumpSlic (
ACPI_TABLE_HEADER *Table);
void
AcpiDmDumpSlit (
ACPI_TABLE_HEADER *Table);
@@ -538,6 +603,15 @@ AcpiDmIsStringBuffer (
/*
* dmextern
*/
ACPI_STATUS
AcpiDmAddToExternalFileList (
char *PathList);
void
AcpiDmClearExternalFileList (
void);
void
AcpiDmAddToExternalList (
ACPI_PARSE_OBJECT *Op,
@@ -754,4 +828,13 @@ AcpiDmCheckResourceReference (
ACPI_PARSE_OBJECT *Op,
ACPI_WALK_STATE *WalkState);
/*
* acdisasm
*/
void
AdDisassemblerHeader (
char *Filename);
#endif /* __ACDISASM_H__ */
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, 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 - 2009, 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,18 +140,6 @@ BOOLEAN
AcpiEvIsNotifyObject (
ACPI_NAMESPACE_NODE *Node);
ACPI_STATUS
AcpiEvAcquireGlobalLock(
UINT16 Timeout);
ACPI_STATUS
AcpiEvReleaseGlobalLock(
void);
ACPI_STATUS
AcpiEvInitGlobalLockHandler (
void);
UINT32
AcpiEvGetGpeNumberIndex (
UINT32 GpeNumber);
@@ -167,20 +151,46 @@ AcpiEvQueueNotifyRequest (
/*
* evgpe - GPE handling and dispatch
* evglock - Global Lock support
*/
ACPI_STATUS
AcpiEvUpdateGpeEnableMasks (
ACPI_GPE_EVENT_INFO *GpeEventInfo,
UINT8 Type);
AcpiEvInitGlobalLockHandler (
void);
ACPI_STATUS
AcpiEvAcquireGlobalLock(
UINT16 Timeout);
ACPI_STATUS
AcpiEvReleaseGlobalLock(
void);
ACPI_STATUS
AcpiEvRemoveGlobalLockHandler (
void);
/*
* evgpe - Low-level GPE support
*/
UINT32
AcpiEvGpeDetect (
ACPI_GPE_XRUPT_INFO *GpeXruptList);
ACPI_STATUS
AcpiEvUpdateGpeEnableMask (
ACPI_GPE_EVENT_INFO *GpeEventInfo);
ACPI_STATUS
AcpiEvEnableGpe (
ACPI_GPE_EVENT_INFO *GpeEventInfo,
BOOLEAN WriteToHardware);
ACPI_GPE_EVENT_INFO *GpeEventInfo);
ACPI_STATUS
AcpiEvDisableGpe (
AcpiEvAddGpeReference (
ACPI_GPE_EVENT_INFO *GpeEventInfo);
ACPI_STATUS
AcpiEvRemoveGpeReference (
ACPI_GPE_EVENT_INFO *GpeEventInfo);
ACPI_GPE_EVENT_INFO *
@@ -188,25 +198,19 @@ AcpiEvGetGpeEventInfo (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber);
ACPI_GPE_EVENT_INFO *
AcpiEvLowGetGpeInfo (
UINT32 GpeNumber,
ACPI_GPE_BLOCK_INFO *GpeBlock);
/*
* evgpeblk
*/
BOOLEAN
AcpiEvValidGpeEvent (
ACPI_STATUS
AcpiEvFinishGpe (
ACPI_GPE_EVENT_INFO *GpeEventInfo);
ACPI_STATUS
AcpiEvWalkGpeList (
ACPI_GPE_CALLBACK GpeWalkCallback,
void *Context);
ACPI_STATUS
AcpiEvDeleteGpeHandlers (
ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
ACPI_GPE_BLOCK_INFO *GpeBlock,
void *Context);
/*
* evgpeblk - Upper-level GPE block support
*/
ACPI_STATUS
AcpiEvCreateGpeBlock (
ACPI_NAMESPACE_NODE *GpeDevice,
@@ -218,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 (
@@ -227,26 +232,60 @@ AcpiEvDeleteGpeBlock (
UINT32
AcpiEvGpeDispatch (
ACPI_NAMESPACE_NODE *GpeDevice,
ACPI_GPE_EVENT_INFO *GpeEventInfo,
UINT32 GpeNumber);
UINT32
AcpiEvGpeDetect (
ACPI_GPE_XRUPT_INFO *GpeXruptList);
ACPI_STATUS
AcpiEvSetGpeType (
ACPI_GPE_EVENT_INFO *GpeEventInfo,
UINT8 Type);
ACPI_STATUS
AcpiEvCheckForWakeOnlyGpe (
ACPI_GPE_EVENT_INFO *GpeEventInfo);
/*
* evgpeinit - GPE initialization and update
*/
ACPI_STATUS
AcpiEvGpeInitialize (
void);
void
AcpiEvUpdateGpes (
ACPI_OWNER_ID TableOwnerId);
ACPI_STATUS
AcpiEvMatchGpeMethod (
ACPI_HANDLE ObjHandle,
UINT32 Level,
void *Context,
void **ReturnValue);
/*
* evgpeutil - GPE utilities
*/
ACPI_STATUS
AcpiEvWalkGpeList (
ACPI_GPE_CALLBACK GpeWalkCallback,
void *Context);
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);
ACPI_STATUS
AcpiEvDeleteGpeXrupt (
ACPI_GPE_XRUPT_INFO *GpeXrupt);
ACPI_STATUS
AcpiEvDeleteGpeHandlers (
ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
ACPI_GPE_BLOCK_INFO *GpeBlock,
void *Context);
/*
* evregion - Address Space handling
@@ -265,7 +304,7 @@ AcpiEvAddressSpaceDispatch (
UINT32 Function,
UINT32 RegionOffset,
UINT32 BitWidth,
ACPI_INTEGER *Value);
UINT64 *Value);
ACPI_STATUS
AcpiEvAttachRegion (
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -162,7 +162,7 @@
#define AE_NO_GLOBAL_LOCK (ACPI_STATUS) (0x0017 | AE_CODE_ENVIRONMENTAL)
#define AE_ABORT_METHOD (ACPI_STATUS) (0x0018 | AE_CODE_ENVIRONMENTAL)
#define AE_SAME_HANDLER (ACPI_STATUS) (0x0019 | AE_CODE_ENVIRONMENTAL)
#define AE_WAKE_ONLY_GPE (ACPI_STATUS) (0x001A | AE_CODE_ENVIRONMENTAL)
#define AE_NO_HANDLER (ACPI_STATUS) (0x001A | AE_CODE_ENVIRONMENTAL)
#define AE_OWNER_ID_LIMIT (ACPI_STATUS) (0x001B | AE_CODE_ENVIRONMENTAL)
#define AE_CODE_ENV_MAX 0x001B
@@ -293,7 +293,7 @@ char const *AcpiGbl_ExceptionNames_Env[] =
"AE_NO_GLOBAL_LOCK",
"AE_ABORT_METHOD",
"AE_SAME_HANDLER",
"AE_WAKE_ONLY_GPE",
"AE_NO_HANDLER",
"AE_OWNER_ID_LIMIT"
};
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -173,19 +173,39 @@ 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.
*/
UINT8 ACPI_INIT_GLOBAL (AcpiGbl_UseDefaultRegisterWidths, TRUE);
/*
* Optionally enable output from the AML Debug Object.
*/
UINT8 ACPI_INIT_GLOBAL (AcpiGbl_EnableAmlDebugObject, FALSE);
/*
* Optionally copy the entire DSDT to local memory (instead of simply
* mapping it.) There are some BIOSs that corrupt or replace the original
* DSDT, creating the need for this option. Default is FALSE, do not copy
* the DSDT.
*/
UINT8 ACPI_INIT_GLOBAL (AcpiGbl_CopyDsdtLocally, FALSE);
/*
* Optionally truncate I/O addresses to 16 bits. Provides compatibility
* with other ACPI implementations. NOTE: During ACPICA initialization,
* this value is set to TRUE if any Windows OSI strings have been
* requested by the BIOS.
*/
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. */
@@ -193,6 +213,7 @@ ACPI_TABLE_FADT AcpiGbl_FADT;
UINT32 AcpiCurrentGpeCount;
UINT32 AcpiGbl_TraceFlags;
ACPI_NAME AcpiGbl_TraceMethodName;
BOOLEAN AcpiGbl_SystemAwakeAndRunning;
#endif
@@ -203,11 +224,10 @@ ACPI_NAME AcpiGbl_TraceMethodName;
****************************************************************************/
/*
* AcpiGbl_RootTableList is the master list of ACPI tables found in the
* RSDT/XSDT.
*
* AcpiGbl_RootTableList is the master list of ACPI tables that were
* found in the RSDT/XSDT.
*/
ACPI_EXTERN ACPI_INTERNAL_RSDT AcpiGbl_RootTableList;
ACPI_EXTERN ACPI_TABLE_LIST AcpiGbl_RootTableList;
ACPI_EXTERN ACPI_TABLE_FACS *AcpiGbl_FACS;
/* These addresses are calculated from the FADT Event Block addresses */
@@ -218,6 +238,11 @@ ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1aEnable;
ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1bStatus;
ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1bEnable;
/* DSDT information. Used to check for DSDT corruption */
ACPI_EXTERN ACPI_TABLE_HEADER *AcpiGbl_DSDT;
ACPI_EXTERN ACPI_TABLE_HEADER AcpiGbl_OriginalDsdtHeader;
/*
* Handle both ACPI 1.0 and ACPI 2.0 Integer widths. The integer width is
* determined by the revision of the DSDT: If the DSDT revision is less than
@@ -243,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
@@ -258,6 +286,10 @@ ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockPresent;
ACPI_EXTERN ACPI_SPINLOCK AcpiGbl_GpeLock; /* For GPE data structs and registers */
ACPI_EXTERN ACPI_SPINLOCK AcpiGbl_HardwareLock; /* For ACPI H/W except GPE registers */
/* Mutex for _OSI support */
ACPI_EXTERN ACPI_MUTEX AcpiGbl_OsiMutex;
/* Reader/Writer lock is used for namespace walk and dynamic table unload */
ACPI_EXTERN ACPI_RW_LOCK AcpiGbl_NamespaceRwLock;
@@ -286,7 +318,7 @@ ACPI_EXTERN ACPI_INIT_HANDLER AcpiGbl_InitHandler;
ACPI_EXTERN ACPI_TABLE_HANDLER AcpiGbl_TableHandler;
ACPI_EXTERN void *AcpiGbl_TableHandlerContext;
ACPI_EXTERN ACPI_WALK_STATE *AcpiGbl_BreakpointWalk;
ACPI_EXTERN ACPI_INTERFACE_HANDLER AcpiGbl_InterfaceHandler;
/* Owner ID support */
@@ -294,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;
@@ -305,8 +341,8 @@ ACPI_EXTERN UINT8 AcpiGbl_DebuggerConfiguration;
ACPI_EXTERN BOOLEAN AcpiGbl_StepToNextCall;
ACPI_EXTERN BOOLEAN AcpiGbl_AcpiHardwarePresent;
ACPI_EXTERN BOOLEAN AcpiGbl_EventsInitialized;
ACPI_EXTERN BOOLEAN AcpiGbl_SystemAwakeAndRunning;
ACPI_EXTERN UINT8 AcpiGbl_OsiData;
ACPI_EXTERN ACPI_INTERFACE_INFO *AcpiGbl_SupportedInterfaces;
#ifndef DEFINE_ACPI_GLOBALS
@@ -338,6 +374,7 @@ extern const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_
ACPI_EXTERN ACPI_MEMORY_LIST *AcpiGbl_GlobalList;
ACPI_EXTERN ACPI_MEMORY_LIST *AcpiGbl_NsNodeList;
ACPI_EXTERN BOOLEAN AcpiGbl_DisplayFinalMemStats;
ACPI_EXTERN BOOLEAN AcpiGbl_DisableMemTracking;
#endif
@@ -403,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];
/*****************************************************************************
@@ -447,6 +487,7 @@ ACPI_EXTERN UINT8 AcpiGbl_DbOutputFlags;
ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_disasm;
ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_verbose;
ACPI_EXTERN ACPI_EXTERNAL_LIST *AcpiGbl_ExternalList;
ACPI_EXTERN ACPI_EXTERNAL_FILE *AcpiGbl_ExternalFileList;
#endif
@@ -462,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 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -200,13 +200,15 @@ AcpiHwWritePort (
/*
* hwgpe - GPE support
*/
ACPI_STATUS
AcpiHwLowDisableGpe (
ACPI_GPE_EVENT_INFO *GpeEventInfo);
UINT32
AcpiHwGetGpeRegisterBit (
ACPI_GPE_EVENT_INFO *GpeEventInfo,
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo);
ACPI_STATUS
AcpiHwWriteGpeEnableReg (
ACPI_GPE_EVENT_INFO *GpeEventInfo);
AcpiHwLowSetGpe (
ACPI_GPE_EVENT_INFO *GpeEventInfo,
UINT32 Action);
ACPI_STATUS
AcpiHwDisableGpeBlock (
@@ -248,6 +250,16 @@ AcpiHwEnableRuntimeGpeBlock (
void *Context);
/*
* hwpci - PCI configuration support
*/
ACPI_STATUS
AcpiHwDerivePciId (
ACPI_PCI_ID *PciId,
ACPI_HANDLE RootPciDevice,
ACPI_HANDLE PciRegion);
/*
* hwtimer - ACPI Timer prototypes
*/
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -202,6 +202,16 @@ AcpiExConvertToTargetType (
ACPI_WALK_STATE *WalkState);
/*
* exdebug - AML debug object
*/
void
AcpiExDoDebugObject (
ACPI_OPERAND_OBJECT *SourceDesc,
UINT32 Level,
UINT32 Index);
/*
* exfield - ACPI AML (p-code) execution - field manipulation
*/
@@ -214,13 +224,13 @@ AcpiExCommonBufferSetup (
ACPI_STATUS
AcpiExWriteWithUpdateRule (
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_INTEGER Mask,
ACPI_INTEGER FieldValue,
UINT64 Mask,
UINT64 FieldValue,
UINT32 FieldDatumByteOffset);
void
AcpiExGetBufferDatum(
ACPI_INTEGER *Datum,
UINT64 *Datum,
void *Buffer,
UINT32 BufferLength,
UINT32 ByteGranularity,
@@ -228,7 +238,7 @@ AcpiExGetBufferDatum(
void
AcpiExSetBufferDatum (
ACPI_INTEGER MergedDatum,
UINT64 MergedDatum,
void *Buffer,
UINT32 BufferLength,
UINT32 ByteGranularity,
@@ -266,7 +276,7 @@ ACPI_STATUS
AcpiExAccessRegion (
ACPI_OPERAND_OBJECT *ObjDesc,
UINT32 FieldDatumByteOffset,
ACPI_INTEGER *Value,
UINT64 *Value,
UINT32 ReadWrite);
@@ -296,8 +306,8 @@ AcpiExDoConcatenate (
ACPI_STATUS
AcpiExDoLogicalNumericOp (
UINT16 Opcode,
ACPI_INTEGER Integer0,
ACPI_INTEGER Integer1,
UINT64 Integer0,
UINT64 Integer1,
BOOLEAN *LogicalResult);
ACPI_STATUS
@@ -307,11 +317,11 @@ AcpiExDoLogicalOp (
ACPI_OPERAND_OBJECT *Operand1,
BOOLEAN *LogicalResult);
ACPI_INTEGER
UINT64
AcpiExDoMathOp (
UINT16 Opcode,
ACPI_INTEGER Operand0,
ACPI_INTEGER Operand1);
UINT64 Operand0,
UINT64 Operand1);
ACPI_STATUS
AcpiExCreateMutex (
@@ -424,8 +434,8 @@ AcpiExSystemDoNotifyOp (
ACPI_OPERAND_OBJECT *ObjDesc);
ACPI_STATUS
AcpiExSystemDoSuspend(
ACPI_INTEGER Time);
AcpiExSystemDoSleep(
UINT64 Time);
ACPI_STATUS
AcpiExSystemDoStall (
@@ -697,12 +707,12 @@ AcpiExReleaseGlobalLock (
void
AcpiExEisaIdToString (
char *Dest,
ACPI_INTEGER CompressedId);
UINT64 CompressedId);
void
AcpiExIntegerToString (
char *Dest,
ACPI_INTEGER Value);
UINT64 Value);
/*
@@ -713,7 +723,7 @@ AcpiExSystemMemorySpaceHandler (
UINT32 Function,
ACPI_PHYSICAL_ADDRESS Address,
UINT32 BitWidth,
ACPI_INTEGER *Value,
UINT64 *Value,
void *HandlerContext,
void *RegionContext);
@@ -722,7 +732,7 @@ AcpiExSystemIoSpaceHandler (
UINT32 Function,
ACPI_PHYSICAL_ADDRESS Address,
UINT32 BitWidth,
ACPI_INTEGER *Value,
UINT64 *Value,
void *HandlerContext,
void *RegionContext);
@@ -731,7 +741,7 @@ AcpiExPciConfigSpaceHandler (
UINT32 Function,
ACPI_PHYSICAL_ADDRESS Address,
UINT32 BitWidth,
ACPI_INTEGER *Value,
UINT64 *Value,
void *HandlerContext,
void *RegionContext);
@@ -740,7 +750,7 @@ AcpiExCmosSpaceHandler (
UINT32 Function,
ACPI_PHYSICAL_ADDRESS Address,
UINT32 BitWidth,
ACPI_INTEGER *Value,
UINT64 *Value,
void *HandlerContext,
void *RegionContext);
@@ -749,7 +759,7 @@ AcpiExPciBarSpaceHandler (
UINT32 Function,
ACPI_PHYSICAL_ADDRESS Address,
UINT32 BitWidth,
ACPI_INTEGER *Value,
UINT64 *Value,
void *HandlerContext,
void *RegionContext);
@@ -758,7 +768,7 @@ AcpiExEmbeddedControllerSpaceHandler (
UINT32 Function,
ACPI_PHYSICAL_ADDRESS Address,
UINT32 BitWidth,
ACPI_INTEGER *Value,
UINT64 *Value,
void *HandlerContext,
void *RegionContext);
@@ -767,7 +777,7 @@ AcpiExSmBusSpaceHandler (
UINT32 Function,
ACPI_PHYSICAL_ADDRESS Address,
UINT32 BitWidth,
ACPI_INTEGER *Value,
UINT64 *Value,
void *HandlerContext,
void *RegionContext);
@@ -777,7 +787,7 @@ AcpiExDataTableSpaceHandler (
UINT32 Function,
ACPI_PHYSICAL_ADDRESS Address,
UINT32 BitWidth,
ACPI_INTEGER *Value,
UINT64 *Value,
void *HandlerContext,
void *RegionContext);
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, 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 */
@@ -275,8 +256,9 @@ typedef struct acpi_namespace_node
UINT8 Flags; /* Miscellaneous flags */
ACPI_OWNER_ID OwnerId; /* Node creator */
ACPI_NAME_UNION Name; /* ACPI Name, always 4 chars per ACPI spec */
struct acpi_namespace_node *Parent; /* Parent node */
struct acpi_namespace_node *Child; /* First child */
struct acpi_namespace_node *Peer; /* Peer. Parent if ANOBJ_END_OF_PEER_LIST set */
struct acpi_namespace_node *Peer; /* First peer */
/*
* The following fields are used by the ASL compiler and disassembler only
@@ -292,7 +274,7 @@ typedef struct acpi_namespace_node
/* Namespace Node flags */
#define ANOBJ_END_OF_PEER_LIST 0x01 /* End-of-list, Peer field points to parent */
#define ANOBJ_RESERVED 0x01 /* Available for use */
#define ANOBJ_TEMPORARY 0x02 /* Node is create by a method and is temporary */
#define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */
#define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */
@@ -303,20 +285,19 @@ typedef struct acpi_namespace_node
#define ANOBJ_IS_EXTERNAL 0x08 /* iASL only: This object created via External() */
#define ANOBJ_METHOD_NO_RETVAL 0x10 /* iASL only: Method has no return value */
#define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* iASL only: Method has at least one return value */
#define ANOBJ_IS_BIT_OFFSET 0x40 /* iASL only: Reference is a bit offset */
#define ANOBJ_IS_REFERENCED 0x80 /* iASL only: Object was referenced */
/* One internal RSDT for table management */
/* Internal ACPI table management - master table list */
typedef struct acpi_internal_rsdt
typedef struct acpi_table_list
{
ACPI_TABLE_DESC *Tables;
UINT32 Count;
UINT32 Size;
ACPI_TABLE_DESC *Tables; /* Table descriptor array */
UINT32 CurrentTableCount; /* Tables currently in the array */
UINT32 MaxTableCount; /* Max tables array will hold */
UINT8 Flags;
} ACPI_INTERNAL_RSDT;
} ACPI_TABLE_LIST;
/* Flags for above */
@@ -500,6 +481,8 @@ 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;
@@ -535,18 +518,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;
@@ -560,6 +550,7 @@ typedef struct acpi_gpe_event_info
struct acpi_gpe_register_info *RegisterInfo; /* Backpointer to register info */
UINT8 Flags; /* Misc info about this GPE */
UINT8 GpeNumber; /* This GPE */
UINT8 RuntimeCount; /* References to a run GPE */
} ACPI_GPE_EVENT_INFO;
@@ -589,7 +580,9 @@ typedef struct acpi_gpe_block_info
ACPI_GPE_EVENT_INFO *EventInfo; /* One for each GPE */
ACPI_GENERIC_ADDRESS BlockAddress; /* Base address of the block */
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;
@@ -608,6 +601,9 @@ typedef struct acpi_gpe_walk_info
{
ACPI_NAMESPACE_NODE *GpeDevice;
ACPI_GPE_BLOCK_INFO *GpeBlock;
UINT16 Count;
ACPI_OWNER_ID OwnerId;
BOOLEAN ExecuteByOwnerId;
} ACPI_GPE_WALK_INFO;
@@ -850,15 +846,26 @@ typedef struct acpi_opcode_info
} ACPI_OPCODE_INFO;
/* Structure for Resource Tag information */
typedef struct acpi_tag_info
{
UINT32 BitOffset;
UINT32 BitLength;
} ACPI_TAG_INFO;
/* Value associated with the parse object */
typedef union acpi_parse_value
{
ACPI_INTEGER Integer; /* Integer constant (Up to 64 bits) */
UINT64_STRUCT Integer64; /* Structure overlay for 2 32-bit Dwords */
UINT64 Integer; /* Integer constant (Up to 64 bits) */
UINT32 Size; /* bytelist or field size */
char *String; /* NULL terminated string */
UINT8 *Buffer; /* buffer or string */
char *Name; /* NULL terminated string */
union acpi_parse_object *Arg; /* arguments and contained ops */
ACPI_TAG_INFO Tag; /* Resource descriptor tag info */
} ACPI_PARSE_VALUE;
@@ -1073,6 +1080,7 @@ typedef struct acpi_bit_register_info
ACPI_BITMASK_POWER_BUTTON_STATUS | \
ACPI_BITMASK_SLEEP_BUTTON_STATUS | \
ACPI_BITMASK_RT_CLOCK_STATUS | \
ACPI_BITMASK_PCIEXP_WAKE_STATUS | \
ACPI_BITMASK_WAKE_STATUS)
#define ACPI_BITMASK_TIMER_ENABLE 0x0001
@@ -1129,17 +1137,23 @@ typedef struct acpi_bit_register_info
#define ACPI_OSI_WIN_VISTA 0x07
#define ACPI_OSI_WINSRV_2008 0x08
#define ACPI_OSI_WIN_VISTA_SP1 0x09
#define ACPI_OSI_WIN_7 0x0A
#define ACPI_OSI_WIN_VISTA_SP2 0x0A
#define ACPI_OSI_WIN_7 0x0B
#define ACPI_ALWAYS_ILLEGAL 0x00
typedef struct acpi_interface_info
{
char *Name;
UINT8 Value;
char *Name;
struct acpi_interface_info *Next;
UINT8 Flags;
UINT8 Value;
} ACPI_INTERFACE_INFO;
#define ACPI_OSI_INVALID 0x01
#define ACPI_OSI_DYNAMIC 0x02
typedef struct acpi_port_info
{
char *Name;
@@ -1239,6 +1253,14 @@ typedef struct acpi_external_list
#define ACPI_IPATH_ALLOCATED 0x01
typedef struct acpi_external_file
{
char *Path;
struct acpi_external_file *Next;
} ACPI_EXTERNAL_FILE;
/*****************************************************************************
*
* Debugger
@@ -1250,7 +1272,7 @@ typedef struct acpi_db_method_info
ACPI_HANDLE MainThreadGate;
ACPI_HANDLE ThreadCompleteGate;
ACPI_HANDLE InfoGate;
UINT32 *Threads;
ACPI_THREAD_ID *Threads;
UINT32 NumThreads;
UINT32 NumCreated;
UINT32 NumCompleted;
@@ -1260,6 +1282,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
@@ -1268,6 +1291,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 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -335,8 +335,8 @@
* MASK_BITS_ABOVE creates a mask starting AT the position and above
* MASK_BITS_BELOW creates a mask starting one bit BELOW the position
*/
#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((UINT32) (position))))
#define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((UINT32) (position)))
#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_UINT64_MAX) << ((UINT32) (position))))
#define ACPI_MASK_BITS_BELOW(position) ((ACPI_UINT64_MAX) << ((UINT32) (position)))
/* Bitfields within ACPI registers */
@@ -400,8 +400,8 @@
* the plist contains a set of parens to allow variable-length lists.
* These macros are used for both the debug and non-debug versions of the code.
*/
#define ACPI_ERROR_NAMESPACE(s, e) AcpiNsReportError (AE_INFO, s, e);
#define ACPI_ERROR_METHOD(s, n, p, e) AcpiNsReportMethodError (AE_INFO, s, n, p, e);
#define ACPI_ERROR_NAMESPACE(s, e) AcpiUtNamespaceError (AE_INFO, s, e);
#define ACPI_ERROR_METHOD(s, n, p, e) AcpiUtMethodError (AE_INFO, s, n, p, e);
#define ACPI_WARN_PREDEFINED(plist) AcpiUtPredefinedWarning plist
#define ACPI_INFO_PREDEFINED(plist) AcpiUtPredefinedInfo plist
@@ -473,16 +473,16 @@
AcpiUtPtrExit (ACPI_DEBUG_PARAMETERS, (UINT8 *) _s); \
return (_s); })
#define return_VALUE(s) ACPI_DO_WHILE0 ({ \
register ACPI_INTEGER _s = (s); \
register UINT64 _s = (s); \
AcpiUtValueExit (ACPI_DEBUG_PARAMETERS, _s); \
return (_s); })
#define return_UINT8(s) ACPI_DO_WHILE0 ({ \
register UINT8 _s = (UINT8) (s); \
AcpiUtValueExit (ACPI_DEBUG_PARAMETERS, (ACPI_INTEGER) _s); \
AcpiUtValueExit (ACPI_DEBUG_PARAMETERS, (UINT64) _s); \
return (_s); })
#define return_UINT32(s) ACPI_DO_WHILE0 ({ \
register UINT32 _s = (UINT32) (s); \
AcpiUtValueExit (ACPI_DEBUG_PARAMETERS, (ACPI_INTEGER) _s); \
AcpiUtValueExit (ACPI_DEBUG_PARAMETERS, (UINT64) _s); \
return (_s); })
#else /* Use original less-safe macros */
@@ -493,7 +493,7 @@
AcpiUtPtrExit (ACPI_DEBUG_PARAMETERS, (UINT8 *) (s)); \
return((s)); })
#define return_VALUE(s) ACPI_DO_WHILE0 ({ \
AcpiUtValueExit (ACPI_DEBUG_PARAMETERS, (ACPI_INTEGER) (s)); \
AcpiUtValueExit (ACPI_DEBUG_PARAMETERS, (UINT64) (s)); \
return((s)); })
#define return_UINT8(s) return_VALUE(s)
#define return_UINT32(s) return_VALUE(s)
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, 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 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -444,6 +444,19 @@ AcpiNsRepairPackageList (
ACPI_PREDEFINED_DATA *Data,
ACPI_OPERAND_OBJECT **ObjDescPtr);
ACPI_STATUS
AcpiNsRepairNullElement (
ACPI_PREDEFINED_DATA *Data,
UINT32 ExpectedBtypes,
UINT32 PackageIndex,
ACPI_OPERAND_OBJECT **ReturnObjectPtr);
void
AcpiNsRemoveNullElements (
ACPI_PREDEFINED_DATA *Data,
UINT8 PackageType,
ACPI_OPERAND_OBJECT *ObjDesc);
/*
* nsrepair2 - Return object repair for specific
@@ -456,11 +469,6 @@ AcpiNsComplexRepairs (
ACPI_STATUS ValidateStatus,
ACPI_OPERAND_OBJECT **ReturnObjectPtr);
void
AcpiNsRemoveNullElements (
ACPI_PREDEFINED_DATA *Data,
UINT8 PackageType,
ACPI_OPERAND_OBJECT *ObjDesc);
/*
* nssearch - Namespace searching and entry
@@ -505,22 +513,6 @@ UINT32
AcpiNsLocal (
ACPI_OBJECT_TYPE Type);
void
AcpiNsReportError (
const char *ModuleName,
UINT32 LineNumber,
const char *InternalName,
ACPI_STATUS LookupStatus);
void
AcpiNsReportMethodError (
const char *ModuleName,
UINT32 LineNumber,
const char *Message,
ACPI_NAMESPACE_NODE *Node,
const char *Path,
ACPI_STATUS LookupStatus);
void
AcpiNsPrintNodePathname (
ACPI_NAMESPACE_NODE *Node,
@@ -554,13 +546,4 @@ void
AcpiNsTerminate (
void);
ACPI_NAMESPACE_NODE *
AcpiNsGetParentNode (
ACPI_NAMESPACE_NODE *Node);
ACPI_NAMESPACE_NODE *
AcpiNsGetNextValidNode (
ACPI_NAMESPACE_NODE *Node);
#endif /* __ACNAMESP_H__ */
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -164,13 +164,12 @@
/* Values for Flag byte above */
#define AOPOBJ_AML_CONSTANT 0x01
#define AOPOBJ_STATIC_POINTER 0x02
#define AOPOBJ_DATA_VALID 0x04
#define AOPOBJ_OBJECT_INITIALIZED 0x08
#define AOPOBJ_SETUP_COMPLETE 0x10
#define AOPOBJ_SINGLE_DATUM 0x20
#define AOPOBJ_MODULE_LEVEL 0x40
#define AOPOBJ_AML_CONSTANT 0x01 /* Integer is an AML constant */
#define AOPOBJ_STATIC_POINTER 0x02 /* Data is part of an ACPI table, don't delete */
#define AOPOBJ_DATA_VALID 0x04 /* Object is intialized and data is valid */
#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 */
/******************************************************************************
@@ -190,7 +189,7 @@ typedef struct acpi_object_integer
{
ACPI_OBJECT_COMMON_HEADER
UINT8 Fill[3]; /* Prevent warning on some compilers */
ACPI_INTEGER Value;
UINT64 Value;
} ACPI_OBJECT_INTEGER;
@@ -283,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;
@@ -292,7 +291,7 @@ typedef struct acpi_object_method
{
ACPI_INTERNAL_METHOD Implementation;
union acpi_operand_object *Handler;
} Extra;
} Dispatch;
UINT32 AmlLength;
UINT8 ThreadCount;
@@ -300,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 */
/******************************************************************************
*
@@ -385,7 +392,6 @@ typedef struct acpi_object_thermal_zone
UINT32 BaseByteOffset; /* Byte offset within containing object */\
UINT32 Value; /* Value to store into the Bank or Index register */\
UINT8 StartFieldBitOffset;/* Bit offset within first field datum (0-63) */\
UINT8 AccessBitWidth; /* Read/Write size in bits (8-64) */
typedef struct acpi_object_field_common /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, 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 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -143,8 +143,9 @@
#define ACPI_TOOLS 0x00002000
#define ACPI_EXAMPLE 0x00004000
#define ACPI_DRIVER 0x00008000
#define DT_COMPILER 0x00010000
#define ACPI_ALL_COMPONENTS 0x0000FFFF
#define ACPI_ALL_COMPONENTS 0x0001FFFF
#define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS)
/* Component IDs reserved for ACPI drivers */
@@ -257,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
/*
@@ -281,6 +288,7 @@
#define ACPI_WARNING(plist) AcpiWarning plist
#define ACPI_EXCEPTION(plist) AcpiException plist
#define ACPI_ERROR(plist) AcpiError plist
#define ACPI_DEBUG_OBJECT(obj,l,i) AcpiExDoDebugObject(obj,l,i)
#else
@@ -290,6 +298,7 @@
#define ACPI_WARNING(plist)
#define ACPI_EXCEPTION(plist)
#define ACPI_ERROR(plist)
#define ACPI_DEBUG_OBJECT(obj,l,i)
#endif /* ACPI_NO_ERROR_MESSAGES */
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, 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 - 2009, 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 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -346,7 +346,7 @@ AcpiOsWaitEventsComplete (
void
AcpiOsSleep (
ACPI_INTEGER Milliseconds);
UINT64 Milliseconds);
void
AcpiOsStall (
@@ -394,34 +394,20 @@ ACPI_STATUS
AcpiOsReadPciConfiguration (
ACPI_PCI_ID *PciId,
UINT32 Reg,
void *Value,
UINT64 *Value,
UINT32 Width);
ACPI_STATUS
AcpiOsWritePciConfiguration (
ACPI_PCI_ID *PciId,
UINT32 Reg,
ACPI_INTEGER Value,
UINT64 Value,
UINT32 Width);
/*
* Interim function needed for PCI IRQ routing
*/
void
AcpiOsDerivePciId(
ACPI_HANDLE Rhandle,
ACPI_HANDLE Chandle,
ACPI_PCI_ID **PciId);
/*
* Miscellaneous
*/
ACPI_STATUS
AcpiOsValidateInterface (
char *Interface);
BOOLEAN
AcpiOsReadable (
void *Pointer,
@@ -463,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 - 2009, 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 0x20091214
#define ACPI_CA_VERSION 0x20110922
#include "actypes.h"
#include "actbl.h"
@@ -130,6 +130,7 @@
*/
extern UINT32 AcpiCurrentGpeCount;
extern ACPI_TABLE_FADT AcpiGbl_FADT;
extern BOOLEAN AcpiGbl_SystemAwakeAndRunning;
/* Runtime configuration of debug print levels */
@@ -141,14 +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 (
@@ -172,10 +176,10 @@ ACPI_STATUS
AcpiTerminate (
void);
ACPI_STATUS
AcpiSubsystemStatus (
void);
/*
* Miscellaneous global interfaces
*/
ACPI_STATUS
AcpiEnable (
void);
@@ -184,6 +188,10 @@ ACPI_STATUS
AcpiDisable (
void);
ACPI_STATUS
AcpiSubsystemStatus (
void);
ACPI_STATUS
AcpiGetSystemInfo (
ACPI_BUFFER *RetBuffer);
@@ -200,9 +208,17 @@ ACPI_STATUS
AcpiPurgeCachedObjects (
void);
ACPI_STATUS
AcpiInstallInterface (
ACPI_STRING InterfaceName);
ACPI_STATUS
AcpiRemoveInterface (
ACPI_STRING InterfaceName);
/*
* ACPI Memory managment
* ACPI Memory management
*/
void *
AcpiAllocate (
@@ -281,7 +297,7 @@ AcpiGetDevices (
ACPI_STATUS
AcpiGetName (
ACPI_HANDLE Handle,
ACPI_HANDLE Object,
UINT32 NameType,
ACPI_BUFFER *RetPathPtr);
@@ -293,18 +309,18 @@ AcpiGetHandle (
ACPI_STATUS
AcpiAttachData (
ACPI_HANDLE ObjHandle,
ACPI_HANDLE Object,
ACPI_OBJECT_HANDLER Handler,
void *Data);
ACPI_STATUS
AcpiDetachData (
ACPI_HANDLE ObjHandle,
ACPI_HANDLE Object,
ACPI_OBJECT_HANDLER Handler);
ACPI_STATUS
AcpiGetData (
ACPI_HANDLE ObjHandle,
ACPI_HANDLE Object,
ACPI_OBJECT_HANDLER Handler,
void **Data);
@@ -336,7 +352,7 @@ AcpiEvaluateObjectTyped (
ACPI_STATUS
AcpiGetObjectInfo (
ACPI_HANDLE Handle,
ACPI_HANDLE Object,
ACPI_DEVICE_INFO **ReturnBuffer);
ACPI_STATUS
@@ -369,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,
@@ -380,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,
@@ -407,27 +442,17 @@ 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);
ACPI_STATUS
AcpiInstallInterfaceHandler (
ACPI_INTERFACE_HANDLER Handler);
/*
* Event interfaces
* Global Lock interfaces
*/
ACPI_STATUS
AcpiAcquireGlobalLock (
@@ -438,6 +463,10 @@ ACPI_STATUS
AcpiReleaseGlobalLock (
UINT32 Handle);
/*
* Fixed Event interfaces
*/
ACPI_STATUS
AcpiEnableEvent (
UINT32 Event,
@@ -459,37 +488,54 @@ AcpiGetEventStatus (
/*
* GPE Interfaces
* General Purpose Event (GPE) Interfaces
*/
ACPI_STATUS
AcpiSetGpeType (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
UINT8 Type);
AcpiUpdateAllGpes (
void);
ACPI_STATUS
AcpiEnableGpe (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
UINT32 Flags);
UINT32 GpeNumber);
ACPI_STATUS
AcpiDisableGpe (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
UINT32 Flags);
UINT32 GpeNumber);
ACPI_STATUS
AcpiClearGpe (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber);
ACPI_STATUS
AcpiSetGpe (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
UINT32 Flags);
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);
ACPI_STATUS
AcpiGetGpeStatus (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
UINT32 Flags,
ACPI_EVENT_STATUS *EventStatus);
ACPI_STATUS
@@ -527,36 +573,36 @@ ACPI_STATUS (*ACPI_WALK_RESOURCE_CALLBACK) (
ACPI_STATUS
AcpiGetVendorResource (
ACPI_HANDLE DeviceHandle,
ACPI_HANDLE Device,
char *Name,
ACPI_VENDOR_UUID *Uuid,
ACPI_BUFFER *RetBuffer);
ACPI_STATUS
AcpiGetCurrentResources(
ACPI_HANDLE DeviceHandle,
AcpiGetCurrentResources (
ACPI_HANDLE Device,
ACPI_BUFFER *RetBuffer);
ACPI_STATUS
AcpiGetPossibleResources(
ACPI_HANDLE DeviceHandle,
AcpiGetPossibleResources (
ACPI_HANDLE Device,
ACPI_BUFFER *RetBuffer);
ACPI_STATUS
AcpiWalkResources (
ACPI_HANDLE DeviceHandle,
ACPI_HANDLE Device,
char *Name,
ACPI_WALK_RESOURCE_CALLBACK UserFunction,
void *Context);
ACPI_STATUS
AcpiSetCurrentResources (
ACPI_HANDLE DeviceHandle,
ACPI_HANDLE Device,
ACPI_BUFFER *InBuffer);
ACPI_STATUS
AcpiGetIrqRoutingTable (
ACPI_HANDLE BusDeviceHandle,
AcpiGetIrqRoutingTable (
ACPI_HANDLE Device,
ACPI_BUFFER *RetBuffer);
ACPI_STATUS
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, 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}},
@@ -577,14 +578,15 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] =
{{"_WAK", 1, ACPI_RTYPE_NONE | ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE}},
{{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2,0}, 0,0}}, /* Fixed-length (2 Int), but is optional */
/* _WDG/_WED are MS extensions defined by "Windows Instrumentation" */
{{"_WDG", 0, ACPI_RTYPE_BUFFER}},
{{"_WED", 1, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER}},
{{{0,0,0,0}, 0,0}} /* Table terminator */
};
#if 0
/* Not implemented */
{{"_WDG", 0, ACPI_RTYPE_BUFFER}}, /* MS Extension */
{{"_WED", 1, ACPI_RTYPE_PACKAGE}}, /* MS Extension */
/* This is an internally implemented control method, no need to check */
{{"_OSI", 1, ACPI_RTYPE_INTEGER}},
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, 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 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -534,7 +534,7 @@ typedef struct acpi_pci_routing_table
{
UINT32 Length;
UINT32 Pin;
ACPI_INTEGER Address; /* here for 64-bit alignment */
UINT64 Address; /* here for 64-bit alignment */
UINT32 SourceIndex;
char Source[4]; /* pad to 64 bits so sizeof() works in all cases */
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -204,23 +204,23 @@ typedef struct acpi_walk_state
} ACPI_WALK_STATE;
/* Info used by AcpiPsInitObjects */
/* Info used by AcpiNsInitializeObjects and AcpiDsInitializeObjects */
typedef struct acpi_init_walk_info
{
UINT16 MethodCount;
UINT16 DeviceCount;
UINT16 OpRegionCount;
UINT16 FieldCount;
UINT16 BufferCount;
UINT16 PackageCount;
UINT16 OpRegionInit;
UINT16 FieldInit;
UINT16 BufferInit;
UINT16 PackageInit;
UINT16 ObjectCount;
ACPI_OWNER_ID OwnerId;
UINT32 TableIndex;
UINT32 ObjectCount;
UINT32 MethodCount;
UINT32 DeviceCount;
UINT32 OpRegionCount;
UINT32 FieldCount;
UINT32 BufferCount;
UINT32 PackageCount;
UINT32 OpRegionInit;
UINT32 FieldInit;
UINT32 BufferInit;
UINT32 PackageInit;
ACPI_OWNER_ID OwnerId;
} ACPI_INIT_WALK_INFO;
@@ -294,11 +294,11 @@ typedef struct acpi_evaluate_info
typedef struct acpi_device_walk_info
{
UINT16 DeviceCount;
UINT16 Num_STA;
UINT16 Num_INI;
ACPI_TABLE_DESC *TableDesc;
ACPI_EVALUATE_INFO *EvaluateInfo;
UINT32 DeviceCount;
UINT32 Num_STA;
UINT32 Num_INI;
} ACPI_DEVICE_WALK_INFO;
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -230,6 +230,14 @@ AcpiTbVerifyChecksum (
ACPI_TABLE_HEADER *Table,
UINT32 Length);
void
AcpiTbCheckDsdtHeader (
void);
ACPI_TABLE_HEADER *
AcpiTbCopyDsdt (
UINT32 TableIndex);
void
AcpiTbInstallTable (
ACPI_PHYSICAL_ADDRESS Address,
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -224,7 +224,28 @@ typedef struct acpi_table_rsdp
} ACPI_TABLE_RSDP;
#define ACPI_RSDP_REV0_SIZE 20 /* Size of original ACPI 1.0 RSDP */
/* Standalone struct for the ACPI 1.0 RSDP */
typedef struct acpi_rsdp_common
{
char Signature[8];
UINT8 Checksum;
char OemId[ACPI_OEM_ID_SIZE];
UINT8 Revision;
UINT32 RsdtPhysicalAddress;
} ACPI_RSDP_COMMON;
/* Standalone struct for the extended part of the RSDP (ACPI 2.0+) */
typedef struct acpi_rsdp_extension
{
UINT32 Length;
UINT64 XsdtPhysicalAddress;
UINT8 ExtendedChecksum;
UINT8 Reserved[3];
} ACPI_RSDP_EXTENSION;
/*******************************************************************************
@@ -448,4 +469,20 @@ typedef struct acpi_table_desc
#define ACPI_FADT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_FADT, f)
/*
* Sizes of the various flavors of FADT. We need to look closely
* at the FADT length because the version number essentially tells
* us nothing because of many BIOS bugs where the version does not
* match the expected length. In other words, the length of the
* FADT is the bottom line as to what the version really is.
*
* For reference, the values below are as follows:
* FADT V1 size: 0x74
* FADT V2 size: 0x84
* FADT V3+ size: 0xF4
*/
#define ACPI_FADT_V1_SIZE (UINT32) (ACPI_FADT_OFFSET (Flags) + 4)
#define ACPI_FADT_V2_SIZE (UINT32) (ACPI_FADT_OFFSET (Reserved4[0]) + 3)
#define ACPI_FADT_V3_SIZE (UINT32) (sizeof (ACPI_TABLE_FADT))
#endif /* __ACTBL_H__ */
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -1,6 +1,6 @@
/******************************************************************************
*
* Name: actbl2.h - ACPI Specification Revision 2.0 Tables
* Name: actbl2.h - ACPI Table Definitions (tables not in ACPI spec)
*
*****************************************************************************/
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -143,6 +143,7 @@
#define ACPI_SIG_IBFT "IBFT" /* iSCSI Boot Firmware Table */
#define ACPI_SIG_IVRS "IVRS" /* I/O Virtualization Reporting Structure */
#define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */
#define ACPI_SIG_MCHI "MCHI" /* Management Controller Host Interface table */
#define ACPI_SIG_SLIC "SLIC" /* Software Licensing Description Table */
#define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */
#define ACPI_SIG_SPMI "SPMI" /* Server Platform Management Interface table */
@@ -150,8 +151,17 @@
#define ACPI_SIG_UEFI "UEFI" /* Uefi Boot Optimization Table */
#define ACPI_SIG_WAET "WAET" /* Windows ACPI Emulated devices Table */
#define ACPI_SIG_WDAT "WDAT" /* Watchdog Action Table */
#define ACPI_SIG_WDDT "WDDT" /* Watchdog Timer Description Table */
#define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */
#ifdef ACPI_UNDEFINED_TABLES
/*
* These tables have been seen in the field, but no definition has been found
*/
#define ACPI_SIG_ATKG "ATKG"
#define ACPI_SIG_GSCI "GSCI" /* GMCH SCI table */
#define ACPI_SIG_IEIT "IEIT"
#endif
/*
* All tables must be byte-packed to match the ACPI specification, since
@@ -862,6 +872,110 @@ typedef struct acpi_mcfg_allocation
} ACPI_MCFG_ALLOCATION;
/*******************************************************************************
*
* MCHI - Management Controller Host Interface Table
* Version 1
*
* Conforms to "Management Component Transport Protocol (MCTP) Host
* Interface Specification", Revision 1.0.0a, October 13, 2009
*
******************************************************************************/
typedef struct acpi_table_mchi
{
ACPI_TABLE_HEADER Header; /* Common ACPI table header */
UINT8 InterfaceType;
UINT8 Protocol;
UINT64 ProtocolData;
UINT8 InterruptType;
UINT8 Gpe;
UINT8 PciDeviceFlag;
UINT32 GlobalInterrupt;
ACPI_GENERIC_ADDRESS ControlRegister;
UINT8 PciSegment;
UINT8 PciBus;
UINT8 PciDevice;
UINT8 PciFunction;
} ACPI_TABLE_MCHI;
/*******************************************************************************
*
* SLIC - Software Licensing Description Table
* Version 1
*
* Conforms to "OEM Activation 2.0 for Windows Vista Operating Systems",
* Copyright 2006
*
******************************************************************************/
/* Basic SLIC table is only the common ACPI header */
typedef struct acpi_table_slic
{
ACPI_TABLE_HEADER Header; /* Common ACPI table header */
} ACPI_TABLE_SLIC;
/* Common SLIC subtable header */
typedef struct acpi_slic_header
{
UINT32 Type;
UINT32 Length;
} ACPI_SLIC_HEADER;
/* Values for Type field above */
enum AcpiSlicType
{
ACPI_SLIC_TYPE_PUBLIC_KEY = 0,
ACPI_SLIC_TYPE_WINDOWS_MARKER = 1,
ACPI_SLIC_TYPE_RESERVED = 2 /* 2 and greater are reserved */
};
/*
* SLIC Sub-tables, correspond to Type in ACPI_SLIC_HEADER
*/
/* 0: Public Key Structure */
typedef struct acpi_slic_key
{
ACPI_SLIC_HEADER Header;
UINT8 KeyType;
UINT8 Version;
UINT16 Reserved;
UINT32 Algorithm;
char Magic[4];
UINT32 BitLength;
UINT32 Exponent;
UINT8 Modulus[128];
} ACPI_SLIC_KEY;
/* 1: Windows Marker Structure */
typedef struct acpi_slic_marker
{
ACPI_SLIC_HEADER Header;
UINT32 Version;
char OemId[ACPI_OEM_ID_SIZE]; /* ASCII OEM identification */
char OemTableId[ACPI_OEM_TABLE_ID_SIZE]; /* ASCII OEM table identification */
char WindowsFlag[8];
UINT32 SlicVersion;
UINT8 Reserved[16];
UINT8 Signature[128];
} ACPI_SLIC_MARKER;
/*******************************************************************************
*
* SPCR - Serial Port Console Redirection table
@@ -1089,6 +1203,47 @@ enum AcpiWdatInstructions
};
/*******************************************************************************
*
* WDDT - Watchdog Descriptor Table
* Version 1
*
* Conforms to "Using the Intel ICH Family Watchdog Timer (WDT)",
* Version 001, September 2002
*
******************************************************************************/
typedef struct acpi_table_wddt
{
ACPI_TABLE_HEADER Header; /* Common ACPI table header */
UINT16 SpecVersion;
UINT16 TableVersion;
UINT16 PciVendorId;
ACPI_GENERIC_ADDRESS Address;
UINT16 MaxCount; /* Maximum counter value supported */
UINT16 MinCount; /* Minimum counter value supported */
UINT16 Period;
UINT16 Status;
UINT16 Capability;
} ACPI_TABLE_WDDT;
/* Flags for Status field above */
#define ACPI_WDDT_AVAILABLE (1)
#define ACPI_WDDT_ACTIVE (1<<1)
#define ACPI_WDDT_TCO_OS_OWNED (1<<2)
#define ACPI_WDDT_USER_RESET (1<<11)
#define ACPI_WDDT_WDT_RESET (1<<12)
#define ACPI_WDDT_POWER_FAIL (1<<13)
#define ACPI_WDDT_UNKNOWN_RESET (1<<14)
/* Flags for Capability field above */
#define ACPI_WDDT_AUTO_RESET (1)
#define ACPI_WDDT_ALERT_SUPPORT (1<<1)
/*******************************************************************************
*
* WDRT - Watchdog Resource Table
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -188,7 +188,6 @@
*
* ACPI_SIZE 16/32/64-bit unsigned value
* ACPI_NATIVE_INT 16/32/64-bit signed value
*
*/
/*******************************************************************************
@@ -205,6 +204,16 @@
/*! [End] no source code translation !*/
/*
* Value returned by AcpiOsGetThreadId. There is no standard "thread_id"
* across operating systems or even the various UNIX systems. Since ACPICA
* only needs the thread ID as a unique thread identifier, we use a UINT64
* as the only common data type - it will accommodate any type of pointer or
* any type of integer. It is up to the host-dependent OSL to cast the
* native thread ID type to a UINT64 (in AcpiOsGetThreadId).
*/
#define ACPI_THREAD_ID UINT64
/*******************************************************************************
*
@@ -216,8 +225,8 @@
/*! [Begin] no source code translation (keep the typedefs as-is) */
typedef unsigned int UINT32;
typedef int INT32;
//typedef unsigned int UINT32;
//typedef int INT32;
/*! [End] no source code translation !*/
@@ -286,12 +295,6 @@ typedef UINT32 ACPI_PHYSICAL_ADDRESS;
*
******************************************************************************/
/* Value returned by AcpiOsGetThreadId */
#ifndef ACPI_THREAD_ID
#define ACPI_THREAD_ID ACPI_SIZE
#endif
/* Flags for AcpiOsAcquireLock/AcpiOsReleaseLock */
#ifndef ACPI_CPU_FLAGS
@@ -456,36 +459,6 @@ typedef UINT8 ACPI_OWNER_ID;
#define ACPI_OWNER_ID_MAX 0xFF
typedef struct uint64_struct
{
UINT32 Lo;
UINT32 Hi;
} UINT64_STRUCT;
typedef union uint64_overlay
{
UINT64 Full;
UINT64_STRUCT Part;
} UINT64_OVERLAY;
typedef struct uint32_struct
{
UINT32 Lo;
UINT32 Hi;
} UINT32_STRUCT;
/*
* Acpi integer width. In ACPI version 1, integers are 32 bits. In ACPI
* version 2, integers are 64 bits. Note that this pertains to the ACPI integer
* type only, not other integers used in the implementation of the ACPI CA
* subsystem.
*/
typedef UINT64 ACPI_INTEGER;
#define ACPI_INTEGER_MAX ACPI_UINT64_MAX
#define ACPI_INTEGER_BIT_SIZE 64
#define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */
#define ACPI_MAX64_DECIMAL_DIGITS 20
@@ -500,6 +473,19 @@ typedef UINT64 ACPI_INTEGER;
#define ACPI_WAIT_FOREVER 0xFFFF /* UINT16, as per ACPI spec */
#define ACPI_DO_NOT_WAIT 0
/*
* Obsolete: Acpi integer width. In ACPI version 1 (1996), integers are 32 bits.
* In ACPI version 2 (2000) and later, integers are 64 bits. Note that this
* pertains to the ACPI integer type only, not to other integers used in the
* implementation of the ACPICA subsystem.
*
* 01/2010: This type is obsolete and has been removed from the entire ACPICA
* code base. It remains here for compatibility with device drivers that use
* the type. However, it will be removed in the future.
*/
typedef UINT64 ACPI_INTEGER;
#define ACPI_INTEGER_MAX ACPI_UINT64_MAX
/*******************************************************************************
*
@@ -744,53 +730,38 @@ typedef UINT32 ACPI_EVENT_STATUS;
#define ACPI_GPE_MAX 0xFF
#define ACPI_NUM_GPE 256
/* Actions for AcpiSetGpe, AcpiGpeWakeup, AcpiHwLowSetGpe */
#define ACPI_GPE_ENABLE 0
#define ACPI_GPE_DISABLE 1
#define ACPI_GPE_CONDITIONAL_ENABLE 2
/*
* GPE info flags - Per GPE
* +-+-+-+---+---+-+
* |7|6|5|4:3|2:1|0|
* +-+-+-+---+---+-+
* | | | | | |
* | | | | | +--- Interrupt type: Edge or Level Triggered
* | | | | +--- Type: Wake-only, Runtime-only, or wake/runtime
* | | | +--- Type of dispatch -- to method, handler, or none
* | | +--- Enabled for runtime?
* | +--- Enabled for wake?
* +--- Unused
* +-------+-+-+---+
* | 7:4 |3|2|1:0|
* +-------+-+-+---+
* | | | |
* | | | +-- Type of dispatch:to method, handler, notify, or none
* | | +----- Interrupt type: edge or level triggered
* | +------- Is a Wake GPE
* +------------ <Reserved>
*/
#define ACPI_GPE_XRUPT_TYPE_MASK (UINT8) 0x01
#define ACPI_GPE_LEVEL_TRIGGERED (UINT8) 0x01
#define ACPI_GPE_DISPATCH_NONE (UINT8) 0x00
#define ACPI_GPE_DISPATCH_METHOD (UINT8) 0x01
#define ACPI_GPE_DISPATCH_HANDLER (UINT8) 0x02
#define ACPI_GPE_DISPATCH_NOTIFY (UINT8) 0x03
#define ACPI_GPE_DISPATCH_MASK (UINT8) 0x03
#define ACPI_GPE_LEVEL_TRIGGERED (UINT8) 0x04
#define ACPI_GPE_EDGE_TRIGGERED (UINT8) 0x00
#define ACPI_GPE_XRUPT_TYPE_MASK (UINT8) 0x04
#define ACPI_GPE_TYPE_MASK (UINT8) 0x06
#define ACPI_GPE_TYPE_WAKE_RUN (UINT8) 0x06
#define ACPI_GPE_TYPE_WAKE (UINT8) 0x02
#define ACPI_GPE_TYPE_RUNTIME (UINT8) 0x04 /* Default */
#define ACPI_GPE_DISPATCH_MASK (UINT8) 0x18
#define ACPI_GPE_DISPATCH_HANDLER (UINT8) 0x08
#define ACPI_GPE_DISPATCH_METHOD (UINT8) 0x10
#define ACPI_GPE_DISPATCH_NOT_USED (UINT8) 0x00 /* Default */
#define ACPI_GPE_RUN_ENABLE_MASK (UINT8) 0x20
#define ACPI_GPE_RUN_ENABLED (UINT8) 0x20
#define ACPI_GPE_RUN_DISABLED (UINT8) 0x00 /* Default */
#define ACPI_GPE_WAKE_ENABLE_MASK (UINT8) 0x40
#define ACPI_GPE_WAKE_ENABLED (UINT8) 0x40
#define ACPI_GPE_WAKE_DISABLED (UINT8) 0x00 /* Default */
#define ACPI_GPE_ENABLE_MASK (UINT8) 0x60 /* Both run/wake */
#define ACPI_GPE_CAN_WAKE (UINT8) 0x08
/*
* Flags for GPE and Lock interfaces
*/
#define ACPI_EVENT_WAKE_ENABLE 0x2 /* AcpiGpeEnable */
#define ACPI_EVENT_WAKE_DISABLE 0x2 /* AcpiGpeDisable */
#define ACPI_NOT_ISR 0x1
#define ACPI_ISR 0x0
@@ -817,9 +788,24 @@ typedef UINT8 ACPI_ADR_SPACE_TYPE;
#define ACPI_ADR_SPACE_CMOS (ACPI_ADR_SPACE_TYPE) 5
#define ACPI_ADR_SPACE_PCI_BAR_TARGET (ACPI_ADR_SPACE_TYPE) 6
#define ACPI_ADR_SPACE_IPMI (ACPI_ADR_SPACE_TYPE) 7
#define ACPI_ADR_SPACE_DATA_TABLE (ACPI_ADR_SPACE_TYPE) 8
#define ACPI_ADR_SPACE_FIXED_HARDWARE (ACPI_ADR_SPACE_TYPE) 127
#define ACPI_NUM_PREDEFINED_REGIONS 8
/*
* Special Address Spaces
*
* Note: A Data Table region is a special type of operation region
* that has its own AML opcode. However, internally, the AML
* interpreter simply creates an operation region with an an address
* space type of ACPI_ADR_SPACE_DATA_TABLE.
*/
#define ACPI_ADR_SPACE_DATA_TABLE (ACPI_ADR_SPACE_TYPE) 0x7E /* Internal to ACPICA only */
#define ACPI_ADR_SPACE_FIXED_HARDWARE (ACPI_ADR_SPACE_TYPE) 0x7F
/* Values for _REG connection code */
#define ACPI_REG_DISCONNECT 0
#define ACPI_REG_CONNECT 1
/*
* BitRegister IDs
@@ -890,7 +876,7 @@ typedef union acpi_object
struct
{
ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_INTEGER */
ACPI_INTEGER Value; /* The actual number */
UINT64 Value; /* The actual number */
} Integer;
struct
@@ -1044,10 +1030,26 @@ typedef void
/*
* Various handlers and callback procedures
*/
typedef
void (*ACPI_GBL_EVENT_HANDLER) (
UINT32 EventType,
ACPI_HANDLE Device,
UINT32 EventNumber,
void *Context);
#define ACPI_EVENT_TYPE_GPE 0
#define ACPI_EVENT_TYPE_FIXED 1
typedef
UINT32 (*ACPI_EVENT_HANDLER) (
void *Context);
typedef
UINT32 (*ACPI_GPE_HANDLER) (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
void *Context);
typedef
void (*ACPI_NOTIFY_HANDLER) (
ACPI_HANDLE Device,
@@ -1094,7 +1096,7 @@ ACPI_STATUS (*ACPI_ADR_SPACE_HANDLER) (
UINT32 Function,
ACPI_PHYSICAL_ADDRESS Address,
UINT32 BitWidth,
ACPI_INTEGER *Value,
UINT64 *Value,
void *HandlerContext,
void *RegionContext);
@@ -1112,17 +1114,27 @@ ACPI_STATUS (*ACPI_ADR_SPACE_SETUP) (
typedef
ACPI_STATUS (*ACPI_WALK_CALLBACK) (
ACPI_HANDLE ObjHandle,
ACPI_HANDLE Object,
UINT32 NestingLevel,
void *Context,
void **ReturnValue);
typedef
UINT32 (*ACPI_INTERFACE_HANDLER) (
ACPI_STRING InterfaceName,
UINT32 Supported);
/* Interrupt handler return values */
#define ACPI_INTERRUPT_NOT_HANDLED 0x00
#define ACPI_INTERRUPT_HANDLED 0x01
/* GPE handler return values */
#define ACPI_REENABLE_GPE 0x80
/* Length of 32-bit EISAID values when converted back to a string */
#define ACPI_EISAID_STRING_SIZE 8 /* Includes null terminator */
@@ -1164,7 +1176,7 @@ typedef struct acpi_device_info
UINT8 HighestDstates[4]; /* _SxD values: 0xFF indicates not valid */
UINT8 LowestDstates[5]; /* _SxW values: 0xFF indicates not valid */
UINT32 CurrentStatus; /* _STA value */
ACPI_INTEGER Address; /* _ADR value */
UINT64 Address; /* _ADR value */
ACPI_DEVICE_ID HardwareId; /* _HID value */
ACPI_DEVICE_ID UniqueId; /* _UID value */
ACPI_DEVICE_ID_LIST CompatibleIdList; /* _CID list <must be last> */
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -235,7 +235,7 @@ AcpiUtGetEventName (
char
AcpiUtHexToAsciiChar (
ACPI_INTEGER Integer,
UINT64 Integer,
UINT32 Position);
BOOLEAN
@@ -470,7 +470,7 @@ AcpiUtValueExit (
const char *FunctionName,
const char *ModuleName,
UINT32 ComponentId,
ACPI_INTEGER Value);
UINT64 Value);
void
AcpiUtPtrExit (
@@ -536,10 +536,6 @@ AcpiUtDeleteInternalObjectList (
* uteval - object evaluation
*/
ACPI_STATUS
AcpiUtOsiImplementation (
ACPI_WALK_STATE *WalkState);
ACPI_STATUS
AcpiUtEvaluateObject (
ACPI_NAMESPACE_NODE *PrefixNode,
char *Path,
@@ -550,7 +546,7 @@ ACPI_STATUS
AcpiUtEvaluateNumericObject (
char *ObjectName,
ACPI_NAMESPACE_NODE *DeviceNode,
ACPI_INTEGER *Value);
UINT64 *Value);
ACPI_STATUS
AcpiUtExecute_STA (
@@ -661,6 +657,34 @@ AcpiUtGetObjectSize(
ACPI_SIZE *ObjLength);
/*
* utosi - Support for the _OSI predefined control method
*/
ACPI_STATUS
AcpiUtInitializeInterfaces (
void);
void
AcpiUtInterfaceTerminate (
void);
ACPI_STATUS
AcpiUtInstallInterface (
ACPI_STRING InterfaceName);
ACPI_STATUS
AcpiUtRemoveInterface (
ACPI_STRING InterfaceName);
ACPI_INTERFACE_INFO *
AcpiUtGetInterface (
ACPI_STRING InterfaceName);
ACPI_STATUS
AcpiUtOsiImplementation (
ACPI_WALK_STATE *WalkState);
/*
* utstate - Generic state creation/cache routines
*/
@@ -720,16 +744,16 @@ AcpiUtDeleteGenericState (
*/
ACPI_STATUS
AcpiUtDivide (
ACPI_INTEGER InDividend,
ACPI_INTEGER InDivisor,
ACPI_INTEGER *OutQuotient,
ACPI_INTEGER *OutRemainder);
UINT64 InDividend,
UINT64 InDivisor,
UINT64 *OutQuotient,
UINT64 *OutRemainder);
ACPI_STATUS
AcpiUtShortDivide (
ACPI_INTEGER InDividend,
UINT64 InDividend,
UINT32 Divisor,
ACPI_INTEGER *OutQuotient,
UINT64 *OutQuotient,
UINT32 *OutRemainder);
/*
@@ -766,6 +790,10 @@ void
AcpiUtStrupr (
char *SrcString);
void
AcpiUtStrlwr (
char *SrcString);
void
AcpiUtPrintString (
char *String,
@@ -788,25 +816,7 @@ ACPI_STATUS
AcpiUtStrtoul64 (
char *String,
UINT32 Base,
ACPI_INTEGER *RetInteger);
void ACPI_INTERNAL_VAR_XFACE
AcpiUtPredefinedWarning (
const char *ModuleName,
UINT32 LineNumber,
char *Pathname,
UINT8 NodeFlags,
const char *Format,
...);
void ACPI_INTERNAL_VAR_XFACE
AcpiUtPredefinedInfo (
const char *ModuleName,
UINT32 LineNumber,
char *Pathname,
UINT8 NodeFlags,
const char *Format,
...);
UINT64 *RetInteger);
/* Values for Base above (16=Hex, 10=Decimal) */
@@ -957,7 +967,44 @@ AcpiUtCreateList (
UINT16 ObjectSize,
ACPI_MEMORY_LIST **ReturnCache);
#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
#endif
/*
* utxferror - various error/warning output functions
*/
void ACPI_INTERNAL_VAR_XFACE
AcpiUtPredefinedWarning (
const char *ModuleName,
UINT32 LineNumber,
char *Pathname,
UINT8 NodeFlags,
const char *Format,
...);
void ACPI_INTERNAL_VAR_XFACE
AcpiUtPredefinedInfo (
const char *ModuleName,
UINT32 LineNumber,
char *Pathname,
UINT8 NodeFlags,
const char *Format,
...);
void
AcpiUtNamespaceError (
const char *ModuleName,
UINT32 LineNumber,
const char *InternalName,
ACPI_STATUS LookupStatus);
void
AcpiUtMethodError (
const char *ModuleName,
UINT32 LineNumber,
const char *Message,
ACPI_NAMESPACE_NODE *Node,
const char *Path,
ACPI_STATUS LookupStatus);
#endif /* _ACUTILS_H */
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -474,24 +474,6 @@
#define AML_CLASS_UNKNOWN 0x0A
/* Predefined Operation Region SpaceIDs */
typedef enum
{
REGION_MEMORY = 0,
REGION_IO,
REGION_PCI_CONFIG,
REGION_EC,
REGION_SMBUS,
REGION_CMOS,
REGION_PCI_BAR,
REGION_IPMI,
REGION_DATA_TABLE, /* Internal use only */
REGION_FIXED_HW = 0x7F
} AML_REGION_TYPES;
/* Comparison operation codes for MatchOp operator */
typedef enum
@@ -579,17 +561,11 @@ typedef enum
} AML_ACCESS_ATTRIBUTE;
/* Bit fields in MethodFlags byte */
/* Bit fields in the AML MethodFlags byte */
#define AML_METHOD_ARG_COUNT 0x07
#define AML_METHOD_SERIALIZED 0x08
#define AML_METHOD_SYNC_LEVEL 0xF0
/* METHOD_FLAGS_ARG_COUNT is not used internally, define additional flags */
#define AML_METHOD_INTERNAL_ONLY 0x01
#define AML_METHOD_RESERVED1 0x02
#define AML_METHOD_RESERVED2 0x04
#endif /* __AMLCODE_H__ */
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -300,6 +300,12 @@ typedef struct aml_resource_large_header
} AML_RESOURCE_LARGE_HEADER;
/* General Flags for address space resource descriptors */
#define ACPI_RESOURCE_FLAG_DEC 2
#define ACPI_RESOURCE_FLAG_MIF 4
#define ACPI_RESOURCE_FLAG_MAF 8
typedef struct aml_resource_memory24
{
AML_RESOURCE_LARGE_HEADER_COMMON
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -121,7 +121,6 @@
*/
#define ACPI_USE_SYSTEM_CLIBRARY
#define ACPI_USE_DO_WHILE_0
#define ACPI_THREAD_ID pthread_t
#define ACPI_FLUSH_CPU_CACHE()
/*
* This is needed since sem_timedwait does not appear to work properly
@@ -151,10 +150,12 @@
#define __cdecl
#endif
#ifdef _ANSI
#define inline
#endif
#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) if (GLptr) Acq=1; else Acq=0;
#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pending) Pending = 1
/* On Cygwin, pthread_t is a pointer */
#define ACPI_CAST_PTHREAD_T(pthread) ((ACPI_THREAD_ID) ACPI_TO_INTEGER (pthread))
/* Cygwin uses GCC */
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, 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 - 2009, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -148,9 +148,10 @@
#define ACPI_CONSTANT_EVAL_ONLY
#define ACPI_LARGE_NAMESPACE_NODE
#define ACPI_DATA_TABLE_DISASSEMBLY
#define ACPI_SINGLE_THREADED
#endif
/* AcpiExec configuration */
/* AcpiExec configuration. Multithreaded with full AML debugger */
#ifdef ACPI_EXEC_APP
#define ACPI_APPLICATION
@@ -159,6 +160,31 @@
#define ACPI_DBG_TRACK_ALLOCATIONS
#endif
/* AcpiNames configuration. Single threaded with debugger output enabled. */
#ifdef ACPI_NAMES_APP
#define ACPI_DEBUGGER
#define ACPI_APPLICATION
#define ACPI_SINGLE_THREADED
#endif
/*
* AcpiBin/AcpiHelp/AcpiSrc configuration. All single threaded, with
* no debug output.
*/
#if (defined ACPI_BIN_APP) || \
(defined ACPI_SRC_APP) || \
(defined ACPI_XTRACT_APP)
#define ACPI_APPLICATION
#define ACPI_SINGLE_THREADED
#endif
#ifdef ACPI_HELP_APP
#define ACPI_DEBUG_OUTPUT
#define ACPI_APPLICATION
#define ACPI_SINGLE_THREADED
#endif
/* Linkable ACPICA library */
#ifdef ACPI_LIBRARY
@@ -256,17 +282,17 @@
/* Type of mutex supported by host. Default is binary semaphores. */
#ifndef ACPI_MUTEX_TYPE
#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE
#define ACPI_MUTEX_TYPE ACPI_OSL_MUTEX
#endif
/* Global Lock acquire/release */
#ifndef ACPI_ACQUIRE_GLOBAL_LOCK
#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) Acq = 1
#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acquired) Acquired = 1
#endif
#ifndef ACPI_RELEASE_GLOBAL_LOCK
#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) Acq = 0
#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pending) Pending = 0
#endif
/* Flush CPU cache - used when going to sleep. Wbinvd or similar. */
@@ -275,6 +301,12 @@
#define ACPI_FLUSH_CPU_CACHE()
#endif
/* "inline" keywords - configurable since inline is not standardized */
#ifndef ACPI_INLINE
#define ACPI_INLINE
#endif
/*
* Configurable calling conventions:
*
@@ -424,8 +456,8 @@ typedef char *va_list;
#define ACPI_MEMCMP(s1,s2,n) AcpiUtMemcmp((const char *)(s1), (const char *)(s2), (ACPI_SIZE)(n))
#define ACPI_MEMCPY(d,s,n) (void) AcpiUtMemcpy ((d), (s), (ACPI_SIZE)(n))
#define ACPI_MEMSET(d,v,n) (void) AcpiUtMemset ((d), (v), (ACPI_SIZE)(n))
#define ACPI_TOUPPER AcpiUtToUpper
#define ACPI_TOLOWER AcpiUtToLower
#define ACPI_TOUPPER(c) AcpiUtToUpper ((int) (c))
#define ACPI_TOLOWER(c) AcpiUtToLower ((int) (c))
#endif /* ACPI_USE_SYSTEM_CLIBRARY */

Some files were not shown because too many files have changed in this diff Show More