/******************************************************************************
*
* Module Name: dsopcode - Dispatcher support for regions and fields
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* 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.
*/
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "amlcode.h"
#include "acdispat.h"
#include "acinterp.h"
#include "acnamesp.h"
#include "acevents.h"
#include "actables.h"
ACPI_MODULE_NAME ("dsopcode")
/* Local prototypes */
static ACPI_STATUS
/*******************************************************************************
*
* FUNCTION: AcpiDsInitializeRegion
*
* PARAMETERS: ObjHandle - Region namespace node
*
* RETURN: Status
*
* DESCRIPTION: Front end to EvInitializeRegion
*
******************************************************************************/
{
/* Namespace is NOT locked */
return (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiDsInitBufferField
*
* PARAMETERS: AmlOpcode - CreateXxxField
* ObjDesc - BufferField object
* BufferDesc - Host Buffer
* OffsetDesc - Offset into buffer
* LengthDesc - Length of field (CREATE_FIELD_OP only)
* ResultDesc - Where to store the result
*
* RETURN: Status
*
* DESCRIPTION: Perform actual initialization of a buffer field
*
******************************************************************************/
static ACPI_STATUS
{
/* Host object must be a Buffer */
{
"Target of Create Field is not a Buffer object - %s",
goto Cleanup;
}
/*
* The last parameter to all of these opcodes (ResultDesc) started
* out as a NameString, and should therefore now be a NS node
* after resolution in AcpiExResolveOperands().
*/
{
"(%s) destination not a NS Node [%s]",
goto Cleanup;
}
/*
* Setup the Bit offsets and counts, according to the opcode
*/
switch (AmlOpcode)
{
case AML_CREATE_FIELD_OP:
/* Offset is in bits, count is in bits */
/* Must have a valid (>0) bit count */
if (BitCount == 0)
{
"Attempt to CreateField of length zero"));
goto Cleanup;
}
break;
case AML_CREATE_BIT_FIELD_OP:
/* Offset is in bits, Field is one bit */
BitCount = 1;
break;
case AML_CREATE_BYTE_FIELD_OP:
/* Offset is in bytes, field is one byte */
BitCount = 8;
break;
case AML_CREATE_WORD_FIELD_OP:
/* Offset is in bytes, field is one word */
BitCount = 16;
break;
/* Offset is in bytes, field is one dword */
BitCount = 32;
break;
/* Offset is in bytes, field is one qword */
BitCount = 64;
break;
default:
"Unknown field creation opcode 0x%02X",
AmlOpcode));
goto Cleanup;
}
/* Entire field must fit within the current length of the buffer */
{
"Field [%4.4s] at %u exceeds Buffer [%4.4s] size %u (bits)",
goto Cleanup;
}
/*
* Initialize areas of the field object that are common to all fields
* For FieldFlags, use LOCK_RULE = 0 (NO_LOCK),
* UPDATE_RULE = 0 (UPDATE_PRESERVE)
*/
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
/* Reference count for BufferDesc inherits ObjDesc count */
/* Always delete the operands */
if (AmlOpcode == AML_CREATE_FIELD_OP)
{
}
/* On failure, delete the result descriptor */
if (ACPI_FAILURE (Status))
{
}
else
{
/* Now the address and length are valid for this BufferField */
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDsEvalBufferFieldOperands
*
* PARAMETERS: WalkState - Current walk
* Op - A valid BufferField Op object
*
* RETURN: Status
*
* DESCRIPTION: Get BufferField Buffer and Index
* Called from AcpiDsExecEndOp during BufferField parse tree walk
*
******************************************************************************/
{
/*
* This is where we evaluate the address and length fields of the
* CreateXxxField declaration
*/
/* NextOp points to the op that holds the Buffer */
if (ACPI_FAILURE (Status))
{
}
if (!ObjDesc)
{
}
/* Resolve the operands */
if (ACPI_FAILURE (Status))
{
}
/* Initialize the Buffer Field */
{
/* NOTE: Slightly different operands for this opcode */
}
else
{
/* All other, CreateXxxField opcodes */
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDsEvalRegionOperands
*
* PARAMETERS: WalkState - Current walk
* Op - A valid region Op object
*
* RETURN: Status
*
* DESCRIPTION: Get region address and length
* Called from AcpiDsExecEndOp during OpRegion parse tree walk
*
******************************************************************************/
{
/*
* This is where we evaluate the address and length fields of the
* OpRegion declaration
*/
/* NextOp points to the op that holds the SpaceID */
/* NextOp points to address op */
if (ACPI_FAILURE (Status))
{
}
/* Resolve the length and address operands to numbers */
if (ACPI_FAILURE (Status))
{
}
if (!ObjDesc)
{
}
/*
* Get the length operand and save it
* (at Top of stack)
*/
/*
* Get the address and save it
* (at top of stack - 1)
*/
/* Now the address and length are valid for this opregion */
}
/*******************************************************************************
*
* FUNCTION: AcpiDsEvalTableRegionOperands
*
* PARAMETERS: WalkState - Current walk
* Op - A valid region Op object
*
* RETURN: Status
*
* DESCRIPTION: Get region address and length.
* Called from AcpiDsExecEndOp during DataTableRegion parse
* tree walk.
*
******************************************************************************/
{
/*
* This is where we evaluate the Signature string, OemId string,
* and OemTableId string of the Data Table Region declaration
*/
/* NextOp points to Signature string op */
/*
* and OemTableId string operands
*/
if (ACPI_FAILURE (Status))
{
}
/*
* Resolve the Signature string, OemId string,
* and OemTableId string operands
*/
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
/* Find the ACPI table */
if (ACPI_FAILURE (Status))
{
if (Status == AE_NOT_FOUND)
{
}
goto Cleanup;
}
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
if (!ObjDesc)
{
goto Cleanup;
}
/* Now the address and length are valid for this opregion */
AcpiUtRemoveReference (Operand[0]);
}
/*******************************************************************************
*
* FUNCTION: AcpiDsEvalDataObjectOperands
*
* PARAMETERS: WalkState - Current walk
* Op - A valid DataObject Op object
* ObjDesc - DataObject
*
* RETURN: Status
*
* DESCRIPTION: Get the operands and complete the following data object types:
* Buffer, Package.
*
******************************************************************************/
{
/* The first operand (for all of these data objects) is the length */
/*
* Set proper index into operand stack for AcpiDsObjStackPush
* invoked inside AcpiDsCreateOperand.
*/
if (ACPI_FAILURE (Status))
{
}
if (ACPI_FAILURE (Status))
{
}
/* Extract length operand */
/* Cleanup for length operand */
if (ACPI_FAILURE (Status))
{
}
/*
* Create the actual data object
*/
{
case AML_BUFFER_OP:
break;
case AML_PACKAGE_OP:
case AML_VAR_PACKAGE_OP:
break;
default:
}
if (ACPI_SUCCESS (Status))
{
/*
* Return the object in the WalkState, unless the parent is a package -
* in this case, the return object will be stored in the parse tree
* for the package.
*/
{
}
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDsEvalBankFieldOperands
*
* PARAMETERS: WalkState - Current walk
* Op - A valid BankField Op object
*
* RETURN: Status
*
* DESCRIPTION: Get BankField BankValue
* Called from AcpiDsExecEndOp during BankField parse tree walk
*
******************************************************************************/
{
/*
* This is where we evaluate the BankValue field of the
* BankField declaration
*/
/* NextOp points to the op that holds the Region */
/* NextOp points to the op that holds the Bank Register */
/* NextOp points to the op that holds the Bank Value */
/*
* Set proper index into operand stack for AcpiDsObjStackPush
* invoked inside AcpiDsCreateOperand.
*
* We use WalkState->Operands[0] to store the evaluated BankValue
*/
WalkState->OperandIndex = 0;
if (ACPI_FAILURE (Status))
{
}
if (ACPI_FAILURE (Status))
{
}
/*
* Get the BankValue operand and save it
* (at Top of stack)
*/
/* Arg points to the start Bank Field */
while (Arg)
{
/* Ignore OFFSET and ACCESSAS terms here */
{
if (!ObjDesc)
{
}
}
/* Move to next field in the list */
}
}