Import ACPICA 20090521 (with three patches from ACPICA GIT).

This commit is contained in:
jkim 2009-06-01 21:02:40 +00:00
parent 1a9fa9cb67
commit 02935ea0ac
252 changed files with 34693 additions and 8952 deletions

79
README Normal file
View File

@ -0,0 +1,79 @@
acpica-unix
-----------
This source release includes:
1) a cross-OS AML interpreter
This is intended to allow commercial and open source operating systems
to be enabled for ACPI. OS specific code is still needed, but the
AML interpreter should greatly improve the development speed of ACPI
support.
The AML interpreter source should be integrated into the kernel's
build process. We recommend establishing an automated method for
this, so later versions can also be incorporated easily. Please see
the documentation on the website for API and other implementation
information.
2) iasl, an ASL compiler/decompiler
iasl compiles ASL (ACPI Source Language) into AML (ACPI Machine
Language). This AML is suitable for inclusion as a DSDT in system
firmware. It also can disassemble AML, for debugging purposes.
To compile:
cd compiler
make
It has been compiled on Linux, but should easily port to other Unix
environments.
Run 'iasl -h' for more information, or download the binary version for
documentation in PDF format.
3) acpisrc, a source code conversion tool
acpisrc converts the standard form of the acpica source release (included
here) into a version that meets Linux coding guidelines. This consists
mainly of performing a series of string replacements and transformations
to the code.
To compile:
cd tools/acpisrc
make
It has been compiled on Linux, but should easily port to other Unix
environments.
4) acpibin, an AML file tool
acpibin compares AML files, dumps AML binary files to text files,
extracts binary AML from text files, and other AML file
manipulation.
To compile:
cd tools/acpibin
make
5) acpiexec, a user-space AML interpreter
acpiexec allows the loading of ACPI tables and execution of control
methods from user space. Useful for debugging AML code and testing
the AML interpreter.
To compile:
cd tools/acpiexec
make
Thanks -- The ACPI CA Team

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: adfile - Application-level disassembler file support routines
* $Revision: 1.3 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "acapps.h"
#include <stdio.h>
@ -125,6 +125,13 @@
#define _COMPONENT ACPI_TOOLS
ACPI_MODULE_NAME ("adfile")
/* Local prototypes */
INT32
AdWriteBuffer (
char *Filename,
char *Buffer,
UINT32 Length);
char FilenameBuf[20];
@ -146,8 +153,8 @@ AdGenerateFilename (
char *Prefix,
char *TableId)
{
ACPI_NATIVE_UINT i;
ACPI_NATIVE_UINT j;
UINT32 i;
UINT32 j;
for (i = 0; Prefix[i]; i++)
@ -183,14 +190,14 @@ AdGenerateFilename (
*
******************************************************************************/
ACPI_NATIVE_INT
INT32
AdWriteBuffer (
char *Filename,
char *Buffer,
UINT32 Length)
char *Filename,
char *Buffer,
UINT32 Length)
{
FILE *fp;
ACPI_SIZE Actual;
FILE *fp;
ACPI_SIZE Actual;
fp = fopen (Filename, "wb");
@ -202,7 +209,7 @@ AdWriteBuffer (
Actual = fwrite (Buffer, (size_t) Length, 1, fp);
fclose (fp);
return ((ACPI_NATIVE_INT) Actual);
return ((INT32) Actual);
}

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: adisasm - Application-level disassembler routines
* $Revision: 1.104 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "amlcode.h"
#include "acdebug.h"
@ -153,7 +153,25 @@ void
AdDisassemblerHeader (
char *Filename);
ACPI_PARSE_OBJECT *AcpiGbl_ParseOpRoot;
void
AdAddExternalsToNamespace (
void);
UINT32
AdMethodExternalCount (
void);
ACPI_STATUS
AdDeferredParse (
ACPI_PARSE_OBJECT *Op,
UINT8 *Aml,
UINT32 AmlLength);
ACPI_STATUS
AdParseDeferredOps (
ACPI_PARSE_OBJECT *Root);
ACPI_PARSE_OBJECT *AcpiGbl_ParseOpRoot;
/* Stubs for ASL compiler */
@ -179,7 +197,7 @@ AcpiDsMethodError (
ACPI_STATUS
AcpiNsLoadTable (
ACPI_NATIVE_UINT TableIndex,
UINT32 TableIndex,
ACPI_NAMESPACE_NODE *Node)
{
return (AE_NOT_IMPLEMENTED);
@ -245,18 +263,27 @@ AdInitialize (
/* ACPI CA subsystem initialization */
Status = AcpiOsInitialize ();
AcpiUtInitGlobals ();
if (ACPI_FAILURE (Status))
{
return (Status);
}
Status = AcpiUtInitGlobals ();
if (ACPI_FAILURE (Status))
{
return (Status);
}
Status = AcpiUtMutexInitialize ();
if (ACPI_FAILURE (Status))
{
return Status;
return (Status);
}
Status = AcpiNsRootInitialize ();
if (ACPI_FAILURE (Status))
{
return Status;
return (Status);
}
/* Setup the Table Manager (cheat - there is no RSDT) */
@ -265,7 +292,7 @@ AdInitialize (
AcpiGbl_RootTableList.Count = 0;
AcpiGbl_RootTableList.Tables = LocalTables;
return Status;
return (Status);
}
@ -275,7 +302,7 @@ AdInitialize (
*
* PARAMETERS:
*
* RETURN: Status
* RETURN: None
*
* DESCRIPTION:
*
@ -371,14 +398,17 @@ AdAmlDisassemble (
{
ACPI_STATUS Status;
char *DisasmFilename = NULL;
char *ExternalFilename;
FILE *File = NULL;
ACPI_TABLE_HEADER *Table;
ACPI_TABLE_HEADER *Table = NULL;
ACPI_TABLE_HEADER *ExternalTable;
ACPI_OWNER_ID OwnerId;
ACPI_EXTERNAL_LIST *NextExternal;
/*
* Input: AML Code from either a file,
* or via GetTables (memory or registry)
* Input: AML Code from either a file,
* or via GetTables (memory or registry)
*/
if (Filename)
{
@ -388,12 +418,56 @@ AdAmlDisassemble (
return Status;
}
/*
* External filenames separated by commas
* Example: iasl -e file1,file2,file3 -d xxx.aml
*/
if (Gbl_ExternalFilename)
{
Status = AcpiDbGetTableFromFile (Gbl_ExternalFilename, &ExternalTable);
if (ACPI_FAILURE (Status))
ExternalFilename = strtok (Gbl_ExternalFilename, ",");
while (ExternalFilename)
{
return Status;
Status = AcpiDbGetTableFromFile (ExternalFilename, &ExternalTable);
if (ACPI_FAILURE (Status))
{
return Status;
}
/* Load external table for symbol resolution */
if (ExternalTable)
{
Status = AdParseTable (ExternalTable, &OwnerId, TRUE, TRUE);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not parse external ACPI tables, %s\n",
AcpiFormatException (Status));
return Status;
}
/*
* Load namespace from names created within control methods
* Set owner id of nodes in external table
*/
AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot,
AcpiGbl_RootNode, OwnerId);
AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot);
}
/* Next external file name */
ExternalFilename = strtok (NULL, ",");
}
/* Clear external list generated by Scope in external tables */
while (AcpiGbl_ExternalList)
{
NextExternal = AcpiGbl_ExternalList->Next;
ACPI_FREE (AcpiGbl_ExternalList->Path);
ACPI_FREE (AcpiGbl_ExternalList);
AcpiGbl_ExternalList = NextExternal;
}
}
}
@ -470,7 +544,7 @@ AdAmlDisassemble (
{
/* Always parse the tables, only option is what to display */
Status = AdParseTable (Table);
Status = AdParseTable (Table, &OwnerId, TRUE, FALSE);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not parse ACPI tables, %s\n",
@ -490,12 +564,12 @@ AdAmlDisassemble (
/*
* Load namespace from names created within control methods
*/
AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode);
AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode, OwnerId);
/*
* Cross reference the namespace here, in order to generate External() statements
*/
AcpiDmCrossReferenceNamespace (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode);
AcpiDmCrossReferenceNamespace (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode, OwnerId);
if (AslCompilerdebug)
{
@ -510,14 +584,6 @@ AdAmlDisassemble (
AcpiDmConvertResourceIndexes (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode);
if (AslCompilerdebug)
{
AcpiOsPrintf ("/**** After second load and resource conversion\n");
LsSetupNsList (File);
LsDisplayNamespace ();
AcpiOsPrintf ("*****/\n");
}
/*
* If we found any external control methods, we must reparse the entire
* tree with the new information (namely, the number of arguments per
@ -547,7 +613,9 @@ AdAmlDisassemble (
Status = AcpiNsRootInitialize ();
AdAddExternalsToNamespace ();
Status = AdParseTable (Table);
/* Parse table. No need to reload it, however (FALSE) */
Status = AdParseTable (Table, NULL, FALSE, FALSE);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not parse ACPI tables, %s\n",
@ -557,6 +625,11 @@ AdAmlDisassemble (
if (AslCompilerdebug)
{
AcpiOsPrintf ("/**** After second load and resource conversion\n");
LsSetupNsList (File);
LsDisplayNamespace ();
AcpiOsPrintf ("*****/\n");
AcpiDmDumpTree (AcpiGbl_ParseOpRoot);
}
}
@ -573,6 +646,17 @@ AdAmlDisassemble (
}
Cleanup:
if (Table && !AcpiUtIsAmlTable (Table))
{
ACPI_FREE (Table);
}
if (DisasmFilename)
{
ACPI_FREE (DisasmFilename);
}
if (OutToFile && File)
{
@ -585,7 +669,8 @@ AdAmlDisassemble (
}
AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot);
return Status;
AcpiGbl_ParseOpRoot = NULL;
return (Status);
}
@ -640,19 +725,59 @@ AdCreateTableHeader (
ACPI_TABLE_HEADER *Table)
{
char *NewFilename;
UINT8 Checksum;
/*
* Print file header and dump original table header
*/
AdDisassemblerHeader (Filename);
AcpiOsPrintf (" *\n * Original Table Header:\n");
AcpiOsPrintf (" * Signature \"%4.4s\"\n", Table->Signature);
AcpiOsPrintf (" * Length 0x%8.8X (%u)\n", Table->Length, Table->Length);
AcpiOsPrintf (" * Revision 0x%2.2X\n", Table->Revision);
/* Print and validate the revision */
AcpiOsPrintf (" * Revision 0x%2.2X", Table->Revision);
switch (Table->Revision)
{
case 0:
AcpiOsPrintf (" **** Invalid Revision");
break;
case 1:
/* Revision of DSDT controls the ACPI integer width */
if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_DSDT))
{
AcpiOsPrintf (" **** ACPI 1.0, no 64-bit math support");
}
break;
default:
break;
}
AcpiOsPrintf ("\n");
/* Print and validate the table checksum */
AcpiOsPrintf (" * Checksum 0x%2.2X", Table->Checksum);
Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Table->Length);
if (Checksum)
{
AcpiOsPrintf (" **** Incorrect checksum, should be 0x%2.2X",
(UINT8) (Table->Checksum - Checksum));
}
AcpiOsPrintf ("\n");
AcpiOsPrintf (" * OEM ID \"%.6s\"\n", Table->OemId);
AcpiOsPrintf (" * OEM Table ID \"%.8s\"\n", Table->OemTableId);
AcpiOsPrintf (" * OEM Revision 0x%8.8X (%u)\n", Table->OemRevision, Table->OemRevision);
AcpiOsPrintf (" * Creator ID \"%.4s\"\n", Table->AslCompilerId);
AcpiOsPrintf (" * Creator Revision 0x%8.8X (%u)\n", Table->AslCompilerRevision, Table->AslCompilerRevision);
AcpiOsPrintf (" * Compiler ID \"%.4s\"\n", Table->AslCompilerId);
AcpiOsPrintf (" * Compiler Version 0x%8.8X (%u)\n", Table->AslCompilerRevision, Table->AslCompilerRevision);
AcpiOsPrintf (" */\n");
/* Create AML output filename based on input filename */
@ -674,6 +799,8 @@ AdCreateTableHeader (
"DefinitionBlock (\"%s\", \"%4.4s\", %hd, \"%.6s\", \"%.8s\", 0x%8.8X)\n",
NewFilename, Table->Signature, Table->Revision,
Table->OemId, Table->OemTableId, Table->OemRevision);
ACPI_FREE (NewFilename);
}
@ -904,6 +1031,7 @@ AdParseDeferredOps (
case AML_CREATE_BYTE_FIELD_OP:
case AML_CREATE_BIT_FIELD_OP:
case AML_CREATE_FIELD_OP:
case AML_BANK_FIELD_OP:
/* Nothing to do in these cases */
@ -946,7 +1074,7 @@ AdGetLocalTables (
ACPI_TABLE_HEADER *NewTable;
UINT32 NumTables;
UINT32 PointerSize;
ACPI_NATIVE_UINT TableIndex;
UINT32 TableIndex;
if (GetAllTables)
@ -958,6 +1086,11 @@ AdGetLocalTables (
fprintf (stderr, "Could not obtain RSDT\n");
return AE_NO_ACPI_TABLES;
}
else
{
AdWriteTable (NewTable, NewTable->Length,
ACPI_SIG_RSDT, NewTable->OemTableId);
}
if (ACPI_COMPARE_NAME (NewTable->Signature, ACPI_SIG_RSDT))
{
@ -1037,6 +1170,9 @@ AdGetLocalTables (
* FUNCTION: AdParseTable
*
* PARAMETERS: Table - Pointer to the raw table
* OwnerId - Returned OwnerId of the table
* LoadTable - If add table to the global table list
* External - If this is an external table
*
* RETURN: Status
*
@ -1046,13 +1182,16 @@ AdGetLocalTables (
ACPI_STATUS
AdParseTable (
ACPI_TABLE_HEADER *Table)
ACPI_TABLE_HEADER *Table,
ACPI_OWNER_ID *OwnerId,
BOOLEAN LoadTable,
BOOLEAN External)
{
ACPI_STATUS Status = AE_OK;
ACPI_WALK_STATE *WalkState;
UINT8 *AmlStart;
UINT32 AmlLength;
ACPI_NATIVE_UINT TableIndex;
UINT32 TableIndex;
if (!Table)
@ -1100,23 +1239,50 @@ AdParseTable (
return Status;
}
/* If LoadTable is FALSE, we are parsing the last loaded table */
TableIndex = AcpiGbl_RootTableList.Count - 1;
/* Pass 2 */
Status = AcpiTbStoreTable ((ACPI_NATIVE_UINT) Table, Table,
Table->Length, ACPI_TABLE_ORIGIN_ALLOCATED, &TableIndex);
if (ACPI_FAILURE (Status))
if (LoadTable)
{
return Status;
Status = AcpiTbStoreTable ((ACPI_PHYSICAL_ADDRESS) Table, Table,
Table->Length, ACPI_TABLE_ORIGIN_ALLOCATED, &TableIndex);
if (ACPI_FAILURE (Status))
{
return Status;
}
Status = AcpiTbAllocateOwnerId (TableIndex);
if (ACPI_FAILURE (Status))
{
return Status;
}
if (OwnerId)
{
Status = AcpiTbGetOwnerId (TableIndex, OwnerId);
if (ACPI_FAILURE (Status))
{
return Status;
}
}
}
fprintf (stderr, "Pass 2 parse of [%4.4s]\n", (char *) Table->Signature);
Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, 0);
Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, TableIndex, NULL);
if (ACPI_FAILURE (Status))
{
return (Status);
}
/* No need to parse control methods of external table */
if (External)
{
return AE_OK;
}
/* Pass 3: Parse control methods and link their parse trees into the main parse tree */
Status = AdParseDeferredOps (AcpiGbl_ParseOpRoot);

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: adwalk - Application-level disassembler parse tree walk routines
* $Revision: 1.6 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "amlcode.h"
#include "acdebug.h"
@ -252,6 +252,7 @@ AcpiDmFindOrphanMethods (
*
* PARAMETERS: ParseTreeRoot - Root of the parse tree
* NamespaceRoot - Root of the internal namespace
* OwnerId - OwnerId of the table to be disassembled
*
* RETURN: None
*
@ -263,7 +264,8 @@ AcpiDmFindOrphanMethods (
void
AcpiDmFinishNamespaceLoad (
ACPI_PARSE_OBJECT *ParseTreeRoot,
ACPI_NAMESPACE_NODE *NamespaceRoot)
ACPI_NAMESPACE_NODE *NamespaceRoot,
ACPI_OWNER_ID OwnerId)
{
ACPI_STATUS Status;
ACPI_OP_WALK_INFO Info;
@ -277,7 +279,7 @@ AcpiDmFinishNamespaceLoad (
/* Create and initialize a new walk state */
WalkState = AcpiDsCreateWalkState (0, ParseTreeRoot, NULL, NULL);
WalkState = AcpiDsCreateWalkState (OwnerId, ParseTreeRoot, NULL, NULL);
if (!WalkState)
{
return;
@ -304,6 +306,7 @@ AcpiDmFinishNamespaceLoad (
*
* PARAMETERS: ParseTreeRoot - Root of the parse tree
* NamespaceRoot - Root of the internal namespace
* OwnerId - OwnerId of the table to be disassembled
*
* RETURN: None
*
@ -314,7 +317,8 @@ AcpiDmFinishNamespaceLoad (
void
AcpiDmCrossReferenceNamespace (
ACPI_PARSE_OBJECT *ParseTreeRoot,
ACPI_NAMESPACE_NODE *NamespaceRoot)
ACPI_NAMESPACE_NODE *NamespaceRoot,
ACPI_OWNER_ID OwnerId)
{
ACPI_STATUS Status;
ACPI_OP_WALK_INFO Info;
@ -328,7 +332,7 @@ AcpiDmCrossReferenceNamespace (
/* Create and initialize a new walk state */
WalkState = AcpiDsCreateWalkState (0, ParseTreeRoot, NULL, NULL);
WalkState = AcpiDsCreateWalkState (OwnerId, ParseTreeRoot, NULL, NULL);
if (!WalkState)
{
return;
@ -470,6 +474,9 @@ AcpiDmDumpDescending (
case AML_INT_NAMEDFIELD_OP:
AcpiOsPrintf ("%4.4s", &Op->Named.Name);
break;
default:
break;
}
AcpiOsPrintf ("\n");
@ -618,6 +625,9 @@ AcpiDmFindOrphanDescending (
}
break;
default:
break;
}
return (AE_OK);
@ -650,6 +660,9 @@ AcpiDmLoadDescendingOp (
char *Path = NULL;
ACPI_PARSE_OBJECT *NextOp;
ACPI_NAMESPACE_NODE *Node;
char FieldPath[5];
BOOLEAN PreDefined = FALSE;
UINT8 PreDefineIndex = 0;
WalkState = Info->WalkState;
@ -672,6 +685,13 @@ AcpiDmLoadDescendingOp (
/* For all named operators, get the new name */
Path = (char *) Op->Named.Path;
if (!Path && Op->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)
{
*ACPI_CAST_PTR (UINT32, &FieldPath[0]) = Op->Named.Name;
FieldPath[4] = 0;
Path = FieldPath;
}
}
else if (OpInfo->Flags & AML_CREATE)
{
@ -699,6 +719,36 @@ AcpiDmLoadDescendingOp (
Op->Common.Node = Node;
if (ACPI_SUCCESS (Status))
{
/* Check if it's a predefined node */
while (AcpiGbl_PreDefinedNames[PreDefineIndex].Name)
{
if (!ACPI_STRNCMP (Node->Name.Ascii,
AcpiGbl_PreDefinedNames[PreDefineIndex].Name, 4))
{
PreDefined = TRUE;
break;
}
PreDefineIndex++;
}
/*
* Set node owner id if it satisfies all the following conditions:
* 1) Not a predefined node, _SB_ etc
* 2) Not the root node
* 3) Not a node created by Scope
*/
if (!PreDefined && Node != AcpiGbl_RootNode &&
Op->Common.AmlOpcode != AML_SCOPE_OP)
{
Node->OwnerId = WalkState->OwnerId;
}
}
Exit:
@ -740,10 +790,12 @@ AcpiDmXrefDescendingOp (
const ACPI_OPCODE_INFO *OpInfo;
ACPI_WALK_STATE *WalkState;
ACPI_OBJECT_TYPE ObjectType;
ACPI_OBJECT_TYPE ObjectType2;
ACPI_STATUS Status;
char *Path = NULL;
ACPI_PARSE_OBJECT *NextOp;
ACPI_NAMESPACE_NODE *Node;
ACPI_OPERAND_OBJECT *Object;
WalkState = Info->WalkState;
@ -819,6 +871,33 @@ AcpiDmXrefDescendingOp (
#endif
}
}
/*
* Found the node in external table, add it to external list
* Node->OwnerId == 0 indicates built-in ACPI Names, _OS_ etc
*/
else if (Node->OwnerId && WalkState->OwnerId != Node->OwnerId)
{
ObjectType2 = ObjectType;
Object = AcpiNsGetAttachedObject (Node);
if (Object)
{
ObjectType2 = Object->Common.Type;
}
if (ObjectType2 == ACPI_TYPE_METHOD)
{
AcpiDmAddToExternalList (Path, ACPI_TYPE_METHOD,
Object->Method.ParamCount);
}
else
{
AcpiDmAddToExternalList (Path, (UINT8) ObjectType2, 0);
}
Op->Common.Node = Node;
}
else
{
Op->Common.Node = Node;

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: dmrestag - Add tags to resource descriptors (Application-level)
* $Revision: 1.11 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "acdisasm.h"
#include "acnamesp.h"
@ -636,13 +636,22 @@ AcpiGetTagPathname (
/* Get the full pathname to the parent buffer */
RequiredSize = AcpiNsGetPathnameLength (BufferNode);
if (!RequiredSize)
{
return (NULL);
}
Pathname = ACPI_ALLOCATE_ZEROED (RequiredSize + ACPI_PATH_SEGMENT_LENGTH);
if (!Pathname)
{
return (NULL);
}
AcpiNsBuildExternalPath (BufferNode, RequiredSize, Pathname);
Status = AcpiNsBuildExternalPath (BufferNode, RequiredSize, Pathname);
if (ACPI_FAILURE (Status))
{
return (NULL);
}
/*
* Create the full path to the resource and tag by: remove the buffer name,
@ -720,7 +729,7 @@ AcpiDmUpdateResourceName (
/* Change the resource descriptor name */
ResourceNode->Name.Integer = *(UINT32 *) Name;
ResourceNode->Name.Integer = *ACPI_CAST_PTR (UINT32, &Name[0]);
}

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: dmtable - Support for ACPI tables that contain no AML code
* $Revision: 1.12 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -115,6 +114,7 @@
*****************************************************************************/
#include "acpi.h"
#include "accommon.h"
#include "acdisasm.h"
#include "actables.h"
@ -134,16 +134,56 @@ AcpiDmCheckAscii (
UINT8 *Target,
UINT32 Count);
UINT8
AcpiTbGenerateChecksum (
ACPI_TABLE_HEADER *Table);
/* These tables map a subtable type to a description string */
static const char *AcpiDmAsfSubnames[] =
{
"ASF Information",
"ASF Alerts",
"ASF Remote Control",
"ASF RMCP Boot Options",
"ASF Address",
"Unknown SubTable Type" /* Reserved */
};
static const char *AcpiDmDmarSubnames[] =
{
"Hardware Unit Definition",
"Reserved Memory Region",
"Root Port ATS Capability",
"Unknown SubTable Type" /* Reserved */
};
static const char *AcpiDmHestSubnames[] =
{
"XPF Machine Check Exception",
"XPF Corrected Machine Check",
"NOT USED???",
"XPF Non-Maskable Interrupt",
"IPF Corrected Machine Check",
"IPF Corrected Platform Error",
"PCI Express Root Port AER",
"PCI Express AER (AER Endpoint)",
"PCI Express/PCI-X Bridge AER",
"Generic Hardware Error Source",
"Unknown SubTable Type" /* Reserved */
};
static const char *AcpiDmHestNotifySubnames[] =
{
"Polled",
"External Interrupt",
"Local Interrupt",
"SCI",
"NMI",
"Unknown Notify Type" /* Reserved */
};
static const char *AcpiDmMadtSubnames[] =
{
"Processor Local APIC", /* ACPI_MADT_TYPE_LOCAL_APIC */
@ -155,6 +195,8 @@ static const char *AcpiDmMadtSubnames[] =
"I/O SAPIC", /* ACPI_MADT_TYPE_IO_SAPIC */
"Local SAPIC", /* ACPI_MADT_TYPE_LOCAL_SAPIC */
"Platform Interrupt Sources", /* ACPI_MADT_TYPE_INTERRUPT_SOURCE */
"Processor Local x2APIC", /* ACPI_MADT_TYPE_LOCAL_X2APIC */
"Local x2APIC NMI", /* ACPI_MADT_TYPE_LOCAL_X2APIC_NMI */
"Unknown SubTable Type" /* Reserved */
};
@ -162,10 +204,27 @@ static const char *AcpiDmSratSubnames[] =
{
"Processor Local APIC/SAPIC Affinity",
"Memory Affinity",
"Processor Local x2APIC Affinity",
"Unknown SubTable Type" /* Reserved */
};
#define ACPI_FADT_PM_RESERVED 8
static const char *AcpiDmFadtProfiles[] =
{
"Unspecified",
"Desktop",
"Mobile",
"Workstation",
"Enterprise Server",
"SOHO Server",
"Appliance PC",
"Performance Server",
"Unknown Profile Type"
};
/*******************************************************************************
*
* ACPI Table Data, indexed by signature.
@ -180,16 +239,21 @@ static ACPI_DMTABLE_DATA AcpiDmTableData[] =
{
{ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, "Alert Standard Format table"},
{ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, "Simple Boot Flag Table"},
{ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, "Boot Error Record Table"},
{ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, "Corrected Platform Error Polling table"},
{ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, "Debug Port table"},
{ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, "DMA Remapping table"},
{ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, "Embedded Controller Boot Resources Table"},
{ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, "Error Injection table"},
{ACPI_SIG_ERST, NULL, AcpiDmDumpErst, "Error Record Serialization Table"},
{ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, "Fixed ACPI Description Table"},
{ACPI_SIG_HEST, NULL, AcpiDmDumpHest, "Hardware Error Source Table"},
{ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, "High Precision Event Timer table"},
{ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, "Multiple APIC Description Table"},
{ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, "Memory Mapped Configuration table"},
{ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, "Root System Description Table"},
{ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, "Smart Battery Specification Table"},
{ACPI_SIG_SLIC, AcpiDmTableInfoSlic, NULL, "Software Licensing Description Table"},
{ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, "System Locality Information Table"},
{ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, "Serial Port Console Redirection table"},
{ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, "Server Platform Management Interface table"},
@ -284,6 +348,7 @@ void
AcpiDmDumpDataTable (
ACPI_TABLE_HEADER *Table)
{
ACPI_STATUS Status;
ACPI_DMTABLE_DATA *TableData;
UINT32 Length;
@ -314,7 +379,11 @@ AcpiDmDumpDataTable (
* All other tables must use the common ACPI table header, dump it now
*/
Length = Table->Length;
AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader);
Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader);
if (ACPI_FAILURE (Status))
{
return;
}
AcpiOsPrintf ("\n");
/* Match signature and dispatch appropriately */
@ -380,12 +449,12 @@ AcpiDmLineHeader (
if (ByteLength)
{
AcpiOsPrintf ("[%3.3Xh %3.3d% 3d] %28s : ",
AcpiOsPrintf ("[%3.3Xh %4.4d% 3d] %28s : ",
Offset, Offset, ByteLength, Name);
}
else
{
AcpiOsPrintf ("%42s : ",
AcpiOsPrintf ("%43s : ",
Name);
}
}
@ -400,12 +469,12 @@ AcpiDmLineHeader2 (
if (ByteLength)
{
AcpiOsPrintf ("[%3.3Xh %3.3d% 3d] %24s % 3d : ",
AcpiOsPrintf ("[%3.3Xh %4.4d% 3d] %24s % 3d : ",
Offset, Offset, ByteLength, Name, Value);
}
else
{
AcpiOsPrintf ("[%3.3Xh %3.3d ] %24s % 3d : ",
AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s % 3d : ",
Offset, Offset, Name, Value);
}
}
@ -419,7 +488,7 @@ AcpiDmLineHeader2 (
* TableOffset - Starting offset within the table for this
* sub-descriptor (0 if main table)
* Table - The ACPI table
* SubtableLength - Lenghth of this sub-descriptor
* SubtableLength - Length of this sub-descriptor
* Info - Info table for this ACPI table
*
* RETURN: None
@ -428,7 +497,7 @@ AcpiDmLineHeader2 (
*
******************************************************************************/
void
ACPI_STATUS
AcpiDmDumpTable (
UINT32 TableLength,
UINT32 TableOffset,
@ -442,12 +511,13 @@ AcpiDmDumpTable (
UINT8 Temp8;
UINT16 Temp16;
ACPI_DMTABLE_DATA *TableData;
BOOLEAN LastOutputBlankLine = FALSE;
if (!Info)
{
AcpiOsPrintf ("Display not implemented\n");
return;
return (AE_NOT_IMPLEMENTED);
}
/* Walk entire Info table; Null name terminates */
@ -466,7 +536,8 @@ AcpiDmDumpTable (
if ((CurrentOffset >= TableLength) ||
(SubtableLength && (Info->Offset >= SubtableLength)))
{
return;
AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n");
return (AE_BAD_DATA);
}
/* Generate the byte length for this field */
@ -478,10 +549,14 @@ AcpiDmDumpTable (
case ACPI_DMT_SPACEID:
case ACPI_DMT_MADT:
case ACPI_DMT_SRAT:
case ACPI_DMT_ASF:
case ACPI_DMT_HESTNTYP:
case ACPI_DMT_FADTPM:
ByteLength = 1;
break;
case ACPI_DMT_UINT16:
case ACPI_DMT_DMAR:
case ACPI_DMT_HEST:
ByteLength = 2;
break;
case ACPI_DMT_UINT24:
@ -506,14 +581,32 @@ AcpiDmDumpTable (
ByteLength = ACPI_STRLEN (ACPI_CAST_PTR (char, Target)) + 1;
break;
case ACPI_DMT_GAS:
AcpiOsPrintf ("\n");
if (!LastOutputBlankLine)
{
AcpiOsPrintf ("\n");
LastOutputBlankLine = TRUE;
}
ByteLength = sizeof (ACPI_GENERIC_ADDRESS);
break;
case ACPI_DMT_HESTNTFY:
if (!LastOutputBlankLine)
{
AcpiOsPrintf ("\n");
LastOutputBlankLine = TRUE;
}
ByteLength = sizeof (ACPI_HEST_NOTIFY);
break;
default:
ByteLength = 0;
break;
}
if (CurrentOffset + ByteLength > TableLength)
{
AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n");
return (AE_BAD_DATA);
}
/* Start a new line and decode the opcode */
AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name);
@ -571,9 +664,11 @@ AcpiDmDumpTable (
case ACPI_DMT_UINT56:
AcpiOsPrintf ("%6.6X%8.8X\n",
ACPI_HIDWORD (ACPI_GET64 (Target)) & 0x00FFFFFF,
ACPI_LODWORD (ACPI_GET64 (Target)));
for (Temp8 = 0; Temp8 < 7; Temp8++)
{
AcpiOsPrintf ("%2.2X", Target[Temp8]);
}
AcpiOsPrintf ("\n");
break;
case ACPI_DMT_UINT64:
@ -648,22 +743,73 @@ AcpiDmDumpTable (
AcpiOsPrintf ("<Generic Address Structure>\n");
AcpiDmDumpTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
CurrentOffset, Target, 0, AcpiDmTableInfoGas);
CurrentOffset, Target, sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas);
AcpiOsPrintf ("\n");
LastOutputBlankLine = TRUE;
break;
case ACPI_DMT_ASF:
/* ASF subtable types */
Temp16 = (UINT16) ((*Target) & 0x7F); /* Top bit can be zero or one */
if (Temp16 > ACPI_ASF_TYPE_RESERVED)
{
Temp16 = ACPI_ASF_TYPE_RESERVED;
}
AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmAsfSubnames[Temp16]);
break;
case ACPI_DMT_DMAR:
/* DMAR subtable types */
Temp16 = *Target;
Temp16 = ACPI_GET16 (Target);
if (Temp16 > ACPI_DMAR_TYPE_RESERVED)
{
Temp16 = ACPI_DMAR_TYPE_RESERVED;
}
AcpiOsPrintf ("%4.4X <%s>\n", *Target, AcpiDmDmarSubnames[Temp16]);
AcpiOsPrintf ("%4.4X <%s>\n", ACPI_GET16 (Target), AcpiDmDmarSubnames[Temp16]);
break;
case ACPI_DMT_HEST:
/* HEST subtable types */
Temp16 = ACPI_GET16 (Target);
if (Temp16 > ACPI_HEST_TYPE_RESERVED)
{
Temp16 = ACPI_HEST_TYPE_RESERVED;
}
AcpiOsPrintf ("%4.4X (%s)\n", ACPI_GET16 (Target), AcpiDmHestSubnames[Temp16]);
break;
case ACPI_DMT_HESTNTFY:
AcpiOsPrintf ("<Hardware Error Notification Structure>\n");
AcpiDmDumpTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
CurrentOffset, Target, sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify);
AcpiOsPrintf ("\n");
LastOutputBlankLine = TRUE;
break;
case ACPI_DMT_HESTNTYP:
/* HEST Notify types */
Temp8 = *Target;
if (Temp8 > ACPI_HEST_NOTIFY_RESERVED)
{
Temp8 = ACPI_HEST_NOTIFY_RESERVED;
}
AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmHestNotifySubnames[Temp8]);
break;
case ACPI_DMT_MADT:
/* MADT subtable types */
@ -690,15 +836,38 @@ AcpiDmDumpTable (
AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmSratSubnames[Temp8]);
break;
case ACPI_DMT_FADTPM:
/* FADT Preferred PM Profile names */
Temp8 = *Target;
if (Temp8 > ACPI_FADT_PM_RESERVED)
{
Temp8 = ACPI_FADT_PM_RESERVED;
}
AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmFadtProfiles[Temp8]);
break;
case ACPI_DMT_EXIT:
return;
return (AE_OK);
default:
ACPI_ERROR ((AE_INFO,
"**** Invalid table opcode [%X] ****\n", Info->Opcode));
return;
return (AE_SUPPORT);
}
}
if (TableOffset && !SubtableLength)
{
/* If this table is not the main table, subtable must have valid length */
AcpiOsPrintf ("Invalid zero length subtable\n");
return (AE_BAD_DATA);
}
return (AE_OK);
}

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: dmtbdump - Dump ACPI data tables that contain no AML code
* $Revision: 1.15 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -115,6 +114,7 @@
*****************************************************************************/
#include "acpi.h"
#include "accommon.h"
#include "acdisasm.h"
#include "actables.h"
@ -260,13 +260,20 @@ AcpiDmDumpFadt (
AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt1);
/* Check for ACPI 2.0+ extended data (cannot depend on Revision field) */
/* Check for ACPI 1.0B MS extensions (FADT revision 2) */
if (Table->Length >= sizeof (ACPI_TABLE_FADT))
if (Table->Revision == 2)
{
AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt2);
}
/* Check for ACPI 2.0+ extended data (FADT revision 3+) */
else if (Table->Length >= sizeof (ACPI_TABLE_FADT))
{
AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt3);
}
/* Validate various fields in the FADT, including length */
AcpiTbCreateLocalFadt (Table, Table->Length);
@ -289,15 +296,16 @@ void
AcpiDmDumpAsf (
ACPI_TABLE_HEADER *Table)
{
ACPI_STATUS Status;
UINT32 Offset = sizeof (ACPI_TABLE_HEADER);
ACPI_ASF_INFO *SubTable;
ACPI_DMTABLE_INFO *InfoTable;
ACPI_DMTABLE_INFO *DataInfoTable = NULL;
UINT8 *DataTable = NULL;
ACPI_NATIVE_UINT DataCount = 0;
ACPI_NATIVE_UINT DataLength = 0;
ACPI_NATIVE_UINT DataOffset = 0;
ACPI_NATIVE_UINT i;
UINT32 DataCount = 0;
UINT32 DataLength = 0;
UINT32 DataOffset = 0;
UINT32 i;
/* No main table, only sub-tables */
@ -307,7 +315,12 @@ AcpiDmDumpAsf (
{
/* Common sub-table header */
AcpiDmDumpTable (Table->Length, Offset, SubTable, 0, AcpiDmTableInfoAsfHdr);
Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
SubTable->Header.Length, AcpiDmTableInfoAsfHdr);
if (ACPI_FAILURE (Status))
{
return;
}
switch (SubTable->Header.Type & 0x7F) /* Mask off top bit */
{
@ -349,8 +362,12 @@ AcpiDmDumpAsf (
return;
}
AcpiDmDumpTable (Table->Length, Offset, SubTable, SubTable->Header.Length, InfoTable);
Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
SubTable->Header.Length, InfoTable);
if (ACPI_FAILURE (Status))
{
return;
}
/* Dump variable-length extra data */
@ -362,7 +379,12 @@ AcpiDmDumpAsf (
for (i = 0; i < DataCount; i++)
{
AcpiOsPrintf ("\n");
AcpiDmDumpTable (Table->Length, DataOffset, DataTable, DataLength, DataInfoTable);
Status = AcpiDmDumpTable (Table->Length, DataOffset,
DataTable, DataLength, DataInfoTable);
if (ACPI_FAILURE (Status))
{
return;
}
DataTable = ACPI_ADD_PTR (UINT8, DataTable, DataLength);
DataOffset += DataLength;
@ -381,16 +403,30 @@ AcpiDmDumpAsf (
AcpiOsPrintf ("%2.2X ", *DataTable);
DataTable++;
DataOffset++;
if (DataOffset > Table->Length)
{
AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n");
return;
}
}
AcpiOsPrintf ("\n");
break;
default:
break;
}
AcpiOsPrintf ("\n");
/* Point to next sub-table */
if (!SubTable->Header.Length)
{
AcpiOsPrintf ("Invalid zero subtable header length\n");
return;
}
Offset += SubTable->Header.Length;
SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, SubTable, SubTable->Header.Length);
}
@ -414,6 +450,7 @@ void
AcpiDmDumpCpep (
ACPI_TABLE_HEADER *Table)
{
ACPI_STATUS Status;
ACPI_CPEP_POLLING *SubTable;
UINT32 Length = Table->Length;
UINT32 Offset = sizeof (ACPI_TABLE_CPEP);
@ -421,7 +458,11 @@ AcpiDmDumpCpep (
/* Main table */
AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep);
Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep);
if (ACPI_FAILURE (Status))
{
return;
}
/* Sub-tables */
@ -429,7 +470,12 @@ AcpiDmDumpCpep (
while (Offset < Table->Length)
{
AcpiOsPrintf ("\n");
AcpiDmDumpTable (Length, Offset, SubTable, SubTable->Length, AcpiDmTableInfoCpep0);
Status = AcpiDmDumpTable (Length, Offset, SubTable,
SubTable->Length, AcpiDmTableInfoCpep0);
if (ACPI_FAILURE (Status))
{
return;
}
/* Point to next sub-table */
@ -456,6 +502,7 @@ void
AcpiDmDumpDmar (
ACPI_TABLE_HEADER *Table)
{
ACPI_STATUS Status;
ACPI_DMAR_HEADER *SubTable;
UINT32 Length = Table->Length;
UINT32 Offset = sizeof (ACPI_TABLE_DMAR);
@ -468,7 +515,11 @@ AcpiDmDumpDmar (
/* Main table */
AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar);
Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar);
if (ACPI_FAILURE (Status))
{
return;
}
/* Sub-tables */
@ -478,7 +529,12 @@ AcpiDmDumpDmar (
/* Common sub-table header */
AcpiOsPrintf ("\n");
AcpiDmDumpTable (Length, Offset, SubTable, 0, AcpiDmTableInfoDmarHdr);
Status = AcpiDmDumpTable (Length, Offset, SubTable,
SubTable->Length, AcpiDmTableInfoDmarHdr);
if (ACPI_FAILURE (Status))
{
return;
}
switch (SubTable->Type)
{
@ -490,52 +546,58 @@ AcpiDmDumpDmar (
InfoTable = AcpiDmTableInfoDmar1;
ScopeOffset = sizeof (ACPI_DMAR_RESERVED_MEMORY);
break;
case ACPI_DMAR_TYPE_ATSR:
InfoTable = AcpiDmTableInfoDmar2;
ScopeOffset = sizeof (ACPI_DMAR_ATSR);
break;
default:
AcpiOsPrintf ("\n**** Unknown DMAR sub-table type %X\n\n", SubTable->Type);
return;
}
AcpiDmDumpTable (Length, Offset, SubTable, SubTable->Length, InfoTable);
/*
* Currently, a common flag indicates whether there are any
* device scope entries present at the end of the subtable.
*/
if ((SubTable->Flags & ACPI_DMAR_INCLUDE_ALL) == 0)
Status = AcpiDmDumpTable (Length, Offset, SubTable,
SubTable->Length, InfoTable);
if (ACPI_FAILURE (Status))
{
/* Dump the device scope entries */
return;
}
ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, SubTable, ScopeOffset);
while (ScopeOffset < SubTable->Length)
/* Dump the device scope entries (if any) */
ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, SubTable, ScopeOffset);
while (ScopeOffset < SubTable->Length)
{
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable,
ScopeTable->Length, AcpiDmTableInfoDmarScope);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("\n");
AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable,
ScopeTable->Length, AcpiDmTableInfoDmarScope);
/* Dump the PCI Path entries for this device scope */
PathOffset = sizeof (ACPI_DMAR_DEVICE_SCOPE); /* Path entries start at this offset */
PciPath = ACPI_ADD_PTR (UINT8, ScopeTable,
sizeof (ACPI_DMAR_DEVICE_SCOPE));
while (PathOffset < ScopeTable->Length)
{
AcpiDmLineHeader ((PathOffset + ScopeOffset + Offset), 2, "PCI Path");
AcpiOsPrintf ("[%2.2X, %2.2X]\n", PciPath[0], PciPath[1]);
/* Point to next PCI Path entry */
PathOffset += 2;
PciPath += 2;
}
/* Point to next device scope entry */
ScopeOffset += ScopeTable->Length;
ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE,
ScopeTable, ScopeTable->Length);
return;
}
/* Dump the PCI Path entries for this device scope */
PathOffset = sizeof (ACPI_DMAR_DEVICE_SCOPE); /* Path entries start at this offset */
PciPath = ACPI_ADD_PTR (UINT8, ScopeTable,
sizeof (ACPI_DMAR_DEVICE_SCOPE));
while (PathOffset < ScopeTable->Length)
{
AcpiDmLineHeader ((PathOffset + ScopeOffset + Offset), 2, "PCI Path");
AcpiOsPrintf ("[%2.2X, %2.2X]\n", PciPath[0], PciPath[1]);
/* Point to next PCI Path entry */
PathOffset += 2;
PciPath += 2;
}
/* Point to next device scope entry */
ScopeOffset += ScopeTable->Length;
ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE,
ScopeTable, ScopeTable->Length);
}
/* Point to next sub-table */
@ -546,6 +608,220 @@ AcpiDmDumpDmar (
}
/*******************************************************************************
*
* FUNCTION: AcpiDmDumpEinj
*
* PARAMETERS: Table - A EINJ table
*
* RETURN: None
*
* DESCRIPTION: Format the contents of a EINJ. This table type consists
* of an open-ended number of subtables.
*
******************************************************************************/
void
AcpiDmDumpEinj (
ACPI_TABLE_HEADER *Table)
{
ACPI_STATUS Status;
ACPI_WHEA_HEADER *SubTable;
UINT32 Length = Table->Length;
UINT32 Offset = sizeof (ACPI_TABLE_EINJ);
/* Main table */
Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoEinj);
if (ACPI_FAILURE (Status))
{
return;
}
/* Sub-tables */
SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
while (Offset < Table->Length)
{
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Length, Offset, SubTable,
sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0);
if (ACPI_FAILURE (Status))
{
return;
}
/* Point to next sub-table (each subtable is of fixed length) */
Offset += sizeof (ACPI_WHEA_HEADER);
SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable,
sizeof (ACPI_WHEA_HEADER));
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDmDumpErst
*
* PARAMETERS: Table - A ERST table
*
* RETURN: None
*
* DESCRIPTION: Format the contents of a ERST. This table type consists
* of an open-ended number of subtables.
*
******************************************************************************/
void
AcpiDmDumpErst (
ACPI_TABLE_HEADER *Table)
{
ACPI_STATUS Status;
ACPI_WHEA_HEADER *SubTable;
UINT32 Length = Table->Length;
UINT32 Offset = sizeof (ACPI_TABLE_ERST);
/* Main table */
Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoErst);
if (ACPI_FAILURE (Status))
{
return;
}
/* Sub-tables */
SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
while (Offset < Table->Length)
{
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Length, Offset, SubTable,
sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0);
if (ACPI_FAILURE (Status))
{
return;
}
/* Point to next sub-table (each subtable is of fixed length) */
Offset += sizeof (ACPI_WHEA_HEADER);
SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable,
sizeof (ACPI_WHEA_HEADER));
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDmDumpHest
*
* PARAMETERS: Table - A HEST table
*
* RETURN: None
*
* DESCRIPTION: Format the contents of a HEST. This table type consists
* of an open-ended number of subtables.
*
******************************************************************************/
void
AcpiDmDumpHest (
ACPI_TABLE_HEADER *Table)
{
ACPI_STATUS Status;
ACPI_HEST_HEADER *SubTable;
UINT32 Length = Table->Length;
UINT32 Offset = sizeof (ACPI_TABLE_HEST);
ACPI_DMTABLE_INFO *InfoTable;
UINT32 SubTableLength;
/* Main table */
Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHest);
if (ACPI_FAILURE (Status))
{
return;
}
/* Sub-tables */
SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset);
while (Offset < Table->Length)
{
switch (SubTable->Type)
{
case ACPI_HEST_TYPE_XPF_MACHINE_CHECK:
InfoTable = AcpiDmTableInfoHest0;
SubTableLength = sizeof (ACPI_HEST_XPF_MACHINE_CHECK);
break;
case ACPI_HEST_TYPE_XPF_CORRECTED_MACHINE_CHECK:
InfoTable = AcpiDmTableInfoHest1;
SubTableLength = sizeof (ACPI_HEST_XPF_CORRECTED);
break;
case ACPI_HEST_TYPE_XPF_NON_MASKABLE_INTERRUPT:
InfoTable = AcpiDmTableInfoHest3;
SubTableLength = sizeof (ACPI_HEST_XPF_NMI);
break;
case ACPI_HEST_TYPE_IPF_CORRECTED_MACHINE_CHECK:
InfoTable = AcpiDmTableInfoHest4;
SubTableLength = sizeof (ACPI_HEST_IPF_CORRECTED);
break;
case ACPI_HEST_TYPE_IPF_CORRECTED_PLATFORM_ERROR:
InfoTable = AcpiDmTableInfoHest5;
SubTableLength = sizeof (ACPI_HEST_IPF_CORRECTED_PLATFORM);
break;
case ACPI_HEST_TYPE_AER_ROOT_PORT:
InfoTable = AcpiDmTableInfoHest6;
SubTableLength = sizeof (ACPI_HEST_AER_ROOT);
break;
case ACPI_HEST_TYPE_AER_ENDPOINT:
InfoTable = AcpiDmTableInfoHest7;
SubTableLength = sizeof (ACPI_HEST_AER);
break;
case ACPI_HEST_TYPE_AER_BRIDGE:
InfoTable = AcpiDmTableInfoHest8;
SubTableLength = sizeof (ACPI_HEST_AER_BRIDGE);
break;
case ACPI_HEST_TYPE_GENERIC_HARDWARE_ERROR_SOURCE:
InfoTable = AcpiDmTableInfoHest9;
SubTableLength = sizeof (ACPI_HEST_GENERIC);
break;
default:
/* Cannot continue on unknown type - no length */
AcpiOsPrintf ("\n**** Unknown HEST sub-table type %X\n", SubTable->Type);
return;
}
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Length, Offset, SubTable,
SubTableLength, InfoTable);
if (ACPI_FAILURE (Status))
{
return;
}
/* Point to next sub-table (each subtable is of fixed length) */
Offset += SubTableLength;
SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, SubTable, SubTableLength);
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDmDumpMadt
@ -563,6 +839,7 @@ void
AcpiDmDumpMadt (
ACPI_TABLE_HEADER *Table)
{
ACPI_STATUS Status;
ACPI_SUBTABLE_HEADER *SubTable;
UINT32 Length = Table->Length;
UINT32 Offset = sizeof (ACPI_TABLE_MADT);
@ -571,7 +848,11 @@ AcpiDmDumpMadt (
/* Main table */
AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt);
Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt);
if (ACPI_FAILURE (Status))
{
return;
}
/* Sub-tables */
@ -581,7 +862,12 @@ AcpiDmDumpMadt (
/* Common sub-table header */
AcpiOsPrintf ("\n");
AcpiDmDumpTable (Length, Offset, SubTable, 0, AcpiDmTableInfoMadtHdr);
Status = AcpiDmDumpTable (Length, Offset, SubTable,
SubTable->Length, AcpiDmTableInfoMadtHdr);
if (ACPI_FAILURE (Status))
{
return;
}
switch (SubTable->Type)
{
@ -612,13 +898,33 @@ AcpiDmDumpMadt (
case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
InfoTable = AcpiDmTableInfoMadt8;
break;
case ACPI_MADT_TYPE_LOCAL_X2APIC:
InfoTable = AcpiDmTableInfoMadt9;
break;
case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI:
InfoTable = AcpiDmTableInfoMadt10;
break;
default:
AcpiOsPrintf ("\n**** Unknown MADT sub-table type %X\n\n", SubTable->Type);
/* Attempt to continue */
if (!SubTable->Length)
{
AcpiOsPrintf ("Invalid zero length subtable\n");
return;
}
goto NextSubTable;
}
Status = AcpiDmDumpTable (Length, Offset, SubTable,
SubTable->Length, InfoTable);
if (ACPI_FAILURE (Status))
{
return;
}
AcpiDmDumpTable (Length, Offset, SubTable, SubTable->Length, InfoTable);
NextSubTable:
/* Point to next sub-table */
Offset += SubTable->Length;
@ -643,13 +949,18 @@ void
AcpiDmDumpMcfg (
ACPI_TABLE_HEADER *Table)
{
ACPI_STATUS Status;
UINT32 Offset = sizeof (ACPI_TABLE_MCFG);
ACPI_MCFG_ALLOCATION *SubTable;
/* Main table */
AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);
Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);
if (ACPI_FAILURE (Status))
{
return;
}
/* Sub-tables */
@ -664,7 +975,12 @@ AcpiDmDumpMcfg (
}
AcpiOsPrintf ("\n");
AcpiDmDumpTable (Table->Length, Offset, SubTable, 0, AcpiDmTableInfoMcfg0);
Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0);
if (ACPI_FAILURE (Status))
{
return;
}
/* Point to next sub-table (each subtable is of fixed length) */
@ -691,6 +1007,7 @@ void
AcpiDmDumpSlit (
ACPI_TABLE_HEADER *Table)
{
ACPI_STATUS Status;
UINT32 Offset;
UINT8 *Row;
UINT32 Localities;
@ -700,7 +1017,11 @@ AcpiDmDumpSlit (
/* Main table */
AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit);
Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit);
if (ACPI_FAILURE (Status))
{
return;
}
/* Display the Locality NxN Matrix */
@ -759,6 +1080,7 @@ void
AcpiDmDumpSrat (
ACPI_TABLE_HEADER *Table)
{
ACPI_STATUS Status;
UINT32 Offset = sizeof (ACPI_TABLE_SRAT);
ACPI_SUBTABLE_HEADER *SubTable;
ACPI_DMTABLE_INFO *InfoTable;
@ -766,13 +1088,27 @@ AcpiDmDumpSrat (
/* Main table */
AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat);
Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat);
if (ACPI_FAILURE (Status))
{
return;
}
/* Sub-tables */
SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
while (Offset < Table->Length)
{
/* Common sub-table header */
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
SubTable->Length, AcpiDmTableInfoSratHdr);
if (ACPI_FAILURE (Status))
{
return;
}
switch (SubTable->Type)
{
case ACPI_SRAT_TYPE_CPU_AFFINITY:
@ -781,14 +1117,31 @@ AcpiDmDumpSrat (
case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
InfoTable = AcpiDmTableInfoSrat1;
break;
case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY:
InfoTable = AcpiDmTableInfoSrat2;
break;
default:
AcpiOsPrintf ("\n**** Unknown SRAT sub-table type %X\n", SubTable->Type);
return;
/* Attempt to continue */
if (!SubTable->Length)
{
AcpiOsPrintf ("Invalid zero length subtable\n");
return;
}
goto NextSubTable;
}
AcpiOsPrintf ("\n");
AcpiDmDumpTable (Table->Length, Offset, SubTable, SubTable->Length, InfoTable);
Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
SubTable->Length, InfoTable);
if (ACPI_FAILURE (Status))
{
return;
}
NextSubTable:
/* Point to next sub-table */
Offset += SubTable->Length;

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: dmtbinfo - Table info for non-AML tables
* $Revision: 1.13 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -115,6 +114,7 @@
*****************************************************************************/
#include "acpi.h"
#include "accommon.h"
#include "acdisasm.h"
/* This module used for application-level code only */
@ -130,10 +130,14 @@
#define ACPI_HDR_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_HEADER,f)
#define ACPI_RSDP_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_RSDP,f)
#define ACPI_BOOT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_BOOT,f)
#define ACPI_BERT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_BERT,f)
#define ACPI_CPEP_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_CPEP,f)
#define ACPI_DBGP_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_DBGP,f)
#define ACPI_DMAR_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_DMAR,f)
#define ACPI_ECDT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_ECDT,f)
#define ACPI_EINJ_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_EINJ,f)
#define ACPI_ERST_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_ERST,f)
#define ACPI_HEST_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_HEST,f)
#define ACPI_HPET_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_HPET,f)
#define ACPI_MADT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MADT,f)
#define ACPI_MCFG_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MCFG,f)
@ -145,7 +149,7 @@
#define ACPI_TCPA_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_TCPA,f)
#define ACPI_WDRT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_WDRT,f)
/* Sub-tables */
/* Subtables */
#define ACPI_ASF0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_INFO,f)
#define ACPI_ASF1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_ALERT,f)
@ -158,6 +162,18 @@
#define ACPI_DMARS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_DEVICE_SCOPE,f)
#define ACPI_DMAR0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_HARDWARE_UNIT,f)
#define ACPI_DMAR1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_RESERVED_MEMORY,f)
#define ACPI_DMAR2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_ATSR,f)
#define ACPI_EINJ0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_WHEA_HEADER,f)
#define ACPI_HEST0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_XPF_MACHINE_CHECK,f)
#define ACPI_HEST1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_XPF_CORRECTED,f)
#define ACPI_HEST3_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_XPF_NMI,f)
#define ACPI_HEST4_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IPF_CORRECTED,f)
#define ACPI_HEST5_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IPF_CORRECTED_PLATFORM,f)
#define ACPI_HEST6_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_AER_ROOT,f)
#define ACPI_HEST7_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_AER,f)
#define ACPI_HEST8_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_AER_BRIDGE,f)
#define ACPI_HEST9_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_GENERIC,f)
#define ACPI_HESTN_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_NOTIFY,f)
#define ACPI_MADT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_APIC,f)
#define ACPI_MADT1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_IO_APIC,f)
#define ACPI_MADT2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_INTERRUPT_OVERRIDE,f)
@ -167,10 +183,14 @@
#define ACPI_MADT6_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_IO_SAPIC,f)
#define ACPI_MADT7_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_SAPIC,f)
#define ACPI_MADT8_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_INTERRUPT_SOURCE,f)
#define ACPI_MADT9_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_X2APIC,f)
#define ACPI_MADT10_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_X2APIC_NMI,f)
#define ACPI_MADTH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f)
#define ACPI_MCFG0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MCFG_ALLOCATION,f)
#define ACPI_SRATH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f)
#define ACPI_SRAT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SRAT_CPU_AFFINITY,f)
#define ACPI_SRAT1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SRAT_MEM_AFFINITY,f)
#define ACPI_SRAT2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SRAT_X2APIC_CPU_AFFINITY,f)
/*
* Simplify access to flag fields by breaking them up into bytes
@ -184,6 +204,7 @@
#define ACPI_HPET_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_HPET,f,o)
#define ACPI_SRAT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_CPU_AFFINITY,f,o)
#define ACPI_SRAT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_MEM_AFFINITY,f,o)
#define ACPI_SRAT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_X2APIC_CPU_AFFINITY,f,o)
#define ACPI_MADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_MADT,f,o)
#define ACPI_MADT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_APIC,f,o)
#define ACPI_MADT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_INTERRUPT_OVERRIDE,f,o)
@ -191,6 +212,8 @@
#define ACPI_MADT4_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_APIC_NMI,f,o)
#define ACPI_MADT7_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_SAPIC,f,o)
#define ACPI_MADT8_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_INTERRUPT_SOURCE,f,o)
#define ACPI_MADT9_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_X2APIC,f,o)
#define ACPI_MADT10_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_X2APIC_NMI,f,o)
/*
@ -292,12 +315,14 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoFacs[] =
*
******************************************************************************/
/* ACPI 1.0 FADT (Version 1) */
ACPI_DMTABLE_INFO AcpiDmTableInfoFadt1[] =
{
{ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Facs), "FACS Address"},
{ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Dsdt), "DSDT Address"},
{ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Model), "Model"},
{ACPI_DMT_UINT8, ACPI_FADT_OFFSET (PreferredProfile), "PM Profile"},
{ACPI_DMT_FADTPM, ACPI_FADT_OFFSET (PreferredProfile), "PM Profile"},
{ACPI_DMT_UINT16, ACPI_FADT_OFFSET (SciInterrupt), "SCI Interrupt"},
{ACPI_DMT_UINT32, ACPI_FADT_OFFSET (SmiCommand), "SMI Command Port"},
{ACPI_DMT_UINT8, ACPI_FADT_OFFSET (AcpiEnable), "ACPI Enable Value"},
@ -329,46 +354,64 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoFadt1[] =
{ACPI_DMT_UINT8, ACPI_FADT_OFFSET (DayAlarm), "RTC Day Alarm Index"},
{ACPI_DMT_UINT8, ACPI_FADT_OFFSET (MonthAlarm), "RTC Month Alarm Index"},
{ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Century), "RTC Century Index"},
{ACPI_DMT_UINT16, ACPI_FADT_OFFSET (BootFlags), "Boot Architecture Flags"},
{ACPI_DMT_UINT16, ACPI_FADT_OFFSET (BootFlags), "Boot Flags (decoded below)"},
/* Boot Architecture Flags byte 0 */
{ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "Legacy Devices Supported (V2)"},
{ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "8042 Present on ports 60/64 (V2)"},
{ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "VGA Not Present (V4)"},
{ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "MSI Not Supported (V4)"},
{ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "PCIe ASPM Not Supported (V4)"},
{ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Reserved), "Reserved"},
{ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Flags), "Flags (decoded below)"},
/* Flags byte 0 */
{ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,0), "WBINVD is operational"},
{ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,0), "WBINVD does not invalidate"},
{ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,0), "All CPUs support C1"},
{ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,0), "C2 works on MP system"},
{ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (Flags,0), "Power button is generic"},
{ACPI_DMT_FLAG5, ACPI_FADT_FLAG_OFFSET (Flags,0), "Sleep button is generic"},
{ACPI_DMT_FLAG6, ACPI_FADT_FLAG_OFFSET (Flags,0), "RTC wakeup not fixed"},
{ACPI_DMT_FLAG7, ACPI_FADT_FLAG_OFFSET (Flags,0), "RTC wakeup/S4 not possible"},
{ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,0), "WBINVD instruction is operational (V1)"},
{ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,0), "WBINVD flushes all caches (V1)"},
{ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,0), "All CPUs support C1 (V1)"},
{ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,0), "C2 works on MP system (V1)"},
{ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (Flags,0), "Control Method Power Button (V1)"},
{ACPI_DMT_FLAG5, ACPI_FADT_FLAG_OFFSET (Flags,0), "Control Method Sleep Button (V1)"},
{ACPI_DMT_FLAG6, ACPI_FADT_FLAG_OFFSET (Flags,0), "RTC wake not in fixed reg space (V1)"},
{ACPI_DMT_FLAG7, ACPI_FADT_FLAG_OFFSET (Flags,0), "RTC can wake system from S4 (V1)"},
/* Flags byte 1 */
{ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,1), "32-bit PM Timer"},
{ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,1), "Docking Supported"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* ACPI 2.0+ Extensions */
ACPI_DMTABLE_INFO AcpiDmTableInfoFadt2[] =
{
{ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,1), "Reset Register Supported"},
{ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,1), "Sealed Case"},
{ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (Flags,1), "Headless - No Video"},
{ACPI_DMT_FLAG5, ACPI_FADT_FLAG_OFFSET (Flags,1), "Native instr after SLP_TYP"},
{ACPI_DMT_FLAG6, ACPI_FADT_FLAG_OFFSET (Flags,1), "PCIEXP_WAK Supported"},
{ACPI_DMT_FLAG7, ACPI_FADT_FLAG_OFFSET (Flags,1), "Use Platform Timer"},
{ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,1), "32-bit PM Timer (V1)"},
{ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,1), "Docking Supported (V1)"},
{ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,1), "Reset Register Supported (V2)"},
{ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,1), "Sealed Case (V3)"},
{ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (Flags,1), "Headless - No Video (V3)"},
{ACPI_DMT_FLAG5, ACPI_FADT_FLAG_OFFSET (Flags,1), "Use native instr after SLP_TYPx (V3)"},
{ACPI_DMT_FLAG6, ACPI_FADT_FLAG_OFFSET (Flags,1), "PCIEXP_WAK Bits Supported (V4)"},
{ACPI_DMT_FLAG7, ACPI_FADT_FLAG_OFFSET (Flags,1), "Use Platform Timer (V4)"},
/* Flags byte 2 */
{ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,2), "RTC_STS valid after S4"},
{ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,2), "Remote Power-on capable"},
{ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,2), "APIC Cluster Model"},
{ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,2), "APIC Physical Dest Mode"},
{ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,2), "RTC_STS valid on S4 wake (V4)"},
{ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,2), "Remote Power-on capable (V4)"},
{ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,2), "Use APIC Cluster Model (V4)"},
{ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,2), "Use APIC Physical Destination Mode (V4)"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* ACPI 1.0 MS Extensions (FADT version 2) */
ACPI_DMTABLE_INFO AcpiDmTableInfoFadt2[] =
{
{ACPI_DMT_GAS, ACPI_FADT_OFFSET (ResetRegister), "Reset Register"},
{ACPI_DMT_UINT8, ACPI_FADT_OFFSET (ResetValue), "Value to cause reset"},
{ACPI_DMT_UINT24, ACPI_FADT_OFFSET (Reserved4[0]), "Reserved"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* ACPI 2.0+ Extensions (FADT version 3+) */
ACPI_DMTABLE_INFO AcpiDmTableInfoFadt3[] =
{
{ACPI_DMT_GAS, ACPI_FADT_OFFSET (ResetRegister), "Reset Register"},
{ACPI_DMT_UINT8, ACPI_FADT_OFFSET (ResetValue), "Value to cause reset"},
{ACPI_DMT_UINT24, ACPI_FADT_OFFSET (Reserved4[0]), "Reserved"},
@ -396,11 +439,11 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoFadt2[] =
*
******************************************************************************/
/* Common sub-table header (one per sub-table) */
/* Common Subtable header (one per Subtable) */
ACPI_DMTABLE_INFO AcpiDmTableInfoAsfHdr[] =
{
{ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (Header.Type), "Sub-Table Type"},
{ACPI_DMT_ASF, ACPI_ASF0_OFFSET (Header.Type), "Subtable Type"},
{ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (Header.Reserved), "Reserved"},
{ACPI_DMT_UINT16, ACPI_ASF0_OFFSET (Header.Length), "Length"},
{ACPI_DMT_EXIT, 0, NULL}
@ -494,6 +537,20 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoAsf4[] =
};
/*******************************************************************************
*
* BERT - Boot Error Record table
*
******************************************************************************/
ACPI_DMTABLE_INFO AcpiDmTableInfoBert[] =
{
{ACPI_DMT_UINT32, ACPI_BERT_OFFSET (RegionLength), "Boot Error Region Length"},
{ACPI_DMT_UINT64, ACPI_BERT_OFFSET (Address), "Boot Error Region Address"},
{ACPI_DMT_EXIT, 0, NULL}
};
/*******************************************************************************
*
* BOOT - Simple Boot Flag Table
@ -522,7 +579,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoCpep[] =
ACPI_DMTABLE_INFO AcpiDmTableInfoCpep0[] =
{
{ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Type), "Sub-Table Type"},
{ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Type), "Subtable Type"},
{ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Length), "Length"},
{ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Id), "Processor ID"},
{ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Eid), "Processor EID"},
@ -555,17 +612,16 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoDbgp[] =
ACPI_DMTABLE_INFO AcpiDmTableInfoDmar[] =
{
{ACPI_DMT_UINT8, ACPI_DMAR_OFFSET (Width), "Host Address Width"},
{ACPI_DMT_UINT8, ACPI_DMAR_OFFSET (Flags), "Flags"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* Common sub-table header (one per sub-table) */
/* Common Subtable header (one per Subtable) */
ACPI_DMTABLE_INFO AcpiDmTableInfoDmarHdr[] =
{
{ACPI_DMT_DMAR, ACPI_DMAR0_OFFSET (Header.Type), "Sub-Table Type"},
{ACPI_DMT_DMAR, ACPI_DMAR0_OFFSET (Header.Type), "Subtable Type"},
{ACPI_DMT_UINT16, ACPI_DMAR0_OFFSET (Header.Length), "Length"},
{ACPI_DMT_UINT8, ACPI_DMAR0_OFFSET (Header.Flags), "Flags"},
{ACPI_DMT_UINT24, ACPI_DMAR0_OFFSET (Header.Reserved[0]), "Reserved"},
{ACPI_DMT_EXIT, 0, NULL}
};
@ -575,30 +631,46 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoDmarScope[] =
{
{ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (EntryType), "Device Scope Entry Type"},
{ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (Length), "Entry Length"},
{ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (Segment), "PCI Segment Number"},
{ACPI_DMT_UINT16, ACPI_DMARS_OFFSET (Reserved), "Reserved"},
{ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (EnumerationId), "Enumeration ID"},
{ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (Bus), "PCI Bus Number"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* DMAR sub-tables */
/* DMAR Subtables */
/* 0: Hardware Unit Definition */
ACPI_DMTABLE_INFO AcpiDmTableInfoDmar0[] =
{
{ACPI_DMT_UINT8, ACPI_DMAR0_OFFSET (Flags), "Flags"},
{ACPI_DMT_UINT8, ACPI_DMAR0_OFFSET (Reserved), "Reserved"},
{ACPI_DMT_UINT16, ACPI_DMAR0_OFFSET (Segment), "PCI Segment Number"},
{ACPI_DMT_UINT64, ACPI_DMAR0_OFFSET (Address), "Register Base Address"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* 1: Reserved Memory Defininition */
/* 1: Reserved Memory Definition */
ACPI_DMTABLE_INFO AcpiDmTableInfoDmar1[] =
{
{ACPI_DMT_UINT64, ACPI_DMAR1_OFFSET (Address), "Base Address"},
{ACPI_DMT_UINT16, ACPI_DMAR1_OFFSET (Reserved), "Reserved"},
{ACPI_DMT_UINT16, ACPI_DMAR1_OFFSET (Segment), "PCI Segment Number"},
{ACPI_DMT_UINT64, ACPI_DMAR1_OFFSET (BaseAddress), "Base Address"},
{ACPI_DMT_UINT64, ACPI_DMAR1_OFFSET (EndAddress), "End Address (limit)"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* 2: Root Port ATS Capability Definition */
ACPI_DMTABLE_INFO AcpiDmTableInfoDmar2[] =
{
{ACPI_DMT_UINT8, ACPI_DMAR2_OFFSET (Flags), "Flags"},
{ACPI_DMT_UINT8, ACPI_DMAR2_OFFSET (Reserved), "Reserved"},
{ACPI_DMT_UINT16, ACPI_DMAR2_OFFSET (Segment), "PCI Segment Number"},
{ACPI_DMT_EXIT, 0, NULL}
};
/*******************************************************************************
*
@ -617,6 +689,236 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoEcdt[] =
};
/*******************************************************************************
*
* EINJ - Error Injection table
*
******************************************************************************/
ACPI_DMTABLE_INFO AcpiDmTableInfoEinj[] =
{
{ACPI_DMT_UINT32, ACPI_EINJ_OFFSET (HeaderLength), "Injection Header Length"},
{ACPI_DMT_UINT32, ACPI_EINJ_OFFSET (Reserved), "Reserved"},
{ACPI_DMT_UINT32, ACPI_EINJ_OFFSET (Entries), "Injection Entry Count"},
{ACPI_DMT_EXIT, 0, NULL}
};
ACPI_DMTABLE_INFO AcpiDmTableInfoEinj0[] =
{
{ACPI_DMT_UINT8, ACPI_EINJ0_OFFSET (Action), "Action"},
{ACPI_DMT_UINT8, ACPI_EINJ0_OFFSET (Instruction), "Instruction"},
{ACPI_DMT_UINT8, ACPI_EINJ0_OFFSET (Flags), "Flags"},
{ACPI_DMT_UINT8, ACPI_EINJ0_OFFSET (Reserved), "Reserved"},
{ACPI_DMT_GAS, ACPI_EINJ0_OFFSET (RegisterRegion), "Register Region"},
{ACPI_DMT_UINT64, ACPI_EINJ0_OFFSET (Value), "Value"},
{ACPI_DMT_UINT64, ACPI_EINJ0_OFFSET (Mask), "Mask"},
{ACPI_DMT_EXIT, 0, NULL}
};
/*******************************************************************************
*
* ERST - Error Record Serialization table
*
******************************************************************************/
ACPI_DMTABLE_INFO AcpiDmTableInfoErst[] =
{
{ACPI_DMT_UINT32, ACPI_ERST_OFFSET (HeaderLength), "Serialization Header Length"},
{ACPI_DMT_UINT32, ACPI_ERST_OFFSET (Reserved), "Reserved"},
{ACPI_DMT_UINT32, ACPI_ERST_OFFSET (Entries), "Instruction Entry Count"},
{ACPI_DMT_EXIT, 0, NULL}
};
/*******************************************************************************
*
* HEST - Hardware Error Source table
*
******************************************************************************/
ACPI_DMTABLE_INFO AcpiDmTableInfoHest[] =
{
{ACPI_DMT_UINT32, ACPI_HEST_OFFSET (ErrorSourceCount), "Error Source Count"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* HEST Subtables */
/* 0: XPF Machine Check Exception */
ACPI_DMTABLE_INFO AcpiDmTableInfoHest0[] =
{
{ACPI_DMT_HEST, ACPI_HEST0_OFFSET (Header.Type), "Subtable Type"},
{ACPI_DMT_UINT16, ACPI_HEST0_OFFSET (SourceId), "Source Id"},
{ACPI_DMT_UINT16, ACPI_HEST0_OFFSET (ConfigWriteEnable), "Configuration Write Enable"},
{ACPI_DMT_UINT8, ACPI_HEST0_OFFSET (Flags), "Flags"},
{ACPI_DMT_UINT8, ACPI_HEST0_OFFSET (Reserved1), "Reserved"},
{ACPI_DMT_UINT32, ACPI_HEST0_OFFSET (RecordsToPreAllocate), "Records To Preallocate"},
{ACPI_DMT_UINT32, ACPI_HEST0_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record"},
{ACPI_DMT_UINT64, ACPI_HEST0_OFFSET (GlobalCapabilityData), "Global Capability Data"},
{ACPI_DMT_UINT64, ACPI_HEST0_OFFSET (GlobalControlData), "Global Control Data"},
{ACPI_DMT_UINT8, ACPI_HEST0_OFFSET (NumHardwareBanks), "Num Hardware Banks"},
{ACPI_DMT_UINT56, ACPI_HEST0_OFFSET (Reserved2), "Reserved"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* 1: XPF Corrected Machine Check */
ACPI_DMTABLE_INFO AcpiDmTableInfoHest1[] =
{
{ACPI_DMT_HEST, ACPI_HEST1_OFFSET (Header.Type), "Subtable Type"},
{ACPI_DMT_UINT16, ACPI_HEST1_OFFSET (SourceId), "Source Id"},
{ACPI_DMT_UINT16, ACPI_HEST1_OFFSET (ConfigWriteEnable), "Configuration Write Enable"},
{ACPI_DMT_UINT8, ACPI_HEST1_OFFSET (Flags), "Flags"},
{ACPI_DMT_UINT8, ACPI_HEST1_OFFSET (Enabled), "Enabled"},
{ACPI_DMT_UINT32, ACPI_HEST1_OFFSET (RecordsToPreAllocate), "Records To Preallocate"},
{ACPI_DMT_UINT32, ACPI_HEST1_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record"},
{ACPI_DMT_HESTNTFY, ACPI_HEST1_OFFSET (Notify), "Notify"},
{ACPI_DMT_UINT8, ACPI_HEST1_OFFSET (NumHardwareBanks), "Num Hardware Banks"},
{ACPI_DMT_UINT24, ACPI_HEST1_OFFSET (Reserved), "Reserved"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* 3: XPF Non-Maskable Interrupt */
ACPI_DMTABLE_INFO AcpiDmTableInfoHest3[] =
{
{ACPI_DMT_HEST, ACPI_HEST3_OFFSET (Header.Type), "Subtable Type"},
{ACPI_DMT_UINT16, ACPI_HEST3_OFFSET (SourceId), "Source Id"},
{ACPI_DMT_UINT32, ACPI_HEST3_OFFSET (Reserved), "Reserved"},
{ACPI_DMT_UINT32, ACPI_HEST3_OFFSET (RecordsToPreAllocate), "Records To Preallocate"},
{ACPI_DMT_UINT32, ACPI_HEST3_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record"},
{ACPI_DMT_UINT32, ACPI_HEST3_OFFSET (MaxRawDataLength), "Max Raw Data Length"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* 4: IPF Corrected Machine Check */
ACPI_DMTABLE_INFO AcpiDmTableInfoHest4[] =
{
{ACPI_DMT_HEST, ACPI_HEST4_OFFSET (Header.Type), "Subtable Type"},
{ACPI_DMT_UINT8, ACPI_HEST4_OFFSET (Enabled), "Enabled"},
{ACPI_DMT_UINT8, ACPI_HEST4_OFFSET (Reserved), "Reserved"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* 5: IPF Corrected Platform Error */
ACPI_DMTABLE_INFO AcpiDmTableInfoHest5[] =
{
{ACPI_DMT_HEST, ACPI_HEST5_OFFSET (Header.Type), "Subtable Type"},
{ACPI_DMT_UINT8, ACPI_HEST5_OFFSET (Enabled), "Enabled"},
{ACPI_DMT_UINT8, ACPI_HEST5_OFFSET (Reserved), "Reserved"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* 6: PCI Express Root Port AER */
ACPI_DMTABLE_INFO AcpiDmTableInfoHest6[] =
{
{ACPI_DMT_HEST, ACPI_HEST6_OFFSET (Header.Type), "Subtable Type"},
{ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.SourceId), "Source Id"},
{ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.ConfigWriteEnable), "Configuration Write Enable"},
{ACPI_DMT_UINT8, ACPI_HEST6_OFFSET (Aer.Flags), "Flags"},
{ACPI_DMT_UINT8, ACPI_HEST6_OFFSET (Aer.Enabled), "Enabled"},
{ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.RecordsToPreAllocate), "Records To Preallocate"},
{ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.MaxSectionsPerRecord), "Max Sections Per Record"},
{ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.Bus), "Bus"},
{ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Device), "Device"},
{ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Function), "Function"},
{ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.DeviceControl), "DeviceControl"},
{ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Reserved), "Reserved"},
{ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.UncorrectableErrorMask), "Uncorrectable Error Mask"},
{ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.UncorrectableErrorSeverity), "Uncorrectable Error Severity"},
{ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.CorrectableErrorMask), "Correctable Error Mask"},
{ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.AdvancedErrorCapabilities), "Advanced Error Capabilities"},
{ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (RootErrorCommand), "Root Error Command"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* 7: PCI Express AER (AER Endpoint) */
ACPI_DMTABLE_INFO AcpiDmTableInfoHest7[] =
{
{ACPI_DMT_HEST, ACPI_HEST6_OFFSET (Header.Type), "Subtable Type"},
{ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.SourceId), "Source Id"},
{ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.ConfigWriteEnable), "Configuration Write Enable"},
{ACPI_DMT_UINT8, ACPI_HEST6_OFFSET (Aer.Flags), "Flags"},
{ACPI_DMT_UINT8, ACPI_HEST6_OFFSET (Aer.Enabled), "Enabled"},
{ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.RecordsToPreAllocate), "Records To Preallocate"},
{ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.MaxSectionsPerRecord), "Max Sections Per Record"},
{ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.Bus), "Bus"},
{ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Device), "Device"},
{ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Function), "Function"},
{ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.DeviceControl), "DeviceControl"},
{ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Reserved), "Reserved"},
{ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.UncorrectableErrorMask), "Uncorrectable Error Mask"},
{ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.UncorrectableErrorSeverity), "Uncorrectable Error Severity"},
{ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.CorrectableErrorMask), "Correctable Error Mask"},
{ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.AdvancedErrorCapabilities), "Advanced Error Capabilities"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* 8: PCI Express/PCI-X Bridge AER */
ACPI_DMTABLE_INFO AcpiDmTableInfoHest8[] =
{
{ACPI_DMT_HEST, ACPI_HEST6_OFFSET (Header.Type), "Subtable Type"},
{ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.SourceId), "Source Id"},
{ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.ConfigWriteEnable), "Configuration Write Enable"},
{ACPI_DMT_UINT8, ACPI_HEST6_OFFSET (Aer.Flags), "Flags"},
{ACPI_DMT_UINT8, ACPI_HEST6_OFFSET (Aer.Enabled), "Enabled"},
{ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.RecordsToPreAllocate), "Records To Preallocate"},
{ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.MaxSectionsPerRecord), "Max Sections Per Record"},
{ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.Bus), "Bus"},
{ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Device), "Device"},
{ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Function), "Function"},
{ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.DeviceControl), "DeviceControl"},
{ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Reserved), "Reserved"},
{ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.UncorrectableErrorMask), "Uncorrectable Error Mask"},
{ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.UncorrectableErrorSeverity), "Uncorrectable Error Severity"},
{ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.CorrectableErrorMask), "Correctable Error Mask"},
{ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.AdvancedErrorCapabilities), "Advanced Error Capabilities"},
{ACPI_DMT_UINT32, ACPI_HEST8_OFFSET (SecondaryUncorrectableErrorMask), "2nd Uncorrectable Err Mask"},
{ACPI_DMT_UINT32, ACPI_HEST8_OFFSET (SecondaryUncorrectableErrorSeverity), "2nd Uncorrectable Err Severity"},
{ACPI_DMT_UINT32, ACPI_HEST8_OFFSET (SecondaryAdvancedCapabilities), "2nd Advanced Capabilities"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* 9: Generic Hardware Error Source */
ACPI_DMTABLE_INFO AcpiDmTableInfoHest9[] =
{
{ACPI_DMT_HEST, ACPI_HEST9_OFFSET (Header.Type), "Subtable Type"},
{ACPI_DMT_UINT16, ACPI_HEST9_OFFSET (SourceId), "Source Id"},
{ACPI_DMT_UINT16, ACPI_HEST9_OFFSET (RelatedSourceId), "Related Source Id"},
{ACPI_DMT_UINT8, ACPI_HEST9_OFFSET (ConfigWriteEnable), "Configuration Write Enable"},
{ACPI_DMT_UINT8, ACPI_HEST9_OFFSET (Enabled), "Enabled"},
{ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (RecordsToPreAllocate), "Records To Preallocate"},
{ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record"},
{ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (MaxRawDataLength), "Max Raw Data Length"},
{ACPI_DMT_GAS, ACPI_HEST9_OFFSET (ErrorStatusAddress), "Error Status Address"},
{ACPI_DMT_HESTNTFY, ACPI_HEST9_OFFSET (Notify), "Notify"},
{ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (ErrorStatusBlockLength), "Error Status Block Length"},
{ACPI_DMT_EXIT, 0, NULL}
};
ACPI_DMTABLE_INFO AcpiDmTableInfoHestNotify[10] =
{
{ACPI_DMT_HESTNTYP, ACPI_HESTN_OFFSET (Type), "Notify Type"},
{ACPI_DMT_UINT8, ACPI_HESTN_OFFSET (Length), "Notify Length"},
{ACPI_DMT_UINT16, ACPI_HESTN_OFFSET (ConfigWriteEnable), "Configuration Write Enable"},
{ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (PollInterval), "PollInterval"},
{ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (Vector), "Vector"},
{ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (PollingThresholdValue), "Polling Threshold Value"},
{ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (PollingThresholdWindow), "Polling Threshold Window"},
{ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (ErrorThresholdValue), "Error Threshold Value"},
{ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (ErrorThresholdWindow), "Error Threshold Window"},
{ACPI_DMT_EXIT, 0, NULL}
};
/*******************************************************************************
*
* HPET - High Precision Event Timer table
@ -651,16 +953,16 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt[] =
{ACPI_DMT_EXIT, 0, NULL}
};
/* Common sub-table header (one per sub-table) */
/* Common Subtable header (one per Subtable) */
ACPI_DMTABLE_INFO AcpiDmTableInfoMadtHdr[] =
{
{ACPI_DMT_MADT, ACPI_MADTH_OFFSET (Type), "Sub-Table Type"},
{ACPI_DMT_MADT, ACPI_MADTH_OFFSET (Type), "Subtable Type"},
{ACPI_DMT_UINT8, ACPI_MADTH_OFFSET (Length), "Length"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* MADT sub-tables */
/* MADT Subtables */
/* 0: processor APIC */
@ -772,10 +1074,35 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt8[] =
{ACPI_DMT_EXIT, 0, NULL}
};
/* 9: Processor Local X2_APIC (07/2008) */
ACPI_DMTABLE_INFO AcpiDmTableInfoMadt9[] =
{
{ACPI_DMT_UINT16, ACPI_MADT9_OFFSET (Reserved), "Reserved"},
{ACPI_DMT_UINT32, ACPI_MADT9_OFFSET (LocalApicId), "Processor x2Apic ID"},
{ACPI_DMT_UINT32, ACPI_MADT9_OFFSET (LapicFlags), "Flags (decoded below)"},
{ACPI_DMT_FLAG0, ACPI_MADT9_FLAG_OFFSET (LapicFlags,0), "Processor Enabled"},
{ACPI_DMT_UINT32, ACPI_MADT9_OFFSET (Uid), "Processor UID"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* 10: Local X2_APIC NMI (07/2008) */
ACPI_DMTABLE_INFO AcpiDmTableInfoMadt10[] =
{
{ACPI_DMT_UINT16, ACPI_MADT10_OFFSET (IntiFlags), "Flags (decoded below)"},
{ACPI_DMT_FLAGS0, ACPI_MADT10_FLAG_OFFSET (IntiFlags,0), "Polarity"},
{ACPI_DMT_FLAGS2, ACPI_MADT10_FLAG_OFFSET (IntiFlags,0), "Trigger Mode"},
{ACPI_DMT_UINT32, ACPI_MADT10_OFFSET (Uid), "Processor UID"},
{ACPI_DMT_UINT8, ACPI_MADT10_OFFSET (Lint), "Interrupt Input LINT"},
{ACPI_DMT_UINT24, ACPI_MADT10_OFFSET (Reserved[0]), "Reserved"},
{ACPI_DMT_EXIT, 0, NULL}
};
/*******************************************************************************
*
* MCFG - PCI Memory Mapped Configuration table and sub-table
* MCFG - PCI Memory Mapped Configuration table and Subtable
*
******************************************************************************/
@ -811,6 +1138,18 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSbst[] =
};
/*******************************************************************************
*
* SLIC - Software Licensing Description Table. NOT FULLY IMPLEMENTED
*
******************************************************************************/
ACPI_DMTABLE_INFO AcpiDmTableInfoSlic[] =
{
{ACPI_DMT_EXIT, 0, NULL}
};
/*******************************************************************************
*
* SLIT - System Locality Information Table
@ -883,7 +1222,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSpmi[] =
/*******************************************************************************
*
* SRAT - System Resource Affinity Table and sub-tables
* SRAT - System Resource Affinity Table and Subtables
*
******************************************************************************/
@ -894,10 +1233,21 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSrat[] =
{ACPI_DMT_EXIT, 0, NULL}
};
/* Common Subtable header (one per Subtable) */
ACPI_DMTABLE_INFO AcpiDmTableInfoSratHdr[] =
{
{ACPI_DMT_SRAT, ACPI_SRATH_OFFSET (Type), "Subtable Type"},
{ACPI_DMT_UINT8, ACPI_SRATH_OFFSET (Length), "Length"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* SRAT Subtables */
/* 0: Processor Local APIC/SAPIC Affinity */
ACPI_DMTABLE_INFO AcpiDmTableInfoSrat0[] =
{
{ACPI_DMT_SRAT, ACPI_SRAT0_OFFSET (Header.Type), "Sub-Table Type"},
{ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (Header.Length), "Length"},
{ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (ProximityDomainLo), "Proximity Domain Low(8)"},
{ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (ApicId), "Apic ID"},
{ACPI_DMT_UINT32, ACPI_SRAT0_OFFSET (Flags), "Flags (decoded below)"},
@ -908,20 +1258,32 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSrat0[] =
{ACPI_DMT_EXIT, 0, NULL}
};
/* 1: Memory Affinity */
ACPI_DMTABLE_INFO AcpiDmTableInfoSrat1[] =
{
{ACPI_DMT_SRAT, ACPI_SRAT1_OFFSET (Header.Type), "Sub-Table Type"},
{ACPI_DMT_UINT8, ACPI_SRAT1_OFFSET (Header.Length), "Length"},
{ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (ProximityDomain), "Proximity Domain"},
{ACPI_DMT_UINT16, ACPI_SRAT1_OFFSET (Reserved), "Reserved"},
{ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (BaseAddress), "Base Address"},
{ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (Length), "Address Length"},
{ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (MemoryType), "Memory Type"},
{ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (Reserved1), "Reserved"},
{ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (Flags), "Flags (decoded below)"},
{ACPI_DMT_FLAG0, ACPI_SRAT1_FLAG_OFFSET (Flags,0), "Enabled"},
{ACPI_DMT_FLAG1, ACPI_SRAT1_FLAG_OFFSET (Flags,0), "Hot Pluggable"},
{ACPI_DMT_FLAG2, ACPI_SRAT1_FLAG_OFFSET (Flags,0), "Non-Volatile"},
{ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (Reserved1), "Reserved"},
{ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (Reserved2), "Reserved"},
{ACPI_DMT_EXIT, 0, NULL}
};
/* 2: Processor Local X2_APIC Affinity (07/2008) */
ACPI_DMTABLE_INFO AcpiDmTableInfoSrat2[] =
{
{ACPI_DMT_UINT16, ACPI_SRAT2_OFFSET (Reserved), "Reserved"},
{ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (ProximityDomain), "Proximity Domain"},
{ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (ApicId), "Apic ID"},
{ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (Flags), "Flags (decoded below)"},
{ACPI_DMT_FLAG0, ACPI_SRAT2_FLAG_OFFSET (Flags,0), "Enabled"},
{ACPI_DMT_EXIT, 0, NULL}
};

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: getopt
* $Revision: 1.10 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -118,6 +117,9 @@
#include <stdio.h>
#include <string.h>
#include "acpi.h"
#include "accommon.h"
#include "acapps.h"
#define ERR(szz,czz) if(AcpiGbl_Opterr){fprintf(stderr,"%s%s%c\n",argv[0],szz,czz);}

128
compiler/Makefile Normal file
View File

@ -0,0 +1,128 @@
PROG= iasl
SRCS= aslcompilerparse.c aslcompilerlex.c aslanalyze.c aslcodegen.c \
aslcompile.c aslerror.c aslfiles.c asllength.c \
asllisting.c aslload.c asllookup.c aslmain.c aslmap.c aslopcodes.c \
asloperands.c aslresource.c aslrestype1.c aslrestype2.c aslstartup.c \
asltree.c aslutils.c asltransform.c aslfold.c aslstubs.c aslopt.c \
../common/getopt.c \
../utilities/utalloc.c \
../utilities/utcache.c \
../utilities/utcopy.c \
../utilities/utdebug.c \
../utilities/utdelete.c \
../utilities/utglobal.c \
../utilities/utinit.c \
../utilities/utlock.c \
../utilities/utobject.c \
../utilities/utmisc.c \
../utilities/utmath.c \
../utilities/utmutex.c \
../utilities/utresrc.c \
../utilities/utstate.c \
../utilities/utxface.c \
../namespace/nsaccess.c \
../namespace/nsalloc.c \
../namespace/nsdump.c \
../namespace/nsnames.c \
../namespace/nsobject.c \
../namespace/nsparse.c \
../namespace/nssearch.c \
../namespace/nsutils.c \
../namespace/nswalk.c \
../namespace/nsxfobj.c \
../parser/psargs.c \
../parser/psloop.c \
../parser/psopcode.c \
../parser/psparse.c \
../parser/psscope.c \
../parser/pstree.c \
../parser/psutils.c \
../parser/pswalk.c \
../dispatcher/dswscope.c \
../dispatcher/dswstate.c \
../dispatcher/dsfield.c \
../dispatcher/dsobject.c \
../dispatcher/dsopcode.c \
../dispatcher/dsutils.c \
../dispatcher/dswexec.c \
../dispatcher/dswload.c \
../executer/exconvrt.c \
../executer/excreate.c \
../executer/exdump.c \
../executer/exmisc.c \
../executer/exmutex.c \
../executer/exnames.c \
../executer/exoparg1.c \
../executer/exoparg2.c \
../executer/exoparg3.c \
../executer/exoparg6.c \
../executer/exprep.c \
../executer/exregion.c \
../executer/exresnte.c \
../executer/exresolv.c \
../executer/exresop.c \
../executer/exstore.c \
../executer/exstoren.c \
../executer/exstorob.c \
../executer/exsystem.c \
../executer/exutils.c \
../common/adfile.c \
../common/adisasm.c \
../common/adwalk.c \
../common/dmrestag.c \
../common/dmtable.c \
../common/dmtbinfo.c \
../common/dmtbdump.c \
../debugger/dbfileio.c \
../disassembler/dmbuffer.c \
../disassembler/dmnames.c \
../disassembler/dmopcode.c \
../disassembler/dmobject.c \
../disassembler/dmresrc.c \
../disassembler/dmresrcl.c \
../disassembler/dmresrcs.c \
../disassembler/dmutils.c \
../disassembler/dmwalk.c \
../tables/tbfadt.c \
../tables/tbinstal.c \
../tables/tbutils.c \
../tables/tbxface.c \
../osunixxf.c
NOMAN= YES
CFLAGS+= -Wall -O2 -Wstrict-prototypes -D_LINUX -DACPI_ASL_COMPILER -I../include
#YACC= yacc
YACC= bison
YFLAGS+= -v -d
LEX= flex
LFLAGS+= -i
#.if $(YACC) == "bison"
YFLAGS+= -y -pAslCompiler
#.else
#CFLAGS+= -D_USE_BERKELEY_YACC
#.endif
LDLIBS = -lpthread -lrt
aslmain : $(patsubst %.c,%.o, $(SRCS))
$(CC) $(LDFLAGS) $(patsubst %.c,%.o, $(SRCS)) \
$(LOADLIBES) $(LDLIBS) -o iasl
CLEANFILES= y.output y.tab.c y.tab.h aslcompiler.y.h \
aslcompilerparse.c aslcompilerlex.c iasl
aslcompilerparse.c: aslcompiler.y
${YACC} ${YFLAGS} aslcompiler.y
cp y.tab.c aslcompilerparse.c
cp y.tab.h aslcompiler.y.h
aslcompilerlex.c: aslcompiler.l
${LEX} ${LFLAGS} -PAslCompiler -oaslcompilerlex.c aslcompiler.l
clean :
rm -f $(CLEANFILES) $(patsubst %.c,%.o, $(SRCS))

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: aslanalyze.c - check for semantic errors
* $Revision: 1.115 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -121,8 +120,6 @@
#include "acparser.h"
#include "amlcode.h"
#include <ctype.h>
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslanalyze")
@ -179,6 +176,10 @@ static UINT32
AnGetInternalMethodReturnType (
ACPI_PARSE_OBJECT *Op);
BOOLEAN
AnIsResultUsed (
ACPI_PARSE_OBJECT *Op);
/*******************************************************************************
*
@ -272,7 +273,11 @@ AnMapArgTypeToBtype (
return (ACPI_BTYPE_MUTEX);
case ARGI_DDBHANDLE:
return (ACPI_BTYPE_DDB_HANDLE);
/*
* DDBHandleObject := SuperName
* ACPI_BTYPE_REFERENCE: Index reference as parameter of Load/Unload
*/
return (ACPI_BTYPE_DDB_HANDLE | ACPI_BTYPE_REFERENCE);
/* Interchangeable types */
/*
@ -682,7 +687,15 @@ AnCheckForReservedName (
return (ACPI_NOT_RESERVED_NAME);
}
AslError (ASL_ERROR, ASL_MSG_RESERVED_WORD, Op, Op->Asl.ExternalName);
/*
* Was not actually emitted by the compiler. This is a special case,
* however. If the ASL code being compiled was the result of a
* dissasembly, it may possibly contain valid compiler-emitted names
* of the form "_T_x". We don't want to issue an error or even a
* warning and force the user to manually change the names. So, we
* will issue a remark instead.
*/
AslError (ASL_REMARK, ASL_MSG_COMPILER_RESERVED, Op, Op->Asl.ExternalName);
return (ACPI_COMPILER_RESERVED_NAME);
}
@ -718,6 +731,8 @@ AnCheckForReservedMethod (
ASL_METHOD_INFO *MethodInfo)
{
UINT32 Index;
UINT32 RequiredArgsCurrent;
UINT32 RequiredArgsOld;
/* Check for a match against the reserved name list */
@ -754,15 +769,23 @@ AnCheckForReservedMethod (
Gbl_ReservedMethods++;
/* Matched a reserved method name */
/*
* Matched a reserved method name
*
* Validate the ASL-defined argument count. Allow two different legal
* arg counts.
*/
RequiredArgsCurrent = ReservedMethods[Index].NumArguments & 0x0F;
RequiredArgsOld = ReservedMethods[Index].NumArguments >> 4;
if (MethodInfo->NumArguments != ReservedMethods[Index].NumArguments)
if ((MethodInfo->NumArguments != RequiredArgsCurrent) &&
(MethodInfo->NumArguments != RequiredArgsOld))
{
sprintf (MsgBuffer, "%s requires %d",
ReservedMethods[Index].Name,
ReservedMethods[Index].NumArguments);
RequiredArgsCurrent);
if (MethodInfo->NumArguments > ReservedMethods[Index].NumArguments)
if (MethodInfo->NumArguments > RequiredArgsCurrent)
{
AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op,
MsgBuffer);
@ -956,9 +979,9 @@ AnMethodAnalysisWalkBegin (
MethodInfo->ValidArgTypes[ActualArgs] =
AnMapObjTypeToBtype (NextType);
NextType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
ActualArgs++;
}
ActualArgs++;
NextType = NextType->Asl.Next;
}
@ -1010,10 +1033,10 @@ AnMethodAnalysisWalkBegin (
if (!MethodInfo)
{
/*
* Probably was an error in the method declaration,
* no additional error here
* Local was used outside a control method, or there was an error
* in the method declaration.
*/
ACPI_WARNING ((AE_INFO, "%p, No parent method", Op));
AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD, Op, Op->Asl.ExternalName);
return (AE_ERROR);
}
@ -1054,10 +1077,10 @@ AnMethodAnalysisWalkBegin (
if (!MethodInfo)
{
/*
* Probably was an error in the method declaration,
* no additional error here
* Arg was used outside a control method, or there was an error
* in the method declaration.
*/
ACPI_WARNING ((AE_INFO, "%p, No parent method", Op));
AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD, Op, Op->Asl.ExternalName);
return (AE_ERROR);
}
@ -1705,6 +1728,30 @@ AnOperandTypecheckWalkEnd (
RuntimeArgTypes = OpInfo->RuntimeArgs;
OpcodeClass = OpInfo->Class;
#ifdef ASL_ERROR_NAMED_OBJECT_IN_WHILE
/*
* Update 11/2008: In practice, we can't perform this check. A simple
* analysis is not sufficient. Also, it can cause errors when compiling
* disassembled code because of the way Switch operators are implemented
* (a While(One) loop with a named temp variable created within.)
*/
/*
* If we are creating a named object, check if we are within a while loop
* by checking if the parent is a WHILE op. This is a simple analysis, but
* probably sufficient for many cases.
*
* Allow Scope(), Buffer(), and Package().
*/
if (((OpcodeClass == AML_CLASS_NAMED_OBJECT) && (Op->Asl.AmlOpcode != AML_SCOPE_OP)) ||
((OpcodeClass == AML_CLASS_CREATE) && (OpInfo->Flags & AML_NSNODE)))
{
if (Op->Asl.Parent->Asl.AmlOpcode == AML_WHILE_OP)
{
AslError (ASL_ERROR, ASL_MSG_NAMED_OBJECT_IN_WHILE, Op, NULL);
}
}
#endif
/*
* Special case for control opcodes IF/RETURN/WHILE since they
@ -2074,6 +2121,7 @@ AnOtherSemanticAnalysisWalkBegin (
{
case PARSEOP_ACQUIRE:
case PARSEOP_WAIT:
case PARSEOP_LOADTABLE:
break;
default:

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: aslcodegen - AML code generation
* $Revision: 1.62 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -235,24 +234,24 @@ CgAmlWriteWalk (
DbgPrint (ASL_TREE_OUTPUT, " ");
}
DbgPrint (ASL_TREE_OUTPUT,
"%08X %04X %04X %01X %04X %04X %04X %04X %08X %08X %08X %08X %08X %04X %02d %02d\n",
/* 1 */ (UINT32) Op->Asl.Value.Integer,
/* 2 */ Op->Asl.ParseOpcode,
/* 3 */ Op->Asl.AmlOpcode,
/* 4 */ Op->Asl.AmlOpcodeLength,
/* 5 */ Op->Asl.AmlPkgLenBytes,
/* 6 */ Op->Asl.AmlLength,
/* 7 */ Op->Asl.AmlSubtreeLength,
/* 8 */ Op->Asl.Parent ? Op->Asl.Parent->Asl.AmlSubtreeLength : 0,
/* 9 */ Op,
/* 10 */ Op->Asl.Child,
/* 11 */ Op->Asl.Parent,
/* 12 */ Op->Asl.CompileFlags,
/* 13 */ Op->Asl.AcpiBtype,
/* 14 */ Op->Asl.FinalAmlLength,
/* 15 */ Op->Asl.Column,
/* 16 */ Op->Asl.LineNumber);
DbgPrint (ASL_TREE_OUTPUT,
"%08X %04X %04X %01X %04X %04X %04X %04X %08X %08X %08X %08X %08X %04X %02d %02d\n",
/* 1 */ (UINT32) Op->Asl.Value.Integer,
/* 2 */ Op->Asl.ParseOpcode,
/* 3 */ Op->Asl.AmlOpcode,
/* 4 */ Op->Asl.AmlOpcodeLength,
/* 5 */ Op->Asl.AmlPkgLenBytes,
/* 6 */ Op->Asl.AmlLength,
/* 7 */ Op->Asl.AmlSubtreeLength,
/* 8 */ Op->Asl.Parent ? Op->Asl.Parent->Asl.AmlSubtreeLength : 0,
/* 9 */ Op,
/* 10 */ Op->Asl.Child,
/* 11 */ Op->Asl.Parent,
/* 12 */ Op->Asl.CompileFlags,
/* 13 */ Op->Asl.AcpiBtype,
/* 14 */ Op->Asl.FinalAmlLength,
/* 15 */ Op->Asl.Column,
/* 16 */ Op->Asl.LineNumber);
/* Generate the AML for this node */

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: aslcompile - top level compile module
* $Revision: 1.97 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -132,6 +131,16 @@ static ACPI_STATUS
FlCheckForAscii (
ASL_FILE_INFO *FileInfo);
void
FlConsumeAnsiComment (
ASL_FILE_INFO *FileInfo,
ASL_FILE_STATUS *Status);
void
FlConsumeNewComment (
ASL_FILE_INFO *FileInfo,
ASL_FILE_STATUS *Status);
/*******************************************************************************
*
@ -466,7 +475,7 @@ FlCheckForAscii (
/* Check for an ASCII character */
if (!isascii (Byte))
if (!ACPI_IS_ASCII (Byte))
{
if (BadBytes < 10)
{
@ -914,16 +923,6 @@ CmCleanupAndExit (
}
UtDisplaySummary (ASL_FILE_STDOUT);
/*
* Return non-zero exit code if there have been errors, unless the
* global ignore error flag has been set
*/
if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && (!Gbl_IgnoreErrors))
{
exit (1);
}
exit (0);
}

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: aslcompiler.h - common include file for iASL
* $Revision: 1.148 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -140,6 +139,7 @@
#include "acpi.h"
#include "accommon.h"
#include "amlresrc.h"
#include "acdebug.h"
@ -188,6 +188,16 @@ AslPushInputFileStack (
FILE *InputFile,
char *Filename);
/*
* aslstartup - called from main
*/
ACPI_STATUS
AslDoOnePathname (
char *Pathname);
ACPI_STATUS
AslDoOneFile (
char *Filename);
/*
* aslcompile - compile mainline
@ -307,6 +317,10 @@ void
AePrintErrorLog (
UINT32 FileId);
void
AeClearErrorLog (
void);
ACPI_PHYSICAL_ADDRESS
AeLocalGetRootPointer (
void);

View File

@ -3,7 +3,6 @@
/******************************************************************************
*
* Module Name: aslcompiler.l - Flex input file
* $Revision: 1.79 $
*
*****************************************************************************/
@ -11,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -169,7 +168,8 @@ NamePathTail [.]{NameSeg}
%%
[ ] { count (0); }
[\n] { count (0); }
[\n] { count (0); } /* Handle files with both LF and CR/LF */
[\r] { count (0); } /* termination on both Unix and Windows */
[ \t] { count (0); }

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: asldefine.h - Common defines for the iASL compiler
* $Revision: 1.7 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -128,7 +127,7 @@
#define IntelAcpiCA "Intel ACPI Component Architecture"
#define CompilerId "ASL Optimizing Compiler"
#define DisassemblerId "AML Disassembler"
#define CompilerCopyright "Copyright (C) 2000 - 2007 Intel Corporation"
#define CompilerCopyright "Copyright (C) 2000 - 2009 Intel Corporation"
#define CompilerCompliance "Supports ACPI Specification Revision 3.0a"
#define CompilerName "iasl"
#define CompilerCreatorId "INTL"

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: aslerror - Error handling and statistics
* $Revision: 1.92 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -128,6 +127,26 @@ AeAddToErrorLog (
ASL_ERROR_MSG *Enode);
void
AeClearErrorLog (
void)
{
ASL_ERROR_MSG *Enode = Gbl_ErrorLog;
ASL_ERROR_MSG *Next;
/* Walk the error node list */
while (Enode)
{
Next = Enode->Next;
ACPI_FREE (Enode);
Enode = Next;
}
Gbl_ErrorLog = NULL;
}
/*******************************************************************************
*
* FUNCTION: AeAddToErrorLog
@ -228,6 +247,11 @@ AePrintException (
FILE *SourceFile;
if (Gbl_NoErrors)
{
return;
}
/*
* Only listing files have a header, and remarks/optimizations
* are always output
@ -288,7 +312,8 @@ AePrintException (
if (Actual)
{
fprintf (OutputFile,
"[*** iASL: Seek error on source code temp file ***]");
"[*** iASL: Seek error on source code temp file %s ***]",
Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
}
else
{
@ -296,7 +321,8 @@ AePrintException (
if (!RActual)
{
fprintf (OutputFile,
"[*** iASL: Read error on source code temp file ***]");
"[*** iASL: Read error on source code temp file %s ***]",
Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
}
else while (RActual && SourceByte && (SourceByte != '\n'))

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: aslfiles - file I/O suppoert
* $Revision: 1.54 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -191,7 +190,18 @@ FlOpenLocalFile (
char *Mode)
{
strcpy (StringBuffer, Gbl_DirectoryPath);
StringBuffer[0] = 0;
/* Check for an absolute pathname */
if ((LocalName[0] != '/') && /* Forward slash */
(LocalName[0] != '\\') && /* backslash (Win) */
(LocalName[1] != ':')) /* Device name (Win) */
{
/* The include file path is relative, prepend the directory path */
strcat (StringBuffer, Gbl_DirectoryPath);
}
strcat (StringBuffer, LocalName);
DbgPrint (ASL_PARSE_OUTPUT, "FlOpenLocalFile: %s\n", StringBuffer);
@ -369,6 +379,8 @@ FlPrintFile (
va_start (Args, Format);
Actual = vfprintf (Gbl_Files[FileId].Handle, Format, Args);
va_end (Args);
if (Actual == -1)
{
FlFileError (FileId, ASL_MSG_WRITE);

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: aslfold - Constant folding
* $Revision: 1.20 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -481,7 +480,7 @@ OpcAmlConstantWalk (
* Because we know we executed type 3/4/5 opcodes above, we know that
* the result must be either an Integer, String, or Buffer.
*/
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_INTEGER:

View File

@ -3,7 +3,6 @@
/******************************************************************************
*
* Module Name: aslglobal.h - Global variable definitions
* $Revision: 1.56 $
*
*****************************************************************************/
@ -11,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -144,7 +143,7 @@ extern FILE *AslCompilerin;
extern int AslCompilerdebug;
extern const ASL_MAPPING_ENTRY AslKeywordMapping[];
extern char *AslCompilertext;
extern char hex[];
extern char HexLookup[];
#define ASL_LINE_BUFFER_SIZE 512
#define ASL_MSG_BUFFER_SIZE 4096
@ -171,6 +170,9 @@ extern UINT32 Gbl_ExceptionCount[];
/* Option flags */
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoCompile, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoSignon, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_Acpi2, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_UseDefaultAmlFilename, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NsOutputFlag, FALSE);
@ -186,6 +188,7 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ParseOnlyFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CompileTimesFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_FoldConstants, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_VerboseErrors, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NoErrors, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisasmFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_GetAllTables, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_IntegerOptimizationFlag, TRUE);

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: asllength - Tree walk to determine package and opcode lengths
* $Revision: 1.37 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: asllisting - Listing file generation
* $Revision: 1.63 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -199,6 +198,12 @@ static void
LsDoHexOutputAsm (
void);
ACPI_STATUS
LsTreeWriteWalk (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context);
/*******************************************************************************
*

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: dswload - Dispatcher namespace load callbacks
* $Revision: 1.77 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -145,7 +144,13 @@ LdNamespace1Begin (
void *Context);
static ACPI_STATUS
LdNamespace1End (
LdNamespace2Begin (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context);
static ACPI_STATUS
LdCommonNamespaceEnd (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context);
@ -160,7 +165,7 @@ LdNamespace1End (
* RETURN: Status
*
* DESCRIPTION: Perform a walk of the parse tree that in turn loads all of the
* named ASL/AML objects into the namespace. The namespace is
* named ASL/AML objects into the namespace. The namespace is
* constructed in order to resolve named references and references
* to named fields within resource templates/descriptors.
*
@ -183,10 +188,15 @@ LdLoadNamespace (
return AE_NO_MEMORY;
}
/* Perform the walk of the parse tree */
/* Walk the entire parse tree, first pass */
TrWalkParseTree (RootOp, ASL_WALK_VISIT_TWICE, LdNamespace1Begin,
LdNamespace1End, WalkState);
LdCommonNamespaceEnd, WalkState);
/* Second pass to handle forward references */
TrWalkParseTree (RootOp, ASL_WALK_VISIT_TWICE, LdNamespace2Begin,
LdCommonNamespaceEnd, WalkState);
/* Dump the namespace if debug is enabled */
@ -304,7 +314,7 @@ LdLoadFieldElements (
* DESCRIPTION: Enter the named elements of the resource descriptor (children
* of the parent) into the namespace.
*
* NOTE: In the real AML namespace, these named elements never exist. But
* NOTE: In the real AML namespace, these named elements never exist. But
* we simply use the namespace here as a symbol table so we can look
* them up as they are referenced.
*
@ -395,7 +405,7 @@ LdLoadResourceElements (
*
* RETURN: Status
*
* DESCRIPTION: Descending callback used during the parse tree walk. If this
* DESCRIPTION: Descending callback used during the parse tree walk. If this
* is a named AML opcode, enter into the namespace
*
******************************************************************************/
@ -536,7 +546,7 @@ LdNamespace1Begin (
* The name referenced by Scope(Name) must already exist at this point.
* In other words, forward references for Scope() are not supported.
* The only real reason for this is that the MS interpreter cannot
* handle this case. Perhaps someday this case can go away.
* handle this case. Perhaps someday this case can go away.
*/
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
@ -621,7 +631,7 @@ LdNamespace1Begin (
/*
* However, switch the type to be an actual scope so
* that compilation can continue without generating a whole
* cascade of additional errors. Open the new scope.
* cascade of additional errors. Open the new scope.
*/
Node->Type = ACPI_TYPE_LOCAL_SCOPE;
Status = AcpiDsScopeStackPush (Node, ACPI_TYPE_LOCAL_SCOPE,
@ -652,8 +662,8 @@ LdNamespace1Begin (
Flags |= ACPI_NS_ERROR_IF_FOUND;
/*
* Enter the named type into the internal namespace. We enter the name
* as we go downward in the parse tree. Any necessary subobjects that
* 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.
*/
@ -672,7 +682,8 @@ LdNamespace1Begin (
Node->Type = (UINT8) ObjectType;
Status = AE_OK;
}
else if (Node->Flags & ANOBJ_IS_EXTERNAL)
else if ((Node->Flags & ANOBJ_IS_EXTERNAL) &&
(Op->Asl.ParseOpcode != PARSEOP_EXTERNAL))
{
/*
* Allow one create on an object or segment that was
@ -752,7 +763,143 @@ LdNamespace1Begin (
/*******************************************************************************
*
* FUNCTION: LdNamespace1End
* FUNCTION: LdNamespace2Begin
*
* PARAMETERS: ASL_WALK_CALLBACK
*
* RETURN: Status
*
* DESCRIPTION: Descending callback used during the pass 2 parse tree walk.
* Second pass resolves some forward references.
*
* Notes:
* Currently only needs to handle the Alias operator.
* Could be used to allow forward references from the Scope() operator, but
* the MS interpreter does not allow this, so this compiler does not either.
*
******************************************************************************/
static ACPI_STATUS
LdNamespace2Begin (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context)
{
ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context;
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *Node;
ACPI_OBJECT_TYPE ObjectType;
BOOLEAN ForceNewScope = FALSE;
ACPI_PARSE_OBJECT *Arg;
char *Path;
ACPI_NAMESPACE_NODE *TargetNode;
ACPI_FUNCTION_NAME (LdNamespace2Begin);
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op %p [%s]\n",
Op, Op->Asl.ParseOpName));
/* Ignore Ops with no namespace node */
Node = Op->Asl.Node;
if (!Node)
{
return (AE_OK);
}
/* Get the type to determine if we should push the scope */
if ((Op->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) &&
(Op->Asl.CompileFlags == NODE_IS_RESOURCE_DESC))
{
ObjectType = ACPI_TYPE_LOCAL_RESOURCE;
}
else
{
ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
}
/* Push scope for Resource Templates */
if (Op->Asl.ParseOpcode == PARSEOP_NAME)
{
if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC)
{
ForceNewScope = TRUE;
}
}
/* Push the scope stack */
if (ForceNewScope || AcpiNsOpensScope (ObjectType))
{
Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
if (Op->Asl.ParseOpcode == PARSEOP_ALIAS)
{
/* Complete the alias node by getting and saving the target node */
/* First child is the alias target */
Arg = Op->Asl.Child;
/* Get the target pathname */
Path = Arg->Asl.Namepath;
if (!Path)
{
Status = UtInternalizeName (Arg->Asl.ExternalName, &Path);
if (ACPI_FAILURE (Status))
{
return (Status);
}
}
/* Get the NS node associated with the target. It must exist. */
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
WalkState, &TargetNode);
if (ACPI_FAILURE (Status))
{
if (Status == AE_NOT_FOUND)
{
AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op,
Op->Asl.ExternalName);
/*
* The name was not found, go ahead and create it.
* This prevents more errors later.
*/
Status = AcpiNsLookup (WalkState->ScopeInfo, Path,
ACPI_TYPE_ANY,
ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH,
WalkState, &(Node));
return (AE_OK);
}
AslCoreSubsystemError (Op, Status, "Failure from lookup\n", FALSE);
return (AE_OK);
}
/* Save the target node within the alias node */
Node->Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode);
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: LdCommonNamespaceEnd
*
* PARAMETERS: ASL_WALK_CALLBACK
*
@ -764,7 +911,7 @@ LdNamespace1Begin (
******************************************************************************/
static ACPI_STATUS
LdNamespace1End (
LdCommonNamespaceEnd (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context)
@ -774,7 +921,7 @@ LdNamespace1End (
BOOLEAN ForceNewScope = FALSE;
ACPI_FUNCTION_NAME (LdNamespace1End);
ACPI_FUNCTION_NAME (LdCommonNamespaceEnd);
/* We are only interested in opcodes that have an associated name */
@ -812,7 +959,6 @@ LdNamespace1End (
if (ForceNewScope || AcpiNsOpensScope (ObjectType))
{
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"(%s): Popping scope for Op [%s] %p\n",
AcpiUtGetTypeName (ObjectType), Op->Asl.ParseOpName, Op));

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: asllookup- Namespace lookup
* $Revision: 1.103 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -174,6 +173,21 @@ LkIsObjectUsed (
void *Context,
void **ReturnValue);
static ACPI_STATUS
LsDoOnePathname (
ACPI_HANDLE ObjHandle,
UINT32 Level,
void *Context,
void **ReturnValue);
void
LsSetupNsList (
void *Handle);
ACPI_PARSE_OBJECT *
LkGetNameOp (
ACPI_PARSE_OBJECT *Op);
/*******************************************************************************
*
@ -416,8 +430,21 @@ LsDoOneNamespaceObject (
}
/*******************************************************************************
*
* FUNCTION: LsSetupNsList
*
* PARAMETERS: Handle - local file handle
*
* RETURN: None
*
* DESCRIPTION: Set the namespace output file to the input handle
*
******************************************************************************/
void
LsSetupNsList (void * Handle)
LsSetupNsList (
void *Handle)
{
Gbl_NsOutputFlag = TRUE;
@ -425,6 +452,44 @@ LsSetupNsList (void * Handle)
}
/*******************************************************************************
*
* FUNCTION: LsDoOnePathname
*
* PARAMETERS: ACPI_WALK_CALLBACK
*
* RETURN: Status
*
* DESCRIPTION: Print the full pathname for a namespace node.
*
******************************************************************************/
static ACPI_STATUS
LsDoOnePathname (
ACPI_HANDLE ObjHandle,
UINT32 Level,
void *Context,
void **ReturnValue)
{
ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
ACPI_STATUS Status;
ACPI_BUFFER TargetPath;
TargetPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
Status = AcpiNsHandleToPathname (Node, &TargetPath);
if (ACPI_FAILURE (Status))
{
return (Status);
}
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%s\n", TargetPath.Pointer);
ACPI_FREE (TargetPath.Pointer);
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: LsDisplayNamespace
@ -463,6 +528,15 @@ LsDisplayNamespace (
Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX, FALSE, LsDoOneNamespaceObject,
NULL, NULL);
/* Print the full pathname for each namespace node */
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\nNamespace pathnames\n\n");
Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX, FALSE, LsDoOnePathname,
NULL, NULL);
return (Status);
}
@ -856,6 +930,17 @@ LkNamespaceLocateBegin (
return (AE_OK);
}
/*
* One special case: CondRefOf operator - we don't care if the name exists
* or not at this point, just ignore it, the point of the operator is to
* determine if the name exists at runtime.
*/
if ((Op->Asl.Parent) &&
(Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF))
{
return (AE_OK);
}
/*
* We must enable the "search-to-root" for single NameSegs, but
* we have to be very careful about opening up scopes
@ -944,14 +1029,6 @@ LkNamespaceLocateBegin (
{
/* The name doesn't exist, period */
if ((Op->Asl.Parent) &&
(Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF))
{
/* Ignore not found if parent is CondRefOf */
return (AE_OK);
}
AslError (ASL_ERROR, ASL_MSG_NOT_EXIST,
Op, Op->Asl.ExternalName);
}
@ -964,14 +1041,6 @@ LkNamespaceLocateBegin (
{
/* Gave full path, the object does not exist */
if ((Op->Asl.Parent) &&
(Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF))
{
/* Ignore not found if parent is CondRefOf */
return (AE_OK);
}
AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, Op,
Op->Asl.ExternalName);
}

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: aslmain - compiler main and utilities
* $Revision: 1.96 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -119,8 +118,6 @@
#define _DECLARE_GLOBALS
#include "aslcompiler.h"
#include "acnamesp.h"
#include "actables.h"
#include "acapps.h"
#ifdef _DEBUG
@ -130,15 +127,6 @@
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslmain")
BOOLEAN AslToFile = TRUE;
BOOLEAN DoCompile = TRUE;
BOOLEAN DoSignon = TRUE;
char hex[] =
{
'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
};
/* Local prototypes */
static void
@ -157,14 +145,11 @@ static void
AslInitialize (
void);
static void
static int
AslCommandLine (
int argc,
char **argv);
#ifdef _DEBUG
#include <crtdbg.h>
#endif
/*******************************************************************************
*
@ -184,7 +169,8 @@ Options (
{
printf ("General Output:\n");
printf (" -p <prefix> Specify filename prefix for all output files (including .aml)\n");
printf (" -p <prefix> Specify path/filename prefix for all output files\n");
printf (" -va Disable all errors and warnings (summary only)\n");
printf (" -vi Less verbose errors and warnings for use with IDEs\n");
printf (" -vo Enable optimization comments\n");
printf (" -vr Disable remarks\n");
@ -212,7 +198,7 @@ Options (
printf (" -d [file] Disassemble or decode binary ACPI table to file (*.dsl)\n");
printf (" -dc [file] Disassemble AML and immediately compile it\n");
printf (" (Obtain DSDT from current system if no input file)\n");
printf (" -e [file] Include ACPI table for external symbol resolution\n");
printf (" -e [f1,f2] Include ACPI table(s) for external symbol resolution\n");
printf (" -2 Emit ACPI 2.0 compatible ASL code\n");
printf (" -g Get ACPI tables and write to files (*.dat)\n");
@ -278,7 +264,7 @@ Usage (
void)
{
printf ("Usage: %s [Options] [InputFile]\n\n", CompilerName);
printf ("Usage: %s [Options] [Files]\n\n", CompilerName);
Options ();
}
@ -334,13 +320,13 @@ AslInitialize (
*
******************************************************************************/
static void
static int
AslCommandLine (
int argc,
char **argv)
{
BOOLEAN BadCommandLine = FALSE;
ACPI_NATIVE_INT j;
int j;
/* Minimum command line contains at least one option or an input file */
@ -400,7 +386,7 @@ AslCommandLine (
switch (AcpiGbl_Optarg[0])
{
case '^':
DoCompile = FALSE;
Gbl_DoCompile = FALSE;
break;
case 'c':
@ -434,7 +420,7 @@ AslCommandLine (
/* Get all ACPI tables */
Gbl_GetAllTables = TRUE;
DoCompile = FALSE;
Gbl_DoCompile = FALSE;
break;
@ -635,6 +621,12 @@ AslCommandLine (
switch (AcpiGbl_Optarg[0])
{
case 'a':
/* Disable All error/warning messages */
Gbl_NoErrors = TRUE;
break;
case 'i':
/* Less verbose error messages */
@ -650,7 +642,7 @@ AslCommandLine (
break;
case 's':
DoSignon = FALSE;
Gbl_DoSignon = FALSE;
break;
default:
@ -699,9 +691,7 @@ AslCommandLine (
/* Next parameter must be the input filename */
Gbl_Files[ASL_FILE_INPUT].Filename = argv[AcpiGbl_Optind];
if (!Gbl_Files[ASL_FILE_INPUT].Filename &&
if (!argv[AcpiGbl_Optind] &&
!Gbl_DisasmFlag &&
!Gbl_GetAllTables)
{
@ -709,7 +699,7 @@ AslCommandLine (
BadCommandLine = TRUE;
}
if (DoSignon)
if (Gbl_DoSignon)
{
AslCompilerSignon (ASL_FILE_STDOUT);
}
@ -723,11 +713,7 @@ AslCommandLine (
exit (1);
}
if ((AcpiGbl_Optind + 1) < argc)
{
printf ("Warning: extra arguments (%d) after input filename are ignored\n\n",
argc - AcpiGbl_Optind - 1);
}
return (AcpiGbl_Optind);
}
@ -739,8 +725,8 @@ AslCommandLine (
*
* RETURN: Program termination code
*
* DESCRIPTION: C main routine for the Asl Compiler. Handle command line
* options and begin the compile.
* DESCRIPTION: C main routine for the Asl Compiler. Handle command line
* options and begin the compile for each file on the command line
*
******************************************************************************/
@ -750,7 +736,7 @@ main (
char **argv)
{
ACPI_STATUS Status;
char *Prefix;
int Index;
#ifdef _DEBUG
@ -761,105 +747,31 @@ main (
/* Init and command line */
AslInitialize ();
AslCommandLine (argc, argv);
Index = AslCommandLine (argc, argv);
/*
* If -p not specified, we will use the input filename as the
* output filename prefix
*/
Status = FlSplitInputPathname (Gbl_Files[ASL_FILE_INPUT].Filename,
&Gbl_DirectoryPath, &Prefix);
if (ACPI_FAILURE (Status))
/* Options that have no additional parameters or pathnames */
if (Gbl_GetAllTables)
{
return -1;
Status = AslDoOneFile (NULL);
if (ACPI_FAILURE (Status))
{
return (-1);
}
return (0);
}
if (Gbl_UseDefaultAmlFilename)
/* Process each pathname/filename in the list, with possible wildcards */
while (argv[Index])
{
Gbl_OutputFilenamePrefix = Prefix;
}
/* AML Disassembly (Optional) */
if (Gbl_DisasmFlag || Gbl_GetAllTables)
{
/* ACPI CA subsystem initialization */
Status = AdInitialize ();
Status = AslDoOnePathname (argv[Index]);
if (ACPI_FAILURE (Status))
{
return -1;
return (-1);
}
Status = AcpiAllocateRootTable (4);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not initialize ACPI Table Manager, %s\n",
AcpiFormatException (Status));
return -1;
}
/* This is where the disassembly happens */
AcpiGbl_DbOpt_disasm = TRUE;
Status = AdAmlDisassemble (AslToFile,
Gbl_Files[ASL_FILE_INPUT].Filename,
Gbl_OutputFilenamePrefix,
&Gbl_Files[ASL_FILE_INPUT].Filename,
Gbl_GetAllTables);
if (ACPI_FAILURE (Status))
{
return -1;
}
/*
* Gbl_Files[ASL_FILE_INPUT].Filename was replaced with the
* .DSL disassembly file, which can now be compiled if requested
*/
if (DoCompile)
{
AcpiOsPrintf ("\nCompiling \"%s\"\n",
Gbl_Files[ASL_FILE_INPUT].Filename);
}
}
/*
* ASL Compilation (Optional)
*/
if (DoCompile)
{
/*
* If -p not specified, we will use the input filename as the
* output filename prefix
*/
Status = FlSplitInputPathname (Gbl_Files[ASL_FILE_INPUT].Filename,
&Gbl_DirectoryPath, &Prefix);
if (ACPI_FAILURE (Status))
{
return -1;
}
if (Gbl_UseDefaultAmlFilename)
{
Gbl_OutputFilenamePrefix = Prefix;
}
/* ACPI CA subsystem initialization (Must be re-initialized) */
Status = AcpiOsInitialize ();
AcpiUtInitGlobals ();
Status = AcpiUtMutexInitialize ();
if (ACPI_FAILURE (Status))
{
return -1;
}
Status = AcpiNsRootInitialize ();
if (ACPI_FAILURE (Status))
{
return -1;
}
Status = CmDoCompile ();
Index++;
}
return (0);

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: aslmap - parser to AML opcode mapping table
* $Revision: 1.87 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -205,7 +204,7 @@ MpDisplayReservedNames (
else
{
printf ("Method with %d arguments, ",
ReservedMethods[i].NumArguments);
ReservedMethods[i].NumArguments & 0x0F);
if (ReservedMethods[i].Flags & ASL_RSVD_RETURN_VALUE)
{
@ -266,6 +265,7 @@ const ASL_RESERVED_INFO ReservedMethods[] = {
{"_ALR", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
{"_ALT", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
{"_ASI", 0, ASL_RSVD_RESOURCE_NAME},
{"_ASZ", 0, ASL_RSVD_RESOURCE_NAME},
{"_BAS", 0, ASL_RSVD_RESOURCE_NAME},
{"_BBN", 0, ASL_RSVD_RETURN_VALUE},
{"_BCL", 0, ASL_RSVD_RETURN_VALUE},
@ -343,6 +343,7 @@ const ASL_RESERVED_INFO ReservedMethods[] = {
{"_MIN", 0, ASL_RSVD_RESOURCE_NAME},
{"_MLS", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
{"_MSG", 1, 0},
{"_MTP", 0, ASL_RSVD_RESOURCE_NAME},
{"_OFF", 0, 0},
{"_ON_", 0, 0},
{"_OS_", 0, ASL_RSVD_RETURN_VALUE},
@ -403,7 +404,7 @@ const ASL_RESERVED_INFO ReservedMethods[] = {
{"_S4W", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
{"_SB_", 0, ASL_RSVD_SCOPE},
{"_SBS", 0, ASL_RSVD_RETURN_VALUE},
{"_SCP", 1, 0},
{"_SCP", 0x13, 0}, /* Acpi 1.0 - one arg; Acpi 3.0 - three args */
{"_SDD", 1, 0}, /* Acpi 3.0 */
{"_SEG", 0, ASL_RSVD_RETURN_VALUE},
{"_SHR", 0, ASL_RSVD_RESOURCE_NAME},

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: aslopcode - AML opcode generation
* $Revision: 1.74 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -546,7 +545,7 @@ OpcDoEisaId (
UINT32 BigEndianId;
char *InString;
ACPI_STATUS Status = AE_OK;
ACPI_NATIVE_UINT i;
UINT32 i;
InString = (char *) Op->Asl.Value.String;
@ -642,7 +641,7 @@ OpcDoUuId (
char *InString;
char *Buffer;
ACPI_STATUS Status = AE_OK;
ACPI_NATIVE_UINT i;
UINT32 i;
ACPI_PARSE_OBJECT *NewOp;

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: asloperands - AML operand processing
* $Revision: 1.61 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -948,7 +947,8 @@ OpnDoDefinitionBlock (
{
ACPI_PARSE_OBJECT *Child;
ACPI_SIZE Length;
ACPI_NATIVE_UINT i;
UINT32 i;
char *Filename;
/*
@ -966,7 +966,19 @@ OpnDoDefinitionBlock (
*Child->Asl.Value.Buffer &&
(Gbl_UseDefaultAmlFilename))
{
Gbl_OutputFilenamePrefix = (char *) Child->Asl.Value.Buffer;
/*
* We will use the AML filename that is embedded in the source file
* for the output filename.
*/
Filename = ACPI_ALLOCATE (strlen (Gbl_DirectoryPath) +
strlen ((char *) Child->Asl.Value.Buffer) + 1);
/* Prepend the current directory path */
strcpy (Filename, Gbl_DirectoryPath);
strcat (Filename, (char *) Child->Asl.Value.Buffer);
Gbl_OutputFilenamePrefix = Filename;
}
Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: aslopt- Compiler optimizations
* $Revision: 1.26 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -288,9 +287,9 @@ OptBuildShortestPath (
{
UINT32 NumCommonSegments;
UINT32 MaxCommonSegments;
ACPI_NATIVE_UINT Index;
UINT32 Index;
UINT32 NumCarats;
ACPI_NATIVE_UINT i;
UINT32 i;
char *NewPath;
char *NewPathExternal;
ACPI_NAMESPACE_NODE *Node;
@ -437,7 +436,7 @@ OptBuildShortestPath (
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS,
" NOT SHORTER (New %u old %u)",
ACPI_STRLEN (NewPath), AmlNameStringLength));
(UINT32) ACPI_STRLEN (NewPath), (UINT32) AmlNameStringLength));
ACPI_FREE (NewPathExternal);
return (AE_NOT_FOUND);
}
@ -753,8 +752,8 @@ OptOptimizeNamePath (
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS,
"%37s (%2u) ==> %-32s(%2u) %-32s",
(char *) CurrentPath.Pointer, CurrentPath.Length,
(char *) TargetPath.Pointer, TargetPath.Length, ExternalNameString));
(char *) CurrentPath.Pointer, (UINT32) CurrentPath.Length,
(char *) TargetPath.Pointer, (UINT32) TargetPath.Length, ExternalNameString));
ACPI_FREE (ExternalNameString);
@ -812,7 +811,7 @@ OptOptimizeNamePath (
OptTotal += HowMuchShorter;
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " REDUCED %2u (%u)",
HowMuchShorter, OptTotal));
(UINT32) HowMuchShorter, OptTotal));
if (Flags & AML_NAMED)
{

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: aslresource - Resource templates and descriptors
* $Revision: 1.43 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: aslrestype1 - Short (type1) resource templates and descriptors
* $Revision: 1.40 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: aslrestype2 - Long (type2) resource templates and descriptors
* $Revision: 1.51 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -2488,20 +2487,25 @@ RsDoInterruptDescriptor (
InitializerOp = Op->Asl.Child;
StringLength = RsGetStringDataLength (InitializerOp);
if (StringLength)
{
/* Make room for the ResourceSourceIndex */
OptionIndex++;
}
/* Count the interrupt numbers */
for (i = 0; InitializerOp; i++)
{
InitializerOp = ASL_GET_PEER_NODE (InitializerOp);
if (i <= 6)
{
if (i == 3 &&
InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
{
/*
* ResourceSourceIndex was specified, always make room for
* it, even if the ResourceSource was omitted.
*/
OptionIndex++;
}
continue;
}
@ -2636,6 +2640,14 @@ RsDoInterruptDescriptor (
if (i == 7)
{
if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
{
/* Must be at least one interrupt */
AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST_MIN,
InitializerOp, NULL);
}
/* Check now for duplicates in list */
RsCheckListForDuplicates (InitializerOp);

446
compiler/aslstartup.c Normal file
View File

@ -0,0 +1,446 @@
/******************************************************************************
*
* Module Name: aslstartup - Compiler startup routines, called from main
*
*****************************************************************************/
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
* rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
* copy of the source code appearing in this file ("Covered Code") an
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
* base code distributed originally by Intel ("Original Intel Code") to copy,
* make derivatives, distribute, use and display any portion of the Covered
* Code in any form, with the right to sublicense such rights; and
*
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
* license (with the right to sublicense), under only those claims of Intel
* patents that are infringed by the Original Intel Code, to make, use, sell,
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
* to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
* documentation and/or other materials provided with distribution. In
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* property embodied in the software Licensee provides to its licensee, and
* not to intellectual property embodied in modifications its licensee may
* make.
*
* 3.3. Redistribution of Executable. Redistribution in executable form of any
* substantial portion of the Covered Code or modification must reproduce the
* above Copyright Notice, and the following Disclaimer and Export Compliance
* provision in the documentation and/or other materials provided with the
* distribution.
*
* 3.4. Intel retains all right, title, and interest in and to the Original
* Intel Code.
*
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
* Intel shall be used in advertising or otherwise to promote the sale, use or
* other dealings in products derived from or relating to the Covered Code
* without prior written authorization from Intel.
*
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
* any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* ensure that the distribution and export/re-export of the software is in
* compliance with all laws, regulations, orders, or other restrictions of the
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
* any of its subsidiaries will export/re-export any technical data, process,
* software, or service, directly or indirectly, to any country for which the
* United States government or any agency thereof requires an export license,
* other governmental approval, or letter of assurance, without first obtaining
* such license, approval or letter.
*
*****************************************************************************/
#include "aslcompiler.h"
#include "actables.h"
#include "acapps.h"
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslstartup")
#define ASL_MAX_FILES 256
char *FileList[ASL_MAX_FILES];
int FileCount;
BOOLEAN AslToFile = TRUE;
/* Local prototypes */
static void
AslInitializeGlobals (
void);
static char **
AsDoWildcard (
char *DirectoryPathname,
char *FileSpecifier);
/*******************************************************************************
*
* FUNCTION: AslInitializeGlobals
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Re-initialize globals needed to restart the compiler. This
* allows multiple files to be disassembled and/or compiled.
*
******************************************************************************/
static void
AslInitializeGlobals (
void)
{
UINT32 i;
/* Init compiler globals */
Gbl_CurrentColumn = 0;
Gbl_CurrentLineNumber = 1;
Gbl_LogicalLineNumber = 1;
Gbl_CurrentLineOffset = 0;
Gbl_LineBufPtr = Gbl_CurrentLineBuffer;
Gbl_ErrorLog = NULL;
Gbl_NextError = NULL;
AslGbl_NextEvent = 0;
for (i = 0; i < ASL_NUM_REPORT_LEVELS; i++)
{
Gbl_ExceptionCount[i] = 0;
}
Gbl_Files[ASL_FILE_AML_OUTPUT].Filename = NULL;
}
/******************************************************************************
*
* FUNCTION: AsDoWildcard
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Process files via wildcards. This function is for the Windows
* case only.
*
******************************************************************************/
static char **
AsDoWildcard (
char *DirectoryPathname,
char *FileSpecifier)
{
#ifdef WIN32
void *DirInfo;
char *Filename;
FileCount = 0;
/* Open parent directory */
DirInfo = AcpiOsOpenDirectory (DirectoryPathname, FileSpecifier, REQUEST_FILE_ONLY);
if (!DirInfo)
{
/* Either the directory of file does not exist */
Gbl_Files[ASL_FILE_INPUT].Filename = FileSpecifier;
FlFileError (ASL_FILE_INPUT, ASL_MSG_OPEN);
AslAbort ();
}
/* Process each file that matches the wildcard specification */
while ((Filename = AcpiOsGetNextFilename (DirInfo)))
{
/* Add the filename to the file list */
FileList[FileCount] = AcpiOsAllocate (strlen (Filename) + 1);
strcpy (FileList[FileCount], Filename);
FileCount++;
if (FileCount >= ASL_MAX_FILES)
{
printf ("Max files reached\n");
FileList[0] = NULL;
return (FileList);
}
}
/* Cleanup */
AcpiOsCloseDirectory (DirInfo);
FileList[FileCount] = NULL;
return (FileList);
#else
/*
* Linux/Unix cases - Wildcards are expanded by the shell automatically.
* Just return the filename in a null terminated list
*/
FileList[0] = AcpiOsAllocate (strlen (FileSpecifier) + 1);
strcpy (FileList[0], FileSpecifier);
FileList[1] = NULL;
return (FileList);
#endif
}
/*******************************************************************************
*
* FUNCTION: AslDoOneFile
*
* PARAMETERS: Filename - Name of the file
*
* RETURN: Status
*
* DESCRIPTION: Process a single file - either disassemble, compile, or both
*
******************************************************************************/
ACPI_STATUS
AslDoOneFile (
char *Filename)
{
ACPI_STATUS Status;
Gbl_Files[ASL_FILE_INPUT].Filename = Filename;
/* Re-initialize "some" compiler globals */
AslInitializeGlobals ();
/*
* AML Disassembly (Optional)
*/
if (Gbl_DisasmFlag || Gbl_GetAllTables)
{
/* ACPI CA subsystem initialization */
Status = AdInitialize ();
if (ACPI_FAILURE (Status))
{
return (Status);
}
Status = AcpiAllocateRootTable (4);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not initialize ACPI Table Manager, %s\n",
AcpiFormatException (Status));
return (Status);
}
/* This is where the disassembly happens */
AcpiGbl_DbOpt_disasm = TRUE;
Status = AdAmlDisassemble (AslToFile,
Gbl_Files[ASL_FILE_INPUT].Filename,
Gbl_OutputFilenamePrefix,
&Gbl_Files[ASL_FILE_INPUT].Filename,
Gbl_GetAllTables);
if (ACPI_FAILURE (Status))
{
return (Status);
}
/* Shutdown compiler and ACPICA subsystem */
AeClearErrorLog ();
AcpiTerminate ();
/*
* Gbl_Files[ASL_FILE_INPUT].Filename was replaced with the
* .DSL disassembly file, which can now be compiled if requested
*/
if (Gbl_DoCompile)
{
AcpiOsPrintf ("\nCompiling \"%s\"\n",
Gbl_Files[ASL_FILE_INPUT].Filename);
}
}
/*
* ASL Compilation (Optional)
*/
if (Gbl_DoCompile)
{
/*
* If -p not specified, we will use the input filename as the
* output filename prefix
*/
if (Gbl_UseDefaultAmlFilename)
{
Gbl_OutputFilenamePrefix = Gbl_Files[ASL_FILE_INPUT].Filename;
}
/* ACPI CA subsystem initialization (Must be re-initialized) */
Status = AdInitialize ();
if (ACPI_FAILURE (Status))
{
return (Status);
}
Status = CmDoCompile ();
AcpiTerminate ();
/*
* Return non-zero exit code if there have been errors, unless the
* global ignore error flag has been set
*/
if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && (!Gbl_IgnoreErrors))
{
return (AE_ERROR);
}
AeClearErrorLog ();
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AslDoOnePathname
*
* PARAMETERS: Pathname - Full pathname, possibly with wildcards
*
* RETURN: Status
*
* DESCRIPTION: Process one pathname, possible terminated with a wildcard
* specification. If a wildcard, it is expanded and the multiple
* files are processed.
*
******************************************************************************/
ACPI_STATUS
AslDoOnePathname (
char *Pathname)
{
ACPI_STATUS Status;
char **FileList;
char *Filename;
char *FullPathname;
/* Split incoming path into a directory/filename combo */
Status = FlSplitInputPathname (Pathname, &Gbl_DirectoryPath, &Filename);
if (ACPI_FAILURE (Status))
{
return (Status);
}
/* Expand possible wildcard into a file list (Windows/DOS only) */
FileList = AsDoWildcard (Gbl_DirectoryPath, Filename);
while (*FileList)
{
FullPathname = ACPI_ALLOCATE (
strlen (Gbl_DirectoryPath) + strlen (*FileList) + 1);
/* Construct a full path to the file */
strcpy (FullPathname, Gbl_DirectoryPath);
strcat (FullPathname, *FileList);
/*
* If -p not specified, we will use the input filename as the
* output filename prefix
*/
if (Gbl_UseDefaultAmlFilename)
{
Gbl_OutputFilenamePrefix = FullPathname;
}
Status = AslDoOneFile (FullPathname);
if (ACPI_FAILURE (Status))
{
return (Status);
}
ACPI_FREE (FullPathname);
ACPI_FREE (*FileList);
*FileList = NULL;
FileList++;
}
ACPI_FREE (Gbl_DirectoryPath);
ACPI_FREE (Filename);
return (AE_OK);
}

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: aslstubs - Stubs used to link to Aml interpreter
* $Revision: 1.20 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -115,10 +114,11 @@
*
*****************************************************************************/
#include <stdio.h>
#include "aslcompiler.h"
#include "acdispat.h"
#include "actables.h"
#include "acevents.h"
#include "acinterp.h"
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslstubs")
@ -136,6 +136,24 @@ AeLocalGetRootPointer (
return 0;
}
ACPI_STATUS
AcpiHwReadPort (
ACPI_IO_ADDRESS Address,
UINT32 *Value,
UINT32 Width)
{
return (AE_OK);
}
ACPI_STATUS
AcpiHwWritePort (
ACPI_IO_ADDRESS Address,
UINT32 Value,
UINT32 Width)
{
return (AE_OK);
}
ACPI_STATUS
AcpiDsMethodError (
ACPI_STATUS Status,
@ -146,7 +164,7 @@ AcpiDsMethodError (
ACPI_STATUS
AcpiDsMethodDataGetValue (
UINT16 Opcode,
UINT8 Type,
UINT32 Index,
ACPI_WALK_STATE *WalkState,
ACPI_OPERAND_OBJECT **DestDesc)
@ -156,7 +174,7 @@ AcpiDsMethodDataGetValue (
ACPI_STATUS
AcpiDsMethodDataGetNode (
UINT16 Opcode,
UINT8 Type,
UINT32 Index,
ACPI_WALK_STATE *WalkState,
ACPI_NAMESPACE_NODE **Node)
@ -166,7 +184,7 @@ AcpiDsMethodDataGetNode (
ACPI_STATUS
AcpiDsStoreObjectToLocal (
UINT16 Opcode,
UINT8 Type,
UINT32 Index,
ACPI_OPERAND_OBJECT *SrcDesc,
ACPI_WALK_STATE *WalkState)
@ -197,14 +215,14 @@ AcpiEvIsNotifyObject (
}
ACPI_STATUS
AcpiEvAcquireGlobalLock(
UINT32 Timeout)
AcpiEvAcquireGlobalLock (
UINT16 Timeout)
{
return (AE_OK);
}
ACPI_STATUS
AcpiEvReleaseGlobalLock(
AcpiEvReleaseGlobalLock (
void)
{
return (AE_OK);
@ -273,7 +291,7 @@ AcpiTbFindTable (
char *Signature,
char *OemId,
char *OemTableId,
ACPI_NATIVE_UINT *TableIndex)
UINT32 *TableIndex)
{
return (AE_SUPPORT);
}

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: asltransform - Parse tree transforms
* $Revision: 1.42 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -468,6 +467,7 @@ TrDoSwitch (
ACPI_PARSE_OBJECT *Peer;
ACPI_PARSE_OBJECT *NewOp;
ACPI_PARSE_OBJECT *NewOp2;
ACPI_PARSE_OBJECT *MethodOp;
char *PredicateValueName;
UINT16 Index;
UINT32 Btype;
@ -729,18 +729,32 @@ TrDoSwitch (
{
Next = Next->Asl.Parent;
}
MethodOp = Next;
NewOp->Asl.CompileFlags |= NODE_COMPILER_EMITTED;
NewOp->Asl.Parent = Next;
/* Insert name after the method name and arguments */
Next = Next->Asl.Child;
Next = Next->Asl.Next;
Next = Next->Asl.Next;
Next = Next->Asl.Next;
Next = Next->Asl.Next;
Next = Next->Asl.Next;
Next = Next->Asl.Child; /* Name */
Next = Next->Asl.Next; /* NumArgs */
Next = Next->Asl.Next; /* SerializeRule */
/*
* If method is not Serialized, we must make is so, because of the way
* that Switch() must be implemented -- we cannot allow multiple threads
* to execute this method concurrently since we need to create local
* temporary name(s).
*/
if (Next->Asl.ParseOpcode != PARSEOP_SERIALIZERULE_SERIAL)
{
AslError (ASL_REMARK, ASL_MSG_SERIALIZED, MethodOp, "Due to use of Switch operator");
Next->Asl.ParseOpcode = PARSEOP_SERIALIZERULE_SERIAL;
}
Next = Next->Asl.Next; /* SyncLevel */
Next = Next->Asl.Next; /* ReturnType */
Next = Next->Asl.Next; /* ParameterTypes */
TrAmlInsertPeer (Next, NewOp);
TrAmlInitLineNumbers (NewOp, Next);
@ -763,7 +777,7 @@ TrDoSwitch (
case ACPI_BTYPE_STRING:
NewOp2->Asl.Next = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL,
(ACPI_INTEGER) "");
(ACPI_INTEGER) ACPI_TO_INTEGER (""));
break;
case ACPI_BTYPE_BUFFER:

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: asltree - parse tree management
* $Revision: 1.63 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -914,6 +913,7 @@ TrLinkPeerNodes (
This->Asl.Next = Next;
This = Next;
}
va_end (ap);
DbgPrint (ASL_PARSE_OUTPUT,"\n\n");
return (Start);

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: asltypes.h - compiler data types and struct definitions
* $Revision: 1.89 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -340,6 +339,7 @@ typedef enum
ASL_MSG_EARLY_EOF,
ASL_MSG_ENCODING_LENGTH,
ASL_MSG_EX_INTERRUPT_LIST,
ASL_MSG_EX_INTERRUPT_LIST_MIN,
ASL_MSG_EX_INTERRUPT_NUMBER,
ASL_MSG_FIELD_ACCESS_WIDTH,
ASL_MSG_FIELD_UNIT_ACCESS_WIDTH,
@ -422,7 +422,11 @@ typedef enum
ASL_MSG_RESULT_NOT_USED,
ASL_MSG_NOT_REFERENCED,
ASL_MSG_NON_ZERO,
ASL_MSG_STRING_LENGTH
ASL_MSG_STRING_LENGTH,
ASL_MSG_SERIALIZED,
ASL_MSG_COMPILER_RESERVED,
ASL_MSG_NAMED_OBJECT_IN_WHILE,
ASL_MSG_LOCAL_OUTSIDE_METHOD
} ASL_MESSAGE_IDS;
@ -454,6 +458,7 @@ char *AslMessages [] = {
/* ASL_MSG_EARLY_EOF */ "Premature end-of-file reached",
/* ASL_MSG_ENCODING_LENGTH */ "Package length too long to encode",
/* ASL_MSG_EX_INTERRUPT_LIST */ "Too many interrupts (255 max)",
/* ASL_MSG_EX_INTERRUPT_LIST_MIN */ "Too few interrupts (1 minimum required)",
/* ASL_MSG_EX_INTERRUPT_NUMBER */ "Invalid interrupt number (must be 32 bits)",
/* ASL_MSG_FIELD_ACCESS_WIDTH */ "Access width is greater than region size",
/* ASL_MSG_FIELD_UNIT_ACCESS_WIDTH */ "Access width of Field Unit extends beyond region limit",
@ -510,7 +515,7 @@ char *AslMessages [] = {
/* ASL_MSG_RESERVED_OPERAND_TYPE */ "Invalid operand type for reserved name, must be",
/* ASL_MSG_RESERVED_RETURN_VALUE */ "Reserved method must return a value",
/* ASL_MSG_RESERVED_USE */ "Invalid use of reserved name",
/* ASL_MSG_RESERVED_WORD */ "Use of reserved word",
/* ASL_MSG_RESERVED_WORD */ "Use of reserved name",
/* ASL_MSG_RESOURCE_FIELD */ "Resource field name cannot be used as a target",
/* ASL_MSG_RESOURCE_INDEX */ "Missing ResourceSourceIndex (required)",
/* ASL_MSG_RESOURCE_LIST */ "Too many resource items (internal error)",
@ -536,7 +541,11 @@ char *AslMessages [] = {
/* ASL_MSG_RESULT_NOT_USED */ "Result is not used, operator has no effect",
/* ASL_MSG_NOT_REFERENCED */ "Namespace object is not referenced",
/* ASL_MSG_NON_ZERO */ "Operand evaluates to zero",
/* ASL_MSG_STRING_LENGTH */ "String literal too long"
/* ASL_MSG_STRING_LENGTH */ "String literal too long",
/* ASL_MSG_SERIALIZED */ "Control Method marked Serialized",
/* ASL_MSG_COMPILER_RESERVED */ "Use of compiler reserved name",
/* ASL_MSG_NAMED_OBJECT_IN_WHILE */ "Creating a named object in a While loop",
/* ASL_MSG_LOCAL_OUTSIDE_METHOD */ "Local or Arg used outside a control method"
};

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: aslutils -- compiler utilities
* $Revision: 1.72 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -131,6 +130,12 @@ static const char * const *yytname = &AslCompilername[254];
extern const char * const yytname[];
#endif
char HexLookup[] =
{
'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
};
/* Local prototypes */
static ACPI_STATUS
@ -333,8 +338,8 @@ UtConvertByteToHex (
Buffer[0] = '0';
Buffer[1] = 'x';
Buffer[2] = (UINT8) hex[(RawByte >> 4) & 0xF];
Buffer[3] = (UINT8) hex[RawByte & 0xF];
Buffer[2] = (UINT8) HexLookup[(RawByte >> 4) & 0xF];
Buffer[3] = (UINT8) HexLookup[RawByte & 0xF];
}
@ -359,8 +364,8 @@ UtConvertByteToAsmHex (
{
Buffer[0] = '0';
Buffer[1] = (UINT8) hex[(RawByte >> 4) & 0xF];
Buffer[2] = (UINT8) hex[RawByte & 0xF];
Buffer[1] = (UINT8) HexLookup[(RawByte >> 4) & 0xF];
Buffer[2] = (UINT8) HexLookup[RawByte & 0xF];
Buffer[3] = 'h';
}
@ -530,7 +535,7 @@ UtDisplaySummary (
if ((Gbl_ExceptionCount[ASL_ERROR] == 0) || (Gbl_IgnoreErrors))
{
FlPrintFile (FileId,
"AML Output: %s - %d bytes %d named objects %d executable opcodes\n\n",
"AML Output: %s - %d bytes, %d named objects, %d executable opcodes\n\n",
Gbl_Files[ASL_FILE_AML_OUTPUT].Filename, Gbl_TableLength,
TotalNamedObjects, TotalExecutableOpcodes);
}

85
compiler/readme.txt Normal file
View File

@ -0,0 +1,85 @@
Instructions for integrating iASL compiler into MS VC++ 6.0 environment.
Part 1. Integration as a custom tool
This procedure adds the iASL compiler as a custom tool that can be used
to compile ASL source files. The output is sent to the VC output
window.
a) Select Tools->Customize.
b) Select the "Tools" tab.
c) Scroll down to the bottom of the "Menu Contents" window. There you
will see an empty rectangle. Click in the rectangle to enter a
name for this tool.
d) Type "iASL Compiler" in the box and hit enter. You can now edit
the other fields for this new custom tool.
e) Enter the following into the fields:
Command: C:\Acpi\iasl.exe
Arguments: -e "$(FilePath)"
Initial Directory "$(FileDir)"
Use Output Window <Check this option>
"Command" must be the path to wherever you copied the compiler.
"-e" instructs the compiler to produce messages appropriate for VC.
Quotes around FilePath and FileDir enable spaces in filenames.
f) Select "Close".
These steps will add the compiler to the tools menu as a custom tool.
By enabling "Use Output Window", you can click on error messages in
the output window and the source file and source line will be
automatically displayed by VC. Also, you can use F4 to step through
the messages and the corresponding source line(s).
Part 2. Integration into a project build
This procedure creates a project that compiles ASL files to AML.
a) Create a new, empty project and add your .ASL files to the project
b) For all ASL files in the project, specify a custom build (under
Project/Settings/CustomBuild with the following settings (or similar):
Commands:
c:\acpi\libraries\iasl.exe -vs -vi "$(InputPath)"
Output:
$(InputDir)\$(InputPath).aml
Compiler Generation From Source
Generation of the ASL compiler from source code requires these items:
Required Tools
1) The Flex (or Lex) lexical analyzer generator.
2) The Bison (or Yacc) parser generator.
3) An ANSI C compiler.
Required Source Code.
There are three major source code components that are required to
generate the compiler:
1) The ASL compiler source.
2) The ACPI CA Core Subsystem source. In particular, the Namespace Manager
component is used to create an internal ACPI namespace and symbol table,
and the AML Interpreter is used to evaluate constant expressions.
3) The Common source for all ACPI components.

View File

@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dbcmds - debug commands and output routines
* $Revision: 1.150 $
*
******************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -116,15 +115,14 @@
#include "acpi.h"
#include "accommon.h"
#include "acdispat.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "acevents.h"
#include "acdebug.h"
#include "acresrc.h"
#include "acdisasm.h"
#include "actables.h"
#include "acparser.h"
#ifdef ACPI_DEBUGGER
@ -388,6 +386,228 @@ AcpiDbFindReferences (
}
/*******************************************************************************
*
* 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, (void *) &Count, NULL);
AcpiOsPrintf ("Found %d predefined names in the namespace\n", Count);
}
/*******************************************************************************
*
* 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;
UINT32 *Count = (UINT32 *) Context;
const ACPI_PREDEFINED_INFO *Predefined;
ACPI_BUFFER ReturnObj;
ACPI_STATUS Status;
char *Pathname;
ACPI_BUFFER Buffer;
UINT32 i;
ACPI_DEVICE_INFO *ObjInfo;
ACPI_OBJECT_LIST ParamObjects;
ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS];
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 */
Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
Status = AcpiGetObjectInfo (ObjHandle, &Buffer);
if (ACPI_FAILURE (Status))
{
return (Status);
}
ParamObjects.Pointer = NULL;
ParamObjects.Count = 0;
ObjInfo = Buffer.Pointer;
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 (Buffer.Pointer);
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);
(*Count)++;
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbBatchExecute
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Namespace batch execution.
*
******************************************************************************/
void
AcpiDbBatchExecute (
void)
{
UINT32 Count = 0;
/* Search all nodes in namespace */
(void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
AcpiDbWalkForExecute, (void *) &Count, NULL);
AcpiOsPrintf ("Executed %d predefined names in the namespace\n", Count);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDisplayLocks
@ -433,28 +653,39 @@ void
AcpiDbDisplayTableInfo (
char *TableArg)
{
ACPI_NATIVE_UINT i;
UINT32 i;
ACPI_TABLE_DESC *TableDesc;
ACPI_STATUS Status;
/*
* Walk the root table list
*/
/* Walk the entire root table list */
for (i = 0; i < AcpiGbl_RootTableList.Count; i++)
{
TableDesc = &AcpiGbl_RootTableList.Tables[i];
AcpiOsPrintf ( "%4.4s at %p length %.5X",
TableDesc->Signature.Ascii, TableDesc->Pointer,
(UINT32) TableDesc->Length);
AcpiOsPrintf ("%d ", i);
if (TableDesc->Pointer && (i != ACPI_TABLE_INDEX_FACS))
/* Make sure that the table is mapped */
Status = AcpiTbVerifyTable (TableDesc);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf (" OemId=\"%6s\" OemTableId=\"%8s\" OemRevision=%8.8X",
TableDesc->Pointer->OemId,
TableDesc->Pointer->OemTableId,
TableDesc->Pointer->OemRevision);
return;
}
/* Dump the table header */
if (TableDesc->Pointer)
{
AcpiTbPrintTableHeader (TableDesc->Address, TableDesc->Pointer);
}
else
{
/* If the pointer is null, the table has been unloaded */
ACPI_INFO ((AE_INFO, "%4.4s - Table has been unloaded",
TableDesc->Signature.Ascii));
}
AcpiOsPrintf ("\n");
}
}
@ -938,7 +1169,7 @@ AcpiDbSetMethodData (
goto Cleanup;
}
Status = AcpiDsStoreObjectToLocal (AML_ARG_OP, Index, ObjDesc,
Status = AcpiDsStoreObjectToLocal (ACPI_REFCLASS_ARG, Index, ObjDesc,
WalkState);
if (ACPI_FAILURE (Status))
{
@ -961,7 +1192,7 @@ AcpiDbSetMethodData (
goto Cleanup;
}
Status = AcpiDsStoreObjectToLocal (AML_LOCAL_OP, Index, ObjDesc,
Status = AcpiDsStoreObjectToLocal (ACPI_REFCLASS_LOCAL, Index, ObjDesc,
WalkState);
if (ACPI_FAILURE (Status))
{
@ -1168,6 +1399,9 @@ ACPI_STATUS
AcpiDbFindNameInNamespace (
char *NameArg)
{
char AcpiName[5] = "____";
char *AcpiNamePtr = AcpiName;
if (ACPI_STRLEN (NameArg) > 4)
{
@ -1175,11 +1409,20 @@ AcpiDbFindNameInNamespace (
return (AE_OK);
}
/* Walk the namespace from the root */
/* 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, NameArg, NULL);
AcpiDbWalkAndMatchName, AcpiName, NULL);
AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
return (AE_OK);
@ -1411,8 +1654,8 @@ AcpiDmTestResourceConversion (
OriginalAml = ReturnObj.Pointer;
AcpiDmCompareAmlResources (
OriginalAml->Buffer.Pointer, OriginalAml->Buffer.Length,
NewAml.Pointer, NewAml.Length);
OriginalAml->Buffer.Pointer, (ACPI_RSDESC_SIZE) OriginalAml->Buffer.Length,
NewAml.Pointer, (ACPI_RSDESC_SIZE) NewAml.Length);
/* Cleanup and exit */
@ -1603,24 +1846,45 @@ AcpiDbIntegrityWalk (
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++;
if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
/* Verify the NS node, and dereference aliases */
while (Alias)
{
AcpiOsPrintf ("Invalid Descriptor Type for Node %p [%s]\n",
Node, AcpiUtGetDescriptorName (Node));
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);

View File

@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dbdisply - debug display commands
* $Revision: 1.120 $
*
******************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "amlcode.h"
#include "acdispat.h"
#include "acnamesp.h"
@ -685,7 +685,7 @@ AcpiDbDisplayObjectType (
ACPI_BUFFER Buffer;
ACPI_DEVICE_INFO *Info;
ACPI_STATUS Status;
ACPI_NATIVE_UINT i;
UINT32 i;
Handle = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16));
@ -707,7 +707,7 @@ AcpiDbDisplayObjectType (
{
for (i = 0; i < Info->CompatibilityId.Count; i++)
{
AcpiOsPrintf ("CID #%d: %s\n", (UINT32) i,
AcpiOsPrintf ("CID #%d: %s\n", i,
Info->CompatibilityId.Id[i].Value);
}
}

View File

@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dbexec - debugger control method execution
* $Revision: 1.81 $
*
******************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "acdebug.h"
#include "acnamesp.h"
@ -175,7 +175,10 @@ AcpiDbExecuteMethod (
ACPI_STATUS Status;
ACPI_OBJECT_LIST ParamObjects;
ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS];
ACPI_HANDLE Handle;
ACPI_BUFFER Buffer;
UINT32 i;
ACPI_DEVICE_INFO *ObjInfo;
if (AcpiGbl_DbOutputToFile && !AcpiDbgLevel)
@ -183,33 +186,77 @@ AcpiDbExecuteMethod (
AcpiOsPrintf ("Warning: debug output is not enabled!\n");
}
/* Are there arguments to the method? */
/* Get the NS node, determines existence also */
if (Info->Args && Info->Args[0])
Status = AcpiGetHandle (NULL, Info->Pathname, &Handle);
if (ACPI_FAILURE (Status))
{
for (i = 0; Info->Args[i] && i < ACPI_METHOD_NUM_ARGS; i++)
return (Status);
}
/* Get the object info for number of method parameters */
Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
Status = AcpiGetObjectInfo (Handle, &Buffer);
if (ACPI_FAILURE (Status))
{
return (Status);
}
ParamObjects.Pointer = NULL;
ParamObjects.Count = 0;
ObjInfo = Buffer.Pointer;
if (ObjInfo->Type == ACPI_TYPE_METHOD)
{
/* Are there arguments to the method? */
if (Info->Args && Info->Args[0])
{
Params[i].Type = ACPI_TYPE_INTEGER;
Params[i].Integer.Value = ACPI_STRTOUL (Info->Args[i], NULL, 16);
for (i = 0; Info->Args[i] && i < ACPI_METHOD_NUM_ARGS; i++)
{
Params[i].Type = ACPI_TYPE_INTEGER;
Params[i].Integer.Value = ACPI_STRTOUL (Info->Args[i], NULL, 16);
}
ParamObjects.Pointer = Params;
ParamObjects.Count = i;
}
else
{
/* Setup default parameters */
ParamObjects.Pointer = Params;
ParamObjects.Count = i;
for (i = 0; i < ObjInfo->ParamCount; i++)
{
switch (i)
{
case 0:
Params[0].Type = ACPI_TYPE_INTEGER;
Params[0].Integer.Value = 0x01020304;
break;
case 1:
Params[1].Type = ACPI_TYPE_STRING;
Params[1].String.Length = 12;
Params[1].String.Pointer = "AML Debugger";
break;
default:
Params[i].Type = ACPI_TYPE_INTEGER;
Params[i].Integer.Value = i * (ACPI_INTEGER) 0x1000;
break;
}
}
ParamObjects.Pointer = Params;
ParamObjects.Count = ObjInfo->ParamCount;
}
}
else
{
/* Setup default parameters */
Params[0].Type = ACPI_TYPE_INTEGER;
Params[0].Integer.Value = 0x01020304;
Params[1].Type = ACPI_TYPE_STRING;
Params[1].String.Length = 12;
Params[1].String.Pointer = "AML Debugger";
ParamObjects.Pointer = Params;
ParamObjects.Count = 2;
}
ACPI_FREE (Buffer.Pointer);
/* Prepare for a return object of arbitrary size */
@ -504,25 +551,47 @@ AcpiDbMethodThread (
{
ACPI_STATUS Status;
ACPI_DB_METHOD_INFO *Info = Context;
ACPI_DB_METHOD_INFO LocalInfo;
UINT32 i;
UINT8 Allow;
ACPI_BUFFER ReturnObj;
/*
* AcpiGbl_DbMethodInfo.Arguments will be passed as method arguments.
* Prevent AcpiGbl_DbMethodInfo from being modified by multiple threads
* concurrently.
*
* Note: The arguments we are passing are used by the ASL test suite
* (aslts). Do not change them without updating the tests.
*/
(void) AcpiOsWaitSemaphore (Info->InfoGate, 1, ACPI_WAIT_FOREVER);
if (Info->InitArgs)
{
AcpiDbUInt32ToHexString (Info->NumCreated, Info->IndexOfThreadStr);
AcpiDbUInt32ToHexString (AcpiOsGetThreadId (), Info->IdOfThreadStr);
AcpiDbUInt32ToHexString (ACPI_TO_INTEGER (AcpiOsGetThreadId ()),
Info->IdOfThreadStr);
}
if (Info->Threads && (Info->NumCreated < Info->NumThreads))
{
Info->Threads[Info->NumCreated++] = AcpiOsGetThreadId();
Info->Threads[Info->NumCreated++] =
ACPI_TO_INTEGER (AcpiOsGetThreadId());
}
LocalInfo = *Info;
LocalInfo.Args = LocalInfo.Arguments;
LocalInfo.Arguments[0] = LocalInfo.NumThreadsStr;
LocalInfo.Arguments[1] = LocalInfo.IdOfThreadStr;
LocalInfo.Arguments[2] = LocalInfo.IndexOfThreadStr;
LocalInfo.Arguments[3] = NULL;
(void) AcpiOsSignalSemaphore (Info->InfoGate, 1);
for (i = 0; i < Info->NumLoops; i++)
{
Status = AcpiDbExecuteMethod (Info, &ReturnObj);
Status = AcpiDbExecuteMethod (&LocalInfo, &ReturnObj);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("%s During execution of %s at iteration %X\n",
@ -551,7 +620,7 @@ AcpiDbMethodThread (
/* Signal our completion */
Allow = 0;
AcpiOsWaitSemaphore (Info->ThreadCompleteGate, 1, ACPI_WAIT_FOREVER);
(void) AcpiOsWaitSemaphore (Info->ThreadCompleteGate, 1, ACPI_WAIT_FOREVER);
Info->NumCompleted++;
if (Info->NumCompleted == Info->NumThreads)
@ -560,7 +629,7 @@ AcpiDbMethodThread (
Allow = 1;
}
AcpiOsSignalSemaphore (Info->ThreadCompleteGate, 1);
(void) AcpiOsSignalSemaphore (Info->ThreadCompleteGate, 1);
if (Allow)
{
@ -601,6 +670,8 @@ AcpiDbCreateExecutionThreads (
UINT32 Size;
ACPI_MUTEX MainThreadGate;
ACPI_MUTEX ThreadCompleteGate;
ACPI_MUTEX InfoGate;
/* Get the arguments */
@ -639,6 +710,16 @@ AcpiDbCreateExecutionThreads (
return;
}
Status = AcpiOsCreateSemaphore (1, 1, &InfoGate);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not create semaphore for synchronization of AcpiGbl_DbMethodInfo, %s\n",
AcpiFormatException (Status));
(void) AcpiOsDeleteSemaphore (ThreadCompleteGate);
(void) AcpiOsDeleteSemaphore (MainThreadGate);
return;
}
ACPI_MEMSET (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO));
/* Array to store IDs of threads */
@ -651,6 +732,7 @@ AcpiDbCreateExecutionThreads (
AcpiOsPrintf ("No memory for thread IDs array\n");
(void) AcpiOsDeleteSemaphore (MainThreadGate);
(void) AcpiOsDeleteSemaphore (ThreadCompleteGate);
(void) AcpiOsDeleteSemaphore (InfoGate);
return;
}
ACPI_MEMSET (AcpiGbl_DbMethodInfo.Threads, 0, Size);
@ -662,6 +744,7 @@ AcpiDbCreateExecutionThreads (
AcpiGbl_DbMethodInfo.NumLoops = NumLoops;
AcpiGbl_DbMethodInfo.MainThreadGate = MainThreadGate;
AcpiGbl_DbMethodInfo.ThreadCompleteGate = ThreadCompleteGate;
AcpiGbl_DbMethodInfo.InfoGate = InfoGate;
/* Init arguments to be passed to method */
@ -692,7 +775,7 @@ AcpiDbCreateExecutionThreads (
/* Wait for all threads to complete */
AcpiOsWaitSemaphore (MainThreadGate, 1, ACPI_WAIT_FOREVER);
(void) AcpiOsWaitSemaphore (MainThreadGate, 1, ACPI_WAIT_FOREVER);
AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
AcpiOsPrintf ("All threads (%X) have completed\n", NumThreads);
@ -702,6 +785,7 @@ AcpiDbCreateExecutionThreads (
(void) AcpiOsDeleteSemaphore (MainThreadGate);
(void) AcpiOsDeleteSemaphore (ThreadCompleteGate);
(void) AcpiOsDeleteSemaphore (InfoGate);
AcpiOsFree (AcpiGbl_DbMethodInfo.Threads);
AcpiGbl_DbMethodInfo.Threads = NULL;

View File

@ -1,8 +1,7 @@
/*******************************************************************************
*
* Module Name: dbfileio - Debugger file I/O commands. These can't usually
* Module Name: dbfileio - Debugger file I/O commands. These can't usually
* be used when running the debugger in Ring 0 (Kernel mode)
* $Revision: 1.94 $
*
******************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -117,10 +116,12 @@
#include "acpi.h"
#include "accommon.h"
#include "acdebug.h"
#include "acnamesp.h"
#ifdef ACPI_APPLICATION
#include "actables.h"
#include "acdisasm.h"
#endif
#if (defined ACPI_DEBUGGER || defined ACPI_DISASSEMBLER)
@ -128,7 +129,7 @@
ACPI_MODULE_NAME ("dbfileio")
/*
* NOTE: this is here for lack of a better place. It is used in all
* NOTE: this is here for lack of a better place. It is used in all
* flavors of the debugger, need LCD file
*/
#ifdef ACPI_APPLICATION
@ -263,7 +264,7 @@ AcpiDbCheckTextModeCorruption (
{
if (Table[i - 1] != 0x0D)
{
/* The LF does not have a preceeding CR, table not corrupted */
/* The LF does not have a preceding CR, table not corrupted */
return (AE_OK);
}
@ -355,7 +356,7 @@ AcpiDbReadTable (
}
else
{
/* Read the table header */
/* Read the table header */
if (fread (&TableHeader, 1, sizeof (TableHeader), fp) !=
sizeof (ACPI_TABLE_HEADER))
@ -462,8 +463,8 @@ AcpiDbReadTable (
* RETURN: Status
*
* DESCRIPTION: This function is called to load a table from the caller's
* buffer. The buffer must contain an entire ACPI Table including
* a valid header. The header fields will be verified, and if it
* buffer. The buffer must contain an entire ACPI Table including
* a valid header. The header fields will be verified, and if it
* is determined that the table is invalid, the call will fail.
*
******************************************************************************/

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: dbhistry - debugger HISTORY command
* $Revision: 1.34 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "acdebug.h"
#ifdef ACPI_DEBUGGER
@ -210,7 +210,7 @@ void
AcpiDbDisplayHistory (
void)
{
ACPI_NATIVE_UINT i;
UINT32 i;
UINT16 HistoryIndex;
@ -249,7 +249,7 @@ char *
AcpiDbGetFromHistory (
char *CommandNumArg)
{
ACPI_NATIVE_UINT i;
UINT32 i;
UINT16 HistoryIndex;
UINT32 CmdNum;

View File

@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dbinput - user front-end to the AML debugger
* $Revision: 1.114 $
*
******************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "acdebug.h"
@ -160,6 +160,7 @@ enum AcpiExDebuggerCommands
CMD_ALLOCATIONS,
CMD_ARGS,
CMD_ARGUMENTS,
CMD_BATCH,
CMD_BREAKPOINT,
CMD_BUSINFO,
CMD_CALL,
@ -194,6 +195,7 @@ enum AcpiExDebuggerCommands
CMD_OBJECT,
CMD_OPEN,
CMD_OWNER,
CMD_PREDEFINED,
CMD_PREFIX,
CMD_QUIT,
CMD_REFERENCES,
@ -214,6 +216,9 @@ enum AcpiExDebuggerCommands
#define CMD_FIRST_VALID 2
/* Second parameter is the required argument count */
static const COMMAND_INFO AcpiGbl_DbCommands[] =
{
{"<NOT FOUND>", 0},
@ -221,6 +226,7 @@ static const COMMAND_INFO AcpiGbl_DbCommands[] =
{"ALLOCATIONS", 0},
{"ARGS", 0},
{"ARGUMENTS", 0},
{"BATCH", 0},
{"BREAKPOINT", 1},
{"BUSINFO", 0},
{"CALL", 0},
@ -255,6 +261,7 @@ static const COMMAND_INFO AcpiGbl_DbCommands[] =
{"OBJECT", 1},
{"OPEN", 1},
{"OWNER", 1},
{"PREDEFINED", 0},
{"PREFIX", 0},
{"QUIT", 0},
{"REFERENCES", 1},
@ -360,6 +367,7 @@ AcpiDbDisplayHelp (
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");
@ -635,6 +643,10 @@ AcpiDbCommandDispatch (
AcpiDbDisplayArguments ();
break;
case CMD_BATCH:
AcpiDbBatchExecute ();
break;
case CMD_BREAKPOINT:
AcpiDbSetMethodBreakpoint (AcpiGbl_DbArgs[1], WalkState, Op);
break;
@ -812,6 +824,10 @@ AcpiDbCommandDispatch (
AcpiDbDumpNamespaceByOwner (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
break;
case CMD_PREDEFINED:
AcpiDbCheckPredefinedNames ();
break;
case CMD_PREFIX:
AcpiDbSetScope (AcpiGbl_DbArgs[1]);
break;
@ -866,7 +882,7 @@ AcpiDbCommandDispatch (
break;
case CMD_TRACE:
AcpiDebugTrace (AcpiGbl_DbArgs[1],0,0,1);
(void) AcpiDebugTrace (AcpiGbl_DbArgs[1],0,0,1);
break;
case CMD_TREE:

View File

@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dbstats - Generation and display of ACPI table statistics
* $Revision: 1.87 $
*
******************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "acdebug.h"
#include "acnamesp.h"
@ -173,7 +173,6 @@ static ARGUMENT_INFO AcpiDbStatTypes [] =
#if defined ACPI_DBG_TRACK_ALLOCATIONS || defined ACPI_USE_LOCAL_CACHE
/*******************************************************************************
*
* FUNCTION: AcpiDbListInfo
@ -277,18 +276,18 @@ AcpiDbEnumerateObject (
AcpiGbl_NumObjects++;
if (ACPI_GET_OBJECT_TYPE (ObjDesc) > ACPI_TYPE_NS_NODE_MAX)
if (ObjDesc->Common.Type > ACPI_TYPE_NS_NODE_MAX)
{
AcpiGbl_ObjTypeCountMisc++;
}
else
{
AcpiGbl_ObjTypeCount [ACPI_GET_OBJECT_TYPE (ObjDesc)]++;
AcpiGbl_ObjTypeCount [ObjDesc->Common.Type]++;
}
/* Count the sub-objects */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_PACKAGE:
@ -531,7 +530,7 @@ AcpiDbDisplayStatistics (
#endif
#ifdef ACPI_USE_LOCAL_CACHE
AcpiOsPrintf ("\n----Cache Statistics (all in hex)----------\n");
AcpiOsPrintf ("\n----Cache Statistics (all in hex)---------\n");
AcpiDbListInfo (AcpiGbl_OperandCache);
AcpiDbListInfo (AcpiGbl_PsNodeCache);
AcpiDbListInfo (AcpiGbl_PsNodeExtCache);
@ -593,6 +592,7 @@ AcpiDbDisplayStatistics (
AcpiOsPrintf ("ParseObjectAsl %3d\n", sizeof (ACPI_PARSE_OBJ_ASL));
AcpiOsPrintf ("OperandObject %3d\n", sizeof (ACPI_OPERAND_OBJECT));
AcpiOsPrintf ("NamespaceNode %3d\n", sizeof (ACPI_NAMESPACE_NODE));
AcpiOsPrintf ("AcpiObject %3d\n", sizeof (ACPI_OBJECT));
break;
@ -600,13 +600,13 @@ AcpiDbDisplayStatistics (
case CMD_STAT_STACK:
#if defined(ACPI_DEBUG_OUTPUT)
Temp = (UINT32) (AcpiGbl_EntryStackPointer - AcpiGbl_LowestStackPointer);
Temp = (UINT32) ACPI_PTR_DIFF (AcpiGbl_EntryStackPointer, AcpiGbl_LowestStackPointer);
AcpiOsPrintf ("\nSubsystem Stack Usage:\n\n");
AcpiOsPrintf ("Entry Stack Pointer %X\n", AcpiGbl_EntryStackPointer);
AcpiOsPrintf ("Lowest Stack Pointer %X\n", AcpiGbl_LowestStackPointer);
AcpiOsPrintf ("Stack Use %X (%d)\n", Temp, Temp);
AcpiOsPrintf ("Deepest Procedure Nesting %d\n", AcpiGbl_DeepestNesting);
AcpiOsPrintf ("Entry Stack Pointer %p\n", AcpiGbl_EntryStackPointer);
AcpiOsPrintf ("Lowest Stack Pointer %p\n", AcpiGbl_LowestStackPointer);
AcpiOsPrintf ("Stack Use %X (%u)\n", Temp, Temp);
AcpiOsPrintf ("Deepest Procedure Nesting %u\n", AcpiGbl_DeepestNesting);
#endif
break;

View File

@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dbutils - AML debugger utilities
* $Revision: 1.83 $
*
******************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
#include "acdebug.h"
#include "acdisasm.h"
@ -248,8 +248,7 @@ AcpiDbDumpExternalObject (
{
case ACPI_TYPE_ANY:
AcpiOsPrintf ("[Object Reference] = %p", ObjDesc->Reference.Handle);
AcpiDmDisplayInternalObject (ObjDesc->Reference.Handle, NULL);
AcpiOsPrintf ("[Null Object] (Type=0)\n");
break;
@ -300,7 +299,7 @@ AcpiDbDumpExternalObject (
case ACPI_TYPE_LOCAL_REFERENCE:
AcpiOsPrintf ("[Object Reference] = %p", ObjDesc->Reference.Handle);
AcpiOsPrintf ("[Object Reference] = ");
AcpiDmDisplayInternalObject (ObjDesc->Reference.Handle, NULL);
break;

View File

@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dbxface - AML Debugger external interfaces
* $Revision: 1.78 $
*
******************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "amlcode.h"
#include "acdebug.h"
#include "acdisasm.h"
@ -563,10 +563,6 @@ AcpiDbTerminate (
void)
{
if (AcpiGbl_DbTablePtr)
{
AcpiOsFree (AcpiGbl_DbTablePtr);
}
if (AcpiGbl_DbBuffer)
{
AcpiOsFree (AcpiGbl_DbBuffer);

View File

@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dmbuffer - AML disassembler, buffer and string support
* $Revision: 1.25 $
*
******************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "acdisasm.h"
#include "acparser.h"
#include "amlcode.h"
@ -132,6 +132,10 @@ static void
AcpiDmUnicode (
ACPI_PARSE_OBJECT *Op);
static void
AcpiDmIsEisaIdElement (
ACPI_PARSE_OBJECT *Op);
/*******************************************************************************
*
@ -282,7 +286,7 @@ AcpiDmIsUnicodeBuffer (
UINT32 WordCount;
ACPI_PARSE_OBJECT *SizeOp;
ACPI_PARSE_OBJECT *NextOp;
ACPI_NATIVE_UINT i;
UINT32 i;
/* Buffer size is the buffer argument */
@ -320,7 +324,7 @@ AcpiDmIsUnicodeBuffer (
for (i = 0; i < (ByteCount - 2); i += 2)
{
if ((!ACPI_IS_PRINT (ByteData[i])) ||
(ByteData[i + 1] != 0))
(ByteData[(ACPI_SIZE) i + 1] != 0))
{
return (FALSE);
}
@ -441,54 +445,37 @@ AcpiDmUnicode (
/*******************************************************************************
*
* FUNCTION: AcpiDmIsEisaId
* FUNCTION: AcpiDmIsEisaIdElement
*
* PARAMETERS: Op - Op to be examined
*
* RETURN: None
*
* DESCRIPTION: Determine if an Op can be converted to an EisaId.
* DESCRIPTION: Determine if an Op (argument to _HID or _CID) can be converted
* to an EISA ID.
*
******************************************************************************/
void
AcpiDmIsEisaId (
static void
AcpiDmIsEisaIdElement (
ACPI_PARSE_OBJECT *Op)
{
UINT32 Name;
UINT32 BigEndianId;
ACPI_PARSE_OBJECT *NextOp;
ACPI_NATIVE_UINT i;
UINT32 Prefix[3];
UINT32 i;
/* Get the NameSegment */
Name = AcpiPsGetName (Op);
if (!Name)
{
return;
}
/* We are looking for _HID */
if (!ACPI_COMPARE_NAME (&Name, METHOD_NAME__HID))
{
return;
}
/* The parameter must be either a word or a dword */
NextOp = AcpiPsGetDepthNext (NULL, Op);
if ((NextOp->Common.AmlOpcode != AML_DWORD_OP) &&
(NextOp->Common.AmlOpcode != AML_WORD_OP))
if ((Op->Common.AmlOpcode != AML_DWORD_OP) &&
(Op->Common.AmlOpcode != AML_WORD_OP))
{
return;
}
/* Swap from little-endian to big-endian to simplify conversion */
BigEndianId = AcpiUtDwordByteSwap ((UINT32) NextOp->Common.Value.Integer);
BigEndianId = AcpiUtDwordByteSwap ((UINT32) Op->Common.Value.Integer);
/* Create the 3 leading ASCII letters */
@ -509,7 +496,79 @@ AcpiDmIsEisaId (
/* OK - mark this node as convertable to an EISA ID */
NextOp->Common.DisasmOpcode = ACPI_DASM_EISAID;
Op->Common.DisasmOpcode = ACPI_DASM_EISAID;
}
/*******************************************************************************
*
* FUNCTION: AcpiDmIsEisaId
*
* PARAMETERS: Op - Op to be examined
*
* RETURN: None
*
* DESCRIPTION: Determine if a Name() Op can be converted to an EisaId.
*
******************************************************************************/
void
AcpiDmIsEisaId (
ACPI_PARSE_OBJECT *Op)
{
UINT32 Name;
ACPI_PARSE_OBJECT *NextOp;
/* Get the NameSegment */
Name = AcpiPsGetName (Op);
if (!Name)
{
return;
}
NextOp = AcpiPsGetDepthNext (NULL, Op);
if (!NextOp)
{
return;
}
/* Check for _HID - has one argument */
if (ACPI_COMPARE_NAME (&Name, METHOD_NAME__HID))
{
AcpiDmIsEisaIdElement (NextOp);
return;
}
/* Exit if not _CID */
if (!ACPI_COMPARE_NAME (&Name, METHOD_NAME__CID))
{
return;
}
/* _CID can contain a single argument or a package */
if (NextOp->Common.AmlOpcode != AML_PACKAGE_OP)
{
AcpiDmIsEisaIdElement (NextOp);
return;
}
/* _CID with Package: get the package length */
NextOp = AcpiPsGetDepthNext (NULL, NextOp);
/* Don't need to use the length, just walk the peer list */
NextOp = NextOp->Common.Next;
while (NextOp)
{
AcpiDmIsEisaIdElement (NextOp);
NextOp = NextOp->Common.Next;
}
}

View File

@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dmnames - AML disassembler, names, namestrings, pathnames
* $Revision: 1.17 $
*
******************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "amlcode.h"
#include "acnamesp.h"
@ -150,16 +150,20 @@ AcpiDmDisplayPath (
UINT32
AcpiDmDumpName (
char *Name)
UINT32 Name)
{
UINT32 i;
UINT32 Length;
char NewName[4];
/* Copy name locally in case the original name is not writeable */
*ACPI_CAST_PTR (UINT32, &NewName[0]) = Name;
/* Ensure that the name is printable, even if we have to fix it */
*(UINT32 *) NewName = AcpiUtRepairName (Name);
AcpiUtRepairName (NewName);
/* Remove all trailing underscores from the name */
@ -327,7 +331,7 @@ AcpiDmNamestring (
{
/* Append Name segment */
AcpiDmDumpName ((char *) Name);
AcpiDmDumpName (*ACPI_CAST_PTR (UINT32, Name));
SegCount--;
if (SegCount)

View File

@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dmobject - ACPI object decode and display
* $Revision: 1.22 $
*
******************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -116,10 +115,9 @@
#include "acpi.h"
#include "amlcode.h"
#include "accommon.h"
#include "acnamesp.h"
#include "acdisasm.h"
#include "acparser.h"
#ifdef ACPI_DISASSEMBLER
@ -280,7 +278,7 @@ AcpiDmDecodeInternalObject (
AcpiOsPrintf (" %s", AcpiUtGetObjectTypeName (ObjDesc));
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_INTEGER:
@ -352,7 +350,22 @@ AcpiDmDecodeNode (
AcpiOsPrintf (" [Method Local]");
}
AcpiDmDecodeInternalObject (AcpiNsGetAttachedObject (Node));
switch (Node->Type)
{
/* These types have no attached object */
case ACPI_TYPE_DEVICE:
AcpiOsPrintf (" Device");
break;
case ACPI_TYPE_THERMAL:
AcpiOsPrintf (" Thermal Zone");
break;
default:
AcpiDmDecodeInternalObject (AcpiNsGetAttachedObject (Node));
break;
}
}
@ -403,7 +416,7 @@ AcpiDmDisplayInternalObject (
case ACPI_DESC_TYPE_OPERAND:
Type = ACPI_GET_OBJECT_TYPE (ObjDesc);
Type = ObjDesc->Common.Type;
if (Type > ACPI_TYPE_LOCAL_MAX)
{
AcpiOsPrintf (" Type %X [Invalid Type]", (UINT32) Type);
@ -412,50 +425,48 @@ AcpiDmDisplayInternalObject (
/* Decode the ACPI object type */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_LOCAL_REFERENCE:
switch (ObjDesc->Reference.Opcode)
AcpiOsPrintf ("[%s] ", AcpiUtGetReferenceName (ObjDesc));
/* Decode the refererence */
switch (ObjDesc->Reference.Class)
{
case AML_LOCAL_OP:
case ACPI_REFCLASS_LOCAL:
AcpiOsPrintf ("[Local%d] ", ObjDesc->Reference.Offset);
AcpiOsPrintf ("%X ", ObjDesc->Reference.Value);
if (WalkState)
{
ObjDesc = WalkState->LocalVariables[
ObjDesc->Reference.Offset].Object;
ObjDesc = WalkState->LocalVariables
[ObjDesc->Reference.Value].Object;
AcpiOsPrintf ("%p", ObjDesc);
AcpiDmDecodeInternalObject (ObjDesc);
}
break;
case AML_ARG_OP:
case ACPI_REFCLASS_ARG:
AcpiOsPrintf ("[Arg%d] ", ObjDesc->Reference.Offset);
AcpiOsPrintf ("%X ", ObjDesc->Reference.Value);
if (WalkState)
{
ObjDesc = WalkState->Arguments[
ObjDesc->Reference.Offset].Object;
ObjDesc = WalkState->Arguments
[ObjDesc->Reference.Value].Object;
AcpiOsPrintf ("%p", ObjDesc);
AcpiDmDecodeInternalObject (ObjDesc);
}
break;
case AML_DEBUG_OP:
case ACPI_REFCLASS_INDEX:
AcpiOsPrintf ("[Debug] ");
break;
case AML_INDEX_OP:
AcpiOsPrintf ("[Index] ");
switch (ObjDesc->Reference.TargetType)
{
case ACPI_TYPE_BUFFER_FIELD:
AcpiOsPrintf ("%p", ObjDesc->Reference.Object);
AcpiDmDecodeInternalObject (ObjDesc->Reference.Object);
break;
@ -465,7 +476,7 @@ AcpiDmDisplayInternalObject (
AcpiOsPrintf ("%p", ObjDesc->Reference.Where);
if (!ObjDesc->Reference.Where)
{
AcpiOsPrintf (" Uninitialized WHERE ptr");
AcpiOsPrintf (" Uninitialized WHERE pointer");
}
else
{
@ -475,25 +486,18 @@ AcpiDmDisplayInternalObject (
break;
default:
AcpiOsPrintf ("Unknown index target type");
break;
}
break;
case AML_LOAD_OP:
AcpiOsPrintf ("[DdbHandle] ");
break;
case AML_REF_OF_OP:
AcpiOsPrintf ("[RefOf] ");
case ACPI_REFCLASS_REFOF:
if (!ObjDesc->Reference.Object)
{
AcpiOsPrintf ("Uninitialized reference subobject ptr");
AcpiOsPrintf ("Uninitialized reference subobject pointer");
break;
}
@ -514,20 +518,28 @@ AcpiDmDisplayInternalObject (
}
break;
case AML_INT_NAMEPATH_OP:
case ACPI_REFCLASS_NAME:
AcpiDmDecodeNode (ObjDesc->Reference.Node);
break;
default:
AcpiOsPrintf ("Unknown Reference opcode %X (%s)\n",
ObjDesc->Reference.Opcode,
AcpiPsGetOpcodeName (ObjDesc->Reference.Opcode));
case ACPI_REFCLASS_DEBUG:
case ACPI_REFCLASS_TABLE:
AcpiOsPrintf ("\n");
break;
default: /* Unknown reference class */
AcpiOsPrintf ("%2.2X\n", ObjDesc->Reference.Class);
break;
}
break;
default:
AcpiOsPrintf ("<Obj> ");
@ -540,7 +552,7 @@ AcpiDmDisplayInternalObject (
default:
AcpiOsPrintf ("<Not a valid ACPI Object Descriptor> [%s]",
AcpiUtGetDescriptorName (ObjDesc));
AcpiUtGetDescriptorName (ObjDesc));
break;
}

View File

@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dmopcode - AML disassembler, specific AML opcodes
* $Revision: 1.101 $
*
******************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -115,6 +114,7 @@
*****************************************************************************/
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "amlcode.h"
#include "acdisasm.h"
@ -202,8 +202,6 @@ AcpiDmFieldFlags (
UINT32 Flags;
/* The next peer Op (not child op) contains the flags */
Op = Op->Common.Next;
Flags = (UINT8) Op->Common.Value.Integer;
@ -406,6 +404,9 @@ AcpiDmDisassembleOneOp (
case AML_LLESS_OP:
AcpiOsPrintf ("LGreaterEqual");
break;
default:
break;
}
Op->Common.DisasmOpcode = 0;
Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
@ -548,7 +549,7 @@ AcpiDmDisassembleOneOp (
case AML_INT_NAMEDFIELD_OP:
Length = AcpiDmDumpName ((char *) &Op->Named.Name);
Length = AcpiDmDumpName (Op->Named.Name);
AcpiOsPrintf (",%*.s %d", (int) (5 - Length), " ",
(UINT32) Op->Common.Value.Integer);
AcpiDmCommaIfFieldMember (Op);

View File

@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dmresrc.c - Resource Descriptor disassembly
* $Revision: 1.35 $
*
******************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "amlcode.h"
#include "acdisasm.h"
@ -133,7 +133,7 @@ void (*ACPI_RESOURCE_HANDLER) (
UINT32 Length,
UINT32 Level);
static ACPI_RESOURCE_HANDLER AcpiGbl_DumpResourceDispatch [] =
static ACPI_RESOURCE_HANDLER AcpiGbl_DmResourceDispatch [] =
{
/* Small descriptors */
@ -325,7 +325,7 @@ AcpiDmResourceTemplate (
UINT32 ByteCount)
{
ACPI_STATUS Status;
ACPI_NATIVE_UINT CurrentByteOffset;
UINT32 CurrentByteOffset;
UINT8 ResourceType;
UINT32 ResourceLength;
void *Aml;
@ -343,7 +343,7 @@ AcpiDmResourceTemplate (
Node = Node->Child;
}
for (CurrentByteOffset = 0; CurrentByteOffset < ByteCount; )
for (CurrentByteOffset = 0; CurrentByteOffset < ByteCount;)
{
Aml = &ByteData[CurrentByteOffset];
@ -423,7 +423,7 @@ AcpiDmResourceTemplate (
Node = Node->Peer;
}
AcpiGbl_DumpResourceDispatch [ResourceIndex] (
AcpiGbl_DmResourceDispatch [ResourceIndex] (
Aml, ResourceLength, Level);
/* Descriptor post-processing */

View File

@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dmresrcl.c - "Large" Resource Descriptor disassembly
* $Revision: 1.37 $
*
******************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "acdisasm.h"
@ -215,7 +215,7 @@ AcpiDmMemoryFields (
UINT8 Type,
UINT32 Level)
{
ACPI_NATIVE_UINT i;
UINT32 i;
for (i = 0; i < 4; i++)
@ -261,7 +261,7 @@ AcpiDmAddressFields (
UINT8 Type,
UINT32 Level)
{
ACPI_NATIVE_UINT i;
UINT32 i;
AcpiOsPrintf ("\n");
@ -1026,7 +1026,7 @@ AcpiDmInterruptDescriptor (
*/
AcpiDmResourceSource (Resource,
sizeof (AML_RESOURCE_EXTENDED_IRQ) +
(Resource->ExtendedIrq.InterruptCount - 1) * sizeof (UINT32),
((UINT32) Resource->ExtendedIrq.InterruptCount - 1) * sizeof (UINT32),
Resource->ExtendedIrq.ResourceLength);
/* Insert a descriptor name */

View File

@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dmresrcs.c - "Small" Resource Descriptor disassembly
* $Revision: 1.16 $
*
******************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "acdisasm.h"

View File

@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dmutils - AML disassembler utilities
* $Revision: 1.25 $
*
******************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "amlcode.h"
#include "acdisasm.h"

View File

@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dmwalk - AML disassembly tree walk
* $Revision: 1.33 $
*
******************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -116,6 +115,7 @@
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "amlcode.h"
#include "acdisasm.h"
@ -148,6 +148,69 @@ static UINT32
AcpiDmBlockType (
ACPI_PARSE_OBJECT *Op);
static const char *
AcpiDmGetObjectTypeName (
ACPI_OBJECT_TYPE Type);
/*
* This table maps ACPI_OBJECT_TYPEs to the corresponding ASL
* ObjectTypeKeyword. Used to generate typed external declarations
*/
static const char *AcpiGbl_DmTypeNames[] =
{
/* 00 */ "", /* Type ANY */
/* 01 */ ", IntObj",
/* 02 */ ", StrObj",
/* 03 */ ", BuffObj",
/* 04 */ ", PkgObj",
/* 05 */ ", FieldUnitObj",
/* 06 */ ", DeviceObj",
/* 07 */ ", EventObj",
/* 08 */ ", MethodObj",
/* 09 */ ", MutexObj",
/* 10 */ ", OpRegionObj",
/* 11 */ ", PowerResObj",
/* 12 */ ", ProcessorObj",
/* 13 */ ", ThermalZoneObj",
/* 14 */ ", BuffFieldObj",
/* 15 */ ", DDBHandleObj",
/* 16 */ "", /* Debug object */
/* 17 */ ", FieldUnitObj",
/* 18 */ ", FieldUnitObj",
/* 19 */ ", FieldUnitObj"
};
/*******************************************************************************
*
* FUNCTION: AcpiDmGetObjectTypeName
*
* PARAMETERS: Type - An ACPI_OBJECT_TYPE
*
* RETURN: Pointer to a string
*
* DESCRIPTION: Map an object type to the ASL object type string.
*
******************************************************************************/
static const char *
AcpiDmGetObjectTypeName (
ACPI_OBJECT_TYPE Type)
{
if (Type == ACPI_TYPE_LOCAL_SCOPE)
{
Type = ACPI_TYPE_DEVICE;
}
else if (Type > ACPI_TYPE_LOCAL_INDEX_FIELD)
{
return ("");
}
return (AcpiGbl_DmTypeNames[Type]);
}
/*******************************************************************************
*
@ -499,28 +562,9 @@ AcpiDmDescendingOp (
*/
while (AcpiGbl_ExternalList)
{
AcpiOsPrintf (" External (%s",
AcpiGbl_ExternalList->Path);
/* TBD: should be a lookup table */
switch (AcpiGbl_ExternalList->Type)
{
case ACPI_TYPE_DEVICE:
AcpiOsPrintf (", DeviceObj");
break;
case ACPI_TYPE_METHOD:
AcpiOsPrintf (", MethodObj");
break;
case ACPI_TYPE_INTEGER:
AcpiOsPrintf (", IntObj");
break;
default:
break;
}
AcpiOsPrintf (" External (%s%s",
AcpiGbl_ExternalList->Path,
AcpiDmGetObjectTypeName (AcpiGbl_ExternalList->Type));
if (AcpiGbl_ExternalList->Type == ACPI_TYPE_METHOD)
{
@ -622,7 +666,7 @@ AcpiDmDescendingOp (
}
else
{
AcpiDmDumpName ((char *) &Name);
AcpiDmDumpName (Name);
}
if (Op->Common.AmlOpcode != AML_INT_NAMEDFIELD_OP)

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: dsfield - Dispatcher field routines
* $Revision: 1.84 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -117,6 +116,7 @@
#define __DSFIELD_C__
#include "acpi.h"
#include "accommon.h"
#include "amlcode.h"
#include "acdispat.h"
#include "acinterp.h"
@ -171,15 +171,18 @@ AcpiDsCreateBufferField (
ACPI_FUNCTION_TRACE (DsCreateBufferField);
/* Get the NameString argument */
/*
* Get the NameString argument (name of the new BufferField)
*/
if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP)
{
/* For CreateField, name is the 4th argument */
Arg = AcpiPsGetArg (Op, 3);
}
else
{
/* Create Bit/Byte/Word/Dword field */
/* For all other CreateXXXField operators, name is the 3rd argument */
Arg = AcpiPsGetArg (Op, 2);
}
@ -196,27 +199,30 @@ AcpiDsCreateBufferField (
}
else
{
/*
* During the load phase, we want to enter the name of the field into
* the namespace. During the execute phase (when we evaluate the size
* operand), we want to lookup the name
*/
if (WalkState->ParseFlags & ACPI_PARSE_EXECUTE)
/* Execute flag should always be set when this function is entered */
if (!(WalkState->ParseFlags & ACPI_PARSE_EXECUTE))
{
Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE;
}
else
{
Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
ACPI_NS_ERROR_IF_FOUND;
return_ACPI_STATUS (AE_AML_INTERNAL);
}
/*
* Enter the NameString into the namespace
*/
/* Creating new namespace node, should not already exist */
Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
ACPI_NS_ERROR_IF_FOUND;
/* Mark node temporary if we are executing a method */
if (WalkState->MethodNode)
{
Flags |= ACPI_NS_TEMPORARY;
}
/* Enter the NameString into the namespace */
Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS1,
Flags, WalkState, &(Node));
ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS1,
Flags, WalkState, &Node);
if (ACPI_FAILURE (Status))
{
ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
@ -227,13 +233,13 @@ AcpiDsCreateBufferField (
/*
* 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
* so we can get it again at the end of this scope.
*/
Op->Common.Node = Node;
/*
* If there is no object attached to the node, this node was just created
* and we need to create the field object. Otherwise, this was a lookup
* and we need to create the field object. Otherwise, this was a lookup
* of an existing node and we don't want to create the field object again.
*/
ObjDesc = AcpiNsGetAttachedObject (Node);
@ -257,9 +263,8 @@ AcpiDsCreateBufferField (
}
/*
* Remember location in AML stream of the field unit
* opcode and operands -- since the buffer and index
* operands must be evaluated.
* Remember location in AML stream of the field unit opcode and operands --
* since the buffer and index operands must be evaluated.
*/
SecondDesc = ObjDesc->Common.NextObject;
SecondDesc->Extra.AmlStart = Op->Named.Data;
@ -364,34 +369,35 @@ AcpiDsGetFieldNames (
case AML_INT_NAMEDFIELD_OP:
/* Lookup the name */
/* Lookup the name, it should already exist */
Status = AcpiNsLookup (WalkState->ScopeInfo,
(char *) &Arg->Named.Name,
Info->FieldType, ACPI_IMODE_EXECUTE,
ACPI_NS_DONT_OPEN_SCOPE,
WalkState, &Info->FieldNode);
(char *) &Arg->Named.Name, Info->FieldType,
ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE,
WalkState, &Info->FieldNode);
if (ACPI_FAILURE (Status))
{
ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status);
if (Status != AE_ALREADY_EXISTS)
{
return_ACPI_STATUS (Status);
}
/* Already exists, ignore error */
return_ACPI_STATUS (Status);
}
else
{
Arg->Common.Node = Info->FieldNode;
Info->FieldBitLength = Arg->Common.Value.Size;
/* Create and initialize an object for the new Field Node */
Status = AcpiExPrepFieldValue (Info);
if (ACPI_FAILURE (Status))
/*
* If there is no object attached to the node, this node was
* just created and we need to create the field object.
* Otherwise, this was a lookup of an existing node and we
* don't want to create the field object again.
*/
if (!AcpiNsGetAttachedObject (Info->FieldNode))
{
return_ACPI_STATUS (Status);
Status = AcpiExPrepFieldValue (Info);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
}
@ -415,8 +421,7 @@ AcpiDsGetFieldNames (
default:
ACPI_ERROR ((AE_INFO,
"Invalid opcode in field list: %X",
Arg->Common.AmlOpcode));
"Invalid opcode in field list: %X", Arg->Common.AmlOpcode));
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
}
@ -511,11 +516,30 @@ AcpiDsInitFieldObjects (
ACPI_PARSE_OBJECT *Arg = NULL;
ACPI_NAMESPACE_NODE *Node;
UINT8 Type = 0;
UINT32 Flags;
ACPI_FUNCTION_TRACE_PTR (DsInitFieldObjects, Op);
/* Execute flag should always be set when this function is entered */
if (!(WalkState->ParseFlags & ACPI_PARSE_EXECUTE))
{
if (WalkState->ParseFlags & ACPI_PARSE_DEFERRED_OP)
{
/* BankField Op is deferred, just return OK */
return_ACPI_STATUS (AE_OK);
}
return_ACPI_STATUS (AE_AML_INTERNAL);
}
/*
* Get the FieldList argument for this opcode. This is the start of the
* list of field elements.
*/
switch (WalkState->Opcode)
{
case AML_FIELD_OP:
@ -537,21 +561,33 @@ AcpiDsInitFieldObjects (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Creating new namespace node(s), should not already exist */
Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
ACPI_NS_ERROR_IF_FOUND;
/* Mark node(s) temporary if we are executing a method */
if (WalkState->MethodNode)
{
Flags |= ACPI_NS_TEMPORARY;
}
/*
* Walk the list of entries in the FieldList
* Note: FieldList can be of zero length. In this case, Arg will be NULL.
*/
while (Arg)
{
/* Ignore OFFSET and ACCESSAS terms here */
/*
* Ignore OFFSET and ACCESSAS terms here; we are only interested in the
* field names in order to enter them into the namespace.
*/
if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)
{
Status = AcpiNsLookup (WalkState->ScopeInfo,
(char *) &Arg->Named.Name,
Type, ACPI_IMODE_LOAD_PASS1,
ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
ACPI_NS_ERROR_IF_FOUND,
WalkState, &Node);
(char *) &Arg->Named.Name, Type, ACPI_IMODE_LOAD_PASS1,
Flags, WalkState, &Node);
if (ACPI_FAILURE (Status))
{
ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status);
@ -568,7 +604,7 @@ AcpiDsInitFieldObjects (
Arg->Common.Node = Node;
}
/* Move to next field in the list */
/* Get the next field element in the list */
Arg = Arg->Common.Next;
}
@ -583,7 +619,7 @@ AcpiDsInitFieldObjects (
*
* PARAMETERS: Op - Op containing the Field definition and args
* RegionNode - Object for the containing Operation Region
* ` WalkState - Current method state
* WalkState - Current method state
*
* RETURN: Status
*
@ -632,36 +668,13 @@ AcpiDsCreateBankField (
return_ACPI_STATUS (Status);
}
/* Third arg is the BankValue */
/* TBD: This arg is a TermArg, not a constant, and must be evaluated */
/*
* Third arg is the BankValue
* This arg is a TermArg, not a constant
* It will be evaluated later, by AcpiDsEvalBankFieldOperands
*/
Arg = Arg->Common.Next;
/* Currently, only the following constants are supported */
switch (Arg->Common.AmlOpcode)
{
case AML_ZERO_OP:
Info.BankValue = 0;
break;
case AML_ONE_OP:
Info.BankValue = 1;
break;
case AML_BYTE_OP:
case AML_WORD_OP:
case AML_DWORD_OP:
case AML_QWORD_OP:
Info.BankValue = (UINT32) Arg->Common.Value.Integer;
break;
default:
Info.BankValue = 0;
ACPI_ERROR ((AE_INFO, "Non-constant BankValue for BankField is not implemented"));
}
/* Fourth arg is the field flags */
Arg = Arg->Common.Next;
@ -672,8 +685,17 @@ AcpiDsCreateBankField (
Info.FieldType = ACPI_TYPE_LOCAL_BANK_FIELD;
Info.RegionNode = RegionNode;
Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next);
/*
* Use Info.DataRegisterNode to store BankField Op
* It's safe because DataRegisterNode will never be used when create bank field
* We store AmlStart and AmlLength in the BankField Op for late evaluation
* Used in AcpiExPrepFieldValue(Info)
*
* TBD: Or, should we add a field in ACPI_CREATE_FIELD_INFO, like "void *ParentOp"?
*/
Info.DataRegisterNode = (ACPI_NAMESPACE_NODE*) Op;
Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next);
return_ACPI_STATUS (Status);
}

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: dsinit - Object initialization namespace walk
* $Revision: 1.28 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -117,6 +116,7 @@
#define __DSINIT_C__
#include "acpi.h"
#include "accommon.h"
#include "acdispat.h"
#include "acnamesp.h"
#include "actables.h"
@ -241,7 +241,7 @@ AcpiDsInitOneObject (
ACPI_STATUS
AcpiDsInitializeObjects (
ACPI_NATIVE_UINT TableIndex,
UINT32 TableIndex,
ACPI_NAMESPACE_NODE *StartNode)
{
ACPI_STATUS Status;
@ -272,12 +272,23 @@ AcpiDsInitializeObjects (
/* Walk entire namespace from the supplied root */
Status = AcpiWalkNamespace (ACPI_TYPE_ANY, StartNode, ACPI_UINT32_MAX,
AcpiDsInitOneObject, &Info, NULL);
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/*
* We don't use AcpiWalkNamespace since we do not want to acquire
* the namespace reader lock.
*/
Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, StartNode, ACPI_UINT32_MAX,
ACPI_NS_WALK_UNLOCK, AcpiDsInitOneObject, &Info, NULL);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace"));
}
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
Status = AcpiGetTableByIndex (TableIndex, &Table);
if (ACPI_FAILURE (Status))

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: dsmethod - Parser/Interpreter interface - control method parsing
* $Revision: 1.136 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -117,7 +116,7 @@
#define __DSMETHOD_C__
#include "acpi.h"
#include "acparser.h"
#include "accommon.h"
#include "amlcode.h"
#include "acdispat.h"
#include "acinterp.h"
@ -183,9 +182,11 @@ AcpiDsMethodError (
WalkState->MethodNode ?
WalkState->MethodNode->Name.Integer : 0,
WalkState->Opcode, WalkState->AmlOffset, NULL);
(void) AcpiExEnterInterpreter ();
AcpiExEnterInterpreter ();
}
AcpiDsClearImplicitReturn (WalkState);
#ifdef ACPI_DISASSEMBLER
if (ACPI_FAILURE (Status))
{
@ -384,6 +385,7 @@ AcpiDsBeginMethodExecution (
* reentered one more time (even if it is the same thread)
*/
ObjDesc->Method.ThreadCount++;
AcpiMethodCount++;
return_ACPI_STATUS (Status);
@ -484,7 +486,6 @@ AcpiDsCallControlMethod (
}
Info->Parameters = &ThisWalkState->Operands[0];
Info->ParameterType = ACPI_PARAM_ARGS;
Status = AcpiDsInitAmlWalk (NextWalkState, NULL, MethodNode,
ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength,
@ -519,6 +520,10 @@ AcpiDsCallControlMethod (
if (ObjDesc->Method.MethodFlags & AML_METHOD_INTERNAL_ONLY)
{
Status = ObjDesc->Method.Implementation (NextWalkState);
if (Status == AE_OK)
{
Status = AE_CTRL_TERMINATE;
}
}
return_ACPI_STATUS (Status);
@ -651,8 +656,6 @@ AcpiDsTerminateControlMethod (
ACPI_OPERAND_OBJECT *MethodDesc,
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE_PTR (DsTerminateControlMethod, WalkState);
@ -669,29 +672,26 @@ AcpiDsTerminateControlMethod (
/* Delete all arguments and locals */
AcpiDsMethodDataDeleteAll (WalkState);
}
/*
* If method is serialized, release the mutex and restore the
* current sync level for this thread
*/
if (MethodDesc->Method.Mutex)
{
/* Acquisition Depth handles recursive calls */
MethodDesc->Method.Mutex->Mutex.AcquisitionDepth--;
if (!MethodDesc->Method.Mutex->Mutex.AcquisitionDepth)
/*
* If method is serialized, release the mutex and restore the
* current sync level for this thread
*/
if (MethodDesc->Method.Mutex)
{
WalkState->Thread->CurrentSyncLevel =
MethodDesc->Method.Mutex->Mutex.OriginalSyncLevel;
/* Acquisition Depth handles recursive calls */
AcpiOsReleaseMutex (MethodDesc->Method.Mutex->Mutex.OsMutex);
MethodDesc->Method.Mutex->Mutex.ThreadId = 0;
MethodDesc->Method.Mutex->Mutex.AcquisitionDepth--;
if (!MethodDesc->Method.Mutex->Mutex.AcquisitionDepth)
{
WalkState->Thread->CurrentSyncLevel =
MethodDesc->Method.Mutex->Mutex.OriginalSyncLevel;
AcpiOsReleaseMutex (MethodDesc->Method.Mutex->Mutex.OsMutex);
MethodDesc->Method.Mutex->Mutex.ThreadId = 0;
}
}
}
if (WalkState)
{
/*
* Delete any namespace objects created anywhere within
* the namespace by the execution of this method
@ -740,7 +740,7 @@ AcpiDsTerminateControlMethod (
if ((MethodDesc->Method.MethodFlags & AML_METHOD_SERIALIZED) &&
(!MethodDesc->Method.Mutex))
{
Status = AcpiDsCreateMethodMutex (MethodDesc);
(void) AcpiDsCreateMethodMutex (MethodDesc);
}
/* No more threads, we can free the OwnerId */

View File

@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dsmthdat - control method arguments and local variables
* $Revision: 1.92 $
*
******************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -117,8 +116,8 @@
#define __DSMTHDAT_C__
#include "acpi.h"
#include "accommon.h"
#include "acdispat.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "acinterp.h"
@ -130,13 +129,13 @@
static void
AcpiDsMethodDataDeleteValue (
UINT16 Opcode,
UINT8 Type,
UINT32 Index,
ACPI_WALK_STATE *WalkState);
static ACPI_STATUS
AcpiDsMethodDataSetValue (
UINT16 Opcode,
UINT8 Type,
UINT32 Index,
ACPI_OPERAND_OBJECT *Object,
ACPI_WALK_STATE *WalkState);
@ -313,7 +312,7 @@ AcpiDsMethodDataInitArgs (
* Store the argument in the method/walk descriptor.
* Do not copy the arg in order to implement call by reference
*/
Status = AcpiDsMethodDataSetValue (AML_ARG_OP, Index,
Status = AcpiDsMethodDataSetValue (ACPI_REFCLASS_ARG, Index,
Params[Index], WalkState);
if (ACPI_FAILURE (Status))
{
@ -332,7 +331,8 @@ AcpiDsMethodDataInitArgs (
*
* FUNCTION: AcpiDsMethodDataGetNode
*
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
* PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or
* ACPI_REFCLASS_ARG
* Index - Which Local or Arg whose type to get
* WalkState - Current walk state object
* Node - Where the node is returned.
@ -345,7 +345,7 @@ AcpiDsMethodDataInitArgs (
ACPI_STATUS
AcpiDsMethodDataGetNode (
UINT16 Opcode,
UINT8 Type,
UINT32 Index,
ACPI_WALK_STATE *WalkState,
ACPI_NAMESPACE_NODE **Node)
@ -356,9 +356,9 @@ AcpiDsMethodDataGetNode (
/*
* Method Locals and Arguments are supported
*/
switch (Opcode)
switch (Type)
{
case AML_LOCAL_OP:
case ACPI_REFCLASS_LOCAL:
if (Index > ACPI_METHOD_MAX_LOCAL)
{
@ -373,7 +373,7 @@ AcpiDsMethodDataGetNode (
*Node = &WalkState->LocalVariables[Index];
break;
case AML_ARG_OP:
case ACPI_REFCLASS_ARG:
if (Index > ACPI_METHOD_MAX_ARG)
{
@ -389,8 +389,8 @@ AcpiDsMethodDataGetNode (
break;
default:
ACPI_ERROR ((AE_INFO, "Opcode %d is invalid", Opcode));
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
ACPI_ERROR ((AE_INFO, "Type %d is invalid", Type));
return_ACPI_STATUS (AE_TYPE);
}
return_ACPI_STATUS (AE_OK);
@ -401,7 +401,8 @@ AcpiDsMethodDataGetNode (
*
* FUNCTION: AcpiDsMethodDataSetValue
*
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
* PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or
* ACPI_REFCLASS_ARG
* Index - Which Local or Arg to get
* Object - Object to be inserted into the stack entry
* WalkState - Current walk state object
@ -415,7 +416,7 @@ AcpiDsMethodDataGetNode (
static ACPI_STATUS
AcpiDsMethodDataSetValue (
UINT16 Opcode,
UINT8 Type,
UINT32 Index,
ACPI_OPERAND_OBJECT *Object,
ACPI_WALK_STATE *WalkState)
@ -428,13 +429,13 @@ AcpiDsMethodDataSetValue (
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"NewObj %p Opcode %X, Refs=%d [%s]\n", Object,
Opcode, Object->Common.ReferenceCount,
"NewObj %p Type %2.2X, Refs=%d [%s]\n", Object,
Type, Object->Common.ReferenceCount,
AcpiUtGetTypeName (Object->Common.Type)));
/* Get the namespace node for the arg/local */
Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node);
Status = AcpiDsMethodDataGetNode (Type, Index, WalkState, &Node);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -459,7 +460,8 @@ AcpiDsMethodDataSetValue (
*
* FUNCTION: AcpiDsMethodDataGetValue
*
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
* PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or
* ACPI_REFCLASS_ARG
* Index - Which localVar or argument to get
* WalkState - Current walk state object
* DestDesc - Where Arg or Local value is returned
@ -473,7 +475,7 @@ AcpiDsMethodDataSetValue (
ACPI_STATUS
AcpiDsMethodDataGetValue (
UINT16 Opcode,
UINT8 Type,
UINT32 Index,
ACPI_WALK_STATE *WalkState,
ACPI_OPERAND_OBJECT **DestDesc)
@ -496,7 +498,7 @@ AcpiDsMethodDataGetValue (
/* Get the namespace node for the arg/local */
Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node);
Status = AcpiDsMethodDataGetNode (Type, Index, WalkState, &Node);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -534,9 +536,9 @@ AcpiDsMethodDataGetValue (
/* Otherwise, return the error */
else switch (Opcode)
else switch (Type)
{
case AML_ARG_OP:
case ACPI_REFCLASS_ARG:
ACPI_ERROR ((AE_INFO,
"Uninitialized Arg[%d] at node %p",
@ -544,16 +546,16 @@ AcpiDsMethodDataGetValue (
return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG);
case AML_LOCAL_OP:
case ACPI_REFCLASS_LOCAL:
ACPI_ERROR ((AE_INFO,
"Uninitialized Local[%d] at node %p",
Index, Node));
"Uninitialized Local[%d] at node %p", Index, Node));
return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL);
default:
ACPI_ERROR ((AE_INFO, "Not a Arg/Local opcode: %X", Opcode));
ACPI_ERROR ((AE_INFO, "Not a Arg/Local opcode: %X", Type));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
}
@ -573,7 +575,8 @@ AcpiDsMethodDataGetValue (
*
* FUNCTION: AcpiDsMethodDataDeleteValue
*
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
* PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or
* ACPI_REFCLASS_ARG
* Index - Which localVar or argument to delete
* WalkState - Current walk state object
*
@ -586,7 +589,7 @@ AcpiDsMethodDataGetValue (
static void
AcpiDsMethodDataDeleteValue (
UINT16 Opcode,
UINT8 Type,
UINT32 Index,
ACPI_WALK_STATE *WalkState)
{
@ -600,7 +603,7 @@ AcpiDsMethodDataDeleteValue (
/* Get the namespace node for the arg/local */
Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node);
Status = AcpiDsMethodDataGetNode (Type, Index, WalkState, &Node);
if (ACPI_FAILURE (Status))
{
return_VOID;
@ -636,7 +639,8 @@ AcpiDsMethodDataDeleteValue (
*
* FUNCTION: AcpiDsStoreObjectToLocal
*
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
* PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or
* ACPI_REFCLASS_ARG
* Index - Which Local or Arg to set
* ObjDesc - Value to be stored
* WalkState - Current walk state
@ -651,7 +655,7 @@ AcpiDsMethodDataDeleteValue (
ACPI_STATUS
AcpiDsStoreObjectToLocal (
UINT16 Opcode,
UINT8 Type,
UINT32 Index,
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_WALK_STATE *WalkState)
@ -663,8 +667,8 @@ AcpiDsStoreObjectToLocal (
ACPI_FUNCTION_TRACE (DsStoreObjectToLocal);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n",
Opcode, Index, ObjDesc));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Type=%2.2X Index=%d Obj=%p\n",
Type, Index, ObjDesc));
/* Parameter validation */
@ -675,7 +679,7 @@ AcpiDsStoreObjectToLocal (
/* Get the namespace node for the arg/local */
Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node);
Status = AcpiDsMethodDataGetNode (Type, Index, WalkState, &Node);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -730,7 +734,7 @@ AcpiDsStoreObjectToLocal (
*
* Weird, but true.
*/
if (Opcode == AML_ARG_OP)
if (Type == ACPI_REFCLASS_ARG)
{
/*
* If we have a valid reference object that came from RefOf(),
@ -738,7 +742,7 @@ AcpiDsStoreObjectToLocal (
*/
if ((ACPI_GET_DESCRIPTOR_TYPE (CurrentObjDesc) == ACPI_DESC_TYPE_OPERAND) &&
(CurrentObjDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
(CurrentObjDesc->Reference.Opcode == AML_REF_OF_OP))
(CurrentObjDesc->Reference.Class == ACPI_REFCLASS_REFOF))
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Arg (%p) is an ObjRef(Node), storing in node %p\n",
@ -763,11 +767,9 @@ AcpiDsStoreObjectToLocal (
}
}
/*
* Delete the existing object
* before storing the new one
*/
AcpiDsMethodDataDeleteValue (Opcode, Index, WalkState);
/* Delete the existing object before storing the new one */
AcpiDsMethodDataDeleteValue (Type, Index, WalkState);
}
/*
@ -775,7 +777,7 @@ AcpiDsStoreObjectToLocal (
* the descriptor for the Arg or Local.
* (increments the object reference count by one)
*/
Status = AcpiDsMethodDataSetValue (Opcode, Index, NewObjDesc, WalkState);
Status = AcpiDsMethodDataSetValue (Type, Index, NewObjDesc, WalkState);
/* Remove local reference if we copied the object above */
@ -837,7 +839,7 @@ AcpiDsMethodDataGetType (
/* Get the object type */
return_VALUE (ACPI_GET_OBJECT_TYPE (Object));
return_VALUE (Object->Type);
}
#endif

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: dsobject - Dispatcher object management routines
* $Revision: 1.135 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -117,6 +116,7 @@
#define __DSOBJECT_C__
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "amlcode.h"
#include "acdispat.h"
@ -211,6 +211,72 @@ AcpiDsBuildInternalObject (
return_ACPI_STATUS (Status);
}
}
/* Special object resolution for elements of a package */
if ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
(Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP))
{
/*
* Attempt to resolve the node to a value before we insert it into
* the package. If this is a reference to a common data type,
* resolve it immediately. According to the ACPI spec, package
* elements can only be "data objects" or method references.
* Attempt to resolve to an Integer, Buffer, String or Package.
* If cannot, return the named reference (for things like Devices,
* Methods, etc.) Buffer Fields and Fields will resolve to simple
* objects (int/buf/str/pkg).
*
* NOTE: References to things like Devices, Methods, Mutexes, etc.
* will remain as named references. This behavior is not described
* in the ACPI spec, but it appears to be an oversight.
*/
ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Op->Common.Node);
Status = AcpiExResolveNodeToValue (
ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &ObjDesc),
WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
switch (Op->Common.Node->Type)
{
/*
* For these types, we need the actual node, not the subobject.
* However, the subobject did not get an extra reference count above.
*
* TBD: should ExResolveNodeToValue be changed to fix this?
*/
case ACPI_TYPE_DEVICE:
case ACPI_TYPE_THERMAL:
AcpiUtAddReference (Op->Common.Node->Object);
/*lint -fallthrough */
/*
* For these types, we need the actual node, not the subobject.
* The subobject got an extra reference count in ExResolveNodeToValue.
*/
case ACPI_TYPE_MUTEX:
case ACPI_TYPE_METHOD:
case ACPI_TYPE_POWER:
case ACPI_TYPE_PROCESSOR:
case ACPI_TYPE_EVENT:
case ACPI_TYPE_REGION:
/* We will create a reference object for these types below */
break;
default:
/*
* All other types - the node was resolved to an actual
* object, we are done.
*/
goto Exit;
}
}
}
/* Create and init a new internal ACPI object */
@ -230,8 +296,9 @@ AcpiDsBuildInternalObject (
return_ACPI_STATUS (Status);
}
Exit:
*ObjDescPtr = ObjDesc;
return_ACPI_STATUS (AE_OK);
return_ACPI_STATUS (Status);
}
@ -392,7 +459,7 @@ AcpiDsBuildInternalPackageObj (
ACPI_PARSE_OBJECT *Parent;
ACPI_OPERAND_OBJECT *ObjDesc = NULL;
ACPI_STATUS Status = AE_OK;
ACPI_NATIVE_UINT i;
UINT32 i;
UINT16 Index;
UINT16 ReferenceCount;
@ -454,10 +521,23 @@ AcpiDsBuildInternalPackageObj (
{
if (Arg->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP)
{
/* This package element is already built, just get it */
if (Arg->Common.Node->Type == ACPI_TYPE_METHOD)
{
/*
* A method reference "looks" to the parser to be a method
* invocation, so we special case it here
*/
Arg->Common.AmlOpcode = AML_INT_NAMEPATH_OP;
Status = AcpiDsBuildInternalObject (WalkState, Arg,
&ObjDesc->Package.Elements[i]);
}
else
{
/* This package element is already built, just get it */
ObjDesc->Package.Elements[i] =
ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Arg->Common.Node);
ObjDesc->Package.Elements[i] =
ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Arg->Common.Node);
}
}
else
{
@ -484,11 +564,40 @@ AcpiDsBuildInternalPackageObj (
Arg = Arg->Common.Next;
}
if (!Arg)
/* Check for match between NumElements and actual length of PackageList */
if (Arg)
{
/*
* NumElements was exhausted, but there are remaining elements in the
* PackageList.
*
* Note: technically, this is an error, from ACPI spec: "It is an error
* for NumElements to be less than the number of elements in the
* PackageList". However, for now, we just print an error message and
* no exception is returned.
*/
while (Arg)
{
/* Find out how many elements there really are */
i++;
Arg = Arg->Common.Next;
}
ACPI_ERROR ((AE_INFO,
"Package List length (%X) larger than NumElements count (%X), truncated\n",
i, ElementCount));
}
else if (i < ElementCount)
{
/*
* Arg list (elements) was exhausted, but we did not reach NumElements count.
* Note: this is not an error, the package is padded out with NULLs.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Package List length larger than NumElements count (%X), truncated\n",
ElementCount));
"Package List length (%X) smaller than NumElements count (%X), padded with null elements\n",
i, ElementCount));
}
ObjDesc->Package.Flags |= AOPOBJ_DATA_VALID;
@ -552,7 +661,7 @@ AcpiDsCreateNode (
/* Re-type the object according to its argument */
Node->Type = ACPI_GET_OBJECT_TYPE (ObjDesc);
Node->Type = ObjDesc->Common.Type;
/* Attach obj to node */
@ -610,7 +719,7 @@ AcpiDsInitObjectFromOp (
/* Perform per-object initialization */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_BUFFER:
@ -730,45 +839,59 @@ AcpiDsInitObjectFromOp (
{
case AML_TYPE_LOCAL_VARIABLE:
/* Split the opcode into a base opcode + offset */
/* Local ID (0-7) is (AML opcode - base AML_LOCAL_OP) */
ObjDesc->Reference.Opcode = AML_LOCAL_OP;
ObjDesc->Reference.Offset = Opcode - AML_LOCAL_OP;
ObjDesc->Reference.Value = ((UINT32) Opcode) - AML_LOCAL_OP;
ObjDesc->Reference.Class = ACPI_REFCLASS_LOCAL;
#ifndef ACPI_NO_METHOD_EXECUTION
Status = AcpiDsMethodDataGetNode (AML_LOCAL_OP,
ObjDesc->Reference.Offset,
WalkState,
(ACPI_NAMESPACE_NODE **) &ObjDesc->Reference.Object);
Status = AcpiDsMethodDataGetNode (ACPI_REFCLASS_LOCAL,
ObjDesc->Reference.Value, WalkState,
ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE,
&ObjDesc->Reference.Object));
#endif
break;
case AML_TYPE_METHOD_ARGUMENT:
/* Split the opcode into a base opcode + offset */
/* Arg ID (0-6) is (AML opcode - base AML_ARG_OP) */
ObjDesc->Reference.Opcode = AML_ARG_OP;
ObjDesc->Reference.Offset = Opcode - AML_ARG_OP;
ObjDesc->Reference.Value = ((UINT32) Opcode) - AML_ARG_OP;
ObjDesc->Reference.Class = ACPI_REFCLASS_ARG;
#ifndef ACPI_NO_METHOD_EXECUTION
Status = AcpiDsMethodDataGetNode (AML_ARG_OP,
ObjDesc->Reference.Offset,
WalkState,
(ACPI_NAMESPACE_NODE **) &ObjDesc->Reference.Object);
Status = AcpiDsMethodDataGetNode (ACPI_REFCLASS_ARG,
ObjDesc->Reference.Value, WalkState,
ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE,
&ObjDesc->Reference.Object));
#endif
break;
default: /* Other literals, etc.. */
default: /* Object name or Debug object */
if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
switch (Op->Common.AmlOpcode)
{
case AML_INT_NAMEPATH_OP:
/* Node was saved in Op */
ObjDesc->Reference.Node = Op->Common.Node;
}
ObjDesc->Reference.Object = Op->Common.Node->Object;
ObjDesc->Reference.Class = ACPI_REFCLASS_NAME;
break;
ObjDesc->Reference.Opcode = Opcode;
case AML_DEBUG_OP:
ObjDesc->Reference.Class = ACPI_REFCLASS_DEBUG;
break;
default:
ACPI_ERROR ((AE_INFO,
"Unimplemented reference type for AML opcode: %4.4X", Opcode));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
break;
}
break;
@ -777,7 +900,7 @@ AcpiDsInitObjectFromOp (
default:
ACPI_ERROR ((AE_INFO, "Unimplemented data type: %X",
ACPI_GET_OBJECT_TYPE (ObjDesc)));
ObjDesc->Common.Type));
Status = AE_AML_OPERAND_TYPE;
break;

View File

@ -2,7 +2,6 @@
*
* Module Name: dsopcode - Dispatcher Op Region support and handling of
* "control" opcodes
* $Revision: 1.111 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -118,12 +117,14 @@
#define __DSOPCODE_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"
#include "actables.h"
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsopcode")
@ -312,6 +313,53 @@ AcpiDsGetBufferFieldArguments (
}
/*******************************************************************************
*
* FUNCTION: AcpiDsGetBankFieldArguments
*
* PARAMETERS: ObjDesc - A valid BankField object
*
* RETURN: Status.
*
* DESCRIPTION: Get BankField BankValue. This implements the late
* evaluation of these field attributes.
*
******************************************************************************/
ACPI_STATUS
AcpiDsGetBankFieldArguments (
ACPI_OPERAND_OBJECT *ObjDesc)
{
ACPI_OPERAND_OBJECT *ExtraDesc;
ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE_PTR (DsGetBankFieldArguments, ObjDesc);
if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
{
return_ACPI_STATUS (AE_OK);
}
/* Get the AML pointer (method object) and BankField node */
ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
Node = ObjDesc->BankField.Node;
ACPI_DEBUG_EXEC(AcpiUtDisplayInitPathname (ACPI_TYPE_LOCAL_BANK_FIELD, Node, NULL));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BankField Arg Init\n",
AcpiUtGetNodeName (Node)));
/* Execute the AML code for the TermArg arguments */
Status = AcpiDsExecuteArguments (Node, AcpiNsGetParentNode (Node),
ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiDsGetBufferArguments
@ -459,28 +507,6 @@ AcpiDsGetRegionArguments (
Status = AcpiDsExecuteArguments (Node, AcpiNsGetParentNode (Node),
ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Validate the region address/length via the host OS */
Status = AcpiOsValidateAddress (ObjDesc->Region.SpaceId,
ObjDesc->Region.Address, (ACPI_SIZE) ObjDesc->Region.Length);
if (ACPI_FAILURE (Status))
{
/*
* Invalid address/length. We will emit an error message and mark
* the region as invalid, so that it will cause an additional error if
* it is ever used. Then return AE_OK.
*/
ACPI_EXCEPTION ((AE_INFO, Status,
"During address validation of OpRegion [%4.4s]", Node->Name.Ascii));
ObjDesc->Common.Flags |= AOPOBJ_INVALID;
Status = AE_OK;
}
return_ACPI_STATUS (Status);
}
@ -552,7 +578,7 @@ AcpiDsInitBufferField (
/* Host object must be a Buffer */
if (ACPI_GET_OBJECT_TYPE (BufferDesc) != ACPI_TYPE_BUFFER)
if (BufferDesc->Common.Type != ACPI_TYPE_BUFFER)
{
ACPI_ERROR ((AE_INFO,
"Target of Create Field is not a Buffer object - %s",
@ -778,11 +804,6 @@ AcpiDsEvalBufferFieldOperands (
Status = AcpiExResolveOperands (Op->Common.AmlOpcode,
ACPI_WALK_OPERANDS, WalkState);
ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
AcpiPsGetOpcodeName (Op->Common.AmlOpcode),
WalkState->NumOperands, "after AcpiExResolveOperands");
if (ACPI_FAILURE (Status))
{
ACPI_ERROR ((AE_INFO, "(%s) bad operand(s) (%X)",
@ -874,10 +895,6 @@ AcpiDsEvalRegionOperands (
return_ACPI_STATUS (Status);
}
ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
AcpiPsGetOpcodeName (Op->Common.AmlOpcode),
1, "after AcpiExResolveOperands");
ObjDesc = AcpiNsGetAttachedObject (Node);
if (!ObjDesc)
{
@ -905,7 +922,113 @@ AcpiDsEvalRegionOperands (
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
ObjDesc,
ACPI_FORMAT_UINT64 (ObjDesc->Region.Address),
ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address),
ObjDesc->Region.Length));
/* Now the address and length are valid for this opregion */
ObjDesc->Region.Flags |= AOPOBJ_DATA_VALID;
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiDsEvalTableRegionOperands
*
* PARAMETERS: WalkState - Current walk
* Op - A valid region Op object
*
* RETURN: Status
*
* DESCRIPTION: Get region address and length
* Called from AcpiDsExecEndOp during DataTableRegion parse tree walk
*
******************************************************************************/
ACPI_STATUS
AcpiDsEvalTableRegionOperands (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op)
{
ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_OPERAND_OBJECT **Operand;
ACPI_NAMESPACE_NODE *Node;
ACPI_PARSE_OBJECT *NextOp;
UINT32 TableIndex;
ACPI_TABLE_HEADER *Table;
ACPI_FUNCTION_TRACE_PTR (DsEvalTableRegionOperands, Op);
/*
* This is where we evaluate the SignatureString and OemIDString
* and OemTableIDString of the DataTableRegion declaration
*/
Node = Op->Common.Node;
/* NextOp points to SignatureString op */
NextOp = Op->Common.Value.Arg;
/*
* Evaluate/create the SignatureString and OemIDString
* and OemTableIDString operands
*/
Status = AcpiDsCreateOperands (WalkState, NextOp);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/*
* Resolve the SignatureString and OemIDString
* and OemTableIDString operands
*/
Status = AcpiExResolveOperands (Op->Common.AmlOpcode,
ACPI_WALK_OPERANDS, WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
Operand = &WalkState->Operands[0];
/* Find the ACPI table */
Status = AcpiTbFindTable (Operand[0]->String.Pointer,
Operand[1]->String.Pointer, Operand[2]->String.Pointer,
&TableIndex);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
AcpiUtRemoveReference (Operand[0]);
AcpiUtRemoveReference (Operand[1]);
AcpiUtRemoveReference (Operand[2]);
Status = AcpiGetTableByIndex (TableIndex, &Table);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
ObjDesc = AcpiNsGetAttachedObject (Node);
if (!ObjDesc)
{
return_ACPI_STATUS (AE_NOT_EXIST);
}
ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS) ACPI_TO_INTEGER (Table);
ObjDesc->Region.Length = Table->Length;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
ObjDesc,
ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address),
ObjDesc->Region.Length));
/* Now the address and length are valid for this opregion */
@ -1022,6 +1145,111 @@ AcpiDsEvalDataObjectOperands (
}
/*******************************************************************************
*
* FUNCTION: AcpiDsEvalBankFieldOperands
*
* PARAMETERS: WalkState - Current walk
* Op - A valid BankField Op object
*
* RETURN: Status
*
* DESCRIPTION: Get BankField BankValue
* Called from AcpiDsExecEndOp during BankField parse tree walk
*
******************************************************************************/
ACPI_STATUS
AcpiDsEvalBankFieldOperands (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op)
{
ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_OPERAND_OBJECT *OperandDesc;
ACPI_NAMESPACE_NODE *Node;
ACPI_PARSE_OBJECT *NextOp;
ACPI_PARSE_OBJECT *Arg;
ACPI_FUNCTION_TRACE_PTR (DsEvalBankFieldOperands, Op);
/*
* This is where we evaluate the BankValue field of the
* BankField declaration
*/
/* NextOp points to the op that holds the Region */
NextOp = Op->Common.Value.Arg;
/* NextOp points to the op that holds the Bank Register */
NextOp = NextOp->Common.Next;
/* NextOp points to the op that holds the Bank Value */
NextOp = NextOp->Common.Next;
/*
* Set proper index into operand stack for AcpiDsObjStackPush
* invoked inside AcpiDsCreateOperand.
*
* We use WalkState->Operands[0] to store the evaluated BankValue
*/
WalkState->OperandIndex = 0;
Status = AcpiDsCreateOperand (WalkState, NextOp, 0);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
Status = AcpiExResolveToValue (&WalkState->Operands[0], WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS,
AcpiPsGetOpcodeName (Op->Common.AmlOpcode), 1);
/*
* Get the BankValue operand and save it
* (at Top of stack)
*/
OperandDesc = WalkState->Operands[0];
/* Arg points to the start Bank Field */
Arg = AcpiPsGetArg (Op, 4);
while (Arg)
{
/* Ignore OFFSET and ACCESSAS terms here */
if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)
{
Node = Arg->Common.Node;
ObjDesc = AcpiNsGetAttachedObject (Node);
if (!ObjDesc)
{
return_ACPI_STATUS (AE_NOT_EXIST);
}
ObjDesc->BankField.Value = (UINT32) OperandDesc->Integer.Value;
}
/* Move to next field in the list */
Arg = Arg->Common.Next;
}
AcpiUtRemoveReference (OperandDesc);
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiDsExecBeginControlOp
@ -1053,9 +1281,28 @@ AcpiDsExecBeginControlOp (
switch (Op->Common.AmlOpcode)
{
case AML_IF_OP:
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
@ -1162,21 +1409,41 @@ AcpiDsExecEndControlOp (
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", Op));
if (WalkState->ControlState->Common.Value)
ControlState = WalkState->ControlState;
if (ControlState->Common.Value)
{
/* Predicate was true, go back and evaluate it again! */
/* 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);
WalkState->AmlLastWhile = ControlState->Control.AmlPredicateStart;
AcpiUtDeleteGenericState (ControlState);
break;
@ -1239,8 +1506,8 @@ AcpiDsExecEndControlOp (
* Allow references created by the Index operator to return unchanged.
*/
if ((ACPI_GET_DESCRIPTOR_TYPE (WalkState->Results->Results.ObjDesc[0]) == ACPI_DESC_TYPE_OPERAND) &&
(ACPI_GET_OBJECT_TYPE (WalkState->Results->Results.ObjDesc [0]) == ACPI_TYPE_LOCAL_REFERENCE) &&
((WalkState->Results->Results.ObjDesc [0])->Reference.Opcode != AML_INDEX_OP))
((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))
@ -1284,12 +1551,20 @@ AcpiDsExecEndControlOp (
case AML_BREAK_POINT_OP:
/* Call up to the OS service layer to handle this */
/*
* 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"));
Status = AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT, "Executed AML Breakpoint opcode");
/* If and when it returns, all done. */
/* Call to the OSL in case OS wants a piece of the action */
Status = AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT,
"Executed AML Breakpoint opcode");
break;

View File

@ -1,7 +1,6 @@
/*******************************************************************************
*
* Module Name: dsutils - Dispatcher utilities
* $Revision: 1.124 $
*
******************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -117,6 +116,7 @@
#define __DSUTILS_C__
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "amlcode.h"
#include "acdispat.h"
@ -374,7 +374,8 @@ AcpiDsIsResultUsed (
(Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
(Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP) ||
(Op->Common.Parent->Common.AmlOpcode == AML_BUFFER_OP) ||
(Op->Common.Parent->Common.AmlOpcode == AML_INT_EVAL_SUBTREE_OP))
(Op->Common.Parent->Common.AmlOpcode == AML_INT_EVAL_SUBTREE_OP) ||
(Op->Common.Parent->Common.AmlOpcode == AML_BANK_FIELD_OP))
{
/*
* These opcodes allow TermArg(s) as operands and therefore
@ -826,10 +827,9 @@ AcpiDsCreateOperands (
ACPI_STATUS Status = AE_OK;
ACPI_PARSE_OBJECT *Arg;
ACPI_PARSE_OBJECT *Arguments[ACPI_OBJ_NUM_OPERANDS];
UINT8 ArgCount = 0;
UINT8 Count = 0;
UINT8 Index = WalkState->NumOperands;
UINT8 i;
UINT32 ArgCount = 0;
UINT32 Index = WalkState->NumOperands;
UINT32 i;
ACPI_FUNCTION_TRACE_PTR (DsCreateOperands, FirstArg);
@ -865,7 +865,7 @@ AcpiDsCreateOperands (
/* Force the filling of the operand stack in inverse order */
WalkState->OperandIndex = Index;
WalkState->OperandIndex = (UINT8) Index;
Status = AcpiDsCreateOperand (WalkState, Arg, Index);
if (ACPI_FAILURE (Status))
@ -873,7 +873,6 @@ AcpiDsCreateOperands (
goto Cleanup;
}
Count++;
Index--;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%d (%p) done, Arg1=%p\n",
@ -954,7 +953,7 @@ AcpiDsEvaluateNamePath (
goto PushResult;
}
Type = ACPI_GET_OBJECT_TYPE (*Operand);
Type = (*Operand)->Common.Type;
Status = AcpiExResolveToValue (Operand, WalkState);
if (ACPI_FAILURE (Status))

View File

@ -2,7 +2,6 @@
*
* Module Name: dswexec - Dispatcher method execution callbacks;
* dispatch to interpreter.
* $Revision: 1.134 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -118,6 +117,7 @@
#define __DSWEXEC_C__
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "amlcode.h"
#include "acdispat.h"
@ -224,11 +224,11 @@ AcpiDsGetPredicateValue (
goto Cleanup;
}
if (ACPI_GET_OBJECT_TYPE (LocalObjDesc) != ACPI_TYPE_INTEGER)
if (LocalObjDesc->Common.Type != ACPI_TYPE_INTEGER)
{
ACPI_ERROR ((AE_INFO,
"Bad predicate (not an integer) ObjDesc=%p State=%p Type=%X",
ObjDesc, WalkState, ACPI_GET_OBJECT_TYPE (ObjDesc)));
ObjDesc, WalkState, ObjDesc->Common.Type));
Status = AE_AML_OPERAND_TYPE;
goto Cleanup;
@ -256,6 +256,10 @@ AcpiDsGetPredicateValue (
Status = AE_CTRL_FALSE;
}
/* Predicate can be used for an implicit return value */
(void) AcpiDsDoImplicitReturn (LocalObjDesc, WalkState, TRUE);
Cleanup:
@ -515,12 +519,6 @@ AcpiDsExecEndOp (
Status = AcpiExResolveOperands (WalkState->Opcode,
&(WalkState->Operands [WalkState->NumOperands -1]),
WalkState);
if (ACPI_SUCCESS (Status))
{
ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
AcpiPsGetOpcodeName (WalkState->Opcode),
WalkState->NumOperands, "after ExResolveOperands");
}
}
if (ACPI_SUCCESS (Status))
@ -542,10 +540,10 @@ AcpiDsExecEndOp (
(WalkState->Opcode == AML_STORE_OP) &&
(WalkState->Operands[0]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
(WalkState->Operands[1]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
(WalkState->Operands[0]->Reference.Opcode ==
WalkState->Operands[1]->Reference.Opcode) &&
(WalkState->Operands[0]->Reference.Offset ==
WalkState->Operands[1]->Reference.Offset))
(WalkState->Operands[0]->Reference.Class ==
WalkState->Operands[1]->Reference.Class) &&
(WalkState->Operands[0]->Reference.Value ==
WalkState->Operands[1]->Reference.Value))
{
Status = AE_OK;
}
@ -600,7 +598,7 @@ AcpiDsExecEndOp (
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Method Reference in a Package, Op=%p\n", Op));
Op->Common.Node = (ACPI_NAMESPACE_NODE *) Op->Asl.Value.Arg->Asl.Node->Object;
Op->Common.Node = (ACPI_NAMESPACE_NODE *) Op->Asl.Value.Arg->Asl.Node;
AcpiUtAddReference (Op->Asl.Value.Arg->Asl.Node->Object);
return_ACPI_STATUS (AE_OK);
}
@ -742,6 +740,28 @@ AcpiDsExecEndOp (
break;
}
}
else if (Op->Common.AmlOpcode == AML_DATA_REGION_OP)
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Executing DataTableRegion Strings Op=%p\n", Op));
Status = AcpiDsEvalTableRegionOperands (WalkState, Op);
if (ACPI_FAILURE (Status))
{
break;
}
}
else if (Op->Common.AmlOpcode == AML_BANK_FIELD_OP)
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Executing BankField Op=%p\n", Op));
Status = AcpiDsEvalBankFieldOperands (WalkState, Op);
if (ACPI_FAILURE (Status))
{
break;
}
}
break;

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: dswload - Dispatcher namespace load callbacks
* $Revision: 1.117 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -117,6 +116,7 @@
#define __DSWLOAD_C__
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "amlcode.h"
#include "acdispat.h"
@ -534,6 +534,15 @@ AcpiDsLoad1EndOp (
return_ACPI_STATUS (Status);
}
}
else if (Op->Common.AmlOpcode == AML_DATA_REGION_OP)
{
Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length,
REGION_DATA_TABLE, WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
}
#endif
@ -860,6 +869,13 @@ AcpiDsLoad2BeginOp (
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;
}
@ -922,6 +938,7 @@ AcpiDsLoad2EndOp (
ACPI_NAMESPACE_NODE *NewNode;
#ifndef ACPI_NO_METHOD_EXECUTION
UINT32 i;
UINT8 RegionSpace;
#endif
@ -1105,10 +1122,6 @@ AcpiDsLoad2EndOp (
Status = AcpiExCreateEvent (WalkState);
break;
case AML_DATA_REGION_OP:
Status = AcpiExCreateTableRegion (WalkState);
break;
case AML_ALIAS_OP:
@ -1139,6 +1152,17 @@ AcpiDsLoad2EndOp (
{
#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;
}
/*
* If we are executing a method, initialize the region
@ -1146,9 +1170,7 @@ AcpiDsLoad2EndOp (
if (WalkState->MethodNode)
{
Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length,
(ACPI_ADR_SPACE_TYPE)
((Op->Common.Value.Arg)->Common.Value.Integer),
WalkState);
RegionSpace, WalkState);
if (ACPI_FAILURE (Status))
{
return (Status);

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: dswscope - Scope stack manipulation
* $Revision: 1.69 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -117,6 +116,7 @@
#define __DSWSCOPE_C__
#include "acpi.h"
#include "accommon.h"
#include "acdispat.h"

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: dswstate - Dispatcher parse tree walk management routines
* $Revision: 1.101 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -118,6 +117,7 @@
#define __DSWSTATE_C__
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "acdispat.h"
#include "acnamesp.h"
@ -154,7 +154,7 @@ AcpiDsResultPop (
ACPI_OPERAND_OBJECT **Object,
ACPI_WALK_STATE *WalkState)
{
ACPI_NATIVE_UINT Index;
UINT32 Index;
ACPI_GENERIC_STATE *State;
ACPI_STATUS Status;
@ -189,7 +189,7 @@ AcpiDsResultPop (
/* Return object of the top element and clean that top element result stack */
WalkState->ResultCount--;
Index = WalkState->ResultCount % ACPI_RESULTS_FRAME_OBJ_NUM;
Index = (UINT32) WalkState->ResultCount % ACPI_RESULTS_FRAME_OBJ_NUM;
*Object = State->Results.ObjDesc [Index];
if (!*Object)
@ -212,7 +212,7 @@ AcpiDsResultPop (
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Obj=%p [%s] Index=%X State=%p Num=%X\n", *Object,
AcpiUtGetObjectTypeName (*Object),
(UINT32) Index, WalkState, WalkState->ResultCount));
Index, WalkState, WalkState->ResultCount));
return (AE_OK);
}
@ -238,7 +238,7 @@ AcpiDsResultPush (
{
ACPI_GENERIC_STATE *State;
ACPI_STATUS Status;
ACPI_NATIVE_UINT Index;
UINT32 Index;
ACPI_FUNCTION_NAME (DsResultPush);
@ -284,7 +284,7 @@ AcpiDsResultPush (
/* Assign the address of object to the top free element of result stack */
Index = WalkState->ResultCount % ACPI_RESULTS_FRAME_OBJ_NUM;
Index = (UINT32) WalkState->ResultCount % ACPI_RESULTS_FRAME_OBJ_NUM;
State->Results.ObjDesc [Index] = Object;
WalkState->ResultCount++;
@ -320,7 +320,7 @@ AcpiDsResultStackPush (
/* Check for stack overflow */
if ((WalkState->ResultSize + ACPI_RESULTS_FRAME_OBJ_NUM) >
if (((UINT32) WalkState->ResultSize + ACPI_RESULTS_FRAME_OBJ_NUM) >
ACPI_RESULTS_OBJ_NUM_MAX)
{
ACPI_ERROR ((AE_INFO, "Result stack overflow: State=%p Num=%X",
@ -517,7 +517,7 @@ AcpiDsObjStackPopAndDelete (
UINT32 PopCount,
ACPI_WALK_STATE *WalkState)
{
UINT32 i;
INT32 i;
ACPI_OPERAND_OBJECT *ObjDesc;
@ -529,7 +529,7 @@ AcpiDsObjStackPopAndDelete (
return;
}
for (i = (PopCount - 1); i >= 0; i--)
for (i = (INT32) PopCount - 1; i >= 0; i--)
{
if (WalkState->NumOperands == 0)
{
@ -763,16 +763,8 @@ AcpiDsInitAmlWalk (
if (Info)
{
if (Info->ParameterType == ACPI_PARAM_GPE)
{
WalkState->GpeEventInfo =
ACPI_CAST_PTR (ACPI_GPE_EVENT_INFO, Info->Parameters);
}
else
{
WalkState->Params = Info->Parameters;
WalkState->CallerReturnDesc = &Info->ReturnObject;
}
WalkState->Params = Info->Parameters;
WalkState->CallerReturnDesc = &Info->ReturnObject;
}
Status = AcpiPsInitScope (&WalkState->ParserState, Op);

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: evevent - Fixed Event handling and dispatch
* $Revision: 1.125 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -115,6 +114,7 @@
*****************************************************************************/
#include "acpi.h"
#include "accommon.h"
#include "acevents.h"
#define _COMPONENT ACPI_EVENTS
@ -155,8 +155,8 @@ AcpiEvInitializeEvents (
/*
* Initialize the Fixed and General Purpose Events. This is done prior to
* enabling SCIs to prevent interrupts from occurring before the handlers are
* installed.
* enabling SCIs to prevent interrupts from occurring before the handlers
* are installed.
*/
Status = AcpiEvFixedEventInitialize ();
if (ACPI_FAILURE (Status))
@ -281,7 +281,7 @@ AcpiEvInstallXruptHandlers (
*
* RETURN: Status
*
* DESCRIPTION: Install the fixed event handlers and enable the fixed events.
* DESCRIPTION: Install the fixed event handlers and disable all fixed events.
*
******************************************************************************/
@ -289,25 +289,26 @@ static ACPI_STATUS
AcpiEvFixedEventInitialize (
void)
{
ACPI_NATIVE_UINT i;
UINT32 i;
ACPI_STATUS Status;
/*
* Initialize the structure that keeps track of fixed event handlers
* and enable the fixed events.
* Initialize the structure that keeps track of fixed event handlers and
* enable the fixed events.
*/
for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
{
AcpiGbl_FixedEventHandlers[i].Handler = NULL;
AcpiGbl_FixedEventHandlers[i].Context = NULL;
/* Enable the fixed event */
/* Disable the fixed event */
if (AcpiGbl_FixedEventInfo[i].EnableRegisterId != 0xFF)
{
Status = AcpiSetRegister (
AcpiGbl_FixedEventInfo[i].EnableRegisterId, 0);
Status = AcpiWriteBitRegister (
AcpiGbl_FixedEventInfo[i].EnableRegisterId,
ACPI_DISABLE_EVENT);
if (ACPI_FAILURE (Status))
{
return (Status);
@ -338,7 +339,7 @@ AcpiEvFixedEventDetect (
UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED;
UINT32 FixedStatus;
UINT32 FixedEnable;
ACPI_NATIVE_UINT i;
UINT32 i;
ACPI_FUNCTION_NAME (EvFixedEventDetect);
@ -346,12 +347,10 @@ AcpiEvFixedEventDetect (
/*
* Read the fixed feature status and enable registers, as all the cases
* depend on their values. Ignore errors here.
* depend on their values. Ignore errors here.
*/
(void) AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS,
&FixedStatus);
(void) AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE,
&FixedEnable);
(void) AcpiHwRegisterRead (ACPI_REGISTER_PM1_STATUS, &FixedStatus);
(void) AcpiHwRegisterRead (ACPI_REGISTER_PM1_ENABLE, &FixedEnable);
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
"Fixed Event Block: Enable %08X Status %08X\n",
@ -369,7 +368,8 @@ AcpiEvFixedEventDetect (
{
/* Found an active (signalled) event */
IntStatus |= AcpiEvFixedEventDispatch ((UINT32) i);
AcpiFixedEventCount[i]++;
IntStatus |= AcpiEvFixedEventDispatch (i);
}
}
@ -395,21 +395,24 @@ AcpiEvFixedEventDispatch (
UINT32 Event)
{
ACPI_FUNCTION_ENTRY ();
/* Clear the status bit */
(void) AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId, 1);
(void) AcpiWriteBitRegister (
AcpiGbl_FixedEventInfo[Event].StatusRegisterId,
ACPI_CLEAR_STATUS);
/*
* Make sure we've got a handler. If not, report an error.
* The event is disabled to prevent further interrupts.
* Make sure we've got a handler. If not, report an error. The event is
* disabled to prevent further interrupts.
*/
if (NULL == AcpiGbl_FixedEventHandlers[Event].Handler)
{
(void) AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, 0);
(void) AcpiWriteBitRegister (
AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
ACPI_DISABLE_EVENT);
ACPI_ERROR ((AE_INFO,
"No installed handler for fixed event [%08X]",
@ -421,7 +424,7 @@ AcpiEvFixedEventDispatch (
/* Invoke the Fixed Event handler */
return ((AcpiGbl_FixedEventHandlers[Event].Handler)(
AcpiGbl_FixedEventHandlers[Event].Context));
AcpiGbl_FixedEventHandlers[Event].Context));
}

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: evgpe - General Purpose Event handling and dispatch
* $Revision: 1.68 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -115,6 +114,7 @@
*****************************************************************************/
#include "acpi.h"
#include "accommon.h"
#include "acevents.h"
#include "acnamesp.h"
@ -123,12 +123,12 @@
/* Local prototypes */
static void
AcpiEvAsynchEnableGpe (
static void ACPI_SYSTEM_XFACE
AcpiEvAsynchExecuteGpeMethod (
void *Context);
static void ACPI_SYSTEM_XFACE
AcpiEvAsynchExecuteGpeMethod (
AcpiEvAsynchEnableGpe (
void *Context);
@ -173,10 +173,10 @@ AcpiEvSetGpeType (
Status = AcpiEvDisableGpe (GpeEventInfo);
/* Type was validated above */
/* Clear the type bits and insert the new Type */
GpeEventInfo->Flags &= ~ACPI_GPE_TYPE_MASK; /* Clear type bits */
GpeEventInfo->Flags |= Type; /* Insert type */
GpeEventInfo->Flags &= ~ACPI_GPE_TYPE_MASK;
GpeEventInfo->Flags |= Type;
return_ACPI_STATUS (Status);
}
@ -212,10 +212,11 @@ AcpiEvUpdateGpeEnableMasks (
{
return_ACPI_STATUS (AE_NOT_EXIST);
}
RegisterBit = (UINT8)
(1 << (GpeEventInfo->GpeNumber - GpeRegisterInfo->BaseGpeNumber));
/* 1) Disable case. Simply clear all enable bits */
/* 1) Disable case. Simply clear all enable bits */
if (Type == ACPI_GPE_DISABLE)
{
@ -224,7 +225,7 @@ AcpiEvUpdateGpeEnableMasks (
return_ACPI_STATUS (AE_OK);
}
/* 2) Enable case. Set/Clear the appropriate enable bits */
/* 2) Enable case. Set/Clear the appropriate enable bits */
switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK)
{
@ -349,10 +350,11 @@ AcpiEvDisableGpe (
ACPI_FUNCTION_TRACE (EvDisableGpe);
if (!(GpeEventInfo->Flags & ACPI_GPE_ENABLE_MASK))
{
return_ACPI_STATUS (AE_OK);
}
/*
* Note: Always disable the GPE, even if we think that that it is already
* disabled. It is possible that the AML or some other code has enabled
* the GPE behind our back.
*/
/* Make sure HW enable masks are updated */
@ -362,15 +364,17 @@ AcpiEvDisableGpe (
return_ACPI_STATUS (Status);
}
/* Mark wake-disabled or HW disable, or both */
/* Clear the appropriate enabled flags for this GPE */
switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK)
{
case ACPI_GPE_TYPE_WAKE:
ACPI_CLEAR_BIT (GpeEventInfo->Flags, ACPI_GPE_WAKE_ENABLED);
break;
case ACPI_GPE_TYPE_WAKE_RUN:
ACPI_CLEAR_BIT (GpeEventInfo->Flags, ACPI_GPE_WAKE_ENABLED);
/*lint -fallthrough */
@ -380,14 +384,22 @@ AcpiEvDisableGpe (
/* Disable the requested runtime GPE */
ACPI_CLEAR_BIT (GpeEventInfo->Flags, ACPI_GPE_RUN_ENABLED);
Status = AcpiHwWriteGpeEnableReg (GpeEventInfo);
break;
default:
return_ACPI_STATUS (AE_BAD_PARAMETER);
break;
}
return_ACPI_STATUS (AE_OK);
/*
* Always H/W disable this GPE, even if we don't know the GPE type.
* Simply clear the enable bit for this particular GPE, but do not
* write out the current GPE enable mask since this may inadvertently
* enable GPEs too early. An example is a rogue GPE that has arrived
* during ACPICA initialization - possibly because AML or other code
* has enabled the GPE.
*/
Status = AcpiHwLowDisableGpe (GpeEventInfo);
return_ACPI_STATUS (Status);
}
@ -395,10 +407,10 @@ AcpiEvDisableGpe (
*
* FUNCTION: AcpiEvGetGpeEventInfo
*
* PARAMETERS: GpeDevice - Device node. NULL for GPE0/GPE1
* PARAMETERS: GpeDevice - Device node. NULL for GPE0/GPE1
* GpeNumber - Raw GPE number
*
* RETURN: A GPE EventInfo struct. NULL if not a valid GPE
* RETURN: A GPE EventInfo struct. NULL if not a valid GPE
*
* DESCRIPTION: Returns the EventInfo struct associated with this GPE.
* Validates the GpeBlock and the GpeNumber
@ -415,7 +427,7 @@ AcpiEvGetGpeEventInfo (
{
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_GPE_BLOCK_INFO *GpeBlock;
ACPI_NATIVE_UINT i;
UINT32 i;
ACPI_FUNCTION_ENTRY ();
@ -477,7 +489,7 @@ AcpiEvGetGpeEventInfo (
*
* RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
*
* DESCRIPTION: Detect if any GP events have occurred. This function is
* DESCRIPTION: Detect if any GP events have occurred. This function is
* executed at interrupt level.
*
******************************************************************************/
@ -494,8 +506,8 @@ AcpiEvGpeDetect (
UINT32 StatusReg;
UINT32 EnableReg;
ACPI_CPU_FLAGS Flags;
ACPI_NATIVE_UINT i;
ACPI_NATIVE_UINT j;
UINT32 i;
UINT32 j;
ACPI_FUNCTION_NAME (EvGpeDetect);
@ -509,8 +521,8 @@ AcpiEvGpeDetect (
/*
* We need to obtain the GPE lock for both the data structs and registers
* Note: Not necessary to obtain the hardware lock, since the GPE registers
* are owned by the GpeLock.
* Note: Not necessary to obtain the hardware lock, since the GPE
* registers are owned by the GpeLock.
*/
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
@ -520,9 +532,8 @@ AcpiEvGpeDetect (
while (GpeBlock)
{
/*
* Read all of the 8-bit GPE status and enable registers
* in this GPE block, saving all of them.
* Find all currently active GP events.
* Read all of the 8-bit GPE status and enable registers in this GPE
* block, saving all of them. Find all currently active GP events.
*/
for (i = 0; i < GpeBlock->RegisterCount; i++)
{
@ -532,8 +543,7 @@ AcpiEvGpeDetect (
/* Read the Status Register */
Status = AcpiHwLowLevelRead (ACPI_GPE_REGISTER_WIDTH, &StatusReg,
&GpeRegisterInfo->StatusAddress);
Status = AcpiRead (&StatusReg, &GpeRegisterInfo->StatusAddress);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
@ -541,8 +551,7 @@ AcpiEvGpeDetect (
/* Read the Enable Register */
Status = AcpiHwLowLevelRead (ACPI_GPE_REGISTER_WIDTH, &EnableReg,
&GpeRegisterInfo->EnableAddress);
Status = AcpiRead (&EnableReg, &GpeRegisterInfo->EnableAddress);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
@ -575,8 +584,9 @@ AcpiEvGpeDetect (
* or method.
*/
IntStatus |= AcpiEvGpeDispatch (
&GpeBlock->EventInfo[(i * ACPI_GPE_REGISTER_WIDTH) + j],
(UINT32) j + GpeRegisterInfo->BaseGpeNumber);
&GpeBlock->EventInfo[((ACPI_SIZE) i *
ACPI_GPE_REGISTER_WIDTH) + j],
j + GpeRegisterInfo->BaseGpeNumber);
}
}
}
@ -611,15 +621,25 @@ static void ACPI_SYSTEM_XFACE
AcpiEvAsynchExecuteGpeMethod (
void *Context)
{
ACPI_GPE_EVENT_INFO *GpeEventInfo = (void *) Context;
ACPI_GPE_EVENT_INFO *GpeEventInfo = Context;
ACPI_STATUS Status;
ACPI_GPE_EVENT_INFO LocalGpeEventInfo;
ACPI_GPE_EVENT_INFO *LocalGpeEventInfo;
ACPI_EVALUATE_INFO *Info;
ACPI_FUNCTION_TRACE (EvAsynchExecuteGpeMethod);
/* Allocate a local GPE block */
LocalGpeEventInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_EVENT_INFO));
if (!LocalGpeEventInfo)
{
ACPI_EXCEPTION ((AE_INFO, AE_NO_MEMORY,
"while handling a GPE"));
return_VOID;
}
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
@ -639,10 +659,10 @@ AcpiEvAsynchExecuteGpeMethod (
(void) AcpiEvEnableGpe (GpeEventInfo, FALSE);
/*
* Take a snapshot of the GPE info for this level - we copy the
* info to prevent a race condition with RemoveHandler/RemoveBlock.
* Take a snapshot of the GPE info for this level - we copy the info to
* prevent a race condition with RemoveHandler/RemoveBlock.
*/
ACPI_MEMCPY (&LocalGpeEventInfo, GpeEventInfo,
ACPI_MEMCPY (LocalGpeEventInfo, GpeEventInfo,
sizeof (ACPI_GPE_EVENT_INFO));
Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
@ -652,10 +672,10 @@ AcpiEvAsynchExecuteGpeMethod (
}
/*
* Must check for control method type dispatch one more
* time to avoid race with EvGpeInstallHandler
* Must check for control method type dispatch one more time to avoid a
* race with EvGpeInstallHandler
*/
if ((LocalGpeEventInfo.Flags & ACPI_GPE_DISPATCH_MASK) ==
if ((LocalGpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
ACPI_GPE_DISPATCH_METHOD)
{
/* Allocate the evaluation information block */
@ -671,9 +691,7 @@ AcpiEvAsynchExecuteGpeMethod (
* Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx
* control method that corresponds to this GPE
*/
Info->PrefixNode = LocalGpeEventInfo.Dispatch.MethodNode;
Info->Parameters = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT *, GpeEventInfo);
Info->ParameterType = ACPI_PARAM_GPE;
Info->PrefixNode = LocalGpeEventInfo->Dispatch.MethodNode;
Info->Flags = ACPI_IGNORE_RETURN_VALUE;
Status = AcpiNsEvaluate (Info);
@ -684,40 +702,64 @@ AcpiEvAsynchExecuteGpeMethod (
{
ACPI_EXCEPTION ((AE_INFO, Status,
"while evaluating GPE method [%4.4s]",
AcpiUtGetNodeName (LocalGpeEventInfo.Dispatch.MethodNode)));
AcpiUtGetNodeName (LocalGpeEventInfo->Dispatch.MethodNode)));
}
}
/* Defer enabling of GPE until all notify handlers are done */
AcpiOsExecute(OSL_NOTIFY_HANDLER, AcpiEvAsynchEnableGpe, GpeEventInfo);
Status = AcpiOsExecute (OSL_NOTIFY_HANDLER,
AcpiEvAsynchEnableGpe, LocalGpeEventInfo);
if (ACPI_FAILURE (Status))
{
ACPI_FREE (LocalGpeEventInfo);
}
return_VOID;
}
static void
/*******************************************************************************
*
* FUNCTION: AcpiEvAsynchEnableGpe
*
* PARAMETERS: Context (GpeEventInfo) - Info for this GPE
*
* RETURN: None
*
* DESCRIPTION: Asynchronous clear/enable for GPE. This allows the GPE to
* complete (i.e., finish execution of Notify)
*
******************************************************************************/
static void ACPI_SYSTEM_XFACE
AcpiEvAsynchEnableGpe (
void *Context)
{
ACPI_GPE_EVENT_INFO *GpeEventInfo = (void *) Context;
ACPI_GPE_EVENT_INFO *GpeEventInfo = Context;
ACPI_STATUS Status;
if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
ACPI_GPE_LEVEL_TRIGGERED)
{
/*
* GPE is level-triggered, we clear the GPE status bit after
* handling the event.
* GPE is level-triggered, we clear the GPE status bit after handling
* the event.
*/
Status = AcpiHwClearGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
return_VOID;
goto Exit;
}
}
/* Enable this GPE */
(void) AcpiHwWriteGpeEnableReg (GpeEventInfo);
return_VOID;
Exit:
ACPI_FREE (GpeEventInfo);
return;
}
@ -751,7 +793,7 @@ AcpiEvGpeDispatch (
AcpiGpeCount++;
/*
* If edge-triggered, clear the GPE status bit now. Note that
* If edge-triggered, clear the GPE status bit now. Note that
* level-triggered events are cleared after the GPE is serviced.
*/
if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
@ -766,18 +808,6 @@ AcpiEvGpeDispatch (
}
}
if (!AcpiGbl_SystemAwakeAndRunning)
{
/*
* We just woke up because of a wake GPE. Disable any further GPEs
* until we are fully up and running (Only wake GPEs should be enabled
* at this time, but we just brute-force disable them all.)
* 1) We must disable this particular wake GPE so it won't fire again
* 2) We want to disable all wake GPEs, since we are now awake
*/
(void) AcpiHwDisableAllGpes ();
}
/*
* Dispatch the GPE to either an installed handler, or the control method
* associated with this GPE (_Lxx or _Exx). If a handler exists, we invoke
@ -791,7 +821,8 @@ AcpiEvGpeDispatch (
/*
* Invoke the installed handler (at interrupt level)
* Ignore return status for now. TBD: leave GPE disabled on error?
* Ignore return status for now.
* TBD: leave GPE disabled on error?
*/
(void) GpeEventInfo->Dispatch.Handler->Address (
GpeEventInfo->Dispatch.Handler->Context);
@ -848,7 +879,7 @@ AcpiEvGpeDispatch (
GpeNumber));
/*
* Disable the GPE. The GPE will remain disabled until the ACPI
* Disable the GPE. The GPE will remain disabled until the ACPICA
* Core Subsystem is restarted, or a handler is installed.
*/
Status = AcpiEvDisableGpe (GpeEventInfo);

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: evgpeblk - GPE block creation and initialization.
* $Revision: 1.60 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -115,6 +114,7 @@
*****************************************************************************/
#include "acpi.h"
#include "accommon.h"
#include "acevents.h"
#include "acnamesp.h"
@ -194,7 +194,8 @@ AcpiEvValidGpeEvent (
while (GpeBlock)
{
if ((&GpeBlock->EventInfo[0] <= GpeEventInfo) &&
(&GpeBlock->EventInfo[((ACPI_SIZE) GpeBlock->RegisterCount) * 8] > GpeEventInfo))
(&GpeBlock->EventInfo[((ACPI_SIZE)
GpeBlock->RegisterCount) * 8] > GpeEventInfo))
{
return (TRUE);
}
@ -214,6 +215,7 @@ AcpiEvValidGpeEvent (
* FUNCTION: AcpiEvWalkGpeList
*
* PARAMETERS: GpeWalkCallback - Routine called for each GPE block
* Context - Value passed to callback
*
* RETURN: Status
*
@ -223,7 +225,8 @@ AcpiEvValidGpeEvent (
ACPI_STATUS
AcpiEvWalkGpeList (
ACPI_GPE_CALLBACK GpeWalkCallback)
ACPI_GPE_CALLBACK GpeWalkCallback,
void *Context)
{
ACPI_GPE_BLOCK_INFO *GpeBlock;
ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
@ -248,9 +251,13 @@ AcpiEvWalkGpeList (
{
/* One callback per GPE block */
Status = GpeWalkCallback (GpeXruptInfo, GpeBlock);
Status = GpeWalkCallback (GpeXruptInfo, GpeBlock, Context);
if (ACPI_FAILURE (Status))
{
if (Status == AE_CTRL_END) /* Callback abort */
{
Status = AE_OK;
}
goto UnlockAndExit;
}
@ -283,11 +290,12 @@ AcpiEvWalkGpeList (
ACPI_STATUS
AcpiEvDeleteGpeHandlers (
ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
ACPI_GPE_BLOCK_INFO *GpeBlock)
ACPI_GPE_BLOCK_INFO *GpeBlock,
void *Context)
{
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_NATIVE_UINT i;
ACPI_NATIVE_UINT j;
UINT32 i;
UINT32 j;
ACPI_FUNCTION_TRACE (EvDeleteGpeHandlers);
@ -301,7 +309,8 @@ AcpiEvDeleteGpeHandlers (
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
{
GpeEventInfo = &GpeBlock->EventInfo[(i * ACPI_GPE_REGISTER_WIDTH) + j];
GpeEventInfo = &GpeBlock->EventInfo[((ACPI_SIZE) i *
ACPI_GPE_REGISTER_WIDTH) + j];
if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
ACPI_GPE_DISPATCH_HANDLER)
@ -387,7 +396,8 @@ AcpiEvSaveMethodInfo (
/* Unknown method type, just ignore it! */
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,
"Ignoring unknown GPE method type: %s (name not of form _Lxx or _Exx)",
"Ignoring unknown GPE method type: %s "
"(name not of form _Lxx or _Exx)",
Name));
return_ACPI_STATUS (AE_OK);
}
@ -400,7 +410,8 @@ AcpiEvSaveMethodInfo (
/* Conversion failed; invalid method, just ignore it */
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,
"Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)",
"Could not extract GPE number from name: %s "
"(name is not of form _Lxx or _Exx)",
Name));
return_ACPI_STATUS (AE_OK);
}
@ -408,20 +419,21 @@ AcpiEvSaveMethodInfo (
/* Ensure that we have a valid GPE number for this GPE block */
if ((GpeNumber < GpeBlock->BlockBaseNumber) ||
(GpeNumber >= (GpeBlock->BlockBaseNumber + (GpeBlock->RegisterCount * 8))))
(GpeNumber >= (GpeBlock->BlockBaseNumber +
(GpeBlock->RegisterCount * 8))))
{
/*
* Not valid for this GPE block, just ignore it
* However, it may be valid for a different GPE block, since GPE0 and GPE1
* methods both appear under \_GPE.
* Not valid for this GPE block, just ignore it. However, it may be
* valid for a different GPE block, since GPE0 and GPE1 methods both
* appear under \_GPE.
*/
return_ACPI_STATUS (AE_OK);
}
/*
* Now we can add this information to the GpeEventInfo block
* for use during dispatch of this GPE. Default type is RUNTIME, although
* this may change when the _PRW methods are executed later.
* Now we can add this information to the GpeEventInfo block for use
* during dispatch of this GPE. Default type is RUNTIME, although this may
* change when the _PRW methods are executed later.
*/
GpeEventInfo = &GpeBlock->EventInfo[GpeNumber - GpeBlock->BlockBaseNumber];
@ -501,12 +513,12 @@ AcpiEvMatchPrwAndGpe (
GpeBlock = GpeInfo->GpeBlock;
/*
* The _PRW object must return a package, we are only interested
* in the first element
* The _PRW object must return a package, we are only interested in the
* first element
*/
ObjDesc = PkgDesc->Package.Elements[0];
if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER)
if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER)
{
/* Use FADT-defined GPE device (from definition of _PRW) */
@ -516,13 +528,15 @@ AcpiEvMatchPrwAndGpe (
GpeNumber = (UINT32) ObjDesc->Integer.Value;
}
else if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_PACKAGE)
else if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE)
{
/* Package contains a GPE reference and GPE number within a GPE block */
if ((ObjDesc->Package.Count < 2) ||
(ACPI_GET_OBJECT_TYPE (ObjDesc->Package.Elements[0]) != ACPI_TYPE_LOCAL_REFERENCE) ||
(ACPI_GET_OBJECT_TYPE (ObjDesc->Package.Elements[1]) != ACPI_TYPE_INTEGER))
((ObjDesc->Package.Elements[0])->Common.Type !=
ACPI_TYPE_LOCAL_REFERENCE) ||
((ObjDesc->Package.Elements[1])->Common.Type !=
ACPI_TYPE_INTEGER))
{
goto Cleanup;
}
@ -542,16 +556,18 @@ AcpiEvMatchPrwAndGpe (
/*
* Is this GPE within this block?
*
* TRUE iff these conditions are true:
* TRUE if and only if these conditions are true:
* 1) The GPE devices match.
* 2) The GPE index(number) is within the range of the Gpe Block
* associated with the GPE device.
*/
if ((GpeDevice == TargetGpeDevice) &&
(GpeNumber >= GpeBlock->BlockBaseNumber) &&
(GpeNumber < GpeBlock->BlockBaseNumber + (GpeBlock->RegisterCount * 8)))
(GpeNumber < GpeBlock->BlockBaseNumber +
(GpeBlock->RegisterCount * 8)))
{
GpeEventInfo = &GpeBlock->EventInfo[GpeNumber - GpeBlock->BlockBaseNumber];
GpeEventInfo = &GpeBlock->EventInfo[GpeNumber -
GpeBlock->BlockBaseNumber];
/* Mark GPE for WAKE-ONLY but WAKE_DISABLED */
@ -562,6 +578,7 @@ AcpiEvMatchPrwAndGpe (
{
goto Cleanup;
}
Status = AcpiEvUpdateGpeEnableMasks (GpeEventInfo, ACPI_GPE_DISABLE);
}
@ -580,9 +597,9 @@ AcpiEvMatchPrwAndGpe (
* RETURN: A GPE interrupt block
*
* DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt
* block per unique interrupt level used for GPEs.
* Should be called only when the GPE lists are semaphore locked
* and not subject to change.
* block per unique interrupt level used for GPEs. Should be
* called only when the GPE lists are semaphore locked and not
* subject to change.
*
******************************************************************************/
@ -709,6 +726,12 @@ AcpiEvDeleteGpeXrupt (
{
GpeXrupt->Previous->Next = GpeXrupt->Next;
}
else
{
/* No previous, update list head */
AcpiGbl_GpeXruptListHead = GpeXrupt->Next;
}
if (GpeXrupt->Next)
{
@ -727,8 +750,9 @@ AcpiEvDeleteGpeXrupt (
*
* FUNCTION: AcpiEvInstallGpeBlock
*
* PARAMETERS: GpeBlock - New GPE block
* InterruptNumber - Xrupt to be associated with this GPE block
* PARAMETERS: GpeBlock - New GPE block
* InterruptNumber - Xrupt to be associated with this
* GPE block
*
* RETURN: Status
*
@ -796,7 +820,7 @@ AcpiEvInstallGpeBlock (
*
* FUNCTION: AcpiEvDeleteGpeBlock
*
* PARAMETERS: GpeBlock - Existing GPE block
* PARAMETERS: GpeBlock - Existing GPE block
*
* RETURN: Status
*
@ -823,7 +847,7 @@ AcpiEvDeleteGpeBlock (
/* Disable all GPEs in this block */
Status = AcpiHwDisableGpeBlock (GpeBlock->XruptBlock, GpeBlock);
Status = AcpiHwDisableGpeBlock (GpeBlock->XruptBlock, GpeBlock, NULL);
if (!GpeBlock->Previous && !GpeBlock->Next)
{
@ -856,6 +880,8 @@ AcpiEvDeleteGpeBlock (
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
}
AcpiCurrentGpeCount -= GpeBlock->RegisterCount * ACPI_GPE_REGISTER_WIDTH;
/* Free the GpeBlock */
ACPI_FREE (GpeBlock->RegisterInfo);
@ -888,8 +914,8 @@ AcpiEvCreateGpeInfoBlocks (
ACPI_GPE_EVENT_INFO *GpeEventInfo = NULL;
ACPI_GPE_EVENT_INFO *ThisEvent;
ACPI_GPE_REGISTER_INFO *ThisRegister;
ACPI_NATIVE_UINT i;
ACPI_NATIVE_UINT j;
UINT32 i;
UINT32 j;
ACPI_STATUS Status;
@ -931,9 +957,9 @@ AcpiEvCreateGpeInfoBlocks (
/*
* Initialize the GPE Register and Event structures. A goal of these
* tables is to hide the fact that there are two separate GPE register sets
* in a given GPE hardware block, the status registers occupy the first half,
* and the enable registers occupy the second half.
* tables is to hide the fact that there are two separate GPE register
* sets in a given GPE hardware block, the status registers occupy the
* first half, and the enable registers occupy the second half.
*/
ThisRegister = GpeRegisterInfo;
ThisEvent = GpeEventInfo;
@ -955,8 +981,8 @@ AcpiEvCreateGpeInfoBlocks (
ThisRegister->EnableAddress.SpaceId = GpeBlock->BlockAddress.SpaceId;
ThisRegister->StatusAddress.BitWidth = ACPI_GPE_REGISTER_WIDTH;
ThisRegister->EnableAddress.BitWidth = ACPI_GPE_REGISTER_WIDTH;
ThisRegister->StatusAddress.BitOffset = ACPI_GPE_REGISTER_WIDTH;
ThisRegister->EnableAddress.BitOffset = ACPI_GPE_REGISTER_WIDTH;
ThisRegister->StatusAddress.BitOffset = 0;
ThisRegister->EnableAddress.BitOffset = 0;
/* Init the EventInfo for each GPE within this register */
@ -969,8 +995,7 @@ AcpiEvCreateGpeInfoBlocks (
/* Disable all GPEs within this register */
Status = AcpiHwLowLevelWrite (ACPI_GPE_REGISTER_WIDTH, 0x00,
&ThisRegister->EnableAddress);
Status = AcpiWrite (0x00, &ThisRegister->EnableAddress);
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
@ -978,8 +1003,7 @@ AcpiEvCreateGpeInfoBlocks (
/* Clear any pending GPE events within this register */
Status = AcpiHwLowLevelWrite (ACPI_GPE_REGISTER_WIDTH, 0xFF,
&ThisRegister->StatusAddress);
Status = AcpiWrite (0xFF, &ThisRegister->StatusAddress);
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
@ -1104,6 +1128,9 @@ AcpiEvCreateGpeBlock (
GpeBlock->RegisterCount,
InterruptNumber));
/* Update global count of currently available GPEs */
AcpiCurrentGpeCount += RegisterCount * ACPI_GPE_REGISTER_WIDTH;
return_ACPI_STATUS (AE_OK);
}
@ -1134,8 +1161,8 @@ AcpiEvInitializeGpeBlock (
ACPI_GPE_WALK_INFO GpeInfo;
UINT32 WakeGpeCount;
UINT32 GpeEnabledCount;
ACPI_NATIVE_UINT i;
ACPI_NATIVE_UINT j;
UINT32 i;
UINT32 j;
ACPI_FUNCTION_TRACE (EvInitializeGpeBlock);
@ -1173,8 +1200,8 @@ AcpiEvInitializeGpeBlock (
* 1) are "runtime" or "run/wake" GPEs, and
* 2) have a corresponding _Lxx or _Exx method
*
* Any other GPEs within this block must be enabled via the AcpiEnableGpe()
* external interface.
* Any other GPEs within this block must be enabled via the
* AcpiEnableGpe() external interface.
*/
WakeGpeCount = 0;
GpeEnabledCount = 0;
@ -1185,9 +1212,11 @@ AcpiEvInitializeGpeBlock (
{
/* Get the info block for this particular GPE */
GpeEventInfo = &GpeBlock->EventInfo[(i * ACPI_GPE_REGISTER_WIDTH) + j];
GpeEventInfo = &GpeBlock->EventInfo[((ACPI_SIZE) i *
ACPI_GPE_REGISTER_WIDTH) + j];
if (((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_METHOD) &&
if (((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
ACPI_GPE_DISPATCH_METHOD) &&
(GpeEventInfo->Flags & ACPI_GPE_TYPE_RUNTIME))
{
GpeEnabledCount++;
@ -1206,7 +1235,7 @@ AcpiEvInitializeGpeBlock (
/* Enable all valid runtime GPEs found above */
Status = AcpiHwEnableRuntimeGpeBlock (NULL, GpeBlock);
Status = AcpiHwEnableRuntimeGpeBlock (NULL, GpeBlock, NULL);
if (ACPI_FAILURE (Status))
{
ACPI_ERROR ((AE_INFO, "Could not enable GPEs in GpeBlock %p",
@ -1251,8 +1280,8 @@ AcpiEvGpeInitialize (
/*
* Initialize the GPE Block(s) defined in the FADT
*
* Why the GPE register block lengths are divided by 2: From the ACPI Spec,
* section "General-Purpose Event Registers", we have:
* Why the GPE register block lengths are divided by 2: From the ACPI
* Spec, section "General-Purpose Event Registers", we have:
*
* "Each register block contains two registers of equal length
* GPEx_STS and GPEx_EN (where x is 0 or 1). The length of the
@ -1308,7 +1337,8 @@ AcpiEvGpeInitialize (
(GpeNumberMax >= AcpiGbl_FADT.Gpe1Base))
{
ACPI_ERROR ((AE_INFO,
"GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d) - Ignoring GPE1",
"GPE0 block (GPE 0 to %d) overlaps the GPE1 block "
"(GPE %d to %d) - Ignoring GPE1",
GpeNumberMax, AcpiGbl_FADT.Gpe1Base,
AcpiGbl_FADT.Gpe1Base +
((RegisterCount1 * ACPI_GPE_REGISTER_WIDTH) - 1)));

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: evmisc - Miscellaneous event manager support functions
* $Revision: 1.103 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -115,6 +114,7 @@
*****************************************************************************/
#include "acpi.h"
#include "accommon.h"
#include "acevents.h"
#include "acnamesp.h"
#include "acinterp.h"
@ -123,26 +123,6 @@
ACPI_MODULE_NAME ("evmisc")
/* Names for Notify() values, used for debug output */
#ifdef ACPI_DEBUG_OUTPUT
static const char *AcpiNotifyValueNames[] =
{
"Bus Check",
"Device Check",
"Device Wake",
"Eject Request",
"Device Check Light",
"Frequency Mismatch",
"Bus Mode Mismatch",
"Power Fault"
};
#endif
/* Pointer to FACS needed for the Global Lock */
static ACPI_TABLE_FACS *Facs = NULL;
/* Local prototypes */
static void ACPI_SYSTEM_XFACE
@ -180,7 +160,6 @@ AcpiEvIsNotifyObject (
{
case ACPI_TYPE_DEVICE:
case ACPI_TYPE_PROCESSOR:
case ACPI_TYPE_POWER:
case ACPI_TYPE_THERMAL:
/*
* These are the ONLY objects that can receive ACPI notifications
@ -229,19 +208,9 @@ AcpiEvQueueNotifyRequest (
* initiate soft-off or sleep operation?
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Dispatching Notify(%X) on node %p\n", NotifyValue, Node));
if (NotifyValue <= 7)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: %s\n",
AcpiNotifyValueNames[NotifyValue]));
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Notify value: 0x%2.2X **Device Specific**\n",
NotifyValue));
}
"Dispatching Notify on [%4.4s] Node %p Value 0x%2.2X (%s)\n",
AcpiUtGetNodeName (Node), Node, NotifyValue,
AcpiUtGetNotifyName (NotifyValue)));
/* Get the notify object attached to the NS Node */
@ -252,10 +221,11 @@ AcpiEvQueueNotifyRequest (
switch (Node->Type)
{
/* Notify allowed only on these types */
case ACPI_TYPE_DEVICE:
case ACPI_TYPE_THERMAL:
case ACPI_TYPE_PROCESSOR:
case ACPI_TYPE_POWER:
if (NotifyValue <= ACPI_MAX_SYS_NOTIFY)
{
@ -268,15 +238,24 @@ AcpiEvQueueNotifyRequest (
break;
default:
/* All other types are not supported */
return (AE_TYPE);
}
}
/* If there is any handler to run, schedule the dispatcher */
if ((AcpiGbl_SystemNotify.Handler && (NotifyValue <= ACPI_MAX_SYS_NOTIFY)) ||
(AcpiGbl_DeviceNotify.Handler && (NotifyValue > ACPI_MAX_SYS_NOTIFY)) ||
/*
* If there is any handler to run, schedule the dispatcher.
* Check for:
* 1) Global system notify handler
* 2) Global device notify handler
* 3) Per-device notify handler
*/
if ((AcpiGbl_SystemNotify.Handler &&
(NotifyValue <= ACPI_MAX_SYS_NOTIFY)) ||
(AcpiGbl_DeviceNotify.Handler &&
(NotifyValue > ACPI_MAX_SYS_NOTIFY)) ||
HandlerObj)
{
NotifyInfo = AcpiUtCreateGenericState ();
@ -285,6 +264,14 @@ AcpiEvQueueNotifyRequest (
return (AE_NO_MEMORY);
}
if (!HandlerObj)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Executing system notify handler for Notify (%4.4s, %X) "
"node %p\n",
AcpiUtGetNodeName (Node), NotifyValue, Node));
}
NotifyInfo->Common.DescriptorType = ACPI_DESC_TYPE_STATE_NOTIFY;
NotifyInfo->Notify.Node = Node;
NotifyInfo->Notify.Value = (UINT16) NotifyValue;
@ -297,15 +284,12 @@ AcpiEvQueueNotifyRequest (
AcpiUtDeleteGenericState (NotifyInfo);
}
}
if (!HandlerObj)
else
{
/*
* There is no per-device notify handler for this device.
* This may or may not be a problem.
*/
/* There is no notify handler (per-device or system) for this device */
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"No notify handler for Notify(%4.4s, %X) node %p\n",
"No notify handler for Notify (%4.4s, %X) node %p\n",
AcpiUtGetNodeName (Node), NotifyValue, Node));
}
@ -340,9 +324,8 @@ AcpiEvNotifyDispatch (
/*
* We will invoke a global notify handler if installed.
* This is done _before_ we invoke the per-device handler attached
* to the device.
* We will invoke a global notify handler if installed. This is done
* _before_ we invoke the per-device handler attached to the device.
*/
if (NotifyInfo->Notify.Value <= ACPI_MAX_SYS_NOTIFY)
{
@ -421,7 +404,7 @@ AcpiEvGlobalLockHandler (
* If we don't get it now, it will be marked pending and we will
* take another interrupt when it becomes free.
*/
ACPI_ACQUIRE_GLOBAL_LOCK (Facs, Acquired);
ACPI_ACQUIRE_GLOBAL_LOCK (AcpiGbl_FACS, Acquired);
if (Acquired)
{
/* Got the lock, now wake the thread waiting for it */
@ -463,23 +446,16 @@ AcpiEvInitGlobalLockHandler (
ACPI_FUNCTION_TRACE (EvInitGlobalLockHandler);
Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS,
ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Facs));
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Attempt installation of the global lock handler */
AcpiGbl_GlobalLockPresent = TRUE;
Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL,
AcpiEvGlobalLockHandler, NULL);
/*
* If the global lock does not exist on this platform, the attempt
* to enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick)
* Map to AE_OK, but mark global lock as not present.
* Any attempt to actually use the global lock will be flagged
* with an error.
* If the global lock does not exist on this platform, the attempt to
* enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick).
* Map to AE_OK, but mark global lock as not present. Any attempt to
* actually use the global lock will be flagged with an error.
*/
if (Status == AE_NO_HARDWARE_RESPONSE)
{
@ -487,9 +463,10 @@ AcpiEvInitGlobalLockHandler (
"No response from Global Lock hardware, disabling lock"));
AcpiGbl_GlobalLockPresent = FALSE;
Status = AE_OK;
return_ACPI_STATUS (AE_OK);
}
AcpiGbl_GlobalLockPresent = TRUE;
return_ACPI_STATUS (Status);
}
@ -582,8 +559,8 @@ AcpiEvAcquireGlobalLock (
}
/*
* Make sure that a global lock actually exists. If not, just treat
* the lock as a standard mutex.
* Make sure that a global lock actually exists. If not, just treat the
* lock as a standard mutex.
*/
if (!AcpiGbl_GlobalLockPresent)
{
@ -593,7 +570,7 @@ AcpiEvAcquireGlobalLock (
/* Attempt to acquire the actual hardware lock */
ACPI_ACQUIRE_GLOBAL_LOCK (Facs, Acquired);
ACPI_ACQUIRE_GLOBAL_LOCK (AcpiGbl_FACS, Acquired);
if (Acquired)
{
/* We got the lock */
@ -657,7 +634,7 @@ AcpiEvReleaseGlobalLock (
{
/* Allow any thread to release the lock */
ACPI_RELEASE_GLOBAL_LOCK (Facs, Pending);
ACPI_RELEASE_GLOBAL_LOCK (AcpiGbl_FACS, Pending);
/*
* If the pending bit was set, we must write GBL_RLS to the control
@ -665,8 +642,8 @@ AcpiEvReleaseGlobalLock (
*/
if (Pending)
{
Status = AcpiSetRegister (
ACPI_BITREG_GLOBAL_LOCK_RELEASE, 1);
Status = AcpiWriteBitRegister (
ACPI_BITREG_GLOBAL_LOCK_RELEASE, ACPI_ENABLE_EVENT);
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Released hardware Global Lock\n"));
@ -697,7 +674,7 @@ void
AcpiEvTerminate (
void)
{
ACPI_NATIVE_UINT i;
UINT32 i;
ACPI_STATUS Status;
@ -707,15 +684,15 @@ AcpiEvTerminate (
if (AcpiGbl_EventsInitialized)
{
/*
* Disable all event-related functionality.
* In all cases, on error, print a message but obviously we don't abort.
* Disable all event-related functionality. In all cases, on error,
* print a message but obviously we don't abort.
*/
/* Disable all fixed events */
for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
{
Status = AcpiDisableEvent ((UINT32) i, 0);
Status = AcpiDisableEvent (i, 0);
if (ACPI_FAILURE (Status))
{
ACPI_ERROR ((AE_INFO,
@ -725,7 +702,7 @@ AcpiEvTerminate (
/* Disable all GPEs in all GPE blocks */
Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock);
Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock, NULL);
/* Remove SCI handler */
@ -746,7 +723,7 @@ AcpiEvTerminate (
/* Deallocate all handler objects installed within GPE info structs */
Status = AcpiEvWalkGpeList (AcpiEvDeleteGpeHandlers);
Status = AcpiEvWalkGpeList (AcpiEvDeleteGpeHandlers, NULL);
/* Return to original mode if necessary */

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: evregion - ACPI AddressSpace (OpRegion) handler dispatch
* $Revision: 1.168 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -118,6 +117,7 @@
#define __EVREGION_C__
#include "acpi.h"
#include "accommon.h"
#include "acevents.h"
#include "acnamesp.h"
#include "acinterp.h"
@ -125,15 +125,6 @@
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evregion")
#define ACPI_NUM_DEFAULT_SPACES 4
static UINT8 AcpiGbl_DefaultAddressSpaces[ACPI_NUM_DEFAULT_SPACES] =
{
ACPI_ADR_SPACE_SYSTEM_MEMORY,
ACPI_ADR_SPACE_SYSTEM_IO,
ACPI_ADR_SPACE_PCI_CONFIG,
ACPI_ADR_SPACE_DATA_TABLE
};
/* Local prototypes */
@ -151,6 +142,18 @@ AcpiEvInstallHandler (
void *Context,
void **ReturnValue);
/* These are the address spaces that will get default handlers */
#define ACPI_NUM_DEFAULT_SPACES 4
static UINT8 AcpiGbl_DefaultAddressSpaces[ACPI_NUM_DEFAULT_SPACES] =
{
ACPI_ADR_SPACE_SYSTEM_MEMORY,
ACPI_ADR_SPACE_SYSTEM_IO,
ACPI_ADR_SPACE_PCI_CONFIG,
ACPI_ADR_SPACE_DATA_TABLE
};
/*******************************************************************************
*
@ -169,7 +172,7 @@ AcpiEvInstallRegionHandlers (
void)
{
ACPI_STATUS Status;
ACPI_NATIVE_UINT i;
UINT32 i;
ACPI_FUNCTION_TRACE (EvInstallRegionHandlers);
@ -182,18 +185,19 @@ AcpiEvInstallRegionHandlers (
}
/*
* All address spaces (PCI Config, EC, SMBus) are scope dependent
* and registration must occur for a specific device.
* All address spaces (PCI Config, EC, SMBus) are scope dependent and
* registration must occur for a specific device.
*
* In the case of the system memory and IO address spaces there is currently
* no device associated with the address space. For these we use the root.
* In the case of the system memory and IO address spaces there is
* currently no device associated with the address space. For these we
* use the root.
*
* We install the default PCI config space handler at the root so
* that this space is immediately available even though the we have
* not enumerated all the PCI Root Buses yet. This is to conform
* to the ACPI specification which states that the PCI config
* space must be always available -- even though we are nowhere
* near ready to find the PCI root buses at this point.
* We install the default PCI config space handler at the root so that
* this space is immediately available even though the we have not
* enumerated all the PCI Root Buses yet. This is to conform to the ACPI
* specification which states that the PCI config space must be always
* available -- even though we are nowhere near ready to find the PCI root
* buses at this point.
*
* NOTE: We ignore AE_ALREADY_EXISTS because this means that a handler
* has already been installed (via AcpiInstallAddressSpaceHandler).
@ -245,7 +249,7 @@ AcpiEvInitializeOpRegions (
void)
{
ACPI_STATUS Status;
ACPI_NATIVE_UINT i;
UINT32 i;
ACPI_FUNCTION_TRACE (EvInitializeOpRegions);
@ -257,12 +261,12 @@ AcpiEvInitializeOpRegions (
return_ACPI_STATUS (Status);
}
/*
* Run the _REG methods for OpRegions in each default address space
*/
/* Run the _REG methods for OpRegions in each default address space */
for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++)
{
/* TBD: Make sure handler is the DEFAULT handler, otherwise
/*
* TBD: Make sure handler is the DEFAULT handler, otherwise
* _REG will have already been run.
*/
Status = AcpiEvExecuteRegMethods (AcpiGbl_RootNode,
@ -323,7 +327,6 @@ AcpiEvExecuteRegMethod (
Info->PrefixNode = RegionObj2->Extra.Method_REG;
Info->Pathname = NULL;
Info->Parameters = Args;
Info->ParameterType = ACPI_PARAM_ARGS;
Info->Flags = ACPI_IGNORE_RETURN_VALUE;
/*
@ -379,7 +382,7 @@ AcpiEvExecuteRegMethod (
*
* PARAMETERS: RegionObj - Internal region object
* Function - Read or Write operation
* Address - Where in the space to read or write
* RegionOffset - Where in the region to read or write
* BitWidth - Field width in bits (8, 16, 32, or 64)
* Value - Pointer to in or out value, must be
* full 64-bit ACPI_INTEGER
@ -395,7 +398,7 @@ ACPI_STATUS
AcpiEvAddressSpaceDispatch (
ACPI_OPERAND_OBJECT *RegionObj,
UINT32 Function,
ACPI_PHYSICAL_ADDRESS Address,
UINT32 RegionOffset,
UINT32 BitWidth,
ACPI_INTEGER *Value)
{
@ -430,14 +433,13 @@ AcpiEvAddressSpaceDispatch (
}
/*
* It may be the case that the region has never been initialized
* It may be the case that the region has never been initialized.
* Some types of regions require special init code
*/
if (!(RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE))
{
/*
* This region has not been initialized yet, do it
*/
/* This region has not been initialized yet, do it */
RegionSetup = HandlerDesc->AddressSpace.Setup;
if (!RegionSetup)
{
@ -450,18 +452,18 @@ AcpiEvAddressSpaceDispatch (
}
/*
* We must exit the interpreter because the region
* setup will potentially execute control methods
* (e.g., _REG method for this region)
* We must exit the interpreter because the region setup will
* potentially execute control methods (for example, the _REG method
* for this region)
*/
AcpiExRelinquishInterpreter ();
AcpiExExitInterpreter ();
Status = RegionSetup (RegionObj, ACPI_REGION_ACTIVATE,
HandlerDesc->AddressSpace.Context, &RegionContext);
/* Re-enter the interpreter */
AcpiExReacquireInterpreter ();
AcpiExEnterInterpreter ();
/* Check for failure of the Region Setup */
@ -473,9 +475,8 @@ AcpiEvAddressSpaceDispatch (
return_ACPI_STATUS (Status);
}
/*
* Region initialization may have been completed by RegionSetup
*/
/* Region initialization may have been completed by RegionSetup */
if (!(RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE))
{
RegionObj->Region.Flags |= AOPOBJ_SETUP_COMPLETE;
@ -504,7 +505,7 @@ AcpiEvAddressSpaceDispatch (
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
"Handler %p (@%p) Address %8.8X%8.8X [%s]\n",
&RegionObj->Region.Handler->AddressSpace, Handler,
ACPI_FORMAT_UINT64 (Address),
ACPI_FORMAT_NATIVE_UINT (RegionObj->Region.Address + RegionOffset),
AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
if (!(HandlerDesc->AddressSpace.HandlerFlags &
@ -515,12 +516,13 @@ AcpiEvAddressSpaceDispatch (
* exit the interpreter because the handler *might* block -- we don't
* know what it will do, so we can't hold the lock on the intepreter.
*/
AcpiExRelinquishInterpreter();
AcpiExExitInterpreter();
}
/* Call the handler */
Status = Handler (Function, Address, BitWidth, Value,
Status = Handler (Function,
(RegionObj->Region.Address + RegionOffset), BitWidth, Value,
HandlerDesc->AddressSpace.Context, RegionObj2->Extra.RegionContext);
if (ACPI_FAILURE (Status))
@ -536,7 +538,7 @@ AcpiEvAddressSpaceDispatch (
* We just returned from a non-default handler, we must re-enter the
* interpreter
*/
AcpiExReacquireInterpreter ();
AcpiExEnterInterpreter ();
}
return_ACPI_STATUS (Status);
@ -609,7 +611,7 @@ AcpiEvDetachRegion(
/* This is it, remove it from the handler's list */
*LastObjPtr = ObjDesc->Region.Next;
ObjDesc->Region.Next = NULL; /* Must clear field */
ObjDesc->Region.Next = NULL; /* Must clear field */
if (AcpiNsIsLocked)
{
@ -639,8 +641,8 @@ AcpiEvDetachRegion(
}
/*
* If the region has been activated, call the setup handler
* with the deactivate notification
* If the region has been activated, call the setup handler with
* the deactivate notification
*/
if (RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE)
{
@ -793,8 +795,8 @@ AcpiEvInstallHandler (
}
/*
* We only care about regions.and objects
* that are allowed to have address space handlers
* We only care about regions and objects that are allowed to have
* address space handlers
*/
if ((Node->Type != ACPI_TYPE_DEVICE) &&
(Node->Type != ACPI_TYPE_REGION) &&
@ -815,7 +817,7 @@ AcpiEvInstallHandler (
/* Devices are handled different than regions */
if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_DEVICE)
if (ObjDesc->Common.Type == ACPI_TYPE_DEVICE)
{
/* Check if this Device already has a handler for this address space */
@ -824,19 +826,21 @@ AcpiEvInstallHandler (
{
/* Found a handler, is it for the same address space? */
if (NextHandlerObj->AddressSpace.SpaceId == HandlerObj->AddressSpace.SpaceId)
if (NextHandlerObj->AddressSpace.SpaceId ==
HandlerObj->AddressSpace.SpaceId)
{
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
"Found handler for region [%s] in device %p(%p) handler %p\n",
"Found handler for region [%s] in device %p(%p) "
"handler %p\n",
AcpiUtGetRegionName (HandlerObj->AddressSpace.SpaceId),
ObjDesc, NextHandlerObj, HandlerObj));
/*
* Since the object we found it on was a device, then it
* means that someone has already installed a handler for
* the branch of the namespace from this device on. Just
* the branch of the namespace from this device on. Just
* bail out telling the walk routine to not traverse this
* branch. This preserves the scoping rule for handlers.
* branch. This preserves the scoping rule for handlers.
*/
return (AE_CTRL_DEPTH);
}
@ -847,9 +851,8 @@ AcpiEvInstallHandler (
}
/*
* As long as the device didn't have a handler for this
* space we don't care about it. We just ignore it and
* proceed.
* As long as the device didn't have a handler for this space we
* don't care about it. We just ignore it and proceed.
*/
return (AE_OK);
}
@ -858,16 +861,13 @@ AcpiEvInstallHandler (
if (ObjDesc->Region.SpaceId != HandlerObj->AddressSpace.SpaceId)
{
/*
* This region is for a different address space
* -- just ignore it
*/
/* This region is for a different address space, just ignore it */
return (AE_OK);
}
/*
* Now we have a region and it is for the handler's address
* space type.
* Now we have a region and it is for the handler's address space type.
*
* First disconnect region for any previous handler (if any)
*/
@ -916,9 +916,8 @@ AcpiEvInstallSpaceHandler (
/*
* This registration is valid for only the types below
* and the root. This is where the default handlers
* get placed.
* This registration is valid for only the types below and the root. This
* is where the default handlers get placed.
*/
if ((Node->Type != ACPI_TYPE_DEVICE) &&
(Node->Type != ACPI_TYPE_PROCESSOR) &&
@ -984,8 +983,8 @@ AcpiEvInstallSpaceHandler (
if (ObjDesc)
{
/*
* The attached device object already exists.
* Make sure the handler is not already installed.
* The attached device object already exists. Make sure the handler
* is not already installed.
*/
HandlerObj = ObjDesc->Device.Handler;
@ -1001,8 +1000,8 @@ AcpiEvInstallSpaceHandler (
{
/*
* It is (relatively) OK to attempt to install the SAME
* handler twice. This can easily happen
* with PCI_Config space.
* handler twice. This can easily happen with the
* PCI_Config space.
*/
Status = AE_SAME_HANDLER;
goto UnlockAndExit;
@ -1070,9 +1069,8 @@ AcpiEvInstallSpaceHandler (
/*
* Install the handler
*
* At this point there is no existing handler.
* Just allocate the object for the handler and link it
* into the list.
* At this point there is no existing handler. Just allocate the object
* for the handler and link it into the list.
*/
HandlerObj = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_ADDRESS_HANDLER);
if (!HandlerObj)
@ -1148,11 +1146,10 @@ AcpiEvExecuteRegMethods (
/*
* Run all _REG methods for all Operation Regions for this
* space ID. This is a separate walk in order to handle any
* interdependencies between regions and _REG methods. (i.e. handlers
* must be installed for all regions of this Space ID before we
* can run any _REG methods)
* Run all _REG methods for all Operation Regions for this space ID. This
* is a separate walk in order to handle any interdependencies between
* regions and _REG methods. (i.e. handlers must be installed for all
* regions of this Space ID before we can run any _REG methods)
*/
Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, ACPI_UINT32_MAX,
ACPI_NS_WALK_UNLOCK, AcpiEvRegRun,
@ -1196,8 +1193,8 @@ AcpiEvRegRun (
}
/*
* We only care about regions.and objects
* that are allowed to have address space handlers
* We only care about regions.and objects that are allowed to have address
* space handlers
*/
if ((Node->Type != ACPI_TYPE_REGION) &&
(Node != AcpiGbl_RootNode))
@ -1219,10 +1216,8 @@ AcpiEvRegRun (
if (ObjDesc->Region.SpaceId != SpaceId)
{
/*
* This region is for a different address space
* -- just ignore it
*/
/* This region is for a different address space, just ignore it */
return (AE_OK);
}

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: evrgnini- ACPI AddressSpace (OpRegion) init
* $Revision: 1.88 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -118,6 +117,7 @@
#define __EVRGNINI_C__
#include "acpi.h"
#include "accommon.h"
#include "acevents.h"
#include "acnamesp.h"
@ -335,16 +335,17 @@ AcpiEvPciConfigRegionSetup (
if (Status == AE_SAME_HANDLER)
{
/*
* It is OK if the handler is already installed on the root
* bridge. Still need to return a context object for the
* new PCI_Config operation region, however.
* It is OK if the handler is already installed on the
* root bridge. Still need to return a context object
* for the new PCI_Config operation region, however.
*/
Status = AE_OK;
}
else
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Could not install PciConfig handler for Root Bridge %4.4s",
"Could not install PciConfig handler "
"for Root Bridge %4.4s",
AcpiUtGetNodeName (PciRootNode)));
}
}
@ -379,8 +380,8 @@ AcpiEvPciConfigRegionSetup (
}
/*
* For PCI_Config space access, we need the segment, bus,
* device and function numbers. Acquire them here.
* For PCI_Config space access, we need the segment, bus, device and
* function numbers. Acquire them here.
*
* Find the parent device object. (This allows the operation region to be
* within a subscope under the device, such as a control method.)
@ -393,18 +394,20 @@ AcpiEvPciConfigRegionSetup (
if (!PciDeviceNode)
{
ACPI_FREE (PciId);
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
/*
* Get the PCI device and function numbers from the _ADR object
* contained in the parent's scope.
* Get the PCI device and function numbers from the _ADR object contained
* in the parent's scope.
*/
Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, PciDeviceNode, &PciValue);
Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR,
PciDeviceNode, &PciValue);
/*
* The default is zero, and since the allocation above zeroed
* the data, just do nothing on failure.
* The default is zero, and since the allocation above zeroed the data,
* just do nothing on failure.
*/
if (ACPI_SUCCESS (Status))
{
@ -414,7 +417,8 @@ AcpiEvPciConfigRegionSetup (
/* The PCI segment number comes from the _SEG method */
Status = AcpiUtEvaluateNumericObject (METHOD_NAME__SEG, PciRootNode, &PciValue);
Status = AcpiUtEvaluateNumericObject (METHOD_NAME__SEG,
PciRootNode, &PciValue);
if (ACPI_SUCCESS (Status))
{
PciId->Segment = ACPI_LOWORD (PciValue);
@ -422,7 +426,8 @@ AcpiEvPciConfigRegionSetup (
/* The PCI bus number comes from the _BBN method */
Status = AcpiUtEvaluateNumericObject (METHOD_NAME__BBN, PciRootNode, &PciValue);
Status = AcpiUtEvaluateNumericObject (METHOD_NAME__BBN,
PciRootNode, &PciValue);
if (ACPI_SUCCESS (Status))
{
PciId->Bus = ACPI_LOWORD (PciValue);
@ -493,12 +498,11 @@ AcpiEvIsPciRootBridge (
ACPI_STATUS Status;
ACPI_DEVICE_ID Hid;
ACPI_COMPATIBLE_ID_LIST *Cid;
ACPI_NATIVE_UINT i;
UINT32 i;
/*
* Get the _HID and check for a PCI Root Bridge
*/
/* Get the _HID and check for a PCI Root Bridge */
Status = AcpiUtExecute_HID (Node, &Hid);
if (ACPI_FAILURE (Status))
{
@ -510,10 +514,8 @@ AcpiEvIsPciRootBridge (
return (TRUE);
}
/*
* The _HID did not match.
* Get the _CID and check for a PCI Root Bridge
*/
/* The _HID did not match. Get the _CID and check for a PCI Root Bridge */
Status = AcpiUtExecute_CID (Node, &Cid);
if (ACPI_FAILURE (Status))
{
@ -651,9 +653,9 @@ AcpiEvDefaultRegionSetup (
* Get the appropriate address space handler for a newly
* created region.
*
* This also performs address space specific initialization. For
* This also performs address space specific initialization. For
* example, PCI regions must have an _ADR object that contains
* a PCI address in the scope of the definition. This address is
* a PCI address in the scope of the definition. This address is
* required to perform an access to PCI config space.
*
* MUTEX: Interpreter should be unlocked, because we may run the _REG
@ -713,7 +715,7 @@ AcpiEvInitializeRegion (
{
/*
* The _REG method is optional and there can be only one per region
* definition. This will be executed when the handler is attached
* definition. This will be executed when the handler is attached
* or removed
*/
RegionObj2->Extra.Method_REG = MethodNode;
@ -771,8 +773,8 @@ AcpiEvInitializeRegion (
AcpiNsLocked);
/*
* Tell all users that this region is usable by running the _REG
* method
* Tell all users that this region is usable by
* running the _REG method
*/
if (AcpiNsLocked)
{
@ -803,10 +805,8 @@ AcpiEvInitializeRegion (
}
}
/*
* This node does not have the handler we need;
* Pop up one level
*/
/* This node does not have the handler we need; Pop up one level */
Node = AcpiNsGetParentNode (Node);
}

View File

@ -2,7 +2,6 @@
*
* Module Name: evsci - System Control Interrupt configuration and
* legacy to ACPI mode state transition functions
* $Revision: 1.102 $
*
******************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -117,6 +116,7 @@
*****************************************************************************/
#include "acpi.h"
#include "accommon.h"
#include "acevents.h"
@ -171,6 +171,7 @@ AcpiEvSciXruptHandler (
*/
InterruptHandled |= AcpiEvGpeDetect (GpeXruptList);
AcpiSciCount++;
return_UINT32 (InterruptHandled);
}
@ -203,10 +204,8 @@ AcpiEvGpeXruptHandler (
* if this interrupt handler is installed, ACPI is enabled.
*/
/*
* GPEs:
* Check for and dispatch any GPEs that have occurred
*/
/* GPEs: Check for and dispatch any GPEs that have occurred */
InterruptHandled |= AcpiEvGpeDetect (GpeXruptList);
return_UINT32 (InterruptHandled);
@ -250,11 +249,11 @@ AcpiEvInstallSciHandler (
* RETURN: E_OK if handler uninstalled OK, E_ERROR if handler was not
* installed to begin with
*
* DESCRIPTION: Remove the SCI interrupt handler. No further SCIs will be
* DESCRIPTION: Remove the SCI interrupt handler. No further SCIs will be
* taken.
*
* Note: It doesn't seem important to disable all events or set the event
* enable registers to their original values. The OS should disable
* enable registers to their original values. The OS should disable
* the SCI interrupt level when the handler is removed, so no more
* events will come in.
*

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: evxface - External interfaces for ACPI events
* $Revision: 1.165 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -118,6 +117,7 @@
#define __EVXFACE_C__
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
#include "acevents.h"
#include "acinterp.h"
@ -378,7 +378,7 @@ AcpiInstallNotifyHandler (
/*
* Root Object:
* Registering a notify handler on the root object indicates that the
* caller wishes to receive notifications for all objects. Note that
* caller wishes to receive notifications for all objects. Note that
* only one <external> global handler can be regsitered (per notify type).
*/
if (Device == ACPI_ROOT_OBJECT)
@ -727,7 +727,8 @@ AcpiInstallGpeHandler (
/* Make sure that there isn't a handler there already */
if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER)
if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
ACPI_GPE_DISPATCH_HANDLER)
{
Status = AE_ALREADY_EXISTS;
goto UnlockAndExit;
@ -761,7 +762,7 @@ AcpiInstallGpeHandler (
/* Setup up dispatch flags to indicate handler (vs. method) */
GpeEventInfo->Flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); /* Clear bits */
GpeEventInfo->Flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK);
GpeEventInfo->Flags |= (UINT8) (Type | ACPI_GPE_DISPATCH_HANDLER);
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
@ -829,7 +830,8 @@ AcpiRemoveGpeHandler (
/* Make sure that a handler is indeed installed */
if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) != ACPI_GPE_DISPATCH_HANDLER)
if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) !=
ACPI_GPE_DISPATCH_HANDLER)
{
Status = AE_NOT_EXIST;
goto UnlockAndExit;

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
* $Revision: 1.93 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -118,6 +117,7 @@
#define __EVXFEVNT_C__
#include "acpi.h"
#include "accommon.h"
#include "acevents.h"
#include "acnamesp.h"
#include "actables.h"
@ -125,6 +125,14 @@
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evxfevnt")
/* Local prototypes */
static ACPI_STATUS
AcpiEvGetGpeDevice (
ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
ACPI_GPE_BLOCK_INFO *GpeBlock,
void *Context);
/*******************************************************************************
*
@ -264,10 +272,12 @@ AcpiEnableEvent (
}
/*
* Enable the requested fixed event (by writing a one to the
* enable register bit)
* Enable the requested fixed event (by writing a one to the enable
* register bit)
*/
Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, 1);
Status = AcpiWriteBitRegister (
AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
ACPI_ENABLE_EVENT);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -275,8 +285,8 @@ AcpiEnableEvent (
/* Make sure that the hardware responded */
Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
&Value);
Status = AcpiReadBitRegister (
AcpiGbl_FixedEventInfo[Event].EnableRegisterId, &Value);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -504,17 +514,19 @@ AcpiDisableEvent (
}
/*
* Disable the requested fixed event (by writing a zero to the
* enable register bit)
* Disable the requested fixed event (by writing a zero to the enable
* register bit)
*/
Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, 0);
Status = AcpiWriteBitRegister (
AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
ACPI_DISABLE_EVENT);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
&Value);
Status = AcpiReadBitRegister (
AcpiGbl_FixedEventInfo[Event].EnableRegisterId, &Value);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -563,10 +575,12 @@ AcpiClearEvent (
}
/*
* Clear the requested fixed event (By writing a one to the
* status register bit)
* Clear the requested fixed event (By writing a one to the status
* register bit)
*/
Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId, 1);
Status = AcpiWriteBitRegister (
AcpiGbl_FixedEventInfo[Event].StatusRegisterId,
ACPI_CLEAR_STATUS);
return_ACPI_STATUS (Status);
}
@ -673,8 +687,8 @@ AcpiGetEventStatus (
/* Get the status of the requested fixed event */
Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId,
EventStatus);
Status = AcpiReadBitRegister (
AcpiGbl_FixedEventInfo[Event].StatusRegisterId, EventStatus);
return_ACPI_STATUS (Status);
}
@ -803,7 +817,7 @@ AcpiInstallGpeBlock (
* is always zero
*/
Status = AcpiEvCreateGpeBlock (Node, GpeBlockAddress, RegisterCount,
0, InterruptNumber, &GpeBlock);
0, InterruptNumber, &GpeBlock);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
@ -922,3 +936,177 @@ AcpiRemoveGpeBlock (
ACPI_EXPORT_SYMBOL (AcpiRemoveGpeBlock)
/*******************************************************************************
*
* FUNCTION: AcpiGetGpeDevice
*
* PARAMETERS: Index - System GPE index (0-CurrentGpeCount)
* GpeDevice - Where the parent GPE Device is returned
*
* RETURN: Status
*
* DESCRIPTION: Obtain the GPE device associated with the input index. A NULL
* gpe device indicates that the gpe number is contained in one of
* the FADT-defined gpe blocks. Otherwise, the GPE block device.
*
******************************************************************************/
ACPI_STATUS
AcpiGetGpeDevice (
UINT32 Index,
ACPI_HANDLE *GpeDevice)
{
ACPI_GPE_DEVICE_INFO Info;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (AcpiGetGpeDevice);
if (!GpeDevice)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
if (Index >= AcpiCurrentGpeCount)
{
return_ACPI_STATUS (AE_NOT_EXIST);
}
/* Setup and walk the GPE list */
Info.Index = Index;
Info.Status = AE_NOT_EXIST;
Info.GpeDevice = NULL;
Info.NextBlockBaseIndex = 0;
Status = AcpiEvWalkGpeList (AcpiEvGetGpeDevice, &Info);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
*GpeDevice = ACPI_CAST_PTR (ACPI_HANDLE, Info.GpeDevice);
return_ACPI_STATUS (Info.Status);
}
ACPI_EXPORT_SYMBOL (AcpiGetGpeDevice)
/*******************************************************************************
*
* FUNCTION: AcpiEvGetGpeDevice
*
* PARAMETERS: GPE_WALK_CALLBACK
*
* RETURN: Status
*
* DESCRIPTION: Matches the input GPE index (0-CurrentGpeCount) with a GPE
* block device. NULL if the GPE is one of the FADT-defined GPEs.
*
******************************************************************************/
static ACPI_STATUS
AcpiEvGetGpeDevice (
ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
ACPI_GPE_BLOCK_INFO *GpeBlock,
void *Context)
{
ACPI_GPE_DEVICE_INFO *Info = Context;
/* Increment Index by the number of GPEs in this block */
Info->NextBlockBaseIndex +=
(GpeBlock->RegisterCount * ACPI_GPE_REGISTER_WIDTH);
if (Info->Index < Info->NextBlockBaseIndex)
{
/*
* The GPE index is within this block, get the node. Leave the node
* NULL for the FADT-defined GPEs
*/
if ((GpeBlock->Node)->Type == ACPI_TYPE_DEVICE)
{
Info->GpeDevice = GpeBlock->Node;
}
Info->Status = AE_OK;
return (AE_CTRL_END);
}
return (AE_OK);
}
/******************************************************************************
*
* FUNCTION: AcpiDisableAllGpes
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Disable and clear all GPEs in all GPE blocks
*
******************************************************************************/
ACPI_STATUS
AcpiDisableAllGpes (
void)
{
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (AcpiDisableAllGpes);
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
Status = AcpiHwDisableAllGpes ();
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
return_ACPI_STATUS (Status);
}
/******************************************************************************
*
* FUNCTION: AcpiEnableAllRuntimeGpes
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks
*
******************************************************************************/
ACPI_STATUS
AcpiEnableAllRuntimeGpes (
void)
{
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (AcpiEnableAllRuntimeGpes);
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
Status = AcpiHwEnableAllRuntimeGpes ();
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
return_ACPI_STATUS (Status);
}

View File

@ -2,7 +2,6 @@
*
* Module Name: evxfregn - External Interfaces, ACPI Operation Regions and
* Address Spaces.
* $Revision: 1.70 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -118,6 +117,7 @@
#define __EVXFREGN_C__
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
#include "acevents.h"
@ -285,7 +285,8 @@ AcpiRemoveAddressSpaceHandler (
/* Matched SpaceId, first dereference this in the Regions */
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
"Removing address handler %p(%p) for region %s on Device %p(%p)\n",
"Removing address handler %p(%p) for region %s "
"on Device %p(%p)\n",
HandlerObj, Handler, AcpiUtGetRegionName (SpaceId),
Node, ObjDesc));

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes)
* $Revision: 1.103 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -118,12 +117,12 @@
#define __EXCONFIG_C__
#include "acpi.h"
#include "accommon.h"
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "acevents.h"
#include "actables.h"
#include "acdispat.h"
#include "acevents.h"
#define _COMPONENT ACPI_EXECUTER
@ -133,10 +132,16 @@
static ACPI_STATUS
AcpiExAddTable (
ACPI_NATIVE_UINT TableIndex,
UINT32 TableIndex,
ACPI_NAMESPACE_NODE *ParentNode,
ACPI_OPERAND_OBJECT **DdbHandle);
static ACPI_STATUS
AcpiExRegionRead (
ACPI_OPERAND_OBJECT *ObjDesc,
UINT32 Length,
UINT8 *Buffer);
/*******************************************************************************
*
@ -155,7 +160,7 @@ AcpiExAddTable (
static ACPI_STATUS
AcpiExAddTable (
ACPI_NATIVE_UINT TableIndex,
UINT32 TableIndex,
ACPI_NAMESPACE_NODE *ParentNode,
ACPI_OPERAND_OBJECT **DdbHandle)
{
@ -176,12 +181,13 @@ AcpiExAddTable (
/* Init the table handle */
ObjDesc->Reference.Opcode = AML_LOAD_OP;
ObjDesc->Common.Flags |= AOPOBJ_DATA_VALID;
ObjDesc->Reference.Class = ACPI_REFCLASS_TABLE;
*DdbHandle = ObjDesc;
/* Install the new table into the local data structures */
ObjDesc->Reference.Object = ACPI_CAST_PTR (void, TableIndex);
ObjDesc->Reference.Value = TableIndex;
/* Add the table to the namespace */
@ -216,17 +222,26 @@ AcpiExLoadTableOp (
{
ACPI_STATUS Status;
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
ACPI_NATIVE_UINT TableIndex;
ACPI_NAMESPACE_NODE *ParentNode;
ACPI_NAMESPACE_NODE *StartNode;
ACPI_NAMESPACE_NODE *ParameterNode = NULL;
ACPI_OPERAND_OBJECT *DdbHandle;
ACPI_TABLE_HEADER *Table;
UINT32 TableIndex;
ACPI_FUNCTION_TRACE (ExLoadTableOp);
/* Validate lengths for the SignatureString, OEMIDString, OEMTableID */
if ((Operand[0]->String.Length > ACPI_NAME_SIZE) ||
(Operand[1]->String.Length > ACPI_OEM_ID_SIZE) ||
(Operand[2]->String.Length > ACPI_OEM_TABLE_ID_SIZE))
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Find the ACPI table in the RSDT/XSDT */
Status = AcpiTbFindTable (Operand[0]->String.Pointer,
@ -318,6 +333,8 @@ AcpiExLoadTableOp (
if (ACPI_FAILURE (Status))
{
(void) AcpiExUnloadTable (DdbHandle);
AcpiUtRemoveReference (DdbHandle);
return_ACPI_STATUS (Status);
}
}
@ -326,15 +343,70 @@ AcpiExLoadTableOp (
if (ACPI_SUCCESS (Status))
{
ACPI_INFO ((AE_INFO,
"Dynamic OEM Table Load - [%4.4s] OemId [%6.6s] OemTableId [%8.8s]",
"Dynamic OEM Table Load - [%.4s] OemId [%.6s] OemTableId [%.8s]",
Table->Signature, Table->OemId, Table->OemTableId));
}
/* Invoke table handler if present */
if (AcpiGbl_TableHandler)
{
(void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table,
AcpiGbl_TableHandlerContext);
}
*ReturnDesc = DdbHandle;
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiExRegionRead
*
* PARAMETERS: ObjDesc - Region descriptor
* Length - Number of bytes to read
* Buffer - Pointer to where to put the data
*
* RETURN: Status
*
* DESCRIPTION: Read data from an operation region. The read starts from the
* beginning of the region.
*
******************************************************************************/
static ACPI_STATUS
AcpiExRegionRead (
ACPI_OPERAND_OBJECT *ObjDesc,
UINT32 Length,
UINT8 *Buffer)
{
ACPI_STATUS Status;
ACPI_INTEGER Value;
UINT32 RegionOffset = 0;
UINT32 i;
/* Bytewise reads */
for (i = 0; i < Length; i++)
{
Status = AcpiEvAddressSpaceDispatch (ObjDesc, ACPI_READ,
RegionOffset, 8, &Value);
if (ACPI_FAILURE (Status))
{
return (Status);
}
*Buffer = (UINT8) Value;
Buffer++;
RegionOffset++;
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiExLoadOp
@ -363,23 +435,27 @@ AcpiExLoadOp (
ACPI_WALK_STATE *WalkState)
{
ACPI_OPERAND_OBJECT *DdbHandle;
ACPI_TABLE_HEADER *Table;
ACPI_TABLE_DESC TableDesc;
ACPI_NATIVE_UINT TableIndex;
UINT32 TableIndex;
ACPI_STATUS Status;
UINT32 Length;
ACPI_FUNCTION_TRACE (ExLoadOp);
ACPI_MEMSET (&TableDesc, 0, sizeof (ACPI_TABLE_DESC));
TableDesc.Flags = ACPI_TABLE_ORIGIN_ALLOCATED;
/* Source Object can be either an OpRegion or a Buffer/Field */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_REGION:
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Load table from Region %p\n", ObjDesc));
/* Region must be SystemMemory (from ACPI spec) */
if (ObjDesc->Region.SpaceId != ACPI_ADR_SPACE_SYSTEM_MEMORY)
@ -387,9 +463,6 @@ AcpiExLoadOp (
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Region %p %s\n",
ObjDesc, AcpiUtGetObjectTypeName (ObjDesc)));
/*
* If the Region Address and Length have not been previously evaluated,
* evaluate them now and save the results.
@ -403,39 +476,145 @@ AcpiExLoadOp (
}
}
/* Get the table header first so we can get the table length */
Table = ACPI_ALLOCATE (sizeof (ACPI_TABLE_HEADER));
if (!Table)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
Status = AcpiExRegionRead (ObjDesc, sizeof (ACPI_TABLE_HEADER),
ACPI_CAST_PTR (UINT8, Table));
Length = Table->Length;
ACPI_FREE (Table);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Must have at least an ACPI table header */
if (Length < sizeof (ACPI_TABLE_HEADER))
{
return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);
}
/*
* The original implementation simply mapped the table, with no copy.
* However, the memory region is not guaranteed to remain stable and
* we must copy the table to a local buffer. For example, the memory
* region is corrupted after suspend on some machines. Dynamically
* loaded tables are usually small, so this overhead is minimal.
*
* The latest implementation (5/2009) does not use a mapping at all.
* We use the low-level operation region interface to read the table
* instead of the obvious optimization of using a direct mapping.
* This maintains a consistent use of operation regions across the
* entire subsystem. This is important if additional processing must
* be performed in the (possibly user-installed) operation region
* handler. For example, AcpiExec and ASLTS depend on this.
*/
/* Allocate a buffer for the table */
TableDesc.Pointer = ACPI_ALLOCATE (Length);
if (!TableDesc.Pointer)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Read the entire table */
Status = AcpiExRegionRead (ObjDesc, Length,
ACPI_CAST_PTR (UINT8, TableDesc.Pointer));
if (ACPI_FAILURE (Status))
{
ACPI_FREE (TableDesc.Pointer);
return_ACPI_STATUS (Status);
}
TableDesc.Address = ObjDesc->Region.Address;
TableDesc.Length = ObjDesc->Region.Length;
TableDesc.Flags = ACPI_TABLE_ORIGIN_MAPPED;
break;
case ACPI_TYPE_BUFFER: /* Buffer or resolved RegionField */
/* Simply extract the buffer from the buffer object */
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Load table from Buffer or Field %p\n", ObjDesc));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Buffer or Field %p %s\n",
ObjDesc, AcpiUtGetObjectTypeName (ObjDesc)));
/* Must have at least an ACPI table header */
TableDesc.Pointer = ACPI_CAST_PTR (ACPI_TABLE_HEADER,
ObjDesc->Buffer.Pointer);
TableDesc.Length = TableDesc.Pointer->Length;
TableDesc.Flags = ACPI_TABLE_ORIGIN_ALLOCATED;
if (ObjDesc->Buffer.Length < sizeof (ACPI_TABLE_HEADER))
{
return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);
}
ObjDesc->Buffer.Pointer = NULL;
/* Get the actual table length from the table header */
Table = ACPI_CAST_PTR (ACPI_TABLE_HEADER, ObjDesc->Buffer.Pointer);
Length = Table->Length;
/* Table cannot extend beyond the buffer */
if (Length > ObjDesc->Buffer.Length)
{
return_ACPI_STATUS (AE_AML_BUFFER_LIMIT);
}
if (Length < sizeof (ACPI_TABLE_HEADER))
{
return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);
}
/*
* Copy the table from the buffer because the buffer could be modified
* or even deleted in the future
*/
TableDesc.Pointer = ACPI_ALLOCATE (Length);
if (!TableDesc.Pointer)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
ACPI_MEMCPY (TableDesc.Pointer, Table, Length);
TableDesc.Address = ACPI_TO_INTEGER (TableDesc.Pointer);
break;
default:
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
/*
* Install the new table into the local data structures
*/
/* Validate table checksum (will not get validated in TbAddTable) */
Status = AcpiTbVerifyChecksum (TableDesc.Pointer, Length);
if (ACPI_FAILURE (Status))
{
ACPI_FREE (TableDesc.Pointer);
return_ACPI_STATUS (Status);
}
/* Complete the table descriptor */
TableDesc.Length = Length;
TableDesc.Flags = ACPI_TABLE_ORIGIN_ALLOCATED;
/* Install the new table into the local data structures */
Status = AcpiTbAddTable (&TableDesc, &TableIndex);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
/*
* Add the table to the namespace.
*
* Note: Load the table objects relative to the root of the namespace.
* This appears to go against the ACPI specification, but we do it for
* compatibility with other ACPI implementations.
*/
Status = AcpiExAddTable (TableIndex, AcpiGbl_RootNode, &DdbHandle);
if (ACPI_FAILURE (Status))
{
@ -453,12 +632,27 @@ AcpiExLoadOp (
/* TablePtr was deallocated above */
AcpiUtRemoveReference (DdbHandle);
return_ACPI_STATUS (Status);
}
/* Remove the reference by added by AcpiExStore above */
AcpiUtRemoveReference (DdbHandle);
/* Invoke table handler if present */
if (AcpiGbl_TableHandler)
{
(void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, TableDesc.Pointer,
AcpiGbl_TableHandlerContext);
}
Cleanup:
if (ACPI_FAILURE (Status))
{
/* Delete allocated table buffer */
AcpiTbDeleteTable (&TableDesc);
}
return_ACPI_STATUS (Status);
@ -483,7 +677,8 @@ AcpiExUnloadTable (
{
ACPI_STATUS Status = AE_OK;
ACPI_OPERAND_OBJECT *TableDesc = DdbHandle;
ACPI_NATIVE_UINT TableIndex;
UINT32 TableIndex;
ACPI_TABLE_HEADER *Table;
ACPI_FUNCTION_TRACE (ExUnloadTable);
@ -491,33 +686,61 @@ AcpiExUnloadTable (
/*
* Validate the handle
* Although the handle is partially validated in AcpiExReconfiguration(),
* Although the handle is partially validated in AcpiExReconfiguration()
* when it calls AcpiExResolveOperands(), the handle is more completely
* validated here.
*
* Handle must be a valid operand object of type reference. Also, the
* DdbHandle must still be marked valid (table has not been previously
* unloaded)
*/
if ((!DdbHandle) ||
(ACPI_GET_DESCRIPTOR_TYPE (DdbHandle) != ACPI_DESC_TYPE_OPERAND) ||
(ACPI_GET_OBJECT_TYPE (DdbHandle) != ACPI_TYPE_LOCAL_REFERENCE))
(DdbHandle->Common.Type != ACPI_TYPE_LOCAL_REFERENCE) ||
(!(DdbHandle->Common.Flags & AOPOBJ_DATA_VALID)))
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Get the table index from the DdbHandle */
TableIndex = (ACPI_NATIVE_UINT) TableDesc->Reference.Object;
TableIndex = TableDesc->Reference.Value;
/*
* Delete the entire namespace under this table Node
* (Offset contains the TableId)
*/
AcpiTbDeleteNamespaceByOwner (TableIndex);
AcpiTbReleaseOwnerId (TableIndex);
/* Ensure the table is still loaded */
if (!AcpiTbIsTableLoaded (TableIndex))
{
return_ACPI_STATUS (AE_NOT_EXIST);
}
/* Invoke table handler if present */
if (AcpiGbl_TableHandler)
{
Status = AcpiGetTableByIndex (TableIndex, &Table);
if (ACPI_SUCCESS (Status))
{
(void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_UNLOAD, Table,
AcpiGbl_TableHandlerContext);
}
}
/* Delete the portion of the namespace owned by this table */
Status = AcpiTbDeleteNamespaceByOwner (TableIndex);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
(void) AcpiTbReleaseOwnerId (TableIndex);
AcpiTbSetTableLoadedFlag (TableIndex, FALSE);
/* Delete the table descriptor (DdbHandle) */
AcpiUtRemoveReference (TableDesc);
return_ACPI_STATUS (Status);
/*
* Invalidate the handle. We do this because the handle may be stored
* in a named object and may not be actually deleted until much later.
*/
DdbHandle->Common.Flags &= ~AOPOBJ_DATA_VALID;
return_ACPI_STATUS (AE_OK);
}

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: exconvrt - Object conversion routines
* $Revision: 1.74 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -118,6 +117,7 @@
#define __EXCONVRT_C__
#include "acpi.h"
#include "accommon.h"
#include "acinterp.h"
#include "amlcode.h"
@ -139,7 +139,7 @@ AcpiExConvertToAscii (
*
* FUNCTION: AcpiExConvertToInteger
*
* PARAMETERS: ObjDesc - Object to be converted. Must be an
* PARAMETERS: ObjDesc - Object to be converted. Must be an
* Integer, Buffer, or String
* ResultDesc - Where the new Integer object is returned
* Flags - Used for string conversion
@ -167,7 +167,7 @@ AcpiExConvertToInteger (
ACPI_FUNCTION_TRACE_PTR (ExConvertToInteger, ObjDesc);
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_INTEGER:
@ -190,7 +190,7 @@ AcpiExConvertToInteger (
}
/*
* Convert the buffer/string to an integer. Note that both buffers and
* Convert the buffer/string to an integer. Note that both buffers and
* strings are treated as raw data - we don't convert ascii to hex for
* strings.
*
@ -202,13 +202,13 @@ AcpiExConvertToInteger (
/* String conversion is different than Buffer conversion */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_STRING:
/*
* Convert string to an integer - for most cases, the string must be
* hexadecimal as per the ACPI specification. The only exception (as
* hexadecimal as per the ACPI specification. The only exception (as
* of ACPI 3.0) is that the ToInteger() operator allows both decimal
* and hexadecimal strings (hex prefixed with "0x").
*/
@ -253,6 +253,7 @@ AcpiExConvertToInteger (
default:
/* No other types can get here */
break;
}
@ -281,7 +282,7 @@ AcpiExConvertToInteger (
*
* FUNCTION: AcpiExConvertToBuffer
*
* PARAMETERS: ObjDesc - Object to be converted. Must be an
* PARAMETERS: ObjDesc - Object to be converted. Must be an
* Integer, Buffer, or String
* ResultDesc - Where the new buffer object is returned
*
@ -303,7 +304,7 @@ AcpiExConvertToBuffer (
ACPI_FUNCTION_TRACE_PTR (ExConvertToBuffer, ObjDesc);
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_BUFFER:
@ -395,11 +396,11 @@ AcpiExConvertToAscii (
UINT8 DataWidth)
{
ACPI_INTEGER Digit;
ACPI_NATIVE_UINT i;
ACPI_NATIVE_UINT j;
ACPI_NATIVE_UINT k = 0;
ACPI_NATIVE_UINT HexLength;
ACPI_NATIVE_UINT DecimalLength;
UINT32 i;
UINT32 j;
UINT32 k = 0;
UINT32 HexLength;
UINT32 DecimalLength;
UINT32 Remainder;
BOOLEAN SupressZeros;
@ -461,7 +462,7 @@ AcpiExConvertToAscii (
/* HexLength: 2 ascii hex chars per data byte */
HexLength = (ACPI_NATIVE_UINT) ACPI_MUL_2 (DataWidth);
HexLength = ACPI_MUL_2 (DataWidth);
for (i = 0, j = (HexLength-1); i < HexLength; i++, j--)
{
/* Get one hex digit, most significant digits first */
@ -476,7 +477,7 @@ AcpiExConvertToAscii (
}
/*
* Since leading zeros are supressed, we must check for the case where
* Since leading zeros are suppressed, we must check for the case where
* the integer equals 0
*
* Finally, null terminate the string and return the length
@ -496,7 +497,7 @@ AcpiExConvertToAscii (
*
* FUNCTION: AcpiExConvertToString
*
* PARAMETERS: ObjDesc - Object to be converted. Must be an
* PARAMETERS: ObjDesc - Object to be converted. Must be an
* Integer, Buffer, or String
* ResultDesc - Where the string object is returned
* Type - String flags (base and conversion type)
@ -524,7 +525,7 @@ AcpiExConvertToString (
ACPI_FUNCTION_TRACE_PTR (ExConvertToString, ObjDesc);
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_STRING:
@ -592,7 +593,7 @@ AcpiExConvertToString (
Base = 10;
/*
* Calculate the final string length. Individual string values
* Calculate the final string length. Individual string values
* are variable length (include separator for each)
*/
for (i = 0; i < ObjDesc->Buffer.Length; i++)
@ -637,8 +638,14 @@ AcpiExConvertToString (
/*
* Create a new string object and string buffer
* (-1 because of extra separator included in StringLength from above)
* Allow creation of zero-length strings from zero-length buffers.
*/
ReturnDesc = AcpiUtCreateStringObject ((ACPI_SIZE) (StringLength - 1));
if (StringLength)
{
StringLength--;
}
ReturnDesc = AcpiUtCreateStringObject ((ACPI_SIZE) StringLength);
if (!ReturnDesc)
{
return_ACPI_STATUS (AE_NO_MEMORY);
@ -662,7 +669,10 @@ AcpiExConvertToString (
* Null terminate the string
* (overwrites final comma/space from above)
*/
NewBuf--;
if (ObjDesc->Buffer.Length)
{
NewBuf--;
}
*NewBuf = 0;
break;
@ -728,7 +738,7 @@ AcpiExConvertToTargetType (
default:
/* No conversion allowed for these types */
if (DestinationType != ACPI_GET_OBJECT_TYPE (SourceDesc))
if (DestinationType != SourceDesc->Common.Type)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Explicit operator, will store (%s) over existing type (%s)\n",
@ -749,7 +759,7 @@ AcpiExConvertToTargetType (
case ACPI_TYPE_LOCAL_BANK_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
/*
* These types require an Integer operand. We can convert
* These types require an Integer operand. We can convert
* a Buffer or a String to an Integer if necessary.
*/
Status = AcpiExConvertToInteger (SourceDesc, ResultDesc,
@ -759,7 +769,7 @@ AcpiExConvertToTargetType (
case ACPI_TYPE_STRING:
/*
* The operand must be a String. We can convert an
* The operand must be a String. We can convert an
* Integer or Buffer if necessary
*/
Status = AcpiExConvertToString (SourceDesc, ResultDesc,
@ -769,7 +779,7 @@ AcpiExConvertToTargetType (
case ACPI_TYPE_BUFFER:
/*
* The operand must be a Buffer. We can convert an
* The operand must be a Buffer. We can convert an
* Integer or String if necessary
*/
Status = AcpiExConvertToBuffer (SourceDesc, ResultDesc);

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: excreate - Named object creation
* $Revision: 1.114 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -118,11 +117,10 @@
#define __EXCREATE_C__
#include "acpi.h"
#include "accommon.h"
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "acevents.h"
#include "actables.h"
#define _COMPONENT ACPI_EXECUTER
@ -180,16 +178,28 @@ AcpiExCreateAlias (
*/
switch (TargetNode->Type)
{
/* For these types, the sub-object can change dynamically via a Store */
case ACPI_TYPE_INTEGER:
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
case ACPI_TYPE_PACKAGE:
case ACPI_TYPE_BUFFER_FIELD:
/*
* These types open a new scope, so we need the NS node in order to access
* any children.
*/
case ACPI_TYPE_DEVICE:
case ACPI_TYPE_POWER:
case ACPI_TYPE_PROCESSOR:
case ACPI_TYPE_THERMAL:
case ACPI_TYPE_LOCAL_SCOPE:
/*
* The new alias has the type ALIAS and points to the original
* NS node, not the object itself. This is because for these
* types, the object can change dynamically via a Store.
* NS node, not the object itself.
*/
AliasNode->Type = ACPI_TYPE_LOCAL_ALIAS;
AliasNode->Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode);
@ -198,9 +208,7 @@ AcpiExCreateAlias (
case ACPI_TYPE_METHOD:
/*
* The new alias has the type ALIAS and points to the original
* NS node, not the object itself. This is because for these
* types, the object can change dynamically via a Store.
* Control method aliases need to be differentiated
*/
AliasNode->Type = ACPI_TYPE_LOCAL_METHOD_ALIAS;
AliasNode->Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode);
@ -439,115 +447,6 @@ AcpiExCreateRegion (
}
/*******************************************************************************
*
* FUNCTION: AcpiExCreateTableRegion
*
* PARAMETERS: WalkState - Current state
*
* RETURN: Status
*
* DESCRIPTION: Create a new DataTableRegion object
*
******************************************************************************/
ACPI_STATUS
AcpiExCreateTableRegion (
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status;
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_NAMESPACE_NODE *Node;
ACPI_OPERAND_OBJECT *RegionObj2;
ACPI_NATIVE_UINT TableIndex;
ACPI_TABLE_HEADER *Table;
ACPI_FUNCTION_TRACE (ExCreateTableRegion);
/* Get the Node from the object stack */
Node = WalkState->Op->Common.Node;
/*
* If the region object is already attached to this node,
* just return
*/
if (AcpiNsGetAttachedObject (Node))
{
return_ACPI_STATUS (AE_OK);
}
/* Find the ACPI table */
Status = AcpiTbFindTable (Operand[1]->String.Pointer,
Operand[2]->String.Pointer, Operand[3]->String.Pointer,
&TableIndex);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Create the region descriptor */
ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_REGION);
if (!ObjDesc)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
RegionObj2 = ObjDesc->Common.NextObject;
RegionObj2->Extra.RegionContext = NULL;
Status = AcpiGetTableByIndex (TableIndex, &Table);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Init the region from the operands */
ObjDesc->Region.SpaceId = REGION_DATA_TABLE;
ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS) ACPI_TO_INTEGER (Table);
ObjDesc->Region.Length = Table->Length;
ObjDesc->Region.Node = Node;
ObjDesc->Region.Flags = AOPOBJ_DATA_VALID;
/* Install the new region object in the parent Node */
Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_REGION);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
Status = AcpiEvInitializeRegion (ObjDesc, FALSE);
if (ACPI_FAILURE (Status))
{
if (Status == AE_NOT_EXIST)
{
Status = AE_OK;
}
else
{
goto Cleanup;
}
}
ObjDesc->Region.Flags |= AOPOBJ_SETUP_COMPLETE;
Cleanup:
/* Remove local reference to the object */
AcpiUtRemoveReference (ObjDesc);
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiExCreateProcessor
@ -715,7 +614,7 @@ AcpiExCreateMethod (
* ACPI 2.0: SyncLevel = SyncLevel in method declaration
*/
ObjDesc->Method.SyncLevel = (UINT8)
((MethodFlags & AML_METHOD_SYNCH_LEVEL) >> 4);
((MethodFlags & AML_METHOD_SYNC_LEVEL) >> 4);
}
/* Attach the new object to the method Node */

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: exdump - Interpreter debug output routines
* $Revision: 1.202 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -117,10 +116,11 @@
#define __EXDUMP_C__
#include "acpi.h"
#include "accommon.h"
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "acparser.h"
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exdump")
@ -213,10 +213,11 @@ static ACPI_EXDUMP_INFO AcpiExDumpEvent[2] =
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Event.OsSemaphore), "OsSemaphore"}
};
static ACPI_EXDUMP_INFO AcpiExDumpMethod[8] =
static ACPI_EXDUMP_INFO AcpiExDumpMethod[9] =
{
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpMethod), NULL},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.ParamCount), "ParamCount"},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.MethodFlags), "Method Flags"},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.ParamCount), "Parameter Count"},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.SyncLevel), "Sync Level"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Method.Mutex), "Mutex"},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.OwnerId), "Owner Id"},
@ -305,12 +306,12 @@ static ACPI_EXDUMP_INFO AcpiExDumpIndexField[5] =
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET (IndexField.DataObj), "Data Object"}
};
static ACPI_EXDUMP_INFO AcpiExDumpReference[7] =
static ACPI_EXDUMP_INFO AcpiExDumpReference[8] =
{
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpReference), NULL},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Reference.Class), "Class"},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Reference.TargetType), "Target Type"},
{ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Reference.Offset), "Offset"},
{ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Reference.Value), "Value"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Object), "Object Desc"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Node), "Node"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Where), "Where"},
@ -345,7 +346,6 @@ static ACPI_EXDUMP_INFO AcpiExDumpCommon[4] =
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Common.Flags), "Flags"}
};
static ACPI_EXDUMP_INFO AcpiExDumpFieldCommon[7] =
{
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpFieldCommon), NULL},
@ -449,6 +449,7 @@ AcpiExDumpObject (
break;
case ACPI_EXD_TYPE:
AcpiExOutString ("Type", AcpiUtGetObjectTypeName (ObjDesc));
break;
@ -470,7 +471,7 @@ AcpiExDumpObject (
case ACPI_EXD_UINT64:
AcpiOsPrintf ("%20s : %8.8X%8.8X\n", "Value",
ACPI_FORMAT_UINT64 (ACPI_GET64 (Target)));
ACPI_FORMAT_UINT64 (ACPI_GET64 (Target)));
break;
case ACPI_EXD_POINTER:
@ -505,13 +506,15 @@ AcpiExDumpObject (
case ACPI_EXD_REFERENCE:
AcpiExOutString ("Opcode",
(AcpiPsGetOpcodeInfo (ObjDesc->Reference.Opcode))->Name);
AcpiExOutString ("Class Name",
ACPI_CAST_PTR (char, AcpiUtGetReferenceName (ObjDesc)));
AcpiExDumpReferenceObj (ObjDesc);
break;
default:
AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n", Info->Opcode);
AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n",
Info->Opcode);
return;
}
@ -589,108 +592,79 @@ AcpiExDumpOperand (
/* Decode object type */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_LOCAL_REFERENCE:
switch (ObjDesc->Reference.Opcode)
AcpiOsPrintf ("Reference: [%s] ", AcpiUtGetReferenceName (ObjDesc));
switch (ObjDesc->Reference.Class)
{
case AML_DEBUG_OP:
AcpiOsPrintf ("Reference: Debug\n");
break;
case AML_INDEX_OP:
AcpiOsPrintf ("Reference: Index %p\n",
ObjDesc->Reference.Object);
break;
case AML_REF_OF_OP:
AcpiOsPrintf ("Reference: (RefOf) %p\n",
ObjDesc->Reference.Object);
break;
case AML_ARG_OP:
AcpiOsPrintf ("Reference: Arg%d",
ObjDesc->Reference.Offset);
if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER)
{
/* Value is an Integer */
AcpiOsPrintf (" value is [%8.8X%8.8x]",
ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
}
case ACPI_REFCLASS_DEBUG:
AcpiOsPrintf ("\n");
break;
case AML_LOCAL_OP:
case ACPI_REFCLASS_INDEX:
AcpiOsPrintf ("Reference: Local%d",
ObjDesc->Reference.Offset);
if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER)
{
/* Value is an Integer */
AcpiOsPrintf (" value is [%8.8X%8.8x]",
ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
}
AcpiOsPrintf ("\n");
AcpiOsPrintf ("%p\n", ObjDesc->Reference.Object);
break;
case AML_INT_NAMEPATH_OP:
case ACPI_REFCLASS_TABLE:
AcpiOsPrintf ("Reference.Node->Name %X\n",
ObjDesc->Reference.Node->Name.Integer);
AcpiOsPrintf ("Table Index %X\n", ObjDesc->Reference.Value);
break;
default:
case ACPI_REFCLASS_REFOF:
/* Unknown opcode */
AcpiOsPrintf ("Unknown Reference opcode=%X\n",
ObjDesc->Reference.Opcode);
AcpiOsPrintf ("%p [%s]\n", ObjDesc->Reference.Object,
AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *)
ObjDesc->Reference.Object)->Common.Type));
break;
case ACPI_REFCLASS_NAME:
AcpiOsPrintf ("- [%4.4s]\n", ObjDesc->Reference.Node->Name.Ascii);
break;
case ACPI_REFCLASS_ARG:
case ACPI_REFCLASS_LOCAL:
AcpiOsPrintf ("%X\n", ObjDesc->Reference.Value);
break;
default: /* Unknown reference class */
AcpiOsPrintf ("%2.2X\n", ObjDesc->Reference.Class);
break;
}
break;
case ACPI_TYPE_BUFFER:
AcpiOsPrintf ("Buffer len %X @ %p\n",
AcpiOsPrintf ("Buffer length %.2X @ %p\n",
ObjDesc->Buffer.Length, ObjDesc->Buffer.Pointer);
Length = ObjDesc->Buffer.Length;
if (Length > 64)
{
Length = 64;
}
/* Debug only -- dump the buffer contents */
if (ObjDesc->Buffer.Pointer)
{
AcpiOsPrintf ("Buffer Contents: ");
for (Index = 0; Index < Length; Index++)
Length = ObjDesc->Buffer.Length;
if (Length > 128)
{
AcpiOsPrintf (" %02x", ObjDesc->Buffer.Pointer[Index]);
Length = 128;
}
AcpiOsPrintf ("\n");
AcpiOsPrintf ("Buffer Contents: (displaying length 0x%.2X)\n",
Length);
ACPI_DUMP_BUFFER (ObjDesc->Buffer.Pointer, Length);
}
break;
@ -740,7 +714,7 @@ AcpiExDumpOperand (
else
{
AcpiOsPrintf (" base %8.8X%8.8X Length %X\n",
ACPI_FORMAT_UINT64 (ObjDesc->Region.Address),
ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address),
ObjDesc->Region.Length);
}
break;
@ -765,8 +739,8 @@ AcpiExDumpOperand (
case ACPI_TYPE_LOCAL_REGION_FIELD:
AcpiOsPrintf (
"RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n",
AcpiOsPrintf ("RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at "
"byte=%X bit=%X of below:\n",
ObjDesc->Field.BitLength,
ObjDesc->Field.AccessByteWidth,
ObjDesc->Field.FieldFlags & AML_FIELD_LOCK_RULE_MASK,
@ -786,8 +760,7 @@ AcpiExDumpOperand (
case ACPI_TYPE_BUFFER_FIELD:
AcpiOsPrintf (
"BufferField: %X bits at byte %X bit %X of\n",
AcpiOsPrintf ("BufferField: %X bits at byte %X bit %X of\n",
ObjDesc->BufferField.BitLength,
ObjDesc->BufferField.BaseByteOffset,
ObjDesc->BufferField.StartFieldBitOffset);
@ -796,7 +769,7 @@ AcpiExDumpOperand (
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL*\n"));
}
else if (ACPI_GET_OBJECT_TYPE (ObjDesc->BufferField.BufferObj) !=
else if ((ObjDesc->BufferField.BufferObj)->Common.Type !=
ACPI_TYPE_BUFFER)
{
AcpiOsPrintf ("*not a Buffer*\n");
@ -856,7 +829,7 @@ AcpiExDumpOperand (
default:
/* Unknown Type */
AcpiOsPrintf ("Unknown Type %X\n", ACPI_GET_OBJECT_TYPE (ObjDesc));
AcpiOsPrintf ("Unknown Type %X\n", ObjDesc->Common.Type);
break;
}
@ -868,63 +841,48 @@ AcpiExDumpOperand (
*
* FUNCTION: AcpiExDumpOperands
*
* PARAMETERS: Operands - Operand list
* InterpreterMode - Load or Exec
* Ident - Identification
* NumLevels - # of stack entries to dump above line
* Note - Output notation
* ModuleName - Caller's module name
* LineNumber - Caller's invocation line number
* PARAMETERS: Operands - A list of Operand objects
* OpcodeName - AML opcode name
* NumOperands - Operand count for this opcode
*
* DESCRIPTION: Dump the object stack
* DESCRIPTION: Dump the operands associated with the opcode
*
******************************************************************************/
void
AcpiExDumpOperands (
ACPI_OPERAND_OBJECT **Operands,
ACPI_INTERPRETER_MODE InterpreterMode,
char *Ident,
UINT32 NumLevels,
char *Note,
char *ModuleName,
UINT32 LineNumber)
const char *OpcodeName,
UINT32 NumOperands)
{
ACPI_NATIVE_UINT i;
ACPI_FUNCTION_NAME (ExDumpOperands);
if (!Ident)
if (!OpcodeName)
{
Ident = "?";
}
if (!Note)
{
Note = "?";
OpcodeName = "UNKNOWN";
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"************* Operand Stack Contents (Opcode [%s], %d Operands)\n",
Ident, NumLevels));
"**** Start operand dump for opcode [%s], %d operands\n",
OpcodeName, NumOperands));
if (NumLevels == 0)
if (NumOperands == 0)
{
NumLevels = 1;
NumOperands = 1;
}
/* Dump the operand stack starting at the top */
/* Dump the individual operands */
for (i = 0; NumLevels > 0; i--, NumLevels--)
while (NumOperands)
{
AcpiExDumpOperand (Operands[i], 0);
AcpiExDumpOperand (*Operands, 0);
Operands++;
NumOperands--;
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"************* Operand Stack dump from %s(%d), %s\n",
ModuleName, LineNumber, Note));
"**** End operand dump for [%s]\n", OpcodeName));
return;
}
@ -987,10 +945,10 @@ AcpiExDumpNamespaceNode (
}
}
AcpiOsPrintf ("%20s : %4.4s\n", "Name", AcpiUtGetNodeName (Node));
AcpiExOutString ("Type", AcpiUtGetTypeName (Node->Type));
AcpiExOutPointer ("Attached Object", AcpiNsGetAttachedObject (Node));
AcpiExOutPointer ("Parent", AcpiNsGetParentNode (Node));
AcpiOsPrintf ("%20s : %4.4s\n", "Name", AcpiUtGetNodeName (Node));
AcpiExOutString ("Type", AcpiUtGetTypeName (Node->Type));
AcpiExOutPointer ("Attached Object", AcpiNsGetAttachedObject (Node));
AcpiExOutPointer ("Parent", AcpiNsGetParentNode (Node));
AcpiExDumpObject (ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node),
AcpiExDumpNode);
@ -1017,14 +975,14 @@ AcpiExDumpReferenceObj (
RetBuf.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
if (ObjDesc->Reference.Opcode == AML_INT_NAMEPATH_OP)
if (ObjDesc->Reference.Class == ACPI_REFCLASS_NAME)
{
AcpiOsPrintf ("Named Object %p ", ObjDesc->Reference.Node);
AcpiOsPrintf (" %p ", ObjDesc->Reference.Node);
Status = AcpiNsHandleToPathname (ObjDesc->Reference.Node, &RetBuf);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not convert name to pathname\n");
AcpiOsPrintf (" Could not convert name to pathname\n");
}
else
{
@ -1034,7 +992,24 @@ AcpiExDumpReferenceObj (
}
else if (ObjDesc->Reference.Object)
{
AcpiOsPrintf ("\nReferenced Object: %p\n", ObjDesc->Reference.Object);
if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND)
{
AcpiOsPrintf (" Target: %p", ObjDesc->Reference.Object);
if (ObjDesc->Reference.Class == ACPI_REFCLASS_TABLE)
{
AcpiOsPrintf (" Table Index: %X\n", ObjDesc->Reference.Value);
}
else
{
AcpiOsPrintf (" Target: %p [%s]\n", ObjDesc->Reference.Object,
AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *)
ObjDesc->Reference.Object)->Common.Type));
}
}
else
{
AcpiOsPrintf (" Target: %p\n", ObjDesc->Reference.Object);
}
}
}
@ -1084,12 +1059,12 @@ AcpiExDumpPackageObj (
/* Packages may only contain a few object types */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_INTEGER:
AcpiOsPrintf ("[Integer] = %8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
break;
@ -1110,7 +1085,7 @@ AcpiExDumpPackageObj (
if (ObjDesc->Buffer.Length)
{
AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer),
ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT);
ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT);
}
else
{
@ -1122,7 +1097,7 @@ AcpiExDumpPackageObj (
case ACPI_TYPE_PACKAGE:
AcpiOsPrintf ("[Package] Contains %d Elements:\n",
ObjDesc->Package.Count);
ObjDesc->Package.Count);
for (i = 0; i < ObjDesc->Package.Count; i++)
{
@ -1133,14 +1108,16 @@ AcpiExDumpPackageObj (
case ACPI_TYPE_LOCAL_REFERENCE:
AcpiOsPrintf ("[Object Reference] ");
AcpiOsPrintf ("[Object Reference] Type [%s] %2.2X",
AcpiUtGetReferenceName (ObjDesc),
ObjDesc->Reference.Class);
AcpiExDumpReferenceObj (ObjDesc);
break;
default:
AcpiOsPrintf ("[Unknown Type] %X\n", ACPI_GET_OBJECT_TYPE (ObjDesc));
AcpiOsPrintf ("[Unknown Type] %X\n", ObjDesc->Common.Type);
break;
}
}

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: exfield - ACPI AML (p-code) execution - field manipulation
* $Revision: 1.131 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -118,6 +117,7 @@
#define __EXFIELD_C__
#include "acpi.h"
#include "accommon.h"
#include "acdispat.h"
#include "acinterp.h"
@ -167,7 +167,7 @@ AcpiExReadDataFromField (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_BUFFER_FIELD)
if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD)
{
/*
* If the BufferField arguments have not been previously evaluated,
@ -182,7 +182,7 @@ AcpiExReadDataFromField (
}
}
}
else if ((ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_REGION_FIELD) &&
else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) &&
(ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS))
{
/*
@ -249,7 +249,7 @@ AcpiExReadDataFromField (
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"FieldRead [TO]: Obj %p, Type %X, Buf %p, ByteLen %X\n",
ObjDesc, ACPI_GET_OBJECT_TYPE (ObjDesc), Buffer, (UINT32) Length));
ObjDesc, ObjDesc->Common.Type, Buffer, (UINT32) Length));
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"FieldRead [FROM]: BitLen %X, BitOff %X, ByteOff %X\n",
ObjDesc->CommonField.BitLength,
@ -302,9 +302,7 @@ AcpiExWriteDataToField (
{
ACPI_STATUS Status;
UINT32 Length;
UINT32 RequiredLength;
void *Buffer;
void *NewBuffer;
ACPI_OPERAND_OBJECT *BufferDesc;
@ -318,7 +316,7 @@ AcpiExWriteDataToField (
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_BUFFER_FIELD)
if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD)
{
/*
* If the BufferField arguments have not been previously evaluated,
@ -333,7 +331,7 @@ AcpiExWriteDataToField (
}
}
}
else if ((ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_REGION_FIELD) &&
else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) &&
(ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS))
{
/*
@ -342,7 +340,7 @@ AcpiExWriteDataToField (
*
* Source must be a buffer of sufficient size (ACPI_SMBUS_BUFFER_SIZE).
*/
if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_BUFFER)
if (SourceDesc->Common.Type != ACPI_TYPE_BUFFER)
{
ACPI_ERROR ((AE_INFO, "SMBus write requires Buffer, found type %s",
AcpiUtGetObjectTypeName (SourceDesc)));
@ -389,7 +387,7 @@ AcpiExWriteDataToField (
/* Get a pointer to the data to be written */
switch (ACPI_GET_OBJECT_TYPE (SourceDesc))
switch (SourceDesc->Common.Type)
{
case ACPI_TYPE_INTEGER:
Buffer = &SourceDesc->Integer.Value;
@ -410,45 +408,15 @@ AcpiExWriteDataToField (
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
/*
* We must have a buffer that is at least as long as the field
* we are writing to. This is because individual fields are
* indivisible and partial writes are not supported -- as per
* the ACPI specification.
*/
NewBuffer = NULL;
RequiredLength = ACPI_ROUND_BITS_UP_TO_BYTES (
ObjDesc->CommonField.BitLength);
if (Length < RequiredLength)
{
/* We need to create a new buffer */
NewBuffer = ACPI_ALLOCATE_ZEROED (RequiredLength);
if (!NewBuffer)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
/*
* Copy the original data to the new buffer, starting
* at Byte zero. All unused (upper) bytes of the
* buffer will be 0.
*/
ACPI_MEMCPY ((char *) NewBuffer, (char *) Buffer, Length);
Buffer = NewBuffer;
Length = RequiredLength;
}
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"FieldWrite [FROM]: Obj %p (%s:%X), Buf %p, ByteLen %X\n",
SourceDesc, AcpiUtGetTypeName (ACPI_GET_OBJECT_TYPE (SourceDesc)),
ACPI_GET_OBJECT_TYPE (SourceDesc), Buffer, Length));
SourceDesc, AcpiUtGetTypeName (SourceDesc->Common.Type),
SourceDesc->Common.Type, Buffer, Length));
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"FieldWrite [TO]: Obj %p (%s:%X), BitLen %X, BitOff %X, ByteOff %X\n",
ObjDesc, AcpiUtGetTypeName (ACPI_GET_OBJECT_TYPE (ObjDesc)),
ACPI_GET_OBJECT_TYPE (ObjDesc),
ObjDesc, AcpiUtGetTypeName (ObjDesc->Common.Type),
ObjDesc->Common.Type,
ObjDesc->CommonField.BitLength,
ObjDesc->CommonField.StartFieldBitOffset,
ObjDesc->CommonField.BaseByteOffset));
@ -462,13 +430,6 @@ AcpiExWriteDataToField (
Status = AcpiExInsertIntoField (ObjDesc, Buffer, Length);
AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags);
/* Free temporary buffer if we used one */
if (NewBuffer)
{
ACPI_FREE (NewBuffer);
}
return_ACPI_STATUS (Status);
}

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: exfldio - Aml Field I/O
* $Revision: 1.128 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -118,6 +117,7 @@
#define __EXFLDIO_C__
#include "acpi.h"
#include "accommon.h"
#include "acinterp.h"
#include "amlcode.h"
#include "acevents.h"
@ -179,10 +179,10 @@ AcpiExSetupRegion (
/* We must have a valid region */
if (ACPI_GET_OBJECT_TYPE (RgnDesc) != ACPI_TYPE_REGION)
if (RgnDesc->Common.Type != ACPI_TYPE_REGION)
{
ACPI_ERROR ((AE_INFO, "Needed Region, found type %X (%s)",
ACPI_GET_OBJECT_TYPE (RgnDesc),
RgnDesc->Common.Type,
AcpiUtGetObjectTypeName (RgnDesc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@ -201,13 +201,6 @@ AcpiExSetupRegion (
}
}
/* Exit if Address/Length have been disallowed by the host OS */
if (RgnDesc->Common.Flags & AOPOBJ_INVALID)
{
return_ACPI_STATUS (AE_AML_ILLEGAL_ADDRESS);
}
/*
* Exit now for SMBus address space, it has a non-linear address space
* and the request cannot be directly validated
@ -248,13 +241,13 @@ AcpiExSetupRegion (
/*
* Slack mode only: We will go ahead and allow access to this
* field if it is within the region length rounded up to the next
* access width boundary.
* access width boundary. ACPI_SIZE cast for 64-bit compile.
*/
if (ACPI_ROUND_UP (RgnDesc->Region.Length,
ObjDesc->CommonField.AccessByteWidth) >=
(ObjDesc->CommonField.BaseByteOffset +
(ACPI_NATIVE_UINT) ObjDesc->CommonField.AccessByteWidth +
FieldDatumByteOffset))
((ACPI_SIZE) ObjDesc->CommonField.BaseByteOffset +
ObjDesc->CommonField.AccessByteWidth +
FieldDatumByteOffset))
{
return_ACPI_STATUS (AE_OK);
}
@ -321,7 +314,7 @@ AcpiExAccessRegion (
{
ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *RgnDesc;
ACPI_PHYSICAL_ADDRESS Address;
UINT32 RegionOffset;
ACPI_FUNCTION_TRACE (ExAccessRegion);
@ -345,9 +338,9 @@ AcpiExAccessRegion (
* 3) The current offset into the field
*/
RgnDesc = ObjDesc->CommonField.RegionObj;
Address = RgnDesc->Region.Address +
ObjDesc->CommonField.BaseByteOffset +
FieldDatumByteOffset;
RegionOffset =
ObjDesc->CommonField.BaseByteOffset +
FieldDatumByteOffset;
if ((Function & ACPI_IO_MASK) == ACPI_READ)
{
@ -365,12 +358,11 @@ AcpiExAccessRegion (
ObjDesc->CommonField.AccessByteWidth,
ObjDesc->CommonField.BaseByteOffset,
FieldDatumByteOffset,
(void *) Address));
ACPI_CAST_PTR (void, (RgnDesc->Region.Address + RegionOffset))));
/* Invoke the appropriate AddressSpace/OpRegion handler */
Status = AcpiEvAddressSpaceDispatch (RgnDesc, Function,
Address,
Status = AcpiEvAddressSpaceDispatch (RgnDesc, Function, RegionOffset,
ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth), Value);
if (ACPI_FAILURE (Status))
@ -499,7 +491,7 @@ AcpiExFieldDatumIo (
* IndexField - Write to an Index Register, then read/write from/to a
* Data Register
*/
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_BUFFER_FIELD:
/*
@ -614,13 +606,13 @@ AcpiExFieldDatumIo (
return_ACPI_STATUS (Status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"I/O to Data Register: ValuePtr %p\n", Value));
if (ReadWrite == ACPI_READ)
{
/* Read the datum from the DataRegister */
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Read from Data Register\n"));
Status = AcpiExExtractFromField (ObjDesc->IndexField.DataObj,
Value, sizeof (ACPI_INTEGER));
}
@ -628,6 +620,10 @@ AcpiExFieldDatumIo (
{
/* Write the datum to the DataRegister */
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Write to Data Register: Value %8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (*Value)));
Status = AcpiExInsertIntoField (ObjDesc->IndexField.DataObj,
Value, sizeof (ACPI_INTEGER));
}
@ -637,7 +633,7 @@ AcpiExFieldDatumIo (
default:
ACPI_ERROR ((AE_INFO, "Wrong object type in field I/O %X",
ACPI_GET_OBJECT_TYPE (ObjDesc)));
ObjDesc->Common.Type));
Status = AE_AML_INTERNAL;
break;
}
@ -930,6 +926,8 @@ AcpiExInsertIntoField (
UINT32 DatumCount;
UINT32 FieldDatumCount;
UINT32 i;
UINT32 RequiredLength;
void *NewBuffer;
ACPI_FUNCTION_TRACE (ExInsertIntoField);
@ -937,14 +935,33 @@ AcpiExInsertIntoField (
/* Validate input buffer */
if (BufferLength <
ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength))
NewBuffer = NULL;
RequiredLength = ACPI_ROUND_BITS_UP_TO_BYTES (
ObjDesc->CommonField.BitLength);
/*
* We must have a buffer that is at least as long as the field
* we are writing to. This is because individual fields are
* indivisible and partial writes are not supported -- as per
* the ACPI specification.
*/
if (BufferLength < RequiredLength)
{
ACPI_ERROR ((AE_INFO,
"Field size %X (bits) is too large for buffer (%X)",
ObjDesc->CommonField.BitLength, BufferLength));
/* We need to create a new buffer */
return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
NewBuffer = ACPI_ALLOCATE_ZEROED (RequiredLength);
if (!NewBuffer)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
/*
* Copy the original data to the new buffer, starting
* at Byte zero. All unused (upper) bytes of the
* buffer will be 0.
*/
ACPI_MEMCPY ((char *) NewBuffer, (char *) Buffer, BufferLength);
Buffer = NewBuffer;
BufferLength = RequiredLength;
}
/*
@ -992,7 +1009,7 @@ AcpiExInsertIntoField (
MergedDatum, FieldOffset);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
goto Exit;
}
FieldOffset += ObjDesc->CommonField.AccessByteWidth;
@ -1050,6 +1067,13 @@ AcpiExInsertIntoField (
Status = AcpiExWriteWithUpdateRule (ObjDesc,
Mask, MergedDatum, FieldOffset);
Exit:
/* Free temporary buffer if we used one */
if (NewBuffer)
{
ACPI_FREE (NewBuffer);
}
return_ACPI_STATUS (Status);
}

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes
* $Revision: 1.144 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -119,6 +118,7 @@
#define __EXMISC_C__
#include "acpi.h"
#include "accommon.h"
#include "acinterp.h"
#include "amlcode.h"
#include "amlresrc.h"
@ -162,7 +162,7 @@ AcpiExGetObjectReference (
{
case ACPI_DESC_TYPE_OPERAND:
if (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_LOCAL_REFERENCE)
if (ObjDesc->Common.Type != ACPI_TYPE_LOCAL_REFERENCE)
{
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
@ -170,11 +170,11 @@ AcpiExGetObjectReference (
/*
* Must be a reference to a Local or Arg
*/
switch (ObjDesc->Reference.Opcode)
switch (ObjDesc->Reference.Class)
{
case AML_LOCAL_OP:
case AML_ARG_OP:
case AML_DEBUG_OP:
case ACPI_REFCLASS_LOCAL:
case ACPI_REFCLASS_ARG:
case ACPI_REFCLASS_DEBUG:
/* The referenced object is the pseudo-node for the local/arg */
@ -183,8 +183,8 @@ AcpiExGetObjectReference (
default:
ACPI_ERROR ((AE_INFO, "Unknown Reference opcode %X",
ObjDesc->Reference.Opcode));
ACPI_ERROR ((AE_INFO, "Unknown Reference Class %2.2X",
ObjDesc->Reference.Class));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
break;
@ -215,7 +215,7 @@ AcpiExGetObjectReference (
return_ACPI_STATUS (AE_NO_MEMORY);
}
ReferenceObj->Reference.Opcode = AML_REF_OF_OP;
ReferenceObj->Reference.Class = ACPI_REFCLASS_REFOF;
ReferenceObj->Reference.Object = ReferencedObj;
*ReturnDesc = ReferenceObj;
@ -357,7 +357,7 @@ AcpiExDoConcatenate (
* guaranteed to be either Integer/String/Buffer by the operand
* resolution mechanism.
*/
switch (ACPI_GET_OBJECT_TYPE (Operand0))
switch (Operand0->Common.Type)
{
case ACPI_TYPE_INTEGER:
Status = AcpiExConvertToInteger (Operand1, &LocalOperand1, 16);
@ -374,7 +374,7 @@ AcpiExDoConcatenate (
default:
ACPI_ERROR ((AE_INFO, "Invalid object type: %X",
ACPI_GET_OBJECT_TYPE (Operand0)));
Operand0->Common.Type));
Status = AE_AML_INTERNAL;
}
@ -396,7 +396,7 @@ AcpiExDoConcatenate (
* 2) Two Strings concatenated to produce a new String
* 3) Two Buffers concatenated to produce a new Buffer
*/
switch (ACPI_GET_OBJECT_TYPE (Operand0))
switch (Operand0->Common.Type)
{
case ACPI_TYPE_INTEGER:
@ -429,8 +429,8 @@ AcpiExDoConcatenate (
/* Result of two Strings is a String */
ReturnDesc = AcpiUtCreateStringObject ((ACPI_SIZE)
(Operand0->String.Length +
ReturnDesc = AcpiUtCreateStringObject (
((ACPI_SIZE) Operand0->String.Length +
LocalOperand1->String.Length));
if (!ReturnDesc)
{
@ -451,8 +451,8 @@ AcpiExDoConcatenate (
/* Result of two Buffers is a Buffer */
ReturnDesc = AcpiUtCreateBufferObject ((ACPI_SIZE)
(Operand0->Buffer.Length +
ReturnDesc = AcpiUtCreateBufferObject (
((ACPI_SIZE) Operand0->Buffer.Length +
LocalOperand1->Buffer.Length));
if (!ReturnDesc)
{
@ -476,7 +476,7 @@ AcpiExDoConcatenate (
/* Invalid object type, should not happen here */
ACPI_ERROR ((AE_INFO, "Invalid object type: %X",
ACPI_GET_OBJECT_TYPE (Operand0)));
Operand0->Common.Type));
Status =AE_AML_INTERNAL;
goto Cleanup;
}
@ -709,7 +709,7 @@ AcpiExDoLogicalOp (
* guaranteed to be either Integer/String/Buffer by the operand
* resolution mechanism.
*/
switch (ACPI_GET_OBJECT_TYPE (Operand0))
switch (Operand0->Common.Type)
{
case ACPI_TYPE_INTEGER:
Status = AcpiExConvertToInteger (Operand1, &LocalOperand1, 16);
@ -737,7 +737,7 @@ AcpiExDoLogicalOp (
/*
* Two cases: 1) Both Integers, 2) Both Strings or Buffers
*/
if (ACPI_GET_OBJECT_TYPE (Operand0) == ACPI_TYPE_INTEGER)
if (Operand0->Common.Type == ACPI_TYPE_INTEGER)
{
/*
* 1) Both operands are of type integer

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: exmutex - ASL Mutex Acquire/Release functions
* $Revision: 1.40 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -118,6 +117,7 @@
#define __EXMUTEX_C__
#include "acpi.h"
#include "accommon.h"
#include "acinterp.h"
#include "acevents.h"
@ -166,6 +166,15 @@ AcpiExUnlinkMutex (
if (ObjDesc->Mutex.Prev)
{
(ObjDesc->Mutex.Prev)->Mutex.Next = ObjDesc->Mutex.Next;
/*
* Migrate the previous sync level associated with this mutex to the
* previous mutex on the list so that it may be preserved. This handles
* the case where several mutexes have been acquired at the same level,
* but are not released in opposite order.
*/
(ObjDesc->Mutex.Prev)->Mutex.OriginalSyncLevel =
ObjDesc->Mutex.OriginalSyncLevel;
}
else
{
@ -461,6 +470,7 @@ AcpiExReleaseMutex (
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status = AE_OK;
UINT8 PreviousSyncLevel;
ACPI_FUNCTION_TRACE (ExReleaseMutex);
@ -488,10 +498,10 @@ AcpiExReleaseMutex (
(ObjDesc != AcpiGbl_GlobalLockMutex))
{
ACPI_ERROR ((AE_INFO,
"Thread %X cannot release Mutex [%4.4s] acquired by thread %X",
WalkState->Thread->ThreadId,
"Thread %p cannot release Mutex [%4.4s] acquired by thread %p",
ACPI_CAST_PTR (void, WalkState->Thread->ThreadId),
AcpiUtGetNodeName (ObjDesc->Mutex.Node),
ObjDesc->Mutex.OwnerThread->ThreadId));
ACPI_CAST_PTR (void, ObjDesc->Mutex.OwnerThread->ThreadId)));
return_ACPI_STATUS (AE_AML_NOT_OWNER);
}
@ -505,10 +515,13 @@ AcpiExReleaseMutex (
}
/*
* The sync level of the mutex must be less than or equal to the current
* sync level
* The sync level of the mutex must be equal to the current sync level. In
* other words, the current level means that at least one mutex at that
* level is currently being held. Attempting to release a mutex of a
* different level can only mean that the mutex ordering rule is being
* violated. This behavior is clarified in ACPI 4.0 specification.
*/
if (ObjDesc->Mutex.SyncLevel > WalkState->Thread->CurrentSyncLevel)
if (ObjDesc->Mutex.SyncLevel != WalkState->Thread->CurrentSyncLevel)
{
ACPI_ERROR ((AE_INFO,
"Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %d current %d",
@ -517,13 +530,25 @@ AcpiExReleaseMutex (
return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
}
/*
* Get the previous SyncLevel from the head of the acquired mutex list.
* This handles the case where several mutexes at the same level have been
* acquired, but are not released in reverse order.
*/
PreviousSyncLevel =
WalkState->Thread->AcquiredMutexList->Mutex.OriginalSyncLevel;
Status = AcpiExReleaseMutexObject (ObjDesc);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
if (ObjDesc->Mutex.AcquisitionDepth == 0)
{
/* Restore the original SyncLevel */
/* Restore the previous SyncLevel */
WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.OriginalSyncLevel;
WalkState->Thread->CurrentSyncLevel = PreviousSyncLevel;
}
return_ACPI_STATUS (Status);
}

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: exnames - interpreter/scanner name load/execute
* $Revision: 1.111 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -118,6 +117,7 @@
#define __EXNAMES_C__
#include "acpi.h"
#include "accommon.h"
#include "acinterp.h"
#include "amlcode.h"

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: exoparg1 - AML execution - opcodes with 1 argument
* $Revision: 1.184 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -118,6 +117,7 @@
#define __EXOPARG1_C__
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "acdispat.h"
#include "acinterp.h"
@ -880,26 +880,39 @@ AcpiExOpcode_1A_0T_1R (
Value = AcpiGbl_IntegerByteWidth;
break;
case ACPI_TYPE_BUFFER:
Value = TempDesc->Buffer.Length;
break;
case ACPI_TYPE_STRING:
Value = TempDesc->String.Length;
break;
case ACPI_TYPE_BUFFER:
/* Buffer arguments may not be evaluated at this point */
Status = AcpiDsGetBufferArguments (TempDesc);
Value = TempDesc->Buffer.Length;
break;
case ACPI_TYPE_PACKAGE:
/* Package arguments may not be evaluated at this point */
Status = AcpiDsGetPackageArguments (TempDesc);
Value = TempDesc->Package.Count;
break;
default:
ACPI_ERROR ((AE_INFO,
"Operand is not Buf/Int/Str/Pkg - found type %s",
"Operand must be Buffer/Integer/String/Package - found type %s",
AcpiUtGetTypeName (Type)));
Status = AE_AML_OPERAND_TYPE;
goto Cleanup;
}
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
/*
* Now that we have the size of the object, create a result
* object to hold the value
@ -934,8 +947,8 @@ AcpiExOpcode_1A_0T_1R (
TempDesc = AcpiNsGetAttachedObject (
(ACPI_NAMESPACE_NODE *) Operand[0]);
if (TempDesc &&
((ACPI_GET_OBJECT_TYPE (TempDesc) == ACPI_TYPE_STRING) ||
(ACPI_GET_OBJECT_TYPE (TempDesc) == ACPI_TYPE_LOCAL_REFERENCE)))
((TempDesc->Common.Type == ACPI_TYPE_STRING) ||
(TempDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE)))
{
Operand[0] = TempDesc;
AcpiUtAddReference (TempDesc);
@ -948,7 +961,7 @@ AcpiExOpcode_1A_0T_1R (
}
else
{
switch (ACPI_GET_OBJECT_TYPE (Operand[0]))
switch ((Operand[0])->Common.Type)
{
case ACPI_TYPE_LOCAL_REFERENCE:
/*
@ -956,16 +969,16 @@ AcpiExOpcode_1A_0T_1R (
*
* Must resolve/dereference the local/arg reference first
*/
switch (Operand[0]->Reference.Opcode)
switch (Operand[0]->Reference.Class)
{
case AML_LOCAL_OP:
case AML_ARG_OP:
case ACPI_REFCLASS_LOCAL:
case ACPI_REFCLASS_ARG:
/* Set Operand[0] to the value of the local/arg */
Status = AcpiDsMethodDataGetValue (
Operand[0]->Reference.Opcode,
Operand[0]->Reference.Offset,
Operand[0]->Reference.Class,
Operand[0]->Reference.Value,
WalkState, &TempDesc);
if (ACPI_FAILURE (Status))
{
@ -980,7 +993,7 @@ AcpiExOpcode_1A_0T_1R (
Operand[0] = TempDesc;
break;
case AML_REF_OF_OP:
case ACPI_REFCLASS_REFOF:
/* Get the object to which the reference refers */
@ -1007,7 +1020,7 @@ AcpiExOpcode_1A_0T_1R (
if (ACPI_GET_DESCRIPTOR_TYPE (Operand[0]) != ACPI_DESC_TYPE_NAMED)
{
if (ACPI_GET_OBJECT_TYPE (Operand[0]) == ACPI_TYPE_STRING)
if ((Operand[0])->Common.Type == ACPI_TYPE_STRING)
{
/*
* This is a DerefOf (String). The string is a reference
@ -1055,9 +1068,9 @@ AcpiExOpcode_1A_0T_1R (
* This must be a reference object produced by either the
* Index() or RefOf() operator
*/
switch (Operand[0]->Reference.Opcode)
switch (Operand[0]->Reference.Class)
{
case AML_INDEX_OP:
case ACPI_REFCLASS_INDEX:
/*
* The target type for the Index operator must be
@ -1090,7 +1103,7 @@ AcpiExOpcode_1A_0T_1R (
* reference to the buffer itself.
*/
ReturnDesc->Integer.Value =
TempDesc->Buffer.Pointer[Operand[0]->Reference.Offset];
TempDesc->Buffer.Pointer[Operand[0]->Reference.Value];
break;
@ -1111,7 +1124,7 @@ AcpiExOpcode_1A_0T_1R (
default:
ACPI_ERROR ((AE_INFO,
"Unknown Index TargetType %X in obj %p",
"Unknown Index TargetType %X in reference object %p",
Operand[0]->Reference.TargetType, Operand[0]));
Status = AE_AML_OPERAND_TYPE;
goto Cleanup;
@ -1119,7 +1132,7 @@ AcpiExOpcode_1A_0T_1R (
break;
case AML_REF_OF_OP:
case ACPI_REFCLASS_REFOF:
ReturnDesc = Operand[0]->Reference.Object;
@ -1138,8 +1151,8 @@ AcpiExOpcode_1A_0T_1R (
default:
ACPI_ERROR ((AE_INFO,
"Unknown opcode in reference(%p) - %X",
Operand[0], Operand[0]->Reference.Opcode));
"Unknown class in reference(%p) - %2.2X",
Operand[0], Operand[0]->Reference.Class));
Status = AE_TYPE;
goto Cleanup;

View File

@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: exoparg2 - AML execution - opcodes with 2 arguments
* $Revision: 1.143 $
*
*****************************************************************************/
@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -118,6 +117,7 @@
#define __EXOPARG2_C__
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "acinterp.h"
#include "acevents.h"
@ -504,14 +504,14 @@ AcpiExOpcode_2A_1T_1R (
/* Initialize the Index reference object */
Index = Operand[1]->Integer.Value;
ReturnDesc->Reference.Offset = (UINT32) Index;
ReturnDesc->Reference.Opcode = AML_INDEX_OP;
ReturnDesc->Reference.Value = (UINT32) Index;
ReturnDesc->Reference.Class = ACPI_REFCLASS_INDEX;
/*
* At this point, the Source operand is a String, Buffer, or Package.
* Verify that the index is within range.
*/
switch (ACPI_GET_OBJECT_TYPE (Operand[0]))
switch ((Operand[0])->Common.Type)
{
case ACPI_TYPE_STRING:

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: exoparg3 - AML execution - opcodes with 3 arguments
* $Revision: 1.35 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -119,6 +118,7 @@
#define __EXOPARG3_C__
#include "acpi.h"
#include "accommon.h"
#include "acinterp.h"
#include "acparser.h"
#include "amlcode.h"
@ -256,7 +256,7 @@ AcpiExOpcode_3A_1T_1R (
* either a String or a Buffer, so just use its type.
*/
ReturnDesc = AcpiUtCreateInternalObject (
ACPI_GET_OBJECT_TYPE (Operand[0]));
(Operand[0])->Common.Type);
if (!ReturnDesc)
{
Status = AE_NO_MEMORY;
@ -287,7 +287,7 @@ AcpiExOpcode_3A_1T_1R (
/* Strings always have a sub-pointer, not so for buffers */
switch (ACPI_GET_OBJECT_TYPE (Operand[0]))
switch ((Operand[0])->Common.Type)
{
case ACPI_TYPE_STRING:

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: exoparg6 - AML execution - opcodes with 6 arguments
* $Revision: 1.29 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -119,6 +118,7 @@
#define __EXOPARG6_C__
#include "acpi.h"
#include "accommon.h"
#include "acinterp.h"
#include "acparser.h"
#include "amlcode.h"

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: exprep - ACPI AML (p-code) execution - field prep utilities
* $Revision: 1.142 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -118,6 +117,7 @@
#define __EXPREP_C__
#include "acpi.h"
#include "accommon.h"
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
@ -367,7 +367,7 @@ AcpiExDecodeFieldAccess (
return_UINT32 (0);
}
if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_BUFFER_FIELD)
if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD)
{
/*
* BufferField access can be on any byte boundary, so the
@ -511,6 +511,7 @@ AcpiExPrepFieldValue (
ACPI_CREATE_FIELD_INFO *Info)
{
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_OPERAND_OBJECT *SecondDesc = NULL;
UINT32 Type;
ACPI_STATUS Status;
@ -597,6 +598,16 @@ AcpiExPrepFieldValue (
ObjDesc->Field.AccessByteWidth,
ObjDesc->BankField.RegionObj,
ObjDesc->BankField.BankObj));
/*
* Remember location in AML stream of the field unit
* opcode and operands -- since the BankValue
* operands must be evaluated.
*/
SecondDesc = ObjDesc->Common.NextObject;
SecondDesc->Extra.AmlStart = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Info->DataRegisterNode)->Named.Data;
SecondDesc->Extra.AmlLength = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Info->DataRegisterNode)->Named.Length;
break;

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: exregion - ACPI default OpRegion (address space) handlers
* $Revision: 1.101 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -119,6 +118,7 @@
#define __EXREGION_C__
#include "acpi.h"
#include "accommon.h"
#include "acinterp.h"
@ -240,12 +240,13 @@ AcpiExSystemMemorySpaceHandler (
/* Create a new mapping starting at the address given */
MemInfo->MappedLogicalAddress = AcpiOsMapMemory ((ACPI_NATIVE_UINT) Address, WindowSize);
MemInfo->MappedLogicalAddress = AcpiOsMapMemory (
(ACPI_PHYSICAL_ADDRESS) Address, WindowSize);
if (!MemInfo->MappedLogicalAddress)
{
ACPI_ERROR ((AE_INFO,
"Could not map memory at %8.8X%8.8X, size %X",
ACPI_FORMAT_UINT64 (Address), (UINT32) WindowSize));
ACPI_FORMAT_NATIVE_UINT (Address), (UINT32) WindowSize));
MemInfo->MappedLength = 0;
return_ACPI_STATUS (AE_NO_MEMORY);
}
@ -265,7 +266,7 @@ AcpiExSystemMemorySpaceHandler (
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n",
BitWidth, Function, ACPI_FORMAT_UINT64 (Address)));
BitWidth, Function, ACPI_FORMAT_NATIVE_UINT (Address)));
/*
* Perform the memory read or write
@ -375,7 +376,7 @@ AcpiExSystemIoSpaceHandler (
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"System-IO (width %d) R/W %d Address=%8.8X%8.8X\n",
BitWidth, Function, ACPI_FORMAT_UINT64 (Address)));
BitWidth, Function, ACPI_FORMAT_NATIVE_UINT (Address)));
/* Decode the function parameter */
@ -383,14 +384,14 @@ AcpiExSystemIoSpaceHandler (
{
case ACPI_READ:
Status = AcpiOsReadPort ((ACPI_IO_ADDRESS) Address,
Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) Address,
&Value32, BitWidth);
*Value = Value32;
break;
case ACPI_WRITE:
Status = AcpiOsWritePort ((ACPI_IO_ADDRESS) Address,
Status = AcpiHwWritePort ((ACPI_IO_ADDRESS) Address,
(UINT32) *Value, BitWidth);
break;

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: exresnte - AML Interpreter object resolution
* $Revision: 1.75 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -118,11 +117,10 @@
#define __EXRESNTE_C__
#include "acpi.h"
#include "accommon.h"
#include "acdispat.h"
#include "acinterp.h"
#include "acnamesp.h"
#include "acparser.h"
#include "amlcode.h"
#define _COMPONENT ACPI_EXECUTER
@ -197,9 +195,11 @@ AcpiExResolveNodeToValue (
* Several object types require no further processing:
* 1) Device/Thermal objects don't have a "real" subobject, return the Node
* 2) Method locals and arguments have a pseudo-Node
* 3) 10/2007: Added method type to assist with Package construction.
*/
if ((EntryType == ACPI_TYPE_DEVICE) ||
(EntryType == ACPI_TYPE_THERMAL) ||
(EntryType == ACPI_TYPE_METHOD) ||
(Node->Flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL)))
{
return_ACPI_STATUS (AE_OK);
@ -220,7 +220,7 @@ AcpiExResolveNodeToValue (
{
case ACPI_TYPE_PACKAGE:
if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_PACKAGE)
if (SourceDesc->Common.Type != ACPI_TYPE_PACKAGE)
{
ACPI_ERROR ((AE_INFO, "Object not a Package, type %s",
AcpiUtGetObjectTypeName (SourceDesc)));
@ -240,7 +240,7 @@ AcpiExResolveNodeToValue (
case ACPI_TYPE_BUFFER:
if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_BUFFER)
if (SourceDesc->Common.Type != ACPI_TYPE_BUFFER)
{
ACPI_ERROR ((AE_INFO, "Object not a Buffer, type %s",
AcpiUtGetObjectTypeName (SourceDesc)));
@ -260,7 +260,7 @@ AcpiExResolveNodeToValue (
case ACPI_TYPE_STRING:
if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_STRING)
if (SourceDesc->Common.Type != ACPI_TYPE_STRING)
{
ACPI_ERROR ((AE_INFO, "Object not a String, type %s",
AcpiUtGetObjectTypeName (SourceDesc)));
@ -276,7 +276,7 @@ AcpiExResolveNodeToValue (
case ACPI_TYPE_INTEGER:
if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_INTEGER)
if (SourceDesc->Common.Type != ACPI_TYPE_INTEGER)
{
ACPI_ERROR ((AE_INFO, "Object not a Integer, type %s",
AcpiUtGetObjectTypeName (SourceDesc)));
@ -305,7 +305,6 @@ AcpiExResolveNodeToValue (
/* For these objects, just return the object attached to the Node */
case ACPI_TYPE_MUTEX:
case ACPI_TYPE_METHOD:
case ACPI_TYPE_POWER:
case ACPI_TYPE_PROCESSOR:
case ACPI_TYPE_EVENT:
@ -329,15 +328,14 @@ AcpiExResolveNodeToValue (
case ACPI_TYPE_LOCAL_REFERENCE:
switch (SourceDesc->Reference.Opcode)
switch (SourceDesc->Reference.Class)
{
case AML_LOAD_OP:
case ACPI_REFCLASS_TABLE: /* This is a DdbHandle */
case ACPI_REFCLASS_REFOF:
case ACPI_REFCLASS_INDEX:
/* This is a DdbHandle */
/* Return an additional reference to the object */
case AML_REF_OF_OP:
ObjDesc = SourceDesc;
AcpiUtAddReference (ObjDesc);
break;
@ -346,9 +344,8 @@ AcpiExResolveNodeToValue (
/* No named references are allowed here */
ACPI_ERROR ((AE_INFO,
"Unsupported Reference opcode %X (%s)",
SourceDesc->Reference.Opcode,
AcpiPsGetOpcodeName (SourceDesc->Reference.Opcode)));
"Unsupported Reference type %X",
SourceDesc->Reference.Class));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: exresolv - AML Interpreter object resolution
* $Revision: 1.142 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -118,11 +117,11 @@
#define __EXRESOLV_C__
#include "acpi.h"
#include "accommon.h"
#include "amlcode.h"
#include "acdispat.h"
#include "acinterp.h"
#include "acnamesp.h"
#include "acparser.h"
#define _COMPONENT ACPI_EXECUTER
@ -230,7 +229,7 @@ AcpiExResolveObjectToValue (
ACPI_STATUS Status = AE_OK;
ACPI_OPERAND_OBJECT *StackDesc;
ACPI_OPERAND_OBJECT *ObjDesc = NULL;
UINT16 Opcode;
UINT8 RefType;
ACPI_FUNCTION_TRACE (ExResolveObjectToValue);
@ -240,30 +239,30 @@ AcpiExResolveObjectToValue (
/* This is an ACPI_OPERAND_OBJECT */
switch (ACPI_GET_OBJECT_TYPE (StackDesc))
switch (StackDesc->Common.Type)
{
case ACPI_TYPE_LOCAL_REFERENCE:
Opcode = StackDesc->Reference.Opcode;
RefType = StackDesc->Reference.Class;
switch (Opcode)
switch (RefType)
{
case AML_LOCAL_OP:
case AML_ARG_OP:
case ACPI_REFCLASS_LOCAL:
case ACPI_REFCLASS_ARG:
/*
* Get the local from the method's state info
* Note: this increments the local's object reference count
*/
Status = AcpiDsMethodDataGetValue (Opcode,
StackDesc->Reference.Offset, WalkState, &ObjDesc);
Status = AcpiDsMethodDataGetValue (RefType,
StackDesc->Reference.Value, WalkState, &ObjDesc);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Arg/Local %X] ValueObj is %p\n",
StackDesc->Reference.Offset, ObjDesc));
StackDesc->Reference.Value, ObjDesc));
/*
* Now we can delete the original Reference Object and
@ -274,23 +273,33 @@ AcpiExResolveObjectToValue (
break;
case AML_INDEX_OP:
case ACPI_REFCLASS_INDEX:
switch (StackDesc->Reference.TargetType)
{
case ACPI_TYPE_BUFFER_FIELD:
/* Just return - leave the Reference on the stack */
/* Just return - do not dereference */
break;
case ACPI_TYPE_PACKAGE:
/* If method call or CopyObject - do not dereference */
if ((WalkState->Opcode == AML_INT_METHODCALL_OP) ||
(WalkState->Opcode == AML_COPY_OP))
{
break;
}
/* Otherwise, dereference the PackageIndex to a package element */
ObjDesc = *StackDesc->Reference.Where;
if (ObjDesc)
{
/*
* Valid obj descriptor, copy pointer to return value
* Valid object descriptor, copy pointer to return value
* (i.e., dereference the package index)
* Delete the ref object, increment the returned object
*/
@ -301,11 +310,11 @@ AcpiExResolveObjectToValue (
else
{
/*
* A NULL object descriptor means an unitialized element of
* A NULL object descriptor means an uninitialized element of
* the package, can't dereference it
*/
ACPI_ERROR ((AE_INFO,
"Attempt to deref an Index to NULL pkg element Idx=%p",
"Attempt to dereference an Index to NULL package element Idx=%p",
StackDesc));
Status = AE_AML_UNINITIALIZED_ELEMENT;
}
@ -317,7 +326,7 @@ AcpiExResolveObjectToValue (
/* Invalid reference object */
ACPI_ERROR ((AE_INFO,
"Unknown TargetType %X in Index/Reference obj %p",
"Unknown TargetType %X in Index/Reference object %p",
StackDesc->Reference.TargetType, StackDesc));
Status = AE_AML_INTERNAL;
break;
@ -325,15 +334,15 @@ AcpiExResolveObjectToValue (
break;
case AML_REF_OF_OP:
case AML_DEBUG_OP:
case AML_LOAD_OP:
case ACPI_REFCLASS_REFOF:
case ACPI_REFCLASS_DEBUG:
case ACPI_REFCLASS_TABLE:
/* Just leave the object as-is */
/* Just leave the object as-is, do not dereference */
break;
case AML_INT_NAMEPATH_OP: /* Reference to a named object */
case ACPI_REFCLASS_NAME: /* Reference to a named object */
/* Dereference the name */
@ -358,8 +367,7 @@ AcpiExResolveObjectToValue (
default:
ACPI_ERROR ((AE_INFO,
"Unknown Reference opcode %X (%s) in %p",
Opcode, AcpiPsGetOpcodeName (Opcode), StackDesc));
"Unknown Reference type %X in %p", RefType, StackDesc));
Status = AE_AML_INTERNAL;
break;
}
@ -384,7 +392,7 @@ AcpiExResolveObjectToValue (
case ACPI_TYPE_LOCAL_INDEX_FIELD:
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "FieldRead SourceDesc=%p Type=%X\n",
StackDesc, ACPI_GET_OBJECT_TYPE (StackDesc)));
StackDesc, StackDesc->Common.Type));
Status = AcpiExReadDataFromField (WalkState, StackDesc, &ObjDesc);
@ -467,21 +475,21 @@ AcpiExResolveMultiple (
}
/*
* For reference objects created via the RefOf or Index operators,
* we need to get to the base object (as per the ACPI specification
* of the ObjectType and SizeOf operators). This means traversing
* the list of possibly many nested references.
* For reference objects created via the RefOf, Index, or Load/LoadTable
* operators, we need to get to the base object (as per the ACPI
* specification of the ObjectType and SizeOf operators). This means
* traversing the list of possibly many nested references.
*/
while (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_REFERENCE)
while (ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE)
{
switch (ObjDesc->Reference.Opcode)
switch (ObjDesc->Reference.Class)
{
case AML_REF_OF_OP:
case AML_INT_NAMEPATH_OP:
case ACPI_REFCLASS_REFOF:
case ACPI_REFCLASS_NAME:
/* Dereference the reference pointer */
if (ObjDesc->Reference.Opcode == AML_REF_OF_OP)
if (ObjDesc->Reference.Class == ACPI_REFCLASS_REFOF)
{
Node = ObjDesc->Reference.Object;
}
@ -520,7 +528,7 @@ AcpiExResolveMultiple (
break;
case AML_INDEX_OP:
case ACPI_REFCLASS_INDEX:
/* Get the type of this reference (index into another object) */
@ -548,13 +556,19 @@ AcpiExResolveMultiple (
break;
case AML_LOCAL_OP:
case AML_ARG_OP:
case ACPI_REFCLASS_TABLE:
Type = ACPI_TYPE_DDB_HANDLE;
goto Exit;
case ACPI_REFCLASS_LOCAL:
case ACPI_REFCLASS_ARG:
if (ReturnDesc)
{
Status = AcpiDsMethodDataGetValue (ObjDesc->Reference.Opcode,
ObjDesc->Reference.Offset, WalkState, &ObjDesc);
Status = AcpiDsMethodDataGetValue (ObjDesc->Reference.Class,
ObjDesc->Reference.Value, WalkState, &ObjDesc);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -563,8 +577,8 @@ AcpiExResolveMultiple (
}
else
{
Status = AcpiDsMethodDataGetNode (ObjDesc->Reference.Opcode,
ObjDesc->Reference.Offset, WalkState, &Node);
Status = AcpiDsMethodDataGetNode (ObjDesc->Reference.Class,
ObjDesc->Reference.Value, WalkState, &Node);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -580,7 +594,7 @@ AcpiExResolveMultiple (
break;
case AML_DEBUG_OP:
case ACPI_REFCLASS_DEBUG:
/* The Debug Object is of type "DebugObject" */
@ -591,8 +605,7 @@ AcpiExResolveMultiple (
default:
ACPI_ERROR ((AE_INFO,
"Unknown Reference subtype %X",
ObjDesc->Reference.Opcode));
"Unknown Reference Class %2.2X", ObjDesc->Reference.Class));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
}
@ -601,7 +614,7 @@ AcpiExResolveMultiple (
* Now we are guaranteed to have an object that has not been created
* via the RefOf or Index operators.
*/
Type = ACPI_GET_OBJECT_TYPE (ObjDesc);
Type = ObjDesc->Common.Type;
Exit:

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: exresop - AML Interpreter operand/object resolution
* $Revision: 1.95 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -118,6 +117,7 @@
#define __EXRESOP_C__
#include "acpi.h"
#include "accommon.h"
#include "amlcode.h"
#include "acparser.h"
#include "acinterp.h"
@ -302,52 +302,48 @@ AcpiExResolveOperands (
/* ACPI internal object */
ObjectType = ACPI_GET_OBJECT_TYPE (ObjDesc);
ObjectType = ObjDesc->Common.Type;
/* Check for bad ACPI_OBJECT_TYPE */
if (!AcpiUtValidObjectType (ObjectType))
{
ACPI_ERROR ((AE_INFO,
"Bad operand object type [%X]",
ObjectType));
"Bad operand object type [%X]", ObjectType));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
if (ObjectType == (UINT8) ACPI_TYPE_LOCAL_REFERENCE)
{
/* Decode the Reference */
/* Validate the Reference */
OpInfo = AcpiPsGetOpcodeInfo (Opcode);
if (OpInfo->Class == AML_CLASS_UNKNOWN)
switch (ObjDesc->Reference.Class)
{
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
}
case ACPI_REFCLASS_DEBUG:
switch (ObjDesc->Reference.Opcode)
{
case AML_DEBUG_OP:
TargetOp = AML_DEBUG_OP;
/*lint -fallthrough */
case AML_INDEX_OP:
case AML_REF_OF_OP:
case AML_ARG_OP:
case AML_LOCAL_OP:
case AML_LOAD_OP: /* DdbHandle from LOAD_OP or LOAD_TABLE_OP */
case AML_INT_NAMEPATH_OP: /* Reference to a named object */
case ACPI_REFCLASS_ARG:
case ACPI_REFCLASS_LOCAL:
case ACPI_REFCLASS_INDEX:
case ACPI_REFCLASS_REFOF:
case ACPI_REFCLASS_TABLE: /* DdbHandle from LOAD_OP or LOAD_TABLE_OP */
case ACPI_REFCLASS_NAME: /* Reference to a named object */
ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Operand is a Reference, RefOpcode [%s]\n",
(AcpiPsGetOpcodeInfo (ObjDesc->Reference.Opcode))->Name)));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Operand is a Reference, Class [%s] %2.2X\n",
AcpiUtGetReferenceName (ObjDesc),
ObjDesc->Reference.Class));
break;
default:
ACPI_ERROR ((AE_INFO,
"Operand is a Reference, Unknown Reference Opcode: %X",
ObjDesc->Reference.Opcode));
"Unknown Reference Class %2.2X in %p",
ObjDesc->Reference.Class, ObjDesc));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
@ -359,8 +355,7 @@ AcpiExResolveOperands (
/* Invalid descriptor */
ACPI_ERROR ((AE_INFO,
"Invalid descriptor %p [%s]",
ACPI_ERROR ((AE_INFO, "Invalid descriptor %p [%s]",
ObjDesc, AcpiUtGetDescriptorName (ObjDesc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@ -380,7 +375,7 @@ AcpiExResolveOperands (
case ARGI_REF_OR_STRING: /* Can be a String or Reference */
if ((ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND) &&
(ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_STRING))
(ObjDesc->Common.Type == ACPI_TYPE_STRING))
{
/*
* String found - the string references a named object and
@ -430,8 +425,8 @@ AcpiExResolveOperands (
* -- All others must be resolved below.
*/
if ((Opcode == AML_STORE_OP) &&
(ACPI_GET_OBJECT_TYPE (*StackPtr) == ACPI_TYPE_LOCAL_REFERENCE) &&
((*StackPtr)->Reference.Opcode == AML_INDEX_OP))
((*StackPtr)->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
((*StackPtr)->Reference.Class == ACPI_REFCLASS_INDEX))
{
goto NextOperand;
}
@ -595,7 +590,7 @@ AcpiExResolveOperands (
/* Need an operand of type INTEGER, STRING or BUFFER */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_INTEGER:
case ACPI_TYPE_STRING:
@ -618,7 +613,7 @@ AcpiExResolveOperands (
/* Need an operand of type STRING or BUFFER */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
@ -660,7 +655,7 @@ AcpiExResolveOperands (
* The only reference allowed here is a direct reference to
* a namespace node.
*/
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_PACKAGE:
case ACPI_TYPE_STRING:
@ -684,7 +679,7 @@ AcpiExResolveOperands (
/* Need a buffer or package or (ACPI 2.0) String */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_PACKAGE:
case ACPI_TYPE_STRING:
@ -707,7 +702,7 @@ AcpiExResolveOperands (
/* Need an operand of type REGION or a BUFFER (which could be a resolved region field) */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_BUFFER:
case ACPI_TYPE_REGION:
@ -729,7 +724,7 @@ AcpiExResolveOperands (
/* Used by the Store() operator only */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_INTEGER:
case ACPI_TYPE_PACKAGE:
@ -789,7 +784,7 @@ AcpiExResolveOperands (
* required object type (Simple cases only).
*/
Status = AcpiExCheckObjectType (TypeNeeded,
ACPI_GET_OBJECT_TYPE (*StackPtr), *StackPtr);
(*StackPtr)->Common.Type, *StackPtr);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -806,6 +801,9 @@ AcpiExResolveOperands (
}
}
ACPI_DUMP_OPERANDS (WalkState->Operands,
AcpiPsGetOpcodeName (Opcode), WalkState->NumOperands);
return_ACPI_STATUS (Status);
}

View File

@ -2,7 +2,6 @@
/******************************************************************************
*
* Module Name: exstore - AML Interpreter object store support
* $Revision: 1.203 $
*
*****************************************************************************/
@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -118,11 +117,11 @@
#define __EXSTORE_C__
#include "acpi.h"
#include "accommon.h"
#include "acdispat.h"
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "acparser.h"
#define _COMPONENT ACPI_EXECUTER
@ -169,8 +168,13 @@ AcpiExDoDebugObject (
ACPI_FUNCTION_TRACE_PTR (ExDoDebugObject, SourceDesc);
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s",
Level, " "));
/* Print line header as long as we are not in the middle of an object display */
if (!((Level > 0) && Index == 0))
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s",
Level, " "));
}
/* Display index for package output only */
@ -182,13 +186,13 @@ AcpiExDoDebugObject (
if (!SourceDesc)
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "<Null Object>\n"));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[Null Object]\n"));
return_VOID;
}
if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_OPERAND)
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: ",
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s ",
AcpiUtGetObjectTypeName (SourceDesc)));
if (!AcpiUtValidInternalObject (SourceDesc))
@ -210,7 +214,9 @@ AcpiExDoDebugObject (
return_VOID;
}
switch (ACPI_GET_OBJECT_TYPE (SourceDesc))
/* SourceDesc is of type ACPI_DESC_TYPE_OPERAND */
switch (SourceDesc->Common.Type)
{
case ACPI_TYPE_INTEGER:
@ -244,7 +250,7 @@ AcpiExDoDebugObject (
case ACPI_TYPE_PACKAGE:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X Elements]\n",
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[Contains 0x%.2X Elements]\n",
SourceDesc->Package.Count));
/* Output the entire contents of the package */
@ -258,20 +264,69 @@ AcpiExDoDebugObject (
case ACPI_TYPE_LOCAL_REFERENCE:
if (SourceDesc->Reference.Opcode == AML_INDEX_OP)
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s] ",
AcpiUtGetReferenceName (SourceDesc)));
/* Decode the reference */
switch (SourceDesc->Reference.Class)
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s, 0x%X]\n",
AcpiPsGetOpcodeName (SourceDesc->Reference.Opcode),
SourceDesc->Reference.Offset));
}
else
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s]\n",
AcpiPsGetOpcodeName (SourceDesc->Reference.Opcode)));
case ACPI_REFCLASS_INDEX:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%X\n",
SourceDesc->Reference.Value));
break;
case ACPI_REFCLASS_TABLE:
/* Case for DdbHandle */
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Table Index 0x%X\n",
SourceDesc->Reference.Value));
return;
default:
break;
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, " "));
if (SourceDesc->Reference.Object)
/* Check for valid node first, then valid object */
if (SourceDesc->Reference.Node)
{
if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc->Reference.Node) !=
ACPI_DESC_TYPE_NAMED)
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT,
" %p - Not a valid namespace node\n",
SourceDesc->Reference.Node));
}
else
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Node %p [%4.4s] ",
SourceDesc->Reference.Node, (SourceDesc->Reference.Node)->Name.Ascii));
switch ((SourceDesc->Reference.Node)->Type)
{
/* These types have no attached object */
case ACPI_TYPE_DEVICE:
AcpiOsPrintf ("Device\n");
break;
case ACPI_TYPE_THERMAL:
AcpiOsPrintf ("Thermal Zone\n");
break;
default:
AcpiExDoDebugObject ((SourceDesc->Reference.Node)->Object,
Level+4, 0);
break;
}
}
}
else if (SourceDesc->Reference.Object)
{
if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc->Reference.Object) ==
ACPI_DESC_TYPE_NAMED)
@ -285,17 +340,12 @@ AcpiExDoDebugObject (
AcpiExDoDebugObject (SourceDesc->Reference.Object, Level+4, 0);
}
}
else if (SourceDesc->Reference.Node)
{
AcpiExDoDebugObject ((SourceDesc->Reference.Node)->Object,
Level+4, 0);
}
break;
default:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p %s\n",
SourceDesc, AcpiUtGetObjectTypeName (SourceDesc)));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p\n",
SourceDesc));
break;
}
@ -362,7 +412,7 @@ AcpiExStore (
/* Destination object must be a Reference or a Constant object */
switch (ACPI_GET_OBJECT_TYPE (DestDesc))
switch (DestDesc->Common.Type)
{
case ACPI_TYPE_LOCAL_REFERENCE:
break;
@ -386,25 +436,20 @@ AcpiExStore (
"Target is not a Reference or Constant object - %s [%p]",
AcpiUtGetObjectTypeName (DestDesc), DestDesc));
ACPI_DUMP_STACK_ENTRY (SourceDesc);
ACPI_DUMP_STACK_ENTRY (DestDesc);
ACPI_DUMP_OPERANDS (&DestDesc, ACPI_IMODE_EXECUTE, "ExStore",
2, "Target is not a Reference or Constant object");
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
/*
* Examine the Reference opcode. These cases are handled:
* Examine the Reference class. These cases are handled:
*
* 1) Store to Name (Change the object associated with a name)
* 2) Store to an indexed area of a Buffer or Package
* 3) Store to a Method Local or Arg
* 4) Store to the debug object
*/
switch (RefDesc->Reference.Opcode)
switch (RefDesc->Reference.Class)
{
case AML_REF_OF_OP:
case ACPI_REFCLASS_REFOF:
/* Storing an object into a Name "container" */
@ -414,7 +459,7 @@ AcpiExStore (
break;
case AML_INDEX_OP:
case ACPI_REFCLASS_INDEX:
/* Storing to an Index (pointer into a packager or buffer) */
@ -422,17 +467,17 @@ AcpiExStore (
break;
case AML_LOCAL_OP:
case AML_ARG_OP:
case ACPI_REFCLASS_LOCAL:
case ACPI_REFCLASS_ARG:
/* Store to a method local/arg */
Status = AcpiDsStoreObjectToLocal (RefDesc->Reference.Opcode,
RefDesc->Reference.Offset, SourceDesc, WalkState);
Status = AcpiDsStoreObjectToLocal (RefDesc->Reference.Class,
RefDesc->Reference.Value, SourceDesc, WalkState);
break;
case AML_DEBUG_OP:
case ACPI_REFCLASS_DEBUG:
/*
* Storing to the Debug object causes the value stored to be
@ -448,9 +493,9 @@ AcpiExStore (
default:
ACPI_ERROR ((AE_INFO, "Unknown Reference opcode %X",
RefDesc->Reference.Opcode));
ACPI_DUMP_ENTRY (RefDesc, ACPI_LV_ERROR);
ACPI_ERROR ((AE_INFO, "Unknown Reference Class %2.2X",
RefDesc->Reference.Class));
ACPI_DUMP_ENTRY (RefDesc, ACPI_LV_INFO);
Status = AE_AML_INTERNAL;
break;
@ -508,10 +553,23 @@ AcpiExStoreObjectToIndex (
*/
ObjDesc = *(IndexDesc->Reference.Where);
Status = AcpiUtCopyIobjectToIobject (SourceDesc, &NewDesc, WalkState);
if (ACPI_FAILURE (Status))
if (SourceDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE &&
SourceDesc->Reference.Class == ACPI_REFCLASS_TABLE)
{
return_ACPI_STATUS (Status);
/* This is a DDBHandle, just add a reference to it */
AcpiUtAddReference (SourceDesc);
NewDesc = SourceDesc;
}
else
{
/* Normal object, copy it */
Status = AcpiUtCopyIobjectToIobject (SourceDesc, &NewDesc, WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
if (ObjDesc)
@ -559,8 +617,8 @@ AcpiExStoreObjectToIndex (
* by the INDEX_OP code.
*/
ObjDesc = IndexDesc->Reference.Object;
if ((ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_BUFFER) &&
(ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_STRING))
if ((ObjDesc->Common.Type != ACPI_TYPE_BUFFER) &&
(ObjDesc->Common.Type != ACPI_TYPE_STRING))
{
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
@ -569,7 +627,7 @@ AcpiExStoreObjectToIndex (
* The assignment of the individual elements will be slightly
* different for each source type.
*/
switch (ACPI_GET_OBJECT_TYPE (SourceDesc))
switch (SourceDesc->Common.Type)
{
case ACPI_TYPE_INTEGER:
@ -598,7 +656,7 @@ AcpiExStoreObjectToIndex (
/* Store the source value into the target buffer byte */
ObjDesc->Buffer.Pointer[IndexDesc->Reference.Offset] = Value;
ObjDesc->Buffer.Pointer[IndexDesc->Reference.Value] = Value;
break;
@ -676,10 +734,18 @@ AcpiExStoreObjectToNode (
/* If no implicit conversion, drop into the default case below */
if ((!ImplicitConversion) || (WalkState->Opcode == AML_COPY_OP))
if ((!ImplicitConversion) ||
((WalkState->Opcode == AML_COPY_OP) &&
(TargetType != ACPI_TYPE_LOCAL_REGION_FIELD) &&
(TargetType != ACPI_TYPE_LOCAL_BANK_FIELD) &&
(TargetType != ACPI_TYPE_LOCAL_INDEX_FIELD)))
{
/* Force execution of default (no implicit conversion) */
/*
* Force execution of default (no implicit conversion). Note:
* CopyObject does not perform an implicit conversion, as per the ACPI
* spec -- except in case of region/bank/index fields -- because these
* objects must retain their original type permanently.
*/
TargetType = ACPI_TYPE_ANY;
}
@ -746,7 +812,7 @@ AcpiExStoreObjectToNode (
/* No conversions for all other types. Just attach the source object */
Status = AcpiNsAttachObject (Node, SourceDesc,
ACPI_GET_OBJECT_TYPE (SourceDesc));
SourceDesc->Common.Type);
break;
}

View File

@ -3,7 +3,6 @@
*
* Module Name: exstoren - AML Interpreter object store support,
* Store to Node (namespace object)
* $Revision: 1.71 $
*
*****************************************************************************/
@ -11,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@ -119,6 +118,7 @@
#define __EXSTOREN_C__
#include "acpi.h"
#include "accommon.h"
#include "acinterp.h"
#include "amlcode.h"
@ -177,7 +177,7 @@ AcpiExResolveObject (
* are all essentially the same. This case handles the
* "interchangeable" types Integer, String, and Buffer.
*/
if (ACPI_GET_OBJECT_TYPE (SourceDesc) == ACPI_TYPE_LOCAL_REFERENCE)
if (SourceDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE)
{
/* Resolve a reference object first */
@ -197,10 +197,11 @@ AcpiExResolveObject (
/* Must have a Integer, Buffer, or String */
if ((ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_INTEGER) &&
(ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_BUFFER) &&
(ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_STRING) &&
!((ACPI_GET_OBJECT_TYPE (SourceDesc) == ACPI_TYPE_LOCAL_REFERENCE) && (SourceDesc->Reference.Opcode == AML_LOAD_OP)))
if ((SourceDesc->Common.Type != ACPI_TYPE_INTEGER) &&
(SourceDesc->Common.Type != ACPI_TYPE_BUFFER) &&
(SourceDesc->Common.Type != ACPI_TYPE_STRING) &&
!((SourceDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
(SourceDesc->Reference.Class== ACPI_REFCLASS_TABLE)))
{
/* Conversion successful but still not a valid type */
@ -300,7 +301,7 @@ AcpiExStoreObjectToObject (
return_ACPI_STATUS (Status);
}
if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_GET_OBJECT_TYPE (DestDesc))
if (SourceDesc->Common.Type != DestDesc->Common.Type)
{
/*
* The source type does not match the type of the destination.
@ -311,7 +312,7 @@ AcpiExStoreObjectToObject (
* Otherwise, ActualSrcDesc is a temporary object to hold the
* converted object.
*/
Status = AcpiExConvertToTargetType (ACPI_GET_OBJECT_TYPE (DestDesc),
Status = AcpiExConvertToTargetType (DestDesc->Common.Type,
SourceDesc, &ActualSrcDesc, WalkState);
if (ACPI_FAILURE (Status))
{
@ -333,7 +334,7 @@ AcpiExStoreObjectToObject (
* We now have two objects of identical types, and we can perform a
* copy of the *value* of the source object.
*/
switch (ACPI_GET_OBJECT_TYPE (DestDesc))
switch (DestDesc->Common.Type)
{
case ACPI_TYPE_INTEGER:

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