Update to opcode names and typenames for fields

date	2001.03.30.18.15.00;	author rmoore1;	state Exp;
This commit is contained in:
aystarik 2005-06-29 15:59:01 +00:00
parent 76a83281fa
commit a1530335a7
5 changed files with 978 additions and 966 deletions

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: asllisting - Listing file generation
* $Revision: 1.1 $
* $Revision: 1.17 $
*
*****************************************************************************/
@ -10,8 +10,8 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
* reserved.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
*
@ -116,112 +116,229 @@
*****************************************************************************/
#include "AslCompiler.h"
#include "AslCompiler.y.h"
#include "aslcompiler.h"
#include "aslcompiler.y.h"
#include "aslresource.h"
#include "amlcode.h"
#include "acparser.h"
UINT32 HexColumn = 0;
UINT32 AmlOffset = 0;
UINT32 Gbl_CurrentLine = 0;
UINT8 Gbl_AmlBuffer[16];
#define _COMPONENT ACPI_COMPILER
MODULE_NAME ("aslisting")
/*******************************************************************************
*
* FUNCTION:
* FUNCTION: LsPushNode
*
* PARAMETERS:
* PARAMETERS: Filename - Pointer to the include filename
*
* RETURN:
* RETURN: None
*
* DESCRIPTION:
* DESCRIPTION: Push a listing node on the listing/include file stack. This
* stack enables tracking of include files (infinitely nested)
* and resumption of the listing of the parent file when the
* include file is finished.
*
******************************************************************************/
void
CgCheckException (
UINT32 LineNumber)
LsPushNode (
char *Filename)
{
ASL_LISTING_NODE *Lnode;
if ((!AslGbl_NextError) ||
(LineNumber < AslGbl_NextError->LogicalLineNumber ))
if (!Gbl_ListingOutputFile)
{
return;
}
fprintf (Gbl_ListingFile, "[****AslException****]\n");
AePrintException (Gbl_ListingFile, AslGbl_NextError);
AslGbl_NextError = AslGbl_NextError->Next;
fprintf (Gbl_ListingFile, "\n");
/* Create a new node */
Lnode = UtLocalCalloc (sizeof (ASL_LISTING_NODE));
/* Initialize */
Lnode->Filename = Filename;
Lnode->LineNumber = 0;
/* Link (push) */
Lnode->Next = Gbl_ListingNode;
Gbl_ListingNode = Lnode;
}
/*******************************************************************************
*
* FUNCTION:
* FUNCTION: LsPopNode
*
* PARAMETERS:
* PARAMETERS: None
*
* RETURN:
* RETURN: List head after current head is popped off
*
* DESCRIPTION:
* DESCRIPTION: Pop the current head of the list, free it, and return the
* next node on the stack (the new current node).
*
******************************************************************************/
ASL_LISTING_NODE *
LsPopNode (void)
{
ASL_LISTING_NODE *Lnode;
if (!Gbl_ListingOutputFile)
{
return Gbl_ListingNode;
}
/* Just grab the node at the head of the list */
Lnode = Gbl_ListingNode;
if ((!Lnode) ||
(!Lnode->Next))
{
AslError (ASL_ERROR, ASL_MSG_INTERNAL, NULL, "Could not pop empty listing stack");
return Gbl_ListingNode;
}
Gbl_ListingNode = Lnode->Next;
AcpiCmFree (Lnode);
/* New "Current" node is the new head */
return (Gbl_ListingNode);
}
/*******************************************************************************
*
* FUNCTION: LsCheckException
*
* PARAMETERS: LineNumber - Current logical (cumulative) line #
*
* RETURN: None
*
* DESCRIPTION: Check if there is an exception for this line, and if there is,
* put it in the listing immediately. Handles multiple errors
* per line. Gbl_NextError points to the next error in the
* sorted (by line #) list of compile errors/warnings.
*
******************************************************************************/
void
CgFlushListingBuffer (void)
LsCheckException (
UINT32 LineNumber)
{
if ((!Gbl_NextError) ||
(LineNumber < Gbl_NextError->LogicalLineNumber ))
{
return;
}
/* Handle multiple errors per line */
while (Gbl_NextError &&
(LineNumber >= Gbl_NextError->LogicalLineNumber))
{
fprintf (Gbl_ListingOutputFile, "\n[****AslException****]\n");
AePrintException (Gbl_ListingOutputFile, Gbl_NextError);
Gbl_NextError = Gbl_NextError->Next;
}
fprintf (Gbl_ListingOutputFile, "\n");
}
/*******************************************************************************
*
* FUNCTION: LsFlushListingBuffer
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Flush out the current contents of the 16-byte hex AML code
* buffer. Usually called at the termination of a single line
* of source code or when the buffer is full.
*
******************************************************************************/
void
LsFlushListingBuffer (void)
{
UINT32 i;
UINT8 BufChar;
for (i = 0; i < HexColumn; i++)
if (Gbl_CurrentHexColumn == 0)
{
fwrite (&hex[Gbl_AmlBuffer[i] >> 4], 1, 1, Gbl_ListingFile);
fwrite (&hex[Gbl_AmlBuffer[i] & 0xF], 1, 1, Gbl_ListingFile);
fprintf (Gbl_ListingFile, " ");
return;
}
fprintf (Gbl_ListingFile, " %*s", ((16 - HexColumn) * 3) + 1, " ");
for (i = 0; i < HexColumn; i++)
/* Write the hex bytes */
for (i = 0; i < Gbl_CurrentHexColumn; i++)
{
fwrite (&hex[Gbl_AmlBuffer[i] >> 4], 1, 1, Gbl_ListingOutputFile);
fwrite (&hex[Gbl_AmlBuffer[i] & 0xF], 1, 1, Gbl_ListingOutputFile);
fprintf (Gbl_ListingOutputFile, " ");
}
for (i = 0; i < ((16 - Gbl_CurrentHexColumn) * 3); i++)
{
fprintf (Gbl_ListingOutputFile, ".");
}
fprintf (Gbl_ListingOutputFile, " ");
/* Write the ASCII character associated with each of the bytes */
for (i = 0; i < Gbl_CurrentHexColumn; i++)
{
BufChar = Gbl_AmlBuffer[i];
if ((BufChar > 0x1F && BufChar < 0x2E) ||
(BufChar > 0x2F && BufChar < 0x61) ||
(BufChar > 0x60 && BufChar < 0x7F))
{
fprintf (Gbl_ListingFile, "%c", BufChar);
fprintf (Gbl_ListingOutputFile, "%c", BufChar);
}
else
{
fprintf (Gbl_ListingFile, ".");
fprintf (Gbl_ListingOutputFile, ".");
}
}
HexColumn = 0;
fprintf (Gbl_ListingOutputFile, "\n");
Gbl_CurrentHexColumn = 0;
Gbl_HexBytesWereWritten = TRUE;
}
/*******************************************************************************
*
* FUNCTION:
* FUNCTION: LsWriteListingHexBytes
*
* PARAMETERS:
* PARAMETERS: Buffer - AML code buffer
* Length - Number of AML bytes to write
*
* RETURN:
* RETURN: None
*
* DESCRIPTION:
* DESCRIPTION: Write the contents of the AML buffer to the listing file via
* the listing buffer. The listing buffer is flushed every 16
* AML bytes.
*
******************************************************************************/
void
LsWriteListingHexBytes (
char *Buffer,
@ -231,43 +348,218 @@ LsWriteListingHexBytes (
UINT8 *CharBuffer = (UINT8 *) Buffer;
/* Are we in listing mode? */
if (!Gbl_ListingFlag)
{
return;
}
/* Transfer all requested bytes */
for (i = 0; i < Length; i++)
{
if (HexColumn == 0)
/* Print line header when buffer is empty */
if (Gbl_CurrentHexColumn == 0)
{
fprintf (Gbl_ListingFile, "%8.8X:....", AmlOffset);
if (Gbl_HasIncludeFiles)
{
fprintf (Gbl_ListingOutputFile, "%*s", 10, " ");
}
fprintf (Gbl_ListingOutputFile, "%8.8X....", Gbl_CurrentAmlOffset);
}
Gbl_AmlBuffer[HexColumn] = Buffer[i];
/* Transfer AML byte and update counts */
HexColumn++;
AmlOffset++;
Gbl_AmlBuffer[Gbl_CurrentHexColumn] = Buffer[i];
if (HexColumn >= 16)
Gbl_CurrentHexColumn++;
Gbl_CurrentAmlOffset++;
/* Flush buffer when it is full */
if (Gbl_CurrentHexColumn >= 16)
{
CgFlushListingBuffer ();
fwrite ("\n", 1, 1, Gbl_ListingFile);
LsFlushListingBuffer ();
}
}
}
/*******************************************************************************
*
* FUNCTION: LsWriteOneSourceLine
*
* PARAMETERS: None
*
* RETURN: FALSE on EOF (input source file), TRUE otherwise
*
* DESCRIPTION: Read one line from the input source file and echo it to the
* listing file, prefixed with the line number, and if the source
* file contains include files, prefixed with the current filename
*
******************************************************************************/
UINT32
LsWriteOneSourceLine (void)
{
UINT8 FileByte;
Gbl_SourceLine++;
Gbl_ListingNode->LineNumber++;
if (Gbl_HasIncludeFiles)
{
/*
* This file contains "include" statements, print the current
* filename and line number within the current file
*/
fprintf (Gbl_ListingOutputFile, "%12s %5d....",
Gbl_ListingNode->Filename, Gbl_ListingNode->LineNumber);
}
else
{
/* No include files, just print the line number */
fprintf (Gbl_ListingOutputFile, "%8d....", Gbl_SourceLine);
}
/* Read one line (up to a newline or EOF) */
while (fread (&FileByte, 1, 1, Gbl_SourceOutputFile))
{
fwrite (&FileByte, 1, 1, Gbl_ListingOutputFile);
DbgPrint (ASL_PARSE_OUTPUT, "%c", FileByte);
if (FileByte == '\n')
{
/*
* Check if an error occurred on this source line during the compile.
* If so, we print the error message after the source line.
*/
LsCheckException (Gbl_SourceLine);
return (1);
}
}
/* EOF on the input file was reached */
return (0);
}
/*******************************************************************************
*
* FUNCTION:
* FUNCTION: LsFinishSourceListing
*
* PARAMETERS:
* PARAMETERS: None
*
* RETURN:
* RETURN: None
*
* DESCRIPTION:
* DESCRIPTION: Cleanup routine for the listing file. Flush the hex AML
* listing buffer, and flush out any remaining lines in the
* source input file.
*
******************************************************************************/
void
LsFinishSourceListing (void)
{
UINT32 Actual = 1;
if (!Gbl_ListingFlag)
{
return;
}
LsFlushListingBuffer ();
Gbl_CurrentAmlOffset = 0;
/* Flush any remaining text in the source file */
while (LsWriteOneSourceLine ())
{ ; }
}
/*******************************************************************************
*
* FUNCTION: LsWriteSourceLines
*
* PARAMETERS: ToLineNumber
* ToLogicalLineNumber
*
* RETURN: None
*
* DESCRIPTION: Read then write source lines to the listing file until we have
* reached the specified logical (cumulative) line number. This
* automatically echos out comment blocks and other non-AML
* generating text until we get to the actual AML-generating line
* of ASL code specified by the logical line number.
*
******************************************************************************/
void
LsWriteSourceLines (
UINT32 ToLineNumber,
UINT32 ToLogicalLineNumber)
{
Gbl_CurrentLine = ToLogicalLineNumber;
/* Flush any hex bytes remaining from the last opcode */
LsFlushListingBuffer ();
/*
* Read lines and write them as long as we are not caught up
*/
if (Gbl_SourceLine < Gbl_CurrentLine)
{
/*
* If we just completed writing some AML hex bytes, output a linefeed
* to add some whitespace for readability.
*/
if (Gbl_HexBytesWereWritten)
{
fprintf (Gbl_ListingOutputFile, "\n");
Gbl_HexBytesWereWritten = FALSE;
}
/*
* Write one line at a time until we have reached the target line #
*/
while ((Gbl_SourceLine < Gbl_CurrentLine) &&
LsWriteOneSourceLine ())
{ ; }
fprintf (Gbl_ListingOutputFile, "\n");
}
}
/*******************************************************************************
*
* FUNCTION: LsWriteNodeToListing
*
* PARAMETERS: Node - Parse node to write to the listing file.
*
* RETURN: None.
*
* DESCRIPTION: Write "a node" to the listing file. This means to
* 1) Write out all of the source text associated with the node
* 2) Write out all of the AML bytes associated with the node
* 3) Write any compiler exceptions associated with the node
*
******************************************************************************/
@ -277,9 +569,6 @@ LsWriteNodeToListing (
{
ACPI_OPCODE_INFO *OpInfo;
UINT8 Optype;
char FileByte;
ASL_PARSE_NODE *Next;
UINT32 i;
if (!Gbl_ListingFlag)
@ -287,46 +576,55 @@ LsWriteNodeToListing (
return;
}
OpInfo = AcpiPsGetOpcodeInfo (Node->AmlOpcode);
Optype = (UINT8) ACPI_GET_OP_CLASS (OpInfo);
/* These cases do not have a corresponding AML opcode */
switch (Node->ParseOpcode)
{
case DEFINITIONBLOCK:
CgFlushListingBuffer ();
// fprintf (Gbl_ListingFile, "NodeName %8s, Line %d\n", Node->ParseOpName, Node->LineNumber);
Next = Node->Child;
for (i = 0; i < 6; i++)
{
Gbl_CurrentLine = Next->LogicalLineNumber;
// fprintf (Gbl_ListingFile, "ChildName %8s, Line %d\n", Next->ParseOpName, Next->LineNumber);
Next = Next->Peer;
}
if (Gbl_SourceLine < Gbl_CurrentLine)
fprintf (Gbl_ListingFile, "\n\n");
while (Gbl_SourceLine < Gbl_CurrentLine)
{
Gbl_SourceLine++;
fprintf (Gbl_ListingFile, "%5d....", Gbl_SourceLine);
while (fread (&FileByte, 1, 1, Gbl_SourceOutputFile))
{
fwrite (&FileByte, 1, 1, Gbl_ListingFile);
if (FileByte == '\n')
break;
}
}
fprintf (Gbl_ListingFile, "\n");
CgCheckException (Gbl_CurrentLine);
LsWriteSourceLines (Node->EndLine, Node->EndLogicalLine);
return;
case METHODCALL:
LsWriteSourceLines (Node->LineNumber, Node->LogicalLineNumber);
return;
case INCLUDE:
/*
* Flush everything up to and including the include source line
*/
LsWriteSourceLines (Node->LineNumber, Node->LogicalLineNumber);
/*
* Create a new listing node and push it
*/
LsPushNode (Node->Child->Value.String);
return;
case INCLUDE_END:
/*
* Flush out the rest of the include file
*/
LsWriteSourceLines (Node->LineNumber, Node->LogicalLineNumber);
/*
* Pop off this listing node and go back to the parent file
*/
LsPopNode ();
return;
break;
}
/*
* Otherwise, we look at the AML opcode because we can
* switch on the opcode type, getting an entire class
* at once
*/
OpInfo = AcpiPsGetOpcodeInfo (Node->AmlOpcode);
Optype = (UINT8) ACPI_GET_OP_CLASS (OpInfo);
switch (Optype)
{
case OPTYPE_BOGUS:
@ -336,46 +634,121 @@ LsWriteNodeToListing (
case OPTYPE_LOCAL_VARIABLE: /* argument type only */
case OPTYPE_METHOD_ARGUMENT: /* argument type only */
// fprintf (Gbl_ListingFile, "NodeName %8s, Line %d\n", Node->ParseOpName, Node->LineNumber);
if (Node->LogicalLineNumber > Gbl_CurrentLine)
break;
case OPTYPE_NAMED_OBJECT:
switch (Node->AmlOpcode)
{
Gbl_CurrentLine = Node->LogicalLineNumber;
/* For fields, we want to dump all the AML after the entire definition */
case AML_FIELD_OP:
case AML_INDEX_FIELD_OP:
case AML_BANK_FIELD_OP:
case AML_NAME_OP:
LsWriteSourceLines (Node->EndLine, Node->EndLogicalLine);
break;
default:
LsWriteSourceLines (Node->LineNumber, Node->LogicalLineNumber);
break;
}
break;
case OPTYPE_UNDEFINED:
default:
CgFlushListingBuffer ();
// fprintf (Gbl_ListingFile, "NodeName %8s, Line %d\n", Node->ParseOpName, Node->LineNumber);
if (Node->Child)
{
Gbl_CurrentLine = Node->Child->LogicalLineNumber;
// fprintf (Gbl_ListingFile, "ChildName %8s, Line %d\n", Node->Child->ParseOpName, Node->Child->LineNumber);
}
if (Gbl_SourceLine < Gbl_CurrentLine)
fprintf (Gbl_ListingFile, "\n\n");
while (Gbl_SourceLine < Gbl_CurrentLine)
{
Gbl_SourceLine++;
fprintf (Gbl_ListingFile, "%5d....", Gbl_SourceLine);
while (fread (&FileByte, 1, 1, Gbl_SourceOutputFile))
{
fwrite (&FileByte, 1, 1, Gbl_ListingFile);
if (FileByte == '\n')
break;
}
}
fprintf (Gbl_ListingFile, "\n");
CgCheckException (Gbl_CurrentLine);
LsWriteSourceLines (Node->LineNumber, Node->LogicalLineNumber);
break;
}
}
/*******************************************************************************
*
* FUNCTION: LsDoHexOutput
*
* PARAMETERS: None
*
* RETURN: None.
*
* DESCRIPTION: Create the hex output file. This is the same data as the AML
* output file, but formatted into hex/ascii bytes suitable for
* inclusion into a C source file.
*
******************************************************************************/
#define HEX_CHARS_PER_LINE 16
void
LsDoHexOutput (void)
{
UINT32 j;
UINT8 BufChar;
UINT8 FileByte[HEX_CHARS_PER_LINE];
UINT8 Buffer[4];
if (!Gbl_HexOutputFlag)
{
return;
}
/* Start at the beginning of the AML file */
fseek (Gbl_AmlOutputFile, 0, SEEK_SET);
/* Process all AML bytes in the AML file */
j = 0;
while (fread (&FileByte[j], 1, 1, Gbl_AmlOutputFile))
{
/*
* Convert each AML byte to hex
*/
UtConvertByteToHex (FileByte[j], Buffer);
fwrite (Buffer, 4, 1, Gbl_HexOutputFile);
fprintf (Gbl_HexOutputFile, ",");
/* An occasional linefeed improves readability */
j++;
if (j >= HEX_CHARS_PER_LINE)
{
fprintf (Gbl_HexOutputFile, " /* ");
/* Write the ASCII character associated with each of the bytes */
for (j = 0; j < HEX_CHARS_PER_LINE; j++)
{
BufChar = FileByte[j];
if ((BufChar > 0x1F && BufChar < 0x2E) ||
(BufChar > 0x2F && BufChar < 0x61) ||
(BufChar > 0x60 && BufChar < 0x7F))
{
fprintf (Gbl_HexOutputFile, "%c", BufChar);
}
else
{
fprintf (Gbl_HexOutputFile, ".");
}
}
fprintf (Gbl_HexOutputFile, " */\n");
j = 0;
}
}
fprintf (Gbl_HexOutputFile, "\n");
fclose (Gbl_HexOutputFile);
}

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dswload - Dispatcher namespace load callbacks
* $Revision: 1.4 $
* $Revision: 1.22 $
*
*****************************************************************************/
@ -9,8 +9,8 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
* reserved.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
*
@ -114,7 +114,7 @@
*
*****************************************************************************/
#define __DSWLOAD_C__
#define __ASLLOAD_C__
#include "acpi.h"
#include "acparser.h"
@ -123,25 +123,26 @@
#include "acinterp.h"
#include "acnamesp.h"
#include "acevents.h"
#include "AslCompiler.h"
#include "AslCompiler.y.h"
#define _COMPONENT DISPATCHER
MODULE_NAME ("dswload")
#include "aslcompiler.h"
#include "aslcompiler.y.h"
#define _COMPONENT ACPI_COMPILER
MODULE_NAME ("aslload")
/*******************************************************************************
*
* FUNCTION:
* FUNCTION: LdLoadNamespace
*
* PARAMETERS:
* PARAMETERS: None
*
* RETURN:
* RETURN: Status
*
* DESCRIPTION:
* DESCRIPTION: Perform a walk of the parse tree that in turn loads all of the
* named ASL/AML objects into the namespace. The namespace is
* constructed in order to resolve named references and references
* to named fields within resource templates/descriptors.
*
******************************************************************************/
@ -150,13 +151,14 @@ LdLoadNamespace (void)
{
ACPI_WALK_STATE *WalkState;
ACPI_WALK_LIST WalkList;
// ACPI_STATUS Status;
DbgPrint ("\nCreating namespace\n\n");
DbgPrint (ASL_DEBUG_OUTPUT, "\nCreating namespace\n\n");
/* Create a new walk state */
WalkList.WalkState = NULL;
WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, NULL, NULL, &WalkList);
if (!WalkState)
{
@ -164,13 +166,13 @@ LdLoadNamespace (void)
}
// AcpiDbgLevel = 0xFFFFFFFF;
TgWalkParseTree (ASL_WALK_VISIT_TWICE, LdNamespace1Begin,
/* Perform the walk of the parse tree */
TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, LdNamespace1Begin,
LdNamespace1End, WalkState);
/* Dump the namespace if requested */
// AcpiDbgLevel = TRACE_TABLES;
/* Dump the namespace if debug is enabled */
AcpiNsDumpTables (NS_ALL, ACPI_UINT32_MAX);
@ -178,17 +180,17 @@ LdLoadNamespace (void)
}
/*******************************************************************************
*
* FUNCTION: LdLoadFieldElements
*
* PARAMETERS:
* PARAMETERS: PsNode - Parent node (Field)
* WalkState - Current walk state
*
* RETURN:
* RETURN: None
*
* DESCRIPTION:
* DESCRIPTION: Enter the named elements of the field (children of the parent)
* into the namespace.
*
******************************************************************************/
@ -199,8 +201,10 @@ LdLoadFieldElements (
{
ASL_PARSE_NODE *Child = NULL;
ACPI_NAMESPACE_NODE *NsNode;
ACPI_STATUS Status;
/* Get the first named field element */
switch (PsNode->AmlOpcode)
{
@ -212,12 +216,14 @@ LdLoadFieldElements (
Child = UtGetArg (PsNode, 5);
break;
case AML_DEF_FIELD_OP:
case AML_FIELD_OP:
Child = UtGetArg (PsNode, 4);
break;
}
/* Enter all elements into the namespace */
while (Child)
{
switch (Child->AmlOpcode)
@ -228,12 +234,18 @@ LdLoadFieldElements (
default:
AcpiNsLookup (WalkState->ScopeInfo,
Child->Value.String,
INTERNAL_TYPE_DEF_FIELD,
IMODE_LOAD_PASS1,
Status = AcpiNsLookup (WalkState->ScopeInfo, Child->Value.String,
INTERNAL_TYPE_FIELD, IMODE_LOAD_PASS1,
NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
NULL, &NsNode);
if (ACPI_FAILURE (Status))
{
/* TBD - emit error */
return;
}
Child->NsNode = NsNode;
NsNode->Object = Child;
break;
}
@ -242,17 +254,23 @@ LdLoadFieldElements (
}
/*****************************************************************************
/*******************************************************************************
*
* FUNCTION:
* FUNCTION: LdLoadResourceElements
*
* PARAMETERS:
* PARAMETERS: PsNode - Parent node (Resource Descriptor)
* WalkState - Current walk state
*
* RETURN: Status
* RETURN: None
*
* DESCRIPTION:
* DESCRIPTION: Enter the named elements of the resource descriptor (children
* of the parent) into the namespace.
*
****************************************************************************/
* NOTE: In the real AML namespace, these named elements never exist. But
* we simply use the namespace here as a symbol table so we can look
* them up as they are referenced.
*
******************************************************************************/
void
LdLoadResourceElements (
@ -264,8 +282,8 @@ LdLoadResourceElements (
ACPI_STATUS Status;
/*
* Enter the resouce name into the namespace
/*
* Enter the resouce name into the namespace
* This opens a scope
*/
Status = AcpiNsLookup (WalkState->ScopeInfo,
@ -275,13 +293,8 @@ LdLoadResourceElements (
NS_NO_UPSEARCH,
WalkState, &NsNode);
/*
* Store offset of zero for the base name of the resource
*/
(UINT32) NsNode->Object = 0;
/*
* Now enter the predefined fields, for easy lookup when referenced
* by the source ASL
*/
@ -303,28 +316,33 @@ LdLoadResourceElements (
return;
}
/*
/*
* Store the field offset in the namespace node so it
* can be used when the field is referenced
*/
(UINT16) NsNode->OwnerId = InitializerNode->Value.Integer16;
InitializerNode->NsNode = NsNode;
NsNode->Object = InitializerNode;
}
InitializerNode = ASL_GET_PEER_NODE (InitializerNode);
}
}
/*****************************************************************************
/*******************************************************************************
*
* FUNCTION:
* FUNCTION: LdNamespace1Begin
*
* PARAMETERS:
* PARAMETERS: ASL_WALK_CALLBACK
*
* RETURN: Status
*
* DESCRIPTION: Descending callback used during the loading of ACPI tables.
* DESCRIPTION: Descending callback used during the parse tree walk. If this
* is a named AML opcode, enter into the namespace
*
****************************************************************************/
******************************************************************************/
ACPI_STATUS
LdNamespace1Begin (
@ -337,6 +355,9 @@ LdNamespace1Begin (
ACPI_STATUS Status;
OBJECT_TYPE_INTERNAL DataType;
NATIVE_CHAR *Path;
UINT32 Flags = NS_NO_UPSEARCH;
ASL_PARSE_NODE *Arg;
UINT32 i;
DEBUG_PRINT (TRACE_DISPATCH,
@ -349,7 +370,7 @@ LdNamespace1Begin (
{
case AML_BANK_FIELD_OP:
case AML_INDEX_FIELD_OP:
case AML_DEF_FIELD_OP:
case AML_FIELD_OP:
LdLoadFieldElements (PsNode, WalkState);
return (AE_OK);
@ -373,8 +394,32 @@ LdNamespace1Begin (
/* Map the raw opcode into an internal object type */
if ((PsNode->ParseOpcode == DEFAULT_ARG) &&
(PsNode->Flags == NODE_IS_RESOURCE_DESC))
if (PsNode->ParseOpcode == NAME)
{
Arg = PsNode->Child; /* Get the NameSeg/NameString node */
Arg = Arg->Peer; /* First peer is the object to be associated with the name */
/* Get the data type associated with the named object, not the name itself */
/* Log2 loop to convert from Btype (binary) to Etype (encoded) */
DataType = 1;
for (i = 1; i < Arg->AcpiBtype; i *= 2)
{
DataType++;
}
}
else if (PsNode->ParseOpcode == EXTERNAL)
{
/* "External" simply enters a name and type into the namespace */
/* first child is name, next child is ObjectType */
DataType = PsNode->Child->Peer->Value.Integer8;
}
else if ((PsNode->ParseOpcode == DEFAULT_ARG) &&
(PsNode->Flags == NODE_IS_RESOURCE_DESC))
{
/* TBD: Merge into AcpiDsMapNamedOpcodeToDataType */
@ -392,54 +437,74 @@ LdNamespace1Begin (
("Load1BeginOp: Type=%x\n", DataType));
if (PsNode->ParseOpcode != SCOPE)
{
Flags |= NS_ERROR_IF_FOUND;
}
/*
* Enter the named type into the internal namespace. We enter the name
* as we go downward in the parse tree. Any necessary subobjects that involve
* arguments to the opcode must be created as we go back up the parse tree later.
*/
Status = AcpiNsLookup (WalkState->ScopeInfo, Path,
DataType, IMODE_LOAD_PASS1,
NS_NO_UPSEARCH, WalkState, &(NsNode));
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, DataType,
IMODE_LOAD_PASS1, Flags, WalkState, &(NsNode));
if (ACPI_FAILURE (Status))
{
if (Status == AE_EXIST)
{
/* The name already exists in this scope */
AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, PsNode, Path);
return (Status);
}
printf ("Failure from lookup %s\n", AcpiCmFormatException (Status));
return (Status);
}
/*
* Point the parse node to the new namespace node, and point
* the NsNode back to the original Parse node
*/
PsNode->NsNode = NsNode;
NsNode->Object = PsNode;
if (PsNode->ParseOpcode == METHOD)
{
NsNode->OwnerId = PsNode->Extra;
}
return (Status);
}
/*****************************************************************************
/*******************************************************************************
*
* FUNCTION:
* FUNCTION: LdNamespace1End
*
* PARAMETERS:
* PARAMETERS: ASL_WALK_CALLBACK
*
* RETURN: Status
*
* DESCRIPTION: Ascending callback used during the loading of the namespace,
* both control methods and everything else.
* We only need to worry about managing the scope stack here.
*
****************************************************************************/
******************************************************************************/
ACPI_STATUS
LdNamespace1End (
ASL_PARSE_NODE *PsNode,
UINT32 Level,
void *Context)
ASL_PARSE_NODE *PsNode,
UINT32 Level,
void *Context)
{
ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context;
OBJECT_TYPE_INTERNAL DataType;
/* We are only interested in opcodes that have an associated name */
if (!PsNode->Namepath)
@ -479,7 +544,6 @@ LdNamespace1End (
}
return (AE_OK);
}

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: asllookup- Namespace lookup
* $Revision: 1.78 $
* $Revision: 1.24 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* All rights reserved.
*
* 2. License
@ -125,10 +125,10 @@
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("asllookup")
MODULE_NAME ("asllookup")
/*******************************************************************************
/*****************************************************************************
*
* FUNCTION: LsDoOneNamespaceObject
*
@ -139,7 +139,7 @@
* DESCRIPTION: Dump a namespace object to the namespace output file.
* Called during the walk of the namespace to dump all objects.
*
******************************************************************************/
****************************************************************************/
ACPI_STATUS
LsDoOneNamespaceObject (
@ -149,85 +149,84 @@ LsDoOneNamespaceObject (
void **ReturnValue)
{
ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
ACPI_PARSE_OBJECT *Op;
ASL_PARSE_NODE *Pnode;
Gbl_NumNamespaceObjects++;
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%5d [%d] %*s %4.4s - %s",
fprintf (Gbl_NamespaceOutputFile, "%5d [%d] %*s %4.4s - %s",
Gbl_NumNamespaceObjects, Level, (Level * 3), " ",
&Node->Name,
AcpiUtGetTypeName (Node->Type));
AcpiCmGetTypeName (Node->Type));
Op = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Node->Object);
Pnode = (ASL_PARSE_NODE *) Node->Object;
if (Op)
if (Pnode)
{
if (Op->Asl.ParseOpcode == PARSEOP_NAME)
if (Pnode->ParseOpcode == NAME)
{
Op = Op->Asl.Child;
Pnode = Pnode->Child;
}
switch (Node->Type)
{
case ACPI_TYPE_INTEGER:
if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
(Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
if ((Pnode->ParseOpcode == NAMESEG) ||
(Pnode->ParseOpcode == NAMESTRING))
{
Op = Op->Asl.Next;
Pnode = Pnode->Peer;
}
if (Op->Asl.Value.Integer > ACPI_UINT32_MAX)
if (Pnode->Value.Integer64 > ACPI_UINT32_MAX)
{
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [Initial Value = 0x%X%X]",
ACPI_HIDWORD (Op->Asl.Value.Integer64), Op->Asl.Value.Integer32);
fprintf (Gbl_NamespaceOutputFile, " [Initial Value = 0x%X%X]",
HIDWORD (Pnode->Value.Integer64), Pnode->Value.Integer32);
}
else
{
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [Initial Value = 0x%X]",
Op->Asl.Value.Integer32);
fprintf (Gbl_NamespaceOutputFile, " [Initial Value = 0x%X]",
Pnode->Value.Integer32);
}
break;
case ACPI_TYPE_STRING:
if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
(Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
if ((Pnode->ParseOpcode == NAMESEG) ||
(Pnode->ParseOpcode == NAMESTRING))
{
Op = Op->Asl.Next;
Pnode = Pnode->Peer;
}
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [Initial Value = \"%s\"]",
Op->Asl.Value.String);
fprintf (Gbl_NamespaceOutputFile, " [Initial Value = \"%s\"]",
Pnode->Value.String);
break;
case ACPI_TYPE_LOCAL_REGION_FIELD:
if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
(Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
case INTERNAL_TYPE_FIELD:
if ((Pnode->ParseOpcode == NAMESEG) ||
(Pnode->ParseOpcode == NAMESTRING))
{
Op = Op->Asl.Child;
Pnode = Pnode->Child;
}
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [Offset 0x%02X, Length 0x%02X]",
Op->Asl.Parent->Asl.ExtraValue, Op->Asl.Value.Integer32);
fprintf (Gbl_NamespaceOutputFile, " [Length = 0x%02X]",
Pnode->Value.Integer32);
break;
default:
/* Nothing to do for other types */
break;
}
}
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\n");
fprintf (Gbl_NamespaceOutputFile, "\n");
return (AE_OK);
}
/*******************************************************************************
/*****************************************************************************
*
* FUNCTION: LsDisplayNamespace
*
@ -239,11 +238,10 @@ LsDoOneNamespaceObject (
* in the tree. Information is written to the optional
* namespace output file.
*
******************************************************************************/
****************************************************************************/
ACPI_STATUS
LsDisplayNamespace (
void)
LsDisplayNamespace (void)
{
ACPI_STATUS Status;
@ -255,19 +253,20 @@ LsDisplayNamespace (
/* File header */
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "Contents of ACPI Namespace\n\n");
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "Count Depth Name - Type\n\n");
fprintf (Gbl_NamespaceOutputFile, "Contents of ACPI Namespace\n\n");
fprintf (Gbl_NamespaceOutputFile, "Count Depth Name - Type\n\n");
/* Walk entire namespace from the root */
/* Walk entire namespace from the supplied root */
Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX, FALSE, LsDoOneNamespaceObject,
NULL, NULL);
return (Status);
return (AE_OK);
}
/*******************************************************************************
/*****************************************************************************
*
* FUNCTION: LsCompareOneNamespaceObject
*
@ -277,7 +276,7 @@ LsDisplayNamespace (
*
* DESCRIPTION: Compare name of one object.
*
******************************************************************************/
****************************************************************************/
ACPI_STATUS
LsCompareOneNamespaceObject (
@ -291,7 +290,7 @@ LsCompareOneNamespaceObject (
/* Simply check the name */
if (*((UINT32 *) (Context)) == Node->Name.Integer)
if (*((UINT32 *) (Context)) == Node->Name)
{
/* Abort walk if we found one instance */
@ -302,7 +301,7 @@ LsCompareOneNamespaceObject (
}
/*******************************************************************************
/*****************************************************************************
*
* FUNCTION: LkObjectExists
*
@ -312,7 +311,7 @@ LsCompareOneNamespaceObject (
*
* DESCRIPTION: Walk the namespace to find an object
*
******************************************************************************/
****************************************************************************/
BOOLEAN
LkObjectExists (
@ -326,6 +325,7 @@ LkObjectExists (
Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX, FALSE, LsCompareOneNamespaceObject,
Name, NULL);
if (Status == AE_CTRL_TRUE)
{
/* At least one instance of the name was found */
@ -337,7 +337,7 @@ LkObjectExists (
}
/*******************************************************************************
/*****************************************************************************
*
* FUNCTION: LkCrossReferenceNamespace
*
@ -355,93 +355,40 @@ LkObjectExists (
* namespace so that references to the external name will be resolved
* correctly here.
*
******************************************************************************/
****************************************************************************/
ACPI_STATUS
LkCrossReferenceNamespace (
void)
LkCrossReferenceNamespace (void)
{
ACPI_WALK_STATE *WalkState;
ACPI_WALK_LIST WalkList;
DbgPrint (ASL_DEBUG_OUTPUT, "\nCross referencing namespace\n\n");
DbgPrint (ASL_DEBUG_OUTPUT, "\nCreating namespace\n\n");
/*
* Create a new walk state for use when looking up names
* within the namespace (Passed as context to the callbacks)
*/
WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, NULL, NULL, NULL);
WalkList.WalkState = NULL;
WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, NULL, NULL, &WalkList);
if (!WalkState)
{
return AE_NO_MEMORY;
}
/* Walk the entire parse tree */
TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, LkNamespaceLocateBegin,
LkNamespaceLocateEnd, WalkState);
return AE_OK;
}
/*******************************************************************************
*
* FUNCTION: LkCheckFieldRange
*
* PARAMETERS: RegionBitLength - Length of entire parent region
* FieldBitOffset - Start of the field unit (within region)
* FieldBitLength - Entire length of field unit
* AccessBitWidth - Access width of the field unit
*
* RETURN: None
*
* DESCRIPTION: Check one field unit to make sure it fits in the parent
* op region.
*
* Note: AccessBitWidth must be either 8,16,32, or 64
*
******************************************************************************/
void
LkCheckFieldRange (
ACPI_PARSE_OBJECT *Op,
UINT32 RegionBitLength,
UINT32 FieldBitOffset,
UINT32 FieldBitLength,
UINT32 AccessBitWidth)
{
UINT32 FieldEndBitOffset;
/*
* Check each field unit against the region size. The entire
* field unit (start offset plus length) must fit within the
* region.
*/
FieldEndBitOffset = FieldBitOffset + FieldBitLength;
if (FieldEndBitOffset > RegionBitLength)
{
/* Field definition itself is beyond the end-of-region */
AslError (ASL_ERROR, ASL_MSG_FIELD_UNIT_OFFSET, Op, NULL);
return;
}
/*
* Now check that the field plus AccessWidth doesn't go beyond
* the end-of-region. Assumes AccessBitWidth is a power of 2
*/
FieldEndBitOffset = ACPI_ROUND_UP (FieldEndBitOffset, AccessBitWidth);
if (FieldEndBitOffset > RegionBitLength)
{
/* Field definition combined with the access is beyond EOR */
AslError (ASL_ERROR, ASL_MSG_FIELD_UNIT_ACCESS_WIDTH, Op, NULL);
}
}
/*******************************************************************************
/*****************************************************************************
*
* FUNCTION: LkNamespaceLocateBegin
*
@ -454,110 +401,59 @@ LkCheckFieldRange (
* namespace.
*
* NOTE: ASL references to named fields within resource descriptors are
* resolved to integer values here. Therefore, this step is an
* resolve to integer values here. Therefore, this step is an
* important part of the code generation. We don't know that the
* name refers to a resource descriptor until now.
*
******************************************************************************/
****************************************************************************/
ACPI_STATUS
LkNamespaceLocateBegin (
ACPI_PARSE_OBJECT *Op,
ASL_PARSE_NODE *PsNode,
UINT32 Level,
void *Context)
{
ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context;
ACPI_NAMESPACE_NODE *Node;
ACPI_NAMESPACE_NODE *NsNode;
ACPI_STATUS Status;
ACPI_OBJECT_TYPE ObjectType;
char *Path;
OBJECT_TYPE_INTERNAL DataType;
NATIVE_CHAR *Path;
UINT8 PassedArgs;
ACPI_PARSE_OBJECT *NextOp;
ACPI_PARSE_OBJECT *OwningOp;
ACPI_PARSE_OBJECT *SpaceIdOp;
UINT32 MinimumLength;
UINT32 Temp;
const ACPI_OPCODE_INFO *OpInfo;
UINT32 Flags;
ASL_PARSE_NODE *Next;
ASL_PARSE_NODE *MethodPsNode;
ACPI_FUNCTION_TRACE_PTR ("LkNamespaceLocateBegin", Op);
DEBUG_PRINT (TRACE_DISPATCH,
("NamespaceLocateBegin: PsNode %p\n", PsNode));
/*
* If this node is the actual declaration of a name
* [such as the XXXX name in "Method (XXXX)"],
* we are not interested in it here. We only care about names that are
* references to other objects within the namespace and the parent objects
* of name declarations
*/
if (Op->Asl.CompileFlags & NODE_IS_NAME_DECLARATION)
{
return (AE_OK);
}
/* We are only interested in opcodes that have an associated name */
OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
if ((!(OpInfo->Flags & AML_NAMED)) &&
(!(OpInfo->Flags & AML_CREATE)) &&
(Op->Asl.ParseOpcode != PARSEOP_NAMESTRING) &&
(Op->Asl.ParseOpcode != PARSEOP_NAMESEG) &&
(Op->Asl.ParseOpcode != PARSEOP_METHODCALL))
if ((!AcpiPsIsNamedOp (PsNode->AmlOpcode)) &&
(PsNode->ParseOpcode != NAMESTRING) &&
(PsNode->ParseOpcode != NAMESEG) &&
(PsNode->ParseOpcode != METHODCALL))
{
return (AE_OK);
}
/*
* We must enable the "search-to-root" for single NameSegs, but
* we have to be very careful about opening up scopes
*/
Flags = ACPI_NS_SEARCH_PARENT;
if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) ||
(Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
(Op->Asl.ParseOpcode == PARSEOP_METHODCALL))
if (AcpiPsIsNamedOp (PsNode->AmlOpcode))
{
/*
* These are name references, do not push the scope stack
* for them.
*/
Flags |= ACPI_NS_DONT_OPEN_SCOPE;
}
/* Get the NamePath from the appropriate place */
if (OpInfo->Flags & AML_NAMED)
{
/* For all NAMED operators, the name reference is the first child */
Path = Op->Asl.Child->Asl.Value.String;
if (Op->Asl.AmlOpcode == AML_ALIAS_OP)
{
/*
* ALIAS is the only oddball opcode, the name declaration
* (alias name) is the second operand
*/
Path = Op->Asl.Child->Asl.Next->Asl.Value.String;
}
}
else if (OpInfo->Flags & AML_CREATE)
{
/* Name must appear as the last parameter */
NextOp = Op->Asl.Child;
while (!(NextOp->Asl.CompileFlags & NODE_IS_NAME_DECLARATION))
{
NextOp = NextOp->Asl.Next;
}
Path = NextOp->Asl.Value.String;
Path = PsNode->Child->Value.String;
}
else
{
Path = Op->Asl.Value.String;
Path = PsNode->Value.String;
}
ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Type=%s\n", AcpiUtGetTypeName (ObjectType)));
/* Map the raw opcode into an internal object type */
DataType = AcpiDsMapNamedOpcodeToDataType (PsNode->AmlOpcode);
DEBUG_PRINT (TRACE_DISPATCH,
("NamespaceLocateBegin: Type=%x\n", DataType));
/*
* Lookup the name in the namespace. Name must exist at this point, or it
@ -568,16 +464,19 @@ LkNamespaceLocateBegin (
*/
Gbl_NsLookupCount++;
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
ACPI_IMODE_EXECUTE, Flags, WalkState, &(Node));
Status = AcpiNsLookup (WalkState->ScopeInfo, Path,
DataType, IMODE_EXECUTE,
NS_SEARCH_PARENT, WalkState, &(NsNode));
if (ACPI_FAILURE (Status))
{
if (Status == AE_NOT_FOUND)
{
/*
* We didn't find the name reference by path -- we can qualify this
* a little better before we print an error message
* a little better before we print an error message
*/
if (strlen (Path) == ACPI_NAME_SIZE)
{
/* A simple, one-segment ACPI name */
@ -586,15 +485,16 @@ LkNamespaceLocateBegin (
{
/* There exists such a name, but we couldn't get to it from this scope */
AslError (ASL_ERROR, ASL_MSG_NOT_REACHABLE, Op, Op->Asl.ExternalName);
AslError (ASL_WARNING, ASL_MSG_NOT_REACHABLE, PsNode, PsNode->ExternalName);
}
else
{
/* The name doesn't exist, period */
AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, Op, Op->Asl.ExternalName);
AslError (ASL_WARNING, ASL_MSG_NOT_EXIST, PsNode, PsNode->ExternalName);
}
}
else
{
/* Check for a fully qualified path */
@ -603,55 +503,21 @@ LkNamespaceLocateBegin (
{
/* Gave full path, the object does not exist */
AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, Op, Op->Asl.ExternalName);
AslError (ASL_WARNING, ASL_MSG_NOT_EXIST, PsNode, PsNode->ExternalName);
}
else
{
/* We can't tell whether it doesn't exist or just can't be reached. */
AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op, Op->Asl.ExternalName);
AslError (ASL_WARNING, ASL_MSG_NOT_FOUND, PsNode, PsNode->ExternalName);
}
}
Status = AE_OK;
}
return (Status);
}
/* Attempt to optimize the NamePath */
OptOptimizeNamePath (Op, OpInfo->Flags, WalkState, Path, Node);
/*
* Dereference an alias. (A name reference that is an alias.)
* Aliases are not nested; The alias always points to the final object
*/
if ((Op->Asl.ParseOpcode != PARSEOP_ALIAS) && (Node->Type == ACPI_TYPE_LOCAL_ALIAS))
{
/* This node points back to the original PARSEOP_ALIAS */
NextOp = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Node->Object);
/* The first child is the alias target op */
NextOp = NextOp->Asl.Child;
/* Who in turn points back to original target alias node */
if (NextOp->Asl.Node)
{
Node = NextOp->Asl.Node;
}
else
{
AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op, "Missing alias link");
}
}
/* 1) Check for a reference to a resource descriptor */
else if ((Node->Type == ACPI_TYPE_LOCAL_RESOURCE_FIELD) ||
(Node->Type == ACPI_TYPE_LOCAL_RESOURCE))
if (NsNode->Type == INTERNAL_TYPE_RESOURCE)
{
/*
* This was a reference to a field within a resource descriptor. Extract
@ -659,99 +525,33 @@ LkNamespaceLocateBegin (
* the field type) and change the named reference into an integer for
* AML code generation
*/
Temp = (UINT32) Node->OwnerId;
if (Node->Flags & ANOBJ_IS_BIT_OFFSET)
{
Op->Asl.CompileFlags |= NODE_IS_BIT_OFFSET;
}
/* Perform BitOffset <--> ByteOffset conversion if necessary */
AcpiCmFree (PsNode->Value.String);
switch (Op->Asl.Parent->Asl.AmlOpcode)
{
case AML_CREATE_FIELD_OP:
PsNode->ParseOpcode = INTEGER;
PsNode->AmlOpcode = AML_DWORD_OP;
PsNode->Value.Integer = (UINT64) NsNode->OwnerId;
/* We allow a Byte offset to Bit Offset conversion for this op */
if (!(Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET))
{
/* Simply multiply byte offset times 8 to get bit offset */
Temp = ACPI_MUL_8 (Temp);
}
break;
case AML_CREATE_BIT_FIELD_OP:
/* This op requires a Bit Offset */
if (!(Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET))
{
AslError (ASL_ERROR, ASL_MSG_BYTES_TO_BITS, Op, NULL);
}
break;
case AML_CREATE_BYTE_FIELD_OP:
case AML_CREATE_WORD_FIELD_OP:
case AML_CREATE_DWORD_FIELD_OP:
case AML_CREATE_QWORD_FIELD_OP:
case AML_INDEX_OP:
/* These Ops require Byte offsets */
if (Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET)
{
AslError (ASL_ERROR, ASL_MSG_BITS_TO_BYTES, Op, NULL);
}
break;
default:
/* Nothing to do for other opcodes */
break;
}
/* Now convert this node to an integer whose value is the field offset */
Op->Asl.ParseOpcode = PARSEOP_INTEGER;
Op->Asl.Value.Integer = (UINT64) Temp;
Op->Asl.CompileFlags |= NODE_IS_RESOURCE_FIELD;
OpcGenerateAmlOpcode (Op);
Op->Asl.AmlLength = OpcSetOptimalIntegerSize (Op);
PsNode->AmlLength = OpcSetOptimalIntegerSize (PsNode);
}
/* 2) Check for a method invocation */
/*
* There are two types of method invocation:
* 1) Invocation with arguments -- the parser recognizes this as a METHODCALL
* 2) Invocation with no arguments --the parser cannot determine that this is a method
* invocation, therefore we have to figure it out here.
*/
else if ((((PsNode->ParseOpcode == NAMESTRING) || (PsNode->ParseOpcode == NAMESEG)) &&
(NsNode->Type == ACPI_TYPE_METHOD) &&
(PsNode->Parent) &&
(PsNode->Parent->ParseOpcode != METHOD)) ||
else if ((((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || (Op->Asl.ParseOpcode == PARSEOP_NAMESEG)) &&
(Node->Type == ACPI_TYPE_METHOD) &&
(Op->Asl.Parent) &&
(Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_METHOD)) ||
(Op->Asl.ParseOpcode == PARSEOP_METHODCALL))
(PsNode->ParseOpcode == METHODCALL))
{
/*
* There are two types of method invocation:
* 1) Invocation with arguments -- the parser recognizes this as a METHODCALL
* 2) Invocation with no arguments --the parser cannot determine that this is a method
* invocation, therefore we have to figure it out here.
*/
if (Node->Type != ACPI_TYPE_METHOD)
{
sprintf (MsgBuffer, "%s is a %s", Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type));
AslError (ASL_ERROR, ASL_MSG_NOT_METHOD, Op, MsgBuffer);
return (AE_OK);
}
/* Save the method node in the caller's op */
Op->Asl.Node = Node;
if (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF)
if (NsNode->Type != ACPI_TYPE_METHOD)
{
AslError (ASL_ERROR, ASL_MSG_NOT_METHOD, PsNode, PsNode->ExternalName);
return (AE_OK);
}
@ -760,160 +560,76 @@ LkNamespaceLocateBegin (
* Count the number of arguments, each appears as a child
* under the parent node
*/
Op->Asl.ParseOpcode = PARSEOP_METHODCALL;
UtSetParseOpName (Op);
PsNode->ParseOpcode = METHODCALL;
PassedArgs = 0;
Next = PsNode->Child;
PassedArgs = 0;
NextOp = Op->Asl.Child;
while (NextOp)
while (Next)
{
PassedArgs++;
NextOp = NextOp->Asl.Next;
Next = Next->Peer;
}
if (Node->OwnerId != ASL_EXTERNAL_METHOD)
{
/*
* Check the parsed arguments with the number expected by the
* method declaration itself
*/
if (PassedArgs != Node->OwnerId)
{
sprintf (MsgBuffer, "%s requires %d", Op->Asl.ExternalName,
Node->OwnerId);
if (PassedArgs < Node->OwnerId)
{
AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_LO, Op, MsgBuffer);
}
else
{
AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_HI, Op, MsgBuffer);
}
}
}
}
/*
* 3) Check for an ASL Field definition
*/
else if ((Op->Asl.Parent) &&
((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_FIELD) ||
(Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_BANKFIELD)))
{
/*
* Offset checking for fields. If the parent operation region has a
* constant length (known at compile time), we can check fields
* defined in that region against the region length. This will catch
* fields and field units that cannot possibly fit within the region.
*
* Note: Index fields do not directly reference an operation region,
* thus they are not included in this check.
* Check the parsed arguments with the number expected by the
* method declaration itself
*/
if (Op == Op->Asl.Parent->Asl.Child)
if (PassedArgs != NsNode->OwnerId)
{
/*
* This is the first child of the field node, which is
* the name of the region. Get the parse node for the
* region -- which contains the length of the region.
*/
OwningOp = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Node->Object);
Op->Asl.Parent->Asl.ExtraValue = ACPI_MUL_8 (OwningOp->Asl.Value.Integer32);
sprintf (MsgBuffer, "%s requires %d", PsNode->ExternalName,
NsNode->OwnerId);
/* Examine the field access width */
switch (Op->Asl.Parent->Asl.Value.Integer8)
if (PassedArgs < NsNode->OwnerId)
{
case AML_FIELD_ACCESS_ANY:
case AML_FIELD_ACCESS_BYTE:
case AML_FIELD_ACCESS_BUFFER:
default:
MinimumLength = 1;
break;
AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_LO, PsNode, MsgBuffer);
case AML_FIELD_ACCESS_WORD:
MinimumLength = 2;
break;
case AML_FIELD_ACCESS_DWORD:
MinimumLength = 4;
break;
case AML_FIELD_ACCESS_QWORD:
MinimumLength = 8;
break;
}
/*
* Is the region at least as big as the access width?
* Note: DataTableRegions have 0 length
*/
if ((OwningOp->Asl.Value.Integer32) &&
(OwningOp->Asl.Value.Integer32 < MinimumLength))
{
AslError (ASL_ERROR, ASL_MSG_FIELD_ACCESS_WIDTH, Op, NULL);
}
/*
* Check EC/CMOS/SMBUS fields to make sure that the correct
* access type is used (BYTE for EC/CMOS, BUFFER for SMBUS)
*/
SpaceIdOp = OwningOp->Asl.Child->Asl.Next;
switch (SpaceIdOp->Asl.Value.Integer32)
{
case REGION_EC:
case REGION_CMOS:
if (Op->Asl.Parent->Asl.Value.Integer8 != AML_FIELD_ACCESS_BYTE)
if (NsNode->OwnerId > 7)
{
AslError (ASL_ERROR, ASL_MSG_REGION_BYTE_ACCESS, Op, NULL);
printf ("too many arguments defined for method [%4.4s]\n", &NsNode->Name);
return (AE_BAD_PARAMETER);
}
break;
case REGION_SMBUS:
if (Op->Asl.Parent->Asl.Value.Integer8 != AML_FIELD_ACCESS_BUFFER)
{
AslError (ASL_ERROR, ASL_MSG_REGION_BUFFER_ACCESS, Op, NULL);
}
break;
default:
/* Nothing to do for other address spaces */
break;
}
else
{
AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_HI, PsNode, MsgBuffer);
}
}
else
/*
* Check if the method caller expects this method to return a value and
* if the called method in fact returns a value.
*/
if (!(PsNode->Flags & NODE_RESULT_NOT_USED))
{
/*
* This is one element of the field list. Check to make sure
* that it does not go beyond the end of the parent operation region.
*
* In the code below:
* Op->Asl.Parent->Asl.ExtraValue - Region Length (bits)
* Op->Asl.ExtraValue - Field start offset (bits)
* Op->Asl.Child->Asl.Value.Integer32 - Field length (bits)
* Op->Asl.Child->Asl.ExtraValue - Field access width (bits)
*/
if (Op->Asl.Parent->Asl.ExtraValue && Op->Asl.Child)
/* 1) The result from the method is used (the method is a TermArg) */
MethodPsNode = NsNode->Object;
if (MethodPsNode->Flags & NODE_METHOD_NO_RETVAL)
{
LkCheckFieldRange (Op,
Op->Asl.Parent->Asl.ExtraValue,
Op->Asl.ExtraValue,
Op->Asl.Child->Asl.Value.Integer32,
Op->Asl.Child->Asl.ExtraValue);
/*
* 2) Method NEVER returns a value
*/
AslError (ASL_ERROR, ASL_MSG_NO_RETVAL, PsNode, PsNode->ExternalName);
}
else if (MethodPsNode->Flags & NODE_METHOD_SOME_NO_RETVAL)
{
/*
* 2) Method SOMETIMES returns a value, SOMETIMES not
*/
AslError (ASL_WARNING, ASL_MSG_SOME_NO_RETVAL, PsNode, PsNode->ExternalName);
}
}
}
Op->Asl.Node = Node;
PsNode->NsNode = NsNode;
return (Status);
}
/*******************************************************************************
/*****************************************************************************
*
* FUNCTION: LkNamespaceLocateEnd
*
@ -924,48 +640,58 @@ LkNamespaceLocateBegin (
* DESCRIPTION: Ascending callback used during cross reference. We only
* need to worry about scope management here.
*
******************************************************************************/
****************************************************************************/
ACPI_STATUS
LkNamespaceLocateEnd (
ACPI_PARSE_OBJECT *Op,
ASL_PARSE_NODE *PsNode,
UINT32 Level,
void *Context)
{
ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context;
const ACPI_OPCODE_INFO *OpInfo;
ACPI_FUNCTION_TRACE ("LkNamespaceLocateEnd");
OBJECT_TYPE_INTERNAL DataType;
/* We are only interested in opcodes that have an associated name */
OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
if (!(OpInfo->Flags & AML_NAMED))
if (!AcpiPsIsNamedOp (PsNode->AmlOpcode))
{
return (AE_OK);
}
/* Not interested in name references, we did not open a scope for them */
if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) ||
(Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
(Op->Asl.ParseOpcode == PARSEOP_METHODCALL))
/* Get the type to determine if we should pop the scope */
DataType = AcpiDsMapNamedOpcodeToDataType (PsNode->AmlOpcode);
if (PsNode->AmlOpcode == AML_NAME_OP)
{
return (AE_OK);
/* For Name opcode, check the argument */
if (PsNode->Child)
{
/*
DataType = AcpiDsMapOpcodeToDataType (
PsNode->Child->AmlOpcode, NULL);
((ACPI_NAMESPACE_NODE *)Op->Node)->Type =
(UINT8) DataType;
*/
}
}
/* Pop the scope stack if necessary */
if (AcpiNsOpensScope (AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode)))
/* Pop the scope stack */
if (AcpiNsOpensScope (DataType))
{
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"%s: Popping scope for Op %p\n",
AcpiUtGetTypeName (OpInfo->ObjectType), Op));
DEBUG_PRINT (TRACE_DISPATCH,
("NamespaceLocateEnd/%s: Popping scope for Op %p\n",
AcpiCmGetTypeName (DataType), PsNode));
AcpiDsScopeStackPop (WalkState);
}
return (AE_OK);

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslmap - parser to AML opcode mapping table
* $Revision: 1.40 $
* $Revision: 1.27 $
*
*****************************************************************************/
@ -125,6 +125,7 @@
MODULE_NAME ("aslmap")
/*******************************************************************************
*
* DATA STRUCTURE: ReservedMethods
@ -142,123 +143,123 @@
*
******************************************************************************/
const ASL_RESERVED_INFO ReservedMethods[] = {
{"_AC0", 0, ASL_RSVD_RETURN_VALUE},
{"_AC1", 0, ASL_RSVD_RETURN_VALUE},
{"_AC2", 0, ASL_RSVD_RETURN_VALUE},
{"_AC3", 0, ASL_RSVD_RETURN_VALUE},
{"_ADR", 0, ASL_RSVD_RETURN_VALUE},
{"_AL0", 0, ASL_RSVD_RETURN_VALUE},
{"_AL1", 0, ASL_RSVD_RETURN_VALUE},
{"_AL2", 0, ASL_RSVD_RETURN_VALUE},
{"_AL3", 0, ASL_RSVD_RETURN_VALUE},
{"_BBN", 0, ASL_RSVD_RETURN_VALUE},
{"_BCL", 0, ASL_RSVD_RETURN_VALUE},
{"_BCM", 1, 0},
{"_BDN", 0, ASL_RSVD_RETURN_VALUE},
{"_BFS", 1, 0},
{"_BIF", 0, ASL_RSVD_RETURN_VALUE},
{"_BST", 0, ASL_RSVD_RETURN_VALUE},
{"_BTP", 1, 0},
{"_CID", 0, ASL_RSVD_RETURN_VALUE},
{"_CRS", 0, ASL_RSVD_RETURN_VALUE},
{"_CRT", 0, ASL_RSVD_RETURN_VALUE},
{"_CST", 0, ASL_RSVD_RETURN_VALUE},
{"_DCK", 1, ASL_RSVD_RETURN_VALUE},
{"_DCS", 0, ASL_RSVD_RETURN_VALUE},
{"_DDC", 1, ASL_RSVD_RETURN_VALUE},
{"_DDN", 1, 0}, /* Spec is ambiguous about this */
{"_DGS", 0, ASL_RSVD_RETURN_VALUE},
{"_DIS", 0, 0},
{"_DMA", 0, ASL_RSVD_RETURN_VALUE},
{"_DOD", 0, ASL_RSVD_RETURN_VALUE},
{"_DOS", 1, 0},
{"_DSS", 1, 0},
{"_EC_", 0, ASL_RSVD_RETURN_VALUE},
{"_EDL", 0, ASL_RSVD_RETURN_VALUE},
{"_EJ0", 1, 0},
{"_EJ1", 1, 0},
{"_EJ2", 1, 0},
{"_EJ3", 1, 0},
{"_EJ4", 1, 0},
{"_EJD", 0, ASL_RSVD_RETURN_VALUE},
{"_FDE", 0, ASL_RSVD_RETURN_VALUE},
{"_FDI", 0, ASL_RSVD_RETURN_VALUE},
{"_FDM", 1, 0},
{"_FIX", 0, ASL_RSVD_RETURN_VALUE},
{"_GLK", 0, ASL_RSVD_RETURN_VALUE},
{"_GPD", 0, ASL_RSVD_RETURN_VALUE},
{"_GPE", 0, ASL_RSVD_RETURN_VALUE},
{"_GTF", 0, ASL_RSVD_RETURN_VALUE},
{"_GTM", 0, ASL_RSVD_RETURN_VALUE},
{"_GTS", 1, 0},
{"_HID", 0, ASL_RSVD_RETURN_VALUE},
{"_HOT", 0, ASL_RSVD_RETURN_VALUE},
{"_HPP", 0, ASL_RSVD_RETURN_VALUE},
{"_INI", 0, 0},
{"_IRC", 0, 0},
{"_LCK", 1, 0},
{"_LID", 0, ASL_RSVD_RETURN_VALUE},
{"_MAT", 0, ASL_RSVD_RETURN_VALUE},
{"_MSG", 1, 0},
{"_OFF", 0, 0},
{"_ON_", 0, 0},
{"_PCL", 0, ASL_RSVD_RETURN_VALUE},
{"_PCT", 0, ASL_RSVD_RETURN_VALUE},
{"_PIC", 1, 0},
{"_PPC", 0, ASL_RSVD_RETURN_VALUE},
{"_PR0", 0, ASL_RSVD_RETURN_VALUE},
{"_PR1", 0, ASL_RSVD_RETURN_VALUE},
{"_PR2", 0, ASL_RSVD_RETURN_VALUE},
{"_PRS", 0, ASL_RSVD_RETURN_VALUE},
{"_PRT", 0, ASL_RSVD_RETURN_VALUE},
{"_PRW", 0, ASL_RSVD_RETURN_VALUE},
{"_PS0", 0, 0},
{"_PS1", 0, 0},
{"_PS2", 0, 0},
{"_PS3", 0, 0},
{"_PSC", 0, ASL_RSVD_RETURN_VALUE},
{"_PSL", 0, ASL_RSVD_RETURN_VALUE},
{"_PSR", 0, ASL_RSVD_RETURN_VALUE},
{"_PSS", 0, ASL_RSVD_RETURN_VALUE},
{"_PSV", 0, ASL_RSVD_RETURN_VALUE},
{"_PSW", 1, 0},
{"_PTC", 0, ASL_RSVD_RETURN_VALUE},
{"_PTS", 1, 0},
{"_PXM", 0, ASL_RSVD_RETURN_VALUE},
{"_REG", 2, 0},
{"_RMV", 0, ASL_RSVD_RETURN_VALUE},
{"_ROM", 2, ASL_RSVD_RETURN_VALUE},
{"_S0_", 0, ASL_RSVD_RETURN_VALUE},
{"_S1_", 0, ASL_RSVD_RETURN_VALUE},
{"_S2_", 0, ASL_RSVD_RETURN_VALUE},
{"_S3_", 0, ASL_RSVD_RETURN_VALUE},
{"_S4_", 0, ASL_RSVD_RETURN_VALUE},
{"_S5_", 0, ASL_RSVD_RETURN_VALUE},
{"_S1D", 0, ASL_RSVD_RETURN_VALUE},
{"_S2D", 0, ASL_RSVD_RETURN_VALUE},
{"_S3D", 0, ASL_RSVD_RETURN_VALUE},
{"_S4D", 0, ASL_RSVD_RETURN_VALUE},
{"_SBS", 0, ASL_RSVD_RETURN_VALUE},
{"_SCP", 1, 0},
{"_SEG", 0, ASL_RSVD_RETURN_VALUE},
{"_SPD", 1, ASL_RSVD_RETURN_VALUE},
{"_SRS", 1, 0},
{"_SST", 1, 0},
{"_STA", 0, ASL_RSVD_RETURN_VALUE},
{"_STM", 3, 0},
{"_STR", 0, ASL_RSVD_RETURN_VALUE},
{"_SUN", 0, ASL_RSVD_RETURN_VALUE},
{"_TC1", 0, ASL_RSVD_RETURN_VALUE},
{"_TC2", 0, ASL_RSVD_RETURN_VALUE},
{"_TMP", 0, ASL_RSVD_RETURN_VALUE},
{"_TSP", 0, ASL_RSVD_RETURN_VALUE},
{"_TZD", 0, ASL_RSVD_RETURN_VALUE},
{"_TZP", 0, ASL_RSVD_RETURN_VALUE},
{"_UID", 0, ASL_RSVD_RETURN_VALUE},
{"_VPO", 0, ASL_RSVD_RETURN_VALUE},
{"_WAK", 1, ASL_RSVD_RETURN_VALUE},
{NULL, 0, 0},
ASL_RESERVED_INFO ReservedMethods[] = {
"_AC0", 0, ASL_RSVD_RETURN_VALUE,
"_AC1", 0, ASL_RSVD_RETURN_VALUE,
"_AC2", 0, ASL_RSVD_RETURN_VALUE,
"_AC3", 0, ASL_RSVD_RETURN_VALUE,
"_ADR", 0, ASL_RSVD_RETURN_VALUE,
"_AL0", 0, ASL_RSVD_RETURN_VALUE,
"_AL1", 0, ASL_RSVD_RETURN_VALUE,
"_AL2", 0, ASL_RSVD_RETURN_VALUE,
"_AL3", 0, ASL_RSVD_RETURN_VALUE,
"_BBN", 0, ASL_RSVD_RETURN_VALUE,
"_BCL", 0, ASL_RSVD_RETURN_VALUE,
"_BCM", 1, 0,
"_BDN", 0, ASL_RSVD_RETURN_VALUE,
"_BFS", 1, 0,
"_BIF", 0, ASL_RSVD_RETURN_VALUE,
"_BST", 0, ASL_RSVD_RETURN_VALUE,
"_BTP", 1, 0,
"_CID", 0, ASL_RSVD_RETURN_VALUE,
"_CRS", 0, ASL_RSVD_RETURN_VALUE,
"_CRT", 0, ASL_RSVD_RETURN_VALUE,
"_CST", 0, ASL_RSVD_RETURN_VALUE,
"_DCK", 1, ASL_RSVD_RETURN_VALUE,
"_DCS", 0, ASL_RSVD_RETURN_VALUE,
"_DDC", 1, ASL_RSVD_RETURN_VALUE,
"_DDN", 1, 0, /* Spec is ambiguous about this */
"_DGS", 0, ASL_RSVD_RETURN_VALUE,
"_DIS", 0, 0,
"_DMA", 0, ASL_RSVD_RETURN_VALUE,
"_DOD", 0, ASL_RSVD_RETURN_VALUE,
"_DOS", 1, 0,
"_DSS", 1, 0,
"_EC_", 0, ASL_RSVD_RETURN_VALUE,
"_EDL", 0, ASL_RSVD_RETURN_VALUE,
"_EJ0", 1, 0,
"_EJ1", 1, 0,
"_EJ2", 1, 0,
"_EJ3", 1, 0,
"_EJ4", 1, 0,
"_EJD", 0, ASL_RSVD_RETURN_VALUE,
"_FDE", 0, ASL_RSVD_RETURN_VALUE,
"_FDI", 0, ASL_RSVD_RETURN_VALUE,
"_FDM", 1, 0,
"_FIX", 0, ASL_RSVD_RETURN_VALUE,
"_GLK", 0, ASL_RSVD_RETURN_VALUE,
"_GPD", 0, ASL_RSVD_RETURN_VALUE,
"_GPE", 0, ASL_RSVD_RETURN_VALUE,
"_GTF", 0, ASL_RSVD_RETURN_VALUE,
"_GTM", 0, ASL_RSVD_RETURN_VALUE,
"_GTS", 1, 0,
"_HID", 0, ASL_RSVD_RETURN_VALUE,
"_HOT", 0, ASL_RSVD_RETURN_VALUE,
"_HPP", 0, ASL_RSVD_RETURN_VALUE,
"_INI", 0, 0,
"_IRC", 0, 0,
"_LCK", 1, 0,
"_LID", 0, ASL_RSVD_RETURN_VALUE,
"_MAT", 0, ASL_RSVD_RETURN_VALUE,
"_MSG", 1, 0,
"_OFF", 0, 0,
"_ON_", 0, 0,
"_PCL", 0, ASL_RSVD_RETURN_VALUE,
"_PCT", 0, ASL_RSVD_RETURN_VALUE,
"_PIC", 1, 0,
"_PPC", 0, ASL_RSVD_RETURN_VALUE,
"_PR0", 0, ASL_RSVD_RETURN_VALUE,
"_PR1", 0, ASL_RSVD_RETURN_VALUE,
"_PR2", 0, ASL_RSVD_RETURN_VALUE,
"_PRS", 0, ASL_RSVD_RETURN_VALUE,
"_PRT", 0, ASL_RSVD_RETURN_VALUE,
"_PRW", 0, ASL_RSVD_RETURN_VALUE,
"_PS0", 0, 0,
"_PS1", 0, 0,
"_PS2", 0, 0,
"_PS3", 0, 0,
"_PSC", 0, ASL_RSVD_RETURN_VALUE,
"_PSL", 0, ASL_RSVD_RETURN_VALUE,
"_PSR", 0, ASL_RSVD_RETURN_VALUE,
"_PSS", 0, ASL_RSVD_RETURN_VALUE,
"_PSV", 0, ASL_RSVD_RETURN_VALUE,
"_PSW", 1, 0,
"_PTC", 0, ASL_RSVD_RETURN_VALUE,
"_PTS", 1, 0,
"_PXM", 0, ASL_RSVD_RETURN_VALUE,
"_REG", 2, 0,
"_RMV", 0, ASL_RSVD_RETURN_VALUE,
"_ROM", 2, ASL_RSVD_RETURN_VALUE,
"_S0_", 0, ASL_RSVD_RETURN_VALUE,
"_S1_", 0, ASL_RSVD_RETURN_VALUE,
"_S2_", 0, ASL_RSVD_RETURN_VALUE,
"_S3_", 0, ASL_RSVD_RETURN_VALUE,
"_S4_", 0, ASL_RSVD_RETURN_VALUE,
"_S5_", 0, ASL_RSVD_RETURN_VALUE,
"_S1D", 0, ASL_RSVD_RETURN_VALUE,
"_S2D", 0, ASL_RSVD_RETURN_VALUE,
"_S3D", 0, ASL_RSVD_RETURN_VALUE,
"_S4D", 0, ASL_RSVD_RETURN_VALUE,
"_SBS", 0, ASL_RSVD_RETURN_VALUE,
"_SCP", 1, 0,
"_SEG", 0, ASL_RSVD_RETURN_VALUE,
"_SPD", 1, ASL_RSVD_RETURN_VALUE,
"_SRS", 1, 0,
"_SST", 1, 0,
"_STA", 0, ASL_RSVD_RETURN_VALUE,
"_STM", 3, 0,
"_STR", 0, ASL_RSVD_RETURN_VALUE,
"_SUN", 0, ASL_RSVD_RETURN_VALUE,
"_TC1", 0, ASL_RSVD_RETURN_VALUE,
"_TC2", 0, ASL_RSVD_RETURN_VALUE,
"_TMP", 0, ASL_RSVD_RETURN_VALUE,
"_TSP", 0, ASL_RSVD_RETURN_VALUE,
"_TZD", 0, ASL_RSVD_RETURN_VALUE,
"_TZP", 0, ASL_RSVD_RETURN_VALUE,
"_UID", 0, ASL_RSVD_RETURN_VALUE,
"_VPO", 0, ASL_RSVD_RETURN_VALUE,
"_WAK", 1, ASL_RSVD_RETURN_VALUE,
NULL, 0, 0,
};
@ -287,10 +288,10 @@ const ASL_RESERVED_INFO ReservedMethods[] = {
*
******************************************************************************/
const ASL_MAPPING_ENTRY AslKeywordMapping [] =
ASL_MAPPING_ENTRY AslKeywordMapping [] =
{
/* ACCESSAS */ OP_TABLE_ENTRY (AML_INT_ACCESSFIELD_OP, 0, 0, 0),
/* ACCESSAS */ OP_TABLE_ENTRY (AML_ACCESSFIELD_OP, 0, 0, 0),
/* ACCESSATTRIB_BLOCK */ OP_TABLE_ENTRY (AML_BYTE_OP, ACCESS_BLOCK_ACC, 0, 0),
/* ACCESSATTRIB_BYTE */ OP_TABLE_ENTRY (AML_BYTE_OP, ACCESS_BYTE_ACC, 0, 0),
/* ACCESSATTRIB_CALL */ OP_TABLE_ENTRY (AML_BYTE_OP, ACCESS_BYTE_ACC, 0, 0),
@ -339,7 +340,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* CREATEQWORDFIELD */ OP_TABLE_ENTRY (AML_CREATE_QWORD_FIELD_OP, 0, 0, 0),
/* CREATEWORDFIELD */ OP_TABLE_ENTRY (AML_CREATE_WORD_FIELD_OP, 0, 0, 0),
/* DATATABLEREGION */ OP_TABLE_ENTRY (AML_DATA_REGION_OP, 0, 0, 0),
/* DEBUG */ OP_TABLE_ENTRY (AML_DEBUG_OP, 0, 0, ACPI_BTYPE_DEBUG_OBJECT),
/* DEBUG */ OP_TABLE_ENTRY (AML_DEBUG_OP, 0, 0, 0),
/* DECODETYPE_POS */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
/* DECODETYPE_SUB */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
/* DECREMENT */ OP_TABLE_ENTRY (AML_DECREMENT_OP, 0, 0, ACPI_BTYPE_INTEGER),
@ -357,7 +358,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* DWORDCONST */ OP_TABLE_ENTRY (AML_RAW_DATA_DWORD, 0, 0, ACPI_BTYPE_INTEGER),
/* DWORDIO */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
/* DWORDMEMORY */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
/* EISAID */ OP_TABLE_ENTRY (AML_DWORD_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* EISAID */ OP_TABLE_ENTRY (AML_DWORD_OP, 0, 0, 0),
/* ELSE */ OP_TABLE_ENTRY (AML_ELSE_OP, 0, NODE_AML_PACKAGE, 0),
/* ELSEIF */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, NODE_AML_PACKAGE, 0),
/* ENDDEPENDENTFN */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
@ -457,7 +458,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* OBJECTTYPE_STR */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_STRING, 0, 0),
/* OBJECTTYPE_THZ */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_THERMAL, 0, 0),
/* OBJECTTYPE_UNK */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_ANY, 0, 0),
/* OFFSET */ OP_TABLE_ENTRY (AML_INT_RESERVEDFIELD_OP, 0, 0, 0),
/* OFFSET */ OP_TABLE_ENTRY (AML_RESERVEDFIELD_OP, 0, 0, 0),
/* ONE */ OP_TABLE_ENTRY (AML_ONE_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* ONES */ OP_TABLE_ENTRY (AML_ONES_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* OPERATIONREGION */ OP_TABLE_ENTRY (AML_REGION_OP, 0, 0, 0),
@ -485,13 +486,13 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* REGIONSPACE_SMBUS */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_SMBUS, 0, 0),
/* REGISTER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
/* RELEASE */ OP_TABLE_ENTRY (AML_RELEASE_OP, 0, 0, 0),
/* RESERVED_BYTES */ OP_TABLE_ENTRY (AML_INT_RESERVEDFIELD_OP, 0, 0, 0),
/* RESERVED_BYTES */ OP_TABLE_ENTRY (AML_RESERVEDFIELD_OP, 0, 0, 0),
/* RESET */ OP_TABLE_ENTRY (AML_RESET_OP, 0, 0, 0),
/* RESOURCETEMPLATE */ OP_TABLE_ENTRY (AML_BUFFER_OP, 0, 0, ACPI_BTYPE_BUFFER),
/* RESOURCETEMPLATE */ OP_TABLE_ENTRY (AML_BUFFER_OP, 0, 0, 0),
/* RESOURCETYPE_CONSUMER */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
/* RESOURCETYPE_PRODUCER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
/* RETURN */ OP_TABLE_ENTRY (AML_RETURN_OP, 0, 0, 0),
/* REVISION */ OP_TABLE_ENTRY (AML_REVISION_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* REVISION */ OP_TABLE_ENTRY (AML_REVISION_OP, 0, 0, 0),
/* SCOPE */ OP_TABLE_ENTRY (AML_SCOPE_OP, 0, NODE_AML_PACKAGE, 0),
/* SERIALIZERULE_NOTSERIAL */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
/* SERIALIZERULE_SERIAL */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
@ -525,7 +526,6 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* UPDATERULE_ONES */ OP_TABLE_ENTRY (AML_BYTE_OP, UPDATE_WRITE_AS_ONES, 0, 0),
/* UPDATERULE_PRESERVE */ OP_TABLE_ENTRY (AML_BYTE_OP, UPDATE_PRESERVE, 0, 0),
/* UPDATERULE_ZEROS */ OP_TABLE_ENTRY (AML_BYTE_OP, UPDATE_WRITE_AS_ZEROS, 0, 0),
/* VAR_PACKAGE */ OP_TABLE_ENTRY (AML_VAR_PACKAGE_OP, 0, NODE_AML_PACKAGE, ACPI_BTYPE_PACKAGE),
/* VENDORLONG */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
/* VENDORSHORT */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
/* WAIT */ OP_TABLE_ENTRY (AML_WAIT_OP, 0, 0, ACPI_BTYPE_INTEGER),
@ -542,6 +542,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
};
#include "amlcode.h"
#include "acdispat.h"
#include "acparser.h"
@ -555,7 +556,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/*******************************************************************************
*
* FUNCTION: AcpiExValidateObjectType
* FUNCTION: AcpiAmlValidateObjectType
*
* PARAMETERS: Type Object type to validate
*
@ -564,7 +565,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
******************************************************************************/
BOOLEAN
AcpiExValidateObjectType (
AcpiAmlValidateObjectType (
ACPI_OBJECT_TYPE Type)
{
@ -593,25 +594,23 @@ AcpiExValidateObjectType (
*
******************************************************************************/
ACPI_OBJECT_TYPE8
OBJECT_TYPE_INTERNAL
AcpiDsMapOpcodeToDataType (
UINT16 Opcode,
UINT32 *OutFlags)
{
ACPI_OBJECT_TYPE8 DataType = INTERNAL_TYPE_INVALID;
OBJECT_TYPE_INTERNAL DataType = INTERNAL_TYPE_INVALID;
ACPI_OPCODE_INFO *OpInfo;
UINT32 Flags = 0;
PROC_NAME ("DsMapOpcodeToDataType");
OpInfo = AcpiPsGetOpcodeInfo (Opcode);
if (ACPI_GET_OP_TYPE (OpInfo) != ACPI_OP_TYPE_OPCODE)
{
/* Unknown opcode */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown AML opcode: %x\n",
DEBUG_PRINT (ACPI_ERROR,
("MapOpcode: Unknown AML opcode: %x\n",
Opcode));
return (DataType);
@ -627,7 +626,6 @@ AcpiDsMapOpcodeToDataType (
case AML_BYTE_OP:
case AML_WORD_OP:
case AML_DWORD_OP:
case AML_QWORD_OP:
DataType = ACPI_TYPE_INTEGER;
break;
@ -638,13 +636,13 @@ AcpiDsMapOpcodeToDataType (
DataType = ACPI_TYPE_STRING;
break;
case AML_INT_NAMEPATH_OP:
case AML_NAMEPATH_OP:
DataType = INTERNAL_TYPE_REFERENCE;
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Unknown (type LITERAL) AML opcode: %x\n",
DEBUG_PRINT (ACPI_ERROR,
("MapOpcode: Unknown (type LITERAL) AML opcode: %x\n",
Opcode));
break;
}
@ -661,14 +659,13 @@ AcpiDsMapOpcodeToDataType (
break;
case AML_PACKAGE_OP:
case AML_VAR_PACKAGE_OP:
DataType = ACPI_TYPE_PACKAGE;
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Unknown (type DATA_TERM) AML opcode: %x\n",
DEBUG_PRINT (ACPI_ERROR,
("MapOpcode: Unknown (type DATA_TERM) AML opcode: %x\n",
Opcode));
break;
}
@ -688,9 +685,8 @@ AcpiDsMapOpcodeToDataType (
case OPTYPE_DYADIC2:
case OPTYPE_DYADIC2R:
case OPTYPE_DYADIC2S:
case OPTYPE_TRIADIC:
case OPTYPE_QUADRADIC:
case OPTYPE_HEXADIC:
case OPTYPE_INDEX:
case OPTYPE_MATCH:
case OPTYPE_RETURN:
Flags = OP_HAS_RETURN_VALUE;
@ -720,8 +716,8 @@ AcpiDsMapOpcodeToDataType (
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Unimplemented data type opcode: %x\n",
DEBUG_PRINT (ACPI_ERROR,
("MapOpcode: Unimplemented data type opcode: %x\n",
Opcode));
break;
}
@ -746,15 +742,15 @@ AcpiDsMapOpcodeToDataType (
* RETURN: The ACPI type associated with the named opcode
*
* DESCRIPTION: Convert a raw Named AML opcode to the associated data type.
* Named opcodes are a subset of the AML opcodes.
* Named opcodes are a subsystem of the AML opcodes.
*
******************************************************************************/
ACPI_OBJECT_TYPE8
OBJECT_TYPE_INTERNAL
AcpiDsMapNamedOpcodeToDataType (
UINT16 Opcode)
{
ACPI_OBJECT_TYPE8 DataType;
OBJECT_TYPE_INTERNAL DataType;
/* Decode Opcode */
@ -797,12 +793,12 @@ AcpiDsMapNamedOpcodeToDataType (
DataType = INTERNAL_TYPE_BANK_FIELD_DEFN;
break;
case AML_INT_NAMEDFIELD_OP: /* NO CASE IN ORIGINAL */
case AML_NAMEDFIELD_OP: /* NO CASE IN ORIGINAL */
DataType = ACPI_TYPE_ANY;
break;
case AML_NAME_OP: /* NameOp - special code in original */
case AML_INT_NAMEPATH_OP:
case AML_NAMEPATH_OP:
DataType = ACPI_TYPE_ANY;
break;
@ -828,7 +824,7 @@ AcpiDsMapNamedOpcodeToDataType (
case AML_CREATE_BYTE_FIELD_OP:
case AML_CREATE_BIT_FIELD_OP:
case AML_CREATE_QWORD_FIELD_OP:
DataType = ACPI_TYPE_BUFFER_FIELD;
DataType = ACPI_TYPE_FIELD_UNIT;
break;
default:

View File

@ -1,8 +1,8 @@
/******************************************************************************
*
* Module Name: asloperands - AML operand processing
* $Revision: 1.26 $
* Module Name: aslopcode - AML opcode generation
* $Revision: 1.14 $
*
*****************************************************************************/
@ -184,9 +184,7 @@ OpnDoMethod (
/* Put the bits in their proper places */
MethodFlags = (UINT8) ((NumArgs & 0x7) |
((Serialized & 0x1) << 3) |
((Concurrency & 0xF) << 4));
MethodFlags = (NumArgs & 0x7) | ((Serialized & 0x1) << 3) | ((Concurrency & 0xF) << 4);
/* Use the last node for the combined flags byte */
@ -216,7 +214,6 @@ OpnDoMethod (
void
OpnDoFieldCommon (
ASL_PARSE_NODE *FieldNode,
ASL_PARSE_NODE *Node)
{
ASL_PARSE_NODE *Next;
@ -234,10 +231,6 @@ OpnDoFieldCommon (
AccessType = Node->Value.Integer8;
Node->ParseOpcode = DEFAULT_ARG;
/* Set the access type in the parent (field) node for use later */
FieldNode->Value.Integer8 = AccessType;
/* LockRule -- not optional, so no need to check for DEFAULT_ARG */
Next = Node->Peer;
@ -251,9 +244,7 @@ OpnDoFieldCommon (
/* Generate the flags byte */
FieldFlags = (UINT8) ((AccessType & 0x0F) |
((LockRule & 0x01) << 4) |
((UpdateRule & 0x03) << 5));
FieldFlags = (AccessType & 0x0F) | ((LockRule & 0x01) << 4) | ((UpdateRule & 0x03) << 5);
/* Use the previous node to be the FieldFlags node */
@ -271,10 +262,6 @@ OpnDoFieldCommon (
while (Next)
{
/* Save the offset of this field unit */
Next->ExtraValue = CurrentBitOffset;
switch (Next->ParseOpcode)
{
case ACCESSAS:
@ -373,7 +360,7 @@ OpnDoField (
/* Second child is the AccessType */
OpnDoFieldCommon (Node, Next->Peer);
OpnDoFieldCommon (Next->Peer);
}
@ -407,7 +394,7 @@ OpnDoIndexField (
/* Third child is the AccessType */
OpnDoFieldCommon (Node, Next->Peer);
OpnDoFieldCommon (Next->Peer);
}
@ -446,58 +433,11 @@ OpnDoBankField (
/* Fourth child is the AccessType */
OpnDoFieldCommon (Node, Next->Peer);
OpnDoFieldCommon (Next->Peer);
}
/*******************************************************************************
*
* FUNCTION: OpnDoRegion
*
* PARAMETERS: Node - The parent parse node
*
* RETURN: None
*
* DESCRIPTION: Tries to get the length of the region. Can only do this at
* compile time if the length is a constant.
*
******************************************************************************/
void
OpnDoRegion (
ASL_PARSE_NODE *Node)
{
ASL_PARSE_NODE *Next;
/* Opcode is parent node */
/* First child is the region name */
Next = Node->Child;
/* Second child is the space ID*/
Next = Next->Peer;
/* Third child is the region offset */
Next = Next->Peer;
/* Fourth child is the region length */
Next = Next->Peer;
if (Next->ParseOpcode == INTEGER)
{
Node->Value.Integer = Next->Value.Integer;
}
else
{
Node->Value.Integer = ACPI_INTEGER_MAX;
}
}
/*******************************************************************************
*
* FUNCTION: OpnDoBuffer
@ -677,8 +617,7 @@ OpnDoPackage (
/* Check if initializer list is longer than the buffer length */
if ((PackageLengthNode->ParseOpcode == INTEGER) ||
(PackageLengthNode->ParseOpcode == BYTECONST))
if (PackageLengthNode->ParseOpcode == INTEGER)
{
if (PackageLengthNode->Value.Integer > PackageLength)
{
@ -687,22 +626,13 @@ OpnDoPackage (
}
/*
* If not a variable-length package, check for a zero
* package length
*/
if ((PackageLengthNode->ParseOpcode == INTEGER) ||
(PackageLengthNode->ParseOpcode == BYTECONST) ||
(PackageLengthNode->ParseOpcode == DEFAULT_ARG))
if (!PackageLength)
{
if (!PackageLength)
{
/* No length AND no items -- issue a warning */
/* No length AND no items -- issue a warning */
AslError (ASL_WARNING, ASL_MSG_PACKAGE_LENGTH, PackageLengthNode, NULL);
AslError (ASL_WARNING, ASL_MSG_PACKAGE_LENGTH, PackageLengthNode, NULL);
/* But go ahead and put the buffer length of zero into the AML */
}
/* But go ahead and put the buffer length of zero into the AML */
}
@ -720,74 +650,6 @@ OpnDoPackage (
}
/*******************************************************************************
*
* FUNCTION: OpnDoLoadTable
*
* PARAMETERS: Node - The parent parse node
*
* RETURN: None
*
* DESCRIPTION:
*
******************************************************************************/
void
OpnDoLoadTable (
ASL_PARSE_NODE *Node)
{
ASL_PARSE_NODE *Next;
/* Opcode is parent node */
/* First child is the table signature */
Next = Node->Child;
/* Second child is the OEM ID*/
Next = Next->Peer;
/* Third child is the OEM table ID */
Next = Next->Peer;
/* Fourth child is the RootPath string */
Next = Next->Peer;
if (Next->ParseOpcode == ZERO)
{
Next->ParseOpcode = STRING_LITERAL;
Next->Value.String = "\\";
Next->AmlLength = 2;
OpcGenerateAmlOpcode (Next);
}
/* Fifth child is the [optional] ParameterPathString */
/* Sixth child is the [optional] ParameterData */
/*
Next = Next->Peer;
if (Next->ParseOpcode == DEFAULT_ARG)
{
Next->AmlLength = 1;
Next->ParseOpcode = ZERO;
OpcGenerateAmlOpcode (Next);
}
Next = Next->Peer;
if (Next->ParseOpcode == DEFAULT_ARG)
{
Next->AmlLength = 1;
Next->ParseOpcode = ZERO;
OpcGenerateAmlOpcode (Next);
}
*/
}
/*******************************************************************************
*
* FUNCTION: OpnDoDefinitionBlock
@ -971,7 +833,7 @@ OpnAttachNameToNode (
if (Child)
{
PsNode->ExternalName = Child->Value.String;
Status = UtInternalizeName (Child->Value.String, &PsNode->Namepath);
Status = AcpiNsInternalizeName (Child->Value.String, &PsNode->Namepath);
if (ACPI_FAILURE (Status))
{
}
@ -979,7 +841,6 @@ OpnAttachNameToNode (
}
/*******************************************************************************
*
* FUNCTION: OpnGenerateAmlOperands
@ -1032,18 +893,10 @@ OpnGenerateAmlOperands (
OpnDoBuffer (Node);
break;
case LOADTABLE:
OpnDoLoadTable (Node);
break;
case PACKAGE:
OpnDoPackage (Node);
break;
case OPERATIONREGION:
OpnDoRegion (Node);
break;
case RESOURCETEMPLATE:
RsDoResourceTemplate (Node);
break;