acpi: Update to ACPICA 20130823.

This commit is contained in:
Jérôme Duval 2013-11-01 12:38:14 +01:00
parent 3329eaa1ad
commit c70258b79f
200 changed files with 12541 additions and 7182 deletions

View File

@ -36,6 +36,7 @@ local events_src =
evgpeblk.c
evgpeinit.c
evgpeutil.c
evhandler.c
evmisc.c
evregion.c
evrgnini.c
@ -89,6 +90,8 @@ local hardware_src =
local namespace_src =
nsaccess.c
nsalloc.c
nsarguments.c
nsconvert.c
nsdump.c
nsdumpdv.c
nseval.c
@ -98,6 +101,7 @@ local namespace_src =
nsobject.c
nsparse.c
nspredef.c
nsprepkg.c
nsrepair.c
nsrepair2.c
nssearch.c
@ -111,7 +115,9 @@ local namespace_src =
local parser_src =
psargs.c
psloop.c
psobject.c
psopcode.c
psopinfo.c
psparse.c
psscope.c
pstree.c
@ -140,6 +146,7 @@ local tables_src =
tbfadt.c
tbfind.c
tbinstal.c
tbprint.c
tbutils.c
tbxface.c
tbxfload.c
@ -149,12 +156,14 @@ local tables_src =
local utilities_src =
utaddress.c
utalloc.c
utbuffer.c
utcache.c
utclib.c
utcopy.c
utdecode.c
utdebug.c
utdelete.c
uterror.c
uteval.c
utexcep.c
utglobal.c
@ -166,8 +175,11 @@ local utilities_src =
utmutex.c
utobject.c
utosi.c
utownerid.c
utpredef.c
utresrc.c
utstate.c
utstring.c
uttrack.c
utxface.c
utxferror.c

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -196,19 +196,24 @@ AdWriteBuffer (
char *Buffer,
UINT32 Length)
{
FILE *fp;
FILE *File;
ACPI_SIZE Actual;
fp = fopen (Filename, "wb");
if (!fp)
File = fopen (Filename, "wb");
if (!File)
{
printf ("Couldn't open %s\n", Filename);
printf ("Could not open file %s\n", Filename);
return (-1);
}
Actual = fwrite (Buffer, (size_t) Length, 1, fp);
fclose (fp);
Actual = fwrite (Buffer, 1, (size_t) Length, File);
if (Actual != Length)
{
printf ("Could not write to file %s\n", Filename);
}
fclose (File);
return ((INT32) Actual);
}

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -141,11 +141,11 @@ extern int AslCompilerdebug;
#endif
ACPI_STATUS
LsDisplayNamespace (
NsDisplayNamespace (
void);
void
LsSetupNsList (
NsSetupNamespaceListing (
void *Handle);
@ -160,17 +160,6 @@ AdCreateTableHeader (
char *Filename,
ACPI_TABLE_HEADER *Table);
static ACPI_STATUS
AdDeferredParse (
ACPI_PARSE_OBJECT *Op,
UINT8 *Aml,
UINT32 AmlLength);
static ACPI_STATUS
AdParseDeferredOps (
ACPI_PARSE_OBJECT *Root);
/* Stubs for ASL compiler */
#ifndef ACPI_ASL_COMPILER
@ -424,6 +413,10 @@ AdAmlDisassemble (
{
AcpiDmClearExternalList ();
}
/* Load any externals defined in the optional external ref file */
AcpiDmGetExternalsFromFile ();
}
else
{
@ -455,7 +448,7 @@ AdAmlDisassemble (
}
/*
* Output: ASL code. Redirect to a file if requested
* Output: ASL code. Redirect to a file if requested
*/
if (OutToFile)
{
@ -512,8 +505,8 @@ AdAmlDisassemble (
{
AcpiOsPrintf ("/**** Before second load\n");
LsSetupNsList (File);
LsDisplayNamespace ();
NsSetupNamespaceListing (File);
NsDisplayNamespace ();
AcpiOsPrintf ("*****/\n");
}
@ -581,8 +574,8 @@ AdAmlDisassemble (
if (AslCompilerdebug)
{
AcpiOsPrintf ("/**** After second load and resource conversion\n");
LsSetupNsList (File);
LsDisplayNamespace ();
NsSetupNamespaceListing (File);
NsDisplayNamespace ();
AcpiOsPrintf ("*****/\n");
AcpiDmDumpTree (AcpiGbl_ParseOpRoot);
@ -623,17 +616,12 @@ Cleanup:
ACPI_FREE (Table);
}
if (DisasmFilename)
{
ACPI_FREE (DisasmFilename);
}
if (OutToFile && File)
{
if (AslCompilerdebug) /* Display final namespace, with transforms */
{
LsSetupNsList (File);
LsDisplayNamespace ();
NsSetupNamespaceListing (File);
NsDisplayNamespace ();
}
fclose (File);
@ -716,10 +704,12 @@ AdCreateTableHeader (
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))
@ -729,6 +719,7 @@ AdCreateTableHeader (
break;
default:
break;
}
AcpiOsPrintf ("\n");
@ -750,7 +741,7 @@ AdCreateTableHeader (
AcpiOsPrintf (" * OEM Revision 0x%8.8X (%u)\n", Table->OemRevision, Table->OemRevision);
AcpiOsPrintf (" * Compiler ID \"%.4s\"\n", Table->AslCompilerId);
AcpiOsPrintf (" * Compiler Version 0x%8.8X (%u)\n", Table->AslCompilerRevision, Table->AslCompilerRevision);
AcpiOsPrintf (" */\n\n");
AcpiOsPrintf (" */\n");
/* Create AML output filename based on input filename */
@ -823,207 +814,6 @@ AdDisplayTables (
}
/******************************************************************************
*
* FUNCTION: AdDeferredParse
*
* PARAMETERS: Op - Root Op of the deferred opcode
* Aml - Pointer to the raw AML
* AmlLength - Length of the AML
*
* RETURN: Status
*
* DESCRIPTION: Parse one deferred opcode
* (Methods, operation regions, etc.)
*
*****************************************************************************/
static ACPI_STATUS
AdDeferredParse (
ACPI_PARSE_OBJECT *Op,
UINT8 *Aml,
UINT32 AmlLength)
{
ACPI_WALK_STATE *WalkState;
ACPI_STATUS Status;
ACPI_PARSE_OBJECT *SearchOp;
ACPI_PARSE_OBJECT *StartOp;
UINT32 BaseAmlOffset;
ACPI_PARSE_OBJECT *ExtraOp;
ACPI_FUNCTION_TRACE (AdDeferredParse);
fprintf (stderr, ".");
if (!Aml || !AmlLength)
{
return_ACPI_STATUS (AE_OK);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Parsing %s [%4.4s]\n",
Op->Common.AmlOpName, (char *) &Op->Named.Name));
WalkState = AcpiDsCreateWalkState (0, Op, NULL, NULL);
if (!WalkState)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, Aml,
AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Parse the method */
WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE;
WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
Status = AcpiPsParseAml (WalkState);
/*
* We need to update all of the Aml offsets, since the parser thought
* that the method began at offset zero. In reality, it began somewhere
* within the ACPI table, at the BaseAmlOffset. Walk the entire tree that
* was just created and update the AmlOffset in each Op
*/
BaseAmlOffset = (Op->Common.Value.Arg)->Common.AmlOffset + 1;
StartOp = (Op->Common.Value.Arg)->Common.Next;
SearchOp = StartOp;
/* Walk the parse tree */
while (SearchOp)
{
SearchOp->Common.AmlOffset += BaseAmlOffset;
SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp);
}
/*
* Link the newly parsed subtree into the main parse tree
*/
switch (Op->Common.AmlOpcode)
{
case AML_BUFFER_OP:
case AML_PACKAGE_OP:
case AML_VAR_PACKAGE_OP:
switch (Op->Common.AmlOpcode)
{
case AML_PACKAGE_OP:
ExtraOp = Op->Common.Value.Arg;
ExtraOp = ExtraOp->Common.Next;
Op->Common.Value.Arg = ExtraOp->Common.Value.Arg;
break;
case AML_VAR_PACKAGE_OP:
case AML_BUFFER_OP:
default:
ExtraOp = Op->Common.Value.Arg;
Op->Common.Value.Arg = ExtraOp->Common.Value.Arg;
break;
}
/* Must point all parents to the main tree */
StartOp = Op;
SearchOp = StartOp;
while (SearchOp)
{
if (SearchOp->Common.Parent == ExtraOp)
{
SearchOp->Common.Parent = Op;
}
SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp);
}
break;
default:
break;
}
return_ACPI_STATUS (AE_OK);
}
/******************************************************************************
*
* FUNCTION: AdParseDeferredOps
*
* PARAMETERS: Root - Root of the parse tree
*
* RETURN: Status
*
* DESCRIPTION: Parse the deferred opcodes (Methods, regions, etc.)
*
*****************************************************************************/
static ACPI_STATUS
AdParseDeferredOps (
ACPI_PARSE_OBJECT *Root)
{
ACPI_PARSE_OBJECT *Op = Root;
ACPI_STATUS Status = AE_OK;
const ACPI_OPCODE_INFO *OpInfo;
ACPI_FUNCTION_NAME (AdParseDeferredOps);
fprintf (stderr, "Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)\n");
while (Op)
{
OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
if (!(OpInfo->Flags & AML_DEFER))
{
Op = AcpiPsGetDepthNext (Root, Op);
continue;
}
switch (Op->Common.AmlOpcode)
{
case AML_METHOD_OP:
case AML_BUFFER_OP:
case AML_PACKAGE_OP:
case AML_VAR_PACKAGE_OP:
Status = AdDeferredParse (Op, Op->Named.Data, Op->Named.Length);
if (ACPI_FAILURE (Status))
{
return (Status);
}
break;
case AML_REGION_OP:
case AML_DATA_REGION_OP:
case AML_CREATE_QWORD_FIELD_OP:
case AML_CREATE_DWORD_FIELD_OP:
case AML_CREATE_WORD_FIELD_OP:
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 */
break;
default:
ACPI_ERROR ((AE_INFO, "Unhandled deferred opcode [%s]",
Op->Common.AmlOpName));
break;
}
Op = AcpiPsGetDepthNext (Root, Op);
}
fprintf (stderr, "\n");
return (Status);
}
/******************************************************************************
*
* FUNCTION: AdGetLocalTables
@ -1263,7 +1053,9 @@ AdParseTable (
/* Pass 3: Parse control methods and link their parse trees into the main parse tree */
Status = AdParseDeferredOps (AcpiGbl_ParseOpRoot);
fprintf (stderr, "Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)\n");
Status = AcpiDmParseDeferredOps (AcpiGbl_ParseOpRoot);
fprintf (stderr, "\n");
/* Process Resource Templates */

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -445,16 +445,27 @@ AcpiDmDumpDescending (
switch (Op->Common.AmlOpcode)
{
case AML_BYTE_OP:
AcpiOsPrintf ("%2.2X", (UINT32) Op->Common.Value.Integer);
break;
case AML_WORD_OP:
AcpiOsPrintf ("%4.4X", (UINT32) Op->Common.Value.Integer);
break;
case AML_DWORD_OP:
AcpiOsPrintf ("%X", (UINT32) Op->Common.Value.Integer);
AcpiOsPrintf ("%8.8X", (UINT32) Op->Common.Value.Integer);
break;
case AML_QWORD_OP:
AcpiOsPrintf ("%8.8X%8.8X", ACPI_FORMAT_UINT64 (Op->Common.Value.Integer));
break;
case AML_INT_NAMEPATH_OP:
if (Op->Common.Value.String)
{
AcpiNsExternalizeName (ACPI_UINT32_MAX, Op->Common.Value.String,
@ -472,10 +483,12 @@ AcpiDmDumpDescending (
case AML_METHOD_OP:
case AML_DEVICE_OP:
case AML_INT_NAMEDFIELD_OP:
AcpiOsPrintf ("%4.4s", ACPI_CAST_PTR (char, &Op->Named.Name));
break;
default:
break;
}
@ -522,6 +535,7 @@ AcpiDmFindOrphanDescending (
{
#ifdef ACPI_UNDER_DEVELOPMENT
case AML_ADD_OP:
ChildOp = Op->Common.Value.Arg;
if ((ChildOp->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&
!ChildOp->Common.Node)
@ -628,6 +642,7 @@ AcpiDmFindOrphanDescending (
break;
default:
break;
}
@ -909,7 +924,7 @@ AcpiDmXrefDescendingOp (
}
}
AcpiDmAddToExternalList (Op, Path, (UINT8) ObjectType2, ParamCount);
AcpiDmAddToExternalList (Op, Path, (UINT8) ObjectType2, ParamCount | 0x80);
Op->Common.Node = Node;
}
else

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -133,7 +133,7 @@
const AH_PREDEFINED_NAME AslPredefinedInfo[] =
{
AH_PREDEF ("_ACx", "Active Cooling", "Returns the active cooling policy threshold values"),
AH_PREDEF ("_ADR", "Address", "Returns the address of a device on its parent bus"),
AH_PREDEF ("_ADR", "Address", "Returns address of a device on parent bus, and resource field"),
AH_PREDEF ("_AEI", "ACPI Event Interrupts", "Returns a list of GPIO events to be used as ACPI events"),
AH_PREDEF ("_ALC", "Ambient Light Chromaticity", "Returns the ambient light color chromaticity"),
AH_PREDEF ("_ALI", "Ambient Light Illuminance", "Returns the ambient light brightness"),
@ -185,7 +185,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] =
AH_PREDEF ("_DGS", "Display Graphics State", "Return the current state of the output device"),
AH_PREDEF ("_DIS", "Disable Device", "Disables a device"),
AH_PREDEF ("_DLM", "Device Lock Mutex", "Defines mutex for OS/AML sharing"),
AH_PREDEF ("_DMA", "Direct Memory Access", "Returns a device's current resources for DMA transactions"),
AH_PREDEF ("_DMA", "Direct Memory Access", "Returns device current resources for DMA transactions, and resource field"),
AH_PREDEF ("_DOD", "Display Output Devices", "Enumerate all devices attached to the display adapter"),
AH_PREDEF ("_DOS", "Disable Output Switching", "Sets the display output switching mode"),
AH_PREDEF ("_DPL", "Device Selection Polarity", "Polarity of Device Selection signal, Resource Descriptor field"),

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -118,6 +118,9 @@
#include "amlcode.h"
#include "acnamesp.h"
#include "acdisasm.h"
#include "aslcompiler.h"
#include <stdio.h>
#include <errno.h>
/*
@ -158,6 +161,8 @@ static const char *AcpiGbl_DmTypeNames[] =
/* 19 */ ", FieldUnitObj"
};
#define METHOD_SEPARATORS " \t,()\n"
/* Local prototypes */
@ -170,6 +175,12 @@ AcpiDmNormalizeParentPrefix (
ACPI_PARSE_OBJECT *Op,
char *Path);
static void
AcpiDmAddToExternalListFromFile (
char *Path,
UINT8 Type,
UINT32 Value);
/*******************************************************************************
*
@ -225,10 +236,17 @@ AcpiDmNormalizeParentPrefix (
char *Fullpath;
char *ParentPath;
ACPI_SIZE Length;
UINT32 Index = 0;
/* Search upwards in the parse tree until we reach a namespace node */
if (!Op)
{
return (NULL);
}
/* Search upwards in the parse tree until we reach the next namespace node */
Op = Op->Common.Parent;
while (Op)
{
if (Op->Common.Node)
@ -277,6 +295,13 @@ AcpiDmNormalizeParentPrefix (
* for the required dot separator (ParentPath.Path)
*/
Length++;
/* For External() statements, we do not want a leading '\' */
if (*ParentPath == AML_ROOT_PREFIX)
{
Index = 1;
}
}
Fullpath = ACPI_ALLOCATE_ZEROED (Length);
@ -291,7 +316,7 @@ AcpiDmNormalizeParentPrefix (
*
* Copy the parent path
*/
ACPI_STRCAT (Fullpath, ParentPath);
ACPI_STRCPY (Fullpath, &ParentPath[Index]);
/*
* Add dot separator
@ -431,6 +456,7 @@ AcpiDmAddToExternalList (
ACPI_EXTERNAL_LIST *NextExternal;
ACPI_EXTERNAL_LIST *PrevExternal = NULL;
ACPI_STATUS Status;
BOOLEAN Resolved = FALSE;
if (!Path)
@ -438,7 +464,31 @@ AcpiDmAddToExternalList (
return;
}
/* Externalize the ACPI path */
if (Type == ACPI_TYPE_METHOD)
{
if (Value & 0x80)
{
Resolved = TRUE;
}
Value &= 0x07;
}
/*
* We don't want External() statements to contain a leading '\'.
* This prevents duplicate external statements of the form:
*
* External (\ABCD)
* External (ABCD)
*
* This would cause a compile time error when the disassembled
* output file is recompiled.
*/
if ((*Path == AML_ROOT_PREFIX) && (Path[1]))
{
Path++;
}
/* Externalize the ACPI pathname */
Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, Path,
NULL, &ExternalPath);
@ -447,8 +497,10 @@ AcpiDmAddToExternalList (
return;
}
/* Get the full pathname from root if "Path" has a parent prefix */
/*
* Get the full pathname from the root if "Path" has one or more
* parent prefixes (^). Note: path will not contain a leading '\'.
*/
if (*Path == (UINT8) AML_PARENT_PREFIX)
{
Fullpath = AcpiDmNormalizeParentPrefix (Op, ExternalPath);
@ -474,7 +526,7 @@ AcpiDmAddToExternalList (
(NextExternal->Value != Value))
{
ACPI_ERROR ((AE_INFO,
"Argument count mismatch for method %s %u %u",
"External method arg count mismatch %s: Current %u, attempted %u",
NextExternal->Path, NextExternal->Value, Value));
}
@ -505,6 +557,7 @@ AcpiDmAddToExternalList (
NewExternal->Path = ExternalPath;
NewExternal->Type = Type;
NewExternal->Value = Value;
NewExternal->Resolved = Resolved;
NewExternal->Length = (UINT16) ACPI_STRLEN (ExternalPath);
/* Was the external path with parent prefix normalized to a fullpath? */
@ -563,6 +616,275 @@ AcpiDmAddToExternalList (
}
/*******************************************************************************
*
* FUNCTION: AcpiDmGetExternalsFromFile
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Process the optional external reference file.
*
* Each line in the file should be of the form:
* External (<Method namepath>, MethodObj, <ArgCount>)
*
* Example:
* External (_SB_.PCI0.XHC_.PS0X, MethodObj, 4)
*
******************************************************************************/
void
AcpiDmGetExternalsFromFile (
void)
{
FILE *ExternalRefFile;
char *Token;
char *MethodName;
UINT32 ArgCount;
UINT32 ImportCount = 0;
if (!Gbl_ExternalRefFilename)
{
return;
}
/* Open the file */
ExternalRefFile = fopen (Gbl_ExternalRefFilename, "r");
if (!ExternalRefFile)
{
fprintf (stderr, "Could not open external reference file \"%s\"\n",
Gbl_ExternalRefFilename);
return;
}
/* Each line defines a method */
while (fgets (StringBuffer, ASL_MSG_BUFFER_SIZE, ExternalRefFile))
{
Token = strtok (StringBuffer, METHOD_SEPARATORS); /* "External" */
if (!Token) continue;
if (strcmp (Token, "External")) continue;
MethodName = strtok (NULL, METHOD_SEPARATORS); /* Method namepath */
if (!MethodName) continue;
Token = strtok (NULL, METHOD_SEPARATORS); /* "MethodObj" */
if (!Token) continue;
if (strcmp (Token, "MethodObj")) continue;
Token = strtok (NULL, METHOD_SEPARATORS); /* Arg count */
if (!Token) continue;
/* Convert arg count string to an integer */
errno = 0;
ArgCount = strtoul (Token, NULL, 0);
if (errno)
{
fprintf (stderr, "Invalid argument count (%s)\n", Token);
continue;
}
if (ArgCount > 7)
{
fprintf (stderr, "Invalid argument count (%u)\n", ArgCount);
continue;
}
/* Add this external to the global list */
AcpiOsPrintf ("%s: Importing method external (%u arguments) %s\n",
Gbl_ExternalRefFilename, ArgCount, MethodName);
AcpiDmAddToExternalListFromFile (MethodName, ACPI_TYPE_METHOD, ArgCount | 0x80);
ImportCount++;
}
if (!ImportCount)
{
fprintf (stderr, "Did not find any external methods in reference file \"%s\"\n",
Gbl_ExternalRefFilename);
}
else
{
/* Add the external(s) to the namespace */
AcpiDmAddExternalsToNamespace ();
AcpiOsPrintf ("%s: Imported %u external method definitions\n",
Gbl_ExternalRefFilename, ImportCount);
}
fclose (ExternalRefFile);
}
/*******************************************************************************
*
* FUNCTION: AcpiDmAddToExternalListFromFile
*
* PARAMETERS: Path - Internal (AML) path to the object
* Type - ACPI object type to be added
* Value - Arg count if adding a Method object
*
* RETURN: None
*
* DESCRIPTION: Insert a new name into the global list of Externals which
* will in turn be later emitted as an External() declaration
* in the disassembled output.
*
******************************************************************************/
static void
AcpiDmAddToExternalListFromFile (
char *Path,
UINT8 Type,
UINT32 Value)
{
char *InternalPath;
char *ExternalPath;
ACPI_EXTERNAL_LIST *NewExternal;
ACPI_EXTERNAL_LIST *NextExternal;
ACPI_EXTERNAL_LIST *PrevExternal = NULL;
ACPI_STATUS Status;
BOOLEAN Resolved = FALSE;
if (!Path)
{
return;
}
/* TBD: Add a flags parameter */
if (Type == ACPI_TYPE_METHOD)
{
if (Value & 0x80)
{
Resolved = TRUE;
}
Value &= 0x07;
}
/*
* We don't want External() statements to contain a leading '\'.
* This prevents duplicate external statements of the form:
*
* External (\ABCD)
* External (ABCD)
*
* This would cause a compile time error when the disassembled
* output file is recompiled.
*/
if ((*Path == AML_ROOT_PREFIX) && (Path[1]))
{
Path++;
}
/* Check all existing externals to ensure no duplicates */
NextExternal = AcpiGbl_ExternalList;
while (NextExternal)
{
if (!ACPI_STRCMP (Path, NextExternal->Path))
{
/* Duplicate method, check that the Value (ArgCount) is the same */
if ((NextExternal->Type == ACPI_TYPE_METHOD) &&
(NextExternal->Value != Value))
{
ACPI_ERROR ((AE_INFO,
"(File) External method arg count mismatch %s: Current %u, override to %u",
NextExternal->Path, NextExternal->Value, Value));
/* Override, since new value came from external reference file */
NextExternal->Value = Value;
}
/* Allow upgrade of type from ANY */
else if (NextExternal->Type == ACPI_TYPE_ANY)
{
NextExternal->Type = Type;
NextExternal->Value = Value;
}
return;
}
NextExternal = NextExternal->Next;
}
/* Get the internal pathname (AML format) */
Status = AcpiNsInternalizeName (Path, &InternalPath);
if (ACPI_FAILURE (Status))
{
return;
}
/* Allocate and init a new External() descriptor */
NewExternal = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EXTERNAL_LIST));
if (!NewExternal)
{
ACPI_FREE (InternalPath);
return;
}
/* Must copy and normalize the input path */
AcpiNsExternalizeName (ACPI_UINT32_MAX, InternalPath, NULL, &ExternalPath);
NewExternal->Path = ExternalPath;
NewExternal->Type = Type;
NewExternal->Value = Value;
NewExternal->Resolved = Resolved;
NewExternal->Length = (UINT16) ACPI_STRLEN (Path);
NewExternal->InternalPath = InternalPath;
/* Set flag to indicate External->InternalPath needs to be freed */
NewExternal->Flags |= ACPI_IPATH_ALLOCATED | ACPI_FROM_REFERENCE_FILE;
/* Link the new descriptor into the global list, alphabetically ordered */
NextExternal = AcpiGbl_ExternalList;
while (NextExternal)
{
if (AcpiUtStricmp (NewExternal->Path, NextExternal->Path) < 0)
{
if (PrevExternal)
{
PrevExternal->Next = NewExternal;
}
else
{
AcpiGbl_ExternalList = NewExternal;
}
NewExternal->Next = NextExternal;
return;
}
PrevExternal = NextExternal;
NextExternal = NextExternal->Next;
}
if (PrevExternal)
{
PrevExternal->Next = NewExternal;
}
else
{
AcpiGbl_ExternalList = NewExternal;
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDmAddExternalsToNamespace
@ -592,7 +914,7 @@ AcpiDmAddExternalsToNamespace (
Status = AcpiNsLookup (NULL, External->InternalPath, External->Type,
ACPI_IMODE_LOAD_PASS1,
ACPI_NS_EXTERNAL | ACPI_NS_DONT_OPEN_SCOPE,
ACPI_NS_ERROR_IF_FOUND | ACPI_NS_EXTERNAL | ACPI_NS_DONT_OPEN_SCOPE,
NULL, &Node);
if (ACPI_FAILURE (Status))
@ -623,6 +945,7 @@ AcpiDmAddExternalsToNamespace (
break;
default:
break;
}
@ -725,23 +1048,112 @@ AcpiDmEmitExternals (
}
/*
* Walk the list of externals (unresolved references)
* found during the AML parsing
* Determine the number of control methods in the external list, and
* also how many of those externals were resolved via the namespace.
*/
NextExternal = AcpiGbl_ExternalList;
while (NextExternal)
{
if (NextExternal->Type == ACPI_TYPE_METHOD)
{
AcpiGbl_NumExternalMethods++;
if (NextExternal->Resolved)
{
AcpiGbl_ResolvedExternalMethods++;
}
}
NextExternal = NextExternal->Next;
}
/* Check if any control methods were unresolved */
AcpiDmUnresolvedWarning (1);
/* Emit any unresolved method externals in a single text block */
NextExternal = AcpiGbl_ExternalList;
while (NextExternal)
{
if ((NextExternal->Type == ACPI_TYPE_METHOD) &&
(!NextExternal->Resolved))
{
AcpiOsPrintf (" External (%s%s",
NextExternal->Path,
AcpiDmGetObjectTypeName (NextExternal->Type));
AcpiOsPrintf (
") // Warning: Unresolved Method, "
"guessing %u arguments (may be incorrect, see warning above)\n",
NextExternal->Value);
NextExternal->Emitted = TRUE;
}
NextExternal = NextExternal->Next;
}
AcpiOsPrintf ("\n");
/* Emit externals that were imported from a file */
if (Gbl_ExternalRefFilename)
{
AcpiOsPrintf (
" /*\n * External declarations that were imported from\n"
" * the reference file [%s]\n */\n",
Gbl_ExternalRefFilename);
NextExternal = AcpiGbl_ExternalList;
while (NextExternal)
{
if (!NextExternal->Emitted && (NextExternal->Flags & ACPI_FROM_REFERENCE_FILE))
{
AcpiOsPrintf (" External (%s%s",
NextExternal->Path,
AcpiDmGetObjectTypeName (NextExternal->Type));
if (NextExternal->Type == ACPI_TYPE_METHOD)
{
AcpiOsPrintf (") // %u Arguments\n",
NextExternal->Value);
}
else
{
AcpiOsPrintf (")\n");
}
NextExternal->Emitted = TRUE;
}
NextExternal = NextExternal->Next;
}
AcpiOsPrintf ("\n");
}
/*
* Walk the list of externals found during the AML parsing
*/
while (AcpiGbl_ExternalList)
{
AcpiOsPrintf (" External (%s%s",
AcpiGbl_ExternalList->Path,
AcpiDmGetObjectTypeName (AcpiGbl_ExternalList->Type));
if (!AcpiGbl_ExternalList->Emitted)
{
AcpiOsPrintf (" External (%s%s",
AcpiGbl_ExternalList->Path,
AcpiDmGetObjectTypeName (AcpiGbl_ExternalList->Type));
if (AcpiGbl_ExternalList->Type == ACPI_TYPE_METHOD)
{
AcpiOsPrintf (") // %u Arguments\n",
AcpiGbl_ExternalList->Value);
}
else
{
AcpiOsPrintf (")\n");
/* For methods, add a comment with the number of arguments */
if (AcpiGbl_ExternalList->Type == ACPI_TYPE_METHOD)
{
AcpiOsPrintf (") // %u Arguments\n",
AcpiGbl_ExternalList->Value);
}
else
{
AcpiOsPrintf (")\n");
}
}
/* Free this external info block and move on to next external */
@ -759,3 +1171,172 @@ AcpiDmEmitExternals (
AcpiOsPrintf ("\n");
}
/*******************************************************************************
*
* FUNCTION: AcpiDmUnresolvedWarning
*
* PARAMETERS: Type - Where to output the warning.
* 0 means write to stderr
* 1 means write to AcpiOsPrintf
*
* RETURN: None
*
* DESCRIPTION: Issue warning message if there are unresolved external control
* methods within the disassembly.
*
******************************************************************************/
#if 0
Summary of the external control method problem:
When the -e option is used with disassembly, the various SSDTs are simply
loaded into a global namespace for the disassembler to use in order to
resolve control method references (invocations).
The disassembler tracks any such references, and will emit an External()
statement for these types of methods, with the proper number of arguments .
Without the SSDTs, the AML does not contain enough information to properly
disassemble the control method invocation -- because the disassembler does
not know how many arguments to parse.
An example: Assume we have two control methods. ABCD has one argument, and
EFGH has zero arguments. Further, we have two additional control methods
that invoke ABCD and EFGH, named T1 and T2:
Method (ABCD, 1)
{
}
Method (EFGH, 0)
{
}
Method (T1)
{
ABCD (Add (2, 7, Local0))
}
Method (T2)
{
EFGH ()
Add (2, 7, Local0)
}
Here is the AML code that is generated for T1 and T2:
185: Method (T1)
0000034C: 14 10 54 31 5F 5F 00 ... "..T1__."
186: {
187: ABCD (Add (2, 7, Local0))
00000353: 41 42 43 44 ............ "ABCD"
00000357: 72 0A 02 0A 07 60 ...... "r....`"
188: }
190: Method (T2)
0000035D: 14 10 54 32 5F 5F 00 ... "..T2__."
191: {
192: EFGH ()
00000364: 45 46 47 48 ............ "EFGH"
193: Add (2, 7, Local0)
00000368: 72 0A 02 0A 07 60 ...... "r....`"
194: }
Note that the AML code for T1 and T2 is essentially identical. When
disassembling this code, the methods ABCD and EFGH must be known to the
disassembler, otherwise it does not know how to handle the method invocations.
In other words, if ABCD and EFGH are actually external control methods
appearing in an SSDT, the disassembler does not know what to do unless
the owning SSDT has been loaded via the -e option.
#endif
void
AcpiDmUnresolvedWarning (
UINT8 Type)
{
if (!AcpiGbl_NumExternalMethods)
{
return;
}
if (Type)
{
if (!AcpiGbl_ExternalFileList)
{
/* The -e option was not specified */
AcpiOsPrintf (" /*\n"
" * iASL Warning: There were %u external control methods found during\n"
" * disassembly, but additional ACPI tables to resolve these externals\n"
" * were not specified. This resulting disassembler output file may not\n"
" * compile because the disassembler did not know how many arguments\n"
" * to assign to these methods. To specify the tables needed to resolve\n"
" * external control method references, use the one of the following\n"
" * example iASL invocations:\n"
" * iasl -e <ssdt1.aml,ssdt2.aml...> -d <dsdt.aml>\n"
" * iasl -e <dsdt.aml,ssdt2.aml...> -d <ssdt1.aml>\n"
" */\n",
AcpiGbl_NumExternalMethods);
}
else if (AcpiGbl_NumExternalMethods != AcpiGbl_ResolvedExternalMethods)
{
/* The -e option was specified, but there are still some unresolved externals */
AcpiOsPrintf (" /*\n"
" * iASL Warning: There were %u external control methods found during\n"
" * disassembly, but only %u %s resolved (%u unresolved). Additional\n"
" * ACPI tables are required to properly disassemble the code. This\n"
" * resulting disassembler output file may not compile because the\n"
" * disassembler did not know how many arguments to assign to the\n"
" * unresolved methods.\n"
" */\n",
AcpiGbl_NumExternalMethods, AcpiGbl_ResolvedExternalMethods,
(AcpiGbl_ResolvedExternalMethods > 1 ? "were" : "was"),
(AcpiGbl_NumExternalMethods - AcpiGbl_ResolvedExternalMethods));
}
}
else
{
if (!AcpiGbl_ExternalFileList)
{
/* The -e option was not specified */
fprintf (stderr, "\n"
"iASL Warning: There were %u external control methods found during\n"
"disassembly, but additional ACPI tables to resolve these externals\n"
"were not specified. The resulting disassembler output file may not\n"
"compile because the disassembler did not know how many arguments\n"
"to assign to these methods. To specify the tables needed to resolve\n"
"external control method references, use the one of the following\n"
"example iASL invocations:\n"
" iasl -e <ssdt1.aml,ssdt2.aml...> -d <dsdt.aml>\n"
" iasl -e <dsdt.aml,ssdt2.aml...> -d <ssdt1.aml>\n",
AcpiGbl_NumExternalMethods);
}
else if (AcpiGbl_NumExternalMethods != AcpiGbl_ResolvedExternalMethods)
{
/* The -e option was specified, but there are still some unresolved externals */
fprintf (stderr, "\n"
"iASL Warning: There were %u external control methods found during\n"
"disassembly, but only %u %s resolved (%u unresolved). Additional\n"
"ACPI tables are required to properly disassemble the code. The\n"
"resulting disassembler output file may not compile because the\n"
"disassembler did not know how many arguments to assign to the\n"
"unresolved methods.\n",
AcpiGbl_NumExternalMethods, AcpiGbl_ResolvedExternalMethods,
(AcpiGbl_ResolvedExternalMethods > 1 ? "were" : "was"),
(AcpiGbl_NumExternalMethods - AcpiGbl_ResolvedExternalMethods));
}
}
}

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -161,7 +161,7 @@ AcpiDmAddResourceToNamespace (
UINT32 Length,
UINT32 Offset,
UINT8 ResourceIndex,
void *Context);
void **Context);
static void
AcpiDmAddResourcesToNamespace (
@ -697,7 +697,7 @@ AcpiGetTagPathname (
Aml = ACPI_CAST_PTR (AML_RESOURCE,
&Op->Named.Data[ResourceNode->Value]);
Status = AcpiUtValidateResource (Aml, &ResourceTableIndex);
Status = AcpiUtValidateResource (NULL, Aml, &ResourceTableIndex);
if (ACPI_FAILURE (Status))
{
return (NULL);
@ -738,6 +738,7 @@ AcpiGetTagPathname (
Status = AcpiNsBuildExternalPath (BufferNode, RequiredSize, Pathname);
if (ACPI_FAILURE (Status))
{
ACPI_FREE (Pathname);
return (NULL);
}
@ -870,7 +871,6 @@ AcpiDmGetResourceTag (
case ACPI_RESOURCE_NAME_ADDRESS32:
case ACPI_RESOURCE_NAME_ADDRESS64:
case ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64:
/*
* Subtype differentiation is the flags.
* Kindof brute force, but just blindly search for an index match
@ -918,6 +918,7 @@ AcpiDmGetResourceTag (
break;
default:
break;
}
@ -1010,7 +1011,7 @@ AcpiDmFindResources (
* resource descriptors to the namespace, as children of the
* buffer node.
*/
if (ACPI_SUCCESS (AcpiDmIsResourceTemplate (Op)))
if (ACPI_SUCCESS (AcpiDmIsResourceTemplate (NULL, Op)))
{
Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE;
AcpiDmAddResourcesToNamespace (Parent->Common.Node, Op);
@ -1063,9 +1064,9 @@ AcpiDmAddResourcesToNamespace (
* Insert each resource into the namespace
* NextOp contains the Aml pointer and the Aml length
*/
AcpiUtWalkAmlResources ((UINT8 *) NextOp->Named.Data,
AcpiUtWalkAmlResources (NULL, (UINT8 *) NextOp->Named.Data,
(ACPI_SIZE) NextOp->Common.Value.Integer,
AcpiDmAddResourceToNamespace, BufferNode);
AcpiDmAddResourceToNamespace, (void **) BufferNode);
}
@ -1091,7 +1092,7 @@ AcpiDmAddResourceToNamespace (
UINT32 Length,
UINT32 Offset,
UINT8 ResourceIndex,
void *Context)
void **Context)
{
ACPI_STATUS Status;
ACPI_GENERIC_STATE ScopeInfo;

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -172,6 +172,7 @@ static const char *AcpiDmEinjActions[] =
"Execute Operation",
"Check Busy Status",
"Get Command Status",
"Set Error Type With Address",
"Unknown Action"
};
@ -182,6 +183,7 @@ static const char *AcpiDmEinjInstructions[] =
"Write Register",
"Write Register Value",
"Noop",
"Flush Cacheline",
"Unknown Instruction"
};
@ -252,6 +254,8 @@ static const char *AcpiDmHestNotifySubnames[] =
"Local Interrupt",
"SCI",
"NMI",
"CMCI", /* ACPI 5.0 */
"MCE", /* ACPI 5.0 */
"Unknown Notify Type" /* Reserved */
};
@ -353,7 +357,7 @@ ACPI_DMTABLE_DATA AcpiDmTableData[] =
{ACPI_SIG_BGRT, AcpiDmTableInfoBgrt, NULL, NULL, TemplateBgrt, "Boot Graphics Resource Table"},
{ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot, "Simple Boot Flag Table"},
{ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, TemplateCpep, "Corrected Platform Error Polling table"},
{ACPI_SIG_CSRT, NULL, AcpiDmDumpCsrt, NULL, NULL, "Core System Resource Table"},
{ACPI_SIG_CSRT, NULL, AcpiDmDumpCsrt, DtCompileCsrt, TemplateCsrt, "Core System Resource Table"},
{ACPI_SIG_DBG2, NULL, AcpiDmDumpDbg2, NULL, NULL, "Debug Port table type 2"},
{ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, NULL, TemplateDbgp, "Debug Port table"},
{ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, DtCompileDmar, TemplateDmar, "DMA Remapping table"},
@ -371,6 +375,7 @@ ACPI_DMTABLE_DATA AcpiDmTableData[] =
{ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, NULL, TemplateMchi, "Management Controller Host Interface table"},
{ACPI_SIG_MPST, AcpiDmTableInfoMpst, AcpiDmDumpMpst, DtCompileMpst, TemplateMpst, "Memory Power State Table"},
{ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, TemplateMsct, "Maximum System Characteristics Table"},
{ACPI_SIG_MTMR, NULL, AcpiDmDumpMtmr, DtCompileMtmr, TemplateMtmr, "MID Timer Table"},
{ACPI_SIG_PCCT, NULL, AcpiDmDumpPcct, NULL, NULL, "Platform Communications Channel Table"},
{ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt, "Platform Memory Topology Table"},
{ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt, "Root System Description Table"},
@ -382,7 +387,9 @@ ACPI_DMTABLE_DATA AcpiDmTableData[] =
{ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, TemplateSpmi, "Server Platform Management Interface table"},
{ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat, "System Resource Affinity Table"},
{ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, NULL, TemplateTcpa, "Trusted Computing Platform Alliance table"},
{ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, NULL, NULL, TemplateTpm2, "Trusted Platform Module hardware interface table"},
{ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi, "UEFI Boot Optimization Table"},
{ACPI_SIG_VRTC, AcpiDmTableInfoVrtc, AcpiDmDumpVrtc, DtCompileVrtc, TemplateVrtc, "Virtual Real-Time Clock Table"},
{ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet, "Windows ACPI Emulated Devices Table"},
{ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, TemplateWdat, "Watchdog Action Table"},
{ACPI_SIG_WDDT, AcpiDmTableInfoWddt, NULL, NULL, TemplateWddt, "Watchdog Description Table"},
@ -511,7 +518,7 @@ AcpiDmDumpDataTable (
Length = Table->Length;
AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
}
else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_RSDP))
else if (ACPI_VALIDATE_RSDP_SIG (Table->Signature))
{
Length = AcpiDmDumpRsdp (Table);
}
@ -546,6 +553,8 @@ AcpiDmDumpDataTable (
{
AcpiOsPrintf ("\n**** Unknown ACPI table type [%4.4s]\n\n",
Table->Signature);
fprintf (stderr, "Unknown ACPI table signature [%4.4s], decoding header only\n",
Table->Signature);
}
}
else if (TableData->TableHandler)
@ -764,48 +773,76 @@ AcpiDmDumpTable (
case ACPI_DMT_EINJINST:
case ACPI_DMT_ERSTACT:
case ACPI_DMT_ERSTINST:
ByteLength = 1;
break;
case ACPI_DMT_UINT16:
case ACPI_DMT_DMAR:
case ACPI_DMT_HEST:
ByteLength = 2;
break;
case ACPI_DMT_UINT24:
ByteLength = 3;
break;
case ACPI_DMT_UINT32:
case ACPI_DMT_NAME4:
case ACPI_DMT_SIG:
case ACPI_DMT_SLIC:
ByteLength = 4;
break;
case ACPI_DMT_UINT40:
ByteLength = 5;
break;
case ACPI_DMT_UINT48:
case ACPI_DMT_NAME6:
ByteLength = 6;
break;
case ACPI_DMT_UINT56:
case ACPI_DMT_BUF7:
ByteLength = 7;
break;
case ACPI_DMT_UINT64:
case ACPI_DMT_NAME8:
ByteLength = 8;
break;
case ACPI_DMT_BUF10:
ByteLength = 10;
break;
case ACPI_DMT_BUF16:
case ACPI_DMT_UUID:
ByteLength = 16;
break;
case ACPI_DMT_BUF128:
ByteLength = 128;
break;
case ACPI_DMT_STRING:
ByteLength = ACPI_STRLEN (ACPI_CAST_PTR (char, Target)) + 1;
break;
case ACPI_DMT_GAS:
if (!LastOutputBlankLine)
{
AcpiOsPrintf ("\n");
@ -813,7 +850,9 @@ AcpiDmDumpTable (
}
ByteLength = sizeof (ACPI_GENERIC_ADDRESS);
break;
case ACPI_DMT_HESTNTFY:
if (!LastOutputBlankLine)
{
AcpiOsPrintf ("\n");
@ -821,7 +860,9 @@ AcpiDmDumpTable (
}
ByteLength = sizeof (ACPI_HEST_NOTIFY);
break;
default:
ByteLength = 0;
break;
}
@ -902,9 +943,9 @@ AcpiDmDumpTable (
break;
case ACPI_DMT_BUF7:
case ACPI_DMT_BUF10:
case ACPI_DMT_BUF16:
case ACPI_DMT_BUF128:
/*
* Buffer: Size depends on the opcode and was set above.
* Each hex byte is separated with a space.
@ -1213,16 +1254,19 @@ AcpiDmDumpTable (
switch (Temp8)
{
case ACPI_IVRS_TYPE_HARDWARE:
Name = AcpiDmIvrsSubnames[0];
break;
case ACPI_IVRS_TYPE_MEMORY1:
case ACPI_IVRS_TYPE_MEMORY2:
case ACPI_IVRS_TYPE_MEMORY3:
Name = AcpiDmIvrsSubnames[1];
break;
default:
Name = AcpiDmIvrsSubnames[2];
break;
}
@ -1231,9 +1275,11 @@ AcpiDmDumpTable (
break;
case ACPI_DMT_EXIT:
return (AE_OK);
default:
ACPI_ERROR ((AE_INFO,
"**** Invalid table opcode [0x%X] ****\n", Info->Opcode));
return (AE_SUPPORT);

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -421,27 +421,33 @@ AcpiDmValidateFadtLength (
switch (Revision)
{
case 0:
AcpiOsPrintf ("// ACPI Warning: Invalid FADT revision: 0\n");
return;
case 1:
ExpectedLength = ACPI_FADT_V1_SIZE;
break;
case 2:
ExpectedLength = ACPI_FADT_V2_SIZE;
break;
case 3:
case 4:
ExpectedLength = ACPI_FADT_V3_SIZE;
break;
case 5:
ExpectedLength = ACPI_FADT_V5_SIZE;
break;
default:
return;
}
@ -506,10 +512,12 @@ AcpiDmDumpAsf (
switch (Type)
{
case ACPI_ASF_TYPE_INFO:
InfoTable = AcpiDmTableInfoAsf0;
break;
case ACPI_ASF_TYPE_ALERT:
InfoTable = AcpiDmTableInfoAsf1;
DataInfoTable = AcpiDmTableInfoAsf1a;
DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ALERT));
@ -519,6 +527,7 @@ AcpiDmDumpAsf (
break;
case ACPI_ASF_TYPE_CONTROL:
InfoTable = AcpiDmTableInfoAsf2;
DataInfoTable = AcpiDmTableInfoAsf2a;
DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_REMOTE));
@ -528,10 +537,12 @@ AcpiDmDumpAsf (
break;
case ACPI_ASF_TYPE_BOOT:
InfoTable = AcpiDmTableInfoAsf3;
break;
case ACPI_ASF_TYPE_ADDRESS:
InfoTable = AcpiDmTableInfoAsf4;
DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ADDRESS));
DataLength = ACPI_CAST_PTR (ACPI_ASF_ADDRESS, SubTable)->Devices;
@ -539,6 +550,7 @@ AcpiDmDumpAsf (
break;
default:
AcpiOsPrintf ("\n**** Unknown ASF sub-table type 0x%X\n", SubTable->Header.Type);
return;
}
@ -595,6 +607,7 @@ AcpiDmDumpAsf (
break;
default:
break;
}
@ -686,6 +699,7 @@ AcpiDmDumpCsrt (
{
ACPI_STATUS Status;
ACPI_CSRT_GROUP *SubTable;
ACPI_CSRT_SHARED_INFO *SharedInfoTable;
ACPI_CSRT_DESCRIPTOR *SubSubTable;
UINT32 Length = Table->Length;
UINT32 Offset = sizeof (ACPI_TABLE_CSRT);
@ -701,6 +715,8 @@ AcpiDmDumpCsrt (
SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Table, Offset);
while (Offset < Table->Length)
{
/* Resource group subtable */
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Length, Offset, SubTable,
SubTable->Length, AcpiDmTableInfoCsrt0);
@ -709,15 +725,23 @@ AcpiDmDumpCsrt (
return;
}
/* Shared info subtable (One per resource group) */
SubOffset = sizeof (ACPI_CSRT_GROUP);
SharedInfoTable = ACPI_ADD_PTR (ACPI_CSRT_SHARED_INFO, Table,
Offset + SubOffset);
/* Shared resource group info buffer */
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Length, Offset + SubOffset, SharedInfoTable,
sizeof (ACPI_CSRT_SHARED_INFO), AcpiDmTableInfoCsrt1);
if (ACPI_FAILURE (Status))
{
return;
}
AcpiDmDumpBuffer (SubTable, SubOffset, SubTable->InfoLength,
Offset+SubOffset, "Shared Data");
SubOffset += SubTable->InfoLength;
SubOffset += SubTable->SharedInfoLength;
/* Sub-Sub-tables (Resource Descriptors) */
/* Sub-Subtables (Resource Descriptors) */
SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, Table,
Offset + SubOffset);
@ -727,7 +751,7 @@ AcpiDmDumpCsrt (
{
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Length, Offset + SubOffset, SubSubTable,
SubSubTable->Length, AcpiDmTableInfoCsrt1);
SubSubTable->Length, AcpiDmTableInfoCsrt2);
if (ACPI_FAILURE (Status))
{
return;
@ -743,7 +767,7 @@ AcpiDmDumpCsrt (
Offset + SubOffset + SubSubOffset, "ResourceInfo");
SubSubOffset += InfoLength;
/* Point to next sub-sub-table */
/* Point to next sub-subtable */
SubOffset += SubSubTable->Length;
SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, SubSubTable,
@ -920,26 +944,36 @@ AcpiDmDumpDmar (
{
return;
}
AcpiOsPrintf ("\n");
switch (SubTable->Type)
{
case ACPI_DMAR_TYPE_HARDWARE_UNIT:
InfoTable = AcpiDmTableInfoDmar0;
ScopeOffset = sizeof (ACPI_DMAR_HARDWARE_UNIT);
break;
case ACPI_DMAR_TYPE_RESERVED_MEMORY:
InfoTable = AcpiDmTableInfoDmar1;
ScopeOffset = sizeof (ACPI_DMAR_RESERVED_MEMORY);
break;
case ACPI_DMAR_TYPE_ATSR:
InfoTable = AcpiDmTableInfoDmar2;
ScopeOffset = sizeof (ACPI_DMAR_ATSR);
break;
case ACPI_DMAR_HARDWARE_AFFINITY:
InfoTable = AcpiDmTableInfoDmar3;
ScopeOffset = sizeof (ACPI_DMAR_RHSA);
break;
default:
AcpiOsPrintf ("\n**** Unknown DMAR sub-table type 0x%X\n\n", SubTable->Type);
return;
}
@ -963,6 +997,7 @@ AcpiDmDumpDmar (
{
return;
}
AcpiOsPrintf ("\n");
/* Dump the PCI Path entries for this device scope */
@ -980,6 +1015,7 @@ AcpiDmDumpDmar (
PathOffset += 2;
PciPath += 2;
AcpiOsPrintf ("\n");
}
/* Point to next device scope entry */
@ -1147,12 +1183,17 @@ AcpiDmDumpFpdt (
switch (SubTable->Type)
{
case ACPI_FPDT_TYPE_BOOT:
InfoTable = AcpiDmTableInfoFpdt0;
break;
case ACPI_FPDT_TYPE_S3PERF:
InfoTable = AcpiDmTableInfoFpdt1;
break;
default:
AcpiOsPrintf ("\n**** Unknown FPDT sub-table type 0x%X\n\n", SubTable->Type);
/* Attempt to continue */
@ -1225,6 +1266,7 @@ AcpiDmDumpHest (
switch (SubTable->Type)
{
case ACPI_HEST_TYPE_IA32_CHECK:
InfoTable = AcpiDmTableInfoHest0;
SubTableLength = sizeof (ACPI_HEST_IA_MACHINE_CHECK);
BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK,
@ -1232,6 +1274,7 @@ AcpiDmDumpHest (
break;
case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK:
InfoTable = AcpiDmTableInfoHest1;
SubTableLength = sizeof (ACPI_HEST_IA_CORRECTED);
BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED,
@ -1239,31 +1282,37 @@ AcpiDmDumpHest (
break;
case ACPI_HEST_TYPE_IA32_NMI:
InfoTable = AcpiDmTableInfoHest2;
SubTableLength = sizeof (ACPI_HEST_IA_NMI);
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_ERROR:
InfoTable = AcpiDmTableInfoHest9;
SubTableLength = sizeof (ACPI_HEST_GENERIC);
break;
default:
/* Cannot continue on unknown type - no length */
AcpiOsPrintf ("\n**** Unknown HEST sub-table type 0x%X\n", SubTable->Type);
@ -1365,14 +1414,19 @@ AcpiDmDumpIvrs (
switch (SubTable->Type)
{
case ACPI_IVRS_TYPE_HARDWARE:
InfoTable = AcpiDmTableInfoIvrs0;
break;
case ACPI_IVRS_TYPE_MEMORY1:
case ACPI_IVRS_TYPE_MEMORY2:
case ACPI_IVRS_TYPE_MEMORY3:
InfoTable = AcpiDmTableInfoIvrs1;
break;
default:
AcpiOsPrintf ("\n**** Unknown IVRS sub-table type 0x%X\n",
SubTable->Type);
@ -1534,45 +1588,72 @@ AcpiDmDumpMadt (
switch (SubTable->Type)
{
case ACPI_MADT_TYPE_LOCAL_APIC:
InfoTable = AcpiDmTableInfoMadt0;
break;
case ACPI_MADT_TYPE_IO_APIC:
InfoTable = AcpiDmTableInfoMadt1;
break;
case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
InfoTable = AcpiDmTableInfoMadt2;
break;
case ACPI_MADT_TYPE_NMI_SOURCE:
InfoTable = AcpiDmTableInfoMadt3;
break;
case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
InfoTable = AcpiDmTableInfoMadt4;
break;
case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
InfoTable = AcpiDmTableInfoMadt5;
break;
case ACPI_MADT_TYPE_IO_SAPIC:
InfoTable = AcpiDmTableInfoMadt6;
break;
case ACPI_MADT_TYPE_LOCAL_SAPIC:
InfoTable = AcpiDmTableInfoMadt7;
break;
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;
case ACPI_MADT_TYPE_GENERIC_INTERRUPT:
InfoTable = AcpiDmTableInfoMadt11;
break;
case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR:
InfoTable = AcpiDmTableInfoMadt12;
break;
default:
AcpiOsPrintf ("\n**** Unknown MADT sub-table type 0x%X\n\n", SubTable->Type);
/* Attempt to continue */
@ -1855,6 +1936,58 @@ AcpiDmDumpMsct (
}
/*******************************************************************************
*
* FUNCTION: AcpiDmDumpMtmr
*
* PARAMETERS: Table - A MTMR table
*
* RETURN: None
*
* DESCRIPTION: Format the contents of a MTMR
*
******************************************************************************/
void
AcpiDmDumpMtmr (
ACPI_TABLE_HEADER *Table)
{
ACPI_STATUS Status;
UINT32 Offset = sizeof (ACPI_TABLE_MTMR);
ACPI_MTMR_ENTRY *SubTable;
/* Main table */
Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMtmr);
if (ACPI_FAILURE (Status))
{
return;
}
/* Sub-tables */
SubTable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Table, Offset);
while (Offset < Table->Length)
{
/* Common sub-table header */
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
sizeof (ACPI_MTMR_ENTRY), AcpiDmTableInfoMtmr0);
if (ACPI_FAILURE (Status))
{
return;
}
/* Point to next sub-table */
Offset += sizeof (ACPI_MTMR_ENTRY);
SubTable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, SubTable, sizeof (ACPI_MTMR_ENTRY));
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDmDumpPcct
@ -2161,12 +2294,17 @@ AcpiDmDumpS3pt (
switch (SubTable->Type)
{
case ACPI_S3PT_TYPE_RESUME:
InfoTable = AcpiDmTableInfoS3pt0;
break;
case ACPI_S3PT_TYPE_SUSPEND:
InfoTable = AcpiDmTableInfoS3pt1;
break;
default:
AcpiOsPrintf ("\n**** Unknown S3PT sub-table type 0x%X\n", SubTable->Type);
/* Attempt to continue */
@ -2238,12 +2376,17 @@ AcpiDmDumpSlic (
switch (SubTable->Type)
{
case ACPI_SLIC_TYPE_PUBLIC_KEY:
InfoTable = AcpiDmTableInfoSlic0;
break;
case ACPI_SLIC_TYPE_WINDOWS_MARKER:
InfoTable = AcpiDmTableInfoSlic1;
break;
default:
AcpiOsPrintf ("\n**** Unknown SLIC sub-table type 0x%X\n", SubTable->Type);
/* Attempt to continue */
@ -2399,14 +2542,20 @@ AcpiDmDumpSrat (
switch (SubTable->Type)
{
case ACPI_SRAT_TYPE_CPU_AFFINITY:
InfoTable = AcpiDmTableInfoSrat0;
break;
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 0x%X\n", SubTable->Type);
@ -2437,6 +2586,58 @@ NextSubTable:
}
/*******************************************************************************
*
* FUNCTION: AcpiDmDumpVrtc
*
* PARAMETERS: Table - A VRTC table
*
* RETURN: None
*
* DESCRIPTION: Format the contents of a VRTC
*
******************************************************************************/
void
AcpiDmDumpVrtc (
ACPI_TABLE_HEADER *Table)
{
ACPI_STATUS Status;
UINT32 Offset = sizeof (ACPI_TABLE_VRTC);
ACPI_VRTC_ENTRY *SubTable;
/* Main table */
Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoVrtc);
if (ACPI_FAILURE (Status))
{
return;
}
/* Sub-tables */
SubTable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, Table, Offset);
while (Offset < Table->Length)
{
/* Common sub-table header */
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
sizeof (ACPI_VRTC_ENTRY), AcpiDmTableInfoVrtc0);
if (ACPI_FAILURE (Status))
{
return;
}
/* Point to next sub-table */
Offset += sizeof (ACPI_VRTC_ENTRY);
SubTable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, SubTable, sizeof (ACPI_VRTC_ENTRY));
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDmDumpWdat

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -183,6 +183,7 @@
#define ACPI_SPMI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SPMI,f)
#define ACPI_SRAT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SRAT,f)
#define ACPI_TCPA_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TCPA,f)
#define ACPI_TPM2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TPM2,f)
#define ACPI_UEFI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_UEFI,f)
#define ACPI_WAET_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WAET,f)
#define ACPI_WDAT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WDAT,f)
@ -200,7 +201,8 @@
#define ACPI_ASF4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_ASF_ADDRESS,f)
#define ACPI_CPEP0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CPEP_POLLING,f)
#define ACPI_CSRT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CSRT_GROUP,f)
#define ACPI_CSRT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CSRT_DESCRIPTOR,f)
#define ACPI_CSRT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CSRT_SHARED_INFO,f)
#define ACPI_CSRT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_CSRT_DESCRIPTOR,f)
#define ACPI_DBG20_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DBG2_DEVICE,f)
#define ACPI_DMARS_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_DEVICE_SCOPE,f)
#define ACPI_DMAR0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_HARDWARE_UNIT,f)
@ -249,6 +251,7 @@
#define ACPI_MPST1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MPST_DATA_HDR,f)
#define ACPI_MPST2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MPST_POWER_DATA,f)
#define ACPI_MSCT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MSCT_PROXIMITY,f)
#define ACPI_MTMR0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MTMR_ENTRY,f)
#define ACPI_PCCT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PCCT_SUBSPACE,f)
#define ACPI_PMTT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_SOCKET,f)
#define ACPI_PMTT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_CONTROLLER,f)
@ -265,6 +268,7 @@
#define ACPI_SRAT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_CPU_AFFINITY,f)
#define ACPI_SRAT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_MEM_AFFINITY,f)
#define ACPI_SRAT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_X2APIC_CPU_AFFINITY,f)
#define ACPI_VRTC0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_VRTC_ENTRY,f)
#define ACPI_WDAT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_WDAT_ENTRY,f)
/*
@ -734,18 +738,38 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt0[] =
{ACPI_DMT_UINT16, ACPI_CSRT0_OFFSET (SubdeviceId), "Subdevice ID", 0},
{ACPI_DMT_UINT16, ACPI_CSRT0_OFFSET (Revision), "Revision", 0},
{ACPI_DMT_UINT16, ACPI_CSRT0_OFFSET (Reserved), "Reserved", 0},
{ACPI_DMT_UINT32, ACPI_CSRT0_OFFSET (InfoLength), "InfoLength", 0},
{ACPI_DMT_UINT32, ACPI_CSRT0_OFFSET (SharedInfoLength), "Shared Info Length", 0},
ACPI_DMT_TERMINATOR
};
/* Resource Descriptor subtable */
/* Shared Info subtable */
ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt1[] =
{
{ACPI_DMT_UINT32, ACPI_CSRT1_OFFSET (Length), "Length", 0},
{ACPI_DMT_UINT16, ACPI_CSRT1_OFFSET (Type), "Type", 0},
{ACPI_DMT_UINT16, ACPI_CSRT1_OFFSET (Subtype), "Subtype", 0},
{ACPI_DMT_UINT32, ACPI_CSRT1_OFFSET (Uid), "UID", 0},
{ACPI_DMT_UINT16, ACPI_CSRT1_OFFSET (MajorVersion), "Major Version", 0},
{ACPI_DMT_UINT16, ACPI_CSRT1_OFFSET (MinorVersion), "Minor Version", 0},
{ACPI_DMT_UINT32, ACPI_CSRT1_OFFSET (MmioBaseLow), "MMIO Base Address Low", 0},
{ACPI_DMT_UINT32, ACPI_CSRT1_OFFSET (MmioBaseHigh), "MMIO Base Address High", 0},
{ACPI_DMT_UINT32, ACPI_CSRT1_OFFSET (GsiInterrupt), "GSI Interrupt", 0},
{ACPI_DMT_UINT8, ACPI_CSRT1_OFFSET (InterruptPolarity), "Interrupt Polarity", 0},
{ACPI_DMT_UINT8, ACPI_CSRT1_OFFSET (InterruptMode), "Interrupt Mode", 0},
{ACPI_DMT_UINT8, ACPI_CSRT1_OFFSET (NumChannels), "Num Channels", 0},
{ACPI_DMT_UINT8, ACPI_CSRT1_OFFSET (DmaAddressWidth), "DMA Address Width", 0},
{ACPI_DMT_UINT16, ACPI_CSRT1_OFFSET (BaseRequestLine), "Base Request Line", 0},
{ACPI_DMT_UINT16, ACPI_CSRT1_OFFSET (NumHandshakeSignals), "Num Handshake Signals", 0},
{ACPI_DMT_UINT32, ACPI_CSRT1_OFFSET (MaxBlockSize), "Max Block Size", 0},
ACPI_DMT_TERMINATOR
};
/* Resource Descriptor subtable */
ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt2[] =
{
{ACPI_DMT_UINT32, ACPI_CSRT2_OFFSET (Length), "Length", 0},
{ACPI_DMT_UINT16, ACPI_CSRT2_OFFSET (Type), "Type", 0},
{ACPI_DMT_UINT16, ACPI_CSRT2_OFFSET (Subtype), "Subtype", 0},
{ACPI_DMT_UINT32, ACPI_CSRT2_OFFSET (Uid), "UID", 0},
ACPI_DMT_TERMINATOR
};
@ -828,6 +852,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoDmar[] =
{
{ACPI_DMT_UINT8, ACPI_DMAR_OFFSET (Width), "Host Address Width", 0},
{ACPI_DMT_UINT8, ACPI_DMAR_OFFSET (Flags), "Flags", 0},
{ACPI_DMT_BUF10, ACPI_DMAR_OFFSET (Reserved[0]), "Reserved", 0},
ACPI_DMT_TERMINATOR
};
@ -1692,6 +1717,28 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMsct0[] =
};
/*******************************************************************************
*
* MTMR - MID Timer Table
*
******************************************************************************/
ACPI_DMTABLE_INFO AcpiDmTableInfoMtmr[] =
{
ACPI_DMT_TERMINATOR
};
/* MTMR Subtables - MTMR Entry */
ACPI_DMTABLE_INFO AcpiDmTableInfoMtmr0[] =
{
{ACPI_DMT_GAS, ACPI_MTMR0_OFFSET (PhysicalAddress), "PhysicalAddress", 0},
{ACPI_DMT_UINT32, ACPI_MTMR0_OFFSET (Frequency), "Frequency", 0},
{ACPI_DMT_UINT32, ACPI_MTMR0_OFFSET (Irq), "IRQ", 0},
ACPI_DMT_TERMINATOR
};
/*******************************************************************************
*
* PCCT - Platform Communications Channel Table (ACPI 5.0)
@ -2054,6 +2101,21 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoTcpa[] =
};
/*******************************************************************************
*
* TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table
*
******************************************************************************/
ACPI_DMTABLE_INFO AcpiDmTableInfoTpm2[] =
{
{ACPI_DMT_UINT32, ACPI_TPM2_OFFSET (Flags), "Flags", 0},
{ACPI_DMT_UINT64, ACPI_TPM2_OFFSET (ControlAddress), "Control Address", 0},
{ACPI_DMT_UINT32, ACPI_TPM2_OFFSET (StartMethod), "Start Method", 0},
ACPI_DMT_TERMINATOR
};
/*******************************************************************************
*
* UEFI - UEFI Boot optimization Table
@ -2068,6 +2130,27 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoUefi[] =
};
/*******************************************************************************
*
* VRTC - Virtual Real Time Clock Table
*
******************************************************************************/
ACPI_DMTABLE_INFO AcpiDmTableInfoVrtc[] =
{
ACPI_DMT_TERMINATOR
};
/* VRTC Subtables - VRTC Entry */
ACPI_DMTABLE_INFO AcpiDmTableInfoVrtc0[] =
{
{ACPI_DMT_GAS, ACPI_VRTC0_OFFSET (PhysicalAddress), "PhysicalAddress", 0},
{ACPI_DMT_UINT32, ACPI_VRTC0_OFFSET (Irq), "IRQ", 0},
ACPI_DMT_TERMINATOR
};
/*******************************************************************************
*
* WAET - Windows ACPI Emulated devices Table

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -113,6 +113,15 @@
*
*****************************************************************************/
/*
* ACPICA getopt() implementation
*
* Option strings:
* "f" - Option has no arguments
* "f:" - Option requires an argument
* "f^" - Option has optional single-char sub-options
* "f|" - Option has required single-char sub-options
*/
#include <stdio.h>
#include <string.h>
@ -124,9 +133,59 @@
if (AcpiGbl_Opterr) {fprintf (stderr, "%s%c\n", msg, badchar);}
int AcpiGbl_Opterr = 1;
int AcpiGbl_Optind = 1;
char *AcpiGbl_Optarg;
int AcpiGbl_Opterr = 1;
int AcpiGbl_Optind = 1;
int AcpiGbl_SubOptChar = 0;
char *AcpiGbl_Optarg;
static int CurrentCharPtr = 1;
/*******************************************************************************
*
* FUNCTION: AcpiGetoptArgument
*
* PARAMETERS: argc, argv - from main
*
* RETURN: 0 if an argument was found, -1 otherwise. Sets AcpiGbl_Optarg
* to point to the next argument.
*
* DESCRIPTION: Get the next argument. Used to obtain arguments for the
* two-character options after the original call to AcpiGetopt.
* Note: Either the argument starts at the next character after
* the option, or it is pointed to by the next argv entry.
* (After call to AcpiGetopt, we need to backup to the previous
* argv entry).
*
******************************************************************************/
int
AcpiGetoptArgument (
int argc,
char **argv)
{
AcpiGbl_Optind--;
CurrentCharPtr++;
if (argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)] != '\0')
{
AcpiGbl_Optarg = &argv[AcpiGbl_Optind++][(int) (CurrentCharPtr+1)];
}
else if (++AcpiGbl_Optind >= argc)
{
ACPI_OPTION_ERROR ("Option requires an argument: -", 'v');
CurrentCharPtr = 1;
return (-1);
}
else
{
AcpiGbl_Optarg = argv[AcpiGbl_Optind++];
}
CurrentCharPtr = 1;
return (0);
}
/*******************************************************************************
@ -148,7 +207,6 @@ AcpiGetopt(
char **argv,
char *opts)
{
static int CurrentCharPtr = 1;
int CurrentChar;
char *OptsPtr;
@ -211,6 +269,26 @@ AcpiGetopt(
CurrentCharPtr = 1;
}
/* Option has an optional argument? */
else if (*OptsPtr == '+')
{
if (argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)] != '\0')
{
AcpiGbl_Optarg = &argv[AcpiGbl_Optind++][(int) (CurrentCharPtr+1)];
}
else if (++AcpiGbl_Optind >= argc)
{
AcpiGbl_Optarg = NULL;
}
else
{
AcpiGbl_Optarg = argv[AcpiGbl_Optind++];
}
CurrentCharPtr = 1;
}
/* Option has optional single-char arguments? */
else if (*OptsPtr == '^')
@ -224,6 +302,7 @@ AcpiGetopt(
AcpiGbl_Optarg = "^";
}
AcpiGbl_SubOptChar = AcpiGbl_Optarg[0];
AcpiGbl_Optind++;
CurrentCharPtr = 1;
}
@ -244,6 +323,7 @@ AcpiGetopt(
return ('?');
}
AcpiGbl_SubOptChar = AcpiGbl_Optarg[0];
AcpiGbl_Optind++;
CurrentCharPtr = 1;
}

View File

@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License

View File

@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -158,7 +158,6 @@ AcpiDsExecBeginControlOp (
switch (Op->Common.AmlOpcode)
{
case AML_WHILE_OP:
/*
* If this is an additional iteration of a while loop, continue.
* There is no need to allocate a new control state.
@ -179,7 +178,6 @@ AcpiDsExecBeginControlOp (
/*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
@ -222,6 +220,7 @@ AcpiDsExecBeginControlOp (
break;
default:
break;
}
@ -276,12 +275,10 @@ AcpiDsExecEndControlOp (
AcpiUtDeleteGenericState (ControlState);
break;
case AML_ELSE_OP:
break;
case AML_WHILE_OP:
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", Op));
@ -324,7 +321,6 @@ AcpiDsExecEndControlOp (
AcpiUtDeleteGenericState (ControlState);
break;
case AML_RETURN_OP:
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
@ -420,12 +416,11 @@ AcpiDsExecEndControlOp (
Status = AE_CTRL_TERMINATE;
break;
case AML_NOOP_OP:
/* Just do nothing! */
break;
break;
case AML_BREAK_POINT_OP:
@ -445,11 +440,9 @@ AcpiDsExecEndControlOp (
"Executed AML Breakpoint opcode");
break;
case AML_BREAK_OP:
case AML_CONTINUE_OP: /* ACPI 2.0 */
/* Pop and delete control states until we find a while */
while (WalkState->ControlState &&
@ -482,7 +475,6 @@ AcpiDsExecEndControlOp (
}
break;
default:
ACPI_ERROR ((AE_INFO, "Unknown control opcode=0x%X Op=%p",

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -671,21 +671,25 @@ AcpiDsInitFieldObjects (
switch (WalkState->Opcode)
{
case AML_FIELD_OP:
Arg = AcpiPsGetArg (Op, 2);
Type = ACPI_TYPE_LOCAL_REGION_FIELD;
break;
case AML_BANK_FIELD_OP:
Arg = AcpiPsGetArg (Op, 4);
Type = ACPI_TYPE_LOCAL_BANK_FIELD;
break;
case AML_INDEX_FIELD_OP:
Arg = AcpiPsGetArg (Op, 3);
Type = ACPI_TYPE_LOCAL_INDEX_FIELD;
break;
default:
return_ACPI_STATUS (AE_BAD_PARAMETER);
}

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -200,20 +200,18 @@ AcpiDsInitOneObject (
Info->OpRegionCount++;
break;
case ACPI_TYPE_METHOD:
Info->MethodCount++;
break;
case ACPI_TYPE_DEVICE:
Info->DeviceCount++;
break;
default:
break;
}

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -235,6 +235,7 @@ AcpiDsCreateMethodMutex (
Status = AcpiOsCreateMutex (&MutexDesc->Mutex.OsMutex);
if (ACPI_FAILURE (Status))
{
AcpiUtDeleteObjectDesc (MutexDesc);
return_ACPI_STATUS (Status);
}
@ -481,7 +482,8 @@ AcpiDsCallControlMethod (
Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
if (!Info)
{
return_ACPI_STATUS (AE_NO_MEMORY);
Status = AE_NO_MEMORY;
goto Cleanup;
}
Info->Parameters = &ThisWalkState->Operands[0];

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -387,6 +387,7 @@ AcpiDsMethodDataGetNode (
break;
default:
ACPI_ERROR ((AE_INFO, "Type %u is invalid", Type));
return_ACPI_STATUS (AE_TYPE);
}
@ -544,7 +545,6 @@ AcpiDsMethodDataGetValue (
return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG);
case ACPI_REFCLASS_LOCAL:
/*
* No error message for this case, will be trapped again later to
* detect and ignore cases of Store(LocalX,LocalX)

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -613,7 +613,7 @@ AcpiDsBuildInternalPackageObj (
}
ACPI_INFO ((AE_INFO,
"Actual Package length (%u) is larger than NumElements field (%u), truncated\n",
"Actual Package length (%u) is larger than NumElements field (%u), truncated",
i, ElementCount));
}
else if (i < ElementCount)
@ -749,7 +749,6 @@ AcpiDsInitObjectFromOp (
switch (ObjDesc->Common.Type)
{
case ACPI_TYPE_BUFFER:
/*
* Defer evaluation of Buffer TermArg operand
*/
@ -759,9 +758,7 @@ AcpiDsInitObjectFromOp (
ObjDesc->Buffer.AmlLength = Op->Named.Length;
break;
case ACPI_TYPE_PACKAGE:
/*
* Defer evaluation of Package TermArg operand
*/
@ -771,7 +768,6 @@ AcpiDsInitObjectFromOp (
ObjDesc->Package.AmlLength = Op->Named.Length;
break;
case ACPI_TYPE_INTEGER:
switch (OpInfo->Type)
@ -806,7 +802,7 @@ AcpiDsInitObjectFromOp (
/* Truncate value if we are executing from a 32-bit ACPI table */
#ifndef ACPI_NO_METHOD_EXECUTION
AcpiExTruncateFor32bitTable (ObjDesc);
(void) AcpiExTruncateFor32bitTable (ObjDesc);
#endif
break;
@ -824,17 +820,25 @@ AcpiDsInitObjectFromOp (
}
break;
case AML_TYPE_LITERAL:
ObjDesc->Integer.Value = Op->Common.Value.Integer;
#ifndef ACPI_NO_METHOD_EXECUTION
AcpiExTruncateFor32bitTable (ObjDesc);
if (AcpiExTruncateFor32bitTable (ObjDesc))
{
/* Warn if we found a 64-bit constant in a 32-bit table */
ACPI_WARNING ((AE_INFO,
"Truncated 64-bit constant found in 32-bit table: %8.8X%8.8X => %8.8X",
ACPI_FORMAT_UINT64 (Op->Common.Value.Integer),
(UINT32) ObjDesc->Integer.Value));
}
#endif
break;
default:
ACPI_ERROR ((AE_INFO, "Unknown Integer type 0x%X",
OpInfo->Type));
Status = AE_AML_OPERAND_TYPE;
@ -842,7 +846,6 @@ AcpiDsInitObjectFromOp (
}
break;
case ACPI_TYPE_STRING:
ObjDesc->String.Pointer = Op->Common.Value.String;
@ -855,11 +858,9 @@ AcpiDsInitObjectFromOp (
ObjDesc->Common.Flags |= AOPOBJ_STATIC_POINTER;
break;
case ACPI_TYPE_METHOD:
break;
case ACPI_TYPE_LOCAL_REFERENCE:
switch (OpInfo->Type)
@ -879,7 +880,6 @@ AcpiDsInitObjectFromOp (
#endif
break;
case AML_TYPE_METHOD_ARGUMENT:
/* Arg ID (0-6) is (AML opcode - base AML_ARG_OP) */
@ -923,7 +923,6 @@ AcpiDsInitObjectFromOp (
}
break;
default:
ACPI_ERROR ((AE_INFO, "Unimplemented data type: 0x%X",

View File

@ -1,6 +1,6 @@
/******************************************************************************
*
* Module Name: dsopcode - Dispatcher suport for regions and fields
* Module Name: dsopcode - Dispatcher support for regions and fields
*
*****************************************************************************/
@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -752,6 +752,7 @@ AcpiDsEvalDataObjectOperands (
break;
default:
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
}

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -336,7 +336,6 @@ AcpiDsIsResultUsed (
case AML_IF_OP:
case AML_WHILE_OP:
/*
* If we are executing the predicate AND this is the predicate op,
* we will use the return value
@ -349,7 +348,9 @@ AcpiDsIsResultUsed (
break;
default:
/* Ignore other control opcodes */
break;
}
@ -357,16 +358,13 @@ AcpiDsIsResultUsed (
goto ResultNotUsed;
case AML_CLASS_CREATE:
/*
* These opcodes allow TermArg(s) as operands and therefore
* the operands can be method calls. The result is used.
*/
goto ResultUsed;
case AML_CLASS_NAMED_OBJECT:
if ((Op->Common.Parent->Common.AmlOpcode == AML_REGION_OP) ||
@ -386,9 +384,7 @@ AcpiDsIsResultUsed (
goto ResultNotUsed;
default:
/*
* In all other cases. the parent will actually use the return
* object, so keep it.

View File

@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -236,7 +236,7 @@ AcpiDsGetPredicateValue (
/* Truncate the predicate to 32-bits if necessary */
AcpiExTruncateFor32bitTable (LocalObjDesc);
(void) AcpiExTruncateFor32bitTable (LocalObjDesc);
/*
* Save the result of the predicate evaluation on
@ -390,7 +390,6 @@ AcpiDsExecBeginOp (
Status = AcpiDsExecBeginControlOp (WalkState, Op);
break;
case AML_CLASS_NAMED_OBJECT:
if (WalkState->WalkType & ACPI_WALK_METHOD)
@ -422,14 +421,13 @@ AcpiDsExecBeginOp (
}
break;
case AML_CLASS_EXECUTE:
case AML_CLASS_CREATE:
break;
default:
break;
}
@ -513,7 +511,6 @@ AcpiDsExecEndOp (
}
break;
case AML_CLASS_EXECUTE: /* Most operators with arguments */
/* Build resolved operand stack */
@ -586,7 +583,6 @@ AcpiDsExecEndOp (
}
break;
default:
switch (OpType)
@ -599,9 +595,7 @@ AcpiDsExecEndOp (
break;
case AML_TYPE_METHOD_CALL:
/*
* If the method is referenced from within a package
* declaration, it is not a invocation of the method, just
@ -668,7 +662,6 @@ AcpiDsExecEndOp (
*/
return_ACPI_STATUS (Status);
case AML_TYPE_CREATE_FIELD:
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
@ -692,7 +685,6 @@ AcpiDsExecEndOp (
switch (Op->Common.Parent->Common.AmlOpcode)
{
case AML_NAME_OP:
/*
* Put the Node on the object stack (Contains the ACPI Name
* of this object)
@ -733,7 +725,6 @@ AcpiDsExecEndOp (
}
break;
case AML_TYPE_NAMED_FIELD:
case AML_TYPE_NAMED_COMPLEX:
case AML_TYPE_NAMED_SIMPLE:
@ -780,14 +771,12 @@ AcpiDsExecEndOp (
}
break;
case AML_TYPE_UNDEFINED:
ACPI_ERROR ((AE_INFO,
"Undefined opcode type Op=%p", Op));
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
case AML_TYPE_BOGUS:
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
@ -795,11 +784,10 @@ AcpiDsExecEndOp (
WalkState->Opcode, Op));
break;
default:
ACPI_ERROR ((AE_INFO,
"Unimplemented opcode, class=0x%X type=0x%X Opcode=-0x%X Op=%p",
"Unimplemented opcode, class=0x%X type=0x%X Opcode=0x%X Op=%p",
OpClass, OpType, Op->Common.AmlOpcode, Op));
Status = AE_NOT_IMPLEMENTED;
@ -811,7 +799,7 @@ AcpiDsExecEndOp (
* ACPI 2.0 support for 64-bit integers: Truncate numeric
* result value if we are executing from a 32-bit ACPI table
*/
AcpiExTruncateFor32bitTable (WalkState->ResultObj);
(void) AcpiExTruncateFor32bitTable (WalkState->ResultObj);
/*
* Check if we just completed the evaluation of a

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -153,6 +153,7 @@ AcpiDsInitCallbacks (
switch (PassNumber)
{
case 1:
WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 |
ACPI_PARSE_DELETE_TREE;
WalkState->DescendingCallback = AcpiDsLoad1BeginOp;
@ -160,6 +161,7 @@ AcpiDsInitCallbacks (
break;
case 2:
WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 |
ACPI_PARSE_DELETE_TREE;
WalkState->DescendingCallback = AcpiDsLoad2BeginOp;
@ -167,6 +169,7 @@ AcpiDsInitCallbacks (
break;
case 3:
#ifndef ACPI_NO_METHOD_EXECUTION
WalkState->ParseFlags |= ACPI_PARSE_EXECUTE |
ACPI_PARSE_DELETE_TREE;
@ -176,6 +179,7 @@ AcpiDsInitCallbacks (
break;
default:
return (AE_BAD_PARAMETER);
}
@ -246,7 +250,6 @@ AcpiDsLoad1BeginOp (
switch (WalkState->Opcode)
{
case AML_SCOPE_OP:
/*
* The target name of the Scope() operator must exist at this point so
* that we can actually open the scope to enter new names underneath it.
@ -293,7 +296,6 @@ AcpiDsLoad1BeginOp (
case ACPI_TYPE_INTEGER:
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
/*
* These types we will allow, but we will change the type.
* This enables some existing code of the form:
@ -314,7 +316,6 @@ AcpiDsLoad1BeginOp (
break;
case ACPI_TYPE_METHOD:
/*
* Allow scope change to root during execution of module-level
* code. Root is typed METHOD during this time.
@ -340,7 +341,6 @@ AcpiDsLoad1BeginOp (
}
break;
default:
/*
* For all other named opcodes, we will enter the name into

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -308,7 +308,7 @@ AcpiDsLoad2BeginOp (
*/
ACPI_WARNING ((AE_INFO,
"Type override - [%4.4s] had invalid type (%s) "
"for Scope operator, changed to type ANY\n",
"for Scope operator, changed to type ANY",
AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type)));
Node->Type = ACPI_TYPE_ANY;
@ -568,7 +568,6 @@ AcpiDsLoad2EndOp (
Status = AcpiDsCreateBufferField (Op, WalkState);
break;
case AML_TYPE_NAMED_FIELD:
/*
* If we are executing a method, initialize the field
@ -597,12 +596,12 @@ AcpiDsLoad2EndOp (
break;
default:
/* All NAMED_FIELD opcodes must be handled above */
break;
}
break;
case AML_TYPE_NAMED_SIMPLE:
Status = AcpiDsCreateOperands (WalkState, Arg);
@ -633,13 +632,13 @@ AcpiDsLoad2EndOp (
Status = AcpiExCreateEvent (WalkState);
break;
case AML_ALIAS_OP:
Status = AcpiExCreateAlias (WalkState);
break;
default:
/* Unknown opcode */
Status = AE_OK;
@ -724,13 +723,11 @@ AcpiDsLoad2EndOp (
}
break;
case AML_NAME_OP:
Status = AcpiDsCreateNode (WalkState, Node, Op);
break;
case AML_METHOD_OP:
/*
* MethodOp PkgLength NameString MethodFlags TermList
@ -768,18 +765,17 @@ AcpiDsLoad2EndOp (
#endif /* ACPI_NO_METHOD_EXECUTION */
default:
/* All NAMED_COMPLEX opcodes must be handled above */
break;
}
break;
case AML_CLASS_INTERNAL:
/* case AML_INT_NAMEPATH_OP: */
break;
case AML_CLASS_METHOD_CALL:
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
@ -819,6 +815,7 @@ AcpiDsLoad2EndOp (
default:
break;
}

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -363,6 +363,8 @@ AcpiEvFixedEventDetect (
*
* DESCRIPTION: Clears the status bit for the requested event, calls the
* handler that previously registered for the event.
* NOTE: If there is no handler for the event, the event is
* disabled to prevent further interrupts.
*
******************************************************************************/
@ -381,18 +383,18 @@ AcpiEvFixedEventDispatch (
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 that a handler exists. If not, report an error
* and disable the event to prevent further interrupts.
*/
if (NULL == AcpiGbl_FixedEventHandlers[Event].Handler)
if (!AcpiGbl_FixedEventHandlers[Event].Handler)
{
(void) AcpiWriteBitRegister (
AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
ACPI_DISABLE_EVENT);
ACPI_ERROR ((AE_INFO,
"No installed handler for fixed event [0x%08X]",
Event));
"No installed handler for fixed event - %s (%u), disabling",
AcpiUtGetEventName (Event), Event));
return (ACPI_INTERRUPT_NOT_HANDLED);
}

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -216,6 +216,7 @@ AcpiEvRemoveGlobalLockHandler (
Status = AcpiRemoveFixedEventHandler (ACPI_EVENT_GLOBAL,
AcpiEvGlobalLockHandler);
AcpiOsDeleteLock (AcpiGbl_GlobalLockPendingLock);
return_ACPI_STATUS (Status);
}

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -650,7 +650,6 @@ AcpiEvAsynchExecuteGpeMethod (
switch (LocalGpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK)
{
case ACPI_GPE_DISPATCH_NOTIFY:
/*
* Implicit notify.
* Dispatch a DEVICE_WAKE notify to the appropriate handler.
@ -700,10 +699,10 @@ AcpiEvAsynchExecuteGpeMethod (
"while evaluating GPE method [%4.4s]",
AcpiUtGetNodeName (LocalGpeEventInfo->Dispatch.MethodNode)));
}
break;
default:
return_VOID; /* Should never happen */
}
@ -890,7 +889,6 @@ AcpiEvGpeDispatch (
case ACPI_GPE_DISPATCH_METHOD:
case ACPI_GPE_DISPATCH_NOTIFY:
/*
* Execute the method associated with the GPE
* NOTE: Level-triggered GPEs are cleared after the method completes.
@ -906,7 +904,6 @@ AcpiEvGpeDispatch (
break;
default:
/*
* No handler or method to run!
* 03/2010: This case should no longer be possible. We will not allow

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -492,6 +492,8 @@ AcpiEvCreateGpeBlock (
Status = AcpiEvInstallGpeBlock (GpeBlock, InterruptNumber);
if (ACPI_FAILURE (Status))
{
ACPI_FREE (GpeBlock->RegisterInfo);
ACPI_FREE (GpeBlock->EventInfo);
ACPI_FREE (GpeBlock);
return_ACPI_STATUS (Status);
}
@ -515,8 +517,8 @@ AcpiEvCreateGpeBlock (
(*ReturnGpeBlock) = GpeBlock;
}
ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
"GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n",
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
" Initialized GPE %02X to %02X [%4.4s] %u regs on interrupt 0x%X\n",
(UINT32) GpeBlock->BlockBaseNumber,
(UINT32) (GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1)),
GpeDevice->Name.Ascii, GpeBlock->RegisterCount,
@ -611,8 +613,10 @@ AcpiEvInitializeGpeBlock (
if (GpeEnabledCount)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
"Enabled %u GPEs in this block\n", GpeEnabledCount));
ACPI_INFO ((AE_INFO,
"Enabled %u GPEs in block %02X to %02X", GpeEnabledCount,
(UINT32) GpeBlock->BlockBaseNumber,
(UINT32) (GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1))));
}
GpeBlock->Initialized = TRUE;

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -166,6 +166,9 @@ AcpiEvGpeInitialize (
ACPI_FUNCTION_TRACE (EvGpeInitialize);
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
"Initializing General Purpose Events (GPEs):\n"));
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
@ -203,7 +206,6 @@ AcpiEvGpeInitialize (
/* GPE block 0 exists (has both length and address > 0) */
RegisterCount0 = (UINT16) (AcpiGbl_FADT.Gpe0BlockLength / 2);
GpeNumberMax = (RegisterCount0 * ACPI_GPE_REGISTER_WIDTH) - 1;
/* Install GPE Block 0 */
@ -278,16 +280,6 @@ AcpiEvGpeInitialize (
goto Cleanup;
}
/* Check for Max GPE number out-of-range */
if (GpeNumberMax > ACPI_GPE_MAX)
{
ACPI_ERROR ((AE_INFO,
"Maximum GPE number from FADT is too large: 0x%X",
GpeNumberMax));
Status = AE_BAD_VALUE;
goto Cleanup;
}
Cleanup:
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
@ -451,14 +443,17 @@ AcpiEvMatchGpeMethod (
switch (Name[1])
{
case 'L':
Type = ACPI_GPE_LEVEL_TRIGGERED;
break;
case 'E':
Type = ACPI_GPE_EDGE_TRIGGERED;
break;
default:
/* Unknown method type, just ignore it */
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -288,7 +288,7 @@ AcpiEvGetGpeDevice (
*
* FUNCTION: AcpiEvGetGpeXruptBlock
*
* PARAMETERS: InterruptNumber - Interrupt for a GPE block
* PARAMETERS: InterruptNumber - Interrupt for a GPE block
*
* RETURN: A GPE interrupt block
*

View File

@ -0,0 +1,657 @@
/******************************************************************************
*
* Module Name: evhandler - Support for Address Space handlers
*
*****************************************************************************/
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
* rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
* copy of the source code appearing in this file ("Covered Code") an
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
* base code distributed originally by Intel ("Original Intel Code") to copy,
* make derivatives, distribute, use and display any portion of the Covered
* Code in any form, with the right to sublicense such rights; and
*
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
* license (with the right to sublicense), under only those claims of Intel
* patents that are infringed by the Original Intel Code, to make, use, sell,
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
* to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
* documentation and/or other materials provided with distribution. In
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* property embodied in the software Licensee provides to its licensee, and
* not to intellectual property embodied in modifications its licensee may
* make.
*
* 3.3. Redistribution of Executable. Redistribution in executable form of any
* substantial portion of the Covered Code or modification must reproduce the
* above Copyright Notice, and the following Disclaimer and Export Compliance
* provision in the documentation and/or other materials provided with the
* distribution.
*
* 3.4. Intel retains all right, title, and interest in and to the Original
* Intel Code.
*
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
* Intel shall be used in advertising or otherwise to promote the sale, use or
* other dealings in products derived from or relating to the Covered Code
* without prior written authorization from Intel.
*
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
* any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* ensure that the distribution and export/re-export of the software is in
* compliance with all laws, regulations, orders, or other restrictions of the
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
* any of its subsidiaries will export/re-export any technical data, process,
* software, or service, directly or indirectly, to any country for which the
* United States government or any agency thereof requires an export license,
* other governmental approval, or letter of assurance, without first obtaining
* such license, approval or letter.
*
*****************************************************************************/
#define __EVHANDLER_C__
#include "acpi.h"
#include "accommon.h"
#include "acevents.h"
#include "acnamesp.h"
#include "acinterp.h"
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evhandler")
/* Local prototypes */
static ACPI_STATUS
AcpiEvInstallHandler (
ACPI_HANDLE ObjHandle,
UINT32 Level,
void *Context,
void **ReturnValue);
/* These are the address spaces that will get default handlers */
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
};
/*******************************************************************************
*
* FUNCTION: AcpiEvInstallRegionHandlers
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Installs the core subsystem default address space handlers.
*
******************************************************************************/
ACPI_STATUS
AcpiEvInstallRegionHandlers (
void)
{
ACPI_STATUS Status;
UINT32 i;
ACPI_FUNCTION_TRACE (EvInstallRegionHandlers);
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/*
* 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.
*
* 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).
* Similar for AE_SAME_HANDLER.
*/
for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++)
{
Status = AcpiEvInstallSpaceHandler (AcpiGbl_RootNode,
AcpiGbl_DefaultAddressSpaces[i],
ACPI_DEFAULT_HANDLER, NULL, NULL);
switch (Status)
{
case AE_OK:
case AE_SAME_HANDLER:
case AE_ALREADY_EXISTS:
/* These exceptions are all OK */
Status = AE_OK;
break;
default:
goto UnlockAndExit;
}
}
UnlockAndExit:
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiEvHasDefaultHandler
*
* PARAMETERS: Node - Namespace node for the device
* SpaceId - The address space ID
*
* RETURN: TRUE if default handler is installed, FALSE otherwise
*
* DESCRIPTION: Check if the default handler is installed for the requested
* space ID.
*
******************************************************************************/
BOOLEAN
AcpiEvHasDefaultHandler (
ACPI_NAMESPACE_NODE *Node,
ACPI_ADR_SPACE_TYPE SpaceId)
{
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_OPERAND_OBJECT *HandlerObj;
/* Must have an existing internal object */
ObjDesc = AcpiNsGetAttachedObject (Node);
if (ObjDesc)
{
HandlerObj = ObjDesc->Device.Handler;
/* Walk the linked list of handlers for this object */
while (HandlerObj)
{
if (HandlerObj->AddressSpace.SpaceId == SpaceId)
{
if (HandlerObj->AddressSpace.HandlerFlags &
ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)
{
return (TRUE);
}
}
HandlerObj = HandlerObj->AddressSpace.Next;
}
}
return (FALSE);
}
/*******************************************************************************
*
* FUNCTION: AcpiEvInstallHandler
*
* PARAMETERS: WalkNamespace callback
*
* DESCRIPTION: This routine installs an address handler into objects that are
* of type Region or Device.
*
* If the Object is a Device, and the device has a handler of
* the same type then the search is terminated in that branch.
*
* This is because the existing handler is closer in proximity
* to any more regions than the one we are trying to install.
*
******************************************************************************/
static ACPI_STATUS
AcpiEvInstallHandler (
ACPI_HANDLE ObjHandle,
UINT32 Level,
void *Context,
void **ReturnValue)
{
ACPI_OPERAND_OBJECT *HandlerObj;
ACPI_OPERAND_OBJECT *NextHandlerObj;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status;
ACPI_FUNCTION_NAME (EvInstallHandler);
HandlerObj = (ACPI_OPERAND_OBJECT *) Context;
/* Parameter validation */
if (!HandlerObj)
{
return (AE_OK);
}
/* Convert and validate the device handle */
Node = AcpiNsValidateHandle (ObjHandle);
if (!Node)
{
return (AE_BAD_PARAMETER);
}
/*
* 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) &&
(Node != AcpiGbl_RootNode))
{
return (AE_OK);
}
/* Check for an existing internal object */
ObjDesc = AcpiNsGetAttachedObject (Node);
if (!ObjDesc)
{
/* No object, just exit */
return (AE_OK);
}
/* Devices are handled different than regions */
if (ObjDesc->Common.Type == ACPI_TYPE_DEVICE)
{
/* Check if this Device already has a handler for this address space */
NextHandlerObj = ObjDesc->Device.Handler;
while (NextHandlerObj)
{
/* Found a handler, is it for the same address space? */
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",
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
* bail out telling the walk routine to not traverse this
* branch. This preserves the scoping rule for handlers.
*/
return (AE_CTRL_DEPTH);
}
/* Walk the linked list of handlers attached to this device */
NextHandlerObj = NextHandlerObj->AddressSpace.Next;
}
/*
* 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);
}
/* Object is a Region */
if (ObjDesc->Region.SpaceId != HandlerObj->AddressSpace.SpaceId)
{
/* 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.
*
* First disconnect region for any previous handler (if any)
*/
AcpiEvDetachRegion (ObjDesc, FALSE);
/* Connect the region to the new handler */
Status = AcpiEvAttachRegion (HandlerObj, ObjDesc, FALSE);
return (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiEvInstallSpaceHandler
*
* PARAMETERS: Node - Namespace node for the device
* SpaceId - The address space ID
* Handler - Address of the handler
* Setup - Address of the setup function
* Context - Value passed to the handler on each access
*
* RETURN: Status
*
* DESCRIPTION: Install a handler for all OpRegions of a given SpaceId.
* Assumes namespace is locked
*
******************************************************************************/
ACPI_STATUS
AcpiEvInstallSpaceHandler (
ACPI_NAMESPACE_NODE *Node,
ACPI_ADR_SPACE_TYPE SpaceId,
ACPI_ADR_SPACE_HANDLER Handler,
ACPI_ADR_SPACE_SETUP Setup,
void *Context)
{
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_OPERAND_OBJECT *HandlerObj;
ACPI_STATUS Status;
ACPI_OBJECT_TYPE Type;
UINT8 Flags = 0;
ACPI_FUNCTION_TRACE (EvInstallSpaceHandler);
/*
* 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) &&
(Node->Type != ACPI_TYPE_THERMAL) &&
(Node != AcpiGbl_RootNode))
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
if (Handler == ACPI_DEFAULT_HANDLER)
{
Flags = ACPI_ADDR_HANDLER_DEFAULT_INSTALLED;
switch (SpaceId)
{
case ACPI_ADR_SPACE_SYSTEM_MEMORY:
Handler = AcpiExSystemMemorySpaceHandler;
Setup = AcpiEvSystemMemoryRegionSetup;
break;
case ACPI_ADR_SPACE_SYSTEM_IO:
Handler = AcpiExSystemIoSpaceHandler;
Setup = AcpiEvIoSpaceRegionSetup;
break;
case ACPI_ADR_SPACE_PCI_CONFIG:
Handler = AcpiExPciConfigSpaceHandler;
Setup = AcpiEvPciConfigRegionSetup;
break;
case ACPI_ADR_SPACE_CMOS:
Handler = AcpiExCmosSpaceHandler;
Setup = AcpiEvCmosRegionSetup;
break;
case ACPI_ADR_SPACE_PCI_BAR_TARGET:
Handler = AcpiExPciBarSpaceHandler;
Setup = AcpiEvPciBarRegionSetup;
break;
case ACPI_ADR_SPACE_DATA_TABLE:
Handler = AcpiExDataTableSpaceHandler;
Setup = NULL;
break;
default:
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
}
/* If the caller hasn't specified a setup routine, use the default */
if (!Setup)
{
Setup = AcpiEvDefaultRegionSetup;
}
/* Check for an existing internal object */
ObjDesc = AcpiNsGetAttachedObject (Node);
if (ObjDesc)
{
/*
* The attached device object already exists. Make sure the handler
* is not already installed.
*/
HandlerObj = ObjDesc->Device.Handler;
/* Walk the handler list for this device */
while (HandlerObj)
{
/* Same SpaceId indicates a handler already installed */
if (HandlerObj->AddressSpace.SpaceId == SpaceId)
{
if (HandlerObj->AddressSpace.Handler == Handler)
{
/*
* It is (relatively) OK to attempt to install the SAME
* handler twice. This can easily happen with the
* PCI_Config space.
*/
Status = AE_SAME_HANDLER;
goto UnlockAndExit;
}
else
{
/* A handler is already installed */
Status = AE_ALREADY_EXISTS;
}
goto UnlockAndExit;
}
/* Walk the linked list of handlers */
HandlerObj = HandlerObj->AddressSpace.Next;
}
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
"Creating object on Device %p while installing handler\n", Node));
/* ObjDesc does not exist, create one */
if (Node->Type == ACPI_TYPE_ANY)
{
Type = ACPI_TYPE_DEVICE;
}
else
{
Type = Node->Type;
}
ObjDesc = AcpiUtCreateInternalObject (Type);
if (!ObjDesc)
{
Status = AE_NO_MEMORY;
goto UnlockAndExit;
}
/* Init new descriptor */
ObjDesc->Common.Type = (UINT8) Type;
/* Attach the new object to the Node */
Status = AcpiNsAttachObject (Node, ObjDesc, Type);
/* Remove local reference to the object */
AcpiUtRemoveReference (ObjDesc);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
}
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
"Installing address handler for region %s(%X) on Device %4.4s %p(%p)\n",
AcpiUtGetRegionName (SpaceId), SpaceId,
AcpiUtGetNodeName (Node), Node, ObjDesc));
/*
* Install the handler
*
* 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)
{
Status = AE_NO_MEMORY;
goto UnlockAndExit;
}
/* Init handler obj */
HandlerObj->AddressSpace.SpaceId = (UINT8) SpaceId;
HandlerObj->AddressSpace.HandlerFlags = Flags;
HandlerObj->AddressSpace.RegionList = NULL;
HandlerObj->AddressSpace.Node = Node;
HandlerObj->AddressSpace.Handler = Handler;
HandlerObj->AddressSpace.Context = Context;
HandlerObj->AddressSpace.Setup = Setup;
/* Install at head of Device.AddressSpace list */
HandlerObj->AddressSpace.Next = ObjDesc->Device.Handler;
/*
* The Device object is the first reference on the HandlerObj.
* Each region that uses the handler adds a reference.
*/
ObjDesc->Device.Handler = HandlerObj;
/*
* Walk the namespace finding all of the regions this
* handler will manage.
*
* Start at the device and search the branch toward
* the leaf nodes until either the leaf is encountered or
* a device is detected that has an address handler of the
* same type.
*
* In either case, back up and search down the remainder
* of the branch
*/
Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, ACPI_UINT32_MAX,
ACPI_NS_WALK_UNLOCK, AcpiEvInstallHandler, NULL,
HandlerObj, NULL);
UnlockAndExit:
return_ACPI_STATUS (Status);
}

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -158,6 +158,7 @@ AcpiEvIsNotifyObject (
return (TRUE);
default:
return (FALSE);
}
}
@ -363,21 +364,23 @@ AcpiEvTerminate (
Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock, NULL);
/* Remove SCI handler */
Status = AcpiEvRemoveSciHandler ();
if (ACPI_FAILURE(Status))
{
ACPI_ERROR ((AE_INFO,
"Could not remove SCI handler"));
}
Status = AcpiEvRemoveGlobalLockHandler ();
if (ACPI_FAILURE(Status))
{
ACPI_ERROR ((AE_INFO,
"Could not remove Global Lock handler"));
}
AcpiGbl_EventsInitialized = FALSE;
}
/* Remove SCI handlers */
Status = AcpiEvRemoveAllSciHandlers ();
if (ACPI_FAILURE(Status))
{
ACPI_ERROR ((AE_INFO,
"Could not remove SCI handler"));
}
/* Deallocate all handler objects installed within GPE info structs */

View File

@ -1,6 +1,6 @@
/******************************************************************************
*
* Module Name: evregion - ACPI AddressSpace (OpRegion) handler dispatch
* Module Name: evregion - Operation Region support
*
*****************************************************************************/
@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -126,16 +126,13 @@
ACPI_MODULE_NAME ("evregion")
/* Local prototypes */
extern UINT8 AcpiGbl_DefaultAddressSpaces[];
static BOOLEAN
AcpiEvHasDefaultHandler (
ACPI_NAMESPACE_NODE *Node,
ACPI_ADR_SPACE_TYPE SpaceId);
/* Local prototypes */
static void
AcpiEvOrphanEcRegMethod (
void);
ACPI_NAMESPACE_NODE *EcDeviceNode);
static ACPI_STATUS
AcpiEvRegRun (
@ -144,152 +141,6 @@ AcpiEvRegRun (
void *Context,
void **ReturnValue);
static ACPI_STATUS
AcpiEvInstallHandler (
ACPI_HANDLE ObjHandle,
UINT32 Level,
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
};
/*******************************************************************************
*
* FUNCTION: AcpiEvInstallRegionHandlers
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Installs the core subsystem default address space handlers.
*
******************************************************************************/
ACPI_STATUS
AcpiEvInstallRegionHandlers (
void)
{
ACPI_STATUS Status;
UINT32 i;
ACPI_FUNCTION_TRACE (EvInstallRegionHandlers);
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/*
* 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.
*
* 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).
* Similar for AE_SAME_HANDLER.
*/
for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++)
{
Status = AcpiEvInstallSpaceHandler (AcpiGbl_RootNode,
AcpiGbl_DefaultAddressSpaces[i],
ACPI_DEFAULT_HANDLER, NULL, NULL);
switch (Status)
{
case AE_OK:
case AE_SAME_HANDLER:
case AE_ALREADY_EXISTS:
/* These exceptions are all OK */
Status = AE_OK;
break;
default:
goto UnlockAndExit;
}
}
UnlockAndExit:
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiEvHasDefaultHandler
*
* PARAMETERS: Node - Namespace node for the device
* SpaceId - The address space ID
*
* RETURN: TRUE if default handler is installed, FALSE otherwise
*
* DESCRIPTION: Check if the default handler is installed for the requested
* space ID.
*
******************************************************************************/
static BOOLEAN
AcpiEvHasDefaultHandler (
ACPI_NAMESPACE_NODE *Node,
ACPI_ADR_SPACE_TYPE SpaceId)
{
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_OPERAND_OBJECT *HandlerObj;
/* Must have an existing internal object */
ObjDesc = AcpiNsGetAttachedObject (Node);
if (ObjDesc)
{
HandlerObj = ObjDesc->Device.Handler;
/* Walk the linked list of handlers for this object */
while (HandlerObj)
{
if (HandlerObj->AddressSpace.SpaceId == SpaceId)
{
if (HandlerObj->AddressSpace.HandlerFlags &
ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)
{
return (TRUE);
}
}
HandlerObj = HandlerObj->AddressSpace.Next;
}
}
return (FALSE);
}
/*******************************************************************************
*
@ -345,100 +196,6 @@ AcpiEvInitializeOpRegions (
}
/*******************************************************************************
*
* FUNCTION: AcpiEvExecuteRegMethod
*
* PARAMETERS: RegionObj - Region object
* Function - Passed to _REG: On (1) or Off (0)
*
* RETURN: Status
*
* DESCRIPTION: Execute _REG method for a region
*
******************************************************************************/
ACPI_STATUS
AcpiEvExecuteRegMethod (
ACPI_OPERAND_OBJECT *RegionObj,
UINT32 Function)
{
ACPI_EVALUATE_INFO *Info;
ACPI_OPERAND_OBJECT *Args[3];
ACPI_OPERAND_OBJECT *RegionObj2;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (EvExecuteRegMethod);
RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
if (!RegionObj2)
{
return_ACPI_STATUS (AE_NOT_EXIST);
}
if (RegionObj2->Extra.Method_REG == NULL)
{
return_ACPI_STATUS (AE_OK);
}
/* Allocate and initialize the evaluation information block */
Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
if (!Info)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
Info->PrefixNode = RegionObj2->Extra.Method_REG;
Info->Pathname = NULL;
Info->Parameters = Args;
Info->Flags = ACPI_IGNORE_RETURN_VALUE;
/*
* The _REG method has two arguments:
*
* Arg0 - Integer:
* Operation region space ID Same value as RegionObj->Region.SpaceId
*
* Arg1 - Integer:
* connection status 1 for connecting the handler, 0 for disconnecting
* the handler (Passed as a parameter)
*/
Args[0] = AcpiUtCreateIntegerObject ((UINT64) RegionObj->Region.SpaceId);
if (!Args[0])
{
Status = AE_NO_MEMORY;
goto Cleanup1;
}
Args[1] = AcpiUtCreateIntegerObject ((UINT64) Function);
if (!Args[1])
{
Status = AE_NO_MEMORY;
goto Cleanup2;
}
Args[2] = NULL; /* Terminate list */
/* Execute the method, no return value */
ACPI_DEBUG_EXEC (
AcpiUtDisplayInitPathname (ACPI_TYPE_METHOD, Info->PrefixNode, NULL));
Status = AcpiNsEvaluate (Info);
AcpiUtRemoveReference (Args[1]);
Cleanup2:
AcpiUtRemoveReference (Args[0]);
Cleanup1:
ACPI_FREE (Info);
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiEvAddressSpaceDispatch
@ -549,18 +306,12 @@ AcpiEvAddressSpaceDispatch (
{
RegionObj->Region.Flags |= AOPOBJ_SETUP_COMPLETE;
if (RegionObj2->Extra.RegionContext)
/*
* Save the returned context for use in all accesses to
* the handler for this particular region
*/
if (!(RegionObj2->Extra.RegionContext))
{
/* The handler for this region was already installed */
ACPI_FREE (RegionContext);
}
else
{
/*
* Save the returned context for use in all accesses to
* this particular region
*/
RegionObj2->Extra.RegionContext = RegionContext;
}
}
@ -576,7 +327,6 @@ AcpiEvAddressSpaceDispatch (
ACPI_FORMAT_NATIVE_UINT (RegionObj->Region.Address + RegionOffset),
AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
/*
* Special handling for GenericSerialBus and GeneralPurposeIo:
* There are three extra parameters that must be passed to the
@ -739,6 +489,15 @@ AcpiEvDetachRegion(
Status = RegionSetup (RegionObj, ACPI_REGION_DEACTIVATE,
HandlerObj->AddressSpace.Context, RegionContext);
/*
* RegionContext should have been released by the deactivate
* operation. We don't need access to it anymore here.
*/
if (RegionContext)
{
*RegionContext = NULL;
}
/* Init routine may fail, Just ignore errors */
if (ACPI_FAILURE (Status))
@ -834,377 +593,94 @@ AcpiEvAttachRegion (
/*******************************************************************************
*
* FUNCTION: AcpiEvInstallHandler
* FUNCTION: AcpiEvExecuteRegMethod
*
* PARAMETERS: WalkNamespace callback
*
* DESCRIPTION: This routine installs an address handler into objects that are
* of type Region or Device.
*
* If the Object is a Device, and the device has a handler of
* the same type then the search is terminated in that branch.
*
* This is because the existing handler is closer in proximity
* to any more regions than the one we are trying to install.
*
******************************************************************************/
static ACPI_STATUS
AcpiEvInstallHandler (
ACPI_HANDLE ObjHandle,
UINT32 Level,
void *Context,
void **ReturnValue)
{
ACPI_OPERAND_OBJECT *HandlerObj;
ACPI_OPERAND_OBJECT *NextHandlerObj;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status;
ACPI_FUNCTION_NAME (EvInstallHandler);
HandlerObj = (ACPI_OPERAND_OBJECT *) Context;
/* Parameter validation */
if (!HandlerObj)
{
return (AE_OK);
}
/* Convert and validate the device handle */
Node = AcpiNsValidateHandle (ObjHandle);
if (!Node)
{
return (AE_BAD_PARAMETER);
}
/*
* 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) &&
(Node != AcpiGbl_RootNode))
{
return (AE_OK);
}
/* Check for an existing internal object */
ObjDesc = AcpiNsGetAttachedObject (Node);
if (!ObjDesc)
{
/* No object, just exit */
return (AE_OK);
}
/* Devices are handled different than regions */
if (ObjDesc->Common.Type == ACPI_TYPE_DEVICE)
{
/* Check if this Device already has a handler for this address space */
NextHandlerObj = ObjDesc->Device.Handler;
while (NextHandlerObj)
{
/* Found a handler, is it for the same address space? */
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",
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
* bail out telling the walk routine to not traverse this
* branch. This preserves the scoping rule for handlers.
*/
return (AE_CTRL_DEPTH);
}
/* Walk the linked list of handlers attached to this device */
NextHandlerObj = NextHandlerObj->AddressSpace.Next;
}
/*
* 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);
}
/* Object is a Region */
if (ObjDesc->Region.SpaceId != HandlerObj->AddressSpace.SpaceId)
{
/* 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.
*
* First disconnect region for any previous handler (if any)
*/
AcpiEvDetachRegion (ObjDesc, FALSE);
/* Connect the region to the new handler */
Status = AcpiEvAttachRegion (HandlerObj, ObjDesc, FALSE);
return (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiEvInstallSpaceHandler
*
* PARAMETERS: Node - Namespace node for the device
* SpaceId - The address space ID
* Handler - Address of the handler
* Setup - Address of the setup function
* Context - Value passed to the handler on each access
* PARAMETERS: RegionObj - Region object
* Function - Passed to _REG: On (1) or Off (0)
*
* RETURN: Status
*
* DESCRIPTION: Install a handler for all OpRegions of a given SpaceId.
* Assumes namespace is locked
* DESCRIPTION: Execute _REG method for a region
*
******************************************************************************/
ACPI_STATUS
AcpiEvInstallSpaceHandler (
ACPI_NAMESPACE_NODE *Node,
ACPI_ADR_SPACE_TYPE SpaceId,
ACPI_ADR_SPACE_HANDLER Handler,
ACPI_ADR_SPACE_SETUP Setup,
void *Context)
AcpiEvExecuteRegMethod (
ACPI_OPERAND_OBJECT *RegionObj,
UINT32 Function)
{
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_OPERAND_OBJECT *HandlerObj;
ACPI_EVALUATE_INFO *Info;
ACPI_OPERAND_OBJECT *Args[3];
ACPI_OPERAND_OBJECT *RegionObj2;
ACPI_STATUS Status;
ACPI_OBJECT_TYPE Type;
UINT8 Flags = 0;
ACPI_FUNCTION_TRACE (EvInstallSpaceHandler);
ACPI_FUNCTION_TRACE (EvExecuteRegMethod);
RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
if (!RegionObj2)
{
return_ACPI_STATUS (AE_NOT_EXIST);
}
if (RegionObj2->Extra.Method_REG == NULL)
{
return_ACPI_STATUS (AE_OK);
}
/* Allocate and initialize the evaluation information block */
Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
if (!Info)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
Info->PrefixNode = RegionObj2->Extra.Method_REG;
Info->RelativePathname = NULL;
Info->Parameters = Args;
Info->Flags = ACPI_IGNORE_RETURN_VALUE;
/*
* 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) &&
(Node->Type != ACPI_TYPE_THERMAL) &&
(Node != AcpiGbl_RootNode))
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
if (Handler == ACPI_DEFAULT_HANDLER)
{
Flags = ACPI_ADDR_HANDLER_DEFAULT_INSTALLED;
switch (SpaceId)
{
case ACPI_ADR_SPACE_SYSTEM_MEMORY:
Handler = AcpiExSystemMemorySpaceHandler;
Setup = AcpiEvSystemMemoryRegionSetup;
break;
case ACPI_ADR_SPACE_SYSTEM_IO:
Handler = AcpiExSystemIoSpaceHandler;
Setup = AcpiEvIoSpaceRegionSetup;
break;
case ACPI_ADR_SPACE_PCI_CONFIG:
Handler = AcpiExPciConfigSpaceHandler;
Setup = AcpiEvPciConfigRegionSetup;
break;
case ACPI_ADR_SPACE_CMOS:
Handler = AcpiExCmosSpaceHandler;
Setup = AcpiEvCmosRegionSetup;
break;
case ACPI_ADR_SPACE_PCI_BAR_TARGET:
Handler = AcpiExPciBarSpaceHandler;
Setup = AcpiEvPciBarRegionSetup;
break;
case ACPI_ADR_SPACE_DATA_TABLE:
Handler = AcpiExDataTableSpaceHandler;
Setup = NULL;
break;
default:
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
}
}
/* If the caller hasn't specified a setup routine, use the default */
if (!Setup)
{
Setup = AcpiEvDefaultRegionSetup;
}
/* Check for an existing internal object */
ObjDesc = AcpiNsGetAttachedObject (Node);
if (ObjDesc)
{
/*
* The attached device object already exists. Make sure the handler
* is not already installed.
*/
HandlerObj = ObjDesc->Device.Handler;
/* Walk the handler list for this device */
while (HandlerObj)
{
/* Same SpaceId indicates a handler already installed */
if (HandlerObj->AddressSpace.SpaceId == SpaceId)
{
if (HandlerObj->AddressSpace.Handler == Handler)
{
/*
* It is (relatively) OK to attempt to install the SAME
* handler twice. This can easily happen with the
* PCI_Config space.
*/
Status = AE_SAME_HANDLER;
goto UnlockAndExit;
}
else
{
/* A handler is already installed */
Status = AE_ALREADY_EXISTS;
}
goto UnlockAndExit;
}
/* Walk the linked list of handlers */
HandlerObj = HandlerObj->AddressSpace.Next;
}
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
"Creating object on Device %p while installing handler\n", Node));
/* ObjDesc does not exist, create one */
if (Node->Type == ACPI_TYPE_ANY)
{
Type = ACPI_TYPE_DEVICE;
}
else
{
Type = Node->Type;
}
ObjDesc = AcpiUtCreateInternalObject (Type);
if (!ObjDesc)
{
Status = AE_NO_MEMORY;
goto UnlockAndExit;
}
/* Init new descriptor */
ObjDesc->Common.Type = (UINT8) Type;
/* Attach the new object to the Node */
Status = AcpiNsAttachObject (Node, ObjDesc, Type);
/* Remove local reference to the object */
AcpiUtRemoveReference (ObjDesc);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
}
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
"Installing address handler for region %s(%X) on Device %4.4s %p(%p)\n",
AcpiUtGetRegionName (SpaceId), SpaceId,
AcpiUtGetNodeName (Node), Node, ObjDesc));
/*
* Install the handler
* The _REG method has two arguments:
*
* At this point there is no existing handler. Just allocate the object
* for the handler and link it into the list.
* Arg0 - Integer:
* Operation region space ID Same value as RegionObj->Region.SpaceId
*
* Arg1 - Integer:
* connection status 1 for connecting the handler, 0 for disconnecting
* the handler (Passed as a parameter)
*/
HandlerObj = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_ADDRESS_HANDLER);
if (!HandlerObj)
Args[0] = AcpiUtCreateIntegerObject ((UINT64) RegionObj->Region.SpaceId);
if (!Args[0])
{
Status = AE_NO_MEMORY;
goto UnlockAndExit;
goto Cleanup1;
}
/* Init handler obj */
Args[1] = AcpiUtCreateIntegerObject ((UINT64) Function);
if (!Args[1])
{
Status = AE_NO_MEMORY;
goto Cleanup2;
}
HandlerObj->AddressSpace.SpaceId = (UINT8) SpaceId;
HandlerObj->AddressSpace.HandlerFlags = Flags;
HandlerObj->AddressSpace.RegionList = NULL;
HandlerObj->AddressSpace.Node = Node;
HandlerObj->AddressSpace.Handler = Handler;
HandlerObj->AddressSpace.Context = Context;
HandlerObj->AddressSpace.Setup = Setup;
Args[2] = NULL; /* Terminate list */
/* Install at head of Device.AddressSpace list */
/* Execute the method, no return value */
HandlerObj->AddressSpace.Next = ObjDesc->Device.Handler;
ACPI_DEBUG_EXEC (
AcpiUtDisplayInitPathname (ACPI_TYPE_METHOD, Info->PrefixNode, NULL));
/*
* The Device object is the first reference on the HandlerObj.
* Each region that uses the handler adds a reference.
*/
ObjDesc->Device.Handler = HandlerObj;
Status = AcpiNsEvaluate (Info);
AcpiUtRemoveReference (Args[1]);
/*
* Walk the namespace finding all of the regions this
* handler will manage.
*
* Start at the device and search the branch toward
* the leaf nodes until either the leaf is encountered or
* a device is detected that has an address handler of the
* same type.
*
* In either case, back up and search down the remainder
* of the branch
*/
Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, ACPI_UINT32_MAX,
ACPI_NS_WALK_UNLOCK, AcpiEvInstallHandler, NULL,
HandlerObj, NULL);
Cleanup2:
AcpiUtRemoveReference (Args[0]);
UnlockAndExit:
Cleanup1:
ACPI_FREE (Info);
return_ACPI_STATUS (Status);
}
@ -1248,7 +724,7 @@ AcpiEvExecuteRegMethods (
if (SpaceId == ACPI_ADR_SPACE_EC)
{
AcpiEvOrphanEcRegMethod ();
AcpiEvOrphanEcRegMethod (Node);
}
return_ACPI_STATUS (Status);
@ -1326,7 +802,7 @@ AcpiEvRegRun (
*
* FUNCTION: AcpiEvOrphanEcRegMethod
*
* PARAMETERS: None
* PARAMETERS: EcDeviceNode - Namespace node for an EC device
*
* RETURN: None
*
@ -1338,41 +814,30 @@ AcpiEvRegRun (
* detected by providing a _REG method object underneath the
* Embedded Controller device."
*
* To quickly access the EC device, we use the EC_ID that appears
* within the ECDT. Otherwise, we would need to perform a time-
* consuming namespace walk, executing _HID methods to find the
* EC device.
* To quickly access the EC device, we use the EcDeviceNode used
* during EC handler installation. Otherwise, we would need to
* perform a time consuming namespace walk, executing _HID
* methods to find the EC device.
*
* MUTEX: Assumes the namespace is locked
*
******************************************************************************/
static void
AcpiEvOrphanEcRegMethod (
void)
ACPI_NAMESPACE_NODE *EcDeviceNode)
{
ACPI_TABLE_ECDT *Table;
ACPI_HANDLE RegMethod;
ACPI_NAMESPACE_NODE *NextNode;
ACPI_STATUS Status;
ACPI_OBJECT_LIST Args;
ACPI_OBJECT Objects[2];
ACPI_NAMESPACE_NODE *EcDeviceNode;
ACPI_NAMESPACE_NODE *RegMethod;
ACPI_NAMESPACE_NODE *NextNode;
ACPI_FUNCTION_TRACE (EvOrphanEcRegMethod);
/* Get the ECDT (if present in system) */
Status = AcpiGetTable (ACPI_SIG_ECDT, 0,
ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Table));
if (ACPI_FAILURE (Status))
{
return_VOID;
}
/* We need a valid EC_ID string */
if (!(*Table->Id))
if (!EcDeviceNode)
{
return_VOID;
}
@ -1381,23 +846,12 @@ AcpiEvOrphanEcRegMethod (
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
/* Get a handle to the EC device referenced in the ECDT */
Status = AcpiGetHandle (NULL,
ACPI_CAST_PTR (char, Table->Id),
ACPI_CAST_PTR (ACPI_HANDLE, &EcDeviceNode));
if (ACPI_FAILURE (Status))
{
goto Exit;
}
/* Get a handle to a _REG method immediately under the EC device */
Status = AcpiGetHandle (EcDeviceNode,
METHOD_NAME__REG, ACPI_CAST_PTR (ACPI_HANDLE, &RegMethod));
Status = AcpiGetHandle (EcDeviceNode, METHOD_NAME__REG, &RegMethod);
if (ACPI_FAILURE (Status))
{
goto Exit;
goto Exit; /* There is no _REG method present */
}
/*
@ -1405,7 +859,7 @@ AcpiEvOrphanEcRegMethod (
* this scope with the Embedded Controller space ID. Otherwise, it
* will already have been executed. Note, this allows for Regions
* with other space IDs to be present; but the code below will then
* execute the _REG method with the EC space ID argument.
* execute the _REG method with the EmbeddedControl SpaceID argument.
*/
NextNode = AcpiNsGetNextNode (EcDeviceNode, NULL);
while (NextNode)
@ -1414,12 +868,13 @@ AcpiEvOrphanEcRegMethod (
(NextNode->Object) &&
(NextNode->Object->Region.SpaceId == ACPI_ADR_SPACE_EC))
{
goto Exit; /* Do not execute _REG */
goto Exit; /* Do not execute the _REG */
}
NextNode = AcpiNsGetNextNode (EcDeviceNode, NextNode);
}
/* Evaluate the _REG(EC,Connect) method */
/* Evaluate the _REG(EmbeddedControl,Connect) method */
Args.Count = 2;
Args.Pointer = Objects;

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -736,7 +736,9 @@ AcpiEvInitializeRegion (
break;
default:
/* Ignore other objects */
break;
}

View File

@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -132,6 +132,57 @@ AcpiEvSciXruptHandler (
void *Context);
/*******************************************************************************
*
* FUNCTION: AcpiEvSciDispatch
*
* PARAMETERS: None
*
* RETURN: Status code indicates whether interrupt was handled.
*
* DESCRIPTION: Dispatch the SCI to all host-installed SCI handlers.
*
******************************************************************************/
UINT32
AcpiEvSciDispatch (
void)
{
ACPI_SCI_HANDLER_INFO *SciHandler;
ACPI_CPU_FLAGS Flags;
UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED;
ACPI_FUNCTION_NAME (EvSciDispatch);
/* Are there any host-installed SCI handlers? */
if (!AcpiGbl_SciHandlerList)
{
return (IntStatus);
}
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
/* Invoke all host-installed SCI handlers */
SciHandler = AcpiGbl_SciHandlerList;
while (SciHandler)
{
/* Invoke the installed handler (at interrupt level) */
IntStatus |= SciHandler->Address (
SciHandler->Context);
SciHandler = SciHandler->Next;
}
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
return (IntStatus);
}
/*******************************************************************************
*
* FUNCTION: AcpiEvSciXruptHandler
@ -173,6 +224,10 @@ AcpiEvSciXruptHandler (
*/
InterruptHandled |= AcpiEvGpeDetect (GpeXruptList);
/* Invoke all host-installed SCI handlers */
InterruptHandled |= AcpiEvSciDispatch ();
AcpiSciCount++;
return_UINT32 (InterruptHandled);
}
@ -202,14 +257,13 @@ AcpiEvGpeXruptHandler (
/*
* We are guaranteed by the ACPI CA initialization/shutdown code that
* We are guaranteed by the ACPICA initialization/shutdown code that
* if this interrupt handler is installed, ACPI is enabled.
*/
/* GPEs: Check for and dispatch any GPEs that have occurred */
InterruptHandled |= AcpiEvGpeDetect (GpeXruptList);
return_UINT32 (InterruptHandled);
}
@ -244,15 +298,15 @@ AcpiEvInstallSciHandler (
/******************************************************************************
*
* FUNCTION: AcpiEvRemoveSciHandler
* FUNCTION: AcpiEvRemoveAllSciHandlers
*
* PARAMETERS: none
*
* RETURN: E_OK if handler uninstalled OK, E_ERROR if handler was not
* RETURN: AE_OK if handler uninstalled, AE_ERROR if handler was not
* installed to begin with
*
* DESCRIPTION: Remove the SCI interrupt handler. No further SCIs will be
* taken.
* taken. Remove all host-installed SCI handlers.
*
* Note: It doesn't seem important to disable all events or set the event
* enable registers to their original values. The OS should disable
@ -262,13 +316,15 @@ AcpiEvInstallSciHandler (
******************************************************************************/
ACPI_STATUS
AcpiEvRemoveSciHandler (
AcpiEvRemoveAllSciHandlers (
void)
{
ACPI_SCI_HANDLER_INFO *SciHandler;
ACPI_CPU_FLAGS Flags;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (EvRemoveSciHandler);
ACPI_FUNCTION_TRACE (EvRemoveAllSciHandlers);
/* Just let the OS remove the handler and disable the level */
@ -276,6 +332,23 @@ AcpiEvRemoveSciHandler (
Status = AcpiOsRemoveInterruptHandler ((UINT32) AcpiGbl_FADT.SciInterrupt,
AcpiEvSciXruptHandler);
if (!AcpiGbl_SciHandlerList)
{
return (Status);
}
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
/* Free all host-installed SCI handlers */
while (AcpiGbl_SciHandlerList)
{
SciHandler = AcpiGbl_SciHandlerList;
AcpiGbl_SciHandlerList = SciHandler->Next;
ACPI_FREE (SciHandler);
}
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
return_ACPI_STATUS (Status);
}

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -505,6 +505,169 @@ ACPI_EXPORT_SYMBOL (AcpiInstallExceptionHandler)
#if (!ACPI_REDUCED_HARDWARE)
/*******************************************************************************
*
* FUNCTION: AcpiInstallSciHandler
*
* PARAMETERS: Address - Address of the handler
* Context - Value passed to the handler on each SCI
*
* RETURN: Status
*
* DESCRIPTION: Install a handler for a System Control Interrupt.
*
******************************************************************************/
ACPI_STATUS
AcpiInstallSciHandler (
ACPI_SCI_HANDLER Address,
void *Context)
{
ACPI_SCI_HANDLER_INFO *NewSciHandler;
ACPI_SCI_HANDLER_INFO *SciHandler;
ACPI_CPU_FLAGS Flags;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (AcpiInstallSciHandler);
if (!Address)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Allocate and init a handler object */
NewSciHandler = ACPI_ALLOCATE (sizeof (ACPI_SCI_HANDLER_INFO));
if (!NewSciHandler)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
NewSciHandler->Address = Address;
NewSciHandler->Context = Context;
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
goto Exit;
}
/* Lock list during installation */
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
SciHandler = AcpiGbl_SciHandlerList;
/* Ensure handler does not already exist */
while (SciHandler)
{
if (Address == SciHandler->Address)
{
Status = AE_ALREADY_EXISTS;
goto UnlockAndExit;
}
SciHandler = SciHandler->Next;
}
/* Install the new handler into the global list (at head) */
NewSciHandler->Next = AcpiGbl_SciHandlerList;
AcpiGbl_SciHandlerList = NewSciHandler;
UnlockAndExit:
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
Exit:
if (ACPI_FAILURE (Status))
{
ACPI_FREE (NewSciHandler);
}
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiRemoveSciHandler
*
* PARAMETERS: Address - Address of the handler
*
* RETURN: Status
*
* DESCRIPTION: Remove a handler for a System Control Interrupt.
*
******************************************************************************/
ACPI_STATUS
AcpiRemoveSciHandler (
ACPI_SCI_HANDLER Address)
{
ACPI_SCI_HANDLER_INFO *PrevSciHandler;
ACPI_SCI_HANDLER_INFO *NextSciHandler;
ACPI_CPU_FLAGS Flags;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (AcpiRemoveSciHandler);
if (!Address)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Remove the SCI handler with lock */
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
PrevSciHandler = NULL;
NextSciHandler = AcpiGbl_SciHandlerList;
while (NextSciHandler)
{
if (NextSciHandler->Address == Address)
{
/* Unlink and free the SCI handler info block */
if (PrevSciHandler)
{
PrevSciHandler->Next = NextSciHandler->Next;
}
else
{
AcpiGbl_SciHandlerList = NextSciHandler->Next;
}
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
ACPI_FREE (NextSciHandler);
goto UnlockAndExit;
}
PrevSciHandler = NextSciHandler;
NextSciHandler = NextSciHandler->Next;
}
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
Status = AE_NOT_EXIST;
UnlockAndExit:
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiInstallGlobalEventHandler
@ -606,9 +769,9 @@ AcpiInstallFixedEventHandler (
return_ACPI_STATUS (Status);
}
/* Don't allow two handlers. */
/* Do not allow multiple handlers */
if (NULL != AcpiGbl_FixedEventHandlers[Event].Handler)
if (AcpiGbl_FixedEventHandlers[Event].Handler)
{
Status = AE_ALREADY_EXISTS;
goto Cleanup;
@ -622,7 +785,9 @@ AcpiInstallFixedEventHandler (
Status = AcpiEnableEvent (Event, 0);
if (ACPI_FAILURE (Status))
{
ACPI_WARNING ((AE_INFO, "Could not enable fixed event 0x%X", Event));
ACPI_WARNING ((AE_INFO,
"Could not enable fixed event - %s (%u)",
AcpiUtGetEventName (Event), Event));
/* Remove the handler */
@ -632,7 +797,8 @@ AcpiInstallFixedEventHandler (
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Enabled fixed event %X, Handler=%p\n", Event, Handler));
"Enabled fixed event %s (%X), Handler=%p\n",
AcpiUtGetEventName (Event), Event, Handler));
}
@ -693,11 +859,14 @@ AcpiRemoveFixedEventHandler (
if (ACPI_FAILURE (Status))
{
ACPI_WARNING ((AE_INFO,
"Could not write to fixed event enable register 0x%X", Event));
"Could not disable fixed event - %s (%u)",
AcpiUtGetEventName (Event), Event));
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Disabled fixed event %X\n", Event));
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Disabled fixed event - %s (%X)\n",
AcpiUtGetEventName (Event), Event));
}
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -154,6 +154,13 @@ AcpiEnable (
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
}
/* If the Hardware Reduced flag is set, machine is always in acpi mode */
if (AcpiGbl_ReducedHardware)
{
return_ACPI_STATUS (AE_OK);
}
/* Check current mode */
if (AcpiHwGetMode() == ACPI_SYS_MODE_ACPI)
@ -203,6 +210,13 @@ AcpiDisable (
ACPI_FUNCTION_TRACE (AcpiDisable);
/* If the Hardware Reduced flag is set, machine is always in acpi mode */
if (AcpiGbl_ReducedHardware)
{
return_ACPI_STATUS (AE_OK);
}
if (AcpiHwGetMode() == ACPI_SYS_MODE_LEGACY)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INIT,

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -322,14 +322,17 @@ AcpiSetGpe (
switch (Action)
{
case ACPI_GPE_ENABLE:
Status = AcpiEvEnableGpe (GpeEventInfo);
break;
case ACPI_GPE_DISABLE:
Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE);
break;
default:
Status = AE_BAD_PARAMETER;
break;
}
@ -559,14 +562,17 @@ AcpiSetGpeWakeMask (
switch (Action)
{
case ACPI_GPE_ENABLE:
ACPI_SET_BIT (GpeRegisterInfo->EnableForWake, (UINT8) RegisterBit);
break;
case ACPI_GPE_DISABLE:
ACPI_CLEAR_BIT (GpeRegisterInfo->EnableForWake, (UINT8) RegisterBit);
break;
default:
ACPI_ERROR ((AE_INFO, "%u, Invalid action", Action));
Status = AE_BAD_PARAMETER;
break;

View File

@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -221,6 +221,7 @@ AcpiInstallAddressSpaceHandler (
break;
default:
break;
}

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -123,6 +123,7 @@
#include "actables.h"
#include "acdispat.h"
#include "acevents.h"
#include "amlcode.h"
#define _COMPONENT ACPI_EXECUTER
@ -258,14 +259,15 @@ AcpiExLoadTableOp (
(Operand[1]->String.Length > ACPI_OEM_ID_SIZE) ||
(Operand[2]->String.Length > ACPI_OEM_TABLE_ID_SIZE))
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
return_ACPI_STATUS (AE_AML_STRING_LIMIT);
}
/* Find the ACPI table in the RSDT/XSDT */
Status = AcpiTbFindTable (Operand[0]->String.Pointer,
Operand[1]->String.Pointer,
Operand[2]->String.Pointer, &TableIndex);
Status = AcpiTbFindTable (
Operand[0]->String.Pointer,
Operand[1]->String.Pointer,
Operand[2]->String.Pointer, &TableIndex);
if (ACPI_FAILURE (Status))
{
if (Status != AE_NOT_FOUND)
@ -310,8 +312,8 @@ AcpiExLoadTableOp (
if (Operand[4]->String.Length > 0)
{
if ((Operand[4]->String.Pointer[0] != '\\') &&
(Operand[4]->String.Pointer[0] != '^'))
if ((Operand[4]->String.Pointer[0] != AML_ROOT_PREFIX) &&
(Operand[4]->String.Pointer[0] != AML_PARENT_PREFIX))
{
/*
* Path is not absolute, so it will be relative to the node
@ -372,7 +374,7 @@ AcpiExLoadTableOp (
}
*ReturnDesc = DdbHandle;
return_ACPI_STATUS (Status);
return_ACPI_STATUS (Status);
}
@ -554,7 +556,6 @@ AcpiExLoadOp (
TableDesc.Address = ObjDesc->Region.Address;
break;
case ACPI_TYPE_BUFFER: /* Buffer or resolved RegionField */
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
@ -597,8 +598,8 @@ AcpiExLoadOp (
TableDesc.Address = ACPI_TO_INTEGER (TableDesc.Pointer);
break;
default:
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
@ -714,7 +715,7 @@ AcpiExUnloadTable (
(DdbHandle->Common.Type != ACPI_TYPE_LOCAL_REFERENCE) ||
(!(DdbHandle->Common.Flags & AOPOBJ_DATA_VALID)))
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
/* Get the table index from the DdbHandle */

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -186,6 +186,7 @@ AcpiExConvertToInteger (
break;
default:
return_ACPI_STATUS (AE_TYPE);
}
@ -205,7 +206,6 @@ AcpiExConvertToInteger (
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
@ -219,7 +219,6 @@ AcpiExConvertToInteger (
}
break;
case ACPI_TYPE_BUFFER:
/* Check for zero-length buffer */
@ -251,10 +250,10 @@ AcpiExConvertToInteger (
}
break;
default:
/* No other types can get here */
break;
}
@ -271,7 +270,7 @@ AcpiExConvertToInteger (
/* Save the Result */
AcpiExTruncateFor32bitTable (ReturnDesc);
(void) AcpiExTruncateFor32bitTable (ReturnDesc);
*ResultDesc = ReturnDesc;
return_ACPI_STATUS (AE_OK);
}
@ -314,7 +313,6 @@ AcpiExConvertToBuffer (
case ACPI_TYPE_INTEGER:
/*
* Create a new Buffer object.
* Need enough space for one integer
@ -333,9 +331,7 @@ AcpiExConvertToBuffer (
AcpiGbl_IntegerByteWidth);
break;
case ACPI_TYPE_STRING:
/*
* Create a new Buffer object
* Size will be the string length
@ -359,8 +355,8 @@ AcpiExConvertToBuffer (
ObjDesc->String.Length);
break;
default:
return_ACPI_STATUS (AE_TYPE);
}
@ -416,15 +412,18 @@ AcpiExConvertToAscii (
switch (DataWidth)
{
case 1:
DecimalLength = ACPI_MAX8_DECIMAL_DIGITS;
break;
case 4:
DecimalLength = ACPI_MAX32_DECIMAL_DIGITS;
break;
case 8:
default:
DecimalLength = ACPI_MAX64_DECIMAL_DIGITS;
break;
}
@ -533,7 +532,6 @@ AcpiExConvertToString (
*ResultDesc = ObjDesc;
return_ACPI_STATUS (AE_OK);
case ACPI_TYPE_INTEGER:
switch (Type)
@ -577,7 +575,6 @@ AcpiExConvertToString (
NewBuf [StringLength] = 0;
break;
case ACPI_TYPE_BUFFER:
/* Setup string length, base, and separator */
@ -676,6 +673,7 @@ AcpiExConvertToString (
break;
default:
return_ACPI_STATUS (AE_TYPE);
}
@ -735,6 +733,7 @@ AcpiExConvertToTargetType (
break;
default:
/* No conversion allowed for these types */
if (DestinationType != SourceDesc->Common.Type)
@ -748,7 +747,6 @@ AcpiExConvertToTargetType (
}
break;
case ARGI_TARGETREF:
switch (DestinationType)
@ -765,7 +763,6 @@ AcpiExConvertToTargetType (
16);
break;
case ACPI_TYPE_STRING:
/*
* The operand must be a String. We can convert an
@ -775,7 +772,6 @@ AcpiExConvertToTargetType (
ACPI_IMPLICIT_CONVERT_HEX);
break;
case ACPI_TYPE_BUFFER:
/*
* The operand must be a Buffer. We can convert an
@ -784,8 +780,8 @@ AcpiExConvertToTargetType (
Status = AcpiExConvertToBuffer (SourceDesc, ResultDesc);
break;
default:
ACPI_ERROR ((AE_INFO, "Bad destination type during conversion: 0x%X",
DestinationType));
Status = AE_AML_INTERNAL;
@ -793,15 +789,14 @@ AcpiExConvertToTargetType (
}
break;
case ARGI_REFERENCE:
/*
* CreateXxxxField cases - we are storing the field object into the name
*/
break;
default:
ACPI_ERROR ((AE_INFO,
"Unknown Target type ID 0x%X AmlOpcode 0x%X DestType %s",
GET_CURRENT_ARG_TYPE (WalkState->OpInfo->RuntimeArgs),

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -186,7 +186,6 @@ AcpiExCreateAlias (
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.
@ -196,7 +195,6 @@ AcpiExCreateAlias (
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.
@ -206,7 +204,6 @@ AcpiExCreateAlias (
break;
case ACPI_TYPE_METHOD:
/*
* Control method aliases need to be differentiated
*/

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -280,6 +280,7 @@ AcpiExDoDebugObject (
return_VOID;
default:
break;
}
@ -313,6 +314,7 @@ AcpiExDoDebugObject (
break;
default:
AcpiExDoDebugObject ((SourceDesc->Reference.Node)->Object,
Level+4, 0);
break;

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -429,6 +429,7 @@ AcpiExDumpObject (
{
UINT8 *Target;
char *Name;
const char *ReferenceName;
UINT8 Count;
@ -452,6 +453,7 @@ AcpiExDumpObject (
switch (Info->Opcode)
{
case ACPI_EXD_INIT:
break;
case ACPI_EXD_TYPE:
@ -512,8 +514,8 @@ AcpiExDumpObject (
case ACPI_EXD_REFERENCE:
AcpiExOutString ("Class Name",
ACPI_CAST_PTR (char, AcpiUtGetReferenceName (ObjDesc)));
ReferenceName = AcpiUtGetReferenceName (ObjDesc);
AcpiExOutString ("Class Name", ACPI_CAST_PTR (char, ReferenceName));
AcpiExDumpReferenceObj (ObjDesc);
break;
@ -555,7 +557,9 @@ AcpiExDumpOperand (
ACPI_FUNCTION_NAME (ExDumpOperand)
if (!((ACPI_LV_EXEC & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
/* Check if debug output enabled */
if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_EXEC, _COMPONENT))
{
return;
}
@ -611,19 +615,16 @@ AcpiExDumpOperand (
AcpiOsPrintf ("\n");
break;
case ACPI_REFCLASS_INDEX:
AcpiOsPrintf ("%p\n", ObjDesc->Reference.Object);
break;
case ACPI_REFCLASS_TABLE:
AcpiOsPrintf ("Table Index %X\n", ObjDesc->Reference.Value);
break;
case ACPI_REFCLASS_REFOF:
AcpiOsPrintf ("%p [%s]\n", ObjDesc->Reference.Object,
@ -631,20 +632,17 @@ AcpiExDumpOperand (
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);
@ -652,7 +650,6 @@ AcpiExDumpOperand (
}
break;
case ACPI_TYPE_BUFFER:
AcpiOsPrintf ("Buffer length %.2X @ %p\n",
@ -674,14 +671,12 @@ AcpiExDumpOperand (
}
break;
case ACPI_TYPE_INTEGER:
AcpiOsPrintf ("Integer %8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
break;
case ACPI_TYPE_PACKAGE:
AcpiOsPrintf ("Package [Len %X] ElementArray %p\n",
@ -702,7 +697,6 @@ AcpiExDumpOperand (
}
break;
case ACPI_TYPE_REGION:
AcpiOsPrintf ("Region %s (%X)",
@ -725,7 +719,6 @@ AcpiExDumpOperand (
}
break;
case ACPI_TYPE_STRING:
AcpiOsPrintf ("String length %X @ %p ",
@ -736,13 +729,11 @@ AcpiExDumpOperand (
AcpiOsPrintf ("\n");
break;
case ACPI_TYPE_LOCAL_BANK_FIELD:
AcpiOsPrintf ("BankField\n");
break;
case ACPI_TYPE_LOCAL_REGION_FIELD:
AcpiOsPrintf ("RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at "
@ -757,13 +748,11 @@ AcpiExDumpOperand (
AcpiExDumpOperand (ObjDesc->Field.RegionObj, Depth+1);
break;
case ACPI_TYPE_LOCAL_INDEX_FIELD:
AcpiOsPrintf ("IndexField\n");
break;
case ACPI_TYPE_BUFFER_FIELD:
AcpiOsPrintf ("BufferField: %X bits at byte %X bit %X of\n",
@ -786,13 +775,11 @@ AcpiExDumpOperand (
}
break;
case ACPI_TYPE_EVENT:
AcpiOsPrintf ("Event\n");
break;
case ACPI_TYPE_METHOD:
AcpiOsPrintf ("Method(%X) @ %p:%X\n",
@ -801,38 +788,33 @@ AcpiExDumpOperand (
ObjDesc->Method.AmlLength);
break;
case ACPI_TYPE_MUTEX:
AcpiOsPrintf ("Mutex\n");
break;
case ACPI_TYPE_DEVICE:
AcpiOsPrintf ("Device\n");
break;
case ACPI_TYPE_POWER:
AcpiOsPrintf ("Power\n");
break;
case ACPI_TYPE_PROCESSOR:
AcpiOsPrintf ("Processor\n");
break;
case ACPI_TYPE_THERMAL:
AcpiOsPrintf ("Thermal\n");
break;
default:
/* Unknown Type */
AcpiOsPrintf ("Unknown Type %X\n", ObjDesc->Common.Type);
@ -945,7 +927,9 @@ AcpiExDumpNamespaceNode (
if (!Flags)
{
if (!((ACPI_LV_OBJECTS & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
/* Check if debug output enabled */
if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_OBJECTS, _COMPONENT))
{
return;
}
@ -1073,7 +1057,6 @@ AcpiExDumpPackageObj (
ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
break;
case ACPI_TYPE_STRING:
AcpiOsPrintf ("[String] Value: ");
@ -1081,7 +1064,6 @@ AcpiExDumpPackageObj (
AcpiOsPrintf ("\n");
break;
case ACPI_TYPE_BUFFER:
AcpiOsPrintf ("[Buffer] Length %.2X = ", ObjDesc->Buffer.Length);
@ -1096,7 +1078,6 @@ AcpiExDumpPackageObj (
}
break;
case ACPI_TYPE_PACKAGE:
AcpiOsPrintf ("[Package] Contains %u Elements:\n",
@ -1108,7 +1089,6 @@ AcpiExDumpPackageObj (
}
break;
case ACPI_TYPE_LOCAL_REFERENCE:
AcpiOsPrintf ("[Object Reference] Type [%s] %2.2X",
@ -1117,7 +1097,6 @@ AcpiExDumpPackageObj (
AcpiExDumpReferenceObj (ObjDesc);
break;
default:
AcpiOsPrintf ("[Unknown Type] %X\n", ObjDesc->Common.Type);
@ -1152,7 +1131,9 @@ AcpiExDumpObjectDescriptor (
if (!Flags)
{
if (!((ACPI_LV_OBJECTS & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
/* Check if debug output enabled */
if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_OBJECTS, _COMPONENT))
{
return_VOID;
}

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -432,21 +432,25 @@ AcpiExWriteDataToField (
switch (SourceDesc->Common.Type)
{
case ACPI_TYPE_INTEGER:
Buffer = &SourceDesc->Integer.Value;
Length = sizeof (SourceDesc->Integer.Value);
break;
case ACPI_TYPE_BUFFER:
Buffer = SourceDesc->Buffer.Pointer;
Length = SourceDesc->Buffer.Length;
break;
case ACPI_TYPE_STRING:
Buffer = SourceDesc->String.Pointer;
Length = SourceDesc->String.Length;
break;
default:
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -552,9 +552,7 @@ AcpiExFieldDatumIo (
Status = AE_OK;
break;
case ACPI_TYPE_LOCAL_BANK_FIELD:
/*
* Ensure that the BankValue is not beyond the capacity of
* the register
@ -584,7 +582,6 @@ AcpiExFieldDatumIo (
/*lint -fallthrough */
case ACPI_TYPE_LOCAL_REGION_FIELD:
/*
* For simple RegionFields, we just directly access the owning
@ -594,10 +591,7 @@ AcpiExFieldDatumIo (
ReadWrite);
break;
case ACPI_TYPE_LOCAL_INDEX_FIELD:
/*
* Ensure that the IndexValue is not beyond the capacity of
* the register
@ -647,7 +641,6 @@ AcpiExFieldDatumIo (
}
break;
default:
ACPI_ERROR ((AE_INFO, "Wrong object type in field I/O %u",
@ -838,7 +831,18 @@ AcpiExExtractFromField (
if ((ObjDesc->CommonField.StartFieldBitOffset == 0) &&
(ObjDesc->CommonField.BitLength == AccessBitWidth))
{
Status = AcpiExFieldDatumIo (ObjDesc, 0, Buffer, ACPI_READ);
if (BufferLength >= sizeof (UINT64))
{
Status = AcpiExFieldDatumIo (ObjDesc, 0, Buffer, ACPI_READ);
}
else
{
/* Use RawDatum (UINT64) to handle buffers < 64 bits */
Status = AcpiExFieldDatumIo (ObjDesc, 0, &RawDatum, ACPI_READ);
ACPI_MEMCPY (Buffer, &RawDatum, BufferLength);
}
return_ACPI_STATUS (Status);
}

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -188,16 +188,13 @@ AcpiExGetObjectReference (
}
break;
case ACPI_DESC_TYPE_NAMED:
/*
* A named reference that has already been resolved to a Node
*/
ReferencedObj = ObjDesc;
break;
default:
ACPI_ERROR ((AE_INFO, "Invalid descriptor type 0x%X",
@ -359,19 +356,23 @@ AcpiExDoConcatenate (
switch (Operand0->Common.Type)
{
case ACPI_TYPE_INTEGER:
Status = AcpiExConvertToInteger (Operand1, &LocalOperand1, 16);
break;
case ACPI_TYPE_STRING:
Status = AcpiExConvertToString (Operand1, &LocalOperand1,
ACPI_IMPLICIT_CONVERT_HEX);
break;
case ACPI_TYPE_BUFFER:
Status = AcpiExConvertToBuffer (Operand1, &LocalOperand1);
break;
default:
ACPI_ERROR ((AE_INFO, "Invalid object type: 0x%X",
Operand0->Common.Type));
Status = AE_AML_INTERNAL;
@ -523,37 +524,30 @@ AcpiExDoMathOp (
return (Integer0 + Integer1);
case AML_BIT_AND_OP: /* And (Integer0, Integer1, Result) */
return (Integer0 & Integer1);
case AML_BIT_NAND_OP: /* NAnd (Integer0, Integer1, Result) */
return (~(Integer0 & Integer1));
case AML_BIT_OR_OP: /* Or (Integer0, Integer1, Result) */
return (Integer0 | Integer1);
case AML_BIT_NOR_OP: /* NOr (Integer0, Integer1, Result) */
return (~(Integer0 | Integer1));
case AML_BIT_XOR_OP: /* XOr (Integer0, Integer1, Result) */
return (Integer0 ^ Integer1);
case AML_MULTIPLY_OP: /* Multiply (Integer0, Integer1, Result) */
return (Integer0 * Integer1);
case AML_SHIFT_LEFT_OP: /* ShiftLeft (Operand, ShiftCount, Result)*/
/*
@ -566,7 +560,6 @@ AcpiExDoMathOp (
}
return (Integer0 << Integer1);
case AML_SHIFT_RIGHT_OP: /* ShiftRight (Operand, ShiftCount, Result) */
/*
@ -579,7 +572,6 @@ AcpiExDoMathOp (
}
return (Integer0 >> Integer1);
case AML_SUBTRACT_OP: /* Subtract (Integer0, Integer1, Result) */
return (Integer0 - Integer1);
@ -644,6 +636,7 @@ AcpiExDoLogicalNumericOp (
break;
default:
Status = AE_AML_INTERNAL;
break;
}
@ -711,19 +704,23 @@ AcpiExDoLogicalOp (
switch (Operand0->Common.Type)
{
case ACPI_TYPE_INTEGER:
Status = AcpiExConvertToInteger (Operand1, &LocalOperand1, 16);
break;
case ACPI_TYPE_STRING:
Status = AcpiExConvertToString (Operand1, &LocalOperand1,
ACPI_IMPLICIT_CONVERT_HEX);
break;
case ACPI_TYPE_BUFFER:
Status = AcpiExConvertToBuffer (Operand1, &LocalOperand1);
break;
default:
Status = AE_AML_INTERNAL;
break;
}
@ -772,6 +769,7 @@ AcpiExDoLogicalOp (
break;
default:
Status = AE_AML_INTERNAL;
break;
}
@ -849,6 +847,7 @@ AcpiExDoLogicalOp (
break;
default:
Status = AE_AML_INTERNAL;
break;
}

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -406,7 +406,6 @@ AcpiExGetNameString (
HasPrefix = TRUE;
break;
case AML_PARENT_PREFIX:
/* Increment past possibly multiple parent prefixes */
@ -424,7 +423,6 @@ AcpiExGetNameString (
HasPrefix = TRUE;
break;
default:
/* Not a prefix character */
@ -460,7 +458,6 @@ AcpiExGetNameString (
}
break;
case AML_MULTI_NAME_PREFIX_OP:
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "MultiNamePrefix at %p\n",
@ -492,7 +489,6 @@ AcpiExGetNameString (
break;
case 0:
/* NullName valid as of 8-12-98 ASL/AML Grammar Update */
@ -515,7 +511,6 @@ AcpiExGetNameString (
break;
default:
/* Name segment string */

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -252,37 +252,31 @@ AcpiExOpcode_1A_0T_0R (
Status = AcpiExReleaseMutex (Operand[0], WalkState);
break;
case AML_RESET_OP: /* Reset (EventObject) */
Status = AcpiExSystemResetEvent (Operand[0]);
break;
case AML_SIGNAL_OP: /* Signal (EventObject) */
Status = AcpiExSystemSignalEvent (Operand[0]);
break;
case AML_SLEEP_OP: /* Sleep (MsecTime) */
Status = AcpiExSystemDoSleep (Operand[0]->Integer.Value);
break;
case AML_STALL_OP: /* Stall (UsecTime) */
Status = AcpiExSystemDoStall ((UINT32) Operand[0]->Integer.Value);
break;
case AML_UNLOAD_OP: /* Unload (Handle) */
Status = AcpiExUnloadTable (Operand[0]);
break;
default: /* Unknown opcode */
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
@ -402,7 +396,6 @@ AcpiExOpcode_1A_1T_1R (
ReturnDesc->Integer.Value = ~Operand[0]->Integer.Value;
break;
case AML_FIND_SET_LEFT_BIT_OP: /* FindSetLeftBit (Operand, Result) */
ReturnDesc->Integer.Value = Operand[0]->Integer.Value;
@ -420,7 +413,6 @@ AcpiExOpcode_1A_1T_1R (
ReturnDesc->Integer.Value = Temp32;
break;
case AML_FIND_SET_RIGHT_BIT_OP: /* FindSetRightBit (Operand, Result) */
ReturnDesc->Integer.Value = Operand[0]->Integer.Value;
@ -441,9 +433,7 @@ AcpiExOpcode_1A_1T_1R (
Temp32 == 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - Temp32;
break;
case AML_FROM_BCD_OP: /* FromBcd (BCDValue, Result) */
/*
* The 64-bit ACPI integer can hold 16 4-bit BCD characters
* (if table is 32-bit, integer can hold 8 BCD characters)
@ -488,7 +478,6 @@ AcpiExOpcode_1A_1T_1R (
}
break;
case AML_TO_BCD_OP: /* ToBcd (Operand, Result) */
ReturnDesc->Integer.Value = 0;
@ -520,9 +509,7 @@ AcpiExOpcode_1A_1T_1R (
}
break;
case AML_COND_REF_OF_OP: /* CondRefOf (SourceObject, Result) */
/*
* This op is a little strange because the internal return value is
* different than the return value stored in the result descriptor
@ -557,14 +544,14 @@ AcpiExOpcode_1A_1T_1R (
default:
/* No other opcodes get here */
break;
}
break;
case AML_STORE_OP: /* Store (Source, Target) */
/*
* A store operand is typically a number, string, buffer or lvalue
* Be careful about deleting the source object,
@ -591,7 +578,6 @@ AcpiExOpcode_1A_1T_1R (
}
return_ACPI_STATUS (Status);
/*
* ACPI 2.0 Opcodes
*/
@ -601,7 +587,6 @@ AcpiExOpcode_1A_1T_1R (
WalkState);
break;
case AML_TO_DECSTRING_OP: /* ToDecimalString (Data, Result) */
Status = AcpiExConvertToString (Operand[0], &ReturnDesc,
@ -613,7 +598,6 @@ AcpiExOpcode_1A_1T_1R (
}
break;
case AML_TO_HEXSTRING_OP: /* ToHexString (Data, Result) */
Status = AcpiExConvertToString (Operand[0], &ReturnDesc,
@ -625,7 +609,6 @@ AcpiExOpcode_1A_1T_1R (
}
break;
case AML_TO_BUFFER_OP: /* ToBuffer (Data, Result) */
Status = AcpiExConvertToBuffer (Operand[0], &ReturnDesc);
@ -636,7 +619,6 @@ AcpiExOpcode_1A_1T_1R (
}
break;
case AML_TO_INTEGER_OP: /* ToInteger (Data, Result) */
Status = AcpiExConvertToInteger (Operand[0], &ReturnDesc,
@ -648,7 +630,6 @@ AcpiExOpcode_1A_1T_1R (
}
break;
case AML_SHIFT_LEFT_BIT_OP: /* ShiftLeftBit (Source, BitNum) */
case AML_SHIFT_RIGHT_BIT_OP: /* ShiftRightBit (Source, BitNum) */
@ -660,7 +641,6 @@ AcpiExOpcode_1A_1T_1R (
Status = AE_SUPPORT;
goto Cleanup;
default: /* Unknown opcode */
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
@ -748,10 +728,8 @@ AcpiExOpcode_1A_0T_1R (
}
break;
case AML_DECREMENT_OP: /* Decrement (Operand) */
case AML_INCREMENT_OP: /* Increment (Operand) */
/*
* Create a new integer. Can't just get the base integer and
* increment it because it may be an Arg or Field.
@ -816,9 +794,7 @@ AcpiExOpcode_1A_0T_1R (
Status = AcpiExStore (ReturnDesc, Operand[0], WalkState);
break;
case AML_TYPE_OP: /* ObjectType (SourceObject) */
/*
* Note: The operand is not resolved at this point because we want to
* get the associated object, not its value. For example, we don't
@ -844,9 +820,7 @@ AcpiExOpcode_1A_0T_1R (
}
break;
case AML_SIZE_OF_OP: /* SizeOf (SourceObject) */
/*
* Note: The operand is not resolved at this point because we want to
* get the associated object, not its value.
@ -873,10 +847,12 @@ AcpiExOpcode_1A_0T_1R (
switch (Type)
{
case ACPI_TYPE_INTEGER:
Value = AcpiGbl_IntegerByteWidth;
break;
case ACPI_TYPE_STRING:
Value = TempDesc->String.Length;
break;
@ -897,6 +873,7 @@ AcpiExOpcode_1A_0T_1R (
break;
default:
ACPI_ERROR ((AE_INFO,
"Operand must be Buffer/Integer/String/Package - found type %s",
AcpiUtGetTypeName (Type)));
@ -1004,9 +981,11 @@ AcpiExOpcode_1A_0T_1R (
break;
case ACPI_TYPE_STRING:
break;
default:
Status = AE_AML_OPERAND_TYPE;
goto Cleanup;
}
@ -1065,7 +1044,6 @@ AcpiExOpcode_1A_0T_1R (
switch (Operand[0]->Reference.Class)
{
case ACPI_REFCLASS_INDEX:
/*
* The target type for the Index operator must be
* either a Buffer or a Package
@ -1097,20 +1075,24 @@ AcpiExOpcode_1A_0T_1R (
}
break;
case ACPI_TYPE_PACKAGE:
/*
* Return the referenced element of the package. We must
* add another reference to the referenced object, however.
*/
ReturnDesc = *(Operand[0]->Reference.Where);
if (ReturnDesc)
if (!ReturnDesc)
{
AcpiUtAddReference (ReturnDesc);
/*
* Element is NULL, do not allow the dereference.
* This provides compatibility with other ACPI
* implementations.
*/
return_ACPI_STATUS (AE_AML_UNINITIALIZED_ELEMENT);
}
break;
AcpiUtAddReference (ReturnDesc);
break;
default:
@ -1122,25 +1104,53 @@ AcpiExOpcode_1A_0T_1R (
}
break;
case ACPI_REFCLASS_REFOF:
ReturnDesc = Operand[0]->Reference.Object;
if (ACPI_GET_DESCRIPTOR_TYPE (ReturnDesc) ==
ACPI_DESC_TYPE_NAMED)
ACPI_DESC_TYPE_NAMED)
{
ReturnDesc = AcpiNsGetAttachedObject (
(ACPI_NAMESPACE_NODE *) ReturnDesc);
(ACPI_NAMESPACE_NODE *) ReturnDesc);
if (!ReturnDesc)
{
break;
}
/*
* June 2013:
* BufferFields/FieldUnits require additional resolution
*/
switch (ReturnDesc->Common.Type)
{
case ACPI_TYPE_BUFFER_FIELD:
case ACPI_TYPE_LOCAL_REGION_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
Status = AcpiExReadDataFromField (WalkState,
ReturnDesc, &TempDesc);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
ReturnDesc = TempDesc;
break;
default:
/* Add another reference to the object */
AcpiUtAddReference (ReturnDesc);
break;
}
}
/* Add another reference to the object! */
AcpiUtAddReference (ReturnDesc);
break;
default:
ACPI_ERROR ((AE_INFO,
"Unknown class in reference(%p) - 0x%2.2X",
Operand[0], Operand[0]->Reference.Class));
@ -1151,7 +1161,6 @@ AcpiExOpcode_1A_0T_1R (
}
break;
default:
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -216,7 +216,6 @@ AcpiExOpcode_2A_0T_0R (
Status = AcpiEvQueueNotifyRequest (Node, Value);
break;
default:
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
@ -289,7 +288,6 @@ AcpiExOpcode_2A_2T_1R (
}
break;
default:
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
@ -358,7 +356,7 @@ AcpiExOpcode_2A_1T_1R (
ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
UINT64 Index;
ACPI_STATUS Status = AE_OK;
ACPI_SIZE Length;
ACPI_SIZE Length = 0;
ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_1T_1R,
@ -403,16 +401,13 @@ AcpiExOpcode_2A_1T_1R (
&ReturnDesc->Integer.Value);
break;
case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */
Status = AcpiExDoConcatenate (Operand[0], Operand[1],
&ReturnDesc, WalkState);
break;
case AML_TO_STRING_OP: /* ToString (Buffer, Length, Result) (ACPI 2.0) */
/*
* Input object is guaranteed to be a buffer at this point (it may have
* been converted.) Copy the raw buffer data to a new object of
@ -428,7 +423,6 @@ AcpiExOpcode_2A_1T_1R (
* NOTE: A length of zero is ok, and will create a zero-length, null
* terminated string.
*/
Length = 0;
while ((Length < Operand[0]->Buffer.Length) &&
(Length < Operand[1]->Integer.Value) &&
(Operand[0]->Buffer.Pointer[Length]))
@ -453,7 +447,6 @@ AcpiExOpcode_2A_1T_1R (
Operand[0]->Buffer.Pointer, Length);
break;
case AML_CONCAT_RES_OP:
/* ConcatenateResTemplate (Buffer, Buffer, Result) (ACPI 2.0) */
@ -462,7 +455,6 @@ AcpiExOpcode_2A_1T_1R (
&ReturnDesc, WalkState);
break;
case AML_INDEX_OP: /* Index (Source Index Result) */
/* Create the internal return object */
@ -490,6 +482,7 @@ AcpiExOpcode_2A_1T_1R (
if (Index >= Operand[0]->String.Length)
{
Length = Operand[0]->String.Length;
Status = AE_AML_STRING_LIMIT;
}
@ -500,6 +493,7 @@ AcpiExOpcode_2A_1T_1R (
if (Index >= Operand[0]->Buffer.Length)
{
Length = Operand[0]->Buffer.Length;
Status = AE_AML_BUFFER_LIMIT;
}
@ -510,6 +504,7 @@ AcpiExOpcode_2A_1T_1R (
if (Index >= Operand[0]->Package.Count)
{
Length = Operand[0]->Package.Count;
Status = AE_AML_PACKAGE_LIMIT;
}
@ -528,8 +523,8 @@ AcpiExOpcode_2A_1T_1R (
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Index (0x%8.8X%8.8X) is beyond end of object",
ACPI_FORMAT_UINT64 (Index)));
"Index (0x%X%8.8X) is beyond end of object (length 0x%X)",
ACPI_FORMAT_UINT64 (Index), (UINT32) Length));
goto Cleanup;
}
@ -549,7 +544,6 @@ AcpiExOpcode_2A_1T_1R (
WalkState->ResultObj = ReturnDesc;
goto Cleanup;
default:
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
@ -672,7 +666,6 @@ AcpiExOpcode_2A_0T_1R (
}
break;
default:
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -202,7 +202,6 @@ AcpiExOpcode_3A_0T_0R (
ACPI_FREE (Fatal);
break;
default:
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
@ -249,7 +248,6 @@ AcpiExOpcode_3A_1T_1R (
switch (WalkState->Opcode)
{
case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */
/*
* Create the return object. The Source operand is guaranteed to be
* either a String or a Buffer, so just use its type.
@ -341,7 +339,6 @@ AcpiExOpcode_3A_1T_1R (
ReturnDesc->Buffer.Flags |= AOPOBJ_DATA_VALID;
break;
default:
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -203,7 +203,6 @@ AcpiExDoMatch (
break;
case MATCH_MEQ:
/*
* True if equal: (P[i] == M)
* Change to: (M == P[i])
@ -217,7 +216,6 @@ AcpiExDoMatch (
break;
case MATCH_MLE:
/*
* True if less than or equal: (P[i] <= M) (P[i] NotGreater than M)
* Change to: (M >= P[i]) (M NotLess than P[i])
@ -232,7 +230,6 @@ AcpiExDoMatch (
break;
case MATCH_MLT:
/*
* True if less than: (P[i] < M)
* Change to: (M > P[i])
@ -246,7 +243,6 @@ AcpiExDoMatch (
break;
case MATCH_MGE:
/*
* True if greater than or equal: (P[i] >= M) (P[i] NotLess than M)
* Change to: (M <= P[i]) (M NotGreater than P[i])
@ -261,7 +257,6 @@ AcpiExDoMatch (
break;
case MATCH_MGT:
/*
* True if greater than: (P[i] > M)
* Change to: (M < P[i])
@ -401,13 +396,11 @@ AcpiExOpcode_6A_0T_1R (
}
break;
case AML_LOAD_TABLE_OP:
Status = AcpiExLoadTableOp (WalkState, &ReturnDesc);
break;
default:
ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -339,26 +339,31 @@ AcpiExDecodeFieldAccess (
case AML_FIELD_ACCESS_BYTE:
case AML_FIELD_ACCESS_BUFFER: /* ACPI 2.0 (SMBus Buffer) */
ByteAlignment = 1;
BitLength = 8;
break;
case AML_FIELD_ACCESS_WORD:
ByteAlignment = 2;
BitLength = 16;
break;
case AML_FIELD_ACCESS_DWORD:
ByteAlignment = 4;
BitLength = 32;
break;
case AML_FIELD_ACCESS_QWORD: /* ACPI 2.0 */
ByteAlignment = 8;
BitLength = 64;
break;
default:
/* Invalid field access type */
ACPI_ERROR ((AE_INFO,
@ -608,7 +613,6 @@ AcpiExPrepFieldValue (
ObjDesc->Field.AccessByteWidth, ObjDesc->Field.RegionObj));
break;
case ACPI_TYPE_LOCAL_BANK_FIELD:
ObjDesc->BankField.Value = Info->BankValue;
@ -643,7 +647,6 @@ AcpiExPrepFieldValue (
break;
case ACPI_TYPE_LOCAL_INDEX_FIELD:
/* Get the Index and Data registers */
@ -697,7 +700,9 @@ AcpiExPrepFieldValue (
break;
default:
/* No other types should get here */
break;
}

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -171,22 +171,27 @@ AcpiExSystemMemorySpaceHandler (
switch (BitWidth)
{
case 8:
Length = 1;
break;
case 16:
Length = 2;
break;
case 32:
Length = 4;
break;
case 64:
Length = 8;
break;
default:
ACPI_ERROR ((AE_INFO, "Invalid SystemMemory width %u",
BitWidth));
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
@ -303,23 +308,29 @@ AcpiExSystemMemorySpaceHandler (
switch (BitWidth)
{
case 8:
*Value = (UINT64) ACPI_GET8 (LogicalAddrPtr);
break;
case 16:
*Value = (UINT64) ACPI_GET16 (LogicalAddrPtr);
break;
case 32:
*Value = (UINT64) ACPI_GET32 (LogicalAddrPtr);
break;
case 64:
*Value = (UINT64) ACPI_GET64 (LogicalAddrPtr);
break;
default:
/* BitWidth was already validated */
break;
}
break;
@ -329,28 +340,35 @@ AcpiExSystemMemorySpaceHandler (
switch (BitWidth)
{
case 8:
ACPI_SET8 (LogicalAddrPtr) = (UINT8) *Value;
ACPI_SET8 (LogicalAddrPtr, *Value);
break;
case 16:
ACPI_SET16 (LogicalAddrPtr) = (UINT16) *Value;
ACPI_SET16 (LogicalAddrPtr, *Value);
break;
case 32:
ACPI_SET32 ( LogicalAddrPtr) = (UINT32) *Value;
ACPI_SET32 (LogicalAddrPtr, *Value);
break;
case 64:
ACPI_SET64 (LogicalAddrPtr) = (UINT64) *Value;
ACPI_SET64 (LogicalAddrPtr, *Value);
break;
default:
/* BitWidth was already validated */
break;
}
break;
default:
Status = AE_BAD_PARAMETER;
break;
}
@ -415,6 +433,7 @@ AcpiExSystemIoSpaceHandler (
break;
default:
Status = AE_BAD_PARAMETER;
break;
}

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -236,7 +236,6 @@ AcpiExResolveNodeToValue (
}
break;
case ACPI_TYPE_BUFFER:
if (SourceDesc->Common.Type != ACPI_TYPE_BUFFER)
@ -256,7 +255,6 @@ AcpiExResolveNodeToValue (
}
break;
case ACPI_TYPE_STRING:
if (SourceDesc->Common.Type != ACPI_TYPE_STRING)
@ -272,7 +270,6 @@ AcpiExResolveNodeToValue (
AcpiUtAddReference (ObjDesc);
break;
case ACPI_TYPE_INTEGER:
if (SourceDesc->Common.Type != ACPI_TYPE_INTEGER)
@ -288,7 +285,6 @@ AcpiExResolveNodeToValue (
AcpiUtAddReference (ObjDesc);
break;
case ACPI_TYPE_BUFFER_FIELD:
case ACPI_TYPE_LOCAL_REGION_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD:
@ -324,7 +320,6 @@ AcpiExResolveNodeToValue (
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */
case ACPI_TYPE_LOCAL_REFERENCE:
switch (SourceDesc->Reference.Class)
@ -340,6 +335,7 @@ AcpiExResolveNodeToValue (
break;
default:
/* No named references are allowed here */
ACPI_ERROR ((AE_INFO,
@ -350,7 +346,6 @@ AcpiExResolveNodeToValue (
}
break;
default:
/* Default case is for unknown types */

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -248,7 +248,6 @@ AcpiExResolveObjectToValue (
{
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
@ -271,7 +270,6 @@ AcpiExResolveObjectToValue (
*StackPtr = ObjDesc;
break;
case ACPI_REFCLASS_INDEX:
switch (StackDesc->Reference.TargetType)
@ -281,7 +279,6 @@ AcpiExResolveObjectToValue (
/* Just return - do not dereference */
break;
case ACPI_TYPE_PACKAGE:
/* If method call or CopyObject - do not dereference */
@ -319,7 +316,6 @@ AcpiExResolveObjectToValue (
}
break;
default:
/* Invalid reference object */
@ -332,7 +328,6 @@ AcpiExResolveObjectToValue (
}
break;
case ACPI_REFCLASS_REFOF:
case ACPI_REFCLASS_DEBUG:
case ACPI_REFCLASS_TABLE:
@ -372,19 +367,16 @@ AcpiExResolveObjectToValue (
}
break;
case ACPI_TYPE_BUFFER:
Status = AcpiDsGetBufferArguments (StackDesc);
break;
case ACPI_TYPE_PACKAGE:
Status = AcpiDsGetPackageArguments (StackDesc);
break;
case ACPI_TYPE_BUFFER_FIELD:
case ACPI_TYPE_LOCAL_REGION_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD:
@ -402,6 +394,7 @@ AcpiExResolveObjectToValue (
break;
default:
break;
}
@ -446,10 +439,12 @@ AcpiExResolveMultiple (
switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
{
case ACPI_DESC_TYPE_OPERAND:
Type = ObjDesc->Common.Type;
break;
case ACPI_DESC_TYPE_NAMED:
Type = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ObjDesc);
@ -526,7 +521,6 @@ AcpiExResolveMultiple (
}
break;
case ACPI_REFCLASS_INDEX:
/* Get the type of this reference (index into another object) */
@ -554,13 +548,11 @@ AcpiExResolveMultiple (
}
break;
case ACPI_REFCLASS_TABLE:
Type = ACPI_TYPE_DDB_HANDLE;
goto Exit;
case ACPI_REFCLASS_LOCAL:
case ACPI_REFCLASS_ARG:
@ -592,7 +584,6 @@ AcpiExResolveMultiple (
}
break;
case ACPI_REFCLASS_DEBUG:
/* The Debug Object is of type "DebugObject" */
@ -600,7 +591,6 @@ AcpiExResolveMultiple (
Type = ACPI_TYPE_DEBUG_OBJECT;
goto Exit;
default:
ACPI_ERROR ((AE_INFO,
@ -636,7 +626,9 @@ Exit:
break;
default:
/* No change to Type required */
break;
}

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -296,7 +296,6 @@ AcpiExResolveOperands (
}
break;
case ACPI_DESC_TYPE_OPERAND:
/* ACPI internal object */
@ -349,7 +348,6 @@ AcpiExResolveOperands (
}
break;
default:
/* Invalid descriptor */
@ -396,7 +394,6 @@ AcpiExResolveOperands (
case ARGI_TARGETREF: /* Allows implicit conversion rules before store */
case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */
case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */
/*
* Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
* A Namespace Node is OK as-is
@ -414,9 +411,7 @@ AcpiExResolveOperands (
}
goto NextOperand;
case ARGI_DATAREFOBJ: /* Store operator only */
/*
* We don't want to resolve IndexOp reference objects during
* a store because this would be an implicit DeRefOf operation.
@ -432,7 +427,9 @@ AcpiExResolveOperands (
break;
default:
/* All cases covered above */
break;
}
@ -525,9 +522,7 @@ AcpiExResolveOperands (
}
goto NextOperand;
case ARGI_BUFFER:
/*
* Need an operand of type ACPI_TYPE_BUFFER,
* But we can implicitly convert from a STRING or INTEGER
@ -554,9 +549,7 @@ AcpiExResolveOperands (
}
goto NextOperand;
case ARGI_STRING:
/*
* Need an operand of type ACPI_TYPE_STRING,
* But we can implicitly convert from a BUFFER or INTEGER
@ -584,7 +577,6 @@ AcpiExResolveOperands (
}
goto NextOperand;
case ARGI_COMPUTEDATA:
/* Need an operand of type INTEGER, STRING or BUFFER */
@ -607,7 +599,6 @@ AcpiExResolveOperands (
}
goto NextOperand;
case ARGI_BUFFER_OR_STRING:
/* Need an operand of type STRING or BUFFER */
@ -645,7 +636,6 @@ AcpiExResolveOperands (
}
goto NextOperand;
case ARGI_DATAOBJECT:
/*
* ARGI_DATAOBJECT is only used by the SizeOf operator.
@ -665,6 +655,7 @@ AcpiExResolveOperands (
break;
default:
ACPI_ERROR ((AE_INFO,
"Needed [Buffer/String/Package/Reference], found [%s] %p",
AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
@ -673,7 +664,6 @@ AcpiExResolveOperands (
}
goto NextOperand;
case ARGI_COMPLEXOBJ:
/* Need a buffer or package or (ACPI 2.0) String */
@ -688,6 +678,7 @@ AcpiExResolveOperands (
break;
default:
ACPI_ERROR ((AE_INFO,
"Needed [Buffer/String/Package], found [%s] %p",
AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
@ -696,7 +687,6 @@ AcpiExResolveOperands (
}
goto NextOperand;
case ARGI_REGION_OR_BUFFER: /* Used by Load() only */
/* Need an operand of type REGION or a BUFFER (which could be a resolved region field) */
@ -710,6 +700,7 @@ AcpiExResolveOperands (
break;
default:
ACPI_ERROR ((AE_INFO,
"Needed [Region/Buffer], found [%s] %p",
AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
@ -718,7 +709,6 @@ AcpiExResolveOperands (
}
goto NextOperand;
case ARGI_DATAREFOBJ:
/* Used by the Store() operator only */
@ -766,7 +756,6 @@ AcpiExResolveOperands (
}
goto NextOperand;
default:
/* Unknown type */

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -196,6 +196,7 @@ AcpiExStore (
switch (DestDesc->Common.Type)
{
case ACPI_TYPE_LOCAL_REFERENCE:
break;
case ACPI_TYPE_INTEGER:
@ -239,7 +240,6 @@ AcpiExStore (
WalkState, ACPI_IMPLICIT_CONVERSION);
break;
case ACPI_REFCLASS_INDEX:
/* Storing to an Index (pointer into a packager or buffer) */
@ -247,7 +247,6 @@ AcpiExStore (
Status = AcpiExStoreObjectToIndex (SourceDesc, RefDesc, WalkState);
break;
case ACPI_REFCLASS_LOCAL:
case ACPI_REFCLASS_ARG:
@ -257,9 +256,7 @@ AcpiExStore (
RefDesc->Reference.Value, SourceDesc, WalkState);
break;
case ACPI_REFCLASS_DEBUG:
/*
* Storing to the Debug object causes the value stored to be
* displayed and otherwise has no effect -- see ACPI Specification
@ -271,7 +268,6 @@ AcpiExStore (
ACPI_DEBUG_OBJECT (SourceDesc, 0, 0);
break;
default:
ACPI_ERROR ((AE_INFO, "Unknown Reference Class 0x%2.2X",
@ -380,9 +376,7 @@ AcpiExStoreObjectToIndex (
break;
case ACPI_TYPE_BUFFER_FIELD:
/*
* Store into a Buffer or String (not actually a real BufferField)
* at a location defined by an Index.
@ -440,7 +434,6 @@ AcpiExStoreObjectToIndex (
ObjDesc->Buffer.Pointer[IndexDesc->Reference.Value] = Value;
break;
default:
ACPI_ERROR ((AE_INFO,
"Target is not a Package or BufferField"));
@ -545,11 +538,9 @@ AcpiExStoreObjectToNode (
&WalkState->ResultObj);
break;
case ACPI_TYPE_INTEGER:
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
/*
* These target types are all of type Integer/String/Buffer, and
* therefore support implicit conversion before the store.
@ -583,17 +574,31 @@ AcpiExStoreObjectToNode (
}
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Storing %s (%p) directly into node (%p) with no implicit conversion\n",
AcpiUtGetObjectTypeName (SourceDesc), SourceDesc, Node));
"Storing [%s] (%p) directly into node [%s] (%p)"
" with no implicit conversion\n",
AcpiUtGetObjectTypeName (SourceDesc), SourceDesc,
AcpiUtGetObjectTypeName (TargetDesc), Node));
/* No conversions for all other types. Just attach the source object */
/*
* No conversions for all other types. Directly store a copy of
* the source object. NOTE: This is a departure from the ACPI
* spec, which states "If conversion is impossible, abort the
* running control method".
*
* This code implements "If conversion is impossible, treat the
* Store operation as a CopyObject".
*/
Status = AcpiUtCopyIobjectToIobject (SourceDesc, &NewDesc, WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
Status = AcpiNsAttachObject (Node, SourceDesc,
SourceDesc->Common.Type);
Status = AcpiNsAttachObject (Node, NewDesc, NewDesc->Common.Type);
AcpiUtRemoveReference (NewDesc);
break;
}

View File

@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -166,11 +166,9 @@ AcpiExResolveObject (
* These cases all require only Integers or values that
* can be converted to Integers (Strings or Buffers)
*/
case ACPI_TYPE_INTEGER:
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
/*
* Stores into a Field/Region or into a Integer/Buffer/String
* are all essentially the same. This case handles the
@ -212,10 +210,8 @@ AcpiExResolveObject (
}
break;
case ACPI_TYPE_LOCAL_ALIAS:
case ACPI_TYPE_LOCAL_METHOD_ALIAS:
/*
* All aliases should have been resolved earlier, during the
* operand resolution phase.
@ -224,10 +220,8 @@ AcpiExResolveObject (
Status = AE_AML_INTERNAL;
break;
case ACPI_TYPE_PACKAGE:
default:
/*
* All other types than Alias and the various Fields come here,
* including the untyped case - ACPI_TYPE_ANY.
@ -341,7 +335,7 @@ AcpiExStoreObjectToObject (
/* Truncate value if we are executing from a 32-bit ACPI table */
AcpiExTruncateFor32bitTable (DestDesc);
(void) AcpiExTruncateFor32bitTable (DestDesc);
break;
case ACPI_TYPE_STRING:

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -301,14 +301,14 @@ AcpiExRelinquishInterpreter (
*
* PARAMETERS: ObjDesc - Object to be truncated
*
* RETURN: none
* RETURN: TRUE if a truncation was performed, FALSE otherwise.
*
* DESCRIPTION: Truncate an ACPI Integer to 32 bits if the execution mode is
* 32-bit, as determined by the revision of the DSDT.
*
******************************************************************************/
void
BOOLEAN
AcpiExTruncateFor32bitTable (
ACPI_OPERAND_OBJECT *ObjDesc)
{
@ -318,23 +318,27 @@ AcpiExTruncateFor32bitTable (
/*
* Object must be a valid number and we must be executing
* a control method. NS node could be there for AML_INT_NAMEPATH_OP.
* a control method. Object could be NS node for AML_INT_NAMEPATH_OP.
*/
if ((!ObjDesc) ||
(ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) ||
(ObjDesc->Common.Type != ACPI_TYPE_INTEGER))
{
return;
return (FALSE);
}
if (AcpiGbl_IntegerByteWidth == 4)
if ((AcpiGbl_IntegerByteWidth == 4) &&
(ObjDesc->Integer.Value > (UINT64) ACPI_UINT32_MAX))
{
/*
* We are running a method that exists in a 32-bit ACPI table.
* We are executing in a 32-bit ACPI table.
* Truncate the value to 32 bits by zeroing out the upper 32-bit field
*/
ObjDesc->Integer.Value &= (UINT64) ACPI_UINT32_MAX;
return (TRUE);
}
return (FALSE);
}

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -147,6 +147,14 @@ AcpiHwSetMode (
ACPI_FUNCTION_TRACE (HwSetMode);
/* If the Hardware Reduced flag is set, machine is always in acpi mode */
if (AcpiGbl_ReducedHardware)
{
return_ACPI_STATUS (AE_OK);
}
/*
* ACPI 2.0 clarified that if SMI_CMD in FADT is zero,
* system does not support mode transition.
@ -184,7 +192,6 @@ AcpiHwSetMode (
break;
case ACPI_SYS_MODE_LEGACY:
/*
* BIOS should clear all fixed status bits and restore fixed event
* enable bits to default
@ -196,6 +203,7 @@ AcpiHwSetMode (
break;
default:
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
@ -213,13 +221,13 @@ AcpiHwSetMode (
Retry = 3000;
while (Retry)
{
if (AcpiHwGetMode() == Mode)
if (AcpiHwGetMode () == Mode)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n",
Mode));
return_ACPI_STATUS (AE_OK);
}
AcpiOsStall(1000);
AcpiOsStall (ACPI_USEC_PER_MSEC);
Retry--;
}
@ -252,6 +260,13 @@ AcpiHwGetMode (
ACPI_FUNCTION_TRACE (HwGetMode);
/* If the Hardware Reduced flag is set, machine is always in acpi mode */
if (AcpiGbl_ReducedHardware)
{
return_UINT32 (ACPI_SYS_MODE_ACPI);
}
/*
* ACPI 2.0 clarified that if SMI_CMD in FADT is zero,
* system does not support mode transition.

View File

@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -214,15 +214,18 @@ AcpiHwLowSetGpe (
/*lint -fallthrough */
case ACPI_GPE_ENABLE:
ACPI_SET_BIT (EnableMask, RegisterBit);
break;
case ACPI_GPE_DISABLE:
ACPI_CLEAR_BIT (EnableMask, RegisterBit);
break;
default:
ACPI_ERROR ((AE_INFO, "Invalid GPE Action, %u\n", Action));
ACPI_ERROR ((AE_INFO, "Invalid GPE Action, %u", Action));
return (AE_BAD_PARAMETER);
}

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License

View File

@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -502,7 +502,6 @@ AcpiHwRegisterRead (
&AcpiGbl_XPm1bStatus);
break;
case ACPI_REGISTER_PM1_ENABLE: /* PM1 A/B: 16-bit access each */
Status = AcpiHwReadMultiple (&Value,
@ -510,7 +509,6 @@ AcpiHwRegisterRead (
&AcpiGbl_XPm1bEnable);
break;
case ACPI_REGISTER_PM1_CONTROL: /* PM1 A/B: 16-bit access each */
Status = AcpiHwReadMultiple (&Value,
@ -525,26 +523,23 @@ AcpiHwRegisterRead (
Value &= ~ACPI_PM1_CONTROL_WRITEONLY_BITS;
break;
case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
Status = AcpiHwRead (&Value, &AcpiGbl_FADT.XPm2ControlBlock);
break;
case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
Status = AcpiHwRead (&Value, &AcpiGbl_FADT.XPmTimerBlock);
break;
case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
Status = AcpiHwReadPort (AcpiGbl_FADT.SmiCommand, &Value, 8);
break;
default:
ACPI_ERROR ((AE_INFO, "Unknown Register ID: 0x%X",
RegisterId));
Status = AE_BAD_PARAMETER;
@ -618,7 +613,6 @@ AcpiHwRegisterWrite (
&AcpiGbl_XPm1bStatus);
break;
case ACPI_REGISTER_PM1_ENABLE: /* PM1 A/B: 16-bit access each */
Status = AcpiHwWriteMultiple (Value,
@ -626,9 +620,7 @@ AcpiHwRegisterWrite (
&AcpiGbl_XPm1bEnable);
break;
case ACPI_REGISTER_PM1_CONTROL: /* PM1 A/B: 16-bit access each */
/*
* Perform a read first to preserve certain bits (per ACPI spec)
* Note: This includes SCI_EN, we never want to change this bit
@ -652,9 +644,7 @@ AcpiHwRegisterWrite (
&AcpiGbl_FADT.XPm1bControlBlock);
break;
case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
/*
* For control registers, all reserved bits must be preserved,
* as per the ACPI spec.
@ -672,13 +662,11 @@ AcpiHwRegisterWrite (
Status = AcpiHwWrite (Value, &AcpiGbl_FADT.XPm2ControlBlock);
break;
case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
Status = AcpiHwWrite (Value, &AcpiGbl_FADT.XPmTimerBlock);
break;
case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
/* SMI_CMD is currently always in IO space */
@ -686,8 +674,8 @@ AcpiHwRegisterWrite (
Status = AcpiHwWritePort (AcpiGbl_FADT.SmiCommand, Value, 8);
break;
default:
ACPI_ERROR ((AE_INFO, "Unknown Register ID: 0x%X",
RegisterId));
Status = AE_BAD_PARAMETER;

View File

@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -251,7 +251,7 @@ AcpiHwLegacySleep (
* to still read the right value. Ideally, this block would go
* away entirely.
*/
AcpiOsStall (10000000);
AcpiOsStall (10 * ACPI_USEC_PER_SEC);
Status = AcpiHwRegisterWrite (ACPI_REGISTER_PM1_CONTROL,
SleepEnableRegInfo->AccessBitMask);

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -187,8 +187,14 @@ AcpiGetTimer (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
Status = AcpiHwRead (Ticks, &AcpiGbl_FADT.XPmTimerBlock);
/* ACPI 5.0A: PM Timer is optional */
if (!AcpiGbl_FADT.XPmTimerBlock.Address)
{
return_ACPI_STATUS (AE_SUPPORT);
}
Status = AcpiHwRead (Ticks, &AcpiGbl_FADT.XPmTimerBlock);
return_ACPI_STATUS (Status);
}
@ -243,6 +249,13 @@ AcpiGetTimerDuration (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* ACPI 5.0A: PM Timer is optional */
if (!AcpiGbl_FADT.XPmTimerBlock.Address)
{
return_ACPI_STATUS (AE_SUPPORT);
}
/*
* Compute Tick Delta:
* Handle (max one) timer rollovers on 24-bit versus 32-bit timers.
@ -275,10 +288,11 @@ AcpiGetTimerDuration (
/*
* Compute Duration (Requires a 64-bit multiply and divide):
*
* TimeElapsed = (DeltaTicks * 1000000) / PM_TIMER_FREQUENCY;
* TimeElapsed (microseconds) =
* (DeltaTicks * ACPI_USEC_PER_SEC) / ACPI_PM_TIMER_FREQUENCY;
*/
Status = AcpiUtShortDivide (((UINT64) DeltaTicks) * 1000000,
PM_TIMER_FREQUENCY, &Quotient, NULL);
Status = AcpiUtShortDivide (((UINT64) DeltaTicks) * ACPI_USEC_PER_SEC,
ACPI_PM_TIMER_FREQUENCY, &Quotient, NULL);
*TimeElapsed = (UINT32) Quotient;
return_ACPI_STATUS (Status);

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -203,7 +203,8 @@ AcpiRead (
UINT64 *ReturnValue,
ACPI_GENERIC_ADDRESS *Reg)
{
UINT32 Value;
UINT32 ValueLo;
UINT32 ValueHi;
UINT32 Width;
UINT64 Address;
ACPI_STATUS Status;
@ -225,13 +226,8 @@ AcpiRead (
return (Status);
}
/* Initialize entire 64-bit return value to zero */
*ReturnValue = 0;
Value = 0;
/*
* Two address spaces supported: Memory or IO. PCI_Config is
* Two address spaces supported: Memory or I/O. PCI_Config is
* not supported here because the GAS structure is insufficient
*/
if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY)
@ -245,6 +241,9 @@ AcpiRead (
}
else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
{
ValueLo = 0;
ValueHi = 0;
Width = Reg->BitWidth;
if (Width == 64)
{
@ -252,25 +251,27 @@ AcpiRead (
}
Status = AcpiHwReadPort ((ACPI_IO_ADDRESS)
Address, &Value, Width);
Address, &ValueLo, Width);
if (ACPI_FAILURE (Status))
{
return (Status);
}
*ReturnValue = Value;
if (Reg->BitWidth == 64)
{
/* Read the top 32 bits */
Status = AcpiHwReadPort ((ACPI_IO_ADDRESS)
(Address + 4), &Value, 32);
(Address + 4), &ValueHi, 32);
if (ACPI_FAILURE (Status))
{
return (Status);
}
*ReturnValue |= ((UINT64) Value << 32);
}
/* Set the return value only if status is AE_OK */
*ReturnValue = (ValueLo | ((UINT64) ValueHi << 32));
}
ACPI_DEBUG_PRINT ((ACPI_DB_IO,
@ -279,7 +280,7 @@ AcpiRead (
ACPI_FORMAT_UINT64 (Address),
AcpiUtGetRegionName (Reg->SpaceId)));
return (Status);
return (AE_OK);
}
ACPI_EXPORT_SYMBOL (AcpiRead)
@ -449,7 +450,7 @@ ACPI_EXPORT_SYMBOL (AcpiReadBitRegister)
*
* PARAMETERS: RegisterId - ID of ACPI Bit Register to access
* Value - Value to write to the register, in bit
* position zero. The bit is automaticallly
* position zero. The bit is automatically
* shifted to the correct position.
*
* RETURN: Status
@ -564,10 +565,33 @@ ACPI_EXPORT_SYMBOL (AcpiWriteBitRegister)
* *SleepTypeA - Where SLP_TYPa is returned
* *SleepTypeB - Where SLP_TYPb is returned
*
* RETURN: Status - ACPI status
* RETURN: Status
*
* DESCRIPTION: Obtain the SLP_TYPa and SLP_TYPb values for the requested sleep
* state.
* DESCRIPTION: Obtain the SLP_TYPa and SLP_TYPb values for the requested
* sleep state via the appropriate \_Sx object.
*
* The sleep state package returned from the corresponding \_Sx_ object
* must contain at least one integer.
*
* March 2005:
* Added support for a package that contains two integers. This
* goes against the ACPI specification which defines this object as a
* package with one encoded DWORD integer. However, existing practice
* by many BIOS vendors is to return a package with 2 or more integer
* elements, at least one per sleep type (A/B).
*
* January 2013:
* Therefore, we must be prepared to accept a package with either a
* single integer or multiple integers.
*
* The single integer DWORD format is as follows:
* BYTE 0 - Value for the PM1A SLP_TYP register
* BYTE 1 - Value for the PM1B SLP_TYP register
* BYTE 2-3 - Reserved
*
* The dual integer format is as follows:
* Integer 0 - Value for the PM1A SLP_TYP register
* Integer 1 - Value for the PM1A SLP_TYP register
*
******************************************************************************/
@ -577,8 +601,9 @@ AcpiGetSleepTypeData (
UINT8 *SleepTypeA,
UINT8 *SleepTypeB)
{
ACPI_STATUS Status = AE_OK;
ACPI_STATUS Status;
ACPI_EVALUATE_INFO *Info;
ACPI_OPERAND_OBJECT **Elements;
ACPI_FUNCTION_TRACE (AcpiGetSleepTypeData);
@ -587,8 +612,7 @@ AcpiGetSleepTypeData (
/* Validate parameters */
if ((SleepState > ACPI_S_STATES_MAX) ||
!SleepTypeA ||
!SleepTypeB)
!SleepTypeA || !SleepTypeB)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
@ -601,17 +625,15 @@ AcpiGetSleepTypeData (
return_ACPI_STATUS (AE_NO_MEMORY);
}
Info->Pathname = ACPI_CAST_PTR (char, AcpiGbl_SleepStateNames[SleepState]);
/* Evaluate the namespace object containing the values for this state */
/*
* Evaluate the \_Sx namespace object containing the register values
* for this state
*/
Info->RelativePathname = ACPI_CAST_PTR (
char, AcpiGbl_SleepStateNames[SleepState]);
Status = AcpiNsEvaluate (Info);
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"%s while evaluating SleepState [%s]\n",
AcpiFormatException (Status), Info->Pathname));
goto Cleanup;
}
@ -620,67 +642,74 @@ AcpiGetSleepTypeData (
if (!Info->ReturnObject)
{
ACPI_ERROR ((AE_INFO, "No Sleep State object returned from [%s]",
Info->Pathname));
Status = AE_NOT_EXIST;
Info->RelativePathname));
Status = AE_AML_NO_RETURN_VALUE;
goto Cleanup;
}
/* It must be of type Package */
/* Return object must be of type Package */
else if (Info->ReturnObject->Common.Type != ACPI_TYPE_PACKAGE)
if (Info->ReturnObject->Common.Type != ACPI_TYPE_PACKAGE)
{
ACPI_ERROR ((AE_INFO, "Sleep State return object is not a Package"));
Status = AE_AML_OPERAND_TYPE;
goto Cleanup1;
}
/*
* The package must have at least two elements. NOTE (March 2005): This
* goes against the current ACPI spec which defines this object as a
* package with one encoded DWORD element. However, existing practice
* by BIOS vendors seems to be to have 2 or more elements, at least
* one per sleep type (A/B).
* Any warnings about the package length or the object types have
* already been issued by the predefined name module -- there is no
* need to repeat them here.
*/
else if (Info->ReturnObject->Package.Count < 2)
Elements = Info->ReturnObject->Package.Elements;
switch (Info->ReturnObject->Package.Count)
{
ACPI_ERROR ((AE_INFO,
"Sleep State return package does not have at least two elements"));
Status = AE_AML_NO_OPERAND;
}
/* The first two elements must both be of type Integer */
else if (((Info->ReturnObject->Package.Elements[0])->Common.Type
!= ACPI_TYPE_INTEGER) ||
((Info->ReturnObject->Package.Elements[1])->Common.Type
!= ACPI_TYPE_INTEGER))
{
ACPI_ERROR ((AE_INFO,
"Sleep State return package elements are not both Integers "
"(%s, %s)",
AcpiUtGetObjectTypeName (Info->ReturnObject->Package.Elements[0]),
AcpiUtGetObjectTypeName (Info->ReturnObject->Package.Elements[1])));
Status = AE_AML_OPERAND_TYPE;
}
else
{
/* Valid _Sx_ package size, type, and value */
*SleepTypeA = (UINT8)
(Info->ReturnObject->Package.Elements[0])->Integer.Value;
*SleepTypeB = (UINT8)
(Info->ReturnObject->Package.Elements[1])->Integer.Value;
}
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"While evaluating SleepState [%s], bad Sleep object %p type %s",
Info->Pathname, Info->ReturnObject,
AcpiUtGetObjectTypeName (Info->ReturnObject)));
case 0:
Status = AE_AML_PACKAGE_LIMIT;
break;
case 1:
if (Elements[0]->Common.Type != ACPI_TYPE_INTEGER)
{
Status = AE_AML_OPERAND_TYPE;
break;
}
/* A valid _Sx_ package with one integer */
*SleepTypeA = (UINT8) Elements[0]->Integer.Value;
*SleepTypeB = (UINT8) (Elements[0]->Integer.Value >> 8);
break;
case 2:
default:
if ((Elements[0]->Common.Type != ACPI_TYPE_INTEGER) ||
(Elements[1]->Common.Type != ACPI_TYPE_INTEGER))
{
Status = AE_AML_OPERAND_TYPE;
break;
}
/* A valid _Sx_ package with two integers */
*SleepTypeA = (UINT8) Elements[0]->Integer.Value;
*SleepTypeB = (UINT8) Elements[1]->Integer.Value;
break;
}
Cleanup1:
AcpiUtRemoveReference (Info->ReturnObject);
Cleanup:
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"While evaluating Sleep State [%s]", Info->RelativePathname));
}
ACPI_FREE (Info);
return_ACPI_STATUS (Status);
}

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -299,7 +299,7 @@ AcpiEnterSleepStateS4bios (
(UINT32) AcpiGbl_FADT.S4BiosRequest, 8);
do {
AcpiOsStall(1000);
AcpiOsStall (ACPI_USEC_PER_MSEC);
Status = AcpiReadBitRegister (ACPI_BITREG_WAKE_STATUS, &InValue);
if (ACPI_FAILURE (Status))
{
@ -339,13 +339,14 @@ AcpiHwSleepDispatch (
#if (!ACPI_REDUCED_HARDWARE)
/*
* If the Hardware Reduced flag is set (from the FADT), we must
* use the extended sleep registers
* use the extended sleep registers (FADT). Note: As per the ACPI
* specification, these extended registers are to be used for HW-reduced
* platforms only. They are not general-purpose replacements for the
* legacy PM register sleep support.
*/
if (AcpiGbl_ReducedHardware ||
AcpiGbl_FADT.SleepControl.Address)
if (AcpiGbl_ReducedHardware)
{
Status = SleepFunctions->ExtendedFunction (SleepState);
}
@ -423,20 +424,24 @@ AcpiEnterSleepStatePrep (
switch (SleepState)
{
case ACPI_STATE_S0:
SstValue = ACPI_SST_WORKING;
break;
case ACPI_STATE_S1:
case ACPI_STATE_S2:
case ACPI_STATE_S3:
SstValue = ACPI_SST_SLEEPING;
break;
case ACPI_STATE_S4:
SstValue = ACPI_SST_SLEEP_CONTEXT;
break;
default:
SstValue = ACPI_SST_INDICATOR_OFF; /* Default is off */
break;
}

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -239,6 +239,7 @@ AcpiNsRootInitialize (
switch (InitVal->Type)
{
case ACPI_TYPE_METHOD:
ObjDesc->Method.ParamCount = (UINT8) ACPI_TO_INTEGER (Val);
ObjDesc->Common.Flags |= AOPOBJ_DATA_VALID;
@ -260,7 +261,6 @@ AcpiNsRootInitialize (
ObjDesc->Integer.Value = ACPI_TO_INTEGER (Val);
break;
case ACPI_TYPE_STRING:
/* Build an object around the static string */
@ -270,7 +270,6 @@ AcpiNsRootInitialize (
ObjDesc->Common.Flags |= AOPOBJ_STATIC_POINTER;
break;
case ACPI_TYPE_MUTEX:
ObjDesc->Mutex.Node = NewNode;
@ -303,7 +302,6 @@ AcpiNsRootInitialize (
}
break;
default:
ACPI_ERROR ((AE_INFO, "Unsupported initial type value 0x%X",
@ -522,8 +520,8 @@ AcpiNsLookup (
/* Current scope has no parent scope */
ACPI_ERROR ((AE_INFO,
"ACPI path has too many parent prefixes (^) "
"- reached beyond root node"));
"%s: Path has too many parent prefixes (^) "
"- reached beyond root node", Pathname));
return_ACPI_STATUS (AE_NOT_FOUND);
}
}

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License

View File

@ -0,0 +1,375 @@
/******************************************************************************
*
* Module Name: nsarguments - Validation of args for ACPI predefined methods
*
*****************************************************************************/
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
* rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
* copy of the source code appearing in this file ("Covered Code") an
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
* base code distributed originally by Intel ("Original Intel Code") to copy,
* make derivatives, distribute, use and display any portion of the Covered
* Code in any form, with the right to sublicense such rights; and
*
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
* license (with the right to sublicense), under only those claims of Intel
* patents that are infringed by the Original Intel Code, to make, use, sell,
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
* to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
* documentation and/or other materials provided with distribution. In
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* property embodied in the software Licensee provides to its licensee, and
* not to intellectual property embodied in modifications its licensee may
* make.
*
* 3.3. Redistribution of Executable. Redistribution in executable form of any
* substantial portion of the Covered Code or modification must reproduce the
* above Copyright Notice, and the following Disclaimer and Export Compliance
* provision in the documentation and/or other materials provided with the
* distribution.
*
* 3.4. Intel retains all right, title, and interest in and to the Original
* Intel Code.
*
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
* Intel shall be used in advertising or otherwise to promote the sale, use or
* other dealings in products derived from or relating to the Covered Code
* without prior written authorization from Intel.
*
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
* any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* ensure that the distribution and export/re-export of the software is in
* compliance with all laws, regulations, orders, or other restrictions of the
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
* any of its subsidiaries will export/re-export any technical data, process,
* software, or service, directly or indirectly, to any country for which the
* United States government or any agency thereof requires an export license,
* other governmental approval, or letter of assurance, without first obtaining
* such license, approval or letter.
*
*****************************************************************************/
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
#include "acpredef.h"
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nsarguments")
/*******************************************************************************
*
* FUNCTION: AcpiNsCheckArgumentTypes
*
* PARAMETERS: Info - Method execution information block
*
* RETURN: None
*
* DESCRIPTION: Check the incoming argument count and all argument types
* against the argument type list for a predefined name.
*
******************************************************************************/
void
AcpiNsCheckArgumentTypes (
ACPI_EVALUATE_INFO *Info)
{
UINT16 ArgTypeList;
UINT8 ArgCount;
UINT8 ArgType;
UINT8 UserArgType;
UINT32 i;
/* If not a predefined name, cannot typecheck args */
if (!Info->Predefined)
{
return;
}
ArgTypeList = Info->Predefined->Info.ArgumentList;
ArgCount = METHOD_GET_ARG_COUNT (ArgTypeList);
/* Typecheck all arguments */
for (i = 0; ((i < ArgCount) && (i < Info->ParamCount)); i++)
{
ArgType = METHOD_GET_NEXT_TYPE (ArgTypeList);
UserArgType = Info->Parameters[i]->Common.Type;
if (UserArgType != ArgType)
{
ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, ACPI_WARN_ALWAYS,
"Argument #%u type mismatch - "
"Found [%s], ACPI requires [%s]", (i + 1),
AcpiUtGetTypeName (UserArgType),
AcpiUtGetTypeName (ArgType)));
}
}
}
/*******************************************************************************
*
* FUNCTION: AcpiNsCheckAcpiCompliance
*
* PARAMETERS: Pathname - Full pathname to the node (for error msgs)
* Node - Namespace node for the method/object
* Predefined - Pointer to entry in predefined name table
*
* RETURN: None
*
* DESCRIPTION: Check that the declared parameter count (in ASL/AML) for a
* predefined name is what is expected (matches what is defined in
* the ACPI specification for this predefined name.)
*
******************************************************************************/
void
AcpiNsCheckAcpiCompliance (
char *Pathname,
ACPI_NAMESPACE_NODE *Node,
const ACPI_PREDEFINED_INFO *Predefined)
{
UINT32 AmlParamCount;
UINT32 RequiredParamCount;
if (!Predefined)
{
return;
}
/* Get the ACPI-required arg count from the predefined info table */
RequiredParamCount = METHOD_GET_ARG_COUNT (Predefined->Info.ArgumentList);
/*
* If this object is not a control method, we can check if the ACPI
* spec requires that it be a method.
*/
if (Node->Type != ACPI_TYPE_METHOD)
{
if (RequiredParamCount > 0)
{
/* Object requires args, must be implemented as a method */
ACPI_BIOS_ERROR_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS,
"Object (%s) must be a control method with %u arguments",
AcpiUtGetTypeName (Node->Type), RequiredParamCount));
}
else if (!RequiredParamCount && !Predefined->Info.ExpectedBtypes)
{
/* Object requires no args and no return value, must be a method */
ACPI_BIOS_ERROR_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS,
"Object (%s) must be a control method "
"with no arguments and no return value",
AcpiUtGetTypeName (Node->Type)));
}
return;
}
/*
* This is a control method.
* Check that the ASL/AML-defined parameter count for this method
* matches the ACPI-required parameter count
*
* Some methods are allowed to have a "minimum" number of args (_SCP)
* because their definition in ACPI has changed over time.
*
* Note: These are BIOS errors in the declaration of the object
*/
AmlParamCount = Node->Object->Method.ParamCount;
if (AmlParamCount < RequiredParamCount)
{
ACPI_BIOS_ERROR_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS,
"Insufficient arguments - "
"ASL declared %u, ACPI requires %u",
AmlParamCount, RequiredParamCount));
}
else if ((AmlParamCount > RequiredParamCount) &&
!(Predefined->Info.ArgumentList & ARG_COUNT_IS_MINIMUM))
{
ACPI_BIOS_ERROR_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS,
"Excess arguments - "
"ASL declared %u, ACPI requires %u",
AmlParamCount, RequiredParamCount));
}
}
/*******************************************************************************
*
* FUNCTION: AcpiNsCheckArgumentCount
*
* PARAMETERS: Pathname - Full pathname to the node (for error msgs)
* Node - Namespace node for the method/object
* UserParamCount - Number of args passed in by the caller
* Predefined - Pointer to entry in predefined name table
*
* RETURN: None
*
* DESCRIPTION: Check that incoming argument count matches the declared
* parameter count (in the ASL/AML) for an object.
*
******************************************************************************/
void
AcpiNsCheckArgumentCount (
char *Pathname,
ACPI_NAMESPACE_NODE *Node,
UINT32 UserParamCount,
const ACPI_PREDEFINED_INFO *Predefined)
{
UINT32 AmlParamCount;
UINT32 RequiredParamCount;
if (!Predefined)
{
/*
* Not a predefined name. Check the incoming user argument count
* against the count that is specified in the method/object.
*/
if (Node->Type != ACPI_TYPE_METHOD)
{
if (UserParamCount)
{
ACPI_INFO_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS,
"%u arguments were passed to a non-method ACPI object (%s)",
UserParamCount, AcpiUtGetTypeName (Node->Type)));
}
return;
}
/*
* This is a control method. Check the parameter count.
* We can only check the incoming argument count against the
* argument count declared for the method in the ASL/AML.
*
* Emit a message if too few or too many arguments have been passed
* by the caller.
*
* Note: Too many arguments will not cause the method to
* fail. However, the method will fail if there are too few
* arguments and the method attempts to use one of the missing ones.
*/
AmlParamCount = Node->Object->Method.ParamCount;
if (UserParamCount < AmlParamCount)
{
ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS,
"Insufficient arguments - "
"Caller passed %u, method requires %u",
UserParamCount, AmlParamCount));
}
else if (UserParamCount > AmlParamCount)
{
ACPI_INFO_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS,
"Excess arguments - "
"Caller passed %u, method requires %u",
UserParamCount, AmlParamCount));
}
return;
}
/*
* This is a predefined name. Validate the user-supplied parameter
* count against the ACPI specification. We don't validate against
* the method itself because what is important here is that the
* caller is in conformance with the spec. (The arg count for the
* method was checked against the ACPI spec earlier.)
*
* Some methods are allowed to have a "minimum" number of args (_SCP)
* because their definition in ACPI has changed over time.
*/
RequiredParamCount = METHOD_GET_ARG_COUNT (Predefined->Info.ArgumentList);
if (UserParamCount < RequiredParamCount)
{
ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS,
"Insufficient arguments - "
"Caller passed %u, ACPI requires %u",
UserParamCount, RequiredParamCount));
}
else if ((UserParamCount > RequiredParamCount) &&
!(Predefined->Info.ArgumentList & ARG_COUNT_IS_MINIMUM))
{
ACPI_INFO_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS,
"Excess arguments - "
"Caller passed %u, ACPI requires %u",
UserParamCount, RequiredParamCount));
}
}

View File

@ -0,0 +1,556 @@
/******************************************************************************
*
* Module Name: nsconvert - Object conversions for objects returned by
* predefined methods
*
*****************************************************************************/
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
* rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
* copy of the source code appearing in this file ("Covered Code") an
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
* base code distributed originally by Intel ("Original Intel Code") to copy,
* make derivatives, distribute, use and display any portion of the Covered
* Code in any form, with the right to sublicense such rights; and
*
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
* license (with the right to sublicense), under only those claims of Intel
* patents that are infringed by the Original Intel Code, to make, use, sell,
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
* to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
* documentation and/or other materials provided with distribution. In
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* property embodied in the software Licensee provides to its licensee, and
* not to intellectual property embodied in modifications its licensee may
* make.
*
* 3.3. Redistribution of Executable. Redistribution in executable form of any
* substantial portion of the Covered Code or modification must reproduce the
* above Copyright Notice, and the following Disclaimer and Export Compliance
* provision in the documentation and/or other materials provided with the
* distribution.
*
* 3.4. Intel retains all right, title, and interest in and to the Original
* Intel Code.
*
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
* Intel shall be used in advertising or otherwise to promote the sale, use or
* other dealings in products derived from or relating to the Covered Code
* without prior written authorization from Intel.
*
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
* any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* ensure that the distribution and export/re-export of the software is in
* compliance with all laws, regulations, orders, or other restrictions of the
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
* any of its subsidiaries will export/re-export any technical data, process,
* software, or service, directly or indirectly, to any country for which the
* United States government or any agency thereof requires an export license,
* other governmental approval, or letter of assurance, without first obtaining
* such license, approval or letter.
*
*****************************************************************************/
#define __NSCONVERT_C__
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
#include "acinterp.h"
#include "acpredef.h"
#include "amlresrc.h"
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nsconvert")
/*******************************************************************************
*
* FUNCTION: AcpiNsConvertToInteger
*
* PARAMETERS: OriginalObject - Object to be converted
* ReturnObject - Where the new converted object is returned
*
* RETURN: Status. AE_OK if conversion was successful.
*
* DESCRIPTION: Attempt to convert a String/Buffer object to an Integer.
*
******************************************************************************/
ACPI_STATUS
AcpiNsConvertToInteger (
ACPI_OPERAND_OBJECT *OriginalObject,
ACPI_OPERAND_OBJECT **ReturnObject)
{
ACPI_OPERAND_OBJECT *NewObject;
ACPI_STATUS Status;
UINT64 Value = 0;
UINT32 i;
switch (OriginalObject->Common.Type)
{
case ACPI_TYPE_STRING:
/* String-to-Integer conversion */
Status = AcpiUtStrtoul64 (OriginalObject->String.Pointer,
ACPI_ANY_BASE, &Value);
if (ACPI_FAILURE (Status))
{
return (Status);
}
break;
case ACPI_TYPE_BUFFER:
/* Buffer-to-Integer conversion. Max buffer size is 64 bits. */
if (OriginalObject->Buffer.Length > 8)
{
return (AE_AML_OPERAND_TYPE);
}
/* Extract each buffer byte to create the integer */
for (i = 0; i < OriginalObject->Buffer.Length; i++)
{
Value |= ((UINT64) OriginalObject->Buffer.Pointer[i] << (i * 8));
}
break;
default:
return (AE_AML_OPERAND_TYPE);
}
NewObject = AcpiUtCreateIntegerObject (Value);
if (!NewObject)
{
return (AE_NO_MEMORY);
}
*ReturnObject = NewObject;
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiNsConvertToString
*
* PARAMETERS: OriginalObject - Object to be converted
* ReturnObject - Where the new converted object is returned
*
* RETURN: Status. AE_OK if conversion was successful.
*
* DESCRIPTION: Attempt to convert a Integer/Buffer object to a String.
*
******************************************************************************/
ACPI_STATUS
AcpiNsConvertToString (
ACPI_OPERAND_OBJECT *OriginalObject,
ACPI_OPERAND_OBJECT **ReturnObject)
{
ACPI_OPERAND_OBJECT *NewObject;
ACPI_SIZE Length;
ACPI_STATUS Status;
switch (OriginalObject->Common.Type)
{
case ACPI_TYPE_INTEGER:
/*
* Integer-to-String conversion. Commonly, convert
* an integer of value 0 to a NULL string. The last element of
* _BIF and _BIX packages occasionally need this fix.
*/
if (OriginalObject->Integer.Value == 0)
{
/* Allocate a new NULL string object */
NewObject = AcpiUtCreateStringObject (0);
if (!NewObject)
{
return (AE_NO_MEMORY);
}
}
else
{
Status = AcpiExConvertToString (OriginalObject, &NewObject,
ACPI_IMPLICIT_CONVERT_HEX);
if (ACPI_FAILURE (Status))
{
return (Status);
}
}
break;
case ACPI_TYPE_BUFFER:
/*
* Buffer-to-String conversion. Use a ToString
* conversion, no transform performed on the buffer data. The best
* example of this is the _BIF method, where the string data from
* the battery is often (incorrectly) returned as buffer object(s).
*/
Length = 0;
while ((Length < OriginalObject->Buffer.Length) &&
(OriginalObject->Buffer.Pointer[Length]))
{
Length++;
}
/* Allocate a new string object */
NewObject = AcpiUtCreateStringObject (Length);
if (!NewObject)
{
return (AE_NO_MEMORY);
}
/*
* Copy the raw buffer data with no transform. String is already NULL
* terminated at Length+1.
*/
ACPI_MEMCPY (NewObject->String.Pointer,
OriginalObject->Buffer.Pointer, Length);
break;
default:
return (AE_AML_OPERAND_TYPE);
}
*ReturnObject = NewObject;
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiNsConvertToBuffer
*
* PARAMETERS: OriginalObject - Object to be converted
* ReturnObject - Where the new converted object is returned
*
* RETURN: Status. AE_OK if conversion was successful.
*
* DESCRIPTION: Attempt to convert a Integer/String/Package object to a Buffer.
*
******************************************************************************/
ACPI_STATUS
AcpiNsConvertToBuffer (
ACPI_OPERAND_OBJECT *OriginalObject,
ACPI_OPERAND_OBJECT **ReturnObject)
{
ACPI_OPERAND_OBJECT *NewObject;
ACPI_STATUS Status;
ACPI_OPERAND_OBJECT **Elements;
UINT32 *DwordBuffer;
UINT32 Count;
UINT32 i;
switch (OriginalObject->Common.Type)
{
case ACPI_TYPE_INTEGER:
/*
* Integer-to-Buffer conversion.
* Convert the Integer to a packed-byte buffer. _MAT and other
* objects need this sometimes, if a read has been performed on a
* Field object that is less than or equal to the global integer
* size (32 or 64 bits).
*/
Status = AcpiExConvertToBuffer (OriginalObject, &NewObject);
if (ACPI_FAILURE (Status))
{
return (Status);
}
break;
case ACPI_TYPE_STRING:
/* String-to-Buffer conversion. Simple data copy */
NewObject = AcpiUtCreateBufferObject (OriginalObject->String.Length);
if (!NewObject)
{
return (AE_NO_MEMORY);
}
ACPI_MEMCPY (NewObject->Buffer.Pointer,
OriginalObject->String.Pointer, OriginalObject->String.Length);
break;
case ACPI_TYPE_PACKAGE:
/*
* This case is often seen for predefined names that must return a
* Buffer object with multiple DWORD integers within. For example,
* _FDE and _GTM. The Package can be converted to a Buffer.
*/
/* All elements of the Package must be integers */
Elements = OriginalObject->Package.Elements;
Count = OriginalObject->Package.Count;
for (i = 0; i < Count; i++)
{
if ((!*Elements) ||
((*Elements)->Common.Type != ACPI_TYPE_INTEGER))
{
return (AE_AML_OPERAND_TYPE);
}
Elements++;
}
/* Create the new buffer object to replace the Package */
NewObject = AcpiUtCreateBufferObject (ACPI_MUL_4 (Count));
if (!NewObject)
{
return (AE_NO_MEMORY);
}
/* Copy the package elements (integers) to the buffer as DWORDs */
Elements = OriginalObject->Package.Elements;
DwordBuffer = ACPI_CAST_PTR (UINT32, NewObject->Buffer.Pointer);
for (i = 0; i < Count; i++)
{
*DwordBuffer = (UINT32) (*Elements)->Integer.Value;
DwordBuffer++;
Elements++;
}
break;
default:
return (AE_AML_OPERAND_TYPE);
}
*ReturnObject = NewObject;
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiNsConvertToUnicode
*
* PARAMETERS: OriginalObject - ASCII String Object to be converted
* ReturnObject - Where the new converted object is returned
*
* RETURN: Status. AE_OK if conversion was successful.
*
* DESCRIPTION: Attempt to convert a String object to a Unicode string Buffer.
*
******************************************************************************/
ACPI_STATUS
AcpiNsConvertToUnicode (
ACPI_OPERAND_OBJECT *OriginalObject,
ACPI_OPERAND_OBJECT **ReturnObject)
{
ACPI_OPERAND_OBJECT *NewObject;
char *AsciiString;
UINT16 *UnicodeBuffer;
UINT32 UnicodeLength;
UINT32 i;
if (!OriginalObject)
{
return (AE_OK);
}
/* If a Buffer was returned, it must be at least two bytes long */
if (OriginalObject->Common.Type == ACPI_TYPE_BUFFER)
{
if (OriginalObject->Buffer.Length < 2)
{
return (AE_AML_OPERAND_VALUE);
}
*ReturnObject = NULL;
return (AE_OK);
}
/*
* The original object is an ASCII string. Convert this string to
* a unicode buffer.
*/
AsciiString = OriginalObject->String.Pointer;
UnicodeLength = (OriginalObject->String.Length * 2) + 2;
/* Create a new buffer object for the Unicode data */
NewObject = AcpiUtCreateBufferObject (UnicodeLength);
if (!NewObject)
{
return (AE_NO_MEMORY);
}
UnicodeBuffer = ACPI_CAST_PTR (UINT16, NewObject->Buffer.Pointer);
/* Convert ASCII to Unicode */
for (i = 0; i < OriginalObject->String.Length; i++)
{
UnicodeBuffer[i] = (UINT16) AsciiString[i];
}
*ReturnObject = NewObject;
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiNsConvertToResource
*
* PARAMETERS: OriginalObject - Object to be converted
* ReturnObject - Where the new converted object is returned
*
* RETURN: Status. AE_OK if conversion was successful
*
* DESCRIPTION: Attempt to convert a Integer object to a ResourceTemplate
* Buffer.
*
******************************************************************************/
ACPI_STATUS
AcpiNsConvertToResource (
ACPI_OPERAND_OBJECT *OriginalObject,
ACPI_OPERAND_OBJECT **ReturnObject)
{
ACPI_OPERAND_OBJECT *NewObject;
UINT8 *Buffer;
/*
* We can fix the following cases for an expected resource template:
* 1. No return value (interpreter slack mode is disabled)
* 2. A "Return (Zero)" statement
* 3. A "Return empty buffer" statement
*
* We will return a buffer containing a single EndTag
* resource descriptor.
*/
if (OriginalObject)
{
switch (OriginalObject->Common.Type)
{
case ACPI_TYPE_INTEGER:
/* We can only repair an Integer==0 */
if (OriginalObject->Integer.Value)
{
return (AE_AML_OPERAND_TYPE);
}
break;
case ACPI_TYPE_BUFFER:
if (OriginalObject->Buffer.Length)
{
/* Additional checks can be added in the future */
*ReturnObject = NULL;
return (AE_OK);
}
break;
case ACPI_TYPE_STRING:
default:
return (AE_AML_OPERAND_TYPE);
}
}
/* Create the new buffer object for the resource descriptor */
NewObject = AcpiUtCreateBufferObject (2);
if (!NewObject)
{
return (AE_NO_MEMORY);
}
Buffer = ACPI_CAST_PTR (UINT8, NewObject->Buffer.Pointer);
/* Initialize the Buffer with a single EndTag descriptor */
Buffer[0] = (ACPI_RESOURCE_NAME_END_TAG | ASL_RDESC_END_TAG_SIZE);
Buffer[1] = 0x00;
*ReturnObject = NewObject;
return (AE_OK);
}

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -119,6 +119,7 @@
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
#include "acoutput.h"
#define _COMPONENT ACPI_NAMESPACE
@ -141,6 +142,22 @@ AcpiNsDumpOneDevice (
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
static ACPI_STATUS
AcpiNsDumpOneObjectPath (
ACPI_HANDLE ObjHandle,
UINT32 Level,
void *Context,
void **ReturnValue);
static ACPI_STATUS
AcpiNsGetMaxDepth (
ACPI_HANDLE ObjHandle,
UINT32 Level,
void *Context,
void **ReturnValue);
/*******************************************************************************
*
* FUNCTION: AcpiNsPrintPathname
@ -165,7 +182,9 @@ AcpiNsPrintPathname (
ACPI_FUNCTION_NAME (NsPrintPathname);
if (!(AcpiDbgLevel & ACPI_LV_NAMES) || !(AcpiDbgLayer & ACPI_NAMESPACE))
/* Check if debug output enabled */
if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_NAMES, ACPI_NAMESPACE))
{
return;
}
@ -224,7 +243,7 @@ AcpiNsDumpPathname (
/* Do this only if the requested debug level and component are enabled */
if (!(AcpiDbgLevel & Level) || !(AcpiDbgLayer & Component))
if (!ACPI_IS_DEBUG_ENABLED (Level, Component))
{
return_VOID;
}
@ -352,10 +371,12 @@ AcpiNsDumpOneObject (
case ACPI_TYPE_BUFFER:
case ACPI_TYPE_STRING:
case ACPI_TYPE_METHOD:
AcpiOsPrintf ("<No attached object>");
break;
default:
break;
}
@ -372,13 +393,11 @@ AcpiNsDumpOneObject (
ACPI_CAST_PTR (void, ObjDesc->Processor.Address));
break;
case ACPI_TYPE_DEVICE:
AcpiOsPrintf ("Notify Object: %p\n", ObjDesc);
break;
case ACPI_TYPE_METHOD:
AcpiOsPrintf ("Args %X Len %.4X Aml %p\n",
@ -386,14 +405,12 @@ AcpiNsDumpOneObject (
ObjDesc->Method.AmlLength, ObjDesc->Method.AmlStart);
break;
case ACPI_TYPE_INTEGER:
AcpiOsPrintf ("= %8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
break;
case ACPI_TYPE_PACKAGE:
if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
@ -407,7 +424,6 @@ AcpiNsDumpOneObject (
}
break;
case ACPI_TYPE_BUFFER:
if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
@ -433,7 +449,6 @@ AcpiNsDumpOneObject (
}
break;
case ACPI_TYPE_STRING:
AcpiOsPrintf ("Len %.2X ", ObjDesc->String.Length);
@ -441,7 +456,6 @@ AcpiNsDumpOneObject (
AcpiOsPrintf ("\n");
break;
case ACPI_TYPE_REGION:
AcpiOsPrintf ("[%s]",
@ -458,13 +472,11 @@ AcpiNsDumpOneObject (
}
break;
case ACPI_TYPE_LOCAL_REFERENCE:
AcpiOsPrintf ("[%s]\n", AcpiUtGetReferenceName (ObjDesc));
break;
case ACPI_TYPE_BUFFER_FIELD:
if (ObjDesc->BufferField.BufferObj &&
@ -476,7 +488,6 @@ AcpiNsDumpOneObject (
}
break;
case ACPI_TYPE_LOCAL_REGION_FIELD:
AcpiOsPrintf ("Rgn [%4.4s]",
@ -484,7 +495,6 @@ AcpiNsDumpOneObject (
ObjDesc->CommonField.RegionObj->Region.Node));
break;
case ACPI_TYPE_LOCAL_BANK_FIELD:
AcpiOsPrintf ("Rgn [%4.4s] Bnk [%4.4s]",
@ -494,7 +504,6 @@ AcpiNsDumpOneObject (
ObjDesc->BankField.BankObj->CommonField.Node));
break;
case ACPI_TYPE_LOCAL_INDEX_FIELD:
AcpiOsPrintf ("Idx [%4.4s] Dat [%4.4s]",
@ -504,7 +513,6 @@ AcpiNsDumpOneObject (
ObjDesc->IndexField.DataObj->CommonField.Node));
break;
case ACPI_TYPE_LOCAL_ALIAS:
case ACPI_TYPE_LOCAL_METHOD_ALIAS:
@ -535,11 +543,11 @@ AcpiNsDumpOneObject (
break;
default:
break;
}
break;
case ACPI_DISPLAY_OBJECTS:
AcpiOsPrintf ("O:%p", ObjDesc);
@ -588,7 +596,6 @@ AcpiNsDumpOneObject (
}
break;
default:
AcpiOsPrintf ("\n");
break;
@ -675,30 +682,37 @@ AcpiNsDumpOneObject (
goto Cleanup;
case ACPI_TYPE_BUFFER_FIELD:
ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BufferField.BufferObj;
break;
case ACPI_TYPE_PACKAGE:
ObjDesc = (void *) ObjDesc->Package.Elements;
break;
case ACPI_TYPE_METHOD:
ObjDesc = (void *) ObjDesc->Method.AmlStart;
break;
case ACPI_TYPE_LOCAL_REGION_FIELD:
ObjDesc = (void *) ObjDesc->Field.RegionObj;
break;
case ACPI_TYPE_LOCAL_BANK_FIELD:
ObjDesc = (void *) ObjDesc->BankField.RegionObj;
break;
case ACPI_TYPE_LOCAL_INDEX_FIELD:
ObjDesc = (void *) ObjDesc->IndexField.IndexObj;
break;
default:
goto Cleanup;
}
@ -770,6 +784,142 @@ AcpiNsDumpObjects (
}
/*******************************************************************************
*
* FUNCTION: AcpiNsDumpOneObjectPath, AcpiNsGetMaxDepth
*
* PARAMETERS: ObjHandle - Node to be dumped
* Level - Nesting level of the handle
* Context - Passed into WalkNamespace
* ReturnValue - Not used
*
* RETURN: Status
*
* DESCRIPTION: Dump the full pathname to a namespace object. AcpNsGetMaxDepth
* computes the maximum nesting depth in the namespace tree, in
* order to simplify formatting in AcpiNsDumpOneObjectPath.
* These procedures are UserFunctions called by AcpiNsWalkNamespace.
*
******************************************************************************/
static ACPI_STATUS
AcpiNsDumpOneObjectPath (
ACPI_HANDLE ObjHandle,
UINT32 Level,
void *Context,
void **ReturnValue)
{
UINT32 MaxLevel = *((UINT32 *) Context);
char *Pathname;
ACPI_NAMESPACE_NODE *Node;
int PathIndent;
if (!ObjHandle)
{
return (AE_OK);
}
Node = AcpiNsValidateHandle (ObjHandle);
Pathname = AcpiNsGetExternalPathname (Node);
PathIndent = 1;
if (Level <= MaxLevel)
{
PathIndent = MaxLevel - Level + 1;
}
AcpiOsPrintf ("%2d%*s%-12s%*s",
Level, Level, " ", AcpiUtGetTypeName (Node->Type),
PathIndent, " ");
AcpiOsPrintf ("%s\n", &Pathname[1]);
ACPI_FREE (Pathname);
return (AE_OK);
}
static ACPI_STATUS
AcpiNsGetMaxDepth (
ACPI_HANDLE ObjHandle,
UINT32 Level,
void *Context,
void **ReturnValue)
{
UINT32 *MaxLevel = (UINT32 *) Context;
if (Level > *MaxLevel)
{
*MaxLevel = Level;
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiNsDumpObjectPaths
*
* PARAMETERS: Type - Object type to be dumped
* DisplayType - 0 or ACPI_DISPLAY_SUMMARY
* MaxDepth - Maximum depth of dump. Use ACPI_UINT32_MAX
* for an effectively unlimited depth.
* OwnerId - Dump only objects owned by this ID. Use
* ACPI_UINT32_MAX to match all owners.
* StartHandle - Where in namespace to start/end search
*
* RETURN: None
*
* DESCRIPTION: Dump full object pathnames within the loaded namespace. Uses
* AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObjectPath.
*
******************************************************************************/
void
AcpiNsDumpObjectPaths (
ACPI_OBJECT_TYPE Type,
UINT8 DisplayType,
UINT32 MaxDepth,
ACPI_OWNER_ID OwnerId,
ACPI_HANDLE StartHandle)
{
ACPI_STATUS Status;
UINT32 MaxLevel = 0;
ACPI_FUNCTION_ENTRY ();
/*
* Just lock the entire namespace for the duration of the dump.
* We don't want any changes to the namespace during this time,
* especially the temporary nodes since we are going to display
* them also.
*/
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not acquire namespace mutex\n");
return;
}
/* Get the max depth of the namespace tree, for formatting later */
(void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
AcpiNsGetMaxDepth, NULL, (void *) &MaxLevel, NULL);
/* Now dump the entire namespace */
(void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
AcpiNsDumpOneObjectPath, NULL, (void *) &MaxLevel, NULL);
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
}
/*******************************************************************************
*
* FUNCTION: AcpiNsDumpEntry

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -140,7 +140,7 @@ AcpiNsExecModuleCode (
*
* PARAMETERS: Info - Evaluation info block, contains:
* PrefixNode - Prefix or Method/Object Node to execute
* Pathname - Name of method to execute, If NULL, the
* RelativePath - Name of method to execute, If NULL, the
* Node is the object to execute
* Parameters - List of parameters to pass to the method,
* terminated by NULL. Params itself may be
@ -166,7 +166,6 @@ AcpiNsEvaluate (
ACPI_EVALUATE_INFO *Info)
{
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *Node;
ACPI_FUNCTION_TRACE (NsEvaluate);
@ -177,80 +176,141 @@ AcpiNsEvaluate (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Initialize the return value to an invalid object */
Info->ReturnObject = NULL;
Info->ParamCount = 0;
/*
* Get the actual namespace node for the target object. Handles these cases:
*
* 1) Null node, Pathname (absolute path)
* 2) Node, Pathname (path relative to Node)
* 3) Node, Null Pathname
*/
Status = AcpiNsGetNode (Info->PrefixNode, Info->Pathname,
ACPI_NS_NO_UPSEARCH, &Info->ResolvedNode);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/*
* For a method alias, we must grab the actual method node so that proper
* scoping context will be established before execution.
*/
if (AcpiNsGetType (Info->ResolvedNode) == ACPI_TYPE_LOCAL_METHOD_ALIAS)
{
Info->ResolvedNode =
ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Info->ResolvedNode->Object);
}
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n", Info->Pathname,
Info->ResolvedNode, AcpiNsGetAttachedObject (Info->ResolvedNode)));
Node = Info->ResolvedNode;
/*
* Two major cases here:
*
* 1) The object is a control method -- execute it
* 2) The object is not a method -- just return it's current value
*/
if (AcpiNsGetType (Info->ResolvedNode) == ACPI_TYPE_METHOD)
if (!Info->Node)
{
/*
* 1) Object is a control method - execute it
* Get the actual namespace node for the target object if we
* need to. Handles these cases:
*
* 1) Null node, valid pathname from root (absolute path)
* 2) Node and valid pathname (path relative to Node)
* 3) Node, Null pathname
*/
Status = AcpiNsGetNode (Info->PrefixNode, Info->RelativePathname,
ACPI_NS_NO_UPSEARCH, &Info->Node);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
/*
* For a method alias, we must grab the actual method node so that
* proper scoping context will be established before execution.
*/
if (AcpiNsGetType (Info->Node) == ACPI_TYPE_LOCAL_METHOD_ALIAS)
{
Info->Node = ACPI_CAST_PTR (
ACPI_NAMESPACE_NODE, Info->Node->Object);
}
/* Complete the info block initialization */
Info->ReturnObject = NULL;
Info->NodeFlags = Info->Node->Flags;
Info->ObjDesc = AcpiNsGetAttachedObject (Info->Node);
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n",
Info->RelativePathname, Info->Node,
AcpiNsGetAttachedObject (Info->Node)));
/* Get info if we have a predefined name (_HID, etc.) */
Info->Predefined = AcpiUtMatchPredefinedMethod (Info->Node->Name.Ascii);
/* Get the full pathname to the object, for use in warning messages */
Info->FullPathname = AcpiNsGetExternalPathname (Info->Node);
if (!Info->FullPathname)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Count the number of arguments being passed in */
Info->ParamCount = 0;
if (Info->Parameters)
{
while (Info->Parameters[Info->ParamCount])
{
Info->ParamCount++;
}
/* Warn on impossible argument count */
if (Info->ParamCount > ACPI_METHOD_NUM_ARGS)
{
ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, ACPI_WARN_ALWAYS,
"Excess arguments (%u) - using only %u",
Info->ParamCount, ACPI_METHOD_NUM_ARGS));
Info->ParamCount = ACPI_METHOD_NUM_ARGS;
}
}
/*
* For predefined names: Check that the declared argument count
* matches the ACPI spec -- otherwise this is a BIOS error.
*/
AcpiNsCheckAcpiCompliance (Info->FullPathname, Info->Node,
Info->Predefined);
/*
* For all names: Check that the incoming argument count for
* this method/object matches the actual ASL/AML definition.
*/
AcpiNsCheckArgumentCount (Info->FullPathname, Info->Node,
Info->ParamCount, Info->Predefined);
/* For predefined names: Typecheck all incoming arguments */
AcpiNsCheckArgumentTypes (Info);
/*
* Three major evaluation cases:
*
* 1) Object types that cannot be evaluated by definition
* 2) The object is a control method -- execute it
* 3) The object is not a method -- just return it's current value
*/
switch (AcpiNsGetType (Info->Node))
{
case ACPI_TYPE_DEVICE:
case ACPI_TYPE_EVENT:
case ACPI_TYPE_MUTEX:
case ACPI_TYPE_REGION:
case ACPI_TYPE_THERMAL:
case ACPI_TYPE_LOCAL_SCOPE:
/*
* 1) Disallow evaluation of certain object types. For these,
* object evaluation is undefined and not supported.
*/
ACPI_ERROR ((AE_INFO,
"%s: Evaluation of object type [%s] is not supported",
Info->FullPathname,
AcpiUtGetTypeName (Info->Node->Type)));
Status = AE_TYPE;
goto Cleanup;
case ACPI_TYPE_METHOD:
/*
* 2) Object is a control method - execute it
*/
/* Verify that there is a method object associated with this node */
Info->ObjDesc = AcpiNsGetAttachedObject (Info->ResolvedNode);
if (!Info->ObjDesc)
{
ACPI_ERROR ((AE_INFO, "Control method has no attached sub-object"));
return_ACPI_STATUS (AE_NULL_OBJECT);
ACPI_ERROR ((AE_INFO, "%s: Method has no attached sub-object",
Info->FullPathname));
Status = AE_NULL_OBJECT;
goto Cleanup;
}
/* Count the number of arguments being passed to the method */
if (Info->Parameters)
{
while (Info->Parameters[Info->ParamCount])
{
if (Info->ParamCount > ACPI_METHOD_MAX_ARG)
{
return_ACPI_STATUS (AE_LIMIT);
}
Info->ParamCount++;
}
}
ACPI_DUMP_PATHNAME (Info->ResolvedNode, "ACPI: Execute Method",
ACPI_LV_INFO, _COMPONENT);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Method at AML address %p Length %X\n",
"**** Execute method [%s] at AML address %p length %X\n",
Info->FullPathname,
Info->ObjDesc->Method.AmlStart + 1,
Info->ObjDesc->Method.AmlLength - 1));
@ -265,80 +325,58 @@ AcpiNsEvaluate (
AcpiExEnterInterpreter ();
Status = AcpiPsExecuteMethod (Info);
AcpiExExitInterpreter ();
}
else
{
break;
default:
/*
* 2) Object is not a method, return its current value
*
* Disallow certain object types. For these, "evaluation" is undefined.
* 3) All other non-method objects -- get the current object value
*/
switch (Info->ResolvedNode->Type)
{
case ACPI_TYPE_DEVICE:
case ACPI_TYPE_EVENT:
case ACPI_TYPE_MUTEX:
case ACPI_TYPE_REGION:
case ACPI_TYPE_THERMAL:
case ACPI_TYPE_LOCAL_SCOPE:
ACPI_ERROR ((AE_INFO,
"[%4.4s] Evaluation of object type [%s] is not supported",
Info->ResolvedNode->Name.Ascii,
AcpiUtGetTypeName (Info->ResolvedNode->Type)));
return_ACPI_STATUS (AE_TYPE);
default:
break;
}
/*
* Objects require additional resolution steps (e.g., the Node may be
* a field that must be read, etc.) -- we can't just grab the object
* out of the node.
* Some objects require additional resolution steps (e.g., the Node
* may be a field that must be read, etc.) -- we can't just grab
* the object out of the node.
*
* Use ResolveNodeToValue() to get the associated value.
*
* NOTE: we can get away with passing in NULL for a walk state because
* ResolvedNode is guaranteed to not be a reference to either a method
* the Node is guaranteed to not be a reference to either a method
* local or a method argument (because this interface is never called
* from a running method.)
*
* Even though we do not directly invoke the interpreter for object
* resolution, we must lock it because we could access an opregion.
* The opregion access code assumes that the interpreter is locked.
* resolution, we must lock it because we could access an OpRegion.
* The OpRegion access code assumes that the interpreter is locked.
*/
AcpiExEnterInterpreter ();
/* Function has a strange interface */
/* TBD: ResolveNodeToValue has a strange interface, fix */
Status = AcpiExResolveNodeToValue (&Info->ResolvedNode, NULL);
Info->ReturnObject = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Info->Node);
Status = AcpiExResolveNodeToValue (ACPI_CAST_INDIRECT_PTR (
ACPI_NAMESPACE_NODE, &Info->ReturnObject), NULL);
AcpiExExitInterpreter ();
/*
* If AcpiExResolveNodeToValue() succeeded, the return value was placed
* in ResolvedNode.
*/
if (ACPI_SUCCESS (Status))
if (ACPI_FAILURE (Status))
{
Status = AE_CTRL_RETURN_VALUE;
Info->ReturnObject =
ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Info->ResolvedNode);
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returning object %p [%s]\n",
Info->ReturnObject,
AcpiUtGetObjectTypeName (Info->ReturnObject)));
goto Cleanup;
}
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returned object %p [%s]\n",
Info->ReturnObject,
AcpiUtGetObjectTypeName (Info->ReturnObject)));
Status = AE_CTRL_RETURN_VALUE; /* Always has a "return value" */
break;
}
/*
* Check input argument count against the ASL-defined count for a method.
* Also check predefined names: argument count and return value against
* the ACPI specification. Some incorrect return value types are repaired.
* For predefined names, check the return value against the ACPI
* specification. Some incorrect return value types are repaired.
*/
(void) AcpiNsCheckPredefinedNames (Node, Info->ParamCount,
Status, &Info->ReturnObject);
(void) AcpiNsCheckReturnValue (Info->Node, Info, Info->ParamCount,
Status, &Info->ReturnObject);
/* Check if there is a return value that must be dealt with */
@ -358,12 +396,16 @@ AcpiNsEvaluate (
}
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"*** Completed evaluation of object %s ***\n", Info->Pathname));
"*** Completed evaluation of object %s ***\n",
Info->RelativePathname));
Cleanup:
/*
* Namespace was unlocked by the handling AcpiNs* function, so we
* just return
* just free the pathname and return
*/
ACPI_FREE (Info->FullPathname);
Info->FullPathname = NULL;
return_ACPI_STATUS (Status);
}

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -176,7 +176,7 @@ AcpiNsInitializeObjects (
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"**** Starting initialization of namespace objects ****\n"));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
"Completing Region/Field/Buffer/Package initialization:"));
"Completing Region/Field/Buffer/Package initialization:\n"));
/* Set all init info to zero */
@ -193,7 +193,7 @@ AcpiNsInitializeObjects (
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
"\nInitialized %u/%u Regions %u/%u Fields %u/%u "
" Initialized %u/%u Regions %u/%u Fields %u/%u "
"Buffers %u/%u Packages (%u nodes)\n",
Info.OpRegionInit, Info.OpRegionCount,
Info.FieldInit, Info.FieldCount,
@ -244,7 +244,7 @@ AcpiNsInitializeDevices (
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
"Initializing Device/Processor/Thermal objects "
"by executing _INI methods:"));
"and executing _INI/_STA methods:\n"));
/* Tree analysis: find all subtrees that contain _INI methods */
@ -270,7 +270,7 @@ AcpiNsInitializeDevices (
* part of the ACPI specification.
*/
Info.EvaluateInfo->PrefixNode = AcpiGbl_RootNode;
Info.EvaluateInfo->Pathname = METHOD_NAME__INI;
Info.EvaluateInfo->RelativePathname = METHOD_NAME__INI;
Info.EvaluateInfo->Parameters = NULL;
Info.EvaluateInfo->Flags = ACPI_IGNORE_RETURN_VALUE;
@ -302,7 +302,7 @@ AcpiNsInitializeDevices (
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
"\nExecuted %u _INI methods requiring %u _STA executions "
" Executed %u _INI methods requiring %u _STA executions "
"(examined %u objects)\n",
Info.Num_INI, Info.Num_STA, Info.DeviceCount));
@ -368,28 +368,34 @@ AcpiNsInitOneObject (
switch (Type)
{
case ACPI_TYPE_REGION:
Info->OpRegionCount++;
break;
case ACPI_TYPE_BUFFER_FIELD:
Info->FieldCount++;
break;
case ACPI_TYPE_LOCAL_BANK_FIELD:
Info->FieldCount++;
break;
case ACPI_TYPE_BUFFER:
Info->BufferCount++;
break;
case ACPI_TYPE_PACKAGE:
Info->PackageCount++;
break;
default:
/* No init required, just exit now */
return (AE_OK);
}
@ -441,7 +447,9 @@ AcpiNsInitOneObject (
break;
default:
/* No other types can get here */
break;
}
@ -452,15 +460,6 @@ AcpiNsInitOneObject (
AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Type)));
}
/*
* Print a dot for each object unless we are going to print the entire
* pathname
*/
if (!(AcpiDbgLevel & ACPI_LV_INIT_NAMES))
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
}
/*
* We ignore errors from above, and always return OK, since we don't want
* to abort the walk on any single error.
@ -537,6 +536,7 @@ AcpiNsFindIniMethods (
break;
default:
break;
}
@ -690,8 +690,9 @@ AcpiNsInitOneDevice (
ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (
ACPI_TYPE_METHOD, DeviceNode, METHOD_NAME__INI));
ACPI_MEMSET (Info, 0, sizeof (ACPI_EVALUATE_INFO));
Info->PrefixNode = DeviceNode;
Info->Pathname = METHOD_NAME__INI;
Info->RelativePathname = METHOD_NAME__INI;
Info->Parameters = NULL;
Info->Flags = ACPI_IGNORE_RETURN_VALUE;
@ -699,12 +700,6 @@ AcpiNsInitOneDevice (
if (ACPI_SUCCESS (Status))
{
WalkInfo->Num_INI++;
if ((AcpiDbgLevel <= ACPI_LV_ALL_EXCEPTIONS) &&
(!(AcpiDbgLevel & ACPI_LV_INFO)))
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
}
}
#ifdef ACPI_DEBUG_OUTPUT
@ -712,7 +707,7 @@ AcpiNsInitOneDevice (
{
/* Ignore error and move on to next device */
char *ScopeName = AcpiNsGetExternalPathname (Info->ResolvedNode);
char *ScopeName = AcpiNsGetExternalPathname (Info->Node);
ACPI_EXCEPTION ((AE_INFO, Status, "during %s._INI execution",
ScopeName));

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License

View File

@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License

View File

@ -0,0 +1,703 @@
/******************************************************************************
*
* Module Name: nsprepkg - Validation of package objects for predefined names
*
*****************************************************************************/
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
* rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
* copy of the source code appearing in this file ("Covered Code") an
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
* base code distributed originally by Intel ("Original Intel Code") to copy,
* make derivatives, distribute, use and display any portion of the Covered
* Code in any form, with the right to sublicense such rights; and
*
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
* license (with the right to sublicense), under only those claims of Intel
* patents that are infringed by the Original Intel Code, to make, use, sell,
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
* to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
* documentation and/or other materials provided with distribution. In
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* property embodied in the software Licensee provides to its licensee, and
* not to intellectual property embodied in modifications its licensee may
* make.
*
* 3.3. Redistribution of Executable. Redistribution in executable form of any
* substantial portion of the Covered Code or modification must reproduce the
* above Copyright Notice, and the following Disclaimer and Export Compliance
* provision in the documentation and/or other materials provided with the
* distribution.
*
* 3.4. Intel retains all right, title, and interest in and to the Original
* Intel Code.
*
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
* Intel shall be used in advertising or otherwise to promote the sale, use or
* other dealings in products derived from or relating to the Covered Code
* without prior written authorization from Intel.
*
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
* any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* ensure that the distribution and export/re-export of the software is in
* compliance with all laws, regulations, orders, or other restrictions of the
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
* any of its subsidiaries will export/re-export any technical data, process,
* software, or service, directly or indirectly, to any country for which the
* United States government or any agency thereof requires an export license,
* other governmental approval, or letter of assurance, without first obtaining
* such license, approval or letter.
*
*****************************************************************************/
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
#include "acpredef.h"
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nsprepkg")
/* Local prototypes */
static ACPI_STATUS
AcpiNsCheckPackageList (
ACPI_EVALUATE_INFO *Info,
const ACPI_PREDEFINED_INFO *Package,
ACPI_OPERAND_OBJECT **Elements,
UINT32 Count);
static ACPI_STATUS
AcpiNsCheckPackageElements (
ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT **Elements,
UINT8 Type1,
UINT32 Count1,
UINT8 Type2,
UINT32 Count2,
UINT32 StartIndex);
/*******************************************************************************
*
* FUNCTION: AcpiNsCheckPackage
*
* PARAMETERS: Info - Method execution information block
* ReturnObjectPtr - Pointer to the object returned from the
* evaluation of a method or object
*
* RETURN: Status
*
* DESCRIPTION: Check a returned package object for the correct count and
* correct type of all sub-objects.
*
******************************************************************************/
ACPI_STATUS
AcpiNsCheckPackage (
ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT **ReturnObjectPtr)
{
ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr;
const ACPI_PREDEFINED_INFO *Package;
ACPI_OPERAND_OBJECT **Elements;
ACPI_STATUS Status = AE_OK;
UINT32 ExpectedCount;
UINT32 Count;
UINT32 i;
ACPI_FUNCTION_NAME (NsCheckPackage);
/* The package info for this name is in the next table entry */
Package = Info->Predefined + 1;
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"%s Validating return Package of Type %X, Count %X\n",
Info->FullPathname, Package->RetInfo.Type,
ReturnObject->Package.Count));
/*
* For variable-length Packages, we can safely remove all embedded
* and trailing NULL package elements
*/
AcpiNsRemoveNullElements (Info, Package->RetInfo.Type, ReturnObject);
/* Extract package count and elements array */
Elements = ReturnObject->Package.Elements;
Count = ReturnObject->Package.Count;
/*
* Most packages must have at least one element. The only exception
* is the variable-length package (ACPI_PTYPE1_VAR).
*/
if (!Count)
{
if (Package->RetInfo.Type == ACPI_PTYPE1_VAR)
{
return (AE_OK);
}
ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
"Return Package has no elements (empty)"));
return (AE_AML_OPERAND_VALUE);
}
/*
* Decode the type of the expected package contents
*
* PTYPE1 packages contain no subpackages
* PTYPE2 packages contain sub-packages
*/
switch (Package->RetInfo.Type)
{
case ACPI_PTYPE1_FIXED:
/*
* The package count is fixed and there are no sub-packages
*
* If package is too small, exit.
* If package is larger than expected, issue warning but continue
*/
ExpectedCount = Package->RetInfo.Count1 + Package->RetInfo.Count2;
if (Count < ExpectedCount)
{
goto PackageTooSmall;
}
else if (Count > ExpectedCount)
{
ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
"%s: Return Package is larger than needed - "
"found %u, expected %u\n",
Info->FullPathname, Count, ExpectedCount));
}
/* Validate all elements of the returned package */
Status = AcpiNsCheckPackageElements (Info, Elements,
Package->RetInfo.ObjectType1, Package->RetInfo.Count1,
Package->RetInfo.ObjectType2, Package->RetInfo.Count2, 0);
break;
case ACPI_PTYPE1_VAR:
/*
* The package count is variable, there are no sub-packages, and all
* elements must be of the same type
*/
for (i = 0; i < Count; i++)
{
Status = AcpiNsCheckObjectType (Info, Elements,
Package->RetInfo.ObjectType1, i);
if (ACPI_FAILURE (Status))
{
return (Status);
}
Elements++;
}
break;
case ACPI_PTYPE1_OPTION:
/*
* The package count is variable, there are no sub-packages. There are
* a fixed number of required elements, and a variable number of
* optional elements.
*
* Check if package is at least as large as the minimum required
*/
ExpectedCount = Package->RetInfo3.Count;
if (Count < ExpectedCount)
{
goto PackageTooSmall;
}
/* Variable number of sub-objects */
for (i = 0; i < Count; i++)
{
if (i < Package->RetInfo3.Count)
{
/* These are the required package elements (0, 1, or 2) */
Status = AcpiNsCheckObjectType (Info, Elements,
Package->RetInfo3.ObjectType[i], i);
if (ACPI_FAILURE (Status))
{
return (Status);
}
}
else
{
/* These are the optional package elements */
Status = AcpiNsCheckObjectType (Info, Elements,
Package->RetInfo3.TailObjectType, i);
if (ACPI_FAILURE (Status))
{
return (Status);
}
}
Elements++;
}
break;
case ACPI_PTYPE2_REV_FIXED:
/* First element is the (Integer) revision */
Status = AcpiNsCheckObjectType (Info, Elements,
ACPI_RTYPE_INTEGER, 0);
if (ACPI_FAILURE (Status))
{
return (Status);
}
Elements++;
Count--;
/* Examine the sub-packages */
Status = AcpiNsCheckPackageList (Info, Package, Elements, Count);
break;
case ACPI_PTYPE2_PKG_COUNT:
/* First element is the (Integer) count of sub-packages to follow */
Status = AcpiNsCheckObjectType (Info, Elements,
ACPI_RTYPE_INTEGER, 0);
if (ACPI_FAILURE (Status))
{
return (Status);
}
/*
* Count cannot be larger than the parent package length, but allow it
* to be smaller. The >= accounts for the Integer above.
*/
ExpectedCount = (UINT32) (*Elements)->Integer.Value;
if (ExpectedCount >= Count)
{
goto PackageTooSmall;
}
Count = ExpectedCount;
Elements++;
/* Examine the sub-packages */
Status = AcpiNsCheckPackageList (Info, Package, Elements, Count);
break;
case ACPI_PTYPE2:
case ACPI_PTYPE2_FIXED:
case ACPI_PTYPE2_MIN:
case ACPI_PTYPE2_COUNT:
case ACPI_PTYPE2_FIX_VAR:
/*
* These types all return a single Package that consists of a
* variable number of sub-Packages.
*
* First, ensure that the first element is a sub-Package. If not,
* the BIOS may have incorrectly returned the object as a single
* package instead of a Package of Packages (a common error if
* there is only one entry). We may be able to repair this by
* wrapping the returned Package with a new outer Package.
*/
if (*Elements && ((*Elements)->Common.Type != ACPI_TYPE_PACKAGE))
{
/* Create the new outer package and populate it */
Status = AcpiNsWrapWithPackage (Info, ReturnObject, ReturnObjectPtr);
if (ACPI_FAILURE (Status))
{
return (Status);
}
/* Update locals to point to the new package (of 1 element) */
ReturnObject = *ReturnObjectPtr;
Elements = ReturnObject->Package.Elements;
Count = 1;
}
/* Examine the sub-packages */
Status = AcpiNsCheckPackageList (Info, Package, Elements, Count);
break;
default:
/* Should not get here if predefined info table is correct */
ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
"Invalid internal return type in table entry: %X",
Package->RetInfo.Type));
return (AE_AML_INTERNAL);
}
return (Status);
PackageTooSmall:
/* Error exit for the case with an incorrect package count */
ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
"Return Package is too small - found %u elements, expected %u",
Count, ExpectedCount));
return (AE_AML_OPERAND_VALUE);
}
/*******************************************************************************
*
* FUNCTION: AcpiNsCheckPackageList
*
* PARAMETERS: Info - Method execution information block
* Package - Pointer to package-specific info for method
* Elements - Element list of parent package. All elements
* of this list should be of type Package.
* Count - Count of subpackages
*
* RETURN: Status
*
* DESCRIPTION: Examine a list of subpackages
*
******************************************************************************/
static ACPI_STATUS
AcpiNsCheckPackageList (
ACPI_EVALUATE_INFO *Info,
const ACPI_PREDEFINED_INFO *Package,
ACPI_OPERAND_OBJECT **Elements,
UINT32 Count)
{
ACPI_OPERAND_OBJECT *SubPackage;
ACPI_OPERAND_OBJECT **SubElements;
ACPI_STATUS Status;
UINT32 ExpectedCount;
UINT32 i;
UINT32 j;
/*
* Validate each sub-Package in the parent Package
*
* NOTE: assumes list of sub-packages contains no NULL elements.
* Any NULL elements should have been removed by earlier call
* to AcpiNsRemoveNullElements.
*/
for (i = 0; i < Count; i++)
{
SubPackage = *Elements;
SubElements = SubPackage->Package.Elements;
Info->ParentPackage = SubPackage;
/* Each sub-object must be of type Package */
Status = AcpiNsCheckObjectType (Info, &SubPackage,
ACPI_RTYPE_PACKAGE, i);
if (ACPI_FAILURE (Status))
{
return (Status);
}
/* Examine the different types of expected sub-packages */
Info->ParentPackage = SubPackage;
switch (Package->RetInfo.Type)
{
case ACPI_PTYPE2:
case ACPI_PTYPE2_PKG_COUNT:
case ACPI_PTYPE2_REV_FIXED:
/* Each subpackage has a fixed number of elements */
ExpectedCount = Package->RetInfo.Count1 + Package->RetInfo.Count2;
if (SubPackage->Package.Count < ExpectedCount)
{
goto PackageTooSmall;
}
Status = AcpiNsCheckPackageElements (Info, SubElements,
Package->RetInfo.ObjectType1,
Package->RetInfo.Count1,
Package->RetInfo.ObjectType2,
Package->RetInfo.Count2, 0);
if (ACPI_FAILURE (Status))
{
return (Status);
}
break;
case ACPI_PTYPE2_FIX_VAR:
/*
* Each subpackage has a fixed number of elements and an
* optional element
*/
ExpectedCount = Package->RetInfo.Count1 + Package->RetInfo.Count2;
if (SubPackage->Package.Count < ExpectedCount)
{
goto PackageTooSmall;
}
Status = AcpiNsCheckPackageElements (Info, SubElements,
Package->RetInfo.ObjectType1,
Package->RetInfo.Count1,
Package->RetInfo.ObjectType2,
SubPackage->Package.Count - Package->RetInfo.Count1, 0);
if (ACPI_FAILURE (Status))
{
return (Status);
}
break;
case ACPI_PTYPE2_FIXED:
/* Each sub-package has a fixed length */
ExpectedCount = Package->RetInfo2.Count;
if (SubPackage->Package.Count < ExpectedCount)
{
goto PackageTooSmall;
}
/* Check the type of each sub-package element */
for (j = 0; j < ExpectedCount; j++)
{
Status = AcpiNsCheckObjectType (Info, &SubElements[j],
Package->RetInfo2.ObjectType[j], j);
if (ACPI_FAILURE (Status))
{
return (Status);
}
}
break;
case ACPI_PTYPE2_MIN:
/* Each sub-package has a variable but minimum length */
ExpectedCount = Package->RetInfo.Count1;
if (SubPackage->Package.Count < ExpectedCount)
{
goto PackageTooSmall;
}
/* Check the type of each sub-package element */
Status = AcpiNsCheckPackageElements (Info, SubElements,
Package->RetInfo.ObjectType1,
SubPackage->Package.Count, 0, 0, 0);
if (ACPI_FAILURE (Status))
{
return (Status);
}
break;
case ACPI_PTYPE2_COUNT:
/*
* First element is the (Integer) count of elements, including
* the count field (the ACPI name is NumElements)
*/
Status = AcpiNsCheckObjectType (Info, SubElements,
ACPI_RTYPE_INTEGER, 0);
if (ACPI_FAILURE (Status))
{
return (Status);
}
/*
* Make sure package is large enough for the Count and is
* is as large as the minimum size
*/
ExpectedCount = (UINT32) (*SubElements)->Integer.Value;
if (SubPackage->Package.Count < ExpectedCount)
{
goto PackageTooSmall;
}
if (SubPackage->Package.Count < Package->RetInfo.Count1)
{
ExpectedCount = Package->RetInfo.Count1;
goto PackageTooSmall;
}
if (ExpectedCount == 0)
{
/*
* Either the NumEntries element was originally zero or it was
* a NULL element and repaired to an Integer of value zero.
* In either case, repair it by setting NumEntries to be the
* actual size of the subpackage.
*/
ExpectedCount = SubPackage->Package.Count;
(*SubElements)->Integer.Value = ExpectedCount;
}
/* Check the type of each sub-package element */
Status = AcpiNsCheckPackageElements (Info, (SubElements + 1),
Package->RetInfo.ObjectType1,
(ExpectedCount - 1), 0, 0, 1);
if (ACPI_FAILURE (Status))
{
return (Status);
}
break;
default: /* Should not get here, type was validated by caller */
return (AE_AML_INTERNAL);
}
Elements++;
}
return (AE_OK);
PackageTooSmall:
/* The sub-package count was smaller than required */
ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
"Return Sub-Package[%u] is too small - found %u elements, expected %u",
i, SubPackage->Package.Count, ExpectedCount));
return (AE_AML_OPERAND_VALUE);
}
/*******************************************************************************
*
* FUNCTION: AcpiNsCheckPackageElements
*
* PARAMETERS: Info - Method execution information block
* Elements - Pointer to the package elements array
* Type1 - Object type for first group
* Count1 - Count for first group
* Type2 - Object type for second group
* Count2 - Count for second group
* StartIndex - Start of the first group of elements
*
* RETURN: Status
*
* DESCRIPTION: Check that all elements of a package are of the correct object
* type. Supports up to two groups of different object types.
*
******************************************************************************/
static ACPI_STATUS
AcpiNsCheckPackageElements (
ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT **Elements,
UINT8 Type1,
UINT32 Count1,
UINT8 Type2,
UINT32 Count2,
UINT32 StartIndex)
{
ACPI_OPERAND_OBJECT **ThisElement = Elements;
ACPI_STATUS Status;
UINT32 i;
/*
* Up to two groups of package elements are supported by the data
* structure. All elements in each group must be of the same type.
* The second group can have a count of zero.
*/
for (i = 0; i < Count1; i++)
{
Status = AcpiNsCheckObjectType (Info, ThisElement,
Type1, i + StartIndex);
if (ACPI_FAILURE (Status))
{
return (Status);
}
ThisElement++;
}
for (i = 0; i < Count2; i++)
{
Status = AcpiNsCheckObjectType (Info, ThisElement,
Type2, (i + Count1 + StartIndex));
if (ACPI_FAILURE (Status))
{
return (Status);
}
ThisElement++;
}
return (AE_OK);
}

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -120,6 +120,7 @@
#include "acnamesp.h"
#include "acinterp.h"
#include "acpredef.h"
#include "amlresrc.h"
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nsrepair")
@ -146,6 +147,11 @@
* Buffer -> String
* Buffer -> Package of Integers
* Package -> Package of one Package
*
* Additional conversions that are available:
* Convert a null return or zero return value to an EndTag descriptor
* Convert an ASCII string to a Unicode buffer
*
* An incorrect standalone object is wrapped with required outer package
*
* Additional possible repairs:
@ -156,27 +162,48 @@
/* Local prototypes */
static ACPI_STATUS
AcpiNsConvertToInteger (
ACPI_OPERAND_OBJECT *OriginalObject,
ACPI_OPERAND_OBJECT **ReturnObject);
static const ACPI_SIMPLE_REPAIR_INFO *
AcpiNsMatchSimpleRepair (
ACPI_NAMESPACE_NODE *Node,
UINT32 ReturnBtype,
UINT32 PackageIndex);
static ACPI_STATUS
AcpiNsConvertToString (
ACPI_OPERAND_OBJECT *OriginalObject,
ACPI_OPERAND_OBJECT **ReturnObject);
static ACPI_STATUS
AcpiNsConvertToBuffer (
ACPI_OPERAND_OBJECT *OriginalObject,
ACPI_OPERAND_OBJECT **ReturnObject);
/*
* Special but simple repairs for some names.
*
* 2nd argument: Unexpected types that can be repaired
*/
static const ACPI_SIMPLE_REPAIR_INFO AcpiObjectRepairInfo[] =
{
/* Resource descriptor conversions */
{ "_CRS", ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER | ACPI_RTYPE_NONE,
ACPI_NOT_PACKAGE_ELEMENT,
AcpiNsConvertToResource },
{ "_DMA", ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER | ACPI_RTYPE_NONE,
ACPI_NOT_PACKAGE_ELEMENT,
AcpiNsConvertToResource },
{ "_PRS", ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER | ACPI_RTYPE_NONE,
ACPI_NOT_PACKAGE_ELEMENT,
AcpiNsConvertToResource },
/* Unicode conversions */
{ "_MLS", ACPI_RTYPE_STRING, 1,
AcpiNsConvertToUnicode },
{ "_STR", ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER,
ACPI_NOT_PACKAGE_ELEMENT,
AcpiNsConvertToUnicode },
{ {0,0,0,0}, 0, 0, NULL } /* Table terminator */
};
/*******************************************************************************
*
* FUNCTION: AcpiNsRepairObject
* FUNCTION: AcpiNsSimpleRepair
*
* PARAMETERS: Data - Pointer to validation data structure
* PARAMETERS: Info - Method execution information block
* ExpectedBtypes - Object types expected
* PackageIndex - Index of object within parent package (if
* applicable - ACPI_NOT_PACKAGE_ELEMENT
@ -192,26 +219,84 @@ AcpiNsConvertToBuffer (
******************************************************************************/
ACPI_STATUS
AcpiNsRepairObject (
ACPI_PREDEFINED_DATA *Data,
AcpiNsSimpleRepair (
ACPI_EVALUATE_INFO *Info,
UINT32 ExpectedBtypes,
UINT32 PackageIndex,
ACPI_OPERAND_OBJECT **ReturnObjectPtr)
{
ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr;
ACPI_OPERAND_OBJECT *NewObject;
ACPI_OPERAND_OBJECT *NewObject = NULL;
ACPI_STATUS Status;
const ACPI_SIMPLE_REPAIR_INFO *Predefined;
ACPI_FUNCTION_NAME (NsRepairObject);
ACPI_FUNCTION_NAME (NsSimpleRepair);
/*
* Special repairs for certain names that are in the repair table.
* Check if this name is in the list of repairable names.
*/
Predefined = AcpiNsMatchSimpleRepair (Info->Node,
Info->ReturnBtype, PackageIndex);
if (Predefined)
{
if (!ReturnObject)
{
ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname,
ACPI_WARN_ALWAYS, "Missing expected return value"));
}
Status = Predefined->ObjectConverter (ReturnObject, &NewObject);
if (ACPI_FAILURE (Status))
{
/* A fatal error occurred during a conversion */
ACPI_EXCEPTION ((AE_INFO, Status,
"During return object analysis"));
return (Status);
}
if (NewObject)
{
goto ObjectRepaired;
}
}
/*
* Do not perform simple object repair unless the return type is not
* expected.
*/
if (Info->ReturnBtype & ExpectedBtypes)
{
return (AE_OK);
}
/*
* At this point, we know that the type of the returned object was not
* one of the expected types for this predefined name. Attempt to
* repair the object by converting it to one of the expected object
* types for this predefined name.
*/
/*
* If there is no return value, check if we require a return value for
* this predefined name. Either one return value is expected, or none,
* for both methods and other objects.
*
* Exit now if there is no return object. Warning if one was expected.
*/
if (!ReturnObject)
{
if (ExpectedBtypes && (!(ExpectedBtypes & ACPI_RTYPE_NONE)))
{
ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname,
ACPI_WARN_ALWAYS, "Missing expected return value"));
return (AE_AML_NO_RETURN_VALUE);
}
}
if (ExpectedBtypes & ACPI_RTYPE_INTEGER)
{
Status = AcpiNsConvertToInteger (ReturnObject, &NewObject);
@ -246,7 +331,7 @@ AcpiNsRepairObject (
* object. Note: after the wrapping, the package will be validated
* for correct contents (expected object type or types).
*/
Status = AcpiNsWrapWithPackage (Data, ReturnObject, &NewObject);
Status = AcpiNsWrapWithPackage (Info, ReturnObject, &NewObject);
if (ACPI_SUCCESS (Status))
{
/*
@ -254,7 +339,7 @@ AcpiNsRepairObject (
* incremented for being inserted into the new package.
*/
*ReturnObjectPtr = NewObject; /* New Package object */
Data->Flags |= ACPI_OBJECT_REPAIRED;
Info->ReturnFlags |= ACPI_OBJECT_REPAIRED;
return (AE_OK);
}
}
@ -279,7 +364,7 @@ ObjectRepaired:
* package object as part of the repair, we don't need to
* change the reference count.
*/
if (!(Data->Flags & ACPI_OBJECT_WRAPPED))
if (!(Info->ReturnFlags & ACPI_OBJECT_WRAPPED))
{
NewObject->Common.ReferenceCount =
ReturnObject->Common.ReferenceCount;
@ -292,14 +377,14 @@ ObjectRepaired:
ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
"%s: Converted %s to expected %s at Package index %u\n",
Data->Pathname, AcpiUtGetObjectTypeName (ReturnObject),
Info->FullPathname, AcpiUtGetObjectTypeName (ReturnObject),
AcpiUtGetObjectTypeName (NewObject), PackageIndex));
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
"%s: Converted %s to expected %s\n",
Data->Pathname, AcpiUtGetObjectTypeName (ReturnObject),
Info->FullPathname, AcpiUtGetObjectTypeName (ReturnObject),
AcpiUtGetObjectTypeName (NewObject)));
}
@ -307,278 +392,57 @@ ObjectRepaired:
AcpiUtRemoveReference (ReturnObject);
*ReturnObjectPtr = NewObject;
Data->Flags |= ACPI_OBJECT_REPAIRED;
Info->ReturnFlags |= ACPI_OBJECT_REPAIRED;
return (AE_OK);
}
/*******************************************************************************
/******************************************************************************
*
* FUNCTION: AcpiNsConvertToInteger
* FUNCTION: AcpiNsMatchSimpleRepair
*
* PARAMETERS: OriginalObject - Object to be converted
* ReturnObject - Where the new converted object is returned
* PARAMETERS: Node - Namespace node for the method/object
* ReturnBtype - Object type that was returned
* PackageIndex - Index of object within parent package (if
* applicable - ACPI_NOT_PACKAGE_ELEMENT
* otherwise)
*
* RETURN: Status. AE_OK if conversion was successful.
* RETURN: Pointer to entry in repair table. NULL indicates not found.
*
* DESCRIPTION: Attempt to convert a String/Buffer object to an Integer.
* DESCRIPTION: Check an object name against the repairable object list.
*
******************************************************************************/
*****************************************************************************/
static ACPI_STATUS
AcpiNsConvertToInteger (
ACPI_OPERAND_OBJECT *OriginalObject,
ACPI_OPERAND_OBJECT **ReturnObject)
static const ACPI_SIMPLE_REPAIR_INFO *
AcpiNsMatchSimpleRepair (
ACPI_NAMESPACE_NODE *Node,
UINT32 ReturnBtype,
UINT32 PackageIndex)
{
ACPI_OPERAND_OBJECT *NewObject;
ACPI_STATUS Status;
UINT64 Value = 0;
UINT32 i;
const ACPI_SIMPLE_REPAIR_INFO *ThisName;
switch (OriginalObject->Common.Type)
/* Search info table for a repairable predefined method/object name */
ThisName = AcpiObjectRepairInfo;
while (ThisName->ObjectConverter)
{
case ACPI_TYPE_STRING:
/* String-to-Integer conversion */
Status = AcpiUtStrtoul64 (OriginalObject->String.Pointer,
ACPI_ANY_BASE, &Value);
if (ACPI_FAILURE (Status))
if (ACPI_COMPARE_NAME (Node->Name.Ascii, ThisName->Name))
{
return (Status);
}
break;
/* Check if we can actually repair this name/type combination */
case ACPI_TYPE_BUFFER:
/* Buffer-to-Integer conversion. Max buffer size is 64 bits. */
if (OriginalObject->Buffer.Length > 8)
{
return (AE_AML_OPERAND_TYPE);
}
/* Extract each buffer byte to create the integer */
for (i = 0; i < OriginalObject->Buffer.Length; i++)
{
Value |= ((UINT64) OriginalObject->Buffer.Pointer[i] << (i * 8));
}
break;
default:
return (AE_AML_OPERAND_TYPE);
}
NewObject = AcpiUtCreateIntegerObject (Value);
if (!NewObject)
{
return (AE_NO_MEMORY);
}
*ReturnObject = NewObject;
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiNsConvertToString
*
* PARAMETERS: OriginalObject - Object to be converted
* ReturnObject - Where the new converted object is returned
*
* RETURN: Status. AE_OK if conversion was successful.
*
* DESCRIPTION: Attempt to convert a Integer/Buffer object to a String.
*
******************************************************************************/
static ACPI_STATUS
AcpiNsConvertToString (
ACPI_OPERAND_OBJECT *OriginalObject,
ACPI_OPERAND_OBJECT **ReturnObject)
{
ACPI_OPERAND_OBJECT *NewObject;
ACPI_SIZE Length;
ACPI_STATUS Status;
switch (OriginalObject->Common.Type)
{
case ACPI_TYPE_INTEGER:
/*
* Integer-to-String conversion. Commonly, convert
* an integer of value 0 to a NULL string. The last element of
* _BIF and _BIX packages occasionally need this fix.
*/
if (OriginalObject->Integer.Value == 0)
{
/* Allocate a new NULL string object */
NewObject = AcpiUtCreateStringObject (0);
if (!NewObject)
if ((ReturnBtype & ThisName->UnexpectedBtypes) &&
(PackageIndex == ThisName->PackageIndex))
{
return (AE_NO_MEMORY);
return (ThisName);
}
return (NULL);
}
else
{
Status = AcpiExConvertToString (OriginalObject, &NewObject,
ACPI_IMPLICIT_CONVERT_HEX);
if (ACPI_FAILURE (Status))
{
return (Status);
}
}
break;
case ACPI_TYPE_BUFFER:
/*
* Buffer-to-String conversion. Use a ToString
* conversion, no transform performed on the buffer data. The best
* example of this is the _BIF method, where the string data from
* the battery is often (incorrectly) returned as buffer object(s).
*/
Length = 0;
while ((Length < OriginalObject->Buffer.Length) &&
(OriginalObject->Buffer.Pointer[Length]))
{
Length++;
}
/* Allocate a new string object */
NewObject = AcpiUtCreateStringObject (Length);
if (!NewObject)
{
return (AE_NO_MEMORY);
}
/*
* Copy the raw buffer data with no transform. String is already NULL
* terminated at Length+1.
*/
ACPI_MEMCPY (NewObject->String.Pointer,
OriginalObject->Buffer.Pointer, Length);
break;
default:
return (AE_AML_OPERAND_TYPE);
ThisName++;
}
*ReturnObject = NewObject;
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiNsConvertToBuffer
*
* PARAMETERS: OriginalObject - Object to be converted
* ReturnObject - Where the new converted object is returned
*
* RETURN: Status. AE_OK if conversion was successful.
*
* DESCRIPTION: Attempt to convert a Integer/String/Package object to a Buffer.
*
******************************************************************************/
static ACPI_STATUS
AcpiNsConvertToBuffer (
ACPI_OPERAND_OBJECT *OriginalObject,
ACPI_OPERAND_OBJECT **ReturnObject)
{
ACPI_OPERAND_OBJECT *NewObject;
ACPI_STATUS Status;
ACPI_OPERAND_OBJECT **Elements;
UINT32 *DwordBuffer;
UINT32 Count;
UINT32 i;
switch (OriginalObject->Common.Type)
{
case ACPI_TYPE_INTEGER:
/*
* Integer-to-Buffer conversion.
* Convert the Integer to a packed-byte buffer. _MAT and other
* objects need this sometimes, if a read has been performed on a
* Field object that is less than or equal to the global integer
* size (32 or 64 bits).
*/
Status = AcpiExConvertToBuffer (OriginalObject, &NewObject);
if (ACPI_FAILURE (Status))
{
return (Status);
}
break;
case ACPI_TYPE_STRING:
/* String-to-Buffer conversion. Simple data copy */
NewObject = AcpiUtCreateBufferObject (OriginalObject->String.Length);
if (!NewObject)
{
return (AE_NO_MEMORY);
}
ACPI_MEMCPY (NewObject->Buffer.Pointer,
OriginalObject->String.Pointer, OriginalObject->String.Length);
break;
case ACPI_TYPE_PACKAGE:
/*
* This case is often seen for predefined names that must return a
* Buffer object with multiple DWORD integers within. For example,
* _FDE and _GTM. The Package can be converted to a Buffer.
*/
/* All elements of the Package must be integers */
Elements = OriginalObject->Package.Elements;
Count = OriginalObject->Package.Count;
for (i = 0; i < Count; i++)
{
if ((!*Elements) ||
((*Elements)->Common.Type != ACPI_TYPE_INTEGER))
{
return (AE_AML_OPERAND_TYPE);
}
Elements++;
}
/* Create the new buffer object to replace the Package */
NewObject = AcpiUtCreateBufferObject (ACPI_MUL_4 (Count));
if (!NewObject)
{
return (AE_NO_MEMORY);
}
/* Copy the package elements (integers) to the buffer as DWORDs */
Elements = OriginalObject->Package.Elements;
DwordBuffer = ACPI_CAST_PTR (UINT32, NewObject->Buffer.Pointer);
for (i = 0; i < Count; i++)
{
*DwordBuffer = (UINT32) (*Elements)->Integer.Value;
DwordBuffer++;
Elements++;
}
break;
default:
return (AE_AML_OPERAND_TYPE);
}
*ReturnObject = NewObject;
return (AE_OK);
return (NULL); /* Name was not found in the repair table */
}
@ -586,7 +450,7 @@ AcpiNsConvertToBuffer (
*
* FUNCTION: AcpiNsRepairNullElement
*
* PARAMETERS: Data - Pointer to validation data structure
* PARAMETERS: Info - Method execution information block
* ExpectedBtypes - Object types expected
* PackageIndex - Index of object within parent package (if
* applicable - ACPI_NOT_PACKAGE_ELEMENT
@ -602,7 +466,7 @@ AcpiNsConvertToBuffer (
ACPI_STATUS
AcpiNsRepairNullElement (
ACPI_PREDEFINED_DATA *Data,
ACPI_EVALUATE_INFO *Info,
UINT32 ExpectedBtypes,
UINT32 PackageIndex,
ACPI_OPERAND_OBJECT **ReturnObjectPtr)
@ -659,14 +523,14 @@ AcpiNsRepairNullElement (
/* Set the reference count according to the parent Package object */
NewObject->Common.ReferenceCount = Data->ParentPackage->Common.ReferenceCount;
NewObject->Common.ReferenceCount = Info->ParentPackage->Common.ReferenceCount;
ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
"%s: Converted NULL package element to expected %s at index %u\n",
Data->Pathname, AcpiUtGetObjectTypeName (NewObject), PackageIndex));
Info->FullPathname, AcpiUtGetObjectTypeName (NewObject), PackageIndex));
*ReturnObjectPtr = NewObject;
Data->Flags |= ACPI_OBJECT_REPAIRED;
Info->ReturnFlags |= ACPI_OBJECT_REPAIRED;
return (AE_OK);
}
@ -675,7 +539,7 @@ AcpiNsRepairNullElement (
*
* FUNCTION: AcpiNsRemoveNullElements
*
* PARAMETERS: Data - Pointer to validation data structure
* PARAMETERS: Info - Method execution information block
* PackageType - An AcpiReturnPackageTypes value
* ObjDesc - A Package object
*
@ -689,7 +553,7 @@ AcpiNsRepairNullElement (
void
AcpiNsRemoveNullElements (
ACPI_PREDEFINED_DATA *Data,
ACPI_EVALUATE_INFO *Info,
UINT8 PackageType,
ACPI_OPERAND_OBJECT *ObjDesc)
{
@ -718,6 +582,7 @@ AcpiNsRemoveNullElements (
case ACPI_PTYPE2_MIN:
case ACPI_PTYPE2_REV_FIXED:
case ACPI_PTYPE2_FIX_VAR:
break;
default:
@ -754,7 +619,7 @@ AcpiNsRemoveNullElements (
{
ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
"%s: Found and removed %u NULL elements\n",
Data->Pathname, (Count - NewCount)));
Info->FullPathname, (Count - NewCount)));
/* NULL terminate list and update the package count */
@ -768,7 +633,7 @@ AcpiNsRemoveNullElements (
*
* FUNCTION: AcpiNsWrapWithPackage
*
* PARAMETERS: Data - Pointer to validation data structure
* PARAMETERS: Info - Method execution information block
* OriginalObject - Pointer to the object to repair.
* ObjDescPtr - The new package object is returned here
*
@ -790,7 +655,7 @@ AcpiNsRemoveNullElements (
ACPI_STATUS
AcpiNsWrapWithPackage (
ACPI_PREDEFINED_DATA *Data,
ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT *OriginalObject,
ACPI_OPERAND_OBJECT **ObjDescPtr)
{
@ -814,11 +679,11 @@ AcpiNsWrapWithPackage (
ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
"%s: Wrapped %s with expected Package object\n",
Data->Pathname, AcpiUtGetObjectTypeName (OriginalObject)));
Info->FullPathname, AcpiUtGetObjectTypeName (OriginalObject)));
/* Return the new object in the object pointer */
*ObjDescPtr = PkgObjDesc;
Data->Flags |= ACPI_OBJECT_REPAIRED | ACPI_OBJECT_WRAPPED;
Info->ReturnFlags |= ACPI_OBJECT_REPAIRED | ACPI_OBJECT_WRAPPED;
return (AE_OK);
}

View File

@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -130,7 +130,7 @@
*/
typedef
ACPI_STATUS (*ACPI_REPAIR_FUNCTION) (
ACPI_PREDEFINED_DATA *Data,
ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT **ReturnObjectPtr);
typedef struct acpi_repair_info
@ -144,48 +144,69 @@ typedef struct acpi_repair_info
/* Local prototypes */
static const ACPI_REPAIR_INFO *
AcpiNsMatchRepairableName (
AcpiNsMatchComplexRepair (
ACPI_NAMESPACE_NODE *Node);
static ACPI_STATUS
AcpiNsRepair_ALR (
ACPI_PREDEFINED_DATA *Data,
ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT **ReturnObjectPtr);
static ACPI_STATUS
AcpiNsRepair_CID (
ACPI_PREDEFINED_DATA *Data,
ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT **ReturnObjectPtr);
static ACPI_STATUS
AcpiNsRepair_CST (
ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT **ReturnObjectPtr);
static ACPI_STATUS
AcpiNsRepair_FDE (
ACPI_PREDEFINED_DATA *Data,
ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT **ReturnObjectPtr);
static ACPI_STATUS
AcpiNsRepair_HID (
ACPI_PREDEFINED_DATA *Data,
ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT **ReturnObjectPtr);
static ACPI_STATUS
AcpiNsRepair_PRT (
ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT **ReturnObjectPtr);
static ACPI_STATUS
AcpiNsRepair_PSS (
ACPI_PREDEFINED_DATA *Data,
ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT **ReturnObjectPtr);
static ACPI_STATUS
AcpiNsRepair_TSS (
ACPI_PREDEFINED_DATA *Data,
ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT **ReturnObjectPtr);
static ACPI_STATUS
AcpiNsCheckSortedList (
ACPI_PREDEFINED_DATA *Data,
ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT *ReturnObject,
UINT32 StartIndex,
UINT32 ExpectedCount,
UINT32 SortIndex,
UINT8 SortDirection,
char *SortKeyName);
/* Values for SortDirection above */
#define ACPI_SORT_ASCENDING 0
#define ACPI_SORT_DESCENDING 1
static void
AcpiNsRemoveElement (
ACPI_OPERAND_OBJECT *ObjDesc,
UINT32 Index);
static void
AcpiNsSortList (
ACPI_OPERAND_OBJECT **Elements,
@ -193,11 +214,6 @@ AcpiNsSortList (
UINT32 Index,
UINT8 SortDirection);
/* Values for SortDirection above */
#define ACPI_SORT_ASCENDING 0
#define ACPI_SORT_DESCENDING 1
/*
* This table contains the names of the predefined methods for which we can
@ -207,9 +223,11 @@ AcpiNsSortList (
*
* _ALR: Sort the list ascending by AmbientIlluminance
* _CID: Strings: uppercase all, remove any leading asterisk
* _CST: Sort the list ascending by C state type
* _FDE: Convert Buffer of BYTEs to a Buffer of DWORDs
* _GTM: Convert Buffer of BYTEs to a Buffer of DWORDs
* _HID: Strings: uppercase all, remove any leading asterisk
* _PRT: Fix reversed SourceName and SourceIndex
* _PSS: Sort the list descending by Power
* _TSS: Sort the list descending by Power
*
@ -224,9 +242,11 @@ static const ACPI_REPAIR_INFO AcpiNsRepairableNames[] =
{
{"_ALR", AcpiNsRepair_ALR},
{"_CID", AcpiNsRepair_CID},
{"_CST", AcpiNsRepair_CST},
{"_FDE", AcpiNsRepair_FDE},
{"_GTM", AcpiNsRepair_FDE}, /* _GTM has same repair as _FDE */
{"_HID", AcpiNsRepair_HID},
{"_PRT", AcpiNsRepair_PRT},
{"_PSS", AcpiNsRepair_PSS},
{"_TSS", AcpiNsRepair_TSS},
{{0,0,0,0}, NULL} /* Table terminator */
@ -242,7 +262,7 @@ static const ACPI_REPAIR_INFO AcpiNsRepairableNames[] =
*
* FUNCTION: AcpiNsComplexRepairs
*
* PARAMETERS: Data - Pointer to validation data structure
* PARAMETERS: Info - Method execution information block
* Node - Namespace node for the method/object
* ValidateStatus - Original status of earlier validation
* ReturnObjectPtr - Pointer to the object returned from the
@ -258,7 +278,7 @@ static const ACPI_REPAIR_INFO AcpiNsRepairableNames[] =
ACPI_STATUS
AcpiNsComplexRepairs (
ACPI_PREDEFINED_DATA *Data,
ACPI_EVALUATE_INFO *Info,
ACPI_NAMESPACE_NODE *Node,
ACPI_STATUS ValidateStatus,
ACPI_OPERAND_OBJECT **ReturnObjectPtr)
@ -269,20 +289,20 @@ AcpiNsComplexRepairs (
/* Check if this name is in the list of repairable names */
Predefined = AcpiNsMatchRepairableName (Node);
Predefined = AcpiNsMatchComplexRepair (Node);
if (!Predefined)
{
return (ValidateStatus);
}
Status = Predefined->RepairFunction (Data, ReturnObjectPtr);
Status = Predefined->RepairFunction (Info, ReturnObjectPtr);
return (Status);
}
/******************************************************************************
*
* FUNCTION: AcpiNsMatchRepairableName
* FUNCTION: AcpiNsMatchComplexRepair
*
* PARAMETERS: Node - Namespace node for the method/object
*
@ -293,7 +313,7 @@ AcpiNsComplexRepairs (
*****************************************************************************/
static const ACPI_REPAIR_INFO *
AcpiNsMatchRepairableName (
AcpiNsMatchComplexRepair (
ACPI_NAMESPACE_NODE *Node)
{
const ACPI_REPAIR_INFO *ThisName;
@ -319,7 +339,7 @@ AcpiNsMatchRepairableName (
*
* FUNCTION: AcpiNsRepair_ALR
*
* PARAMETERS: Data - Pointer to validation data structure
* PARAMETERS: Info - Method execution information block
* ReturnObjectPtr - Pointer to the object returned from the
* evaluation of a method or object
*
@ -332,14 +352,14 @@ AcpiNsMatchRepairableName (
static ACPI_STATUS
AcpiNsRepair_ALR (
ACPI_PREDEFINED_DATA *Data,
ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT **ReturnObjectPtr)
{
ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr;
ACPI_STATUS Status;
Status = AcpiNsCheckSortedList (Data, ReturnObject, 2, 1,
Status = AcpiNsCheckSortedList (Info, ReturnObject, 0, 2, 1,
ACPI_SORT_ASCENDING, "AmbientIlluminance");
return (Status);
@ -350,7 +370,7 @@ AcpiNsRepair_ALR (
*
* FUNCTION: AcpiNsRepair_FDE
*
* PARAMETERS: Data - Pointer to validation data structure
* PARAMETERS: Info - Method execution information block
* ReturnObjectPtr - Pointer to the object returned from the
* evaluation of a method or object
*
@ -365,7 +385,7 @@ AcpiNsRepair_ALR (
static ACPI_STATUS
AcpiNsRepair_FDE (
ACPI_PREDEFINED_DATA *Data,
ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT **ReturnObjectPtr)
{
ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr;
@ -393,7 +413,7 @@ AcpiNsRepair_FDE (
if (ReturnObject->Buffer.Length != ACPI_FDE_BYTE_BUFFER_SIZE)
{
ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags,
ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
"Incorrect return buffer length %u, expected %u",
ReturnObject->Buffer.Length, ACPI_FDE_DWORD_BUFFER_SIZE));
@ -422,10 +442,11 @@ AcpiNsRepair_FDE (
ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
"%s Expanded Byte Buffer to expected DWord Buffer\n",
Data->Pathname));
Info->FullPathname));
break;
default:
return (AE_AML_OPERAND_TYPE);
}
@ -434,7 +455,7 @@ AcpiNsRepair_FDE (
AcpiUtRemoveReference (ReturnObject);
*ReturnObjectPtr = BufferObject;
Data->Flags |= ACPI_OBJECT_REPAIRED;
Info->ReturnFlags |= ACPI_OBJECT_REPAIRED;
return (AE_OK);
}
@ -443,7 +464,7 @@ AcpiNsRepair_FDE (
*
* FUNCTION: AcpiNsRepair_CID
*
* PARAMETERS: Data - Pointer to validation data structure
* PARAMETERS: Info - Method execution information block
* ReturnObjectPtr - Pointer to the object returned from the
* evaluation of a method or object
*
@ -457,7 +478,7 @@ AcpiNsRepair_FDE (
static ACPI_STATUS
AcpiNsRepair_CID (
ACPI_PREDEFINED_DATA *Data,
ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT **ReturnObjectPtr)
{
ACPI_STATUS Status;
@ -472,7 +493,7 @@ AcpiNsRepair_CID (
if (ReturnObject->Common.Type == ACPI_TYPE_STRING)
{
Status = AcpiNsRepair_HID (Data, ReturnObjectPtr);
Status = AcpiNsRepair_HID (Info, ReturnObjectPtr);
return (Status);
}
@ -491,7 +512,7 @@ AcpiNsRepair_CID (
OriginalElement = *ElementPtr;
OriginalRefCount = OriginalElement->Common.ReferenceCount;
Status = AcpiNsRepair_HID (Data, ElementPtr);
Status = AcpiNsRepair_HID (Info, ElementPtr);
if (ACPI_FAILURE (Status))
{
return (Status);
@ -516,11 +537,104 @@ AcpiNsRepair_CID (
}
/******************************************************************************
*
* FUNCTION: AcpiNsRepair_CST
*
* PARAMETERS: Info - Method execution information block
* ReturnObjectPtr - Pointer to the object returned from the
* evaluation of a method or object
*
* RETURN: Status. AE_OK if object is OK or was repaired successfully
*
* DESCRIPTION: Repair for the _CST object:
* 1. Sort the list ascending by C state type
* 2. Ensure type cannot be zero
* 3. A sub-package count of zero means _CST is meaningless
* 4. Count must match the number of C state sub-packages
*
*****************************************************************************/
static ACPI_STATUS
AcpiNsRepair_CST (
ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT **ReturnObjectPtr)
{
ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr;
ACPI_OPERAND_OBJECT **OuterElements;
UINT32 OuterElementCount;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_STATUS Status;
BOOLEAN Removing;
UINT32 i;
ACPI_FUNCTION_NAME (NsRepair_CST);
/*
* Check if the C-state type values are proportional.
*/
OuterElementCount = ReturnObject->Package.Count - 1;
i = 0;
while (i < OuterElementCount)
{
OuterElements = &ReturnObject->Package.Elements[i + 1];
Removing = FALSE;
if ((*OuterElements)->Package.Count == 0)
{
ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
"SubPackage[%u] - removing entry due to zero count", i));
Removing = TRUE;
goto RemoveElement;
}
ObjDesc = (*OuterElements)->Package.Elements[1]; /* Index1 = Type */
if ((UINT32) ObjDesc->Integer.Value == 0)
{
ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
"SubPackage[%u] - removing entry due to invalid Type(0)", i));
Removing = TRUE;
}
RemoveElement:
if (Removing)
{
AcpiNsRemoveElement (ReturnObject, i + 1);
OuterElementCount--;
}
else
{
i++;
}
}
/* Update top-level package count, Type "Integer" checked elsewhere */
ObjDesc = ReturnObject->Package.Elements[0];
ObjDesc->Integer.Value = OuterElementCount;
/*
* Entries (subpackages) in the _CST Package must be sorted by the
* C-state type, in ascending order.
*/
Status = AcpiNsCheckSortedList (Info, ReturnObject, 1, 4, 1,
ACPI_SORT_ASCENDING, "C-State Type");
if (ACPI_FAILURE (Status))
{
return (Status);
}
return (AE_OK);
}
/******************************************************************************
*
* FUNCTION: AcpiNsRepair_HID
*
* PARAMETERS: Data - Pointer to validation data structure
* PARAMETERS: Info - Method execution information block
* ReturnObjectPtr - Pointer to the object returned from the
* evaluation of a method or object
*
@ -533,7 +647,7 @@ AcpiNsRepair_CID (
static ACPI_STATUS
AcpiNsRepair_HID (
ACPI_PREDEFINED_DATA *Data,
ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT **ReturnObjectPtr)
{
ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr;
@ -554,12 +668,12 @@ AcpiNsRepair_HID (
if (ReturnObject->String.Length == 0)
{
ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags,
ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
"Invalid zero-length _HID or _CID string"));
/* Return AE_OK anyway, let driver handle it */
Data->Flags |= ACPI_OBJECT_REPAIRED;
Info->ReturnFlags |= ACPI_OBJECT_REPAIRED;
return (AE_OK);
}
@ -584,7 +698,7 @@ AcpiNsRepair_HID (
NewString->String.Length--;
ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
"%s: Removed invalid leading asterisk\n", Data->Pathname));
"%s: Removed invalid leading asterisk\n", Info->FullPathname));
}
/*
@ -608,47 +722,65 @@ AcpiNsRepair_HID (
/******************************************************************************
*
* FUNCTION: AcpiNsRepair_TSS
* FUNCTION: AcpiNsRepair_PRT
*
* PARAMETERS: Data - Pointer to validation data structure
* PARAMETERS: Info - Method execution information block
* ReturnObjectPtr - Pointer to the object returned from the
* evaluation of a method or object
*
* RETURN: Status. AE_OK if object is OK or was repaired successfully
*
* DESCRIPTION: Repair for the _TSS object. If necessary, sort the object list
* descending by the power dissipation values.
* DESCRIPTION: Repair for the _PRT object. If necessary, fix reversed
* SourceName and SourceIndex field, a common BIOS bug.
*
*****************************************************************************/
static ACPI_STATUS
AcpiNsRepair_TSS (
ACPI_PREDEFINED_DATA *Data,
AcpiNsRepair_PRT (
ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT **ReturnObjectPtr)
{
ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr;
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *Node;
ACPI_OPERAND_OBJECT *PackageObject = *ReturnObjectPtr;
ACPI_OPERAND_OBJECT **TopObjectList;
ACPI_OPERAND_OBJECT **SubObjectList;
ACPI_OPERAND_OBJECT *ObjDesc;
UINT32 ElementCount;
UINT32 Index;
/*
* We can only sort the _TSS return package if there is no _PSS in the
* same scope. This is because if _PSS is present, the ACPI specification
* dictates that the _TSS Power Dissipation field is to be ignored, and
* therefore some BIOSs leave garbage values in the _TSS Power field(s).
* In this case, it is best to just return the _TSS package as-is.
* (May, 2011)
*/
Status = AcpiNsGetNode (Data->Node, "^_PSS", ACPI_NS_NO_UPSEARCH, &Node);
if (ACPI_SUCCESS (Status))
/* Each element in the _PRT package is a subpackage */
TopObjectList = PackageObject->Package.Elements;
ElementCount = PackageObject->Package.Count;
for (Index = 0; Index < ElementCount; Index++)
{
return (AE_OK);
SubObjectList = (*TopObjectList)->Package.Elements;
/*
* If the BIOS has erroneously reversed the _PRT SourceName (index 2)
* and the SourceIndex (index 3), fix it. _PRT is important enough to
* workaround this BIOS error. This also provides compatibility with
* other ACPI implementations.
*/
ObjDesc = SubObjectList[3];
if (!ObjDesc || (ObjDesc->Common.Type != ACPI_TYPE_INTEGER))
{
SubObjectList[3] = SubObjectList[2];
SubObjectList[2] = ObjDesc;
Info->ReturnFlags |= ACPI_OBJECT_REPAIRED;
ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
"PRT[%X]: Fixed reversed SourceName and SourceIndex",
Index));
}
/* Point to the next ACPI_OPERAND_OBJECT in the top level package */
TopObjectList++;
}
Status = AcpiNsCheckSortedList (Data, ReturnObject, 5, 1,
ACPI_SORT_DESCENDING, "PowerDissipation");
return (Status);
return (AE_OK);
}
@ -656,7 +788,7 @@ AcpiNsRepair_TSS (
*
* FUNCTION: AcpiNsRepair_PSS
*
* PARAMETERS: Data - Pointer to validation data structure
* PARAMETERS: Info - Method execution information block
* ReturnObjectPtr - Pointer to the object returned from the
* evaluation of a method or object
*
@ -671,7 +803,7 @@ AcpiNsRepair_TSS (
static ACPI_STATUS
AcpiNsRepair_PSS (
ACPI_PREDEFINED_DATA *Data,
ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT **ReturnObjectPtr)
{
ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr;
@ -690,7 +822,7 @@ AcpiNsRepair_PSS (
* incorrectly sorted, sort it. We sort by CpuFrequency, since this
* should be proportional to the power.
*/
Status =AcpiNsCheckSortedList (Data, ReturnObject, 6, 0,
Status =AcpiNsCheckSortedList (Info, ReturnObject, 0, 6, 0,
ACPI_SORT_DESCENDING, "CpuFrequency");
if (ACPI_FAILURE (Status))
{
@ -712,7 +844,7 @@ AcpiNsRepair_PSS (
if ((UINT32) ObjDesc->Integer.Value > PreviousValue)
{
ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags,
ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
"SubPackage[%u,%u] - suspicious power dissipation values",
i-1, i));
}
@ -725,12 +857,60 @@ AcpiNsRepair_PSS (
}
/******************************************************************************
*
* FUNCTION: AcpiNsRepair_TSS
*
* PARAMETERS: Info - Method execution information block
* ReturnObjectPtr - Pointer to the object returned from the
* evaluation of a method or object
*
* RETURN: Status. AE_OK if object is OK or was repaired successfully
*
* DESCRIPTION: Repair for the _TSS object. If necessary, sort the object list
* descending by the power dissipation values.
*
*****************************************************************************/
static ACPI_STATUS
AcpiNsRepair_TSS (
ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT **ReturnObjectPtr)
{
ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr;
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *Node;
/*
* We can only sort the _TSS return package if there is no _PSS in the
* same scope. This is because if _PSS is present, the ACPI specification
* dictates that the _TSS Power Dissipation field is to be ignored, and
* therefore some BIOSs leave garbage values in the _TSS Power field(s).
* In this case, it is best to just return the _TSS package as-is.
* (May, 2011)
*/
Status = AcpiNsGetNode (Info->Node, "^_PSS",
ACPI_NS_NO_UPSEARCH, &Node);
if (ACPI_SUCCESS (Status))
{
return (AE_OK);
}
Status = AcpiNsCheckSortedList (Info, ReturnObject, 0, 5, 1,
ACPI_SORT_DESCENDING, "PowerDissipation");
return (Status);
}
/******************************************************************************
*
* FUNCTION: AcpiNsCheckSortedList
*
* PARAMETERS: Data - Pointer to validation data structure
* PARAMETERS: Info - Method execution information block
* ReturnObject - Pointer to the top-level returned object
* StartIndex - Index of the first sub-package
* ExpectedCount - Minimum length of each sub-package
* SortIndex - Sub-package entry to sort on
* SortDirection - Ascending or descending
@ -746,8 +926,9 @@ AcpiNsRepair_PSS (
static ACPI_STATUS
AcpiNsCheckSortedList (
ACPI_PREDEFINED_DATA *Data,
ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT *ReturnObject,
UINT32 StartIndex,
UINT32 ExpectedCount,
UINT32 SortIndex,
UINT8 SortDirection,
@ -776,13 +957,15 @@ AcpiNsCheckSortedList (
* Any NULL elements should have been removed by earlier call
* to AcpiNsRemoveNullElements.
*/
OuterElements = ReturnObject->Package.Elements;
OuterElementCount = ReturnObject->Package.Count;
if (!OuterElementCount)
if (!OuterElementCount || StartIndex >= OuterElementCount)
{
return (AE_AML_PACKAGE_LIMIT);
}
OuterElements = &ReturnObject->Package.Elements[StartIndex];
OuterElementCount -= StartIndex;
PreviousValue = 0;
if (SortDirection == ACPI_SORT_DESCENDING)
{
@ -824,14 +1007,14 @@ AcpiNsCheckSortedList (
((SortDirection == ACPI_SORT_DESCENDING) &&
(ObjDesc->Integer.Value > PreviousValue)))
{
AcpiNsSortList (ReturnObject->Package.Elements,
AcpiNsSortList (&ReturnObject->Package.Elements[StartIndex],
OuterElementCount, SortIndex, SortDirection);
Data->Flags |= ACPI_OBJECT_REPAIRED;
Info->ReturnFlags |= ACPI_OBJECT_REPAIRED;
ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
"%s: Repaired unsorted list - now sorted by %s\n",
Data->Pathname, SortKeyName));
Info->FullPathname, SortKeyName));
return (AE_OK);
}
@ -897,3 +1080,61 @@ AcpiNsSortList (
}
}
}
/******************************************************************************
*
* FUNCTION: AcpiNsRemoveElement
*
* PARAMETERS: ObjDesc - Package object element list
* Index - Index of element to remove
*
* RETURN: None
*
* DESCRIPTION: Remove the requested element of a package and delete it.
*
*****************************************************************************/
static void
AcpiNsRemoveElement (
ACPI_OPERAND_OBJECT *ObjDesc,
UINT32 Index)
{
ACPI_OPERAND_OBJECT **Source;
ACPI_OPERAND_OBJECT **Dest;
UINT32 Count;
UINT32 NewCount;
UINT32 i;
ACPI_FUNCTION_NAME (NsRemoveElement);
Count = ObjDesc->Package.Count;
NewCount = Count - 1;
Source = ObjDesc->Package.Elements;
Dest = Source;
/* Examine all elements of the package object, remove matched index */
for (i = 0; i < Count; i++)
{
if (i == Index)
{
AcpiUtRemoveReference (*Source); /* Remove one ref for being in pkg */
AcpiUtRemoveReference (*Source);
}
else
{
*Dest = *Source;
Dest++;
}
Source++;
}
/* NULL terminate list and update the package count */
*Dest = NULL;
ObjDesc->Package.Count = NewCount;
}

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License

View File

@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -126,10 +126,6 @@
/* Local prototypes */
static BOOLEAN
AcpiNsValidPathSeparator (
char Sep);
#ifdef ACPI_OBSOLETE_FUNCTIONS
ACPI_NAME
AcpiNsFindParentName (
@ -182,48 +178,6 @@ AcpiNsPrintNodePathname (
}
/*******************************************************************************
*
* FUNCTION: AcpiNsValidRootPrefix
*
* PARAMETERS: Prefix - Character to be checked
*
* RETURN: TRUE if a valid prefix
*
* DESCRIPTION: Check if a character is a valid ACPI Root prefix
*
******************************************************************************/
BOOLEAN
AcpiNsValidRootPrefix (
char Prefix)
{
return ((BOOLEAN) (Prefix == '\\'));
}
/*******************************************************************************
*
* FUNCTION: AcpiNsValidPathSeparator
*
* PARAMETERS: Sep - Character to be checked
*
* RETURN: TRUE if a valid path separator
*
* DESCRIPTION: Check if a character is a valid ACPI path separator
*
******************************************************************************/
static BOOLEAN
AcpiNsValidPathSeparator (
char Sep)
{
return ((BOOLEAN) (Sep == '.'));
}
/*******************************************************************************
*
* FUNCTION: AcpiNsGetType
@ -246,10 +200,10 @@ AcpiNsGetType (
if (!Node)
{
ACPI_WARNING ((AE_INFO, "Null Node parameter"));
return_UINT32 (ACPI_TYPE_ANY);
return_UINT8 (ACPI_TYPE_ANY);
}
return_UINT32 ((ACPI_OBJECT_TYPE) Node->Type);
return_UINT8 (Node->Type);
}
@ -281,7 +235,7 @@ AcpiNsLocal (
return_UINT32 (ACPI_NS_NORMAL);
}
return_UINT32 ((UINT32) AcpiGbl_NsProperties[Type] & ACPI_NS_LOCAL);
return_UINT32 (AcpiGbl_NsProperties[Type] & ACPI_NS_LOCAL);
}
@ -322,14 +276,14 @@ AcpiNsGetInternalNameLength (
*
* strlen() + 1 covers the first NameSeg, which has no path separator
*/
if (AcpiNsValidRootPrefix (*NextExternalChar))
if (ACPI_IS_ROOT_PREFIX (*NextExternalChar))
{
Info->FullyQualified = TRUE;
NextExternalChar++;
/* Skip redundant RootPrefix, like \\_SB.PCI0.SBRG.EC0 */
while (AcpiNsValidRootPrefix (*NextExternalChar))
while (ACPI_IS_ROOT_PREFIX (*NextExternalChar))
{
NextExternalChar++;
}
@ -338,7 +292,7 @@ AcpiNsGetInternalNameLength (
{
/* Handle Carat prefixes */
while (*NextExternalChar == '^')
while (ACPI_IS_PARENT_PREFIX (*NextExternalChar))
{
Info->NumCarats++;
NextExternalChar++;
@ -355,7 +309,7 @@ AcpiNsGetInternalNameLength (
Info->NumSegments = 1;
for (i = 0; NextExternalChar[i]; i++)
{
if (AcpiNsValidPathSeparator (NextExternalChar[i]))
if (ACPI_IS_PATH_SEPARATOR (NextExternalChar[i]))
{
Info->NumSegments++;
}
@ -400,7 +354,7 @@ AcpiNsBuildInternalName (
if (Info->FullyQualified)
{
InternalName[0] = '\\';
InternalName[0] = AML_ROOT_PREFIX;
if (NumSegments <= 1)
{
@ -429,7 +383,7 @@ AcpiNsBuildInternalName (
{
for (i = 0; i < Info->NumCarats; i++)
{
InternalName[i] = '^';
InternalName[i] = AML_PARENT_PREFIX;
}
}
@ -456,7 +410,7 @@ AcpiNsBuildInternalName (
{
for (i = 0; i < ACPI_NAME_SIZE; i++)
{
if (AcpiNsValidPathSeparator (*ExternalName) ||
if (ACPI_IS_PATH_SEPARATOR (*ExternalName) ||
(*ExternalName == 0))
{
/* Pad the segment with underscore(s) if segment is short */
@ -474,7 +428,7 @@ AcpiNsBuildInternalName (
/* Now we must have a path separator, or the pathname is bad */
if (!AcpiNsValidPathSeparator (*ExternalName) &&
if (!ACPI_IS_PATH_SEPARATOR (*ExternalName) &&
(*ExternalName != 0))
{
return_ACPI_STATUS (AE_BAD_PATHNAME);
@ -614,14 +568,16 @@ AcpiNsExternalizeName (
switch (InternalName[0])
{
case '\\':
case AML_ROOT_PREFIX:
PrefixLength = 1;
break;
case '^':
case AML_PARENT_PREFIX:
for (i = 0; i < InternalNameLength; i++)
{
if (InternalName[i] == '^')
if (ACPI_IS_PARENT_PREFIX (InternalName[i]))
{
PrefixLength = i + 1;
}
@ -639,6 +595,7 @@ AcpiNsExternalizeName (
break;
default:
break;
}
@ -849,18 +806,18 @@ UINT32
AcpiNsOpensScope (
ACPI_OBJECT_TYPE Type)
{
ACPI_FUNCTION_TRACE_STR (NsOpensScope, AcpiUtGetTypeName (Type));
ACPI_FUNCTION_ENTRY ();
if (!AcpiUtValidObjectType (Type))
if (Type > ACPI_TYPE_LOCAL_MAX)
{
/* type code out of range */
ACPI_WARNING ((AE_INFO, "Invalid Object Type 0x%X", Type));
return_UINT32 (ACPI_NS_NORMAL);
return (ACPI_NS_NORMAL);
}
return_UINT32 (((UINT32) AcpiGbl_NsProperties[Type]) & ACPI_NS_NEWSCOPE);
return (((UINT32) AcpiGbl_NsProperties[Type]) & ACPI_NS_NEWSCOPE);
}
@ -901,6 +858,8 @@ AcpiNsGetNode (
ACPI_FUNCTION_TRACE_PTR (NsGetNode, ACPI_CAST_PTR (char, Pathname));
/* Simplest case is a null pathname */
if (!Pathname)
{
*ReturnNode = PrefixNode;
@ -911,6 +870,14 @@ AcpiNsGetNode (
return_ACPI_STATUS (AE_OK);
}
/* Quick check for a reference to the root */
if (ACPI_IS_ROOT_PREFIX (Pathname[0]) && (!Pathname[1]))
{
*ReturnNode = AcpiGbl_RootNode;
return_ACPI_STATUS (AE_OK);
}
/* Convert path to internal representation */
Status = AcpiNsInternalizeName (Pathname, &InternalPath);

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -237,9 +237,9 @@ AcpiNsGetNextNodeTyped (
* MaxDepth - Depth to which search is to reach
* Flags - Whether to unlock the NS before invoking
* the callback routine
* PreOrderVisit - Called during tree pre-order visit
* DescendingCallback - Called during tree descent
* when an object of "Type" is found
* PostOrderVisit - Called during tree post-order visit
* AscendingCallback - Called during tree ascent
* when an object of "Type" is found
* Context - Passed to user function(s) above
* ReturnValue - from the UserFunction if terminated
@ -267,8 +267,8 @@ AcpiNsWalkNamespace (
ACPI_HANDLE StartNode,
UINT32 MaxDepth,
UINT32 Flags,
ACPI_WALK_CALLBACK PreOrderVisit,
ACPI_WALK_CALLBACK PostOrderVisit,
ACPI_WALK_CALLBACK DescendingCallback,
ACPI_WALK_CALLBACK AscendingCallback,
void *Context,
void **ReturnValue)
{
@ -346,22 +346,22 @@ AcpiNsWalkNamespace (
}
/*
* Invoke the user function, either pre-order or post-order
* Invoke the user function, either descending, ascending,
* or both.
*/
if (!NodePreviouslyVisited)
{
if (PreOrderVisit)
if (DescendingCallback)
{
Status = PreOrderVisit (ChildNode, Level,
Status = DescendingCallback (ChildNode, Level,
Context, ReturnValue);
}
}
else
{
if (PostOrderVisit)
if (AscendingCallback)
{
Status = PostOrderVisit (ChildNode, Level,
Status = AscendingCallback (ChildNode, Level,
Context, ReturnValue);
}
}

View File

@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -277,8 +277,6 @@ AcpiEvaluateObject (
return_ACPI_STATUS (AE_NO_MEMORY);
}
Info->Pathname = Pathname;
/* Convert and validate the device handle */
Info->PrefixNode = AcpiNsValidateHandle (Handle);
@ -289,57 +287,26 @@ AcpiEvaluateObject (
}
/*
* If there are parameters to be passed to a control method, the external
* objects must all be converted to internal objects
*/
if (ExternalParams && ExternalParams->Count)
{
/*
* Allocate a new parameter block for the internal objects
* Add 1 to count to allow for null terminated internal list
*/
Info->Parameters = ACPI_ALLOCATE_ZEROED (
((ACPI_SIZE) ExternalParams->Count + 1) * sizeof (void *));
if (!Info->Parameters)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
/* Convert each external object in the list to an internal object */
for (i = 0; i < ExternalParams->Count; i++)
{
Status = AcpiUtCopyEobjectToIobject (
&ExternalParams->Pointer[i], &Info->Parameters[i]);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
}
Info->Parameters[ExternalParams->Count] = NULL;
}
/*
* Three major cases:
* 1) Fully qualified pathname
* 2) No handle, not fully qualified pathname (error)
* 3) Valid handle
* Get the actual namespace node for the target object.
* Handles these cases:
*
* 1) Null node, valid pathname from root (absolute path)
* 2) Node and valid pathname (path relative to Node)
* 3) Node, Null pathname
*/
if ((Pathname) &&
(AcpiNsValidRootPrefix (Pathname[0])))
(ACPI_IS_ROOT_PREFIX (Pathname[0])))
{
/* The path is fully qualified, just evaluate by name */
Info->PrefixNode = NULL;
Status = AcpiNsEvaluate (Info);
}
else if (!Handle)
{
/*
* A handle is optional iff a fully qualified pathname is specified.
* Since we've already handled fully qualified names above, this is
* an error
* an error.
*/
if (!Pathname)
{
@ -353,14 +320,148 @@ AcpiEvaluateObject (
}
Status = AE_BAD_PARAMETER;
goto Cleanup;
}
else
{
/* We have a namespace a node and a possible relative path */
Status = AcpiNsEvaluate (Info);
Info->RelativePathname = Pathname;
/*
* Convert all external objects passed as arguments to the
* internal version(s).
*/
if (ExternalParams && ExternalParams->Count)
{
Info->ParamCount = (UINT16) ExternalParams->Count;
/* Warn on impossible argument count */
if (Info->ParamCount > ACPI_METHOD_NUM_ARGS)
{
ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS,
"Excess arguments (%u) - using only %u",
Info->ParamCount, ACPI_METHOD_NUM_ARGS));
Info->ParamCount = ACPI_METHOD_NUM_ARGS;
}
/*
* Allocate a new parameter block for the internal objects
* Add 1 to count to allow for null terminated internal list
*/
Info->Parameters = ACPI_ALLOCATE_ZEROED (
((ACPI_SIZE) Info->ParamCount + 1) * sizeof (void *));
if (!Info->Parameters)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
/* Convert each external object in the list to an internal object */
for (i = 0; i < Info->ParamCount; i++)
{
Status = AcpiUtCopyEobjectToIobject (
&ExternalParams->Pointer[i], &Info->Parameters[i]);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
}
Info->Parameters[Info->ParamCount] = NULL;
}
#if 0
/*
* Begin incoming argument count analysis. Check for too few args
* and too many args.
*/
switch (AcpiNsGetType (Info->Node))
{
case ACPI_TYPE_METHOD:
/* Check incoming argument count against the method definition */
if (Info->ObjDesc->Method.ParamCount > Info->ParamCount)
{
ACPI_ERROR ((AE_INFO,
"Insufficient arguments (%u) - %u are required",
Info->ParamCount,
Info->ObjDesc->Method.ParamCount));
Status = AE_MISSING_ARGUMENTS;
goto Cleanup;
}
else if (Info->ObjDesc->Method.ParamCount < Info->ParamCount)
{
ACPI_WARNING ((AE_INFO,
"Excess arguments (%u) - only %u are required",
Info->ParamCount,
Info->ObjDesc->Method.ParamCount));
/* Just pass the required number of arguments */
Info->ParamCount = Info->ObjDesc->Method.ParamCount;
}
/*
* Any incoming external objects to be passed as arguments to the
* method must be converted to internal objects
*/
if (Info->ParamCount)
{
/*
* Allocate a new parameter block for the internal objects
* Add 1 to count to allow for null terminated internal list
*/
Info->Parameters = ACPI_ALLOCATE_ZEROED (
((ACPI_SIZE) Info->ParamCount + 1) * sizeof (void *));
if (!Info->Parameters)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
/* Convert each external object in the list to an internal object */
for (i = 0; i < Info->ParamCount; i++)
{
Status = AcpiUtCopyEobjectToIobject (
&ExternalParams->Pointer[i], &Info->Parameters[i]);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
}
Info->Parameters[Info->ParamCount] = NULL;
}
break;
default:
/* Warn if arguments passed to an object that is not a method */
if (Info->ParamCount)
{
ACPI_WARNING ((AE_INFO,
"%u arguments were passed to a non-method ACPI object",
Info->ParamCount));
}
break;
}
#endif
/* Now we can evaluate the object */
Status = AcpiNsEvaluate (Info);
/*
* If we are expecting a return value, and all went well above,
* copy the return value to an external object.
@ -521,6 +622,7 @@ AcpiNsResolveReferences (
break;
default:
return;
}
@ -544,9 +646,9 @@ AcpiNsResolveReferences (
* PARAMETERS: Type - ACPI_OBJECT_TYPE to search for
* StartObject - Handle in namespace where search begins
* MaxDepth - Depth to which search is to reach
* PreOrderVisit - Called during tree pre-order visit
* DescendingCallback - Called during tree descent
* when an object of "Type" is found
* PostOrderVisit - Called during tree post-order visit
* AscendingCallback - Called during tree ascent
* when an object of "Type" is found
* Context - Passed to user function(s) above
* ReturnValue - Location where return value of
@ -575,8 +677,8 @@ AcpiWalkNamespace (
ACPI_OBJECT_TYPE Type,
ACPI_HANDLE StartObject,
UINT32 MaxDepth,
ACPI_WALK_CALLBACK PreOrderVisit,
ACPI_WALK_CALLBACK PostOrderVisit,
ACPI_WALK_CALLBACK DescendingCallback,
ACPI_WALK_CALLBACK AscendingCallback,
void *Context,
void **ReturnValue)
{
@ -590,7 +692,7 @@ AcpiWalkNamespace (
if ((Type > ACPI_TYPE_LOCAL_MAX) ||
(!MaxDepth) ||
(!PreOrderVisit && !PostOrderVisit))
(!DescendingCallback && !AscendingCallback))
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
@ -624,10 +726,19 @@ AcpiWalkNamespace (
goto UnlockAndExit;
}
Status = AcpiNsWalkNamespace (Type, StartObject, MaxDepth,
ACPI_NS_WALK_UNLOCK, PreOrderVisit,
PostOrderVisit, Context, ReturnValue);
/* Now we can validate the starting node */
if (!AcpiNsValidateHandle (StartObject))
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit2;
}
Status = AcpiNsWalkNamespace (Type, StartObject, MaxDepth,
ACPI_NS_WALK_UNLOCK, DescendingCallback,
AscendingCallback, Context, ReturnValue);
UnlockAndExit2:
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
UnlockAndExit:

View File

@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -192,7 +192,7 @@ AcpiGetHandle (
*
* Error for <null Parent + relative path>
*/
if (AcpiNsValidRootPrefix (Pathname[0]))
if (ACPI_IS_ROOT_PREFIX (Pathname[0]))
{
/* Pathname is fully qualified (starts with '\') */
@ -249,6 +249,7 @@ AcpiGetName (
{
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *Node;
char *NodeName;
/* Parameter validation */
@ -299,7 +300,8 @@ AcpiGetName (
/* Just copy the ACPI name from the Node and zero terminate it */
ACPI_MOVE_NAME (Buffer->Pointer, AcpiUtGetNodeName (Node));
NodeName = AcpiUtGetNodeName (Node);
ACPI_MOVE_NAME (Buffer->Pointer, NodeName);
((char *) Buffer->Pointer) [ACPI_NAME_SIZE] = 0;
Status = AE_OK;
@ -397,7 +399,7 @@ AcpiGetObjectInfo (
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
return (Status);
}
Node = AcpiNsValidateHandle (Handle);
@ -495,9 +497,14 @@ AcpiGetObjectInfo (
* Get extra info for ACPI Device/Processor objects only:
* Run the _STA, _ADR and, SxW, and _SxD methods.
*
* Note: none of these methods are required, so they may or may
* Notes: none of these methods are required, so they may or may
* not be present for this device. The Info->Valid bitfield is used
* to indicate which methods were found and run successfully.
*
* For _STA, if the method does not exist, then (as per the ACPI
* specification), the returned CurrentStatus flags will indicate
* that the device is present/functional/enabled. Otherwise, the
* CurrentStatus flags reflect the value returned from _STA.
*/
/* Execute the Device._STA method */

View File

@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -254,7 +254,8 @@ AcpiPsGetNextNamestring (
/* Point past any namestring prefix characters (backslash or carat) */
while (AcpiPsIsPrefixChar (*End))
while (ACPI_IS_ROOT_PREFIX (*End) ||
ACPI_IS_PARENT_PREFIX (*End))
{
End++;
}
@ -518,7 +519,6 @@ AcpiPsGetNextSimpleArg (
Length = 1;
break;
case ARGP_WORDDATA:
/* Get 2 bytes from the AML stream */
@ -528,7 +528,6 @@ AcpiPsGetNextSimpleArg (
Length = 2;
break;
case ARGP_DWORDDATA:
/* Get 4 bytes from the AML stream */
@ -538,7 +537,6 @@ AcpiPsGetNextSimpleArg (
Length = 4;
break;
case ARGP_QWORDDATA:
/* Get 8 bytes from the AML stream */
@ -548,7 +546,6 @@ AcpiPsGetNextSimpleArg (
Length = 8;
break;
case ARGP_CHARLIST:
/* Get a pointer to the string, point past the string */
@ -566,7 +563,6 @@ AcpiPsGetNextSimpleArg (
Length++;
break;
case ARGP_NAME:
case ARGP_NAMESTRING:
@ -574,7 +570,6 @@ AcpiPsGetNextSimpleArg (
Arg->Common.Value.Name = AcpiPsGetNextNamestring (ParserState);
return_VOID;
default:
ACPI_ERROR ((AE_INFO, "Invalid ArgType 0x%X", ArgType));
@ -756,21 +751,25 @@ AcpiPsGetNextField (
switch (Opcode)
{
case AML_BYTE_OP: /* AML_BYTEDATA_ARG */
BufferLength = ACPI_GET8 (ParserState->Aml);
ParserState->Aml += 1;
break;
case AML_WORD_OP: /* AML_WORDDATA_ARG */
BufferLength = ACPI_GET16 (ParserState->Aml);
ParserState->Aml += 2;
break;
case AML_DWORD_OP: /* AML_DWORDATA_ARG */
BufferLength = ACPI_GET32 (ParserState->Aml);
ParserState->Aml += 4;
break;
default:
BufferLength = 0;
break;
}
@ -867,7 +866,6 @@ AcpiPsGetNextArg (
AcpiPsGetNextSimpleArg (ParserState, ArgType, Arg);
break;
case ARGP_PKGLENGTH:
/* Package length, nothing returned */
@ -875,7 +873,6 @@ AcpiPsGetNextArg (
ParserState->PkgEnd = AcpiPsGetNextPackageEnd (ParserState);
break;
case ARGP_FIELDLIST:
if (ParserState->Aml < ParserState->PkgEnd)
@ -907,7 +904,6 @@ AcpiPsGetNextArg (
}
break;
case ARGP_BYTELIST:
if (ParserState->Aml < ParserState->PkgEnd)
@ -932,7 +928,6 @@ AcpiPsGetNextArg (
}
break;
case ARGP_TARGET:
case ARGP_SUPERNAME:
case ARGP_SIMPLENAME:
@ -940,7 +935,8 @@ AcpiPsGetNextArg (
Subop = AcpiPsPeekOpcode (ParserState);
if (Subop == 0 ||
AcpiPsIsLeadingChar (Subop) ||
AcpiPsIsPrefixChar (Subop))
ACPI_IS_ROOT_PREFIX (Subop) ||
ACPI_IS_PARENT_PREFIX (Subop))
{
/* NullName or NameString */
@ -979,7 +975,6 @@ AcpiPsGetNextArg (
}
break;
case ARGP_DATAOBJ:
case ARGP_TERMARG:
@ -988,7 +983,6 @@ AcpiPsGetNextArg (
WalkState->ArgCount = 1;
break;
case ARGP_DATAOBJLIST:
case ARGP_TERMLIST:
case ARGP_OBJLIST:
@ -1001,7 +995,6 @@ AcpiPsGetNextArg (
}
break;
default:
ACPI_ERROR ((AE_INFO, "Invalid ArgType: 0x%X", ArgType));

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -131,46 +131,15 @@
#define _COMPONENT ACPI_PARSER
ACPI_MODULE_NAME ("psloop")
static UINT32 AcpiGbl_Depth = 0;
/* Local prototypes */
static ACPI_STATUS
AcpiPsGetAmlOpcode (
ACPI_WALK_STATE *WalkState);
static ACPI_STATUS
AcpiPsBuildNamedOp (
ACPI_WALK_STATE *WalkState,
UINT8 *AmlOpStart,
ACPI_PARSE_OBJECT *UnnamedOp,
ACPI_PARSE_OBJECT **Op);
static ACPI_STATUS
AcpiPsCreateOp (
ACPI_WALK_STATE *WalkState,
UINT8 *AmlOpStart,
ACPI_PARSE_OBJECT **NewOp);
static ACPI_STATUS
AcpiPsGetArguments (
ACPI_WALK_STATE *WalkState,
UINT8 *AmlOpStart,
ACPI_PARSE_OBJECT *Op);
static ACPI_STATUS
AcpiPsCompleteOp (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT **Op,
ACPI_STATUS Status);
static ACPI_STATUS
AcpiPsCompleteFinalOp (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op,
ACPI_STATUS Status);
static void
AcpiPsLinkModuleCode (
ACPI_PARSE_OBJECT *ParentOp,
@ -179,341 +148,6 @@ AcpiPsLinkModuleCode (
ACPI_OWNER_ID OwnerId);
/*******************************************************************************
*
* FUNCTION: AcpiPsGetAmlOpcode
*
* PARAMETERS: WalkState - Current state
*
* RETURN: Status
*
* DESCRIPTION: Extract the next AML opcode from the input stream.
*
******************************************************************************/
static ACPI_STATUS
AcpiPsGetAmlOpcode (
ACPI_WALK_STATE *WalkState)
{
ACPI_FUNCTION_TRACE_PTR (PsGetAmlOpcode, WalkState);
WalkState->AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->ParserState.Aml,
WalkState->ParserState.AmlStart);
WalkState->Opcode = AcpiPsPeekOpcode (&(WalkState->ParserState));
/*
* First cut to determine what we have found:
* 1) A valid AML opcode
* 2) A name string
* 3) An unknown/invalid opcode
*/
WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode);
switch (WalkState->OpInfo->Class)
{
case AML_CLASS_ASCII:
case AML_CLASS_PREFIX:
/*
* Starts with a valid prefix or ASCII char, this is a name
* string. Convert the bare name string to a namepath.
*/
WalkState->Opcode = AML_INT_NAMEPATH_OP;
WalkState->ArgTypes = ARGP_NAMESTRING;
break;
case AML_CLASS_UNKNOWN:
/* The opcode is unrecognized. Complain and skip unknown opcodes */
if (WalkState->PassNumber == 2)
{
ACPI_ERROR ((AE_INFO,
"Unknown opcode 0x%.2X at table offset 0x%.4X, ignoring",
WalkState->Opcode,
(UINT32) (WalkState->AmlOffset + sizeof (ACPI_TABLE_HEADER))));
ACPI_DUMP_BUFFER (WalkState->ParserState.Aml - 16, 48);
#ifdef ACPI_ASL_COMPILER
/*
* This is executed for the disassembler only. Output goes
* to the disassembled ASL output file.
*/
AcpiOsPrintf (
"/*\nError: Unknown opcode 0x%.2X at table offset 0x%.4X, context:\n",
WalkState->Opcode,
(UINT32) (WalkState->AmlOffset + sizeof (ACPI_TABLE_HEADER)));
/* Dump the context surrounding the invalid opcode */
AcpiUtDumpBuffer (((UINT8 *) WalkState->ParserState.Aml - 16),
48, DB_BYTE_DISPLAY,
WalkState->AmlOffset + sizeof (ACPI_TABLE_HEADER) - 16);
AcpiOsPrintf (" */\n");
#endif
}
/* Increment past one-byte or two-byte opcode */
WalkState->ParserState.Aml++;
if (WalkState->Opcode > 0xFF) /* Can only happen if first byte is 0x5B */
{
WalkState->ParserState.Aml++;
}
return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE);
default:
/* Found opcode info, this is a normal opcode */
WalkState->ParserState.Aml += AcpiPsGetOpcodeSize (WalkState->Opcode);
WalkState->ArgTypes = WalkState->OpInfo->ParseArgs;
break;
}
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiPsBuildNamedOp
*
* PARAMETERS: WalkState - Current state
* AmlOpStart - Begin of named Op in AML
* UnnamedOp - Early Op (not a named Op)
* Op - Returned Op
*
* RETURN: Status
*
* DESCRIPTION: Parse a named Op
*
******************************************************************************/
static ACPI_STATUS
AcpiPsBuildNamedOp (
ACPI_WALK_STATE *WalkState,
UINT8 *AmlOpStart,
ACPI_PARSE_OBJECT *UnnamedOp,
ACPI_PARSE_OBJECT **Op)
{
ACPI_STATUS Status = AE_OK;
ACPI_PARSE_OBJECT *Arg = NULL;
ACPI_FUNCTION_TRACE_PTR (PsBuildNamedOp, WalkState);
UnnamedOp->Common.Value.Arg = NULL;
UnnamedOp->Common.ArgListLength = 0;
UnnamedOp->Common.AmlOpcode = WalkState->Opcode;
/*
* Get and append arguments until we find the node that contains
* the name (the type ARGP_NAME).
*/
while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) &&
(GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) != ARGP_NAME))
{
Status = AcpiPsGetNextArg (WalkState, &(WalkState->ParserState),
GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
AcpiPsAppendArg (UnnamedOp, Arg);
INCREMENT_ARG_LIST (WalkState->ArgTypes);
}
/*
* Make sure that we found a NAME and didn't run out of arguments
*/
if (!GET_CURRENT_ARG_TYPE (WalkState->ArgTypes))
{
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
/* We know that this arg is a name, move to next arg */
INCREMENT_ARG_LIST (WalkState->ArgTypes);
/*
* Find the object. This will either insert the object into
* the namespace or simply look it up
*/
WalkState->Op = NULL;
Status = WalkState->DescendingCallback (WalkState, Op);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status, "During name lookup/catalog"));
return_ACPI_STATUS (Status);
}
if (!*Op)
{
return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE);
}
Status = AcpiPsNextParseState (WalkState, *Op, Status);
if (ACPI_FAILURE (Status))
{
if (Status == AE_CTRL_PENDING)
{
return_ACPI_STATUS (AE_CTRL_PARSE_PENDING);
}
return_ACPI_STATUS (Status);
}
AcpiPsAppendArg (*Op, UnnamedOp->Common.Value.Arg);
AcpiGbl_Depth++;
if ((*Op)->Common.AmlOpcode == AML_REGION_OP ||
(*Op)->Common.AmlOpcode == AML_DATA_REGION_OP)
{
/*
* Defer final parsing of an OperationRegion body, because we don't
* have enough info in the first pass to parse it correctly (i.e.,
* there may be method calls within the TermArg elements of the body.)
*
* However, we must continue parsing because the opregion is not a
* standalone package -- we don't know where the end is at this point.
*
* (Length is unknown until parse of the body complete)
*/
(*Op)->Named.Data = AmlOpStart;
(*Op)->Named.Length = 0;
}
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiPsCreateOp
*
* PARAMETERS: WalkState - Current state
* AmlOpStart - Op start in AML
* NewOp - Returned Op
*
* RETURN: Status
*
* DESCRIPTION: Get Op from AML
*
******************************************************************************/
static ACPI_STATUS
AcpiPsCreateOp (
ACPI_WALK_STATE *WalkState,
UINT8 *AmlOpStart,
ACPI_PARSE_OBJECT **NewOp)
{
ACPI_STATUS Status = AE_OK;
ACPI_PARSE_OBJECT *Op;
ACPI_PARSE_OBJECT *NamedOp = NULL;
ACPI_PARSE_OBJECT *ParentScope;
UINT8 ArgumentCount;
const ACPI_OPCODE_INFO *OpInfo;
ACPI_FUNCTION_TRACE_PTR (PsCreateOp, WalkState);
Status = AcpiPsGetAmlOpcode (WalkState);
if (Status == AE_CTRL_PARSE_CONTINUE)
{
return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE);
}
/* Create Op structure and append to parent's argument list */
WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode);
Op = AcpiPsAllocOp (WalkState->Opcode);
if (!Op)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
if (WalkState->OpInfo->Flags & AML_NAMED)
{
Status = AcpiPsBuildNamedOp (WalkState, AmlOpStart, Op, &NamedOp);
AcpiPsFreeOp (Op);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
*NewOp = NamedOp;
return_ACPI_STATUS (AE_OK);
}
/* Not a named opcode, just allocate Op and append to parent */
if (WalkState->OpInfo->Flags & AML_CREATE)
{
/*
* Backup to beginning of CreateXXXfield declaration
* BodyLength is unknown until we parse the body
*/
Op->Named.Data = AmlOpStart;
Op->Named.Length = 0;
}
if (WalkState->Opcode == AML_BANK_FIELD_OP)
{
/*
* Backup to beginning of BankField declaration
* BodyLength is unknown until we parse the body
*/
Op->Named.Data = AmlOpStart;
Op->Named.Length = 0;
}
ParentScope = AcpiPsGetParentScope (&(WalkState->ParserState));
AcpiPsAppendArg (ParentScope, Op);
if (ParentScope)
{
OpInfo = AcpiPsGetOpcodeInfo (ParentScope->Common.AmlOpcode);
if (OpInfo->Flags & AML_HAS_TARGET)
{
ArgumentCount = AcpiPsGetArgumentCount (OpInfo->Type);
if (ParentScope->Common.ArgListLength > ArgumentCount)
{
Op->Common.Flags |= ACPI_PARSEOP_TARGET;
}
}
else if (ParentScope->Common.AmlOpcode == AML_INCREMENT_OP)
{
Op->Common.Flags |= ACPI_PARSEOP_TARGET;
}
}
if (WalkState->DescendingCallback != NULL)
{
/*
* Find the object. This will either insert the object into
* the namespace or simply look it up
*/
WalkState->Op = *NewOp = Op;
Status = WalkState->DescendingCallback (WalkState, &Op);
Status = AcpiPsNextParseState (WalkState, Op, Status);
if (Status == AE_CTRL_PENDING)
{
Status = AE_CTRL_PARSE_PENDING;
}
}
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiPsGetArguments
@ -612,7 +246,6 @@ AcpiPsGetArguments (
case AML_IF_OP:
case AML_ELSE_OP:
case AML_WHILE_OP:
/*
* Currently supported module-level opcodes are:
* IF/ELSE/WHILE. These appear to be the most common,
@ -718,6 +351,7 @@ AcpiPsGetArguments (
default:
/* No action for all other opcodes */
break;
}
@ -818,298 +452,6 @@ AcpiPsLinkModuleCode (
}
}
/*******************************************************************************
*
* FUNCTION: AcpiPsCompleteOp
*
* PARAMETERS: WalkState - Current state
* Op - Returned Op
* Status - Parse status before complete Op
*
* RETURN: Status
*
* DESCRIPTION: Complete Op
*
******************************************************************************/
static ACPI_STATUS
AcpiPsCompleteOp (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT **Op,
ACPI_STATUS Status)
{
ACPI_STATUS Status2;
ACPI_FUNCTION_TRACE_PTR (PsCompleteOp, WalkState);
/*
* Finished one argument of the containing scope
*/
WalkState->ParserState.Scope->ParseScope.ArgCount--;
/* Close this Op (will result in parse subtree deletion) */
Status2 = AcpiPsCompleteThisOp (WalkState, *Op);
if (ACPI_FAILURE (Status2))
{
return_ACPI_STATUS (Status2);
}
*Op = NULL;
switch (Status)
{
case AE_OK:
break;
case AE_CTRL_TRANSFER:
/* We are about to transfer to a called method */
WalkState->PrevOp = NULL;
WalkState->PrevArgTypes = WalkState->ArgTypes;
return_ACPI_STATUS (Status);
case AE_CTRL_END:
AcpiPsPopScope (&(WalkState->ParserState), Op,
&WalkState->ArgTypes, &WalkState->ArgCount);
if (*Op)
{
WalkState->Op = *Op;
WalkState->OpInfo = AcpiPsGetOpcodeInfo ((*Op)->Common.AmlOpcode);
WalkState->Opcode = (*Op)->Common.AmlOpcode;
Status = WalkState->AscendingCallback (WalkState);
Status = AcpiPsNextParseState (WalkState, *Op, Status);
Status2 = AcpiPsCompleteThisOp (WalkState, *Op);
if (ACPI_FAILURE (Status2))
{
return_ACPI_STATUS (Status2);
}
}
Status = AE_OK;
break;
case AE_CTRL_BREAK:
case AE_CTRL_CONTINUE:
/* Pop off scopes until we find the While */
while (!(*Op) || ((*Op)->Common.AmlOpcode != AML_WHILE_OP))
{
AcpiPsPopScope (&(WalkState->ParserState), Op,
&WalkState->ArgTypes, &WalkState->ArgCount);
}
/* Close this iteration of the While loop */
WalkState->Op = *Op;
WalkState->OpInfo = AcpiPsGetOpcodeInfo ((*Op)->Common.AmlOpcode);
WalkState->Opcode = (*Op)->Common.AmlOpcode;
Status = WalkState->AscendingCallback (WalkState);
Status = AcpiPsNextParseState (WalkState, *Op, Status);
Status2 = AcpiPsCompleteThisOp (WalkState, *Op);
if (ACPI_FAILURE (Status2))
{
return_ACPI_STATUS (Status2);
}
Status = AE_OK;
break;
case AE_CTRL_TERMINATE:
/* Clean up */
do
{
if (*Op)
{
Status2 = AcpiPsCompleteThisOp (WalkState, *Op);
if (ACPI_FAILURE (Status2))
{
return_ACPI_STATUS (Status2);
}
AcpiUtDeleteGenericState (
AcpiUtPopGenericState (&WalkState->ControlState));
}
AcpiPsPopScope (&(WalkState->ParserState), Op,
&WalkState->ArgTypes, &WalkState->ArgCount);
} while (*Op);
return_ACPI_STATUS (AE_OK);
default: /* All other non-AE_OK status */
do
{
if (*Op)
{
Status2 = AcpiPsCompleteThisOp (WalkState, *Op);
if (ACPI_FAILURE (Status2))
{
return_ACPI_STATUS (Status2);
}
}
AcpiPsPopScope (&(WalkState->ParserState), Op,
&WalkState->ArgTypes, &WalkState->ArgCount);
} while (*Op);
#if 0
/*
* TBD: Cleanup parse ops on error
*/
if (*Op == NULL)
{
AcpiPsPopScope (ParserState, Op,
&WalkState->ArgTypes, &WalkState->ArgCount);
}
#endif
WalkState->PrevOp = NULL;
WalkState->PrevArgTypes = WalkState->ArgTypes;
return_ACPI_STATUS (Status);
}
/* This scope complete? */
if (AcpiPsHasCompletedScope (&(WalkState->ParserState)))
{
AcpiPsPopScope (&(WalkState->ParserState), Op,
&WalkState->ArgTypes, &WalkState->ArgCount);
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", *Op));
}
else
{
*Op = NULL;
}
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiPsCompleteFinalOp
*
* PARAMETERS: WalkState - Current state
* Op - Current Op
* Status - Current parse status before complete last
* Op
*
* RETURN: Status
*
* DESCRIPTION: Complete last Op.
*
******************************************************************************/
static ACPI_STATUS
AcpiPsCompleteFinalOp (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op,
ACPI_STATUS Status)
{
ACPI_STATUS Status2;
ACPI_FUNCTION_TRACE_PTR (PsCompleteFinalOp, WalkState);
/*
* Complete the last Op (if not completed), and clear the scope stack.
* It is easily possible to end an AML "package" with an unbounded number
* of open scopes (such as when several ASL blocks are closed with
* sequential closing braces). We want to terminate each one cleanly.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "AML package complete at Op %p\n", Op));
do
{
if (Op)
{
if (WalkState->AscendingCallback != NULL)
{
WalkState->Op = Op;
WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
WalkState->Opcode = Op->Common.AmlOpcode;
Status = WalkState->AscendingCallback (WalkState);
Status = AcpiPsNextParseState (WalkState, Op, Status);
if (Status == AE_CTRL_PENDING)
{
Status = AcpiPsCompleteOp (WalkState, &Op, AE_OK);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
if (Status == AE_CTRL_TERMINATE)
{
Status = AE_OK;
/* Clean up */
do
{
if (Op)
{
Status2 = AcpiPsCompleteThisOp (WalkState, Op);
if (ACPI_FAILURE (Status2))
{
return_ACPI_STATUS (Status2);
}
}
AcpiPsPopScope (&(WalkState->ParserState), &Op,
&WalkState->ArgTypes, &WalkState->ArgCount);
} while (Op);
return_ACPI_STATUS (Status);
}
else if (ACPI_FAILURE (Status))
{
/* First error is most important */
(void) AcpiPsCompleteThisOp (WalkState, Op);
return_ACPI_STATUS (Status);
}
}
Status2 = AcpiPsCompleteThisOp (WalkState, Op);
if (ACPI_FAILURE (Status2))
{
return_ACPI_STATUS (Status2);
}
}
AcpiPsPopScope (&(WalkState->ParserState), &Op, &WalkState->ArgTypes,
&WalkState->ArgCount);
} while (Op);
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiPsParseLoop
@ -1297,11 +639,6 @@ AcpiPsParseLoop (
WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
if (WalkState->OpInfo->Flags & AML_NAMED)
{
if (AcpiGbl_Depth)
{
AcpiGbl_Depth--;
}
if (Op->Common.AmlOpcode == AML_REGION_OP ||
Op->Common.AmlOpcode == AML_DATA_REGION_OP)
{

View File

@ -0,0 +1,751 @@
/******************************************************************************
*
* Module Name: psobject - Support for parse objects
*
*****************************************************************************/
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
* rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
* copy of the source code appearing in this file ("Covered Code") an
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
* base code distributed originally by Intel ("Original Intel Code") to copy,
* make derivatives, distribute, use and display any portion of the Covered
* Code in any form, with the right to sublicense such rights; and
*
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
* license (with the right to sublicense), under only those claims of Intel
* patents that are infringed by the Original Intel Code, to make, use, sell,
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
* to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
* documentation and/or other materials provided with distribution. In
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* property embodied in the software Licensee provides to its licensee, and
* not to intellectual property embodied in modifications its licensee may
* make.
*
* 3.3. Redistribution of Executable. Redistribution in executable form of any
* substantial portion of the Covered Code or modification must reproduce the
* above Copyright Notice, and the following Disclaimer and Export Compliance
* provision in the documentation and/or other materials provided with the
* distribution.
*
* 3.4. Intel retains all right, title, and interest in and to the Original
* Intel Code.
*
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
* Intel shall be used in advertising or otherwise to promote the sale, use or
* other dealings in products derived from or relating to the Covered Code
* without prior written authorization from Intel.
*
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
* any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* ensure that the distribution and export/re-export of the software is in
* compliance with all laws, regulations, orders, or other restrictions of the
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
* any of its subsidiaries will export/re-export any technical data, process,
* software, or service, directly or indirectly, to any country for which the
* United States government or any agency thereof requires an export license,
* other governmental approval, or letter of assurance, without first obtaining
* such license, approval or letter.
*
*****************************************************************************/
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "amlcode.h"
#define _COMPONENT ACPI_PARSER
ACPI_MODULE_NAME ("psobject")
/* Local prototypes */
static ACPI_STATUS
AcpiPsGetAmlOpcode (
ACPI_WALK_STATE *WalkState);
/*******************************************************************************
*
* FUNCTION: AcpiPsGetAmlOpcode
*
* PARAMETERS: WalkState - Current state
*
* RETURN: Status
*
* DESCRIPTION: Extract the next AML opcode from the input stream.
*
******************************************************************************/
static ACPI_STATUS
AcpiPsGetAmlOpcode (
ACPI_WALK_STATE *WalkState)
{
ACPI_FUNCTION_TRACE_PTR (PsGetAmlOpcode, WalkState);
WalkState->AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->ParserState.Aml,
WalkState->ParserState.AmlStart);
WalkState->Opcode = AcpiPsPeekOpcode (&(WalkState->ParserState));
/*
* First cut to determine what we have found:
* 1) A valid AML opcode
* 2) A name string
* 3) An unknown/invalid opcode
*/
WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode);
switch (WalkState->OpInfo->Class)
{
case AML_CLASS_ASCII:
case AML_CLASS_PREFIX:
/*
* Starts with a valid prefix or ASCII char, this is a name
* string. Convert the bare name string to a namepath.
*/
WalkState->Opcode = AML_INT_NAMEPATH_OP;
WalkState->ArgTypes = ARGP_NAMESTRING;
break;
case AML_CLASS_UNKNOWN:
/* The opcode is unrecognized. Complain and skip unknown opcodes */
if (WalkState->PassNumber == 2)
{
ACPI_ERROR ((AE_INFO,
"Unknown opcode 0x%.2X at table offset 0x%.4X, ignoring",
WalkState->Opcode,
(UINT32) (WalkState->AmlOffset + sizeof (ACPI_TABLE_HEADER))));
ACPI_DUMP_BUFFER ((WalkState->ParserState.Aml - 16), 48);
#ifdef ACPI_ASL_COMPILER
/*
* This is executed for the disassembler only. Output goes
* to the disassembled ASL output file.
*/
AcpiOsPrintf (
"/*\nError: Unknown opcode 0x%.2X at table offset 0x%.4X, context:\n",
WalkState->Opcode,
(UINT32) (WalkState->AmlOffset + sizeof (ACPI_TABLE_HEADER)));
/* Dump the context surrounding the invalid opcode */
AcpiUtDumpBuffer (((UINT8 *) WalkState->ParserState.Aml - 16),
48, DB_BYTE_DISPLAY,
(WalkState->AmlOffset + sizeof (ACPI_TABLE_HEADER) - 16));
AcpiOsPrintf (" */\n");
#endif
}
/* Increment past one-byte or two-byte opcode */
WalkState->ParserState.Aml++;
if (WalkState->Opcode > 0xFF) /* Can only happen if first byte is 0x5B */
{
WalkState->ParserState.Aml++;
}
return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE);
default:
/* Found opcode info, this is a normal opcode */
WalkState->ParserState.Aml += AcpiPsGetOpcodeSize (WalkState->Opcode);
WalkState->ArgTypes = WalkState->OpInfo->ParseArgs;
break;
}
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiPsBuildNamedOp
*
* PARAMETERS: WalkState - Current state
* AmlOpStart - Begin of named Op in AML
* UnnamedOp - Early Op (not a named Op)
* Op - Returned Op
*
* RETURN: Status
*
* DESCRIPTION: Parse a named Op
*
******************************************************************************/
ACPI_STATUS
AcpiPsBuildNamedOp (
ACPI_WALK_STATE *WalkState,
UINT8 *AmlOpStart,
ACPI_PARSE_OBJECT *UnnamedOp,
ACPI_PARSE_OBJECT **Op)
{
ACPI_STATUS Status = AE_OK;
ACPI_PARSE_OBJECT *Arg = NULL;
ACPI_FUNCTION_TRACE_PTR (PsBuildNamedOp, WalkState);
UnnamedOp->Common.Value.Arg = NULL;
UnnamedOp->Common.ArgListLength = 0;
UnnamedOp->Common.AmlOpcode = WalkState->Opcode;
/*
* Get and append arguments until we find the node that contains
* the name (the type ARGP_NAME).
*/
while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) &&
(GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) != ARGP_NAME))
{
Status = AcpiPsGetNextArg (WalkState, &(WalkState->ParserState),
GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
AcpiPsAppendArg (UnnamedOp, Arg);
INCREMENT_ARG_LIST (WalkState->ArgTypes);
}
/*
* Make sure that we found a NAME and didn't run out of arguments
*/
if (!GET_CURRENT_ARG_TYPE (WalkState->ArgTypes))
{
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
/* We know that this arg is a name, move to next arg */
INCREMENT_ARG_LIST (WalkState->ArgTypes);
/*
* Find the object. This will either insert the object into
* the namespace or simply look it up
*/
WalkState->Op = NULL;
Status = WalkState->DescendingCallback (WalkState, Op);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status, "During name lookup/catalog"));
return_ACPI_STATUS (Status);
}
if (!*Op)
{
return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE);
}
Status = AcpiPsNextParseState (WalkState, *Op, Status);
if (ACPI_FAILURE (Status))
{
if (Status == AE_CTRL_PENDING)
{
return_ACPI_STATUS (AE_CTRL_PARSE_PENDING);
}
return_ACPI_STATUS (Status);
}
AcpiPsAppendArg (*Op, UnnamedOp->Common.Value.Arg);
if ((*Op)->Common.AmlOpcode == AML_REGION_OP ||
(*Op)->Common.AmlOpcode == AML_DATA_REGION_OP)
{
/*
* Defer final parsing of an OperationRegion body, because we don't
* have enough info in the first pass to parse it correctly (i.e.,
* there may be method calls within the TermArg elements of the body.)
*
* However, we must continue parsing because the opregion is not a
* standalone package -- we don't know where the end is at this point.
*
* (Length is unknown until parse of the body complete)
*/
(*Op)->Named.Data = AmlOpStart;
(*Op)->Named.Length = 0;
}
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiPsCreateOp
*
* PARAMETERS: WalkState - Current state
* AmlOpStart - Op start in AML
* NewOp - Returned Op
*
* RETURN: Status
*
* DESCRIPTION: Get Op from AML
*
******************************************************************************/
ACPI_STATUS
AcpiPsCreateOp (
ACPI_WALK_STATE *WalkState,
UINT8 *AmlOpStart,
ACPI_PARSE_OBJECT **NewOp)
{
ACPI_STATUS Status = AE_OK;
ACPI_PARSE_OBJECT *Op;
ACPI_PARSE_OBJECT *NamedOp = NULL;
ACPI_PARSE_OBJECT *ParentScope;
UINT8 ArgumentCount;
const ACPI_OPCODE_INFO *OpInfo;
ACPI_FUNCTION_TRACE_PTR (PsCreateOp, WalkState);
Status = AcpiPsGetAmlOpcode (WalkState);
if (Status == AE_CTRL_PARSE_CONTINUE)
{
return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE);
}
/* Create Op structure and append to parent's argument list */
WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode);
Op = AcpiPsAllocOp (WalkState->Opcode);
if (!Op)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
if (WalkState->OpInfo->Flags & AML_NAMED)
{
Status = AcpiPsBuildNamedOp (WalkState, AmlOpStart, Op, &NamedOp);
AcpiPsFreeOp (Op);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
*NewOp = NamedOp;
return_ACPI_STATUS (AE_OK);
}
/* Not a named opcode, just allocate Op and append to parent */
if (WalkState->OpInfo->Flags & AML_CREATE)
{
/*
* Backup to beginning of CreateXXXfield declaration
* BodyLength is unknown until we parse the body
*/
Op->Named.Data = AmlOpStart;
Op->Named.Length = 0;
}
if (WalkState->Opcode == AML_BANK_FIELD_OP)
{
/*
* Backup to beginning of BankField declaration
* BodyLength is unknown until we parse the body
*/
Op->Named.Data = AmlOpStart;
Op->Named.Length = 0;
}
ParentScope = AcpiPsGetParentScope (&(WalkState->ParserState));
AcpiPsAppendArg (ParentScope, Op);
if (ParentScope)
{
OpInfo = AcpiPsGetOpcodeInfo (ParentScope->Common.AmlOpcode);
if (OpInfo->Flags & AML_HAS_TARGET)
{
ArgumentCount = AcpiPsGetArgumentCount (OpInfo->Type);
if (ParentScope->Common.ArgListLength > ArgumentCount)
{
Op->Common.Flags |= ACPI_PARSEOP_TARGET;
}
}
else if (ParentScope->Common.AmlOpcode == AML_INCREMENT_OP)
{
Op->Common.Flags |= ACPI_PARSEOP_TARGET;
}
}
if (WalkState->DescendingCallback != NULL)
{
/*
* Find the object. This will either insert the object into
* the namespace or simply look it up
*/
WalkState->Op = *NewOp = Op;
Status = WalkState->DescendingCallback (WalkState, &Op);
Status = AcpiPsNextParseState (WalkState, Op, Status);
if (Status == AE_CTRL_PENDING)
{
Status = AE_CTRL_PARSE_PENDING;
}
}
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiPsCompleteOp
*
* PARAMETERS: WalkState - Current state
* Op - Returned Op
* Status - Parse status before complete Op
*
* RETURN: Status
*
* DESCRIPTION: Complete Op
*
******************************************************************************/
ACPI_STATUS
AcpiPsCompleteOp (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT **Op,
ACPI_STATUS Status)
{
ACPI_STATUS Status2;
ACPI_FUNCTION_TRACE_PTR (PsCompleteOp, WalkState);
/*
* Finished one argument of the containing scope
*/
WalkState->ParserState.Scope->ParseScope.ArgCount--;
/* Close this Op (will result in parse subtree deletion) */
Status2 = AcpiPsCompleteThisOp (WalkState, *Op);
if (ACPI_FAILURE (Status2))
{
return_ACPI_STATUS (Status2);
}
*Op = NULL;
switch (Status)
{
case AE_OK:
break;
case AE_CTRL_TRANSFER:
/* We are about to transfer to a called method */
WalkState->PrevOp = NULL;
WalkState->PrevArgTypes = WalkState->ArgTypes;
return_ACPI_STATUS (Status);
case AE_CTRL_END:
AcpiPsPopScope (&(WalkState->ParserState), Op,
&WalkState->ArgTypes, &WalkState->ArgCount);
if (*Op)
{
WalkState->Op = *Op;
WalkState->OpInfo = AcpiPsGetOpcodeInfo ((*Op)->Common.AmlOpcode);
WalkState->Opcode = (*Op)->Common.AmlOpcode;
Status = WalkState->AscendingCallback (WalkState);
Status = AcpiPsNextParseState (WalkState, *Op, Status);
Status2 = AcpiPsCompleteThisOp (WalkState, *Op);
if (ACPI_FAILURE (Status2))
{
return_ACPI_STATUS (Status2);
}
}
Status = AE_OK;
break;
case AE_CTRL_BREAK:
case AE_CTRL_CONTINUE:
/* Pop off scopes until we find the While */
while (!(*Op) || ((*Op)->Common.AmlOpcode != AML_WHILE_OP))
{
AcpiPsPopScope (&(WalkState->ParserState), Op,
&WalkState->ArgTypes, &WalkState->ArgCount);
}
/* Close this iteration of the While loop */
WalkState->Op = *Op;
WalkState->OpInfo = AcpiPsGetOpcodeInfo ((*Op)->Common.AmlOpcode);
WalkState->Opcode = (*Op)->Common.AmlOpcode;
Status = WalkState->AscendingCallback (WalkState);
Status = AcpiPsNextParseState (WalkState, *Op, Status);
Status2 = AcpiPsCompleteThisOp (WalkState, *Op);
if (ACPI_FAILURE (Status2))
{
return_ACPI_STATUS (Status2);
}
Status = AE_OK;
break;
case AE_CTRL_TERMINATE:
/* Clean up */
do
{
if (*Op)
{
Status2 = AcpiPsCompleteThisOp (WalkState, *Op);
if (ACPI_FAILURE (Status2))
{
return_ACPI_STATUS (Status2);
}
AcpiUtDeleteGenericState (
AcpiUtPopGenericState (&WalkState->ControlState));
}
AcpiPsPopScope (&(WalkState->ParserState), Op,
&WalkState->ArgTypes, &WalkState->ArgCount);
} while (*Op);
return_ACPI_STATUS (AE_OK);
default: /* All other non-AE_OK status */
do
{
if (*Op)
{
Status2 = AcpiPsCompleteThisOp (WalkState, *Op);
if (ACPI_FAILURE (Status2))
{
return_ACPI_STATUS (Status2);
}
}
AcpiPsPopScope (&(WalkState->ParserState), Op,
&WalkState->ArgTypes, &WalkState->ArgCount);
} while (*Op);
#if 0
/*
* TBD: Cleanup parse ops on error
*/
if (*Op == NULL)
{
AcpiPsPopScope (ParserState, Op,
&WalkState->ArgTypes, &WalkState->ArgCount);
}
#endif
WalkState->PrevOp = NULL;
WalkState->PrevArgTypes = WalkState->ArgTypes;
return_ACPI_STATUS (Status);
}
/* This scope complete? */
if (AcpiPsHasCompletedScope (&(WalkState->ParserState)))
{
AcpiPsPopScope (&(WalkState->ParserState), Op,
&WalkState->ArgTypes, &WalkState->ArgCount);
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", *Op));
}
else
{
*Op = NULL;
}
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiPsCompleteFinalOp
*
* PARAMETERS: WalkState - Current state
* Op - Current Op
* Status - Current parse status before complete last
* Op
*
* RETURN: Status
*
* DESCRIPTION: Complete last Op.
*
******************************************************************************/
ACPI_STATUS
AcpiPsCompleteFinalOp (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op,
ACPI_STATUS Status)
{
ACPI_STATUS Status2;
ACPI_FUNCTION_TRACE_PTR (PsCompleteFinalOp, WalkState);
/*
* Complete the last Op (if not completed), and clear the scope stack.
* It is easily possible to end an AML "package" with an unbounded number
* of open scopes (such as when several ASL blocks are closed with
* sequential closing braces). We want to terminate each one cleanly.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "AML package complete at Op %p\n", Op));
do
{
if (Op)
{
if (WalkState->AscendingCallback != NULL)
{
WalkState->Op = Op;
WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
WalkState->Opcode = Op->Common.AmlOpcode;
Status = WalkState->AscendingCallback (WalkState);
Status = AcpiPsNextParseState (WalkState, Op, Status);
if (Status == AE_CTRL_PENDING)
{
Status = AcpiPsCompleteOp (WalkState, &Op, AE_OK);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
if (Status == AE_CTRL_TERMINATE)
{
Status = AE_OK;
/* Clean up */
do
{
if (Op)
{
Status2 = AcpiPsCompleteThisOp (WalkState, Op);
if (ACPI_FAILURE (Status2))
{
return_ACPI_STATUS (Status2);
}
}
AcpiPsPopScope (&(WalkState->ParserState), &Op,
&WalkState->ArgTypes, &WalkState->ArgCount);
} while (Op);
return_ACPI_STATUS (Status);
}
else if (ACPI_FAILURE (Status))
{
/* First error is most important */
(void) AcpiPsCompleteThisOp (WalkState, Op);
return_ACPI_STATUS (Status);
}
}
Status2 = AcpiPsCompleteThisOp (WalkState, Op);
if (ACPI_FAILURE (Status2))
{
return_ACPI_STATUS (Status2);
}
}
AcpiPsPopScope (&(WalkState->ParserState), &Op, &WalkState->ArgTypes,
&WalkState->ArgCount);
} while (Op);
return_ACPI_STATUS (Status);
}

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2012, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
* All rights reserved.
*
* 2. License
@ -116,7 +116,6 @@
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "acopcode.h"
#include "amlcode.h"
@ -125,9 +124,6 @@
ACPI_MODULE_NAME ("psopcode")
static const UINT8 AcpiGbl_ArgumentCount[] = {0,1,1,1,1,2,2,2,2,3,3,6};
/*******************************************************************************
*
* NAME: AcpiGbl_AmlOpInfo
@ -414,181 +410,3 @@ const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES] =
/*! [End] no source code translation !*/
};
/*
* This table is directly indexed by the opcodes, and returns an
* index into the table above
*/
static const UINT8 AcpiGbl_ShortOpIndex[256] =
{
/* 0 1 2 3 4 5 6 7 */
/* 8 9 A B C D E F */
/* 0x00 */ 0x00, 0x01, _UNK, _UNK, _UNK, _UNK, 0x02, _UNK,
/* 0x08 */ 0x03, _UNK, 0x04, 0x05, 0x06, 0x07, 0x6E, _UNK,
/* 0x10 */ 0x08, 0x09, 0x0a, 0x6F, 0x0b, _UNK, _UNK, _UNK,
/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0x20 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0x28 */ _UNK, _UNK, _UNK, _UNK, _UNK, 0x63, _PFX, _PFX,
/* 0x30 */ 0x67, 0x66, 0x68, 0x65, 0x69, 0x64, 0x6A, 0x7D,
/* 0x38 */ 0x7F, 0x80, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0x40 */ _UNK, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
/* 0x48 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
/* 0x50 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
/* 0x58 */ _ASC, _ASC, _ASC, _UNK, _PFX, _UNK, _PFX, _ASC,
/* 0x60 */ 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13,
/* 0x68 */ 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, _UNK,
/* 0x70 */ 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22,
/* 0x78 */ 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a,
/* 0x80 */ 0x2b, 0x2c, 0x2d, 0x2e, 0x70, 0x71, 0x2f, 0x30,
/* 0x88 */ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x72,
/* 0x90 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x73, 0x74,
/* 0x98 */ 0x75, 0x76, _UNK, _UNK, 0x77, 0x78, 0x79, 0x7A,
/* 0xA0 */ 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x60, 0x61,
/* 0xA8 */ 0x62, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0xB0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0xB8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0xC0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0xC8 */ _UNK, _UNK, _UNK, _UNK, 0x44, _UNK, _UNK, _UNK,
/* 0xD0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0xD8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0xE0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0xE8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0xF0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0xF8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x45,
};
/*
* This table is indexed by the second opcode of the extended opcode
* pair. It returns an index into the opcode table (AcpiGbl_AmlOpInfo)
*/
static const UINT8 AcpiGbl_LongOpIndex[NUM_EXTENDED_OPCODE] =
{
/* 0 1 2 3 4 5 6 7 */
/* 8 9 A B C D E F */
/* 0x00 */ _UNK, 0x46, 0x47, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0x08 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0x10 */ _UNK, _UNK, 0x48, 0x49, _UNK, _UNK, _UNK, _UNK,
/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x7B,
/* 0x20 */ 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51,
/* 0x28 */ 0x52, 0x53, 0x54, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0x30 */ 0x55, 0x56, 0x57, 0x7e, _UNK, _UNK, _UNK, _UNK,
/* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0x40 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0x48 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0x50 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0x58 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0x60 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0x68 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0x70 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0x78 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
/* 0x80 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
/* 0x88 */ 0x7C,
};
/*******************************************************************************
*
* FUNCTION: AcpiPsGetOpcodeInfo
*
* PARAMETERS: Opcode - The AML opcode
*
* RETURN: A pointer to the info about the opcode.
*
* DESCRIPTION: Find AML opcode description based on the opcode.
* NOTE: This procedure must ALWAYS return a valid pointer!
*
******************************************************************************/
const ACPI_OPCODE_INFO *
AcpiPsGetOpcodeInfo (
UINT16 Opcode)
{
ACPI_FUNCTION_NAME (PsGetOpcodeInfo);
/*
* Detect normal 8-bit opcode or extended 16-bit opcode
*/
if (!(Opcode & 0xFF00))
{
/* Simple (8-bit) opcode: 0-255, can't index beyond table */
return (&AcpiGbl_AmlOpInfo [AcpiGbl_ShortOpIndex [(UINT8) Opcode]]);
}
if (((Opcode & 0xFF00) == AML_EXTENDED_OPCODE) &&
(((UINT8) Opcode) <= MAX_EXTENDED_OPCODE))
{
/* Valid extended (16-bit) opcode */
return (&AcpiGbl_AmlOpInfo [AcpiGbl_LongOpIndex [(UINT8) Opcode]]);
}
/* Unknown AML opcode */
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Unknown AML opcode [%4.4X]\n", Opcode));
return (&AcpiGbl_AmlOpInfo [_UNK]);
}
/*******************************************************************************
*
* FUNCTION: AcpiPsGetOpcodeName
*
* PARAMETERS: Opcode - The AML opcode
*
* RETURN: A pointer to the name of the opcode (ASCII String)
* Note: Never returns NULL.
*
* DESCRIPTION: Translate an opcode into a human-readable string
*
******************************************************************************/
char *
AcpiPsGetOpcodeName (
UINT16 Opcode)
{
#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)
const ACPI_OPCODE_INFO *Op;
Op = AcpiPsGetOpcodeInfo (Opcode);
/* Always guaranteed to return a valid pointer */
return (Op->Name);
#else
return ("OpcodeName unavailable");
#endif
}
/*******************************************************************************
*
* FUNCTION: AcpiPsGetArgumentCount
*
* PARAMETERS: OpType - Type associated with the AML opcode
*
* RETURN: Argument count
*
* DESCRIPTION: Obtain the number of expected arguments for an AML opcode
*
******************************************************************************/
UINT8
AcpiPsGetArgumentCount (
UINT32 OpType)
{
if (OpType <= AML_TYPE_EXEC_6A_0T_1R)
{
return (AcpiGbl_ArgumentCount[OpType]);
}
return (0);
}

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