1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-23 11:18:54 +00:00

Import ACPICA 20110211.

This commit is contained in:
Jung-uk Kim 2011-02-11 22:56:14 +00:00
parent 8f74426ca5
commit 19834a6cfd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor-sys/acpica/dist/; revision=218585
svn path=/vendor-sys/acpica/20110211/; revision=218586; tag=vendor/acpica/20110211
62 changed files with 9446 additions and 5516 deletions

File diff suppressed because it is too large Load Diff

View File

@ -641,6 +641,7 @@ AcpiDmDumpTable (
ByteLength = 6;
break;
case ACPI_DMT_UINT56:
case ACPI_DMT_BUF7:
ByteLength = 7;
break;
case ACPI_DMT_UINT64:
@ -751,16 +752,19 @@ AcpiDmDumpTable (
ACPI_FORMAT_UINT64 (ACPI_GET64 (Target)));
break;
case ACPI_DMT_BUF7:
case ACPI_DMT_BUF16:
/* Buffer of length 16 */
for (Temp8 = 0; Temp8 < 16; Temp8++)
/*
* Buffer: Size depends on the opcode and was set above.
* Each hex byte is separated with a space.
*/
for (Temp8 = 0; Temp8 < ByteLength; Temp8++)
{
AcpiOsPrintf ("%2.2X", Target[Temp8]);
if ((Temp8 + 1) < 16)
if ((UINT32) (Temp8 + 1) < ByteLength)
{
AcpiOsPrintf (",");
AcpiOsPrintf (" ");
}
}
AcpiOsPrintf ("\n");

View File

@ -52,6 +52,12 @@
ACPI_MODULE_NAME ("dmtbdump")
static void
AcpiDmValidateFadtLength (
UINT32 Revision,
UINT32 Length);
/*******************************************************************************
*
* FUNCTION: AcpiDmDumpRsdp
@ -201,6 +207,10 @@ AcpiDmDumpXsdt (
*
* DESCRIPTION: Format the contents of a FADT
*
* NOTE: We cannot depend on the FADT version to indicate the actual
* contents of the FADT because of BIOS bugs. The table length
* is the only reliable indicator.
*
******************************************************************************/
void
@ -208,20 +218,21 @@ AcpiDmDumpFadt (
ACPI_TABLE_HEADER *Table)
{
/* Common ACPI 1.0 portion of FADT */
/* Always dump the minimum FADT revision 1 fields (ACPI 1.0) */
AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt1);
/* Check for ACPI 1.0B MS extensions (FADT revision 2) */
/* Check for FADT revision 2 fields (ACPI 1.0B MS extensions) */
if (Table->Revision == 2)
if ((Table->Length > ACPI_FADT_V1_SIZE) &&
(Table->Length <= ACPI_FADT_V2_SIZE))
{
AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt2);
}
/* Check for ACPI 2.0+ extended data (FADT revision 3+) */
/* Check for FADT revision 3 fields and up (ACPI 2.0+ extended data) */
else if (Table->Length >= sizeof (ACPI_TABLE_FADT))
else if (Table->Length > ACPI_FADT_V2_SIZE)
{
AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt3);
}
@ -229,6 +240,68 @@ AcpiDmDumpFadt (
/* Validate various fields in the FADT, including length */
AcpiTbCreateLocalFadt (Table, Table->Length);
/* Validate FADT length against the revision */
AcpiDmValidateFadtLength (Table->Revision, Table->Length);
}
/*******************************************************************************
*
* FUNCTION: AcpiDmValidateFadtLength
*
* PARAMETERS: Revision - FADT revision (Header->Revision)
* Length - FADT length (Header->Length
*
* RETURN: None
*
* DESCRIPTION: Check the FADT revision against the expected table length for
* that revision. Issue a warning if the length is not what was
* expected. This seems to be such a common BIOS bug that the
* FADT revision has been rendered virtually meaningless.
*
******************************************************************************/
static void
AcpiDmValidateFadtLength (
UINT32 Revision,
UINT32 Length)
{
UINT32 ExpectedLength;
switch (Revision)
{
case 0:
AcpiOsPrintf ("// ACPI Warning: Invalid FADT revision: 0\n");
return;
case 1:
ExpectedLength = ACPI_FADT_V1_SIZE;
break;
case 2:
ExpectedLength = ACPI_FADT_V2_SIZE;
break;
case 3:
case 4:
ExpectedLength = ACPI_FADT_V3_SIZE;
break;
default:
return;
}
if (Length == ExpectedLength)
{
return;
}
AcpiOsPrintf (
"\n// ACPI Warning: FADT revision %X does not match length: found %X expected %X\n",
Revision, Length, ExpectedLength);
}

View File

@ -477,7 +477,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoAsf2a[] =
ACPI_DMTABLE_INFO AcpiDmTableInfoAsf3[] =
{
{ACPI_DMT_UINT56, ACPI_ASF3_OFFSET (Capabilities[0]), "Capabilities", 0},
{ACPI_DMT_BUF7, ACPI_ASF3_OFFSET (Capabilities[0]), "Capabilities", 0},
{ACPI_DMT_UINT8, ACPI_ASF3_OFFSET (CompletionCode), "Completion Code", 0},
{ACPI_DMT_UINT32, ACPI_ASF3_OFFSET (EnterpriseId), "Enterprise ID", 0},
{ACPI_DMT_UINT8, ACPI_ASF3_OFFSET (Command), "Command", 0},
@ -1588,5 +1588,6 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoGeneric[][2] =
ACPI_DM_GENERIC_ENTRY (ACPI_DMT_BUFFER, "Buffer"),
ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UUID, "GUID"),
ACPI_DM_GENERIC_ENTRY (ACPI_DMT_STRING, "DevicePath"),
ACPI_DM_GENERIC_ENTRY (ACPI_DMT_LABEL, "Label"),
{ACPI_DMT_TERMINATOR}
};

View File

@ -32,7 +32,9 @@ OBJS = \
adfile.o \
adisasm.o \
adwalk.o \
aslbtypes.o \
aslanalyze.o \
aslbtypes.o \
aslcodegen.o \
aslcompile.o \
aslcompilerlex.o \
@ -64,7 +66,9 @@ OBJS = \
asltree.o \
aslutils.o \
asluuid.o \
aslwalks.o \
dtcompile.o \
dtexpress.o \
dtfield.o \
dtio.o \
dtsubtable.o \
@ -86,12 +90,15 @@ OBJS = \
dmtbinfo.o \
dmutils.o \
dmwalk.o \
dsargs.o \
dscontrol.o \
dsfield.o \
dsobject.o \
dsopcode.o \
dsutils.o \
dswexec.o \
dswload.o \
dswload2.o \
dswscope.o \
dswstate.o \
exconvrt.o \
@ -142,6 +149,7 @@ OBJS = \
utcache.o \
utcopy.o \
utdebug.o \
utdecode.o \
utdelete.o \
utglobal.o \
utinit.o \
@ -201,6 +209,9 @@ aslcompilerparse.o : aslcompilerparse.c
aslanalyze.o : $(ASL_COMPILER)/aslanalyze.c
$(COMPILE)
aslbtypes.o : $(ASL_COMPILER)/aslbtypes.c
$(COMPILE)
aslcodegen.o : $(ASL_COMPILER)/aslcodegen.c
$(COMPILE)
@ -288,6 +299,9 @@ aslutils.o : $(ASL_COMPILER)/aslutils.c
asluuid.o : $(ASL_COMPILER)/asluuid.c
$(COMPILE)
aslwalks.o : $(ASL_COMPILER)/aslwalks.c
$(COMPILE)
#
# Data Table Compiler
@ -295,6 +309,9 @@ asluuid.o : $(ASL_COMPILER)/asluuid.c
dtcompile.o : $(ASL_COMPILER)/dtcompile.c
$(COMPILE)
dtexpress.o : $(ASL_COMPILER)/dtexpress.c
$(COMPILE)
dtfield.o : $(ASL_COMPILER)/dtfield.c
$(COMPILE)
@ -378,6 +395,12 @@ dmutils.o : $(ACPICA_CORE)/disassembler/dmutils.c
dmwalk.o : $(ACPICA_CORE)/disassembler/dmwalk.c
$(COMPILE)
dsargs.o : $(ACPICA_CORE)/dispatcher/dsargs.c
$(COMPILE)
dscontrol.o : $(ACPICA_CORE)/dispatcher/dscontrol.c
$(COMPILE)
dsfield.o : $(ACPICA_CORE)/dispatcher/dsfield.c
$(COMPILE)
@ -396,6 +419,9 @@ dswexec.o : $(ACPICA_CORE)/dispatcher/dswexec.c
dswload.o : $(ACPICA_CORE)/dispatcher/dswload.c
$(COMPILE)
dswload2.o : $(ACPICA_CORE)/dispatcher/dswload2.c
$(COMPILE)
dswscope.o : $(ACPICA_CORE)/dispatcher/dswscope.c
$(COMPILE)
@ -540,6 +566,9 @@ utcopy.o : $(ACPICA_CORE)/utilities/utcopy.c
utdebug.o : $(ACPICA_CORE)/utilities/utdebug.c
$(COMPILE)
utdecode.o : $(ACPICA_CORE)/utilities/utdecode.c
$(COMPILE)
utdelete.o : $(ACPICA_CORE)/utilities/utdelete.c
$(COMPILE)

File diff suppressed because it is too large Load Diff

525
compiler/aslbtypes.c Normal file
View File

@ -0,0 +1,525 @@
/******************************************************************************
*
* Module Name: aslbtypes - Support for bitfield types
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2011, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#include "aslcompiler.h"
#include "aslcompiler.y.h"
#include "amlcode.h"
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslbtypes")
/* Local prototypes */
static UINT32
AnMapEtypeToBtype (
UINT32 Etype);
/*******************************************************************************
*
* FUNCTION: AnMapArgTypeToBtype
*
* PARAMETERS: ArgType - The ARGI required type(s) for this
* argument, from the opcode info table
*
* RETURN: The corresponding Bit-encoded types
*
* DESCRIPTION: Convert an encoded ARGI required argument type code into a
* bitfield type code. Implements the implicit source conversion
* rules.
*
******************************************************************************/
UINT32
AnMapArgTypeToBtype (
UINT32 ArgType)
{
switch (ArgType)
{
/* Simple types */
case ARGI_ANYTYPE:
return (ACPI_BTYPE_OBJECTS_AND_REFS);
case ARGI_PACKAGE:
return (ACPI_BTYPE_PACKAGE);
case ARGI_EVENT:
return (ACPI_BTYPE_EVENT);
case ARGI_MUTEX:
return (ACPI_BTYPE_MUTEX);
case ARGI_DDBHANDLE:
/*
* DDBHandleObject := SuperName
* ACPI_BTYPE_REFERENCE: Index reference as parameter of Load/Unload
*/
return (ACPI_BTYPE_DDB_HANDLE | ACPI_BTYPE_REFERENCE);
/* Interchangeable types */
/*
* Source conversion rules:
* Integer, String, and Buffer are all interchangeable
*/
case ARGI_INTEGER:
case ARGI_STRING:
case ARGI_BUFFER:
case ARGI_BUFFER_OR_STRING:
case ARGI_COMPUTEDATA:
return (ACPI_BTYPE_COMPUTE_DATA);
/* References */
case ARGI_INTEGER_REF:
return (ACPI_BTYPE_INTEGER);
case ARGI_OBJECT_REF:
return (ACPI_BTYPE_ALL_OBJECTS);
case ARGI_DEVICE_REF:
return (ACPI_BTYPE_DEVICE_OBJECTS);
case ARGI_REFERENCE:
return (ACPI_BTYPE_REFERENCE);
case ARGI_TARGETREF:
case ARGI_FIXED_TARGET:
case ARGI_SIMPLE_TARGET:
return (ACPI_BTYPE_OBJECTS_AND_REFS);
/* Complex types */
case ARGI_DATAOBJECT:
/*
* Buffer, string, package or reference to a Op -
* Used only by SizeOf operator
*/
return (ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER |
ACPI_BTYPE_PACKAGE | ACPI_BTYPE_REFERENCE);
case ARGI_COMPLEXOBJ:
/* Buffer, String, or package */
return (ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER | ACPI_BTYPE_PACKAGE);
case ARGI_REF_OR_STRING:
return (ACPI_BTYPE_STRING | ACPI_BTYPE_REFERENCE);
case ARGI_REGION_OR_BUFFER:
/* Used by Load() only. Allow buffers in addition to regions/fields */
return (ACPI_BTYPE_REGION | ACPI_BTYPE_BUFFER | ACPI_BTYPE_FIELD_UNIT);
case ARGI_DATAREFOBJ:
return (ACPI_BTYPE_INTEGER |ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER |
ACPI_BTYPE_PACKAGE | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE);
default:
break;
}
return (ACPI_BTYPE_OBJECTS_AND_REFS);
}
/*******************************************************************************
*
* FUNCTION: AnMapEtypeToBtype
*
* PARAMETERS: Etype - Encoded ACPI Type
*
* RETURN: Btype corresponding to the Etype
*
* DESCRIPTION: Convert an encoded ACPI type to a bitfield type applying the
* operand conversion rules. In other words, returns the type(s)
* this Etype is implicitly converted to during interpretation.
*
******************************************************************************/
static UINT32
AnMapEtypeToBtype (
UINT32 Etype)
{
if (Etype == ACPI_TYPE_ANY)
{
return (ACPI_BTYPE_OBJECTS_AND_REFS);
}
/* Try the standard ACPI data types */
if (Etype <= ACPI_TYPE_EXTERNAL_MAX)
{
/*
* This switch statement implements the allowed operand conversion
* rules as per the "ASL Data Types" section of the ACPI
* specification.
*/
switch (Etype)
{
case ACPI_TYPE_INTEGER:
return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_DDB_HANDLE);
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
return (ACPI_BTYPE_COMPUTE_DATA);
case ACPI_TYPE_PACKAGE:
return (ACPI_BTYPE_PACKAGE);
case ACPI_TYPE_FIELD_UNIT:
return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_FIELD_UNIT);
case ACPI_TYPE_BUFFER_FIELD:
return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_BUFFER_FIELD);
case ACPI_TYPE_DDB_HANDLE:
return (ACPI_BTYPE_INTEGER | ACPI_BTYPE_DDB_HANDLE);
case ACPI_BTYPE_DEBUG_OBJECT:
/* Cannot be used as a source operand */
return (0);
default:
return (1 << (Etype - 1));
}
}
/* Try the internal data types */
switch (Etype)
{
case ACPI_TYPE_LOCAL_REGION_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
/* Named fields can be either Integer/Buffer/String */
return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_FIELD_UNIT);
case ACPI_TYPE_LOCAL_ALIAS:
return (ACPI_BTYPE_INTEGER);
case ACPI_TYPE_LOCAL_RESOURCE:
case ACPI_TYPE_LOCAL_RESOURCE_FIELD:
return (ACPI_BTYPE_REFERENCE);
default:
printf ("Unhandled encoded type: %X\n", Etype);
return (0);
}
}
/*******************************************************************************
*
* FUNCTION: AnFormatBtype
*
* PARAMETERS: Btype - Bitfield of ACPI types
* Buffer - Where to put the ascii string
*
* RETURN: None.
*
* DESCRIPTION: Convert a Btype to a string of ACPI types
*
******************************************************************************/
void
AnFormatBtype (
char *Buffer,
UINT32 Btype)
{
UINT32 Type;
BOOLEAN First = TRUE;
*Buffer = 0;
if (Btype == 0)
{
strcat (Buffer, "NoReturnValue");
return;
}
for (Type = 1; Type <= ACPI_TYPE_EXTERNAL_MAX; Type++)
{
if (Btype & 0x00000001)
{
if (!First)
{
strcat (Buffer, "|");
}
First = FALSE;
strcat (Buffer, AcpiUtGetTypeName (Type));
}
Btype >>= 1;
}
if (Btype & 0x00000001)
{
if (!First)
{
strcat (Buffer, "|");
}
First = FALSE;
strcat (Buffer, "Reference");
}
Btype >>= 1;
if (Btype & 0x00000001)
{
if (!First)
{
strcat (Buffer, "|");
}
First = FALSE;
strcat (Buffer, "Resource");
}
}
/*******************************************************************************
*
* FUNCTION: AnGetBtype
*
* PARAMETERS: Op - Parse node whose type will be returned.
*
* RETURN: The Btype associated with the Op.
*
* DESCRIPTION: Get the (bitfield) ACPI type associated with the parse node.
* Handles the case where the node is a name or method call and
* the actual type must be obtained from the namespace node.
*
******************************************************************************/
UINT32
AnGetBtype (
ACPI_PARSE_OBJECT *Op)
{
ACPI_NAMESPACE_NODE *Node;
ACPI_PARSE_OBJECT *ReferencedNode;
UINT32 ThisNodeBtype = 0;
if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
(Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) ||
(Op->Asl.ParseOpcode == PARSEOP_METHODCALL))
{
Node = Op->Asl.Node;
if (!Node)
{
DbgPrint (ASL_DEBUG_OUTPUT,
"No attached Nsnode: [%s] at line %u name [%s], ignoring typecheck\n",
Op->Asl.ParseOpName, Op->Asl.LineNumber,
Op->Asl.ExternalName);
return (ACPI_UINT32_MAX);
}
ThisNodeBtype = AnMapEtypeToBtype (Node->Type);
if (!ThisNodeBtype)
{
AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op,
"could not map type");
}
/*
* Since it was a named reference, enable the
* reference bit also
*/
ThisNodeBtype |= ACPI_BTYPE_REFERENCE;
if (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)
{
ReferencedNode = Node->Op;
if (!ReferencedNode)
{
/* Check for an internal method */
if (AnIsInternalMethod (Op))
{
return (AnGetInternalMethodReturnType (Op));
}
AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op,
"null Op pointer");
return (ACPI_UINT32_MAX);
}
if (ReferencedNode->Asl.CompileFlags & NODE_METHOD_TYPED)
{
ThisNodeBtype = ReferencedNode->Asl.AcpiBtype;
}
else
{
return (ACPI_UINT32_MAX -1);
}
}
}
else
{
ThisNodeBtype = Op->Asl.AcpiBtype;
}
return (ThisNodeBtype);
}
/*******************************************************************************
*
* FUNCTION: AnMapObjTypeToBtype
*
* PARAMETERS: Op - A parse node
*
* RETURN: A Btype
*
* DESCRIPTION: Map object to the associated "Btype"
*
******************************************************************************/
UINT32
AnMapObjTypeToBtype (
ACPI_PARSE_OBJECT *Op)
{
switch (Op->Asl.ParseOpcode)
{
case PARSEOP_OBJECTTYPE_BFF: /* "BuffFieldObj" */
return (ACPI_BTYPE_BUFFER_FIELD);
case PARSEOP_OBJECTTYPE_BUF: /* "BuffObj" */
return (ACPI_BTYPE_BUFFER);
case PARSEOP_OBJECTTYPE_DDB: /* "DDBHandleObj" */
return (ACPI_BTYPE_DDB_HANDLE);
case PARSEOP_OBJECTTYPE_DEV: /* "DeviceObj" */
return (ACPI_BTYPE_DEVICE);
case PARSEOP_OBJECTTYPE_EVT: /* "EventObj" */
return (ACPI_BTYPE_EVENT);
case PARSEOP_OBJECTTYPE_FLD: /* "FieldUnitObj" */
return (ACPI_BTYPE_FIELD_UNIT);
case PARSEOP_OBJECTTYPE_INT: /* "IntObj" */
return (ACPI_BTYPE_INTEGER);
case PARSEOP_OBJECTTYPE_MTH: /* "MethodObj" */
return (ACPI_BTYPE_METHOD);
case PARSEOP_OBJECTTYPE_MTX: /* "MutexObj" */
return (ACPI_BTYPE_MUTEX);
case PARSEOP_OBJECTTYPE_OPR: /* "OpRegionObj" */
return (ACPI_BTYPE_REGION);
case PARSEOP_OBJECTTYPE_PKG: /* "PkgObj" */
return (ACPI_BTYPE_PACKAGE);
case PARSEOP_OBJECTTYPE_POW: /* "PowerResObj" */
return (ACPI_BTYPE_POWER);
case PARSEOP_OBJECTTYPE_STR: /* "StrObj" */
return (ACPI_BTYPE_STRING);
case PARSEOP_OBJECTTYPE_THZ: /* "ThermalZoneObj" */
return (ACPI_BTYPE_THERMAL);
case PARSEOP_OBJECTTYPE_UNK: /* "UnknownObj" */
return (ACPI_BTYPE_OBJECTS_AND_REFS);
default:
return (0);
}
}
#ifdef ACPI_OBSOLETE_FUNCTIONS
/*******************************************************************************
*
* FUNCTION: AnMapBtypeToEtype
*
* PARAMETERS: Btype - Bitfield of ACPI types
*
* RETURN: The Etype corresponding the the Btype
*
* DESCRIPTION: Convert a bitfield type to an encoded type
*
******************************************************************************/
UINT32
AnMapBtypeToEtype (
UINT32 Btype)
{
UINT32 i;
UINT32 Etype;
if (Btype == 0)
{
return (0);
}
Etype = 1;
for (i = 1; i < Btype; i *= 2)
{
Etype++;
}
return (Etype);
}
#endif

View File

@ -600,27 +600,25 @@ CmDoCompile (
Event = UtBeginEvent ("Determine object types returned by methods");
DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Method typing\n\n");
TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE,
AnMethodTypingWalkBegin,
AnMethodTypingWalkEnd, NULL);
TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD,
NULL, AnMethodTypingWalkEnd, NULL);
UtEndEvent (Event);
/* Semantic error checking part three - operand type checking */
Event = UtBeginEvent ("Analyze AML operand types");
DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Operand type checking\n\n");
TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE,
AnOperandTypecheckWalkBegin,
AnOperandTypecheckWalkEnd, &AnalysisWalkInfo);
TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD,
NULL, AnOperandTypecheckWalkEnd, &AnalysisWalkInfo);
UtEndEvent (Event);
/* Semantic error checking part four - other miscellaneous checks */
Event = UtBeginEvent ("Miscellaneous analysis");
DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - miscellaneous\n\n");
TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE,
TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD,
AnOtherSemanticAnalysisWalkBegin,
AnOtherSemanticAnalysisWalkEnd, &AnalysisWalkInfo);
NULL, &AnalysisWalkInfo);
UtEndEvent (Event);
/* Calculate all AML package lengths */

View File

