summaryrefslogtreecommitdiff
path: root/sys/contrib/dev/acpica/Subsystem/Dispatcher
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/Subsystem/Dispatcher')
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Dispatcher/dsfield.c546
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Dispatcher/dsmethod.c645
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Dispatcher/dsmthdat.c897
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Dispatcher/dsobject.c816
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Dispatcher/dsopcode.c1089
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Dispatcher/dsutils.c948
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Dispatcher/dswexec.c829
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Dispatcher/dswload.c929
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Dispatcher/dswscope.c268
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Dispatcher/dswstate.c1149
10 files changed, 0 insertions, 8116 deletions
diff --git a/sys/contrib/dev/acpica/Subsystem/Dispatcher/dsfield.c b/sys/contrib/dev/acpica/Subsystem/Dispatcher/dsfield.c
deleted file mode 100644
index 11f304da90c2..000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Dispatcher/dsfield.c
+++ /dev/null
@@ -1,546 +0,0 @@
-/******************************************************************************
- *
- * Module Name: dsfield - Dispatcher field routines
- * $Revision: 31 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 1. Copyright Notice
- *
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, 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 __DSFIELD_C__
-
-#include "acpi.h"
-#include "amlcode.h"
-#include "acdispat.h"
-#include "acinterp.h"
-#include "acnamesp.h"
-
-
-#define _COMPONENT DISPATCHER
- MODULE_NAME ("dsfield")
-
-
-/*
- * Field flags: Bits 00 - 03 : AccessType (AnyAcc, ByteAcc, etc.)
- * 04 : LockRule (1 == Lock)
- * 05 - 06 : UpdateRule
- */
-
-#define FIELD_ACCESS_TYPE_MASK 0x0F
-#define FIELD_LOCK_RULE_MASK 0x10
-#define FIELD_UPDATE_RULE_MASK 0x60
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsCreateField
- *
- * PARAMETERS: Op - Op containing the Field definition and args
- * RegionNode - Object for the containing Operation Region
- *
- * RETURN: Status
- *
- * DESCRIPTION: Create a new field in the specified operation region
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsCreateField (
- ACPI_PARSE_OBJECT *Op,
- ACPI_NAMESPACE_NODE *RegionNode,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_STATUS Status = AE_AML_ERROR;
- ACPI_PARSE_OBJECT *Arg;
- ACPI_NAMESPACE_NODE *Node;
- UINT8 FieldFlags;
- UINT8 AccessAttribute = 0;
- UINT32 FieldBitPosition = 0;
-
-
- FUNCTION_TRACE_PTR ("DsCreateField", Op);
-
-
- /* First arg is the name of the parent OpRegion */
-
- Arg = Op->Value.Arg;
- if (!RegionNode)
- {
- Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.Name,
- ACPI_TYPE_REGION, IMODE_EXECUTE,
- NS_SEARCH_PARENT, WalkState,
- &RegionNode);
-
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- }
-
- /* Second arg is the field flags */
-
- Arg = Arg->Next;
- FieldFlags = (UINT8) Arg->Value.Integer;
-
- /* Each remaining arg is a Named Field */
-
- Arg = Arg->Next;
- while (Arg)
- {
- switch (Arg->Opcode)
- {
- case AML_RESERVEDFIELD_OP:
-
- FieldBitPosition += Arg->Value.Size;
- break;
-
-
- case AML_ACCESSFIELD_OP:
-
- /*
- * Get a new AccessType and AccessAttribute for all
- * entries (until end or another AccessAs keyword)
- */
-
- AccessAttribute = (UINT8) Arg->Value.Integer;
- FieldFlags = (UINT8)
- ((FieldFlags & FIELD_ACCESS_TYPE_MASK) ||
- ((UINT8) (Arg->Value.Integer >> 8)));
- break;
-
-
- case AML_NAMEDFIELD_OP:
-
- Status = AcpiNsLookup (WalkState->ScopeInfo,
- (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)Arg)->Name,
- INTERNAL_TYPE_DEF_FIELD,
- IMODE_LOAD_PASS1,
- NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
- NULL, &Node);
-
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /*
- * Initialize an object for the new Node that is on
- * the object stack
- */
-
- Status = AcpiAmlPrepDefFieldValue (Node, RegionNode, FieldFlags,
- AccessAttribute, FieldBitPosition, Arg->Value.Size);
-
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Keep track of bit position for *next* field */
-
- FieldBitPosition += Arg->Value.Size;
- break;
- }
-
- Arg = Arg->Next;
- }
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsCreateBankField
- *
- * PARAMETERS: Op - Op containing the Field definition and args
- * RegionNode - Object for the containing Operation Region
- *
- * RETURN: Status
- *
- * DESCRIPTION: Create a new bank field in the specified operation region
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsCreateBankField (
- ACPI_PARSE_OBJECT *Op,
- ACPI_NAMESPACE_NODE *RegionNode,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_STATUS Status = AE_AML_ERROR;
- ACPI_PARSE_OBJECT *Arg;
- ACPI_NAMESPACE_NODE *RegisterNode;
- ACPI_NAMESPACE_NODE *Node;
- UINT32 BankValue;
- UINT8 FieldFlags;
- UINT8 AccessAttribute = 0;
- UINT32 FieldBitPosition = 0;
-
-
- FUNCTION_TRACE_PTR ("DsCreateBankField", Op);
-
-
- /* First arg is the name of the parent OpRegion */
-
- Arg = Op->Value.Arg;
- if (!RegionNode)
- {
- Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.Name,
- ACPI_TYPE_REGION, IMODE_EXECUTE,
- NS_SEARCH_PARENT, WalkState,
- &RegionNode);
-
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- }
-
- /* Second arg is the Bank Register */
-
- Arg = Arg->Next;
-
- Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String,
- INTERNAL_TYPE_BANK_FIELD_DEFN,
- IMODE_LOAD_PASS1,
- NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
- NULL, &RegisterNode);
-
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Third arg is the BankValue */
-
- Arg = Arg->Next;
- BankValue = Arg->Value.Integer;
-
-
- /* Next arg is the field flags */
-
- Arg = Arg->Next;
- FieldFlags = (UINT8) Arg->Value.Integer;
-
- /* Each remaining arg is a Named Field */
-
- Arg = Arg->Next;
- while (Arg)
- {
- switch (Arg->Opcode)
- {
- case AML_RESERVEDFIELD_OP:
-
- FieldBitPosition += Arg->Value.Size;
- break;
-
-
- case AML_ACCESSFIELD_OP:
-
- /*
- * Get a new AccessType and AccessAttribute for
- * all entries (until end or another AccessAs keyword)
- */
-
- AccessAttribute = (UINT8) Arg->Value.Integer;
- FieldFlags = (UINT8)
- ((FieldFlags & FIELD_ACCESS_TYPE_MASK) ||
- ((UINT8) (Arg->Value.Integer >> 8)));
- break;
-
-
- case AML_NAMEDFIELD_OP:
-
- Status = AcpiNsLookup (WalkState->ScopeInfo,
- (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)Arg)->Name,
- INTERNAL_TYPE_DEF_FIELD,
- IMODE_LOAD_PASS1,
- NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
- NULL, &Node);
-
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /*
- * Initialize an object for the new Node that is on
- * the object stack
- */
-
- Status = AcpiAmlPrepBankFieldValue (Node, RegionNode, RegisterNode,
- BankValue, FieldFlags, AccessAttribute,
- FieldBitPosition, Arg->Value.Size);
-
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Keep track of bit position for the *next* field */
-
- FieldBitPosition += Arg->Value.Size;
- break;
-
- }
-
- Arg = Arg->Next;
- }
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsCreateIndexField
- *
- * PARAMETERS: Op - Op containing the Field definition and args
- * RegionNode - Object for the containing Operation Region
- *
- * RETURN: Status
- *
- * DESCRIPTION: Create a new index field in the specified operation region
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsCreateIndexField (
- ACPI_PARSE_OBJECT *Op,
- ACPI_HANDLE RegionNode,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_STATUS Status;
- ACPI_PARSE_OBJECT *Arg;
- ACPI_NAMESPACE_NODE *Node;
- ACPI_NAMESPACE_NODE *IndexRegisterNode;
- ACPI_NAMESPACE_NODE *DataRegisterNode;
- UINT8 FieldFlags;
- UINT8 AccessAttribute = 0;
- UINT32 FieldBitPosition = 0;
-
-
- FUNCTION_TRACE_PTR ("DsCreateIndexField", Op);
-
-
- Arg = Op->Value.Arg;
-
- /* First arg is the name of the Index register */
-
- Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String,
- ACPI_TYPE_ANY, IMODE_LOAD_PASS1,
- NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
- NULL, &IndexRegisterNode);
-
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Second arg is the data register */
-
- Arg = Arg->Next;
-
- Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String,
- INTERNAL_TYPE_INDEX_FIELD_DEFN,
- IMODE_LOAD_PASS1,
- NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
- NULL, &DataRegisterNode);
-
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
-
- /* Next arg is the field flags */
-
- Arg = Arg->Next;
- FieldFlags = (UINT8) Arg->Value.Integer;
-
-
- /* Each remaining arg is a Named Field */
-
- Arg = Arg->Next;
- while (Arg)
- {
- switch (Arg->Opcode)
- {
- case AML_RESERVEDFIELD_OP:
-
- FieldBitPosition += Arg->Value.Size;
- break;
-
-
- case AML_ACCESSFIELD_OP:
-
- /*
- * Get a new AccessType and AccessAttribute for all
- * entries (until end or another AccessAs keyword)
- */
-
- AccessAttribute = (UINT8) Arg->Value.Integer;
- FieldFlags = (UINT8)
- ((FieldFlags & FIELD_ACCESS_TYPE_MASK) ||
- ((UINT8) (Arg->Value.Integer >> 8)));
- break;
-
-
- case AML_NAMEDFIELD_OP:
-
- Status = AcpiNsLookup (WalkState->ScopeInfo,
- (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)Arg)->Name,
- INTERNAL_TYPE_INDEX_FIELD,
- IMODE_LOAD_PASS1,
- NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
- NULL, &Node);
-
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /*
- * Initialize an object for the new Node that is on
- * the object stack
- */
-
- Status = AcpiAmlPrepIndexFieldValue (Node, IndexRegisterNode, DataRegisterNode,
- FieldFlags, AccessAttribute,
- FieldBitPosition, Arg->Value.Size);
-
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Keep track of bit position for the *next* field */
-
- FieldBitPosition += Arg->Value.Size;
- break;
-
-
- default:
-
- DEBUG_PRINT (ACPI_ERROR,
- ("DsEnterIndexField: Invalid opcode in field list: %X\n",
- Arg->Opcode));
- Status = AE_AML_ERROR;
- break;
- }
-
- Arg = Arg->Next;
- }
-
- return_ACPI_STATUS (Status);
-}
-
-
diff --git a/sys/contrib/dev/acpica/Subsystem/Dispatcher/dsmethod.c b/sys/contrib/dev/acpica/Subsystem/Dispatcher/dsmethod.c
deleted file mode 100644
index 02e1322318d4..000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Dispatcher/dsmethod.c
+++ /dev/null
@@ -1,645 +0,0 @@
-/******************************************************************************
- *
- * Module Name: dsmethod - Parser/Interpreter interface - control method parsing
- * $Revision: 56 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 1. Copyright Notice
- *
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, 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 __DSMETHOD_C__
-
-#include "acpi.h"
-#include "acparser.h"
-#include "amlcode.h"
-#include "acdispat.h"
-#include "acinterp.h"
-#include "acnamesp.h"
-#include "actables.h"
-#include "acdebug.h"
-
-
-#define _COMPONENT DISPATCHER
- MODULE_NAME ("dsmethod")
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsParseMethod
- *
- * PARAMETERS: ObjHandle - Node of the method
- * Level - Current nesting level
- * Context - Points to a method counter
- * ReturnValue - Not used
- *
- * RETURN: Status
- *
- * DESCRIPTION: Call the parser and parse the AML that is
- * associated with the method.
- *
- * MUTEX: Assumes parser is locked
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsParseMethod (
- ACPI_HANDLE ObjHandle)
-{
- ACPI_STATUS Status;
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_PARSE_OBJECT *Op;
- ACPI_NAMESPACE_NODE *Node;
- ACPI_OWNER_ID OwnerId;
-
-
- FUNCTION_TRACE_PTR ("DsParseMethod", ObjHandle);
-
-
- /* Parameter Validation */
-
- if (!ObjHandle)
- {
- return_ACPI_STATUS (AE_NULL_ENTRY);
- }
-
- DEBUG_PRINT (ACPI_INFO,
- ("DsParseMethod: **** Parsing [%4.4s] **** NamedObj=%p\n",
- &((ACPI_NAMESPACE_NODE *)ObjHandle)->Name, ObjHandle));
-
-
- /* Extract the method object from the method Node */
-
- Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
- ObjDesc = Node->Object;
- if (!ObjDesc)
- {
- return_ACPI_STATUS (AE_NULL_OBJECT);
- }
-
- /* Create a mutex for the method if there is a concurrency limit */
-
- if ((ObjDesc->Method.Concurrency != INFINITE_CONCURRENCY) &&
- (!ObjDesc->Method.Semaphore))
- {
- Status = AcpiOsCreateSemaphore (1,ObjDesc->Method.Concurrency,
- &ObjDesc->Method.Semaphore);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- }
-
- /*
- * Allocate a new parser op to be the root of the parsed
- * method tree
- */
-
- Op = AcpiPsAllocOp (AML_METHOD_OP);
- if (!Op)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /* Init new op with the method name and pointer back to the Node */
-
- AcpiPsSetName (Op, Node->Name);
- Op->Node = Node;
-
-
- /*
- * Parse the method, first pass
- *
- * The first pass load is
- * where newly declared named objects are
- * added into the namespace. Actual evaluation of
- * the named objects (what would be called a "second
- * pass") happens during the actual execution of the
- * method so that operands to the named objects can
- * take on dynamic run-time values.
- */
-
- Status = AcpiPsParseAml (Op, ObjDesc->Method.Pcode,
- ObjDesc->Method.PcodeLength,
- ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE,
- Node, NULL, NULL,
- AcpiDsLoad1BeginOp, AcpiDsLoad1EndOp);
-
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Get a new OwnerId for objects created by this method */
-
- OwnerId = AcpiCmAllocateOwnerId (OWNER_TYPE_METHOD);
- ObjDesc->Method.OwningId = OwnerId;
-
- DEBUG_PRINT (ACPI_INFO,
- ("DsParseMethod: **** [%4.4s] Parsed **** NamedObj=%p Op=%p\n",
- &((ACPI_NAMESPACE_NODE *)ObjHandle)->Name, ObjHandle, Op));
-
- /* Install the parsed tree in the method object */
- /* TBD: [Restructure] Obsolete field? */
-
- AcpiPsDeleteParseTree (Op);
-
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsBeginMethodExecution
- *
- * PARAMETERS: MethodNode - Node of the method
- * ObjDesc - The method object
- *
- * RETURN: Status
- *
- * DESCRIPTION: Prepare a method for execution. Parses the method if necessary,
- * increments the thread count, and waits at the method semaphore
- * for clearance to execute.
- *
- * MUTEX: Locks/unlocks parser.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsBeginMethodExecution (
- ACPI_NAMESPACE_NODE *MethodNode,
- ACPI_OPERAND_OBJECT *ObjDesc)
-{
- ACPI_STATUS Status = AE_OK;
-
-
- FUNCTION_TRACE_PTR ("DsBeginMethodExecution", MethodNode);
-
-
- if (!MethodNode)
- {
- return_ACPI_STATUS (AE_NULL_ENTRY);
- }
-
- ObjDesc = AcpiNsGetAttachedObject (MethodNode);
- if (!ObjDesc)
- {
- return_ACPI_STATUS (AE_NULL_OBJECT);
- }
-
-
- /*
- * If there is a concurrency limit on this method, we need to
- * obtain a unit from the method semaphore. This releases the
- * interpreter if we block
- */
-
- if (ObjDesc->Method.Semaphore)
- {
- Status = AcpiAmlSystemWaitSemaphore (ObjDesc->Method.Semaphore,
- WAIT_FOREVER);
- }
-
-
- /*
- * Increment the method parse tree thread count since there
- * is one additional thread executing in it. If configured
- * for deletion-on-exit, the parse tree will be deleted when
- * the last thread completes execution of the method
- */
-
- ObjDesc->Method.ThreadCount++;
-
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsCallControlMethod
- *
- * PARAMETERS: WalkState - Current state of the walk
- * Op - Current Op to be walked
- *
- * RETURN: Status
- *
- * DESCRIPTION: Transfer execution to a called control method
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsCallControlMethod (
- ACPI_WALK_LIST *WalkList,
- ACPI_WALK_STATE *ThisWalkState,
- ACPI_PARSE_OBJECT *Op)
-{
- ACPI_STATUS Status;
- ACPI_NAMESPACE_NODE *MethodNode;
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_WALK_STATE *NextWalkState;
- ACPI_PARSE_STATE *ParserState;
- UINT32 i;
-
-
- FUNCTION_TRACE_PTR ("DsCallControlMethod", ThisWalkState);
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("DsCall, execute method %p, currentstate=%p\n",
- ThisWalkState->PrevOp, ThisWalkState));
-
- /*
- * Get the namespace entry for the control method we are about to call
- */
-
- MethodNode = ThisWalkState->MethodCallNode;
- if (!MethodNode)
- {
- return_ACPI_STATUS (AE_NULL_ENTRY);
- }
-
- ObjDesc = AcpiNsGetAttachedObject (MethodNode);
- if (!ObjDesc)
- {
- return_ACPI_STATUS (AE_NULL_OBJECT);
- }
-
-
- /* Init for new method, wait on concurrency semaphore */
-
- Status = AcpiDsBeginMethodExecution (MethodNode, ObjDesc);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
-
- /* Create and initialize a new parser state */
-
- ParserState = AcpiPsCreateState (ObjDesc->Method.Pcode,
- ObjDesc->Method.PcodeLength);
- if (!ParserState)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- AcpiPsInitScope (ParserState, NULL);
- ParserState->StartNode = MethodNode;
-
-
- /* Create a new state for the preempting walk */
-
- NextWalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwningId,
- NULL, ObjDesc, WalkList);
- if (!NextWalkState)
- {
- /* TBD: delete parser state */
-
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- NextWalkState->WalkType = WALK_METHOD;
- NextWalkState->MethodNode = MethodNode;
- NextWalkState->ParserState = ParserState;
- NextWalkState->ParseFlags = ThisWalkState->ParseFlags;
- NextWalkState->DescendingCallback = ThisWalkState->DescendingCallback;
- NextWalkState->AscendingCallback = ThisWalkState->AscendingCallback;
-
- /* The NextOp of the NextWalk will be the beginning of the method */
- /* TBD: [Restructure] -- obsolete? */
-
- NextWalkState->NextOp = NULL;
-
- /* Open a new scope */
-
- Status = AcpiDsScopeStackPush (MethodNode,
- ACPI_TYPE_METHOD, NextWalkState);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
-
- /*
- * Initialize the arguments for the method. The resolved
- * arguments were put on the previous walk state's operand
- * stack. Operands on the previous walk state stack always
- * start at index 0.
- */
-
- Status = AcpiDsMethodDataInitArgs (&ThisWalkState->Operands[0],
- ThisWalkState->NumOperands,
- NextWalkState);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
-
- /* Create and init a Root Node */
-
- Op = AcpiPsAllocOp (AML_SCOPE_OP);
- if (!Op)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- Status = AcpiPsParseAml (Op, ObjDesc->Method.Pcode,
- ObjDesc->Method.PcodeLength,
- ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE,
- MethodNode, NULL, NULL,
- AcpiDsLoad1BeginOp, AcpiDsLoad1EndOp);
- AcpiPsDeleteParseTree (Op);
-
-
- /*
- * Delete the operands on the previous walkstate operand stack
- * (they were copied to new objects)
- */
-
- for (i = 0; i < ObjDesc->Method.ParamCount; i++)
- {
- AcpiCmRemoveReference (ThisWalkState->Operands [i]);
- ThisWalkState->Operands [i] = NULL;
- }
-
- /* Clear the operand stack */
-
- ThisWalkState->NumOperands = 0;
-
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("DsCall, starting nested execution, newstate=%p\n", NextWalkState));
-
- return_ACPI_STATUS (AE_OK);
-
-
- /* On error, we must delete the new walk state */
-
-Cleanup:
- AcpiDsTerminateControlMethod (NextWalkState);
- AcpiDsDeleteWalkState (NextWalkState);
- return_ACPI_STATUS (Status);
-
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsRestartControlMethod
- *
- * PARAMETERS: WalkState - State of the method when it was preempted
- * Op - Pointer to new current op
- *
- * RETURN: Status
- *
- * DESCRIPTION: Restart a method that was preempted
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsRestartControlMethod (
- ACPI_WALK_STATE *WalkState,
- ACPI_OPERAND_OBJECT *ReturnDesc)
-{
- ACPI_STATUS Status;
-
-
- FUNCTION_TRACE_PTR ("DsRestartControlMethod", WalkState);
-
-
- if (ReturnDesc)
- {
- if (WalkState->ReturnUsed)
- {
- /*
- * Get the return value (if any) from the previous method.
- * NULL if no return value
- */
-
- Status = AcpiDsResultPush (ReturnDesc, WalkState);
- if (ACPI_FAILURE (Status))
- {
- AcpiCmRemoveReference (ReturnDesc);
- return_ACPI_STATUS (Status);
- }
- }
-
- else
- {
- /*
- * Delete the return value if it will not be used by the
- * calling method
- */
- AcpiCmRemoveReference (ReturnDesc);
- }
-
- }
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("DsRestart: Method=%p Return=%p ReturnUsed?=%X ResStack=%p State=%p\n",
- WalkState->MethodCallOp, ReturnDesc, WalkState->ReturnUsed,
- WalkState->Results, WalkState));
-
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsTerminateControlMethod
- *
- * PARAMETERS: WalkState - State of the method
- *
- * RETURN: Status
- *
- * DESCRIPTION: Terminate a control method. Delete everything that the method
- * created, delete all locals and arguments, and delete the parse
- * tree if requested.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsTerminateControlMethod (
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_STATUS Status;
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_NAMESPACE_NODE *MethodNode;
-
-
- FUNCTION_TRACE_PTR ("DsTerminateControlMethod", WalkState);
-
-
- /* The method object should be stored in the walk state */
-
- ObjDesc = WalkState->MethodDesc;
- if (!ObjDesc)
- {
- return_ACPI_STATUS (AE_OK);
- }
-
- /* Delete all arguments and locals */
-
- AcpiDsMethodDataDeleteAll (WalkState);
-
- /*
- * Lock the parser while we terminate this method.
- * If this is the last thread executing the method,
- * we have additional cleanup to perform
- */
-
- AcpiCmAcquireMutex (ACPI_MTX_PARSER);
-
-
- /* Signal completion of the execution of this method if necessary */
-
- if (WalkState->MethodDesc->Method.Semaphore)
- {
- Status = AcpiOsSignalSemaphore (
- WalkState->MethodDesc->Method.Semaphore, 1);
- }
-
- /* Decrement the thread count on the method parse tree */
-
- WalkState->MethodDesc->Method.ThreadCount--;
- if (!WalkState->MethodDesc->Method.ThreadCount)
- {
- /*
- * There are no more threads executing this method. Perform
- * additional cleanup.
- *
- * The method Node is stored in the walk state
- */
- MethodNode = WalkState->MethodNode;
- /*
- * Delete any namespace entries created immediately underneath
- * the method
- */
- AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE);
- if (MethodNode->Child)
- {
- AcpiNsDeleteNamespaceSubtree (MethodNode);
- }
-
- /*
- * Delete any namespace entries created anywhere else within
- * the namespace
- */
- AcpiNsDeleteNamespaceByOwner (WalkState->MethodDesc->Method.OwningId);
- AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE);
- }
-
- AcpiCmReleaseMutex (ACPI_MTX_PARSER);
- return_ACPI_STATUS (AE_OK);
-}
-
-
diff --git a/sys/contrib/dev/acpica/Subsystem/Dispatcher/dsmthdat.c b/sys/contrib/dev/acpica/Subsystem/Dispatcher/dsmthdat.c
deleted file mode 100644
index 0734ce6f2d1d..000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Dispatcher/dsmthdat.c
+++ /dev/null
@@ -1,897 +0,0 @@
-/*******************************************************************************
- *
- * Module Name: dsmthdat - control method arguments and local variables
- * $Revision: 39 $
- *
- ******************************************************************************/
-
-/******************************************************************************
- *
- * 1. Copyright Notice
- *
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, 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 __DSMTHDAT_C__
-
-#include "acpi.h"
-#include "acparser.h"
-#include "acdispat.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-
-
-#define _COMPONENT DISPATCHER
- MODULE_NAME ("dsmthdat")
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsMethodDataInit
- *
- * PARAMETERS: WalkState - Current walk state object
- *
- * RETURN: Status
- *
- * DESCRIPTION: Initialize the data structures that hold the method's arguments
- * and locals. The data struct is an array of NTEs for each.
- * This allows RefOf and DeRefOf to work properly for these
- * special data types.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsMethodDataInit (
- ACPI_WALK_STATE *WalkState)
-{
- UINT32 i;
-
-
- FUNCTION_TRACE ("DsMethodDataInit");
-
- /*
- * WalkState fields are initialized to zero by the
- * AcpiCmCallocate().
- *
- * An Node is assigned to each argument and local so
- * that RefOf() can return a pointer to the Node.
- */
-
- /* Init the method arguments */
-
- for (i = 0; i < MTH_NUM_ARGS; i++)
- {
- MOVE_UNALIGNED32_TO_32 (&WalkState->Arguments[i].Name,
- NAMEOF_ARG_NTE);
- WalkState->Arguments[i].Name |= (i << 24);
- WalkState->Arguments[i].DataType = ACPI_DESC_TYPE_NAMED;
- WalkState->Arguments[i].Type = ACPI_TYPE_ANY;
- WalkState->Arguments[i].Flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG;
- }
-
- /* Init the method locals */
-
- for (i = 0; i < MTH_NUM_LOCALS; i++)
- {
- MOVE_UNALIGNED32_TO_32 (&WalkState->LocalVariables[i].Name,
- NAMEOF_LOCAL_NTE);
-
- WalkState->LocalVariables[i].Name |= (i << 24);
- WalkState->LocalVariables[i].DataType = ACPI_DESC_TYPE_NAMED;
- WalkState->LocalVariables[i].Type = ACPI_TYPE_ANY;
- WalkState->LocalVariables[i].Flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL;
- }
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsMethodDataDeleteAll
- *
- * PARAMETERS: WalkState - Current walk state object
- *
- * RETURN: Status
- *
- * DESCRIPTION: Delete method locals and arguments. Arguments are only
- * deleted if this method was called from another method.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsMethodDataDeleteAll (
- ACPI_WALK_STATE *WalkState)
-{
- UINT32 Index;
- ACPI_OPERAND_OBJECT *Object;
-
-
- FUNCTION_TRACE ("DsMethodDataDeleteAll");
-
-
- /* Delete the locals */
-
- DEBUG_PRINT (ACPI_INFO,
- ("MethodDeleteAll: Deleting local variables in %p\n", WalkState));
-
- for (Index = 0; Index < MTH_NUM_LOCALS; Index++)
- {
- Object = WalkState->LocalVariables[Index].Object;
- if (Object)
- {
- DEBUG_PRINT (TRACE_EXEC,
- ("MethodDeleteAll: Deleting Local%d=%p\n", Index, Object));
-
- /* Remove first */
-
- WalkState->LocalVariables[Index].Object = NULL;
-
- /* Was given a ref when stored */
-
- AcpiCmRemoveReference (Object);
- }
- }
-
-
- /* Delete the arguments */
-
- DEBUG_PRINT (ACPI_INFO,
- ("MethodDeleteAll: Deleting arguments in %p\n", WalkState));
-
- for (Index = 0; Index < MTH_NUM_ARGS; Index++)
- {
- Object = WalkState->Arguments[Index].Object;
- if (Object)
- {
- DEBUG_PRINT (TRACE_EXEC,
- ("MethodDeleteAll: Deleting Arg%d=%p\n", Index, Object));
-
- /* Remove first */
-
- WalkState->Arguments[Index].Object = NULL;
-
- /* Was given a ref when stored */
-
- AcpiCmRemoveReference (Object);
- }
- }
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsMethodDataInitArgs
- *
- * PARAMETERS: *Params - Pointer to a parameter list for the method
- * MaxParamCount - The arg count for this method
- * WalkState - Current walk state object
- *
- * RETURN: Status
- *
- * DESCRIPTION: Initialize arguments for a method
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsMethodDataInitArgs (
- ACPI_OPERAND_OBJECT **Params,
- UINT32 MaxParamCount,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_STATUS Status;
- UINT32 Mindex;
- UINT32 Pindex;
-
-
- FUNCTION_TRACE_PTR ("DsMethodDataInitArgs", Params);
-
-
- if (!Params)
- {
- DEBUG_PRINT (TRACE_EXEC,
- ("DsMethodDataInitArgs: No param list passed to method\n"));
- return_ACPI_STATUS (AE_OK);
- }
-
- /* Copy passed parameters into the new method stack frame */
-
- for (Pindex = Mindex = 0;
- (Mindex < MTH_NUM_ARGS) && (Pindex < MaxParamCount);
- Mindex++)
- {
- if (Params[Pindex])
- {
- /*
- * A valid parameter.
- * Set the current method argument to the
- * Params[Pindex++] argument object descriptor
- */
- Status = AcpiDsMethodDataSetValue (MTH_TYPE_ARG, Mindex,
- Params[Pindex], WalkState);
- if (ACPI_FAILURE (Status))
- {
- break;
- }
-
- Pindex++;
- }
-
- else
- {
- break;
- }
- }
-
- DEBUG_PRINT (TRACE_EXEC,
- ("DsMethodDataInitArgs: %d args passed to method\n", Pindex));
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsMethodDataGetEntry
- *
- * PARAMETERS: Type - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG
- * Index - Which localVar or argument to get
- * Entry - Pointer to where a pointer to the stack
- * entry is returned.
- * WalkState - Current walk state object
- *
- * RETURN: Status
- *
- * DESCRIPTION: Get the address of the stack entry given by Type:Index
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsMethodDataGetEntry (
- UINT32 Type,
- UINT32 Index,
- ACPI_WALK_STATE *WalkState,
- ACPI_OPERAND_OBJECT ***Entry)
-{
-
- FUNCTION_TRACE_U32 ("DsMethodDataGetEntry", Index);
-
-
- /*
- * Get the requested object.
- * The stack "Type" is either a LocalVariable or an Argument
- */
-
- switch (Type)
- {
-
- case MTH_TYPE_LOCAL:
-
- if (Index > MTH_MAX_LOCAL)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("DsMethodDataGetEntry: LocalVar index %d is invalid (max %d)\n",
- Index, MTH_MAX_LOCAL));
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- *Entry =
- (ACPI_OPERAND_OBJECT **) &WalkState->LocalVariables[Index].Object;
- break;
-
-
- case MTH_TYPE_ARG:
-
- if (Index > MTH_MAX_ARG)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("DsMethodDataGetEntry: Argument index %d is invalid (max %d)\n",
- Index, MTH_MAX_ARG));
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- *Entry =
- (ACPI_OPERAND_OBJECT **) &WalkState->Arguments[Index].Object;
- break;
-
-
- default:
- DEBUG_PRINT (ACPI_ERROR,
- ("DsMethodDataGetEntry: Stack type %d is invalid\n",
- Type));
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsMethodDataSetEntry
- *
- * PARAMETERS: Type - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG
- * Index - Which localVar or argument to get
- * Object - Object to be inserted into the stack entry
- * WalkState - Current walk state object
- *
- * RETURN: Status
- *
- * DESCRIPTION: Insert an object onto the method stack at entry Type:Index.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsMethodDataSetEntry (
- UINT32 Type,
- UINT32 Index,
- ACPI_OPERAND_OBJECT *Object,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_STATUS Status;
- ACPI_OPERAND_OBJECT **Entry;
-
-
- FUNCTION_TRACE ("DsMethodDataSetEntry");
-
- /* Get a pointer to the stack entry to set */
-
- Status = AcpiDsMethodDataGetEntry (Type, Index, WalkState, &Entry);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Increment ref count so object can't be deleted while installed */
-
- AcpiCmAddReference (Object);
-
- /* Install the object into the stack entry */
-
- *Entry = Object;
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsMethodDataGetType
- *
- * PARAMETERS: Type - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG
- * Index - Which localVar or argument whose type
- * to get
- * WalkState - Current walk state object
- *
- * RETURN: Data type of selected Arg or Local
- * Used only in ExecMonadic2()/TypeOp.
- *
- ******************************************************************************/
-
-OBJECT_TYPE_INTERNAL
-AcpiDsMethodDataGetType (
- UINT32 Type,
- UINT32 Index,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_STATUS Status;
- ACPI_OPERAND_OBJECT **Entry;
- ACPI_OPERAND_OBJECT *Object;
-
-
- FUNCTION_TRACE ("DsMethodDataGetType");
-
-
- /* Get a pointer to the requested stack entry */
-
- Status = AcpiDsMethodDataGetEntry (Type, Index, WalkState, &Entry);
- if (ACPI_FAILURE (Status))
- {
- return_VALUE ((ACPI_TYPE_NOT_FOUND));
- }
-
- /* Get the object from the method stack */
-
- Object = *Entry;
-
- /* Get the object type */
-
- if (!Object)
- {
- /* Any == 0 => "uninitialized" -- see spec 15.2.3.5.2.28 */
- return_VALUE (ACPI_TYPE_ANY);
- }
-
- return_VALUE (Object->Common.Type);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsMethodDataGetNte
- *
- * PARAMETERS: Type - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG
- * Index - Which localVar or argument whose type
- * to get
- * WalkState - Current walk state object
- *
- * RETURN: Get the Node associated with a local or arg.
- *
- ******************************************************************************/
-
-ACPI_NAMESPACE_NODE *
-AcpiDsMethodDataGetNte (
- UINT32 Type,
- UINT32 Index,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_NAMESPACE_NODE *Node = NULL;
-
-
- FUNCTION_TRACE ("DsMethodDataGetNte");
-
-
- switch (Type)
- {
-
- case MTH_TYPE_LOCAL:
-
- if (Index > MTH_MAX_LOCAL)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("DsMethodDataGetEntry: LocalVar index %d is invalid (max %d)\n",
- Index, MTH_MAX_LOCAL));
- return_PTR (Node);
- }
-
- Node = &WalkState->LocalVariables[Index];
- break;
-
-
- case MTH_TYPE_ARG:
-
- if (Index > MTH_MAX_ARG)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("DsMethodDataGetEntry: Argument index %d is invalid (max %d)\n",
- Index, MTH_MAX_ARG));
- return_PTR (Node);
- }
-
- Node = &WalkState->Arguments[Index];
- break;
-
-
- default:
- DEBUG_PRINT (ACPI_ERROR,
- ("DsMethodDataGetEntry: Stack type %d is invalid\n",
- Type));
- break;
- }
-
-
- return_PTR (Node);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsMethodDataGetValue
- *
- * PARAMETERS: Type - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG
- * Index - Which localVar or argument to get
- * WalkState - Current walk state object
- * *DestDesc - Ptr to Descriptor into which selected Arg
- * or Local value should be copied
- *
- * RETURN: Status
- *
- * DESCRIPTION: Retrieve value of selected Arg or Local from the method frame
- * at the current top of the method stack.
- * Used only in AcpiAmlResolveToValue().
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsMethodDataGetValue (
- UINT32 Type,
- UINT32 Index,
- ACPI_WALK_STATE *WalkState,
- ACPI_OPERAND_OBJECT **DestDesc)
-{
- ACPI_STATUS Status;
- ACPI_OPERAND_OBJECT **Entry;
- ACPI_OPERAND_OBJECT *Object;
-
-
- FUNCTION_TRACE ("DsMethodDataGetValue");
-
-
- /* Validate the object descriptor */
-
- if (!DestDesc)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("DsMethodDataGetValue: NULL object descriptor pointer\n"));
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
-
- /* Get a pointer to the requested method stack entry */
-
- Status = AcpiDsMethodDataGetEntry (Type, Index, WalkState, &Entry);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Get the object from the method stack */
-
- Object = *Entry;
-
-
- /* Examine the returned object, it must be valid. */
-
- if (!Object)
- {
- /*
- * Index points to uninitialized object stack value.
- * This means that either 1) The expected argument was
- * not passed to the method, or 2) A local variable
- * was referenced by the method (via the ASL)
- * before it was initialized. Either case is an error.
- */
-
- switch (Type)
- {
- case MTH_TYPE_ARG:
-
- DEBUG_PRINT (ACPI_ERROR,
- ("DsMethodDataGetValue: Uninitialized Arg[%d] at entry %p\n",
- Index, Entry));
-
- return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG);
- break;
-
- case MTH_TYPE_LOCAL:
-
- DEBUG_PRINT (ACPI_ERROR,
- ("DsMethodDataGetValue: Uninitialized Local[%d] at entry %p\n",
- Index, Entry));
-
- return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL);
- break;
- }
- }
-
-
- /*
- * Index points to initialized and valid object stack value.
- * Return an additional reference to the object
- */
-
- *DestDesc = Object;
- AcpiCmAddReference (Object);
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsMethodDataDeleteValue
- *
- * PARAMETERS: Type - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG
- * Index - Which localVar or argument to delete
- * WalkState - Current walk state object
- *
- * RETURN: Status
- *
- * DESCRIPTION: Delete the entry at Type:Index on the method stack. Inserts
- * a null into the stack slot after the object is deleted.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsMethodDataDeleteValue (
- UINT32 Type,
- UINT32 Index,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_STATUS Status;
- ACPI_OPERAND_OBJECT **Entry;
- ACPI_OPERAND_OBJECT *Object;
-
-
- FUNCTION_TRACE ("DsMethodDataDeleteValue");
-
-
- /* Get a pointer to the requested entry */
-
- Status = AcpiDsMethodDataGetEntry (Type, Index, WalkState, &Entry);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Get the current entry in this slot k */
-
- Object = *Entry;
-
- /*
- * Undefine the Arg or Local by setting its descriptor
- * pointer to NULL. Locals/Args can contain both
- * ACPI_OPERAND_OBJECTS and ACPI_NAMESPACE_NODEs
- */
- *Entry = NULL;
-
-
- if ((Object) &&
- (VALID_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_INTERNAL)))
- {
- /*
- * There is a valid object in this slot
- * Decrement the reference count by one to balance the
- * increment when the object was stored in the slot.
- */
- AcpiCmRemoveReference (Object);
- }
-
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsMethodDataSetValue
- *
- * PARAMETERS: Type - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG
- * Index - Which localVar or argument to set
- * SrcDesc - Value to be stored
- * WalkState - Current walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Store a value in an Arg or Local. The SrcDesc is installed
- * as the new value for the Arg or Local and the reference count
- * for SrcDesc is incremented.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsMethodDataSetValue (
- UINT32 Type,
- UINT32 Index,
- ACPI_OPERAND_OBJECT *SrcDesc,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_STATUS Status;
- ACPI_OPERAND_OBJECT **Entry;
-
-
- FUNCTION_TRACE ("DsMethodDataSetValue");
- DEBUG_PRINT (TRACE_EXEC,
- ("DsMethodDataSetValue: Type=%d Idx=%d Obj=%p\n",
- Type, Index, SrcDesc));
-
-
- /* Parameter validation */
-
- if (!SrcDesc)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
-
- /* Get a pointer to the requested method stack entry */
-
- Status = AcpiDsMethodDataGetEntry (Type, Index, WalkState, &Entry);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
- if (*Entry == SrcDesc)
- {
- DEBUG_PRINT (TRACE_EXEC,
- ("DsMethodDataSetValue: Obj=%p already installed!\n",
- SrcDesc));
- goto Cleanup;
- }
-
-
- /*
- * If there is an object already in this slot, we either
- * have to delete it, or if this is an argument and there
- * is an object reference stored there, we have to do
- * an indirect store!
- */
-
- if (*Entry)
- {
- /*
- * Check for an indirect store if an argument
- * contains an object reference (stored as an Node).
- * We don't allow this automatic dereferencing for
- * locals, since a store to a local should overwrite
- * anything there, including an object reference.
- *
- * If both Arg0 and Local0 contain RefOf (Local4):
- *
- * Store (1, Arg0) - Causes indirect store to local4
- * Store (1, Local0) - Stores 1 in local0, overwriting
- * the reference to local4
- * Store (1, DeRefof (Local0)) - Causes indirect store to local4
- *
- * Weird, but true.
- */
-
- if ((Type == MTH_TYPE_ARG) &&
- (VALID_DESCRIPTOR_TYPE (*Entry, ACPI_DESC_TYPE_NAMED)))
- {
- DEBUG_PRINT (TRACE_EXEC,
- ("DsMethodDataSetValue: Arg (%p) is an ObjRef(Node), storing in %p\n",
- SrcDesc, *Entry));
-
- /* Detach an existing object from the Node */
-
- AcpiNsDetachObject ((ACPI_NAMESPACE_NODE *) *Entry);
-
- /*
- * Store this object into the Node
- * (do the indirect store)
- */
- Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) *Entry, SrcDesc,
- SrcDesc->Common.Type);
- return_ACPI_STATUS (Status);
- }
-
-
- /*
- * Perform "Implicit conversion" of the new object to the type of the
- * existing object
- */
- Status = AcpiAmlConvertToTargetType ((*Entry)->Common.Type, &SrcDesc, WalkState);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
- /*
- * Delete the existing object
- * before storing the new one
- */
- AcpiDsMethodDataDeleteValue (Type, Index, WalkState);
- }
-
-
- /*
- * Install the ObjStack descriptor (*SrcDesc) into
- * the descriptor for the Arg or Local.
- * Install the new object in the stack entry
- * (increments the object reference count by one)
- */
- Status = AcpiDsMethodDataSetEntry (Type, Index, SrcDesc, WalkState);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
- /* Normal exit */
-
- return_ACPI_STATUS (AE_OK);
-
-
- /* Error exit */
-
-Cleanup:
-
- return_ACPI_STATUS (Status);
-}
-
diff --git a/sys/contrib/dev/acpica/Subsystem/Dispatcher/dsobject.c b/sys/contrib/dev/acpica/Subsystem/Dispatcher/dsobject.c
deleted file mode 100644
index 13bf56ae523f..000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Dispatcher/dsobject.c
+++ /dev/null
@@ -1,816 +0,0 @@
-/******************************************************************************
- *
- * Module Name: dsobject - Dispatcher object management routines
- * $Revision: 57 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 1. Copyright Notice
- *
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, 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 __DSOBJECT_C__
-
-#include "acpi.h"
-#include "acparser.h"
-#include "amlcode.h"
-#include "acdispat.h"
-#include "acinterp.h"
-#include "acnamesp.h"
-
-#define _COMPONENT DISPATCHER
- MODULE_NAME ("dsobject")
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsInitOneObject
- *
- * PARAMETERS: ObjHandle - Node
- * Level - Current nesting level
- * Context - Points to a init info struct
- * ReturnValue - Not used
- *
- * RETURN: Status
- *
- * DESCRIPTION: Callback from AcpiWalkNamespace. Invoked for every object
- * within the namespace.
- *
- * Currently, the only objects that require initialization are:
- * 1) Methods
- * 2) Op Regions
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsInitOneObject (
- ACPI_HANDLE ObjHandle,
- UINT32 Level,
- void *Context,
- void **ReturnValue)
-{
- OBJECT_TYPE_INTERNAL Type;
- ACPI_STATUS Status;
- ACPI_INIT_WALK_INFO *Info = (ACPI_INIT_WALK_INFO *) Context;
- UINT8 TableRevision;
-
-
- Info->ObjectCount++;
- TableRevision = Info->TableDesc->Pointer->Revision;
-
- /*
- * We are only interested in objects owned by the table that
- * was just loaded
- */
-
- if (((ACPI_NAMESPACE_NODE *) ObjHandle)->OwnerId !=
- Info->TableDesc->TableId)
- {
- return (AE_OK);
- }
-
-
- /* And even then, we are only interested in a few object types */
-
- Type = AcpiNsGetType (ObjHandle);
-
- switch (Type)
- {
-
- case ACPI_TYPE_REGION:
-
- AcpiDsInitializeRegion (ObjHandle);
-
- Info->OpRegionCount++;
- break;
-
-
- case ACPI_TYPE_METHOD:
-
- Info->MethodCount++;
-
- if (!(AcpiDbgLevel & TRACE_INIT))
- {
- DEBUG_PRINT_RAW (ACPI_OK, ("."));
- }
-
- /*
- * Set the execution data width (32 or 64) based upon the
- * revision number of the parent ACPI table.
- */
-
- if (TableRevision == 1)
- {
- ((ACPI_NAMESPACE_NODE *)ObjHandle)->Flags |= ANOBJ_DATA_WIDTH_32;
- }
-
- /*
- * Always parse methods to detect errors, we may delete
- * the parse tree below
- */
-
- Status = AcpiDsParseMethod (ObjHandle);
-
- /* TBD: [Errors] what do we do with an error? */
-
- if (ACPI_FAILURE (Status))
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("DsInitOneObject: Method %p [%4.4s] parse failed! %s\n",
- ObjHandle, &((ACPI_NAMESPACE_NODE *)ObjHandle)->Name,
- AcpiCmFormatException (Status)));
- break;
- }
-
- /*
- * Delete the parse tree. We simple re-parse the method
- * for every execution since there isn't much overhead
- */
- AcpiNsDeleteNamespaceSubtree (ObjHandle);
- break;
-
- default:
- break;
- }
-
- /*
- * We ignore errors from above, and always return OK, since
- * we don't want to abort the walk on a single error.
- */
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsInitializeObjects
- *
- * PARAMETERS: None
- *
- * RETURN: Status
- *
- * DESCRIPTION: Walk the entire namespace and perform any necessary
- * initialization on the objects found therein
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsInitializeObjects (
- ACPI_TABLE_DESC *TableDesc,
- ACPI_NAMESPACE_NODE *StartNode)
-{
- ACPI_STATUS Status;
- ACPI_INIT_WALK_INFO Info;
-
-
- FUNCTION_TRACE ("DsInitializeObjects");
-
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("DsInitializeObjects: **** Starting initialization of namespace objects ****\n"));
- DEBUG_PRINT_RAW (ACPI_OK, ("Parsing Methods:"));
-
-
- Info.MethodCount = 0;
- Info.OpRegionCount = 0;
- Info.ObjectCount = 0;
- Info.TableDesc = TableDesc;
-
-
- /* Walk entire namespace from the supplied root */
-
- Status = AcpiWalkNamespace (ACPI_TYPE_ANY, StartNode,
- ACPI_UINT32_MAX, AcpiDsInitOneObject,
- &Info, NULL);
- if (ACPI_FAILURE (Status))
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("DsInitializeObjects: WalkNamespace failed! %x\n", Status));
- }
-
- DEBUG_PRINT_RAW (ACPI_OK,
- ("\n%d Control Methods found and parsed (%d nodes total)\n",
- Info.MethodCount, Info.ObjectCount));
- DEBUG_PRINT (TRACE_DISPATCH,
- ("DsInitializeObjects: %d Control Methods found\n", Info.MethodCount));
- DEBUG_PRINT (TRACE_DISPATCH,
- ("DsInitializeObjects: %d Op Regions found\n", Info.OpRegionCount));
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiDsInitObjectFromOp
- *
- * PARAMETERS: Op - Parser op used to init the internal object
- * Opcode - AML opcode associated with the object
- * ObjDesc - Namespace object to be initialized
- *
- * RETURN: Status
- *
- * DESCRIPTION: Initialize a namespace object from a parser Op and its
- * associated arguments. The namespace object is a more compact
- * representation of the Op and its arguments.
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiDsInitObjectFromOp (
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT *Op,
- UINT16 Opcode,
- ACPI_OPERAND_OBJECT **ObjDesc)
-{
- ACPI_STATUS Status;
- ACPI_PARSE_OBJECT *Arg;
- ACPI_PARSE2_OBJECT *ByteList;
- ACPI_OPERAND_OBJECT *ArgDesc;
- ACPI_OPCODE_INFO *OpInfo;
-
-
- OpInfo = AcpiPsGetOpcodeInfo (Opcode);
- if (ACPI_GET_OP_TYPE (OpInfo) != ACPI_OP_TYPE_OPCODE)
- {
- /* Unknown opcode */
-
- return (AE_TYPE);
- }
-
-
- /* Get and prepare the first argument */
-
- switch ((*ObjDesc)->Common.Type)
- {
- case ACPI_TYPE_BUFFER:
-
- /* First arg is a number */
-
- AcpiDsCreateOperand (WalkState, Op->Value.Arg, 0);
- ArgDesc = WalkState->Operands [WalkState->NumOperands - 1];
- AcpiDsObjStackPop (1, WalkState);
-
- /* Resolve the object (could be an arg or local) */
-
- Status = AcpiAmlResolveToValue (&ArgDesc, WalkState);
- if (ACPI_FAILURE (Status))
- {
- AcpiCmRemoveReference (ArgDesc);
- return (Status);
- }
-
- /* We are expecting a number */
-
- if (ArgDesc->Common.Type != ACPI_TYPE_INTEGER)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("InitObject: Expecting number, got obj: %p type %X\n",
- ArgDesc, ArgDesc->Common.Type));
- AcpiCmRemoveReference (ArgDesc);
- return (AE_TYPE);
- }
-
- /* Get the value, delete the internal object */
-
- (*ObjDesc)->Buffer.Length = (UINT32) ArgDesc->Integer.Value;
- AcpiCmRemoveReference (ArgDesc);
-
- /* Allocate the buffer */
-
- if ((*ObjDesc)->Buffer.Length == 0)
- {
- (*ObjDesc)->Buffer.Pointer = NULL;
- REPORT_WARNING (("Buffer created with zero length in AML\n"));
- break;
- }
-
- else
- {
- (*ObjDesc)->Buffer.Pointer =
- AcpiCmCallocate ((*ObjDesc)->Buffer.Length);
-
- if (!(*ObjDesc)->Buffer.Pointer)
- {
- return (AE_NO_MEMORY);
- }
- }
-
- /*
- * Second arg is the buffer data (optional)
- * ByteList can be either individual bytes or a
- * string initializer!
- */
-
- /* skip first arg */
- Arg = Op->Value.Arg;
- ByteList = (ACPI_PARSE2_OBJECT *) Arg->Next;
- if (ByteList)
- {
- if (ByteList->Opcode != AML_BYTELIST_OP)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("InitObject: Expecting bytelist, got: %x\n",
- ByteList));
- return (AE_TYPE);
- }
-
- MEMCPY ((*ObjDesc)->Buffer.Pointer, ByteList->Data,
- (*ObjDesc)->Buffer.Length);
- }
-
- break;
-
-
- case ACPI_TYPE_PACKAGE:
-
- /*
- * When called, an internal package object has already
- * been built and is pointed to by *ObjDesc.
- * AcpiDsBuildInternalObject build another internal
- * package object, so remove reference to the original
- * so that it is deleted. Error checking is done
- * within the remove reference function.
- */
- AcpiCmRemoveReference(*ObjDesc);
-
- Status = AcpiDsBuildInternalObject (WalkState, Op, ObjDesc);
- break;
-
- case ACPI_TYPE_INTEGER:
- (*ObjDesc)->Integer.Value = Op->Value.Integer;
- break;
-
-
- case ACPI_TYPE_STRING:
- (*ObjDesc)->String.Pointer = Op->Value.String;
- (*ObjDesc)->String.Length = STRLEN (Op->Value.String);
- break;
-
-
- case ACPI_TYPE_METHOD:
- break;
-
-
- case INTERNAL_TYPE_REFERENCE:
-
- switch (ACPI_GET_OP_CLASS (OpInfo))
- {
- case OPTYPE_LOCAL_VARIABLE:
-
- /* Split the opcode into a base opcode + offset */
-
- (*ObjDesc)->Reference.OpCode = AML_LOCAL_OP;
- (*ObjDesc)->Reference.Offset = Opcode - AML_LOCAL_OP;
- break;
-
- case OPTYPE_METHOD_ARGUMENT:
-
- /* Split the opcode into a base opcode + offset */
-
- (*ObjDesc)->Reference.OpCode = AML_ARG_OP;
- (*ObjDesc)->Reference.Offset = Opcode - AML_ARG_OP;
- break;
-
- default: /* Constants, Literals, etc.. */
-
- if (Op->Opcode == AML_NAMEPATH_OP)
- {
- /* Node was saved in Op */
-
- (*ObjDesc)->Reference.Node = Op->Node;
- }
-
- (*ObjDesc)->Reference.OpCode = Opcode;
- break;
- }
-
- break;
-
-
- default:
-
- DEBUG_PRINT (ACPI_ERROR,
- ("InitObject: Unimplemented data type: %x\n",
- (*ObjDesc)->Common.Type));
-
- break;
- }
-
- return (AE_OK);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiDsBuildInternalSimpleObj
- *
- * PARAMETERS: Op - Parser object to be translated
- * ObjDescPtr - Where the ACPI internal object is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Translate a parser Op object to the equivalent namespace object
- * Simple objects are any objects other than a package object!
- *
- ****************************************************************************/
-
-static ACPI_STATUS
-AcpiDsBuildInternalSimpleObj (
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT *Op,
- ACPI_OPERAND_OBJECT **ObjDescPtr)
-{
- ACPI_OPERAND_OBJECT *ObjDesc;
- OBJECT_TYPE_INTERNAL Type;
- ACPI_STATUS Status;
- UINT32 Length;
- char *Name;
-
-
- FUNCTION_TRACE ("DsBuildInternalSimpleObj");
-
-
- if (Op->Opcode == AML_NAMEPATH_OP)
- {
- /*
- * This is an object reference. If The name was
- * previously looked up in the NS, it is stored in this op.
- * Otherwise, go ahead and look it up now
- */
-
- if (!Op->Node)
- {
- Status = AcpiNsLookup (WalkState->ScopeInfo,
- Op->Value.String, ACPI_TYPE_ANY,
- IMODE_EXECUTE,
- NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE,
- NULL,
- (ACPI_NAMESPACE_NODE **)&(Op->Node));
-
- if (ACPI_FAILURE (Status))
- {
- if (Status == AE_NOT_FOUND)
- {
- Name = NULL;
- AcpiNsExternalizeName (ACPI_UINT32_MAX, Op->Value.String, &Length, &Name);
-
- if (Name)
- {
- REPORT_WARNING (("Reference %s at AML %X not found\n",
- Name, Op->AmlOffset));
- AcpiCmFree (Name);
- }
- else
- {
- REPORT_WARNING (("Reference %s at AML %X not found\n",
- Op->Value.String, Op->AmlOffset));
- }
- *ObjDescPtr = NULL;
- }
-
- else
- {
- return_ACPI_STATUS (Status);
- }
- }
- }
-
- /*
- * The reference will be a Reference
- * TBD: [Restructure] unless we really need a separate
- * type of INTERNAL_TYPE_REFERENCE change
- * AcpiDsMapOpcodeToDataType to handle this case
- */
- Type = INTERNAL_TYPE_REFERENCE;
- }
- else
- {
- Type = AcpiDsMapOpcodeToDataType (Op->Opcode, NULL);
- }
-
-
- /* Create and init the internal ACPI object */
-
- ObjDesc = AcpiCmCreateInternalObject (Type);
- if (!ObjDesc)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- Status = AcpiDsInitObjectFromOp (WalkState, Op,
- Op->Opcode, &ObjDesc);
-
- if (ACPI_FAILURE (Status))
- {
- AcpiCmRemoveReference (ObjDesc);
- return_ACPI_STATUS (Status);
- }
-
- *ObjDescPtr = ObjDesc;
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiDsBuildInternalPackageObj
- *
- * PARAMETERS: Op - Parser object to be translated
- * ObjDescPtr - Where the ACPI internal object is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Translate a parser Op package object to the equivalent
- * namespace object
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiDsBuildInternalPackageObj (
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT *Op,
- ACPI_OPERAND_OBJECT **ObjDescPtr)
-{
- ACPI_PARSE_OBJECT *Arg;
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_STATUS Status = AE_OK;
-
-
- FUNCTION_TRACE ("DsBuildInternalPackageObj");
-
-
- ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_PACKAGE);
- if (!ObjDesc)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /* The first argument must be the package length */
-
- Arg = Op->Value.Arg;
- ObjDesc->Package.Count = Arg->Value.Integer;
-
- /*
- * Allocate the array of pointers (ptrs to the
- * individual objects) Add an extra pointer slot so
- * that the list is always null terminated.
- */
-
- ObjDesc->Package.Elements =
- AcpiCmCallocate ((ObjDesc->Package.Count + 1) *
- sizeof (void *));
-
- if (!ObjDesc->Package.Elements)
- {
- /* Package vector allocation failure */
-
- REPORT_ERROR (("DsBuildInternalPackageObj: Package vector allocation failure\n"));
-
- AcpiCmDeleteObjectDesc (ObjDesc);
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- ObjDesc->Package.NextElement = ObjDesc->Package.Elements;
-
- /*
- * Now init the elements of the package
- */
-
- Arg = Arg->Next;
- while (Arg)
- {
- if (Arg->Opcode == AML_PACKAGE_OP)
- {
- Status = AcpiDsBuildInternalPackageObj (WalkState, Arg,
- ObjDesc->Package.NextElement);
- }
-
- else
- {
- Status = AcpiDsBuildInternalSimpleObj (WalkState, Arg,
- ObjDesc->Package.NextElement);
- }
-
- ObjDesc->Package.NextElement++;
- Arg = Arg->Next;
- }
-
- *ObjDescPtr = ObjDesc;
- return_ACPI_STATUS (Status);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiDsBuildInternalObject
- *
- * PARAMETERS: Op - Parser object to be translated
- * ObjDescPtr - Where the ACPI internal object is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Translate a parser Op object to the equivalent namespace
- * object
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiDsBuildInternalObject (
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT *Op,
- ACPI_OPERAND_OBJECT **ObjDescPtr)
-{
- ACPI_STATUS Status;
-
-
- if (Op->Opcode == AML_PACKAGE_OP)
- {
- Status = AcpiDsBuildInternalPackageObj (WalkState, Op,
- ObjDescPtr);
- }
-
- else
- {
- Status = AcpiDsBuildInternalSimpleObj (WalkState, Op,
- ObjDescPtr);
- }
-
- return (Status);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiDsCreateNode
- *
- * PARAMETERS: Op - Parser object to be translated
- * ObjDescPtr - Where the ACPI internal object is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION:
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiDsCreateNode (
- ACPI_WALK_STATE *WalkState,
- ACPI_NAMESPACE_NODE *Node,
- ACPI_PARSE_OBJECT *Op)
-{
- ACPI_STATUS Status;
- ACPI_OPERAND_OBJECT *ObjDesc;
-
-
- FUNCTION_TRACE_PTR ("DsCreateNode", Op);
-
-
- if (!Op->Value.Arg)
- {
- /* No arguments, there is nothing to do */
-
- return_ACPI_STATUS (AE_OK);
- }
-
-
- /* Build an internal object for the argument(s) */
-
- Status = AcpiDsBuildInternalObject (WalkState,
- Op->Value.Arg, &ObjDesc);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
-
- /* Re-type the object according to it's argument */
-
- Node->Type = ObjDesc->Common.Type;
-
- /* Init obj */
-
- Status = AcpiNsAttachObject ((ACPI_HANDLE) Node, ObjDesc,
- (UINT8) Node->Type);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
- return_ACPI_STATUS (Status);
-
-
-Cleanup:
-
- AcpiCmRemoveReference (ObjDesc);
-
- return_ACPI_STATUS (Status);
-}
-
-
diff --git a/sys/contrib/dev/acpica/Subsystem/Dispatcher/dsopcode.c b/sys/contrib/dev/acpica/Subsystem/Dispatcher/dsopcode.c
deleted file mode 100644
index 5153537a06a2..000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Dispatcher/dsopcode.c
+++ /dev/null
@@ -1,1089 +0,0 @@
-/******************************************************************************
- *
- * Module Name: dsopcode - Dispatcher Op Region support and handling of
- * "control" opcodes
- * $Revision: 32 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 1. Copyright Notice
- *
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, 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 __DSOPCODE_C__
-
-#include "acpi.h"
-#include "acparser.h"
-#include "amlcode.h"
-#include "acdispat.h"
-#include "acinterp.h"
-#include "acnamesp.h"
-#include "acevents.h"
-#include "actables.h"
-
-#define _COMPONENT DISPATCHER
- MODULE_NAME ("dsopcode")
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiDsGetFieldUnitArguments
- *
- * PARAMETERS: ObjDesc - A valid FieldUnit object
- *
- * RETURN: Status.
- *
- * DESCRIPTION: Get FieldUnit Buffer and Index. This implements the late
- * evaluation of these field attributes.
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiDsGetFieldUnitArguments (
- ACPI_OPERAND_OBJECT *ObjDesc)
-{
- ACPI_OPERAND_OBJECT *ExtraDesc;
- ACPI_NAMESPACE_NODE *Node;
- ACPI_PARSE_OBJECT *Op;
- ACPI_PARSE_OBJECT *FieldOp;
- ACPI_STATUS Status;
- ACPI_TABLE_DESC *TableDesc;
-
-
- FUNCTION_TRACE_PTR ("DsGetFieldUnitArguments", ObjDesc);
-
-
- if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
- {
- return_ACPI_STATUS (AE_OK);
- }
-
-
- /* Get the AML pointer (method object) and FieldUnit node */
-
- ExtraDesc = ObjDesc->FieldUnit.Extra;
- Node = ObjDesc->FieldUnit.Node;
-
- DEBUG_EXEC(AcpiCmDisplayInitPathname (Node, " [Field]"));
- DEBUG_PRINT (TRACE_EXEC,
- ("DsGetFieldUnitArguments: [%4.4s] FieldUnit JIT Init\n",
- &Node->Name));
-
-
- /*
- * Allocate a new parser op to be the root of the parsed
- * OpRegion tree
- */
-
- Op = AcpiPsAllocOp (AML_SCOPE_OP);
- if (!Op)
- {
- return (AE_NO_MEMORY);
- }
-
- /* Save the Node for use in AcpiPsParseAml */
-
- Op->Node = AcpiNsGetParentObject (Node);
-
- /* Get a handle to the parent ACPI table */
-
- Status = AcpiTbHandleToObject (Node->OwnerId, &TableDesc);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Pass1: Parse the entire FieldUnit declaration */
-
- Status = AcpiPsParseAml (Op, ExtraDesc->Extra.Pcode,
- ExtraDesc->Extra.PcodeLength, 0,
- NULL, NULL, NULL, AcpiDsLoad1BeginOp, AcpiDsLoad1EndOp);
- if (ACPI_FAILURE (Status))
- {
- AcpiPsDeleteParseTree (Op);
- return_ACPI_STATUS (Status);
- }
-
-
- /* Get and init the actual FielUnitOp created above */
-
- FieldOp = Op->Value.Arg;
- Op->Node = Node;
-
-
- FieldOp = Op->Value.Arg;
- FieldOp->Node = Node;
- AcpiPsDeleteParseTree (Op);
-
- /* AcpiEvaluate the address and length arguments for the OpRegion */
-
- Op = AcpiPsAllocOp (AML_SCOPE_OP);
- if (!Op)
- {
- return (AE_NO_MEMORY);
- }
-
- Op->Node = AcpiNsGetParentObject (Node);
-
- Status = AcpiPsParseAml (Op, ExtraDesc->Extra.Pcode,
- ExtraDesc->Extra.PcodeLength,
- ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE,
- NULL /*MethodDesc*/, NULL, NULL,
- AcpiDsExecBeginOp, AcpiDsExecEndOp);
- /* All done with the parse tree, delete it */
-
- AcpiPsDeleteParseTree (Op);
-
-
- /*
- * The pseudo-method object is no longer needed since the region is
- * now initialized
- */
- AcpiCmRemoveReference (ObjDesc->FieldUnit.Extra);
- ObjDesc->FieldUnit.Extra = NULL;
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiDsGetRegionArguments
- *
- * PARAMETERS: ObjDesc - A valid region object
- *
- * RETURN: Status.
- *
- * DESCRIPTION: Get region address and length. This implements the late
- * evaluation of these region attributes.
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiDsGetRegionArguments (
- ACPI_OPERAND_OBJECT *ObjDesc)
-{
- ACPI_OPERAND_OBJECT *ExtraDesc = NULL;
- ACPI_NAMESPACE_NODE *Node;
- ACPI_PARSE_OBJECT *Op;
- ACPI_PARSE_OBJECT *RegionOp;
- ACPI_STATUS Status;
- ACPI_TABLE_DESC *TableDesc;
-
-
- FUNCTION_TRACE_PTR ("DsGetRegionArguments", ObjDesc);
-
-
- if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
- {
- return_ACPI_STATUS (AE_OK);
- }
-
-
- /* Get the AML pointer (method object) and region node */
-
- ExtraDesc = ObjDesc->Region.Extra;
- Node = ObjDesc->Region.Node;
-
- DEBUG_EXEC(AcpiCmDisplayInitPathname (Node, " [Operation Region]"));
-
- DEBUG_PRINT (TRACE_EXEC,
- ("DsGetRegionArguments: [%4.4s] OpRegion Init at AML %p[%x]\n",
- &Node->Name, ExtraDesc->Extra.Pcode, *(UINT32*) ExtraDesc->Extra.Pcode));
-
- /*
- * Allocate a new parser op to be the root of the parsed
- * OpRegion tree
- */
-
- Op = AcpiPsAllocOp (AML_SCOPE_OP);
- if (!Op)
- {
- return (AE_NO_MEMORY);
- }
-
- /* Save the Node for use in AcpiPsParseAml */
-
- Op->Node = AcpiNsGetParentObject (Node);
-
- /* Get a handle to the parent ACPI table */
-
- Status = AcpiTbHandleToObject (Node->OwnerId, &TableDesc);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Parse the entire OpRegion declaration, creating a parse tree */
-
- Status = AcpiPsParseAml (Op, ExtraDesc->Extra.Pcode,
- ExtraDesc->Extra.PcodeLength, 0,
- NULL, NULL, NULL, AcpiDsLoad1BeginOp, AcpiDsLoad1EndOp);
-
- if (ACPI_FAILURE (Status))
- {
- AcpiPsDeleteParseTree (Op);
- return_ACPI_STATUS (Status);
- }
-
-
- /* Get and init the actual RegionOp created above */
-
- RegionOp = Op->Value.Arg;
- Op->Node = Node;
-
-
- RegionOp = Op->Value.Arg;
- RegionOp->Node = Node;
- AcpiPsDeleteParseTree (Op);
-
- /* AcpiEvaluate the address and length arguments for the OpRegion */
-
- Op = AcpiPsAllocOp (AML_SCOPE_OP);
- if (!Op)
- {
- return (AE_NO_MEMORY);
- }
-
- Op->Node = AcpiNsGetParentObject (Node);
-
- Status = AcpiPsParseAml (Op, ExtraDesc->Extra.Pcode,
- ExtraDesc->Extra.PcodeLength,
- ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE,
- NULL /*MethodDesc*/, NULL, NULL,
- AcpiDsExecBeginOp, AcpiDsExecEndOp);
-
- /* All done with the parse tree, delete it */
-
- AcpiPsDeleteParseTree (Op);
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiDsInitializeRegion
- *
- * PARAMETERS: Op - A valid region Op object
- *
- * RETURN: Status
- *
- * DESCRIPTION:
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiDsInitializeRegion (
- ACPI_HANDLE ObjHandle)
-{
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_STATUS Status;
-
-
- ObjDesc = AcpiNsGetAttachedObject (ObjHandle);
-
- /* Namespace is NOT locked */
-
- Status = AcpiEvInitializeRegion (ObjDesc, FALSE);
-
- return (Status);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiDsEvalFieldUnitOperands
- *
- * PARAMETERS: Op - A valid FieldUnit Op object
- *
- * RETURN: Status
- *
- * DESCRIPTION: Get FieldUnit Buffer and Index
- * Called from AcpiDsExecEndOp during FieldUnit parse tree walk
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiDsEvalFieldUnitOperands (
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT *Op)
-{
- ACPI_STATUS Status;
- ACPI_OPERAND_OBJECT *FieldDesc;
- ACPI_NAMESPACE_NODE *Node;
- ACPI_PARSE_OBJECT *NextOp;
- UINT32 Offset;
- UINT32 BitOffset;
- UINT16 BitCount;
-
-
- ACPI_OPERAND_OBJECT *ResDesc = NULL;
- ACPI_OPERAND_OBJECT *CntDesc = NULL;
- ACPI_OPERAND_OBJECT *OffDesc = NULL;
- ACPI_OPERAND_OBJECT *SrcDesc = NULL;
- UINT32 NumOperands = 3;
-
-
- FUNCTION_TRACE_PTR ("DsEvalFieldUnitOperands", Op);
-
-
- /*
- * This is where we evaluate the address and length fields of the OpFieldUnit declaration
- */
-
- Node = Op->Node;
-
- /* NextOp points to the op that holds the Buffer */
- NextOp = Op->Value.Arg;
-
- /* AcpiEvaluate/create the address and length operands */
-
- Status = AcpiDsCreateOperands (WalkState, NextOp);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- FieldDesc = AcpiNsGetAttachedObject (Node);
- if (!FieldDesc)
- {
- return_ACPI_STATUS (AE_NOT_EXIST);
- }
-
-
- /* Resolve the operands */
-
- Status = AcpiAmlResolveOperands (Op->Opcode, WALK_OPERANDS, WalkState);
- DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (Op->Opcode),
- NumOperands, "after AcpiAmlResolveOperands");
-
-
- /* Get the operands */
-
- Status |= AcpiDsObjStackPopObject (&ResDesc, WalkState);
- if (AML_CREATE_FIELD_OP == Op->Opcode)
- {
- NumOperands = 4;
- Status |= AcpiDsObjStackPopObject (&CntDesc, WalkState);
- }
-
- Status |= AcpiDsObjStackPopObject (&OffDesc, WalkState);
- Status |= AcpiDsObjStackPopObject (&SrcDesc, WalkState);
-
- if (ACPI_FAILURE (Status))
- {
- /* Invalid parameters on object stack */
-
- DEBUG_PRINT (ACPI_ERROR,
- ("ExecCreateField/%s: bad operand(s) (%X)\n",
- AcpiPsGetOpcodeName (Op->Opcode), Status));
-
- goto Cleanup;
- }
-
-
- Offset = (UINT32) OffDesc->Integer.Value;
-
-
- /*
- * If ResDesc is a Name, it will be a direct name pointer after
- * AcpiAmlResolveOperands()
- */
-
- if (!VALID_DESCRIPTOR_TYPE (ResDesc, ACPI_DESC_TYPE_NAMED))
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlExecCreateField (%s): destination must be a Node\n",
- AcpiPsGetOpcodeName (Op->Opcode)));
-
- Status = AE_AML_OPERAND_TYPE;
- goto Cleanup;
- }
-
-
- /*
- * Setup the Bit offsets and counts, according to the opcode
- */
-
- switch (Op->Opcode)
- {
-
- /* DefCreateBitField */
-
- case AML_BIT_FIELD_OP:
-
- /* Offset is in bits, Field is a bit */
-
- BitOffset = Offset;
- BitCount = 1;
- break;
-
-
- /* DefCreateByteField */
-
- case AML_BYTE_FIELD_OP:
-
- /* Offset is in bytes, field is a byte */
-
- BitOffset = 8 * Offset;
- BitCount = 8;
- break;
-
-
- /* DefCreateWordField */
-
- case AML_WORD_FIELD_OP:
-
- /* Offset is in bytes, field is a word */
-
- BitOffset = 8 * Offset;
- BitCount = 16;
- break;
-
-
- /* DefCreateDWordField */
-
- case AML_DWORD_FIELD_OP:
-
- /* Offset is in bytes, field is a dword */
-
- BitOffset = 8 * Offset;
- BitCount = 32;
- break;
-
-
- /* DefCreateField */
-
- case AML_CREATE_FIELD_OP:
-
- /* Offset is in bits, count is in bits */
-
- BitOffset = Offset;
- BitCount = (UINT16) CntDesc->Integer.Value;
- break;
-
-
- default:
-
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlExecCreateField: Internal error - unknown field creation opcode %02x\n",
- Op->Opcode));
- Status = AE_AML_BAD_OPCODE;
- goto Cleanup;
- }
-
-
- /*
- * Setup field according to the object type
- */
-
- switch (SrcDesc->Common.Type)
- {
-
- /* SourceBuff := TermArg=>Buffer */
-
- case ACPI_TYPE_BUFFER:
-
- if (BitOffset + (UINT32) BitCount >
- (8 * (UINT32) SrcDesc->Buffer.Length))
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlExecCreateField: Field exceeds Buffer %d > %d\n",
- BitOffset + (UINT32) BitCount,
- 8 * (UINT32) SrcDesc->Buffer.Length));
- Status = AE_AML_BUFFER_LIMIT;
- goto Cleanup;
- }
-
-
- /* Construct the remainder of the field object */
-
- FieldDesc->FieldUnit.Access = (UINT8) ACCESS_ANY_ACC;
- FieldDesc->FieldUnit.LockRule = (UINT8) GLOCK_NEVER_LOCK;
- FieldDesc->FieldUnit.UpdateRule = (UINT8) UPDATE_PRESERVE;
- FieldDesc->FieldUnit.Length = BitCount;
- FieldDesc->FieldUnit.BitOffset = (UINT8) (BitOffset % 8);
- FieldDesc->FieldUnit.Offset = DIV_8 (BitOffset);
- FieldDesc->FieldUnit.Container = SrcDesc;
-
- /* Reference count for SrcDesc inherits FieldDesc count */
-
- SrcDesc->Common.ReferenceCount = (UINT16) (SrcDesc->Common.ReferenceCount +
- FieldDesc->Common.ReferenceCount);
-
- break;
-
-
- /* Improper object type */
-
- default:
-
- if ((SrcDesc->Common.Type > (UINT8) INTERNAL_TYPE_REFERENCE) ||
- !AcpiCmValidObjectType (SrcDesc->Common.Type))
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlExecCreateField: Tried to create field in invalid object type %X\n",
- SrcDesc->Common.Type));
- }
-
- else
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlExecCreateField: Tried to create field in improper object type - %s\n",
- AcpiCmGetTypeName (SrcDesc->Common.Type)));
- }
-
- Status = AE_AML_OPERAND_TYPE;
- goto Cleanup;
- }
-
-
- if (AML_CREATE_FIELD_OP == Op->Opcode)
- {
- /* Delete object descriptor unique to CreateField */
-
- AcpiCmRemoveReference (CntDesc);
- CntDesc = NULL;
- }
-
-
-Cleanup:
-
- /* Always delete the operands */
-
- AcpiCmRemoveReference (OffDesc);
- AcpiCmRemoveReference (SrcDesc);
-
- if (AML_CREATE_FIELD_OP == Op->Opcode)
- {
- AcpiCmRemoveReference (CntDesc);
- }
-
- /* On failure, delete the result descriptor */
-
- if (ACPI_FAILURE (Status))
- {
- AcpiCmRemoveReference (ResDesc); /* Result descriptor */
- }
-
- else
- {
- /* Now the address and length are valid for this opFieldUnit */
-
- FieldDesc->FieldUnit.Flags |= AOPOBJ_DATA_VALID;
- }
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiDsEvalRegionOperands
- *
- * PARAMETERS: Op - A valid region Op object
- *
- * RETURN: Status
- *
- * DESCRIPTION: Get region address and length
- * Called from AcpiDsExecEndOp during OpRegion parse tree walk
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiDsEvalRegionOperands (
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT *Op)
-{
- ACPI_STATUS Status;
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_OPERAND_OBJECT *OperandDesc;
- ACPI_NAMESPACE_NODE *Node;
- ACPI_PARSE_OBJECT *NextOp;
-
-
- FUNCTION_TRACE_PTR ("DsEvalRegionOperands", Op);
-
-
- /*
- * This is where we evaluate the address and length fields of the OpRegion declaration
- */
-
- Node = Op->Node;
-
- /* NextOp points to the op that holds the SpaceID */
- NextOp = Op->Value.Arg;
-
- /* NextOp points to address op */
- NextOp = NextOp->Next;
-
- /* AcpiEvaluate/create the address and length operands */
-
- Status = AcpiDsCreateOperands (WalkState, NextOp);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Resolve the length and address operands to numbers */
-
- Status = AcpiAmlResolveOperands (Op->Opcode, WALK_OPERANDS, WalkState);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE,
- AcpiPsGetOpcodeName (Op->Opcode),
- 1, "after AcpiAmlResolveOperands");
-
-
- ObjDesc = AcpiNsGetAttachedObject (Node);
- if (!ObjDesc)
- {
- return_ACPI_STATUS (AE_NOT_EXIST);
- }
-
- /*
- * Get the length operand and save it
- * (at Top of stack)
- */
- OperandDesc = WalkState->Operands[WalkState->NumOperands - 1];
-
- ObjDesc->Region.Length = (UINT32) OperandDesc->Integer.Value;
- AcpiCmRemoveReference (OperandDesc);
-
- /*
- * Get the address and save it
- * (at top of stack - 1)
- */
- OperandDesc = WalkState->Operands[WalkState->NumOperands - 2];
-
- ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS) OperandDesc->Integer.Value;
- AcpiCmRemoveReference (OperandDesc);
-
-
- DEBUG_PRINT (TRACE_EXEC,
- ("DsEvalRegionOperands: RgnObj %p Addr %X Len %X\n",
- ObjDesc, ObjDesc->Region.Address, ObjDesc->Region.Length));
-
- /* Now the address and length are valid for this opregion */
-
- ObjDesc->Region.Flags |= AOPOBJ_DATA_VALID;
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsExecBeginControlOp
- *
- * PARAMETERS: WalkList - The list that owns the walk stack
- * Op - The control Op
- *
- * RETURN: Status
- *
- * DESCRIPTION: Handles all control ops encountered during control method
- * execution.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsExecBeginControlOp (
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT *Op)
-{
- ACPI_STATUS Status = AE_OK;
- ACPI_GENERIC_STATE *ControlState;
-
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("BeginControlOp: Op=%p Opcode=%2.2X State=%p\n", Op,
- Op->Opcode, WalkState));
-
- switch (Op->Opcode)
- {
- case AML_IF_OP:
- case AML_WHILE_OP:
-
- /*
- * IF/WHILE: Create a new control state to manage these
- * constructs. We need to manage these as a stack, in order
- * to handle nesting.
- */
-
- ControlState = AcpiCmCreateControlState ();
- if (!ControlState)
- {
- Status = AE_NO_MEMORY;
- break;
- }
-
- AcpiCmPushGenericState (&WalkState->ControlState, ControlState);
-
- /*
- * Save a pointer to the predicate for multiple executions
- * of a loop
- */
- WalkState->ControlState->Control.AmlPredicateStart =
- WalkState->ParserState->Aml - 1;
- /* TBD: can this be removed? */
- /*AcpiPsPkgLengthEncodingSize (GET8 (WalkState->ParserState->Aml));*/
- break;
-
-
- case AML_ELSE_OP:
-
- /* Predicate is in the state object */
- /* If predicate is true, the IF was executed, ignore ELSE part */
-
- if (WalkState->LastPredicate)
- {
- Status = AE_CTRL_TRUE;
- }
-
- break;
-
-
- case AML_RETURN_OP:
-
- break;
-
-
- default:
- break;
- }
-
- return (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsExecEndControlOp
- *
- * PARAMETERS: WalkList - The list that owns the walk stack
- * Op - The control Op
- *
- * RETURN: Status
- *
- * DESCRIPTION: Handles all control ops encountered during control method
- * execution.
- *
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsExecEndControlOp (
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT *Op)
-{
- ACPI_STATUS Status = AE_OK;
- ACPI_GENERIC_STATE *ControlState;
-
-
- switch (Op->Opcode)
- {
- case AML_IF_OP:
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("EndControlOp: [IF_OP] Op=%p\n", Op));
-
- /*
- * Save the result of the predicate in case there is an
- * ELSE to come
- */
-
- WalkState->LastPredicate =
- (BOOLEAN) WalkState->ControlState->Common.Value;
-
- /*
- * Pop the control state that was created at the start
- * of the IF and free it
- */
-
- ControlState =
- AcpiCmPopGenericState (&WalkState->ControlState);
-
- AcpiCmDeleteGenericState (ControlState);
-
- break;
-
-
- case AML_ELSE_OP:
-
- break;
-
-
- case AML_WHILE_OP:
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("EndControlOp: [WHILE_OP] Op=%p\n", Op));
-
- if (WalkState->ControlState->Common.Value)
- {
- /* Predicate was true, go back and evaluate it again! */
-
- Status = AE_CTRL_PENDING;
- }
-
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("EndControlOp: [WHILE_OP] termination! Op=%p\n", Op));
-
- /* Pop this control state and free it */
-
- ControlState =
- AcpiCmPopGenericState (&WalkState->ControlState);
-
- WalkState->AmlLastWhile = ControlState->Control.AmlPredicateStart;
- AcpiCmDeleteGenericState (ControlState);
-
- break;
-
-
- case AML_RETURN_OP:
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("EndControlOp: [RETURN_OP] Op=%p Arg=%p\n",Op, Op->Value.Arg));
-
-
- /*
- * One optional operand -- the return value
- * It can be either an immediate operand or a result that
- * has been bubbled up the tree
- */
- if (Op->Value.Arg)
- {
- /* Return statement has an immediate operand */
-
- Status = AcpiDsCreateOperands (WalkState, Op->Value.Arg);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
-
- /*
- * If value being returned is a Reference (such as
- * an arg or local), resolve it now because it may
- * cease to exist at the end of the method.
- */
-
- Status = AcpiAmlResolveToValue (&WalkState->Operands [0], WalkState);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
-
- /*
- * Get the return value and save as the last result
- * value. This is the only place where WalkState->ReturnDesc
- * is set to anything other than zero!
- */
-
- WalkState->ReturnDesc = WalkState->Operands[0];
- }
-
- else if ((WalkState->Results) &&
- (WalkState->Results->Results.NumResults > 0))
- {
- /*
- * The return value has come from a previous calculation.
- *
- * If value being returned is a Reference (such as
- * an arg or local), resolve it now because it may
- * cease to exist at the end of the method.
- */
-
- Status = AcpiAmlResolveToValue (&WalkState->Results->Results.ObjDesc [0], WalkState);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
-
- WalkState->ReturnDesc = WalkState->Results->Results.ObjDesc [0];
- }
-
- else
- {
- /* No return operand */
-
- if (WalkState->NumOperands)
- {
- AcpiCmRemoveReference (WalkState->Operands [0]);
- }
-
- WalkState->Operands [0] = NULL;
- WalkState->NumOperands = 0;
- WalkState->ReturnDesc = NULL;
- }
-
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("EndControlOp: Completed RETURN_OP State=%p, RetVal=%p\n",
- WalkState, WalkState->ReturnDesc));
-
- /* End the control method execution right now */
- Status = AE_CTRL_TERMINATE;
- break;
-
-
- case AML_NOOP_OP:
-
- /* Just do nothing! */
- break;
-
-
- case AML_BREAK_POINT_OP:
-
- /* Call up to the OS dependent layer to handle this */
-
- AcpiOsBreakpoint (NULL);
-
- /* If it returns, we are done! */
-
- break;
-
-
- case AML_BREAK_OP:
-
- DEBUG_PRINT (ACPI_INFO,
- ("EndControlOp: Break to end of current package, Op=%p\n", Op));
-
- /*
- * As per the ACPI specification:
- * "The break operation causes the current package
- * execution to complete"
- * "Break -- Stop executing the current code package
- * at this point"
- *
- * Returning AE_FALSE here will cause termination of
- * the current package, and execution will continue one
- * level up, starting with the completion of the parent Op.
- */
-
- Status = AE_CTRL_FALSE;
- break;
-
-
- default:
-
- DEBUG_PRINT (ACPI_ERROR,
- ("EndControlOp: Unknown control opcode=%X Op=%p\n",
- Op->Opcode, Op));
-
- Status = AE_AML_BAD_OPCODE;
- break;
- }
-
-
- return (Status);
-}
-
diff --git a/sys/contrib/dev/acpica/Subsystem/Dispatcher/dsutils.c b/sys/contrib/dev/acpica/Subsystem/Dispatcher/dsutils.c
deleted file mode 100644
index 9e4d0da3400b..000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Dispatcher/dsutils.c
+++ /dev/null
@@ -1,948 +0,0 @@
-/*******************************************************************************
- *
- * Module Name: dsutils - Dispatcher utilities
- * $Revision: 52 $
- *
- ******************************************************************************/
-
-/******************************************************************************
- *
- * 1. Copyright Notice
- *
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, 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 __DSUTILS_C__
-
-#include "acpi.h"
-#include "acparser.h"
-#include "amlcode.h"
-#include "acdispat.h"
-#include "acinterp.h"
-#include "acnamesp.h"
-#include "acdebug.h"
-
-#define _COMPONENT PARSER
- MODULE_NAME ("dsutils")
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsIsResultUsed
- *
- * PARAMETERS: Op
- * ResultObj
- * WalkState
- *
- * RETURN: Status
- *
- * DESCRIPTION: Check if a result object will be used by the parent
- *
- ******************************************************************************/
-
-BOOLEAN
-AcpiDsIsResultUsed (
- ACPI_PARSE_OBJECT *Op,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_OPCODE_INFO *ParentInfo;
-
-
- FUNCTION_TRACE_PTR ("DsIsResultUsed", Op);
-
-
- /* Must have both an Op and a Result Object */
-
- if (!Op)
- {
- DEBUG_PRINT (ACPI_ERROR, ("DsIsResultUsed: Null Op\n"));
- return_VALUE (TRUE);
- }
-
-
- /*
- * If there is no parent, the result can't possibly be used!
- * (An executing method typically has no parent, since each
- * method is parsed separately) However, a method that is
- * invoked from another method has a parent.
- */
- if (!Op->Parent)
- {
- return_VALUE (FALSE);
- }
-
-
- /*
- * Get info on the parent. The root Op is AML_SCOPE
- */
-
- ParentInfo = AcpiPsGetOpcodeInfo (Op->Parent->Opcode);
- if (ACPI_GET_OP_TYPE (ParentInfo) != ACPI_OP_TYPE_OPCODE)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("DsIsResultUsed: Unknown parent opcode. Op=%X\n",
- Op));
-
- return_VALUE (FALSE);
- }
-
-
- /*
- * Decide what to do with the result based on the parent. If
- * the parent opcode will not use the result, delete the object.
- * Otherwise leave it as is, it will be deleted when it is used
- * as an operand later.
- */
-
- switch (ACPI_GET_OP_CLASS (ParentInfo))
- {
- /*
- * In these cases, the parent will never use the return object
- */
- case OPTYPE_CONTROL: /* IF, ELSE, WHILE only */
-
- switch (Op->Parent->Opcode)
- {
- case AML_RETURN_OP:
-
- /* Never delete the return value associated with a return opcode */
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("DsIsResultUsed: Result used, [RETURN] opcode=%X Op=%X\n",
- Op->Opcode, Op));
- return_VALUE (TRUE);
- break;
-
- case AML_IF_OP:
- case AML_WHILE_OP:
-
- /*
- * If we are executing the predicate AND this is the predicate op,
- * we will use the return value!
- */
-
- if ((WalkState->ControlState->Common.State == CONTROL_PREDICATE_EXECUTING) &&
- (WalkState->ControlState->Control.PredicateOp == Op))
- {
- DEBUG_PRINT (TRACE_DISPATCH,
- ("DsIsResultUsed: Result used as a predicate, [IF/WHILE] opcode=%X Op=%X\n",
- Op->Opcode, Op));
- return_VALUE (TRUE);
- }
-
- break;
- }
-
-
- /* Fall through to not used case below */
-
-
- case OPTYPE_NAMED_OBJECT: /* Scope, method, etc. */
-
- /*
- * These opcodes allow TermArg(s) as operands and therefore
- * method calls. The result is used.
- */
- if ((Op->Parent->Opcode == AML_REGION_OP) ||
- (Op->Parent->Opcode == AML_CREATE_FIELD_OP) ||
- (Op->Parent->Opcode == AML_BIT_FIELD_OP) ||
- (Op->Parent->Opcode == AML_BYTE_FIELD_OP) ||
- (Op->Parent->Opcode == AML_WORD_FIELD_OP) ||
- (Op->Parent->Opcode == AML_DWORD_FIELD_OP) ||
- (Op->Parent->Opcode == AML_QWORD_FIELD_OP))
- {
- DEBUG_PRINT (TRACE_DISPATCH,
- ("DsIsResultUsed: Result used, [Region or CreateField] opcode=%X Op=%X\n",
- Op->Opcode, Op));
- return_VALUE (TRUE);
- }
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("DsIsResultUsed: Result not used, Parent opcode=%X Op=%X\n",
- Op->Opcode, Op));
-
- return_VALUE (FALSE);
- break;
-
- /*
- * In all other cases. the parent will actually use the return
- * object, so keep it.
- */
- default:
- break;
- }
-
- return_VALUE (TRUE);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsDeleteResultIfNotUsed
- *
- * PARAMETERS: Op
- * ResultObj
- * WalkState
- *
- * RETURN: Status
- *
- * DESCRIPTION: Used after interpretation of an opcode. If there is an internal
- * result descriptor, check if the parent opcode will actually use
- * this result. If not, delete the result now so that it will
- * not become orphaned.
- *
- ******************************************************************************/
-
-void
-AcpiDsDeleteResultIfNotUsed (
- ACPI_PARSE_OBJECT *Op,
- ACPI_OPERAND_OBJECT *ResultObj,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_STATUS Status;
-
-
- FUNCTION_TRACE_PTR ("DsDeleteResultIfNotUsed", ResultObj);
-
-
- if (!Op)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("DsDeleteResultIfNotUsed: Null Op=%X\n",
- Op));
- return_VOID;
- }
-
- if (!ResultObj)
- {
- return_VOID;
- }
-
-
- if (!AcpiDsIsResultUsed (Op, WalkState))
- {
- /*
- * Must pop the result stack (ObjDesc should be equal
- * to ResultObj)
- */
-
- Status = AcpiDsResultPop (&ObjDesc, WalkState);
- if (ACPI_SUCCESS (Status))
- {
- AcpiCmRemoveReference (ResultObj);
- }
- }
-
- return_VOID;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsCreateOperand
- *
- * PARAMETERS: WalkState
- * Arg
- *
- * RETURN: Status
- *
- * DESCRIPTION: Translate a parse tree object that is an argument to an AML
- * opcode to the equivalent interpreter object. This may include
- * looking up a name or entering a new name into the internal
- * namespace.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsCreateOperand (
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT *Arg,
- UINT32 ArgIndex)
-{
- ACPI_STATUS Status = AE_OK;
- NATIVE_CHAR *NameString;
- UINT32 NameLength;
- OBJECT_TYPE_INTERNAL DataType;
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_PARSE_OBJECT *ParentOp;
- UINT16 Opcode;
- UINT32 Flags;
- OPERATING_MODE InterpreterMode;
-
-
- FUNCTION_TRACE_PTR ("DsCreateOperand", Arg);
-
-
- /* A valid name must be looked up in the namespace */
-
- if ((Arg->Opcode == AML_NAMEPATH_OP) &&
- (Arg->Value.String))
- {
- DEBUG_PRINT (TRACE_DISPATCH,
- ("DsCreateOperand: Getting a name: Arg=%p\n", Arg));
-
- /* Get the entire name string from the AML stream */
-
- Status = AcpiAmlGetNameString (ACPI_TYPE_ANY,
- Arg->Value.Buffer,
- &NameString,
- &NameLength);
-
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /*
- * All prefixes have been handled, and the name is
- * in NameString
- */
-
- /*
- * Differentiate between a namespace "create" operation
- * versus a "lookup" operation (IMODE_LOAD_PASS2 vs.
- * IMODE_EXECUTE) in order to support the creation of
- * namespace objects during the execution of control methods.
- */
-
- ParentOp = Arg->Parent;
- if ((AcpiPsIsNodeOp (ParentOp->Opcode)) &&
- (ParentOp->Opcode != AML_METHODCALL_OP) &&
- (ParentOp->Opcode != AML_REGION_OP) &&
- (ParentOp->Opcode != AML_NAMEPATH_OP))
- {
- /* Enter name into namespace if not found */
-
- InterpreterMode = IMODE_LOAD_PASS2;
- }
-
- else
- {
- /* Return a failure if name not found */
-
- InterpreterMode = IMODE_EXECUTE;
- }
-
- Status = AcpiNsLookup (WalkState->ScopeInfo, NameString,
- ACPI_TYPE_ANY, InterpreterMode,
- NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE,
- WalkState,
- (ACPI_NAMESPACE_NODE **) &ObjDesc);
-
- /* Free the namestring created above */
-
- AcpiCmFree (NameString);
-
- /*
- * The only case where we pass through (ignore) a NOT_FOUND
- * error is for the CondRefOf opcode.
- */
-
- if (Status == AE_NOT_FOUND)
- {
- if (ParentOp->Opcode == AML_COND_REF_OF_OP)
- {
- /*
- * For the Conditional Reference op, it's OK if
- * the name is not found; We just need a way to
- * indicate this to the interpreter, set the
- * object to the root
- */
- ObjDesc = (ACPI_OPERAND_OBJECT *) AcpiGbl_RootNode;
- Status = AE_OK;
- }
-
- else
- {
- /*
- * We just plain didn't find it -- which is a
- * very serious error at this point
- */
- Status = AE_AML_NAME_NOT_FOUND;
- }
- }
-
- /* Check status from the lookup */
-
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Put the resulting object onto the current object stack */
-
- Status = AcpiDsObjStackPush (ObjDesc, WalkState);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (ObjDesc, WalkState));
- }
-
-
- else
- {
- /* Check for null name case */
-
- if (Arg->Opcode == AML_NAMEPATH_OP)
- {
- /*
- * If the name is null, this means that this is an
- * optional result parameter that was not specified
- * in the original ASL. Create an Reference for a
- * placeholder
- */
- Opcode = AML_ZERO_OP; /* Has no arguments! */
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("DsCreateOperand: Null namepath: Arg=%p\n", Arg));
-
- /*
- * TBD: [Investigate] anything else needed for the
- * zero op lvalue?
- */
- }
-
- else
- {
- Opcode = Arg->Opcode;
- }
-
-
- /* Get the data type of the argument */
-
- DataType = AcpiDsMapOpcodeToDataType (Opcode, &Flags);
- if (DataType == INTERNAL_TYPE_INVALID)
- {
- return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
- }
-
- if (Flags & OP_HAS_RETURN_VALUE)
- {
- DEBUG_PRINT (TRACE_DISPATCH,
- ("DsCreateOperand: Argument previously created, already stacked \n"));
-
- DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (WalkState->Operands [WalkState->NumOperands - 1], WalkState));
-
- /*
- * Use value that was already previously returned
- * by the evaluation of this argument
- */
-
- Status = AcpiDsResultPopFromBottom (&ObjDesc, WalkState);
- if (ACPI_FAILURE (Status))
- {
- /*
- * Only error is underflow, and this indicates
- * a missing or null operand!
- */
- DEBUG_PRINT (ACPI_ERROR,
- ("DsCreateOperand: Missing or null operand, %s\n", AcpiCmFormatException (Status)));
- return_ACPI_STATUS (Status);
- }
-
- }
-
- else
- {
- /* Create an ACPI_INTERNAL_OBJECT for the argument */
-
- ObjDesc = AcpiCmCreateInternalObject (DataType);
- if (!ObjDesc)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /* Initialize the new object */
-
- Status = AcpiDsInitObjectFromOp (WalkState, Arg,
- Opcode, &ObjDesc);
- if (ACPI_FAILURE (Status))
- {
- AcpiCmDeleteObjectDesc (ObjDesc);
- return_ACPI_STATUS (Status);
- }
- }
-
- /* Put the operand object on the object stack */
-
- Status = AcpiDsObjStackPush (ObjDesc, WalkState);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (ObjDesc, WalkState));
- }
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsCreateOperands
- *
- * PARAMETERS: FirstArg - First argument of a parser argument tree
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert an operator's arguments from a parse tree format to
- * namespace objects and place those argument object on the object
- * stack in preparation for evaluation by the interpreter.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsCreateOperands (
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT *FirstArg)
-{
- ACPI_STATUS Status = AE_OK;
- ACPI_PARSE_OBJECT *Arg;
- UINT32 ArgCount = 0;
-
-
- FUNCTION_TRACE_PTR ("DsCreateOperands", FirstArg);
-
- /* For all arguments in the list... */
-
- Arg = FirstArg;
- while (Arg)
- {
- Status = AcpiDsCreateOperand (WalkState, Arg, ArgCount);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("DsCreateOperands: Arg #%d (%p) done, Arg1=%p\n",
- ArgCount, Arg, FirstArg));
-
- /* Move on to next argument, if any */
-
- Arg = Arg->Next;
- ArgCount++;
- }
-
- return_ACPI_STATUS (Status);
-
-
-Cleanup:
- /*
- * We must undo everything done above; meaning that we must
- * pop everything off of the operand stack and delete those
- * objects
- */
-
- AcpiDsObjStackPopAndDelete (ArgCount, WalkState);
-
- DEBUG_PRINT (ACPI_ERROR,
- ("DsCreateOperands: Error while creating Arg %d - %s\n",
- (ArgCount + 1), AcpiCmFormatException (Status)));
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsResolveOperands
- *
- * PARAMETERS: WalkState - Current walk state with operands on stack
- *
- * RETURN: Status
- *
- * DESCRIPTION: Resolve all operands to their values. Used to prepare
- * arguments to a control method invocation (a call from one
- * method to another.)
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsResolveOperands (
- ACPI_WALK_STATE *WalkState)
-{
- UINT32 i;
- ACPI_STATUS Status = AE_OK;
-
-
- FUNCTION_TRACE_PTR ("DsResolveOperands", WalkState);
-
-
- /*
- * Attempt to resolve each of the valid operands
- * Method arguments are passed by value, not by reference
- */
-
- /*
- * TBD: [Investigate] Note from previous parser:
- * RefOf problem with AcpiAmlResolveToValue() conversion.
- */
-
- for (i = 0; i < WalkState->NumOperands; i++)
- {
- Status = AcpiAmlResolveToValue (&WalkState->Operands[i], WalkState);
- if (ACPI_FAILURE (Status))
- {
- break;
- }
- }
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsMapOpcodeToDataType
- *
- * PARAMETERS: Opcode - AML opcode to map
- * OutFlags - Additional info about the opcode
- *
- * RETURN: The ACPI type associated with the opcode
- *
- * DESCRIPTION: Convert a raw AML opcode to the associated ACPI data type,
- * if any. If the opcode returns a value as part of the
- * intepreter execution, a flag is returned in OutFlags.
- *
- ******************************************************************************/
-
-OBJECT_TYPE_INTERNAL
-AcpiDsMapOpcodeToDataType (
- UINT16 Opcode,
- UINT32 *OutFlags)
-{
- OBJECT_TYPE_INTERNAL DataType = INTERNAL_TYPE_INVALID;
- ACPI_OPCODE_INFO *OpInfo;
- UINT32 Flags = 0;
-
-
- OpInfo = AcpiPsGetOpcodeInfo (Opcode);
- if (ACPI_GET_OP_TYPE (OpInfo) != ACPI_OP_TYPE_OPCODE)
- {
- /* Unknown opcode */
-
- DEBUG_PRINT (ACPI_ERROR,
- ("MapOpcode: Unknown AML opcode: %x\n",
- Opcode));
-
- return (DataType);
- }
-
- switch (ACPI_GET_OP_CLASS (OpInfo))
- {
-
- case OPTYPE_LITERAL:
-
- switch (Opcode)
- {
- case AML_BYTE_OP:
- case AML_WORD_OP:
- case AML_DWORD_OP:
-
- DataType = ACPI_TYPE_INTEGER;
- break;
-
-
- case AML_STRING_OP:
-
- DataType = ACPI_TYPE_STRING;
- break;
-
- case AML_NAMEPATH_OP:
- DataType = INTERNAL_TYPE_REFERENCE;
- break;
-
- default:
- DEBUG_PRINT (ACPI_ERROR,
- ("MapOpcode: Unknown (type LITERAL) AML opcode: %x\n",
- Opcode));
- break;
- }
- break;
-
-
- case OPTYPE_DATA_TERM:
-
- switch (Opcode)
- {
- case AML_BUFFER_OP:
-
- DataType = ACPI_TYPE_BUFFER;
- break;
-
- case AML_PACKAGE_OP:
-
- DataType = ACPI_TYPE_PACKAGE;
- break;
-
- default:
- DEBUG_PRINT (ACPI_ERROR,
- ("MapOpcode: Unknown (type DATA_TERM) AML opcode: %x\n",
- Opcode));
- break;
- }
- break;
-
-
- case OPTYPE_CONSTANT:
- case OPTYPE_METHOD_ARGUMENT:
- case OPTYPE_LOCAL_VARIABLE:
-
- DataType = INTERNAL_TYPE_REFERENCE;
- break;
-
-
- case OPTYPE_MONADIC2:
- case OPTYPE_MONADIC2R:
- case OPTYPE_DYADIC2:
- case OPTYPE_DYADIC2R:
- case OPTYPE_DYADIC2S:
- case OPTYPE_INDEX:
- case OPTYPE_MATCH:
- case OPTYPE_RETURN:
-
- Flags = OP_HAS_RETURN_VALUE;
- DataType = ACPI_TYPE_ANY;
- break;
-
- case OPTYPE_METHOD_CALL:
-
- Flags = OP_HAS_RETURN_VALUE;
- DataType = ACPI_TYPE_METHOD;
- break;
-
-
- case OPTYPE_NAMED_OBJECT:
-
- DataType = AcpiDsMapNamedOpcodeToDataType (Opcode);
- break;
-
-
- case OPTYPE_DYADIC1:
- case OPTYPE_CONTROL:
-
- /* No mapping needed at this time */
-
- break;
-
-
- default:
-
- DEBUG_PRINT (ACPI_ERROR,
- ("MapOpcode: Unimplemented data type opcode: %x\n",
- Opcode));
- break;
- }
-
- /* Return flags to caller if requested */
-
- if (OutFlags)
- {
- *OutFlags = Flags;
- }
-
- return (DataType);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsMapNamedOpcodeToDataType
- *
- * PARAMETERS: Opcode - The Named AML opcode to map
- *
- * RETURN: The ACPI type associated with the named opcode
- *
- * DESCRIPTION: Convert a raw Named AML opcode to the associated data type.
- * Named opcodes are a subsystem of the AML opcodes.
- *
- ******************************************************************************/
-
-OBJECT_TYPE_INTERNAL
-AcpiDsMapNamedOpcodeToDataType (
- UINT16 Opcode)
-{
- OBJECT_TYPE_INTERNAL DataType;
-
-
- /* Decode Opcode */
-
- switch (Opcode)
- {
- case AML_SCOPE_OP:
- DataType = INTERNAL_TYPE_SCOPE;
- break;
-
- case AML_DEVICE_OP:
- DataType = ACPI_TYPE_DEVICE;
- break;
-
- case AML_THERMAL_ZONE_OP:
- DataType = ACPI_TYPE_THERMAL;
- break;
-
- case AML_METHOD_OP:
- DataType = ACPI_TYPE_METHOD;
- break;
-
- case AML_POWER_RES_OP:
- DataType = ACPI_TYPE_POWER;
- break;
-
- case AML_PROCESSOR_OP:
- DataType = ACPI_TYPE_PROCESSOR;
- break;
-
- case AML_DEF_FIELD_OP: /* DefFieldOp */
- DataType = INTERNAL_TYPE_DEF_FIELD_DEFN;
- break;
-
- case AML_INDEX_FIELD_OP: /* IndexFieldOp */
- DataType = INTERNAL_TYPE_INDEX_FIELD_DEFN;
- break;
-
- case AML_BANK_FIELD_OP: /* BankFieldOp */
- DataType = INTERNAL_TYPE_BANK_FIELD_DEFN;
- break;
-
- case AML_NAMEDFIELD_OP: /* NO CASE IN ORIGINAL */
- DataType = ACPI_TYPE_ANY;
- break;
-
- case AML_NAME_OP: /* NameOp - special code in original */
- case AML_NAMEPATH_OP:
- DataType = ACPI_TYPE_ANY;
- break;
-
- case AML_ALIAS_OP:
- DataType = INTERNAL_TYPE_ALIAS;
- break;
-
- case AML_MUTEX_OP:
- DataType = ACPI_TYPE_MUTEX;
- break;
-
- case AML_EVENT_OP:
- DataType = ACPI_TYPE_EVENT;
- break;
-
- case AML_REGION_OP:
- DataType = ACPI_TYPE_REGION;
- break;
-
-
- default:
- DataType = ACPI_TYPE_ANY;
- break;
-
- }
-
- return (DataType);
-}
-
-
diff --git a/sys/contrib/dev/acpica/Subsystem/Dispatcher/dswexec.c b/sys/contrib/dev/acpica/Subsystem/Dispatcher/dswexec.c
deleted file mode 100644
index d3c04a6371a9..000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Dispatcher/dswexec.c
+++ /dev/null
@@ -1,829 +0,0 @@
-/******************************************************************************
- *
- * Module Name: dswexec - Dispatcher method execution callbacks;
- * dispatch to interpreter.
- * $Revision: 55 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 1. Copyright Notice
- *
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, 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 __DSWEXEC_C__
-
-#include "acpi.h"
-#include "acparser.h"
-#include "amlcode.h"
-#include "acdispat.h"
-#include "acinterp.h"
-#include "acnamesp.h"
-#include "acdebug.h"
-
-
-#define _COMPONENT DISPATCHER
- MODULE_NAME ("dswexec")
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiDsGetPredicateValue
- *
- * PARAMETERS: WalkState - Current state of the parse tree walk
- *
- * RETURN: Status
- *
- * DESCRIPTION: Get the result of a predicate evaluation
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiDsGetPredicateValue (
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT *Op,
- UINT32 HasResultObj)
-{
- ACPI_STATUS Status = AE_OK;
- ACPI_OPERAND_OBJECT *ObjDesc;
-
-
- FUNCTION_TRACE_PTR ("DsGetPredicateValue", WalkState);
-
-
- WalkState->ControlState->Common.State = 0;
-
- if (HasResultObj)
- {
- Status = AcpiDsResultPop (&ObjDesc, WalkState);
- if (ACPI_FAILURE (Status))
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("DsGetPredicateValue: Could not get result from predicate evaluation, %s\n",
- AcpiCmFormatException (Status)));
-
- return_ACPI_STATUS (Status);
- }
- }
-
- else
- {
- Status = AcpiDsCreateOperand (WalkState, Op, 0);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- Status = AcpiAmlResolveToValue (&WalkState->Operands [0], WalkState);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- ObjDesc = WalkState->Operands [0];
- }
-
- if (!ObjDesc)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("ExecEndOp: No predicate ObjDesc=%X State=%X\n",
- ObjDesc, WalkState));
-
- return_ACPI_STATUS (AE_AML_NO_OPERAND);
- }
-
-
- /*
- * Result of predicate evaluation currently must
- * be a number
- */
-
- if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("ExecEndOp: Bad predicate (not a number) ObjDesc=%X State=%X Type=%X\n",
- ObjDesc, WalkState, ObjDesc->Common.Type));
-
- Status = AE_AML_OPERAND_TYPE;
- goto Cleanup;
- }
-
-
- /* Truncate the predicate to 32-bits if necessary */
-
- AcpiAmlTruncateFor32bitTable (ObjDesc, WalkState);
-
- /*
- * Save the result of the predicate evaluation on
- * the control stack
- */
-
- if (ObjDesc->Integer.Value)
- {
- WalkState->ControlState->Common.Value = TRUE;
- }
-
- else
- {
- /*
- * Predicate is FALSE, we will just toss the
- * rest of the package
- */
-
- WalkState->ControlState->Common.Value = FALSE;
- Status = AE_CTRL_FALSE;
- }
-
-
-Cleanup:
-
- DEBUG_PRINT (TRACE_EXEC,
- ("ExecEndOp: Completed a predicate eval=%X Op=%X\n",
- WalkState->ControlState->Common.Value, Op));
-
- /* Break to debugger to display result */
-
- DEBUGGER_EXEC (AcpiDbDisplayResultObject (ObjDesc, WalkState));
-
- /*
- * Delete the predicate result object (we know that
- * we don't need it anymore)
- */
-
- AcpiCmRemoveReference (ObjDesc);
-
- WalkState->ControlState->Common.State = CONTROL_NORMAL;
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiDsExecBeginOp
- *
- * PARAMETERS: WalkState - Current state of the parse tree walk
- * Op - Op that has been just been reached in the
- * walk; Arguments have not been evaluated yet.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Descending callback used during the execution of control
- * methods. This is where most operators and operands are
- * dispatched to the interpreter.
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiDsExecBeginOp (
- UINT16 Opcode,
- ACPI_PARSE_OBJECT *Op,
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT **OutOp)
-{
- ACPI_OPCODE_INFO *OpInfo;
- ACPI_STATUS Status = AE_OK;
-
-
- FUNCTION_TRACE_PTR ("DsExecBeginOp", Op);
-
-
- if (!Op)
- {
- Status = AcpiDsLoad2BeginOp (Opcode, NULL, WalkState, OutOp);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- Op = *OutOp;
- }
-
- if (Op == WalkState->Origin)
- {
- if (OutOp)
- {
- *OutOp = Op;
- }
-
- return_ACPI_STATUS (AE_OK);
- }
-
- /*
- * If the previous opcode was a conditional, this opcode
- * must be the beginning of the associated predicate.
- * Save this knowledge in the current scope descriptor
- */
-
- if ((WalkState->ControlState) &&
- (WalkState->ControlState->Common.State ==
- CONTROL_CONDITIONAL_EXECUTING))
- {
- DEBUG_PRINT (TRACE_EXEC, ("BeginOp: Exec predicate Op=%X State=%X\n",
- Op, WalkState));
-
- WalkState->ControlState->Common.State = CONTROL_PREDICATE_EXECUTING;
-
- /* Save start of predicate */
-
- WalkState->ControlState->Control.PredicateOp = Op;
- }
-
-
- OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode);
-
- /* We want to send namepaths to the load code */
-
- if (Op->Opcode == AML_NAMEPATH_OP)
- {
- OpInfo->Flags = OPTYPE_NAMED_OBJECT;
- }
-
-
- /*
- * Handle the opcode based upon the opcode type
- */
-
- switch (ACPI_GET_OP_CLASS (OpInfo))
- {
- case OPTYPE_CONTROL:
-
- Status = AcpiDsResultStackPush (WalkState);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- Status = AcpiDsExecBeginControlOp (WalkState, Op);
- break;
-
-
- case OPTYPE_NAMED_OBJECT:
-
- if (WalkState->WalkType == WALK_METHOD)
- {
- /*
- * Found a named object declaration during method
- * execution; we must enter this object into the
- * namespace. The created object is temporary and
- * will be deleted upon completion of the execution
- * of this method.
- */
-
- Status = AcpiDsLoad2BeginOp (Op->Opcode, Op, WalkState, NULL);
- }
-
-
- if (Op->Opcode == AML_REGION_OP)
- {
- Status = AcpiDsResultStackPush (WalkState);
- }
-
- break;
-
-
- /* most operators with arguments */
-
- case OPTYPE_MONADIC1:
- case OPTYPE_DYADIC1:
- case OPTYPE_MONADIC2:
- case OPTYPE_MONADIC2R:
- case OPTYPE_DYADIC2:
- case OPTYPE_DYADIC2R:
- case OPTYPE_DYADIC2S:
- case OPTYPE_RECONFIGURATION:
- case OPTYPE_INDEX:
- case OPTYPE_MATCH:
- case OPTYPE_FATAL:
- case OPTYPE_CREATE_FIELD:
-
- /* Start a new result/operand state */
-
- Status = AcpiDsResultStackPush (WalkState);
- break;
-
-
- default:
- break;
- }
-
- /* Nothing to do here during method execution */
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiDsExecEndOp
- *
- * PARAMETERS: WalkState - Current state of the parse tree walk
- * Op - Op that has been just been completed in the
- * walk; Arguments have now been evaluated.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Ascending callback used during the execution of control
- * methods. The only thing we really need to do here is to
- * notice the beginning of IF, ELSE, and WHILE blocks.
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiDsExecEndOp (
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT *Op)
-{
- ACPI_STATUS Status = AE_OK;
- UINT16 Opcode;
- UINT8 Optype;
- ACPI_PARSE_OBJECT *NextOp;
- ACPI_NAMESPACE_NODE *Node;
- ACPI_PARSE_OBJECT *FirstArg;
- ACPI_OPERAND_OBJECT *ResultObj = NULL;
- ACPI_OPCODE_INFO *OpInfo;
- UINT32 OperandIndex;
-
-
- FUNCTION_TRACE_PTR ("DsExecEndOp", Op);
-
-
- Opcode = (UINT16) Op->Opcode;
-
-
- OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode);
- if (ACPI_GET_OP_TYPE (OpInfo) != ACPI_OP_TYPE_OPCODE)
- {
- DEBUG_PRINT (ACPI_ERROR, ("ExecEndOp: Unknown opcode. Op=%X\n",
- Op));
-
- return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
- }
-
- Optype = (UINT8) ACPI_GET_OP_CLASS (OpInfo);
- FirstArg = Op->Value.Arg;
-
- /* Init the walk state */
-
- WalkState->NumOperands = 0;
- WalkState->ReturnDesc = NULL;
- WalkState->OpInfo = OpInfo;
- WalkState->Opcode = Opcode;
-
-
- /* Call debugger for single step support (DEBUG build only) */
-
- DEBUGGER_EXEC (Status = AcpiDbSingleStep (WalkState, Op, Optype));
- DEBUGGER_EXEC (if (ACPI_FAILURE (Status)) {return_ACPI_STATUS (Status);});
-
-
- /* Decode the opcode */
-
- switch (Optype)
- {
- case OPTYPE_UNDEFINED:
-
- DEBUG_PRINT (ACPI_ERROR, ("ExecEndOp: Undefined opcode type Op=%X\n",
- Op));
- return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
- break;
-
-
- case OPTYPE_BOGUS:
- DEBUG_PRINT (TRACE_DISPATCH,
- ("ExecEndOp: Internal opcode=%X type Op=%X\n",
- Opcode, Op));
- break;
-
- case OPTYPE_CONSTANT: /* argument type only */
- case OPTYPE_LITERAL: /* argument type only */
- case OPTYPE_DATA_TERM: /* argument type only */
- case OPTYPE_LOCAL_VARIABLE: /* argument type only */
- case OPTYPE_METHOD_ARGUMENT: /* argument type only */
- break;
-
-
- /* most operators with arguments */
-
- case OPTYPE_MONADIC1:
- case OPTYPE_DYADIC1:
- case OPTYPE_MONADIC2:
- case OPTYPE_MONADIC2R:
- case OPTYPE_DYADIC2:
- case OPTYPE_DYADIC2R:
- case OPTYPE_DYADIC2S:
- case OPTYPE_RECONFIGURATION:
- case OPTYPE_INDEX:
- case OPTYPE_MATCH:
- case OPTYPE_FATAL:
-
-
- /* Build resolved operand stack */
-
- Status = AcpiDsCreateOperands (WalkState, FirstArg);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
- OperandIndex = WalkState->NumOperands - 1;
-
-
- /* Done with this result state (Now that operand stack is built) */
-
- Status = AcpiDsResultStackPop (WalkState);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
- switch (Optype)
- {
- case OPTYPE_MONADIC1:
-
- /* 1 Operand, 0 ExternalResult, 0 InternalResult */
-
- Status = AcpiAmlExecMonadic1 (Opcode, WalkState);
- break;
-
-
- case OPTYPE_MONADIC2:
-
- /* 1 Operand, 0 ExternalResult, 1 InternalResult */
-
- Status = AcpiAmlExecMonadic2 (Opcode, WalkState, &ResultObj);
- break;
-
-
- case OPTYPE_MONADIC2R:
-
- /* 1 Operand, 1 ExternalResult, 1 InternalResult */
-
- Status = AcpiAmlExecMonadic2R (Opcode, WalkState, &ResultObj);
- break;
-
-
- case OPTYPE_DYADIC1:
-
- /* 2 Operands, 0 ExternalResult, 0 InternalResult */
-
- Status = AcpiAmlExecDyadic1 (Opcode, WalkState);
- break;
-
-
- case OPTYPE_DYADIC2:
-
- /* 2 Operands, 0 ExternalResult, 1 InternalResult */
-
- Status = AcpiAmlExecDyadic2 (Opcode, WalkState, &ResultObj);
- break;
-
-
- case OPTYPE_DYADIC2R:
-
- /* 2 Operands, 1 or 2 ExternalResults, 1 InternalResult */
-
- Status = AcpiAmlExecDyadic2R (Opcode, WalkState, &ResultObj);
- break;
-
-
- case OPTYPE_DYADIC2S: /* Synchronization Operator */
-
- /* 2 Operands, 0 ExternalResult, 1 InternalResult */
-
- Status = AcpiAmlExecDyadic2S (Opcode, WalkState, &ResultObj);
- break;
-
-
- case OPTYPE_INDEX: /* Type 2 opcode with 3 operands */
-
- /* 3 Operands, 1 ExternalResult, 1 InternalResult */
-
- Status = AcpiAmlExecIndex (WalkState, &ResultObj);
- break;
-
-
- case OPTYPE_MATCH: /* Type 2 opcode with 6 operands */
-
- /* 6 Operands, 0 ExternalResult, 1 InternalResult */
-
- Status = AcpiAmlExecMatch (WalkState, &ResultObj);
- break;
-
-
- case OPTYPE_RECONFIGURATION:
-
- /* 1 or 2 operands, 0 Internal Result */
-
- Status = AcpiAmlExecReconfiguration (Opcode, WalkState);
- break;
-
-
- case OPTYPE_FATAL:
-
- /* 3 Operands, 0 ExternalResult, 0 InternalResult */
-
- Status = AcpiAmlExecFatal (WalkState);
- break;
- }
-
- /*
- * If a result object was returned from above, push it on the
- * current result stack
- */
- if (ACPI_SUCCESS (Status) &&
- ResultObj)
- {
- Status = AcpiDsResultPush (ResultObj, WalkState);
- }
-
- break;
-
-
- case OPTYPE_CONTROL: /* Type 1 opcode, IF/ELSE/WHILE/NOOP */
-
- /* 1 Operand, 0 ExternalResult, 0 InternalResult */
-
- Status = AcpiDsExecEndControlOp (WalkState, Op);
-
- AcpiDsResultStackPop (WalkState);
- break;
-
-
- case OPTYPE_METHOD_CALL:
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("ExecEndOp: Method invocation, Op=%X\n", Op));
-
- /*
- * (AML_METHODCALL) Op->Value->Arg->Node contains
- * the method Node pointer
- */
- /* NextOp points to the op that holds the method name */
-
- NextOp = FirstArg;
- Node = NextOp->Node;
-
- /* NextOp points to first argument op */
-
- NextOp = NextOp->Next;
-
- /*
- * Get the method's arguments and put them on the operand stack
- */
- Status = AcpiDsCreateOperands (WalkState, NextOp);
- if (ACPI_FAILURE (Status))
- {
- break;
- }
-
- /*
- * Since the operands will be passed to another
- * control method, we must resolve all local
- * references here (Local variables, arguments
- * to *this* method, etc.)
- */
-
- Status = AcpiDsResolveOperands (WalkState);
- if (ACPI_FAILURE (Status))
- {
- break;
- }
-
- /*
- * Tell the walk loop to preempt this running method and
- * execute the new method
- */
- Status = AE_CTRL_TRANSFER;
-
- /*
- * Return now; we don't want to disturb anything,
- * especially the operand count!
- */
- return_ACPI_STATUS (Status);
- break;
-
-
- case OPTYPE_CREATE_FIELD:
-
- DEBUG_PRINT (TRACE_EXEC,
- ("ExecEndOp: Executing CreateField Buffer/Index Op=%X\n",
- Op));
-
- Status = AcpiDsLoad2EndOp (WalkState, Op);
- if (ACPI_FAILURE (Status))
- {
- break;
- }
-
- Status = AcpiDsEvalFieldUnitOperands (WalkState, Op);
- break;
-
-
- case OPTYPE_NAMED_OBJECT:
-
- Status = AcpiDsLoad2EndOp (WalkState, Op);
- if (ACPI_FAILURE (Status))
- {
- break;
- }
-
- switch (Op->Opcode)
- {
- case AML_REGION_OP:
-
- DEBUG_PRINT (TRACE_EXEC,
- ("ExecEndOp: Executing OpRegion Address/Length Op=%X\n",
- Op));
-
- Status = AcpiDsEvalRegionOperands (WalkState, Op);
- if (ACPI_FAILURE (Status))
- {
- break;
- }
-
- Status = AcpiDsResultStackPop (WalkState);
- break;
-
-
- case AML_METHOD_OP:
- break;
-
-
- case AML_ALIAS_OP:
-
- /* Alias creation was already handled by call
- to psxload above */
- break;
-
-
- default:
- /* Nothing needs to be done */
-
- Status = AE_OK;
- break;
- }
-
- break;
-
- default:
-
- DEBUG_PRINT (ACPI_ERROR,
- ("ExecEndOp: Unimplemented opcode, type=%X Opcode=%X Op=%X\n",
- Optype, Op->Opcode, Op));
-
- Status = AE_NOT_IMPLEMENTED;
- break;
- }
-
-
- /*
- * ACPI 2.0 support for 64-bit integers:
- * Truncate numeric result value if we are executing from a 32-bit ACPI table
- */
- AcpiAmlTruncateFor32bitTable (ResultObj, WalkState);
-
- /*
- * Check if we just completed the evaluation of a
- * conditional predicate
- */
-
- if ((WalkState->ControlState) &&
- (WalkState->ControlState->Common.State ==
- CONTROL_PREDICATE_EXECUTING) &&
- (WalkState->ControlState->Control.PredicateOp == Op))
- {
- Status = AcpiDsGetPredicateValue (WalkState, Op, (UINT32) ResultObj);
- ResultObj = NULL;
- }
-
-
-Cleanup:
- if (ResultObj)
- {
- /* Break to debugger to display result */
-
- DEBUGGER_EXEC (AcpiDbDisplayResultObject (ResultObj, WalkState));
-
- /*
- * Delete the result op if and only if:
- * Parent will not use the result -- such as any
- * non-nested type2 op in a method (parent will be method)
- */
- AcpiDsDeleteResultIfNotUsed (Op, ResultObj, WalkState);
- }
-
- /* Always clear the object stack */
-
- /* TBD: [Investigate] Clear stack of return value,
- but don't delete it */
- WalkState->NumOperands = 0;
-
- return_ACPI_STATUS (Status);
-}
-
-
diff --git a/sys/contrib/dev/acpica/Subsystem/Dispatcher/dswload.c b/sys/contrib/dev/acpica/Subsystem/Dispatcher/dswload.c
deleted file mode 100644
index 47d57a26eff8..000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Dispatcher/dswload.c
+++ /dev/null
@@ -1,929 +0,0 @@
-/******************************************************************************
- *
- * Module Name: dswload - Dispatcher namespace load callbacks
- * $Revision: 26 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 1. Copyright Notice
- *
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, 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 __DSWLOAD_C__
-
-#include "acpi.h"
-#include "acparser.h"
-#include "amlcode.h"
-#include "acdispat.h"
-#include "acinterp.h"
-#include "acnamesp.h"
-#include "acevents.h"
-
-
-#define _COMPONENT DISPATCHER
- MODULE_NAME ("dswload")
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiDsLoad1BeginOp
- *
- * PARAMETERS: WalkState - Current state of the parse tree walk
- * Op - Op that has been just been reached in the
- * walk; Arguments have not been evaluated yet.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Descending callback used during the loading of ACPI tables.
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiDsLoad1BeginOp (
- UINT16 Opcode,
- ACPI_PARSE_OBJECT *Op,
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT **OutOp)
-{
- ACPI_NAMESPACE_NODE *Node;
- ACPI_STATUS Status;
- OBJECT_TYPE_INTERNAL DataType;
- NATIVE_CHAR *Path;
-
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("Load1BeginOp: Op=%p State=%p\n", Op, WalkState));
-
-
- /* We are only interested in opcodes that have an associated name */
-
- if (!AcpiPsIsNamedOp (Opcode))
- {
- *OutOp = Op;
- return (AE_OK);
- }
-
-
- /* Check if this object has already been installed in the namespace */
-
- if (Op && Op->Node)
- {
- *OutOp = Op;
- return (AE_OK);
- }
-
- Path = AcpiPsGetNextNamestring (WalkState->ParserState);
-
- /* Map the raw opcode into an internal object type */
-
- DataType = AcpiDsMapNamedOpcodeToDataType (Opcode);
-
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("Load1BeginOp: State=%p Op=%p Type=%x\n", WalkState, Op, DataType));
-
-
- if (Opcode == AML_SCOPE_OP)
- {
- DEBUG_PRINT (TRACE_DISPATCH,
- ("Load1BeginOp: State=%p Op=%p Type=%x\n", WalkState, Op, DataType));
- }
-
- /*
- * Enter the named type into the internal namespace. We enter the name
- * as we go downward in the parse tree. Any necessary subobjects that involve
- * arguments to the opcode must be created as we go back up the parse tree later.
- */
- Status = AcpiNsLookup (WalkState->ScopeInfo, Path,
- DataType, IMODE_LOAD_PASS1,
- NS_NO_UPSEARCH, WalkState, &(Node));
-
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
-
- if (!Op)
- {
- /* Create a new op */
-
- Op = AcpiPsAllocOp (Opcode);
- if (!Op)
- {
- return (AE_NO_MEMORY);
- }
- }
-
- /* Initialize */
-
- ((ACPI_PARSE2_OBJECT *)Op)->Name = Node->Name;
-
- /*
- * Put the Node in the "op" object that the parser uses, so we
- * can get it again quickly when this scope is closed
- */
- Op->Node = Node;
-
-
- AcpiPsAppendArg (AcpiPsGetParentScope (WalkState->ParserState), Op);
-
- *OutOp = Op;
-
- return (Status);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiDsLoad1EndOp
- *
- * PARAMETERS: WalkState - Current state of the parse tree walk
- * Op - Op that has been just been completed in the
- * walk; Arguments have now been evaluated.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Ascending callback used during the loading of the namespace,
- * both control methods and everything else.
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiDsLoad1EndOp (
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT *Op)
-{
- OBJECT_TYPE_INTERNAL DataType;
-
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("Load1EndOp: Op=%p State=%p\n", Op, WalkState));
-
- /* We are only interested in opcodes that have an associated name */
-
- if (!AcpiPsIsNamedOp (Op->Opcode))
- {
- return (AE_OK);
- }
-
-
- /* Get the type to determine if we should pop the scope */
-
- DataType = AcpiDsMapNamedOpcodeToDataType (Op->Opcode);
-
- if (Op->Opcode == AML_NAME_OP)
- {
- /* For Name opcode, check the argument */
-
- if (Op->Value.Arg)
- {
- DataType = AcpiDsMapOpcodeToDataType (
- (Op->Value.Arg)->Opcode, NULL);
- ((ACPI_NAMESPACE_NODE *)Op->Node)->Type =
- (UINT8) DataType;
- }
- }
-
-
- /* Pop the scope stack */
-
- if (AcpiNsOpensScope (DataType))
- {
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("Load1EndOp/%s: Popping scope for Op %p\n",
- AcpiCmGetTypeName (DataType), Op));
- AcpiDsScopeStackPop (WalkState);
- }
-
- return (AE_OK);
-
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiDsLoad2BeginOp
- *
- * PARAMETERS: WalkState - Current state of the parse tree walk
- * Op - Op that has been just been reached in the
- * walk; Arguments have not been evaluated yet.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Descending callback used during the loading of ACPI tables.
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiDsLoad2BeginOp (
- UINT16 Opcode,
- ACPI_PARSE_OBJECT *Op,
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT **OutOp)
-{
- ACPI_NAMESPACE_NODE *Node;
- ACPI_STATUS Status;
- OBJECT_TYPE_INTERNAL DataType;
- NATIVE_CHAR *BufferPtr;
- void *Original = NULL;
-
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("Load2BeginOp: Op=%p State=%p\n", Op, WalkState));
-
-
- /* We only care about Namespace opcodes here */
-
- if (!AcpiPsIsNamespaceOp (Opcode) &&
- Opcode != AML_NAMEPATH_OP)
- {
- return (AE_OK);
- }
-
-
- /* Temp! same code as in psparse */
-
- if (!AcpiPsIsNamedOp (Opcode))
- {
- return (AE_OK);
- }
-
- if (Op)
- {
- /*
- * Get the name we are going to enter or lookup in the namespace
- */
- if (Opcode == AML_NAMEPATH_OP)
- {
- /* For Namepath op, get the path string */
-
- BufferPtr = Op->Value.String;
- if (!BufferPtr)
- {
- /* No name, just exit */
-
- return (AE_OK);
- }
- }
-
- else
- {
- /* Get name from the op */
-
- BufferPtr = (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)Op)->Name;
- }
- }
-
- else
- {
- BufferPtr = AcpiPsGetNextNamestring (WalkState->ParserState);
- }
-
-
- /* Map the raw opcode into an internal object type */
-
- DataType = AcpiDsMapNamedOpcodeToDataType (Opcode);
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("Load2BeginOp: State=%p Op=%p Type=%x\n", WalkState, Op, DataType));
-
-
- if (Opcode == AML_DEF_FIELD_OP ||
- Opcode == AML_BANK_FIELD_OP ||
- Opcode == AML_INDEX_FIELD_OP)
- {
- Node = NULL;
- Status = AE_OK;
- }
-
- else if (Opcode == AML_NAMEPATH_OP)
- {
- /*
- * The NamePath is an object reference to an existing object. Don't enter the
- * name into the namespace, but look it up for use later
- */
- Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr,
- DataType, IMODE_EXECUTE,
- NS_SEARCH_PARENT, WalkState,
- &(Node));
- }
-
- else
- {
- if (Op && Op->Node)
- {
- Original = Op->Node;
- Node = Op->Node;
-
- if (AcpiNsOpensScope (DataType))
- {
- Status = AcpiDsScopeStackPush (Node,
- DataType,
- WalkState);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
-
- }
- return (AE_OK);
- }
-
- /*
- * Enter the named type into the internal namespace. We enter the name
- * as we go downward in the parse tree. Any necessary subobjects that involve
- * arguments to the opcode must be created as we go back up the parse tree later.
- */
- Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr,
- DataType, IMODE_EXECUTE,
- NS_NO_UPSEARCH, WalkState,
- &(Node));
- }
-
- if (ACPI_SUCCESS (Status))
- {
- if (!Op)
- {
- /* Create a new op */
-
- Op = AcpiPsAllocOp (Opcode);
- if (!Op)
- {
- return (AE_NO_MEMORY);
- }
-
- /* Initialize */
-
- ((ACPI_PARSE2_OBJECT *)Op)->Name = Node->Name;
- *OutOp = Op;
- }
-
-
- /*
- * Put the Node in the "op" object that the parser uses, so we
- * can get it again quickly when this scope is closed
- */
- Op->Node = Node;
-
- if (Original)
- {
- DEBUG_PRINT (ACPI_INFO,
- ("Lookup: old %p new %p\n", Original, Node));
-
- if (Original != Node)
- {
- DEBUG_PRINT (ACPI_INFO,
- ("Lookup match error: old %p new %p\n", Original, Node));
- }
- }
- }
-
-
- return (Status);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiDsLoad2EndOp
- *
- * PARAMETERS: WalkState - Current state of the parse tree walk
- * Op - Op that has been just been completed in the
- * walk; Arguments have now been evaluated.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Ascending callback used during the loading of the namespace,
- * both control methods and everything else.
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiDsLoad2EndOp (
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT *Op)
-{
- ACPI_STATUS Status = AE_OK;
- OBJECT_TYPE_INTERNAL DataType;
- ACPI_NAMESPACE_NODE *Node;
- ACPI_PARSE_OBJECT *Arg;
- ACPI_NAMESPACE_NODE *NewNode;
-
-
- DEBUG_PRINT (TRACE_DISPATCH, ("Load2EndOp: Op=%p State=%p\n", Op, WalkState));
-
- if (!AcpiPsIsNamespaceObjectOp (Op->Opcode))
- {
- return (AE_OK);
- }
-
- if (Op->Opcode == AML_SCOPE_OP)
- {
- DEBUG_PRINT (TRACE_DISPATCH,
- ("Load2EndOp: ending scope Op=%p State=%p\n", Op, WalkState));
-
- if (((ACPI_PARSE2_OBJECT *)Op)->Name == -1)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("Load2EndOp: Un-named scope! Op=%p State=%p\n", Op,
- WalkState));
- return (AE_OK);
- }
- }
-
-
- DataType = AcpiDsMapNamedOpcodeToDataType (Op->Opcode);
-
- /*
- * Get the Node/name from the earlier lookup
- * (It was saved in the *op structure)
- */
- Node = Op->Node;
-
- /*
- * Put the Node on the object stack (Contains the ACPI Name of
- * this object)
- */
-
- WalkState->Operands[0] = (void *) Node;
- WalkState->NumOperands = 1;
-
- /* Pop the scope stack */
-
- if (AcpiNsOpensScope (DataType))
- {
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("AmlEndNamespaceScope/%s: Popping scope for Op %p\n",
- AcpiCmGetTypeName (DataType), Op));
- AcpiDsScopeStackPop (WalkState);
- }
-
-
- /*
- * Named operations are as follows:
- *
- * AML_SCOPE
- * AML_DEVICE
- * AML_THERMALZONE
- * AML_METHOD
- * AML_POWERRES
- * AML_PROCESSOR
- * AML_FIELD
- * AML_INDEXFIELD
- * AML_BANKFIELD
- * AML_NAMEDFIELD
- * AML_NAME
- * AML_ALIAS
- * AML_MUTEX
- * AML_EVENT
- * AML_OPREGION
- * AML_CREATEFIELD
- * AML_CREATEBITFIELD
- * AML_CREATEBYTEFIELD
- * AML_CREATEWORDFIELD
- * AML_CREATEDWORDFIELD
- * AML_METHODCALL
- */
-
-
- /* Decode the opcode */
-
- Arg = Op->Value.Arg;
-
- switch (Op->Opcode)
- {
-
- case AML_CREATE_FIELD_OP:
- case AML_BIT_FIELD_OP:
- case AML_BYTE_FIELD_OP:
- case AML_WORD_FIELD_OP:
- case AML_DWORD_FIELD_OP:
-
- /*
- * Create the field object, but the field buffer and index must
- * be evaluated later during the execution phase
- */
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("LOADING-CreateXxxField: State=%p Op=%p NamedObj=%p\n",
- WalkState, Op, Node));
-
- /* Get the NameString argument */
-
- if (Op->Opcode == AML_CREATE_FIELD_OP)
- {
- Arg = AcpiPsGetArg (Op, 3);
- }
- else
- {
- /* Create Bit/Byte/Word/Dword field */
-
- Arg = AcpiPsGetArg (Op, 2);
- }
-
- /*
- * Enter the NameString into the namespace
- */
-
- Status = AcpiNsLookup (WalkState->ScopeInfo,
- Arg->Value.String,
- INTERNAL_TYPE_DEF_ANY,
- IMODE_LOAD_PASS1,
- NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE,
- WalkState, &(NewNode));
-
- if (ACPI_SUCCESS (Status))
- {
- /* We could put the returned object (Node) on the object stack for later, but
- * for now, we will put it in the "op" object that the parser uses, so we
- * can get it again at the end of this scope
- */
- Op->Node = NewNode;
-
- /*
- * If there is no object attached to the node, this node was just created and
- * we need to create the field object. Otherwise, this was a lookup of an
- * existing node and we don't want to create the field object again.
- */
- if (!NewNode->Object)
- {
- /*
- * The Field definition is not fully parsed at this time.
- * (We must save the address of the AML for the buffer and index operands)
- */
- Status = AcpiAmlExecCreateField (((ACPI_PARSE2_OBJECT *) Op)->Data,
- ((ACPI_PARSE2_OBJECT *) Op)->Length,
- NewNode, WalkState);
- }
- }
-
-
- break;
-
-
- case AML_METHODCALL_OP:
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n",
- WalkState, Op, Node));
-
- /*
- * Lookup the method name and save the Node
- */
-
- Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String,
- ACPI_TYPE_ANY, IMODE_LOAD_PASS2,
- NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE,
- WalkState, &(NewNode));
-
- if (ACPI_SUCCESS (Status))
- {
-
-/* has name already been resolved by here ??*/
-
- /* TBD: [Restructure] Make sure that what we found is indeed a method! */
- /* We didn't search for a method on purpose, to see if the name would resolve! */
-
- /* We could put the returned object (Node) on the object stack for later, but
- * for now, we will put it in the "op" object that the parser uses, so we
- * can get it again at the end of this scope
- */
- Op->Node = NewNode;
- }
-
-
- break;
-
-
- case AML_PROCESSOR_OP:
-
- /* Nothing to do other than enter object into namespace */
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("LOADING-Processor: State=%p Op=%p NamedObj=%p\n",
- WalkState, Op, Node));
-
- Status = AcpiAmlExecCreateProcessor (Op, (ACPI_HANDLE) Node);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("Completed Processor Init, Op=%p State=%p entry=%p\n",
- Op, WalkState, Node));
- break;
-
-
- case AML_POWER_RES_OP:
-
- /* Nothing to do other than enter object into namespace */
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("LOADING-PowerResource: State=%p Op=%p NamedObj=%p\n",
- WalkState, Op, Node));
-
- Status = AcpiAmlExecCreatePowerResource (Op, (ACPI_HANDLE) Node);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("Completed PowerResource Init, Op=%p State=%p entry=%p\n",
- Op, WalkState, Node));
- break;
-
-
- case AML_THERMAL_ZONE_OP:
-
- /* Nothing to do other than enter object into namespace */
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("LOADING-ThermalZone: State=%p Op=%p NamedObj=%p\n",
- WalkState, Op, Node));
- break;
-
-
- case AML_DEF_FIELD_OP:
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("LOADING-Field: State=%p Op=%p NamedObj=%p\n",
- WalkState, Op, Node));
-
- Arg = Op->Value.Arg;
-
- Status = AcpiDsCreateField (Op,
- Arg->Node,
- WalkState);
- break;
-
-
- case AML_INDEX_FIELD_OP:
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("LOADING-IndexField: State=%p Op=%p NamedObj=%p\n",
- WalkState, Op, Node));
-
- Arg = Op->Value.Arg;
-
- Status = AcpiDsCreateIndexField (Op,
- (ACPI_HANDLE) Arg->Node,
- WalkState);
- break;
-
-
- case AML_BANK_FIELD_OP:
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("LOADING-BankField: State=%p Op=%p NamedObj=%p\n",
- WalkState, Op, Node));
-
- Arg = Op->Value.Arg;
- Status = AcpiDsCreateBankField (Op,
- Arg->Node,
- WalkState);
- break;
-
-
- /*
- * MethodOp PkgLength NamesString MethodFlags TermList
- */
- case AML_METHOD_OP:
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("LOADING-Method: State=%p Op=%p NamedObj=%p\n",
- WalkState, Op, Node));
-
- if (!Node->Object)
- {
- Status = AcpiAmlExecCreateMethod (((ACPI_PARSE2_OBJECT *) Op)->Data,
- ((ACPI_PARSE2_OBJECT *) Op)->Length,
- Arg->Value.Integer, (ACPI_HANDLE) Node);
- }
-
- break;
-
-
- case AML_MUTEX_OP:
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("LOADING-Mutex: Op=%p State=%p\n", Op, WalkState));
-
- Status = AcpiDsCreateOperands (WalkState, Arg);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
- Status = AcpiAmlExecCreateMutex (WalkState);
- break;
-
-
- case AML_EVENT_OP:
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("LOADING-Event: Op=%p State=%p\n", Op, WalkState));
-
- Status = AcpiDsCreateOperands (WalkState, Arg);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
- Status = AcpiAmlExecCreateEvent (WalkState);
- break;
-
-
- case AML_REGION_OP:
-
- if (Node->Object)
- {
- break;
- }
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("LOADING-Opregion: Op=%p State=%p NamedObj=%p\n", Op, WalkState, Node));
-
-
- /*
- * The OpRegion is not fully parsed at this time. Only valid argument is the SpaceId.
- * (We must save the address of the AML of the address and length operands)
- */
-
- Status = AcpiAmlExecCreateRegion (((ACPI_PARSE2_OBJECT *) Op)->Data,
- ((ACPI_PARSE2_OBJECT *) Op)->Length,
- (ACPI_ADDRESS_SPACE_TYPE) Arg->Value.Integer,
- WalkState);
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("Completed OpRegion Init, Op=%p State=%p entry=%p\n",
- Op, WalkState, Node));
- break;
-
-
- /* Namespace Modifier Opcodes */
-
- case AML_ALIAS_OP:
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("LOADING-Alias: Op=%p State=%p\n", Op, WalkState));
-
- Status = AcpiDsCreateOperands (WalkState, Arg);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
- Status = AcpiAmlExecCreateAlias (WalkState);
- break;
-
-
- case AML_NAME_OP:
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("LOADING-Name: Op=%p State=%p\n", Op, WalkState));
-
- /*
- * Because of the execution pass through the non-control-method
- * parts of the table, we can arrive here twice. Only init
- * the named object node the first time through
- */
-
- if (!Node->Object)
- {
- Status = AcpiDsCreateNode (WalkState, Node, Op);
- }
-
- break;
-
-
- case AML_NAMEPATH_OP:
-
- DEBUG_PRINT (TRACE_DISPATCH,
- ("LOADING-NamePath object: State=%p Op=%p NamedObj=%p\n",
- WalkState, Op, Node));
- break;
-
-
- default:
- break;
- }
-
-
-Cleanup:
-
- /* Remove the Node pushed at the very beginning */
-
- AcpiDsObjStackPop (1, WalkState);
- return (Status);
-}
-
-
diff --git a/sys/contrib/dev/acpica/Subsystem/Dispatcher/dswscope.c b/sys/contrib/dev/acpica/Subsystem/Dispatcher/dswscope.c
deleted file mode 100644
index 6e7d7ffed122..000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Dispatcher/dswscope.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/******************************************************************************
- *
- * Module Name: dswscope - Scope stack manipulation
- * $Revision: 42 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 1. Copyright Notice
- *
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, 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 __DSWSCOPE_C__
-
-#include "acpi.h"
-#include "acinterp.h"
-#include "acdispat.h"
-
-
-#define _COMPONENT NAMESPACE
- MODULE_NAME ("dswscope")
-
-
-#define STACK_POP(head) head
-
-
-/****************************************************************************
- *
- * FUNCTION: AcpiDsScopeStackClear
- *
- * PARAMETERS: None
- *
- * DESCRIPTION: Pop (and free) everything on the scope stack except the
- * root scope object (which remains at the stack top.)
- *
- ***************************************************************************/
-
-void
-AcpiDsScopeStackClear (
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_GENERIC_STATE *ScopeInfo;
-
-
- while (WalkState->ScopeInfo)
- {
- /* Pop a scope off the stack */
-
- ScopeInfo = WalkState->ScopeInfo;
- WalkState->ScopeInfo = ScopeInfo->Scope.Next;
-
- DEBUG_PRINT (TRACE_EXEC,
- ("Popped object type %X\n", ScopeInfo->Common.Value));
- AcpiCmDeleteGenericState (ScopeInfo);
- }
-}
-
-
-/****************************************************************************
- *
- * FUNCTION: AcpiDsScopeStackPush
- *
- * PARAMETERS: *Node, - Name to be made current
- * Type, - Type of frame being pushed
- *
- * DESCRIPTION: Push the current scope on the scope stack, and make the
- * passed Node current.
- *
- ***************************************************************************/
-
-ACPI_STATUS
-AcpiDsScopeStackPush (
- ACPI_NAMESPACE_NODE *Node,
- OBJECT_TYPE_INTERNAL Type,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_GENERIC_STATE *ScopeInfo;
-
-
- FUNCTION_TRACE ("DsScopeStackPush");
-
-
- if (!Node)
- {
- /* invalid scope */
-
- REPORT_ERROR (("DsScopeStackPush: null scope passed\n"));
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- /* Make sure object type is valid */
-
- if (!AcpiAmlValidateObjectType (Type))
- {
- REPORT_WARNING (("DsScopeStackPush: type code out of range\n"));
- }
-
-
- /* Allocate a new scope object */
-
- ScopeInfo = AcpiCmCreateGenericState ();
- if (!ScopeInfo)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /* Init new scope object */
-
- ScopeInfo->Scope.Node = Node;
- ScopeInfo->Common.Value = (UINT16) Type;
-
- /* Push new scope object onto stack */
-
- AcpiCmPushGenericState (&WalkState->ScopeInfo, ScopeInfo);
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/****************************************************************************
- *
- * FUNCTION: AcpiDsScopeStackPop
- *
- * PARAMETERS: Type - The type of frame to be found
- *
- * DESCRIPTION: Pop the scope stack until a frame of the requested type
- * is found.
- *
- * RETURN: Count of frames popped. If no frame of the requested type
- * was found, the count is returned as a negative number and
- * the scope stack is emptied (which sets the current scope
- * to the root). If the scope stack was empty at entry, the
- * function is a no-op and returns 0.
- *
- ***************************************************************************/
-
-ACPI_STATUS
-AcpiDsScopeStackPop (
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_GENERIC_STATE *ScopeInfo;
-
-
- FUNCTION_TRACE ("DsScopeStackPop");
-
- /*
- * Pop scope info object off the stack.
- */
-
- ScopeInfo = AcpiCmPopGenericState (&WalkState->ScopeInfo);
- if (!ScopeInfo)
- {
- return_ACPI_STATUS (AE_STACK_UNDERFLOW);
- }
-
- DEBUG_PRINT (TRACE_EXEC,
- ("Popped object type %X\n", ScopeInfo->Common.Value));
-
- AcpiCmDeleteGenericState (ScopeInfo);
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
diff --git a/sys/contrib/dev/acpica/Subsystem/Dispatcher/dswstate.c b/sys/contrib/dev/acpica/Subsystem/Dispatcher/dswstate.c
deleted file mode 100644
index dc0b394ea286..000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Dispatcher/dswstate.c
+++ /dev/null
@@ -1,1149 +0,0 @@
-/******************************************************************************
- *
- * Module Name: dswstate - Dispatcher parse tree walk management routines
- * $Revision: 38 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 1. Copyright Notice
- *
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, 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 __DSWSTATE_C__
-
-#include "acpi.h"
-#include "amlcode.h"
-#include "acparser.h"
-#include "acdispat.h"
-#include "acnamesp.h"
-#include "acinterp.h"
-
-#define _COMPONENT DISPATCHER
- MODULE_NAME ("dswstate")
-
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsResultInsert
- *
- * PARAMETERS: Object - Object to push
- * WalkState - Current Walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Push an object onto this walk's result stack
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsResultInsert (
- void *Object,
- UINT32 Index,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_GENERIC_STATE *State;
-
-
- State = WalkState->Results;
- if (!State)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("DsResultInsert: No result object pushed! State=%p\n",
- WalkState));
- return (AE_NOT_EXIST);
- }
-
- if (Index >= OBJ_NUM_OPERANDS)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("DsResultInsert: Index out of range: %X Obj=%p State=%p Num=%X\n",
- Index, Object, WalkState, State->Results.NumResults));
- return (AE_BAD_PARAMETER);
- }
-
- if (!Object)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("DsResultInsert: Null Object! Index=%X Obj=%p State=%p Num=%X\n",
- Index, Object, WalkState, State->Results.NumResults));
- return (AE_BAD_PARAMETER);
- }
-
- State->Results.ObjDesc [Index] = Object;
- State->Results.NumResults++;
-
- DEBUG_PRINT (TRACE_EXEC,
- ("DsResultStackPush: Obj=%p [%s] State=%p Num=%X Cur=%X\n",
- Object, Object ? AcpiCmGetTypeName (((ACPI_OPERAND_OBJECT *) Object)->Common.Type) : "NULL",
- WalkState, State->Results.NumResults, WalkState->CurrentResult));
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsResultRemove
- *
- * PARAMETERS: Object - Where to return the popped object
- * WalkState - Current Walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Pop an object off the bottom of this walk's result stack. In
- * other words, this is a FIFO.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsResultRemove (
- ACPI_OPERAND_OBJECT **Object,
- UINT32 Index,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_GENERIC_STATE *State;
-
-
- State = WalkState->Results;
- if (!State)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("DsResultRemove: No result object pushed! State=%p\n",
- WalkState));
- return (AE_NOT_EXIST);
- }
-
- if (Index >= OBJ_NUM_OPERANDS)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("DsResultRemove: Index out of range: %X State=%p Num=%X\n",
- Index, WalkState, State->Results.NumResults));
- }
-
-
- /* Check for a valid result object */
-
- if (!State->Results.ObjDesc [Index])
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("DsResultStackRemove: Null operand! State=%p #Ops=%X, Index=%X\n",
- WalkState, State->Results.NumResults, Index));
- return (AE_AML_NO_RETURN_VALUE);
- }
-
- /* Remove the object */
-
- State->Results.NumResults--;
-
- *Object = State->Results.ObjDesc [Index];
- State->Results.ObjDesc [Index] = NULL;
-
- DEBUG_PRINT (TRACE_EXEC,
- ("DsResultStackRemove: Obj=%p [%s] Index=%X State=%p Num=%X\n",
- *Object, (*Object) ? AcpiCmGetTypeName ((*Object)->Common.Type) : "NULL",
- Index, WalkState, State->Results.NumResults));
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsResultPop
- *
- * PARAMETERS: Object - Where to return the popped object
- * WalkState - Current Walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Pop an object off the bottom of this walk's result stack. In
- * other words, this is a FIFO.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsResultPop (
- ACPI_OPERAND_OBJECT **Object,
- ACPI_WALK_STATE *WalkState)
-{
- UINT32 Index;
- ACPI_GENERIC_STATE *State;
-
-
- State = WalkState->Results;
- if (!State)
- {
- return (AE_OK);
- }
-
-
- if (!State->Results.NumResults)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("DsResultPop: Result stack is empty! State=%p\n",
- WalkState));
- return (AE_AML_NO_RETURN_VALUE);
- }
-
- /* Remove top element */
-
- State->Results.NumResults--;
-
- for (Index = OBJ_NUM_OPERANDS; Index; Index--)
- {
- /* Check for a valid result object */
-
- if (State->Results.ObjDesc [Index -1])
- {
- *Object = State->Results.ObjDesc [Index -1];
- State->Results.ObjDesc [Index -1] = NULL;
-
- DEBUG_PRINT (TRACE_EXEC,
- ("DsResultStackRemove: Obj=%p [%s] Index=%X State=%p Num=%X\n",
- *Object, (*Object) ? AcpiCmGetTypeName ((*Object)->Common.Type) : "NULL",
- Index -1, WalkState, State->Results.NumResults));
-
- return (AE_OK);
- }
- }
-
-
- DEBUG_PRINT (ACPI_ERROR,
- ("DsResultPop: No result objects! State=%p\n",
- WalkState));
- return (AE_AML_NO_RETURN_VALUE);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsResultPopFromBottom
- *
- * PARAMETERS: Object - Where to return the popped object
- * WalkState - Current Walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Pop an object off the bottom of this walk's result stack. In
- * other words, this is a FIFO.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsResultPopFromBottom (
- ACPI_OPERAND_OBJECT **Object,
- ACPI_WALK_STATE *WalkState)
-{
- UINT32 Index;
- ACPI_GENERIC_STATE *State;
-
-
- State = WalkState->Results;
- if (!State)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("DsResultPopFromBottom: Warning: No result object pushed! State=%p\n",
- WalkState));
- return (AE_NOT_EXIST);
- }
-
-
- if (!State->Results.NumResults)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("DsResultPopFromBottom: No result objects! State=%p\n",
- WalkState));
- return (AE_AML_NO_RETURN_VALUE);
- }
-
- /* Remove Bottom element */
-
- *Object = State->Results.ObjDesc [0];
-
-
- /* Push entire stack down one element */
-
- for (Index = 0; Index < State->Results.NumResults; Index++)
- {
- State->Results.ObjDesc [Index] = State->Results.ObjDesc [Index + 1];
- }
-
- State->Results.NumResults--;
-
- /* Check for a valid result object */
-
- if (!*Object)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("DsResultPopFromBottom: Null operand! State=%p #Ops=%X, Index=%X\n",
- WalkState, State->Results.NumResults, Index));
- return (AE_AML_NO_RETURN_VALUE);
- }
-
- DEBUG_PRINT (TRACE_EXEC,
- ("DsResultPopFromBottom: Obj=%p [%s], Results=%p State=%p\n",
- *Object, (*Object) ? AcpiCmGetTypeName ((*Object)->Common.Type) : "NULL",
- State, WalkState));
-
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsResultPush
- *
- * PARAMETERS: Object - Where to return the popped object
- * WalkState - Current Walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Push an object onto the current result stack
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsResultPush (
- ACPI_OPERAND_OBJECT *Object,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_GENERIC_STATE *State;
-
-
- State = WalkState->Results;
- if (!State)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("DsResultPush: No result stack frame\n"));
- return (AE_AML_INTERNAL);
- }
-
- if (State->Results.NumResults == OBJ_NUM_OPERANDS)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("DsResultPush: Result stack overflow: Obj=%p State=%p Num=%X\n",
- Object, WalkState, State->Results.NumResults));
- return (AE_STACK_OVERFLOW);
- }
-
- if (!Object)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("DsResultPush: Null Object! Obj=%p State=%p Num=%X\n",
- Object, WalkState, State->Results.NumResults));
- return (AE_BAD_PARAMETER);
- }
-
-
- State->Results.ObjDesc [State->Results.NumResults] = Object;
- State->Results.NumResults++;
-
- DEBUG_PRINT (TRACE_EXEC,
- ("DsResultPush: Obj=%p [%s] State=%p Num=%X Cur=%X\n",
- Object, Object ? AcpiCmGetTypeName (((ACPI_OPERAND_OBJECT *) Object)->Common.Type) : "NULL",
- WalkState, State->Results.NumResults, WalkState->CurrentResult));
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsResultStackPush
- *
- * PARAMETERS: Object - Object to push
- * WalkState - Current Walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION:
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsResultStackPush (
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_GENERIC_STATE *State;
-
-
- State = AcpiCmCreateGenericState ();
- if (!State)
- {
- return (AE_NO_MEMORY);
- }
-
- AcpiCmPushGenericState (&WalkState->Results, State);
-
- DEBUG_PRINT (TRACE_EXEC,
- ("DsResultStackPush: Results=%p State=%p\n",
- State, WalkState));
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsResultStackPop
- *
- * PARAMETERS: WalkState - Current Walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION:
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsResultStackPop (
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_GENERIC_STATE *State;
-
-
- /* Check for stack underflow */
-
- if (WalkState->Results == NULL)
- {
- DEBUG_PRINT (TRACE_EXEC,
- ("DsResultStackPop: Underflow - State=%p\n",
- WalkState));
- return (AE_AML_NO_OPERAND);
- }
-
-
- State = AcpiCmPopGenericState (&WalkState->Results);
-
- DEBUG_PRINT (TRACE_EXEC,
- ("DsResultStackPop: Result=%p RemainingResults=%X State=%p\n",
- State, State->Results.NumResults, WalkState));
-
- AcpiCmDeleteGenericState (State);
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsObjStackDeleteAll
- *
- * PARAMETERS: WalkState - Current Walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Clear the object stack by deleting all objects that are on it.
- * Should be used with great care, if at all!
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsObjStackDeleteAll (
- ACPI_WALK_STATE *WalkState)
-{
- UINT32 i;
-
-
- FUNCTION_TRACE_PTR ("DsObjStackDeleteAll", WalkState);
-
-
- /* The stack size is configurable, but fixed */
-
- for (i = 0; i < OBJ_NUM_OPERANDS; i++)
- {
- if (WalkState->Operands[i])
- {
- AcpiCmRemoveReference (WalkState->Operands[i]);
- WalkState->Operands[i] = NULL;
- }
- }
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsObjStackPush
- *
- * PARAMETERS: Object - Object to push
- * WalkState - Current Walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Push an object onto this walk's object/operand stack
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsObjStackPush (
- void *Object,
- ACPI_WALK_STATE *WalkState)
-{
-
-
- /* Check for stack overflow */
-
- if (WalkState->NumOperands >= OBJ_NUM_OPERANDS)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("DsObjStackPush: overflow! Obj=%p State=%p #Ops=%X\n",
- Object, WalkState, WalkState->NumOperands));
- return (AE_STACK_OVERFLOW);
- }
-
- /* Put the object onto the stack */
-
- WalkState->Operands [WalkState->NumOperands] = Object;
- WalkState->NumOperands++;
-
- DEBUG_PRINT (TRACE_EXEC, ("DsObjStackPush: Obj=%p [%s] State=%p #Ops=%X\n",
- Object, AcpiCmGetTypeName (((ACPI_OPERAND_OBJECT *) Object)->Common.Type),
- WalkState, WalkState->NumOperands));
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsObjStackPopObject
- *
- * PARAMETERS: PopCount - Number of objects/entries to pop
- * WalkState - Current Walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Pop this walk's object stack. Objects on the stack are NOT
- * deleted by this routine.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsObjStackPopObject (
- ACPI_OPERAND_OBJECT **Object,
- ACPI_WALK_STATE *WalkState)
-{
-
-
- /* Check for stack underflow */
-
- if (WalkState->NumOperands == 0)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("DsObjStackPop: Missing operand/stack empty! State=%p #Ops=%X\n",
- WalkState, WalkState->NumOperands));
- return (AE_AML_NO_OPERAND);
- }
-
-
- /* Pop the stack */
-
- WalkState->NumOperands--;
-
- /* Check for a valid operand */
-
- if (!WalkState->Operands [WalkState->NumOperands])
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("DsObjStackPop: Null operand! State=%p #Ops=%X\n",
- WalkState, WalkState->NumOperands));
- return (AE_AML_NO_OPERAND);
- }
-
- /* Get operand and set stack entry to null */
-
- *Object = WalkState->Operands [WalkState->NumOperands];
- WalkState->Operands [WalkState->NumOperands] = NULL;
-
- DEBUG_PRINT (TRACE_EXEC, ("DsObjStackPopObject: Obj=%p [%s] State=%p #Ops=%X\n",
- *Object, AcpiCmGetTypeName ((*Object)->Common.Type),
- WalkState, WalkState->NumOperands));
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsObjStackPop
- *
- * PARAMETERS: PopCount - Number of objects/entries to pop
- * WalkState - Current Walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Pop this walk's object stack. Objects on the stack are NOT
- * deleted by this routine.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsObjStackPop (
- UINT32 PopCount,
- ACPI_WALK_STATE *WalkState)
-{
- UINT32 i;
-
-
- for (i = 0; i < PopCount; i++)
- {
- /* Check for stack underflow */
-
- if (WalkState->NumOperands == 0)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("DsObjStackPop: Underflow! Count=%X State=%p #Ops=%X\n",
- PopCount, WalkState, WalkState->NumOperands));
- return (AE_STACK_UNDERFLOW);
- }
-
- /* Just set the stack entry to null */
-
- WalkState->NumOperands--;
- WalkState->Operands [WalkState->NumOperands] = NULL;
- }
-
- DEBUG_PRINT (TRACE_EXEC, ("DsObjStackPop: Count=%X State=%p #Ops=%X\n",
- PopCount, WalkState, WalkState->NumOperands));
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsObjStackPopAndDelete
- *
- * PARAMETERS: PopCount - Number of objects/entries to pop
- * WalkState - Current Walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Pop this walk's object stack and delete each object that is
- * popped off.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsObjStackPopAndDelete (
- UINT32 PopCount,
- ACPI_WALK_STATE *WalkState)
-{
- UINT32 i;
- ACPI_OPERAND_OBJECT *ObjDesc;
-
-
- for (i = 0; i < PopCount; i++)
- {
- /* Check for stack underflow */
-
- if (WalkState->NumOperands == 0)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("DsObjStackPop: Underflow! Count=%X State=%p #Ops=%X\n",
- PopCount, WalkState, WalkState->NumOperands));
- return (AE_STACK_UNDERFLOW);
- }
-
- /* Pop the stack and delete an object if present in this stack entry */
-
- WalkState->NumOperands--;
- ObjDesc = WalkState->Operands [WalkState->NumOperands];
- if (ObjDesc)
- {
- AcpiCmRemoveReference (WalkState->Operands [WalkState->NumOperands]);
- WalkState->Operands [WalkState->NumOperands] = NULL;
- }
- }
-
- DEBUG_PRINT (TRACE_EXEC, ("DsObjStackPop: Count=%X State=%p #Ops=%X\n",
- PopCount, WalkState, WalkState->NumOperands));
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsObjStackGetValue
- *
- * PARAMETERS: Index - Stack index whose value is desired. Based
- * on the top of the stack (index=0 == top)
- * WalkState - Current Walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Retrieve an object from this walk's object stack. Index must
- * be within the range of the current stack pointer.
- *
- ******************************************************************************/
-
-void *
-AcpiDsObjStackGetValue (
- UINT32 Index,
- ACPI_WALK_STATE *WalkState)
-{
-
- FUNCTION_TRACE_PTR ("DsObjStackGetValue", WalkState);
-
-
- /* Can't do it if the stack is empty */
-
- if (WalkState->NumOperands == 0)
- {
- return_VALUE (NULL);
- }
-
- /* or if the index is past the top of the stack */
-
- if (Index > (WalkState->NumOperands - (UINT32) 1))
- {
- return_VALUE (NULL);
- }
-
-
- return_PTR (WalkState->Operands[(NATIVE_UINT)(WalkState->NumOperands - 1) -
- Index]);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsGetCurrentWalkState
- *
- * PARAMETERS: WalkList - Get current active state for this walk list
- *
- * RETURN: Pointer to the current walk state
- *
- * DESCRIPTION: Get the walk state that is at the head of the list (the "current"
- * walk state.
- *
- ******************************************************************************/
-
-ACPI_WALK_STATE *
-AcpiDsGetCurrentWalkState (
- ACPI_WALK_LIST *WalkList)
-
-{
-
- DEBUG_PRINT (TRACE_PARSE, ("DsGetCurrentWalkState, =%p\n", WalkList->WalkState));
-
- if (!WalkList)
- {
- return (NULL);
- }
-
- return (WalkList->WalkState);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsPushWalkState
- *
- * PARAMETERS: WalkState - State to push
- * WalkList - The list that owns the walk stack
- *
- * RETURN: None
- *
- * DESCRIPTION: Place the WalkState at the head of the state list.
- *
- ******************************************************************************/
-
-static void
-AcpiDsPushWalkState (
- ACPI_WALK_STATE *WalkState,
- ACPI_WALK_LIST *WalkList)
-{
-
-
- FUNCTION_TRACE ("DsPushWalkState");
-
-
- WalkState->Next = WalkList->WalkState;
- WalkList->WalkState = WalkState;
-
- return_VOID;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsPopWalkState
- *
- * PARAMETERS: WalkList - The list that owns the walk stack
- *
- * RETURN: A WalkState object popped from the stack
- *
- * DESCRIPTION: Remove and return the walkstate object that is at the head of
- * the walk stack for the given walk list. NULL indicates that
- * the list is empty.
- *
- ******************************************************************************/
-
-ACPI_WALK_STATE *
-AcpiDsPopWalkState (
- ACPI_WALK_LIST *WalkList)
-{
- ACPI_WALK_STATE *WalkState;
-
-
- FUNCTION_TRACE ("DsPopWalkState");
-
-
- WalkState = WalkList->WalkState;
-
- if (WalkState)
- {
- /* Next walk state becomes the current walk state */
-
- WalkList->WalkState = WalkState->Next;
-
- /*
- * Don't clear the NEXT field, this serves as an indicator
- * that there is a parent WALK STATE
- * WalkState->Next = NULL;
- */
- }
-
- return_PTR (WalkState);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsCreateWalkState
- *
- * PARAMETERS: Origin - Starting point for this walk
- * WalkList - Owning walk list
- *
- * RETURN: Pointer to the new walk state.
- *
- * DESCRIPTION: Allocate and initialize a new walk state. The current walk state
- * is set to this new state.
- *
- ******************************************************************************/
-
-ACPI_WALK_STATE *
-AcpiDsCreateWalkState (
- ACPI_OWNER_ID OwnerId,
- ACPI_PARSE_OBJECT *Origin,
- ACPI_OPERAND_OBJECT *MthDesc,
- ACPI_WALK_LIST *WalkList)
-{
- ACPI_WALK_STATE *WalkState;
- ACPI_STATUS Status;
-
-
- FUNCTION_TRACE ("DsCreateWalkState");
-
-
- AcpiCmAcquireMutex (ACPI_MTX_CACHES);
- AcpiGbl_WalkStateCacheRequests++;
-
- /* Check the cache first */
-
- if (AcpiGbl_WalkStateCache)
- {
- /* There is an object available, use it */
-
- WalkState = AcpiGbl_WalkStateCache;
- AcpiGbl_WalkStateCache = WalkState->Next;
-
- AcpiGbl_WalkStateCacheHits++;
- AcpiGbl_WalkStateCacheDepth--;
-
- DEBUG_PRINT (TRACE_EXEC, ("DsCreateWalkState: State %p from cache\n", WalkState));
-
- AcpiCmReleaseMutex (ACPI_MTX_CACHES);
- }
-
- else
- {
- /* The cache is empty, create a new object */
-
- /* Avoid deadlock with AcpiCmCallocate */
-
- AcpiCmReleaseMutex (ACPI_MTX_CACHES);
-
- WalkState = AcpiCmCallocate (sizeof (ACPI_WALK_STATE));
- if (!WalkState)
- {
- return_VALUE (NULL);
- }
- }
-
- WalkState->DataType = ACPI_DESC_TYPE_WALK;
- WalkState->OwnerId = OwnerId;
- WalkState->Origin = Origin;
- WalkState->MethodDesc = MthDesc;
-
- /* Init the method args/local */
-
-#ifndef _ACPI_ASL_COMPILER
- AcpiDsMethodDataInit (WalkState);
-#endif
-
- /* Create an initial result stack entry */
-
- Status = AcpiDsResultStackPush (WalkState);
- if (ACPI_FAILURE (Status))
- {
- return_VALUE (NULL);
- }
-
-
- /* Put the new state at the head of the walk list */
-
- AcpiDsPushWalkState (WalkState, WalkList);
-
- return_PTR (WalkState);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsDeleteWalkState
- *
- * PARAMETERS: WalkState - State to delete
- *
- * RETURN: Status
- *
- * DESCRIPTION: Delete a walk state including all internal data structures
- *
- ******************************************************************************/
-
-void
-AcpiDsDeleteWalkState (
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_GENERIC_STATE *State;
-
-
- FUNCTION_TRACE_PTR ("DsDeleteWalkState", WalkState);
-
-
- if (!WalkState)
- {
- return;
- }
-
- if (WalkState->DataType != ACPI_DESC_TYPE_WALK)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("DsDeleteWalkState: **** %p not a valid walk state\n", WalkState));
- return;
- }
-
-
- /* Always must free any linked control states */
-
- while (WalkState->ControlState)
- {
- State = WalkState->ControlState;
- WalkState->ControlState = State->Common.Next;
-
- AcpiCmDeleteGenericState (State);
- }
-
- /* Always must free any linked parse states */
-
- while (WalkState->ScopeInfo)
- {
- State = WalkState->ScopeInfo;
- WalkState->ScopeInfo = State->Common.Next;
-
- AcpiCmDeleteGenericState (State);
- }
-
- /* Always must free any stacked result states */
-
- while (WalkState->Results)
- {
- State = WalkState->Results;
- WalkState->Results = State->Common.Next;
-
- AcpiCmDeleteGenericState (State);
- }
-
-
- /* If walk cache is full, just free this wallkstate object */
-
- if (AcpiGbl_WalkStateCacheDepth >= MAX_WALK_CACHE_DEPTH)
- {
- AcpiCmFree (WalkState);
- }
-
- /* Otherwise put this object back into the cache */
-
- else
- {
- AcpiCmAcquireMutex (ACPI_MTX_CACHES);
-
- /* Clear the state */
-
- MEMSET (WalkState, 0, sizeof (ACPI_WALK_STATE));
- WalkState->DataType = ACPI_DESC_TYPE_WALK;
-
- /* Put the object at the head of the global cache list */
-
- WalkState->Next = AcpiGbl_WalkStateCache;
- AcpiGbl_WalkStateCache = WalkState;
- AcpiGbl_WalkStateCacheDepth++;
-
-
- AcpiCmReleaseMutex (ACPI_MTX_CACHES);
- }
-
- return_VOID;
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AcpiDsDeleteWalkStateCache
- *
- * PARAMETERS: None
- *
- * RETURN: Status
- *
- * DESCRIPTION: Purge the global state object cache. Used during subsystem
- * termination.
- *
- ******************************************************************************/
-
-void
-AcpiDsDeleteWalkStateCache (
- void)
-{
- ACPI_WALK_STATE *Next;
-
-
- FUNCTION_TRACE ("DsDeleteWalkStateCache");
-
-
- /* Traverse the global cache list */
-
- while (AcpiGbl_WalkStateCache)
- {
- /* Delete one cached state object */
-
- Next = AcpiGbl_WalkStateCache->Next;
- AcpiCmFree (AcpiGbl_WalkStateCache);
- AcpiGbl_WalkStateCache = Next;
- AcpiGbl_WalkStateCacheDepth--;
- }
-
- return_VOID;
-}
-
-