2003-08-07 16:38:31 +00:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Module Name: asloperands - AML operand processing
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2011-01-13 16:12:34 +00:00
|
|
|
/*
|
2013-01-17 21:32:03 +00:00
|
|
|
* Copyright (C) 2000 - 2013, Intel Corp.
|
2003-08-07 16:38:31 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
2011-01-13 16:12:34 +00:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions, and the following disclaimer,
|
|
|
|
* without modification.
|
|
|
|
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
|
|
|
|
* substantially similar to the "NO WARRANTY" disclaimer below
|
|
|
|
* ("Disclaimer") and any redistribution must be conditioned upon
|
|
|
|
* including a substantially similar Disclaimer requirement for further
|
|
|
|
* binary redistribution.
|
|
|
|
* 3. Neither the names of the above-listed copyright holders nor the names
|
|
|
|
* of any contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* Alternatively, this software may be distributed under the terms of the
|
|
|
|
* GNU General Public License ("GPL") version 2 as published by the Free
|
|
|
|
* Software Foundation.
|
|
|
|
*
|
|
|
|
* NO WARRANTY
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
|
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
|
|
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGES.
|
|
|
|
*/
|
2003-08-07 16:38:31 +00:00
|
|
|
|
|
|
|
|
2009-06-01 19:24:26 +00:00
|
|
|
#include "aslcompiler.h"
|
2003-08-07 16:38:31 +00:00
|
|
|
#include "aslcompiler.y.h"
|
2009-06-01 19:24:26 +00:00
|
|
|
#include "amlcode.h"
|
2003-08-07 16:38:31 +00:00
|
|
|
|
|
|
|
#define _COMPONENT ACPI_COMPILER
|
|
|
|
ACPI_MODULE_NAME ("asloperands")
|
|
|
|
|
2005-11-01 22:11:18 +00:00
|
|
|
/* Local prototypes */
|
|
|
|
|
|
|
|
static void
|
|
|
|
OpnDoField (
|
|
|
|
ACPI_PARSE_OBJECT *Op);
|
|
|
|
|
|
|
|
static void
|
|
|
|
OpnDoBankField (
|
|
|
|
ACPI_PARSE_OBJECT *Op);
|
|
|
|
|
|
|
|
static void
|
|
|
|
OpnDoBuffer (
|
|
|
|
ACPI_PARSE_OBJECT *Op);
|
|
|
|
|
|
|
|
static void
|
|
|
|
OpnDoDefinitionBlock (
|
|
|
|
ACPI_PARSE_OBJECT *Op);
|
|
|
|
|
|
|
|
static void
|
|
|
|
OpnDoFieldCommon (
|
|
|
|
ACPI_PARSE_OBJECT *FieldOp,
|
|
|
|
ACPI_PARSE_OBJECT *Op);
|
|
|
|
|
|
|
|
static void
|
|
|
|
OpnDoIndexField (
|
|
|
|
ACPI_PARSE_OBJECT *Op);
|
|
|
|
|
|
|
|
static void
|
|
|
|
OpnDoLoadTable (
|
|
|
|
ACPI_PARSE_OBJECT *Op);
|
|
|
|
|
|
|
|
static void
|
|
|
|
OpnDoMethod (
|
|
|
|
ACPI_PARSE_OBJECT *Op);
|
|
|
|
|
|
|
|
static void
|
|
|
|
OpnDoMutex (
|
|
|
|
ACPI_PARSE_OBJECT *Op);
|
|
|
|
|
|
|
|
static void
|
|
|
|
OpnDoRegion (
|
|
|
|
ACPI_PARSE_OBJECT *Op);
|
|
|
|
|
|
|
|
static void
|
|
|
|
OpnAttachNameToNode (
|
|
|
|
ACPI_PARSE_OBJECT *Op);
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: OpnDoMutex
|
|
|
|
*
|
|
|
|
* PARAMETERS: Op - The parent parse node
|
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Construct the operands for the MUTEX ASL keyword.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
static void
|
|
|
|
OpnDoMutex (
|
|
|
|
ACPI_PARSE_OBJECT *Op)
|
|
|
|
{
|
|
|
|
ACPI_PARSE_OBJECT *Next;
|
|
|
|
|
|
|
|
|
|
|
|
Next = Op->Asl.Child;
|
|
|
|
Next = Next->Asl.Next;
|
|
|
|
|
|
|
|
if (Next->Asl.Value.Integer > 15)
|
|
|
|
{
|
|
|
|
AslError (ASL_ERROR, ASL_MSG_SYNC_LEVEL, Next, NULL);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2003-08-07 16:38:31 +00:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: OpnDoMethod
|
|
|
|
*
|
|
|
|
* PARAMETERS: Op - The parent parse node
|
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Construct the operands for the METHOD ASL keyword.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-11-01 22:11:18 +00:00
|
|
|
static void
|
2003-08-07 16:38:31 +00:00
|
|
|
OpnDoMethod (
|
|
|
|
ACPI_PARSE_OBJECT *Op)
|
|
|
|
{
|
|
|
|
ACPI_PARSE_OBJECT *Next;
|
|
|
|
|
|
|
|
/* Optional arguments for this opcode with defaults */
|
|
|
|
|
|
|
|
UINT8 NumArgs = 0;
|
|
|
|
UINT8 Serialized = 0;
|
|
|
|
UINT8 Concurrency = 0;
|
|
|
|
UINT8 MethodFlags;
|
|
|
|
|
|
|
|
|
|
|
|
/* Opcode and package length first */
|
|
|
|
/* Method name */
|
|
|
|
|
|
|
|
Next = Op->Asl.Child;
|
|
|
|
|
|
|
|
/* Num args */
|
|
|
|
|
|
|
|
Next = Next->Asl.Next;
|
|
|
|
if (Next->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
|
|
|
{
|
|
|
|
NumArgs = (UINT8) Next->Asl.Value.Integer;
|
|
|
|
Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Serialized Flag */
|
|
|
|
|
|
|
|
Next = Next->Asl.Next;
|
|
|
|
if (Next->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
|
|
|
{
|
|
|
|
Serialized = (UINT8) Next->Asl.Value.Integer;
|
|
|
|
Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
|
|
|
|
}
|
|
|
|
|
2005-11-01 22:11:18 +00:00
|
|
|
/* Concurrency value (valid values are 0-15) */
|
2003-08-07 16:38:31 +00:00
|
|
|
|
|
|
|
Next = Next->Asl.Next;
|
|
|
|
if (Next->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
|
|
|
{
|
2012-09-14 22:53:11 +00:00
|
|
|
/* This is a ByteConstExpr, so eval the constant now */
|
|
|
|
|
|
|
|
OpcAmlConstantWalk (Next, 0, NULL);
|
|
|
|
|
2005-11-01 22:11:18 +00:00
|
|
|
if (Next->Asl.Value.Integer > 15)
|
|
|
|
{
|
|
|
|
AslError (ASL_ERROR, ASL_MSG_SYNC_LEVEL, Next, NULL);
|
|
|
|
}
|
2003-08-07 16:38:31 +00:00
|
|
|
Concurrency = (UINT8) Next->Asl.Value.Integer;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Put the bits in their proper places */
|
|
|
|
|
|
|
|
MethodFlags = (UINT8) ((NumArgs & 0x7) |
|
|
|
|
((Serialized & 0x1) << 3) |
|
|
|
|
((Concurrency & 0xF) << 4));
|
|
|
|
|
|
|
|
/* Use the last node for the combined flags byte */
|
|
|
|
|
|
|
|
Next->Asl.Value.Integer = MethodFlags;
|
|
|
|
Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
|
|
|
|
Next->Asl.AmlLength = 1;
|
|
|
|
Next->Asl.ParseOpcode = PARSEOP_RAW_DATA;
|
|
|
|
|
|
|
|
/* Save the arg count in the first node */
|
|
|
|
|
|
|
|
Op->Asl.Extra = NumArgs;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: OpnDoFieldCommon
|
|
|
|
*
|
|
|
|
* PARAMETERS: FieldOp - Node for an ASL field
|
|
|
|
* Op - The parent parse node
|
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Construct the AML operands for the various field keywords,
|
|
|
|
* FIELD, BANKFIELD, INDEXFIELD
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-11-01 22:11:18 +00:00
|
|
|
static void
|
2003-08-07 16:38:31 +00:00
|
|
|
OpnDoFieldCommon (
|
|
|
|
ACPI_PARSE_OBJECT *FieldOp,
|
|
|
|
ACPI_PARSE_OBJECT *Op)
|
|
|
|
{
|
|
|
|
ACPI_PARSE_OBJECT *Next;
|
|
|
|
ACPI_PARSE_OBJECT *PkgLengthNode;
|
|
|
|
UINT32 CurrentBitOffset;
|
|
|
|
UINT32 NewBitOffset;
|
|
|
|
UINT8 AccessType;
|
|
|
|
UINT8 LockRule;
|
|
|
|
UINT8 UpdateRule;
|
|
|
|
UINT8 FieldFlags;
|
|
|
|
UINT32 MinimumLength;
|
|
|
|
|
|
|
|
|
|
|
|
/* AccessType -- not optional, so no need to check for DEFAULT_ARG */
|
|
|
|
|
|
|
|
AccessType = (UINT8) Op->Asl.Value.Integer;
|
|
|
|
Op->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
|
|
|
|
|
|
|
|
/* Set the access type in the parent (field) node for use later */
|
|
|
|
|
|
|
|
FieldOp->Asl.Value.Integer = AccessType;
|
|
|
|
|
|
|
|
/* LockRule -- not optional, so no need to check for DEFAULT_ARG */
|
|
|
|
|
|
|
|
Next = Op->Asl.Next;
|
|
|
|
LockRule = (UINT8) Next->Asl.Value.Integer;
|
|
|
|
Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
|
|
|
|
|
|
|
|
/* UpdateRule -- not optional, so no need to check for DEFAULT_ARG */
|
|
|
|
|
|
|
|
Next = Next->Asl.Next;
|
|
|
|
UpdateRule = (UINT8) Next->Asl.Value.Integer;
|
|
|
|
|
|
|
|
/*
|
2012-10-19 18:47:57 +00:00
|
|
|
* Generate the flags byte. The various fields are already
|
2003-08-07 16:38:31 +00:00
|
|
|
* in the right bit position via translation from the
|
|
|
|
* keywords by the parser.
|
|
|
|
*/
|
|
|
|
FieldFlags = (UINT8) (AccessType | LockRule | UpdateRule);
|
|
|
|
|
|
|
|
/* Use the previous node to be the FieldFlags node */
|
|
|
|
|
|
|
|
/* Set the node to RAW_DATA */
|
|
|
|
|
|
|
|
Next->Asl.Value.Integer = FieldFlags;
|
|
|
|
Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
|
|
|
|
Next->Asl.AmlLength = 1;
|
|
|
|
Next->Asl.ParseOpcode = PARSEOP_RAW_DATA;
|
|
|
|
|
|
|
|
/* Process the FieldUnitList */
|
|
|
|
|
|
|
|
Next = Next->Asl.Next;
|
|
|
|
CurrentBitOffset = 0;
|
|
|
|
|
|
|
|
while (Next)
|
|
|
|
{
|
|
|
|
/* Save the offset of this field unit */
|
|
|
|
|
|
|
|
Next->Asl.ExtraValue = CurrentBitOffset;
|
|
|
|
|
|
|
|
switch (Next->Asl.ParseOpcode)
|
|
|
|
{
|
|
|
|
case PARSEOP_ACCESSAS:
|
|
|
|
|
|
|
|
PkgLengthNode = Next->Asl.Child;
|
|
|
|
AccessType = (UINT8) PkgLengthNode->Asl.Value.Integer;
|
|
|
|
|
|
|
|
/* Nothing additional to do */
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case PARSEOP_OFFSET:
|
|
|
|
|
|
|
|
/* New offset into the field */
|
|
|
|
|
|
|
|
PkgLengthNode = Next->Asl.Child;
|
|
|
|
NewBitOffset = ((UINT32) PkgLengthNode->Asl.Value.Integer) * 8;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Examine the specified offset in relation to the
|
|
|
|
* current offset counter.
|
|
|
|
*/
|
|
|
|
if (NewBitOffset < CurrentBitOffset)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Not allowed to specify a backwards offset!
|
|
|
|
* Issue error and ignore this node.
|
|
|
|
*/
|
2005-11-01 22:11:18 +00:00
|
|
|
AslError (ASL_ERROR, ASL_MSG_BACKWARDS_OFFSET, PkgLengthNode,
|
|
|
|
NULL);
|
2003-08-07 16:38:31 +00:00
|
|
|
Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
|
|
|
|
PkgLengthNode->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
|
|
|
|
}
|
|
|
|
else if (NewBitOffset == CurrentBitOffset)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Offset is redundant; we don't need to output an
|
2012-10-19 18:47:57 +00:00
|
|
|
* offset opcode. Just set these nodes to default
|
2003-08-07 16:38:31 +00:00
|
|
|
*/
|
|
|
|
Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
|
|
|
|
PkgLengthNode->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Valid new offset - set the value to be inserted into the AML
|
|
|
|
* and update the offset counter.
|
|
|
|
*/
|
2005-11-01 22:11:18 +00:00
|
|
|
PkgLengthNode->Asl.Value.Integer =
|
|
|
|
NewBitOffset - CurrentBitOffset;
|
2003-08-07 16:38:31 +00:00
|
|
|
CurrentBitOffset = NewBitOffset;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case PARSEOP_NAMESEG:
|
|
|
|
case PARSEOP_RESERVED_BYTES:
|
|
|
|
|
|
|
|
/* Named or reserved field entry */
|
|
|
|
|
|
|
|
PkgLengthNode = Next->Asl.Child;
|
|
|
|
NewBitOffset = (UINT32) PkgLengthNode->Asl.Value.Integer;
|
|
|
|
CurrentBitOffset += NewBitOffset;
|
|
|
|
|
|
|
|
/* Save the current AccessAs value for error checking later */
|
|
|
|
|
|
|
|
switch (AccessType)
|
|
|
|
{
|
|
|
|
case AML_FIELD_ACCESS_ANY:
|
|
|
|
case AML_FIELD_ACCESS_BYTE:
|
|
|
|
case AML_FIELD_ACCESS_BUFFER:
|
|
|
|
default:
|
|
|
|
MinimumLength = 8;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AML_FIELD_ACCESS_WORD:
|
|
|
|
MinimumLength = 16;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AML_FIELD_ACCESS_DWORD:
|
|
|
|
MinimumLength = 32;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AML_FIELD_ACCESS_QWORD:
|
|
|
|
MinimumLength = 64;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
PkgLengthNode->Asl.ExtraValue = MinimumLength;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
/* All supported field opcodes must appear above */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Move on to next entry in the field list */
|
|
|
|
|
|
|
|
Next = Next->Asl.Next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: OpnDoField
|
|
|
|
*
|
|
|
|
* PARAMETERS: Op - The parent parse node
|
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Construct the AML operands for the FIELD ASL keyword
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-11-01 22:11:18 +00:00
|
|
|
static void
|
2003-08-07 16:38:31 +00:00
|
|
|
OpnDoField (
|
|
|
|
ACPI_PARSE_OBJECT *Op)
|
|
|
|
{
|
|
|
|
ACPI_PARSE_OBJECT *Next;
|
|
|
|
|
|
|
|
|
|
|
|
/* Opcode is parent node */
|
|
|
|
/* First child is field name */
|
|
|
|
|
|
|
|
Next = Op->Asl.Child;
|
|
|
|
|
|
|
|
/* Second child is the AccessType */
|
|
|
|
|
|
|
|
OpnDoFieldCommon (Op, Next->Asl.Next);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: OpnDoIndexField
|
|
|
|
*
|
|
|
|
* PARAMETERS: Op - The parent parse node
|
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Construct the AML operands for the INDEXFIELD ASL keyword
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-11-01 22:11:18 +00:00
|
|
|
static void
|
2003-08-07 16:38:31 +00:00
|
|
|
OpnDoIndexField (
|
|
|
|
ACPI_PARSE_OBJECT *Op)
|
|
|
|
{
|
|
|
|
ACPI_PARSE_OBJECT *Next;
|
|
|
|
|
|
|
|
|
|
|
|
/* Opcode is parent node */
|
|
|
|
/* First child is the index name */
|
|
|
|
|
|
|
|
Next = Op->Asl.Child;
|
|
|
|
|
|
|
|
/* Second child is the data name */
|
|
|
|
|
|
|
|
Next = Next->Asl.Next;
|
|
|
|
|
|
|
|
/* Third child is the AccessType */
|
|
|
|
|
|
|
|
OpnDoFieldCommon (Op, Next->Asl.Next);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: OpnDoBankField
|
|
|
|
*
|
|
|
|
* PARAMETERS: Op - The parent parse node
|
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Construct the AML operands for the BANKFIELD ASL keyword
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-11-01 22:11:18 +00:00
|
|
|
static void
|
2003-08-07 16:38:31 +00:00
|
|
|
OpnDoBankField (
|
|
|
|
ACPI_PARSE_OBJECT *Op)
|
|
|
|
{
|
|
|
|
ACPI_PARSE_OBJECT *Next;
|
|
|
|
|
|
|
|
|
|
|
|
/* Opcode is parent node */
|
|
|
|
/* First child is the region name */
|
|
|
|
|
|
|
|
Next = Op->Asl.Child;
|
|
|
|
|
|
|
|
/* Second child is the bank name */
|
|
|
|
|
|
|
|
Next = Next->Asl.Next;
|
|
|
|
|
|
|
|
/* Third child is the bank value */
|
|
|
|
|
|
|
|
Next = Next->Asl.Next;
|
|
|
|
|
|
|
|
/* Fourth child is the AccessType */
|
|
|
|
|
|
|
|
OpnDoFieldCommon (Op, Next->Asl.Next);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: OpnDoRegion
|
|
|
|
*
|
|
|
|
* PARAMETERS: Op - The parent parse node
|
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
2012-10-19 18:47:57 +00:00
|
|
|
* DESCRIPTION: Tries to get the length of the region. Can only do this at
|
2003-08-07 16:38:31 +00:00
|
|
|
* compile time if the length is a constant.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-11-01 22:11:18 +00:00
|
|
|
static void
|
2003-08-07 16:38:31 +00:00
|
|
|
OpnDoRegion (
|
|
|
|
ACPI_PARSE_OBJECT *Op)
|
|
|
|
{
|
|
|
|
ACPI_PARSE_OBJECT *Next;
|
|
|
|
|
|
|
|
|
|
|
|
/* Opcode is parent node */
|
|
|
|
/* First child is the region name */
|
|
|
|
|
|
|
|
Next = Op->Asl.Child;
|
|
|
|
|
|
|
|
/* Second child is the space ID*/
|
|
|
|
|
|
|
|
Next = Next->Asl.Next;
|
|
|
|
|
|
|
|
/* Third child is the region offset */
|
|
|
|
|
|
|
|
Next = Next->Asl.Next;
|
|
|
|
|
|
|
|
/* Fourth child is the region length */
|
|
|
|
|
|
|
|
Next = Next->Asl.Next;
|
|
|
|
if (Next->Asl.ParseOpcode == PARSEOP_INTEGER)
|
|
|
|
{
|
|
|
|
Op->Asl.Value.Integer = Next->Asl.Value.Integer;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-01-21 20:56:18 +00:00
|
|
|
Op->Asl.Value.Integer = ACPI_UINT64_MAX;
|
2003-08-07 16:38:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: OpnDoBuffer
|
|
|
|
*
|
|
|
|
* PARAMETERS: Op - The parent parse node
|
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
2012-10-19 18:47:57 +00:00
|
|
|
* DESCRIPTION: Construct the AML operands for the BUFFER ASL keyword. We
|
2003-08-07 16:38:31 +00:00
|
|
|
* build a single raw byte buffer from the initialization nodes,
|
|
|
|
* each parse node contains a buffer byte.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-11-01 22:11:18 +00:00
|
|
|
static void
|
2003-08-07 16:38:31 +00:00
|
|
|
OpnDoBuffer (
|
|
|
|
ACPI_PARSE_OBJECT *Op)
|
|
|
|
{
|
|
|
|
ACPI_PARSE_OBJECT *InitializerOp;
|
|
|
|
ACPI_PARSE_OBJECT *BufferLengthOp;
|
|
|
|
|
|
|
|
/* Optional arguments for this opcode with defaults */
|
|
|
|
|
|
|
|
UINT32 BufferLength = 0;
|
|
|
|
|
|
|
|
|
|
|
|
/* Opcode and package length first */
|
|
|
|
/* Buffer Length is next, followed by the initializer list */
|
|
|
|
|
|
|
|
BufferLengthOp = Op->Asl.Child;
|
|
|
|
InitializerOp = BufferLengthOp->Asl.Next;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If the BufferLength is not an INTEGER or was not specified in the ASL
|
|
|
|
* (DEFAULT_ARG), it is a TermArg that is
|
|
|
|
* evaluated at run-time, and we are therefore finished.
|
|
|
|
*/
|
|
|
|
if ((BufferLengthOp->Asl.ParseOpcode != PARSEOP_INTEGER) &&
|
|
|
|
(BufferLengthOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We want to count the number of items in the initializer list, because if
|
|
|
|
* it is larger than the buffer length, we will define the buffer size
|
|
|
|
* to be the size of the initializer list (as per the ACPI Specification)
|
|
|
|
*/
|
|
|
|
switch (InitializerOp->Asl.ParseOpcode)
|
|
|
|
{
|
|
|
|
case PARSEOP_INTEGER:
|
|
|
|
case PARSEOP_BYTECONST:
|
|
|
|
case PARSEOP_WORDCONST:
|
|
|
|
case PARSEOP_DWORDCONST:
|
|
|
|
|
|
|
|
/* The peer list contains the byte list (if any...) */
|
|
|
|
|
|
|
|
while (InitializerOp)
|
|
|
|
{
|
|
|
|
/* For buffers, this is a list of raw bytes */
|
|
|
|
|
|
|
|
InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
|
|
|
|
InitializerOp->Asl.AmlLength = 1;
|
|
|
|
InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
|
|
|
|
|
|
|
|
BufferLength++;
|
|
|
|
InitializerOp = ASL_GET_PEER_NODE (InitializerOp);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case PARSEOP_STRING_LITERAL:
|
|
|
|
|
|
|
|
/*
|
2012-10-19 18:47:57 +00:00
|
|
|
* Only one initializer, the string. Buffer must be big enough to hold
|
2003-08-07 16:38:31 +00:00
|
|
|
* the string plus the null termination byte
|
|
|
|
*/
|
|
|
|
BufferLength = strlen (InitializerOp->Asl.Value.String) + 1;
|
|
|
|
|
|
|
|
InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER;
|
|
|
|
InitializerOp->Asl.AmlLength = BufferLength;
|
|
|
|
InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case PARSEOP_RAW_DATA:
|
|
|
|
|
|
|
|
/* Buffer nodes are already initialized (e.g. Unicode operator) */
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
case PARSEOP_DEFAULT_ARG:
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
AslError (ASL_ERROR, ASL_MSG_INVALID_OPERAND, InitializerOp,
|
|
|
|
"Unknown buffer initializer opcode");
|
|
|
|
printf ("Unknown buffer initializer opcode [%s]\n",
|
|
|
|
UtGetOpName (InitializerOp->Asl.ParseOpcode));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check if initializer list is longer than the buffer length */
|
|
|
|
|
|
|
|
if (BufferLengthOp->Asl.Value.Integer > BufferLength)
|
|
|
|
{
|
|
|
|
BufferLength = (UINT32) BufferLengthOp->Asl.Value.Integer;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!BufferLength)
|
|
|
|
{
|
2005-11-01 22:11:18 +00:00
|
|
|
/* No length AND no items -- issue notice */
|
2003-08-07 16:38:31 +00:00
|
|
|
|
2005-11-01 22:11:18 +00:00
|
|
|
AslError (ASL_REMARK, ASL_MSG_BUFFER_LENGTH, BufferLengthOp, NULL);
|
2003-08-07 16:38:31 +00:00
|
|
|
|
|
|
|
/* But go ahead and put the buffer length of zero into the AML */
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Just set the buffer size node to be the buffer length, regardless
|
|
|
|
* of whether it was previously an integer or a default_arg placeholder
|
|
|
|
*/
|
|
|
|
BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER;
|
|
|
|
BufferLengthOp->Asl.AmlOpcode = AML_DWORD_OP;
|
|
|
|
BufferLengthOp->Asl.Value.Integer = BufferLength;
|
|
|
|
|
|
|
|
(void) OpcSetOptimalIntegerSize (BufferLengthOp);
|
|
|
|
|
|
|
|
/* Remaining nodes are handled via the tree walk */
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: OpnDoPackage
|
|
|
|
*
|
|
|
|
* PARAMETERS: Op - The parent parse node
|
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
2012-10-19 18:47:57 +00:00
|
|
|
* DESCRIPTION: Construct the AML operands for the PACKAGE ASL keyword. NOTE:
|
2005-11-01 22:11:18 +00:00
|
|
|
* can only be called after constants have been folded, to ensure
|
|
|
|
* that the PackageLength operand has been fully reduced.
|
2003-08-07 16:38:31 +00:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
void
|
|
|
|
OpnDoPackage (
|
|
|
|
ACPI_PARSE_OBJECT *Op)
|
|
|
|
{
|
|
|
|
ACPI_PARSE_OBJECT *InitializerOp;
|
|
|
|
ACPI_PARSE_OBJECT *PackageLengthOp;
|
2005-11-01 22:11:18 +00:00
|
|
|
UINT32 PackageLength = 0;
|
2003-08-07 16:38:31 +00:00
|
|
|
|
|
|
|
|
2005-11-01 22:11:18 +00:00
|
|
|
/* Opcode and package length first, followed by the initializer list */
|
2003-08-07 16:38:31 +00:00
|
|
|
|
|
|
|
PackageLengthOp = Op->Asl.Child;
|
|
|
|
InitializerOp = PackageLengthOp->Asl.Next;
|
|
|
|
|
2005-11-01 22:11:18 +00:00
|
|
|
/* Count the number of items in the initializer list */
|
|
|
|
|
2003-08-07 16:38:31 +00:00
|
|
|
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
|
|
|
|
{
|
|
|
|
/* The peer list contains the byte list (if any...) */
|
|
|
|
|
|
|
|
while (InitializerOp)
|
|
|
|
{
|
|
|
|
PackageLength++;
|
|
|
|
InitializerOp = InitializerOp->Asl.Next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-11-01 22:11:18 +00:00
|
|
|
/* If package length is a constant, compare to the initializer list */
|
2003-08-07 16:38:31 +00:00
|
|
|
|
|
|
|
if ((PackageLengthOp->Asl.ParseOpcode == PARSEOP_INTEGER) ||
|
2005-11-01 22:11:18 +00:00
|
|
|
(PackageLengthOp->Asl.ParseOpcode == PARSEOP_QWORDCONST))
|
2003-08-07 16:38:31 +00:00
|
|
|
{
|
2009-11-16 18:28:41 +00:00
|
|
|
if (PackageLengthOp->Asl.Value.Integer > PackageLength)
|
2003-08-07 16:38:31 +00:00
|
|
|
{
|
2009-11-16 18:28:41 +00:00
|
|
|
/*
|
|
|
|
* Allow package length to be longer than the initializer
|
|
|
|
* list -- but if the length of initializer list is nonzero,
|
|
|
|
* issue a message since this is probably a coding error,
|
|
|
|
* even though technically legal.
|
|
|
|
*/
|
|
|
|
if (PackageLength > 0)
|
|
|
|
{
|
|
|
|
AslError (ASL_REMARK, ASL_MSG_LIST_LENGTH_SHORT,
|
|
|
|
PackageLengthOp, NULL);
|
|
|
|
}
|
2005-11-01 22:11:18 +00:00
|
|
|
|
2003-08-07 16:38:31 +00:00
|
|
|
PackageLength = (UINT32) PackageLengthOp->Asl.Value.Integer;
|
|
|
|
}
|
2009-11-16 18:28:41 +00:00
|
|
|
else if (PackageLengthOp->Asl.Value.Integer < PackageLength)
|
2005-11-01 22:11:18 +00:00
|
|
|
{
|
|
|
|
/*
|
2009-11-16 18:28:41 +00:00
|
|
|
* The package length is smaller than the length of the
|
|
|
|
* initializer list. This is an error as per the ACPI spec.
|
2005-11-01 22:11:18 +00:00
|
|
|
*/
|
2009-11-16 18:28:41 +00:00
|
|
|
AslError (ASL_ERROR, ASL_MSG_LIST_LENGTH_LONG,
|
|
|
|
PackageLengthOp, NULL);
|
2005-11-01 22:11:18 +00:00
|
|
|
}
|
2003-08-07 16:38:31 +00:00
|
|
|
}
|
|
|
|
|
2005-11-01 22:11:18 +00:00
|
|
|
if (PackageLengthOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* This is the case if the PackageLength was left empty - Package()
|
|
|
|
* The package length becomes the length of the initializer list
|
|
|
|
*/
|
|
|
|
Op->Asl.Child->Asl.ParseOpcode = PARSEOP_INTEGER;
|
|
|
|
Op->Asl.Child->Asl.Value.Integer = PackageLength;
|
|
|
|
|
|
|
|
/* Set the AML opcode */
|
|
|
|
|
|
|
|
(void) OpcSetOptimalIntegerSize (Op->Asl.Child);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If not a variable-length package, check for a zero package length */
|
|
|
|
|
2003-08-07 16:38:31 +00:00
|
|
|
if ((PackageLengthOp->Asl.ParseOpcode == PARSEOP_INTEGER) ||
|
2005-11-01 22:11:18 +00:00
|
|
|
(PackageLengthOp->Asl.ParseOpcode == PARSEOP_QWORDCONST) ||
|
2011-09-26 21:40:21 +00:00
|
|
|
(PackageLengthOp->Asl.ParseOpcode == PARSEOP_ZERO) ||
|
2003-08-07 16:38:31 +00:00
|
|
|
(PackageLengthOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG))
|
|
|
|
{
|
|
|
|
if (!PackageLength)
|
|
|
|
{
|
2005-11-01 22:11:18 +00:00
|
|
|
/* No length AND no initializer list -- issue a remark */
|
2003-08-07 16:38:31 +00:00
|
|
|
|
2005-11-01 22:11:18 +00:00
|
|
|
AslError (ASL_REMARK, ASL_MSG_PACKAGE_LENGTH,
|
|
|
|
PackageLengthOp, NULL);
|
2003-08-07 16:38:31 +00:00
|
|
|
|
|
|
|
/* But go ahead and put the buffer length of zero into the AML */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2005-11-01 22:11:18 +00:00
|
|
|
* If the PackageLength is a constant <= 255, we can change the
|
|
|
|
* AML opcode from VarPackage to a simple (ACPI 1.0) Package opcode.
|
2003-08-07 16:38:31 +00:00
|
|
|
*/
|
2011-09-26 21:40:21 +00:00
|
|
|
if (((Op->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER) &&
|
|
|
|
(Op->Asl.Child->Asl.Value.Integer <= 255)) ||
|
|
|
|
(Op->Asl.Child->Asl.ParseOpcode == PARSEOP_ONE) ||
|
|
|
|
(Op->Asl.Child->Asl.ParseOpcode == PARSEOP_ONES)||
|
|
|
|
(Op->Asl.Child->Asl.ParseOpcode == PARSEOP_ZERO))
|
2005-11-01 22:11:18 +00:00
|
|
|
{
|
|
|
|
Op->Asl.AmlOpcode = AML_PACKAGE_OP;
|
|
|
|
Op->Asl.ParseOpcode = PARSEOP_PACKAGE;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Just set the package size node to be the package length, regardless
|
|
|
|
* of whether it was previously an integer or a default_arg placeholder
|
|
|
|
*/
|
|
|
|
PackageLengthOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
|
|
|
|
PackageLengthOp->Asl.AmlLength = 1;
|
|
|
|
PackageLengthOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
|
|
|
|
PackageLengthOp->Asl.Value.Integer = PackageLength;
|
|
|
|
}
|
2003-08-07 16:38:31 +00:00
|
|
|
|
|
|
|
/* Remaining nodes are handled via the tree walk */
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: OpnDoLoadTable
|
|
|
|
*
|
|
|
|
* PARAMETERS: Op - The parent parse node
|
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Construct the AML operands for the LOADTABLE ASL keyword.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-11-01 22:11:18 +00:00
|
|
|
static void
|
2003-08-07 16:38:31 +00:00
|
|
|
OpnDoLoadTable (
|
|
|
|
ACPI_PARSE_OBJECT *Op)
|
|
|
|
{
|
|
|
|
ACPI_PARSE_OBJECT *Next;
|
|
|
|
|
|
|
|
|
|
|
|
/* Opcode is parent node */
|
|
|
|
/* First child is the table signature */
|
|
|
|
|
|
|
|
Next = Op->Asl.Child;
|
|
|
|
|
|
|
|
/* Second child is the OEM ID*/
|
|
|
|
|
|
|
|
Next = Next->Asl.Next;
|
|
|
|
|
|
|
|
/* Third child is the OEM table ID */
|
|
|
|
|
|
|
|
Next = Next->Asl.Next;
|
|
|
|
|
|
|
|
/* Fourth child is the RootPath string */
|
|
|
|
|
|
|
|
Next = Next->Asl.Next;
|
|
|
|
if (Next->Asl.ParseOpcode == PARSEOP_ZERO)
|
|
|
|
{
|
|
|
|
Next->Asl.ParseOpcode = PARSEOP_STRING_LITERAL;
|
|
|
|
Next->Asl.Value.String = "\\";
|
|
|
|
Next->Asl.AmlLength = 2;
|
|
|
|
OpcGenerateAmlOpcode (Next);
|
|
|
|
}
|
|
|
|
|
2005-11-01 22:11:18 +00:00
|
|
|
#ifdef ASL_FUTURE_IMPLEMENTATION
|
|
|
|
|
|
|
|
/* TBD: NOT IMPLEMENTED */
|
2003-08-07 16:38:31 +00:00
|
|
|
/* Fifth child is the [optional] ParameterPathString */
|
|
|
|
/* Sixth child is the [optional] ParameterData */
|
|
|
|
|
|
|
|
Next = Next->Asl.Next;
|
|
|
|
if (Next->Asl.ParseOpcode == DEFAULT_ARG)
|
|
|
|
{
|
|
|
|
Next->Asl.AmlLength = 1;
|
|
|
|
Next->Asl.ParseOpcode = ZERO;
|
|
|
|
OpcGenerateAmlOpcode (Next);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Next = Next->Asl.Next;
|
|
|
|
if (Next->Asl.ParseOpcode == DEFAULT_ARG)
|
|
|
|
{
|
|
|
|
Next->Asl.AmlLength = 1;
|
|
|
|
Next->Asl.ParseOpcode = ZERO;
|
|
|
|
OpcGenerateAmlOpcode (Next);
|
|
|
|
}
|
2005-11-01 22:11:18 +00:00
|
|
|
#endif
|
2003-08-07 16:38:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: OpnDoDefinitionBlock
|
|
|
|
*
|
|
|
|
* PARAMETERS: Op - The parent parse node
|
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Construct the AML operands for the DEFINITIONBLOCK ASL keyword
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-11-01 22:11:18 +00:00
|
|
|
static void
|
2003-08-07 16:38:31 +00:00
|
|
|
OpnDoDefinitionBlock (
|
|
|
|
ACPI_PARSE_OBJECT *Op)
|
|
|
|
{
|
|
|
|
ACPI_PARSE_OBJECT *Child;
|
|
|
|
ACPI_SIZE Length;
|
2009-06-01 21:02:40 +00:00
|
|
|
UINT32 i;
|
|
|
|
char *Filename;
|
2003-08-07 16:38:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
2012-10-19 18:47:57 +00:00
|
|
|
* These nodes get stuffed into the table header. They are special
|
2003-08-07 16:38:31 +00:00
|
|
|
* cased when the table is written to the output file.
|
|
|
|
*
|
|
|
|
* Mark all of these nodes as non-usable so they won't get output
|
|
|
|
* as AML opcodes!
|
|
|
|
*/
|
|
|
|
|
2007-03-22 17:24:05 +00:00
|
|
|
/* Get AML filename. Use it if non-null */
|
2003-08-07 16:38:31 +00:00
|
|
|
|
|
|
|
Child = Op->Asl.Child;
|
2007-03-22 17:24:05 +00:00
|
|
|
if (Child->Asl.Value.Buffer &&
|
|
|
|
*Child->Asl.Value.Buffer &&
|
|
|
|
(Gbl_UseDefaultAmlFilename))
|
2003-08-07 16:38:31 +00:00
|
|
|
{
|
2009-06-01 21:02:40 +00:00
|
|
|
/*
|
|
|
|
* We will use the AML filename that is embedded in the source file
|
|
|
|
* for the output filename.
|
|
|
|
*/
|
|
|
|
Filename = ACPI_ALLOCATE (strlen (Gbl_DirectoryPath) +
|
|
|
|
strlen ((char *) Child->Asl.Value.Buffer) + 1);
|
|
|
|
|
|
|
|
/* Prepend the current directory path */
|
|
|
|
|
|
|
|
strcpy (Filename, Gbl_DirectoryPath);
|
|
|
|
strcat (Filename, (char *) Child->Asl.Value.Buffer);
|
|
|
|
|
|
|
|
Gbl_OutputFilenamePrefix = Filename;
|
2003-08-07 16:38:31 +00:00
|
|
|
}
|
|
|
|
Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
|
|
|
|
|
|
|
|
/* Signature */
|
|
|
|
|
|
|
|
Child = Child->Asl.Next;
|
|
|
|
Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
|
|
|
|
if (Child->Asl.Value.String)
|
|
|
|
{
|
|
|
|
Gbl_TableSignature = Child->Asl.Value.String;
|
|
|
|
if (ACPI_STRLEN (Gbl_TableSignature) != 4)
|
|
|
|
{
|
2005-11-01 22:11:18 +00:00
|
|
|
AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child,
|
|
|
|
"Length not exactly 4");
|
2003-08-07 16:38:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
{
|
2010-01-21 20:56:18 +00:00
|
|
|
if (!isalnum ((int) Gbl_TableSignature[i]))
|
2003-08-07 16:38:31 +00:00
|
|
|
{
|
2005-11-01 22:11:18 +00:00
|
|
|
AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child,
|
|
|
|
"Contains non-alphanumeric characters");
|
2003-08-07 16:38:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Revision */
|
|
|
|
|
|
|
|
Child = Child->Asl.Next;
|
|
|
|
Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
|
2007-03-22 17:24:05 +00:00
|
|
|
/*
|
|
|
|
* We used the revision to set the integer width earlier
|
|
|
|
*/
|
2003-08-07 16:38:31 +00:00
|
|
|
|
|
|
|
/* OEMID */
|
|
|
|
|
|
|
|
Child = Child->Asl.Next;
|
|
|
|
Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
|
|
|
|
|
|
|
|
/* OEM TableID */
|
|
|
|
|
|
|
|
Child = Child->Asl.Next;
|
|
|
|
Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
|
|
|
|
if (Child->Asl.Value.String)
|
|
|
|
{
|
|
|
|
Length = ACPI_STRLEN (Child->Asl.Value.String);
|
|
|
|
Gbl_TableId = AcpiOsAllocate (Length + 1);
|
|
|
|
ACPI_STRCPY (Gbl_TableId, Child->Asl.Value.String);
|
|
|
|
|
|
|
|
for (i = 0; i < Length; i++)
|
|
|
|
{
|
|
|
|
if (Gbl_TableId[i] == ' ')
|
|
|
|
{
|
|
|
|
Gbl_TableId[i] = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* OEM Revision */
|
|
|
|
|
|
|
|
Child = Child->Asl.Next;
|
|
|
|
Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: UtGetArg
|
|
|
|
*
|
|
|
|
* PARAMETERS: Op - Get an argument for this op
|
|
|
|
* Argn - Nth argument to get
|
|
|
|
*
|
2012-10-19 18:47:57 +00:00
|
|
|
* RETURN: The argument (as an Op object). NULL if argument does not exist
|
2003-08-07 16:38:31 +00:00
|
|
|
*
|
|
|
|
* DESCRIPTION: Get the specified op's argument (peer)
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
ACPI_PARSE_OBJECT *
|
|
|
|
UtGetArg (
|
|
|
|
ACPI_PARSE_OBJECT *Op,
|
|
|
|
UINT32 Argn)
|
|
|
|
{
|
|
|
|
ACPI_PARSE_OBJECT *Arg = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
/* Get the requested argument object */
|
|
|
|
|
|
|
|
Arg = Op->Asl.Child;
|
|
|
|
while (Arg && Argn)
|
|
|
|
{
|
|
|
|
Argn--;
|
|
|
|
Arg = Arg->Asl.Next;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (Arg);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: OpnAttachNameToNode
|
|
|
|
*
|
|
|
|
* PARAMETERS: Op - The parent parse node
|
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
|
|
|
* DESCRIPTION: For the named ASL/AML operators, get the actual name from the
|
|
|
|
* argument list and attach it to the parent node so that we
|
|
|
|
* can get to it quickly later.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-11-01 22:11:18 +00:00
|
|
|
static void
|
2003-08-07 16:38:31 +00:00
|
|
|
OpnAttachNameToNode (
|
|
|
|
ACPI_PARSE_OBJECT *Op)
|
|
|
|
{
|
|
|
|
ACPI_PARSE_OBJECT *Child = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
if (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL)
|
|
|
|
{
|
|
|
|
Child = UtGetArg (Op, 0);
|
|
|
|
}
|
|
|
|
else switch (Op->Asl.AmlOpcode)
|
|
|
|
{
|
|
|
|
case AML_DATA_REGION_OP:
|
|
|
|
case AML_DEVICE_OP:
|
|
|
|
case AML_EVENT_OP:
|
|
|
|
case AML_METHOD_OP:
|
|
|
|
case AML_MUTEX_OP:
|
|
|
|
case AML_REGION_OP:
|
|
|
|
case AML_POWER_RES_OP:
|
|
|
|
case AML_PROCESSOR_OP:
|
|
|
|
case AML_THERMAL_ZONE_OP:
|
|
|
|
case AML_NAME_OP:
|
|
|
|
case AML_SCOPE_OP:
|
|
|
|
|
|
|
|
Child = UtGetArg (Op, 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AML_ALIAS_OP:
|
|
|
|
|
|
|
|
Child = UtGetArg (Op, 1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AML_CREATE_BIT_FIELD_OP:
|
|
|
|
case AML_CREATE_BYTE_FIELD_OP:
|
|
|
|
case AML_CREATE_WORD_FIELD_OP:
|
|
|
|
case AML_CREATE_DWORD_FIELD_OP:
|
|
|
|
case AML_CREATE_QWORD_FIELD_OP:
|
|
|
|
|
|
|
|
Child = UtGetArg (Op, 2);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AML_CREATE_FIELD_OP:
|
|
|
|
|
|
|
|
Child = UtGetArg (Op, 3);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AML_BANK_FIELD_OP:
|
|
|
|
case AML_INDEX_FIELD_OP:
|
|
|
|
case AML_FIELD_OP:
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Child)
|
|
|
|
{
|
|
|
|
UtAttachNamepathToOwner (Op, Child);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: OpnGenerateAmlOperands
|
|
|
|
*
|
|
|
|
* PARAMETERS: Op - The parent parse node
|
|
|
|
*
|
|
|
|
* RETURN: None
|
|
|
|
*
|
2012-10-19 18:47:57 +00:00
|
|
|
* DESCRIPTION: Prepare nodes to be output as AML data and operands. The more
|
2003-08-07 16:38:31 +00:00
|
|
|
* complex AML opcodes require processing of the child nodes
|
|
|
|
* (arguments/operands).
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
void
|
|
|
|
OpnGenerateAmlOperands (
|
|
|
|
ACPI_PARSE_OBJECT *Op)
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
if (Op->Asl.AmlOpcode == AML_RAW_DATA_BYTE)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (Op->Asl.ParseOpcode)
|
|
|
|
{
|
|
|
|
case PARSEOP_DEFINITIONBLOCK:
|
|
|
|
OpnDoDefinitionBlock (Op);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PARSEOP_METHOD:
|
|
|
|
OpnDoMethod (Op);
|
|
|
|
break;
|
|
|
|
|
2005-11-01 22:11:18 +00:00
|
|
|
case PARSEOP_MUTEX:
|
|
|
|
OpnDoMutex (Op);
|
|
|
|
break;
|
|
|
|
|
2003-08-07 16:38:31 +00:00
|
|
|
case PARSEOP_FIELD:
|
|
|
|
OpnDoField (Op);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PARSEOP_INDEXFIELD:
|
|
|
|
OpnDoIndexField (Op);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PARSEOP_BANKFIELD:
|
|
|
|
OpnDoBankField (Op);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PARSEOP_BUFFER:
|
|
|
|
OpnDoBuffer (Op);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PARSEOP_LOADTABLE:
|
|
|
|
OpnDoLoadTable (Op);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PARSEOP_OPERATIONREGION:
|
|
|
|
OpnDoRegion (Op);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PARSEOP_RESOURCETEMPLATE:
|
|
|
|
RsDoResourceTemplate (Op);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PARSEOP_NAMESEG:
|
|
|
|
case PARSEOP_NAMESTRING:
|
|
|
|
case PARSEOP_METHODCALL:
|
|
|
|
case PARSEOP_STRING_LITERAL:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* TBD: move */
|
|
|
|
|
|
|
|
OpnAttachNameToNode (Op);
|
|
|
|
}
|