*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2012, 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
+ * 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.
*
* 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
+ * 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
* 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,
+ * 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
+ * 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.
*
* 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
+ * 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
* 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
+ * 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.
*
* 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
+ * 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
+ * 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
void *Context,
void **ReturnValue);
-void
-LsSetupNsList (
- void *Handle);
-
-ACPI_PARSE_OBJECT *
+static ACPI_PARSE_OBJECT *
LkGetNameOp (
ACPI_PARSE_OBJECT *Op);
Gbl_NumNamespaceObjects++;
- FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%5d [%d] %*s %4.4s - %s",
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%5u [%u] %*s %4.4s - %s",
Gbl_NumNamespaceObjects, Level, (Level * 3), " ",
&Node->Name,
AcpiUtGetTypeName (Node->Type));
* RETURN: Status
*
* DESCRIPTION: Walk the namespace an display information about each node
- * in the tree. Information is written to the optional
+ * in the tree. Information is written to the optional
* namespace output file.
*
******************************************************************************/
*
******************************************************************************/
-ACPI_PARSE_OBJECT *
+static ACPI_PARSE_OBJECT *
LkGetNameOp (
ACPI_PARSE_OBJECT *Op)
{
* RETURN: Status
*
* DESCRIPTION: Perform a cross reference check of the parse tree against the
- * namespace. Every named referenced within the parse tree
- * should be get resolved with a namespace lookup. If not, the
+ * namespace. Every named referenced within the parse tree
+ * should be get resolved with a namespace lookup. If not, the
* original reference in the ASL code is invalid -- i.e., refers
* to a non-existent object.
*
WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
if (!WalkState)
{
- return AE_NO_MEMORY;
+ return (AE_NO_MEMORY);
}
/* Walk the entire parse tree */
TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, LkNamespaceLocateBegin,
LkNamespaceLocateEnd, WalkState);
- return AE_OK;
+ return (AE_OK);
}
/*
- * Check each field unit against the region size. The entire
+ * Check each field unit against the region size. The entire
* field unit (start offset plus length) must fit within the
* region.
*/
/*
* Now check that the field plus AccessWidth doesn't go beyond
- * the end-of-region. Assumes AccessBitWidth is a power of 2
+ * the end-of-region. Assumes AccessBitWidth is a power of 2
*/
FieldEndBitOffset = ACPI_ROUND_UP (FieldEndBitOffset, AccessBitWidth);
*
* RETURN: Status
*
- * DESCRIPTION: Descending callback used during cross-reference. For named
+ * DESCRIPTION: Descending callback used during cross-reference. For named
* object references, attempt to locate the name in the
* namespace.
*
* NOTE: ASL references to named fields within resource descriptors are
- * resolved to integer values here. Therefore, this step is an
- * important part of the code generation. We don't know that the
+ * resolved to integer values here. Therefore, this step is an
+ * important part of the code generation. We don't know that the
* name refers to a resource descriptor until now.
*
******************************************************************************/
ACPI_PARSE_OBJECT *OwningOp;
ACPI_PARSE_OBJECT *SpaceIdOp;
UINT32 MinimumLength;
- UINT32 Temp;
+ UINT32 Offset;
+ UINT32 FieldBitLength;
+ UINT32 TagBitLength;
+ UINT8 Message = 0;
const ACPI_OPCODE_INFO *OpInfo;
UINT32 Flags;
/*
* If this node is the actual declaration of a name
* [such as the XXXX name in "Method (XXXX)"],
- * we are not interested in it here. We only care about names that are
+ * we are not interested in it here. We only care about names that are
* references to other objects within the namespace and the parent objects
* of name declarations
*/
"Type=%s\n", AcpiUtGetTypeName (ObjectType)));
/*
- * Lookup the name in the namespace. Name must exist at this point, or it
+ * Lookup the name in the namespace. Name must exist at this point, or it
* is an invalid reference.
*
* The namespace is also used as a lookup table for references to resource
/* 2) Check for a reference to a resource descriptor */
if ((Node->Type == ACPI_TYPE_LOCAL_RESOURCE_FIELD) ||
- (Node->Type == ACPI_TYPE_LOCAL_RESOURCE))
+ (Node->Type == ACPI_TYPE_LOCAL_RESOURCE))
{
/*
- * This was a reference to a field within a resource descriptor. Extract
- * the associated field offset (either a bit or byte offset depending on
- * the field type) and change the named reference into an integer for
- * AML code generation
+ * This was a reference to a field within a resource descriptor.
+ * Extract the associated field offset (either a bit or byte
+ * offset depending on the field type) and change the named
+ * reference into an integer for AML code generation
*/
- Temp = Node->Value;
- if (Node->Flags & ANOBJ_IS_BIT_OFFSET)
- {
- Op->Asl.CompileFlags |= NODE_IS_BIT_OFFSET;
- }
-
- /* Perform BitOffset <--> ByteOffset conversion if necessary */
+ Offset = Node->Value;
+ TagBitLength = Node->Length;
+ /*
+ * If a field is being created, generate the length (in bits) of
+ * the field. Note: Opcodes other than CreateXxxField and Index
+ * can come through here. For other opcodes, we just need to
+ * convert the resource tag reference to an integer offset.
+ */
switch (Op->Asl.Parent->Asl.AmlOpcode)
{
- case AML_CREATE_FIELD_OP:
+ case AML_CREATE_FIELD_OP: /* Variable "Length" field, in bits */
+ /*
+ * We know the length operand is an integer constant because
+ * we know that it contains a reference to a resource
+ * descriptor tag.
+ */
+ FieldBitLength = (UINT32) Op->Asl.Next->Asl.Value.Integer;
+ break;
- /* We allow a Byte offset to Bit Offset conversion for this op */
+ case AML_CREATE_BIT_FIELD_OP:
+ FieldBitLength = 1;
+ break;
- if (!(Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET))
- {
- /* Simply multiply byte offset times 8 to get bit offset */
+ case AML_CREATE_BYTE_FIELD_OP:
+ case AML_INDEX_OP:
+ FieldBitLength = 8;
+ break;
- Temp = ACPI_MUL_8 (Temp);
- }
+ case AML_CREATE_WORD_FIELD_OP:
+ FieldBitLength = 16;
break;
+ case AML_CREATE_DWORD_FIELD_OP:
+ FieldBitLength = 32;
+ break;
- case AML_CREATE_BIT_FIELD_OP:
+ case AML_CREATE_QWORD_FIELD_OP:
+ FieldBitLength = 64;
+ break;
+
+ default:
+ FieldBitLength = 0;
+ break;
+ }
- /* This op requires a Bit Offset */
+ /* Check the field length against the length of the resource tag */
- if (!(Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET))
+ if (FieldBitLength)
+ {
+ if (TagBitLength < FieldBitLength)
{
- AslError (ASL_ERROR, ASL_MSG_BYTES_TO_BITS, Op, NULL);
+ Message = ASL_MSG_TAG_SMALLER;
+ }
+ else if (TagBitLength > FieldBitLength)
+ {
+ Message = ASL_MSG_TAG_LARGER;
}
- break;
+ if (Message)
+ {
+ sprintf (MsgBuffer, "Size mismatch, Tag: %u bit%s, Field: %u bit%s",
+ TagBitLength, (TagBitLength > 1) ? "s" : "",
+ FieldBitLength, (FieldBitLength > 1) ? "s" : "");
+ AslError (ASL_WARNING, Message, Op, MsgBuffer);
+ }
+ }
+
+ /* Convert the BitOffset to a ByteOffset for certain opcodes */
+
+ switch (Op->Asl.Parent->Asl.AmlOpcode)
+ {
case AML_CREATE_BYTE_FIELD_OP:
case AML_CREATE_WORD_FIELD_OP:
case AML_CREATE_DWORD_FIELD_OP:
case AML_CREATE_QWORD_FIELD_OP:
case AML_INDEX_OP:
- /* These Ops require Byte offsets */
-
- if (Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET)
- {
- AslError (ASL_ERROR, ASL_MSG_BITS_TO_BYTES, Op, NULL);
- }
+ Offset = ACPI_DIV_8 (Offset);
break;
-
default:
- /* Nothing to do for other opcodes */
break;
}
/* Now convert this node to an integer whose value is the field offset */
- Op->Asl.AmlLength = 0;
- Op->Asl.ParseOpcode = PARSEOP_INTEGER;
- Op->Asl.Value.Integer = (UINT64) Temp;
- Op->Asl.CompileFlags |= NODE_IS_RESOURCE_FIELD;
+ Op->Asl.AmlLength = 0;
+ Op->Asl.ParseOpcode = PARSEOP_INTEGER;
+ Op->Asl.Value.Integer = (UINT64) Offset;
+ Op->Asl.CompileFlags |= NODE_IS_RESOURCE_FIELD;
OpcGenerateAmlOpcode (Op);
}
*/
if (PassedArgs != Node->Value)
{
- sprintf (MsgBuffer, "%s requires %d", Op->Asl.ExternalName,
+ sprintf (MsgBuffer, "%s requires %u", Op->Asl.ExternalName,
Node->Value);
if (PassedArgs < Node->Value)
(Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_BANKFIELD)))
{
/*
- * Offset checking for fields. If the parent operation region has a
+ * Offset checking for fields. If the parent operation region has a
* constant length (known at compile time), we can check fields
- * defined in that region against the region length. This will catch
+ * defined in that region against the region length. This will catch
* fields and field units that cannot possibly fit within the region.
*
* Note: Index fields do not directly reference an operation region,
{
/*
* This is the first child of the field node, which is
- * the name of the region. Get the parse node for the
+ * the name of the region. Get the parse node for the
* region -- which contains the length of the region.
*/
OwningOp = Node->Op;
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:
+ case ACPI_ADR_SPACE_GPIO:
if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BYTE)
{
}
break;
- case REGION_SMBUS:
- case REGION_IPMI:
+ case ACPI_ADR_SPACE_SMBUS:
+ case ACPI_ADR_SPACE_IPMI:
+ case ACPI_ADR_SPACE_GSBUS:
if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BUFFER)
{
else
{
/*
- * This is one element of the field list. Check to make sure
+ * This is one element of the field list. Check to make sure
* that it does not go beyond the end of the parent operation region.
*
* In the code below:
*
* RETURN: Status
*
- * DESCRIPTION: Ascending callback used during cross reference. We only
+ * DESCRIPTION: Ascending callback used during cross reference. We only
* need to worry about scope management here.
*
******************************************************************************/
return (AE_OK);
}
-
-