@ -164,7 +164,7 @@ FlCheckForAscii (
/*
* aslanalyze - semantic analysis
* aslwalks - semantic analysis and parse tree walks
*/
ACPI_STATUS
AnOtherSemanticAnalysisWalkBegin (
@ -178,12 +178,6 @@ AnOtherSemanticAnalysisWalkEnd (
UINT32 Level,
void *Context);
ACPI_STATUS
AnOperandTypecheckWalkBegin (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context);
ACPI_STATUS
AnOperandTypecheckWalkEnd (
ACPI_PARSE_OBJECT *Op,
@ -202,12 +196,6 @@ AnMethodAnalysisWalkEnd (
UINT32 Level,
void *Context);
ACPI_STATUS
AnMethodTypingWalkBegin (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context);
ACPI_STATUS
AnMethodTypingWalkEnd (
ACPI_PARSE_OBJECT *Op,
@ -215,6 +203,69 @@ AnMethodTypingWalkEnd (
void *Context);
/*
* aslbtypes - bitfield data types
*/
UINT32
AnMapObjTypeToBtype (
ACPI_PARSE_OBJECT *Op);
UINT32
AnMapArgTypeToBtype (
UINT32 ArgType);
UINT32
AnGetBtype (
ACPI_PARSE_OBJECT *Op);
void
AnFormatBtype (
char *Buffer,
UINT32 Btype);
/*
* aslanalyze - Support functions for parse tree walks
*/
void
AnCheckId (
ACPI_PARSE_OBJECT *Op,
ACPI_NAME Type);
/* Values for Type argument above */
#define ASL_TYPE_HID 0
#define ASL_TYPE_CID 1
BOOLEAN
AnIsInternalMethod (
ACPI_PARSE_OBJECT *Op);
UINT32
AnGetInternalMethodReturnType (
ACPI_PARSE_OBJECT *Op);
BOOLEAN
AnLastStatementIsReturn (
ACPI_PARSE_OBJECT *Op);
void
AnCheckMethodReturnValue (
ACPI_PARSE_OBJECT *Op,
const ACPI_OPCODE_INFO *OpInfo,
ACPI_PARSE_OBJECT *ArgOp,
UINT32 RequiredBtypes,
UINT32 ThisNodeBtype);
BOOLEAN
AnIsResultUsed (
ACPI_PARSE_OBJECT *Op);
void
ApCheckForGpeNameConflict (
ACPI_PARSE_OBJECT *Op);
/*
* aslerror - error handling/reporting
*/
@ -487,6 +538,10 @@ TrCreateValuedLeafNode (
UINT32 ParseOpcode,
UINT64 Value);
ACPI_PARSE_OBJECT *
TrCreateConstantLeafNode (
UINT32 ParseOpcode);
ACPI_PARSE_OBJECT *
TrLinkChildren (
ACPI_PARSE_OBJECT *Op,

View File

@ -392,6 +392,9 @@ NamePathTail [.]{NameSeg}
"AddressRangeNVS" { count (0); return (PARSEOP_ADDRESSTYPE_NVS); }
"AddressRangeACPI" { count (0); return (PARSEOP_ADDRESSTYPE_ACPI); }
"__DATE__" { count (0); return (PARSEOP___DATE__); }
"__FILE__" { count (0); return (PARSEOP___FILE__); }
"__LINE__" { count (0); return (PARSEOP___LINE__); }
"{" { count (0); return('{'); }
"}" { count (0); return('}'); }

View File

@ -392,6 +392,13 @@ AslLocalAllocate (unsigned int Size);
%token <i> PARSEOP_XOR
%token <i> PARSEOP_ZERO
/*
* Special functions. These should probably stay at the end of this
* table.
*/
%token <i> PARSEOP___DATE__
%token <i> PARSEOP___FILE__
%token <i> PARSEOP___LINE__
/*
* Production names
@ -695,7 +702,6 @@ AslLocalAllocate (unsigned int Size);
%type <n> OptionalReference
%type <n> OptionalAccessSize
%type <n> TermArgItem
%type <n> NameStringItem
@ -2317,6 +2323,9 @@ ConstExprTerm
: PARSEOP_ZERO {$$ = TrCreateValuedLeafNode (PARSEOP_ZERO, 0);}
| PARSEOP_ONE {$$ = TrCreateValuedLeafNode (PARSEOP_ONE, 1);}
| PARSEOP_ONES {$$ = TrCreateValuedLeafNode (PARSEOP_ONES, ACPI_UINT64_MAX);}
| PARSEOP___DATE__ {$$ = TrCreateConstantLeafNode (PARSEOP___DATE__);}
| PARSEOP___FILE__ {$$ = TrCreateConstantLeafNode (PARSEOP___FILE__);}
| PARSEOP___LINE__ {$$ = TrCreateConstantLeafNode (PARSEOP___LINE__);}
;
/* OptionalCount must appear before ByteList or an incorrect reduction will result */
@ -3070,7 +3079,6 @@ NameStringItem
| ',' error {$$ = AslDoError (); yyclearin;}
;
%%

View File

@ -188,6 +188,8 @@ typedef enum
ASL_MSG_HID_LENGTH,
ASL_MSG_NULL_STRING,
ASL_MSG_LEADING_ASTERISK,
ASL_MSG_RESERVED_NO_RETURN_VAL,
ASL_MSG_GPE_NAME_CONFLICT,
ASL_MSG_INVALID_FIELD_NAME,
ASL_MSG_INTEGER_SIZE,
@ -198,7 +200,10 @@ typedef enum
ASL_MSG_ZERO_VALUE,
ASL_MSG_UNKNOWN_TABLE,
ASL_MSG_UNKNOWN_SUBTABLE,
ASL_MSG_OEM_TABLE
ASL_MSG_OEM_TABLE,
ASL_MSG_UNKNOWN_LABEL,
ASL_MSG_INVALID_EXPRESSION,
ASL_MSG_DIVIDE_BY_ZERO
} ASL_MESSAGE_IDS;
@ -336,6 +341,8 @@ char *AslMessages [] = {
/* ASL_MSG_HID_LENGTH */ "_HID string must be exactly 7 or 8 characters",
/* ASL_MSG_NULL_STRING */ "Invalid zero-length (null) string",
/* ASL_MSG_LEADING_ASTERISK */ "Invalid leading asterisk",
/* ASL_MSG_RESERVED_NO_RETURN_VAL */ "Reserved method should not return a value",
/* ASL_MSG_GPE_NAME_CONFLICT */ "Name conflicts with a previous GPE method",
/* These messages are used by the data table compiler only */
@ -348,7 +355,10 @@ char *AslMessages [] = {
/* ASL_MSG_ZERO_VALUE */ "Value must be non-zero",
/* ASL_MSG_UNKNOWN_TABLE */ "Unknown ACPI table signature",
/* ASL_MSG_UNKNOWN_SUBTABLE */ "Unknown subtable type",
/* ASL_MSG_OEM_TABLE */ "OEM table - unknown contents"
/* ASL_MSG_OEM_TABLE */ "OEM table - unknown contents",
/* ASL_MSG_UNKNOWN_LABEL */ "Label is undefined",
/* ASL_MSG_INVALID_EXPRESSION */ "Invalid expression",
/* ASL_MSG_DIVIDE_BY_ZERO */ "Expression contains divide-by-zero"
};

View File

@ -54,6 +54,11 @@
/* Local prototypes */
static void
ApCheckForUnexpectedReturnValue (
ACPI_PARSE_OBJECT *Op,
ASL_METHOD_INFO *MethodInfo);
static UINT32
ApCheckForSpecialName (
ACPI_PARSE_OBJECT *Op,
@ -236,6 +241,53 @@ ApCheckForPredefinedMethod (
}
/*******************************************************************************
*
* FUNCTION: ApCheckForUnexpectedReturnValue
*
* PARAMETERS: Op - A parse node of type "RETURN".
* MethodInfo - Saved info about this method
*
* RETURN: None
*
* DESCRIPTION: Check for an unexpected return value from a predefined method.
* Invoked for predefined methods that are defined to not return
* any value. If there is a return value, issue a remark, since
* the ASL writer may be confused as to the method definition
* and/or functionality.
*
* Note: We ignore all return values of "Zero", since this is what a standalone
* Return() statement will always generate -- so we ignore it here --
* i.e., there is no difference between Return() and Return(Zero).
* Also, a null Return() will be disassembled to return(Zero) -- so, we
* don't want to generate extraneous remarks/warnings for a disassembled
* ASL file.
*
******************************************************************************/
static void
ApCheckForUnexpectedReturnValue (
ACPI_PARSE_OBJECT *Op,
ASL_METHOD_INFO *MethodInfo)
{
ACPI_PARSE_OBJECT *ReturnValueOp;
/* Ignore Return() and Return(Zero) (they are the same) */
ReturnValueOp = Op->Asl.Child;
if (ReturnValueOp->Asl.ParseOpcode == PARSEOP_ZERO)
{
return;
}
/* We have a valid return value, but the reserved name did not expect it */
AslError (ASL_WARNING, ASL_MSG_RESERVED_NO_RETURN_VAL,
Op, MethodInfo->Op->Asl.ExternalName);
}
/*******************************************************************************
*
* FUNCTION: ApCheckPredefinedReturnValue
@ -249,7 +301,9 @@ ApCheckForPredefinedMethod (
* value. Only "static" types can be validated - a simple return
* of an integer/string/buffer/package or a named reference to
* a static object. Values such as a Localx or Argx or a control
* method invocation are not checked.
* method invocation are not checked. Issue a warning if there is
* a valid return value, but the reserved method defines no
* return value.
*
******************************************************************************/
@ -269,20 +323,27 @@ ApCheckPredefinedReturnValue (
switch (Index)
{
case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */
/* No return value expected, warn if there is one */
ApCheckForUnexpectedReturnValue (Op, MethodInfo);
return;
case ACPI_NOT_RESERVED_NAME: /* No underscore or _Txx or _xxx name not matched */
case ACPI_PREDEFINED_NAME: /* Resource Name or reserved scope name */
case ACPI_COMPILER_RESERVED_NAME: /* A _Txx that was not emitted by compiler */
case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */
/* Just return, nothing to do */
return;
default: /* A standard predefined ACPI name */
/* Exit if no return value expected */
if (!PredefinedNames[Index].Info.ExpectedBtypes)
{
/* No return value expected, warn if there is one */
ApCheckForUnexpectedReturnValue (Op, MethodInfo);
return;
}

View File

@ -45,6 +45,7 @@
#include "aslcompiler.h"
#include "aslcompiler.y.h"
#include <time.h>
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("asltree")
@ -401,6 +402,75 @@ TrCreateLeafNode (
}
/*******************************************************************************
*
* FUNCTION: TrCreateConstantLeafNode
*
* PARAMETERS: ParseOpcode - The constant opcode
*
* RETURN: Pointer to the new node. Aborts on allocation failure
*
* DESCRIPTION: Create a leaf node (no children or peers) for one of the
* special constants - __LINE__, __FILE__, and __DATE__.
*
* Note: An implemenation of __FUNC__ cannot happen here because we don't
* have a full parse tree at this time and cannot find the parent control
* method. If it is ever needed, __FUNC__ must be implemented later, after
* the parse tree has been fully constructed.
*
******************************************************************************/
ACPI_PARSE_OBJECT *
TrCreateConstantLeafNode (
UINT32 ParseOpcode)
{
ACPI_PARSE_OBJECT *Op = NULL;
time_t CurrentTime;
char *StaticTimeString;
char *TimeString;
switch (ParseOpcode)
{
case PARSEOP___LINE__:
Op = TrAllocateNode (PARSEOP_INTEGER);
Op->Asl.Value.Integer = Op->Asl.LineNumber;
break;
case PARSEOP___FILE__:
Op = TrAllocateNode (PARSEOP_STRING_LITERAL);
/* Op.Asl.Filename contains the full pathname to the file */
Op->Asl.Value.String = Op->Asl.Filename;
break;
case PARSEOP___DATE__:
Op = TrAllocateNode (PARSEOP_STRING_LITERAL);
/* Get a copy of the current time */
CurrentTime = time (NULL);
StaticTimeString = ctime (&CurrentTime);
TimeString = UtLocalCalloc (strlen (StaticTimeString) + 1);
strcpy (TimeString, StaticTimeString);
TimeString[strlen(TimeString) -1] = 0; /* Remove trailing newline */
Op->Asl.Value.String = TimeString;
break;
default: /* This would be an internal error */
return (NULL);
}
DbgPrint (ASL_PARSE_OUTPUT,
"\nCreateConstantLeafNode Ln/Col %u/%u NewNode %p Op %s Value %8.8X%8.8X ",
Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName (ParseOpcode),
ACPI_FORMAT_UINT64 (Op->Asl.Value.Integer));
return (Op);
}
/*******************************************************************************
*
* FUNCTION: TrCreateValuedLeafNode

1148
compiler/aslwalks.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -426,7 +426,10 @@ DtCompileTable (
Length = DtGetSubtableLength (*Field, Info);
Subtable = UtLocalCalloc (sizeof (DT_SUBTABLE));
Subtable->Buffer = UtLocalCalloc (Length);
if (Length > 0)
{
Subtable->Buffer = UtLocalCalloc (Length);
}
Subtable->Length = Length;
Subtable->TotalLength = Length;
Buffer = Subtable->Buffer;
@ -470,7 +473,12 @@ DtCompileTable (
}
}
/* Maintain table offsets */
LocalField->TableOffset = Gbl_CurrentTableOffset;
FieldLength = DtGetFieldLength (LocalField, Info);
Gbl_CurrentTableOffset += FieldLength;
FieldType = DtGetFieldType (Info);
Gbl_InputFieldCount++;
@ -537,6 +545,12 @@ DtCompileTable (
LocalField = *Field;
break;
case DT_FIELD_TYPE_LABEL:
DtWriteFieldToListing (Buffer, LocalField, 0);
LocalField = LocalField->Next;
break;
default:
/* Normal case for most field types (Integer, String, etc.) */

View File

@ -73,6 +73,7 @@
#define DT_FIELD_TYPE_UUID 7
#define DT_FIELD_TYPE_UNICODE 8
#define DT_FIELD_TYPE_DEVICE_PATH 9
#define DT_FIELD_TYPE_LABEL 10
/*
@ -80,13 +81,15 @@
*/
typedef struct dt_field
{
char *Name;
char *Value;
struct dt_field *Next;
char *Name; /* Field name (from name : value) */
char *Value; /* Field value (from name : value) */
struct dt_field *Next; /* Next field */
struct dt_field *NextLabel; /* If field is a label, next label */
UINT32 Line; /* Line number for this field */
UINT32 ByteOffset; /* Offset in source file for field */
UINT32 NameColumn; /* Start column for field name */
UINT32 Column; /* Start column for field value */
UINT32 TableOffset;/* Binary offset within ACPI table */
UINT8 Flags;
} DT_FIELD;
@ -131,6 +134,14 @@ DT_EXTERN DT_SUBTABLE DT_INIT_GLOBAL (*Gbl_RootTable, NULL);
DT_EXTERN DT_SUBTABLE DT_INIT_GLOBAL (*Gbl_SubtableStack, NULL);
/* List for defined labels */
DT_EXTERN DT_FIELD DT_INIT_GLOBAL (*Gbl_LabelList, NULL);
/* Current offset within the binary output table */
DT_EXTERN UINT32 DT_INIT_GLOBAL (Gbl_CurrentTableOffset, 0);
/* dtcompiler - main module */
@ -207,6 +218,17 @@ DtGetParentSubtable (
DT_SUBTABLE *Subtable);
/* dtexpress - Integer expressions and labels */
UINT64
DtResolveIntegerExpression (
DT_FIELD *Field);
void
DtDetectAllLabels (
DT_FIELD *FieldList);
/* dtfield - Compile individual fields within a table */
void
@ -391,6 +413,10 @@ ACPI_STATUS
DtCompileXsdt (
void **PFieldList);
ACPI_DMTABLE_INFO *
DtGetGenericTableInfo (
char *Name);
/* ACPI Table templates */
extern const unsigned char TemplateAsf[];

390
compiler/dtexpress.c Normal file
View File

@ -0,0 +1,390 @@
/******************************************************************************
*
* Module Name: dtexpress.c - Support for integer expressions and labels
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2011, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#define __DTEXPRESS_C__
#include "aslcompiler.h"
#include "dtcompiler.h"
#define _COMPONENT DT_COMPILER
ACPI_MODULE_NAME ("dtexpress")
/* Local prototypes */
static UINT64
DtResolveInteger (
DT_FIELD *Field,
char *IntegerString);
static void
DtInsertLabelField (
DT_FIELD *Field);
static DT_FIELD *
DtLookupLabel (
char *Name);
/******************************************************************************
*
* FUNCTION: DtResolveIntegerExpression
*
* PARAMETERS: Field - Field object with Integer expression
*
* RETURN: A 64-bit integer value
*
* DESCRIPTION: Resolve an integer expression to a single value. Supports
* both integer constants and labels. Supported operators are:
* +,-,*,/,%,|,&,^
*
*****************************************************************************/
UINT64
DtResolveIntegerExpression (
DT_FIELD *Field)
{
char *IntegerString;
char *Operator;
UINT64 Value;
UINT64 Value2;
DbgPrint (ASL_DEBUG_OUTPUT, "Full Integer expression: %s\n",
Field->Value);
strcpy (MsgBuffer, Field->Value); /* Must take a copy for strtok() */
/* Obtain and resolve the first operand */
IntegerString = strtok (MsgBuffer, " ");
if (!IntegerString)
{
DtError (ASL_ERROR, ASL_MSG_INVALID_EXPRESSION, Field, Field->Value);
return (0);
}
Value = DtResolveInteger (Field, IntegerString);
DbgPrint (ASL_DEBUG_OUTPUT, "Integer resolved to V1: %8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (Value));
/*
* Consume the entire expression string. For the rest of the
* expression string, values are of the form:
* <operator> <integer>
*/
while (1)
{
Operator = strtok (NULL, " ");
if (!Operator)
{
/* Normal exit */
DbgPrint (ASL_DEBUG_OUTPUT, "Expression Resolved to: %8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (Value));
return (Value);
}
IntegerString = strtok (NULL, " ");
if (!IntegerString ||
(strlen (Operator) > 1))
{
/* No corresponding operand for operator or invalid operator */
DtError (ASL_ERROR, ASL_MSG_INVALID_EXPRESSION, Field, Field->Value);
return (0);
}
Value2 = DtResolveInteger (Field, IntegerString);
DbgPrint (ASL_DEBUG_OUTPUT, "Integer resolved to V2: %8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (Value2));
/* Perform the requested operation */
switch (*Operator)
{
case '-':
Value -= Value2;
break;
case '+':
Value += Value2;
break;
case '*':
Value *= Value2;
break;
case '|':
Value |= Value2;
break;
case '&':
Value &= Value2;
break;
case '^':
Value ^= Value2;
break;
case '/':
if (!Value2)
{
DtError (ASL_ERROR, ASL_MSG_DIVIDE_BY_ZERO, Field, Field->Value);
return (0);
}
Value /= Value2;
break;
case '%':
if (!Value2)
{
DtError (ASL_ERROR, ASL_MSG_DIVIDE_BY_ZERO, Field, Field->Value);
return (0);
}
Value %= Value2;
break;
default:
/* Unknown operator */
DtFatal (ASL_MSG_INVALID_EXPRESSION, Field, Field->Value);
break;
}
}
return (Value);
}
/******************************************************************************
*
* FUNCTION: DtResolveInteger
*
* PARAMETERS: Field - Field object with string to be resolved
* IntegerString - Integer to be resolved
*
* RETURN: A 64-bit integer value
*
* DESCRIPTION: Resolve a single integer string to a value. Supports both
* integer constants and labels.
*
* NOTE: References to labels must begin with a dollar sign ($)
*
*****************************************************************************/
static UINT64
DtResolveInteger (
DT_FIELD *Field,
char *IntegerString)
{
DT_FIELD *LabelField;
UINT64 Value = 0;
char *Message = NULL;
ACPI_STATUS Status;
DbgPrint (ASL_DEBUG_OUTPUT, "Resolve Integer: %s\n", IntegerString);
/* Resolve a label reference to an integer (table offset) */
if (*IntegerString == '$')
{
LabelField = DtLookupLabel (IntegerString);
if (!LabelField)
{
DtError (ASL_ERROR, ASL_MSG_UNKNOWN_LABEL, Field, IntegerString);
return (0);
}
/* All we need from the label is the offset in the table */
Value = LabelField->TableOffset;
return (Value);
}
/* Convert string to an actual integer */
Status = DtStrtoul64 (IntegerString, &Value);
if (ACPI_FAILURE (Status))
{
if (Status == AE_LIMIT)
{
Message = "Constant larger than 64 bits";
}
else if (Status == AE_BAD_CHARACTER)
{
Message = "Invalid character in constant";
}
DtError (ASL_ERROR, ASL_MSG_INVALID_HEX_INTEGER, Field, Message);
}
return (Value);
}
/******************************************************************************
*
* FUNCTION: DtDetectAllLabels
*
* PARAMETERS: FieldList - Field object at start of generic list
*
* RETURN: None
*
* DESCRIPTION: Detect all labels in a list of "generic" opcodes (such as
* a UEFI table.) and insert them into the global label list.
*
*****************************************************************************/
void
DtDetectAllLabels (
DT_FIELD *FieldList)
{
ACPI_DMTABLE_INFO *Info;
DT_FIELD *GenericField;
UINT32 TableOffset;
TableOffset = Gbl_CurrentTableOffset;
GenericField = FieldList;
/*
* Process all "Label:" fields within the parse tree. We need
* to know the offsets for all labels before we can compile
* the parse tree in order to handle forward references. Traverse
* tree and get/set all field lengths of all operators in order to
* determine the label offsets.
*/
while (GenericField)
{
Info = DtGetGenericTableInfo (GenericField->Name);
if (Info)
{
/* Maintain table offsets */
GenericField->TableOffset = TableOffset;
TableOffset += DtGetFieldLength (GenericField, Info);
/* Insert all labels in the global label list */
if (Info->Opcode == ACPI_DMT_LABEL)
{
DtInsertLabelField (GenericField);
}
}
GenericField = GenericField->Next;
}
}
/******************************************************************************
*
* FUNCTION: DtInsertLabelField
*
* PARAMETERS: Field - Field object with Label to be inserted
*
* RETURN: None
*
* DESCRIPTION: Insert a label field into the global label list
*
*****************************************************************************/
static void
DtInsertLabelField (
DT_FIELD *Field)
{
DbgPrint (ASL_DEBUG_OUTPUT,
"DtInsertLabelField: Found Label : %s at output table offset %X\n",
Field->Value, Field->TableOffset);
Field->NextLabel = Gbl_LabelList;
Gbl_LabelList = Field;
}
/******************************************************************************
*
* FUNCTION: DtLookupLabel
*
* PARAMETERS: Name - Label to be resolved
*
* RETURN: Field object associated with the label
*
* DESCRIPTION: Lookup a label in the global label list. Used during the
* resolution of integer expressions.
*
*****************************************************************************/
static DT_FIELD *
DtLookupLabel (
char *Name)
{
DT_FIELD *LabelField;
/* Skip a leading $ */
if (*Name == '$')
{
Name++;
}
/* Search global list */
LabelField = Gbl_LabelList;
while (LabelField)
{
if (!ACPI_STRCMP (Name, LabelField->Value))
{
return (LabelField);
}
LabelField = LabelField->NextLabel;
}
return (NULL);
}

View File

@ -266,10 +266,12 @@ DtCompileUuid (
* PARAMETERS: Buffer - Output buffer
* Field - Field obj with Integer to be compiled
* ByteLength - Byte length of the integer
* Flags - Additional compile info
*
* RETURN: None
*
* DESCRIPTION: Compile an integer
* DESCRIPTION: Compile an integer. Supports integer expressions with C-style
* operators.
*
*****************************************************************************/
@ -280,15 +282,11 @@ DtCompileInteger (
UINT32 ByteLength,
UINT8 Flags)
{
UINT64 Value = 0;
UINT64 Value;
UINT64 MaxValue;
UINT8 *Hex;
char *Message = NULL;
ACPI_STATUS Status;
int i;
/* Byte length must be in range 1-8 */
/* Output buffer byte length must be in range 1-8 */
if ((ByteLength > 8) || (ByteLength == 0))
{
@ -297,23 +295,9 @@ DtCompileInteger (
return;
}
/* Convert string to an actual integer */
/* Resolve integer expression to a single integer value */
Status = DtStrtoul64 (Field->Value, &Value);
if (ACPI_FAILURE (Status))
{
if (Status == AE_LIMIT)
{
Message = "Constant larger than 64 bits";
}
else if (Status == AE_BAD_CHARACTER)
{
Message = "Invalid character in constant";
}
DtError (ASL_ERROR, ASL_MSG_INVALID_HEX_INTEGER, Field, Message);
goto Exit;
}
Value = DtResolveIntegerExpression (Field);
/* Ensure that reserved fields are set to zero */
/* TBD: should we set to zero, or just make this an ERROR? */
@ -344,29 +328,10 @@ DtCompileInteger (
if (Value > MaxValue)
{
sprintf (MsgBuffer, "Maximum %u bytes", ByteLength);
sprintf (MsgBuffer, "%8.8X%8.8X", ACPI_FORMAT_UINT64 (Value));
DtError (ASL_ERROR, ASL_MSG_INTEGER_SIZE, Field, MsgBuffer);
}
/*
* TBD: hard code for ASF! Capabilites field.
*
* This field is actually a buffer, not a 56-bit integer --
* so, the ordering is reversed. Something should be fixed
* so we don't need this code.
*/
if (ByteLength == 7)
{
Hex = ACPI_CAST_PTR (UINT8, &Value);
for (i = 6; i >= 0; i--)
{
Buffer[i] = *Hex;
Hex++;
}
return;
}
Exit:
ACPI_MEMCPY (Buffer, &Value, ByteLength);
return;
}

View File

@ -66,7 +66,7 @@ DtParseLine (
UINT32 Line,
UINT32 Offset);
static UINT32
UINT32
DtGetNextLine (
FILE *Handle);
@ -80,8 +80,10 @@ static void
DtDumpBuffer (
UINT32 FileId,
UINT8 *Buffer,
UINT32 Offset,
UINT32 Length);
/* States for DtGetNextLine */
#define DT_NORMAL_TEXT 0
@ -324,7 +326,7 @@ DtParseLine (
if (*End == '"')
{
End++;
while (*End && *End != '"')
while (*End && (*End != '"'))
{
End++;
}
@ -333,9 +335,16 @@ DtParseLine (
break;
}
/*
* Special "comment" fields at line end, ignore them.
* Note: normal slash-slash and slash-asterisk comments are
* stripped already by the DtGetNextLine parser.
*
* TBD: Perhaps DtGetNextLine should parse the following type
* of comments also.
*/
if (*End == '(' ||
*End == '<' ||
*End == '/')
*End == '<')
{
break;
}
@ -385,7 +394,7 @@ DtParseLine (
*
*****************************************************************************/
static UINT32
UINT32
DtGetNextLine (
FILE *Handle)
{
@ -400,6 +409,19 @@ DtGetNextLine (
c = (char) getc (Handle);
if (c == EOF)
{
switch (State)
{
case DT_START_QUOTED_STRING:
case DT_SLASH_ASTERISK_COMMENT:
case DT_SLASH_SLASH_COMMENT:
AcpiOsPrintf ("**** EOF within comment/string %u\n", State);
break;
default:
break;
}
return (0);
}
@ -520,6 +542,16 @@ DtGetNextLine (
State = DT_NORMAL_TEXT;
break;
case '\n':
CurrentLineOffset = Gbl_NextLineOffset;
Gbl_NextLineOffset = (UINT32) ftell (Handle);
Gbl_CurrentLineNumber++;
break;
case '*':
/* Consume all adjacent asterisks */
break;
default:
State = DT_SLASH_ASTERISK_COMMENT;
break;
@ -653,6 +685,7 @@ DtOutputBinary (
*
* PARAMETERS: FileID - Where to write buffer data
* Buffer - Buffer to dump
* Offset - Offset in current table
* Length - Buffer Length
*
* RETURN: None
@ -667,6 +700,7 @@ static void
DtDumpBuffer (
UINT32 FileId,
UINT8 *Buffer,
UINT32 Offset,
UINT32 Length)
{
UINT32 i;
@ -674,12 +708,18 @@ DtDumpBuffer (
UINT8 BufChar;
FlPrintFile (FileId, "Output: [%3.3Xh %4.4d% 3d] ",
Offset, Offset, Length);
i = 0;
while (i < Length)
{
/* Print 16 hex chars */
if (i >= 16)
{
FlPrintFile (FileId, "%23s", "");
}
FlPrintFile (FileId, "Output: [%.3d] ", Length);
/* Print 16 hex chars */
for (j = 0; j < 16;)
{
@ -773,17 +813,9 @@ DtWriteFieldToListing (
FlPrintFile (ASL_FILE_LISTING_OUTPUT, "Parsed: %*s : %s\n",
Field->Column-4, Field->Name, Field->Value);
#if 0
/* TBD Dump the length and AML offset */
FlPrintFile (ASL_FILE_LISTING_OUTPUT,
"Output: Length %d(0x%X) Offset %d(0x%X)\n",
Field->Column-4, Field->Name, Field->Value);
#endif
/* Dump the hex data that will be output for this field */
DtDumpBuffer (ASL_FILE_LISTING_OUTPUT, Buffer, Length);
DtDumpBuffer (ASL_FILE_LISTING_OUTPUT, Buffer, Field->TableOffset, Length);
}

View File

@ -1278,7 +1278,7 @@ DtCompileSrat (
/******************************************************************************
*
* FUNCTION: DtTableInfoGeneric
* FUNCTION: DtGetGenericTableInfo
*
* PARAMETERS: Name - Generic type name
*
@ -1288,8 +1288,8 @@ DtCompileSrat (
*
*****************************************************************************/
static ACPI_DMTABLE_INFO *
DtTableInfoGeneric (
ACPI_DMTABLE_INFO *
DtGetGenericTableInfo (
char *Name)
{
ACPI_DMTABLE_INFO *Info;
@ -1346,6 +1346,8 @@ DtCompileUefi (
UINT16 *DataOffset;
/* Compile the predefined portion of the UEFI table */
Status = DtCompileTable (PFieldList, AcpiDmTableInfoUefi,
&Subtable, TRUE);
if (ACPI_FAILURE (Status))
@ -1359,9 +1361,21 @@ DtCompileUefi (
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
/*
* Compile the "generic" portion of the UEFI table. This
* part of the table is not predefined and any of the generic
* operators may be used.
*/
/* Find any and all labels in the entire generic portion */
DtDetectAllLabels (*PFieldList);
/* Now we can actually compile the parse tree */
while (*PFieldList)
{
Info = DtTableInfoGeneric ((*PFieldList)->Name);
Info = DtGetGenericTableInfo ((*PFieldList)->Name);
if (!Info)
{
sprintf (MsgBuffer, "Generic data type \"%s\" not found",

View File

@ -399,6 +399,7 @@ DtGetFieldType (
break;
case ACPI_DMT_BUFFER:
case ACPI_DMT_BUF7:
case ACPI_DMT_BUF16:
case ACPI_DMT_PCI_PATH:
Type = DT_FIELD_TYPE_BUFFER;
@ -421,6 +422,10 @@ DtGetFieldType (
Type = DT_FIELD_TYPE_DEVICE_PATH;
break;
case ACPI_DMT_LABEL:
Type = DT_FIELD_TYPE_LABEL;
break;
default:
Type = DT_FIELD_TYPE_INTEGER;
break;
@ -507,6 +512,7 @@ DtGetFieldLength (
case ACPI_DMT_FLAG7:
case ACPI_DMT_FLAGS0:
case ACPI_DMT_FLAGS2:
case ACPI_DMT_LABEL:
ByteLength = 0;
break;
@ -549,6 +555,7 @@ DtGetFieldLength (
break;
case ACPI_DMT_UINT56:
case ACPI_DMT_BUF7:
ByteLength = 7;
break;

File diff suppressed because it is too large Load Diff

View File

@ -887,5 +887,140 @@ AcpiDbDisplayGpes (
}
}
#endif /* ACPI_DEBUGGER */
/*******************************************************************************
*
* FUNCTION: AcpiDbDisplayHandlers
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Display the currently installed global handlers
*
******************************************************************************/
#define ACPI_PREDEFINED_PREFIX "%25s (%.2X) : "
#define ACPI_HANDLER_NAME_STRING "%30s : "
#define ACPI_HANDLER_PRESENT_STRING "%-9s (%p)\n"
#define ACPI_HANDLER_NOT_PRESENT_STRING "%-9s\n"
/* All predefined Space IDs */
static ACPI_ADR_SPACE_TYPE SpaceIdList[] =
{
ACPI_ADR_SPACE_SYSTEM_MEMORY,
ACPI_ADR_SPACE_SYSTEM_IO,
ACPI_ADR_SPACE_PCI_CONFIG,
ACPI_ADR_SPACE_EC,
ACPI_ADR_SPACE_SMBUS,
ACPI_ADR_SPACE_CMOS,
ACPI_ADR_SPACE_PCI_BAR_TARGET,
ACPI_ADR_SPACE_IPMI,
ACPI_ADR_SPACE_DATA_TABLE,
ACPI_ADR_SPACE_FIXED_HARDWARE
};
/* Global handler information */
typedef struct acpi_handler_info
{
void *Handler;
char *Name;
} ACPI_HANDLER_INFO;
ACPI_HANDLER_INFO HandlerList[] =
{
{&AcpiGbl_SystemNotify.Handler, "System Notifications"},
{&AcpiGbl_DeviceNotify.Handler, "Device Notifications"},
{&AcpiGbl_TableHandler, "ACPI Table Events"},
{&AcpiGbl_ExceptionHandler, "Control Method Exceptions"},
{&AcpiGbl_InterfaceHandler, "OSI Invocations"}
};
void
AcpiDbDisplayHandlers (
void)
{
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_OPERAND_OBJECT *HandlerObj;
ACPI_ADR_SPACE_TYPE SpaceId;
UINT32 i;
/* Operation region handlers */
AcpiOsPrintf ("\nOperation Region Handlers:\n");
ObjDesc = AcpiNsGetAttachedObject (AcpiGbl_RootNode);
if (ObjDesc)
{
for (i = 0; i < ACPI_ARRAY_LENGTH (SpaceIdList); i++)
{
SpaceId = SpaceIdList[i];
HandlerObj = ObjDesc->Device.Handler;
AcpiOsPrintf (ACPI_PREDEFINED_PREFIX,
AcpiUtGetRegionName ((UINT8) SpaceId), SpaceId);
while (HandlerObj)
{
if (i == HandlerObj->AddressSpace.SpaceId)
{
AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING,
(HandlerObj->AddressSpace.HandlerFlags &
ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User",
HandlerObj->AddressSpace.Handler);
goto FoundHandler;
}
HandlerObj = HandlerObj->AddressSpace.Next;
}
/* There is no handler for this SpaceId */
AcpiOsPrintf ("None\n");
FoundHandler:;
}
}
/* Fixed event handlers */
AcpiOsPrintf ("\nFixed Event Handlers:\n");
for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
{
AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, AcpiUtGetEventName (i), i);
if (AcpiGbl_FixedEventHandlers[i].Handler)
{
AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User",
AcpiGbl_FixedEventHandlers[i].Handler);
}
else
{
AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None");
}
}
/* Miscellaneous global handlers */
AcpiOsPrintf ("\nMiscellaneous Global Handlers:\n");
for (i = 0; i < ACPI_ARRAY_LENGTH (HandlerList); i++)
{
AcpiOsPrintf (ACPI_HANDLER_NAME_STRING, HandlerList[i].Name);
if (HandlerList[i].Handler)
{
AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User",
HandlerList[i].Handler);
}
else
{
AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None");
}
}
}
#endif /* ACPI_DEBUGGER */

View File

@ -73,7 +73,7 @@ AcpiDbSingleThread (
static void
AcpiDbDisplayHelp (
char *HelpType);
void);
/*
@ -104,6 +104,7 @@ enum AcpiExDebuggerCommands
CMD_GO,
CMD_GPE,
CMD_GPES,
CMD_HANDLERS,
CMD_HELP,
CMD_HELP2,
CMD_HISTORY,
@ -171,6 +172,7 @@ static const COMMAND_INFO AcpiGbl_DbCommands[] =
{"GO", 0},
{"GPE", 2},
{"GPES", 0},
{"HANDLERS", 0},
{"HELP", 0},
{"?", 0},
{"HISTORY", 0},
@ -216,7 +218,7 @@ static const COMMAND_INFO AcpiGbl_DbCommands[] =
*
* FUNCTION: AcpiDbDisplayHelp
*
* PARAMETERS: HelpType - Subcommand (optional)
* PARAMETERS: None
*
* RETURN: None
*
@ -226,120 +228,80 @@ static const COMMAND_INFO AcpiGbl_DbCommands[] =
static void
AcpiDbDisplayHelp (
char *HelpType)
void)
{
AcpiUtStrupr (HelpType);
AcpiOsPrintf ("\nGeneral-Purpose Commands:\n");
AcpiOsPrintf (" Allocations Display list of current memory allocations\n");
AcpiOsPrintf (" Dump <Address>|<Namepath>\n");
AcpiOsPrintf (" [Byte|Word|Dword|Qword] Display ACPI objects or memory\n");
AcpiOsPrintf (" EnableAcpi Enable ACPI (hardware) mode\n");
AcpiOsPrintf (" Handlers Info about global handlers\n");
AcpiOsPrintf (" Help This help screen\n");
AcpiOsPrintf (" History Display command history buffer\n");
AcpiOsPrintf (" Level [<DebugLevel>] [console] Get/Set debug level for file or console\n");
AcpiOsPrintf (" Locks Current status of internal mutexes\n");
AcpiOsPrintf (" Osi [Install|Remove <name>] Display or modify global _OSI list\n");
AcpiOsPrintf (" Quit or Exit Exit this command\n");
AcpiOsPrintf (" Stats [Allocations|Memory|Misc|\n");
AcpiOsPrintf (" Objects|Sizes|Stack|Tables] Display namespace and memory statistics\n");
AcpiOsPrintf (" Allocations Display list of current memory allocations\n");
AcpiOsPrintf (" Memory Dump internal memory lists\n");
AcpiOsPrintf (" Misc Namespace search and mutex stats\n");
AcpiOsPrintf (" Objects Summary of namespace objects\n");
AcpiOsPrintf (" Sizes Sizes for each of the internal objects\n");
AcpiOsPrintf (" Stack Display CPU stack usage\n");
AcpiOsPrintf (" Tables Info about current ACPI table(s)\n");
AcpiOsPrintf (" Tables Display info about loaded ACPI tables\n");
AcpiOsPrintf (" Unload <TableSig> [Instance] Unload an ACPI table\n");
AcpiOsPrintf (" ! <CommandNumber> Execute command from history buffer\n");
AcpiOsPrintf (" !! Execute last command again\n");
/* No parameter, just give the overview */
AcpiOsPrintf ("\nNamespace Access Commands:\n");
AcpiOsPrintf (" Businfo Display system bus info\n");
AcpiOsPrintf (" Disassemble <Method> Disassemble a control method\n");
AcpiOsPrintf (" Event <F|G> <Value> Generate AcpiEvent (Fixed/GPE)\n");
AcpiOsPrintf (" Find <AcpiName> (? is wildcard) Find ACPI name(s) with wildcards\n");
AcpiOsPrintf (" Gpe <GpeNum> <GpeBlock> Simulate a GPE\n");
AcpiOsPrintf (" Gpes Display info on all GPEs\n");
AcpiOsPrintf (" Integrity Validate namespace integrity\n");
AcpiOsPrintf (" Methods Display list of loaded control methods\n");
AcpiOsPrintf (" Namespace [Object] [Depth] Display loaded namespace tree/subtree\n");
AcpiOsPrintf (" Notify <Object> <Value> Send a notification on Object\n");
AcpiOsPrintf (" Objects <ObjectType> Display all objects of the given type\n");
AcpiOsPrintf (" Owner <OwnerId> [Depth] Display loaded namespace by object owner\n");
AcpiOsPrintf (" Predefined Check all predefined names\n");
AcpiOsPrintf (" Prefix [<NamePath>] Set or Get current execution prefix\n");
AcpiOsPrintf (" References <Addr> Find all references to object at addr\n");
AcpiOsPrintf (" Resources <Device> Get and display Device resources\n");
AcpiOsPrintf (" Set N <NamedObject> <Value> Set value for named integer\n");
AcpiOsPrintf (" Sleep <SleepState> Simulate sleep/wake sequence\n");
AcpiOsPrintf (" Terminate Delete namespace and all internal objects\n");
AcpiOsPrintf (" Type <Object> Display object type\n");
if (!HelpType)
{
AcpiOsPrintf ("ACPI CA Debugger Commands\n\n");
AcpiOsPrintf ("The following classes of commands are available. Help is available for\n");
AcpiOsPrintf ("each class by entering \"Help <ClassName>\"\n\n");
AcpiOsPrintf (" [GENERAL] General-Purpose Commands\n");
AcpiOsPrintf (" [NAMESPACE] Namespace Access Commands\n");
AcpiOsPrintf (" [METHOD] Control Method Execution Commands\n");
AcpiOsPrintf (" [STATISTICS] Statistical Information\n");
AcpiOsPrintf (" [FILE] File I/O Commands\n");
return;
}
AcpiOsPrintf ("\nControl Method Execution Commands:\n");
AcpiOsPrintf (" Arguments (or Args) Display method arguments\n");
AcpiOsPrintf (" Breakpoint <AmlOffset> Set an AML execution breakpoint\n");
AcpiOsPrintf (" Call Run to next control method invocation\n");
AcpiOsPrintf (" Debug <Namepath> [Arguments] Single Step a control method\n");
AcpiOsPrintf (" Execute <Namepath> [Arguments] Execute control method\n");
AcpiOsPrintf (" Go Allow method to run to completion\n");
AcpiOsPrintf (" Information Display info about the current method\n");
AcpiOsPrintf (" Into Step into (not over) a method call\n");
AcpiOsPrintf (" List [# of Aml Opcodes] Display method ASL statements\n");
AcpiOsPrintf (" Locals Display method local variables\n");
AcpiOsPrintf (" Results Display method result stack\n");
AcpiOsPrintf (" Set <A|L> <#> <Value> Set method data (Arguments/Locals)\n");
AcpiOsPrintf (" Stop Terminate control method\n");
AcpiOsPrintf (" Thread <Threads><Loops><NamePath> Spawn threads to execute method(s)\n");
AcpiOsPrintf (" Trace <method name> Trace method execution\n");
AcpiOsPrintf (" Tree Display control method calling tree\n");
AcpiOsPrintf (" <Enter> Single step next AML opcode (over calls)\n");
/*
* Parameter is the command class
*
* The idea here is to keep each class of commands smaller than a screenful
*/
switch (HelpType[0])
{
case 'G':
AcpiOsPrintf ("\nGeneral-Purpose Commands\n\n");
AcpiOsPrintf ("Allocations Display list of current memory allocations\n");
AcpiOsPrintf ("Dump <Address>|<Namepath>\n");
AcpiOsPrintf (" [Byte|Word|Dword|Qword] Display ACPI objects or memory\n");
AcpiOsPrintf ("EnableAcpi Enable ACPI (hardware) mode\n");
AcpiOsPrintf ("Help This help screen\n");
AcpiOsPrintf ("History Display command history buffer\n");
AcpiOsPrintf ("Level [<DebugLevel>] [console] Get/Set debug level for file or console\n");
AcpiOsPrintf ("Locks Current status of internal mutexes\n");
AcpiOsPrintf ("Osi [Install|Remove <name>] Display or modify global _OSI list\n");
AcpiOsPrintf ("Quit or Exit Exit this command\n");
AcpiOsPrintf ("Stats [Allocations|Memory|Misc\n");
AcpiOsPrintf (" |Objects|Sizes|Stack|Tables] Display namespace and memory statistics\n");
AcpiOsPrintf ("Tables Display info about loaded ACPI tables\n");
AcpiOsPrintf ("Unload <TableSig> [Instance] Unload an ACPI table\n");
AcpiOsPrintf ("! <CommandNumber> Execute command from history buffer\n");
AcpiOsPrintf ("!! Execute last command again\n");
return;
case 'S':
AcpiOsPrintf ("\nStats Subcommands\n\n");
AcpiOsPrintf ("Allocations Display list of current memory allocations\n");
AcpiOsPrintf ("Memory Dump internal memory lists\n");
AcpiOsPrintf ("Misc Namespace search and mutex stats\n");
AcpiOsPrintf ("Objects Summary of namespace objects\n");
AcpiOsPrintf ("Sizes Sizes for each of the internal objects\n");
AcpiOsPrintf ("Stack Display CPU stack usage\n");
AcpiOsPrintf ("Tables Info about current ACPI table(s)\n");
return;
case 'N':
AcpiOsPrintf ("\nNamespace Access Commands\n\n");
AcpiOsPrintf ("Businfo Display system bus info\n");
AcpiOsPrintf ("Disassemble <Method> Disassemble a control method\n");
AcpiOsPrintf ("Event <F|G> <Value> Generate AcpiEvent (Fixed/GPE)\n");
AcpiOsPrintf ("Find <AcpiName> (? is wildcard) Find ACPI name(s) with wildcards\n");
AcpiOsPrintf ("Gpe <GpeNum> <GpeBlock> Simulate a GPE\n");
AcpiOsPrintf ("Gpes Display info on all GPEs\n");
AcpiOsPrintf ("Integrity Validate namespace integrity\n");
AcpiOsPrintf ("Methods Display list of loaded control methods\n");
AcpiOsPrintf ("Namespace [Object] [Depth] Display loaded namespace tree/subtree\n");
AcpiOsPrintf ("Notify <Object> <Value> Send a notification on Object\n");
AcpiOsPrintf ("Objects <ObjectType> Display all objects of the given type\n");
AcpiOsPrintf ("Owner <OwnerId> [Depth] Display loaded namespace by object owner\n");
AcpiOsPrintf ("Predefined Check all predefined names\n");
AcpiOsPrintf ("Prefix [<NamePath>] Set or Get current execution prefix\n");
AcpiOsPrintf ("References <Addr> Find all references to object at addr\n");
AcpiOsPrintf ("Resources <Device> Get and display Device resources\n");
AcpiOsPrintf ("Set N <NamedObject> <Value> Set value for named integer\n");
AcpiOsPrintf ("Sleep <SleepState> Simulate sleep/wake sequence\n");
AcpiOsPrintf ("Terminate Delete namespace and all internal objects\n");
AcpiOsPrintf ("Type <Object> Display object type\n");
return;
case 'M':
AcpiOsPrintf ("\nControl Method Execution Commands\n\n");
AcpiOsPrintf ("Arguments (or Args) Display method arguments\n");
AcpiOsPrintf ("Breakpoint <AmlOffset> Set an AML execution breakpoint\n");
AcpiOsPrintf ("Call Run to next control method invocation\n");
AcpiOsPrintf ("Debug <Namepath> [Arguments] Single Step a control method\n");
AcpiOsPrintf ("Execute <Namepath> [Arguments] Execute control method\n");
AcpiOsPrintf ("Go Allow method to run to completion\n");
AcpiOsPrintf ("Information Display info about the current method\n");
AcpiOsPrintf ("Into Step into (not over) a method call\n");
AcpiOsPrintf ("List [# of Aml Opcodes] Display method ASL statements\n");
AcpiOsPrintf ("Locals Display method local variables\n");
AcpiOsPrintf ("Results Display method result stack\n");
AcpiOsPrintf ("Set <A|L> <#> <Value> Set method data (Arguments/Locals)\n");
AcpiOsPrintf ("Stop Terminate control method\n");
AcpiOsPrintf ("Thread <Threads><Loops><NamePath> Spawn threads to execute method(s)\n");
AcpiOsPrintf ("Trace <method name> Trace method execution\n");
AcpiOsPrintf ("Tree Display control method calling tree\n");
AcpiOsPrintf ("<Enter> Single step next AML opcode (over calls)\n");
return;
case 'F':
AcpiOsPrintf ("\nFile I/O Commands\n\n");
AcpiOsPrintf ("Close Close debug output file\n");
AcpiOsPrintf ("Open <Output Filename> Open a file for debug output\n");
AcpiOsPrintf ("Load <Input Filename> Load ACPI table from a file\n");
return;
default:
AcpiOsPrintf ("Unrecognized Command Class: %s\n", HelpType);
return;
}
AcpiOsPrintf ("\nFile I/O Commands:\n");
AcpiOsPrintf (" Close Close debug output file\n");
AcpiOsPrintf (" Load <Input Filename> Load ACPI table from a file\n");
AcpiOsPrintf (" Open <Output Filename> Open a file for debug output\n");
}
@ -658,9 +620,13 @@ AcpiDbCommandDispatch (
AcpiDbDisplayGpes ();
break;
case CMD_HANDLERS:
AcpiDbDisplayHandlers ();
break;
case CMD_HELP:
case CMD_HELP2:
AcpiDbDisplayHelp (AcpiGbl_DbArgs[1]);
AcpiDbDisplayHelp ();
break;
case CMD_HISTORY:

525
debugger/dbmethod.c Normal file
View File

@ -0,0 +1,525 @@
/*******************************************************************************
*
* Module Name: dbmethod - Debug commands for control methods
*
******************************************************************************/
/*
* Copyright (C) 2000 - 2011, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#include "acpi.h"
#include "accommon.h"
#include "acdispat.h"
#include "acnamesp.h"
#include "acdebug.h"
#include "acdisasm.h"
#include "acparser.h"
#ifdef ACPI_DEBUGGER
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME ("dbmethod")
/* Local prototypes */
static ACPI_STATUS
AcpiDbWalkForExecute (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
void *Context,
void **ReturnValue);
/*******************************************************************************
*
* FUNCTION: AcpiDbSetMethodBreakpoint
*
* PARAMETERS: Location - AML offset of breakpoint
* WalkState - Current walk info
* Op - Current Op (from parse walk)
*
* RETURN: None
*
* DESCRIPTION: Set a breakpoint in a control method at the specified
* AML offset
*
******************************************************************************/
void
AcpiDbSetMethodBreakpoint (
char *Location,
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op)
{
UINT32 Address;
if (!Op)
{
AcpiOsPrintf ("There is no method currently executing\n");
return;
}
/* Get and verify the breakpoint address */
Address = ACPI_STRTOUL (Location, NULL, 16);
if (Address <= Op->Common.AmlOffset)
{
AcpiOsPrintf ("Breakpoint %X is beyond current address %X\n",
Address, Op->Common.AmlOffset);
}
/* Save breakpoint in current walk */
WalkState->UserBreakpoint = Address;
AcpiOsPrintf ("Breakpoint set at AML offset %X\n", Address);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbSetMethodCallBreakpoint
*
* PARAMETERS: Op - Current Op (from parse walk)
*
* RETURN: None
*
* DESCRIPTION: Set a breakpoint in a control method at the specified
* AML offset
*
******************************************************************************/
void
AcpiDbSetMethodCallBreakpoint (
ACPI_PARSE_OBJECT *Op)
{
if (!Op)
{
AcpiOsPrintf ("There is no method currently executing\n");
return;
}
AcpiGbl_StepToNextCall = TRUE;
}
/*******************************************************************************
*
* FUNCTION: AcpiDbSetMethodData
*
* PARAMETERS: TypeArg - L for local, A for argument
* IndexArg - which one
* ValueArg - Value to set.
*
* RETURN: None
*
* DESCRIPTION: Set a local or argument for the running control method.
* NOTE: only object supported is Number.
*
******************************************************************************/
void
AcpiDbSetMethodData (
char *TypeArg,
char *IndexArg,
char *ValueArg)
{
char Type;
UINT32 Index;
UINT32 Value;
ACPI_WALK_STATE *WalkState;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *Node;
/* Validate TypeArg */
AcpiUtStrupr (TypeArg);
Type = TypeArg[0];
if ((Type != 'L') &&
(Type != 'A') &&
(Type != 'N'))
{
AcpiOsPrintf ("Invalid SET operand: %s\n", TypeArg);
return;
}
Value = ACPI_STRTOUL (ValueArg, NULL, 16);
if (Type == 'N')
{
Node = AcpiDbConvertToNode (IndexArg);
if (Node->Type != ACPI_TYPE_INTEGER)
{
AcpiOsPrintf ("Can only set Integer nodes\n");
return;
}
ObjDesc = Node->Object;
ObjDesc->Integer.Value = Value;
return;
}
/* Get the index and value */
Index = ACPI_STRTOUL (IndexArg, NULL, 16);
WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
if (!WalkState)
{
AcpiOsPrintf ("There is no method currently executing\n");
return;
}
/* Create and initialize the new object */
ObjDesc = AcpiUtCreateIntegerObject ((UINT64) Value);
if (!ObjDesc)
{
AcpiOsPrintf ("Could not create an internal object\n");
return;
}
/* Store the new object into the target */
switch (Type)
{
case 'A':
/* Set a method argument */
if (Index > ACPI_METHOD_MAX_ARG)
{
AcpiOsPrintf ("Arg%u - Invalid argument name\n", Index);
goto Cleanup;
}
Status = AcpiDsStoreObjectToLocal (ACPI_REFCLASS_ARG, Index, ObjDesc,
WalkState);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
ObjDesc = WalkState->Arguments[Index].Object;
AcpiOsPrintf ("Arg%u: ", Index);
AcpiDmDisplayInternalObject (ObjDesc, WalkState);
break;
case 'L':
/* Set a method local */
if (Index > ACPI_METHOD_MAX_LOCAL)
{
AcpiOsPrintf ("Local%u - Invalid local variable name\n", Index);
goto Cleanup;
}
Status = AcpiDsStoreObjectToLocal (ACPI_REFCLASS_LOCAL, Index, ObjDesc,
WalkState);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
ObjDesc = WalkState->LocalVariables[Index].Object;
AcpiOsPrintf ("Local%u: ", Index);
AcpiDmDisplayInternalObject (ObjDesc, WalkState);
break;
default:
break;
}
Cleanup:
AcpiUtRemoveReference (ObjDesc);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDisassembleAml
*
* PARAMETERS: Statements - Number of statements to disassemble
* Op - Current Op (from parse walk)
*
* RETURN: None
*
* DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number
* of statements specified.
*
******************************************************************************/
void
AcpiDbDisassembleAml (
char *Statements,
ACPI_PARSE_OBJECT *Op)
{
UINT32 NumStatements = 8;
if (!Op)
{
AcpiOsPrintf ("There is no method currently executing\n");
return;
}
if (Statements)
{
NumStatements = ACPI_STRTOUL (Statements, NULL, 0);
}
AcpiDmDisassemble (NULL, Op, NumStatements);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDisassembleMethod
*
* PARAMETERS: Name - Name of control method
*
* RETURN: None
*
* DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number
* of statements specified.
*
******************************************************************************/
ACPI_STATUS
AcpiDbDisassembleMethod (
char *Name)
{
ACPI_STATUS Status;
ACPI_PARSE_OBJECT *Op;
ACPI_WALK_STATE *WalkState;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_NAMESPACE_NODE *Method;
Method = AcpiDbConvertToNode (Name);
if (!Method)
{
return (AE_BAD_PARAMETER);
}
ObjDesc = Method->Object;
Op = AcpiPsCreateScopeOp ();
if (!Op)
{
return (AE_NO_MEMORY);
}
/* Create and initialize a new walk state */
WalkState = AcpiDsCreateWalkState (0, Op, NULL, NULL);
if (!WalkState)
{
return (AE_NO_MEMORY);
}
Status = AcpiDsInitAmlWalk (WalkState, Op, NULL,
ObjDesc->Method.AmlStart,
ObjDesc->Method.AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
if (ACPI_FAILURE (Status))
{
return (Status);
}
/* Parse the AML */
WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE;
WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
Status = AcpiPsParseAml (WalkState);
AcpiDmDisassemble (NULL, Op, 0);
AcpiPsDeleteParseTree (Op);
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbWalkForExecute
*
* PARAMETERS: Callback from WalkNamespace
*
* RETURN: Status
*
* DESCRIPTION: Batch execution module. Currently only executes predefined
* ACPI names.
*
******************************************************************************/
static ACPI_STATUS
AcpiDbWalkForExecute (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
void *Context,
void **ReturnValue)
{
ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
ACPI_EXECUTE_WALK *Info = (ACPI_EXECUTE_WALK *) Context;
ACPI_BUFFER ReturnObj;
ACPI_STATUS Status;
char *Pathname;
UINT32 i;
ACPI_DEVICE_INFO *ObjInfo;
ACPI_OBJECT_LIST ParamObjects;
ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS];
const ACPI_PREDEFINED_INFO *Predefined;
Predefined = AcpiNsCheckForPredefinedName (Node);
if (!Predefined)
{
return (AE_OK);
}
if (Node->Type == ACPI_TYPE_LOCAL_SCOPE)
{
return (AE_OK);
}
Pathname = AcpiNsGetExternalPathname (Node);
if (!Pathname)
{
return (AE_OK);
}
/* Get the object info for number of method parameters */
Status = AcpiGetObjectInfo (ObjHandle, &ObjInfo);
if (ACPI_FAILURE (Status))
{
return (Status);
}
ParamObjects.Pointer = NULL;
ParamObjects.Count = 0;
if (ObjInfo->Type == ACPI_TYPE_METHOD)
{
/* Setup default parameters */
for (i = 0; i < ObjInfo->ParamCount; i++)
{
Params[i].Type = ACPI_TYPE_INTEGER;
Params[i].Integer.Value = 1;
}
ParamObjects.Pointer = Params;
ParamObjects.Count = ObjInfo->ParamCount;
}
ACPI_FREE (ObjInfo);
ReturnObj.Pointer = NULL;
ReturnObj.Length = ACPI_ALLOCATE_BUFFER;
/* Do the actual method execution */
AcpiGbl_MethodExecuting = TRUE;
Status = AcpiEvaluateObject (Node, NULL, &ParamObjects, &ReturnObj);
AcpiOsPrintf ("%-32s returned %s\n", Pathname, AcpiFormatException (Status));
AcpiGbl_MethodExecuting = FALSE;
ACPI_FREE (Pathname);
/* Ignore status from method execution */
Status = AE_OK;
/* Update count, check if we have executed enough methods */
Info->Count++;
if (Info->Count >= Info->MaxCount)
{
Status = AE_CTRL_TERMINATE;
}
return (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbBatchExecute
*
* PARAMETERS: CountArg - Max number of methods to execute
*
* RETURN: None
*
* DESCRIPTION: Namespace batch execution. Execute predefined names in the
* namespace, up to the max count, if specified.
*
******************************************************************************/
void
AcpiDbBatchExecute (
char *CountArg)
{
ACPI_EXECUTE_WALK Info;
Info.Count = 0;
Info.MaxCount = ACPI_UINT32_MAX;
if (CountArg)
{
Info.MaxCount = ACPI_STRTOUL (CountArg, NULL, 0);
}
/* Search all nodes in namespace */
(void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
AcpiDbWalkForExecute, NULL, (void *) &Info, NULL);
AcpiOsPrintf ("Executed %u predefined names in the namespace\n", Info.Count);
}
#endif /* ACPI_DEBUGGER */

934
debugger/dbnames.c Normal file
View File

@ -0,0 +1,934 @@
/*******************************************************************************
*
* Module Name: dbnames - Debugger commands for the acpi namespace
*
******************************************************************************/
/*
* Copyright (C) 2000 - 2011, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
#include "acdebug.h"
#ifdef ACPI_DEBUGGER
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME ("dbnames")
/* Local prototypes */
static ACPI_STATUS
AcpiDbWalkAndMatchName (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
void *Context,
void **ReturnValue);
static ACPI_STATUS
AcpiDbWalkForPredefinedNames (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
void *Context,
void **ReturnValue);
static ACPI_STATUS
AcpiDbWalkForSpecificObjects (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
void *Context,
void **ReturnValue);
static ACPI_STATUS
AcpiDbIntegrityWalk (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
void *Context,
void **ReturnValue);
static ACPI_STATUS
AcpiDbWalkForReferences (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
void *Context,
void **ReturnValue);
static ACPI_STATUS
AcpiDbBusWalk (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
void *Context,
void **ReturnValue);
/*
* Arguments for the Objects command
* These object types map directly to the ACPI_TYPES
*/
static ARGUMENT_INFO AcpiDbObjectTypes [] =
{
{"ANY"},
{"INTEGERS"},
{"STRINGS"},
{"BUFFERS"},
{"PACKAGES"},
{"FIELDS"},
{"DEVICES"},
{"EVENTS"},
{"METHODS"},
{"MUTEXES"},
{"REGIONS"},
{"POWERRESOURCES"},
{"PROCESSORS"},
{"THERMALZONES"},
{"BUFFERFIELDS"},
{"DDBHANDLES"},
{"DEBUG"},
{"REGIONFIELDS"},
{"BANKFIELDS"},
{"INDEXFIELDS"},
{"REFERENCES"},
{"ALIAS"},
{NULL} /* Must be null terminated */
};
/*******************************************************************************
*
* FUNCTION: AcpiDbSetScope
*
* PARAMETERS: Name - New scope path
*
* RETURN: Status
*
* DESCRIPTION: Set the "current scope" as maintained by this utility.
* The scope is used as a prefix to ACPI paths.
*
******************************************************************************/
void
AcpiDbSetScope (
char *Name)
{
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *Node;
if (!Name || Name[0] == 0)
{
AcpiOsPrintf ("Current scope: %s\n", AcpiGbl_DbScopeBuf);
return;
}
AcpiDbPrepNamestring (Name);
if (Name[0] == '\\')
{
/* Validate new scope from the root */
Status = AcpiNsGetNode (AcpiGbl_RootNode, Name, ACPI_NS_NO_UPSEARCH,
&Node);
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
}
ACPI_STRCPY (AcpiGbl_DbScopeBuf, Name);
ACPI_STRCAT (AcpiGbl_DbScopeBuf, "\\");
}
else
{
/* Validate new scope relative to old scope */
Status = AcpiNsGetNode (AcpiGbl_DbScopeNode, Name, ACPI_NS_NO_UPSEARCH,
&Node);
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
}
ACPI_STRCAT (AcpiGbl_DbScopeBuf, Name);
ACPI_STRCAT (AcpiGbl_DbScopeBuf, "\\");
}
AcpiGbl_DbScopeNode = Node;
AcpiOsPrintf ("New scope: %s\n", AcpiGbl_DbScopeBuf);
return;
ErrorExit:
AcpiOsPrintf ("Could not attach scope: %s, %s\n",
Name, AcpiFormatException (Status));
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDumpNamespace
*
* PARAMETERS: StartArg - Node to begin namespace dump
* DepthArg - Maximum tree depth to be dumped
*
* RETURN: None
*
* DESCRIPTION: Dump entire namespace or a subtree. Each node is displayed
* with type and other information.
*
******************************************************************************/
void
AcpiDbDumpNamespace (
char *StartArg,
char *DepthArg)
{
ACPI_HANDLE SubtreeEntry = AcpiGbl_RootNode;
UINT32 MaxDepth = ACPI_UINT32_MAX;
/* No argument given, just start at the root and dump entire namespace */
if (StartArg)
{
SubtreeEntry = AcpiDbConvertToNode (StartArg);
if (!SubtreeEntry)
{
return;
}
/* Now we can check for the depth argument */
if (DepthArg)
{
MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0);
}
}
AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
AcpiOsPrintf ("ACPI Namespace (from %4.4s (%p) subtree):\n",
((ACPI_NAMESPACE_NODE *) SubtreeEntry)->Name.Ascii, SubtreeEntry);
/* Display the subtree */
AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth,
ACPI_OWNER_ID_MAX, SubtreeEntry);
AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDumpNamespaceByOwner
*
* PARAMETERS: OwnerArg - Owner ID whose nodes will be displayed
* DepthArg - Maximum tree depth to be dumped
*
* RETURN: None
*
* DESCRIPTION: Dump elements of the namespace that are owned by the OwnerId.
*
******************************************************************************/
void
AcpiDbDumpNamespaceByOwner (
char *OwnerArg,
char *DepthArg)
{
ACPI_HANDLE SubtreeEntry = AcpiGbl_RootNode;
UINT32 MaxDepth = ACPI_UINT32_MAX;
ACPI_OWNER_ID OwnerId;
OwnerId = (ACPI_OWNER_ID) ACPI_STRTOUL (OwnerArg, NULL, 0);
/* Now we can check for the depth argument */
if (DepthArg)
{
MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0);
}
AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
AcpiOsPrintf ("ACPI Namespace by owner %X:\n", OwnerId);
/* Display the subtree */
AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth, OwnerId,
SubtreeEntry);
AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbWalkAndMatchName
*
* PARAMETERS: Callback from WalkNamespace
*
* RETURN: Status
*
* DESCRIPTION: Find a particular name/names within the namespace. Wildcards
* are supported -- '?' matches any character.
*
******************************************************************************/
static ACPI_STATUS
AcpiDbWalkAndMatchName (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
void *Context,
void **ReturnValue)
{
ACPI_STATUS Status;
char *RequestedName = (char *) Context;
UINT32 i;
ACPI_BUFFER Buffer;
ACPI_WALK_INFO Info;
/* Check for a name match */
for (i = 0; i < 4; i++)
{
/* Wildcard support */
if ((RequestedName[i] != '?') &&
(RequestedName[i] != ((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Ascii[i]))
{
/* No match, just exit */
return (AE_OK);
}
}
/* Get the full pathname to this object */
Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
}
else
{
Info.OwnerId = ACPI_OWNER_ID_MAX;
Info.DebugLevel = ACPI_UINT32_MAX;
Info.DisplayType = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT;
AcpiOsPrintf ("%32s", (char *) Buffer.Pointer);
(void) AcpiNsDumpOneObject (ObjHandle, NestingLevel, &Info, NULL);
ACPI_FREE (Buffer.Pointer);
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbFindNameInNamespace
*
* PARAMETERS: NameArg - The 4-character ACPI name to find.
* wildcards are supported.
*
* RETURN: None
*
* DESCRIPTION: Search the namespace for a given name (with wildcards)
*
******************************************************************************/
ACPI_STATUS
AcpiDbFindNameInNamespace (
char *NameArg)
{
char AcpiName[5] = "____";
char *AcpiNamePtr = AcpiName;
if (ACPI_STRLEN (NameArg) > 4)
{
AcpiOsPrintf ("Name must be no longer than 4 characters\n");
return (AE_OK);
}
/* Pad out name with underscores as necessary to create a 4-char name */
AcpiUtStrupr (NameArg);
while (*NameArg)
{
*AcpiNamePtr = *NameArg;
AcpiNamePtr++;
NameArg++;
}
/* Walk the namespace from the root */
(void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
AcpiDbWalkAndMatchName, NULL, AcpiName, NULL);
AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbWalkForPredefinedNames
*
* PARAMETERS: Callback from WalkNamespace
*
* RETURN: Status
*
* DESCRIPTION: Detect and display predefined ACPI names (names that start with
* an underscore)
*
******************************************************************************/
static ACPI_STATUS
AcpiDbWalkForPredefinedNames (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
void *Context,
void **ReturnValue)
{
ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
UINT32 *Count = (UINT32 *) Context;
const ACPI_PREDEFINED_INFO *Predefined;
const ACPI_PREDEFINED_INFO *Package = NULL;
char *Pathname;
Predefined = AcpiNsCheckForPredefinedName (Node);
if (!Predefined)
{
return (AE_OK);
}
Pathname = AcpiNsGetExternalPathname (Node);
if (!Pathname)
{
return (AE_OK);
}
/* If method returns a package, the info is in the next table entry */
if (Predefined->Info.ExpectedBtypes & ACPI_BTYPE_PACKAGE)
{
Package = Predefined + 1;
}
AcpiOsPrintf ("%-32s arg %X ret %2.2X", Pathname,
Predefined->Info.ParamCount, Predefined->Info.ExpectedBtypes);
if (Package)
{
AcpiOsPrintf (" PkgType %2.2X ObjType %2.2X Count %2.2X",
Package->RetInfo.Type, Package->RetInfo.ObjectType1,
Package->RetInfo.Count1);
}
AcpiOsPrintf("\n");
AcpiNsCheckParameterCount (Pathname, Node, ACPI_UINT32_MAX, Predefined);
ACPI_FREE (Pathname);
(*Count)++;
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbCheckPredefinedNames
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Validate all predefined names in the namespace
*
******************************************************************************/
void
AcpiDbCheckPredefinedNames (
void)
{
UINT32 Count = 0;
/* Search all nodes in namespace */
(void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
AcpiDbWalkForPredefinedNames, NULL, (void *) &Count, NULL);
AcpiOsPrintf ("Found %u predefined names in the namespace\n", Count);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbWalkForSpecificObjects
*
* PARAMETERS: Callback from WalkNamespace
*
* RETURN: Status
*
* DESCRIPTION: Display short info about objects in the namespace
*
******************************************************************************/
static ACPI_STATUS
AcpiDbWalkForSpecificObjects (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
void *Context,
void **ReturnValue)
{
ACPI_WALK_INFO *Info = (ACPI_WALK_INFO *) Context;
ACPI_BUFFER Buffer;
ACPI_STATUS Status;
Info->Count++;
/* Get and display the full pathname to this object */
Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
return (AE_OK);
}
AcpiOsPrintf ("%32s", (char *) Buffer.Pointer);
ACPI_FREE (Buffer.Pointer);
/* Dump short info about the object */
(void) AcpiNsDumpOneObject (ObjHandle, NestingLevel, Info, NULL);
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDisplayObjects
*
* PARAMETERS: ObjTypeArg - Type of object to display
* DisplayCountArg - Max depth to display
*
* RETURN: None
*
* DESCRIPTION: Display objects in the namespace of the requested type
*
******************************************************************************/
ACPI_STATUS
AcpiDbDisplayObjects (
char *ObjTypeArg,
char *DisplayCountArg)
{
ACPI_WALK_INFO Info;
ACPI_OBJECT_TYPE Type;
/* Get the object type */
Type = AcpiDbMatchArgument (ObjTypeArg, AcpiDbObjectTypes);
if (Type == ACPI_TYPE_NOT_FOUND)
{
AcpiOsPrintf ("Invalid or unsupported argument\n");
return (AE_OK);
}
AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
AcpiOsPrintf (
"Objects of type [%s] defined in the current ACPI Namespace:\n",
AcpiUtGetTypeName (Type));
AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
Info.Count = 0;
Info.OwnerId = ACPI_OWNER_ID_MAX;
Info.DebugLevel = ACPI_UINT32_MAX;
Info.DisplayType = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT;
/* Walk the namespace from the root */
(void) AcpiWalkNamespace (Type, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
AcpiDbWalkForSpecificObjects, NULL, (void *) &Info, NULL);
AcpiOsPrintf (
"\nFound %u objects of type [%s] in the current ACPI Namespace\n",
Info.Count, AcpiUtGetTypeName (Type));
AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbIntegrityWalk
*
* PARAMETERS: Callback from WalkNamespace
*
* RETURN: Status
*
* DESCRIPTION: Examine one NS node for valid values.
*
******************************************************************************/
static ACPI_STATUS
AcpiDbIntegrityWalk (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
void *Context,
void **ReturnValue)
{
ACPI_INTEGRITY_INFO *Info = (ACPI_INTEGRITY_INFO *) Context;
ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
ACPI_OPERAND_OBJECT *Object;
BOOLEAN Alias = TRUE;
Info->Nodes++;
/* Verify the NS node, and dereference aliases */
while (Alias)
{
if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
{
AcpiOsPrintf ("Invalid Descriptor Type for Node %p [%s] - is %2.2X should be %2.2X\n",
Node, AcpiUtGetDescriptorName (Node), ACPI_GET_DESCRIPTOR_TYPE (Node),
ACPI_DESC_TYPE_NAMED);
return (AE_OK);
}
if ((Node->Type == ACPI_TYPE_LOCAL_ALIAS) ||
(Node->Type == ACPI_TYPE_LOCAL_METHOD_ALIAS))
{
Node = (ACPI_NAMESPACE_NODE *) Node->Object;
}
else
{
Alias = FALSE;
}
}
if (Node->Type > ACPI_TYPE_LOCAL_MAX)
{
AcpiOsPrintf ("Invalid Object Type for Node %p, Type = %X\n",
Node, Node->Type);
return (AE_OK);
}
if (!AcpiUtValidAcpiName (Node->Name.Integer))
{
AcpiOsPrintf ("Invalid AcpiName for Node %p\n", Node);
return (AE_OK);
}
Object = AcpiNsGetAttachedObject (Node);
if (Object)
{
Info->Objects++;
if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND)
{
AcpiOsPrintf ("Invalid Descriptor Type for Object %p [%s]\n",
Object, AcpiUtGetDescriptorName (Object));
}
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbCheckIntegrity
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Check entire namespace for data structure integrity
*
******************************************************************************/
void
AcpiDbCheckIntegrity (
void)
{
ACPI_INTEGRITY_INFO Info = {0,0};
/* Search all nodes in namespace */
(void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
AcpiDbIntegrityWalk, NULL, (void *) &Info, NULL);
AcpiOsPrintf ("Verified %u namespace nodes with %u Objects\n",
Info.Nodes, Info.Objects);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbWalkForReferences
*
* PARAMETERS: Callback from WalkNamespace
*
* RETURN: Status
*
* DESCRIPTION: Check if this namespace object refers to the target object
* that is passed in as the context value.
*
* Note: Currently doesn't check subobjects within the Node's object
*
******************************************************************************/
static ACPI_STATUS
AcpiDbWalkForReferences (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
void *Context,
void **ReturnValue)
{
ACPI_OPERAND_OBJECT *ObjDesc = (ACPI_OPERAND_OBJECT *) Context;
ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
/* Check for match against the namespace node itself */
if (Node == (void *) ObjDesc)
{
AcpiOsPrintf ("Object is a Node [%4.4s]\n",
AcpiUtGetNodeName (Node));
}
/* Check for match against the object attached to the node */
if (AcpiNsGetAttachedObject (Node) == ObjDesc)
{
AcpiOsPrintf ("Reference at Node->Object %p [%4.4s]\n",
Node, AcpiUtGetNodeName (Node));
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbFindReferences
*
* PARAMETERS: ObjectArg - String with hex value of the object
*
* RETURN: None
*
* DESCRIPTION: Search namespace for all references to the input object
*
******************************************************************************/
void
AcpiDbFindReferences (
char *ObjectArg)
{
ACPI_OPERAND_OBJECT *ObjDesc;
/* Convert string to object pointer */
ObjDesc = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16));
/* Search all nodes in namespace */
(void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
AcpiDbWalkForReferences, NULL, (void *) ObjDesc, NULL);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbBusWalk
*
* PARAMETERS: Callback from WalkNamespace
*
* RETURN: Status
*
* DESCRIPTION: Display info about device objects that have a corresponding
* _PRT method.
*
******************************************************************************/
static ACPI_STATUS
AcpiDbBusWalk (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
void *Context,
void **ReturnValue)
{
ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
ACPI_STATUS Status;
ACPI_BUFFER Buffer;
ACPI_NAMESPACE_NODE *TempNode;
ACPI_DEVICE_INFO *Info;
UINT32 i;
if ((Node->Type != ACPI_TYPE_DEVICE) &&
(Node->Type != ACPI_TYPE_PROCESSOR))
{
return (AE_OK);
}
/* Exit if there is no _PRT under this device */
Status = AcpiGetHandle (Node, METHOD_NAME__PRT,
ACPI_CAST_PTR (ACPI_HANDLE, &TempNode));
if (ACPI_FAILURE (Status))
{
return (AE_OK);
}
/* Get the full path to this device object */
Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
return (AE_OK);
}
Status = AcpiGetObjectInfo (ObjHandle, &Info);
if (ACPI_FAILURE (Status))
{
return (AE_OK);
}
/* Display the full path */
AcpiOsPrintf ("%-32s Type %X", (char *) Buffer.Pointer, Node->Type);
ACPI_FREE (Buffer.Pointer);
if (Info->Flags & ACPI_PCI_ROOT_BRIDGE)
{
AcpiOsPrintf (" - Is PCI Root Bridge");
}
AcpiOsPrintf ("\n");
/* _PRT info */
AcpiOsPrintf ("_PRT: %p\n", TempNode);
/* Dump _ADR, _HID, _UID, _CID */
if (Info->Valid & ACPI_VALID_ADR)
{
AcpiOsPrintf ("_ADR: %8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Info->Address));
}
else
{
AcpiOsPrintf ("_ADR: <Not Present>\n");
}
if (Info->Valid & ACPI_VALID_HID)
{
AcpiOsPrintf ("_HID: %s\n", Info->HardwareId.String);
}
else
{
AcpiOsPrintf ("_HID: <Not Present>\n");
}
if (Info->Valid & ACPI_VALID_UID)
{
AcpiOsPrintf ("_UID: %s\n", Info->UniqueId.String);
}
else
{
AcpiOsPrintf ("_UID: <Not Present>\n");
}
if (Info->Valid & ACPI_VALID_CID)
{
for (i = 0; i < Info->CompatibleIdList.Count; i++)
{
AcpiOsPrintf ("_CID: %s\n",
Info->CompatibleIdList.Ids[i].String);
}
}
else
{
AcpiOsPrintf ("_CID: <Not Present>\n");
}
ACPI_FREE (Info);
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbGetBusInfo
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Display info about system busses.
*
******************************************************************************/
void
AcpiDbGetBusInfo (
void)
{
/* Search all nodes in namespace */
(void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
AcpiDbBusWalk, NULL, NULL, NULL);
}
#endif /* ACPI_DEBUGGER */

430
dispatcher/dsargs.c Normal file
View File

@ -0,0 +1,430 @@
/******************************************************************************
*
* Module Name: dsargs - Support for execution of dynamic arguments for static
* objects (regions, fields, buffer fields, etc.)
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2011, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#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);
}

424
dispatcher/dscontrol.c Normal file
View File

@ -0,0 +1,424 @@
/******************************************************************************
*
* Module Name: dscontrol - Support for execution control opcodes -
* if/else/while/return
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2011, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#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);
}

View File

@ -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
*
*****************************************************************************/
@ -59,13 +58,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,
@ -76,369 +68,6 @@ AcpiDsInitBufferField (
ACPI_OPERAND_OBJECT *ResultDesc);
/*******************************************************************************
*
* FUNCTION: AcpiDsExecuteArguments
*
* PARAMETERS: Node - Object NS node
* ScopeNode - Parent NS node
* AmlLength - Length of executable AML
* AmlStart - Pointer to the AML
*
* RETURN: Status.
*
* DESCRIPTION: Late (deferred) execution of region or field arguments
*
******************************************************************************/
static ACPI_STATUS
AcpiDsExecuteArguments (
ACPI_NAMESPACE_NODE *Node,
ACPI_NAMESPACE_NODE *ScopeNode,
UINT32 AmlLength,
UINT8 *AmlStart)
{
ACPI_STATUS Status;
ACPI_PARSE_OBJECT *Op;
ACPI_WALK_STATE *WalkState;
ACPI_FUNCTION_TRACE (DsExecuteArguments);
/*
* Allocate a new parser op to be the root of the parsed tree
*/
Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP);
if (!Op)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Save the Node for use in AcpiPsParseAml */
Op->Common.Node = ScopeNode;
/* Create and initialize a new parser state */
WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
if (!WalkState)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart,
AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
if (ACPI_FAILURE (Status))
{
AcpiDsDeleteWalkState (WalkState);
goto Cleanup;
}
/* Mark this parse as a deferred opcode */
WalkState->ParseFlags = ACPI_PARSE_DEFERRED_OP;
WalkState->DeferredNode = Node;
/* Pass1: Parse the entire declaration */
Status = AcpiPsParseAml (WalkState);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
/* Get and init the Op created above */
Op->Common.Node = Node;
AcpiPsDeleteParseTree (Op);
/* Evaluate the deferred arguments */
Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP);
if (!Op)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
Op->Common.Node = ScopeNode;
/* Create and initialize a new parser state */
WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
if (!WalkState)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
/* Execute the opcode and arguments */
Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart,
AmlLength, NULL, ACPI_IMODE_EXECUTE);
if (ACPI_FAILURE (Status))
{
AcpiDsDeleteWalkState (WalkState);
goto Cleanup;
}
/* Mark this execution as a deferred opcode */
WalkState->DeferredNode = Node;
Status = AcpiPsParseAml (WalkState);
Cleanup:
AcpiPsDeleteParseTree (Op);
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiDsGetBufferFieldArguments
*
* PARAMETERS: ObjDesc - A valid BufferField object
*
* RETURN: Status.
*
* DESCRIPTION: Get BufferField Buffer and Index. This implements the late
* evaluation of these field attributes.
*
******************************************************************************/
ACPI_STATUS
AcpiDsGetBufferFieldArguments (
ACPI_OPERAND_OBJECT *ObjDesc)
{
ACPI_OPERAND_OBJECT *ExtraDesc;
ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE_PTR (DsGetBufferFieldArguments, ObjDesc);
if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
{
return_ACPI_STATUS (AE_OK);
}
/* Get the AML pointer (method object) and BufferField node */
ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
Node = ObjDesc->BufferField.Node;
ACPI_DEBUG_EXEC(AcpiUtDisplayInitPathname (ACPI_TYPE_BUFFER_FIELD, Node, NULL));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BufferField Arg Init\n",
AcpiUtGetNodeName (Node)));
/* Execute the AML code for the TermArg arguments */
Status = AcpiDsExecuteArguments (Node, Node->Parent,
ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiDsGetBankFieldArguments
*
* PARAMETERS: ObjDesc - A valid BankField object
*
* RETURN: Status.
*
* DESCRIPTION: Get BankField BankValue. This implements the late
* evaluation of these field attributes.
*
******************************************************************************/
ACPI_STATUS
AcpiDsGetBankFieldArguments (
ACPI_OPERAND_OBJECT *ObjDesc)
{
ACPI_OPERAND_OBJECT *ExtraDesc;
ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE_PTR (DsGetBankFieldArguments, ObjDesc);
if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
{
return_ACPI_STATUS (AE_OK);
}
/* Get the AML pointer (method object) and BankField node */
ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
Node = ObjDesc->BankField.Node;
ACPI_DEBUG_EXEC(AcpiUtDisplayInitPathname (ACPI_TYPE_LOCAL_BANK_FIELD, Node, NULL));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BankField Arg Init\n",
AcpiUtGetNodeName (Node)));
/* Execute the AML code for the TermArg arguments */
Status = AcpiDsExecuteArguments (Node, Node->Parent,
ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiDsGetBufferArguments
*
* PARAMETERS: ObjDesc - A valid Buffer object
*
* RETURN: Status.
*
* DESCRIPTION: Get Buffer length and initializer byte list. This implements
* the late evaluation of these attributes.
*
******************************************************************************/
ACPI_STATUS
AcpiDsGetBufferArguments (
ACPI_OPERAND_OBJECT *ObjDesc)
{
ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE_PTR (DsGetBufferArguments, ObjDesc);
if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
{
return_ACPI_STATUS (AE_OK);
}
/* Get the Buffer node */
Node = ObjDesc->Buffer.Node;
if (!Node)
{
ACPI_ERROR ((AE_INFO,
"No pointer back to namespace node in buffer object %p", ObjDesc));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Buffer Arg Init\n"));
/* Execute the AML code for the TermArg arguments */
Status = AcpiDsExecuteArguments (Node, Node,
ObjDesc->Buffer.AmlLength, ObjDesc->Buffer.AmlStart);
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiDsGetPackageArguments
*
* PARAMETERS: ObjDesc - A valid Package object
*
* RETURN: Status.
*
* DESCRIPTION: Get Package length and initializer byte list. This implements
* the late evaluation of these attributes.
*
******************************************************************************/
ACPI_STATUS
AcpiDsGetPackageArguments (
ACPI_OPERAND_OBJECT *ObjDesc)
{
ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE_PTR (DsGetPackageArguments, ObjDesc);
if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
{
return_ACPI_STATUS (AE_OK);
}
/* Get the Package node */
Node = ObjDesc->Package.Node;
if (!Node)
{
ACPI_ERROR ((AE_INFO,
"No pointer back to namespace node in package %p", ObjDesc));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Package Arg Init\n"));
/* Execute the AML code for the TermArg arguments */
Status = AcpiDsExecuteArguments (Node, Node,
ObjDesc->Package.AmlLength, ObjDesc->Package.AmlStart);
return_ACPI_STATUS (Status);
}
/*****************************************************************************
*
* FUNCTION: AcpiDsGetRegionArguments
*
* PARAMETERS: ObjDesc - A valid region object
*
* RETURN: Status.
*
* DESCRIPTION: Get region address and length. This implements the late
* evaluation of these region attributes.
*
****************************************************************************/
ACPI_STATUS
AcpiDsGetRegionArguments (
ACPI_OPERAND_OBJECT *ObjDesc)
{
ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *ExtraDesc;
ACPI_FUNCTION_TRACE_PTR (DsGetRegionArguments, ObjDesc);
if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
{
return_ACPI_STATUS (AE_OK);
}
ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
if (!ExtraDesc)
{
return_ACPI_STATUS (AE_NOT_EXIST);
}
/* Get the Region node */
Node = ObjDesc->Region.Node;
ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_REGION, Node, NULL));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] OpRegion Arg Init at AML %p\n",
AcpiUtGetNodeName (Node), ExtraDesc->Extra.AmlStart));
/* Execute the argument AML */
Status = AcpiDsExecuteArguments (Node, Node->Parent,
ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiDsInitializeRegion
@ -870,8 +499,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.
*
******************************************************************************/
@ -1177,371 +807,3 @@ AcpiDsEvalBankFieldOperands (
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiDsExecBeginControlOp
*
* PARAMETERS: WalkList - The list that owns the walk stack
* Op - The control Op
*
* RETURN: Status
*
* DESCRIPTION: Handles all control ops encountered during control method
* execution.
*
******************************************************************************/
ACPI_STATUS
AcpiDsExecBeginControlOp (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op)
{
ACPI_STATUS Status = AE_OK;
ACPI_GENERIC_STATE *ControlState;
ACPI_FUNCTION_NAME (DsExecBeginControlOp);
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", Op,
Op->Common.AmlOpcode, WalkState));
switch (Op->Common.AmlOpcode)
{
case AML_WHILE_OP:
/*
* If this is an additional iteration of a while loop, continue.
* There is no need to allocate a new control state.
*/
if (WalkState->ControlState)
{
if (WalkState->ControlState->Control.AmlPredicateStart ==
(WalkState->ParserState.Aml - 1))
{
/* Reset the state to start-of-loop */
WalkState->ControlState->Common.State = ACPI_CONTROL_CONDITIONAL_EXECUTING;
break;
}
}
/*lint -fallthrough */
case AML_IF_OP:
/*
* IF/WHILE: Create a new control state to manage these
* constructs. We need to manage these as a stack, in order
* to handle nesting.
*/
ControlState = AcpiUtCreateControlState ();
if (!ControlState)
{
Status = AE_NO_MEMORY;
break;
}
/*
* Save a pointer to the predicate for multiple executions
* of a loop
*/
ControlState->Control.AmlPredicateStart = WalkState->ParserState.Aml - 1;
ControlState->Control.PackageEnd = WalkState->ParserState.PkgEnd;
ControlState->Control.Opcode = Op->Common.AmlOpcode;
/* Push the control state on this walk's control stack */
AcpiUtPushGenericState (&WalkState->ControlState, ControlState);
break;
case AML_ELSE_OP:
/* Predicate is in the state object */
/* If predicate is true, the IF was executed, ignore ELSE part */
if (WalkState->LastPredicate)
{
Status = AE_CTRL_TRUE;
}
break;
case AML_RETURN_OP:
break;
default:
break;
}
return (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiDsExecEndControlOp
*
* PARAMETERS: WalkList - The list that owns the walk stack
* Op - The control Op
*
* RETURN: Status
*
* DESCRIPTION: Handles all control ops encountered during control method
* execution.
*
******************************************************************************/
ACPI_STATUS
AcpiDsExecEndControlOp (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op)
{
ACPI_STATUS Status = AE_OK;
ACPI_GENERIC_STATE *ControlState;
ACPI_FUNCTION_NAME (DsExecEndControlOp);
switch (Op->Common.AmlOpcode)
{
case AML_IF_OP:
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[IF_OP] Op=%p\n", Op));
/*
* Save the result of the predicate in case there is an
* ELSE to come
*/
WalkState->LastPredicate =
(BOOLEAN) WalkState->ControlState->Common.Value;
/*
* Pop the control state that was created at the start
* of the IF and free it
*/
ControlState = AcpiUtPopGenericState (&WalkState->ControlState);
AcpiUtDeleteGenericState (ControlState);
break;
case AML_ELSE_OP:
break;
case AML_WHILE_OP:
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", Op));
ControlState = WalkState->ControlState;
if (ControlState->Common.Value)
{
/* Predicate was true, the body of the loop was just executed */
/*
* This loop counter mechanism allows the interpreter to escape
* possibly infinite loops. This can occur in poorly written AML
* when the hardware does not respond within a while loop and the
* loop does not implement a timeout.
*/
ControlState->Control.LoopCount++;
if (ControlState->Control.LoopCount > ACPI_MAX_LOOP_ITERATIONS)
{
Status = AE_AML_INFINITE_LOOP;
break;
}
/*
* Go back and evaluate the predicate and maybe execute the loop
* another time
*/
Status = AE_CTRL_PENDING;
WalkState->AmlLastWhile = ControlState->Control.AmlPredicateStart;
break;
}
/* Predicate was false, terminate this while loop */
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"[WHILE_OP] termination! Op=%p\n",Op));
/* Pop this control state and free it */
ControlState = AcpiUtPopGenericState (&WalkState->ControlState);
AcpiUtDeleteGenericState (ControlState);
break;
case AML_RETURN_OP:
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"[RETURN_OP] Op=%p Arg=%p\n",Op, Op->Common.Value.Arg));
/*
* One optional operand -- the return value
* It can be either an immediate operand or a result that
* has been bubbled up the tree
*/
if (Op->Common.Value.Arg)
{
/* Since we have a real Return(), delete any implicit return */
AcpiDsClearImplicitReturn (WalkState);
/* Return statement has an immediate operand */
Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg);
if (ACPI_FAILURE (Status))
{
return (Status);
}
/*
* If value being returned is a Reference (such as
* an arg or local), resolve it now because it may
* cease to exist at the end of the method.
*/
Status = AcpiExResolveToValue (&WalkState->Operands [0], WalkState);
if (ACPI_FAILURE (Status))
{
return (Status);
}
/*
* Get the return value and save as the last result
* value. This is the only place where WalkState->ReturnDesc
* is set to anything other than zero!
*/
WalkState->ReturnDesc = WalkState->Operands[0];
}
else if (WalkState->ResultCount)
{
/* Since we have a real Return(), delete any implicit return */
AcpiDsClearImplicitReturn (WalkState);
/*
* The return value has come from a previous calculation.
*
* If value being returned is a Reference (such as
* an arg or local), resolve it now because it may
* cease to exist at the end of the method.
*
* Allow references created by the Index operator to return unchanged.
*/
if ((ACPI_GET_DESCRIPTOR_TYPE (WalkState->Results->Results.ObjDesc[0]) == ACPI_DESC_TYPE_OPERAND) &&
((WalkState->Results->Results.ObjDesc [0])->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
((WalkState->Results->Results.ObjDesc [0])->Reference.Class != ACPI_REFCLASS_INDEX))
{
Status = AcpiExResolveToValue (&WalkState->Results->Results.ObjDesc [0], WalkState);
if (ACPI_FAILURE (Status))
{
return (Status);
}
}
WalkState->ReturnDesc = WalkState->Results->Results.ObjDesc [0];
}
else
{
/* No return operand */
if (WalkState->NumOperands)
{
AcpiUtRemoveReference (WalkState->Operands [0]);
}
WalkState->Operands [0] = NULL;
WalkState->NumOperands = 0;
WalkState->ReturnDesc = NULL;
}
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Completed RETURN_OP State=%p, RetVal=%p\n",
WalkState, WalkState->ReturnDesc));
/* End the control method execution right now */
Status = AE_CTRL_TERMINATE;
break;
case AML_NOOP_OP:
/* Just do nothing! */
break;
case AML_BREAK_POINT_OP:
/*
* Set the single-step flag. This will cause the debugger (if present)
* to break to the console within the AML debugger at the start of the
* next AML instruction.
*/
ACPI_DEBUGGER_EXEC (
AcpiGbl_CmSingleStep = TRUE);
ACPI_DEBUGGER_EXEC (
AcpiOsPrintf ("**break** Executed AML BreakPoint opcode\n"));
/* Call to the OSL in case OS wants a piece of the action */
Status = AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT,
"Executed AML Breakpoint opcode");
break;
case AML_BREAK_OP:
case AML_CONTINUE_OP: /* ACPI 2.0 */
/* Pop and delete control states until we find a while */
while (WalkState->ControlState &&
(WalkState->ControlState->Control.Opcode != AML_WHILE_OP))
{
ControlState = AcpiUtPopGenericState (&WalkState->ControlState);
AcpiUtDeleteGenericState (ControlState);
}
/* No while found? */
if (!WalkState->ControlState)
{
return (AE_AML_NO_WHILE);
}
/* Was: WalkState->AmlLastWhile = WalkState->ControlState->Control.AmlPredicateStart; */
WalkState->AmlLastWhile = WalkState->ControlState->Control.PackageEnd;
/* Return status depending on opcode */
if (Op->Common.AmlOpcode == AML_BREAK_OP)
{
Status = AE_CTRL_BREAK;
}
else
{
Status = AE_CTRL_CONTINUE;
}
break;
default:
ACPI_ERROR ((AE_INFO, "Unknown control opcode=0x%X Op=%p",
Op->Common.AmlOpcode, Op));
Status = AE_AML_BAD_OPCODE;
break;
}
return (Status);
}

View File

@ -1,6 +1,6 @@
/******************************************************************************
*
* Module Name: dswload - Dispatcher namespace load callbacks
* Module Name: dswload - Dispatcher first pass namespace load callbacks
*
*****************************************************************************/
@ -50,7 +50,6 @@
#include "acdispat.h"
#include "acinterp.h"
#include "acnamesp.h"
#include "acevents.h"
#ifdef ACPI_ASL_COMPILER
#include "acdisasm.h"
@ -550,695 +549,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);
}

747
dispatcher/dswload2.c Normal file
View File

@ -0,0 +1,747 @@
/******************************************************************************
*
* Module Name: dswload2 - Dispatcher second pass namespace load callbacks
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2011, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#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 = 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);
}

View File

@ -422,6 +422,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);

View File

@ -262,6 +262,8 @@ AcpiEvInitializeOpRegions (
}
}
AcpiGbl_RegMethodsExecuted = TRUE;
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (Status);
}

View File

@ -120,9 +120,41 @@ AcpiInstallAddressSpaceHandler (
goto UnlockAndExit;
}
/* Run all _REG methods for this address space */
/*
* 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)
{
/* Run all _REG methods for this address space */
Status = AcpiEvExecuteRegMethods (Node, SpaceId);
}
break;
default:
Status = AcpiEvExecuteRegMethods (Node, SpaceId);
break;
}
Status = AcpiEvExecuteRegMethods (Node, SpaceId);
UnlockAndExit:
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);

View File

@ -298,14 +298,14 @@ AcpiExAccessRegion (
if (Status == AE_NOT_IMPLEMENTED)
{
ACPI_ERROR ((AE_INFO,
"Region %s(0x%X) not implemented",
"Region %s (ID=%u) not implemented",
AcpiUtGetRegionName (RgnDesc->Region.SpaceId),
RgnDesc->Region.SpaceId));
}
else if (Status == AE_NOT_EXIST)
{
ACPI_ERROR ((AE_INFO,
"Region %s(0x%X) has no handler",
"Region %s (ID=%u) has no handler",
AcpiUtGetRegionName (RgnDesc->Region.SpaceId),
RgnDesc->Region.SpaceId));
}

31
generate/unix/Makefile Normal file
View File

@ -0,0 +1,31 @@
#
# Common make for acpica tools and utilities
#
include Makefile.config
all: ${DIRS}
${DIRS}: FORCE
@cd $@; make; ls -al $@
clean: FORCE
@for d in ${DIRS}; do \
(cd $$d; \
if [ $$? -ne 0 ]; then \
echo "Bad element of DIRS: <$$d>"; \
else \
pwd; make clean; \
fi); \
done
install: FORCE
@for d in ${DIRS}; do \
(cd $$d; \
if [ $$? -ne 0 ]; then \
echo "Bad element of DIRS: <$$d>"; \
else \
pwd; make install; \
fi); \
done
FORCE:

View File

@ -0,0 +1,87 @@
#
# Makefile.config
#
# Common configuration and setup file to generate the ACPICA tools and
# utilities: acpiexec, acpisrc, acpixtract, and the iASL compiler.
#
# This file is included by the individual makefiles for each tool.
#
#
# Configuration
#
HOST = _CYGWIN
CC = gcc-4
ACPICA_SRC = ../../../source
DIRS = acpiexec acpinames acpisrc acpixtract iasl
INSTALLDIR = /usr/bin
#
# Common defines
#
ASL_COMPILER = $(ACPICA_SRC)/compiler
ACPICA_COMMON = $(ACPICA_SRC)/common
ACPICA_CORE = $(ACPICA_SRC)/components
ACPICA_TOOLS = $(ACPICA_SRC)/tools
ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers
COMPILE = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $?
COPYPROG = @mkdir -p ../bin; rm -f ../bin/$(PROG); cp --remove-destination $(PROG) ../bin
INSTALLPROG = cp --remove-destination $(PROG) $(INSTALLDIR)
#
# Common compiler flags. The warning flags in addition to -Wall are not
# automatically included in -Wall.
#
CFLAGS+= -Os -D$(HOST) -I$(ACPICA_SRC)/include -D_GNU_SOURCE
CWARNINGFLAGS = \
-ansi \
-Wall \
-Wbad-function-cast \
-Wdeclaration-after-statement \
-Werror \
-Wformat=2 \
-Wmissing-declarations \
-Wmissing-prototypes \
-Wstrict-aliasing=2 \
-Wstrict-prototypes \
-Wswitch-default \
-Wpointer-arith \
-Wundef
#
# gcc 4+ flags
#
CWARNINGFLAGS+= \
-Waddress \
-Waggregate-return \
-Wchar-subscripts \
-Wempty-body \
-Wlogical-op \
-Wmissing-declarations \
-Wmissing-field-initializers \
-Wmissing-parameter-type \
-Wnested-externs \
-Wold-style-declaration \
-Wold-style-definition \
-Wredundant-decls \
-Wtype-limits
#
# Extra warning flags (possible future use)
#
#CWARNINGFLAGS+= \
# -Wredundant-decls \
# -Wunreachable-code \
# -Wcast-qual \
# -Wconversion
# -Wshadow \
#
# Bison/Flex configuration
#
YACC= bison
YFLAGS+= -v -d -y -pAslCompiler
LEX= flex
LFLAGS+= -i -s -PAslCompiler

View File

@ -0,0 +1,649 @@
#
# AcpiExec utility
#
include ../Makefile.config
PROG = acpiexec
#
# Flags specific to acpiexec utility
#
CFLAGS+= -DACPI_EXEC_APP -I$(ACPICA_TOOLS)/acpiexec
OBJS = \
aeexec.o \
aehandlers.o \
aemain.o \
aetables.o \
dbcmds.o \
dbdisply.o \
dbexec.o \
dbfileio.o \
dbhistry.o \
dbinput.o \
dbmethod.o \
dbnames.o \
dbstats.o \
dbutils.o \
dbxface.o \
dmbuffer.o \
dmnames.o \
dmobject.o \
dmopcode.o \
dmresrc.o \
dmresrcl.o \
dmresrcs.o \
dmutils.o \
dmwalk.o \
dsargs.o \
dscontrol.o \
dsfield.o \
dsinit.o \
dsmethod.o \
dsmthdat.o \
dsobject.o \
dsopcode.o \
dsutils.o \
dswexec.o \
dswload.o \
dswload2.o \
dswscope.o \
dswstate.o \
evevent.o \
evgpe.o \
evgpeblk.o \
evgpeinit.o \
evgpeutil.o \
evmisc.o \
evregion.o \
evrgnini.o \
evsci.o \
evxface.o \
evxfevnt.o \
evxfgpe.o \
evxfregn.o \
exconfig.o \
exconvrt.o \
excreate.o \
exdebug.o \
exdump.o \
exfield.o \
exfldio.o \
exmisc.o \
exmutex.o \
exnames.o \
exoparg1.o \
exoparg2.o \
exoparg3.o \
exoparg6.o \
exprep.o \
exregion.o \
exresnte.o \
exresolv.o \
exresop.o \
exstore.o \
exstoren.o \
exstorob.o \
exsystem.o \
exutils.o \
getopt.o \
hwacpi.o \
hwgpe.o \
hwpci.o \
hwregs.o \
hwsleep.o \
hwvalid.o \
hwxface.o \
nsaccess.o \
nsalloc.o \
nsdump.o \
nsdumpdv.o \
nseval.o \
nsinit.o \
nsload.o \
nsnames.o \
nsobject.o \
nsparse.o \
nspredef.o \
nsrepair.o \
nsrepair2.o \
nssearch.o \
nsutils.o \
nswalk.o \
nsxfeval.o \
nsxfname.o \
nsxfobj.o \
osunixxf.o \
psargs.o \
psloop.o \
psopcode.o \
psparse.o \
psscope.o \
pstree.o \
psutils.o \
pswalk.o \
psxface.o \
rsaddr.o \
rscalc.o \
rscreate.o \
rsdump.o \
rsinfo.o \
rsio.o \
rsirq.o \
rslist.o \
rsmemory.o \
rsmisc.o \
rsutils.o \
rsxface.o \
tbfadt.o \
tbfind.o \
tbinstal.o \
tbutils.o \
tbxface.o \
tbxfroot.o \
utalloc.o \
utcache.o \
utcopy.o \
utdebug.o \
utdecode.o \
utdelete.o \
uteval.o \
utglobal.o \
utids.o \
utinit.o \
utlock.o \
utmath.o \
utmisc.o \
utmutex.o \
utobject.o \
utresrc.o \
utstate.o \
uttrack.o \
utosi.o \
utxferror.o \
utxface.o
#
# Root rule
#
$(PROG) : $(OBJS)
$(CC) $(LDFLAGS) $(OBJS) -lpthread -o $(PROG)
$(COPYPROG)
#
# acpiexec source
#
aeexec.o : $(ACPICA_TOOLS)/acpiexec/aeexec.c
$(COMPILE)
aehandlers.o : $(ACPICA_TOOLS)/acpiexec/aehandlers.c
$(COMPILE)
aemain.o : $(ACPICA_TOOLS)/acpiexec/aemain.c
$(COMPILE)
aetables.o : $(ACPICA_TOOLS)/acpiexec/aetables.c
$(COMPILE)
#
# ACPICA core source - common
#
getopt.o : $(ACPICA_COMMON)/getopt.c
$(COMPILE)
#
# ACPICA core source
#
dbcmds.o : $(ACPICA_CORE)/debugger/dbcmds.c
$(COMPILE)
dbdisply.o : $(ACPICA_CORE)/debugger/dbdisply.c
$(COMPILE)
dbexec.o : $(ACPICA_CORE)/debugger/dbexec.c
$(COMPILE)
dbfileio.o : $(ACPICA_CORE)/debugger/dbfileio.c
$(COMPILE)
dbhistry.o : $(ACPICA_CORE)/debugger/dbhistry.c
$(COMPILE)
dbinput.o : $(ACPICA_CORE)/debugger/dbinput.c
$(COMPILE)
dbmethod.o : $(ACPICA_CORE)/debugger/dbmethod.c
$(COMPILE)
dbnames.o : $(ACPICA_CORE)/debugger/dbnames.c
$(COMPILE)
dbstats.o : $(ACPICA_CORE)/debugger/dbstats.c
$(COMPILE)
dbutils.o : $(ACPICA_CORE)/debugger/dbutils.c
$(COMPILE)
dbxface.o : $(ACPICA_CORE)/debugger/dbxface.c
$(COMPILE)
dmbuffer.o : $(ACPICA_CORE)/disassembler/dmbuffer.c
$(COMPILE)
dmnames.o : $(ACPICA_CORE)/disassembler/dmnames.c
$(COMPILE)
dmobject.o : $(ACPICA_CORE)/disassembler/dmobject.c
$(COMPILE)
dmopcode.o : $(ACPICA_CORE)/disassembler/dmopcode.c
$(COMPILE)
dmresrc.o : $(ACPICA_CORE)/disassembler/dmresrc.c
$(COMPILE)
dmresrcl.o : $(ACPICA_CORE)/disassembler/dmresrcl.c
$(COMPILE)
dmresrcs.o : $(ACPICA_CORE)/disassembler/dmresrcs.c
$(COMPILE)
dmutils.o : $(ACPICA_CORE)/disassembler/dmutils.c
$(COMPILE)
dmwalk.o : $(ACPICA_CORE)/disassembler/dmwalk.c
$(COMPILE)
dsargs.o : $(ACPICA_CORE)/dispatcher/dsargs.c
$(COMPILE)
dscontrol.o : $(ACPICA_CORE)/dispatcher/dscontrol.c
$(COMPILE)
dsfield.o : $(ACPICA_CORE)/dispatcher/dsfield.c
$(COMPILE)
dsinit.o : $(ACPICA_CORE)/dispatcher/dsinit.c
$(COMPILE)
dsmethod.o : $(ACPICA_CORE)/dispatcher/dsmethod.c
$(COMPILE)
dsmthdat.o : $(ACPICA_CORE)/dispatcher/dsmthdat.c
$(COMPILE)
dsobject.o : $(ACPICA_CORE)/dispatcher/dsobject.c
$(COMPILE)
dsopcode.o : $(ACPICA_CORE)/dispatcher/dsopcode.c
$(COMPILE)
dsutils.o : $(ACPICA_CORE)/dispatcher/dsutils.c
$(COMPILE)
dswexec.o : $(ACPICA_CORE)/dispatcher/dswexec.c
$(COMPILE)
dswload.o : $(ACPICA_CORE)/dispatcher/dswload.c
$(COMPILE)
dswload2.o : $(ACPICA_CORE)/dispatcher/dswload2.c
$(COMPILE)
dswscope.o : $(ACPICA_CORE)/dispatcher/dswscope.c
$(COMPILE)
dswstate.o : $(ACPICA_CORE)/dispatcher/dswstate.c
$(COMPILE)
evevent.o : $(ACPICA_CORE)/events/evevent.c
$(COMPILE)
evgpe.o : $(ACPICA_CORE)/events/evgpe.c
$(COMPILE)
evgpeblk.o : $(ACPICA_CORE)/events/evgpeblk.c
$(COMPILE)
evgpeinit.o : $(ACPICA_CORE)/events/evgpeinit.c
$(COMPILE)
evgpeutil.o : $(ACPICA_CORE)/events/evgpeutil.c
$(COMPILE)
evmisc.o : $(ACPICA_CORE)/events/evmisc.c
$(COMPILE)
evregion.o : $(ACPICA_CORE)/events/evregion.c
$(COMPILE)
evrgnini.o : $(ACPICA_CORE)/events/evrgnini.c
$(COMPILE)
evsci.o : $(ACPICA_CORE)/events/evsci.c
$(COMPILE)
evxface.o : $(ACPICA_CORE)/events/evxface.c
$(COMPILE)
evxfevnt.o : $(ACPICA_CORE)/events/evxfevnt.c
$(COMPILE)
evxfgpe.o : $(ACPICA_CORE)/events/evxfgpe.c
$(COMPILE)
evxfregn.o : $(ACPICA_CORE)/events/evxfregn.c
$(COMPILE)
exconfig.o : $(ACPICA_CORE)/executer/exconfig.c
$(COMPILE)
exconvrt.o : $(ACPICA_CORE)/executer/exconvrt.c
$(COMPILE)
excreate.o : $(ACPICA_CORE)/executer/excreate.c
$(COMPILE)
exdebug.o : $(ACPICA_CORE)/executer/exdebug.c
$(COMPILE)
exdump.o : $(ACPICA_CORE)/executer/exdump.c
$(COMPILE)
exfield.o : $(ACPICA_CORE)/executer/exfield.c
$(COMPILE)
exfldio.o : $(ACPICA_CORE)/executer/exfldio.c
$(COMPILE)
exmisc.o : $(ACPICA_CORE)/executer/exmisc.c
$(COMPILE)
exmutex.o : $(ACPICA_CORE)/executer/exmutex.c
$(COMPILE)
exnames.o : $(ACPICA_CORE)/executer/exnames.c
$(COMPILE)
exoparg1.o : $(ACPICA_CORE)/executer/exoparg1.c
$(COMPILE)
exoparg2.o : $(ACPICA_CORE)/executer/exoparg2.c
$(COMPILE)
exoparg3.o : $(ACPICA_CORE)/executer/exoparg3.c
$(COMPILE)
exoparg6.o : $(ACPICA_CORE)/executer/exoparg6.c
$(COMPILE)
exprep.o : $(ACPICA_CORE)/executer/exprep.c
$(COMPILE)
exregion.o : $(ACPICA_CORE)/executer/exregion.c
$(COMPILE)
exresnte.o : $(ACPICA_CORE)/executer/exresnte.c
$(COMPILE)
exresolv.o : $(ACPICA_CORE)/executer/exresolv.c
$(COMPILE)
exresop.o : $(ACPICA_CORE)/executer/exresop.c
$(COMPILE)
exstore.o : $(ACPICA_CORE)/executer/exstore.c
$(COMPILE)
exstoren.o : $(ACPICA_CORE)/executer/exstoren.c
$(COMPILE)
exstorob.o : $(ACPICA_CORE)/executer/exstorob.c
$(COMPILE)
exsystem.o : $(ACPICA_CORE)/executer/exsystem.c
$(COMPILE)
exutils.o : $(ACPICA_CORE)/executer/exutils.c
$(COMPILE)
hwacpi.o : $(ACPICA_CORE)/hardware/hwacpi.c
$(COMPILE)
hwgpe.o : $(ACPICA_CORE)/hardware/hwgpe.c
$(COMPILE)
hwpci.o : $(ACPICA_CORE)/hardware/hwpci.c
$(COMPILE)
hwregs.o : $(ACPICA_CORE)/hardware/hwregs.c
$(COMPILE)
hwsleep.o : $(ACPICA_CORE)/hardware/hwsleep.c
$(COMPILE)
hwvalid.o : $(ACPICA_CORE)/hardware/hwvalid.c
$(COMPILE)
hwxface.o : $(ACPICA_CORE)/hardware/hwxface.c
$(COMPILE)
nsaccess.o : $(ACPICA_CORE)/namespace/nsaccess.c
$(COMPILE)
nsalloc.o : $(ACPICA_CORE)/namespace/nsalloc.c
$(COMPILE)
nsdump.o : $(ACPICA_CORE)/namespace/nsdump.c
$(COMPILE)
nsdumpdv.o : $(ACPICA_CORE)/namespace/nsdumpdv.c
$(COMPILE)
nseval.o : $(ACPICA_CORE)/namespace/nseval.c
$(COMPILE)
nsinit.o : $(ACPICA_CORE)/namespace/nsinit.c
$(COMPILE)
nsload.o : $(ACPICA_CORE)/namespace/nsload.c
$(COMPILE)
nsnames.o : $(ACPICA_CORE)/namespace/nsnames.c
$(COMPILE)
nsobject.o : $(ACPICA_CORE)/namespace/nsobject.c
$(COMPILE)
nsparse.o : $(ACPICA_CORE)/namespace/nsparse.c
$(COMPILE)
nspredef.o : $(ACPICA_CORE)/namespace/nspredef.c
$(COMPILE)
nsrepair.o : $(ACPICA_CORE)/namespace/nsrepair.c
$(COMPILE)
nsrepair2.o : $(ACPICA_CORE)/namespace/nsrepair2.c
$(COMPILE)
nssearch.o : $(ACPICA_CORE)/namespace/nssearch.c
$(COMPILE)
nsutils.o : $(ACPICA_CORE)/namespace/nsutils.c
$(COMPILE)
nswalk.o : $(ACPICA_CORE)/namespace/nswalk.c
$(COMPILE)
nsxfeval.o : $(ACPICA_CORE)/namespace/nsxfeval.c
$(COMPILE)
nsxfname.o : $(ACPICA_CORE)/namespace/nsxfname.c
$(COMPILE)
nsxfobj.o : $(ACPICA_CORE)/namespace/nsxfobj.c
$(COMPILE)
psargs.o : $(ACPICA_CORE)/parser/psargs.c
$(COMPILE)
psloop.o : $(ACPICA_CORE)/parser/psloop.c
$(COMPILE)
psopcode.o : $(ACPICA_CORE)/parser/psopcode.c
$(COMPILE)
psparse.o : $(ACPICA_CORE)/parser/psparse.c
$(COMPILE)
psscope.o : $(ACPICA_CORE)/parser/psscope.c
$(COMPILE)
pstree.o : $(ACPICA_CORE)/parser/pstree.c
$(COMPILE)
psutils.o : $(ACPICA_CORE)/parser/psutils.c
$(COMPILE)
pswalk.o : $(ACPICA_CORE)/parser/pswalk.c
$(COMPILE)
psxface.o : $(ACPICA_CORE)/parser/psxface.c
$(COMPILE)
rsaddr.o : $(ACPICA_CORE)/resources/rsaddr.c
$(COMPILE)
rscalc.o : $(ACPICA_CORE)/resources/rscalc.c
$(COMPILE)
rscreate.o : $(ACPICA_CORE)/resources/rscreate.c
$(COMPILE)
rsdump.o : $(ACPICA_CORE)/resources/rsdump.c
$(COMPILE)
rsio.o : $(ACPICA_CORE)/resources/rsio.c
$(COMPILE)
rsinfo.o : $(ACPICA_CORE)/resources/rsinfo.c
$(COMPILE)
rsirq.o : $(ACPICA_CORE)/resources/rsirq.c
$(COMPILE)
rslist.o : $(ACPICA_CORE)/resources/rslist.c
$(COMPILE)
rsmemory.o : $(ACPICA_CORE)/resources/rsmemory.c
$(COMPILE)
rsmisc.o : $(ACPICA_CORE)/resources/rsmisc.c
$(COMPILE)
rsutils.o : $(ACPICA_CORE)/resources/rsutils.c
$(COMPILE)
rsxface.o : $(ACPICA_CORE)/resources/rsxface.c
$(COMPILE)
tbfadt.o : $(ACPICA_CORE)/tables/tbfadt.c
$(COMPILE)
tbfind.o : $(ACPICA_CORE)/tables/tbfind.c
$(COMPILE)
tbinstal.o : $(ACPICA_CORE)/tables/tbinstal.c
$(COMPILE)
tbutils.o : $(ACPICA_CORE)/tables/tbutils.c
$(COMPILE)
tbxface.o : $(ACPICA_CORE)/tables/tbxface.c
$(COMPILE)
tbxfroot.o : $(ACPICA_CORE)/tables/tbxfroot.c
$(COMPILE)
utalloc.o : $(ACPICA_CORE)/utilities/utalloc.c
$(COMPILE)
utcache.o : $(ACPICA_CORE)/utilities/utcache.c
$(COMPILE)
utcopy.o : $(ACPICA_CORE)/utilities/utcopy.c
$(COMPILE)
utdebug.o : $(ACPICA_CORE)/utilities/utdebug.c
$(COMPILE)
utdecode.o : $(ACPICA_CORE)/utilities/utdecode.c
$(COMPILE)
utdelete.o : $(ACPICA_CORE)/utilities/utdelete.c
$(COMPILE)
uteval.o : $(ACPICA_CORE)/utilities/uteval.c
$(COMPILE)
utglobal.o : $(ACPICA_CORE)/utilities/utglobal.c
$(COMPILE)
utids.o : $(ACPICA_CORE)/utilities/utids.c
$(COMPILE)
utinit.o : $(ACPICA_CORE)/utilities/utinit.c
$(COMPILE)
utlock.o : $(ACPICA_CORE)/utilities/utlock.c
$(COMPILE)
utmath.o : $(ACPICA_CORE)/utilities/utmath.c
$(COMPILE)
utmisc.o : $(ACPICA_CORE)/utilities/utmisc.c
$(COMPILE)
utmutex.o : $(ACPICA_CORE)/utilities/utmutex.c
$(COMPILE)
utobject.o : $(ACPICA_CORE)/utilities/utobject.c
$(COMPILE)
utresrc.o : $(ACPICA_CORE)/utilities/utresrc.c
$(COMPILE)
utstate.o : $(ACPICA_CORE)/utilities/utstate.c
$(COMPILE)
uttrack.o : $(ACPICA_CORE)/utilities/uttrack.c
$(COMPILE)
utosi.o : $(ACPICA_CORE)/utilities/utosi.c
$(COMPILE)
utxferror.o : $(ACPICA_CORE)/utilities/utxferror.c
$(COMPILE)
utxface.o : $(ACPICA_CORE)/utilities/utxface.c
$(COMPILE)
#
# Unix OS services layer (OSL)
#
osunixxf.o : $(ACPICA_OSL)/osunixxf.c
$(COMPILE)
clean :
rm -f $(PROG) $(PROG).exe $(OBJS)
install :
$(INSTALLPROG)

View File

@ -0,0 +1,297 @@
#
# AcpiNames utility
#
include ../Makefile.config
PROG = acpinames
#
# Flags specific to acpinames utility
#
CFLAGS+= -DACPI_APPLICATION -DACPI_SINGLE_THREADED -DACPI_DEBUGGER -I$(ACPICA_TOOLS)/acpinames
OBJS = \
anmain.o \
anstubs.o \
antables.o \
dbfileio.o \
dsfield.o \
dsmthdat.o \
dsobject.o \
dsutils.o \
dswload.o \
dswload2.o \
dswscope.o \
dswstate.o \
excreate.o \
exnames.o \
exresnte.o \
exresolv.o \
exutils.o \
getopt.o \
nsaccess.o \
nsalloc.o \
nsdump.o \
nsinit.o \
nsload.o \
nsnames.o \
nsobject.o \
nsparse.o \
nssearch.o \
nsutils.o \
nswalk.o \
nsxfeval.o \
nsxfname.o \
nsxfobj.o \
osunixxf.o \
psargs.o \
psloop.o \
psopcode.o \
psparse.o \
psscope.o \
pstree.o \
psutils.o \
pswalk.o \
psxface.o \
tbfadt.o \
tbfind.o \
tbinstal.o \
tbutils.o \
tbxface.o \
tbxfroot.o \
utalloc.o \
utcache.o \
utdebug.o \
utdecode.o \
utdelete.o \
utglobal.o \
utlock.o \
utmath.o \
utmisc.o \
utmutex.o \
utobject.o \
utstate.o \
utosi.o \
utxferror.o \
utxface.o
#
# Root rule
#
$(PROG) : $(OBJS)
$(CC) $(LDFLAGS) $(OBJS) -lpthread -o $(PROG)
$(COPYPROG)
#
# acpinames source
#
anmain.o : $(ACPICA_TOOLS)/acpinames/anmain.c
$(COMPILE)
anstubs.o : $(ACPICA_TOOLS)/acpinames/anstubs.c
$(COMPILE)
antables.o : $(ACPICA_TOOLS)/acpinames/antables.c
$(COMPILE)
#
# ACPICA core source - common
#
getopt.o : $(ACPICA_COMMON)/getopt.c
$(COMPILE)
#
# ACPICA core source
#
dbfileio.o : $(ACPICA_CORE)/debugger/dbfileio.c
$(COMPILE)
dsfield.o : $(ACPICA_CORE)/dispatcher/dsfield.c
$(COMPILE)
dsmthdat.o : $(ACPICA_CORE)/dispatcher/dsmthdat.c
$(COMPILE)
dsobject.o : $(ACPICA_CORE)/dispatcher/dsobject.c
$(COMPILE)
dsutils.o : $(ACPICA_CORE)/dispatcher/dsutils.c
$(COMPILE)
dswload.o : $(ACPICA_CORE)/dispatcher/dswload.c
$(COMPILE)
dswload2.o : $(ACPICA_CORE)/dispatcher/dswload2.c
$(COMPILE)
dswscope.o : $(ACPICA_CORE)/dispatcher/dswscope.c
$(COMPILE)
dswstate.o : $(ACPICA_CORE)/dispatcher/dswstate.c
$(COMPILE)
excreate.o : $(ACPICA_CORE)/executer/excreate.c
$(COMPILE)
exnames.o : $(ACPICA_CORE)/executer/exnames.c
$(COMPILE)
exresnte.o : $(ACPICA_CORE)/executer/exresnte.c
$(COMPILE)
exresolv.o : $(ACPICA_CORE)/executer/exresolv.c
$(COMPILE)
exutils.o : $(ACPICA_CORE)/executer/exutils.c
$(COMPILE)
nsaccess.o : $(ACPICA_CORE)/namespace/nsaccess.c
$(COMPILE)
nsalloc.o : $(ACPICA_CORE)/namespace/nsalloc.c
$(COMPILE)
nsdump.o : $(ACPICA_CORE)/namespace/nsdump.c
$(COMPILE)
nsinit.o : $(ACPICA_CORE)/namespace/nsinit.c
$(COMPILE)
nsload.o : $(ACPICA_CORE)/namespace/nsload.c
$(COMPILE)
nsnames.o : $(ACPICA_CORE)/namespace/nsnames.c
$(COMPILE)
nsobject.o : $(ACPICA_CORE)/namespace/nsobject.c
$(COMPILE)
nsparse.o : $(ACPICA_CORE)/namespace/nsparse.c
$(COMPILE)
nssearch.o : $(ACPICA_CORE)/namespace/nssearch.c
$(COMPILE)
nsutils.o : $(ACPICA_CORE)/namespace/nsutils.c
$(COMPILE)
nswalk.o : $(ACPICA_CORE)/namespace/nswalk.c
$(COMPILE)
nsxfeval.o : $(ACPICA_CORE)/namespace/nsxfeval.c
$(COMPILE)
nsxfname.o : $(ACPICA_CORE)/namespace/nsxfname.c
$(COMPILE)
nsxfobj.o : $(ACPICA_CORE)/namespace/nsxfobj.c
$(COMPILE)
psargs.o : $(ACPICA_CORE)/parser/psargs.c
$(COMPILE)
psloop.o : $(ACPICA_CORE)/parser/psloop.c
$(COMPILE)
psopcode.o : $(ACPICA_CORE)/parser/psopcode.c
$(COMPILE)
psparse.o : $(ACPICA_CORE)/parser/psparse.c
$(COMPILE)
psscope.o : $(ACPICA_CORE)/parser/psscope.c
$(COMPILE)
pstree.o : $(ACPICA_CORE)/parser/pstree.c
$(COMPILE)
psutils.o : $(ACPICA_CORE)/parser/psutils.c
$(COMPILE)
pswalk.o : $(ACPICA_CORE)/parser/pswalk.c
$(COMPILE)
psxface.o : $(ACPICA_CORE)/parser/psxface.c
$(COMPILE)
tbfadt.o : $(ACPICA_CORE)/tables/tbfadt.c
$(COMPILE)
tbfind.o : $(ACPICA_CORE)/tables/tbfind.c
$(COMPILE)
tbinstal.o : $(ACPICA_CORE)/tables/tbinstal.c
$(COMPILE)
tbutils.o : $(ACPICA_CORE)/tables/tbutils.c
$(COMPILE)
tbxface.o : $(ACPICA_CORE)/tables/tbxface.c
$(COMPILE)
tbxfroot.o : $(ACPICA_CORE)/tables/tbxfroot.c
$(COMPILE)
utalloc.o : $(ACPICA_CORE)/utilities/utalloc.c
$(COMPILE)
utcache.o : $(ACPICA_CORE)/utilities/utcache.c
$(COMPILE)
utdebug.o : $(ACPICA_CORE)/utilities/utdebug.c
$(COMPILE)
utdecode.o : $(ACPICA_CORE)/utilities/utdecode.c
$(COMPILE)
utdelete.o : $(ACPICA_CORE)/utilities/utdelete.c
$(COMPILE)
utglobal.o : $(ACPICA_CORE)/utilities/utglobal.c
$(COMPILE)
utlock.o : $(ACPICA_CORE)/utilities/utlock.c
$(COMPILE)
utmath.o : $(ACPICA_CORE)/utilities/utmath.c
$(COMPILE)
utmisc.o : $(ACPICA_CORE)/utilities/utmisc.c
$(COMPILE)
utmutex.o : $(ACPICA_CORE)/utilities/utmutex.c
$(COMPILE)
utobject.o : $(ACPICA_CORE)/utilities/utobject.c
$(COMPILE)
utstate.o : $(ACPICA_CORE)/utilities/utstate.c
$(COMPILE)
utosi.o : $(ACPICA_CORE)/utilities/utosi.c
$(COMPILE)
utxferror.o : $(ACPICA_CORE)/utilities/utxferror.c
$(COMPILE)
utxface.o : $(ACPICA_CORE)/utilities/utxface.c
$(COMPILE)
#
# Unix OS services layer (OSL)
#
osunixxf.o : $(ACPICA_OSL)/osunixxf.c
$(COMPILE)
clean :
rm -f $(PROG) $(PROG).exe $(OBJS)
install :
$(INSTALLPROG)

View File

@ -0,0 +1,77 @@
#
# acpisrc utility
#
include ../Makefile.config
PROG = acpisrc
#
# Flags specific to acpisrc
#
CFLAGS+= -DACPI_APPLICATION -I$(ACPICA_TOOLS)/acpisrc
OBJS = \
ascase.o \
asconvrt.o \
asfile.o \
asmain.o \
asremove.o \
astable.o \
asutils.o \
getopt.o \
osunixdir.o
#
# Root rule
#
$(PROG) : $(OBJS)
$(CC) $(LDFLAGS) $(OBJS) -o $(PROG)
$(COPYPROG)
#
# acpisrc source
#
ascase.o : $(ACPICA_TOOLS)/acpisrc/ascase.c
$(COMPILE)
asconvrt.o : $(ACPICA_TOOLS)/acpisrc/asconvrt.c
$(COMPILE)
asfile.o : $(ACPICA_TOOLS)/acpisrc/asfile.c
$(COMPILE)
asmain.o : $(ACPICA_TOOLS)/acpisrc/asmain.c
$(COMPILE)
asremove.o : $(ACPICA_TOOLS)/acpisrc/asremove.c
$(COMPILE)
astable.o : $(ACPICA_TOOLS)/acpisrc/astable.c
$(COMPILE)
asutils.o : $(ACPICA_TOOLS)/acpisrc/asutils.c
$(COMPILE)
#
# ACPICA core source - common
#
getopt.o : $(ACPICA_COMMON)/getopt.c
$(COMPILE)
#
# Unix OS services layer (OSL)
#
osunixdir.o : $(ACPICA_OSL)/osunixdir.c
$(COMPILE)
clean :
rm -f $(PROG) $(PROG).exe $(OBJS)
install :
$(INSTALLPROG)

View File

@ -0,0 +1,17 @@
#
# acpixtract utility
#
include ../Makefile.config
PROG = acpixtract
$(PROG) : $(ACPICA_TOOLS)/acpixtract/acpixtract.c
$(CC) $(CFLAGS) $(CWARNINGFLAGS) $(LDFLAGS) -o$(PROG) $?
$(COPYPROG)
clean :
rm -f $(PROG) $(PROG).exe
install :
$(INSTALLPROG)

602
generate/unix/iasl/Makefile Normal file
View File

@ -0,0 +1,602 @@
#
# iASL compiler
#
include ../Makefile.config
PROG = iasl
#
# Flags specific to iASL compiler
#
CFLAGS+= -DACPI_ASL_COMPILER -I$(ASL_COMPILER) -I.
LDFLAGS+= -lpthread
OBJS = \
adfile.o \
adisasm.o \
adwalk.o \
aslanalyze.o \
aslbtypes.o \
aslcodegen.o \
aslcompile.o \
aslcompilerlex.o \
aslcompilerparse.o \
aslerror.o \
aslfiles.o \
aslfold.o \
asllength.o \
asllisting.o \
aslload.o \
asllookup.o \
aslmain.o \
aslmap.o \
aslopcodes.o \
asloperands.o \
aslopt.o \
aslpredef.o \
aslresource.o \
aslrestype1.o \
aslrestype1i.o \
aslrestype2.o \
aslrestype2d.o \
aslrestype2e.o \
aslrestype2q.o \
aslrestype2w.o \
aslstartup.o \
aslstubs.o \
asltransform.o \
asltree.o \
aslutils.o \
asluuid.o \
aslwalks.o \
dtcompile.o \
dtexpress.o \
dtfield.o \
dtio.o \
dtsubtable.o \
dttable.o \
dttemplate.o \
dtutils.o \
dbfileio.o \
dmbuffer.o \
dmextern.o \
dmnames.o \
dmobject.o \
dmopcode.o \
dmresrc.o \
dmresrcl.o \
dmresrcs.o \
dmrestag.o \
dmtable.o \
dmtbdump.o \
dmtbinfo.o \
dmutils.o \
dmwalk.o \
dsargs.o \
dscontrol.o \
dsfield.o \
dsobject.o \
dsopcode.o \
dsutils.o \
dswexec.o \
dswload.o \
dswload2.o \
dswscope.o \
dswstate.o \
exconvrt.o \
excreate.o \
exdump.o \
exmisc.o \
exmutex.o \
exnames.o \
exoparg1.o \
exoparg2.o \
exoparg3.o \
exoparg6.o \
exprep.o \
exregion.o \
exresnte.o \
exresolv.o \
exresop.o \
exstore.o \
exstoren.o \
exstorob.o \
exsystem.o \
exutils.o \
getopt.o \
nsaccess.o \
nsalloc.o \
nsdump.o \
nsnames.o \
nsobject.o \
nsparse.o \
nssearch.o \
nsutils.o \
nswalk.o \
nsxfobj.o \
osunixxf.o \
psargs.o \
psloop.o \
psopcode.o \
psparse.o \
psscope.o \
pstree.o \
psutils.o \
pswalk.o \
tbfadt.o \
tbinstal.o \
tbutils.o \
tbxface.o \
utalloc.o \
utcache.o \
utcopy.o \
utdebug.o \
utdecode.o \
utdelete.o \
utglobal.o \
utinit.o \
utlock.o \
utmath.o \
utmisc.o \
utmutex.o \
utobject.o \
utresrc.o \
utstate.o \
utxferror.o \
utxface.o
INTERMEDIATES = \
aslcompilerlex.c \
aslcompilerparse.c
MISC = \
aslcompiler.y.h \
aslcompilerparse.output
#
# Root rule
#
$(PROG) : $(INTERMEDIATES) $(OBJS)
$(CC) $(LDFLAGS) $(OBJS) -o $(PROG)
$(COPYPROG)
#
# Parser and Lexer - intermediate C files
#
aslcompilerlex.c : $(ASL_COMPILER)/aslcompiler.l
${LEX} ${LFLAGS} -o$@ $?
aslcompilerparse.c : $(ASL_COMPILER)/aslcompiler.y
${YACC} ${YFLAGS} -o$@ $?
@mv -f aslcompilerparse.h aslcompiler.y.h
#
# Parser and Lexer - final object files
#
# Cannot use the common compile warning flags since the C files are created
# by the utilities above and they are not necessarily ANSI C, etc.
#
aslcompilerlex.o : aslcompilerlex.c
$(CC) -c $(CFLAGS) -Wall -Werror -o$@ $?
aslcompilerparse.o : aslcompilerparse.c
$(CC) -c $(CFLAGS) -Wall -Werror -o$@ $?
#
# Compiler source
#
aslanalyze.o : $(ASL_COMPILER)/aslanalyze.c
$(COMPILE)
aslbtypes.o : $(ASL_COMPILER)/aslbtypes.c
$(COMPILE)
aslcodegen.o : $(ASL_COMPILER)/aslcodegen.c
$(COMPILE)
aslcompile.o : $(ASL_COMPILER)/aslcompile.c
$(COMPILE)
aslerror.o : $(ASL_COMPILER)/aslerror.c
$(COMPILE)
aslfiles.o : $(ASL_COMPILER)/aslfiles.c
$(COMPILE)
aslfold.o : $(ASL_COMPILER)/aslfold.c
$(COMPILE)
asllength.o : $(ASL_COMPILER)/asllength.c
$(COMPILE)
asllisting.o : $(ASL_COMPILER)/asllisting.c
$(COMPILE)
aslload.o : $(ASL_COMPILER)/aslload.c
$(COMPILE)
asllookup.o : $(ASL_COMPILER)/asllookup.c
$(COMPILE)
aslmain.o : $(ASL_COMPILER)/aslmain.c
$(COMPILE)
aslmap.o : $(ASL_COMPILER)/aslmap.c
$(COMPILE)
aslopcodes.o : $(ASL_COMPILER)/aslopcodes.c
$(COMPILE)
asloperands.o : $(ASL_COMPILER)/asloperands.c
$(COMPILE)
aslopt.o : $(ASL_COMPILER)/aslopt.c
$(COMPILE)
aslpredef.o : $(ASL_COMPILER)/aslpredef.c
$(COMPILE)
aslresource.o : $(ASL_COMPILER)/aslresource.c
$(COMPILE)
aslrestype1.o : $(ASL_COMPILER)/aslrestype1.c
$(COMPILE)
aslrestype1i.o : $(ASL_COMPILER)/aslrestype1i.c
$(COMPILE)
aslrestype2.o : $(ASL_COMPILER)/aslrestype2.c
$(COMPILE)
aslrestype2d.o : $(ASL_COMPILER)/aslrestype2d.c
$(COMPILE)
aslrestype2e.o : $(ASL_COMPILER)/aslrestype2e.c
$(COMPILE)
aslrestype2q.o : $(ASL_COMPILER)/aslrestype2q.c
$(COMPILE)
aslrestype2w.o : $(ASL_COMPILER)/aslrestype2w.c
$(COMPILE)
aslstartup.o : $(ASL_COMPILER)/aslstartup.c
$(COMPILE)
aslstubs.o : $(ASL_COMPILER)/aslstubs.c
$(COMPILE)
asltransform.o : $(ASL_COMPILER)/asltransform.c
$(COMPILE)
asltree.o : $(ASL_COMPILER)/asltree.c
$(COMPILE)
aslutils.o : $(ASL_COMPILER)/aslutils.c
$(COMPILE)
asluuid.o : $(ASL_COMPILER)/asluuid.c
$(COMPILE)
aslwalks.o : $(ASL_COMPILER)/aslwalks.c
$(COMPILE)
#
# Data Table Compiler
#
dtcompile.o : $(ASL_COMPILER)/dtcompile.c
$(COMPILE)
dtexpress.o : $(ASL_COMPILER)/dtexpress.c
$(COMPILE)
dtfield.o : $(ASL_COMPILER)/dtfield.c
$(COMPILE)
dtio.o : $(ASL_COMPILER)/dtio.c
$(COMPILE)
dtsubtable.o : $(ASL_COMPILER)/dtsubtable.c
$(COMPILE)
dttable.o : $(ASL_COMPILER)/dttable.c
$(COMPILE)
dttemplate.o : $(ASL_COMPILER)/dttemplate.c
$(COMPILE)
dtutils.o : $(ASL_COMPILER)/dtutils.c
$(COMPILE)
#
# ACPICA core source - common
#
adfile.o : $(ACPICA_COMMON)/adfile.c
$(COMPILE)
adisasm.o : $(ACPICA_COMMON)/adisasm.c
$(COMPILE)
adwalk.o : $(ACPICA_COMMON)/adwalk.c
$(COMPILE)
dmextern.o : $(ACPICA_COMMON)/dmextern.c
$(COMPILE)
dmrestag.o : $(ACPICA_COMMON)/dmrestag.c
$(COMPILE)
dmtable.o : $(ACPICA_COMMON)/dmtable.c
$(COMPILE)
dmtbdump.o : $(ACPICA_COMMON)/dmtbdump.c
$(COMPILE)
dmtbinfo.o : $(ACPICA_COMMON)/dmtbinfo.c
$(COMPILE)
getopt.o : $(ACPICA_COMMON)/getopt.c
$(COMPILE)
#
# ACPICA core source
#
dbfileio.o : $(ACPICA_CORE)/debugger/dbfileio.c
$(COMPILE)
dmbuffer.o : $(ACPICA_CORE)/disassembler/dmbuffer.c
$(COMPILE)
dmnames.o : $(ACPICA_CORE)/disassembler/dmnames.c
$(COMPILE)
dmobject.o : $(ACPICA_CORE)/disassembler/dmobject.c
$(COMPILE)
dmopcode.o : $(ACPICA_CORE)/disassembler/dmopcode.c
$(COMPILE)
dmresrc.o : $(ACPICA_CORE)/disassembler/dmresrc.c
$(COMPILE)
dmresrcl.o : $(ACPICA_CORE)/disassembler/dmresrcl.c
$(COMPILE)
dmresrcs.o : $(ACPICA_CORE)/disassembler/dmresrcs.c
$(COMPILE)
dmutils.o : $(ACPICA_CORE)/disassembler/dmutils.c
$(COMPILE)
dmwalk.o : $(ACPICA_CORE)/disassembler/dmwalk.c
$(COMPILE)
dsargs.o : $(ACPICA_CORE)/dispatcher/dsargs.c
$(COMPILE)
dscontrol.o : $(ACPICA_CORE)/dispatcher/dscontrol.c
$(COMPILE)
dsfield.o : $(ACPICA_CORE)/dispatcher/dsfield.c
$(COMPILE)
dsobject.o : $(ACPICA_CORE)/dispatcher/dsobject.c
$(COMPILE)
dsopcode.o : $(ACPICA_CORE)/dispatcher/dsopcode.c
$(COMPILE)
dsutils.o : $(ACPICA_CORE)/dispatcher/dsutils.c
$(COMPILE)
dswexec.o : $(ACPICA_CORE)/dispatcher/dswexec.c
$(COMPILE)
dswload.o : $(ACPICA_CORE)/dispatcher/dswload.c
$(COMPILE)
dswload2.o : $(ACPICA_CORE)/dispatcher/dswload2.c
$(COMPILE)
dswscope.o : $(ACPICA_CORE)/dispatcher/dswscope.c
$(COMPILE)
dswstate.o : $(ACPICA_CORE)/dispatcher/dswstate.c
$(COMPILE)
exconvrt.o : $(ACPICA_CORE)/executer/exconvrt.c
$(COMPILE)
excreate.o : $(ACPICA_CORE)/executer/excreate.c
$(COMPILE)
exdump.o : $(ACPICA_CORE)/executer/exdump.c
$(COMPILE)
exmisc.o : $(ACPICA_CORE)/executer/exmisc.c
$(COMPILE)
exmutex.o : $(ACPICA_CORE)/executer/exmutex.c
$(COMPILE)
exnames.o : $(ACPICA_CORE)/executer/exnames.c
$(COMPILE)
exoparg1.o : $(ACPICA_CORE)/executer/exoparg1.c
$(COMPILE)
exoparg2.o : $(ACPICA_CORE)/executer/exoparg2.c
$(COMPILE)
exoparg3.o : $(ACPICA_CORE)/executer/exoparg3.c
$(COMPILE)
exoparg6.o : $(ACPICA_CORE)/executer/exoparg6.c
$(COMPILE)
exprep.o : $(ACPICA_CORE)/executer/exprep.c
$(COMPILE)
exregion.o : $(ACPICA_CORE)/executer/exregion.c
$(COMPILE)
exresnte.o : $(ACPICA_CORE)/executer/exresnte.c
$(COMPILE)
exresolv.o : $(ACPICA_CORE)/executer/exresolv.c
$(COMPILE)
exresop.o : $(ACPICA_CORE)/executer/exresop.c
$(COMPILE)
exstore.o : $(ACPICA_CORE)/executer/exstore.c
$(COMPILE)
exstoren.o : $(ACPICA_CORE)/executer/exstoren.c
$(COMPILE)
exstorob.o : $(ACPICA_CORE)/executer/exstorob.c
$(COMPILE)
exsystem.o : $(ACPICA_CORE)/executer/exsystem.c
$(COMPILE)
exutils.o : $(ACPICA_CORE)/executer/exutils.c
$(COMPILE)
nsaccess.o : $(ACPICA_CORE)/namespace/nsaccess.c
$(COMPILE)
nsalloc.o : $(ACPICA_CORE)/namespace/nsalloc.c
$(COMPILE)
nsdump.o : $(ACPICA_CORE)/namespace/nsdump.c
$(COMPILE)
nsnames.o : $(ACPICA_CORE)/namespace/nsnames.c
$(COMPILE)
nsobject.o : $(ACPICA_CORE)/namespace/nsobject.c
$(COMPILE)
nsparse.o : $(ACPICA_CORE)/namespace/nsparse.c
$(COMPILE)
nssearch.o : $(ACPICA_CORE)/namespace/nssearch.c
$(COMPILE)
nsutils.o : $(ACPICA_CORE)/namespace/nsutils.c
$(COMPILE)
nswalk.o : $(ACPICA_CORE)/namespace/nswalk.c
$(COMPILE)
nsxfobj.o : $(ACPICA_CORE)/namespace/nsxfobj.c
$(COMPILE)
psargs.o : $(ACPICA_CORE)/parser/psargs.c
$(COMPILE)
psloop.o : $(ACPICA_CORE)/parser/psloop.c
$(COMPILE)
psopcode.o : $(ACPICA_CORE)/parser/psopcode.c
$(COMPILE)
psparse.o : $(ACPICA_CORE)/parser/psparse.c
$(COMPILE)
psscope.o : $(ACPICA_CORE)/parser/psscope.c
$(COMPILE)
pstree.o : $(ACPICA_CORE)/parser/pstree.c
$(COMPILE)
psutils.o : $(ACPICA_CORE)/parser/psutils.c
$(COMPILE)
pswalk.o : $(ACPICA_CORE)/parser/pswalk.c
$(COMPILE)
tbfadt.o : $(ACPICA_CORE)/tables/tbfadt.c
$(COMPILE)
tbinstal.o : $(ACPICA_CORE)/tables/tbinstal.c
$(COMPILE)
tbutils.o : $(ACPICA_CORE)/tables/tbutils.c
$(COMPILE)
tbxface.o : $(ACPICA_CORE)/tables/tbxface.c
$(COMPILE)
utalloc.o : $(ACPICA_CORE)/utilities/utalloc.c
$(COMPILE)
utcache.o : $(ACPICA_CORE)/utilities/utcache.c
$(COMPILE)
utcopy.o : $(ACPICA_CORE)/utilities/utcopy.c
$(COMPILE)
utdebug.o : $(ACPICA_CORE)/utilities/utdebug.c
$(COMPILE)
utdecode.o : $(ACPICA_CORE)/utilities/utdecode.c
$(COMPILE)
utdelete.o : $(ACPICA_CORE)/utilities/utdelete.c
$(COMPILE)
utglobal.o : $(ACPICA_CORE)/utilities/utglobal.c
$(COMPILE)
utinit.o : $(ACPICA_CORE)/utilities/utinit.c
$(COMPILE)
utlock.o : $(ACPICA_CORE)/utilities/utlock.c
$(COMPILE)
utmath.o : $(ACPICA_CORE)/utilities/utmath.c
$(COMPILE)
utmisc.o : $(ACPICA_CORE)/utilities/utmisc.c
$(COMPILE)
utmutex.o : $(ACPICA_CORE)/utilities/utmutex.c
$(COMPILE)
utobject.o : $(ACPICA_CORE)/utilities/utobject.c
$(COMPILE)
utresrc.o : $(ACPICA_CORE)/utilities/utresrc.c
$(COMPILE)
utstate.o : $(ACPICA_CORE)/utilities/utstate.c
$(COMPILE)
utxferror.o : $(ACPICA_CORE)/utilities/utxferror.c
$(COMPILE)
utxface.o : $(ACPICA_CORE)/utilities/utxface.c
$(COMPILE)
#
# Unix OS services layer (OSL)
#
osunixxf.o : $(ACPICA_OSL)/osunixxf.c
$(COMPILE)
clean :
rm -f $(PROG) $(PROG).exe $(OBJS) $(INTERMEDIATES) $(MISC)
install :
$(INSTALLPROG)

51
generate/unix/readme.txt Normal file
View File

@ -0,0 +1,51 @@
Unix ACPICA makefiles
---------------------
These makefiles are intended for generating the ACPICA utilities in
a Unix-like environment, with the original ACPICA code (not linuxized),
and in the original (git tree) ACPICA directory structure.
The top level makefile will generate the following utilities:
acpiexec
acpinames
acpisrc
acpixtract
iasl
Requirements
------------
make
gcc compiler (3+ or 4+)
bison
flex
Configuration
-------------
The Makefile.config file contains the configuration information:
HOST = _CYGWIN /* Host system, must appear in acenv.h */
CC = gcc-4 /* C compiler */
ACPICA_SRC = ../../../source /* Location of acpica source tree */
Intermediate Files
------------------
The intermediate files for each utility (.o, etc.) are placed in the
subdirectory corresponding to each utility, not in the source code
tree itself. This prevents collisions when different utilities compile
the same source modules with different options.
Output
------
The executable utilities are copied to the local bin directory.
"make install" will install the binaries to /usr/bin

View File

@ -98,9 +98,9 @@ AcpiDbSingleStep (
/*
* dbcmds - debug commands and output routines
*/
ACPI_STATUS
AcpiDbDisassembleMethod (
char *Name);
ACPI_NAMESPACE_NODE *
AcpiDbConvertToNode (
char *InString);
void
AcpiDbDisplayTableInfo (
@ -111,72 +111,20 @@ AcpiDbUnloadAcpiTable (
char *TableArg,
char *InstanceArg);
void
AcpiDbSetMethodBreakpoint (
char *Location,
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op);
void
AcpiDbSetMethodCallBreakpoint (
ACPI_PARSE_OBJECT *Op);
void
AcpiDbGetBusInfo (
void);
void
AcpiDbDisassembleAml (
char *Statements,
ACPI_PARSE_OBJECT *Op);
void
AcpiDbDumpNamespace (
char *StartArg,
char *DepthArg);
void
AcpiDbDumpNamespaceByOwner (
char *OwnerArg,
char *DepthArg);
void
AcpiDbSendNotify (
char *Name,
UINT32 Value);
void
AcpiDbSetMethodData (
char *TypeArg,
char *IndexArg,
char *ValueArg);
ACPI_STATUS
AcpiDbDisplayObjects (
char *ObjTypeArg,
char *DisplayCountArg);
void
AcpiDbDisplayInterfaces (
char *ActionArg,
char *InterfaceNameArg);
ACPI_STATUS
AcpiDbFindNameInNamespace (
char *NameArg);
void
AcpiDbSetScope (
char *Name);
ACPI_STATUS
AcpiDbSleep (
char *ObjectArg);
void
AcpiDbFindReferences (
char *ObjectArg);
void
AcpiDbDisplayLocks (
void);
@ -190,7 +138,7 @@ AcpiDbDisplayGpes (
void);
void
AcpiDbCheckIntegrity (
AcpiDbDisplayHandlers (
void);
void
@ -198,14 +146,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
*/

View File

@ -127,6 +127,8 @@ typedef const struct acpi_dmtable_info
#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
typedef

View File

@ -51,7 +51,7 @@
/*
* dsopcode - support for late evaluation
* dsargs - execution of dynamic arguments for static objects
*/
ACPI_STATUS
AcpiDsGetBufferFieldArguments (
@ -73,6 +73,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,
@ -104,20 +122,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
*/
@ -169,9 +173,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);
@ -180,6 +189,10 @@ ACPI_STATUS
AcpiDsLoad1EndOp (
ACPI_WALK_STATE *WalkState);
/*
* dsload - Parser/Interpreter interface, pass 2 namespace load callbacks
*/
ACPI_STATUS
AcpiDsLoad2BeginOp (
ACPI_WALK_STATE *WalkState,
@ -189,11 +202,6 @@ ACPI_STATUS
AcpiDsLoad2EndOp (
ACPI_WALK_STATE *WalkState);
ACPI_STATUS
AcpiDsInitCallbacks (
ACPI_WALK_STATE *WalkState,
UINT32 PassNumber);
/*
* dsmthdat - method data (locals/args)

View File

@ -245,6 +245,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;

View File

@ -93,25 +93,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 */

View File

@ -186,13 +186,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
/*

View File

@ -48,7 +48,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
#define ACPI_CA_VERSION 0x20110112
#define ACPI_CA_VERSION 0x20110211
#include "actypes.h"
#include "actbl.h"

View File

@ -397,4 +397,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__ */

View File

@ -410,8 +410,11 @@ AcpiTbConvertFadt (
*
* The ACPI 1.0 reserved fields that will be zeroed are the bytes located
* at offset 45, 55, 95, and the word located at offset 109, 110.
*
* Note: The FADT revision value is unreliable. Only the length can be
* trusted.
*/
if (AcpiGbl_FADT.Header.Revision < 3)
if (AcpiGbl_FADT.Header.Length <= ACPI_FADT_V2_SIZE)
{
AcpiGbl_FADT.PreferredProfile = 0;
AcpiGbl_FADT.PstateControl = 0;

View File

@ -165,6 +165,29 @@ DefinitionBlock ("badcode.aml", "DSDT", 1, "Intel", "Example", 0x00000001)
Name (_INI, 1)
Name (_PTP, 2)
// GPE methods that cause type collision (L vs. E)
Scope (\_GPE)
{
Method (_L1D)
{
}
Method (_E1D)
{
}
}
// Predefined names that should not have a return value
Method (_FDM, 1)
{
Return (Buffer(1){0x33})
}
Method (_Q22)
{
Return ("Unexpected Return Value")
}
/*
* Resource Descriptor error checking
*/
@ -172,10 +195,10 @@ DefinitionBlock ("badcode.aml", "DSDT", 1, "Intel", "Example", 0x00000001)
{
// Illegal nested StartDependent macros
StartDependentFn (0, 0)
{
StartDependentFn (0, 0)
{
StartDependentFn (0, 0)
{
StartDependentFn (0, 0)
{
}
}

View File

@ -27,6 +27,8 @@ OBJS = \
dbfileio.o \
dbhistry.o \
dbinput.o \
dbmethod.o \
dbnames.o \
dbstats.o \
dbutils.o \
dbxface.o \
@ -39,6 +41,8 @@ OBJS = \
dmresrcs.o \
dmutils.o \
dmwalk.o \
dsargs.o \
dscontrol.o \
dsfield.o \
dsinit.o \
dsmethod.o \
@ -48,6 +52,7 @@ OBJS = \
dsutils.o \
dswexec.o \
dswload.o \
dswload2.o \
dswscope.o \
dswstate.o \
evevent.o \
@ -146,6 +151,7 @@ OBJS = \
utcache.o \
utcopy.o \
utdebug.o \
utdecode.o \
utdelete.o \
uteval.o \
utglobal.o \
@ -216,6 +222,12 @@ dbhistry.o : $(ACPICA_CORE)/debugger/dbhistry.c
dbinput.o : $(ACPICA_CORE)/debugger/dbinput.c
$(COMPILE)
dbmethod.o : $(ACPICA_CORE)/debugger/dbmethod.c
$(COMPILE)
dbnames.o : $(ACPICA_CORE)/debugger/dbnames.c
$(COMPILE)
dbstats.o : $(ACPICA_CORE)/debugger/dbstats.c
$(COMPILE)
@ -252,6 +264,12 @@ dmutils.o : $(ACPICA_CORE)/disassembler/dmutils.c
dmwalk.o : $(ACPICA_CORE)/disassembler/dmwalk.c
$(COMPILE)
dsargs.o : $(ACPICA_CORE)/dispatcher/dsargs.c
$(COMPILE)
dscontrol.o : $(ACPICA_CORE)/dispatcher/dscontrol.c
$(COMPILE)
dsfield.o : $(ACPICA_CORE)/dispatcher/dsfield.c
$(COMPILE)
@ -279,6 +297,9 @@ dswexec.o : $(ACPICA_CORE)/dispatcher/dswexec.c
dswload.o : $(ACPICA_CORE)/dispatcher/dswload.c
$(COMPILE)
dswload2.o : $(ACPICA_CORE)/dispatcher/dswload2.c
$(COMPILE)
dswscope.o : $(ACPICA_CORE)/dispatcher/dswscope.c
$(COMPILE)
@ -567,6 +588,9 @@ utcopy.o : $(ACPICA_CORE)/utilities/utcopy.c
utdebug.o : $(ACPICA_CORE)/utilities/utdebug.c
$(COMPILE)
utdebug.o : $(ACPICA_CORE)/utilities/utdebug.c
$(COMPILE)
utdelete.o : $(ACPICA_CORE)/utilities/utdelete.c
$(COMPILE)

View File

@ -160,7 +160,11 @@ AeDisplayAllMethods (
UINT32 DisplayCount);
ACPI_STATUS
AeInstallHandlers (
AeInstallEarlyHandlers (
void);
ACPI_STATUS
AeInstallLateHandlers (
void);
void

View File

@ -91,10 +91,41 @@ AeInterfaceHandler (
ACPI_STRING InterfaceName,
UINT32 Supported);
static UINT32
AeEventHandler (
void *Context);
static UINT32 SigintCount = 0;
static AE_DEBUG_REGIONS AeRegions;
/*
* We will override default region handlers for memory and I/O. Especially
* the SystemMemory handler, which must be implemented locally to simulate
* memory operation regions. Do not override the PCI_Config handler since
* we would like to exercise the default handler code. Do not override
* DataTable handler, since the default handler works correctly under
* acpiexec (and is used by the test suites.)
*/
static ACPI_ADR_SPACE_TYPE DefaultSpaceIdList[] =
{
ACPI_ADR_SPACE_SYSTEM_MEMORY,
ACPI_ADR_SPACE_SYSTEM_IO
};
/*
* We will install handlers for some of the various address space IDs
*/
static ACPI_ADR_SPACE_TYPE SpaceIdList[] =
{
ACPI_ADR_SPACE_EC,
ACPI_ADR_SPACE_SMBUS,
ACPI_ADR_SPACE_PCI_BAR_TARGET,
ACPI_ADR_SPACE_IPMI,
ACPI_ADR_SPACE_FIXED_HARDWARE
};
/******************************************************************************
*
* FUNCTION: AeCtrlCHandler
@ -483,6 +514,22 @@ AeInterfaceHandler (
}
/******************************************************************************
*
* FUNCTION: AeEventHandler
*
* DESCRIPTION: Handler for Fixed Events
*
*****************************************************************************/
static UINT32
AeEventHandler (
void *Context)
{
return (0);
}
/******************************************************************************
*
* FUNCTION: AeRegionInit
@ -513,7 +560,58 @@ AeRegionInit (
/******************************************************************************
*
* FUNCTION: AeInstallHandlers
* FUNCTION: AeInstallLateHandlers
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Install handlers for the AcpiExec utility.
*
*****************************************************************************/
ACPI_STATUS
AeInstallLateHandlers (
void)
{
ACPI_STATUS Status;
UINT32 i;
/* Install some fixed event handlers */
Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL, AeEventHandler, NULL);
AE_CHECK_OK (AcpiInstallFixedEventHandler, Status);
Status = AcpiInstallFixedEventHandler (ACPI_EVENT_RTC, AeEventHandler, NULL);
AE_CHECK_OK (AcpiInstallFixedEventHandler, Status);
/*
* Install handlers for some of the "device driver" address spaces
* such as EC, SMBus, etc.
*/
for (i = 0; i < ACPI_ARRAY_LENGTH (SpaceIdList); i++)
{
/* Install handler at the root object */
Status = AcpiInstallAddressSpaceHandler (AcpiGbl_RootNode,
SpaceIdList[i], AeRegionHandler, AeRegionInit, NULL);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Could not install an OpRegion handler for %s space(%u)",
AcpiUtGetRegionName((UINT8) SpaceIdList[i]), SpaceIdList[i]));
return (Status);
}
}
return (AE_OK);
}
/******************************************************************************
*
* FUNCTION: AeInstallEarlyHandlers
*
* PARAMETERS: None
*
@ -526,11 +624,9 @@ AeRegionInit (
*
*****************************************************************************/
static ACPI_ADR_SPACE_TYPE SpaceIdList[] = {0, 1, 3, 4, 5, 6, 7, 0x80};
#define AEXEC_NUM_REGIONS 8
ACPI_STATUS
AeInstallHandlers (void)
AeInstallEarlyHandlers (
void)
{
ACPI_STATUS Status;
UINT32 i;
@ -628,25 +724,24 @@ AeInstallHandlers (void)
printf ("No _SB_ found, %s\n", AcpiFormatException (Status));
}
/* Set a handler for all supported operation regions */
for (i = 0; i < AEXEC_NUM_REGIONS; i++)
/*
* Install handlers that will override the default handlers for some of
* the space IDs.
*/
for (i = 0; i < ACPI_ARRAY_LENGTH (DefaultSpaceIdList); i++)
{
/* Remove any existing handler */
/* Install handler at the root object */
(void) AcpiRemoveAddressSpaceHandler (AcpiGbl_RootNode,
SpaceIdList[i], AeRegionHandler);
/* Install handler at the root object.
* TBD: all default handlers should be installed here!
*/
Status = AcpiInstallAddressSpaceHandler (AcpiGbl_RootNode,
SpaceIdList[i], AeRegionHandler, AeRegionInit, NULL);
DefaultSpaceIdList[i], AeRegionHandler,
AeRegionInit, NULL);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Could not install an OpRegion handler for %s space(%u)",
AcpiUtGetRegionName((UINT8) SpaceIdList[i]), SpaceIdList[i]));
"Could not install a default OpRegion handler for %s space(%u)",
AcpiUtGetRegionName ((UINT8) DefaultSpaceIdList[i]),
DefaultSpaceIdList[i]));
return (Status);
}
}
@ -657,7 +752,6 @@ AeInstallHandlers (void)
*/
AeRegions.NumberOfRegions = 0;
AeRegions.RegionList = NULL;
return (Status);
}

View File

@ -616,15 +616,18 @@ main (
goto enterloop;
}
Status = AeInstallHandlers ();
/*
* Install most of the handlers.
* Override some default region handlers, especially SystemMemory
*/
Status = AeInstallEarlyHandlers ();
if (ACPI_FAILURE (Status))
{
goto enterloop;
}
/*
* TBD:
* Need a way to call this after the "LOAD" command
* TBD: Need a way to call this after the "LOAD" command
*/
Status = AcpiEnableSubsystem (InitFlags);
if (ACPI_FAILURE (Status))
@ -640,6 +643,11 @@ main (
goto enterloop;
}
/*
* Install handlers for "device driver" space IDs (EC,SMBus, etc.)
* and fixed event handlers
*/
AeInstallLateHandlers ();
AeMiscellaneousTests ();
}

298
tools/acpinames/Makefile Normal file
View File

@ -0,0 +1,298 @@
#
# AcpiNames utility
#
PROG = acpinames
ACPICA_SRC = ../..
ACPICA_COMMON = $(ACPICA_SRC)/common
ACPICA_CORE = $(ACPICA_SRC)
ACPICA_TOOLS = $(ACPICA_SRC)/tools
ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers
NOMAN= YES
CFLAGS+= -Wall -g -D_LINUX -DNDEBUG -D_CONSOLE -DACPI_APPLICATION -DACPI_SINGLE_THREADED -DACPI_DEBUGGER -Wstrict-prototypes -I$(ACPICA_SRC)/include -I$(ACPICA_TOOLS)/acpinames
COMPILE = $(CC) -c $(CFLAGS) -o$@ $?
LDFLAGS += -lpthread -lrt
OBJS = \
anmain.o \
anstubs.o \
antables.o \
dbfileio.o \
dsfield.o \
dsmthdat.o \
dsobject.o \
dsutils.o \
dswload.o \
dswload2.o \
dswscope.o \
dswstate.o \
excreate.o \
exnames.o \
exresnte.o \
exresolv.o \
exutils.o \
getopt.o \
nsaccess.o \
nsalloc.o \
nsdump.o \
nsinit.o \
nsload.o \
nsnames.o \
nsobject.o \
nsparse.o \
nssearch.o \
nsutils.o \
nswalk.o \
nsxfeval.o \
nsxfname.o \
nsxfobj.o \
osunixxf.o \
psargs.o \
psloop.o \
psopcode.o \
psparse.o \
psscope.o \
pstree.o \
psutils.o \
pswalk.o \
psxface.o \
tbfadt.o \
tbfind.o \
tbinstal.o \
tbutils.o \
tbxface.o \
tbxfroot.o \
utalloc.o \
utcache.o \
utdebug.o \
utdecode.o \
utdelete.o \
utglobal.o \
utlock.o \
utmath.o \
utmisc.o \
utmutex.o \
utobject.o \
utstate.o \
utosi.o \
utxferror.o \
utxface.o
#
# Root rule
#
$(PROG) : $(OBJS)
$(CC) $(LDFLAGS) $(OBJS) -lpthread -o $(PROG)
$(COPYPROG)
#
# acpinames source
#
anmain.o : $(ACPICA_TOOLS)/acpinames/anmain.c
$(COMPILE)
anstubs.o : $(ACPICA_TOOLS)/acpinames/anstubs.c
$(COMPILE)
antables.o : $(ACPICA_TOOLS)/acpinames/antables.c
$(COMPILE)
#
# ACPICA core source - common
#
getopt.o : $(ACPICA_COMMON)/getopt.c
$(COMPILE)
#
# ACPICA core source
#
dbfileio.o : $(ACPICA_CORE)/debugger/dbfileio.c
$(COMPILE)
dsfield.o : $(ACPICA_CORE)/dispatcher/dsfield.c
$(COMPILE)
dsmthdat.o : $(ACPICA_CORE)/dispatcher/dsmthdat.c
$(COMPILE)
dsobject.o : $(ACPICA_CORE)/dispatcher/dsobject.c
$(COMPILE)
dsutils.o : $(ACPICA_CORE)/dispatcher/dsutils.c
$(COMPILE)
dswload.o : $(ACPICA_CORE)/dispatcher/dswload.c
$(COMPILE)
dswload2.o : $(ACPICA_CORE)/dispatcher/dswload2.c
$(COMPILE)
dswscope.o : $(ACPICA_CORE)/dispatcher/dswscope.c
$(COMPILE)
dswstate.o : $(ACPICA_CORE)/dispatcher/dswstate.c
$(COMPILE)
excreate.o : $(ACPICA_CORE)/executer/excreate.c
$(COMPILE)
exnames.o : $(ACPICA_CORE)/executer/exnames.c
$(COMPILE)
exresnte.o : $(ACPICA_CORE)/executer/exresnte.c
$(COMPILE)
exresolv.o : $(ACPICA_CORE)/executer/exresolv.c
$(COMPILE)
exutils.o : $(ACPICA_CORE)/executer/exutils.c
$(COMPILE)
nsaccess.o : $(ACPICA_CORE)/namespace/nsaccess.c
$(COMPILE)
nsalloc.o : $(ACPICA_CORE)/namespace/nsalloc.c
$(COMPILE)
nsdump.o : $(ACPICA_CORE)/namespace/nsdump.c
$(COMPILE)
nsinit.o : $(ACPICA_CORE)/namespace/nsinit.c
$(COMPILE)
nsload.o : $(ACPICA_CORE)/namespace/nsload.c
$(COMPILE)
nsnames.o : $(ACPICA_CORE)/namespace/nsnames.c
$(COMPILE)
nsobject.o : $(ACPICA_CORE)/namespace/nsobject.c
$(COMPILE)
nsparse.o : $(ACPICA_CORE)/namespace/nsparse.c
$(COMPILE)
nssearch.o : $(ACPICA_CORE)/namespace/nssearch.c
$(COMPILE)
nsutils.o : $(ACPICA_CORE)/namespace/nsutils.c
$(COMPILE)
nswalk.o : $(ACPICA_CORE)/namespace/nswalk.c
$(COMPILE)
nsxfeval.o : $(ACPICA_CORE)/namespace/nsxfeval.c
$(COMPILE)
nsxfname.o : $(ACPICA_CORE)/namespace/nsxfname.c
$(COMPILE)
nsxfobj.o : $(ACPICA_CORE)/namespace/nsxfobj.c
$(COMPILE)
psargs.o : $(ACPICA_CORE)/parser/psargs.c
$(COMPILE)
psloop.o : $(ACPICA_CORE)/parser/psloop.c
$(COMPILE)
psopcode.o : $(ACPICA_CORE)/parser/psopcode.c
$(COMPILE)
psparse.o : $(ACPICA_CORE)/parser/psparse.c
$(COMPILE)
psscope.o : $(ACPICA_CORE)/parser/psscope.c
$(COMPILE)
pstree.o : $(ACPICA_CORE)/parser/pstree.c
$(COMPILE)
psutils.o : $(ACPICA_CORE)/parser/psutils.c
$(COMPILE)
pswalk.o : $(ACPICA_CORE)/parser/pswalk.c
$(COMPILE)
psxface.o : $(ACPICA_CORE)/parser/psxface.c
$(COMPILE)
tbfadt.o : $(ACPICA_CORE)/tables/tbfadt.c
$(COMPILE)
tbfind.o : $(ACPICA_CORE)/tables/tbfind.c
$(COMPILE)
tbinstal.o : $(ACPICA_CORE)/tables/tbinstal.c
$(COMPILE)
tbutils.o : $(ACPICA_CORE)/tables/tbutils.c
$(COMPILE)
tbxface.o : $(ACPICA_CORE)/tables/tbxface.c
$(COMPILE)
tbxfroot.o : $(ACPICA_CORE)/tables/tbxfroot.c
$(COMPILE)
utalloc.o : $(ACPICA_CORE)/utilities/utalloc.c
$(COMPILE)
utcache.o : $(ACPICA_CORE)/utilities/utcache.c
$(COMPILE)
utdebug.o : $(ACPICA_CORE)/utilities/utdebug.c
$(COMPILE)
utdecode.o : $(ACPICA_CORE)/utilities/utdecode.c
$(COMPILE)
utdelete.o : $(ACPICA_CORE)/utilities/utdelete.c
$(COMPILE)
utglobal.o : $(ACPICA_CORE)/utilities/utglobal.c
$(COMPILE)
utlock.o : $(ACPICA_CORE)/utilities/utlock.c
$(COMPILE)
utmath.o : $(ACPICA_CORE)/utilities/utmath.c
$(COMPILE)
utmisc.o : $(ACPICA_CORE)/utilities/utmisc.c
$(COMPILE)
utmutex.o : $(ACPICA_CORE)/utilities/utmutex.c
$(COMPILE)
utobject.o : $(ACPICA_CORE)/utilities/utobject.c
$(COMPILE)
utstate.o : $(ACPICA_CORE)/utilities/utstate.c
$(COMPILE)
utosi.o : $(ACPICA_CORE)/utilities/utosi.c
$(COMPILE)
utxferror.o : $(ACPICA_CORE)/utilities/utxferror.c
$(COMPILE)
utxface.o : $(ACPICA_CORE)/utilities/utxface.c
$(COMPILE)
#
# Unix OS services layer (OSL)
#
osunixxf.o : $(ACPICA_OSL)/osunixxf.c
$(COMPILE)
clean :
rm -f $(PROG) $(PROG).exe $(OBJS)

View File

@ -236,6 +236,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = {
{"ACPI_GPE_WALK_INFO", SRC_TYPE_STRUCT},
{"ACPI_GPE_XRUPT_INFO", SRC_TYPE_STRUCT},
{"ACPI_HANDLE", SRC_TYPE_SIMPLE},
{"ACPI_HANDLER_INFO", SRC_TYPE_STRUCT},
{"ACPI_INIT_HANDLER", SRC_TYPE_SIMPLE},
{"ACPI_IDENTIFIER_TABLE", SRC_TYPE_STRUCT},
{"ACPI_INIT_WALK_INFO", SRC_TYPE_STRUCT},

627
utilities/utdecode.c Normal file
View File

@ -0,0 +1,627 @@
/******************************************************************************
*
* Module Name: utdecode - Utility decoding routines (value-to-string)
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2011, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#define __UTDECODE_C__
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utdecode")
/*******************************************************************************
*
* FUNCTION: AcpiFormatException
*
* PARAMETERS: Status - The ACPI_STATUS code to be formatted
*
* RETURN: A string containing the exception text. A valid pointer is
* always returned.
*
* DESCRIPTION: This function translates an ACPI exception into an ASCII string
* It is here instead of utxface.c so it is always present.
*
******************************************************************************/
const char *
AcpiFormatException (
ACPI_STATUS Status)
{
const char *Exception = NULL;
ACPI_FUNCTION_ENTRY ();
Exception = AcpiUtValidateException (Status);
if (!Exception)
{
/* Exception code was not recognized */
ACPI_ERROR ((AE_INFO,
"Unknown exception code: 0x%8.8X", Status));
Exception = "UNKNOWN_STATUS_CODE";
}
return (ACPI_CAST_PTR (const char, Exception));
}
ACPI_EXPORT_SYMBOL (AcpiFormatException)
/*
* Properties of the ACPI Object Types, both internal and external.
* The table is indexed by values of ACPI_OBJECT_TYPE
*/
const UINT8 AcpiGbl_NsProperties[ACPI_NUM_NS_TYPES] =
{
ACPI_NS_NORMAL, /* 00 Any */
ACPI_NS_NORMAL, /* 01 Number */
ACPI_NS_NORMAL, /* 02 String */
ACPI_NS_NORMAL, /* 03 Buffer */
ACPI_NS_NORMAL, /* 04 Package */
ACPI_NS_NORMAL, /* 05 FieldUnit */
ACPI_NS_NEWSCOPE, /* 06 Device */
ACPI_NS_NORMAL, /* 07 Event */
ACPI_NS_NEWSCOPE, /* 08 Method */
ACPI_NS_NORMAL, /* 09 Mutex */
ACPI_NS_NORMAL, /* 10 Region */
ACPI_NS_NEWSCOPE, /* 11 Power */
ACPI_NS_NEWSCOPE, /* 12 Processor */
ACPI_NS_NEWSCOPE, /* 13 Thermal */
ACPI_NS_NORMAL, /* 14 BufferField */
ACPI_NS_NORMAL, /* 15 DdbHandle */
ACPI_NS_NORMAL, /* 16 Debug Object */
ACPI_NS_NORMAL, /* 17 DefField */
ACPI_NS_NORMAL, /* 18 BankField */
ACPI_NS_NORMAL, /* 19 IndexField */
ACPI_NS_NORMAL, /* 20 Reference */
ACPI_NS_NORMAL, /* 21 Alias */
ACPI_NS_NORMAL, /* 22 MethodAlias */
ACPI_NS_NORMAL, /* 23 Notify */
ACPI_NS_NORMAL, /* 24 Address Handler */
ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Desc */
ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 26 Resource Field */
ACPI_NS_NEWSCOPE, /* 27 Scope */
ACPI_NS_NORMAL, /* 28 Extra */
ACPI_NS_NORMAL, /* 29 Data */
ACPI_NS_NORMAL /* 30 Invalid */
};
/*******************************************************************************
*
* FUNCTION: AcpiUtHexToAsciiChar
*
* PARAMETERS: Integer - Contains the hex digit
* Position - bit position of the digit within the
* integer (multiple of 4)
*
* RETURN: The converted Ascii character
*
* DESCRIPTION: Convert a hex digit to an Ascii character
*
******************************************************************************/
/* Hex to ASCII conversion table */
static const char AcpiGbl_HexToAscii[] =
{
'0','1','2','3','4','5','6','7',
'8','9','A','B','C','D','E','F'
};
char
AcpiUtHexToAsciiChar (
UINT64 Integer,
UINT32 Position)
{
return (AcpiGbl_HexToAscii[(Integer >> Position) & 0xF]);
}
/*******************************************************************************
*
* FUNCTION: AcpiUtGetRegionName
*
* PARAMETERS: Space ID - ID for the region
*
* RETURN: Decoded region SpaceId name
*
* DESCRIPTION: Translate a Space ID into a name string (Debug only)
*
******************************************************************************/
/* Region type decoding */
const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] =
{
"SystemMemory",
"SystemIO",
"PCI_Config",
"EmbeddedControl",
"SMBus",
"SystemCMOS",
"PCIBARTarget",
"IPMI",
"DataTable"
};
char *
AcpiUtGetRegionName (
UINT8 SpaceId)
{
if (SpaceId >= ACPI_USER_REGION_BEGIN)
{
return ("UserDefinedRegion");
}
else if (SpaceId == ACPI_ADR_SPACE_FIXED_HARDWARE)
{
return ("FunctionalFixedHW");
}
else if (SpaceId >= ACPI_NUM_PREDEFINED_REGIONS)
{
return ("InvalidSpaceId");
}
return (ACPI_CAST_PTR (char, AcpiGbl_RegionTypes[SpaceId]));
}
/*******************************************************************************
*
* FUNCTION: AcpiUtGetEventName
*
* PARAMETERS: EventId - Fixed event ID
*
* RETURN: Decoded event ID name
*
* DESCRIPTION: Translate a Event ID into a name string (Debug only)
*
******************************************************************************/
/* Event type decoding */
static const char *AcpiGbl_EventTypes[ACPI_NUM_FIXED_EVENTS] =
{
"PM_Timer",
"GlobalLock",
"PowerButton",
"SleepButton",
"RealTimeClock",
};
char *
AcpiUtGetEventName (
UINT32 EventId)
{
if (EventId > ACPI_EVENT_MAX)
{
return ("InvalidEventID");
}
return (ACPI_CAST_PTR (char, AcpiGbl_EventTypes[EventId]));
}
/*******************************************************************************
*
* FUNCTION: AcpiUtGetTypeName
*
* PARAMETERS: Type - An ACPI object type
*
* RETURN: Decoded ACPI object type name
*
* DESCRIPTION: Translate a Type ID into a name string (Debug only)
*
******************************************************************************/
/*
* Elements of AcpiGbl_NsTypeNames below must match
* one-to-one with values of ACPI_OBJECT_TYPE
*
* The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching;
* when stored in a table it really means that we have thus far seen no
* evidence to indicate what type is actually going to be stored for this entry.
*/
static const char AcpiGbl_BadType[] = "UNDEFINED";
/* Printable names of the ACPI object types */
static const char *AcpiGbl_NsTypeNames[] =
{
/* 00 */ "Untyped",
/* 01 */ "Integer",
/* 02 */ "String",
/* 03 */ "Buffer",
/* 04 */ "Package",
/* 05 */ "FieldUnit",
/* 06 */ "Device",
/* 07 */ "Event",
/* 08 */ "Method",
/* 09 */ "Mutex",
/* 10 */ "Region",
/* 11 */ "Power",
/* 12 */ "Processor",
/* 13 */ "Thermal",
/* 14 */ "BufferField",
/* 15 */ "DdbHandle",
/* 16 */ "DebugObject",
/* 17 */ "RegionField",
/* 18 */ "BankField",
/* 19 */ "IndexField",
/* 20 */ "Reference",
/* 21 */ "Alias",
/* 22 */ "MethodAlias",
/* 23 */ "Notify",
/* 24 */ "AddrHandler",
/* 25 */ "ResourceDesc",
/* 26 */ "ResourceFld",
/* 27 */ "Scope",
/* 28 */ "Extra",
/* 29 */ "Data",
/* 30 */ "Invalid"
};
char *
AcpiUtGetTypeName (
ACPI_OBJECT_TYPE Type)
{
if (Type > ACPI_TYPE_INVALID)
{
return (ACPI_CAST_PTR (char, AcpiGbl_BadType));
}
return (ACPI_CAST_PTR (char, AcpiGbl_NsTypeNames[Type]));
}
char *
AcpiUtGetObjectTypeName (
ACPI_OPERAND_OBJECT *ObjDesc)
{
if (!ObjDesc)
{
return ("[NULL Object Descriptor]");
}
return (AcpiUtGetTypeName (ObjDesc->Common.Type));
}
/*******************************************************************************
*
* FUNCTION: AcpiUtGetNodeName
*
* PARAMETERS: Object - A namespace node
*
* RETURN: ASCII name of the node
*
* DESCRIPTION: Validate the node and return the node's ACPI name.
*
******************************************************************************/
char *
AcpiUtGetNodeName (
void *Object)
{
ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) Object;
/* Must return a string of exactly 4 characters == ACPI_NAME_SIZE */
if (!Object)
{
return ("NULL");
}
/* Check for Root node */
if ((Object == ACPI_ROOT_OBJECT) ||
(Object == AcpiGbl_RootNode))
{
return ("\"\\\" ");
}
/* Descriptor must be a namespace node */
if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
{
return ("####");
}
/*
* Ensure name is valid. The name was validated/repaired when the node
* was created, but make sure it has not been corrupted.
*/
AcpiUtRepairName (Node->Name.Ascii);
/* Return the name */
return (Node->Name.Ascii);
}
/*******************************************************************************
*
* FUNCTION: AcpiUtGetDescriptorName
*
* PARAMETERS: Object - An ACPI object
*
* RETURN: Decoded name of the descriptor type
*
* DESCRIPTION: Validate object and return the descriptor type
*
******************************************************************************/
/* Printable names of object descriptor types */
static const char *AcpiGbl_DescTypeNames[] =
{
/* 00 */ "Not a Descriptor",
/* 01 */ "Cached",
/* 02 */ "State-Generic",
/* 03 */ "State-Update",
/* 04 */ "State-Package",
/* 05 */ "State-Control",
/* 06 */ "State-RootParseScope",
/* 07 */ "State-ParseScope",
/* 08 */ "State-WalkScope",
/* 09 */ "State-Result",
/* 10 */ "State-Notify",
/* 11 */ "State-Thread",
/* 12 */ "Walk",
/* 13 */ "Parser",
/* 14 */ "Operand",
/* 15 */ "Node"
};
char *
AcpiUtGetDescriptorName (
void *Object)
{
if (!Object)
{
return ("NULL OBJECT");
}
if (ACPI_GET_DESCRIPTOR_TYPE (Object) > ACPI_DESC_TYPE_MAX)
{
return ("Not a Descriptor");
}
return (ACPI_CAST_PTR (char,
AcpiGbl_DescTypeNames[ACPI_GET_DESCRIPTOR_TYPE (Object)]));
}
/*******************************************************************************
*
* FUNCTION: AcpiUtGetReferenceName
*
* PARAMETERS: Object - An ACPI reference object
*
* RETURN: Decoded name of the type of reference
*
* DESCRIPTION: Decode a reference object sub-type to a string.
*
******************************************************************************/
/* Printable names of reference object sub-types */
static const char *AcpiGbl_RefClassNames[] =
{
/* 00 */ "Local",
/* 01 */ "Argument",
/* 02 */ "RefOf",
/* 03 */ "Index",
/* 04 */ "DdbHandle",
/* 05 */ "Named Object",
/* 06 */ "Debug"
};
const char *
AcpiUtGetReferenceName (
ACPI_OPERAND_OBJECT *Object)
{
if (!Object)
{
return ("NULL Object");
}
if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND)
{
return ("Not an Operand object");
}
if (Object->Common.Type != ACPI_TYPE_LOCAL_REFERENCE)
{
return ("Not a Reference object");
}
if (Object->Reference.Class > ACPI_REFCLASS_MAX)
{
return ("Unknown Reference class");
}
return (AcpiGbl_RefClassNames[Object->Reference.Class]);
}
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
/*
* Strings and procedures used for debug only
*/
/*******************************************************************************
*
* FUNCTION: AcpiUtGetMutexName
*
* PARAMETERS: MutexId - The predefined ID for this mutex.
*
* RETURN: Decoded name of the internal mutex
*
* DESCRIPTION: Translate a mutex ID into a name string (Debug only)
*
******************************************************************************/
/* Names for internal mutex objects, used for debug output */
static char *AcpiGbl_MutexNames[ACPI_NUM_MUTEX] =
{
"ACPI_MTX_Interpreter",
"ACPI_MTX_Namespace",
"ACPI_MTX_Tables",
"ACPI_MTX_Events",
"ACPI_MTX_Caches",
"ACPI_MTX_Memory",
"ACPI_MTX_CommandComplete",
"ACPI_MTX_CommandReady"
};
char *
AcpiUtGetMutexName (
UINT32 MutexId)
{
if (MutexId > ACPI_MAX_MUTEX)
{
return ("Invalid Mutex ID");
}
return (AcpiGbl_MutexNames[MutexId]);
}
/*******************************************************************************
*
* FUNCTION: AcpiUtGetNotifyName
*
* PARAMETERS: NotifyValue - Value from the Notify() request
*
* RETURN: Decoded name for the notify value
*
* DESCRIPTION: Translate a Notify Value to a notify namestring.
*
******************************************************************************/
/* Names for Notify() values, used for debug output */
static const char *AcpiGbl_NotifyValueNames[] =
{
"Bus Check",
"Device Check",
"Device Wake",
"Eject Request",
"Device Check Light",
"Frequency Mismatch",
"Bus Mode Mismatch",
"Power Fault",
"Capabilities Check",
"Device PLD Check",
"Reserved",
"System Locality Update"
};
const char *
AcpiUtGetNotifyName (
UINT32 NotifyValue)
{
if (NotifyValue <= ACPI_NOTIFY_MAX)
{
return (AcpiGbl_NotifyValueNames[NotifyValue]);
}
else if (NotifyValue <= ACPI_MAX_SYS_NOTIFY)
{
return ("Reserved");
}
else /* Greater or equal to 0x80 */
{
return ("**Device Specific**");
}
}
#endif
/*******************************************************************************
*
* FUNCTION: AcpiUtValidObjectType
*
* PARAMETERS: Type - Object type to be validated
*
* RETURN: TRUE if valid object type, FALSE otherwise
*
* DESCRIPTION: Validate an object type
*
******************************************************************************/
BOOLEAN
AcpiUtValidObjectType (
ACPI_OBJECT_TYPE Type)
{
if (Type > ACPI_TYPE_LOCAL_MAX)
{
/* Note: Assumes all TYPEs are contiguous (external/local) */
return (FALSE);
}
return (TRUE);
}

View File

@ -46,7 +46,6 @@
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utglobal")
@ -118,47 +117,6 @@ const char *AcpiGbl_HighestDstateNames[ACPI_NUM_SxD_METHODS] =
};
/*******************************************************************************
*
* FUNCTION: AcpiFormatException
*
* PARAMETERS: Status - The ACPI_STATUS code to be formatted
*
* RETURN: A string containing the exception text. A valid pointer is
* always returned.
*
* DESCRIPTION: This function translates an ACPI exception into an ASCII string
* It is here instead of utxface.c so it is always present.
*
******************************************************************************/
const char *
AcpiFormatException (
ACPI_STATUS Status)
{
const char *Exception = NULL;
ACPI_FUNCTION_ENTRY ();
Exception = AcpiUtValidateException (Status);
if (!Exception)
{
/* Exception code was not recognized */
ACPI_ERROR ((AE_INFO,
"Unknown exception code: 0x%8.8X", Status));
Exception = "UNKNOWN_STATUS_CODE";
}
return (ACPI_CAST_PTR (const char, Exception));
}
ACPI_EXPORT_SYMBOL (AcpiFormatException)
/*******************************************************************************
*
* Namespace globals
@ -196,78 +154,6 @@ const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] =
{NULL, ACPI_TYPE_ANY, NULL}
};
/*
* Properties of the ACPI Object Types, both internal and external.
* The table is indexed by values of ACPI_OBJECT_TYPE
*/
const UINT8 AcpiGbl_NsProperties[ACPI_NUM_NS_TYPES] =
{
ACPI_NS_NORMAL, /* 00 Any */
ACPI_NS_NORMAL, /* 01 Number */
ACPI_NS_NORMAL, /* 02 String */
ACPI_NS_NORMAL, /* 03 Buffer */
ACPI_NS_NORMAL, /* 04 Package */
ACPI_NS_NORMAL, /* 05 FieldUnit */
ACPI_NS_NEWSCOPE, /* 06 Device */
ACPI_NS_NORMAL, /* 07 Event */
ACPI_NS_NEWSCOPE, /* 08 Method */
ACPI_NS_NORMAL, /* 09 Mutex */
ACPI_NS_NORMAL, /* 10 Region */
ACPI_NS_NEWSCOPE, /* 11 Power */
ACPI_NS_NEWSCOPE, /* 12 Processor */
ACPI_NS_NEWSCOPE, /* 13 Thermal */
ACPI_NS_NORMAL, /* 14 BufferField */
ACPI_NS_NORMAL, /* 15 DdbHandle */
ACPI_NS_NORMAL, /* 16 Debug Object */
ACPI_NS_NORMAL, /* 17 DefField */
ACPI_NS_NORMAL, /* 18 BankField */
ACPI_NS_NORMAL, /* 19 IndexField */
ACPI_NS_NORMAL, /* 20 Reference */
ACPI_NS_NORMAL, /* 21 Alias */
ACPI_NS_NORMAL, /* 22 MethodAlias */
ACPI_NS_NORMAL, /* 23 Notify */
ACPI_NS_NORMAL, /* 24 Address Handler */
ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Desc */
ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 26 Resource Field */
ACPI_NS_NEWSCOPE, /* 27 Scope */
ACPI_NS_NORMAL, /* 28 Extra */
ACPI_NS_NORMAL, /* 29 Data */
ACPI_NS_NORMAL /* 30 Invalid */
};
/* Hex to ASCII conversion table */
static const char AcpiGbl_HexToAscii[] =
{
'0','1','2','3','4','5','6','7',
'8','9','A','B','C','D','E','F'
};
/*******************************************************************************
*
* FUNCTION: AcpiUtHexToAsciiChar
*
* PARAMETERS: Integer - Contains the hex digit
* Position - bit position of the digit within the
* integer (multiple of 4)
*
* RETURN: The converted Ascii character
*
* DESCRIPTION: Convert a hex digit to an Ascii character
*
******************************************************************************/
char
AcpiUtHexToAsciiChar (
UINT64 Integer,
UINT32 Position)
{
return (AcpiGbl_HexToAscii[(Integer >> Position) & 0xF]);
}
/******************************************************************************
*
@ -314,451 +200,6 @@ ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] =
/* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, ACPI_BITREG_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_ENABLE},
};
/*******************************************************************************
*
* FUNCTION: AcpiUtGetRegionName
*
* PARAMETERS: None.
*
* RETURN: Status
*
* DESCRIPTION: Translate a Space ID into a name string (Debug only)
*
******************************************************************************/
/* Region type decoding */
const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] =
{
"SystemMemory",
"SystemIO",
"PCI_Config",
"EmbeddedControl",
"SMBus",
"SystemCMOS",
"PCIBARTarget",
"IPMI",
"DataTable"
};
char *
AcpiUtGetRegionName (
UINT8 SpaceId)
{
if (SpaceId >= ACPI_USER_REGION_BEGIN)
{
return ("UserDefinedRegion");
}
else if (SpaceId >= ACPI_NUM_PREDEFINED_REGIONS)
{
return ("InvalidSpaceId");
}
return (ACPI_CAST_PTR (char, AcpiGbl_RegionTypes[SpaceId]));
}
/*******************************************************************************
*
* FUNCTION: AcpiUtGetEventName
*
* PARAMETERS: None.
*
* RETURN: Status
*
* DESCRIPTION: Translate a Event ID into a name string (Debug only)
*
******************************************************************************/
/* Event type decoding */
static const char *AcpiGbl_EventTypes[ACPI_NUM_FIXED_EVENTS] =
{
"PM_Timer",
"GlobalLock",
"PowerButton",
"SleepButton",
"RealTimeClock",
};
char *
AcpiUtGetEventName (
UINT32 EventId)
{
if (EventId > ACPI_EVENT_MAX)
{
return ("InvalidEventID");
}
return (ACPI_CAST_PTR (char, AcpiGbl_EventTypes[EventId]));
}
/*******************************************************************************
*
* FUNCTION: AcpiUtGetTypeName
*
* PARAMETERS: None.
*
* RETURN: Status
*
* DESCRIPTION: Translate a Type ID into a name string (Debug only)
*
******************************************************************************/
/*
* Elements of AcpiGbl_NsTypeNames below must match
* one-to-one with values of ACPI_OBJECT_TYPE
*
* The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching;
* when stored in a table it really means that we have thus far seen no
* evidence to indicate what type is actually going to be stored for this entry.
*/
static const char AcpiGbl_BadType[] = "UNDEFINED";
/* Printable names of the ACPI object types */
static const char *AcpiGbl_NsTypeNames[] =
{
/* 00 */ "Untyped",
/* 01 */ "Integer",
/* 02 */ "String",
/* 03 */ "Buffer",
/* 04 */ "Package",
/* 05 */ "FieldUnit",
/* 06 */ "Device",
/* 07 */ "Event",
/* 08 */ "Method",
/* 09 */ "Mutex",
/* 10 */ "Region",
/* 11 */ "Power",
/* 12 */ "Processor",
/* 13 */ "Thermal",
/* 14 */ "BufferField",
/* 15 */ "DdbHandle",
/* 16 */ "DebugObject",
/* 17 */ "RegionField",
/* 18 */ "BankField",
/* 19 */ "IndexField",
/* 20 */ "Reference",
/* 21 */ "Alias",
/* 22 */ "MethodAlias",
/* 23 */ "Notify",
/* 24 */ "AddrHandler",
/* 25 */ "ResourceDesc",
/* 26 */ "ResourceFld",
/* 27 */ "Scope",
/* 28 */ "Extra",
/* 29 */ "Data",
/* 30 */ "Invalid"
};
char *
AcpiUtGetTypeName (
ACPI_OBJECT_TYPE Type)
{
if (Type > ACPI_TYPE_INVALID)
{
return (ACPI_CAST_PTR (char, AcpiGbl_BadType));
}
return (ACPI_CAST_PTR (char, AcpiGbl_NsTypeNames[Type]));
}
char *
AcpiUtGetObjectTypeName (
ACPI_OPERAND_OBJECT *ObjDesc)
{
if (!ObjDesc)
{
return ("[NULL Object Descriptor]");
}
return (AcpiUtGetTypeName (ObjDesc->Common.Type));
}
/*******************************************************************************
*
* FUNCTION: AcpiUtGetNodeName
*
* PARAMETERS: Object - A namespace node
*
* RETURN: Pointer to a string
*
* DESCRIPTION: Validate the node and return the node's ACPI name.
*
******************************************************************************/
char *
AcpiUtGetNodeName (
void *Object)
{
ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) Object;
/* Must return a string of exactly 4 characters == ACPI_NAME_SIZE */
if (!Object)
{
return ("NULL");
}
/* Check for Root node */
if ((Object == ACPI_ROOT_OBJECT) ||
(Object == AcpiGbl_RootNode))
{
return ("\"\\\" ");
}
/* Descriptor must be a namespace node */
if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
{
return ("####");
}
/*
* Ensure name is valid. The name was validated/repaired when the node
* was created, but make sure it has not been corrupted.
*/
AcpiUtRepairName (Node->Name.Ascii);
/* Return the name */
return (Node->Name.Ascii);
}
/*******************************************************************************
*
* FUNCTION: AcpiUtGetDescriptorName
*
* PARAMETERS: Object - An ACPI object
*
* RETURN: Pointer to a string
*
* DESCRIPTION: Validate object and return the descriptor type
*
******************************************************************************/
/* Printable names of object descriptor types */
static const char *AcpiGbl_DescTypeNames[] =
{
/* 00 */ "Not a Descriptor",
/* 01 */ "Cached",
/* 02 */ "State-Generic",
/* 03 */ "State-Update",
/* 04 */ "State-Package",
/* 05 */ "State-Control",
/* 06 */ "State-RootParseScope",
/* 07 */ "State-ParseScope",
/* 08 */ "State-WalkScope",
/* 09 */ "State-Result",
/* 10 */ "State-Notify",
/* 11 */ "State-Thread",
/* 12 */ "Walk",
/* 13 */ "Parser",
/* 14 */ "Operand",
/* 15 */ "Node"
};
char *
AcpiUtGetDescriptorName (
void *Object)
{
if (!Object)
{
return ("NULL OBJECT");
}
if (ACPI_GET_DESCRIPTOR_TYPE (Object) > ACPI_DESC_TYPE_MAX)
{
return ("Not a Descriptor");
}
return (ACPI_CAST_PTR (char,
AcpiGbl_DescTypeNames[ACPI_GET_DESCRIPTOR_TYPE (Object)]));
}
/*******************************************************************************
*
* FUNCTION: AcpiUtGetReferenceName
*
* PARAMETERS: Object - An ACPI reference object
*
* RETURN: Pointer to a string
*
* DESCRIPTION: Decode a reference object sub-type to a string.
*
******************************************************************************/
/* Printable names of reference object sub-types */
static const char *AcpiGbl_RefClassNames[] =
{
/* 00 */ "Local",
/* 01 */ "Argument",
/* 02 */ "RefOf",
/* 03 */ "Index",
/* 04 */ "DdbHandle",
/* 05 */ "Named Object",
/* 06 */ "Debug"
};
const char *
AcpiUtGetReferenceName (
ACPI_OPERAND_OBJECT *Object)
{
if (!Object)
{
return ("NULL Object");
}
if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND)
{
return ("Not an Operand object");
}
if (Object->Common.Type != ACPI_TYPE_LOCAL_REFERENCE)
{
return ("Not a Reference object");
}
if (Object->Reference.Class > ACPI_REFCLASS_MAX)
{
return ("Unknown Reference class");
}
return (AcpiGbl_RefClassNames[Object->Reference.Class]);
}
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
/*
* Strings and procedures used for debug only
*/
/*******************************************************************************
*
* FUNCTION: AcpiUtGetMutexName
*
* PARAMETERS: MutexId - The predefined ID for this mutex.
*
* RETURN: String containing the name of the mutex. Always returns a valid
* pointer.
*
* DESCRIPTION: Translate a mutex ID into a name string (Debug only)
*
******************************************************************************/
char *
AcpiUtGetMutexName (
UINT32 MutexId)
{
if (MutexId > ACPI_MAX_MUTEX)
{
return ("Invalid Mutex ID");
}
return (AcpiGbl_MutexNames[MutexId]);
}
/*******************************************************************************
*
* FUNCTION: AcpiUtGetNotifyName
*
* PARAMETERS: NotifyValue - Value from the Notify() request
*
* RETURN: String corresponding to the Notify Value.
*
* DESCRIPTION: Translate a Notify Value to a notify namestring.
*
******************************************************************************/
/* Names for Notify() values, used for debug output */
static const char *AcpiGbl_NotifyValueNames[] =
{
"Bus Check",
"Device Check",
"Device Wake",
"Eject Request",
"Device Check Light",
"Frequency Mismatch",
"Bus Mode Mismatch",
"Power Fault",
"Capabilities Check",
"Device PLD Check",
"Reserved",
"System Locality Update"
};
const char *
AcpiUtGetNotifyName (
UINT32 NotifyValue)
{
if (NotifyValue <= ACPI_NOTIFY_MAX)
{
return (AcpiGbl_NotifyValueNames[NotifyValue]);
}
else if (NotifyValue <= ACPI_MAX_SYS_NOTIFY)
{
return ("Reserved");
}
else /* Greater or equal to 0x80 */
{
return ("**Device Specific**");
}
}
#endif
/*******************************************************************************
*
* FUNCTION: AcpiUtValidObjectType
*
* PARAMETERS: Type - Object type to be validated
*
* RETURN: TRUE if valid object type, FALSE otherwise
*
* DESCRIPTION: Validate an object type
*
******************************************************************************/
BOOLEAN
AcpiUtValidObjectType (
ACPI_OBJECT_TYPE Type)
{
if (Type > ACPI_TYPE_LOCAL_MAX)
{
/* Note: Assumes all TYPEs are contiguous (external/local) */
return (FALSE);
}
return (TRUE);
}
/*******************************************************************************
*
@ -768,7 +209,7 @@ AcpiUtValidObjectType (
*
* RETURN: Status
*
* DESCRIPTION: Init library globals. All globals that require specific
* DESCRIPTION: Init ACPICA globals. All globals that require specific
* initialization should be initialized here!
*
******************************************************************************/
@ -865,6 +306,7 @@ AcpiUtInitGlobals (
AcpiGbl_DbOutputFlags = ACPI_DB_CONSOLE_OUTPUT;
AcpiGbl_OsiData = 0;
AcpiGbl_OsiMutex = NULL;
AcpiGbl_RegMethodsExecuted = FALSE;
/* Hardware oriented */
@ -907,5 +349,3 @@ ACPI_EXPORT_SYMBOL (AcpiDbgLevel)
ACPI_EXPORT_SYMBOL (AcpiDbgLayer)
ACPI_EXPORT_SYMBOL (AcpiGpeCount)
ACPI_EXPORT_SYMBOL (AcpiCurrentGpeCount)