Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2215 → Rev 2216

/drivers/devman/acpica/compiler/aslanalyze.c
1,7 → 1,6
 
/******************************************************************************
*
* Module Name: aslanalyze.c - check for semantic errors
* Module Name: aslanalyze.c - Support functions for parse tree walks
*
*****************************************************************************/
 
9,7 → 8,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
117,60 → 116,13
 
#include "aslcompiler.h"
#include "aslcompiler.y.h"
#include "acparser.h"
#include "amlcode.h"
#include <string.h>
 
 
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslanalyze")
 
/* Local prototypes */
 
static UINT32
AnMapArgTypeToBtype (
UINT32 ArgType);
 
static UINT32
AnMapEtypeToBtype (
UINT32 Etype);
 
static void
AnFormatBtype (
char *Buffer,
UINT32 Btype);
 
static UINT32
AnGetBtype (
ACPI_PARSE_OBJECT *Op);
 
static UINT32
AnMapObjTypeToBtype (
ACPI_PARSE_OBJECT *Op);
 
static BOOLEAN
AnLastStatementIsReturn (
ACPI_PARSE_OBJECT *Op);
 
static void
AnCheckMethodReturnValue (
ACPI_PARSE_OBJECT *Op,
const ACPI_OPCODE_INFO *OpInfo,
ACPI_PARSE_OBJECT *ArgOp,
UINT32 RequiredBtypes,
UINT32 ThisNodeBtype);
 
static BOOLEAN
AnIsInternalMethod (
ACPI_PARSE_OBJECT *Op);
 
static UINT32
AnGetInternalMethodReturnType (
ACPI_PARSE_OBJECT *Op);
 
BOOLEAN
AnIsResultUsed (
ACPI_PARSE_OBJECT *Op);
 
 
/*******************************************************************************
*
* FUNCTION: AnIsInternalMethod
183,7 → 135,7
*
******************************************************************************/
 
static BOOLEAN
BOOLEAN
AnIsInternalMethod (
ACPI_PARSE_OBJECT *Op)
{
210,7 → 162,7
*
******************************************************************************/
 
static UINT32
UINT32
AnGetInternalMethodReturnType (
ACPI_PARSE_OBJECT *Op)
{
227,791 → 179,108
 
/*******************************************************************************
*
* FUNCTION: AnMapArgTypeToBtype
* FUNCTION: AnCheckId
*
* PARAMETERS: ArgType - The ARGI required type(s) for this argument,
* from the opcode info table
* PARAMETERS: Op - Current parse op
* Type - HID or CID
*
* RETURN: The corresponding Bit-encoded types
* RETURN: None
*
* DESCRIPTION: Convert an encoded ARGI required argument type code into a
* bitfield type code. Implements the implicit source conversion
* rules.
* DESCRIPTION: Perform various checks on _HID and _CID strings. Only limited
* checks can be performed on _CID strings.
*
******************************************************************************/
 
static UINT32
AnMapArgTypeToBtype (
UINT32 ArgType)
{
 
switch (ArgType)
{
 
/* Simple types */
 
case ARGI_ANYTYPE:
return (ACPI_BTYPE_OBJECTS_AND_REFS);
 
case ARGI_PACKAGE:
return (ACPI_BTYPE_PACKAGE);
 
case ARGI_EVENT:
return (ACPI_BTYPE_EVENT);
 
case ARGI_MUTEX:
return (ACPI_BTYPE_MUTEX);
 
case ARGI_DDBHANDLE:
/*
* DDBHandleObject := SuperName
* ACPI_BTYPE_REFERENCE: Index reference as parameter of Load/Unload
*/
return (ACPI_BTYPE_DDB_HANDLE | ACPI_BTYPE_REFERENCE);
 
/* Interchangeable types */
/*
* Source conversion rules:
* Integer, String, and Buffer are all interchangeable
*/
case ARGI_INTEGER:
case ARGI_STRING:
case ARGI_BUFFER:
case ARGI_BUFFER_OR_STRING:
case ARGI_COMPUTEDATA:
return (ACPI_BTYPE_COMPUTE_DATA);
 
/* References */
 
case ARGI_INTEGER_REF:
return (ACPI_BTYPE_INTEGER);
 
case ARGI_OBJECT_REF:
return (ACPI_BTYPE_ALL_OBJECTS);
 
case ARGI_DEVICE_REF:
return (ACPI_BTYPE_DEVICE_OBJECTS);
 
case ARGI_REFERENCE:
return (ACPI_BTYPE_REFERENCE);
 
case ARGI_TARGETREF:
case ARGI_FIXED_TARGET:
case ARGI_SIMPLE_TARGET:
return (ACPI_BTYPE_OBJECTS_AND_REFS);
 
/* Complex types */
 
case ARGI_DATAOBJECT:
 
/*
* Buffer, string, package or reference to a Op -
* Used only by SizeOf operator
*/
return (ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER |
ACPI_BTYPE_PACKAGE | ACPI_BTYPE_REFERENCE);
 
case ARGI_COMPLEXOBJ:
 
/* Buffer, String, or package */
 
return (ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER | ACPI_BTYPE_PACKAGE);
 
case ARGI_REF_OR_STRING:
return (ACPI_BTYPE_STRING | ACPI_BTYPE_REFERENCE);
 
case ARGI_REGION_OR_BUFFER:
 
/* Used by Load() only. Allow buffers in addition to regions/fields */
 
return (ACPI_BTYPE_REGION | ACPI_BTYPE_BUFFER | ACPI_BTYPE_FIELD_UNIT);
 
case ARGI_DATAREFOBJ:
return (ACPI_BTYPE_INTEGER |ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER |
ACPI_BTYPE_PACKAGE | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE);
 
default:
break;
}
 
return (ACPI_BTYPE_OBJECTS_AND_REFS);
}
 
 
/*******************************************************************************
*
* FUNCTION: AnMapEtypeToBtype
*
* PARAMETERS: Etype - Encoded ACPI Type
*
* RETURN: Btype corresponding to the Etype
*
* DESCRIPTION: Convert an encoded ACPI type to a bitfield type applying the
* operand conversion rules. In other words, returns the type(s)
* this Etype is implicitly converted to during interpretation.
*
******************************************************************************/
 
static UINT32
AnMapEtypeToBtype (
UINT32 Etype)
{
 
 
if (Etype == ACPI_TYPE_ANY)
{
return ACPI_BTYPE_OBJECTS_AND_REFS;
}
 
/* Try the standard ACPI data types */
 
if (Etype <= ACPI_TYPE_EXTERNAL_MAX)
{
/*
* This switch statement implements the allowed operand conversion
* rules as per the "ASL Data Types" section of the ACPI
* specification.
*/
switch (Etype)
{
case ACPI_TYPE_INTEGER:
return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_DDB_HANDLE);
 
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
return (ACPI_BTYPE_COMPUTE_DATA);
 
case ACPI_TYPE_PACKAGE:
return (ACPI_BTYPE_PACKAGE);
 
case ACPI_TYPE_FIELD_UNIT:
return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_FIELD_UNIT);
 
case ACPI_TYPE_BUFFER_FIELD:
return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_BUFFER_FIELD);
 
case ACPI_TYPE_DDB_HANDLE:
return (ACPI_BTYPE_INTEGER | ACPI_BTYPE_DDB_HANDLE);
 
case ACPI_BTYPE_DEBUG_OBJECT:
 
/* Cannot be used as a source operand */
 
return (0);
 
default:
return (1 << (Etype - 1));
}
}
 
/* Try the internal data types */
 
switch (Etype)
{
case ACPI_TYPE_LOCAL_REGION_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
 
/* Named fields can be either Integer/Buffer/String */
 
return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_FIELD_UNIT);
 
case ACPI_TYPE_LOCAL_ALIAS:
 
return (ACPI_BTYPE_INTEGER);
 
 
case ACPI_TYPE_LOCAL_RESOURCE:
case ACPI_TYPE_LOCAL_RESOURCE_FIELD:
 
return (ACPI_BTYPE_REFERENCE);
 
default:
printf ("Unhandled encoded type: %X\n", Etype);
return (0);
}
}
 
 
/*******************************************************************************
*
* FUNCTION: AnFormatBtype
*
* PARAMETERS: Btype - Bitfield of ACPI types
* Buffer - Where to put the ascii string
*
* RETURN: None.
*
* DESCRIPTION: Convert a Btype to a string of ACPI types
*
******************************************************************************/
 
static void
AnFormatBtype (
char *Buffer,
UINT32 Btype)
{
UINT32 Type;
BOOLEAN First = TRUE;
 
 
*Buffer = 0;
 
if (Btype == 0)
{
strcat (Buffer, "NoReturnValue");
return;
}
 
for (Type = 1; Type <= ACPI_TYPE_EXTERNAL_MAX; Type++)
{
if (Btype & 0x00000001)
{
if (!First)
{
strcat (Buffer, "|");
}
First = FALSE;
strcat (Buffer, AcpiUtGetTypeName (Type));
}
Btype >>= 1;
}
 
if (Btype & 0x00000001)
{
if (!First)
{
strcat (Buffer, "|");
}
First = FALSE;
strcat (Buffer, "Reference");
}
 
Btype >>= 1;
if (Btype & 0x00000001)
{
if (!First)
{
strcat (Buffer, "|");
}
First = FALSE;
strcat (Buffer, "Resource");
}
}
 
 
/*******************************************************************************
*
* FUNCTION: AnGetBtype
*
* PARAMETERS: Op - Parse node whose type will be returned.
*
* RETURN: The Btype associated with the Op.
*
* DESCRIPTION: Get the (bitfield) ACPI type associated with the parse node.
* Handles the case where the node is a name or method call and
* the actual type must be obtained from the namespace node.
*
******************************************************************************/
 
static UINT32
AnGetBtype (
ACPI_PARSE_OBJECT *Op)
{
ACPI_NAMESPACE_NODE *Node;
ACPI_PARSE_OBJECT *ReferencedNode;
UINT32 ThisNodeBtype = 0;
 
 
if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
(Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) ||
(Op->Asl.ParseOpcode == PARSEOP_METHODCALL))
{
Node = Op->Asl.Node;
if (!Node)
{
DbgPrint (ASL_DEBUG_OUTPUT,
"No attached Nsnode: [%s] at line %u name [%s], ignoring typecheck\n",
Op->Asl.ParseOpName, Op->Asl.LineNumber,
Op->Asl.ExternalName);
return ACPI_UINT32_MAX;
}
 
ThisNodeBtype = AnMapEtypeToBtype (Node->Type);
if (!ThisNodeBtype)
{
AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op,
"could not map type");
}
 
/*
* Since it was a named reference, enable the
* reference bit also
*/
ThisNodeBtype |= ACPI_BTYPE_REFERENCE;
 
if (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)
{
ReferencedNode = Node->Op;
if (!ReferencedNode)
{
/* Check for an internal method */
 
if (AnIsInternalMethod (Op))
{
return (AnGetInternalMethodReturnType (Op));
}
 
AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op,
"null Op pointer");
return ACPI_UINT32_MAX;
}
 
if (ReferencedNode->Asl.CompileFlags & NODE_METHOD_TYPED)
{
ThisNodeBtype = ReferencedNode->Asl.AcpiBtype;
}
else
{
return (ACPI_UINT32_MAX -1);
}
}
}
else
{
ThisNodeBtype = Op->Asl.AcpiBtype;
}
 
return (ThisNodeBtype);
}
 
 
/*******************************************************************************
*
* FUNCTION: AnMapObjTypeToBtype
*
* PARAMETERS: Op - A parse node
*
* RETURN: A Btype
*
* DESCRIPTION: Map object to the associated "Btype"
*
******************************************************************************/
 
static UINT32
AnMapObjTypeToBtype (
ACPI_PARSE_OBJECT *Op)
{
 
switch (Op->Asl.ParseOpcode)
{
case PARSEOP_OBJECTTYPE_BFF: /* "BuffFieldObj" */
return (ACPI_BTYPE_BUFFER_FIELD);
 
case PARSEOP_OBJECTTYPE_BUF: /* "BuffObj" */
return (ACPI_BTYPE_BUFFER);
 
case PARSEOP_OBJECTTYPE_DDB: /* "DDBHandleObj" */
return (ACPI_BTYPE_DDB_HANDLE);
 
case PARSEOP_OBJECTTYPE_DEV: /* "DeviceObj" */
return (ACPI_BTYPE_DEVICE);
 
case PARSEOP_OBJECTTYPE_EVT: /* "EventObj" */
return (ACPI_BTYPE_EVENT);
 
case PARSEOP_OBJECTTYPE_FLD: /* "FieldUnitObj" */
return (ACPI_BTYPE_FIELD_UNIT);
 
case PARSEOP_OBJECTTYPE_INT: /* "IntObj" */
return (ACPI_BTYPE_INTEGER);
 
case PARSEOP_OBJECTTYPE_MTH: /* "MethodObj" */
return (ACPI_BTYPE_METHOD);
 
case PARSEOP_OBJECTTYPE_MTX: /* "MutexObj" */
return (ACPI_BTYPE_MUTEX);
 
case PARSEOP_OBJECTTYPE_OPR: /* "OpRegionObj" */
return (ACPI_BTYPE_REGION);
 
case PARSEOP_OBJECTTYPE_PKG: /* "PkgObj" */
return (ACPI_BTYPE_PACKAGE);
 
case PARSEOP_OBJECTTYPE_POW: /* "PowerResObj" */
return (ACPI_BTYPE_POWER);
 
case PARSEOP_OBJECTTYPE_STR: /* "StrObj" */
return (ACPI_BTYPE_STRING);
 
case PARSEOP_OBJECTTYPE_THZ: /* "ThermalZoneObj" */
return (ACPI_BTYPE_THERMAL);
 
case PARSEOP_OBJECTTYPE_UNK: /* "UnknownObj" */
return (ACPI_BTYPE_OBJECTS_AND_REFS);
 
default:
return (0);
}
}
 
 
/*******************************************************************************
*
* FUNCTION: AnMethodAnalysisWalkBegin
*
* PARAMETERS: ASL_WALK_CALLBACK
*
* RETURN: Status
*
* DESCRIPTION: Descending callback for the analysis walk. Check methods for:
* 1) Initialized local variables
* 2) Valid arguments
* 3) Return types
*
******************************************************************************/
 
ACPI_STATUS
AnMethodAnalysisWalkBegin (
void
AnCheckId (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context)
ACPI_NAME Type)
{
ASL_ANALYSIS_WALK_INFO *WalkInfo = (ASL_ANALYSIS_WALK_INFO *) Context;
ASL_METHOD_INFO *MethodInfo = WalkInfo->MethodStack;
ACPI_PARSE_OBJECT *Next;
UINT32 RegisterNumber;
UINT32 i;
char LocalName[] = "Local0";
char ArgName[] = "Arg0";
ACPI_PARSE_OBJECT *ArgNode;
ACPI_PARSE_OBJECT *NextType;
ACPI_PARSE_OBJECT *NextParamType;
UINT8 ActualArgs = 0;
ACPI_SIZE Length;
UINT32 AlphaPrefixLength;
 
 
switch (Op->Asl.ParseOpcode)
{
case PARSEOP_METHOD:
/* Only care about string versions of _HID/_CID (integers are legal) */
 
TotalMethods++;
 
/* Create and init method info */
 
MethodInfo = UtLocalCalloc (sizeof (ASL_METHOD_INFO));
MethodInfo->Next = WalkInfo->MethodStack;
MethodInfo->Op = Op;
 
WalkInfo->MethodStack = MethodInfo;
 
/* Get the name node, ignored here */
 
Next = Op->Asl.Child;
 
/* Get the NumArguments node */
 
Next = Next->Asl.Next;
MethodInfo->NumArguments = (UINT8)
(((UINT8) Next->Asl.Value.Integer) & 0x07);
 
/* Get the SerializeRule and SyncLevel nodes, ignored here */
 
Next = Next->Asl.Next;
Next = Next->Asl.Next;
ArgNode = Next;
 
/* Get the ReturnType node */
 
Next = Next->Asl.Next;
 
NextType = Next->Asl.Child;
while (NextType)
if (Op->Asl.ParseOpcode != PARSEOP_STRING_LITERAL)
{
/* Get and map each of the ReturnTypes */
 
MethodInfo->ValidReturnTypes |= AnMapObjTypeToBtype (NextType);
NextType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
NextType = NextType->Asl.Next;
return;
}
 
/* Get the ParameterType node */
/* For both _HID and _CID, the string must be non-null */
 
Next = Next->Asl.Next;
 
NextType = Next->Asl.Child;
while (NextType)
Length = strlen (Op->Asl.Value.String);
if (!Length)
{
if (NextType->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
{
NextParamType = NextType->Asl.Child;
while (NextParamType)
{
MethodInfo->ValidArgTypes[ActualArgs] |= AnMapObjTypeToBtype (NextParamType);
NextParamType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
NextParamType = NextParamType->Asl.Next;
AslError (ASL_ERROR, ASL_MSG_NULL_STRING,
Op, NULL);
return;
}
}
else
{
MethodInfo->ValidArgTypes[ActualArgs] =
AnMapObjTypeToBtype (NextType);
NextType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
ActualArgs++;
}
 
NextType = NextType->Asl.Next;
}
 
if ((MethodInfo->NumArguments) &&
(MethodInfo->NumArguments != ActualArgs))
{
/* error: Param list did not match number of args */
}
 
/* Allow numarguments == 0 for Function() */
 
if ((!MethodInfo->NumArguments) && (ActualArgs))
{
MethodInfo->NumArguments = ActualArgs;
ArgNode->Asl.Value.Integer |= ActualArgs;
}
 
/*
* Actual arguments are initialized at method entry.
* All other ArgX "registers" can be used as locals, so we
* track their initialization.
* One of the things we want to catch here is the use of a leading
* asterisk in the string -- an odd construct that certain platform
* manufacturers are fond of. Technically, a leading asterisk is OK
* for _CID, but a valid use of this has not been seen.
*/
for (i = 0; i < MethodInfo->NumArguments; i++)
if (*Op->Asl.Value.String == '*')
{
MethodInfo->ArgInitialized[i] = TRUE;
AslError (ASL_ERROR, ASL_MSG_LEADING_ASTERISK,
Op, Op->Asl.Value.String);
return;
}
break;
 
/* _CID strings are bus-specific, no more checks can be performed */
 
case PARSEOP_METHODCALL:
 
if (MethodInfo &&
(Op->Asl.Node == MethodInfo->Op->Asl.Node))
if (Type == ASL_TYPE_CID)
{
AslError (ASL_REMARK, ASL_MSG_RECURSION, Op, Op->Asl.ExternalName);
return;
}
break;
 
/* For _HID, all characters must be alphanumeric */
 
case PARSEOP_LOCAL0:
case PARSEOP_LOCAL1:
case PARSEOP_LOCAL2:
case PARSEOP_LOCAL3:
case PARSEOP_LOCAL4:
case PARSEOP_LOCAL5:
case PARSEOP_LOCAL6:
case PARSEOP_LOCAL7:
 
if (!MethodInfo)
for (i = 0; Op->Asl.Value.String[i]; i++)
{
/*
* Local was used outside a control method, or there was an error
* in the method declaration.
*/
AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD, Op, Op->Asl.ExternalName);
return (AE_ERROR);
}
 
RegisterNumber = (Op->Asl.AmlOpcode & 0x000F);
 
/*
* If the local is being used as a target, mark the local
* initialized
*/
if (Op->Asl.CompileFlags & NODE_IS_TARGET)
if (!isalnum ((int) Op->Asl.Value.String[i]))
{
MethodInfo->LocalInitialized[RegisterNumber] = TRUE;
}
 
/*
* Otherwise, this is a reference, check if the local
* has been previously initialized.
*
* The only operator that accepts an uninitialized value is ObjectType()
*/
else if ((!MethodInfo->LocalInitialized[RegisterNumber]) &&
(Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_OBJECTTYPE))
{
LocalName[strlen (LocalName) -1] = (char) (RegisterNumber + 0x30);
AslError (ASL_ERROR, ASL_MSG_LOCAL_INIT, Op, LocalName);
}
AslError (ASL_ERROR, ASL_MSG_ALPHANUMERIC_STRING,
Op, Op->Asl.Value.String);
break;
 
 
case PARSEOP_ARG0:
case PARSEOP_ARG1:
case PARSEOP_ARG2:
case PARSEOP_ARG3:
case PARSEOP_ARG4:
case PARSEOP_ARG5:
case PARSEOP_ARG6:
 
if (!MethodInfo)
{
/*
* Arg was used outside a control method, or there was an error
* in the method declaration.
*/
AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD, Op, Op->Asl.ExternalName);
return (AE_ERROR);
}
 
RegisterNumber = (Op->Asl.AmlOpcode & 0x000F) - 8;
ArgName[strlen (ArgName) -1] = (char) (RegisterNumber + 0x30);
 
/*
* If the Arg is being used as a target, mark the local
* initialized
*/
if (Op->Asl.CompileFlags & NODE_IS_TARGET)
{
MethodInfo->ArgInitialized[RegisterNumber] = TRUE;
}
 
/*
* Otherwise, this is a reference, check if the Arg
* has been previously initialized.
*
* The only operator that accepts an uninitialized value is ObjectType()
*/
else if ((!MethodInfo->ArgInitialized[RegisterNumber]) &&
(Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_OBJECTTYPE))
{
AslError (ASL_ERROR, ASL_MSG_ARG_INIT, Op, ArgName);
}
/* _HID String must be of the form "XXX####" or "ACPI####" */
 
/* Flag this arg if it is not a "real" argument to the method */
 
if (RegisterNumber >= MethodInfo->NumArguments)
if ((Length < 7) || (Length > 8))
{
AslError (ASL_REMARK, ASL_MSG_NOT_PARAMETER, Op, ArgName);
AslError (ASL_ERROR, ASL_MSG_HID_LENGTH,
Op, Op->Asl.Value.String);
return;
}
break;
 
/* _HID Length is valid, now check for uppercase (first 3 or 4 chars) */
 
case PARSEOP_RETURN:
 
if (!MethodInfo)
AlphaPrefixLength = 3;
if (Length >= 8)
{
/*
* Probably was an error in the method declaration,
* no additional error here
*/
ACPI_WARNING ((AE_INFO, "%p, No parent method", Op));
return (AE_ERROR);
AlphaPrefixLength = 4;
}
 
/* Child indicates a return value */
/* Ensure the alphabetic prefix is all uppercase */
 
if ((Op->Asl.Child) &&
(Op->Asl.Child->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG))
for (i = 0; (i < AlphaPrefixLength) && Op->Asl.Value.String[i]; i++)
{
MethodInfo->NumReturnWithValue++;
}
else
if (!isupper ((int) Op->Asl.Value.String[i]))
{
MethodInfo->NumReturnNoValue++;
}
AslError (ASL_ERROR, ASL_MSG_UPPER_CASE,
Op, &Op->Asl.Value.String[i]);
break;
 
 
case PARSEOP_BREAK:
case PARSEOP_CONTINUE:
 
Next = Op->Asl.Parent;
while (Next)
{
if (Next->Asl.ParseOpcode == PARSEOP_WHILE)
{
break;
}
Next = Next->Asl.Parent;
}
 
if (!Next)
{
AslError (ASL_ERROR, ASL_MSG_NO_WHILE, Op, NULL);
}
break;
 
 
case PARSEOP_STALL:
 
/* We can range check if the argument is an integer */
 
if ((Op->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER) &&
(Op->Asl.Child->Asl.Value.Integer > ACPI_UINT8_MAX))
{
AslError (ASL_ERROR, ASL_MSG_INVALID_TIME, Op, NULL);
}
break;
 
 
case PARSEOP_DEVICE:
case PARSEOP_EVENT:
case PARSEOP_MUTEX:
case PARSEOP_OPERATIONREGION:
case PARSEOP_POWERRESOURCE:
case PARSEOP_PROCESSOR:
case PARSEOP_THERMALZONE:
 
/*
* The first operand is a name to be created in the namespace.
* Check against the reserved list.
*/
i = ApCheckForPredefinedName (Op, Op->Asl.NameSeg);
if (i < ACPI_VALID_RESERVED_NAME_MAX)
{
AslError (ASL_ERROR, ASL_MSG_RESERVED_USE, Op, Op->Asl.ExternalName);
}
break;
 
 
case PARSEOP_NAME:
 
/* Typecheck any predefined names statically defined with Name() */
 
ApCheckForPredefinedObject (Op, Op->Asl.NameSeg);
 
/* Special typechecking for _HID */
 
if (!ACPI_STRCMP (METHOD_NAME__HID, Op->Asl.NameSeg))
{
Next = Op->Asl.Child->Asl.Next;
if (Next->Asl.ParseOpcode == PARSEOP_STRING_LITERAL)
{
/*
* _HID is a string, all characters must be alphanumeric.
* One of the things we want to catch here is the use of
* a leading asterisk in the string.
*/
for (i = 0; Next->Asl.Value.String[i]; i++)
{
if (!isalnum ((int) Next->Asl.Value.String[i]))
{
AslError (ASL_ERROR, ASL_MSG_ALPHANUMERIC_STRING,
Next, Next->Asl.Value.String);
break;
}
}
}
}
break;
 
 
default:
break;
}
 
return AE_OK;
}
 
 
/*******************************************************************************
*
* FUNCTION: AnLastStatementIsReturn
1026,7 → 295,7
*
******************************************************************************/
 
static BOOLEAN
BOOLEAN
AnLastStatementIsReturn (
ACPI_PARSE_OBJECT *Op)
{
1033,9 → 302,8
ACPI_PARSE_OBJECT *Next;
 
 
/*
* Check if last statement is a return
*/
/* Check if last statement is a return */
 
Next = ASL_GET_CHILD_NODE (Op);
while (Next)
{
1042,296 → 310,18
if ((!Next->Asl.Next) &&
(Next->Asl.ParseOpcode == PARSEOP_RETURN))
{
return TRUE;
return (TRUE);
}
 
Next = ASL_GET_PEER_NODE (Next);
}
 
return FALSE;
return (FALSE);
}
 
 
/*******************************************************************************
*
* FUNCTION: AnMethodAnalysisWalkEnd
*
* PARAMETERS: ASL_WALK_CALLBACK
*
* RETURN: Status
*
* DESCRIPTION: Ascending callback for analysis walk. Complete method
* return analysis.
*
******************************************************************************/
 
ACPI_STATUS
AnMethodAnalysisWalkEnd (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context)
{
ASL_ANALYSIS_WALK_INFO *WalkInfo = (ASL_ANALYSIS_WALK_INFO *) Context;
ASL_METHOD_INFO *MethodInfo = WalkInfo->MethodStack;
 
 
switch (Op->Asl.ParseOpcode)
{
case PARSEOP_METHOD:
case PARSEOP_RETURN:
if (!MethodInfo)
{
printf ("No method info for method! [%s]\n", Op->Asl.Namepath);
AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op,
"No method info for this method");
CmCleanupAndExit ();
return (AE_AML_INTERNAL);
}
break;
 
default:
break;
}
 
switch (Op->Asl.ParseOpcode)
{
case PARSEOP_METHOD:
 
WalkInfo->MethodStack = MethodInfo->Next;
 
/*
* Check if there is no return statement at the end of the
* method AND we can actually get there -- i.e., the execution
* of the method can possibly terminate without a return statement.
*/
if ((!AnLastStatementIsReturn (Op)) &&
(!(Op->Asl.CompileFlags & NODE_HAS_NO_EXIT)))
{
/*
* No return statement, and execution can possibly exit
* via this path. This is equivalent to Return ()
*/
MethodInfo->NumReturnNoValue++;
}
 
/*
* Check for case where some return statements have a return value
* and some do not. Exit without a return statement is a return with
* no value
*/
if (MethodInfo->NumReturnNoValue &&
MethodInfo->NumReturnWithValue)
{
AslError (ASL_WARNING, ASL_MSG_RETURN_TYPES, Op,
Op->Asl.ExternalName);
}
 
/*
* If there are any RETURN() statements with no value, or there is a
* control path that allows the method to exit without a return value,
* we mark the method as a method that does not return a value. This
* knowledge can be used to check method invocations that expect a
* returned value.
*/
if (MethodInfo->NumReturnNoValue)
{
if (MethodInfo->NumReturnWithValue)
{
Op->Asl.CompileFlags |= NODE_METHOD_SOME_NO_RETVAL;
}
else
{
Op->Asl.CompileFlags |= NODE_METHOD_NO_RETVAL;
}
}
 
/*
* Check predefined method names for correct return behavior
* and correct number of arguments
*/
ApCheckForPredefinedMethod (Op, MethodInfo);
ACPI_FREE (MethodInfo);
break;
 
 
case PARSEOP_RETURN:
 
/*
* If the parent is a predefined method name, attempt to typecheck
* the return value. Only static types can be validated.
*/
ApCheckPredefinedReturnValue (Op, MethodInfo);
 
/*
* The parent block does not "exit" and continue execution -- the
* method is terminated here with the Return() statement.
*/
Op->Asl.Parent->Asl.CompileFlags |= NODE_HAS_NO_EXIT;
 
/* Used in the "typing" pass later */
 
Op->Asl.ParentMethod = MethodInfo->Op;
 
/*
* If there is a peer node after the return statement, then this
* node is unreachable code -- i.e., it won't be executed because of
* the preceeding Return() statement.
*/
if (Op->Asl.Next)
{
AslError (ASL_WARNING, ASL_MSG_UNREACHABLE_CODE, Op->Asl.Next, NULL);
}
break;
 
 
case PARSEOP_IF:
 
if ((Op->Asl.CompileFlags & NODE_HAS_NO_EXIT) &&
(Op->Asl.Next) &&
(Op->Asl.Next->Asl.ParseOpcode == PARSEOP_ELSE))
{
/*
* This IF has a corresponding ELSE. The IF block has no exit,
* (it contains an unconditional Return)
* mark the ELSE block to remember this fact.
*/
Op->Asl.Next->Asl.CompileFlags |= NODE_IF_HAS_NO_EXIT;
}
break;
 
 
case PARSEOP_ELSE:
 
if ((Op->Asl.CompileFlags & NODE_HAS_NO_EXIT) &&
(Op->Asl.CompileFlags & NODE_IF_HAS_NO_EXIT))
{
/*
* This ELSE block has no exit and the corresponding IF block
* has no exit either. Therefore, the parent node has no exit.
*/
Op->Asl.Parent->Asl.CompileFlags |= NODE_HAS_NO_EXIT;
}
break;
 
 
default:
 
if ((Op->Asl.CompileFlags & NODE_HAS_NO_EXIT) &&
(Op->Asl.Parent))
{
/* If this node has no exit, then the parent has no exit either */
 
Op->Asl.Parent->Asl.CompileFlags |= NODE_HAS_NO_EXIT;
}
break;
}
 
return AE_OK;
}
 
 
/*******************************************************************************
*
* FUNCTION: AnMethodTypingWalkBegin
*
* PARAMETERS: ASL_WALK_CALLBACK
*
* RETURN: Status
*
* DESCRIPTION: Descending callback for the typing walk.
*
******************************************************************************/
 
ACPI_STATUS
AnMethodTypingWalkBegin (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context)
{
 
return AE_OK;
}
 
 
/*******************************************************************************
*
* FUNCTION: AnMethodTypingWalkEnd
*
* PARAMETERS: ASL_WALK_CALLBACK
*
* RETURN: Status
*
* DESCRIPTION: Ascending callback for typing walk. Complete the method
* return analysis. Check methods for:
* 1) Initialized local variables
* 2) Valid arguments
* 3) Return types
*
******************************************************************************/
 
ACPI_STATUS
AnMethodTypingWalkEnd (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context)
{
UINT32 ThisNodeBtype;
 
 
switch (Op->Asl.ParseOpcode)
{
case PARSEOP_METHOD:
 
Op->Asl.CompileFlags |= NODE_METHOD_TYPED;
break;
 
case PARSEOP_RETURN:
 
if ((Op->Asl.Child) &&
(Op->Asl.Child->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG))
{
ThisNodeBtype = AnGetBtype (Op->Asl.Child);
 
if ((Op->Asl.Child->Asl.ParseOpcode == PARSEOP_METHODCALL) &&
(ThisNodeBtype == (ACPI_UINT32_MAX -1)))
{
/*
* The called method is untyped at this time (typically a
* forward reference).
*
* Check for a recursive method call first.
*/
if (Op->Asl.ParentMethod != Op->Asl.Child->Asl.Node->Op)
{
/* We must type the method here */
 
TrWalkParseTree (Op->Asl.Child->Asl.Node->Op,
ASL_WALK_VISIT_TWICE, AnMethodTypingWalkBegin,
AnMethodTypingWalkEnd, NULL);
 
ThisNodeBtype = AnGetBtype (Op->Asl.Child);
}
}
 
/* Returns a value, save the value type */
 
if (Op->Asl.ParentMethod)
{
Op->Asl.ParentMethod->Asl.AcpiBtype |= ThisNodeBtype;
}
}
break;
 
default:
break;
}
 
return AE_OK;
}
 
 
/*******************************************************************************
*
* FUNCTION: AnCheckMethodReturnValue
*
* PARAMETERS: Op - Parent
1347,7 → 337,7
*
******************************************************************************/
 
static void
void
AnCheckMethodReturnValue (
ACPI_PARSE_OBJECT *Op,
const ACPI_OPCODE_INFO *OpInfo,
1384,7 → 374,6
AnFormatBtype (StringBuffer, ThisNodeBtype);
AnFormatBtype (StringBuffer2, RequiredBtypes);
 
 
/*
* The case where the method does not return any value at all
* was already handled in the namespace cross reference
1405,344 → 394,6
 
/*******************************************************************************
*
* FUNCTION: AnOperandTypecheckWalkBegin
*
* PARAMETERS: ASL_WALK_CALLBACK
*
* RETURN: Status
*
* DESCRIPTION: Descending callback for the analysis walk. Check methods for:
* 1) Initialized local variables
* 2) Valid arguments
* 3) Return types
*
******************************************************************************/
 
ACPI_STATUS
AnOperandTypecheckWalkBegin (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context)
{
 
return AE_OK;
}
 
 
/*******************************************************************************
*
* FUNCTION: AnOperandTypecheckWalkEnd
*
* PARAMETERS: ASL_WALK_CALLBACK
*
* RETURN: Status
*
* DESCRIPTION: Ascending callback for analysis walk. Complete method
* return analysis.
*
******************************************************************************/
 
ACPI_STATUS
AnOperandTypecheckWalkEnd (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context)
{
const ACPI_OPCODE_INFO *OpInfo;
UINT32 RuntimeArgTypes;
UINT32 RuntimeArgTypes2;
UINT32 RequiredBtypes;
UINT32 ThisNodeBtype;
UINT32 CommonBtypes;
UINT32 OpcodeClass;
ACPI_PARSE_OBJECT *ArgOp;
UINT32 ArgType;
 
 
switch (Op->Asl.AmlOpcode)
{
case AML_RAW_DATA_BYTE:
case AML_RAW_DATA_WORD:
case AML_RAW_DATA_DWORD:
case AML_RAW_DATA_QWORD:
case AML_RAW_DATA_BUFFER:
case AML_RAW_DATA_CHAIN:
case AML_PACKAGE_LENGTH:
case AML_UNASSIGNED_OPCODE:
case AML_DEFAULT_ARG_OP:
 
/* Ignore the internal (compiler-only) AML opcodes */
 
return (AE_OK);
 
default:
break;
}
 
OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
if (!OpInfo)
{
return (AE_OK);
}
 
ArgOp = Op->Asl.Child;
RuntimeArgTypes = OpInfo->RuntimeArgs;
OpcodeClass = OpInfo->Class;
 
#ifdef ASL_ERROR_NAMED_OBJECT_IN_WHILE
/*
* Update 11/2008: In practice, we can't perform this check. A simple
* analysis is not sufficient. Also, it can cause errors when compiling
* disassembled code because of the way Switch operators are implemented
* (a While(One) loop with a named temp variable created within.)
*/
 
/*
* If we are creating a named object, check if we are within a while loop
* by checking if the parent is a WHILE op. This is a simple analysis, but
* probably sufficient for many cases.
*
* Allow Scope(), Buffer(), and Package().
*/
if (((OpcodeClass == AML_CLASS_NAMED_OBJECT) && (Op->Asl.AmlOpcode != AML_SCOPE_OP)) ||
((OpcodeClass == AML_CLASS_CREATE) && (OpInfo->Flags & AML_NSNODE)))
{
if (Op->Asl.Parent->Asl.AmlOpcode == AML_WHILE_OP)
{
AslError (ASL_ERROR, ASL_MSG_NAMED_OBJECT_IN_WHILE, Op, NULL);
}
}
#endif
 
/*
* Special case for control opcodes IF/RETURN/WHILE since they
* have no runtime arg list (at this time)
*/
switch (Op->Asl.AmlOpcode)
{
case AML_IF_OP:
case AML_WHILE_OP:
case AML_RETURN_OP:
 
if (ArgOp->Asl.ParseOpcode == PARSEOP_METHODCALL)
{
/* Check for an internal method */
 
if (AnIsInternalMethod (ArgOp))
{
return (AE_OK);
}
 
/* The lone arg is a method call, check it */
 
RequiredBtypes = AnMapArgTypeToBtype (ARGI_INTEGER);
if (Op->Asl.AmlOpcode == AML_RETURN_OP)
{
RequiredBtypes = 0xFFFFFFFF;
}
 
ThisNodeBtype = AnGetBtype (ArgOp);
if (ThisNodeBtype == ACPI_UINT32_MAX)
{
return (AE_OK);
}
AnCheckMethodReturnValue (Op, OpInfo, ArgOp,
RequiredBtypes, ThisNodeBtype);
}
return (AE_OK);
 
default:
break;
}
 
/* Ignore the non-executable opcodes */
 
if (RuntimeArgTypes == ARGI_INVALID_OPCODE)
{
return (AE_OK);
}
 
switch (OpcodeClass)
{
case AML_CLASS_EXECUTE:
case AML_CLASS_CREATE:
case AML_CLASS_CONTROL:
case AML_CLASS_RETURN_VALUE:
 
/* TBD: Change class or fix typechecking for these */
 
if ((Op->Asl.AmlOpcode == AML_BUFFER_OP) ||
(Op->Asl.AmlOpcode == AML_PACKAGE_OP) ||
(Op->Asl.AmlOpcode == AML_VAR_PACKAGE_OP))
{
break;
}
 
/* Reverse the runtime argument list */
 
RuntimeArgTypes2 = 0;
while ((ArgType = GET_CURRENT_ARG_TYPE (RuntimeArgTypes)))
{
RuntimeArgTypes2 <<= ARG_TYPE_WIDTH;
RuntimeArgTypes2 |= ArgType;
INCREMENT_ARG_LIST (RuntimeArgTypes);
}
 
while ((ArgType = GET_CURRENT_ARG_TYPE (RuntimeArgTypes2)))
{
RequiredBtypes = AnMapArgTypeToBtype (ArgType);
 
ThisNodeBtype = AnGetBtype (ArgOp);
if (ThisNodeBtype == ACPI_UINT32_MAX)
{
goto NextArgument;
}
 
/* Examine the arg based on the required type of the arg */
 
switch (ArgType)
{
case ARGI_TARGETREF:
 
if (ArgOp->Asl.ParseOpcode == PARSEOP_ZERO)
{
/* ZERO is the placeholder for "don't store result" */
 
ThisNodeBtype = RequiredBtypes;
break;
}
 
if (ArgOp->Asl.ParseOpcode == PARSEOP_INTEGER)
{
/*
* This is the case where an original reference to a resource
* descriptor field has been replaced by an (Integer) offset.
* These named fields are supported at compile-time only;
* the names are not passed to the interpreter (via the AML).
*/
if ((ArgOp->Asl.Node->Type == ACPI_TYPE_LOCAL_RESOURCE_FIELD) ||
(ArgOp->Asl.Node->Type == ACPI_TYPE_LOCAL_RESOURCE))
{
AslError (ASL_ERROR, ASL_MSG_RESOURCE_FIELD, ArgOp, NULL);
}
else
{
AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, NULL);
}
break;
}
 
if ((ArgOp->Asl.ParseOpcode == PARSEOP_METHODCALL) ||
(ArgOp->Asl.ParseOpcode == PARSEOP_DEREFOF))
{
break;
}
 
ThisNodeBtype = RequiredBtypes;
break;
 
 
case ARGI_REFERENCE: /* References */
case ARGI_INTEGER_REF:
case ARGI_OBJECT_REF:
case ARGI_DEVICE_REF:
 
switch (ArgOp->Asl.ParseOpcode)
{
case PARSEOP_LOCAL0:
case PARSEOP_LOCAL1:
case PARSEOP_LOCAL2:
case PARSEOP_LOCAL3:
case PARSEOP_LOCAL4:
case PARSEOP_LOCAL5:
case PARSEOP_LOCAL6:
case PARSEOP_LOCAL7:
 
/* TBD: implement analysis of current value (type) of the local */
/* For now, just treat any local as a typematch */
 
/*ThisNodeBtype = RequiredBtypes;*/
break;
 
case PARSEOP_ARG0:
case PARSEOP_ARG1:
case PARSEOP_ARG2:
case PARSEOP_ARG3:
case PARSEOP_ARG4:
case PARSEOP_ARG5:
case PARSEOP_ARG6:
 
/* Hard to analyze argument types, sow we won't */
/* For now, just treat any arg as a typematch */
 
/* ThisNodeBtype = RequiredBtypes; */
break;
 
case PARSEOP_DEBUG:
break;
 
case PARSEOP_REFOF:
case PARSEOP_INDEX:
default:
break;
 
}
break;
 
case ARGI_INTEGER:
default:
break;
}
 
 
CommonBtypes = ThisNodeBtype & RequiredBtypes;
 
if (ArgOp->Asl.ParseOpcode == PARSEOP_METHODCALL)
{
if (AnIsInternalMethod (ArgOp))
{
return (AE_OK);
}
 
/* Check a method call for a valid return value */
 
AnCheckMethodReturnValue (Op, OpInfo, ArgOp,
RequiredBtypes, ThisNodeBtype);
}
 
/*
* Now check if the actual type(s) match at least one
* bit to the required type
*/
else if (!CommonBtypes)
{
/* No match -- this is a type mismatch error */
 
AnFormatBtype (StringBuffer, ThisNodeBtype);
AnFormatBtype (StringBuffer2, RequiredBtypes);
 
sprintf (MsgBuffer, "[%s] found, %s operator requires [%s]",
StringBuffer, OpInfo->Name, StringBuffer2);
 
AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, MsgBuffer);
}
 
NextArgument:
ArgOp = ArgOp->Asl.Next;
INCREMENT_ARG_LIST (RuntimeArgTypes2);
}
break;
 
default:
break;
}
 
return (AE_OK);
}
 
 
/*******************************************************************************
*
* FUNCTION: AnIsResultUsed
*
* PARAMETERS: Op - Parent op for the operator
1810,211 → 461,150
 
/*******************************************************************************
*
* FUNCTION: AnOtherSemanticAnalysisWalkBegin
* FUNCTION: ApCheckForGpeNameConflict
*
* PARAMETERS: ASL_WALK_CALLBACK
* PARAMETERS: Op - Current parse op
*
* RETURN: Status
* RETURN: None
*
* DESCRIPTION: Descending callback for the analysis walk. Checks for
* miscellaneous issues in the code.
* DESCRIPTION: Check for a conflict between GPE names within this scope.
* Conflict means two GPE names with the same GPE number, but
* different types -- such as _L1C and _E1C.
*
******************************************************************************/
 
ACPI_STATUS
AnOtherSemanticAnalysisWalkBegin (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context)
void
ApCheckForGpeNameConflict (
ACPI_PARSE_OBJECT *Op)
{
ACPI_PARSE_OBJECT *ArgNode;
ACPI_PARSE_OBJECT *PrevArgNode = NULL;
const ACPI_OPCODE_INFO *OpInfo;
ACPI_PARSE_OBJECT *NextOp;
UINT32 GpeNumber;
char Name[ACPI_NAME_SIZE + 1];
char Target[ACPI_NAME_SIZE];
 
 
OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
/* Need a null-terminated string version of NameSeg */
 
ACPI_MOVE_32_TO_32 (Name, &Op->Asl.NameSeg);
Name[ACPI_NAME_SIZE] = 0;
 
/*
* Determine if an execution class operator actually does something by
* checking if it has a target and/or the function return value is used.
* (Target is optional, so a standalone statement can actually do nothing.)
* For a GPE method:
* 1st char must be underscore
* 2nd char must be L or E
* 3rd/4th chars must be a hex number
*/
if ((OpInfo->Class == AML_CLASS_EXECUTE) &&
(OpInfo->Flags & AML_HAS_RETVAL) &&
(!AnIsResultUsed (Op)))
if ((Name[0] != '_') ||
((Name[1] != 'L') && (Name[1] != 'E')))
{
if (OpInfo->Flags & AML_HAS_TARGET)
{
/*
* Find the target node, it is always the last child. If the traget
* is not specified in the ASL, a default node of type Zero was
* created by the parser.
*/
ArgNode = Op->Asl.Child;
while (ArgNode->Asl.Next)
{
PrevArgNode = ArgNode;
ArgNode = ArgNode->Asl.Next;
return;
}
 
/* Divide() is the only weird case, it has two targets */
/* Verify 3rd/4th chars are a valid hex value */
 
if (Op->Asl.AmlOpcode == AML_DIVIDE_OP)
GpeNumber = ACPI_STRTOUL (&Name[2], NULL, 16);
if (GpeNumber == ACPI_UINT32_MAX)
{
if ((ArgNode->Asl.ParseOpcode == PARSEOP_ZERO) &&
(PrevArgNode->Asl.ParseOpcode == PARSEOP_ZERO))
{
AslError (ASL_WARNING, ASL_MSG_RESULT_NOT_USED, Op, Op->Asl.ExternalName);
return;
}
}
else if (ArgNode->Asl.ParseOpcode == PARSEOP_ZERO)
{
AslError (ASL_WARNING, ASL_MSG_RESULT_NOT_USED, Op, Op->Asl.ExternalName);
}
}
else
{
 
/*
* Has no target and the result is not used. Only a couple opcodes
* can have this combination.
* We are now sure we have an _Lxx or _Exx.
* Create the target name that would cause collision (Flip E/L)
*/
switch (Op->Asl.ParseOpcode)
ACPI_MOVE_32_TO_32 (Target, Name);
 
/* Inject opposite letter ("L" versus "E") */
 
if (Name[1] == 'L')
{
case PARSEOP_ACQUIRE:
case PARSEOP_WAIT:
case PARSEOP_LOADTABLE:
break;
 
default:
AslError (ASL_WARNING, ASL_MSG_RESULT_NOT_USED, Op, Op->Asl.ExternalName);
break;
Target[1] = 'E';
}
else /* Name[1] == 'E' */
{
Target[1] = 'L';
}
}
 
/* Search all peers (objects within this scope) for target match */
 
/*
* Semantic checks for individual ASL operators
*/
switch (Op->Asl.ParseOpcode)
NextOp = Op->Asl.Next;
while (NextOp)
{
case PARSEOP_ACQUIRE:
case PARSEOP_WAIT:
/*
* Emit a warning if the timeout parameter for these operators is not
* ACPI_WAIT_FOREVER, and the result value from the operator is not
* checked, meaning that a timeout could happen, but the code
* would not know about it.
* We mostly care about methods, but check Name() constructs also,
* even though they will get another error for not being a method.
* All GPE names must be defined as control methods.
*/
 
/* First child is the namepath, 2nd child is timeout */
 
ArgNode = Op->Asl.Child;
ArgNode = ArgNode->Asl.Next;
 
/*
* Check for the WAIT_FOREVER case - defined by the ACPI spec to be
* 0xFFFF or greater
*/
if (((ArgNode->Asl.ParseOpcode == PARSEOP_WORDCONST) ||
(ArgNode->Asl.ParseOpcode == PARSEOP_INTEGER)) &&
(ArgNode->Asl.Value.Integer >= (UINT64) ACPI_WAIT_FOREVER))
if ((NextOp->Asl.ParseOpcode == PARSEOP_METHOD) ||
(NextOp->Asl.ParseOpcode == PARSEOP_NAME))
{
break;
}
 
/*
* The operation could timeout. If the return value is not used
* (indicates timeout occurred), issue a warning
*/
if (!AnIsResultUsed (Op))
if (ACPI_COMPARE_NAME (Target, NextOp->Asl.NameSeg))
{
AslError (ASL_WARNING, ASL_MSG_TIMEOUT, ArgNode, Op->Asl.ExternalName);
}
break;
/* Found both _Exy and _Lxy in the same scope, error */
 
case PARSEOP_CREATEFIELD:
/*
* Check for a zero Length (NumBits) operand. NumBits is the 3rd operand
*/
ArgNode = Op->Asl.Child;
ArgNode = ArgNode->Asl.Next;
ArgNode = ArgNode->Asl.Next;
 
if ((ArgNode->Asl.ParseOpcode == PARSEOP_ZERO) ||
((ArgNode->Asl.ParseOpcode == PARSEOP_INTEGER) &&
(ArgNode->Asl.Value.Integer == 0)))
{
AslError (ASL_ERROR, ASL_MSG_NON_ZERO, ArgNode, NULL);
AslError (ASL_ERROR, ASL_MSG_GPE_NAME_CONFLICT, NextOp,
Name);
return;
}
break;
}
 
default:
break;
NextOp = NextOp->Asl.Next;
}
 
return AE_OK;
/* OK, no conflict found */
 
return;
}
 
 
/*******************************************************************************
*
* FUNCTION: AnOtherSemanticAnalysisWalkEnd
* FUNCTION: ApCheckRegMethod
*
* PARAMETERS: ASL_WALK_CALLBACK
* PARAMETERS: Op - Current parse op
*
* RETURN: Status
* RETURN: None
*
* DESCRIPTION: Ascending callback for analysis walk. Complete method
* return analysis.
* DESCRIPTION: Ensure that a _REG method has a corresponding Operation
* Region declaration within the same scope. Note: _REG is defined
* to have two arguments and must therefore be defined as a
* control method.
*
******************************************************************************/
 
ACPI_STATUS
AnOtherSemanticAnalysisWalkEnd (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context)
void
ApCheckRegMethod (
ACPI_PARSE_OBJECT *Op)
{
ACPI_PARSE_OBJECT *Next;
ACPI_PARSE_OBJECT *Parent;
 
return AE_OK;
 
/* We are only interested in _REG methods */
 
if (!ACPI_COMPARE_NAME (METHOD_NAME__REG, &Op->Asl.NameSeg))
{
return;
}
 
/* Get the start of the current scope */
 
#ifdef ACPI_OBSOLETE_FUNCTIONS
/*******************************************************************************
*
* FUNCTION: AnMapBtypeToEtype
*
* PARAMETERS: Btype - Bitfield of ACPI types
*
* RETURN: The Etype corresponding the the Btype
*
* DESCRIPTION: Convert a bitfield type to an encoded type
*
******************************************************************************/
Parent = Op->Asl.Parent;
Next = Parent->Asl.Child;
 
UINT32
AnMapBtypeToEtype (
UINT32 Btype)
{
UINT32 i;
UINT32 Etype;
/* Search entire scope for an operation region declaration */
 
 
if (Btype == 0)
while (Next)
{
return 0;
if (Next->Asl.ParseOpcode == PARSEOP_OPERATIONREGION)
{
return; /* Found region, OK */
}
 
Etype = 1;
for (i = 1; i < Btype; i *= 2)
{
Etype++;
Next = Next->Asl.Next;
}
 
return (Etype);
/* No region found, issue warning */
 
AslError (ASL_WARNING, ASL_MSG_NO_REGION, Op, NULL);
}
#endif
 
/drivers/devman/acpica/compiler/aslbtypes.c
0,0 → 1,597
/******************************************************************************
*
* Module Name: aslbtypes - Support for bitfield types
*
*****************************************************************************/
 
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
* rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
* copy of the source code appearing in this file ("Covered Code") an
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
* base code distributed originally by Intel ("Original Intel Code") to copy,
* make derivatives, distribute, use and display any portion of the Covered
* Code in any form, with the right to sublicense such rights; and
*
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
* license (with the right to sublicense), under only those claims of Intel
* patents that are infringed by the Original Intel Code, to make, use, sell,
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
* to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
* documentation and/or other materials provided with distribution. In
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* property embodied in the software Licensee provides to its licensee, and
* not to intellectual property embodied in modifications its licensee may
* make.
*
* 3.3. Redistribution of Executable. Redistribution in executable form of any
* substantial portion of the Covered Code or modification must reproduce the
* above Copyright Notice, and the following Disclaimer and Export Compliance
* provision in the documentation and/or other materials provided with the
* distribution.
*
* 3.4. Intel retains all right, title, and interest in and to the Original
* Intel Code.
*
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
* Intel shall be used in advertising or otherwise to promote the sale, use or
* other dealings in products derived from or relating to the Covered Code
* without prior written authorization from Intel.
*
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
* any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* ensure that the distribution and export/re-export of the software is in
* compliance with all laws, regulations, orders, or other restrictions of the
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
* any of its subsidiaries will export/re-export any technical data, process,
* software, or service, directly or indirectly, to any country for which the
* United States government or any agency thereof requires an export license,
* other governmental approval, or letter of assurance, without first obtaining
* such license, approval or letter.
*
*****************************************************************************/
 
 
#include "aslcompiler.h"
#include "aslcompiler.y.h"
#include "amlcode.h"
 
 
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslbtypes")
 
/* Local prototypes */
 
static UINT32
AnMapEtypeToBtype (
UINT32 Etype);
 
 
/*******************************************************************************
*
* FUNCTION: AnMapArgTypeToBtype
*
* PARAMETERS: ArgType - The ARGI required type(s) for this
* argument, from the opcode info table
*
* RETURN: The corresponding Bit-encoded types
*
* DESCRIPTION: Convert an encoded ARGI required argument type code into a
* bitfield type code. Implements the implicit source conversion
* rules.
*
******************************************************************************/
 
UINT32
AnMapArgTypeToBtype (
UINT32 ArgType)
{
 
switch (ArgType)
{
 
/* Simple types */
 
case ARGI_ANYTYPE:
return (ACPI_BTYPE_OBJECTS_AND_REFS);
 
case ARGI_PACKAGE:
return (ACPI_BTYPE_PACKAGE);
 
case ARGI_EVENT:
return (ACPI_BTYPE_EVENT);
 
case ARGI_MUTEX:
return (ACPI_BTYPE_MUTEX);
 
case ARGI_DDBHANDLE:
/*
* DDBHandleObject := SuperName
* ACPI_BTYPE_REFERENCE: Index reference as parameter of Load/Unload
*/
return (ACPI_BTYPE_DDB_HANDLE | ACPI_BTYPE_REFERENCE);
 
/* Interchangeable types */
/*
* Source conversion rules:
* Integer, String, and Buffer are all interchangeable
*/
case ARGI_INTEGER:
case ARGI_STRING:
case ARGI_BUFFER:
case ARGI_BUFFER_OR_STRING:
case ARGI_COMPUTEDATA:
return (ACPI_BTYPE_COMPUTE_DATA);
 
/* References */
 
case ARGI_INTEGER_REF:
return (ACPI_BTYPE_INTEGER);
 
case ARGI_OBJECT_REF:
return (ACPI_BTYPE_ALL_OBJECTS);
 
case ARGI_DEVICE_REF:
return (ACPI_BTYPE_DEVICE_OBJECTS);
 
case ARGI_REFERENCE:
return (ACPI_BTYPE_REFERENCE);
 
case ARGI_TARGETREF:
case ARGI_FIXED_TARGET:
case ARGI_SIMPLE_TARGET:
return (ACPI_BTYPE_OBJECTS_AND_REFS);
 
/* Complex types */
 
case ARGI_DATAOBJECT:
 
/*
* Buffer, string, package or reference to a Op -
* Used only by SizeOf operator
*/
return (ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER |
ACPI_BTYPE_PACKAGE | ACPI_BTYPE_REFERENCE);
 
case ARGI_COMPLEXOBJ:
 
/* Buffer, String, or package */
 
return (ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER | ACPI_BTYPE_PACKAGE);
 
case ARGI_REF_OR_STRING:
return (ACPI_BTYPE_STRING | ACPI_BTYPE_REFERENCE);
 
case ARGI_REGION_OR_BUFFER:
 
/* Used by Load() only. Allow buffers in addition to regions/fields */
 
return (ACPI_BTYPE_REGION | ACPI_BTYPE_BUFFER | ACPI_BTYPE_FIELD_UNIT);
 
case ARGI_DATAREFOBJ:
return (ACPI_BTYPE_INTEGER |ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER |
ACPI_BTYPE_PACKAGE | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE);
 
default:
break;
}
 
return (ACPI_BTYPE_OBJECTS_AND_REFS);
}
 
 
/*******************************************************************************
*
* FUNCTION: AnMapEtypeToBtype
*
* PARAMETERS: Etype - Encoded ACPI Type
*
* RETURN: Btype corresponding to the Etype
*
* DESCRIPTION: Convert an encoded ACPI type to a bitfield type applying the
* operand conversion rules. In other words, returns the type(s)
* this Etype is implicitly converted to during interpretation.
*
******************************************************************************/
 
static UINT32
AnMapEtypeToBtype (
UINT32 Etype)
{
 
 
if (Etype == ACPI_TYPE_ANY)
{
return (ACPI_BTYPE_OBJECTS_AND_REFS);
}
 
/* Try the standard ACPI data types */
 
if (Etype <= ACPI_TYPE_EXTERNAL_MAX)
{
/*
* This switch statement implements the allowed operand conversion
* rules as per the "ASL Data Types" section of the ACPI
* specification.
*/
switch (Etype)
{
case ACPI_TYPE_INTEGER:
return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_DDB_HANDLE);
 
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
return (ACPI_BTYPE_COMPUTE_DATA);
 
case ACPI_TYPE_PACKAGE:
return (ACPI_BTYPE_PACKAGE);
 
case ACPI_TYPE_FIELD_UNIT:
return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_FIELD_UNIT);
 
case ACPI_TYPE_BUFFER_FIELD:
return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_BUFFER_FIELD);
 
case ACPI_TYPE_DDB_HANDLE:
return (ACPI_BTYPE_INTEGER | ACPI_BTYPE_DDB_HANDLE);
 
case ACPI_BTYPE_DEBUG_OBJECT:
 
/* Cannot be used as a source operand */
 
return (0);
 
default:
return (1 << (Etype - 1));
}
}
 
/* Try the internal data types */
 
switch (Etype)
{
case ACPI_TYPE_LOCAL_REGION_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
 
/* Named fields can be either Integer/Buffer/String */
 
return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_FIELD_UNIT);
 
case ACPI_TYPE_LOCAL_ALIAS:
 
return (ACPI_BTYPE_INTEGER);
 
 
case ACPI_TYPE_LOCAL_RESOURCE:
case ACPI_TYPE_LOCAL_RESOURCE_FIELD:
 
return (ACPI_BTYPE_REFERENCE);
 
default:
printf ("Unhandled encoded type: %X\n", Etype);
return (0);
}
}
 
 
/*******************************************************************************
*
* FUNCTION: AnFormatBtype
*
* PARAMETERS: Btype - Bitfield of ACPI types
* Buffer - Where to put the ascii string
*
* RETURN: None.
*
* DESCRIPTION: Convert a Btype to a string of ACPI types
*
******************************************************************************/
 
void
AnFormatBtype (
char *Buffer,
UINT32 Btype)
{
UINT32 Type;
BOOLEAN First = TRUE;
 
 
*Buffer = 0;
 
if (Btype == 0)
{
strcat (Buffer, "NoReturnValue");
return;
}
 
for (Type = 1; Type <= ACPI_TYPE_EXTERNAL_MAX; Type++)
{
if (Btype & 0x00000001)
{
if (!First)
{
strcat (Buffer, "|");
}
First = FALSE;
strcat (Buffer, AcpiUtGetTypeName (Type));
}
Btype >>= 1;
}
 
if (Btype & 0x00000001)
{
if (!First)
{
strcat (Buffer, "|");
}
First = FALSE;
strcat (Buffer, "Reference");
}
 
Btype >>= 1;
if (Btype & 0x00000001)
{
if (!First)
{
strcat (Buffer, "|");
}
First = FALSE;
strcat (Buffer, "Resource");
}
}
 
 
/*******************************************************************************
*
* FUNCTION: AnGetBtype
*
* PARAMETERS: Op - Parse node whose type will be returned.
*
* RETURN: The Btype associated with the Op.
*
* DESCRIPTION: Get the (bitfield) ACPI type associated with the parse node.
* Handles the case where the node is a name or method call and
* the actual type must be obtained from the namespace node.
*
******************************************************************************/
 
UINT32
AnGetBtype (
ACPI_PARSE_OBJECT *Op)
{
ACPI_NAMESPACE_NODE *Node;
ACPI_PARSE_OBJECT *ReferencedNode;
UINT32 ThisNodeBtype = 0;
 
 
if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
(Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) ||
(Op->Asl.ParseOpcode == PARSEOP_METHODCALL))
{
Node = Op->Asl.Node;
if (!Node)
{
DbgPrint (ASL_DEBUG_OUTPUT,
"No attached Nsnode: [%s] at line %u name [%s], ignoring typecheck\n",
Op->Asl.ParseOpName, Op->Asl.LineNumber,
Op->Asl.ExternalName);
return (ACPI_UINT32_MAX);
}
 
ThisNodeBtype = AnMapEtypeToBtype (Node->Type);
if (!ThisNodeBtype)
{
AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op,
"could not map type");
}
 
/*
* Since it was a named reference, enable the
* reference bit also
*/
ThisNodeBtype |= ACPI_BTYPE_REFERENCE;
 
if (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)
{
ReferencedNode = Node->Op;
if (!ReferencedNode)
{
/* Check for an internal method */
 
if (AnIsInternalMethod (Op))
{
return (AnGetInternalMethodReturnType (Op));
}
 
AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op,
"null Op pointer");
return (ACPI_UINT32_MAX);
}
 
if (ReferencedNode->Asl.CompileFlags & NODE_METHOD_TYPED)
{
ThisNodeBtype = ReferencedNode->Asl.AcpiBtype;
}
else
{
return (ACPI_UINT32_MAX -1);
}
}
}
else
{
ThisNodeBtype = Op->Asl.AcpiBtype;
}
 
return (ThisNodeBtype);
}
 
 
/*******************************************************************************
*
* FUNCTION: AnMapObjTypeToBtype
*
* PARAMETERS: Op - A parse node
*
* RETURN: A Btype
*
* DESCRIPTION: Map object to the associated "Btype"
*
******************************************************************************/
 
UINT32
AnMapObjTypeToBtype (
ACPI_PARSE_OBJECT *Op)
{
 
switch (Op->Asl.ParseOpcode)
{
case PARSEOP_OBJECTTYPE_BFF: /* "BuffFieldObj" */
return (ACPI_BTYPE_BUFFER_FIELD);
 
case PARSEOP_OBJECTTYPE_BUF: /* "BuffObj" */
return (ACPI_BTYPE_BUFFER);
 
case PARSEOP_OBJECTTYPE_DDB: /* "DDBHandleObj" */
return (ACPI_BTYPE_DDB_HANDLE);
 
case PARSEOP_OBJECTTYPE_DEV: /* "DeviceObj" */
return (ACPI_BTYPE_DEVICE);
 
case PARSEOP_OBJECTTYPE_EVT: /* "EventObj" */
return (ACPI_BTYPE_EVENT);
 
case PARSEOP_OBJECTTYPE_FLD: /* "FieldUnitObj" */
return (ACPI_BTYPE_FIELD_UNIT);
 
case PARSEOP_OBJECTTYPE_INT: /* "IntObj" */
return (ACPI_BTYPE_INTEGER);
 
case PARSEOP_OBJECTTYPE_MTH: /* "MethodObj" */
return (ACPI_BTYPE_METHOD);
 
case PARSEOP_OBJECTTYPE_MTX: /* "MutexObj" */
return (ACPI_BTYPE_MUTEX);
 
case PARSEOP_OBJECTTYPE_OPR: /* "OpRegionObj" */
return (ACPI_BTYPE_REGION);
 
case PARSEOP_OBJECTTYPE_PKG: /* "PkgObj" */
return (ACPI_BTYPE_PACKAGE);
 
case PARSEOP_OBJECTTYPE_POW: /* "PowerResObj" */
return (ACPI_BTYPE_POWER);
 
case PARSEOP_OBJECTTYPE_STR: /* "StrObj" */
return (ACPI_BTYPE_STRING);
 
case PARSEOP_OBJECTTYPE_THZ: /* "ThermalZoneObj" */
return (ACPI_BTYPE_THERMAL);
 
case PARSEOP_OBJECTTYPE_UNK: /* "UnknownObj" */
return (ACPI_BTYPE_OBJECTS_AND_REFS);
 
default:
return (0);
}
}
 
 
#ifdef ACPI_OBSOLETE_FUNCTIONS
/*******************************************************************************
*
* FUNCTION: AnMapBtypeToEtype
*
* PARAMETERS: Btype - Bitfield of ACPI types
*
* RETURN: The Etype corresponding the the Btype
*
* DESCRIPTION: Convert a bitfield type to an encoded type
*
******************************************************************************/
 
UINT32
AnMapBtypeToEtype (
UINT32 Btype)
{
UINT32 i;
UINT32 Etype;
 
 
if (Btype == 0)
{
return (0);
}
 
Etype = 1;
for (i = 1; i < Btype; i *= 2)
{
Etype++;
}
 
return (Etype);
}
#endif
/drivers/devman/acpica/compiler/aslcodegen.c
9,7 → 9,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
513,11 → 513,11
 
/* Compiler ID */
 
strncpy (TableHeader.AslCompilerId, CompilerCreatorId, 4);
strncpy (TableHeader.AslCompilerId, ASL_CREATOR_ID, 4);
 
/* Compiler version */
 
TableHeader.AslCompilerRevision = CompilerCreatorRevision;
TableHeader.AslCompilerRevision = ASL_REVISION;
 
/* Table length. Checksum zero for now, will rewrite later */
 
/drivers/devman/acpica/compiler/aslcompile.c
9,7 → 9,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
114,9 → 114,11
*
*****************************************************************************/
 
#include "aslcompiler.h"
 
#include <stdio.h>
#include <time.h>
#include "aslcompiler.h"
#include <acapps.h>
 
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslcompile")
127,12 → 129,12
CmFlushSourceCode (
void);
 
void
static void
FlConsumeAnsiComment (
ASL_FILE_INFO *FileInfo,
ASL_FILE_STATUS *Status);
 
void
static void
FlConsumeNewComment (
ASL_FILE_INFO *FileInfo,
ASL_FILE_STATUS *Status);
155,6 → 157,7
UINT32 FileId)
{
char *Prefix = "";
char *UtilityName;
 
 
/* Set line prefix depending on the destination file type */
192,36 → 195,21
break;
}
 
/*
* Compiler signon with copyright
*/
FlPrintFile (FileId,
"%s\n%s%s\n%s",
Prefix,
Prefix, IntelAcpiCA,
Prefix);
 
/* Running compiler or disassembler? */
 
if (Gbl_DisasmFlag)
{
FlPrintFile (FileId,
"%s", DisassemblerId);
UtilityName = AML_DISASSEMBLER_NAME;
}
else
{
FlPrintFile (FileId,
"%s", CompilerId);
UtilityName = ASL_COMPILER_NAME;
}
 
/* Version, build date, copyright, compliance */
/* Compiler signon with copyright */
 
FlPrintFile (FileId,
" version %X [%s]\n%s%s\n%s%s\n%s\n",
(UINT32) ACPI_CA_VERSION, __DATE__,
Prefix, CompilerCopyright,
Prefix, CompilerCompliance,
Prefix);
FlPrintFile (FileId, "%s\n", Prefix);
FlPrintFile (FileId, ACPI_COMMON_HEADER (UtilityName, Prefix));
}
 
 
345,7 → 333,7
*
******************************************************************************/
 
void
static void
FlConsumeAnsiComment (
ASL_FILE_INFO *FileInfo,
ASL_FILE_STATUS *Status)
389,7 → 377,7
}
 
 
void
static void
FlConsumeNewComment (
ASL_FILE_INFO *FileInfo,
ASL_FILE_STATUS *Status)
684,9 → 672,8
 
Event = UtBeginEvent ("Determine object types returned by methods");
DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Method typing\n\n");
TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE,
AnMethodTypingWalkBegin,
AnMethodTypingWalkEnd, NULL);
TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD,
NULL, AnMethodTypingWalkEnd, NULL);
UtEndEvent (Event);
 
/* Semantic error checking part three - operand type checking */
693,9 → 680,8
 
Event = UtBeginEvent ("Analyze AML operand types");
DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Operand type checking\n\n");
TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE,
AnOperandTypecheckWalkBegin,
AnOperandTypecheckWalkEnd, &AnalysisWalkInfo);
TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD,
NULL, AnOperandTypecheckWalkEnd, &AnalysisWalkInfo);
UtEndEvent (Event);
 
/* Semantic error checking part four - other miscellaneous checks */
702,9 → 688,9
 
Event = UtBeginEvent ("Miscellaneous analysis");
DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - miscellaneous\n\n");
TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE,
TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD,
AnOtherSemanticAnalysisWalkBegin,
AnOtherSemanticAnalysisWalkEnd, &AnalysisWalkInfo);
NULL, &AnalysisWalkInfo);
UtEndEvent (Event);
 
/* Calculate all AML package lengths */
903,10 → 889,19
 
/*
* Delete intermediate ("combined") source file (if -ls flag not set)
* This file is created during normal ASL/AML compiles. It is not
* created by the data table compiler.
*
* If the -ls flag is set, then the .SRC file should not be deleted.
* In this case, Gbl_SourceOutputFlag is set to TRUE.
*
* Note: Handles are cleared by FlCloseFile above, so we look at the
* filename instead, to determine if the .SRC file was actually
* created.
*
* TBD: SourceOutput should be .TMP, then rename if we want to keep it?
*/
if (!Gbl_SourceOutputFlag)
if (!Gbl_SourceOutputFlag && Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename)
{
if (remove (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename))
{
/drivers/devman/acpica/compiler/aslcompiler.h
9,7 → 9,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
118,6 → 118,10
#ifndef __ASLCOMPILER_H
#define __ASLCOMPILER_H
 
#include "acpi.h"
#include "accommon.h"
#include "amlresrc.h"
#include "acdebug.h"
 
/* Microsoft-specific */
 
137,16 → 141,11
#include <errno.h>
#include <ctype.h>
 
 
#include "acpi.h"
#include "accommon.h"
#include "amlresrc.h"
#include "acdebug.h"
 
/* Compiler headers */
 
#include "asldefine.h"
#include "asltypes.h"
#include "aslmessages.h"
#include "aslglobal.h"
 
 
189,11 → 188,20
char *Filename);
 
/*
* aslstartup - called from main
* aslstartup - entered from main()
*/
void
AslInitializeGlobals (
void);
 
typedef
ACPI_STATUS (*ASL_PATHNAME_CALLBACK) (
char *);
 
ACPI_STATUS
AslDoOnePathname (
char *Pathname);
char *Pathname,
ASL_PATHNAME_CALLBACK Callback);
 
ACPI_STATUS
AslDoOneFile (
228,7 → 236,7
 
 
/*
* aslanalyze - semantic analysis
* aslwalks - semantic analysis and parse tree walks
*/
ACPI_STATUS
AnOtherSemanticAnalysisWalkBegin (
243,12 → 251,6
void *Context);
 
ACPI_STATUS
AnOperandTypecheckWalkBegin (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context);
 
ACPI_STATUS
AnOperandTypecheckWalkEnd (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
267,18 → 269,79
void *Context);
 
ACPI_STATUS
AnMethodTypingWalkBegin (
AnMethodTypingWalkEnd (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context);
 
ACPI_STATUS
AnMethodTypingWalkEnd (
 
/*
* aslbtypes - bitfield data types
*/
UINT32
AnMapObjTypeToBtype (
ACPI_PARSE_OBJECT *Op);
 
UINT32
AnMapArgTypeToBtype (
UINT32 ArgType);
 
UINT32
AnGetBtype (
ACPI_PARSE_OBJECT *Op);
 
void
AnFormatBtype (
char *Buffer,
UINT32 Btype);
 
 
/*
* aslanalyze - Support functions for parse tree walks
*/
void
AnCheckId (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context);
ACPI_NAME Type);
 
/* Values for Type argument above */
 
#define ASL_TYPE_HID 0
#define ASL_TYPE_CID 1
 
BOOLEAN
AnIsInternalMethod (
ACPI_PARSE_OBJECT *Op);
 
UINT32
AnGetInternalMethodReturnType (
ACPI_PARSE_OBJECT *Op);
 
BOOLEAN
AnLastStatementIsReturn (
ACPI_PARSE_OBJECT *Op);
 
void
AnCheckMethodReturnValue (
ACPI_PARSE_OBJECT *Op,
const ACPI_OPCODE_INFO *OpInfo,
ACPI_PARSE_OBJECT *ArgOp,
UINT32 RequiredBtypes,
UINT32 ThisNodeBtype);
 
BOOLEAN
AnIsResultUsed (
ACPI_PARSE_OBJECT *Op);
 
void
ApCheckForGpeNameConflict (
ACPI_PARSE_OBJECT *Op);
 
void
ApCheckRegMethod (
ACPI_PARSE_OBJECT *Op);
 
 
/*
* aslerror - error handling/reporting
*/
298,7 → 361,7
 
int
AslCompilererror(
char *s);
const char *s);
 
void
AslCommonError (
470,7 → 533,7
/*
* aslpredef - ACPI predefined names support
*/
void
BOOLEAN
ApCheckForPredefinedMethod (
ACPI_PARSE_OBJECT *Op,
ASL_METHOD_INFO *MethodInfo);
552,6 → 615,10
UINT64 Value);
 
ACPI_PARSE_OBJECT *
TrCreateConstantLeafNode (
UINT32 ParseOpcode);
 
ACPI_PARSE_OBJECT *
TrLinkChildren (
ACPI_PARSE_OBJECT *Op,
UINT32 NumChildren,
677,7 → 744,11
LsDisplayNamespace (
void);
 
void
LsSetupNsList (
void *Handle);
 
 
/*
* aslutils - common compiler utilites
*/
694,6 → 765,10
#define ASL_TREE_OUTPUT 2
 
void
UtDisplaySupportedTables (
void);
 
void
UtDisplayConstantOpcodes (
void);
 
764,8 → 839,31
UtDoConstant (
char *String);
 
ACPI_STATUS
UtStrtoul64 (
char *String,
UINT32 Base,
UINT64 *RetInteger);
 
 
/*
* asluuid - UUID support
*/
ACPI_STATUS
AuValidateUuid (
char *InString);
 
ACPI_STATUS
AuConvertStringToUuid (
char *InString,
char *UuIdBuffer);
 
ACPI_STATUS
AuConvertUuidToString (
char *UuIdBuffer,
char *OutString);
 
/*
* aslresource - Resource template generation utilities
*/
void
778,7 → 876,8
ACPI_PARSE_OBJECT *MinOp,
ACPI_PARSE_OBJECT *MaxOp,
ACPI_PARSE_OBJECT *LengthOp,
ACPI_PARSE_OBJECT *AlignOp);
ACPI_PARSE_OBJECT *AlignOp,
ACPI_PARSE_OBJECT *Op);
 
void
RsLargeAddressCheck (
790,7 → 889,8
ACPI_PARSE_OBJECT *MinOp,
ACPI_PARSE_OBJECT *MaxOp,
ACPI_PARSE_OBJECT *LengthOp,
ACPI_PARSE_OBJECT *GranOp);
ACPI_PARSE_OBJECT *GranOp,
ACPI_PARSE_OBJECT *Op);
 
UINT16
RsGetStringDataLength (
1024,5 → 1124,9
DtDoCompile(
void);
 
ACPI_STATUS
DtCreateTemplates (
char *Signature);
 
#endif /* __ASLCOMPILER_H */
 
/drivers/devman/acpica/compiler/aslcompiler.l
10,7 → 10,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
115,11 → 115,11
*
*****************************************************************************/
 
#include "aslcompiler.h"
#include "aslcompiler.y.h"
 
#include <stdlib.h>
#include <string.h>
#include "aslcompiler.h"
#include "aslcompiler.y.h"
YYSTYPE AslCompilerlval;
 
/*
464,6 → 464,9
"AddressRangeNVS" { count (0); return (PARSEOP_ADDRESSTYPE_NVS); }
"AddressRangeACPI" { count (0); return (PARSEOP_ADDRESSTYPE_ACPI); }
 
"__DATE__" { count (0); return (PARSEOP___DATE__); }
"__FILE__" { count (0); return (PARSEOP___FILE__); }
"__LINE__" { count (0); return (PARSEOP___LINE__); }
 
"{" { count (0); return('{'); }
"}" { count (0); return('}'); }
/drivers/devman/acpica/compiler/aslcompiler.y
10,7 → 10,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
115,14 → 115,6
*
*****************************************************************************/
 
#define YYDEBUG 1
#define YYERROR_VERBOSE 1
 
/*
* State stack - compiler will fault if it overflows. (Default was 200)
*/
#define YYINITDEPTH 600
 
#include "aslcompiler.h"
#include <stdio.h>
#include <stdlib.h>
146,38 → 138,34
* ResourceMacroList, and FieldUnitList
*/
 
void * AslLocalAllocate (unsigned int Size);
 
/*
* Next statement is important - this makes everything public so that
* we can access some of the parser tables from other modules
*/
/* Bison/yacc configuration */
 
#define static
#undef alloca
#define alloca AslLocalAllocate
#define YYERROR_VERBOSE 1
#define yytname AslCompilername
 
void *
AslLocalAllocate (unsigned int Size);
#define YYINITDEPTH 600 /* State stack depth */
#define YYDEBUG 1 /* Enable debug output */
#define YYERROR_VERBOSE 1 /* Verbose error messages */
 
/*
* The windows version of bison defines this incorrectly as "32768" (Not negative).
* Using a custom (edited binary) version of bison that defines YYFLAG as YYFBAD
* We use a custom (edited binary) version of bison that defines YYFLAG as YYFBAD
* instead (#define YYFBAD 32768), so we can define it correctly here.
*
* The problem is that if YYFLAG is positive, the extended syntax error messages
* are disabled.
*/
 
#define YYFLAG -32768
 
 
%}
 
 
/*
* Declare the type of values in the grammar
*/
 
%union {
UINT64 i;
char *s;
184,7 → 172,6
ACPI_PARSE_OBJECT *n;
}
 
 
/*! [Begin] no source code translation */
 
/*
193,7 → 180,6
*/
%expect 60
 
 
/*
* Token types: These are returned by the lexer
*
200,7 → 186,6
* NOTE: This list MUST match the AslKeywordMapping table found
* in aslmap.c EXACTLY! Double check any changes!
*/
 
%token <i> PARSEOP_ACCESSAS
%token <i> PARSEOP_ACCESSATTRIB_BLOCK
%token <i> PARSEOP_ACCESSATTRIB_BLOCK_CALL
464,6 → 449,13
%token <i> PARSEOP_XOR
%token <i> PARSEOP_ZERO
 
/*
* Special functions. These should probably stay at the end of this
* table.
*/
%token <i> PARSEOP___DATE__
%token <i> PARSEOP___FILE__
%token <i> PARSEOP___LINE__
 
/*
* Production names
767,7 → 759,6
%type <n> OptionalReference
%type <n> OptionalAccessSize
 
 
%type <n> TermArgItem
%type <n> NameStringItem
 
794,6 → 785,21
| error {YYABORT; $$ = NULL;}
;
 
/*
* Note concerning support for "module-level code".
*
* ACPI 1.0 allowed Type1 and Type2 executable opcodes outside of control
* methods (the so-called module-level code.) This support was explicitly
* removed in ACPI 2.0, but this type of code continues to be created by
* BIOS vendors. In order to support the disassembly and recompilation of
* such code (and the porting of ASL code to iASL), iASL supports this
* code in violation of the current ACPI specification.
*
* The grammar change to support module-level code is to revert the
* {ObjectList} portion of the DefinitionBlockTerm in ACPI 2.0 to the
* original use of {TermList} instead (see below.) This allows the use
* of Type1 and Type2 opcodes at module level.
*/
DefinitionBlockTerm
: PARSEOP_DEFINITIONBLOCK '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DEFINITIONBLOCK);}
String ','
1535,7 → 1541,7
: PARSEOP_RETURN '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RETURN);}
OptionalReturnArg
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
| PARSEOP_RETURN {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_RETURN),1,TrCreateLeafNode (PARSEOP_ZERO));}
| PARSEOP_RETURN {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_RETURN),1,TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_NULL_RETURN));}
| PARSEOP_RETURN '('
error ')' {$$ = AslDoError(); yyclearin;}
;
2389,6 → 2395,9
: PARSEOP_ZERO {$$ = TrCreateValuedLeafNode (PARSEOP_ZERO, 0);}
| PARSEOP_ONE {$$ = TrCreateValuedLeafNode (PARSEOP_ONE, 1);}
| PARSEOP_ONES {$$ = TrCreateValuedLeafNode (PARSEOP_ONES, ACPI_UINT64_MAX);}
| PARSEOP___DATE__ {$$ = TrCreateConstantLeafNode (PARSEOP___DATE__);}
| PARSEOP___FILE__ {$$ = TrCreateConstantLeafNode (PARSEOP___FILE__);}
| PARSEOP___LINE__ {$$ = TrCreateConstantLeafNode (PARSEOP___LINE__);}
;
 
/* OptionalCount must appear before ByteList or an incorrect reduction will result */
3109,7 → 3118,7
;
 
OptionalReturnArg
: {$$ = TrCreateLeafNode (PARSEOP_ZERO);} /* Placeholder is a ZeroOp object */
: {$$ = TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_NULL_RETURN);} /* Placeholder is a ZeroOp object */
| TermArg {$$ = $1;}
;
 
3142,7 → 3151,6
| ',' error {$$ = AslDoError (); yyclearin;}
;
 
 
%%
 
 
3187,3 → 3195,32
return (TrCreateLeafNode (PARSEOP_ERRORNODE));
 
}
 
 
/*******************************************************************************
*
* FUNCTION: UtGetOpName
*
* PARAMETERS: ParseOpcode - Parser keyword ID
*
* RETURN: Pointer to the opcode name
*
* DESCRIPTION: Get the ascii name of the parse opcode
*
******************************************************************************/
 
char *
UtGetOpName (
UINT32 ParseOpcode)
{
#ifdef ASL_YYTNAME_START
/*
* First entries (ASL_YYTNAME_START) in yytname are special reserved names.
* Ignore first 8 characters of the name
*/
return ((char *) yytname
[(ParseOpcode - ASL_FIRST_PARSE_OPCODE) + ASL_YYTNAME_START] + 8);
#else
return ("[Unknown parser generator]");
#endif
}
/drivers/devman/acpica/compiler/asldefine.h
9,7 → 9,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
122,15 → 122,13
/*
* Compiler versions and names
*/
#define CompilerCreatorRevision ACPI_CA_VERSION
#define ASL_REVISION ACPI_CA_VERSION
#define ASL_COMPILER_NAME "ASL Optimizing Compiler"
#define AML_DISASSEMBLER_NAME "AML Disassembler"
#define ASL_INVOCATION_NAME "iasl"
#define ASL_CREATOR_ID "INTL"
 
#define IntelAcpiCA "Intel ACPI Component Architecture"
#define CompilerId "ASL Optimizing Compiler"
#define DisassemblerId "AML Disassembler"
#define CompilerCopyright "Copyright (c) 2000 - 2010 Intel Corporation"
#define CompilerCompliance "Supports ACPI Specification Revision 4.0a"
#define CompilerName "iasl"
#define CompilerCreatorId "INTL"
#define ASL_COMPLIANCE "Supports ACPI Specification Revision 4.0a"
 
 
/* Configuration constants */
140,12 → 138,23
#define ASL_STRING_CACHE_SIZE 32768
 
#define ASL_FIRST_PARSE_OPCODE PARSEOP_ACCESSAS
#define ASL_YYTNAME_START 3
 
#define ASL_PARSE_OPCODE_BASE PARSEOP_ACCESSAS /* First Lex type */
 
 
/*
* Per-parser-generator configuration. These values are used to cheat and
* directly access the bison/yacc token name table (yyname or yytname).
* Note: These values are the index in yyname for the first lex token
* (PARSEOP_ACCCESSAS).
*/
#if defined (YYBISON)
#define ASL_YYTNAME_START 3 /* Bison */
#elif defined (YYBYACC)
#define ASL_YYTNAME_START 257 /* Berkeley yacc */
#endif
 
 
/*
* Macros
*/
#define ASL_RESDESC_OFFSET(m) ACPI_OFFSET (AML_RESOURCE, m)
171,6 → 180,7
 
/* filename suffixes for output files */
 
#define FILE_SUFFIX_PREPROCESSOR "i"
#define FILE_SUFFIX_AML_CODE "aml"
#define FILE_SUFFIX_LISTING "lst"
#define FILE_SUFFIX_HEX_DUMP "hex"
182,6 → 192,7
#define FILE_SUFFIX_DISASSEMBLY "dsl"
#define FILE_SUFFIX_ASM_INCLUDE "inc"
#define FILE_SUFFIX_C_INCLUDE "h"
#define FILE_SUFFIX_ASL_CODE "asl"
 
 
/* Types for input files */
196,6 → 207,7
#define ASL_EXTERNAL_METHOD 255
#define ASL_ABORT TRUE
#define ASL_NO_ABORT FALSE
#define ASL_EOF ACPI_UINT32_MAX
 
 
/* Support for reserved method names */
/drivers/devman/acpica/compiler/aslerror.c
9,7 → 9,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
241,6 → 241,8
UINT32 ErrorColumn;
FILE *OutputFile;
FILE *SourceFile;
long FileSize;
BOOLEAN PrematureEOF = FALSE;
 
 
if (Gbl_NoErrors)
280,8 → 282,28
/* Get the file handles */
 
OutputFile = Gbl_Files[FileId].Handle;
 
/* Use the merged header/source file if present, otherwise use input file */
 
SourceFile = Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle;
if (!SourceFile)
{
SourceFile = Gbl_Files[ASL_FILE_INPUT].Handle;
}
 
if (SourceFile)
{
/* Determine if the error occurred at source file EOF */
 
fseek (SourceFile, 0, SEEK_END);
FileSize = ftell (SourceFile);
 
if ((long) Enode->LogicalByteOffset >= FileSize)
{
PrematureEOF = TRUE;
}
}
 
if (Header)
{
fprintf (OutputFile, "%s", Header);
300,9 → 322,16
fprintf (OutputFile, "%6u: ", Enode->LineNumber);
 
/*
* Seek to the offset in the combined source file, read the source
* line, and write it to the output.
* If not at EOF, get the corresponding source code line and
* display it. Don't attempt this if we have a premature EOF
* condition.
*/
if (!PrematureEOF)
{
/*
* Seek to the offset in the combined source file, read
* the source line, and write it to the output.
*/
Actual = fseek (SourceFile, (long) Enode->LogicalByteOffset,
(int) SEEK_SET);
if (Actual)
327,6 → 356,8
RActual = fread (&SourceByte, 1, 1, SourceFile);
}
}
}
 
fprintf (OutputFile, "\n");
}
}
369,7 → 400,7
ExtraMessage = NULL;
}
 
if (Gbl_VerboseErrors)
if (Gbl_VerboseErrors && !PrematureEOF)
{
SourceColumn = Enode->Column + Enode->FilenameLength + 6 + 2;
ErrorColumn = ASL_ERROR_LEVEL_LENGTH + 5 + 2 + 1;
399,6 → 430,11
fprintf (OutputFile, " (%s)", ExtraMessage);
}
 
if (PrematureEOF)
{
fprintf (OutputFile, " and premature End-Of-File");
}
 
fprintf (OutputFile, "\n");
if (Gbl_VerboseErrors)
{
656,13 → 692,13
 
int
AslCompilererror (
char *CompilerMessage)
const char *CompilerMessage)
{
 
AslCommonError (ASL_ERROR, ASL_MSG_SYNTAX, Gbl_CurrentLineNumber,
Gbl_LogicalLineNumber, Gbl_CurrentLineOffset,
Gbl_CurrentColumn, Gbl_Files[ASL_FILE_INPUT].Filename,
CompilerMessage);
ACPI_CAST_PTR (char, CompilerMessage));
 
return 0;
}
/drivers/devman/acpica/compiler/aslfiles.c
9,7 → 9,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
122,7 → 122,7
 
/* Local prototypes */
 
FILE *
static FILE *
FlOpenIncludeWithPrefix (
char *PrefixDir,
char *Filename);
546,7 → 546,7
*
******************************************************************************/
 
FILE *
static FILE *
FlOpenIncludeWithPrefix (
char *PrefixDir,
char *Filename)
768,9 → 768,11
char *Filename;
 
 
/* Create/Open a combined source output file */
/* Create/Open a hex output file if asked */
 
Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_SOURCE);
if (Gbl_HexOutputFlag)
{
Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_HEX_DUMP);
if (!Filename)
{
AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME,
778,13 → 780,38
return (AE_ERROR);
}
 
/*
* Open the source output file, binary mode (so that LF does not get
* expanded to CR/LF on some systems, messing up our seek
* calculations.)
*/
FlOpenFile (ASL_FILE_SOURCE_OUTPUT, Filename, "w+b");
/* Open the hex file, text mode */
 
FlOpenFile (ASL_FILE_HEX_OUTPUT, Filename, "w+");
 
AslCompilerSignon (ASL_FILE_HEX_OUTPUT);
AslCompilerFileHeader (ASL_FILE_HEX_OUTPUT);
}
 
/* Create/Open a debug output file if asked */
 
if (Gbl_DebugFlag)
{
Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_DEBUG);
if (!Filename)
{
AslCommonError (ASL_ERROR, ASL_MSG_DEBUG_FILENAME,
0, 0, 0, 0, NULL, NULL);
return (AE_ERROR);
}
 
/* Open the debug file as STDERR, text mode */
 
/* TBD: hide this behind a FlReopenFile function */
 
Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Filename = Filename;
Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle =
freopen (Filename, "w+t", stderr);
 
AslCompilerSignon (ASL_FILE_DEBUG_OUTPUT);
AslCompilerFileHeader (ASL_FILE_DEBUG_OUTPUT);
}
 
/* Create/Open a listing output file if asked */
 
if (Gbl_ListingFlag)
805,6 → 832,28
AslCompilerFileHeader (ASL_FILE_LISTING_OUTPUT);
}
 
if (Gbl_FileType == ASL_INPUT_TYPE_ASCII_DATA)
{
return (AE_OK);
}
 
/* Create/Open a combined source output file */
 
Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_SOURCE);
if (!Filename)
{
AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME,
0, 0, 0, 0, NULL, NULL);
return (AE_ERROR);
}
 
/*
* Open the source output file, binary mode (so that LF does not get
* expanded to CR/LF on some systems, messing up our seek
* calculations.)
*/
FlOpenFile (ASL_FILE_SOURCE_OUTPUT, Filename, "w+b");
 
/* Create/Open a assembly code source output file if asked */
 
if (Gbl_AsmOutputFlag)
887,26 → 936,6
AslCompilerFileHeader (ASL_FILE_C_INCLUDE_OUTPUT);
}
 
/* Create/Open a hex output file if asked */
 
if (Gbl_HexOutputFlag)
{
Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_HEX_DUMP);
if (!Filename)
{
AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME,
0, 0, 0, 0, NULL, NULL);
return (AE_ERROR);
}
 
/* Open the hex file, text mode */
 
FlOpenFile (ASL_FILE_HEX_OUTPUT, Filename, "w+");
 
AslCompilerSignon (ASL_FILE_HEX_OUTPUT);
AslCompilerFileHeader (ASL_FILE_HEX_OUTPUT);
}
 
/* Create a namespace output file if asked */
 
if (Gbl_NsOutputFlag)
927,30 → 956,6
AslCompilerFileHeader (ASL_FILE_NAMESPACE_OUTPUT);
}
 
/* Create/Open a debug output file if asked */
 
if (Gbl_DebugFlag)
{
Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_DEBUG);
if (!Filename)
{
AslCommonError (ASL_ERROR, ASL_MSG_DEBUG_FILENAME,
0, 0, 0, 0, NULL, NULL);
return (AE_ERROR);
}
 
/* Open the debug file as STDERR, text mode */
 
/* TBD: hide this behind a FlReopenFile function */
 
Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Filename = Filename;
Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle =
freopen (Filename, "w+t", stderr);
 
AslCompilerSignon (ASL_FILE_DEBUG_OUTPUT);
AslCompilerFileHeader (ASL_FILE_DEBUG_OUTPUT);
}
 
return (AE_OK);
}
 
/drivers/devman/acpica/compiler/aslfold.c
9,7 → 9,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
/drivers/devman/acpica/compiler/aslglobal.h
10,7 → 10,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
141,9 → 141,9
extern int yydebug;
extern FILE *AslCompilerin;
extern int AslCompilerdebug;
extern int DtParserdebug;
extern const ASL_MAPPING_ENTRY AslKeywordMapping[];
extern char *AslCompilertext;
extern char HexLookup[];
 
#define ASL_LINE_BUFFER_SIZE 1024
#define ASL_MSG_BUFFER_SIZE 4096
171,6 → 171,7
 
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoCompile, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoSignon, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisassembleAll, FALSE);
 
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_Acpi2, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_UseDefaultAmlFilename, TRUE);
197,7 → 198,8
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisplayOptimizations, FALSE);
ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_WarningLevel, ASL_WARNING);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_UseOriginalCompilerId, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DataTableCompilerAvailable, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_VerboseTemplates, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoTemplates, FALSE);
 
 
#define HEX_OUTPUT_NONE 0
213,7 → 215,6
ASL_EXTERN ASL_FILE_INFO Gbl_Files [ASL_NUM_FILES];
 
ASL_EXTERN char *Gbl_DirectoryPath;
ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_ExternalFilename, NULL);
ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_IncludeFilename, NULL);
ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_OutputFilenamePrefix, NULL);
ASL_EXTERN ASL_INCLUDE_DIR ASL_INIT_GLOBAL (*Gbl_IncludeDirList, NULL);
252,8 → 253,8
ASL_EXTERN ACPI_PARSE_OBJECT *Gbl_FirstLevelInsertionNode;
ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_FileType, 0);
ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_Signature, NULL);
ASL_EXTERN char *Gbl_TemplateSignature;
 
 
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentHexColumn, 0);
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentAmlOffset, 0);
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLine, 0);
269,6 → 270,7
 
ASL_EXTERN ASL_ANALYSIS_WALK_INFO AnalysisWalkInfo;
ASL_EXTERN ACPI_TABLE_HEADER TableHeader;
extern char AslHexLookup[];
 
/* Event timing */
 
/drivers/devman/acpica/compiler/asllength.c
9,7 → 9,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
/drivers/devman/acpica/compiler/asllisting.c
9,7 → 9,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
202,7 → 202,7
LsDoHexOutputAsl (
void);
 
ACPI_STATUS
static ACPI_STATUS
LsTreeWriteWalk (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
222,7 → 222,7
*
******************************************************************************/
 
ACPI_STATUS
static ACPI_STATUS
LsTreeWriteWalk (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
/drivers/devman/acpica/compiler/aslload.c
8,7 → 8,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
/drivers/devman/acpica/compiler/asllookup.c
8,7 → 8,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
180,11 → 180,7
void *Context,
void **ReturnValue);
 
void
LsSetupNsList (
void *Handle);
 
ACPI_PARSE_OBJECT *
static ACPI_PARSE_OBJECT *
LkGetNameOp (
ACPI_PARSE_OBJECT *Op);
 
623,7 → 619,7
*
******************************************************************************/
 
ACPI_PARSE_OBJECT *
static ACPI_PARSE_OBJECT *
LkGetNameOp (
ACPI_PARSE_OBJECT *Op)
{
1327,8 → 1323,8
SpaceIdOp = OwningOp->Asl.Child->Asl.Next;
switch ((UINT32) SpaceIdOp->Asl.Value.Integer)
{
case REGION_EC:
case REGION_CMOS:
case ACPI_ADR_SPACE_EC:
case ACPI_ADR_SPACE_CMOS:
 
if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BYTE)
{
1336,8 → 1332,8
}
break;
 
case REGION_SMBUS:
case REGION_IPMI:
case ACPI_ADR_SPACE_SMBUS:
case ACPI_ADR_SPACE_IPMI:
 
if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BUFFER)
{
/drivers/devman/acpica/compiler/aslmain.c
9,7 → 9,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
119,6 → 119,7
 
#include "aslcompiler.h"
#include "acapps.h"
#include "acdisasm.h"
 
#ifdef _DEBUG
#include <crtdbg.h>
167,7 → 168,7
 
 
#define ASL_TOKEN_SEPARATORS " \t\n"
#define ASL_SUPPORTED_OPTIONS "@:2b:c:d^e:fgh^i^I:l^no:p:r:s:t:v:w:x:yz"
#define ASL_SUPPORTED_OPTIONS "@:2b:c:d^e:fgh^i^I:l^no:p:r:s:t:T:v:w:x:z"
 
 
/*******************************************************************************
213,13 → 214,18
printf (" -cr Disable Resource Descriptor error checking\n");
printf (" -r<Revision> Override table header Revision (1-255)\n");
 
printf ("\nListings:\n");
printf ("\nASL Listing Files:\n");
printf (" -l Create mixed listing file (ASL source and AML) (*.lst)\n");
printf (" -ln Create namespace file (*.nsp)\n");
printf (" -ls Create combined source file (expanded includes) (*.src)\n");
 
printf ("\nACPI Data Tables:\n");
printf (" -T <Sig>|ALL|* Create table template file(s) for <Sig>\n");
printf (" -vt Create verbose templates (full disassembly)\n");
 
printf ("\nAML Disassembler:\n");
printf (" -d [file] Disassemble or decode binary ACPI table to file (*.dsl)\n");
printf (" -da [f1,f2] Disassemble multiple tables from single namespace\n");
printf (" -dc [file] Disassemble AML and immediately compile it\n");
printf (" (Obtain DSDT from current system if no input file)\n");
printf (" -e [f1,f2] Include ACPI table(s) for external symbol resolution\n");
230,6 → 236,7
printf (" -h Additional help and compiler debug options\n");
printf (" -hc Display operators allowed in constant expressions\n");
printf (" -hr Display ACPI reserved method names\n");
printf (" -ht Display currently supported ACPI table names\n");
}
 
 
268,7 → 275,6
printf (" -n Parse only, no output generation\n");
printf (" -ot Display compile times\n");
printf (" -x<level> Set debug level for trace output\n");
printf (" -y Temporary: Enable data table compiler\n");
printf (" -z Do not insert new compiler ID for DataTables\n");
}
 
290,7 → 296,8
void)
{
 
printf ("Usage: %s [Options] [Files]\n\n", CompilerName);
printf ("%s\n", ASL_COMPLIANCE);
printf ("Usage: %s [Options] [Files]\n\n", ASL_INVOCATION_NAME);
Options ();
}
 
456,6 → 463,7
BOOLEAN IsResponseFile)
{
int j;
ACPI_STATUS Status;
 
 
/* Get the command line options */
489,10 → 497,12
{
case 'b':
AslCompilerdebug = 1; /* same as yydebug */
DtParserdebug = 1;
break;
 
case 'p':
AslCompilerdebug = 1; /* same as yydebug */
DtParserdebug = 1;
break;
 
case 't':
530,6 → 540,11
Gbl_DoCompile = FALSE;
break;
 
case 'a':
Gbl_DoCompile = FALSE;
Gbl_DisassembleAll = TRUE;
break;
 
case 'c':
break;
 
543,7 → 558,12
 
 
case 'e':
Gbl_ExternalFilename = AcpiGbl_Optarg;
Status = AcpiDmAddToExternalFileList (AcpiGbl_Optarg);
if (ACPI_FAILURE (Status))
{
printf ("Could not add %s to external list\n", AcpiGbl_Optarg);
return (-1);
}
break;
 
 
582,11 → 602,14
ApDisplayReservedNames ();
exit (0);
 
case 't':
UtDisplaySupportedTables ();
exit (0);
 
default:
printf ("Unknown option: -h%s\n", AcpiGbl_Optarg);
return (-1);
}
break;
 
 
case 'I': /* Add an include file search directory */
769,6 → 792,12
break;
 
 
case 'T':
Gbl_DoTemplates = TRUE;
Gbl_TemplateSignature = AcpiGbl_Optarg;
break;
 
 
case 'v':
 
switch (AcpiGbl_Optarg[0])
797,6 → 826,10
Gbl_DoSignon = FALSE;
break;
 
case 't':
Gbl_VerboseTemplates = TRUE;
break;
 
default:
printf ("Unknown option: -v%s\n", AcpiGbl_Optarg);
return (-1);
833,12 → 866,6
break;
 
 
case 'y':
 
Gbl_DataTableCompilerAvailable = TRUE;
break;
 
 
case 'z':
 
Gbl_UseOriginalCompilerId = TRUE;
872,6 → 899,7
char **argv)
{
int BadCommandLine = 0;
ACPI_STATUS Status;
 
 
/* Minimum command line contains at least the command and an input file */
878,7 → 906,7
 
if (argc < 2)
{
AslCompilerSignon (ASL_FILE_STDOUT);
printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME));
Usage ();
exit (1);
}
887,6 → 915,16
 
BadCommandLine = AslDoOptions (argc, argv, FALSE);
 
if (Gbl_DoTemplates)
{
Status = DtCreateTemplates (Gbl_TemplateSignature);
if (ACPI_FAILURE (Status))
{
exit (-1);
}
exit (1);
}
 
/* Next parameter must be the input filename */
 
if (!argv[AcpiGbl_Optind] &&
899,7 → 937,7
 
if (Gbl_DoSignon)
{
AslCompilerSignon (ASL_FILE_STDOUT);
printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME));
}
 
/* Abort if anything went wrong on the command line */
934,9 → 972,12
char **argv)
{
ACPI_STATUS Status;
int Index;
int Index1;
int Index2;
 
 
AcpiGbl_ExternalFileList = NULL;
 
#ifdef _DEBUG
_CrtSetDbgFlag (_CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF |
_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG));
945,7 → 986,7
/* Init and command line */
 
AslInitialize ();
Index = AslCommandLine (argc, argv);
Index1 = Index2 = AslCommandLine (argc, argv);
 
/* Options that have no additional parameters or pathnames */
 
959,19 → 1000,38
return (0);
}
 
if (Gbl_DisassembleAll)
{
while (argv[Index1])
{
Status = AslDoOnePathname (argv[Index1], AcpiDmAddToExternalFileList);
if (ACPI_FAILURE (Status))
{
return (-1);
}
 
Index1++;
}
}
 
/* Process each pathname/filename in the list, with possible wildcards */
 
while (argv[Index])
while (argv[Index2])
{
Status = AslDoOnePathname (argv[Index]);
Status = AslDoOnePathname (argv[Index2], AslDoOneFile);
if (ACPI_FAILURE (Status))
{
return (-1);
}
 
Index++;
Index2++;
}
 
if (AcpiGbl_ExternalFileList)
{
AcpiDmClearExternalFileList();
}
 
return (0);
}
 
/drivers/devman/acpica/compiler/aslmap.c
9,7 → 9,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
213,7 → 213,7
/* ACCESSTYPE_WORD */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_WORD, 0, 0),
/* ACQUIRE */ OP_TABLE_ENTRY (AML_ACQUIRE_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* ADD */ OP_TABLE_ENTRY (AML_ADD_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* ADDRESSSPACE_FFIXEDHW */ OP_TABLE_ENTRY (AML_BYTE_OP, REGION_FIXED_HW, 0, 0),
/* ADDRESSSPACE_FFIXEDHW */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_ADR_SPACE_FIXED_HARDWARE, 0, 0),
/* ADDRESSTYPE_ACPI */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0),
/* ADDRESSTYPE_MEMORY */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
/* ADDRESSTYPE_NVS */ OP_TABLE_ENTRY (AML_BYTE_OP, 3, 0, 0),
393,14 → 393,14
/* READWRITETYPE_BOTH */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
/* READWRITETYPE_READONLY */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
/* REFOF */ OP_TABLE_ENTRY (AML_REF_OF_OP, 0, 0, ACPI_BTYPE_REFERENCE),
/* REGIONSPACE_CMOS */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_CMOS, 0, 0),
/* REGIONSPACE_EC */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_EC, 0, 0),
/* REGIONSPACE_IO */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_IO, 0, 0),
/* REGIONSPACE_IPMI */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_IPMI, 0, 0),
/* REGIONSPACE_MEM */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_MEMORY, 0, 0),
/* REGIONSPACE_PCI */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_PCI_CONFIG, 0, 0),
/* REGIONSPACE_PCIBAR */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_PCI_BAR, 0, 0),
/* REGIONSPACE_SMBUS */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_SMBUS, 0, 0),
/* REGIONSPACE_CMOS */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_CMOS, 0, 0),
/* REGIONSPACE_EC */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_EC, 0, 0),
/* REGIONSPACE_IO */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_SYSTEM_IO, 0, 0),
/* REGIONSPACE_IPMI */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_IPMI, 0, 0),
/* REGIONSPACE_MEM */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_SYSTEM_MEMORY, 0, 0),
/* REGIONSPACE_PCI */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_PCI_CONFIG, 0, 0),
/* REGIONSPACE_PCIBAR */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_PCI_BAR_TARGET, 0, 0),
/* REGIONSPACE_SMBUS */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_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),
/drivers/devman/acpica/compiler/aslmessages.h
0,0 → 1,452
 
/******************************************************************************
*
* Module Name: aslmessages.h - Compiler error/warning messages
*
*****************************************************************************/
 
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
* rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
* copy of the source code appearing in this file ("Covered Code") an
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
* base code distributed originally by Intel ("Original Intel Code") to copy,
* make derivatives, distribute, use and display any portion of the Covered
* Code in any form, with the right to sublicense such rights; and
*
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
* license (with the right to sublicense), under only those claims of Intel
* patents that are infringed by the Original Intel Code, to make, use, sell,
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
* to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
* documentation and/or other materials provided with distribution. In
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* property embodied in the software Licensee provides to its licensee, and
* not to intellectual property embodied in modifications its licensee may
* make.
*
* 3.3. Redistribution of Executable. Redistribution in executable form of any
* substantial portion of the Covered Code or modification must reproduce the
* above Copyright Notice, and the following Disclaimer and Export Compliance
* provision in the documentation and/or other materials provided with the
* distribution.
*
* 3.4. Intel retains all right, title, and interest in and to the Original
* Intel Code.
*
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
* Intel shall be used in advertising or otherwise to promote the sale, use or
* other dealings in products derived from or relating to the Covered Code
* without prior written authorization from Intel.
*
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
* any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* ensure that the distribution and export/re-export of the software is in
* compliance with all laws, regulations, orders, or other restrictions of the
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
* any of its subsidiaries will export/re-export any technical data, process,
* software, or service, directly or indirectly, to any country for which the
* United States government or any agency thereof requires an export license,
* other governmental approval, or letter of assurance, without first obtaining
* such license, approval or letter.
*
*****************************************************************************/
 
 
#ifndef __ASLMESSAGES_H
#define __ASLMESSAGES_H
 
 
#define ASL_WARNING 0
#define ASL_WARNING2 1
#define ASL_WARNING3 2
#define ASL_ERROR 3
#define ASL_REMARK 4
#define ASL_OPTIMIZATION 5
#define ASL_NUM_REPORT_LEVELS 6
 
 
/* Values for all compiler messages */
 
typedef enum
{
ASL_MSG_RESERVED = 0,
ASL_MSG_ALPHANUMERIC_STRING,
ASL_MSG_AML_NOT_IMPLEMENTED,
ASL_MSG_ARG_COUNT_HI,
ASL_MSG_ARG_COUNT_LO,
ASL_MSG_ARG_INIT,
ASL_MSG_BACKWARDS_OFFSET,
ASL_MSG_BITS_TO_BYTES,
ASL_MSG_BUFFER_LENGTH,
ASL_MSG_BYTES_TO_BITS,
ASL_MSG_CLOSE,
ASL_MSG_COMPILER_INTERNAL,
ASL_MSG_CONSTANT_EVALUATION,
ASL_MSG_CONSTANT_FOLDED,
ASL_MSG_CORE_EXCEPTION,
ASL_MSG_DEBUG_FILE_OPEN,
ASL_MSG_DEBUG_FILENAME,
ASL_MSG_DEPENDENT_NESTING,
ASL_MSG_DMA_CHANNEL,
ASL_MSG_DMA_LIST,
ASL_MSG_DUPLICATE_CASE,
ASL_MSG_DUPLICATE_ITEM,
ASL_MSG_EARLY_EOF,
ASL_MSG_ENCODING_LENGTH,
ASL_MSG_EX_INTERRUPT_LIST,
ASL_MSG_EX_INTERRUPT_LIST_MIN,
ASL_MSG_EX_INTERRUPT_NUMBER,
ASL_MSG_FIELD_ACCESS_WIDTH,
ASL_MSG_FIELD_UNIT_ACCESS_WIDTH,
ASL_MSG_FIELD_UNIT_OFFSET,
ASL_MSG_INCLUDE_FILE_OPEN,
ASL_MSG_INPUT_FILE_OPEN,
ASL_MSG_INTEGER_LENGTH,
ASL_MSG_INTEGER_OPTIMIZATION,
ASL_MSG_INTERRUPT_LIST,
ASL_MSG_INTERRUPT_NUMBER,
ASL_MSG_INVALID_CONSTANT_OP,
ASL_MSG_INVALID_EISAID,
ASL_MSG_INVALID_ESCAPE,
ASL_MSG_INVALID_OPERAND,
ASL_MSG_INVALID_PERFORMANCE,
ASL_MSG_INVALID_PRIORITY,
ASL_MSG_INVALID_STRING,
ASL_MSG_INVALID_TARGET,
ASL_MSG_INVALID_TIME,
ASL_MSG_INVALID_TYPE,
ASL_MSG_INVALID_UUID,
ASL_MSG_LIST_LENGTH_LONG,
ASL_MSG_LIST_LENGTH_SHORT,
ASL_MSG_LISTING_FILE_OPEN,
ASL_MSG_LISTING_FILENAME,
ASL_MSG_LOCAL_INIT,
ASL_MSG_LONG_LINE,
ASL_MSG_MEMORY_ALLOCATION,
ASL_MSG_MISSING_ENDDEPENDENT,
ASL_MSG_MISSING_STARTDEPENDENT,
ASL_MSG_MULTIPLE_TYPES,
ASL_MSG_NAME_EXISTS,
ASL_MSG_NAME_OPTIMIZATION,
ASL_MSG_NESTED_COMMENT,
ASL_MSG_NO_CASES,
ASL_MSG_NO_RETVAL,
ASL_MSG_NO_WHILE,
ASL_MSG_NON_ASCII,
ASL_MSG_NOT_EXIST,
ASL_MSG_NOT_FOUND,
ASL_MSG_NOT_METHOD,
ASL_MSG_NOT_PARAMETER,
ASL_MSG_NOT_REACHABLE,
ASL_MSG_OPEN,
ASL_MSG_OUTPUT_FILE_OPEN,
ASL_MSG_OUTPUT_FILENAME,
ASL_MSG_PACKAGE_LENGTH,
ASL_MSG_READ,
ASL_MSG_RECURSION,
ASL_MSG_REGION_BUFFER_ACCESS,
ASL_MSG_REGION_BYTE_ACCESS,
ASL_MSG_RESERVED_ARG_COUNT_HI,
ASL_MSG_RESERVED_ARG_COUNT_LO,
ASL_MSG_RESERVED_METHOD,
ASL_MSG_RESERVED_OPERAND_TYPE,
ASL_MSG_RESERVED_RETURN_VALUE,
ASL_MSG_RESERVED_USE,
ASL_MSG_RESERVED_WORD,
ASL_MSG_RESOURCE_FIELD,
ASL_MSG_RESOURCE_INDEX,
ASL_MSG_RESOURCE_LIST,
ASL_MSG_RESOURCE_SOURCE,
ASL_MSG_RETURN_TYPES,
ASL_MSG_SCOPE_FWD_REF,
ASL_MSG_SCOPE_TYPE,
ASL_MSG_SEEK,
ASL_MSG_SINGLE_NAME_OPTIMIZATION,
ASL_MSG_SOME_NO_RETVAL,
ASL_MSG_SWITCH_TYPE,
ASL_MSG_SYNC_LEVEL,
ASL_MSG_SYNTAX,
ASL_MSG_TABLE_SIGNATURE,
ASL_MSG_TOO_MANY_TEMPS,
ASL_MSG_UNKNOWN_RESERVED_NAME,
ASL_MSG_UNREACHABLE_CODE,
ASL_MSG_UNSUPPORTED,
ASL_MSG_VENDOR_LIST,
ASL_MSG_WRITE,
ASL_MSG_MULTIPLE_DEFAULT,
ASL_MSG_TIMEOUT,
ASL_MSG_RESULT_NOT_USED,
ASL_MSG_NOT_REFERENCED,
ASL_MSG_NON_ZERO,
ASL_MSG_STRING_LENGTH,
ASL_MSG_SERIALIZED,
ASL_MSG_COMPILER_RESERVED,
ASL_MSG_NAMED_OBJECT_IN_WHILE,
ASL_MSG_LOCAL_OUTSIDE_METHOD,
ASL_MSG_ALIGNMENT,
ASL_MSG_ISA_ADDRESS,
ASL_MSG_INVALID_MIN_MAX,
ASL_MSG_INVALID_LENGTH,
ASL_MSG_INVALID_LENGTH_FIXED,
ASL_MSG_INVALID_GRANULARITY,
ASL_MSG_INVALID_GRAN_FIXED,
ASL_MSG_INVALID_ACCESS_SIZE,
ASL_MSG_INVALID_ADDR_FLAGS,
ASL_MSG_NULL_DESCRIPTOR,
ASL_MSG_UPPER_CASE,
ASL_MSG_HID_LENGTH,
ASL_MSG_NULL_STRING,
ASL_MSG_LEADING_ASTERISK,
ASL_MSG_RESERVED_NO_RETURN_VAL,
ASL_MSG_GPE_NAME_CONFLICT,
ASL_MSG_NO_REGION,
 
ASL_MSG_INVALID_FIELD_NAME,
ASL_MSG_INTEGER_SIZE,
ASL_MSG_INVALID_HEX_INTEGER,
ASL_MSG_BUFFER_ELEMENT,
ASL_MSG_RESERVED_VALUE,
ASL_MSG_FLAG_VALUE,
ASL_MSG_ZERO_VALUE,
ASL_MSG_UNKNOWN_TABLE,
ASL_MSG_UNKNOWN_SUBTABLE,
ASL_MSG_OEM_TABLE,
ASL_MSG_UNKNOWN_LABEL,
ASL_MSG_INVALID_EXPRESSION,
ASL_MSG_DIVIDE_BY_ZERO
 
} ASL_MESSAGE_IDS;
 
 
#ifdef ASL_EXCEPTIONS
 
/* Actual message strings for each compiler message */
 
char *AslMessages [] = {
/* The zeroth message is reserved */ "",
/* ASL_MSG_ALPHANUMERIC_STRING */ "String must be entirely alphanumeric",
/* ASL_MSG_AML_NOT_IMPLEMENTED */ "Opcode is not implemented in compiler AML code generator",
/* ASL_MSG_ARG_COUNT_HI */ "Too many arguments",
/* ASL_MSG_ARG_COUNT_LO */ "Too few arguments",
/* ASL_MSG_ARG_INIT */ "Method argument is not initialized",
/* ASL_MSG_BACKWARDS_OFFSET */ "Invalid backwards offset",
/* ASL_MSG_BITS_TO_BYTES */ "Field offset is in bits, but a byte offset is required",
/* ASL_MSG_BUFFER_LENGTH */ "Effective AML buffer length is zero",
/* ASL_MSG_BYTES_TO_BITS */ "Field offset is in bytes, but a bit offset is required",
/* ASL_MSG_CLOSE */ "Could not close file",
/* ASL_MSG_COMPILER_INTERNAL */ "Internal compiler error",
/* ASL_MSG_CONSTANT_EVALUATION */ "Could not evaluate constant expression",
/* ASL_MSG_CONSTANT_FOLDED */ "Constant expression evaluated and reduced",
/* ASL_MSG_CORE_EXCEPTION */ "From ACPI CA Subsystem",
/* ASL_MSG_DEBUG_FILE_OPEN */ "Could not open debug file",
/* ASL_MSG_DEBUG_FILENAME */ "Could not create debug filename",
/* ASL_MSG_DEPENDENT_NESTING */ "Dependent function macros cannot be nested",\
/* ASL_MSG_DMA_CHANNEL */ "Invalid DMA channel (must be 0-7)",
/* ASL_MSG_DMA_LIST */ "Too many DMA channels (8 max)",
/* ASL_MSG_DUPLICATE_CASE */ "Case value already specified",
/* ASL_MSG_DUPLICATE_ITEM */ "Duplicate value in list",
/* ASL_MSG_EARLY_EOF */ "Premature end-of-file reached",
/* ASL_MSG_ENCODING_LENGTH */ "Package length too long to encode",
/* ASL_MSG_EX_INTERRUPT_LIST */ "Too many interrupts (255 max)",
/* ASL_MSG_EX_INTERRUPT_LIST_MIN */ "Too few interrupts (1 minimum required)",
/* ASL_MSG_EX_INTERRUPT_NUMBER */ "Invalid interrupt number (must be 32 bits)",
/* ASL_MSG_FIELD_ACCESS_WIDTH */ "Access width is greater than region size",
/* ASL_MSG_FIELD_UNIT_ACCESS_WIDTH */ "Access width of Field Unit extends beyond region limit",
/* ASL_MSG_FIELD_UNIT_OFFSET */ "Field Unit extends beyond region limit",
/* ASL_MSG_INCLUDE_FILE_OPEN */ "Could not open include file",
/* ASL_MSG_INPUT_FILE_OPEN */ "Could not open input file",
/* ASL_MSG_INTEGER_LENGTH */ "64-bit integer in 32-bit table, truncating",
/* ASL_MSG_INTEGER_OPTIMIZATION */ "Integer optimized to single-byte AML opcode",
/* ASL_MSG_INTERRUPT_LIST */ "Too many interrupts (16 max)",
/* ASL_MSG_INTERRUPT_NUMBER */ "Invalid interrupt number (must be 0-15)",
/* ASL_MSG_INVALID_CONSTANT_OP */ "Invalid operator in constant expression (not type 3/4/5)",
/* ASL_MSG_INVALID_EISAID */ "EISAID string must be of the form \"UUUXXXX\" (3 uppercase, 4 hex digits)",
/* ASL_MSG_INVALID_ESCAPE */ "Invalid or unknown escape sequence",
/* ASL_MSG_INVALID_OPERAND */ "Invalid operand",
/* ASL_MSG_INVALID_PERFORMANCE */ "Invalid performance/robustness value",
/* ASL_MSG_INVALID_PRIORITY */ "Invalid priority value",
/* ASL_MSG_INVALID_STRING */ "Invalid Hex/Octal Escape - Non-ASCII or NULL",
/* ASL_MSG_INVALID_TARGET */ "Target operand not allowed in constant expression",
/* ASL_MSG_INVALID_TIME */ "Time parameter too long (255 max)",
/* ASL_MSG_INVALID_TYPE */ "Invalid type",
/* ASL_MSG_INVALID_UUID */ "UUID string must be of the form \"aabbccdd-eeff-gghh-iijj-kkllmmnnoopp\"",
/* ASL_MSG_LIST_LENGTH_LONG */ "Initializer list longer than declared package length",
/* ASL_MSG_LIST_LENGTH_SHORT */ "Initializer list shorter than declared package length",
/* ASL_MSG_LISTING_FILE_OPEN */ "Could not open listing file",
/* ASL_MSG_LISTING_FILENAME */ "Could not create listing filename",
/* ASL_MSG_LOCAL_INIT */ "Method local variable is not initialized",
/* ASL_MSG_LONG_LINE */ "Splitting long input line",
/* ASL_MSG_MEMORY_ALLOCATION */ "Memory allocation failure",
/* ASL_MSG_MISSING_ENDDEPENDENT */ "Missing EndDependentFn() macro in dependent resource list",
/* ASL_MSG_MISSING_STARTDEPENDENT */ "Missing StartDependentFn() macro in dependent resource list",
/* ASL_MSG_MULTIPLE_TYPES */ "Multiple types",
/* ASL_MSG_NAME_EXISTS */ "Name already exists in scope",
/* ASL_MSG_NAME_OPTIMIZATION */ "NamePath optimized",
/* ASL_MSG_NESTED_COMMENT */ "Nested comment found",
/* ASL_MSG_NO_CASES */ "No Case statements under Switch",
/* ASL_MSG_NO_RETVAL */ "Called method returns no value",
/* ASL_MSG_NO_WHILE */ "No enclosing While statement",
/* ASL_MSG_NON_ASCII */ "Invalid characters found in file",
/* ASL_MSG_NOT_EXIST */ "Object does not exist",
/* ASL_MSG_NOT_FOUND */ "Object not found or not accessible from scope",
/* ASL_MSG_NOT_METHOD */ "Not a control method, cannot invoke",
/* ASL_MSG_NOT_PARAMETER */ "Not a parameter, used as local only",
/* ASL_MSG_NOT_REACHABLE */ "Object is not accessible from this scope",
/* ASL_MSG_OPEN */ "Could not open file",
/* ASL_MSG_OUTPUT_FILE_OPEN */ "Could not open output AML file",
/* ASL_MSG_OUTPUT_FILENAME */ "Could not create output filename",
/* ASL_MSG_PACKAGE_LENGTH */ "Effective AML package length is zero",
/* ASL_MSG_READ */ "Could not read file",
/* ASL_MSG_RECURSION */ "Recursive method call",
/* ASL_MSG_REGION_BUFFER_ACCESS */ "Host Operation Region requires BufferAcc access",
/* ASL_MSG_REGION_BYTE_ACCESS */ "Host Operation Region requires ByteAcc access",
/* ASL_MSG_RESERVED_ARG_COUNT_HI */ "Reserved method has too many arguments",
/* ASL_MSG_RESERVED_ARG_COUNT_LO */ "Reserved method has too few arguments",
/* ASL_MSG_RESERVED_METHOD */ "Reserved name must be a control method",
/* ASL_MSG_RESERVED_OPERAND_TYPE */ "Invalid object type for reserved name",
/* ASL_MSG_RESERVED_RETURN_VALUE */ "Reserved method must return a value",
/* ASL_MSG_RESERVED_USE */ "Invalid use of reserved name",
/* ASL_MSG_RESERVED_WORD */ "Use of reserved name",
/* ASL_MSG_RESOURCE_FIELD */ "Resource field name cannot be used as a target",
/* ASL_MSG_RESOURCE_INDEX */ "Missing ResourceSourceIndex (required)",
/* ASL_MSG_RESOURCE_LIST */ "Too many resource items (internal error)",
/* ASL_MSG_RESOURCE_SOURCE */ "Missing ResourceSource string (required)",
/* ASL_MSG_RETURN_TYPES */ "Not all control paths return a value",
/* ASL_MSG_SCOPE_FWD_REF */ "Forward references from Scope operator not allowed",
/* ASL_MSG_SCOPE_TYPE */ "Existing object has invalid type for Scope operator",
/* ASL_MSG_SEEK */ "Could not seek file",
/* ASL_MSG_SINGLE_NAME_OPTIMIZATION */ "NamePath optimized to NameSeg (uses run-time search path)",
/* ASL_MSG_SOME_NO_RETVAL */ "Called method may not always return a value",
/* ASL_MSG_SWITCH_TYPE */ "Switch expression is not a static Integer/Buffer/String data type, defaulting to Integer",
/* ASL_MSG_SYNC_LEVEL */ "SyncLevel must be in the range 0-15",
/* ASL_MSG_SYNTAX */ "",
/* ASL_MSG_TABLE_SIGNATURE */ "Invalid Table Signature",
/* ASL_MSG_TOO_MANY_TEMPS */ "Method requires too many temporary variables (_T_x)",
/* ASL_MSG_UNKNOWN_RESERVED_NAME */ "Unknown reserved name",
/* ASL_MSG_UNREACHABLE_CODE */ "Statement is unreachable",
/* ASL_MSG_UNSUPPORTED */ "Unsupported feature",
/* ASL_MSG_VENDOR_LIST */ "Too many vendor data bytes (7 max)",
/* ASL_MSG_WRITE */ "Could not write file",
/* ASL_MSG_MULTIPLE_DEFAULT */ "More than one Default statement within Switch construct",
/* ASL_MSG_TIMEOUT */ "Result is not used, possible operator timeout will be missed",
/* ASL_MSG_RESULT_NOT_USED */ "Result is not used, operator has no effect",
/* ASL_MSG_NOT_REFERENCED */ "Namespace object is not referenced",
/* ASL_MSG_NON_ZERO */ "Operand evaluates to zero",
/* ASL_MSG_STRING_LENGTH */ "String literal too long",
/* ASL_MSG_SERIALIZED */ "Control Method marked Serialized",
/* ASL_MSG_COMPILER_RESERVED */ "Use of compiler reserved name",
/* ASL_MSG_NAMED_OBJECT_IN_WHILE */ "Creating a named object in a While loop",
/* ASL_MSG_LOCAL_OUTSIDE_METHOD */ "Local or Arg used outside a control method",
/* ASL_MSG_ALIGNMENT */ "Must be a multiple of alignment/granularity value",
/* ASL_MSG_ISA_ADDRESS */ "Maximum 10-bit ISA address (0x3FF)",
/* ASL_MSG_INVALID_MIN_MAX */ "Address Min is greater than Address Max",
/* ASL_MSG_INVALID_LENGTH */ "Length is larger than Min/Max window",
/* ASL_MSG_INVALID_LENGTH_FIXED */ "Length is not equal to fixed Min/Max window",
/* ASL_MSG_INVALID_GRANULARITY */ "Granularity must be zero or a power of two minus one",
/* ASL_MSG_INVALID_GRAN_FIXED */ "Granularity must be zero for fixed Min/Max",
/* ASL_MSG_INVALID_ACCESS_SIZE */ "Invalid AccessSize (Maximum is 4 - QWord access)",
/* ASL_MSG_INVALID_ADDR_FLAGS */ "Invalid combination of Length and Min/Max fixed flags",
/* ASL_MSG_NULL_DESCRIPTOR */ "Min/Max/Length/Gran are all zero, but no resource tag",
/* ASL_MSG_UPPER_CASE */ "Non-hex letters must be upper case",
/* ASL_MSG_HID_LENGTH */ "_HID string must be exactly 7 or 8 characters",
/* ASL_MSG_NULL_STRING */ "Invalid zero-length (null) string",
/* ASL_MSG_LEADING_ASTERISK */ "Invalid leading asterisk",
/* ASL_MSG_RESERVED_NO_RETURN_VAL */ "Reserved method should not return a value",
/* ASL_MSG_GPE_NAME_CONFLICT */ "Name conflicts with a previous GPE method",
/* ASL_MSG_NO_REGION */ "_REG has no corresponding Operation Region",
 
/* These messages are used by the data table compiler only */
 
/* ASL_MSG_INVALID_FIELD_NAME */ "Invalid Field Name",
/* ASL_MSG_INTEGER_SIZE */ "Integer too large for target",
/* ASL_MSG_INVALID_HEX_INTEGER */ "Invalid hex integer constant",
/* ASL_MSG_BUFFER_ELEMENT */ "Invalid element in buffer initializer list",
/* ASL_MSG_RESERVED_VALUE */ "Reserved field must be zero",
/* ASL_MSG_FLAG_VALUE */ "Flag value is too large",
/* ASL_MSG_ZERO_VALUE */ "Value must be non-zero",
/* ASL_MSG_UNKNOWN_TABLE */ "Unknown ACPI table signature",
/* ASL_MSG_UNKNOWN_SUBTABLE */ "Unknown subtable type",
/* ASL_MSG_OEM_TABLE */ "OEM table - unknown contents",
/* ASL_MSG_UNKNOWN_LABEL */ "Label is undefined",
/* ASL_MSG_INVALID_EXPRESSION */ "Invalid expression",
/* ASL_MSG_DIVIDE_BY_ZERO */ "Expression contains divide-by-zero"
};
 
 
char *AslErrorLevel [ASL_NUM_REPORT_LEVELS] = {
"Warning ",
"Warning ",
"Warning ",
"Error ",
"Remark ",
"Optimize"
};
 
#define ASL_ERROR_LEVEL_LENGTH 8 /* Length of strings above */
 
#endif /* ASL_EXCEPTIONS */
 
#endif /* __ASLMESSAGES_H */
/drivers/devman/acpica/compiler/aslopcodes.c
9,7 → 9,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
123,13 → 123,6
ACPI_MODULE_NAME ("aslopcodes")
 
 
/* UUID support */
 
static UINT8 OpcMapToUUID[16] =
{
6,4,2,0,11,9,16,14,19,21,24,26,28,30,32,34
};
 
/* Local prototypes */
 
static void
592,9 → 585,9
/* Create ID big-endian first (bits are contiguous) */
 
BigEndianId =
(UINT32) (InString[0] - 0x40) << 26 |
(UINT32) (InString[1] - 0x40) << 21 |
(UINT32) (InString[2] - 0x40) << 16 |
(UINT32) ((UINT8) (InString[0] - 0x40)) << 26 |
(UINT32) ((UINT8) (InString[1] - 0x40)) << 21 |
(UINT32) ((UINT8) (InString[2] - 0x40)) << 16 |
 
(UtHexCharToValue (InString[3])) << 12 |
(UtHexCharToValue (InString[4])) << 8 |
641,49 → 634,20
char *InString;
char *Buffer;
ACPI_STATUS Status = AE_OK;
UINT32 i;
ACPI_PARSE_OBJECT *NewOp;
 
 
InString = (char *) Op->Asl.Value.String;
 
if (ACPI_STRLEN (InString) != 36)
{
Status = AE_BAD_PARAMETER;
}
else
{
/* Check all 36 characters for correct format */
 
for (i = 0; i < 36; i++)
{
if ((i == 8) || (i == 13) || (i == 18) || (i == 23))
{
if (InString[i] != '-')
{
Status = AE_BAD_PARAMETER;
}
}
else
{
if (!isxdigit ((int) InString[i]))
{
Status = AE_BAD_PARAMETER;
}
}
}
}
 
Buffer = UtLocalCalloc (16);
 
Status = AuValidateUuid (InString);
if (ACPI_FAILURE (Status))
{
AslError (ASL_ERROR, ASL_MSG_INVALID_UUID, Op, Op->Asl.Value.String);
}
else for (i = 0; i < 16; i++)
else
{
Buffer[i] = (char) (UtHexCharToValue (InString[OpcMapToUUID[i]]) << 4);
Buffer[i] |= (char) UtHexCharToValue (InString[OpcMapToUUID[i] + 1]);
(void) AuConvertStringToUuid (InString, Buffer);
}
 
/* Change Op to a Buffer */
/drivers/devman/acpica/compiler/asloperands.c
9,7 → 9,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
/drivers/devman/acpica/compiler/aslopt.c
8,7 → 8,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
/drivers/devman/acpica/compiler/aslpredef.c
8,7 → 8,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
117,8 → 117,6
 
#include "aslcompiler.h"
#include "aslcompiler.y.h"
#include "amlcode.h"
#include "acparser.h"
#include "acpredef.h"
 
 
128,6 → 126,11
 
/* Local prototypes */
 
static void
ApCheckForUnexpectedReturnValue (
ACPI_PARSE_OBJECT *Op,
ASL_METHOD_INFO *MethodInfo);
 
static UINT32
ApCheckForSpecialName (
ACPI_PARSE_OBJECT *Op,
219,7 → 222,7
*
******************************************************************************/
 
void
BOOLEAN
ApCheckForPredefinedMethod (
ACPI_PARSE_OBJECT *Op,
ASL_METHOD_INFO *MethodInfo)
240,7 → 243,7
case ACPI_COMPILER_RESERVED_NAME: /* A _Txx that was not emitted by compiler */
 
/* Just return, nothing to do */
break;
return (FALSE);
 
 
case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */
307,11 → 310,60
}
break;
}
 
return (TRUE);
}
 
 
/*******************************************************************************
*
* FUNCTION: ApCheckForUnexpectedReturnValue
*
* PARAMETERS: Op - A parse node of type "RETURN".
* MethodInfo - Saved info about this method
*
* RETURN: None
*
* DESCRIPTION: Check for an unexpected return value from a predefined method.
* Invoked for predefined methods that are defined to not return
* any value. If there is a return value, issue a remark, since
* the ASL writer may be confused as to the method definition
* and/or functionality.
*
* Note: We ignore all return values of "Zero", since this is what a standalone
* Return() statement will always generate -- so we ignore it here --
* i.e., there is no difference between Return() and Return(Zero).
* Also, a null Return() will be disassembled to return(Zero) -- so, we
* don't want to generate extraneous remarks/warnings for a disassembled
* ASL file.
*
******************************************************************************/
 
static void
ApCheckForUnexpectedReturnValue (
ACPI_PARSE_OBJECT *Op,
ASL_METHOD_INFO *MethodInfo)
{
ACPI_PARSE_OBJECT *ReturnValueOp;
 
 
/* Ignore Return() and Return(Zero) (they are the same) */
 
ReturnValueOp = Op->Asl.Child;
if (ReturnValueOp->Asl.ParseOpcode == PARSEOP_ZERO)
{
return;
}
 
/* We have a valid return value, but the reserved name did not expect it */
 
AslError (ASL_WARNING, ASL_MSG_RESERVED_NO_RETURN_VAL,
Op, MethodInfo->Op->Asl.ExternalName);
}
 
 
/*******************************************************************************
*
* FUNCTION: ApCheckPredefinedReturnValue
*
* PARAMETERS: Op - A parse node of type "RETURN".
323,7 → 375,9
* value. Only "static" types can be validated - a simple return
* of an integer/string/buffer/package or a named reference to
* a static object. Values such as a Localx or Argx or a control
* method invocation are not checked.
* method invocation are not checked. Issue a warning if there is
* a valid return value, but the reserved method defines no
* return value.
*
******************************************************************************/
 
343,10 → 397,16
 
switch (Index)
{
case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */
 
/* No return value expected, warn if there is one */
 
ApCheckForUnexpectedReturnValue (Op, MethodInfo);
return;
 
case ACPI_NOT_RESERVED_NAME: /* No underscore or _Txx or _xxx name not matched */
case ACPI_PREDEFINED_NAME: /* Resource Name or reserved scope name */
case ACPI_COMPILER_RESERVED_NAME: /* A _Txx that was not emitted by compiler */
case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */
 
/* Just return, nothing to do */
return;
353,10 → 413,11
 
default: /* A standard predefined ACPI name */
 
/* Exit if no return value expected */
 
if (!PredefinedNames[Index].Info.ExpectedBtypes)
{
/* No return value expected, warn if there is one */
 
ApCheckForUnexpectedReturnValue (Op, MethodInfo);
return;
}
 
/drivers/devman/acpica/compiler/aslresource.c
9,7 → 9,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
139,6 → 139,7
* NULL, means "zero value for alignment is
* OK, and means 64K alignment" (for
* Memory24 descriptor)
* Op - Parent Op for entire construct
*
* RETURN: None. Adds error messages to error log if necessary
*
158,7 → 159,8
ACPI_PARSE_OBJECT *MinOp,
ACPI_PARSE_OBJECT *MaxOp,
ACPI_PARSE_OBJECT *LengthOp,
ACPI_PARSE_OBJECT *AlignOp)
ACPI_PARSE_OBJECT *AlignOp,
ACPI_PARSE_OBJECT *Op)
{
 
if (Gbl_NoResourceChecking)
166,6 → 168,34
return;
}
 
/*
* Check for a so-called "null descriptor". These are descriptors that are
* created with most fields set to zero. The intent is that the descriptor
* will be updated/completed at runtime via a BufferField.
*
* If the descriptor does NOT have a resource tag, it cannot be referenced
* by a BufferField and we will flag this as an error. Conversely, if
* the descriptor has a resource tag, we will assume that a BufferField
* will be used to dynamically update it, so no error.
*
* A possible enhancement to this check would be to verify that in fact
* a BufferField is created using the resource tag, and perhaps even
* verify that a Store is performed to the BufferField.
*
* Note: for these descriptors, Alignment is allowed to be zero
*/
if (!Minimum && !Maximum && !Length)
{
if (!Op->Asl.ExternalName)
{
/* No resource tag. Descriptor is fixed and is also illegal */
 
AslError (ASL_ERROR, ASL_MSG_NULL_DESCRIPTOR, Op, NULL);
}
 
return;
}
 
/* Special case for Memory24, values are compressed */
 
if (Type == ACPI_RESOURCE_NAME_MEMORY24)
230,6 → 260,7
* MaxOp - Original Op for Address Max
* LengthOp - Original Op for address range
* GranOp - Original Op for address granularity
* Op - Parent Op for entire construct
*
* RETURN: None. Adds error messages to error log if necessary
*
259,7 → 290,8
ACPI_PARSE_OBJECT *MinOp,
ACPI_PARSE_OBJECT *MaxOp,
ACPI_PARSE_OBJECT *LengthOp,
ACPI_PARSE_OBJECT *GranOp)
ACPI_PARSE_OBJECT *GranOp,
ACPI_PARSE_OBJECT *Op)
{
 
if (Gbl_NoResourceChecking)
267,6 → 299,32
return;
}
 
/*
* Check for a so-called "null descriptor". These are descriptors that are
* created with most fields set to zero. The intent is that the descriptor
* will be updated/completed at runtime via a BufferField.
*
* If the descriptor does NOT have a resource tag, it cannot be referenced
* by a BufferField and we will flag this as an error. Conversely, if
* the descriptor has a resource tag, we will assume that a BufferField
* will be used to dynamically update it, so no error.
*
* A possible enhancement to this check would be to verify that in fact
* a BufferField is created using the resource tag, and perhaps even
* verify that a Store is performed to the BufferField.
*/
if (!Minimum && !Maximum && !Length && !Granularity)
{
if (!Op->Asl.ExternalName)
{
/* No resource tag. Descriptor is fixed and is also illegal */
 
AslError (ASL_ERROR, ASL_MSG_NULL_DESCRIPTOR, Op, NULL);
}
 
return;
}
 
/* Basic checks on Min/Max/Length */
 
if (Minimum > Maximum)
/drivers/devman/acpica/compiler/aslrestype1.c
9,7 → 9,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
224,7 → 224,6
ACPI_PARSE_OBJECT *MinOp = NULL;
ACPI_PARSE_OBJECT *MaxOp = NULL;
ACPI_PARSE_OBJECT *LengthOp = NULL;
ACPI_PARSE_OBJECT *AlignOp = NULL;
ASL_RESOURCE_NODE *Rnode;
UINT32 i;
 
270,7 → 269,6
Descriptor->Memory24.Alignment = (UINT16) InitializerOp->Asl.Value.Integer;
RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Alignment));
AlignOp = InitializerOp;
break;
 
case 4: /* Length */
302,7 → 300,7
Descriptor->Memory24.Maximum,
Descriptor->Memory24.AddressLength,
Descriptor->Memory24.Alignment,
MinOp, MaxOp, LengthOp, NULL);
MinOp, MaxOp, LengthOp, NULL, Op);
 
return (Rnode);
}
410,7 → 408,7
Descriptor->Memory32.Maximum,
Descriptor->Memory32.AddressLength,
Descriptor->Memory32.Alignment,
MinOp, MaxOp, LengthOp, AlignOp);
MinOp, MaxOp, LengthOp, AlignOp, Op);
 
return (Rnode);
}
/drivers/devman/acpica/compiler/aslrestype1i.c
9,7 → 9,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
439,7 → 439,7
Descriptor->Io.Maximum,
Descriptor->Io.AddressLength,
Descriptor->Io.Alignment,
MinOp, MaxOp, LengthOp, AlignOp);
MinOp, MaxOp, LengthOp, AlignOp, Op);
 
return (Rnode);
}
/drivers/devman/acpica/compiler/aslrestype2.c
9,7 → 9,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
/drivers/devman/acpica/compiler/aslrestype2d.c
9,7 → 9,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
347,12 → 347,12
/* Validate the Min/Max/Len/Gran values */
 
RsLargeAddressCheck (
Descriptor->Address32.Minimum,
Descriptor->Address32.Maximum,
Descriptor->Address32.AddressLength,
Descriptor->Address32.Granularity,
(UINT64) Descriptor->Address32.Minimum,
(UINT64) Descriptor->Address32.Maximum,
(UINT64) Descriptor->Address32.AddressLength,
(UINT64) Descriptor->Address32.Granularity,
Descriptor->Address32.Flags,
MinOp, MaxOp, LengthOp, GranOp);
MinOp, MaxOp, LengthOp, GranOp, Op);
 
Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
OptionIndex + StringLength;
583,12 → 583,12
/* Validate the Min/Max/Len/Gran values */
 
RsLargeAddressCheck (
Descriptor->Address32.Minimum,
Descriptor->Address32.Maximum,
Descriptor->Address32.AddressLength,
Descriptor->Address32.Granularity,
(UINT64) Descriptor->Address32.Minimum,
(UINT64) Descriptor->Address32.Maximum,
(UINT64) Descriptor->Address32.AddressLength,
(UINT64) Descriptor->Address32.Granularity,
Descriptor->Address32.Flags,
MinOp, MaxOp, LengthOp, GranOp);
MinOp, MaxOp, LengthOp, GranOp, Op);
 
Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
OptionIndex + StringLength;
801,12 → 801,12
/* Validate the Min/Max/Len/Gran values */
 
RsLargeAddressCheck (
Descriptor->Address32.Minimum,
Descriptor->Address32.Maximum,
Descriptor->Address32.AddressLength,
Descriptor->Address32.Granularity,
(UINT64) Descriptor->Address32.Minimum,
(UINT64) Descriptor->Address32.Maximum,
(UINT64) Descriptor->Address32.AddressLength,
(UINT64) Descriptor->Address32.Granularity,
Descriptor->Address32.Flags,
MinOp, MaxOp, LengthOp, GranOp);
MinOp, MaxOp, LengthOp, GranOp, Op);
 
Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
OptionIndex + StringLength;
/drivers/devman/acpica/compiler/aslrestype2e.c
9,7 → 9,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
116,7 → 116,6
 
 
#include "aslcompiler.h"
#include "aslcompiler.y.h"
 
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslrestype2e")
295,7 → 294,7
Descriptor->ExtAddress64.AddressLength,
Descriptor->ExtAddress64.Granularity,
Descriptor->ExtAddress64.Flags,
MinOp, MaxOp, LengthOp, GranOp);
MinOp, MaxOp, LengthOp, GranOp, Op);
 
Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength;
return (Rnode);
476,7 → 475,7
Descriptor->ExtAddress64.AddressLength,
Descriptor->ExtAddress64.Granularity,
Descriptor->ExtAddress64.Flags,
MinOp, MaxOp, LengthOp, GranOp);
MinOp, MaxOp, LengthOp, GranOp, Op);
 
Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength;
return (Rnode);
639,7 → 638,7
Descriptor->ExtAddress64.AddressLength,
Descriptor->ExtAddress64.Granularity,
Descriptor->ExtAddress64.Flags,
MinOp, MaxOp, LengthOp, GranOp);
MinOp, MaxOp, LengthOp, GranOp, Op);
 
Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength;
return (Rnode);
/drivers/devman/acpica/compiler/aslrestype2q.c
9,7 → 9,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
343,7 → 343,7
Descriptor->Address64.AddressLength,
Descriptor->Address64.Granularity,
Descriptor->Address64.Flags,
MinOp, MaxOp, LengthOp, GranOp);
MinOp, MaxOp, LengthOp, GranOp, Op);
 
Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
OptionIndex + StringLength;
573,7 → 573,7
Descriptor->Address64.AddressLength,
Descriptor->Address64.Granularity,
Descriptor->Address64.Flags,
MinOp, MaxOp, LengthOp, GranOp);
MinOp, MaxOp, LengthOp, GranOp, Op);
 
Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
OptionIndex + StringLength;
785,7 → 785,7
Descriptor->Address64.AddressLength,
Descriptor->Address64.Granularity,
Descriptor->Address64.Flags,
MinOp, MaxOp, LengthOp, GranOp);
MinOp, MaxOp, LengthOp, GranOp, Op);
 
Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
OptionIndex + StringLength;
/drivers/devman/acpica/compiler/aslrestype2w.c
9,7 → 9,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
338,12 → 338,12
/* Validate the Min/Max/Len/Gran values */
 
RsLargeAddressCheck (
Descriptor->Address16.Minimum,
Descriptor->Address16.Maximum,
Descriptor->Address16.AddressLength,
Descriptor->Address16.Granularity,
(UINT64) Descriptor->Address16.Minimum,
(UINT64) Descriptor->Address16.Maximum,
(UINT64) Descriptor->Address16.AddressLength,
(UINT64) Descriptor->Address16.Granularity,
Descriptor->Address16.Flags,
MinOp, MaxOp, LengthOp, GranOp);
MinOp, MaxOp, LengthOp, GranOp, Op);
 
Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
OptionIndex + StringLength;
544,12 → 544,12
/* Validate the Min/Max/Len/Gran values */
 
RsLargeAddressCheck (
Descriptor->Address16.Minimum,
Descriptor->Address16.Maximum,
Descriptor->Address16.AddressLength,
Descriptor->Address16.Granularity,
(UINT64) Descriptor->Address16.Minimum,
(UINT64) Descriptor->Address16.Maximum,
(UINT64) Descriptor->Address16.AddressLength,
(UINT64) Descriptor->Address16.Granularity,
Descriptor->Address16.Flags,
MinOp, MaxOp, LengthOp, GranOp);
MinOp, MaxOp, LengthOp, GranOp, Op);
 
Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
OptionIndex + StringLength;
761,12 → 761,12
/* Validate the Min/Max/Len/Gran values */
 
RsLargeAddressCheck (
Descriptor->Address16.Minimum,
Descriptor->Address16.Maximum,
Descriptor->Address16.AddressLength,
Descriptor->Address16.Granularity,
(UINT64) Descriptor->Address16.Minimum,
(UINT64) Descriptor->Address16.Maximum,
(UINT64) Descriptor->Address16.AddressLength,
(UINT64) Descriptor->Address16.Granularity,
Descriptor->Address16.Flags,
MinOp, MaxOp, LengthOp, GranOp);
MinOp, MaxOp, LengthOp, GranOp, Op);
 
Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
OptionIndex + StringLength;
/drivers/devman/acpica/compiler/aslstartup.c
9,7 → 9,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
124,23 → 124,18
 
 
#define ASL_MAX_FILES 256
char *FileList[ASL_MAX_FILES];
int FileCount;
BOOLEAN AslToFile = TRUE;
static char *FileList[ASL_MAX_FILES];
static BOOLEAN AslToFile = TRUE;
 
 
/* Local prototypes */
 
static void
AslInitializeGlobals (
void);
 
static char **
AsDoWildcard (
char *DirectoryPathname,
char *FileSpecifier);
 
UINT8
static UINT8
AslDetectSourceFileType (
ASL_FILE_INFO *Info);
 
158,7 → 153,7
*
******************************************************************************/
 
static void
void
AslInitializeGlobals (
void)
{
187,6 → 182,9
 
Gbl_Files[ASL_FILE_AML_OUTPUT].Filename = NULL;
Gbl_Files[ASL_FILE_AML_OUTPUT].Handle = NULL;
 
Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename = NULL;
Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle = NULL;
}
 
 
211,6 → 209,7
#ifdef WIN32
void *DirInfo;
char *Filename;
int FileCount;
 
 
FileCount = 0;
278,7 → 277,7
*
******************************************************************************/
 
UINT8
static UINT8
AslDetectSourceFileType (
ASL_FILE_INFO *Info)
{
398,7 → 397,7
/* Shutdown compiler and ACPICA subsystem */
 
AeClearErrorLog ();
AcpiTerminate ();
(void) AcpiTerminate ();
 
/*
* Gbl_Files[ASL_FILE_INPUT].Filename was replaced with the
464,17 → 463,6
*/
case ASL_INPUT_TYPE_ASCII_DATA:
 
/*
* Require use of command-line option to enable the data table
* compiler -- for now, until development of the compiler is
* complete.
*/
if (!Gbl_DataTableCompilerAvailable)
{
printf ("Data Table Compiler is not available yet\n");
return (AE_SUPPORT);
}
 
Status = DtDoCompile ();
 
if (Gbl_Signature)
490,7 → 478,6
*/
case ASL_INPUT_TYPE_ASCII_ASL:
 
 
/* ACPICA subsystem initialization */
 
Status = AdInitialize ();
500,7 → 487,7
}
 
Status = CmDoCompile ();
AcpiTerminate ();
(void) AcpiTerminate ();
 
/*
* Return non-zero exit code if there have been errors, unless the
542,10 → 529,11
 
ACPI_STATUS
AslDoOnePathname (
char *Pathname)
char *Pathname,
ASL_PATHNAME_CALLBACK PathCallback)
{
ACPI_STATUS Status = AE_OK;
char **FileList;
char **WildcardList;
char *Filename;
char *FullPathname;
 
560,16 → 548,16
 
/* Expand possible wildcard into a file list (Windows/DOS only) */
 
FileList = AsDoWildcard (Gbl_DirectoryPath, Filename);
while (*FileList)
WildcardList = AsDoWildcard (Gbl_DirectoryPath, Filename);
while (*WildcardList)
{
FullPathname = ACPI_ALLOCATE (
strlen (Gbl_DirectoryPath) + strlen (*FileList) + 1);
strlen (Gbl_DirectoryPath) + strlen (*WildcardList) + 1);
 
/* Construct a full path to the file */
 
strcpy (FullPathname, Gbl_DirectoryPath);
strcat (FullPathname, *FileList);
strcat (FullPathname, *WildcardList);
 
/*
* If -p not specified, we will use the input filename as the
582,12 → 570,12
 
/* Save status from all compiles */
 
Status |= AslDoOneFile (FullPathname);
Status |= (*PathCallback) (FullPathname);
 
ACPI_FREE (FullPathname);
ACPI_FREE (*FileList);
*FileList = NULL;
FileList++;
ACPI_FREE (*WildcardList);
*WildcardList = NULL;
WildcardList++;
}
 
ACPI_FREE (Gbl_DirectoryPath);
/drivers/devman/acpica/compiler/aslstubs.c
9,7 → 9,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
304,3 → 304,20
return (AE_SUPPORT);
}
 
/* OSL interfaces */
 
ACPI_THREAD_ID
AcpiOsGetThreadId (
void)
{
return (0xFFFF);
}
 
ACPI_STATUS
AcpiOsExecute (
ACPI_EXECUTE_TYPE Type,
ACPI_OSD_EXEC_CALLBACK Function,
void *Context)
{
return (AE_SUPPORT);
}
/drivers/devman/acpica/compiler/asltransform.c
9,7 → 9,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
/drivers/devman/acpica/compiler/asltree.c
9,7 → 9,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
117,6 → 117,7
 
#include "aslcompiler.h"
#include "aslcompiler.y.h"
#include <time.h>
 
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("asltree")
475,6 → 476,75
 
/*******************************************************************************
*
* FUNCTION: TrCreateConstantLeafNode
*
* PARAMETERS: ParseOpcode - The constant opcode
*
* RETURN: Pointer to the new node. Aborts on allocation failure
*
* DESCRIPTION: Create a leaf node (no children or peers) for one of the
* special constants - __LINE__, __FILE__, and __DATE__.
*
* Note: An implemenation of __FUNC__ cannot happen here because we don't
* have a full parse tree at this time and cannot find the parent control
* method. If it is ever needed, __FUNC__ must be implemented later, after
* the parse tree has been fully constructed.
*
******************************************************************************/
 
ACPI_PARSE_OBJECT *
TrCreateConstantLeafNode (
UINT32 ParseOpcode)
{
ACPI_PARSE_OBJECT *Op = NULL;
time_t CurrentTime;
char *StaticTimeString;
char *TimeString;
 
 
switch (ParseOpcode)
{
case PARSEOP___LINE__:
Op = TrAllocateNode (PARSEOP_INTEGER);
Op->Asl.Value.Integer = Op->Asl.LineNumber;
break;
 
case PARSEOP___FILE__:
Op = TrAllocateNode (PARSEOP_STRING_LITERAL);
 
/* Op.Asl.Filename contains the full pathname to the file */
 
Op->Asl.Value.String = Op->Asl.Filename;
break;
 
case PARSEOP___DATE__:
Op = TrAllocateNode (PARSEOP_STRING_LITERAL);
 
/* Get a copy of the current time */
 
CurrentTime = time (NULL);
StaticTimeString = ctime (&CurrentTime);
TimeString = UtLocalCalloc (strlen (StaticTimeString) + 1);
strcpy (TimeString, StaticTimeString);
 
TimeString[strlen(TimeString) -1] = 0; /* Remove trailing newline */
Op->Asl.Value.String = TimeString;
break;
 
default: /* This would be an internal error */
return (NULL);
}
 
DbgPrint (ASL_PARSE_OUTPUT,
"\nCreateConstantLeafNode Ln/Col %u/%u NewNode %p Op %s Value %8.8X%8.8X ",
Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName (ParseOpcode),
ACPI_FORMAT_UINT64 (Op->Asl.Value.Integer));
return (Op);
}
 
 
/*******************************************************************************
*
* FUNCTION: TrCreateValuedLeafNode
*
* PARAMETERS: ParseOpcode - New opcode to be assigned to the node
/drivers/devman/acpica/compiler/asltypes.h
9,7 → 9,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
148,6 → 148,7
#define NODE_COMPILER_EMITTED 0x00020000
#define NODE_IS_DUPLICATE 0x00040000
#define NODE_IS_RESOURCE_DATA 0x00080000
#define NODE_IS_NULL_RETURN 0x00100000
 
/* Keeps information about individual control methods */
 
302,307 → 303,4
} ASL_EVENT_INFO;
 
 
#define ASL_WARNING 0
#define ASL_WARNING2 1
#define ASL_WARNING3 2
#define ASL_ERROR 3
#define ASL_REMARK 4
#define ASL_OPTIMIZATION 5
#define ASL_NUM_REPORT_LEVELS 6
 
 
typedef enum
{
ASL_MSG_RESERVED = 0,
ASL_MSG_ALPHANUMERIC_STRING,
ASL_MSG_AML_NOT_IMPLEMENTED,
ASL_MSG_ARG_COUNT_HI,
ASL_MSG_ARG_COUNT_LO,
ASL_MSG_ARG_INIT,
ASL_MSG_BACKWARDS_OFFSET,
ASL_MSG_BITS_TO_BYTES,
ASL_MSG_BUFFER_LENGTH,
ASL_MSG_BYTES_TO_BITS,
ASL_MSG_CLOSE,
ASL_MSG_COMPILER_INTERNAL,
ASL_MSG_CONSTANT_EVALUATION,
ASL_MSG_CONSTANT_FOLDED,
ASL_MSG_CORE_EXCEPTION,
ASL_MSG_DEBUG_FILE_OPEN,
ASL_MSG_DEBUG_FILENAME,
ASL_MSG_DEPENDENT_NESTING,
ASL_MSG_DMA_CHANNEL,
ASL_MSG_DMA_LIST,
ASL_MSG_DUPLICATE_CASE,
ASL_MSG_DUPLICATE_ITEM,
ASL_MSG_EARLY_EOF,
ASL_MSG_ENCODING_LENGTH,
ASL_MSG_EX_INTERRUPT_LIST,
ASL_MSG_EX_INTERRUPT_LIST_MIN,
ASL_MSG_EX_INTERRUPT_NUMBER,
ASL_MSG_FIELD_ACCESS_WIDTH,
ASL_MSG_FIELD_UNIT_ACCESS_WIDTH,
ASL_MSG_FIELD_UNIT_OFFSET,
ASL_MSG_INCLUDE_FILE_OPEN,
ASL_MSG_INPUT_FILE_OPEN,
ASL_MSG_INTEGER_LENGTH,
ASL_MSG_INTEGER_OPTIMIZATION,
ASL_MSG_INTERRUPT_LIST,
ASL_MSG_INTERRUPT_NUMBER,
ASL_MSG_INVALID_CONSTANT_OP,
ASL_MSG_INVALID_EISAID,
ASL_MSG_INVALID_ESCAPE,
ASL_MSG_INVALID_OPERAND,
ASL_MSG_INVALID_PERFORMANCE,
ASL_MSG_INVALID_PRIORITY,
ASL_MSG_INVALID_STRING,
ASL_MSG_INVALID_TARGET,
ASL_MSG_INVALID_TIME,
ASL_MSG_INVALID_TYPE,
ASL_MSG_INVALID_UUID,
ASL_MSG_LIST_LENGTH_LONG,
ASL_MSG_LIST_LENGTH_SHORT,
ASL_MSG_LISTING_FILE_OPEN,
ASL_MSG_LISTING_FILENAME,
ASL_MSG_LOCAL_INIT,
ASL_MSG_LONG_LINE,
ASL_MSG_MEMORY_ALLOCATION,
ASL_MSG_MISSING_ENDDEPENDENT,
ASL_MSG_MISSING_STARTDEPENDENT,
ASL_MSG_MULTIPLE_TYPES,
ASL_MSG_NAME_EXISTS,
ASL_MSG_NAME_OPTIMIZATION,
ASL_MSG_NESTED_COMMENT,
ASL_MSG_NO_CASES,
ASL_MSG_NO_RETVAL,
ASL_MSG_NO_WHILE,
ASL_MSG_NON_ASCII,
ASL_MSG_NOT_EXIST,
ASL_MSG_NOT_FOUND,
ASL_MSG_NOT_METHOD,
ASL_MSG_NOT_PARAMETER,
ASL_MSG_NOT_REACHABLE,
ASL_MSG_OPEN,
ASL_MSG_OUTPUT_FILE_OPEN,
ASL_MSG_OUTPUT_FILENAME,
ASL_MSG_PACKAGE_LENGTH,
ASL_MSG_READ,
ASL_MSG_RECURSION,
ASL_MSG_REGION_BUFFER_ACCESS,
ASL_MSG_REGION_BYTE_ACCESS,
ASL_MSG_RESERVED_ARG_COUNT_HI,
ASL_MSG_RESERVED_ARG_COUNT_LO,
ASL_MSG_RESERVED_METHOD,
ASL_MSG_RESERVED_OPERAND_TYPE,
ASL_MSG_RESERVED_RETURN_VALUE,
ASL_MSG_RESERVED_USE,
ASL_MSG_RESERVED_WORD,
ASL_MSG_RESOURCE_FIELD,
ASL_MSG_RESOURCE_INDEX,
ASL_MSG_RESOURCE_LIST,
ASL_MSG_RESOURCE_SOURCE,
ASL_MSG_RETURN_TYPES,
ASL_MSG_SCOPE_FWD_REF,
ASL_MSG_SCOPE_TYPE,
ASL_MSG_SEEK,
ASL_MSG_SINGLE_NAME_OPTIMIZATION,
ASL_MSG_SOME_NO_RETVAL,
ASL_MSG_SWITCH_TYPE,
ASL_MSG_SYNC_LEVEL,
ASL_MSG_SYNTAX,
ASL_MSG_TABLE_SIGNATURE,
ASL_MSG_TOO_MANY_TEMPS,
ASL_MSG_UNKNOWN_RESERVED_NAME,
ASL_MSG_UNREACHABLE_CODE,
ASL_MSG_UNSUPPORTED,
ASL_MSG_VENDOR_LIST,
ASL_MSG_WRITE,
ASL_MSG_MULTIPLE_DEFAULT,
ASL_MSG_TIMEOUT,
ASL_MSG_RESULT_NOT_USED,
ASL_MSG_NOT_REFERENCED,
ASL_MSG_NON_ZERO,
ASL_MSG_STRING_LENGTH,
ASL_MSG_SERIALIZED,
ASL_MSG_COMPILER_RESERVED,
ASL_MSG_NAMED_OBJECT_IN_WHILE,
ASL_MSG_LOCAL_OUTSIDE_METHOD,
ASL_MSG_ALIGNMENT,
ASL_MSG_ISA_ADDRESS,
ASL_MSG_INVALID_MIN_MAX,
ASL_MSG_INVALID_LENGTH,
ASL_MSG_INVALID_LENGTH_FIXED,
ASL_MSG_INVALID_GRANULARITY,
ASL_MSG_INVALID_GRAN_FIXED,
ASL_MSG_INVALID_ACCESS_SIZE,
ASL_MSG_INVALID_ADDR_FLAGS,
ASL_MSG_INVALID_FIELD_NAME,
ASL_MSG_INTEGER_SIZE,
ASL_MSG_INVALID_HEX_INTEGER,
ASL_MSG_BUFFER_ELEMENT,
ASL_MSG_RESERVED_VALUE,
ASL_MSG_FLAG_VALUE,
ASL_MSG_ZERO_VALUE,
ASL_MSG_UNKNOWN_TABLE,
ASL_MSG_UNKNOWN_SUBTABLE,
ASL_MSG_OEM_TABLE
 
} ASL_MESSAGE_IDS;
 
#ifdef ASL_EXCEPTIONS
 
char *AslMessages [] = {
/* The zeroth message is reserved */ "",
/* ASL_MSG_ALPHANUMERIC_STRING */ "String must be entirely alphanumeric",
/* ASL_MSG_AML_NOT_IMPLEMENTED */ "Opcode is not implemented in compiler AML code generator",
/* ASL_MSG_ARG_COUNT_HI */ "Too many arguments",
/* ASL_MSG_ARG_COUNT_LO */ "Too few arguments",
/* ASL_MSG_ARG_INIT */ "Method argument is not initialized",
/* ASL_MSG_BACKWARDS_OFFSET */ "Invalid backwards offset",
/* ASL_MSG_BITS_TO_BYTES */ "Field offset is in bits, but a byte offset is required",
/* ASL_MSG_BUFFER_LENGTH */ "Effective AML buffer length is zero",
/* ASL_MSG_BYTES_TO_BITS */ "Field offset is in bytes, but a bit offset is required",
/* ASL_MSG_CLOSE */ "Could not close file",
/* ASL_MSG_COMPILER_INTERNAL */ "Internal compiler error",
/* ASL_MSG_CONSTANT_EVALUATION */ "Could not evaluate constant expression",
/* ASL_MSG_CONSTANT_FOLDED */ "Constant expression evaluated and reduced",
/* ASL_MSG_CORE_EXCEPTION */ "From ACPI CA Subsystem",
/* ASL_MSG_DEBUG_FILE_OPEN */ "Could not open debug file",
/* ASL_MSG_DEBUG_FILENAME */ "Could not create debug filename",
/* ASL_MSG_DEPENDENT_NESTING */ "Dependent function macros cannot be nested",\
/* ASL_MSG_DMA_CHANNEL */ "Invalid DMA channel (must be 0-7)",
/* ASL_MSG_DMA_LIST */ "Too many DMA channels (8 max)",
/* ASL_MSG_DUPLICATE_CASE */ "Case value already specified",
/* ASL_MSG_DUPLICATE_ITEM */ "Duplicate value in list",
/* ASL_MSG_EARLY_EOF */ "Premature end-of-file reached",
/* ASL_MSG_ENCODING_LENGTH */ "Package length too long to encode",
/* ASL_MSG_EX_INTERRUPT_LIST */ "Too many interrupts (255 max)",
/* ASL_MSG_EX_INTERRUPT_LIST_MIN */ "Too few interrupts (1 minimum required)",
/* ASL_MSG_EX_INTERRUPT_NUMBER */ "Invalid interrupt number (must be 32 bits)",
/* ASL_MSG_FIELD_ACCESS_WIDTH */ "Access width is greater than region size",
/* ASL_MSG_FIELD_UNIT_ACCESS_WIDTH */ "Access width of Field Unit extends beyond region limit",
/* ASL_MSG_FIELD_UNIT_OFFSET */ "Field Unit extends beyond region limit",
/* ASL_MSG_INCLUDE_FILE_OPEN */ "Could not open include file",
/* ASL_MSG_INPUT_FILE_OPEN */ "Could not open input file",
/* ASL_MSG_INTEGER_LENGTH */ "64-bit integer in 32-bit table, truncating",
/* ASL_MSG_INTEGER_OPTIMIZATION */ "Integer optimized to single-byte AML opcode",
/* ASL_MSG_INTERRUPT_LIST */ "Too many interrupts (16 max)",
/* ASL_MSG_INTERRUPT_NUMBER */ "Invalid interrupt number (must be 0-15)",
/* ASL_MSG_INVALID_CONSTANT_OP */ "Invalid operator in constant expression (not type 3/4/5)",
/* ASL_MSG_INVALID_EISAID */ "EISAID string must be of the form \"UUUXXXX\" (3 uppercase, 4 hex digits)",
/* ASL_MSG_INVALID_ESCAPE */ "Invalid or unknown escape sequence",
/* ASL_MSG_INVALID_OPERAND */ "Invalid operand",
/* ASL_MSG_INVALID_PERFORMANCE */ "Invalid performance/robustness value",
/* ASL_MSG_INVALID_PRIORITY */ "Invalid priority value",
/* ASL_MSG_INVALID_STRING */ "Invalid Hex/Octal Escape - Non-ASCII or NULL",
/* ASL_MSG_INVALID_TARGET */ "Target operand not allowed in constant expression",
/* ASL_MSG_INVALID_TIME */ "Time parameter too long (255 max)",
/* ASL_MSG_INVALID_TYPE */ "Invalid type",
/* ASL_MSG_INVALID_UUID */ "UUID string must be of the form \"aabbccdd-eeff-gghh-iijj-kkllmmnnoopp\"",
/* ASL_MSG_LIST_LENGTH_LONG */ "Initializer list longer than declared package length",
/* ASL_MSG_LIST_LENGTH_SHORT */ "Initializer list shorter than declared package length",
/* ASL_MSG_LISTING_FILE_OPEN */ "Could not open listing file",
/* ASL_MSG_LISTING_FILENAME */ "Could not create listing filename",
/* ASL_MSG_LOCAL_INIT */ "Method local variable is not initialized",
/* ASL_MSG_LONG_LINE */ "Splitting long input line",
/* ASL_MSG_MEMORY_ALLOCATION */ "Memory allocation failure",
/* ASL_MSG_MISSING_ENDDEPENDENT */ "Missing EndDependentFn() macro in dependent resource list",
/* ASL_MSG_MISSING_STARTDEPENDENT */ "Missing StartDependentFn() macro in dependent resource list",
/* ASL_MSG_MULTIPLE_TYPES */ "Multiple types",
/* ASL_MSG_NAME_EXISTS */ "Name already exists in scope",
/* ASL_MSG_NAME_OPTIMIZATION */ "NamePath optimized",
/* ASL_MSG_NESTED_COMMENT */ "Nested comment found",
/* ASL_MSG_NO_CASES */ "No Case statements under Switch",
/* ASL_MSG_NO_RETVAL */ "Called method returns no value",
/* ASL_MSG_NO_WHILE */ "No enclosing While statement",
/* ASL_MSG_NON_ASCII */ "Invalid characters found in file",
/* ASL_MSG_NOT_EXIST */ "Object does not exist",
/* ASL_MSG_NOT_FOUND */ "Object not found or not accessible from scope",
/* ASL_MSG_NOT_METHOD */ "Not a control method, cannot invoke",
/* ASL_MSG_NOT_PARAMETER */ "Not a parameter, used as local only",
/* ASL_MSG_NOT_REACHABLE */ "Object is not accessible from this scope",
/* ASL_MSG_OPEN */ "Could not open file",
/* ASL_MSG_OUTPUT_FILE_OPEN */ "Could not open output AML file",
/* ASL_MSG_OUTPUT_FILENAME */ "Could not create output filename",
/* ASL_MSG_PACKAGE_LENGTH */ "Effective AML package length is zero",
/* ASL_MSG_READ */ "Could not read file",
/* ASL_MSG_RECURSION */ "Recursive method call",
/* ASL_MSG_REGION_BUFFER_ACCESS */ "Host Operation Region requires BufferAcc access",
/* ASL_MSG_REGION_BYTE_ACCESS */ "Host Operation Region requires ByteAcc access",
/* ASL_MSG_RESERVED_ARG_COUNT_HI */ "Reserved method has too many arguments",
/* ASL_MSG_RESERVED_ARG_COUNT_LO */ "Reserved method has too few arguments",
/* ASL_MSG_RESERVED_METHOD */ "Reserved name must be a control method",
/* ASL_MSG_RESERVED_OPERAND_TYPE */ "Invalid object type for reserved name",
/* ASL_MSG_RESERVED_RETURN_VALUE */ "Reserved method must return a value",
/* ASL_MSG_RESERVED_USE */ "Invalid use of reserved name",
/* ASL_MSG_RESERVED_WORD */ "Use of reserved name",
/* ASL_MSG_RESOURCE_FIELD */ "Resource field name cannot be used as a target",
/* ASL_MSG_RESOURCE_INDEX */ "Missing ResourceSourceIndex (required)",
/* ASL_MSG_RESOURCE_LIST */ "Too many resource items (internal error)",
/* ASL_MSG_RESOURCE_SOURCE */ "Missing ResourceSource string (required)",
/* ASL_MSG_RETURN_TYPES */ "Not all control paths return a value",
/* ASL_MSG_SCOPE_FWD_REF */ "Forward references from Scope operator not allowed",
/* ASL_MSG_SCOPE_TYPE */ "Existing object has invalid type for Scope operator",
/* ASL_MSG_SEEK */ "Could not seek file",
/* ASL_MSG_SINGLE_NAME_OPTIMIZATION */ "NamePath optimized to NameSeg (uses run-time search path)",
/* ASL_MSG_SOME_NO_RETVAL */ "Called method may not always return a value",
/* ASL_MSG_SWITCH_TYPE */ "Switch expression is not a static Integer/Buffer/String data type, defaulting to Integer",
/* ASL_MSG_SYNC_LEVEL */ "SyncLevel must be in the range 0-15",
/* ASL_MSG_SYNTAX */ "",
/* ASL_MSG_TABLE_SIGNATURE */ "Invalid Table Signature",
/* ASL_MSG_TOO_MANY_TEMPS */ "Method requires too many temporary variables (_T_x)",
/* ASL_MSG_UNKNOWN_RESERVED_NAME */ "Unknown reserved name",
/* ASL_MSG_UNREACHABLE_CODE */ "Statement is unreachable",
/* ASL_MSG_UNSUPPORTED */ "Unsupported feature",
/* ASL_MSG_VENDOR_LIST */ "Too many vendor data bytes (7 max)",
/* ASL_MSG_WRITE */ "Could not write file",
/* ASL_MSG_MULTIPLE_DEFAULT */ "More than one Default statement within Switch construct",
/* ASL_MSG_TIMEOUT */ "Possible operator timeout is ignored",
/* ASL_MSG_RESULT_NOT_USED */ "Result is not used, operator has no effect",
/* ASL_MSG_NOT_REFERENCED */ "Namespace object is not referenced",
/* ASL_MSG_NON_ZERO */ "Operand evaluates to zero",
/* ASL_MSG_STRING_LENGTH */ "String literal too long",
/* ASL_MSG_SERIALIZED */ "Control Method marked Serialized",
/* ASL_MSG_COMPILER_RESERVED */ "Use of compiler reserved name",
/* ASL_MSG_NAMED_OBJECT_IN_WHILE */ "Creating a named object in a While loop",
/* ASL_MSG_LOCAL_OUTSIDE_METHOD */ "Local or Arg used outside a control method",
/* ASL_MSG_ALIGNMENT */ "Must be a multiple of alignment/granularity value",
/* ASL_MSG_ISA_ADDRESS */ "Maximum 10-bit ISA address (0x3FF)",
/* ASL_MSG_INVALID_MIN_MAX */ "Address Min is greater than Address Max",
/* ASL_MSG_INVALID_LENGTH */ "Length is larger than Min/Max window",
/* ASL_MSG_INVALID_LENGTH_FIXED */ "Length is not equal to fixed Min/Max window",
/* ASL_MSG_INVALID_GRANULARITY */ "Granularity must be zero or a power of two minus one",
/* ASL_MSG_INVALID_GRAN_FIXED */ "Granularity must be zero for fixed Min/Max",
/* ASL_MSG_INVALID_ACCESS_SIZE */ "Invalid AccessSize (Maximum is 4 - QWord access)",
/* ASL_MSG_INVALID_ADDR_FLAGS */ "Invalid combination of Length and Min/Max fixed flags",
 
/* These messages are used by the data table compiler only */
 
/* ASL_MSG_INVALID_FIELD_NAME */ "Invalid Field Name",
/* ASL_MSG_INTEGER_SIZE */ "Integer too large for target",
/* ASL_MSG_INVALID_HEX_INTEGER */ "Invalid hex integer constant",
/* ASL_MSG_BUFFER_ELEMENT */ "Invalid element in buffer initializer list",
/* ASL_MSG_RESERVED_VALUE */ "Reserved field must be zero",
/* ASL_MSG_FLAG_VALUE */ "Flag value is too large",
/* ASL_MSG_ZERO_VALUE */ "Value must be non-zero",
/* ASL_MSG_UNKNOWN_TABLE */ "Unknown ACPI table signature",
/* ASL_MSG_UNKNOWN_SUBTABLE */ "Unknown subtable type",
/* ASL_MSG_OEM_TABLE */ "OEM table - unknown contents"
 
};
 
 
char *AslErrorLevel [ASL_NUM_REPORT_LEVELS] = {
"Warning ",
"Warning ",
"Warning ",
"Error ",
"Remark ",
"Optimize"
};
 
#define ASL_ERROR_LEVEL_LENGTH 8 /* Length of strings above */
 
#endif /* ASL_EXCEPTIONS */
 
#endif /* __ASLTYPES_H */
/drivers/devman/acpica/compiler/aslutils.c
9,7 → 9,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
117,20 → 117,15
 
#include "aslcompiler.h"
#include "aslcompiler.y.h"
#include "acdisasm.h"
#include "acnamesp.h"
#include "amlcode.h"
#include <acapps.h>
 
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslutils")
 
#ifdef _USE_BERKELEY_YACC
extern const char * const AslCompilername[];
static const char * const *yytname = &AslCompilername[254];
#else
extern const char * const yytname[];
#endif
 
char HexLookup[] =
char AslHexLookup[] =
{
'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
};
138,12 → 133,6
 
/* Local prototypes */
 
static ACPI_STATUS
UtStrtoul64 (
char *String,
UINT32 Base,
UINT64 *RetInteger);
 
static void
UtPadNameWithUnderscores (
char *NameSeg,
157,6 → 146,50
 
/*******************************************************************************
*
* FUNCTION: UtDisplaySupportedTables
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Print all supported ACPI table names.
*
******************************************************************************/
 
void
UtDisplaySupportedTables (
void)
{
ACPI_DMTABLE_DATA *TableData;
UINT32 i = 6;
 
 
printf ("\nACPI tables supported by iASL subsystems in "
"version %8.8X:\n"
" ASL and Data Table compilers\n"
" AML and Data Table disassemblers\n"
" ACPI table template generator\n\n", ACPI_CA_VERSION);
 
/* Special tables */
 
printf ("%8u) %s %s\n", 1, ACPI_SIG_DSDT, "Differentiated System Description Table");
printf ("%8u) %s %s\n", 2, ACPI_SIG_SSDT, "Secondary System Description Table");
printf ("%8u) %s %s\n", 3, ACPI_SIG_FADT, "Fixed ACPI Description Table (FADT)");
printf ("%8u) %s %s\n", 4, ACPI_SIG_FACS, "Firmware ACPI Control Structure");
printf ("%8u) %s %s\n", 5, ACPI_RSDP_NAME, "Root System Description Pointer");
 
/* All data tables with common table header */
 
for (TableData = AcpiDmTableData; TableData->Signature; TableData++)
{
printf ("%8u) %s %s\n", i, TableData->Signature, TableData->Name);
i++;
}
}
 
 
/*******************************************************************************
*
* FUNCTION: AcpiPsDisplayConstantOpcodes
*
* PARAMETERS: None
340,8 → 373,8
Buffer[0] = '0';
Buffer[1] = 'x';
 
Buffer[2] = (UINT8) HexLookup[(RawByte >> 4) & 0xF];
Buffer[3] = (UINT8) HexLookup[RawByte & 0xF];
Buffer[2] = (UINT8) AslHexLookup[(RawByte >> 4) & 0xF];
Buffer[3] = (UINT8) AslHexLookup[RawByte & 0xF];
}
 
 
366,8 → 399,8
{
 
Buffer[0] = '0';
Buffer[1] = (UINT8) HexLookup[(RawByte >> 4) & 0xF];
Buffer[2] = (UINT8) HexLookup[RawByte & 0xF];
Buffer[1] = (UINT8) AslHexLookup[(RawByte >> 4) & 0xF];
Buffer[2] = (UINT8) AslHexLookup[RawByte & 0xF];
Buffer[3] = 'h';
}
 
476,32 → 509,6
 
/*******************************************************************************
*
* FUNCTION: UtGetOpName
*
* PARAMETERS: ParseOpcode - Parser keyword ID
*
* RETURN: Pointer to the opcode name
*
* DESCRIPTION: Get the ascii name of the parse opcode
*
******************************************************************************/
 
char *
UtGetOpName (
UINT32 ParseOpcode)
{
 
/*
* First entries (ASL_YYTNAME_START) in yytname are special reserved names.
* Ignore first 8 characters of the name
*/
return ((char *) yytname
[(ParseOpcode - ASL_FIRST_PARSE_OPCODE) + ASL_YYTNAME_START] + 8);
}
 
 
/*******************************************************************************
*
* FUNCTION: UtDisplaySummary
*
* PARAMETERS: FileID - ID of outpout file
521,8 → 528,8
{
/* Compiler name and version number */
 
FlPrintFile (FileId, "%s version %X [%s]\n",
CompilerId, (UINT32) ACPI_CA_VERSION, __DATE__);
FlPrintFile (FileId, "%s version %X%s [%s]\n",
ASL_COMPILER_NAME, (UINT32) ACPI_CA_VERSION, ACPI_WIDTH, __DATE__);
}
 
if (Gbl_FileType == ASL_INPUT_TYPE_ASCII_DATA)
910,7 → 917,7
*
******************************************************************************/
 
static ACPI_STATUS
ACPI_STATUS
UtStrtoul64 (
char *String,
UINT32 Base,
/drivers/devman/acpica/compiler/asluuid.c
0,0 → 1,288
/******************************************************************************
*
* Module Name: asluuid-- compiler UUID support
*
*****************************************************************************/
 
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
* rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
* copy of the source code appearing in this file ("Covered Code") an
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
* base code distributed originally by Intel ("Original Intel Code") to copy,
* make derivatives, distribute, use and display any portion of the Covered
* Code in any form, with the right to sublicense such rights; and
*
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
* license (with the right to sublicense), under only those claims of Intel
* patents that are infringed by the Original Intel Code, to make, use, sell,
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
* to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
* documentation and/or other materials provided with distribution. In
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* property embodied in the software Licensee provides to its licensee, and
* not to intellectual property embodied in modifications its licensee may
* make.
*
* 3.3. Redistribution of Executable. Redistribution in executable form of any
* substantial portion of the Covered Code or modification must reproduce the
* above Copyright Notice, and the following Disclaimer and Export Compliance
* provision in the documentation and/or other materials provided with the
* distribution.
*
* 3.4. Intel retains all right, title, and interest in and to the Original
* Intel Code.
*
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
* Intel shall be used in advertising or otherwise to promote the sale, use or
* other dealings in products derived from or relating to the Covered Code
* without prior written authorization from Intel.
*
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
* any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* ensure that the distribution and export/re-export of the software is in
* compliance with all laws, regulations, orders, or other restrictions of the
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
* any of its subsidiaries will export/re-export any technical data, process,
* software, or service, directly or indirectly, to any country for which the
* United States government or any agency thereof requires an export license,
* other governmental approval, or letter of assurance, without first obtaining
* such license, approval or letter.
*
*****************************************************************************/
 
 
#include "aslcompiler.h"
 
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("asluuid")
 
 
/*
* UUID support functions.
*
* This table is used to convert an input UUID ascii string to a 16 byte
* buffer and the reverse. The table maps a UUID buffer index 0-15 to
* the index within the 36-byte UUID string where the associated 2-byte
* hex value can be found.
*
* 36-byte UUID strings are of the form:
* aabbccdd-eeff-gghh-iijj-kkllmmnnoopp
* Where aa-pp are one byte hex numbers, made up of two hex digits
*
* Note: This table is basically the inverse of the string-to-offset table
* found in the ACPI spec in the description of the ToUUID macro.
*/
static UINT8 Gbl_MapToUuidOffset[16] =
{
6,4,2,0,11,9,16,14,19,21,24,26,28,30,32,34
};
 
#define UUID_BUFFER_LENGTH 16
#define UUID_STRING_LENGTH 36
 
/* Positions for required hyphens (dashes) in UUID strings */
 
#define UUID_HYPHEN1_OFFSET 8
#define UUID_HYPHEN2_OFFSET 13
#define UUID_HYPHEN3_OFFSET 18
#define UUID_HYPHEN4_OFFSET 23
 
 
/*******************************************************************************
*
* FUNCTION: AuValiduateUuid
*
* PARAMETERS: InString - 36-byte formatted UUID string
*
* RETURN: Status
*
* DESCRIPTION: Check all 36 characters for correct format
*
******************************************************************************/
 
ACPI_STATUS
AuValidateUuid (
char *InString)
{
UINT32 i;
 
 
if (!InString || (ACPI_STRLEN (InString) != UUID_STRING_LENGTH))
{
return (AE_BAD_PARAMETER);
}
 
/* Check all 36 characters for correct format */
 
for (i = 0; i < UUID_STRING_LENGTH; i++)
{
/* Must have 4 hyphens (dashes) in these positions: */
 
if ((i == UUID_HYPHEN1_OFFSET) ||
(i == UUID_HYPHEN2_OFFSET) ||
(i == UUID_HYPHEN3_OFFSET) ||
(i == UUID_HYPHEN4_OFFSET))
{
if (InString[i] != '-')
{
return (AE_BAD_PARAMETER);
}
}
 
/* All other positions must contain hex digits */
 
else
{
if (!isxdigit ((int) InString[i]))
{
return (AE_BAD_PARAMETER);
}
}
}
 
return (AE_OK);
}
 
 
/*******************************************************************************
*
* FUNCTION: AuConvertStringToUuid
*
* PARAMETERS: InString - 36-byte formatted UUID string
* UuidBuffer - 16-byte UUID buffer
*
* RETURN: Status
*
* DESCRIPTION: Convert 36-byte formatted UUID string to 16-byte UUID buffer
*
******************************************************************************/
 
ACPI_STATUS
AuConvertStringToUuid (
char *InString,
char *UuidBuffer)
{
UINT32 i;
 
 
if (!InString || !UuidBuffer)
{
return (AE_BAD_PARAMETER);
}
 
for (i = 0; i < UUID_BUFFER_LENGTH; i++)
{
UuidBuffer[i] = (char) (UtHexCharToValue (InString[Gbl_MapToUuidOffset[i]]) << 4);
UuidBuffer[i] |= (char) UtHexCharToValue (InString[Gbl_MapToUuidOffset[i] + 1]);
}
 
return (AE_OK);
}
 
 
/*******************************************************************************
*
* FUNCTION: AuConvertUuidToString
*
* PARAMETERS: UuidBuffer - 16-byte UUID buffer
* OutString - 36-byte formatted UUID string
*
* RETURN: Status
*
* DESCRIPTION: Convert 16-byte UUID buffer to 36-byte formatted UUID string
* OutString must be 37 bytes to include null terminator.
*
******************************************************************************/
 
ACPI_STATUS
AuConvertUuidToString (
char *UuidBuffer,
char *OutString)
{
UINT32 i;
 
 
if (!UuidBuffer || !OutString)
{
return (AE_BAD_PARAMETER);
}
 
for (i = 0; i < UUID_BUFFER_LENGTH; i++)
{
OutString[Gbl_MapToUuidOffset[i]] = (UINT8) AslHexLookup[(UuidBuffer[i] >> 4) & 0xF];
OutString[Gbl_MapToUuidOffset[i] + 1] = (UINT8) AslHexLookup[UuidBuffer[i] & 0xF];
}
 
/* Insert required hyphens (dashes) */
 
OutString[UUID_HYPHEN1_OFFSET] =
OutString[UUID_HYPHEN2_OFFSET] =
OutString[UUID_HYPHEN3_OFFSET] =
OutString[UUID_HYPHEN4_OFFSET] = '-';
 
OutString[UUID_STRING_LENGTH] = 0; /* Null terminate */
return (AE_OK);
}
/drivers/devman/acpica/compiler/aslwalks.c
0,0 → 1,1236
/******************************************************************************
*
* Module Name: aslwalks.c - major analytical parse tree walks
*
*****************************************************************************/
 
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
* rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
* copy of the source code appearing in this file ("Covered Code") an
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
* base code distributed originally by Intel ("Original Intel Code") to copy,
* make derivatives, distribute, use and display any portion of the Covered
* Code in any form, with the right to sublicense such rights; and
*
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
* license (with the right to sublicense), under only those claims of Intel
* patents that are infringed by the Original Intel Code, to make, use, sell,
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
* to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
* documentation and/or other materials provided with distribution. In
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* property embodied in the software Licensee provides to its licensee, and
* not to intellectual property embodied in modifications its licensee may
* make.
*
* 3.3. Redistribution of Executable. Redistribution in executable form of any
* substantial portion of the Covered Code or modification must reproduce the
* above Copyright Notice, and the following Disclaimer and Export Compliance
* provision in the documentation and/or other materials provided with the
* distribution.
*
* 3.4. Intel retains all right, title, and interest in and to the Original
* Intel Code.
*
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
* Intel shall be used in advertising or otherwise to promote the sale, use or
* other dealings in products derived from or relating to the Covered Code
* without prior written authorization from Intel.
*
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
* any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* ensure that the distribution and export/re-export of the software is in
* compliance with all laws, regulations, orders, or other restrictions of the
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
* any of its subsidiaries will export/re-export any technical data, process,
* software, or service, directly or indirectly, to any country for which the
* United States government or any agency thereof requires an export license,
* other governmental approval, or letter of assurance, without first obtaining
* such license, approval or letter.
*
*****************************************************************************/
 
 
#include "aslcompiler.h"
#include "aslcompiler.y.h"
#include "acparser.h"
#include "amlcode.h"
 
 
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslwalks")
 
 
/*******************************************************************************
*
* FUNCTION: AnMethodAnalysisWalkBegin
*
* PARAMETERS: ASL_WALK_CALLBACK
*
* RETURN: Status
*
* DESCRIPTION: Descending callback for the analysis walk. Check methods for:
* 1) Initialized local variables
* 2) Valid arguments
* 3) Return types
*
******************************************************************************/
 
ACPI_STATUS
AnMethodAnalysisWalkBegin (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context)
{
ASL_ANALYSIS_WALK_INFO *WalkInfo = (ASL_ANALYSIS_WALK_INFO *) Context;
ASL_METHOD_INFO *MethodInfo = WalkInfo->MethodStack;
ACPI_PARSE_OBJECT *Next;
UINT32 RegisterNumber;
UINT32 i;
char LocalName[] = "Local0";
char ArgName[] = "Arg0";
ACPI_PARSE_OBJECT *ArgNode;
ACPI_PARSE_OBJECT *NextType;
ACPI_PARSE_OBJECT *NextParamType;
UINT8 ActualArgs = 0;
 
 
switch (Op->Asl.ParseOpcode)
{
case PARSEOP_METHOD:
 
TotalMethods++;
 
/* Create and init method info */
 
MethodInfo = UtLocalCalloc (sizeof (ASL_METHOD_INFO));
MethodInfo->Next = WalkInfo->MethodStack;
MethodInfo->Op = Op;
 
WalkInfo->MethodStack = MethodInfo;
 
/* Get the name node, ignored here */
 
Next = Op->Asl.Child;
 
/* Get the NumArguments node */
 
Next = Next->Asl.Next;
MethodInfo->NumArguments = (UINT8)
(((UINT8) Next->Asl.Value.Integer) & 0x07);
 
/* Get the SerializeRule and SyncLevel nodes, ignored here */
 
Next = Next->Asl.Next;
Next = Next->Asl.Next;
ArgNode = Next;
 
/* Get the ReturnType node */
 
Next = Next->Asl.Next;
 
NextType = Next->Asl.Child;
while (NextType)
{
/* Get and map each of the ReturnTypes */
 
MethodInfo->ValidReturnTypes |= AnMapObjTypeToBtype (NextType);
NextType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
NextType = NextType->Asl.Next;
}
 
/* Get the ParameterType node */
 
Next = Next->Asl.Next;
 
NextType = Next->Asl.Child;
while (NextType)
{
if (NextType->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
{
NextParamType = NextType->Asl.Child;
while (NextParamType)
{
MethodInfo->ValidArgTypes[ActualArgs] |= AnMapObjTypeToBtype (NextParamType);
NextParamType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
NextParamType = NextParamType->Asl.Next;
}
}
else
{
MethodInfo->ValidArgTypes[ActualArgs] =
AnMapObjTypeToBtype (NextType);
NextType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
ActualArgs++;
}
 
NextType = NextType->Asl.Next;
}
 
if ((MethodInfo->NumArguments) &&
(MethodInfo->NumArguments != ActualArgs))
{
/* error: Param list did not match number of args */
}
 
/* Allow numarguments == 0 for Function() */
 
if ((!MethodInfo->NumArguments) && (ActualArgs))
{
MethodInfo->NumArguments = ActualArgs;
ArgNode->Asl.Value.Integer |= ActualArgs;
}
 
/*
* Actual arguments are initialized at method entry.
* All other ArgX "registers" can be used as locals, so we
* track their initialization.
*/
for (i = 0; i < MethodInfo->NumArguments; i++)
{
MethodInfo->ArgInitialized[i] = TRUE;
}
break;
 
 
case PARSEOP_METHODCALL:
 
if (MethodInfo &&
(Op->Asl.Node == MethodInfo->Op->Asl.Node))
{
AslError (ASL_REMARK, ASL_MSG_RECURSION, Op, Op->Asl.ExternalName);
}
break;
 
 
case PARSEOP_LOCAL0:
case PARSEOP_LOCAL1:
case PARSEOP_LOCAL2:
case PARSEOP_LOCAL3:
case PARSEOP_LOCAL4:
case PARSEOP_LOCAL5:
case PARSEOP_LOCAL6:
case PARSEOP_LOCAL7:
 
if (!MethodInfo)
{
/*
* Local was used outside a control method, or there was an error
* in the method declaration.
*/
AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD, Op, Op->Asl.ExternalName);
return (AE_ERROR);
}
 
RegisterNumber = (Op->Asl.AmlOpcode & 0x000F);
 
/*
* If the local is being used as a target, mark the local
* initialized
*/
if (Op->Asl.CompileFlags & NODE_IS_TARGET)
{
MethodInfo->LocalInitialized[RegisterNumber] = TRUE;
}
 
/*
* Otherwise, this is a reference, check if the local
* has been previously initialized.
*
* The only operator that accepts an uninitialized value is ObjectType()
*/
else if ((!MethodInfo->LocalInitialized[RegisterNumber]) &&
(Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_OBJECTTYPE))
{
LocalName[strlen (LocalName) -1] = (char) (RegisterNumber + 0x30);
AslError (ASL_ERROR, ASL_MSG_LOCAL_INIT, Op, LocalName);
}
break;
 
 
case PARSEOP_ARG0:
case PARSEOP_ARG1:
case PARSEOP_ARG2:
case PARSEOP_ARG3:
case PARSEOP_ARG4:
case PARSEOP_ARG5:
case PARSEOP_ARG6:
 
if (!MethodInfo)
{
/*
* Arg was used outside a control method, or there was an error
* in the method declaration.
*/
AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD, Op, Op->Asl.ExternalName);
return (AE_ERROR);
}
 
RegisterNumber = (Op->Asl.AmlOpcode & 0x000F) - 8;
ArgName[strlen (ArgName) -1] = (char) (RegisterNumber + 0x30);
 
/*
* If the Arg is being used as a target, mark the local
* initialized
*/
if (Op->Asl.CompileFlags & NODE_IS_TARGET)
{
MethodInfo->ArgInitialized[RegisterNumber] = TRUE;
}
 
/*
* Otherwise, this is a reference, check if the Arg
* has been previously initialized.
*
* The only operator that accepts an uninitialized value is ObjectType()
*/
else if ((!MethodInfo->ArgInitialized[RegisterNumber]) &&
(Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_OBJECTTYPE))
{
AslError (ASL_ERROR, ASL_MSG_ARG_INIT, Op, ArgName);
}
 
/* Flag this arg if it is not a "real" argument to the method */
 
if (RegisterNumber >= MethodInfo->NumArguments)
{
AslError (ASL_REMARK, ASL_MSG_NOT_PARAMETER, Op, ArgName);
}
break;
 
 
case PARSEOP_RETURN:
 
if (!MethodInfo)
{
/*
* Probably was an error in the method declaration,
* no additional error here
*/
ACPI_WARNING ((AE_INFO, "%p, No parent method", Op));
return (AE_ERROR);
}
 
/*
* A child indicates a possible return value. A simple Return or
* Return() is marked with NODE_IS_NULL_RETURN by the parser so
* that it is not counted as a "real" return-with-value, although
* the AML code that is actually emitted is Return(0). The AML
* definition of Return has a required parameter, so we are
* forced to convert a null return to Return(0).
*/
if ((Op->Asl.Child) &&
(Op->Asl.Child->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
(!(Op->Asl.Child->Asl.CompileFlags & NODE_IS_NULL_RETURN)))
{
MethodInfo->NumReturnWithValue++;
}
else
{
MethodInfo->NumReturnNoValue++;
}
break;
 
 
case PARSEOP_BREAK:
case PARSEOP_CONTINUE:
 
Next = Op->Asl.Parent;
while (Next)
{
if (Next->Asl.ParseOpcode == PARSEOP_WHILE)
{
break;
}
Next = Next->Asl.Parent;
}
 
if (!Next)
{
AslError (ASL_ERROR, ASL_MSG_NO_WHILE, Op, NULL);
}
break;
 
 
case PARSEOP_STALL:
 
/* We can range check if the argument is an integer */
 
if ((Op->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER) &&
(Op->Asl.Child->Asl.Value.Integer > ACPI_UINT8_MAX))
{
AslError (ASL_ERROR, ASL_MSG_INVALID_TIME, Op, NULL);
}
break;
 
 
case PARSEOP_DEVICE:
case PARSEOP_EVENT:
case PARSEOP_MUTEX:
case PARSEOP_OPERATIONREGION:
case PARSEOP_POWERRESOURCE:
case PARSEOP_PROCESSOR:
case PARSEOP_THERMALZONE:
 
/*
* The first operand is a name to be created in the namespace.
* Check against the reserved list.
*/
i = ApCheckForPredefinedName (Op, Op->Asl.NameSeg);
if (i < ACPI_VALID_RESERVED_NAME_MAX)
{
AslError (ASL_ERROR, ASL_MSG_RESERVED_USE, Op, Op->Asl.ExternalName);
}
break;
 
 
case PARSEOP_NAME:
 
/* Typecheck any predefined names statically defined with Name() */
 
ApCheckForPredefinedObject (Op, Op->Asl.NameSeg);
 
/* Special typechecking for _HID */
 
if (!ACPI_STRCMP (METHOD_NAME__HID, Op->Asl.NameSeg))
{
Next = Op->Asl.Child->Asl.Next;
AnCheckId (Next, ASL_TYPE_HID);
}
 
/* Special typechecking for _CID */
 
else if (!ACPI_STRCMP (METHOD_NAME__CID, Op->Asl.NameSeg))
{
Next = Op->Asl.Child->Asl.Next;
 
if ((Next->Asl.ParseOpcode == PARSEOP_PACKAGE) ||
(Next->Asl.ParseOpcode == PARSEOP_VAR_PACKAGE))
{
Next = Next->Asl.Child;
while (Next)
{
AnCheckId (Next, ASL_TYPE_CID);
Next = Next->Asl.Next;
}
}
else
{
AnCheckId (Next, ASL_TYPE_CID);
}
}
break;
 
 
default:
break;
}
 
return (AE_OK);
}
 
 
/*******************************************************************************
*
* FUNCTION: AnMethodAnalysisWalkEnd
*
* PARAMETERS: ASL_WALK_CALLBACK
*
* RETURN: Status
*
* DESCRIPTION: Ascending callback for analysis walk. Complete method
* return analysis.
*
******************************************************************************/
 
ACPI_STATUS
AnMethodAnalysisWalkEnd (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context)
{
ASL_ANALYSIS_WALK_INFO *WalkInfo = (ASL_ANALYSIS_WALK_INFO *) Context;
ASL_METHOD_INFO *MethodInfo = WalkInfo->MethodStack;
 
 
switch (Op->Asl.ParseOpcode)
{
case PARSEOP_METHOD:
case PARSEOP_RETURN:
if (!MethodInfo)
{
printf ("No method info for method! [%s]\n", Op->Asl.Namepath);
AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op,
"No method info for this method");
 
CmCleanupAndExit ();
return (AE_AML_INTERNAL);
}
break;
 
default:
break;
}
 
switch (Op->Asl.ParseOpcode)
{
case PARSEOP_METHOD:
 
WalkInfo->MethodStack = MethodInfo->Next;
 
/*
* Check if there is no return statement at the end of the
* method AND we can actually get there -- i.e., the execution
* of the method can possibly terminate without a return statement.
*/
if ((!AnLastStatementIsReturn (Op)) &&
(!(Op->Asl.CompileFlags & NODE_HAS_NO_EXIT)))
{
/*
* No return statement, and execution can possibly exit
* via this path. This is equivalent to Return ()
*/
MethodInfo->NumReturnNoValue++;
}
 
/*
* Check for case where some return statements have a return value
* and some do not. Exit without a return statement is a return with
* no value
*/
if (MethodInfo->NumReturnNoValue &&
MethodInfo->NumReturnWithValue)
{
AslError (ASL_WARNING, ASL_MSG_RETURN_TYPES, Op,
Op->Asl.ExternalName);
}
 
/*
* If there are any RETURN() statements with no value, or there is a
* control path that allows the method to exit without a return value,
* we mark the method as a method that does not return a value. This
* knowledge can be used to check method invocations that expect a
* returned value.
*/
if (MethodInfo->NumReturnNoValue)
{
if (MethodInfo->NumReturnWithValue)
{
Op->Asl.CompileFlags |= NODE_METHOD_SOME_NO_RETVAL;
}
else
{
Op->Asl.CompileFlags |= NODE_METHOD_NO_RETVAL;
}
}
 
/*
* Check predefined method names for correct return behavior
* and correct number of arguments. Also, some special checks
* For GPE and _REG methods.
*/
if (ApCheckForPredefinedMethod (Op, MethodInfo))
{
/* Special check for two names like _L01 and _E01 in same scope */
 
ApCheckForGpeNameConflict (Op);
 
/*
* Special check for _REG: Must have an operation region definition
* within the same scope!
*/
ApCheckRegMethod (Op);
}
 
ACPI_FREE (MethodInfo);
break;
 
 
case PARSEOP_NAME:
 
/* Special check for two names like _L01 and _E01 in same scope */
 
ApCheckForGpeNameConflict (Op);
break;
 
 
case PARSEOP_RETURN:
 
/*
* If the parent is a predefined method name, attempt to typecheck
* the return value. Only static types can be validated.
*/
ApCheckPredefinedReturnValue (Op, MethodInfo);
 
/*
* The parent block does not "exit" and continue execution -- the
* method is terminated here with the Return() statement.
*/
Op->Asl.Parent->Asl.CompileFlags |= NODE_HAS_NO_EXIT;
 
/* Used in the "typing" pass later */
 
Op->Asl.ParentMethod = MethodInfo->Op;
 
/*
* If there is a peer node after the return statement, then this
* node is unreachable code -- i.e., it won't be executed because of
* the preceeding Return() statement.
*/
if (Op->Asl.Next)
{
AslError (ASL_WARNING, ASL_MSG_UNREACHABLE_CODE, Op->Asl.Next, NULL);
}
break;
 
 
case PARSEOP_IF:
 
if ((Op->Asl.CompileFlags & NODE_HAS_NO_EXIT) &&
(Op->Asl.Next) &&
(Op->Asl.Next->Asl.ParseOpcode == PARSEOP_ELSE))
{
/*
* This IF has a corresponding ELSE. The IF block has no exit,
* (it contains an unconditional Return)
* mark the ELSE block to remember this fact.
*/
Op->Asl.Next->Asl.CompileFlags |= NODE_IF_HAS_NO_EXIT;
}
break;
 
 
case PARSEOP_ELSE:
 
if ((Op->Asl.CompileFlags & NODE_HAS_NO_EXIT) &&
(Op->Asl.CompileFlags & NODE_IF_HAS_NO_EXIT))
{
/*
* This ELSE block has no exit and the corresponding IF block
* has no exit either. Therefore, the parent node has no exit.
*/
Op->Asl.Parent->Asl.CompileFlags |= NODE_HAS_NO_EXIT;
}
break;
 
 
default:
 
if ((Op->Asl.CompileFlags & NODE_HAS_NO_EXIT) &&
(Op->Asl.Parent))
{
/* If this node has no exit, then the parent has no exit either */
 
Op->Asl.Parent->Asl.CompileFlags |= NODE_HAS_NO_EXIT;
}
break;
}
 
return (AE_OK);
}
 
 
/*******************************************************************************
*
* FUNCTION: AnMethodTypingWalkEnd
*
* PARAMETERS: ASL_WALK_CALLBACK
*
* RETURN: Status
*
* DESCRIPTION: Ascending callback for typing walk. Complete the method
* return analysis. Check methods for:
* 1) Initialized local variables
* 2) Valid arguments
* 3) Return types
*
******************************************************************************/
 
ACPI_STATUS
AnMethodTypingWalkEnd (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context)
{
UINT32 ThisNodeBtype;
 
 
switch (Op->Asl.ParseOpcode)
{
case PARSEOP_METHOD:
 
Op->Asl.CompileFlags |= NODE_METHOD_TYPED;
break;
 
case PARSEOP_RETURN:
 
if ((Op->Asl.Child) &&
(Op->Asl.Child->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG))
{
ThisNodeBtype = AnGetBtype (Op->Asl.Child);
 
if ((Op->Asl.Child->Asl.ParseOpcode == PARSEOP_METHODCALL) &&
(ThisNodeBtype == (ACPI_UINT32_MAX -1)))
{
/*
* The called method is untyped at this time (typically a
* forward reference).
*
* Check for a recursive method call first.
*/
if (Op->Asl.ParentMethod != Op->Asl.Child->Asl.Node->Op)
{
/* We must type the method here */
 
TrWalkParseTree (Op->Asl.Child->Asl.Node->Op,
ASL_WALK_VISIT_UPWARD, NULL,
AnMethodTypingWalkEnd, NULL);
 
ThisNodeBtype = AnGetBtype (Op->Asl.Child);
}
}
 
/* Returns a value, save the value type */
 
if (Op->Asl.ParentMethod)
{
Op->Asl.ParentMethod->Asl.AcpiBtype |= ThisNodeBtype;
}
}
break;
 
default:
break;
}
 
return (AE_OK);
}
 
 
/*******************************************************************************
*
* FUNCTION: AnOperandTypecheckWalkEnd
*
* PARAMETERS: ASL_WALK_CALLBACK
*
* RETURN: Status
*
* DESCRIPTION: Ascending callback for analysis walk. Complete method
* return analysis.
*
******************************************************************************/
 
ACPI_STATUS
AnOperandTypecheckWalkEnd (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context)
{
const ACPI_OPCODE_INFO *OpInfo;
UINT32 RuntimeArgTypes;
UINT32 RuntimeArgTypes2;
UINT32 RequiredBtypes;
UINT32 ThisNodeBtype;
UINT32 CommonBtypes;
UINT32 OpcodeClass;
ACPI_PARSE_OBJECT *ArgOp;
UINT32 ArgType;
 
 
switch (Op->Asl.AmlOpcode)
{
case AML_RAW_DATA_BYTE:
case AML_RAW_DATA_WORD:
case AML_RAW_DATA_DWORD:
case AML_RAW_DATA_QWORD:
case AML_RAW_DATA_BUFFER:
case AML_RAW_DATA_CHAIN:
case AML_PACKAGE_LENGTH:
case AML_UNASSIGNED_OPCODE:
case AML_DEFAULT_ARG_OP:
 
/* Ignore the internal (compiler-only) AML opcodes */
 
return (AE_OK);
 
default:
break;
}
 
OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
if (!OpInfo)
{
return (AE_OK);
}
 
ArgOp = Op->Asl.Child;
RuntimeArgTypes = OpInfo->RuntimeArgs;
OpcodeClass = OpInfo->Class;
 
#ifdef ASL_ERROR_NAMED_OBJECT_IN_WHILE
/*
* Update 11/2008: In practice, we can't perform this check. A simple
* analysis is not sufficient. Also, it can cause errors when compiling
* disassembled code because of the way Switch operators are implemented
* (a While(One) loop with a named temp variable created within.)
*/
 
/*
* If we are creating a named object, check if we are within a while loop
* by checking if the parent is a WHILE op. This is a simple analysis, but
* probably sufficient for many cases.
*
* Allow Scope(), Buffer(), and Package().
*/
if (((OpcodeClass == AML_CLASS_NAMED_OBJECT) && (Op->Asl.AmlOpcode != AML_SCOPE_OP)) ||
((OpcodeClass == AML_CLASS_CREATE) && (OpInfo->Flags & AML_NSNODE)))
{
if (Op->Asl.Parent->Asl.AmlOpcode == AML_WHILE_OP)
{
AslError (ASL_ERROR, ASL_MSG_NAMED_OBJECT_IN_WHILE, Op, NULL);
}
}
#endif
 
/*
* Special case for control opcodes IF/RETURN/WHILE since they
* have no runtime arg list (at this time)
*/
switch (Op->Asl.AmlOpcode)
{
case AML_IF_OP:
case AML_WHILE_OP:
case AML_RETURN_OP:
 
if (ArgOp->Asl.ParseOpcode == PARSEOP_METHODCALL)
{
/* Check for an internal method */
 
if (AnIsInternalMethod (ArgOp))
{
return (AE_OK);
}
 
/* The lone arg is a method call, check it */
 
RequiredBtypes = AnMapArgTypeToBtype (ARGI_INTEGER);
if (Op->Asl.AmlOpcode == AML_RETURN_OP)
{
RequiredBtypes = 0xFFFFFFFF;
}
 
ThisNodeBtype = AnGetBtype (ArgOp);
if (ThisNodeBtype == ACPI_UINT32_MAX)
{
return (AE_OK);
}
AnCheckMethodReturnValue (Op, OpInfo, ArgOp,
RequiredBtypes, ThisNodeBtype);
}
return (AE_OK);
 
default:
break;
}
 
/* Ignore the non-executable opcodes */
 
if (RuntimeArgTypes == ARGI_INVALID_OPCODE)
{
return (AE_OK);
}
 
switch (OpcodeClass)
{
case AML_CLASS_EXECUTE:
case AML_CLASS_CREATE:
case AML_CLASS_CONTROL:
case AML_CLASS_RETURN_VALUE:
 
/* TBD: Change class or fix typechecking for these */
 
if ((Op->Asl.AmlOpcode == AML_BUFFER_OP) ||
(Op->Asl.AmlOpcode == AML_PACKAGE_OP) ||
(Op->Asl.AmlOpcode == AML_VAR_PACKAGE_OP))
{
break;
}
 
/* Reverse the runtime argument list */
 
RuntimeArgTypes2 = 0;
while ((ArgType = GET_CURRENT_ARG_TYPE (RuntimeArgTypes)))
{
RuntimeArgTypes2 <<= ARG_TYPE_WIDTH;
RuntimeArgTypes2 |= ArgType;
INCREMENT_ARG_LIST (RuntimeArgTypes);
}
 
while ((ArgType = GET_CURRENT_ARG_TYPE (RuntimeArgTypes2)))
{
RequiredBtypes = AnMapArgTypeToBtype (ArgType);
 
ThisNodeBtype = AnGetBtype (ArgOp);
if (ThisNodeBtype == ACPI_UINT32_MAX)
{
goto NextArgument;
}
 
/* Examine the arg based on the required type of the arg */
 
switch (ArgType)
{
case ARGI_TARGETREF:
 
if (ArgOp->Asl.ParseOpcode == PARSEOP_ZERO)
{
/* ZERO is the placeholder for "don't store result" */
 
ThisNodeBtype = RequiredBtypes;
break;
}
 
if (ArgOp->Asl.ParseOpcode == PARSEOP_INTEGER)
{
/*
* This is the case where an original reference to a resource
* descriptor field has been replaced by an (Integer) offset.
* These named fields are supported at compile-time only;
* the names are not passed to the interpreter (via the AML).
*/
if ((ArgOp->Asl.Node->Type == ACPI_TYPE_LOCAL_RESOURCE_FIELD) ||
(ArgOp->Asl.Node->Type == ACPI_TYPE_LOCAL_RESOURCE))
{
AslError (ASL_ERROR, ASL_MSG_RESOURCE_FIELD, ArgOp, NULL);
}
else
{
AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, NULL);
}
break;
}
 
if ((ArgOp->Asl.ParseOpcode == PARSEOP_METHODCALL) ||
(ArgOp->Asl.ParseOpcode == PARSEOP_DEREFOF))
{
break;
}
 
ThisNodeBtype = RequiredBtypes;
break;
 
 
case ARGI_REFERENCE: /* References */
case ARGI_INTEGER_REF:
case ARGI_OBJECT_REF:
case ARGI_DEVICE_REF:
 
switch (ArgOp->Asl.ParseOpcode)
{
case PARSEOP_LOCAL0:
case PARSEOP_LOCAL1:
case PARSEOP_LOCAL2:
case PARSEOP_LOCAL3:
case PARSEOP_LOCAL4:
case PARSEOP_LOCAL5:
case PARSEOP_LOCAL6:
case PARSEOP_LOCAL7:
 
/* TBD: implement analysis of current value (type) of the local */
/* For now, just treat any local as a typematch */
 
/*ThisNodeBtype = RequiredBtypes;*/
break;
 
case PARSEOP_ARG0:
case PARSEOP_ARG1:
case PARSEOP_ARG2:
case PARSEOP_ARG3:
case PARSEOP_ARG4:
case PARSEOP_ARG5:
case PARSEOP_ARG6:
 
/* Hard to analyze argument types, sow we won't */
/* For now, just treat any arg as a typematch */
 
/* ThisNodeBtype = RequiredBtypes; */
break;
 
case PARSEOP_DEBUG:
break;
 
case PARSEOP_REFOF:
case PARSEOP_INDEX:
default:
break;
 
}
break;
 
case ARGI_INTEGER:
default:
break;
}
 
 
CommonBtypes = ThisNodeBtype & RequiredBtypes;
 
if (ArgOp->Asl.ParseOpcode == PARSEOP_METHODCALL)
{
if (AnIsInternalMethod (ArgOp))
{
return (AE_OK);
}
 
/* Check a method call for a valid return value */
 
AnCheckMethodReturnValue (Op, OpInfo, ArgOp,
RequiredBtypes, ThisNodeBtype);
}
 
/*
* Now check if the actual type(s) match at least one
* bit to the required type
*/
else if (!CommonBtypes)
{
/* No match -- this is a type mismatch error */
 
AnFormatBtype (StringBuffer, ThisNodeBtype);
AnFormatBtype (StringBuffer2, RequiredBtypes);
 
sprintf (MsgBuffer, "[%s] found, %s operator requires [%s]",
StringBuffer, OpInfo->Name, StringBuffer2);
 
AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, MsgBuffer);
}
 
NextArgument:
ArgOp = ArgOp->Asl.Next;
INCREMENT_ARG_LIST (RuntimeArgTypes2);
}
break;
 
default:
break;
}
 
return (AE_OK);
}
 
 
/*******************************************************************************
*
* FUNCTION: AnOtherSemanticAnalysisWalkBegin
*
* PARAMETERS: ASL_WALK_CALLBACK
*
* RETURN: Status
*
* DESCRIPTION: Descending callback for the analysis walk. Checks for
* miscellaneous issues in the code.
*
******************************************************************************/
 
ACPI_STATUS
AnOtherSemanticAnalysisWalkBegin (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context)
{
ACPI_PARSE_OBJECT *ArgNode;
ACPI_PARSE_OBJECT *PrevArgNode = NULL;
const ACPI_OPCODE_INFO *OpInfo;
 
 
OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
 
/*
* Determine if an execution class operator actually does something by
* checking if it has a target and/or the function return value is used.
* (Target is optional, so a standalone statement can actually do nothing.)
*/
if ((OpInfo->Class == AML_CLASS_EXECUTE) &&
(OpInfo->Flags & AML_HAS_RETVAL) &&
(!AnIsResultUsed (Op)))
{
if (OpInfo->Flags & AML_HAS_TARGET)
{
/*
* Find the target node, it is always the last child. If the traget
* is not specified in the ASL, a default node of type Zero was
* created by the parser.
*/
ArgNode = Op->Asl.Child;
while (ArgNode->Asl.Next)
{
PrevArgNode = ArgNode;
ArgNode = ArgNode->Asl.Next;
}
 
/* Divide() is the only weird case, it has two targets */
 
if (Op->Asl.AmlOpcode == AML_DIVIDE_OP)
{
if ((ArgNode->Asl.ParseOpcode == PARSEOP_ZERO) &&
(PrevArgNode) &&
(PrevArgNode->Asl.ParseOpcode == PARSEOP_ZERO))
{
AslError (ASL_WARNING, ASL_MSG_RESULT_NOT_USED,
Op, Op->Asl.ExternalName);
}
}
else if (ArgNode->Asl.ParseOpcode == PARSEOP_ZERO)
{
AslError (ASL_WARNING, ASL_MSG_RESULT_NOT_USED,
Op, Op->Asl.ExternalName);
}
}
else
{
/*
* Has no target and the result is not used. Only a couple opcodes
* can have this combination.
*/
switch (Op->Asl.ParseOpcode)
{
case PARSEOP_ACQUIRE:
case PARSEOP_WAIT:
case PARSEOP_LOADTABLE:
break;
 
default:
AslError (ASL_WARNING, ASL_MSG_RESULT_NOT_USED,
Op, Op->Asl.ExternalName);
break;
}
}
}
 
 
/*
* Semantic checks for individual ASL operators
*/
switch (Op->Asl.ParseOpcode)
{
case PARSEOP_ACQUIRE:
case PARSEOP_WAIT:
/*
* Emit a warning if the timeout parameter for these operators is not
* ACPI_WAIT_FOREVER, and the result value from the operator is not
* checked, meaning that a timeout could happen, but the code
* would not know about it.
*/
 
/* First child is the namepath, 2nd child is timeout */
 
ArgNode = Op->Asl.Child;
ArgNode = ArgNode->Asl.Next;
 
/*
* Check for the WAIT_FOREVER case - defined by the ACPI spec to be
* 0xFFFF or greater
*/
if (((ArgNode->Asl.ParseOpcode == PARSEOP_WORDCONST) ||
(ArgNode->Asl.ParseOpcode == PARSEOP_INTEGER)) &&
(ArgNode->Asl.Value.Integer >= (UINT64) ACPI_WAIT_FOREVER))
{
break;
}
 
/*
* The operation could timeout. If the return value is not used
* (indicates timeout occurred), issue a warning
*/
if (!AnIsResultUsed (Op))
{
AslError (ASL_WARNING, ASL_MSG_TIMEOUT, ArgNode,
Op->Asl.ExternalName);
}
break;
 
case PARSEOP_CREATEFIELD:
/*
* Check for a zero Length (NumBits) operand. NumBits is the 3rd operand
*/
ArgNode = Op->Asl.Child;
ArgNode = ArgNode->Asl.Next;
ArgNode = ArgNode->Asl.Next;
 
if ((ArgNode->Asl.ParseOpcode == PARSEOP_ZERO) ||
((ArgNode->Asl.ParseOpcode == PARSEOP_INTEGER) &&
(ArgNode->Asl.Value.Integer == 0)))
{
AslError (ASL_ERROR, ASL_MSG_NON_ZERO, ArgNode, NULL);
}
break;
 
default:
break;
}
 
return (AE_OK);
}
/drivers/devman/acpica/compiler/dtcompile.c
8,7 → 8,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
127,7 → 127,7
 
/* Local prototypes */
 
static void
static ACPI_STATUS
DtInitialize (
void);
 
166,7 → 166,12
 
/* Initialize globals */
 
DtInitialize ();
Status = DtInitialize ();
if (ACPI_FAILURE (Status))
{
printf ("Error during compiler initialization, 0x%X\n", Status);
return (Status);
}
 
/*
* Scan the input file (file is already open) and
183,8 → 188,10
/* TBD: temporary error message. Msgs should come from function above */
 
DtError (ASL_ERROR, ASL_MSG_SYNTAX, NULL,
"Could not parse input file");
return (AE_ERROR);
"Input file does not appear to be an ASL or data table source file");
 
Status = AE_ERROR;
goto CleanupAndExit;
}
 
Event = UtBeginEvent ("Compile parse tree");
203,6 → 210,7
 
DtError (ASL_ERROR, ASL_MSG_SYNTAX, NULL,
"Could not compile input file");
 
goto CleanupAndExit;
}
 
219,6 → 227,7
 
DtOutputBinary (Gbl_RootTable);
LsDoHexOutput ();
DtWriteTableToListing ();
 
CleanupAndExit:
 
233,7 → 242,7
*
* PARAMETERS: None
*
* RETURN: None
* RETURN: Status
*
* DESCRIPTION: Initialize data table compiler globals. Enables multiple
* compiles per invocation.
240,16 → 249,31
*
*****************************************************************************/
 
static void
static ACPI_STATUS
DtInitialize (
void)
{
ACPI_STATUS Status;
 
 
Status = AcpiOsInitialize ();
if (ACPI_FAILURE (Status))
{
return (Status);
}
 
Status = AcpiUtInitGlobals ();
if (ACPI_FAILURE (Status))
{
return (Status);
}
 
Gbl_FieldList = NULL;
Gbl_RootTable = NULL;
Gbl_SubtableStack = NULL;
 
sprintf (VersionString, "%X", (UINT32) ACPI_CA_VERSION);
return (AE_OK);
}
 
 
291,7 → 315,7
Next = Next->Next;
}
 
Next->Value = CompilerCreatorId;
Next->Value = ASL_CREATOR_ID;
Next->Flags = DT_FIELD_NOT_ALLOCATED;
 
Next = Next->Next;
325,10 → 349,12
 
/* Verify that we at least have a table signature and save it */
 
Signature = DtGetFieldValue (*FieldList, "Signature");
Signature = DtGetFieldValue (*FieldList);
if (!Signature)
{
DtError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, *FieldList, NULL);
sprintf (MsgBuffer, "Expected \"%s\"", "Signature");
DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
*FieldList, MsgBuffer);
return (AE_ERROR);
}
 
356,11 → 382,6
Status = DtCompileRsdp (FieldList);
return (Status);
}
else if (!ACPI_STRNCMP (Signature, "OEM", 3))
{
DtFatal (ASL_MSG_OEM_TABLE, *FieldList, Signature);
return (AE_ERROR);
}
 
/*
* All other tables must use the common ACPI table header. Insert the
377,15 → 398,17
 
DtPushSubtable (Gbl_RootTable);
 
/* Match signature and dispatch appropriately */
/* Validate the signature via the ACPI table list */
 
TableData = AcpiDmGetTableData (Signature);
if (!TableData)
{
DtFatal (ASL_MSG_UNKNOWN_TABLE, *FieldList, Signature);
return (AE_ERROR);
DtCompileGeneric ((void **) FieldList);
goto Out;
}
 
/* Dispatch to per-table compile */
 
if (TableData->CmTableHandler)
{
/* Complex table, has a handler */
418,6 → 441,7
return (AE_ERROR);
}
 
Out:
/* Set the final table length and then the checksum */
 
DtSetTableLength ();
459,7 → 483,6
UINT8 FieldType;
UINT8 *Buffer;
UINT8 *FlagBuffer = NULL;
UINT32 FlagBitPosition = 0;
ACPI_STATUS Status;
 
 
469,9 → 492,17
}
 
Length = DtGetSubtableLength (*Field, Info);
if (Length == ASL_EOF)
{
return (AE_ERROR);
}
 
Subtable = UtLocalCalloc (sizeof (DT_SUBTABLE));
 
if (Length > 0)
{
Subtable->Buffer = UtLocalCalloc (Length);
}
Subtable->Length = Length;
Subtable->TotalLength = Length;
Buffer = Subtable->Buffer;
492,30 → 523,12
goto Error;
}
 
/* Does input field name match what is expected? */
/* Maintain table offsets */
 
if (ACPI_STRCMP (LocalField->Name, Info->Name))
{
/*
* If Required = TRUE, the subtable must exist.
* If Required = FALSE, the subtable is optional
* (For example, AcpiDmTableInfoDmarScope in DMAR table is
* optional)
*/
if (Required)
{
sprintf (MsgBuffer, "Expected \"%s\"", Info->Name);
DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
LocalField, MsgBuffer);
}
else
{
Status = AE_NOT_FOUND;
goto Error;
}
}
LocalField->TableOffset = Gbl_CurrentTableOffset;
FieldLength = DtGetFieldLength (LocalField, Info);
Gbl_CurrentTableOffset += FieldLength;
 
FieldLength = DtGetFieldLength (LocalField, Info);
FieldType = DtGetFieldType (Info);
Gbl_InputFieldCount++;
 
530,7 → 543,6
LocalField = LocalField->Next;
*Field = LocalField;
 
FlagBitPosition = 0;
FlagBuffer = Buffer;
break;
 
540,8 → 552,7
 
if (FlagBuffer)
{
FlagBitPosition = DtCompileFlag (FlagBuffer,
LocalField, Info, FlagBitPosition);
DtCompileFlag (FlagBuffer, LocalField, Info);
}
else
{
557,7 → 568,6
* Recursion (one level max): compile GAS (Generic Address)
* or Notify in-line subtable
*/
LocalField = LocalField->Next;
*Field = LocalField;
 
if (Info->Opcode == ACPI_DMT_GAS)
576,6 → 586,8
goto Error;
}
 
DtSetSubtableLength (InlineSubtable);
 
ACPI_MEMCPY (Buffer, InlineSubtable->Buffer, FieldLength);
ACPI_FREE (InlineSubtable->Buffer);
ACPI_FREE (InlineSubtable);
582,6 → 594,12
LocalField = *Field;
break;
 
case DT_FIELD_TYPE_LABEL:
 
DtWriteFieldToListing (Buffer, LocalField, 0);
LocalField = LocalField->Next;
break;
 
default:
 
/* Normal case for most field types (Integer, String, etc.) */
588,6 → 606,8
 
DtCompileOneField (Buffer, LocalField,
FieldLength, FieldType, Info->Flags);
 
DtWriteFieldToListing (Buffer, LocalField, FieldLength);
LocalField = LocalField->Next;
 
if (Info->Flags & DT_LENGTH)
597,6 → 617,7
Subtable->LengthField = Buffer;
Subtable->SizeOfLengthField = FieldLength;
}
 
break;
}
 
/drivers/devman/acpica/compiler/dtcompiler.h
8,7 → 8,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
142,6 → 142,10
#define DT_FIELD_TYPE_FLAG 4
#define DT_FIELD_TYPE_FLAGS_INTEGER 5
#define DT_FIELD_TYPE_INLINE_SUBTABLE 6
#define DT_FIELD_TYPE_UUID 7
#define DT_FIELD_TYPE_UNICODE 8
#define DT_FIELD_TYPE_DEVICE_PATH 9
#define DT_FIELD_TYPE_LABEL 10
 
 
/*
149,13 → 153,15
*/
typedef struct dt_field
{
char *Name;
char *Value;
struct dt_field *Next;
char *Name; /* Field name (from name : value) */
char *Value; /* Field value (from name : value) */
struct dt_field *Next; /* Next field */
struct dt_field *NextLabel; /* If field is a label, next label */
UINT32 Line; /* Line number for this field */
UINT32 ByteOffset; /* Offset in source file for field */
UINT32 NameColumn; /* Start column for field name */
UINT32 Column; /* Start column for field value */
UINT32 TableOffset;/* Binary offset within ACPI table */
UINT8 Flags;
 
} DT_FIELD;
200,7 → 206,15
 
DT_EXTERN DT_SUBTABLE DT_INIT_GLOBAL (*Gbl_SubtableStack, NULL);
 
/* List for defined labels */
 
DT_EXTERN DT_FIELD DT_INIT_GLOBAL (*Gbl_LabelList, NULL);
 
/* Current offset within the binary output table */
 
DT_EXTERN UINT32 DT_INIT_GLOBAL (Gbl_CurrentTableOffset, 0);
 
 
/* dtcompiler - main module */
 
ACPI_STATUS
221,7 → 235,17
DtOutputBinary (
DT_SUBTABLE *RootTable);
 
void
DtWriteFieldToListing (
UINT8 *Buffer,
DT_FIELD *Field,
UINT32 Length);
 
void
DtWriteTableToListing (
void);
 
 
/* dtsubtable - compile subtables */
 
void
266,6 → 290,28
DT_SUBTABLE *Subtable);
 
 
/* dtexpress - Integer expressions and labels */
 
ACPI_STATUS
DtResolveIntegerExpression (
DT_FIELD *Field,
UINT64 *ReturnValue);
 
UINT64
DtDoOperator (
UINT64 LeftValue,
UINT32 Operator,
UINT64 RightValue);
 
UINT64
DtResolveLabel (
char *LabelString);
 
void
DtDetectAllLabels (
DT_FIELD *FieldList);
 
 
/* dtfield - Compile individual fields within a table */
 
void
290,14 → 336,32
DT_FIELD *Field,
UINT32 ByteLength);
 
UINT32
void
DtCompileFlag (
UINT8 *Buffer,
DT_FIELD *Field,
ACPI_DMTABLE_INFO *Info,
UINT32 BitPosition);
ACPI_DMTABLE_INFO *Info);
 
 
/* dtparser - lex/yacc files */
 
UINT64
DtEvaluateExpression (
char *ExprString);
 
int
DtInitLexer (
char *String);
 
void
DtTerminateLexer (
void);
 
char *
DtGetOpName (
UINT32 ParseOpcode);
 
 
/* dtutils - Miscellaneous utilities */
 
typedef
344,8 → 408,7
 
char*
DtGetFieldValue (
DT_FIELD *Field,
char *Name);
DT_FIELD *Field);
 
UINT8
DtGetFieldType (
432,6 → 495,10
void **PFieldList);
 
ACPI_STATUS
DtCompileSlic (
void **PFieldList);
 
ACPI_STATUS
DtCompileSlit (
void **PFieldList);
 
440,6 → 507,10
void **PFieldList);
 
ACPI_STATUS
DtCompileUefi (
void **PFieldList);
 
ACPI_STATUS
DtCompileWdat (
void **PFieldList);
 
447,9 → 518,46
DtCompileXsdt (
void **PFieldList);
 
ACPI_STATUS
DtCompileGeneric (
void **PFieldList);
 
/* Debug */
ACPI_DMTABLE_INFO *
DtGetGenericTableInfo (
char *Name);
 
#define MYDEBUG printf
/* ACPI Table templates */
 
extern const unsigned char TemplateAsf[];
extern const unsigned char TemplateBoot[];
extern const unsigned char TemplateBert[];
extern const unsigned char TemplateCpep[];
extern const unsigned char TemplateDbgp[];
extern const unsigned char TemplateDmar[];
extern const unsigned char TemplateEcdt[];
extern const unsigned char TemplateEinj[];
extern const unsigned char TemplateErst[];
extern const unsigned char TemplateFadt[];
extern const unsigned char TemplateHest[];
extern const unsigned char TemplateHpet[];
extern const unsigned char TemplateIvrs[];
extern const unsigned char TemplateMadt[];
extern const unsigned char TemplateMcfg[];
extern const unsigned char TemplateMchi[];
extern const unsigned char TemplateMsct[];
extern const unsigned char TemplateRsdt[];
extern const unsigned char TemplateSbst[];
extern const unsigned char TemplateSlic[];
extern const unsigned char TemplateSlit[];
extern const unsigned char TemplateSpcr[];
extern const unsigned char TemplateSpmi[];
extern const unsigned char TemplateSrat[];
extern const unsigned char TemplateTcpa[];
extern const unsigned char TemplateUefi[];
extern const unsigned char TemplateWaet[];
extern const unsigned char TemplateWdat[];
extern const unsigned char TemplateWddt[];
extern const unsigned char TemplateWdrt[];
extern const unsigned char TemplateXsdt[];
 
#endif
/drivers/devman/acpica/compiler/dtexpress.c
0,0 → 1,480
/******************************************************************************
*
* Module Name: dtexpress.c - Support for integer expressions and labels
*
*****************************************************************************/
 
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
* rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
* copy of the source code appearing in this file ("Covered Code") an
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
* base code distributed originally by Intel ("Original Intel Code") to copy,
* make derivatives, distribute, use and display any portion of the Covered
* Code in any form, with the right to sublicense such rights; and
*
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
* license (with the right to sublicense), under only those claims of Intel
* patents that are infringed by the Original Intel Code, to make, use, sell,
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
* to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
* documentation and/or other materials provided with distribution. In
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* property embodied in the software Licensee provides to its licensee, and
* not to intellectual property embodied in modifications its licensee may
* make.
*
* 3.3. Redistribution of Executable. Redistribution in executable form of any
* substantial portion of the Covered Code or modification must reproduce the
* above Copyright Notice, and the following Disclaimer and Export Compliance
* provision in the documentation and/or other materials provided with the
* distribution.
*
* 3.4. Intel retains all right, title, and interest in and to the Original
* Intel Code.
*
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
* Intel shall be used in advertising or otherwise to promote the sale, use or
* other dealings in products derived from or relating to the Covered Code
* without prior written authorization from Intel.
*
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
* any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* ensure that the distribution and export/re-export of the software is in
* compliance with all laws, regulations, orders, or other restrictions of the
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
* any of its subsidiaries will export/re-export any technical data, process,
* software, or service, directly or indirectly, to any country for which the
* United States government or any agency thereof requires an export license,
* other governmental approval, or letter of assurance, without first obtaining
* such license, approval or letter.
*
*****************************************************************************/
 
#define __DTEXPRESS_C__
 
#include "aslcompiler.h"
#include "dtcompiler.h"
#include "dtparser.y.h"
 
#define _COMPONENT DT_COMPILER
ACPI_MODULE_NAME ("dtexpress")
 
 
/* Local prototypes */
 
static void
DtInsertLabelField (
DT_FIELD *Field);
 
static DT_FIELD *
DtLookupLabel (
char *Name);
 
/* Global used for errors during parse and related functions */
 
DT_FIELD *Gbl_CurrentField;
 
 
/******************************************************************************
*
* FUNCTION: DtResolveIntegerExpression
*
* PARAMETERS: Field - Field object with Integer expression
* ReturnValue - Where the integer is returned
*
* RETURN: Status, and the resolved 64-bit integer value
*
* DESCRIPTION: Resolve an integer expression to a single value. Supports
* both integer constants and labels.
*
*****************************************************************************/
 
ACPI_STATUS
DtResolveIntegerExpression (
DT_FIELD *Field,
UINT64 *ReturnValue)
{
UINT64 Result;
 
 
DbgPrint (ASL_DEBUG_OUTPUT, "Full Integer expression: %s\n",
Field->Value);
 
Gbl_CurrentField = Field;
 
Result = DtEvaluateExpression (Field->Value);
*ReturnValue = Result;
return (AE_OK);
}
 
 
/******************************************************************************
*
* FUNCTION: DtDoOperator
*
* PARAMETERS: LeftValue - First 64-bit operand
* Operator - Parse token for the operator (EXPOP_*)
* RightValue - Second 64-bit operand
*
* RETURN: 64-bit result of the requested operation
*
* DESCRIPTION: Perform the various 64-bit integer math functions
*
*****************************************************************************/
 
UINT64
DtDoOperator (
UINT64 LeftValue,
UINT32 Operator,
UINT64 RightValue)
{
UINT64 Result;
 
 
/* Perform the requested operation */
 
switch (Operator)
{
case EXPOP_ONES_COMPLIMENT:
Result = ~RightValue;
break;
 
case EXPOP_LOGICAL_NOT:
Result = !RightValue;
break;
 
case EXPOP_MULTIPLY:
Result = LeftValue * RightValue;
break;
 
case EXPOP_DIVIDE:
if (!RightValue)
{
DtError (ASL_ERROR, ASL_MSG_DIVIDE_BY_ZERO,
Gbl_CurrentField, Gbl_CurrentField->Value);
return (0);
}
Result = LeftValue / RightValue;
break;
 
case EXPOP_MODULO:
if (!RightValue)
{
DtError (ASL_ERROR, ASL_MSG_DIVIDE_BY_ZERO,
Gbl_CurrentField, Gbl_CurrentField->Value);
return (0);
}
Result = LeftValue % RightValue;
break;
 
case EXPOP_ADD:
Result = LeftValue + RightValue;
break;
 
case EXPOP_SUBTRACT:
Result = LeftValue - RightValue;
break;
 
case EXPOP_SHIFT_RIGHT:
Result = LeftValue >> RightValue;
break;
 
case EXPOP_SHIFT_LEFT:
Result = LeftValue << RightValue;
break;
 
case EXPOP_LESS:
Result = LeftValue < RightValue;
break;
 
case EXPOP_GREATER:
Result = LeftValue > RightValue;
break;
 
case EXPOP_LESS_EQUAL:
Result = LeftValue <= RightValue;
break;
 
case EXPOP_GREATER_EQUAL:
Result = LeftValue >= RightValue;
break;
 
case EXPOP_EQUAL:
Result = LeftValue = RightValue;
break;
 
case EXPOP_NOT_EQUAL:
Result = LeftValue != RightValue;
break;
 
case EXPOP_AND:
Result = LeftValue & RightValue;
break;
 
case EXPOP_XOR:
Result = LeftValue ^ RightValue;
break;
 
case EXPOP_OR:
Result = LeftValue | RightValue;
break;
 
case EXPOP_LOGICAL_AND:
Result = LeftValue && RightValue;
break;
 
case EXPOP_LOGICAL_OR:
Result = LeftValue || RightValue;
break;
 
default:
 
/* Unknown operator */
 
DtFatal (ASL_MSG_INVALID_EXPRESSION,
Gbl_CurrentField, Gbl_CurrentField->Value);
return (0);
}
 
DbgPrint (ASL_DEBUG_OUTPUT,
"IntegerEval: %s (%8.8X%8.8X %s %8.8X%8.8X) = %8.8X%8.8X\n",
Gbl_CurrentField->Value,
ACPI_FORMAT_UINT64 (LeftValue),
DtGetOpName (Operator),
ACPI_FORMAT_UINT64 (RightValue),
ACPI_FORMAT_UINT64 (Result));
 
return (Result);
}
 
 
/******************************************************************************
*
* FUNCTION: DtResolveLabel
*
* PARAMETERS: LabelString - Contains the label
*
* RETURN: Table offset associated with the label
*
* DESCRIPTION: Lookup a lable and return its value.
*
*****************************************************************************/
 
UINT64
DtResolveLabel (
char *LabelString)
{
DT_FIELD *LabelField;
 
 
DbgPrint (ASL_DEBUG_OUTPUT, "Resolve Label: %s\n", LabelString);
 
/* Resolve a label reference to an integer (table offset) */
 
if (*LabelString != '$')
{
return (0);
}
 
LabelField = DtLookupLabel (LabelString);
if (!LabelField)
{
DtError (ASL_ERROR, ASL_MSG_UNKNOWN_LABEL,
Gbl_CurrentField, LabelString);
return (0);
}
 
/* All we need from the label is the offset in the table */
 
DbgPrint (ASL_DEBUG_OUTPUT, "Resolved Label: 0x%8.8X\n",
LabelField->TableOffset);
 
return (LabelField->TableOffset);
}
 
 
/******************************************************************************
*
* FUNCTION: DtDetectAllLabels
*
* PARAMETERS: FieldList - Field object at start of generic list
*
* RETURN: None
*
* DESCRIPTION: Detect all labels in a list of "generic" opcodes (such as
* a UEFI table.) and insert them into the global label list.
*
*****************************************************************************/
 
void
DtDetectAllLabels (
DT_FIELD *FieldList)
{
ACPI_DMTABLE_INFO *Info;
DT_FIELD *GenericField;
UINT32 TableOffset;
 
 
TableOffset = Gbl_CurrentTableOffset;
GenericField = FieldList;
 
/*
* Process all "Label:" fields within the parse tree. We need
* to know the offsets for all labels before we can compile
* the parse tree in order to handle forward references. Traverse
* tree and get/set all field lengths of all operators in order to
* determine the label offsets.
*/
while (GenericField)
{
Info = DtGetGenericTableInfo (GenericField->Name);
if (Info)
{
/* Maintain table offsets */
 
GenericField->TableOffset = TableOffset;
TableOffset += DtGetFieldLength (GenericField, Info);
 
/* Insert all labels in the global label list */
 
if (Info->Opcode == ACPI_DMT_LABEL)
{
DtInsertLabelField (GenericField);
}
}
 
GenericField = GenericField->Next;
}
}
 
 
/******************************************************************************
*
* FUNCTION: DtInsertLabelField
*
* PARAMETERS: Field - Field object with Label to be inserted
*
* RETURN: None
*
* DESCRIPTION: Insert a label field into the global label list
*
*****************************************************************************/
 
static void
DtInsertLabelField (
DT_FIELD *Field)
{
 
DbgPrint (ASL_DEBUG_OUTPUT,
"DtInsertLabelField: Found Label : %s at output table offset %X\n",
Field->Value, Field->TableOffset);
 
Field->NextLabel = Gbl_LabelList;
Gbl_LabelList = Field;
}
 
 
/******************************************************************************
*
* FUNCTION: DtLookupLabel
*
* PARAMETERS: Name - Label to be resolved
*
* RETURN: Field object associated with the label
*
* DESCRIPTION: Lookup a label in the global label list. Used during the
* resolution of integer expressions.
*
*****************************************************************************/
 
static DT_FIELD *
DtLookupLabel (
char *Name)
{
DT_FIELD *LabelField;
 
 
/* Skip a leading $ */
 
if (*Name == '$')
{
Name++;
}
 
/* Search global list */
 
LabelField = Gbl_LabelList;
while (LabelField)
{
if (!ACPI_STRCMP (Name, LabelField->Value))
{
return (LabelField);
}
LabelField = LabelField->NextLabel;
}
 
return (NULL);
}
/drivers/devman/acpica/compiler/dtfield.c
8,7 → 8,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
130,18 → 130,24
DT_FIELD *Field,
UINT32 ByteLength);
 
static char *
DtPciPathToBuffer (
char *PciPath);
 
static void
DtCompilePciPath (
DtCompileUnicode (
UINT8 *Buffer,
char *StringValue,
DT_FIELD *Field,
UINT32 ByteLength);
 
static ACPI_STATUS
DtCompileUuid (
UINT8 *Buffer,
DT_FIELD *Field,
UINT32 ByteLength);
 
static char *
DtNormalizeBuffer (
char *Buffer,
UINT32 *Count);
 
 
/******************************************************************************
*
* FUNCTION: DtCompileOneField
165,6 → 171,7
UINT8 Type,
UINT8 Flags)
{
ACPI_STATUS Status;
 
switch (Type)
{
176,14 → 183,26
DtCompileString (Buffer, Field, ByteLength);
break;
 
case DT_FIELD_TYPE_UUID:
Status = DtCompileUuid (Buffer, Field, ByteLength);
if (ACPI_SUCCESS (Status))
{
break;
}
 
/* Fall through. */
 
case DT_FIELD_TYPE_BUFFER:
DtCompileBuffer (Buffer, Field->Value, Field, ByteLength);
break;
 
case DT_FIELD_TYPE_PCI_PATH:
DtCompilePciPath (Buffer, Field->Value, Field, ByteLength);
case DT_FIELD_TYPE_UNICODE:
DtCompileUnicode (Buffer, Field, ByteLength);
break;
 
case DT_FIELD_TYPE_DEVICE_PATH:
break;
 
default:
DtFatal (ASL_MSG_COMPILER_INTERNAL, Field, "Invalid field type");
break;
225,9 → 244,6
Length = ByteLength;
}
 
/* If input string is shorter than ByteLength, pad with blanks */
 
ACPI_MEMSET (Buffer, 0x20, ByteLength);
ACPI_MEMCPY (Buffer, Field->Value, Length);
}
 
234,15 → 250,100
 
/******************************************************************************
*
* FUNCTION: DtCompileUnicode
*
* PARAMETERS: Buffer - Output buffer
* Field - String to be copied to buffer
* ByteLength - Maximum length of string
*
* RETURN: None
*
* DESCRIPTION: Convert ASCII string to Unicode string
*
* Note: The Unicode string is 16 bits per character, no leading signature,
* with a 16-bit terminating NULL.
*
*****************************************************************************/
 
static void
DtCompileUnicode (
UINT8 *Buffer,
DT_FIELD *Field,
UINT32 ByteLength)
{
UINT32 Count;
UINT32 i;
char *AsciiString;
UINT16 *UnicodeString;
 
 
AsciiString = Field->Value;
UnicodeString = (UINT16 *) Buffer;
Count = ACPI_STRLEN (AsciiString) + 1;
 
/* Convert to Unicode string (including null terminator) */
 
for (i = 0; i < Count; i++)
{
UnicodeString[i] = (UINT16) AsciiString[i];
}
}
 
 
/*******************************************************************************
*
* FUNCTION: DtCompileUuid
*
* PARAMETERS: Buffer - Output buffer
* Field - String to be copied to buffer
* ByteLength - Maximum length of string
*
* RETURN: None
*
* DESCRIPTION: Convert UUID string to 16-byte buffer
*
******************************************************************************/
 
static ACPI_STATUS
DtCompileUuid (
UINT8 *Buffer,
DT_FIELD *Field,
UINT32 ByteLength)
{
char *InString;
ACPI_STATUS Status;
 
 
InString = Field->Value;
 
Status = AuValidateUuid (InString);
if (ACPI_FAILURE (Status))
{
sprintf (MsgBuffer, "%s", Field->Value);
DtNameError (ASL_ERROR, ASL_MSG_INVALID_UUID, Field, MsgBuffer);
}
else
{
Status = AuConvertStringToUuid (InString, (char *) Buffer);
}
 
return (Status);
}
 
 
/******************************************************************************
*
* FUNCTION: DtCompileInteger
*
* PARAMETERS: Buffer - Output buffer
* Field - Field obj with Integer to be compiled
* ByteLength - Byte length of the integer
* Flags - Additional compile info
*
* RETURN: None
*
* DESCRIPTION: Compile an integer
* DESCRIPTION: Compile an integer. Supports integer expressions with C-style
* operators.
*
*****************************************************************************/
 
253,15 → 354,12
UINT32 ByteLength,
UINT8 Flags)
{
UINT64 Value = 0;
UINT64 Value;
UINT64 MaxValue;
UINT8 *Hex;
char *Message = NULL;
ACPI_STATUS Status;
int i;
 
 
/* Byte length must be in range 1-8 */
/* Output buffer byte length must be in range 1-8 */
 
if ((ByteLength > 8) || (ByteLength == 0))
{
270,24 → 368,14
return;
}
 
/* Convert string to an actual integer */
/* Resolve integer expression to a single integer value */
 
Status = DtStrtoul64 (Field->Value, &Value);
Status = DtResolveIntegerExpression (Field, &Value);
if (ACPI_FAILURE (Status))
{
if (Status == AE_LIMIT)
{
Message = "Constant larger than 64 bits";
return;
}
else if (Status == AE_BAD_CHARACTER)
{
Message = "Invalid character in constant";
}
 
DtError (ASL_ERROR, ASL_MSG_INVALID_HEX_INTEGER, Field, Message);
goto Exit;
}
 
/* Ensure that reserved fields are set to zero */
/* TBD: should we set to zero, or just make this an ERROR? */
/* TBD: Probably better to use a flag */
317,29 → 405,10
 
if (Value > MaxValue)
{
sprintf (MsgBuffer, "Maximum %u bytes", ByteLength);
sprintf (MsgBuffer, "%8.8X%8.8X", ACPI_FORMAT_UINT64 (Value));
DtError (ASL_ERROR, ASL_MSG_INTEGER_SIZE, Field, MsgBuffer);
}
 
/*
* TBD: hard code for ASF! Capabilites field.
*
* This field is actually a buffer, not a 56-bit integer --
* so, the ordering is reversed. Something should be fixed
* so we don't need this code.
*/
if (ByteLength == 7)
{
Hex = ACPI_CAST_PTR (UINT8, &Value);
for (i = 6; i >= 0; i--)
{
Buffer[i] = *Hex;
Hex++;
}
return;
}
 
Exit:
ACPI_MEMCPY (Buffer, &Value, ByteLength);
return;
}
347,36 → 416,71
 
/******************************************************************************
*
* FUNCTION: DtPciPathToBuffer
* FUNCTION: DtNormalizeBuffer
*
* PARAMETERS: PciPath - DMAR "PCI Path" field
* PARAMETERS: Buffer - Input buffer
* Count - Output the count of hex number in
* the Buffer
*
* RETURN: Strings of PCI path
* RETURN: The normalized buffer, freed by caller
*
* DESCRIPTION: Remove brackets and comma from DMAR "PCI Path" string, for
* example: [1D, 01] ==> 1D 01
* DESCRIPTION: [1A,2B,3C,4D] or 1A, 2B, 3C, 4D will be normalized
* to 1A 2B 3C 4D
*
*****************************************************************************/
 
static char *
DtPciPathToBuffer (
char *PciPath)
DtNormalizeBuffer (
char *Buffer,
UINT32 *Count)
{
char *Buffer;
char *NewBuffer;
char *TmpBuffer;
UINT32 BufferCount = 0;
BOOLEAN Separator = TRUE;
char c;
 
 
Buffer = UtLocalCalloc (6);
NewBuffer = UtLocalCalloc (ACPI_STRLEN (Buffer) + 1);
TmpBuffer = NewBuffer;
 
Buffer[0] = PciPath[1];
Buffer[1] = PciPath[2];
Buffer[2] = ' ';
Buffer[3] = PciPath[5];
Buffer[4] = PciPath[6];
while ((c = *Buffer++))
{
switch (c)
{
/* Valid separators */
 
return (Buffer);
case '[':
case ']':
case ' ':
case ',':
Separator = TRUE;
break;
 
default:
if (Separator)
{
/* Insert blank as the standard separator */
 
if (NewBuffer[0])
{
*TmpBuffer++ = ' ';
BufferCount++;
}
 
Separator = FALSE;
}
 
*TmpBuffer++ = c;
break;
}
}
 
*Count = BufferCount + 1;
return (NewBuffer);
}
 
 
/******************************************************************************
*
* FUNCTION: DtCompileBuffer
407,14 → 511,18
UINT32 Count;
 
 
Count = ACPI_STRLEN (StringValue) / 3 + 1;
/* Allow several different types of value separators */
 
StringValue = DtNormalizeBuffer (StringValue, &Count);
 
Hex[2] = 0;
for (i = 0; i < Count; i++)
{
Hex[0] = StringValue[0];
Hex[1] = StringValue[1];
/* Each element of StringValue is three chars */
 
Hex[0] = StringValue[(3 * i)];
Hex[1] = StringValue[(3 * i) + 1];
 
/* Convert one hex byte */
 
Value = 0;
426,9 → 534,9
}
 
Buffer[i] = (UINT8) Value;
StringValue += 3;
}
 
ACPI_FREE (StringValue);
return (ByteLength - Count);
}
 
435,61 → 543,27
 
/******************************************************************************
*
* FUNCTION: DtCompilePciPath
*
* PARAMETERS: Buffer - Output buffer
* StringValue - DMAR pci path string
* ByteLength - Byte length of DMAR pci path string, 2
*
* RETURN: None
*
* DESCRIPTION: Compile DMAR PCI path string to binary
*
*****************************************************************************/
 
static void
DtCompilePciPath (
UINT8 *Buffer,
char *StringValue,
DT_FIELD *Field,
UINT32 ByteLength)
{
char *PciPathBuffer;
 
 
/* Parse path to simple hex digits, then convert to binary */
 
PciPathBuffer = DtPciPathToBuffer (StringValue);
 
DtCompileBuffer (Buffer, PciPathBuffer, Field, ByteLength);
ACPI_FREE (PciPathBuffer);
}
 
 
/******************************************************************************
*
* FUNCTION: DtCompileFlag
*
* PARAMETERS: Buffer - Output buffer
* Field - Field to be compiled
* Info - Flag info
* BitPosition - Flag bit position
*
* RETURN: Next flag bit position
* RETURN:
*
* DESCRIPTION: Compile a flag
*
*****************************************************************************/
 
UINT32
void
DtCompileFlag (
UINT8 *Buffer,
DT_FIELD *Field,
ACPI_DMTABLE_INFO *Info,
UINT32 BitPosition)
ACPI_DMTABLE_INFO *Info)
{
UINT64 Value = 0;
UINT32 BitLength = 1;
UINT8 BitPosition = 0;
ACPI_STATUS Status;
 
 
510,12 → 584,20
case ACPI_DMT_FLAG6:
case ACPI_DMT_FLAG7:
 
BitPosition = Info->Opcode;
BitLength = 1;
break;
 
case ACPI_DMT_FLAGS0:
 
BitPosition = 0;
BitLength = 2;
break;
 
 
case ACPI_DMT_FLAGS2:
 
BitPosition = 2;
BitLength = 2;
break;
 
534,10 → 616,5
Value = 0;
}
 
/* Insert the flag, return next flag bit position */
 
Buffer += ACPI_DIV_8 (BitPosition);
*Buffer |= (UINT8) (Value << ACPI_MOD_8 (BitPosition));
 
return (BitPosition + BitLength);
*Buffer |= (UINT8) (Value << BitPosition);
}
/drivers/devman/acpica/compiler/dtio.c
8,7 → 8,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
122,35 → 122,53
ACPI_MODULE_NAME ("dtio")
 
 
/******************************************************************************
*
* FUNCTION: DtIsComment
*
* PARAMETERS: Line - Current source code line
*
* RETURN: TRUE if comment, FALSE otherwise
*
* DESCRIPTION: Detect a comment in the source module
*
*****************************************************************************/
/* Local prototypes */
 
/* TBD: Temporary: very simple code to detect comments */
static char *
DtTrim (
char *String);
 
static int
DtIsComment(
char *Line)
{
static void
DtLinkField (
DT_FIELD *Field);
 
if (!ACPI_STRNCMP (Line, "/*", 2) ||
!ACPI_STRNCMP (Line, " *", 2))
{
return 1;
}
static ACPI_STATUS
DtParseLine (
char *LineBuffer,
UINT32 Line,
UINT32 Offset);
 
return 0;
}
UINT32
DtGetNextLine (
FILE *Handle);
 
static void
DtWriteBinary (
DT_SUBTABLE *Subtable,
void *Context,
void *ReturnValue);
 
static void
DtDumpBuffer (
UINT32 FileId,
UINT8 *Buffer,
UINT32 Offset,
UINT32 Length);
 
 
/* States for DtGetNextLine */
 
#define DT_NORMAL_TEXT 0
#define DT_START_QUOTED_STRING 1
#define DT_START_COMMENT 2
#define DT_SLASH_ASTERISK_COMMENT 3
#define DT_SLASH_SLASH_COMMENT 4
#define DT_END_COMMENT 5
#define DT_MERGE_LINES 6
 
static UINT32 Gbl_NextLineOffset;
 
 
/******************************************************************************
*
* FUNCTION: DtTrim
283,13 → 301,13
* Line - Current line number in the source
* Offset - Current byte offset of the line
*
* RETURN: None
* RETURN: Status
*
* DESCRIPTION: Parse one source line
*
*****************************************************************************/
 
static void
static ACPI_STATUS
DtParseLine (
char *LineBuffer,
UINT32 Line,
306,17 → 324,25
DT_FIELD *Field;
UINT32 Column;
UINT32 NameColumn;
BOOLEAN IsNullString = FALSE;
 
 
if (!LineBuffer || DtIsComment (LineBuffer))
if (!LineBuffer)
{
return;
return (AE_OK);
}
 
/* All lines after "Raw Table Data" are ingored */
 
if (strstr (LineBuffer, ACPI_RAW_TABLE_DATA_HEADER))
{
return (AE_NOT_FOUND);
}
 
Colon = strchr (LineBuffer, ':');
if (!Colon || *(Colon - 1) != ' ')
if (!Colon)
{
return;
return (AE_OK);
}
 
Start = LineBuffer;
341,7 → 367,6
 
if (Start == Colon)
{
MYDEBUG ("ERROR: right bracket reaches colon position\n");
break;
}
 
367,7 → 392,6
ACPI_FREE (TmpName);
 
Start = End = (Colon + 1);
 
while (*End)
{
/* Found left quotation, go to the right quotation and break */
375,8 → 399,15
if (*End == '"')
{
End++;
while (*End && *End != '"')
 
/* Check for an explicit null string */
 
if (*End == '"')
{
IsNullString = TRUE;
}
while (*End && (*End != '"'))
{
End++;
}
 
384,23 → 415,32
break;
}
 
if (*End == '(' ||
*End == '<' ||
*End == '/')
/*
* Special "comment" fields at line end, ignore them.
* Note: normal slash-slash and slash-asterisk comments are
* stripped already by the DtGetNextLine parser.
*
* TBD: Perhaps DtGetNextLine should parse the following type
* of comments also.
*/
if (*End == '[')
{
End--;
break;
}
 
End++;
}
 
Length = ACPI_PTR_DIFF (End, Start);
TmpValue = UtLocalCalloc (Length + 1);
 
ACPI_STRNCPY (TmpValue, Start, Length);
Value = DtTrim (TmpValue);
ACPI_FREE (TmpValue);
 
if (Name && Value)
/* Create a new field object only if we have a valid value field */
 
if ((Value && *Value) || IsNullString)
{
Field = UtLocalCalloc (sizeof (DT_FIELD));
Field->Name = Name;
412,11 → 452,266
 
DtLinkField (Field);
}
else /* Ignore this field, it has no valid data */
{
ACPI_FREE (Name);
ACPI_FREE (Value);
}
 
return (AE_OK);
}
 
 
/******************************************************************************
*
* FUNCTION: DtGetNextLine
*
* PARAMETERS: Handle - Open file handle for the source file
*
* RETURN: Filled line buffer and offset of start-of-line (ASL_EOF on EOF)
*
* DESCRIPTION: Get the next valid source line. Removes all comments.
* Ignores empty lines.
*
* Handles both slash-asterisk and slash-slash comments.
* Also, quoted strings, but no escapes within.
*
* Line is returned in Gbl_CurrentLineBuffer.
* Line number in original file is returned in Gbl_CurrentLineNumber.
*
*****************************************************************************/
 
UINT32
DtGetNextLine (
FILE *Handle)
{
BOOLEAN LineNotAllBlanks = FALSE;
UINT32 State = DT_NORMAL_TEXT;
UINT32 CurrentLineOffset;
UINT32 i;
char c;
 
 
for (i = 0; i < ASL_LINE_BUFFER_SIZE;)
{
c = (char) getc (Handle);
if (c == EOF)
{
switch (State)
{
case DT_START_QUOTED_STRING:
case DT_SLASH_ASTERISK_COMMENT:
case DT_SLASH_SLASH_COMMENT:
 
AcpiOsPrintf ("**** EOF within comment/string %u\n", State);
break;
 
default:
break;
}
 
return (ASL_EOF);
}
 
switch (State)
{
case DT_NORMAL_TEXT:
 
/* Normal text, insert char into line buffer */
 
Gbl_CurrentLineBuffer[i] = c;
switch (c)
{
case '/':
State = DT_START_COMMENT;
break;
 
case '"':
State = DT_START_QUOTED_STRING;
LineNotAllBlanks = TRUE;
i++;
break;
 
case '\\':
/*
* The continuation char MUST be last char on this line.
* Otherwise, it will be assumed to be a valid ASL char.
*/
State = DT_MERGE_LINES;
break;
 
case '\n':
CurrentLineOffset = Gbl_NextLineOffset;
Gbl_NextLineOffset = (UINT32) ftell (Handle);
Gbl_CurrentLineNumber++;
 
/*
* Exit if line is complete. Ignore empty lines (only \n)
* or lines that contain nothing but blanks.
*/
if ((i != 0) && LineNotAllBlanks)
{
Gbl_CurrentLineBuffer[i+1] = 0; /* Terminate string */
return (CurrentLineOffset);
}
 
/* Toss this line and start a new one */
 
i = 0;
LineNotAllBlanks = FALSE;
break;
 
default:
if (c != ' ')
{
LineNotAllBlanks = TRUE;
}
 
i++;
break;
}
break;
 
case DT_START_QUOTED_STRING:
 
/* Insert raw chars until end of quoted string */
 
Gbl_CurrentLineBuffer[i] = c;
i++;
 
if (c == '"')
{
State = DT_NORMAL_TEXT;
}
break;
 
case DT_START_COMMENT:
 
/* Open comment if this character is an asterisk or slash */
 
switch (c)
{
case '*':
State = DT_SLASH_ASTERISK_COMMENT;
break;
 
case '/':
State = DT_SLASH_SLASH_COMMENT;
break;
 
default: /* Not a comment */
i++; /* Save the preceeding slash */
Gbl_CurrentLineBuffer[i] = c;
i++;
State = DT_NORMAL_TEXT;
break;
}
break;
 
case DT_SLASH_ASTERISK_COMMENT:
 
/* Ignore chars until an asterisk-slash is found */
 
switch (c)
{
case '\n':
Gbl_NextLineOffset = (UINT32) ftell (Handle);
Gbl_CurrentLineNumber++;
break;
 
case '*':
State = DT_END_COMMENT;
break;
 
default:
break;
}
break;
 
case DT_SLASH_SLASH_COMMENT:
 
/* Ignore chars until end-of-line */
 
if (c == '\n')
{
/* We will exit via the NORMAL_TEXT path */
 
ungetc (c, Handle);
State = DT_NORMAL_TEXT;
}
break;
 
case DT_END_COMMENT:
 
/* End comment if this char is a slash */
 
switch (c)
{
case '/':
State = DT_NORMAL_TEXT;
break;
 
case '\n':
CurrentLineOffset = Gbl_NextLineOffset;
Gbl_NextLineOffset = (UINT32) ftell (Handle);
Gbl_CurrentLineNumber++;
break;
 
case '*':
/* Consume all adjacent asterisks */
break;
 
default:
State = DT_SLASH_ASTERISK_COMMENT;
break;
}
break;
 
case DT_MERGE_LINES:
 
if (c != '\n')
{
/*
* This is not a continuation backslash, it is a normal
* normal ASL backslash - for example: Scope(\_SB_)
*/
i++; /* Keep the backslash that is already in the buffer */
 
ungetc (c, Handle);
State = DT_NORMAL_TEXT;
}
else
{
/*
* This is a continuation line -- a backlash followed
* immediately by a newline. Insert a space between the
* lines (overwrite the backslash)
*/
Gbl_CurrentLineBuffer[i] = ' ';
i++;
 
/* Ignore newline, this will merge the lines */
 
CurrentLineOffset = Gbl_NextLineOffset;
Gbl_NextLineOffset = (UINT32) ftell (Handle);
Gbl_CurrentLineNumber++;
State = DT_NORMAL_TEXT;
}
break;
 
default:
DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, "Unknown input state");
return (ASL_EOF);
}
}
 
printf ("ERROR - Input line is too long (max %u)\n", ASL_LINE_BUFFER_SIZE);
return (ASL_EOF);
}
 
 
/******************************************************************************
*
* FUNCTION: DtScanFile
*
* PARAMETERS: Handle - Open file handle for the source file
423,7 → 718,7
*
* RETURN: Pointer to start of the constructed parse tree.
*
* DESCRIPTION: Scan source file, link all field name and value
* DESCRIPTION: Scan source file, link all field names and values
* to the global parse tree: Gbl_FieldList
*
*****************************************************************************/
432,25 → 727,60
DtScanFile (
FILE *Handle)
{
UINT32 Line = 0;
UINT32 Offset = 0;
ACPI_STATUS Status;
UINT32 Offset;
DT_FIELD *Next;
 
 
ACPI_FUNCTION_NAME (DtScanFile);
 
 
/* Get the file size */
 
Gbl_InputByteCount = DtGetFileSize (Handle);
 
Gbl_CurrentLineNumber = 0;
Gbl_CurrentLineOffset = 0;
Gbl_NextLineOffset = 0;
 
/* Scan line-by-line */
 
while (fgets (Gbl_CurrentLineBuffer, ASL_LINE_BUFFER_SIZE, Handle))
while ((Offset = DtGetNextLine (Handle)) != ASL_EOF)
{
Line++;
Gbl_CurrentLineNumber++;
DtParseLine (Gbl_CurrentLineBuffer, Line, Offset);
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Line %2.2u/%4.4X - %s",
Gbl_CurrentLineNumber, Offset, Gbl_CurrentLineBuffer));
 
Offset = (UINT32) ftell (Handle);
Status = DtParseLine (Gbl_CurrentLineBuffer, Gbl_CurrentLineNumber, Offset);
if (Status == AE_NOT_FOUND)
{
break;
}
}
 
/* Dump the parse tree if debug enabled */
 
if (Gbl_DebugFlag)
{
Next = Gbl_FieldList;
DbgPrint (ASL_DEBUG_OUTPUT, "Tree: %32s %32s %8s %8s %8s %8s %8s %8s\n\n",
"Name", "Value", "Line", "ByteOff", "NameCol", "Column", "TableOff", "Flags");
 
while (Next)
{
DbgPrint (ASL_DEBUG_OUTPUT, "Field: %32.32s %32.32s %.8X %.8X %.8X %.8X %.8X %.8X\n",
Next->Name,
Next->Value,
Next->Line,
Next->ByteOffset,
Next->NameColumn,
Next->Column,
Next->TableOffset,
Next->Flags);
 
Next = Next->Next;
}
}
 
return (Gbl_FieldList);
}
 
459,7 → 789,6
* Output functions
*/
 
 
/******************************************************************************
*
* FUNCTION: DtWriteBinary
510,3 → 839,197
DtWalkTableTree (RootTable, DtWriteBinary, NULL, NULL);
Gbl_TableLength = DtGetFileSize (Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
}
 
 
/*
* Listing support
*/
 
/******************************************************************************
*
* FUNCTION: DtDumpBuffer
*
* PARAMETERS: FileID - Where to write buffer data
* Buffer - Buffer to dump
* Offset - Offset in current table
* Length - Buffer Length
*
* RETURN: None
*
* DESCRIPTION: Another copy of DumpBuffer routine (unfortunately).
*
* TBD: merge dump buffer routines
*
*****************************************************************************/
 
static void
DtDumpBuffer (
UINT32 FileId,
UINT8 *Buffer,
UINT32 Offset,
UINT32 Length)
{
UINT32 i;
UINT32 j;
UINT8 BufChar;
 
 
FlPrintFile (FileId, "Output: [%3.3Xh %4.4d %3d] ",
Offset, Offset, Length);
 
i = 0;
while (i < Length)
{
if (i >= 16)
{
FlPrintFile (FileId, "%24s", "");
}
 
/* Print 16 hex chars */
 
for (j = 0; j < 16;)
{
if (i + j >= Length)
{
/* Dump fill spaces */
 
FlPrintFile (FileId, " ");
j++;
continue;
}
 
FlPrintFile (FileId, "%02X ", Buffer[i+j]);
j++;
}
 
FlPrintFile (FileId, " ");
for (j = 0; j < 16; j++)
{
if (i + j >= Length)
{
FlPrintFile (FileId, "\n\n");
return;
}
 
BufChar = Buffer[(ACPI_SIZE) i + j];
if (ACPI_IS_PRINT (BufChar))
{
FlPrintFile (FileId, "%c", BufChar);
}
else
{
FlPrintFile (FileId, ".");
}
}
 
/* Done with that line. */
 
FlPrintFile (FileId, "\n");
i += 16;
}
 
FlPrintFile (FileId, "\n\n");
}
 
 
/******************************************************************************
*
* FUNCTION: DtWriteFieldToListing
*
* PARAMETERS: Buffer - Contains the compiled data
* Field - Field node for the input line
* Length - Length of the output data
*
* RETURN: None
*
* DESCRIPTION: Write one field to the listing file (if listing is enabled).
*
*****************************************************************************/
 
void
DtWriteFieldToListing (
UINT8 *Buffer,
DT_FIELD *Field,
UINT32 Length)
{
UINT8 FileByte;
 
 
if (!Gbl_ListingFlag || !Field)
{
return;
}
 
/* Dump the original source line */
 
FlPrintFile (ASL_FILE_LISTING_OUTPUT, "Input: ");
FlSeekFile (ASL_FILE_INPUT, Field->ByteOffset);
 
while (FlReadFile (ASL_FILE_INPUT, &FileByte, 1) == AE_OK)
{
FlWriteFile (ASL_FILE_LISTING_OUTPUT, &FileByte, 1);
if (FileByte == '\n')
{
break;
}
}
 
/* Dump the line as parsed and represented internally */
 
FlPrintFile (ASL_FILE_LISTING_OUTPUT, "Parsed: %*s : %.64s",
Field->Column-4, Field->Name, Field->Value);
 
if (strlen (Field->Value) > 64)
{
FlPrintFile (ASL_FILE_LISTING_OUTPUT, "...Additional data, length 0x%X\n",
strlen (Field->Value));
}
FlPrintFile (ASL_FILE_LISTING_OUTPUT, "\n");
 
/* Dump the hex data that will be output for this field */
 
DtDumpBuffer (ASL_FILE_LISTING_OUTPUT, Buffer, Field->TableOffset, Length);
}
 
 
/******************************************************************************
*
* FUNCTION: DtWriteTableToListing
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Write the entire compiled table to the listing file
* in hex format
*
*****************************************************************************/
 
void
DtWriteTableToListing (
void)
{
UINT8 *Buffer;
 
 
if (!Gbl_ListingFlag)
{
return;
}
 
/* Read the entire table from the output file */
 
Buffer = UtLocalCalloc (Gbl_TableLength);
FlSeekFile (ASL_FILE_AML_OUTPUT, 0);
FlReadFile (ASL_FILE_AML_OUTPUT, Buffer, Gbl_TableLength);
 
/* Dump the raw table data */
 
AcpiOsRedirectOutput (Gbl_Files[ASL_FILE_LISTING_OUTPUT].Handle);
 
AcpiOsPrintf ("\n%s: Length %d (0x%X)\n\n",
ACPI_RAW_TABLE_DATA_HEADER, Gbl_TableLength, Gbl_TableLength);
AcpiUtDumpBuffer2 (Buffer, Gbl_TableLength, DB_BYTE_DISPLAY);
 
AcpiOsRedirectOutput (stdout);
}
/drivers/devman/acpica/compiler/dtparser.l
0,0 → 1,205
%{
/******************************************************************************
*
* Module Name: dtparser.l - Flex input file for table compiler lexer
*
*****************************************************************************/
 
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
* rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
* copy of the source code appearing in this file ("Covered Code") an
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
* base code distributed originally by Intel ("Original Intel Code") to copy,
* make derivatives, distribute, use and display any portion of the Covered
* Code in any form, with the right to sublicense such rights; and
*
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
* license (with the right to sublicense), under only those claims of Intel
* patents that are infringed by the Original Intel Code, to make, use, sell,
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
* to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
* documentation and/or other materials provided with distribution. In
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* property embodied in the software Licensee provides to its licensee, and
* not to intellectual property embodied in modifications its licensee may
* make.
*
* 3.3. Redistribution of Executable. Redistribution in executable form of any
* substantial portion of the Covered Code or modification must reproduce the
* above Copyright Notice, and the following Disclaimer and Export Compliance
* provision in the documentation and/or other materials provided with the
* distribution.
*
* 3.4. Intel retains all right, title, and interest in and to the Original
* Intel Code.
*
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
* Intel shall be used in advertising or otherwise to promote the sale, use or
* other dealings in products derived from or relating to the Covered Code
* without prior written authorization from Intel.
*
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
* any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* ensure that the distribution and export/re-export of the software is in
* compliance with all laws, regulations, orders, or other restrictions of the
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
* any of its subsidiaries will export/re-export any technical data, process,
* software, or service, directly or indirectly, to any country for which the
* United States government or any agency thereof requires an export license,
* other governmental approval, or letter of assurance, without first obtaining
* such license, approval or letter.
*
*****************************************************************************/
 
#include "aslcompiler.h"
#include "dtparser.y.h"
 
#define YY_NO_INPUT /* No file input, we use strings only */
 
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("dtscanner")
%}
 
%option noyywrap
%option nounput
 
Number [0-9a-fA-F]+
HexNumber 0[xX][0-9a-fA-F]+
DecimalNumber 0[dD][0-9]+
LabelRef $[a-zA-Z][0-9a-zA-Z]*
WhiteSpace [ \t\v\r]+
NewLine [\n]
 
%%
 
\( return (EXPOP_PAREN_OPEN);
\) return (EXPOP_PAREN_CLOSE);
\~ return (EXPOP_ONES_COMPLIMENT);
\! return (EXPOP_LOGICAL_NOT);
\* return (EXPOP_MULTIPLY);
\/ return (EXPOP_DIVIDE);
\% return (EXPOP_MODULO);
\+ return (EXPOP_ADD);
\- return (EXPOP_SUBTRACT);
">>" return (EXPOP_SHIFT_RIGHT);
"<<" return (EXPOP_SHIFT_LEFT);
\< return (EXPOP_LESS);
\> return (EXPOP_GREATER);
"<=" return (EXPOP_LESS_EQUAL);
">=" return (EXPOP_GREATER_EQUAL);
"==" return (EXPOP_EQUAL);
"!=" return (EXPOP_NOT_EQUAL);
\& return (EXPOP_AND);
\^ return (EXPOP_XOR);
\| return (EXPOP_OR);
"&&" return (EXPOP_LOGICAL_AND);
"||" return (EXPOP_LOGICAL_OR);
<<EOF>> return (EXPOP_EOF); /* null end-of-string */
 
{LabelRef} return (EXPOP_LABEL);
{Number} return (EXPOP_NUMBER);
{HexNumber} return (EXPOP_HEX_NUMBER);
{NewLine} return (EXPOP_NEW_LINE);
{WhiteSpace} /* Ignore */
 
. return (EXPOP_EOF);
 
%%
 
/*
* Local support functions
*/
YY_BUFFER_STATE LexBuffer;
 
/******************************************************************************
*
* FUNCTION: DtInitLexer, DtTerminateLexer
*
* PARAMETERS: String - Input string to be parsed
*
* RETURN: None
*
* DESCRIPTION: Initialization and termination routines for lexer. Lexer needs
* a buffer to handle strings instead of a file.
*
*****************************************************************************/
 
int
DtInitLexer (
char *String)
{
 
LexBuffer = yy_scan_string (String);
return (LexBuffer == NULL);
}
 
void
DtTerminateLexer (
void)
{
 
yy_delete_buffer (LexBuffer);
}
/drivers/devman/acpica/compiler/dtparser.y
0,0 → 1,345
%{
/******************************************************************************
*
* Module Name: dtparser.y - Bison input file for table compiler parser
*
*****************************************************************************/
 
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
* rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
* copy of the source code appearing in this file ("Covered Code") an
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
* base code distributed originally by Intel ("Original Intel Code") to copy,
* make derivatives, distribute, use and display any portion of the Covered
* Code in any form, with the right to sublicense such rights; and
*
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
* license (with the right to sublicense), under only those claims of Intel
* patents that are infringed by the Original Intel Code, to make, use, sell,
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
* to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
* documentation and/or other materials provided with distribution. In
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* property embodied in the software Licensee provides to its licensee, and
* not to intellectual property embodied in modifications its licensee may
* make.
*
* 3.3. Redistribution of Executable. Redistribution in executable form of any
* substantial portion of the Covered Code or modification must reproduce the
* above Copyright Notice, and the following Disclaimer and Export Compliance
* provision in the documentation and/or other materials provided with the
* distribution.
*
* 3.4. Intel retains all right, title, and interest in and to the Original
* Intel Code.
*
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
* Intel shall be used in advertising or otherwise to promote the sale, use or
* other dealings in products derived from or relating to the Covered Code
* without prior written authorization from Intel.
*
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
* any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* ensure that the distribution and export/re-export of the software is in
* compliance with all laws, regulations, orders, or other restrictions of the
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
* any of its subsidiaries will export/re-export any technical data, process,
* software, or service, directly or indirectly, to any country for which the
* United States government or any agency thereof requires an export license,
* other governmental approval, or letter of assurance, without first obtaining
* such license, approval or letter.
*
*****************************************************************************/
 
#include "aslcompiler.h"
#include "dtcompiler.h"
 
#define _COMPONENT DT_COMPILER
ACPI_MODULE_NAME ("dtparser")
 
int DtParserlex (void);
int DtParserparse (void);
void DtParsererror (char const *msg);
extern char *DtParsertext;
extern DT_FIELD *Gbl_CurrentField;
 
UINT64 DtParserResult; /* Expression return value */
 
/* Bison/yacc configuration */
 
#define yytname DtParsername
#define YYDEBUG 1 /* Enable debug output */
#define YYERROR_VERBOSE 1 /* Verbose error messages */
#define YYFLAG -32768
 
%}
 
%union
{
UINT64 value;
UINT32 op;
}
 
/*! [Begin] no source code translation */
 
%type <value> Expression
 
%token <op> EXPOP_EOF
%token <op> EXPOP_NEW_LINE
%token <op> EXPOP_NUMBER
%token <op> EXPOP_HEX_NUMBER
%token <op> EXPOP_DECIMAL_NUMBER
%token <op> EXPOP_LABEL
%token <op> EXPOP_PAREN_OPEN
%token <op> EXPOP_PAREN_CLOSE
 
%left <op> EXPOP_LOGICAL_OR
%left <op> EXPOP_LOGICAL_AND
%left <op> EXPOP_OR
%left <op> EXPOP_XOR
%left <op> EXPOP_AND
%left <op> EXPOP_EQUAL EXPOP_NOT_EQUAL
%left <op> EXPOP_GREATER EXPOP_LESS EXPOP_GREATER_EQUAL EXPOP_LESS_EQUAL
%left <op> EXPOP_SHIFT_RIGHT EXPOP_SHIFT_LEFT
%left <op> EXPOP_ADD EXPOP_SUBTRACT
%left <op> EXPOP_MULTIPLY EXPOP_DIVIDE EXPOP_MODULO
%right <op> EXPOP_ONES_COMPLIMENT EXPOP_LOGICAL_NOT
 
%%
 
/*
* Operator precedence rules (from K&R)
*
* 1) ( )
* 2) ! ~ (unary operators that are supported here)
* 3) * / %
* 4) + -
* 5) >> <<
* 6) < > <= >=
* 7) == !=
* 8) &
* 9) ^
* 10) |
* 11) &&
* 12) ||
*/
Value
: Expression EXPOP_NEW_LINE { DtParserResult=$1; return 0; } /* End of line (newline) */
| Expression EXPOP_EOF { DtParserResult=$1; return 0; } /* End of string (0) */
;
 
Expression
 
/* Unary operators */
 
: EXPOP_LOGICAL_NOT Expression { $$ = DtDoOperator ($2, EXPOP_LOGICAL_NOT, $2);}
| EXPOP_ONES_COMPLIMENT Expression { $$ = DtDoOperator ($2, EXPOP_ONES_COMPLIMENT, $2);}
 
/* Binary operators */
 
| Expression EXPOP_MULTIPLY Expression { $$ = DtDoOperator ($1, EXPOP_MULTIPLY, $3);}
| Expression EXPOP_DIVIDE Expression { $$ = DtDoOperator ($1, EXPOP_DIVIDE, $3);}
| Expression EXPOP_MODULO Expression { $$ = DtDoOperator ($1, EXPOP_MODULO, $3);}
| Expression EXPOP_ADD Expression { $$ = DtDoOperator ($1, EXPOP_ADD, $3);}
| Expression EXPOP_SUBTRACT Expression { $$ = DtDoOperator ($1, EXPOP_SUBTRACT, $3);}
| Expression EXPOP_SHIFT_RIGHT Expression { $$ = DtDoOperator ($1, EXPOP_SHIFT_RIGHT, $3);}
| Expression EXPOP_SHIFT_LEFT Expression { $$ = DtDoOperator ($1, EXPOP_SHIFT_LEFT, $3);}
| Expression EXPOP_GREATER Expression { $$ = DtDoOperator ($1, EXPOP_GREATER, $3);}
| Expression EXPOP_LESS Expression { $$ = DtDoOperator ($1, EXPOP_LESS, $3);}
| Expression EXPOP_GREATER_EQUAL Expression { $$ = DtDoOperator ($1, EXPOP_GREATER_EQUAL, $3);}
| Expression EXPOP_LESS_EQUAL Expression { $$ = DtDoOperator ($1, EXPOP_LESS_EQUAL, $3);}
| Expression EXPOP_EQUAL Expression { $$ = DtDoOperator ($1, EXPOP_EQUAL, $3);}
| Expression EXPOP_NOT_EQUAL Expression { $$ = DtDoOperator ($1, EXPOP_NOT_EQUAL, $3);}
| Expression EXPOP_AND Expression { $$ = DtDoOperator ($1, EXPOP_AND, $3);}
| Expression EXPOP_XOR Expression { $$ = DtDoOperator ($1, EXPOP_XOR, $3);}
| Expression EXPOP_OR Expression { $$ = DtDoOperator ($1, EXPOP_OR, $3);}
| Expression EXPOP_LOGICAL_AND Expression { $$ = DtDoOperator ($1, EXPOP_LOGICAL_AND, $3);}
| Expression EXPOP_LOGICAL_OR Expression { $$ = DtDoOperator ($1, EXPOP_LOGICAL_OR, $3);}
 
/* Parentheses: '(' Expression ')' */
 
| EXPOP_PAREN_OPEN Expression
EXPOP_PAREN_CLOSE { $$ = $2;}
 
/* Label references (prefixed with $) */
 
| EXPOP_LABEL { $$ = DtResolveLabel (DtParsertext);}
 
/* Default base for a non-prefixed integer is 16 */
 
| EXPOP_NUMBER { UtStrtoul64 (DtParsertext, 16, &$$);}
 
/* Standard hex number (0x1234) */
 
| EXPOP_HEX_NUMBER { UtStrtoul64 (DtParsertext, 16, &$$);}
 
/* TBD: Decimal number with prefix (0d1234) - Not supported by UtStrtoul64 at this time */
 
| EXPOP_DECIMAL_NUMBER { UtStrtoul64 (DtParsertext, 10, &$$);}
;
%%
 
/*! [End] no source code translation !*/
 
/*
* Local support functions, including parser entry point
*/
#define PR_FIRST_PARSE_OPCODE EXPOP_EOF
#define PR_YYTNAME_START 3
 
 
/******************************************************************************
*
* FUNCTION: DtParsererror
*
* PARAMETERS: Message - Parser-generated error message
*
* RETURN: None
*
* DESCRIPTION: Handler for parser errors
*
*****************************************************************************/
 
void
DtParsererror (
char const *Message)
{
DtError (ASL_ERROR, ASL_MSG_SYNTAX,
Gbl_CurrentField, (char *) Message);
}
 
 
/******************************************************************************
*
* FUNCTION: DtGetOpName
*
* PARAMETERS: ParseOpcode - Parser token (EXPOP_*)
*
* RETURN: Pointer to the opcode name
*
* DESCRIPTION: Get the ascii name of the parse opcode for debug output
*
*****************************************************************************/
 
char *
DtGetOpName (
UINT32 ParseOpcode)
{
#ifdef ASL_YYTNAME_START
/*
* First entries (PR_YYTNAME_START) in yytname are special reserved names.
* Ignore first 6 characters of name (EXPOP_)
*/
return ((char *) yytname
[(ParseOpcode - PR_FIRST_PARSE_OPCODE) + PR_YYTNAME_START] + 6);
#else
return ("[Unknown parser generator]");
#endif
}
 
 
/******************************************************************************
*
* FUNCTION: DtEvaluateExpression
*
* PARAMETERS: ExprString - Expression to be evaluated. Must be
* terminated by either a newline or a NUL
* string terminator
*
* RETURN: 64-bit value for the expression
*
* DESCRIPTION: Main entry point for the DT expression parser
*
*****************************************************************************/
 
UINT64
DtEvaluateExpression (
char *ExprString)
{
 
DbgPrint (ASL_DEBUG_OUTPUT,
"**** Input expression: %s (Base 16)\n", ExprString);
 
/* Point lexer to the input string */
 
if (DtInitLexer (ExprString))
{
DtError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL,
Gbl_CurrentField, "Could not initialize lexer");
return (0);
}
 
/* Parse/Evaluate the input string (value returned in DtParserResult) */
 
DtParserparse ();
DtTerminateLexer ();
 
DbgPrint (ASL_DEBUG_OUTPUT,
"**** Parser returned value: %u (%8.8X%8.8X)\n",
(UINT32) DtParserResult, ACPI_FORMAT_UINT64 (DtParserResult));
 
return (DtParserResult);
}
/drivers/devman/acpica/compiler/dtsubtable.c
8,7 → 8,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
360,6 → 360,8
ACPI_DMTABLE_INFO *Info)
{
UINT32 ByteLength = 0;
UINT8 Step;
UINT8 i;
 
 
/* Walk entire Info table; Null name terminates */
366,13 → 368,53
 
for (; Info->Name; Info++)
{
if (!Field)
{
goto Error;
}
 
ByteLength += DtGetFieldLength (Field, Info);
 
switch (Info->Opcode)
{
case ACPI_DMT_GAS:
Step = 5;
break;
 
case ACPI_DMT_HESTNTFY:
Step = 9;
break;
 
default:
Step = 1;
break;
}
 
for (i = 0; i < Step; i++)
{
if (!Field)
{
goto Error;
}
 
Field = Field->Next;
}
}
 
return (ByteLength);
 
Error:
if (!Field)
{
sprintf (MsgBuffer, "Found NULL field - Field name \"%s\" needed",
Info->Name);
DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, MsgBuffer);
}
 
return (ASL_EOF);
}
 
 
/******************************************************************************
*
* FUNCTION: DtSetSubtableLength
/drivers/devman/acpica/compiler/dttable.c
8,7 → 8,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
264,10 → 264,13
DT_FIELD **PFieldList)
{
DT_SUBTABLE *Subtable;
ACPI_TABLE_RSDP *Table;
ACPI_TABLE_RSDP *Rsdp;
ACPI_RSDP_EXTENSION *RsdpExtension;
ACPI_STATUS Status;
 
 
/* Compile the "common" RSDP (ACPI 1.0) */
 
Status = DtCompileTable (PFieldList, AcpiDmTableInfoRsdp1,
&Gbl_RootTable, TRUE);
if (ACPI_FAILURE (Status))
275,11 → 278,13
return (Status);
}
 
Table = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Gbl_RootTable->Buffer);
DtSetTableChecksum (&Table->Checksum);
Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Gbl_RootTable->Buffer);
DtSetTableChecksum (&Rsdp->Checksum);
 
if (Table->Revision > 0)
if (Rsdp->Revision > 0)
{
/* Compile the "extended" part of the RSDP as a subtable */
 
Status = DtCompileTable (PFieldList, AcpiDmTableInfoRsdp2,
&Subtable, TRUE);
if (ACPI_FAILURE (Status))
288,7 → 293,12
}
 
DtInsertSubtable (Gbl_RootTable, Subtable);
DtSetTableChecksum (&Table->ExtendedChecksum);
 
/* Set length and extended checksum for entire RSDP */
 
RsdpExtension = ACPI_CAST_PTR (ACPI_RSDP_EXTENSION, Subtable->Buffer);
RsdpExtension->Length = Gbl_RootTable->Length + Subtable->Length;
DtSetTableChecksum (&RsdpExtension->ExtendedChecksum);
}
 
return (AE_OK);
1196,6 → 1206,75
 
/******************************************************************************
*
* FUNCTION: DtCompileSlic
*
* PARAMETERS: List - Current field list pointer
*
* RETURN: Status
*
* DESCRIPTION: Compile SLIC.
*
*****************************************************************************/
 
ACPI_STATUS
DtCompileSlic (
void **List)
{
ACPI_STATUS Status;
DT_SUBTABLE *Subtable;
DT_SUBTABLE *ParentTable;
DT_FIELD **PFieldList = (DT_FIELD **) List;
DT_FIELD *SubtableStart;
ACPI_SLIC_HEADER *SlicHeader;
ACPI_DMTABLE_INFO *InfoTable;
 
 
while (*PFieldList)
{
SubtableStart = *PFieldList;
Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlicHdr,
&Subtable, TRUE);
if (ACPI_FAILURE (Status))
{
return (Status);
}
 
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
DtPushSubtable (Subtable);
 
SlicHeader = ACPI_CAST_PTR (ACPI_SLIC_HEADER, Subtable->Buffer);
 
switch (SlicHeader->Type)
{
case ACPI_SLIC_TYPE_PUBLIC_KEY:
InfoTable = AcpiDmTableInfoSlic0;
break;
case ACPI_SLIC_TYPE_WINDOWS_MARKER:
InfoTable = AcpiDmTableInfoSlic1;
break;
default:
DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "SLIC");
return (AE_ERROR);
}
 
Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
if (ACPI_FAILURE (Status))
{
return (Status);
}
 
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
DtPopSubtable ();
}
 
return (AE_OK);
}
 
 
/******************************************************************************
*
* FUNCTION: DtCompileSlit
*
* PARAMETERS: List - Current field list pointer
1217,7 → 1296,6
DT_FIELD *FieldList;
UINT32 Localities;
UINT8 *LocalityBuffer;
UINT32 RemainingData;
 
 
Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlit,
1233,22 → 1311,17
Localities = *ACPI_CAST_PTR (UINT32, Subtable->Buffer);
LocalityBuffer = UtLocalCalloc (Localities);
 
/* Compile each locality buffer */
 
FieldList = *PFieldList;
while (FieldList)
{
/* Handle multiple-line buffer */
DtCompileBuffer (LocalityBuffer,
FieldList->Value, FieldList, Localities);
 
RemainingData = Localities;
while (RemainingData && FieldList)
{
RemainingData = DtCompileBuffer (
LocalityBuffer + (Localities - RemainingData),
FieldList->Value, FieldList, RemainingData);
FieldList = FieldList->Next;
}
 
DtCreateSubtable (LocalityBuffer, Localities, &Subtable);
DtInsertSubtable (ParentTable, Subtable);
FieldList = FieldList->Next;
}
 
ACPI_FREE (LocalityBuffer);
1340,6 → 1413,102
 
/******************************************************************************
*
* FUNCTION: DtGetGenericTableInfo
*
* PARAMETERS: Name - Generic type name
*
* RETURN: Info entry
*
* DESCRIPTION: Obtain table info for a generic name entry
*
*****************************************************************************/
 
ACPI_DMTABLE_INFO *
DtGetGenericTableInfo (
char *Name)
{
ACPI_DMTABLE_INFO *Info;
UINT32 i;
 
 
if (!Name)
{
return (NULL);
}
 
/* Search info table for name match */
 
for (i = 0; ; i++)
{
Info = AcpiDmTableInfoGeneric[i];
if (Info->Opcode == ACPI_DMT_EXIT)
{
Info = NULL;
break;
}
 
if (!ACPI_STRCMP (Name, Info->Name))
{
break;
}
}
 
return (Info);
}
 
 
/******************************************************************************
*
* FUNCTION: DtCompileUefi
*
* PARAMETERS: List - Current field list pointer
*
* RETURN: Status
*
* DESCRIPTION: Compile UEFI.
*
*****************************************************************************/
 
ACPI_STATUS
DtCompileUefi (
void **List)
{
ACPI_STATUS Status;
DT_SUBTABLE *Subtable;
DT_SUBTABLE *ParentTable;
DT_FIELD **PFieldList = (DT_FIELD **) List;
UINT16 *DataOffset;
 
 
/* Compile the predefined portion of the UEFI table */
 
Status = DtCompileTable (PFieldList, AcpiDmTableInfoUefi,
&Subtable, TRUE);
if (ACPI_FAILURE (Status))
{
return (Status);
}
 
DataOffset = (UINT16 *) (Subtable->Buffer + 16);
*DataOffset = sizeof (ACPI_TABLE_UEFI);
 
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
 
/*
* Compile the "generic" portion of the UEFI table. This
* part of the table is not predefined and any of the generic
* operators may be used.
*/
 
DtCompileGeneric ((void **) PFieldList);
 
return (AE_OK);
}
 
 
/******************************************************************************
*
* FUNCTION: DtCompileWdat
*
* PARAMETERS: List - Current field list pointer
1397,3 → 1566,78
 
return (AE_OK);
}
 
 
/******************************************************************************
*
* FUNCTION: DtCompileGeneric
*
* PARAMETERS: List - Current field list pointer
*
* RETURN: Status
*
* DESCRIPTION: Compile generic unknown table.
*
*****************************************************************************/
 
ACPI_STATUS
DtCompileGeneric (
void **List)
{
ACPI_STATUS Status;
DT_SUBTABLE *Subtable;
DT_SUBTABLE *ParentTable;
DT_FIELD **PFieldList = (DT_FIELD **) List;
ACPI_DMTABLE_INFO *Info;
 
 
ParentTable = DtPeekSubtable ();
 
/*
* Compile the "generic" portion of the table. This
* part of the table is not predefined and any of the generic
* operators may be used.
*/
 
/* Find any and all labels in the entire generic portion */
 
DtDetectAllLabels (*PFieldList);
 
/* Now we can actually compile the parse tree */
 
while (*PFieldList)
{
Info = DtGetGenericTableInfo ((*PFieldList)->Name);
if (!Info)
{
sprintf (MsgBuffer, "Generic data type \"%s\" not found",
(*PFieldList)->Name);
DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
(*PFieldList), MsgBuffer);
 
*PFieldList = (*PFieldList)->Next;
continue;
}
 
Status = DtCompileTable (PFieldList, Info,
&Subtable, TRUE);
if (ACPI_SUCCESS (Status))
{
DtInsertSubtable (ParentTable, Subtable);
}
else
{
*PFieldList = (*PFieldList)->Next;
 
if (Status == AE_NOT_FOUND)
{
sprintf (MsgBuffer, "Generic data type \"%s\" not found",
(*PFieldList)->Name);
DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
(*PFieldList), MsgBuffer);
}
}
}
 
return (AE_OK);
}
/drivers/devman/acpica/compiler/dttemplate.c
0,0 → 1,446
/******************************************************************************
*
* Module Name: dttemplate - ACPI table template generation
*
*****************************************************************************/
 
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
* rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
* copy of the source code appearing in this file ("Covered Code") an
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
* base code distributed originally by Intel ("Original Intel Code") to copy,
* make derivatives, distribute, use and display any portion of the Covered
* Code in any form, with the right to sublicense such rights; and
*
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
* license (with the right to sublicense), under only those claims of Intel
* patents that are infringed by the Original Intel Code, to make, use, sell,
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
* to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
* documentation and/or other materials provided with distribution. In
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* property embodied in the software Licensee provides to its licensee, and
* not to intellectual property embodied in modifications its licensee may
* make.
*
* 3.3. Redistribution of Executable. Redistribution in executable form of any
* substantial portion of the Covered Code or modification must reproduce the
* above Copyright Notice, and the following Disclaimer and Export Compliance
* provision in the documentation and/or other materials provided with the
* distribution.
*
* 3.4. Intel retains all right, title, and interest in and to the Original
* Intel Code.
*
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
* Intel shall be used in advertising or otherwise to promote the sale, use or
* other dealings in products derived from or relating to the Covered Code
* without prior written authorization from Intel.
*
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
* any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* ensure that the distribution and export/re-export of the software is in
* compliance with all laws, regulations, orders, or other restrictions of the
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
* any of its subsidiaries will export/re-export any technical data, process,
* software, or service, directly or indirectly, to any country for which the
* United States government or any agency thereof requires an export license,
* other governmental approval, or letter of assurance, without first obtaining
* such license, approval or letter.
*
*****************************************************************************/
 
#include "aslcompiler.h"
#include "acapps.h"
#include "dtcompiler.h"
#include "dttemplate.h" /* Contains the hex ACPI table templates */
 
#define _COMPONENT DT_COMPILER
ACPI_MODULE_NAME ("dttemplate")
 
 
/* Local prototypes */
 
static BOOLEAN
AcpiUtIsSpecialTable (
char *Signature);
 
static ACPI_STATUS
DtCreateOneTemplate (
char *Signature,
ACPI_DMTABLE_DATA *TableData);
 
static ACPI_STATUS
DtCreateAllTemplates (
void);
 
 
/*******************************************************************************
*
* FUNCTION: AcpiUtIsSpecialTable
*
* PARAMETERS: Signature - ACPI table signature
*
* RETURN: TRUE if signature is a special ACPI table
*
* DESCRIPTION: Check for valid ACPI tables that are not in the main ACPI
* table data structure (AcpiDmTableData).
*
******************************************************************************/
 
static BOOLEAN
AcpiUtIsSpecialTable (
char *Signature)
{
 
if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_DSDT) ||
ACPI_COMPARE_NAME (Signature, ACPI_SIG_SSDT) ||
ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS) ||
ACPI_COMPARE_NAME (Signature, ACPI_RSDP_NAME))
{
return (TRUE);
}
 
return (FALSE);
}
 
 
/*******************************************************************************
*
* FUNCTION: DtCreateTemplates
*
* PARAMETERS: Signature - ACPI table signature
*
* RETURN: Status
*
* DESCRIPTION: Create one or more template files.
*
******************************************************************************/
 
ACPI_STATUS
DtCreateTemplates (
char *Signature)
{
ACPI_DMTABLE_DATA *TableData;
ACPI_STATUS Status;
 
 
AslInitializeGlobals ();
AcpiUtStrupr (Signature);
 
/* Create all known templates if requested */
 
if (!ACPI_STRNCMP (Signature, "ALL", 3) ||
!ACPI_STRCMP (Signature, "*"))
{
Status = DtCreateAllTemplates ();
return (Status);
}
 
/*
* Validate signature and get the template data:
* 1) Signature must be 4 characters
* 2) Signature must be a recognized ACPI table
* 3) There must be a template associated with the signature
*/
if (strlen (Signature) != ACPI_NAME_SIZE)
{
fprintf (stderr, "%s, Invalid ACPI table signature\n", Signature);
return (AE_ERROR);
}
 
/*
* Some slack for the two strange tables whose name is different than
* their signatures: MADT->APIC and FADT->FACP.
*/
if (!strcmp (Signature, "MADT"))
{
Signature = "APIC";
}
else if (!strcmp (Signature, "FADT"))
{
Signature = "FACP";
}
 
TableData = AcpiDmGetTableData (Signature);
if (TableData)
{
if (!TableData->Template)
{
fprintf (stderr, "%4.4s, No template available\n", Signature);
return (AE_ERROR);
}
}
else if (!AcpiUtIsSpecialTable (Signature))
{
fprintf (stderr,
"%4.4s, Unrecognized ACPI table signature\n", Signature);
return (AE_ERROR);
}
 
Status = AdInitialize ();
if (ACPI_FAILURE (Status))
{
return (Status);
}
 
Status = DtCreateOneTemplate (Signature, TableData);
return (Status);
}
 
 
/*******************************************************************************
*
* FUNCTION: DtCreateAllTemplates
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Create all currently defined template files
*
******************************************************************************/
 
static ACPI_STATUS
DtCreateAllTemplates (
void)
{
ACPI_DMTABLE_DATA *TableData;
ACPI_STATUS Status;
 
 
Status = AdInitialize ();
if (ACPI_FAILURE (Status))
{
return (Status);
}
 
fprintf (stderr, "Creating all supported Template files\n");
 
/* Walk entire ACPI table data structure */
 
for (TableData = AcpiDmTableData; TableData->Signature; TableData++)
{
/* If table has a template, create the template file */
 
if (TableData->Template)
{
Status = DtCreateOneTemplate (TableData->Signature,
TableData);
if (ACPI_FAILURE (Status))
{
return (Status);
}
}
}
 
/*
* Create the "special ACPI tables:
* 1) DSDT/SSDT are AML tables, not data tables
* 2) FACS and RSDP have non-standard headers
*/
Status = DtCreateOneTemplate (ACPI_SIG_DSDT, NULL);
if (ACPI_FAILURE (Status))
{
return (Status);
}
 
Status = DtCreateOneTemplate (ACPI_SIG_SSDT, NULL);
if (ACPI_FAILURE (Status))
{
return (Status);
}
 
Status = DtCreateOneTemplate (ACPI_SIG_FACS, NULL);
if (ACPI_FAILURE (Status))
{
return (Status);
}
 
Status = DtCreateOneTemplate (ACPI_RSDP_NAME, NULL);
if (ACPI_FAILURE (Status))
{
return (Status);
}
 
return (AE_OK);
}
 
 
/*******************************************************************************
*
* FUNCTION: DtCreateOneTemplate
*
* PARAMETERS: Signature - ACPI signature, NULL terminated.
* TableData - Entry in ACPI table data structure.
* NULL if a special ACPI table.
*
* RETURN: Status
*
* DESCRIPTION: Create one template source file for the requested ACPI table.
*
******************************************************************************/
 
static ACPI_STATUS
DtCreateOneTemplate (
char *Signature,
ACPI_DMTABLE_DATA *TableData)
{
char *DisasmFilename;
FILE *File;
ACPI_STATUS Status = AE_OK;
 
 
/* New file will have a .asl suffix */
 
DisasmFilename = FlGenerateFilename (
Signature, FILE_SUFFIX_ASL_CODE);
if (!DisasmFilename)
{
fprintf (stderr, "Could not generate output filename\n");
return (AE_ERROR);
}
 
/* Probably should prompt to overwrite the file */
 
AcpiUtStrlwr (DisasmFilename);
File = fopen (DisasmFilename, "w+");
if (!File)
{
fprintf (stderr, "Could not open output file %s\n", DisasmFilename);
return (AE_ERROR);
}
 
/* Emit the common file header */
 
AcpiOsRedirectOutput (File);
 
AcpiOsPrintf ("/*\n");
AcpiOsPrintf (ACPI_COMMON_HEADER ("iASL Compiler/Disassembler", " * "));
 
AcpiOsPrintf (" * Template for [%4.4s] ACPI Table\n",
Signature);
 
/* Dump the actual ACPI table */
 
if (TableData)
{
/* Normal case, tables that appear in AcpiDmTableData */
 
if (Gbl_VerboseTemplates)
{
AcpiOsPrintf (" * Format: [HexOffset DecimalOffset ByteLength]"
" FieldName : HexFieldValue\n */\n\n");
}
else
{
AcpiOsPrintf (" * Format: [ByteLength]"
" FieldName : HexFieldValue\n */\n\n");
}
 
AcpiDmDumpDataTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER,
TableData->Template));
}
else
{
/* Special ACPI tables - DSDT, SSDT, FACS, RSDP */
 
AcpiOsPrintf (" */\n\n");
if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_DSDT))
{
fwrite (TemplateDsdt, sizeof (TemplateDsdt) -1, 1, File);
}
else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_SSDT))
{
fwrite (TemplateSsdt, sizeof (TemplateSsdt) -1, 1, File);
}
else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS))
{
AcpiDmDumpDataTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER,
TemplateFacs));
}
else if (ACPI_COMPARE_NAME (Signature, ACPI_RSDP_NAME))
{
AcpiDmDumpDataTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER,
TemplateRsdp));
}
else
{
fprintf (stderr,
"%4.4s, Unrecognized ACPI table signature\n", Signature);
return (AE_ERROR);
}
}
 
fprintf (stderr,
"Created ACPI table template for [%4.4s], written to \"%s\"\n",
Signature, DisasmFilename);
 
fclose (File);
AcpiOsRedirectOutput (stdout);
ACPI_FREE (DisasmFilename);
return (Status);
}
/drivers/devman/acpica/compiler/dttemplate.h
0,0 → 1,856
/******************************************************************************
*
* Module Name: dttemplate.h - ACPI table template definitions
*
*****************************************************************************/
 
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
* rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
* copy of the source code appearing in this file ("Covered Code") an
* irrevocable, perpetual, worldwide license under Intel's copyrights in the
* base code distributed originally by Intel ("Original Intel Code") to copy,
* make derivatives, distribute, use and display any portion of the Covered
* Code in any form, with the right to sublicense such rights; and
*
* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
* license (with the right to sublicense), under only those claims of Intel
* patents that are infringed by the Original Intel Code, to make, use, sell,
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
* to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
* documentation and/or other materials provided with distribution. In
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* property embodied in the software Licensee provides to its licensee, and
* not to intellectual property embodied in modifications its licensee may
* make.
*
* 3.3. Redistribution of Executable. Redistribution in executable form of any
* substantial portion of the Covered Code or modification must reproduce the
* above Copyright Notice, and the following Disclaimer and Export Compliance
* provision in the documentation and/or other materials provided with the
* distribution.
*
* 3.4. Intel retains all right, title, and interest in and to the Original
* Intel Code.
*
* 3.5. Neither the name Intel nor any other trademark owned or controlled by
* Intel shall be used in advertising or otherwise to promote the sale, use or
* other dealings in products derived from or relating to the Covered Code
* without prior written authorization from Intel.
*
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
* any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* ensure that the distribution and export/re-export of the software is in
* compliance with all laws, regulations, orders, or other restrictions of the
* U.S. Export Administration Regulations. Licensee agrees that neither it nor
* any of its subsidiaries will export/re-export any technical data, process,
* software, or service, directly or indirectly, to any country for which the
* United States government or any agency thereof requires an export license,
* other governmental approval, or letter of assurance, without first obtaining
* such license, approval or letter.
*
*****************************************************************************/
 
#ifndef __DTTEMPLATE_H
#define __DTTEMPLATE_H
 
 
/* Special templates for DSDT and SSDT (AML byte-code tables) */
 
const char TemplateDsdt[] =
"DefinitionBlock (\"dsdt.aml\", \"DSDT\", 2, \"Intel\", \"Template\", 0x00000001)\n"
"{\n"
" Method (MAIN, 0, NotSerialized)\n"
" {\n"
" Return (Zero)\n"
" }\n"
"}\n\n";
 
const char TemplateSsdt[] =
"DefinitionBlock (\"ssdt.aml\", \"SSDT\", 2, \"Intel\", \"Template\", 0x00000001)\n"
"{\n"
" Method (MAIN, 0, NotSerialized)\n"
" {\n"
" Return (Zero)\n"
" }\n"
"}\n\n";
 
 
/* Templates for ACPI data tables */
 
const unsigned char TemplateAsf[] =
{
0x41,0x53,0x46,0x21,0x72,0x00,0x00,0x00, /* 00000000 "ASF!r..." */
0x10,0x0B,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x28,0x05,0x10,0x20,0x00,0x00,0x10,0x00, /* 00000020 "(.. ...." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
0x00,0x00,0x00,0x00,0x01,0x00,0x14,0x00, /* 00000030 "........" */
0x00,0x00,0x01,0x0C,0x00,0x00,0x00,0x00, /* 00000038 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */
0x02,0x00,0x0C,0x00,0x01,0x04,0x00,0x00, /* 00000048 "........" */
0x00,0x00,0x00,0x00,0x03,0x00,0x17,0x00, /* 00000050 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 "........" */
0x00,0x00,0x00,0x84,0x00,0x07,0x00,0x00, /* 00000068 "........" */
0x01,0x00 /* 00000070 ".." */
};
 
const unsigned char TemplateBert[] =
{
0x42,0x45,0x52,0x54,0x30,0x00,0x00,0x00, /* 00000000 "BERT0..." */
0x01,0x15,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00, /* 00000020 "(.. ...." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000028 "........" */
};
 
const unsigned char TemplateBoot[] =
{
0x42,0x4F,0x4F,0x54,0x28,0x00,0x00,0x00, /* 00000000 "BOOT(..." */
0x01,0x0D,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x00,0x00,0x04,0x06,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00 /* 00000020 "(.. ...." */
};
 
const unsigned char TemplateCpep[] =
{
0x43,0x50,0x45,0x50,0x34,0x00,0x00,0x00, /* 00000000 "CPEP4..." */
0x01,0x0F,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00, /* 00000020 "(.. ...." */
0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00, /* 00000028 "........" */
0x00,0x00,0x00,0x00 /* 00000030 "...." */
};
 
const unsigned char TemplateDbgp[] =
{
0x44,0x42,0x47,0x50,0x34,0x00,0x00,0x00, /* 00000000 "DBGP4..." */
0x01,0x1A,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00, /* 00000020 "(.. ...." */
0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
0x00,0x00,0x00,0x00 /* 00000030 "...." */
};
 
const unsigned char TemplateDmar[] =
{
0x44,0x4D,0x41,0x52,0x8C,0x00,0x00,0x00, /* 00000000 "DMAR...." */
0x01,0x15,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x28,0x05,0x10,0x20,0x2F,0x01,0x00,0x00, /* 00000020 "(.. /..." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
0x00,0x00,0x18,0x00,0x01,0x00,0x00,0x00, /* 00000030 "........" */
0x00,0x00,0x02,0xFD,0x00,0x00,0x00,0x00, /* 00000038 "........" */
0x03,0x08,0x00,0x00,0x08,0xF0,0x1F,0x07, /* 00000040 "........" */
0x01,0x00,0x20,0x00,0x00,0x00,0x00,0x00, /* 00000048 ".. ....." */
0x00,0x10,0xC2,0x78,0x00,0x00,0x00,0x00, /* 00000050 "...x...." */
0xFF,0x3F,0xC2,0x78,0x00,0x00,0x00,0x00, /* 00000058 ".?.x...." */
0x01,0x08,0x00,0x00,0x00,0x00,0x1D,0x00, /* 00000060 "........" */
0x02,0x00,0x10,0x00,0x00,0x00,0x00,0x00, /* 00000068 "........" */
0x02,0x08,0x00,0x00,0x00,0x00,0x01,0x00, /* 00000070 "........" */
0x03,0x00,0x14,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */
0x00,0x00,0x02,0xFD,0x00,0x00,0x00,0x00, /* 00000080 "........" */
0x00,0x00,0x00,0x00 /* 00000088 "...." */
};
 
const unsigned char TemplateEcdt[] =
{
0x45,0x43,0x44,0x54,0x42,0x00,0x00,0x00, /* 00000000 "ECDTB..." */
0x01,0x2D,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".-INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x28,0x05,0x10,0x20,0x01,0x08,0x00,0x00, /* 00000020 "(.. ...." */
0x66,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "f......." */
0x01,0x08,0x00,0x00,0x62,0x00,0x00,0x00, /* 00000030 "....b..." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
0x09,0x00 /* 00000040 ".." */
};
 
const unsigned char TemplateEinj[] =
{
0x45,0x49,0x4E,0x4A,0x30,0x01,0x00,0x00, /* 00000000 "EINJ0..." */
0x01,0x09,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x28,0x05,0x10,0x20,0x30,0x00,0x00,0x00, /* 00000020 "(.. 0..." */
0x00,0x00,0x00,0x00,0x0A,0x00,0x00,0x00, /* 00000028 "........" */
0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x04, /* 00000030 ".....@.." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 00000048 "........" */
0x01,0x00,0x00,0x00,0x00,0x40,0x00,0x04, /* 00000050 ".....@.." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 "........" */
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 00000068 "........" */
0x02,0x02,0x01,0x00,0x00,0x40,0x00,0x04, /* 00000070 ".....@.." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 "........" */
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 00000088 "........" */
0x03,0x00,0x00,0x00,0x00,0x40,0x00,0x04, /* 00000090 ".....@.." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000098 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A0 "........" */
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 000000A8 "........" */
0x04,0x03,0x01,0x00,0x00,0x40,0x00,0x04, /* 000000B0 ".....@.." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B8 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000C0 "........" */
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 000000C8 "........" */
0x05,0x03,0x01,0x00,0x01,0x10,0x00,0x02, /* 000000D0 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000D8 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E0 "........" */
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 000000E8 "........" */
0x06,0x01,0x00,0x00,0x00,0x40,0x00,0x04, /* 000000F0 ".....@.." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F8 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000100 "........" */
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 00000108 "........" */
0x07,0x00,0x01,0x00,0x00,0x40,0x00,0x04, /* 00000110 ".....@.." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000118 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000120 "........" */
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF /* 00000128 "........" */
};
 
const unsigned char TemplateErst[] =
{
0x45,0x52,0x53,0x54,0x30,0x02,0x00,0x00, /* 00000000 "ERST0..." */
0x01,0xAB,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x28,0x05,0x10,0x20,0x30,0x00,0x00,0x00, /* 00000020 "(.. 0..." */
0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00, /* 00000028 "........" */
0x00,0x03,0x00,0x00,0x00,0x40,0x00,0x04, /* 00000030 ".....@.." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 00000048 "........" */
0x01,0x03,0x00,0x00,0x00,0x40,0x00,0x04, /* 00000050 ".....@.." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 "........" */
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 00000068 "........" */
0x02,0x03,0x00,0x00,0x00,0x40,0x00,0x04, /* 00000070 ".....@.." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 "........" */
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 00000088 "........" */
0x03,0x04,0x01,0x00,0x00,0x40,0x00,0x04, /* 00000090 ".....@.." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000098 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A0 "........" */
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 000000A8 "........" */
0x04,0x02,0x00,0x00,0x00,0x40,0x00,0x04, /* 000000B0 ".....@.." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B8 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000C0 "........" */
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 000000C8 "........" */
0x05,0x03,0x00,0x00,0x01,0x08,0x00,0x01, /* 000000D0 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000D8 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E0 "........" */
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 000000E8 "........" */
0x06,0x01,0x00,0x00,0x00,0x40,0x00,0x04, /* 000000F0 ".....@.." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F8 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000100 "........" */
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 00000108 "........" */
0x07,0x00,0x00,0x00,0x00,0x40,0x00,0x04, /* 00000110 ".....@.." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000118 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000120 "........" */
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 00000128 "........" */
0x08,0x00,0x00,0x00,0x00,0x40,0x00,0x04, /* 00000130 ".....@.." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000138 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000140 "........" */
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 00000148 "........" */
0x09,0x02,0x00,0x00,0x00,0x40,0x00,0x04, /* 00000150 ".....@.." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000158 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000160 "........" */
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 00000168 "........" */
0x0A,0x00,0x00,0x00,0x00,0x40,0x00,0x04, /* 00000170 ".....@.." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000178 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000180 "........" */
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 00000188 "........" */
0x0B,0x03,0x00,0x00,0x00,0x40,0x00,0x04, /* 00000190 ".....@.." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000198 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001A0 "........" */
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 000001A8 "........" */
0x0C,0x00,0x00,0x00,0x00,0x40,0x00,0x04, /* 000001B0 ".....@.." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001B8 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001C0 "........" */
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 000001C8 "........" */
0x0D,0x00,0x00,0x00,0x00,0x40,0x00,0x04, /* 000001D0 ".....@.." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001D8 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001E0 "........" */
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 000001E8 "........" */
0x0E,0x00,0x00,0x00,0x00,0x40,0x00,0x04, /* 000001F0 ".....@.." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001F8 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000200 "........" */
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 00000208 "........" */
0x0F,0x00,0x00,0x00,0x00,0x40,0x00,0x04, /* 00000210 ".....@.." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000218 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000220 "........" */
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF /* 00000228 "........" */
};
 
const unsigned char TemplateFacs[] =
{
0x46,0x41,0x43,0x53,0x40,0x00,0x00,0x00, /* 00000000 "FACS@..." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000008 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000010 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000018 "........" */
0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000020 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000038 "........" */
};
 
const unsigned char TemplateFadt[] =
{
0x46,0x41,0x43,0x50,0xF4,0x00,0x00,0x00, /* 00000000 "FACP...." */
0x04,0x4E,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".NINTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x28,0x05,0x10,0x20,0x01,0x00,0x00,0x00, /* 00000020 "(.. ...." */
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */
0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000048 "........" */
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000050 "........" */
0x04,0x02,0x01,0x04,0x08,0x00,0x00,0x00, /* 00000058 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000068 "........" */
0x00,0x00,0x00,0x00,0x01,0x08,0x00,0x01, /* 00000070 "........" */
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */
0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000080 "........" */
0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000088 "........" */
0x00,0x00,0x00,0x00,0x01,0x20,0x00,0x02, /* 00000090 "..... .." */
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000098 "........" */
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A0 "........" */
0x00,0x00,0x00,0x00,0x01,0x10,0x00,0x02, /* 000000A8 "........" */
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B0 "........" */
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B8 "........" */
0x00,0x00,0x00,0x00,0x01,0x08,0x00,0x00, /* 000000C0 "........" */
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000C8 "........" */
0x01,0x20,0x00,0x03,0x01,0x00,0x00,0x00, /* 000000D0 ". ......" */
0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x01, /* 000000D8 "........" */
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E0 "........" */
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E8 "........" */
0x00,0x00,0x00,0x00 /* 000000F0 "...." */
};
 
const unsigned char TemplateHest[] =
{
0x48,0x45,0x53,0x54,0xD4,0x01,0x00,0x00, /* 00000000 "HEST...." */
0x01,0x20,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ". INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x28,0x05,0x10,0x20,0x04,0x00,0x00,0x00, /* 00000020 "(.. ...." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, /* 00000028 "........" */
0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000030 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */
0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000048 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000050 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 "........" */
0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000068 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000070 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 "........" */
0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x01, /* 00000088 "........" */
0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000090 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000098 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A0 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A8 "........" */
0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00, /* 000000B0 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B8 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000C0 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000C8 "........" */
0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 000000D0 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000D8 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E0 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E8 "........" */
0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x01, /* 000000F0 "........" */
0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 000000F8 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000100 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000108 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000110 "........" */
0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00, /* 00000118 "........" */
0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00, /* 00000120 "........" */
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000128 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000130 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000138 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000140 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000148 "........" */
0x00,0x00,0x00,0x00,0x09,0x00,0x02,0x00, /* 00000150 "........" */
0xFF,0xFF,0x00,0x01,0x01,0x00,0x00,0x00, /* 00000158 "........" */
0x01,0x00,0x00,0x00,0x00,0x10,0x00,0x00, /* 00000160 "........" */
0x00,0x40,0x00,0x04,0x00,0x00,0x00,0x00, /* 00000168 ".@......" */
0x00,0x00,0x00,0x00,0x03,0x1C,0x00,0x00, /* 00000170 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000178 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000180 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000188 "........" */
0x00,0x10,0x00,0x00,0x09,0x00,0x03,0x00, /* 00000190 "........" */
0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00, /* 00000198 "........" */
0x01,0x00,0x00,0x00,0x00,0x10,0x00,0x00, /* 000001A0 "........" */
0x00,0x40,0x00,0x04,0x00,0x00,0x00,0x00, /* 000001A8 ".@......" */
0x00,0x00,0x00,0x00,0x04,0x1C,0x00,0x00, /* 000001B0 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001B8 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001C0 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001C8 "........" */
0x00,0x10,0x00,0x00 /* 000001D0 "...." */
};
 
const unsigned char TemplateHpet[] =
{
0x48,0x50,0x45,0x54,0x38,0x00,0x00,0x00, /* 00000000 "HPET8..." */
0x01,0x09,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00, /* 00000020 "(.. ...." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000030 "........" */
};
 
const unsigned char TemplateIvrs[] =
{
0x49,0x56,0x52,0x53,0xBC,0x00,0x00,0x00, /* 00000000 "IVRS...." */
0x01,0x87,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00, /* 00000020 "(.. ...." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
0x10,0x14,0x34,0x00,0x00,0x00,0x00,0x00, /* 00000030 "..4....." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */
0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00, /* 00000048 "....@..." */
0x00,0x00,0x00,0x00,0x42,0x00,0x00,0x00, /* 00000050 "....B..." */
0x00,0x00,0x00,0x00,0x48,0x00,0x00,0x00, /* 00000058 "....H..." */
0x00,0x00,0x00,0x00,0x20,0x08,0x20,0x00, /* 00000060 ".... . ." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000068 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000070 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */
0x00,0x00,0x00,0x00,0x21,0x04,0x20,0x00, /* 00000080 "....!. ." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000088 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000090 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000098 "........" */
0x00,0x00,0x00,0x00,0x10,0x14,0x18,0x00, /* 000000A0 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A8 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B0 "........" */
0x00,0x00,0x00,0x00 /* 000000B8 "...." */
};
 
const unsigned char TemplateMadt[] =
{
0x41,0x50,0x49,0x43,0xB6,0x00,0x00,0x00, /* 00000000 "APIC...." */
0x01,0x45,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".EINTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00, /* 00000020 "(.. ...." */
0x01,0x00,0x00,0x00,0x00,0x08,0x00,0x00, /* 00000028 "........" */
0x01,0x00,0x00,0x00,0x01,0x0C,0x01,0x00, /* 00000030 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
0x02,0x0A,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */
0x00,0x00,0x03,0x08,0x0D,0x00,0x01,0x00, /* 00000048 "........" */
0x00,0x00,0x04,0x06,0x00,0x05,0x00,0x01, /* 00000050 "........" */
0x05,0x0C,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */
0x00,0x00,0x00,0x00,0x06,0x10,0x00,0x00, /* 00000060 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000068 "........" */
0x00,0x00,0x00,0x00,0x07,0x16,0x00,0x00, /* 00000070 "........" */
0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000078 "........" */
0x00,0x00,0x00,0x00,0x5C,0x43,0x50,0x55, /* 00000080 "....\CPU" */
0x30,0x00,0x08,0x10,0x05,0x00,0x00,0x00, /* 00000088 "0......." */
0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00, /* 00000090 "........" */
0x00,0x00,0x09,0x10,0x00,0x00,0x00,0x00, /* 00000098 "........" */
0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00, /* 000000A0 "........" */
0x00,0x00,0x0A,0x0C,0x05,0x00,0x00,0x00, /* 000000A8 "........" */
0x00,0x00,0x00,0x00,0x00,0x00 /* 000000B0 "......" */
};
 
const unsigned char TemplateMcfg[] =
{
0x4D,0x43,0x46,0x47,0x3C,0x00,0x00,0x00, /* 00000000 "MCFG<..." */
0x01,0x19,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00, /* 00000020 "(.. ...." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */
0x00,0x00,0x00,0x00 /* 00000038 "...." */
};
 
const unsigned char TemplateMchi[] =
{
0x4D,0x43,0x48,0x49,0x45,0x00,0x00,0x00, /* 00000000 "MCHIE..." */
0x01,0xE4,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x15,0x07,0x00,0x02,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x28,0x05,0x10,0x20,0x01,0x00,0x00,0x00, /* 00000020 "(.. ...." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
0x00,0x00,0x00,0x00,0x00,0x02,0x08,0x00, /* 00000030 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
0x00,0x00,0x00,0x00,0x00 /* 00000040 "....." */
};
 
const unsigned char TemplateMsct[] =
{
0x4D,0x53,0x43,0x54,0x90,0x00,0x00,0x00, /* 00000000 "MSCT...." */
0x01,0xB7,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x28,0x05,0x10,0x20,0x38,0x00,0x00,0x00, /* 00000020 "(.. 8..." */
0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0x00, /* 00000030 "........" */
0x01,0x16,0x00,0x00,0x00,0x00,0x03,0x00, /* 00000038 "........" */
0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */
0x00,0x00,0x40,0x00,0x00,0x00,0x01,0x16, /* 00000048 "..@....." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000050 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */
0x00,0x00,0x00,0x00,0x01,0x16,0x00,0x00, /* 00000060 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000068 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000070 "........" */
0x00,0x00,0x01,0x16,0x00,0x00,0x00,0x00, /* 00000078 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000088 "........" */
};
 
const unsigned char TemplateRsdp[] =
{
0x52,0x53,0x44,0x20,0x50,0x54,0x52,0x20, /* 00000000 "RSD PTR " */
0x43,0x49,0x4E,0x54,0x45,0x4C,0x20,0x02, /* 00000008 "CINTEL ." */
0x00,0x00,0x00,0x00,0x24,0x00,0x00,0x00, /* 00000010 "....$..." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000018 "........" */
0xDC,0x00,0x00,0x00 /* 00000020 "...." */
};
 
const unsigned char TemplateRsdt[] =
{
0x52,0x53,0x44,0x54,0x44,0x00,0x00,0x00, /* 00000000 "RSDTD..." */
0x01,0xB1,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x28,0x05,0x10,0x20,0x10,0x00,0x00,0x00, /* 00000020 "(.. ...." */
0x20,0x00,0x00,0x00,0x30,0x00,0x00,0x00, /* 00000028 " ...0..." */
0x40,0x00,0x00,0x00,0x50,0x00,0x00,0x00, /* 00000030 "@...P..." */
0x60,0x00,0x00,0x00,0x70,0x00,0x00,0x00, /* 00000038 "`...p..." */
0x80,0x00,0x00,0x00 /* 00000040 "...." */
};
 
const unsigned char TemplateSbst[] =
{
0x53,0x42,0x53,0x54,0x30,0x00,0x00,0x00, /* 00000000 "SBST0..." */
0x01,0x06,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00, /* 00000020 "(.. ...." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000028 "........" */
};
 
const unsigned char TemplateSlic[] =
{
0x53,0x4C,0x49,0x43,0x76,0x01,0x00,0x00, /* 00000000 "SLICv..." */
0x01,0x07,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x11,0x02,0x11,0x20,0x00,0x00,0x00,0x00, /* 00000020 "... ...." */
0x9C,0x00,0x00,0x00,0x06,0x02,0x00,0x00, /* 00000028 "........" */
0x00,0x24,0x00,0x00,0x52,0x53,0x41,0x31, /* 00000030 ".$..RSA1" */
0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000048 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000050 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000068 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000070 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000088 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000090 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000098 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A0 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A8 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B0 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B8 "........" */
0x01,0x00,0x00,0x00,0xB6,0x00,0x00,0x00, /* 000000C0 "........" */
0x00,0x00,0x02,0x00,0x49,0x4E,0x54,0x45, /* 000000C8 "....INTE" */
0x4C,0x20,0x54,0x45,0x4D,0x50,0x4C,0x41, /* 000000D0 "L TEMPLA" */
0x54,0x45,0x57,0x49,0x4E,0x44,0x4F,0x57, /* 000000D8 "TEWINDOW" */
0x53,0x20,0x01,0x00,0x02,0x00,0x00,0x00, /* 000000E0 "S ......" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E8 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F0 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F8 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000100 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000108 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000110 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000118 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000120 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000128 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000130 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000138 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000140 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000148 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000150 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000158 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000160 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000168 "........" */
0x00,0x00,0x00,0x00,0x00,0x00 /* 00000170 "......" */
};
 
const unsigned char TemplateSlit[] =
{
0x53,0x4C,0x49,0x54,0xBC,0x01,0x00,0x00, /* 00000000 "SLIT...." */
0x01,0x00,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x16,0x03,0x11,0x20,0x14,0x00,0x00,0x00, /* 00000020 "... ...." */
0x00,0x00,0x00,0x00,0x0A,0x10,0x16,0x17, /* 00000028 "........" */
0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, /* 00000030 "........" */
0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27, /* 00000038 " !"#$%&'" */
0x10,0x0A,0x15,0x16,0x17,0x18,0x19,0x1A, /* 00000040 "........" */
0x1B,0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22, /* 00000048 "..... !"" */
0x23,0x24,0x25,0x26,0x16,0x15,0x0A,0x10, /* 00000050 "#$%&...." */
0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D, /* 00000058 "........" */
0x1E,0x1F,0x20,0x21,0x22,0x23,0x24,0x25, /* 00000060 ".. !"#$%" */
0x17,0x16,0x10,0x0A,0x15,0x16,0x17,0x18, /* 00000068 "........" */
0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,0x20, /* 00000070 "....... " */
0x21,0x22,0x23,0x24,0x18,0x17,0x16,0x15, /* 00000078 "!"#$...." */
0x0A,0x10,0x16,0x17,0x18,0x19,0x1A,0x1B, /* 00000080 "........" */
0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22,0x23, /* 00000088 ".... !"#" */
0x19,0x18,0x17,0x16,0x10,0x0A,0x15,0x16, /* 00000090 "........" */
0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E, /* 00000098 "........" */
0x1F,0x20,0x21,0x22,0x1A,0x19,0x18,0x17, /* 000000A0 ". !"...." */
0x16,0x15,0x0A,0x10,0x16,0x17,0x18,0x19, /* 000000A8 "........" */
0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,0x20,0x21, /* 000000B0 "...... !" */
0x1B,0x1A,0x19,0x18,0x17,0x16,0x10,0x0A, /* 000000B8 "........" */
0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C, /* 000000C0 "........" */
0x1D,0x1E,0x1F,0x20,0x1C,0x1B,0x1A,0x19, /* 000000C8 "... ...." */
0x18,0x17,0x16,0x15,0x0A,0x10,0x16,0x17, /* 000000D0 "........" */
0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, /* 000000D8 "........" */
0x1D,0x1C,0x1B,0x1A,0x19,0x18,0x17,0x16, /* 000000E0 "........" */
0x10,0x0A,0x15,0x16,0x17,0x18,0x19,0x1A, /* 000000E8 "........" */
0x1B,0x1C,0x1D,0x1E,0x1E,0x1D,0x1C,0x1B, /* 000000F0 "........" */
0x1A,0x19,0x18,0x17,0x16,0x15,0x0A,0x10, /* 000000F8 "........" */
0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D, /* 00000100 "........" */
0x1F,0x1E,0x1D,0x1C,0x1B,0x1A,0x19,0x18, /* 00000108 "........" */
0x17,0x16,0x10,0x0A,0x15,0x16,0x17,0x18, /* 00000110 "........" */
0x19,0x1A,0x1B,0x1C,0x20,0x1F,0x1E,0x1D, /* 00000118 ".... ..." */
0x1C,0x1B,0x1A,0x19,0x18,0x17,0x16,0x15, /* 00000120 "........" */
0x0A,0x10,0x16,0x17,0x18,0x19,0x1A,0x1B, /* 00000128 "........" */
0x21,0x20,0x1F,0x1E,0x1D,0x1C,0x1B,0x1A, /* 00000130 "! ......" */
0x19,0x18,0x17,0x16,0x10,0x0A,0x15,0x16, /* 00000138 "........" */
0x17,0x18,0x19,0x1A,0x22,0x21,0x20,0x1F, /* 00000140 "...."! ." */
0x1E,0x1D,0x1C,0x1B,0x1A,0x19,0x18,0x17, /* 00000148 "........" */
0x16,0x15,0x0A,0x10,0x16,0x17,0x18,0x19, /* 00000150 "........" */
0x23,0x22,0x21,0x20,0x1F,0x1E,0x1D,0x1C, /* 00000158 "#"! ...." */
0x1B,0x1A,0x19,0x18,0x17,0x16,0x10,0x0A, /* 00000160 "........" */
0x15,0x16,0x17,0x18,0x24,0x23,0x22,0x21, /* 00000168 "....$#"!" */
0x20,0x1F,0x1E,0x1D,0x1C,0x1B,0x1A,0x19, /* 00000170 " ......." */
0x18,0x17,0x16,0x15,0x0A,0x10,0x16,0x17, /* 00000178 "........" */
0x25,0x24,0x23,0x22,0x21,0x20,0x1F,0x1E, /* 00000180 "%$#"! .." */
0x1D,0x1C,0x1B,0x1A,0x19,0x18,0x17,0x16, /* 00000188 "........" */
0x10,0x0A,0x15,0x16,0x26,0x25,0x24,0x23, /* 00000190 "....&%$#" */
0x22,0x21,0x20,0x1F,0x1E,0x1D,0x1C,0x1B, /* 00000198 ""! ....." */
0x1A,0x19,0x18,0x17,0x16,0x15,0x0A,0x10, /* 000001A0 "........" */
0x27,0x26,0x25,0x24,0x23,0x22,0x21,0x20, /* 000001A8 "'&%$#"! " */
0x1F,0x1E,0x1D,0x1C,0x1B,0x1A,0x19,0x18, /* 000001B0 "........" */
0x17,0x16,0x10,0x0A /* 000001B8 "...." */
};
 
const unsigned char TemplateSpcr[] =
{
0x53,0x50,0x43,0x52,0x50,0x00,0x00,0x00, /* 00000000 "SPCRP..." */
0x01,0xE3,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00, /* 00000020 "(.. ...." */
0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000048 "........" */
};
 
const unsigned char TemplateSpmi[] =
{
0x53,0x50,0x4D,0x49,0x41,0x00,0x00,0x00, /* 00000000 "SPMIA..." */
0x04,0xED,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00, /* 00000020 "(.. ...." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
0x00,0x08,0x00,0x01,0x00,0x00,0x00,0x00, /* 00000030 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
0x00 /* 00000040 "." */
};
 
const unsigned char TemplateSrat[] =
{
0x53,0x52,0x41,0x54,0x80,0x00,0x00,0x00, /* 00000000 "SRAT...." */
0x03,0x5A,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".ZINTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x28,0x05,0x10,0x20,0x01,0x00,0x00,0x00, /* 00000020 "(.. ...." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
0x00,0x10,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000030 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
0x01,0x28,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 ".(......" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000048 "........" */
0x00,0xFC,0x09,0x00,0x00,0x00,0x00,0x00, /* 00000050 "........" */
0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000058 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 "........" */
0x02,0x18,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000068 "........" */
0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000070 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000078 "........" */
};
 
const unsigned char TemplateTcpa[] =
{
0x54,0x43,0x50,0x41,0x32,0x00,0x00,0x00, /* 00000000 "TCPA2..." */
0x01,0x67,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".gINTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x80,0x31,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 ".1..INTL" */
0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00, /* 00000020 "(.. ...." */
0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
0x00,0x00 /* 00000030 ".." */
};
 
const unsigned char TemplateUefi[] =
{
0x55,0x45,0x46,0x49,0x36,0x00,0x00,0x00, /* 00000000 "UEFI6..." */
0x01,0x9B,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x28,0x05,0x10,0x20,0x00,0x01,0x02,0x03, /* 00000020 "(.. ...." */
0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B, /* 00000028 "........" */
0x0C,0x0D,0x0E,0x0F,0x00,0x00 /* 00000030 "......" */
};
 
const unsigned char TemplateWaet[] =
{
0x57,0x41,0x45,0x54,0x28,0x00,0x00,0x00, /* 00000000 "WAET(..." */
0x01,0x19,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00 /* 00000020 "(.. ...." */
};
 
const unsigned char TemplateWdat[] =
{
0x57,0x44,0x41,0x54,0x5C,0x00,0x00,0x00, /* 00000000 "WDAT\..." */
0x01,0xE3,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x28,0x05,0x10,0x20,0x20,0x00,0x00,0x00, /* 00000020 "(.. ..." */
0xFF,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00, /* 00000028 "........" */
0x58,0x02,0x00,0x00,0xFF,0x03,0x00,0x00, /* 00000030 "X......." */
0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
0x0E,0x00,0x00,0x00,0x01,0x02,0x00,0x00, /* 00000040 "........" */
0x01,0x10,0x00,0x02,0x60,0x04,0x00,0x00, /* 00000048 "....`..." */
0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000050 "........" */
0x01,0x00,0x00,0x00 /* 00000058 "...." */
};
 
const unsigned char TemplateWddt[] =
{
0x57,0x44,0x44,0x54,0x40,0x00,0x00,0x00, /* 00000000 "WDDT@..." */
0x01,0x00,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00, /* 00000020 "(.. ...." */
0x00,0x00,0x01,0xFF,0x00,0x00,0x00,0x00, /* 00000028 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000038 "........" */
};
 
const unsigned char TemplateWdrt[] =
{
0x57,0x44,0x52,0x54,0x47,0x00,0x00,0x00, /* 00000000 "WDRTG..." */
0x01,0xB0,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x28,0x05,0x10,0x20,0x00,0x20,0x00,0x00, /* 00000020 "(.. . .." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 ". ......" */
0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF, /* 00000038 "........" */
0x00,0x00,0x00,0x00,0xFF,0xFF,0x00 /* 00000040 "......." */
};
 
const unsigned char TemplateXsdt[] =
{
0x58,0x53,0x44,0x54,0x64,0x00,0x00,0x00, /* 00000000 "XSDTd..." */
0x01,0x8B,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x28,0x05,0x10,0x20,0x10,0x00,0x00,0x00, /* 00000020 "(.. ...." */
0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00, /* 00000028 ".... ..." */
0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00, /* 00000030 "....0..." */
0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00, /* 00000038 "....@..." */
0x00,0x00,0x00,0x00,0x50,0x00,0x00,0x00, /* 00000040 "....P..." */
0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00, /* 00000048 "....`..." */
0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00, /* 00000050 "....p..." */
0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00, /* 00000058 "........" */
0x00,0x00,0x00,0x00 /* 00000060 "...." */
};
 
#endif
/drivers/devman/acpica/compiler/dtutils.c
8,7 → 8,7
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
* All rights reserved.
*
* 2. License
261,8 → 261,16
 
DtError (ASL_ERROR, MessageId, FieldObject, ExtraMessage);
 
/*
* TBD: remove this entire function, DtFatal
*
* We cannot abort the compiler on error, because we may be compiling a
* list of files. We must move on to the next file.
*/
#ifdef __OBSOLETE
CmCleanupAndExit ();
exit (1);
#endif
}
 
 
388,7 → 396,6
* FUNCTION: DtGetFieldValue
*
* PARAMETERS: Field - Current field list pointer
* Name - Field name
*
* RETURN: Field value
*
398,26 → 405,17
 
char *
DtGetFieldValue (
DT_FIELD *Field,
char *Name)
DT_FIELD *Field)
{
 
/* Search the field list for the name */
 
while (Field)
if (!Field)
{
if (!ACPI_STRCMP (Name, Field->Name))
{
return (Field->Value);
return (NULL);
}
 
Field = Field->Next;
return (Field->Value);
}
 
return (NULL);
}
 
 
/******************************************************************************
*
* FUNCTION: DtGetFieldType
471,19 → 469,34
break;
 
case ACPI_DMT_BUFFER:
case ACPI_DMT_BUF7:
case ACPI_DMT_BUF16:
case ACPI_DMT_BUF128:
case ACPI_DMT_PCI_PATH:
Type = DT_FIELD_TYPE_BUFFER;
break;
 
case ACPI_DMT_PCI_PATH:
Type = DT_FIELD_TYPE_PCI_PATH;
break;
 
case ACPI_DMT_GAS:
case ACPI_DMT_HESTNTFY:
Type = DT_FIELD_TYPE_INLINE_SUBTABLE;
break;
 
case ACPI_DMT_UNICODE:
Type = DT_FIELD_TYPE_UNICODE;
break;
 
case ACPI_DMT_UUID:
Type = DT_FIELD_TYPE_UUID;
break;
 
case ACPI_DMT_DEVICE_PATH:
Type = DT_FIELD_TYPE_DEVICE_PATH;
break;
 
case ACPI_DMT_LABEL:
Type = DT_FIELD_TYPE_LABEL;
break;
 
default:
Type = DT_FIELD_TYPE_INTEGER;
break;
536,7 → 549,7
*
* FUNCTION: DtGetFieldLength
*
* PARAMETERS: Field - Current field list pointer
* PARAMETERS: Field - Current field
* Info - Data table info
*
* RETURN: Field length
543,6 → 556,8
*
* DESCRIPTION: Get length of bytes needed to compile the field
*
* Note: This function must remain in sync with AcpiDmDumpTable.
*
*****************************************************************************/
 
UINT32
568,6 → 583,7
case ACPI_DMT_FLAG7:
case ACPI_DMT_FLAGS0:
case ACPI_DMT_FLAGS2:
case ACPI_DMT_LABEL:
ByteLength = 0;
break;
 
574,12 → 590,17
case ACPI_DMT_UINT8:
case ACPI_DMT_CHKSUM:
case ACPI_DMT_SPACEID:
case ACPI_DMT_ACCWIDTH:
case ACPI_DMT_IVRS:
case ACPI_DMT_MADT:
case ACPI_DMT_SRAT:
case ACPI_DMT_ASF:
case ACPI_DMT_HESTNTYP:
case ACPI_DMT_FADTPM:
case ACPI_DMT_IVRS:
case ACPI_DMT_EINJACT:
case ACPI_DMT_EINJINST:
case ACPI_DMT_ERSTACT:
case ACPI_DMT_ERSTINST:
ByteLength = 1;
break;
 
596,6 → 617,7
 
case ACPI_DMT_UINT32:
case ACPI_DMT_NAME4:
case ACPI_DMT_SLIC:
case ACPI_DMT_SIG:
ByteLength = 4;
break;
605,6 → 627,7
break;
 
case ACPI_DMT_UINT56:
case ACPI_DMT_BUF7:
ByteLength = 7;
break;
 
614,11 → 637,18
break;
 
case ACPI_DMT_STRING:
Value = DtGetFieldValue (Field, Info->Name);
Value = DtGetFieldValue (Field);
if (Value)
{
ByteLength = ACPI_STRLEN (Value) + 1;
}
else
{ /* At this point, this is a fatal error */
 
/* TBD: error if Value is NULL? (as below?) */
 
ByteLength = ACPI_STRLEN (Value) + 1;
sprintf (MsgBuffer, "Expected \"%s\"", Info->Name);
DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, MsgBuffer);
return (0);
}
break;
 
case ACPI_DMT_GAS:
630,7 → 660,7
break;
 
case ACPI_DMT_BUFFER:
Value = DtGetFieldValue (Field, Info->Name);
Value = DtGetFieldValue (Field);
if (Value)
{
ByteLength = DtGetBufferLength (Value);
640,16 → 670,30
 
sprintf (MsgBuffer, "Expected \"%s\"", Info->Name);
DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, MsgBuffer);
return (0);
}
break;
 
case ACPI_DMT_BUF16:
case ACPI_DMT_UUID:
ByteLength = 16;
break;
 
case ACPI_DMT_BUF128:
ByteLength = 128;
break;
 
case ACPI_DMT_UNICODE:
Value = DtGetFieldValue (Field);
 
/* TBD: error if Value is NULL? (as below?) */
 
ByteLength = (ACPI_STRLEN (Value) + 1) * sizeof(UINT16);
break;
 
default:
DtFatal (ASL_MSG_COMPILER_INTERNAL, Field, "Invalid table opcode");
break;
return (0);
}
 
return (ByteLength);
753,6 → 797,11
ChildTable = DtGetNextSubtable (ParentTable, ChildTable);
if (ChildTable)
{
if (ChildTable->LengthField)
{
DtSetSubtableLength (ChildTable);
}
 
if (ChildTable->Child)
{
ParentTable = ChildTable;