aboutsummaryrefslogtreecommitdiff
path: root/sys/contrib/dev/acpica/Subsystem/Interpreter
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/Subsystem/Interpreter')
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Interpreter/amconfig.c435
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Interpreter/amconvrt.c653
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Interpreter/amcreate.c882
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Interpreter/amdump.c984
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Interpreter/amdyadic.c1048
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Interpreter/amfield.c447
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Interpreter/amfldio.c861
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Interpreter/ammisc.c682
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Interpreter/ammonad.c1212
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Interpreter/amnames.c551
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Interpreter/amprep.c596
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Interpreter/amregion.c561
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Interpreter/amresnte.c697
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Interpreter/amresolv.c633
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Interpreter/amresop.c670
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Interpreter/amstore.c764
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Interpreter/amstoren.c376
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Interpreter/amstorob.c596
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Interpreter/amsystem.c463
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Interpreter/amutils.c496
-rw-r--r--sys/contrib/dev/acpica/Subsystem/Interpreter/amxface.c190
21 files changed, 0 insertions, 13797 deletions
diff --git a/sys/contrib/dev/acpica/Subsystem/Interpreter/amconfig.c b/sys/contrib/dev/acpica/Subsystem/Interpreter/amconfig.c
deleted file mode 100644
index b69170ec7bac..000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Interpreter/amconfig.c
+++ /dev/null
@@ -1,435 +0,0 @@
-/******************************************************************************
- *
- * Module Name: amconfig - Namespace reconfiguration (Load/Unload opcodes)
- * $Revision: 29 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 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 __AMCONFIG_C__
-
-#include "acpi.h"
-#include "acparser.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-#include "acevents.h"
-#include "actables.h"
-#include "acdispat.h"
-
-
-#define _COMPONENT INTERPRETER
- MODULE_NAME ("amconfig")
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiAmlExecLoadTable
- *
- * PARAMETERS: RgnDesc - Op region where the table will be obtained
- * DdbHandle - Where a handle to the table will be returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Load an ACPI table
- *
- ****************************************************************************/
-
-static ACPI_STATUS
-AcpiAmlExecLoadTable (
- ACPI_OPERAND_OBJECT *RgnDesc,
- ACPI_HANDLE *DdbHandle)
-{
- ACPI_STATUS Status;
- ACPI_OPERAND_OBJECT *TableDesc = NULL;
- UINT8 *TablePtr;
- UINT8 *TableDataPtr;
- ACPI_TABLE_HEADER TableHeader;
- ACPI_TABLE_DESC TableInfo;
- UINT32 i;
-
-
- FUNCTION_TRACE ("AmlExecLoadTable");
-
- /* TBD: [Unhandled] Object can be either a field or an opregion */
-
-
- /* Get the table header */
-
- TableHeader.Length = 0;
- for (i = 0; i < sizeof (ACPI_TABLE_HEADER); i++)
- {
- Status = AcpiEvAddressSpaceDispatch (RgnDesc, ADDRESS_SPACE_READ,
- (ACPI_PHYSICAL_ADDRESS) i, 8,
- (UINT32 *) ((UINT8 *) &TableHeader + i));
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- }
-
- /* Allocate a buffer for the entire table */
-
- TablePtr = AcpiCmAllocate (TableHeader.Length);
- if (!TablePtr)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /* Copy the header to the buffer */
-
- MEMCPY (TablePtr, &TableHeader, sizeof (ACPI_TABLE_HEADER));
- TableDataPtr = TablePtr + sizeof (ACPI_TABLE_HEADER);
-
-
- /* Get the table from the op region */
-
- for (i = 0; i < TableHeader.Length; i++)
- {
- Status = AcpiEvAddressSpaceDispatch (RgnDesc, ADDRESS_SPACE_READ,
- (ACPI_PHYSICAL_ADDRESS)i, 8,
- (UINT32 *) (TableDataPtr + i));
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
- }
-
-
- /* Table must be either an SSDT or a PSDT */
-
- if ((!STRNCMP (TableHeader.Signature,
- AcpiGbl_AcpiTableData[ACPI_TABLE_PSDT].Signature,
- AcpiGbl_AcpiTableData[ACPI_TABLE_PSDT].SigLength)) &&
- (!STRNCMP (TableHeader.Signature,
- AcpiGbl_AcpiTableData[ACPI_TABLE_SSDT].Signature,
- AcpiGbl_AcpiTableData[ACPI_TABLE_SSDT].SigLength)))
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("Table has invalid signature [%4.4s], must be SSDT or PSDT\n",
- TableHeader.Signature));
- Status = AE_BAD_SIGNATURE;
- goto Cleanup;
- }
-
- /* Create an object to be the table handle */
-
- TableDesc = AcpiCmCreateInternalObject (INTERNAL_TYPE_REFERENCE);
- if (!TableDesc)
- {
- Status = AE_NO_MEMORY;
- goto Cleanup;
- }
-
-
- /* Install the new table into the local data structures */
-
- TableInfo.Pointer = (ACPI_TABLE_HEADER *) TablePtr;
- TableInfo.Length = TableHeader.Length;
- TableInfo.Allocation = ACPI_MEM_ALLOCATED;
- TableInfo.BasePointer = TablePtr;
-
- Status = AcpiTbInstallTable (NULL, &TableInfo);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
- /* Add the table to the namespace */
-
- /* TBD: [Restructure] - change to whatever new interface is appropriate */
-/*
- Status = AcpiLoadNamespace ();
- if (ACPI_FAILURE (Status))
- {
-*/
- /* TBD: [Errors] Unload the table on failure ? */
-/*
- goto Cleanup;
- }
-*/
-
-
- /* TBD: [Investigate] we need a pointer to the table desc */
-
- /* Init the table handle */
-
- TableDesc->Reference.OpCode = AML_LOAD_OP;
- TableDesc->Reference.Object = TableInfo.InstalledDesc;
-
- *DdbHandle = TableDesc;
-
- return_ACPI_STATUS (Status);
-
-
-Cleanup:
-
- AcpiCmFree (TableDesc);
- AcpiCmFree (TablePtr);
- return_ACPI_STATUS (Status);
-
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiAmlExecUnloadTable
- *
- * PARAMETERS: DdbHandle - Handle to a previously loaded table
- *
- * RETURN: Status
- *
- * DESCRIPTION: Unload an ACPI table
- *
- ****************************************************************************/
-
-static ACPI_STATUS
-AcpiAmlExecUnloadTable (
- ACPI_HANDLE DdbHandle)
-{
- ACPI_STATUS Status = AE_NOT_IMPLEMENTED;
- ACPI_OPERAND_OBJECT *TableDesc = (ACPI_OPERAND_OBJECT *) DdbHandle;
- ACPI_TABLE_DESC *TableInfo;
-
-
- FUNCTION_TRACE ("AmlExecUnloadTable");
-
-
- /* Validate the handle */
- /* Although the handle is partially validated in AcpiAmlExecReconfiguration(),
- * when it calls AcpiAmlResolveOperands(), the handle is more completely
- * validated here.
- */
-
- if ((!DdbHandle) ||
- (!VALID_DESCRIPTOR_TYPE (DdbHandle, ACPI_DESC_TYPE_INTERNAL)) ||
- (((ACPI_OPERAND_OBJECT *)DdbHandle)->Common.Type !=
- INTERNAL_TYPE_REFERENCE))
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
-
- /* Get the actual table descriptor from the DdbHandle */
-
- TableInfo = (ACPI_TABLE_DESC *) TableDesc->Reference.Object;
-
- /*
- * Delete the entire namespace under this table Node
- * (Offset contains the TableId)
- */
-
- Status = AcpiNsDeleteNamespaceByOwner (TableInfo->TableId);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Delete the table itself */
-
- AcpiTbUninstallTable (TableInfo->InstalledDesc);
-
- /* Delete the table descriptor (DdbHandle) */
-
- AcpiCmRemoveReference (TableDesc);
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiAmlExecReconfiguration
- *
- * PARAMETERS: Opcode - The opcode to be executed
- * WalkState - Current state of the parse tree walk
- *
- * RETURN: Status
- *
- * DESCRIPTION: Reconfiguration opcodes such as LOAD and UNLOAD
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiAmlExecReconfiguration (
- UINT16 Opcode,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_STATUS Status;
- ACPI_OPERAND_OBJECT *RegionDesc = NULL;
- ACPI_HANDLE *DdbHandle;
-
-
- FUNCTION_TRACE ("AmlExecReconfiguration");
-
-
- /* Resolve the operands */
-
- Status = AcpiAmlResolveOperands (Opcode, WALK_OPERANDS, WalkState);
- DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (Opcode),
- 2, "after AcpiAmlResolveOperands");
-
- /* Get the table handle, common for both opcodes */
-
- Status |= AcpiDsObjStackPopObject ((ACPI_OPERAND_OBJECT **) &DdbHandle,
- WalkState);
-
- switch (Opcode)
- {
-
- case AML_LOAD_OP:
-
- /* Get the region or field descriptor */
-
- Status |= AcpiDsObjStackPopObject (&RegionDesc, WalkState);
- if (ACPI_FAILURE (Status))
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("ExecReconfiguration/AML_LOAD_OP: bad operand(s) (%X)\n",
- Status));
-
- AcpiCmRemoveReference (RegionDesc);
- return_ACPI_STATUS (Status);
- }
-
- Status = AcpiAmlExecLoadTable (RegionDesc, DdbHandle);
- break;
-
-
- case AML_UNLOAD_OP:
-
- if (ACPI_FAILURE (Status))
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("ExecReconfiguration/AML_UNLOAD_OP: bad operand(s) (%X)\n",
- Status));
-
- return_ACPI_STATUS (Status);
- }
-
- Status = AcpiAmlExecUnloadTable (DdbHandle);
- break;
-
-
- default:
-
- DEBUG_PRINT (ACPI_ERROR, ("AmlExecReconfiguration: bad opcode=%X\n",
- Opcode));
-
- Status = AE_AML_BAD_OPCODE;
- break;
- }
-
-
- return_ACPI_STATUS (Status);
-}
-
diff --git a/sys/contrib/dev/acpica/Subsystem/Interpreter/amconvrt.c b/sys/contrib/dev/acpica/Subsystem/Interpreter/amconvrt.c
deleted file mode 100644
index 9aa444effee5..000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Interpreter/amconvrt.c
+++ /dev/null
@@ -1,653 +0,0 @@
-/******************************************************************************
- *
- * Module Name: amconvrt - Object conversion routines
- * $Revision: 3 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 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 __AMCONVRT_C__
-
-#include "acpi.h"
-#include "acparser.h"
-#include "acnamesp.h"
-#include "acinterp.h"
-#include "acevents.h"
-#include "amlcode.h"
-#include "acdispat.h"
-
-
-#define _COMPONENT INTERPRETER
- MODULE_NAME ("amconvrt")
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlConvertToTargetType
- *
- * PARAMETERS: *ObjDesc - Object to be converted.
- * WalkState - Current method state
- *
- * RETURN: Status
- *
- * DESCRIPTION:
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlConvertToTargetType (
- OBJECT_TYPE_INTERNAL DestinationType,
- ACPI_OPERAND_OBJECT **ObjDesc,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_STATUS Status = AE_OK;
-
-
- FUNCTION_TRACE ("AmlConvertToTargetType");
-
-
- /*
- * If required by the target,
- * perform implicit conversion on the source before we store it.
- */
-
- switch (GET_CURRENT_ARG_TYPE (WalkState->OpInfo->RuntimeArgs))
- {
- case ARGI_SIMPLE_TARGET:
- case ARGI_FIXED_TARGET:
- case ARGI_INTEGER_REF: /* Handles Increment, Decrement cases */
-
- switch (DestinationType)
- {
- case INTERNAL_TYPE_DEF_FIELD:
- /*
- * Named field can always handle conversions
- */
- break;
-
- default:
- /* No conversion allowed for these types */
-
- if (DestinationType != (*ObjDesc)->Common.Type)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlConvertToTargetType: Target does not allow conversion of type %s to %s\n",
- AcpiCmGetTypeName ((*ObjDesc)->Common.Type),
- AcpiCmGetTypeName (DestinationType)));
- Status = AE_TYPE;
- }
- }
- break;
-
-
- case ARGI_TARGETREF:
-
- switch (DestinationType)
- {
- case ACPI_TYPE_INTEGER:
- case ACPI_TYPE_FIELD_UNIT:
- case INTERNAL_TYPE_BANK_FIELD:
- case INTERNAL_TYPE_INDEX_FIELD:
- /*
- * These types require an Integer operand. We can convert
- * a Buffer or a String to an Integer if necessary.
- */
- Status = AcpiAmlConvertToInteger (ObjDesc, WalkState);
- break;
-
-
- case ACPI_TYPE_STRING:
-
- /*
- * The operand must be a String. We can convert an
- * Integer or Buffer if necessary
- */
- Status = AcpiAmlConvertToString (ObjDesc, WalkState);
- break;
-
-
- case ACPI_TYPE_BUFFER:
-
- /*
- * The operand must be a String. We can convert an
- * Integer or Buffer if necessary
- */
- Status = AcpiAmlConvertToBuffer (ObjDesc, WalkState);
- break;
- }
- break;
-
-
- case ARGI_REFERENCE:
- /*
- * CreateXxxxField cases - we are storing the field object into the name
- */
- break;
-
-
- default:
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlConvertToTargetType: Unknown Target type ID 0x%X Op %s DestType %s\n",
- GET_CURRENT_ARG_TYPE (WalkState->OpInfo->RuntimeArgs),
- WalkState->OpInfo->Name,
- AcpiCmGetTypeName (DestinationType)));
-
- Status = AE_AML_INTERNAL;
- }
-
-
- /*
- * Source-to-Target conversion semantics:
- *
- * If conversion to the target type cannot be performed, then simply
- * overwrite the target with the new object and type.
- */
- if (Status == AE_TYPE)
- {
- Status = AE_OK;
- }
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlConvertToInteger
- *
- * PARAMETERS: *ObjDesc - Object to be converted. Must be an
- * Integer, Buffer, or String
- * WalkState - Current method state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert an ACPI Object to an integer.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlConvertToInteger (
- ACPI_OPERAND_OBJECT **ObjDesc,
- ACPI_WALK_STATE *WalkState)
-{
- UINT32 i;
- ACPI_OPERAND_OBJECT *RetDesc;
- UINT32 Count;
- char *Pointer;
- ACPI_INTEGER Result;
- UINT32 IntegerSize = sizeof (ACPI_INTEGER);
-
-
- switch ((*ObjDesc)->Common.Type)
- {
- case ACPI_TYPE_INTEGER:
- return (AE_OK);
-
- case ACPI_TYPE_STRING:
- Pointer = (*ObjDesc)->String.Pointer;
- Count = (*ObjDesc)->String.Length;
- break;
-
- case ACPI_TYPE_BUFFER:
- Pointer = (char *) (*ObjDesc)->Buffer.Pointer;
- Count = (*ObjDesc)->Buffer.Length;
- break;
-
- default:
- return (AE_TYPE);
- }
-
- /*
- * Create a new integer
- */
- RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER);
- if (!RetDesc)
- {
- return (AE_NO_MEMORY);
- }
-
-
- /* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
-
- if (WalkState->MethodNode->Flags & ANOBJ_DATA_WIDTH_32)
- {
- /*
- * We are running a method that exists in a 32-bit ACPI table.
- * Truncate the value to 32 bits by zeroing out the upper 32-bit field
- */
- IntegerSize = sizeof (UINT32);
- }
-
-
- /*
- * Convert the buffer/string to an integer. Note that both buffers and
- * strings are treated as raw data - we don't convert ascii to hex for
- * strings.
- *
- * There are two terminating conditions for the loop:
- * 1) The size of an integer has been reached, or
- * 2) The end of the buffer or string has been reached
- */
- Result = 0;
-
- /* Transfer no more than an integer's worth of data */
-
- if (Count > IntegerSize)
- {
- Count = IntegerSize;
- }
-
- /*
- * String conversion is different than Buffer conversion
- */
- switch ((*ObjDesc)->Common.Type)
- {
- case ACPI_TYPE_STRING:
-
- /* TBD: Need to use 64-bit STRTOUL */
-
- /*
- * Convert string to an integer
- * String must be hexadecimal as per the ACPI specification
- */
-
- Result = STRTOUL (Pointer, NULL, 16);
- break;
-
-
- case ACPI_TYPE_BUFFER:
-
- /*
- * Buffer conversion - we simply grab enough raw data from the
- * buffer to fill an integer
- */
- for (i = 0; i < Count; i++)
- {
- /*
- * Get next byte and shift it into the Result.
- * Little endian is used, meaning that the first byte of the buffer
- * is the LSB of the integer
- */
- Result |= (((ACPI_INTEGER) Pointer[i]) << (i * 8));
- }
-
- break;
- }
-
- /* Save the Result, delete original descriptor, store new descriptor */
-
- RetDesc->Integer.Value = Result;
-
- if (WalkState->Opcode != AML_STORE_OP)
- {
- AcpiCmRemoveReference (*ObjDesc);
- }
-
- *ObjDesc = RetDesc;
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlConvertToBuffer
- *
- * PARAMETERS: *ObjDesc - Object to be converted. Must be an
- * Integer, Buffer, or String
- * WalkState - Current method state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert an ACPI Object to an Buffer
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlConvertToBuffer (
- ACPI_OPERAND_OBJECT **ObjDesc,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_OPERAND_OBJECT *RetDesc;
- UINT32 i;
- UINT32 IntegerSize = sizeof (ACPI_INTEGER);
- UINT8 *NewBuf;
-
-
- switch ((*ObjDesc)->Common.Type)
- {
- case ACPI_TYPE_INTEGER:
-
- /*
- * Create a new Buffer
- */
- RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_BUFFER);
- if (!RetDesc)
- {
- return (AE_NO_MEMORY);
- }
-
- /* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
-
- if (WalkState->MethodNode->Flags & ANOBJ_DATA_WIDTH_32)
- {
- /*
- * We are running a method that exists in a 32-bit ACPI table.
- * Truncate the value to 32 bits by zeroing out the upper
- * 32-bit field
- */
- IntegerSize = sizeof (UINT32);
- }
-
- /* Need enough space for one integers */
-
- RetDesc->Buffer.Length = IntegerSize;
- NewBuf = AcpiCmCallocate (IntegerSize);
- if (!NewBuf)
- {
- REPORT_ERROR
- (("AmlExecDyadic2R/ConcatOp: Buffer allocation failure\n"));
- AcpiCmRemoveReference (RetDesc);
- return (AE_NO_MEMORY);
- }
-
- /* Copy the integer to the buffer */
-
- for (i = 0; i < IntegerSize; i++)
- {
- NewBuf[i] = (UINT8) ((*ObjDesc)->Integer.Value >> (i * 8));
- }
- RetDesc->Buffer.Pointer = NewBuf;
-
- /* Return the new buffer descriptor */
-
- if (WalkState->Opcode != AML_STORE_OP)
- {
- AcpiCmRemoveReference (*ObjDesc);
- }
- *ObjDesc = RetDesc;
- break;
-
-
- case ACPI_TYPE_STRING:
- break;
-
-
- case ACPI_TYPE_BUFFER:
- break;
-
-
- default:
- return (AE_TYPE);
- break;
- }
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlConvertToString
- *
- * PARAMETERS: *ObjDesc - Object to be converted. Must be an
- * Integer, Buffer, or String
- * WalkState - Current method state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert an ACPI Object to a string
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlConvertToString (
- ACPI_OPERAND_OBJECT **ObjDesc,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_OPERAND_OBJECT *RetDesc;
- UINT32 i;
- UINT32 Index;
- UINT32 IntegerSize = sizeof (ACPI_INTEGER);
- UINT8 *NewBuf;
- UINT8 *Pointer;
-
-
- switch ((*ObjDesc)->Common.Type)
- {
- case ACPI_TYPE_INTEGER:
-
- /*
- * Create a new String
- */
- RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_STRING);
- if (!RetDesc)
- {
- return (AE_NO_MEMORY);
- }
-
- /* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
-
- if (WalkState->MethodNode->Flags & ANOBJ_DATA_WIDTH_32)
- {
- /*
- * We are running a method that exists in a 32-bit ACPI table.
- * Truncate the value to 32 bits by zeroing out the upper
- * 32-bit field
- */
- IntegerSize = sizeof (UINT32);
- }
-
- /* Need enough space for one ASCII integer plus null terminator */
-
- RetDesc->String.Length = (IntegerSize * 2) + 1;
- NewBuf = AcpiCmCallocate (RetDesc->String.Length);
- if (!NewBuf)
- {
- REPORT_ERROR
- (("AmlExecDyadic2R/ConcatOp: Buffer allocation failure\n"));
- AcpiCmRemoveReference (RetDesc);
- return (AE_NO_MEMORY);
- }
-
- /* Copy the integer to the buffer */
-
- for (i = 0; i < (IntegerSize * 2); i++)
- {
- NewBuf[i] = AcpiGbl_HexToAscii [((*ObjDesc)->Integer.Value >> (i * 4)) & 0xF];
- }
-
- /* Null terminate */
-
- NewBuf [i] = 0;
- RetDesc->Buffer.Pointer = NewBuf;
-
- /* Return the new buffer descriptor */
-
- if (WalkState->Opcode != AML_STORE_OP)
- {
- AcpiCmRemoveReference (*ObjDesc);
- }
- *ObjDesc = RetDesc;
-
- return (AE_OK);
-
-
- case ACPI_TYPE_BUFFER:
-
- if (((*ObjDesc)->Buffer.Length * 3) > ACPI_MAX_STRING_CONVERSION)
- {
- return (AE_AML_STRING_LIMIT);
- }
-
- /*
- * Create a new String
- */
- RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_STRING);
- if (!RetDesc)
- {
- return (AE_NO_MEMORY);
- }
-
- /* Need enough space for one ASCII integer plus null terminator */
-
- RetDesc->String.Length = (*ObjDesc)->Buffer.Length * 3;
- NewBuf = AcpiCmCallocate (RetDesc->String.Length + 1);
- if (!NewBuf)
- {
- REPORT_ERROR
- (("AmlExecDyadic2R/ConcatOp: Buffer allocation failure\n"));
- AcpiCmRemoveReference (RetDesc);
- return (AE_NO_MEMORY);
- }
-
- /*
- * Convert each byte of the buffer to two ASCII characters plus a space.
- */
- Pointer = (*ObjDesc)->Buffer.Pointer;
- Index = 0;
- for (i = 0; i < (*ObjDesc)->Buffer.Length; i++)
- {
- NewBuf[Index + 0] = AcpiGbl_HexToAscii [Pointer[i] & 0x0F];
- NewBuf[Index + 1] = AcpiGbl_HexToAscii [(Pointer[i] >> 4) & 0x0F];
- NewBuf[Index + 2] = ' ';
- Index += 3;
- }
-
- /* Null terminate */
-
- NewBuf [Index] = 0;
- RetDesc->Buffer.Pointer = NewBuf;
-
- /* Return the new buffer descriptor */
-
- if (WalkState->Opcode != AML_STORE_OP)
- {
- AcpiCmRemoveReference (*ObjDesc);
- }
- *ObjDesc = RetDesc;
- break;
-
-
- case ACPI_TYPE_STRING:
- break;
-
-
- default:
- return (AE_TYPE);
- break;
- }
-
- return (AE_OK);
-}
-
-
diff --git a/sys/contrib/dev/acpica/Subsystem/Interpreter/amcreate.c b/sys/contrib/dev/acpica/Subsystem/Interpreter/amcreate.c
deleted file mode 100644
index e02df3c1bb00..000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Interpreter/amcreate.c
+++ /dev/null
@@ -1,882 +0,0 @@
-/******************************************************************************
- *
- * Module Name: amcreate - Named object creation
- * $Revision: 53 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 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 __AMCREATE_C__
-
-#include "acpi.h"
-#include "acparser.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-#include "acevents.h"
-#include "acdispat.h"
-
-
-#define _COMPONENT INTERPRETER
- MODULE_NAME ("amcreate")
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlExecCreateField
- *
- * PARAMETERS: Opcode - The opcode to be executed
- * Operands - List of operands for the opcode
- *
- * RETURN: Status
- *
- * DESCRIPTION: Execute CreateField operators: CreateBitFieldOp,
- * CreateByteFieldOp, CreateWordFieldOp, CreateDWordFieldOp,
- * CreateFieldOp (which define fields in buffers)
- *
- * ALLOCATION: Deletes CreateFieldOp's count operand descriptor
- *
- *
- * ACPI SPECIFICATION REFERENCES:
- * DefCreateBitField := CreateBitFieldOp SrcBuf BitIdx NameString
- * DefCreateByteField := CreateByteFieldOp SrcBuf ByteIdx NameString
- * DefCreateDWordField := CreateDWordFieldOp SrcBuf ByteIdx NameString
- * DefCreateField := CreateFieldOp SrcBuf BitIdx NumBits NameString
- * DefCreateWordField := CreateWordFieldOp SrcBuf ByteIdx NameString
- * BitIndex := TermArg=>Integer
- * ByteIndex := TermArg=>Integer
- * NumBits := TermArg=>Integer
- * SourceBuff := TermArg=>Buffer
- *
- ******************************************************************************/
-
-
-ACPI_STATUS
-AcpiAmlExecCreateField (
- UINT8 *AmlPtr,
- UINT32 AmlLength,
- ACPI_NAMESPACE_NODE *Node,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_STATUS Status;
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_OPERAND_OBJECT *TmpDesc;
-
-
- FUNCTION_TRACE ("AmlExecCreateField");
-
-
- /* Create the region descriptor */
-
- ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_FIELD_UNIT);
- if (!ObjDesc)
- {
- Status = AE_NO_MEMORY;
- goto Cleanup;
- }
-
- /* Construct the field object */
-
- ObjDesc->FieldUnit.Access = (UINT8) ACCESS_ANY_ACC;
- ObjDesc->FieldUnit.LockRule = (UINT8) GLOCK_NEVER_LOCK;
- ObjDesc->FieldUnit.UpdateRule = (UINT8) UPDATE_PRESERVE;
-
- /*
- * Allocate a method object for this field unit
- */
-
- ObjDesc->FieldUnit.Extra = AcpiCmCreateInternalObject (
- INTERNAL_TYPE_EXTRA);
- if (!ObjDesc->FieldUnit.Extra)
- {
- Status = AE_NO_MEMORY;
- goto Cleanup;
- }
-
- /*
- * Remember location in AML stream of the field unit
- * opcode and operands -- since the buffer and index
- * operands must be evaluated.
- */
-
- ObjDesc->FieldUnit.Extra->Extra.Pcode = AmlPtr;
- ObjDesc->FieldUnit.Extra->Extra.PcodeLength = AmlLength;
- ObjDesc->FieldUnit.Node = Node;
-
-
- /*
- * This operation is supposed to cause the destination Name to refer
- * to the defined FieldUnit -- it must not store the constructed
- * FieldUnit object (or its current value) in some location that the
- * Name may already be pointing to. So, if the Name currently contains
- * a reference which would cause AcpiAmlExecStore() to perform an indirect
- * store rather than setting the value of the Name itself, clobber that
- * reference before calling AcpiAmlExecStore().
- */
-
- /* Type of Name's existing value */
-
- switch (AcpiNsGetType (Node))
- {
-
- case ACPI_TYPE_FIELD_UNIT:
-
- case INTERNAL_TYPE_ALIAS:
- case INTERNAL_TYPE_BANK_FIELD:
- case INTERNAL_TYPE_DEF_FIELD:
- case INTERNAL_TYPE_INDEX_FIELD:
-
- TmpDesc = AcpiNsGetAttachedObject (Node);
- if (TmpDesc)
- {
- /*
- * There is an existing object here; delete it and zero out the
- * object field within the Node
- */
-
- DUMP_PATHNAME (Node,
- "AmlExecCreateField: Removing Current Reference",
- TRACE_BFIELD, _COMPONENT);
-
- DUMP_ENTRY (Node, TRACE_BFIELD);
- DUMP_STACK_ENTRY (TmpDesc);
-
- AcpiCmRemoveReference (TmpDesc);
- AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Node, NULL,
- ACPI_TYPE_ANY);
- }
-
- /* Set the type to ANY (or the store below will fail) */
-
- ((ACPI_NAMESPACE_NODE *) Node)->Type = ACPI_TYPE_ANY;
-
- break;
-
-
- default:
-
- break;
- }
-
-
- /* Store constructed field descriptor in result location */
-
- Status = AcpiAmlExecStore (ObjDesc, (ACPI_OPERAND_OBJECT *) Node, WalkState);
-
- /*
- * If the field descriptor was not physically stored (or if a failure
- * above), we must delete it
- */
- if (ObjDesc->Common.ReferenceCount <= 1)
- {
- AcpiCmRemoveReference (ObjDesc);
- }
-
-
- return_ACPI_STATUS (AE_OK);
-
-
-Cleanup:
-
- /* Delete region object and method subobject */
-
- if (ObjDesc)
- {
- /* Remove deletes both objects! */
-
- AcpiCmRemoveReference (ObjDesc);
- ObjDesc = NULL;
- }
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiAmlExecCreateAlias
- *
- * PARAMETERS: Operands - List of operands for the opcode
- *
- * RETURN: Status
- *
- * DESCRIPTION: Create a new named alias
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiAmlExecCreateAlias (
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_NAMESPACE_NODE *SourceNode;
- ACPI_NAMESPACE_NODE *AliasNode;
- ACPI_STATUS Status;
-
-
- FUNCTION_TRACE ("AmlExecCreateAlias");
-
-
- /* Get the source/alias operands (both NTEs) */
-
- Status = AcpiDsObjStackPopObject ((ACPI_OPERAND_OBJECT **) &SourceNode,
- WalkState);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /*
- * Don't pop it, it gets removed in the calling routine
- */
-
- AliasNode = AcpiDsObjStackGetValue (0, WalkState);
-
- /* Add an additional reference to the object */
-
- AcpiCmAddReference (SourceNode->Object);
-
- /*
- * Attach the original source Node to the new Alias Node.
- */
- Status = AcpiNsAttachObject (AliasNode, SourceNode->Object,
- SourceNode->Type);
-
-
- /*
- * The new alias assumes the type of the source, but it points
- * to the same object. The reference count of the object has two
- * additional references to prevent deletion out from under either the
- * source or the alias Node
- */
-
- /* Since both operands are NTEs, we don't need to delete them */
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiAmlExecCreateEvent
- *
- * PARAMETERS: None
- *
- * RETURN: Status
- *
- * DESCRIPTION: Create a new event object
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiAmlExecCreateEvent (
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_STATUS Status;
- ACPI_OPERAND_OBJECT *ObjDesc;
-
-
- FUNCTION_TRACE ("AmlExecCreateEvent");
-
-
- BREAKPOINT3;
-
- ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_EVENT);
- if (!ObjDesc)
- {
- Status = AE_NO_MEMORY;
- goto Cleanup;
- }
-
- /* Create the actual OS semaphore */
-
- /* TBD: [Investigate] should be created with 0 or 1 units? */
-
- Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, 1,
- &ObjDesc->Event.Semaphore);
- if (ACPI_FAILURE (Status))
- {
- AcpiCmRemoveReference (ObjDesc);
- goto Cleanup;
- }
-
- /* Attach object to the Node */
-
- Status = AcpiNsAttachObject (AcpiDsObjStackGetValue (0, WalkState),
- ObjDesc, (UINT8) ACPI_TYPE_EVENT);
- if (ACPI_FAILURE (Status))
- {
- AcpiOsDeleteSemaphore (ObjDesc->Event.Semaphore);
- AcpiCmRemoveReference (ObjDesc);
- goto Cleanup;
- }
-
-
-Cleanup:
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiAmlExecCreateMutex
- *
- * PARAMETERS: InterpreterMode - Current running mode (load1/Load2/Exec)
- * Operands - List of operands for the opcode
- *
- * RETURN: Status
- *
- * DESCRIPTION: Create a new mutex object
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiAmlExecCreateMutex (
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_STATUS Status = AE_OK;
- ACPI_OPERAND_OBJECT *SyncDesc;
- ACPI_OPERAND_OBJECT *ObjDesc;
-
-
- FUNCTION_TRACE_PTR ("AmlExecCreateMutex", WALK_OPERANDS);
-
-
- /* Get the operand */
-
- Status = AcpiDsObjStackPopObject (&SyncDesc, WalkState);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Attempt to allocate a new object */
-
- ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_MUTEX);
- if (!ObjDesc)
- {
- Status = AE_NO_MEMORY;
- goto Cleanup;
- }
-
- /* Create the actual OS semaphore */
-
- Status = AcpiOsCreateSemaphore (1, 1, &ObjDesc->Mutex.Semaphore);
- if (ACPI_FAILURE (Status))
- {
- AcpiCmRemoveReference (ObjDesc);
- goto Cleanup;
- }
-
- ObjDesc->Mutex.SyncLevel = (UINT8) SyncDesc->Integer.Value;
-
- /* ObjDesc was on the stack top, and the name is below it */
-
- Status = AcpiNsAttachObject (AcpiDsObjStackGetValue (0, WalkState),
- ObjDesc, (UINT8) ACPI_TYPE_MUTEX);
- if (ACPI_FAILURE (Status))
- {
- AcpiOsDeleteSemaphore (ObjDesc->Mutex.Semaphore);
- AcpiCmRemoveReference (ObjDesc);
- goto Cleanup;
- }
-
-
-Cleanup:
-
- /* Always delete the operand */
-
- AcpiCmRemoveReference (SyncDesc);
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiAmlExecCreateRegion
- *
- * PARAMETERS: AmlPtr - Pointer to the region declaration AML
- * AmlLength - Max length of the declaration AML
- * Operands - List of operands for the opcode
- * InterpreterMode - Load1/Load2/Execute
- *
- * RETURN: Status
- *
- * DESCRIPTION: Create a new operation region object
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiAmlExecCreateRegion (
- UINT8 *AmlPtr,
- UINT32 AmlLength,
- UINT8 RegionSpace,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_STATUS Status;
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_NAMESPACE_NODE *Node;
-
-
- FUNCTION_TRACE ("AmlExecCreateRegion");
-
-
- /*
- * Space ID must be one of the predefined IDs, or in the user-defined
- * range
- */
- if ((RegionSpace >= NUM_REGION_TYPES) &&
- (RegionSpace < USER_REGION_BEGIN))
- {
- REPORT_ERROR (("Invalid AddressSpace type %X\n", RegionSpace));
- return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID);
- }
-
- DEBUG_PRINT (TRACE_LOAD, ("AmlExecCreateRegion: Region Type - %s (%X)\n",
- AcpiCmGetRegionName (RegionSpace), RegionSpace));
-
-
- /* Get the Node from the object stack */
-
- Node = (ACPI_NAMESPACE_NODE *) AcpiDsObjStackGetValue (0, WalkState);
-
- /* Create the region descriptor */
-
- ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_REGION);
- if (!ObjDesc)
- {
- Status = AE_NO_MEMORY;
- goto Cleanup;
- }
-
- /*
- * Allocate a method object for this region.
- */
-
- ObjDesc->Region.Extra = AcpiCmCreateInternalObject (
- INTERNAL_TYPE_EXTRA);
- if (!ObjDesc->Region.Extra)
- {
- Status = AE_NO_MEMORY;
- goto Cleanup;
- }
-
- /*
- * Remember location in AML stream of address & length
- * operands since they need to be evaluated at run time.
- */
-
- ObjDesc->Region.Extra->Extra.Pcode = AmlPtr;
- ObjDesc->Region.Extra->Extra.PcodeLength = AmlLength;
-
- /* Init the region from the operands */
-
- ObjDesc->Region.SpaceId = RegionSpace;
- ObjDesc->Region.Address = 0;
- ObjDesc->Region.Length = 0;
-
-
- /* Install the new region object in the parent Node */
-
- ObjDesc->Region.Node = Node;
-
- Status = AcpiNsAttachObject (Node, ObjDesc,
- (UINT8) ACPI_TYPE_REGION);
-
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
- /*
- * If we have a valid region, initialize it
- * Namespace is NOT locked at this point.
- */
-
- Status = AcpiEvInitializeRegion (ObjDesc, FALSE);
-
- if (ACPI_FAILURE (Status))
- {
- /*
- * If AE_NOT_EXIST is returned, it is not fatal
- * because many regions get created before a handler
- * is installed for said region.
- */
- if (AE_NOT_EXIST == Status)
- {
- Status = AE_OK;
- }
- }
-
-Cleanup:
-
- if (ACPI_FAILURE (Status))
- {
- /* Delete region object and method subobject */
-
- if (ObjDesc)
- {
- /* Remove deletes both objects! */
-
- AcpiCmRemoveReference (ObjDesc);
- ObjDesc = NULL;
- }
- }
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiAmlExecCreateProcessor
- *
- * PARAMETERS: Op - Op containing the Processor definition and
- * args
- * ProcessorNTE - Node for the containing Node
- *
- * RETURN: Status
- *
- * DESCRIPTION: Create a new processor object and populate the fields
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiAmlExecCreateProcessor (
- ACPI_PARSE_OBJECT *Op,
- ACPI_HANDLE ProcessorNTE)
-{
- ACPI_STATUS Status;
- ACPI_PARSE_OBJECT *Arg;
- ACPI_OPERAND_OBJECT *ObjDesc;
-
-
- FUNCTION_TRACE_PTR ("AmlExecCreateProcessor", Op);
-
-
- ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_PROCESSOR);
- if (!ObjDesc)
- {
- Status = AE_NO_MEMORY;
- return_ACPI_STATUS (Status);
- }
-
- /* Install the new processor object in the parent Node */
-
- Status = AcpiNsAttachObject (ProcessorNTE, ObjDesc,
- (UINT8) ACPI_TYPE_PROCESSOR);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS(Status);
- }
-
- Arg = Op->Value.Arg;
-
- /* check existence */
-
- if (!Arg)
- {
- Status = AE_AML_NO_OPERAND;
- return_ACPI_STATUS (Status);
- }
-
- /* First arg is the Processor ID */
-
- ObjDesc->Processor.ProcId = (UINT8) Arg->Value.Integer;
-
- /* Move to next arg and check existence */
-
- Arg = Arg->Next;
- if (!Arg)
- {
- Status = AE_AML_NO_OPERAND;
- return_ACPI_STATUS (Status);
- }
-
- /* Second arg is the PBlock Address */
-
- ObjDesc->Processor.Address = (ACPI_IO_ADDRESS) Arg->Value.Integer;
-
- /* Move to next arg and check existence */
-
- Arg = Arg->Next;
- if (!Arg)
- {
- Status = AE_AML_NO_OPERAND;
- return_ACPI_STATUS (Status);
- }
-
- /* Third arg is the PBlock Length */
-
- ObjDesc->Processor.Length = (UINT8) Arg->Value.Integer;
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiAmlExecCreatePowerResource
- *
- * PARAMETERS: Op - Op containing the PowerResource definition
- * and args
- * PowerResNTE - Node for the containing Node
- *
- * RETURN: Status
- *
- * DESCRIPTION: Create a new PowerResource object and populate the fields
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiAmlExecCreatePowerResource (
- ACPI_PARSE_OBJECT *Op,
- ACPI_HANDLE PowerResNTE)
-{
- ACPI_STATUS Status;
- ACPI_PARSE_OBJECT *Arg;
- ACPI_OPERAND_OBJECT *ObjDesc;
-
-
- FUNCTION_TRACE_PTR ("AmlExecCreatePowerResource", Op);
-
-
- ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_POWER);
- if (!ObjDesc)
- {
- Status = AE_NO_MEMORY;
- return_ACPI_STATUS (Status);
- }
-
- /* Install the new power resource object in the parent Node */
-
- Status = AcpiNsAttachObject (PowerResNTE, ObjDesc,
- (UINT8) ACPI_TYPE_POWER);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS(Status);
- }
-
- Arg = Op->Value.Arg;
-
- /* check existence */
-
- if (!Arg)
- {
- Status = AE_AML_NO_OPERAND;
- return_ACPI_STATUS (Status);
- }
-
- /* First arg is the SystemLevel */
-
- ObjDesc->PowerResource.SystemLevel = (UINT8) Arg->Value.Integer;
-
- /* Move to next arg and check existence */
-
- Arg = Arg->Next;
- if (!Arg)
- {
- Status = AE_AML_NO_OPERAND;
- return_ACPI_STATUS (Status);
- }
-
- /* Second arg is the PBlock Address */
-
- ObjDesc->PowerResource.ResourceOrder = (UINT16) Arg->Value.Integer;
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiAmlExecCreateMethod
- *
- * PARAMETERS: AmlPtr - First byte of the method's AML
- * AmlLength - AML byte count for this method
- * MethodFlags - AML method flag byte
- * Method - Method Node
- *
- * RETURN: Status
- *
- * DESCRIPTION: Create a new method object
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiAmlExecCreateMethod (
- UINT8 *AmlPtr,
- UINT32 AmlLength,
- UINT32 MethodFlags,
- ACPI_HANDLE Method)
-{
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_STATUS Status;
-
-
- FUNCTION_TRACE_PTR ("AmlExecCreateMethod", Method);
-
-
- /* Create a new method object */
-
- ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_METHOD);
- if (!ObjDesc)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /* Get the method's AML pointer/length from the Op */
-
- ObjDesc->Method.Pcode = AmlPtr;
- ObjDesc->Method.PcodeLength = AmlLength;
-
- /*
- * First argument is the Method Flags (contains parameter count for the
- * method)
- */
-
- ObjDesc->Method.MethodFlags = (UINT8) MethodFlags;
- ObjDesc->Method.ParamCount = (UINT8) (MethodFlags &
- METHOD_FLAGS_ARG_COUNT);
-
- /*
- * Get the concurrency count. If required, a semaphore will be
- * created for this method when it is parsed.
- *
- * TBD: [Future] for APCI 2.0, there will be a SyncLevel value, not
- * just a flag
- * Concurrency = SyncLevel + 1;.
- */
-
- if (MethodFlags & METHOD_FLAGS_SERIALIZED)
- {
- ObjDesc->Method.Concurrency = 1;
- }
-
- else
- {
- ObjDesc->Method.Concurrency = INFINITE_CONCURRENCY;
- }
-
- /* Attach the new object to the method Node */
-
- Status = AcpiNsAttachObject (Method, ObjDesc, (UINT8) ACPI_TYPE_METHOD);
- if (ACPI_FAILURE (Status))
- {
- AcpiCmDeleteObjectDesc (ObjDesc);
- }
-
- return_ACPI_STATUS (Status);
-}
-
-
diff --git a/sys/contrib/dev/acpica/Subsystem/Interpreter/amdump.c b/sys/contrib/dev/acpica/Subsystem/Interpreter/amdump.c
deleted file mode 100644
index 37f67f8aff68..000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Interpreter/amdump.c
+++ /dev/null
@@ -1,984 +0,0 @@
-/******************************************************************************
- *
- * Module Name: amdump - Interpreter debug output routines
- * $Revision: 100 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 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 __AMDUMP_C__
-
-#include "acpi.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-#include "actables.h"
-
-#define _COMPONENT INTERPRETER
- MODULE_NAME ("amdump")
-
-
-/*
- * The following routines are used for debug output only
- */
-
-#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiAmlShowHexValue
- *
- * PARAMETERS: ByteCount - Number of bytes to print (1, 2, or 4)
- * *AmlPtr - Address in AML stream of bytes to print
- * InterpreterMode - Current running mode (load1/Load2/Exec)
- * LeadSpace - # of spaces to print ahead of value
- * 0 => none ahead but one behind
- *
- * DESCRIPTION: Print ByteCount byte(s) starting at AcpiAmlPtr as a single
- * value, in hex. If ByteCount > 1 or the value printed is > 9, also
- * print in decimal.
- *
- ****************************************************************************/
-
-void
-AcpiAmlShowHexValue (
- UINT32 ByteCount,
- UINT8 *AmlPtr,
- UINT32 LeadSpace)
-{
- UINT32 Value; /* Value retrieved from AML stream */
- UINT32 ShowDecimalValue;
- UINT32 Length; /* Length of printed field */
- UINT8 *CurrentAmlPtr = NULL; /* Pointer to current byte of AML value */
-
-
- FUNCTION_TRACE ("AmlShowHexValue");
-
-
- if (!AmlPtr)
- {
- REPORT_ERROR (("AmlShowHexValue: null pointer\n"));
- }
-
- /*
- * AML numbers are always stored little-endian,
- * even if the processor is big-endian.
- */
- for (CurrentAmlPtr = AmlPtr + ByteCount,
- Value = 0;
- CurrentAmlPtr > AmlPtr; )
- {
- Value = (Value << 8) + (UINT32)* --CurrentAmlPtr;
- }
-
- Length = LeadSpace * ByteCount + 2;
- if (ByteCount > 1)
- {
- Length += (ByteCount - 1);
- }
-
- ShowDecimalValue = (ByteCount > 1 || Value > 9);
- if (ShowDecimalValue)
- {
- Length += 3 + AcpiAmlDigitsNeeded (Value, 10);
- }
-
- DEBUG_PRINT (TRACE_LOAD, (""));
-
- for (Length = LeadSpace; Length; --Length )
- {
- DEBUG_PRINT_RAW (TRACE_LOAD, (" "));
- }
-
- while (ByteCount--)
- {
- DEBUG_PRINT_RAW (TRACE_LOAD, ("%02x", *AmlPtr++));
-
- if (ByteCount)
- {
- DEBUG_PRINT_RAW (TRACE_LOAD, (" "));
- }
- }
-
- if (ShowDecimalValue)
- {
- DEBUG_PRINT_RAW (TRACE_LOAD, (" [%ld]", Value));
- }
-
- if (0 == LeadSpace)
- {
- DEBUG_PRINT_RAW (TRACE_LOAD, (" "));
- }
-
- DEBUG_PRINT_RAW (TRACE_LOAD, ("\n"));
- return_VOID;
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiAmlDumpOperand
- *
- * PARAMETERS: *EntryDesc - Pointer to entry to be dumped
- *
- * RETURN: Status
- *
- * DESCRIPTION: Dump a stack entry
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiAmlDumpOperand (
- ACPI_OPERAND_OBJECT *EntryDesc)
-{
- UINT8 *Buf = NULL;
- UINT32 Length;
- UINT32 i;
-
-
- if (!EntryDesc)
- {
- /*
- * This usually indicates that something serious is wrong --
- * since most (if not all)
- * code that dumps the stack expects something to be there!
- */
- DEBUG_PRINT (ACPI_INFO,
- ("AmlDumpOperand: *** Possible error: Null stack entry ptr\n"));
- return (AE_OK);
- }
-
- if (VALID_DESCRIPTOR_TYPE (EntryDesc, ACPI_DESC_TYPE_NAMED))
- {
- DEBUG_PRINT (ACPI_INFO,
- ("AmlDumpOperand: Node: \n"));
- DUMP_ENTRY (EntryDesc, ACPI_INFO);
- return (AE_OK);
- }
-
- if (AcpiTbSystemTablePointer (EntryDesc))
- {
- DEBUG_PRINT (ACPI_INFO,
- ("AmlDumpOperand: %p is a Pcode pointer\n",
- EntryDesc));
- return (AE_OK);
- }
-
- if (!VALID_DESCRIPTOR_TYPE (EntryDesc, ACPI_DESC_TYPE_INTERNAL))
- {
- DEBUG_PRINT (ACPI_INFO,
- ("AmlDumpOperand: %p Not a local object \n", EntryDesc));
- DUMP_BUFFER (EntryDesc, sizeof (ACPI_OPERAND_OBJECT));
- return (AE_OK);
- }
-
- /* EntryDesc is a valid object */
-
- DEBUG_PRINT (ACPI_INFO, ("AmlDumpOperand: %p ", EntryDesc));
-
- switch (EntryDesc->Common.Type)
- {
- case INTERNAL_TYPE_REFERENCE:
-
- switch (EntryDesc->Reference.OpCode)
- {
- case AML_ZERO_OP:
-
- DEBUG_PRINT_RAW (ACPI_INFO, ("Reference: Zero\n"));
- break;
-
-
- case AML_ONE_OP:
-
- DEBUG_PRINT_RAW (ACPI_INFO, ("Reference: One\n"));
- break;
-
-
- case AML_ONES_OP:
-
- DEBUG_PRINT_RAW (ACPI_INFO, ("Reference: Ones\n"));
- break;
-
-
- case AML_DEBUG_OP:
-
- DEBUG_PRINT_RAW (ACPI_INFO, ("Reference: Debug\n"));
- break;
-
-
- case AML_NAME_OP:
-
- DUMP_PATHNAME (EntryDesc->Reference.Object, "Reference: Name: ",
- ACPI_INFO, _COMPONENT);
- DUMP_ENTRY (EntryDesc->Reference.Object, ACPI_INFO);
- break;
-
-
- case AML_INDEX_OP:
-
- DEBUG_PRINT_RAW (ACPI_INFO, ("Reference: Index %p\n",
- EntryDesc->Reference.Object));
- break;
-
-
- case AML_ARG_OP:
-
- DEBUG_PRINT_RAW (ACPI_INFO, ("Reference: Arg%d",
- EntryDesc->Reference.Offset));
-
- if (ACPI_TYPE_INTEGER == EntryDesc->Common.Type)
- {
- /* Value is a Number */
-
- DEBUG_PRINT_RAW (ACPI_INFO, (" value is [%ld]",
- EntryDesc->Integer.Value));
- }
-
- DEBUG_PRINT_RAW (ACPI_INFO, ("\n"));
- break;
-
-
- case AML_LOCAL_OP:
-
- DEBUG_PRINT_RAW (ACPI_INFO, ("Reference: Local%d",
- EntryDesc->Reference.Offset));
-
- if (ACPI_TYPE_INTEGER == EntryDesc->Common.Type)
- {
-
- /* Value is a Number */
-
- DEBUG_PRINT_RAW (ACPI_INFO, (" value is [%ld]",
- EntryDesc->Integer.Value));
- }
-
- DEBUG_PRINT_RAW (ACPI_INFO, ("\n"));
- break;
-
-
- case AML_NAMEPATH_OP:
- DEBUG_PRINT_RAW (ACPI_INFO, ("Reference.Node->Name %x\n",
- EntryDesc->Reference.Node->Name));
- break;
-
- default:
-
- /* unknown opcode */
-
- DEBUG_PRINT_RAW (ACPI_INFO, ("Unknown opcode=%X\n",
- EntryDesc->Reference.OpCode));
- break;
-
- }
-
- break;
-
-
- case ACPI_TYPE_BUFFER:
-
- DEBUG_PRINT_RAW (ACPI_INFO, ("Buffer len %X @ %p \n",
- EntryDesc->Buffer.Length,
- EntryDesc->Buffer.Pointer));
-
- Length = EntryDesc->Buffer.Length;
-
- if (Length > 64)
- {
- Length = 64;
- }
-
- /* Debug only -- dump the buffer contents */
-
- if (EntryDesc->Buffer.Pointer)
- {
- DEBUG_PRINT_RAW (ACPI_INFO, ("Buffer Contents: "));
-
- for (Buf = EntryDesc->Buffer.Pointer; Length--; ++Buf)
- {
- DEBUG_PRINT_RAW (ACPI_INFO,
- (Length ? " %02x" : " %02x", *Buf));
- }
- DEBUG_PRINT_RAW (ACPI_INFO,("\n"));
- }
-
- break;
-
-
- case ACPI_TYPE_INTEGER:
-
- DEBUG_PRINT_RAW (ACPI_INFO, ("Number %lX\n",
- EntryDesc->Integer.Value));
- break;
-
-
- case INTERNAL_TYPE_IF:
-
- DEBUG_PRINT_RAW (ACPI_INFO, ("If [Number] %lX\n",
- EntryDesc->Integer.Value));
- break;
-
-
- case INTERNAL_TYPE_WHILE:
-
- DEBUG_PRINT_RAW (ACPI_INFO, ("While [Number] %lX\n",
- EntryDesc->Integer.Value));
- break;
-
-
- case ACPI_TYPE_PACKAGE:
-
- DEBUG_PRINT_RAW (ACPI_INFO, ("Package count %X @ %p\n",
- EntryDesc->Package.Count, EntryDesc->Package.Elements));
-
-
- /*
- * If elements exist, package vector pointer is valid,
- * and debug_level exceeds 1, dump package's elements.
- */
- if (EntryDesc->Package.Count &&
- EntryDesc->Package.Elements &&
- GetDebugLevel () > 1)
- {
- ACPI_OPERAND_OBJECT**Element;
- UINT16 ElementIndex;
-
- for (ElementIndex = 0, Element = EntryDesc->Package.Elements;
- ElementIndex < EntryDesc->Package.Count;
- ++ElementIndex, ++Element)
- {
- AcpiAmlDumpOperand (*Element);
- }
- }
-
- DEBUG_PRINT_RAW (ACPI_INFO, ("\n"));
-
- break;
-
-
- case ACPI_TYPE_REGION:
-
- DEBUG_PRINT_RAW (ACPI_INFO, ("Region %s (%X)",
- AcpiCmGetRegionName (EntryDesc->Region.SpaceId),
- EntryDesc->Region.SpaceId));
-
- /*
- * If the address and length have not been evaluated,
- * don't print them.
- */
- if (!(EntryDesc->Region.Flags & AOPOBJ_DATA_VALID))
- {
- DEBUG_PRINT_RAW (ACPI_INFO, ("\n"));
- }
- else
- {
- DEBUG_PRINT_RAW (ACPI_INFO, (" base %p Length %X\n",
- EntryDesc->Region.Address, EntryDesc->Region.Length));
- }
- break;
-
-
- case ACPI_TYPE_STRING:
-
- DEBUG_PRINT_RAW (ACPI_INFO, ("String length %X @ %p\n\n",
- EntryDesc->String.Length, EntryDesc->String.Pointer));
-
- for (i=0; i < EntryDesc->String.Length; i++)
- {
- DEBUG_PRINT_RAW (ACPI_INFO, ("%c",
- EntryDesc->String.Pointer[i]));
- }
-
- DEBUG_PRINT_RAW (ACPI_INFO, ("\n\n"));
- break;
-
-
- case INTERNAL_TYPE_BANK_FIELD:
-
- DEBUG_PRINT_RAW (ACPI_INFO, ("BankField\n"));
- break;
-
-
- case INTERNAL_TYPE_DEF_FIELD:
-
- DEBUG_PRINT_RAW (ACPI_INFO,
- ("DefField: bits=%X acc=%X lock=%X update=%X at byte=%lX bit=%X of below:\n",
- EntryDesc->Field.Length, EntryDesc->Field.Access,
- EntryDesc->Field.LockRule, EntryDesc->Field.UpdateRule,
- EntryDesc->Field.Offset, EntryDesc->Field.BitOffset));
- DUMP_STACK_ENTRY (EntryDesc->Field.Container);
- break;
-
-
- case INTERNAL_TYPE_INDEX_FIELD:
-
- DEBUG_PRINT_RAW (ACPI_INFO, ("IndexField\n"));
- break;
-
-
- case ACPI_TYPE_FIELD_UNIT:
-
- DEBUG_PRINT_RAW (ACPI_INFO,
- ("FieldUnit: %X bits acc %X lock %X update %X at byte %lX bit %X of \n",
- EntryDesc->FieldUnit.Length, EntryDesc->FieldUnit.Access,
- EntryDesc->FieldUnit.LockRule, EntryDesc->FieldUnit.UpdateRule,
- EntryDesc->FieldUnit.Offset, EntryDesc->FieldUnit.BitOffset));
-
- if (!EntryDesc->FieldUnit.Container)
- {
- DEBUG_PRINT (ACPI_INFO, ("*NULL* \n"));
- }
-
- else if (ACPI_TYPE_BUFFER !=
- EntryDesc->FieldUnit.Container->Common.Type)
- {
- DEBUG_PRINT_RAW (ACPI_INFO, ("*not a Buffer* \n"));
- }
-
- else
- {
- DUMP_STACK_ENTRY (EntryDesc->FieldUnit.Container);
- }
-
- break;
-
-
- case ACPI_TYPE_EVENT:
-
- DEBUG_PRINT_RAW (ACPI_INFO, ("Event\n"));
- break;
-
-
- case ACPI_TYPE_METHOD:
-
- DEBUG_PRINT_RAW (ACPI_INFO,
- ("Method(%X) @ %p:%lX\n",
- EntryDesc->Method.ParamCount,
- EntryDesc->Method.Pcode, EntryDesc->Method.PcodeLength));
- break;
-
-
- case ACPI_TYPE_MUTEX:
-
- DEBUG_PRINT_RAW (ACPI_INFO, ("Mutex\n"));
- break;
-
-
- case ACPI_TYPE_DEVICE:
-
- DEBUG_PRINT_RAW (ACPI_INFO, ("Device\n"));
- break;
-
-
- case ACPI_TYPE_POWER:
-
- DEBUG_PRINT_RAW (ACPI_INFO, ("Power\n"));
- break;
-
-
- case ACPI_TYPE_PROCESSOR:
-
- DEBUG_PRINT_RAW (ACPI_INFO, ("Processor\n"));
- break;
-
-
- case ACPI_TYPE_THERMAL:
-
- DEBUG_PRINT_RAW (ACPI_INFO, ("Thermal\n"));
- break;
-
-
- default:
- /* unknown EntryDesc->Common.Type value */
-
- DEBUG_PRINT_RAW (ACPI_INFO, ("Unknown Type %X\n",
- EntryDesc->Common.Type));
-
- /* Back up to previous entry */
-
- EntryDesc--;
-
-
- /* TBD: [Restructure] Change to use dump object routine !! */
- /* What is all of this?? */
-
- DUMP_BUFFER (EntryDesc, sizeof (ACPI_OPERAND_OBJECT));
- DUMP_BUFFER (++EntryDesc, sizeof (ACPI_OPERAND_OBJECT));
- DUMP_BUFFER (++EntryDesc, sizeof (ACPI_OPERAND_OBJECT));
- break;
-
- }
-
- return (AE_OK);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiAmlDumpOperands
- *
- * PARAMETERS: InterpreterMode - Load or Exec
- * *Ident - Identification
- * NumLevels - # of stack entries to dump above line
- * *Note - Output notation
- *
- * DESCRIPTION: Dump the object stack
- *
- ****************************************************************************/
-
-void
-AcpiAmlDumpOperands (
- ACPI_OPERAND_OBJECT **Operands,
- OPERATING_MODE InterpreterMode,
- NATIVE_CHAR *Ident,
- UINT32 NumLevels,
- NATIVE_CHAR *Note,
- NATIVE_CHAR *ModuleName,
- UINT32 LineNumber)
-{
- NATIVE_UINT i;
- ACPI_OPERAND_OBJECT **EntryDesc;
-
-
- if (!Ident)
- {
- Ident = "?";
- }
-
- if (!Note)
- {
- Note = "?";
- }
-
-
- DEBUG_PRINT (ACPI_INFO,
- ("************* AcpiAmlDumpOperands Mode=%X ******************\n",
- InterpreterMode));
- DEBUG_PRINT (ACPI_INFO,
- ("From %12s(%d) %s: %s\n", ModuleName, LineNumber, Ident, Note));
-
- if (NumLevels == 0)
- NumLevels = 1;
-
- /* Dump the stack starting at the top, working down */
-
- for (i = 0; NumLevels > 0; i--, NumLevels--)
- {
- EntryDesc = &Operands[i];
-
- if (ACPI_FAILURE (AcpiAmlDumpOperand (*EntryDesc)))
- {
- break;
- }
- }
-
- return;
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiAmlDumpNode
- *
- * PARAMETERS: *Node - Descriptor to dump
- * Flags - Force display
- *
- * DESCRIPTION: Dumps the members of the given.Node
- *
- ****************************************************************************/
-
-void
-AcpiAmlDumpNode (
- ACPI_NAMESPACE_NODE *Node,
- UINT32 Flags)
-{
-
- if (!Flags)
- {
- if (!((TRACE_OBJECTS & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
- {
- return;
- }
- }
-
-
- AcpiOsPrintf ("%20s : %4.4s\n", "Name", &Node->Name);
- AcpiOsPrintf ("%20s : %s\n", "Type", AcpiCmGetTypeName (Node->Type));
- AcpiOsPrintf ("%20s : %X\n", "Flags", Node->Flags);
- AcpiOsPrintf ("%20s : %X\n", "Owner Id", Node->OwnerId);
- AcpiOsPrintf ("%20s : %X\n", "Reference Count", Node->ReferenceCount);
- AcpiOsPrintf ("%20s : %p\n", "Attached Object", Node->Object);
- AcpiOsPrintf ("%20s : %p\n", "ChildList", Node->Child);
- AcpiOsPrintf ("%20s : %p\n", "NextPeer", Node->Peer);
- AcpiOsPrintf ("%20s : %p\n", "Parent", AcpiNsGetParentObject (Node));
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiAmlDumpObjectDescriptor
- *
- * PARAMETERS: *Object - Descriptor to dump
- * Flags - Force display
- *
- * DESCRIPTION: Dumps the members of the object descriptor given.
- *
- ****************************************************************************/
-
-void
-AcpiAmlDumpObjectDescriptor (
- ACPI_OPERAND_OBJECT *ObjDesc,
- UINT32 Flags)
-{
- FUNCTION_TRACE ("AmlDumpObjectDescriptor");
-
-
- if (!Flags)
- {
- if (!((TRACE_OBJECTS & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
- {
- return;
- }
- }
-
- if (!(VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_INTERNAL)))
- {
- AcpiOsPrintf ("%p is not a valid ACPI object\n", ObjDesc);
- return;
- }
-
- /* Common Fields */
-
- AcpiOsPrintf ("%20s : %X\n", "Reference Count", ObjDesc->Common.ReferenceCount);
- AcpiOsPrintf ("%20s : %X\n", "Flags", ObjDesc->Common.Flags);
-
- /* Object-specific Fields */
-
- switch (ObjDesc->Common.Type)
- {
- case ACPI_TYPE_INTEGER:
-
- AcpiOsPrintf ("%20s : %s\n", "Type", "Number");
- AcpiOsPrintf ("%20s : %X\n", "Value", ObjDesc->Integer.Value);
- break;
-
-
- case ACPI_TYPE_STRING:
-
- AcpiOsPrintf ("%20s : %s\n", "Type", "String");
- AcpiOsPrintf ("%20s : %X\n", "Length", ObjDesc->String.Length);
- AcpiOsPrintf ("%20s : %p\n", "Pointer", ObjDesc->String.Pointer);
- break;
-
-
- case ACPI_TYPE_BUFFER:
-
- AcpiOsPrintf ("%20s : %s\n", "Type", "Buffer");
- AcpiOsPrintf ("%20s : %X\n", "Length", ObjDesc->Buffer.Length);
- AcpiOsPrintf ("%20s : %p\n", "Pointer", ObjDesc->Buffer.Pointer);
- break;
-
-
- case ACPI_TYPE_PACKAGE:
-
- AcpiOsPrintf ("%20s : %s\n", "Type", "Package");
- AcpiOsPrintf ("%20s : %X\n", "Count", ObjDesc->Package.Count);
- AcpiOsPrintf ("%20s : %p\n", "Elements", ObjDesc->Package.Elements);
- AcpiOsPrintf ("%20s : %p\n", "NextElement", ObjDesc->Package.NextElement);
- break;
-
-
- case ACPI_TYPE_FIELD_UNIT:
-
- AcpiOsPrintf ("%20s : %s\n", "Type", "FieldUnit");
- AcpiOsPrintf ("%20s : %X\n", "Access", ObjDesc->FieldUnit.Access);
- AcpiOsPrintf ("%20s : %X\n", "LockRule", ObjDesc->FieldUnit.LockRule);
- AcpiOsPrintf ("%20s : %X\n", "UpdateRule", ObjDesc->FieldUnit.UpdateRule);
- AcpiOsPrintf ("%20s : %X\n", "Length", ObjDesc->FieldUnit.Length);
- AcpiOsPrintf ("%20s : %X\n", "BitOffset", ObjDesc->FieldUnit.BitOffset);
- AcpiOsPrintf ("%20s : %X\n", "Offset", ObjDesc->FieldUnit.Offset);
- AcpiOsPrintf ("%20s : %p\n", "Container", ObjDesc->FieldUnit.Container);
- break;
-
-
- case ACPI_TYPE_DEVICE:
-
- AcpiOsPrintf ("%20s : %s\n", "Type", "Device");
- AcpiOsPrintf ("%20s : %p\n", "AddrHandler", ObjDesc->Device.AddrHandler);
- AcpiOsPrintf ("%20s : %p\n", "SysHandler", ObjDesc->Device.SysHandler);
- AcpiOsPrintf ("%20s : %p\n", "DrvHandler", ObjDesc->Device.DrvHandler);
- break;
-
- case ACPI_TYPE_EVENT:
-
- AcpiOsPrintf ("%20s : %s\n", "Type", "Event");
- AcpiOsPrintf ("%20s : %X\n", "Semaphore", ObjDesc->Event.Semaphore);
- break;
-
-
- case ACPI_TYPE_METHOD:
-
- AcpiOsPrintf ("%20s : %s\n", "Type", "Method");
- AcpiOsPrintf ("%20s : %X\n", "ParamCount", ObjDesc->Method.ParamCount);
- AcpiOsPrintf ("%20s : %X\n", "Concurrency", ObjDesc->Method.Concurrency);
- AcpiOsPrintf ("%20s : %p\n", "Semaphore", ObjDesc->Method.Semaphore);
- AcpiOsPrintf ("%20s : %X\n", "PcodeLength", ObjDesc->Method.PcodeLength);
- AcpiOsPrintf ("%20s : %X\n", "Pcode", ObjDesc->Method.Pcode);
- break;
-
-
- case ACPI_TYPE_MUTEX:
-
- AcpiOsPrintf ("%20s : %s\n", "Type", "Mutex");
- AcpiOsPrintf ("%20s : %X\n", "SyncLevel", ObjDesc->Mutex.SyncLevel);
- AcpiOsPrintf ("%20s : %p\n", "Semaphore", ObjDesc->Mutex.Semaphore);
- break;
-
-
- case ACPI_TYPE_REGION:
-
- AcpiOsPrintf ("%20s : %s\n", "Type", "Region");
- AcpiOsPrintf ("%20s : %X\n", "SpaceId", ObjDesc->Region.SpaceId);
- AcpiOsPrintf ("%20s : %X\n", "Flags", ObjDesc->Region.Flags);
- AcpiOsPrintf ("%20s : %X\n", "Address", ObjDesc->Region.Address);
- AcpiOsPrintf ("%20s : %X\n", "Length", ObjDesc->Region.Length);
- AcpiOsPrintf ("%20s : %p\n", "AddrHandler", ObjDesc->Region.AddrHandler);
- AcpiOsPrintf ("%20s : %p\n", "Next", ObjDesc->Region.Next);
- break;
-
-
- case ACPI_TYPE_POWER:
-
- AcpiOsPrintf ("%20s : %s\n", "Type", "PowerResource");
- AcpiOsPrintf ("%20s : %X\n", "SystemLevel", ObjDesc->PowerResource.SystemLevel);
- AcpiOsPrintf ("%20s : %X\n", "ResourceOrder", ObjDesc->PowerResource.ResourceOrder);
- AcpiOsPrintf ("%20s : %p\n", "SysHandler", ObjDesc->PowerResource.SysHandler);
- AcpiOsPrintf ("%20s : %p\n", "DrvHandler", ObjDesc->PowerResource.DrvHandler);
- break;
-
-
- case ACPI_TYPE_PROCESSOR:
-
- AcpiOsPrintf ("%20s : %s\n", "Type", "Processor");
- AcpiOsPrintf ("%20s : %X\n", "Processor ID", ObjDesc->Processor.ProcId);
- AcpiOsPrintf ("%20s : %X\n", "Length", ObjDesc->Processor.Length);
- AcpiOsPrintf ("%20s : %X\n", "Address", ObjDesc->Processor.Address);
- AcpiOsPrintf ("%20s : %p\n", "SysHandler", ObjDesc->Processor.SysHandler);
- AcpiOsPrintf ("%20s : %p\n", "DrvHandler", ObjDesc->Processor.DrvHandler);
- AcpiOsPrintf ("%20s : %p\n", "AddrHandler", ObjDesc->Processor.AddrHandler);
- break;
-
-
- case ACPI_TYPE_THERMAL:
-
- AcpiOsPrintf ("%20s : %s\n", "Type", "ThermalZone");
- AcpiOsPrintf ("%20s : %p\n", "SysHandler", ObjDesc->ThermalZone.SysHandler);
- AcpiOsPrintf ("%20s : %p\n", "DrvHandler", ObjDesc->ThermalZone.DrvHandler);
- AcpiOsPrintf ("%20s : %p\n", "AddrHandler", ObjDesc->ThermalZone.AddrHandler);
- break;
-
- case INTERNAL_TYPE_BANK_FIELD:
-
- AcpiOsPrintf ("%20s : %s\n", "Type", "BankField");
- AcpiOsPrintf ("%20s : %X\n", "Access", ObjDesc->BankField.Access);
- AcpiOsPrintf ("%20s : %X\n", "LockRule", ObjDesc->BankField.LockRule);
- AcpiOsPrintf ("%20s : %X\n", "UpdateRule", ObjDesc->BankField.UpdateRule);
- AcpiOsPrintf ("%20s : %X\n", "Length", ObjDesc->BankField.Length);
- AcpiOsPrintf ("%20s : %X\n", "BitOffset", ObjDesc->BankField.BitOffset);
- AcpiOsPrintf ("%20s : %X\n", "Offset", ObjDesc->BankField.Offset);
- AcpiOsPrintf ("%20s : %X\n", "Value", ObjDesc->BankField.Value);
- AcpiOsPrintf ("%20s : %p\n", "Container", ObjDesc->BankField.Container);
- AcpiOsPrintf ("%20s : %X\n", "BankSelect", ObjDesc->BankField.BankSelect);
- break;
-
-
- case INTERNAL_TYPE_INDEX_FIELD:
-
- AcpiOsPrintf ("%20s : %s\n", "Type", "IndexField");
- AcpiOsPrintf ("%20s : %X\n", "Access", ObjDesc->IndexField.Access);
- AcpiOsPrintf ("%20s : %X\n", "LockRule", ObjDesc->IndexField.LockRule);
- AcpiOsPrintf ("%20s : %X\n", "UpdateRule", ObjDesc->IndexField.UpdateRule);
- AcpiOsPrintf ("%20s : %X\n", "Length", ObjDesc->IndexField.Length);
- AcpiOsPrintf ("%20s : %X\n", "BitOffset", ObjDesc->IndexField.BitOffset);
- AcpiOsPrintf ("%20s : %X\n", "Value", ObjDesc->IndexField.Value);
- AcpiOsPrintf ("%20s : %X\n", "Index", ObjDesc->IndexField.Index);
- AcpiOsPrintf ("%20s : %X\n", "Data", ObjDesc->IndexField.Data);
- break;
-
-
- case INTERNAL_TYPE_REFERENCE:
-
- AcpiOsPrintf ("%20s : %s\n", "Type", "Reference");
- AcpiOsPrintf ("%20s : %X\n", "TargetType", ObjDesc->Reference.TargetType);
- AcpiOsPrintf ("%20s : %X\n", "OpCode", ObjDesc->Reference.OpCode);
- AcpiOsPrintf ("%20s : %X\n", "Offset", ObjDesc->Reference.Offset);
- AcpiOsPrintf ("%20s : %p\n", "ObjDesc", ObjDesc->Reference.Object);
- AcpiOsPrintf ("%20s : %p\n", "Node", ObjDesc->Reference.Node);
- AcpiOsPrintf ("%20s : %p\n", "Where", ObjDesc->Reference.Where);
- break;
-
-
- case INTERNAL_TYPE_ADDRESS_HANDLER:
-
- AcpiOsPrintf ("%20s : %s\n", "Type", "Address Handler");
- AcpiOsPrintf ("%20s : %X\n", "SpaceId", ObjDesc->AddrHandler.SpaceId);
- AcpiOsPrintf ("%20s : %p\n", "Next", ObjDesc->AddrHandler.Next);
- AcpiOsPrintf ("%20s : %p\n", "RegionList", ObjDesc->AddrHandler.RegionList);
- AcpiOsPrintf ("%20s : %p\n", "Node", ObjDesc->AddrHandler.Node);
- AcpiOsPrintf ("%20s : %p\n", "Handler", ObjDesc->AddrHandler.Handler);
- AcpiOsPrintf ("%20s : %p\n", "Context", ObjDesc->AddrHandler.Context);
- break;
-
-
- case INTERNAL_TYPE_NOTIFY:
-
- AcpiOsPrintf ("%20s : %s\n", "Type", "Notify Handler");
- AcpiOsPrintf ("%20s : %p\n", "Node", ObjDesc->NotifyHandler.Node);
- AcpiOsPrintf ("%20s : %p\n", "Handler", ObjDesc->NotifyHandler.Handler);
- AcpiOsPrintf ("%20s : %p\n", "Context", ObjDesc->NotifyHandler.Context);
- break;
-
-
- case INTERNAL_TYPE_DEF_FIELD:
-
- AcpiOsPrintf ("%20s : %p\n", "Granularity", ObjDesc->Field.Granularity);
- AcpiOsPrintf ("%20s : %p\n", "Length", ObjDesc->Field.Length);
- AcpiOsPrintf ("%20s : %p\n", "Offset", ObjDesc->Field.Offset);
- AcpiOsPrintf ("%20s : %p\n", "BitOffset", ObjDesc->Field.BitOffset);
- AcpiOsPrintf ("%20s : %p\n", "Container", ObjDesc->Field.Container);
- break;
-
-
- case INTERNAL_TYPE_ALIAS:
- case INTERNAL_TYPE_DEF_FIELD_DEFN:
- case INTERNAL_TYPE_BANK_FIELD_DEFN:
- case INTERNAL_TYPE_INDEX_FIELD_DEFN:
- case INTERNAL_TYPE_IF:
- case INTERNAL_TYPE_ELSE:
- case INTERNAL_TYPE_WHILE:
- case INTERNAL_TYPE_SCOPE:
- case INTERNAL_TYPE_DEF_ANY:
-
- AcpiOsPrintf ("*** Structure display not implemented for type %X! ***\n",
- ObjDesc->Common.Type);
- break;
-
-
- default:
-
- AcpiOsPrintf ("*** Cannot display unknown type %X! ***\n", ObjDesc->Common.Type);
- break;
- }
-
- return_VOID;
-}
-
-#endif
-
diff --git a/sys/contrib/dev/acpica/Subsystem/Interpreter/amdyadic.c b/sys/contrib/dev/acpica/Subsystem/Interpreter/amdyadic.c
deleted file mode 100644
index c80d929955de..000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Interpreter/amdyadic.c
+++ /dev/null
@@ -1,1048 +0,0 @@
-/******************************************************************************
- *
- * Module Name: amdyadic - ACPI AML (p-code) execution for dyadic operators
- * $Revision: 71 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 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 __AMDYADIC_C__
-
-#include "acpi.h"
-#include "acparser.h"
-#include "acnamesp.h"
-#include "acinterp.h"
-#include "acevents.h"
-#include "amlcode.h"
-#include "acdispat.h"
-
-
-#define _COMPONENT INTERPRETER
- MODULE_NAME ("amdyadic")
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlDoConcatenate
- *
- * PARAMETERS: *ObjDesc - Object to be converted. Must be an
- * Integer, Buffer, or String
- *
- * RETURN: Status
- *
- * DESCRIPTION: Concatenate two objects OF THE SAME TYPE.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlDoConcatenate (
- ACPI_OPERAND_OBJECT *ObjDesc,
- ACPI_OPERAND_OBJECT *ObjDesc2,
- ACPI_OPERAND_OBJECT **ActualRetDesc,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_STATUS Status;
- UINT32 i;
- ACPI_INTEGER ThisInteger;
- ACPI_OPERAND_OBJECT *RetDesc;
- NATIVE_CHAR *NewBuf;
- UINT32 IntegerSize = sizeof (ACPI_INTEGER);
-
-
- /*
- * There are three cases to handle:
- * 1) Two Integers concatenated to produce a buffer
- * 2) Two Strings concatenated to produce a string
- * 3) Two Buffers concatenated to produce a buffer
- */
- switch (ObjDesc->Common.Type)
- {
- case ACPI_TYPE_INTEGER:
-
- /* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */
-
- if (WalkState->MethodNode->Flags & ANOBJ_DATA_WIDTH_32)
- {
- /*
- * We are running a method that exists in a 32-bit ACPI table.
- * Truncate the value to 32 bits by zeroing out the upper
- * 32-bit field
- */
- IntegerSize = sizeof (UINT32);
- }
-
- /* Result of two integers is a buffer */
-
- RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_BUFFER);
- if (!RetDesc)
- {
- return (AE_NO_MEMORY);
- }
-
- /* Need enough space for two integers */
-
- RetDesc->Buffer.Length = IntegerSize * 2;
- NewBuf = AcpiCmCallocate (RetDesc->Buffer.Length);
- if (!NewBuf)
- {
- REPORT_ERROR
- (("AmlExecDyadic2R/ConcatOp: Buffer allocation failure\n"));
- Status = AE_NO_MEMORY;
- goto Cleanup;
- }
-
- RetDesc->Buffer.Pointer = (UINT8 *) NewBuf;
-
- /* Convert the first integer */
-
- ThisInteger = ObjDesc->Integer.Value;
- for (i = 0; i < IntegerSize; i++)
- {
- NewBuf[i] = (UINT8) ThisInteger;
- ThisInteger >>= 8;
- }
-
- /* Convert the second integer */
-
- ThisInteger = ObjDesc2->Integer.Value;
- for (; i < (IntegerSize * 2); i++)
- {
- NewBuf[i] = (UINT8) ThisInteger;
- ThisInteger >>= 8;
- }
-
- break;
-
-
- case ACPI_TYPE_STRING:
-
- RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_STRING);
- if (!RetDesc)
- {
- return (AE_NO_MEMORY);
- }
-
- /* Operand1 is string */
-
- NewBuf = AcpiCmAllocate (ObjDesc->String.Length +
- ObjDesc2->String.Length + 1);
- if (!NewBuf)
- {
- REPORT_ERROR
- (("AmlExecDyadic2R/ConcatOp: String allocation failure\n"));
- Status = AE_NO_MEMORY;
- goto Cleanup;
- }
-
- STRCPY (NewBuf, ObjDesc->String.Pointer);
- STRCPY (NewBuf + ObjDesc->String.Length,
- ObjDesc2->String.Pointer);
-
- /* Point the return object to the new string */
-
- RetDesc->String.Pointer = NewBuf;
- RetDesc->String.Length = ObjDesc->String.Length +=
- ObjDesc2->String.Length;
- break;
-
-
- case ACPI_TYPE_BUFFER:
-
- /* Operand1 is a buffer */
-
- RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_BUFFER);
- if (!RetDesc)
- {
- return (AE_NO_MEMORY);
- }
-
- NewBuf = AcpiCmAllocate (ObjDesc->Buffer.Length +
- ObjDesc2->Buffer.Length);
- if (!NewBuf)
- {
- REPORT_ERROR
- (("AmlExecDyadic2R/ConcatOp: Buffer allocation failure\n"));
- Status = AE_NO_MEMORY;
- goto Cleanup;
- }
-
- MEMCPY (NewBuf, ObjDesc->Buffer.Pointer,
- ObjDesc->Buffer.Length);
- MEMCPY (NewBuf + ObjDesc->Buffer.Length, ObjDesc2->Buffer.Pointer,
- ObjDesc2->Buffer.Length);
-
- /*
- * Point the return object to the new buffer
- */
-
- RetDesc->Buffer.Pointer = (UINT8 *) NewBuf;
- RetDesc->Buffer.Length = ObjDesc->Buffer.Length +
- ObjDesc2->Buffer.Length;
- break;
-
- default:
- Status = AE_AML_INTERNAL;
- RetDesc = NULL;
- }
-
-
- *ActualRetDesc = RetDesc;
- return (AE_OK);
-
-
-Cleanup:
-
- AcpiCmRemoveReference (RetDesc);
- return (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlExecDyadic1
- *
- * PARAMETERS: Opcode - The opcode to be executed
- *
- * RETURN: Status
- *
- * DESCRIPTION: Execute Type 1 dyadic operator with numeric operands:
- * NotifyOp
- *
- * ALLOCATION: Deletes both operands
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlExecDyadic1 (
- UINT16 Opcode,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_OPERAND_OBJECT *ObjDesc = NULL;
- ACPI_OPERAND_OBJECT *ValDesc = NULL;
- ACPI_NAMESPACE_NODE *Node;
- ACPI_STATUS Status = AE_OK;
-
-
- FUNCTION_TRACE_PTR ("AmlExecDyadic1", WALK_OPERANDS);
-
-
- /* Resolve all operands */
-
- Status = AcpiAmlResolveOperands (Opcode, WALK_OPERANDS, WalkState);
- DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (Opcode),
- 2, "after AcpiAmlResolveOperands");
-
- /* Get the operands */
-
- Status |= AcpiDsObjStackPopObject (&ValDesc, WalkState);
- Status |= AcpiDsObjStackPopObject (&ObjDesc, WalkState);
- if (ACPI_FAILURE (Status))
- {
- /* Invalid parameters on object stack */
-
- DEBUG_PRINT (ACPI_ERROR,
- ("ExecDyadic1/%s: bad operand(s) (Status=%X)\n",
- AcpiPsGetOpcodeName (Opcode), Status));
-
- goto Cleanup;
- }
-
-
- /* Examine the opcode */
-
- switch (Opcode)
- {
-
- /* DefNotify := NotifyOp NotifyObject NotifyValue */
-
- case AML_NOTIFY_OP:
-
- /* The ObjDesc is actually an Node */
-
- Node = (ACPI_NAMESPACE_NODE *) ObjDesc;
- ObjDesc = NULL;
-
- /* Object must be a device or thermal zone */
-
- if (Node && ValDesc)
- {
- switch (Node->Type)
- {
- case ACPI_TYPE_DEVICE:
- case ACPI_TYPE_THERMAL:
-
- /*
- * Requires that Device and ThermalZone be compatible
- * mappings
- */
-
- /* Dispatch the notify to the appropriate handler */
-
- AcpiEvNotifyDispatch (Node, (UINT32) ValDesc->Integer.Value);
- break;
-
- default:
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlExecDyadic1/NotifyOp: unexpected notify object type %X\n",
- ObjDesc->Common.Type));
-
- Status = AE_AML_OPERAND_TYPE;
- }
- }
- break;
-
- default:
-
- REPORT_ERROR (("AcpiAmlExecDyadic1: Unknown dyadic opcode %X\n",
- Opcode));
- Status = AE_AML_BAD_OPCODE;
- }
-
-
-Cleanup:
-
- /* Always delete both operands */
-
- AcpiCmRemoveReference (ValDesc);
- AcpiCmRemoveReference (ObjDesc);
-
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlExecDyadic2R
- *
- * PARAMETERS: Opcode - The opcode to be executed
- *
- * RETURN: Status
- *
- * DESCRIPTION: Execute Type 2 dyadic operator with numeric operands and
- * one or two result operands.
- *
- * ALLOCATION: Deletes one operand descriptor -- other remains on stack
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlExecDyadic2R (
- UINT16 Opcode,
- ACPI_WALK_STATE *WalkState,
- ACPI_OPERAND_OBJECT **ReturnDesc)
-{
- ACPI_OPERAND_OBJECT *ObjDesc = NULL;
- ACPI_OPERAND_OBJECT *ObjDesc2 = NULL;
- ACPI_OPERAND_OBJECT *ResDesc = NULL;
- ACPI_OPERAND_OBJECT *ResDesc2 = NULL;
- ACPI_OPERAND_OBJECT *RetDesc = NULL;
- ACPI_OPERAND_OBJECT *RetDesc2 = NULL;
- ACPI_STATUS Status = AE_OK;
- UINT32 NumOperands = 3;
-
-
- FUNCTION_TRACE_U32 ("AmlExecDyadic2R", Opcode);
-
-
- /* Resolve all operands */
-
- Status = AcpiAmlResolveOperands (Opcode, WALK_OPERANDS, WalkState);
- DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (Opcode),
- NumOperands, "after AcpiAmlResolveOperands");
-
- /* Get all operands */
-
- if (AML_DIVIDE_OP == Opcode)
- {
- NumOperands = 4;
- Status |= AcpiDsObjStackPopObject (&ResDesc2, WalkState);
- }
-
- Status |= AcpiDsObjStackPopObject (&ResDesc, WalkState);
- Status |= AcpiDsObjStackPopObject (&ObjDesc2, WalkState);
- Status |= AcpiDsObjStackPopObject (&ObjDesc, WalkState);
- if (ACPI_FAILURE (Status))
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("ExecDyadic2R/%s: bad operand(s) (Status=%X)\n",
- AcpiPsGetOpcodeName (Opcode), Status));
-
- goto Cleanup;
- }
-
-
- /* Create an internal return object if necessary */
-
- switch (Opcode)
- {
- case AML_ADD_OP:
- case AML_BIT_AND_OP:
- case AML_BIT_NAND_OP:
- case AML_BIT_OR_OP:
- case AML_BIT_NOR_OP:
- case AML_BIT_XOR_OP:
- case AML_DIVIDE_OP:
- case AML_MULTIPLY_OP:
- case AML_SHIFT_LEFT_OP:
- case AML_SHIFT_RIGHT_OP:
- case AML_SUBTRACT_OP:
-
- RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER);
- if (!RetDesc)
- {
- Status = AE_NO_MEMORY;
- goto Cleanup;
- }
-
- break;
- }
-
-
- /*
- * Execute the opcode
- */
-
- switch (Opcode)
- {
-
- /* DefAdd := AddOp Operand1 Operand2 Result */
-
- case AML_ADD_OP:
-
- RetDesc->Integer.Value = ObjDesc->Integer.Value +
- ObjDesc2->Integer.Value;
- break;
-
-
- /* DefAnd := AndOp Operand1 Operand2 Result */
-
- case AML_BIT_AND_OP:
-
- RetDesc->Integer.Value = ObjDesc->Integer.Value &
- ObjDesc2->Integer.Value;
- break;
-
-
- /* DefNAnd := NAndOp Operand1 Operand2 Result */
-
- case AML_BIT_NAND_OP:
-
- RetDesc->Integer.Value = ~(ObjDesc->Integer.Value &
- ObjDesc2->Integer.Value);
- break;
-
-
- /* DefOr := OrOp Operand1 Operand2 Result */
-
- case AML_BIT_OR_OP:
-
- RetDesc->Integer.Value = ObjDesc->Integer.Value |
- ObjDesc2->Integer.Value;
- break;
-
-
- /* DefNOr := NOrOp Operand1 Operand2 Result */
-
- case AML_BIT_NOR_OP:
-
- RetDesc->Integer.Value = ~(ObjDesc->Integer.Value |
- ObjDesc2->Integer.Value);
- break;
-
-
- /* DefXOr := XOrOp Operand1 Operand2 Result */
-
- case AML_BIT_XOR_OP:
-
- RetDesc->Integer.Value = ObjDesc->Integer.Value ^
- ObjDesc2->Integer.Value;
- break;
-
-
- /* DefDivide := DivideOp Dividend Divisor Remainder Quotient */
-
- case AML_DIVIDE_OP:
-
- if (!ObjDesc2->Integer.Value)
- {
- REPORT_ERROR
- (("AmlExecDyadic2R/DivideOp: Divide by zero\n"));
-
- Status = AE_AML_DIVIDE_BY_ZERO;
- goto Cleanup;
- }
-
- RetDesc2 = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER);
- if (!RetDesc2)
- {
- Status = AE_NO_MEMORY;
- goto Cleanup;
- }
-
- /* Remainder (modulo) */
-
- RetDesc->Integer.Value = ACPI_MODULO (ObjDesc->Integer.Value,
- ObjDesc2->Integer.Value);
-
- /* Result (what we used to call the quotient) */
-
- RetDesc2->Integer.Value = ACPI_DIVIDE (ObjDesc->Integer.Value,
- ObjDesc2->Integer.Value);
- break;
-
-
- /* DefMultiply := MultiplyOp Operand1 Operand2 Result */
-
- case AML_MULTIPLY_OP:
-
- RetDesc->Integer.Value = ObjDesc->Integer.Value *
- ObjDesc2->Integer.Value;
- break;
-
-
- /* DefShiftLeft := ShiftLeftOp Operand ShiftCount Result */
-
- case AML_SHIFT_LEFT_OP:
-
- RetDesc->Integer.Value = ObjDesc->Integer.Value <<
- ObjDesc2->Integer.Value;
- break;
-
-
- /* DefShiftRight := ShiftRightOp Operand ShiftCount Result */
-
- case AML_SHIFT_RIGHT_OP:
-
- RetDesc->Integer.Value = ObjDesc->Integer.Value >>
- ObjDesc2->Integer.Value;
- break;
-
-
- /* DefSubtract := SubtractOp Operand1 Operand2 Result */
-
- case AML_SUBTRACT_OP:
-
- RetDesc->Integer.Value = ObjDesc->Integer.Value -
- ObjDesc2->Integer.Value;
- break;
-
-
- /* DefConcat := ConcatOp Data1 Data2 Result */
-
- case AML_CONCAT_OP:
-
-
- /*
- * Convert the second operand if necessary. The first operand
- * determines the type of the second operand, (See the Data Types
- * section of the ACPI specification.) Both object types are
- * guaranteed to be either Integer/String/Buffer by the operand
- * resolution mechanism above.
- */
-
- switch (ObjDesc->Common.Type)
- {
- case ACPI_TYPE_INTEGER:
- Status = AcpiAmlConvertToInteger (&ObjDesc2, WalkState);
- break;
-
- case ACPI_TYPE_STRING:
- Status = AcpiAmlConvertToString (&ObjDesc2, WalkState);
- break;
-
- case ACPI_TYPE_BUFFER:
- Status = AcpiAmlConvertToBuffer (&ObjDesc2, WalkState);
- break;
-
- default:
- Status = AE_AML_INTERNAL;
- }
-
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
-
- /*
- * Both operands are now known to be the same object type
- * (Both are Integer, String, or Buffer), and we can now perform the
- * concatenation.
- */
- Status = AcpiAmlDoConcatenate (ObjDesc, ObjDesc2, &RetDesc, WalkState);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
- break;
-
-
- default:
-
- REPORT_ERROR (("AcpiAmlExecDyadic2R: Unknown dyadic opcode %X\n",
- Opcode));
- Status = AE_AML_BAD_OPCODE;
- goto Cleanup;
- }
-
-
- /*
- * Store the result of the operation (which is now in ObjDesc) into
- * the result descriptor, or the location pointed to by the result
- * descriptor (ResDesc).
- */
-
- Status = AcpiAmlExecStore (RetDesc, ResDesc, WalkState);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
- if (AML_DIVIDE_OP == Opcode)
- {
- Status = AcpiAmlExecStore (RetDesc2, ResDesc2, WalkState);
-
- /*
- * Since the remainder is not returned, remove a reference to
- * the object we created earlier
- */
-
- AcpiCmRemoveReference (RetDesc2);
- }
-
-
-Cleanup:
-
- /* Always delete the operands */
-
- AcpiCmRemoveReference (ObjDesc);
- AcpiCmRemoveReference (ObjDesc2);
-
-
- /* Delete return object on error */
-
- if (ACPI_FAILURE (Status))
- {
- /* On failure, delete the result ops */
-
- AcpiCmRemoveReference (ResDesc);
- AcpiCmRemoveReference (ResDesc2);
-
- if (RetDesc)
- {
- /* And delete the internal return object */
-
- AcpiCmRemoveReference (RetDesc);
- RetDesc = NULL;
- }
- }
-
- /* Set the return object and exit */
-
- *ReturnDesc = RetDesc;
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlExecDyadic2S
- *
- * PARAMETERS: Opcode - The opcode to be executed
- *
- * RETURN: Status
- *
- * DESCRIPTION: Execute Type 2 dyadic synchronization operator
- *
- * ALLOCATION: Deletes one operand descriptor -- other remains on stack
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlExecDyadic2S (
- UINT16 Opcode,
- ACPI_WALK_STATE *WalkState,
- ACPI_OPERAND_OBJECT **ReturnDesc)
-{
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_OPERAND_OBJECT *TimeDesc;
- ACPI_OPERAND_OBJECT *RetDesc = NULL;
- ACPI_STATUS Status;
-
-
- FUNCTION_TRACE_PTR ("AmlExecDyadic2S", WALK_OPERANDS);
-
-
- /* Resolve all operands */
-
- Status = AcpiAmlResolveOperands (Opcode, WALK_OPERANDS, WalkState);
- DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (Opcode),
- 2, "after AcpiAmlResolveOperands");
-
- /* Get all operands */
-
- Status |= AcpiDsObjStackPopObject (&TimeDesc, WalkState);
- Status |= AcpiDsObjStackPopObject (&ObjDesc, WalkState);
- if (ACPI_FAILURE (Status))
- {
- /* Invalid parameters on object stack */
-
- DEBUG_PRINT (ACPI_ERROR,
- ("ExecDyadic2S/%s: bad operand(s) (Status=%X)\n",
- AcpiPsGetOpcodeName (Opcode), Status));
-
- goto Cleanup;
- }
-
-
- /* Create the internal return object */
-
- RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER);
- if (!RetDesc)
- {
- Status = AE_NO_MEMORY;
- goto Cleanup;
- }
-
- /* Default return value is FALSE, operation did not time out */
-
- RetDesc->Integer.Value = 0;
-
-
- /* Examine the opcode */
-
- switch (Opcode)
- {
-
- /* DefAcquire := AcquireOp MutexObject Timeout */
-
- case AML_ACQUIRE_OP:
-
- Status = AcpiAmlSystemAcquireMutex (TimeDesc, ObjDesc);
- break;
-
-
- /* DefWait := WaitOp AcpiEventObject Timeout */
-
- case AML_WAIT_OP:
-
- Status = AcpiAmlSystemWaitEvent (TimeDesc, ObjDesc);
- break;
-
-
- default:
-
- REPORT_ERROR (("AcpiAmlExecDyadic2S: Unknown dyadic synchronization opcode %X\n", Opcode));
- Status = AE_AML_BAD_OPCODE;
- goto Cleanup;
- }
-
-
- /*
- * Return a boolean indicating if operation timed out
- * (TRUE) or not (FALSE)
- */
-
- if (Status == AE_TIME)
- {
- RetDesc->Integer.Value = ACPI_INTEGER_MAX; /* TRUE, op timed out */
- Status = AE_OK;
- }
-
-
-Cleanup:
-
- /* Delete params */
-
- AcpiCmRemoveReference (TimeDesc);
- AcpiCmRemoveReference (ObjDesc);
-
- /* Delete return object on error */
-
- if (ACPI_FAILURE (Status) &&
- (RetDesc))
- {
- AcpiCmRemoveReference (RetDesc);
- RetDesc = NULL;
- }
-
-
- /* Set the return object and exit */
-
- *ReturnDesc = RetDesc;
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlExecDyadic2
- *
- * PARAMETERS: Opcode - The opcode to be executed
- *
- * RETURN: Status
- *
- * DESCRIPTION: Execute Type 2 dyadic operator with numeric operands and
- * no result operands
- *
- * ALLOCATION: Deletes one operand descriptor -- other remains on stack
- * containing result value
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlExecDyadic2 (
- UINT16 Opcode,
- ACPI_WALK_STATE *WalkState,
- ACPI_OPERAND_OBJECT **ReturnDesc)
-{
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_OPERAND_OBJECT *ObjDesc2;
- ACPI_OPERAND_OBJECT *RetDesc = NULL;
- ACPI_STATUS Status;
- BOOLEAN Lboolean;
-
-
- FUNCTION_TRACE_PTR ("AmlExecDyadic2", WALK_OPERANDS);
-
-
- /* Resolve all operands */
-
- Status = AcpiAmlResolveOperands (Opcode, WALK_OPERANDS, WalkState);
- DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (Opcode),
- 2, "after AcpiAmlResolveOperands");
-
- /* Get all operands */
-
- Status |= AcpiDsObjStackPopObject (&ObjDesc2, WalkState);
- Status |= AcpiDsObjStackPopObject (&ObjDesc, WalkState);
- if (ACPI_FAILURE (Status))
- {
- /* Invalid parameters on object stack */
-
- DEBUG_PRINT (ACPI_ERROR,
- ("ExecDyadic2/%s: bad operand(s) (Status=%X)\n",
- AcpiPsGetOpcodeName (Opcode), Status));
-
- goto Cleanup;
- }
-
-
- /* Create the internal return object */
-
- RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER);
- if (!RetDesc)
- {
- Status = AE_NO_MEMORY;
- goto Cleanup;
- }
-
- /*
- * Execute the Opcode
- */
-
- Lboolean = FALSE;
- switch (Opcode)
- {
-
- /* DefLAnd := LAndOp Operand1 Operand2 */
-
- case AML_LAND_OP:
-
- Lboolean = (BOOLEAN) (ObjDesc->Integer.Value &&
- ObjDesc2->Integer.Value);
- break;
-
-
- /* DefLEqual := LEqualOp Operand1 Operand2 */
-
- case AML_LEQUAL_OP:
-
- Lboolean = (BOOLEAN) (ObjDesc->Integer.Value ==
- ObjDesc2->Integer.Value);
- break;
-
-
- /* DefLGreater := LGreaterOp Operand1 Operand2 */
-
- case AML_LGREATER_OP:
-
- Lboolean = (BOOLEAN) (ObjDesc->Integer.Value >
- ObjDesc2->Integer.Value);
- break;
-
-
- /* DefLLess := LLessOp Operand1 Operand2 */
-
- case AML_LLESS_OP:
-
- Lboolean = (BOOLEAN) (ObjDesc->Integer.Value <
- ObjDesc2->Integer.Value);
- break;
-
-
- /* DefLOr := LOrOp Operand1 Operand2 */
-
- case AML_LOR_OP:
-
- Lboolean = (BOOLEAN) (ObjDesc->Integer.Value ||
- ObjDesc2->Integer.Value);
- break;
-
-
- default:
-
- REPORT_ERROR (("AcpiAmlExecDyadic2: Unknown dyadic opcode %X\n", Opcode));
- Status = AE_AML_BAD_OPCODE;
- goto Cleanup;
- break;
- }
-
-
- /* Set return value to logical TRUE (all ones) or FALSE (zero) */
-
- if (Lboolean)
- {
- RetDesc->Integer.Value = ACPI_INTEGER_MAX;
- }
- else
- {
- RetDesc->Integer.Value = 0;
- }
-
-
-Cleanup:
-
- /* Always delete operands */
-
- AcpiCmRemoveReference (ObjDesc);
- AcpiCmRemoveReference (ObjDesc2);
-
-
- /* Delete return object on error */
-
- if (ACPI_FAILURE (Status) &&
- (RetDesc))
- {
- AcpiCmRemoveReference (RetDesc);
- RetDesc = NULL;
- }
-
-
- /* Set the return object and exit */
-
- *ReturnDesc = RetDesc;
- return_ACPI_STATUS (Status);
-}
-
-
diff --git a/sys/contrib/dev/acpica/Subsystem/Interpreter/amfield.c b/sys/contrib/dev/acpica/Subsystem/Interpreter/amfield.c
deleted file mode 100644
index 62c77a7e576e..000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Interpreter/amfield.c
+++ /dev/null
@@ -1,447 +0,0 @@
-/******************************************************************************
- *
- * Module Name: amfield - ACPI AML (p-code) execution - field manipulation
- * $Revision: 77 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 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 __AMFIELD_C__
-
-#include "acpi.h"
-#include "acdispat.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-#include "achware.h"
-#include "acevents.h"
-
-
-#define _COMPONENT INTERPRETER
- MODULE_NAME ("amfield")
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlSetupField
- *
- * PARAMETERS: *ObjDesc - Field to be read or written
- * *RgnDesc - Region containing field
- * FieldBitWidth - Field Width in bits (8, 16, or 32)
- *
- * RETURN: Status
- *
- * DESCRIPTION: Common processing for AcpiAmlReadField and AcpiAmlWriteField
- *
- * ACPI SPECIFICATION REFERENCES:
- * Each of the Type1Opcodes is defined as specified in in-line
- * comments below. For each one, use the following definitions.
- *
- * DefBitField := BitFieldOp SrcBuf BitIdx Destination
- * DefByteField := ByteFieldOp SrcBuf ByteIdx Destination
- * DefCreateField := CreateFieldOp SrcBuf BitIdx NumBits NameString
- * DefDWordField := DWordFieldOp SrcBuf ByteIdx Destination
- * DefWordField := WordFieldOp SrcBuf ByteIdx Destination
- * BitIndex := TermArg=>Integer
- * ByteIndex := TermArg=>Integer
- * Destination := NameString
- * NumBits := TermArg=>Integer
- * SourceBuf := TermArg=>Buffer
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlSetupField (
- ACPI_OPERAND_OBJECT *ObjDesc,
- ACPI_OPERAND_OBJECT *RgnDesc,
- UINT32 FieldBitWidth)
-{
- ACPI_STATUS Status = AE_OK;
- UINT32 FieldByteWidth;
-
-
- FUNCTION_TRACE ("AmlSetupField");
-
-
- /* Parameter validation */
-
- if (!ObjDesc || !RgnDesc)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlSetupField: Internal error - null handle\n"));
- return_ACPI_STATUS (AE_AML_NO_OPERAND);
- }
-
- if (ACPI_TYPE_REGION != RgnDesc->Common.Type)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlSetupField: Needed Region, found type %x %s\n",
- RgnDesc->Common.Type, AcpiCmGetTypeName (RgnDesc->Common.Type)));
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
-
-
- /*
- * TBD: [Future] Acpi 2.0 supports Qword fields
- *
- * Init and validate Field width
- * Possible values are 1, 2, 4
- */
-
- FieldByteWidth = DIV_8 (FieldBitWidth);
-
- if ((FieldBitWidth != 8) &&
- (FieldBitWidth != 16) &&
- (FieldBitWidth != 32))
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlSetupField: Internal error - bad width %d\n", FieldBitWidth));
- return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
- }
-
-
- /*
- * If the Region Address and Length have not been previously evaluated,
- * evaluate them and save the results.
- */
- if (!(RgnDesc->Region.Flags & AOPOBJ_DATA_VALID))
- {
-
- Status = AcpiDsGetRegionArguments (RgnDesc);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- }
-
-
- if ((ObjDesc->Common.Type == ACPI_TYPE_FIELD_UNIT) &&
- (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)))
- {
- /*
- * Field Buffer and Index have not been previously evaluated,
- */
- DEBUG_PRINT (ACPI_ERROR, ("Uninitialized field!\n"));
- return_ACPI_STATUS (AE_AML_INTERNAL);
- }
-
- if (RgnDesc->Region.Length <
- (ObjDesc->Field.Offset & ~((UINT32) FieldByteWidth - 1)) +
- FieldByteWidth)
- {
- /*
- * Offset rounded up to next multiple of field width
- * exceeds region length, indicate an error
- */
-
- DUMP_STACK_ENTRY (RgnDesc);
- DUMP_STACK_ENTRY (ObjDesc);
-
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlSetupField: Operation at %08lX width %d bits exceeds len %08lX field=%p region=%p\n",
- ObjDesc->Field.Offset, FieldBitWidth, RgnDesc->Region.Length,
- ObjDesc, RgnDesc));
-
- return_ACPI_STATUS (AE_AML_REGION_LIMIT);
- }
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlAccessNamedField
- *
- * PARAMETERS: Mode - ACPI_READ or ACPI_WRITE
- * NamedField - Handle for field to be accessed
- * *Buffer - Value(s) to be read or written
- * BufferLength - Number of bytes to transfer
- *
- * RETURN: Status
- *
- * DESCRIPTION: Read or write a named field
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlAccessNamedField (
- UINT32 Mode,
- ACPI_HANDLE NamedField,
- void *Buffer,
- UINT32 BufferLength)
-{
- ACPI_OPERAND_OBJECT *ObjDesc = NULL;
- ACPI_STATUS Status = AE_OK;
- BOOLEAN Locked = FALSE;
- UINT32 BitGranularity = 0;
- UINT32 ByteGranularity;
- UINT32 DatumLength;
- UINT32 ActualByteLength;
- UINT32 ByteFieldLength;
-
-
- FUNCTION_TRACE_PTR ("AmlAccessNamedField", NamedField);
-
-
- /* Parameter validation */
-
- if ((!NamedField) || (ACPI_READ == Mode && !Buffer))
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AcpiAmlAccessNamedField: Internal error - null parameter\n"));
- return_ACPI_STATUS (AE_AML_INTERNAL);
- }
-
- /* Get the attached field object */
-
- ObjDesc = AcpiNsGetAttachedObject (NamedField);
- if (!ObjDesc)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlAccessNamedField: Internal error - null value pointer\n"));
- return_ACPI_STATUS (AE_AML_INTERNAL);
- }
-
- /* Check the type */
-
- if (INTERNAL_TYPE_DEF_FIELD != AcpiNsGetType (NamedField))
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlAccessNamedField: Name %4.4s type %x is not a defined field\n",
- &(((ACPI_NAMESPACE_NODE *) NamedField)->Name),
- AcpiNsGetType (NamedField)));
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
-
- /* ObjDesc valid and NamedField is a defined field */
-
- DEBUG_PRINT (ACPI_INFO,
- ("AccessNamedField: Obj=%p Type=%x Buf=%p Len=%x\n",
- ObjDesc, ObjDesc->Common.Type, Buffer, BufferLength));
- DEBUG_PRINT (ACPI_INFO,
- ("AccessNamedField: Mode=%d FieldLen=%d, BitOffset=%d\n",
- Mode, ObjDesc->FieldUnit.Length, ObjDesc->FieldUnit.BitOffset));
- DUMP_ENTRY (NamedField, ACPI_INFO);
-
-
- /* Double-check that the attached object is also a field */
-
- if (INTERNAL_TYPE_DEF_FIELD != ObjDesc->Common.Type)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlAccessNamedField: Internal error - Name %4.4s type %x does not match value-type %x at %p\n",
- &(((ACPI_NAMESPACE_NODE *) NamedField)->Name),
- AcpiNsGetType (NamedField), ObjDesc->Common.Type, ObjDesc));
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
-
-
- /*
- * Granularity was decoded from the field access type
- * (AnyAcc will be the same as ByteAcc)
- */
-
- BitGranularity = ObjDesc->FieldUnit.Granularity;
- ByteGranularity = DIV_8 (BitGranularity);
-
- /*
- * Check if request is too large for the field, and silently truncate
- * if necessary
- */
-
- /* TBD: [Errors] should an error be returned in this case? */
-
- ByteFieldLength = (UINT32) DIV_8 (ObjDesc->FieldUnit.Length + 7);
-
-
- ActualByteLength = BufferLength;
- if (BufferLength > ByteFieldLength)
- {
- DEBUG_PRINT (ACPI_INFO,
- ("AmlAccessNamedField: Byte length %X truncated to %X\n",
- ActualByteLength, ByteFieldLength));
-
- ActualByteLength = ByteFieldLength;
- }
-
- /* TBD: should these round down to a power of 2? */
-
- if (DIV_8 (BitGranularity) > ByteFieldLength)
- {
- DEBUG_PRINT (ACPI_INFO,
- ("AmlAccessNamedField: Bit granularity %X truncated to %X\n",
- BitGranularity, MUL_8(ByteFieldLength)));
-
- BitGranularity = MUL_8(ByteFieldLength);
- }
-
- if (ByteGranularity > ByteFieldLength)
- {
- DEBUG_PRINT (ACPI_INFO,
- ("AmlAccessNamedField: Byte granularity %X truncated to %X\n",
- ByteGranularity, ByteFieldLength));
-
- ByteGranularity = ByteFieldLength;
- }
-
-
- /* Convert byte count to datum count, round up if necessary */
-
- DatumLength = (ActualByteLength + (ByteGranularity-1)) / ByteGranularity;
-
- DEBUG_PRINT (ACPI_INFO,
- ("ByteLen=%x, DatumLen=%x, BitGran=%x, ByteGran=%x\n",
- ActualByteLength, DatumLength, BitGranularity, ByteGranularity));
-
-
- /* Get the global lock if needed */
-
- Locked = AcpiAmlAcquireGlobalLock (ObjDesc->FieldUnit.LockRule);
-
-
- /* Perform the actual read or write of the buffer */
-
- switch (Mode)
- {
- case ACPI_READ:
-
- Status = AcpiAmlReadField (ObjDesc, Buffer, BufferLength,
- ActualByteLength, DatumLength,
- BitGranularity, ByteGranularity);
- break;
-
-
- case ACPI_WRITE:
-
- Status = AcpiAmlWriteField (ObjDesc, Buffer, BufferLength,
- ActualByteLength, DatumLength,
- BitGranularity, ByteGranularity);
- break;
-
-
- default:
-
- DEBUG_PRINT (ACPI_ERROR,
- ("AccessNamedField: Unknown I/O Mode: %X\n", Mode));
- Status = AE_BAD_PARAMETER;
- break;
- }
-
-
- /* Release global lock if we acquired it earlier */
-
- AcpiAmlReleaseGlobalLock (Locked);
-
- return_ACPI_STATUS (Status);
-}
-
diff --git a/sys/contrib/dev/acpica/Subsystem/Interpreter/amfldio.c b/sys/contrib/dev/acpica/Subsystem/Interpreter/amfldio.c
deleted file mode 100644
index 24c9a2a23e97..000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Interpreter/amfldio.c
+++ /dev/null
@@ -1,861 +0,0 @@
-/******************************************************************************
- *
- * Module Name: amfldio - Aml Field I/O
- * $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 __AMFLDIO_C__
-
-#include "acpi.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-#include "achware.h"
-#include "acevents.h"
-
-
-#define _COMPONENT INTERPRETER
- MODULE_NAME ("amfldio")
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlReadFieldData
- *
- * PARAMETERS: *ObjDesc - Field to be read
- * *Value - Where to store value
- * FieldBitWidth - Field Width in bits (8, 16, or 32)
- *
- * RETURN: Status
- *
- * DESCRIPTION: Retrieve the value of the given field
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlReadFieldData (
- ACPI_OPERAND_OBJECT *ObjDesc,
- UINT32 FieldByteOffset,
- UINT32 FieldBitWidth,
- UINT32 *Value)
-{
- ACPI_STATUS Status;
- ACPI_OPERAND_OBJECT *RgnDesc = NULL;
- ACPI_PHYSICAL_ADDRESS Address;
- UINT32 LocalValue = 0;
- UINT32 FieldByteWidth;
-
-
- FUNCTION_TRACE ("AmlReadFieldData");
-
-
- /* ObjDesc is validated by callers */
-
- if (ObjDesc)
- {
- RgnDesc = ObjDesc->Field.Container;
- }
-
-
- FieldByteWidth = DIV_8 (FieldBitWidth);
- Status = AcpiAmlSetupField (ObjDesc, RgnDesc, FieldBitWidth);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* SetupField validated RgnDesc and FieldBitWidth */
-
- if (!Value)
- {
- Value = &LocalValue; /* support reads without saving value */
- }
-
-
- /*
- * Set offset to next multiple of field width,
- * add region base address and offset within the field
- */
- Address = RgnDesc->Region.Address +
- (ObjDesc->Field.Offset * FieldByteWidth) +
- FieldByteOffset;
-
- DEBUG_PRINT (TRACE_OPREGION,
- ("AmlReadFieldData: Region %s(%X) at %08lx width %X\n",
- AcpiCmGetRegionName (RgnDesc->Region.SpaceId),
- RgnDesc->Region.SpaceId, Address,
- FieldBitWidth));
-
-
- /* Invoke the appropriate AddressSpace/OpRegion handler */
-
- Status = AcpiEvAddressSpaceDispatch (RgnDesc, ADDRESS_SPACE_READ,
- Address, FieldBitWidth, Value);
-
- if (Status == AE_NOT_IMPLEMENTED)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlReadFieldData: **** Region %s(%X) not implemented\n",
- AcpiCmGetRegionName (RgnDesc->Region.SpaceId),
- RgnDesc->Region.SpaceId));
- }
-
- else if (Status == AE_NOT_EXIST)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlReadFieldData: **** Region %s(%X) has no handler\n",
- AcpiCmGetRegionName (RgnDesc->Region.SpaceId),
- RgnDesc->Region.SpaceId));
- }
-
- DEBUG_PRINT (TRACE_OPREGION,
- ("AmlReadField: Returned value=%08lx \n", *Value));
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlReadField
- *
- * PARAMETERS: *ObjDesc - Field to be read
- * *Value - Where to store value
- * FieldBitWidth - Field Width in bits (8, 16, or 32)
- *
- * RETURN: Status
- *
- * DESCRIPTION: Retrieve the value of the given field
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlReadField (
- ACPI_OPERAND_OBJECT *ObjDesc,
- void *Buffer,
- UINT32 BufferLength,
- UINT32 ByteLength,
- UINT32 DatumLength,
- UINT32 BitGranularity,
- UINT32 ByteGranularity)
-{
- ACPI_STATUS Status;
- UINT32 ThisFieldByteOffset;
- UINT32 ThisFieldDatumOffset;
- UINT32 PreviousRawDatum;
- UINT32 ThisRawDatum = 0;
- UINT32 ValidFieldBits;
- UINT32 Mask;
- UINT32 MergedDatum = 0;
-
-
- FUNCTION_TRACE ("AmlReadField");
-
- /*
- * Clear the caller's buffer (the whole buffer length as given)
- * This is very important, especially in the cases where a byte is read,
- * but the buffer is really a UINT32 (4 bytes).
- */
-
- MEMSET (Buffer, 0, BufferLength);
-
- /* Read the first raw datum to prime the loop */
-
- ThisFieldByteOffset = 0;
- ThisFieldDatumOffset= 0;
-
- Status = AcpiAmlReadFieldData (ObjDesc, ThisFieldByteOffset, BitGranularity,
- &PreviousRawDatum);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
- /* We might actually be done if the request fits in one datum */
-
- if ((DatumLength == 1) &&
- ((ObjDesc->Field.BitOffset + ObjDesc->FieldUnit.Length) <=
- (UINT16) BitGranularity))
- {
- MergedDatum = PreviousRawDatum;
-
- MergedDatum = (MergedDatum >> ObjDesc->Field.BitOffset);
-
- ValidFieldBits = ObjDesc->FieldUnit.Length % BitGranularity;
- if (ValidFieldBits)
- {
- Mask = (((UINT32) 1 << ValidFieldBits) - (UINT32) 1);
- MergedDatum &= Mask;
- }
-
-
- /*
- * Place the MergedDatum into the proper format and return buffer
- * field
- */
-
- switch (ByteGranularity)
- {
- case 1:
- ((UINT8 *) Buffer) [ThisFieldDatumOffset] = (UINT8) MergedDatum;
- break;
-
- case 2:
- MOVE_UNALIGNED16_TO_16 (&(((UINT16 *) Buffer)[ThisFieldDatumOffset]), &MergedDatum);
- break;
-
- case 4:
- MOVE_UNALIGNED32_TO_32 (&(((UINT32 *) Buffer)[ThisFieldDatumOffset]), &MergedDatum);
- break;
- }
-
- ThisFieldByteOffset = 1;
- ThisFieldDatumOffset = 1;
- }
-
- else
- {
- /* We need to get more raw data to complete one or more field data */
-
- while (ThisFieldDatumOffset < DatumLength)
- {
- /*
- * If the field is aligned on a byte boundary, we don't want
- * to perform a final read, since this would potentially read
- * past the end of the region.
- *
- * TBD: [Investigate] It may make more sense to just split the aligned
- * and non-aligned cases since the aligned case is so very simple,
- */
- if ((ObjDesc->Field.BitOffset != 0) ||
- ((ObjDesc->Field.BitOffset == 0) &&
- (ThisFieldDatumOffset < (DatumLength -1))))
- {
- /*
- * Get the next raw datum, it contains some or all bits
- * of the current field datum
- */
-
- Status = AcpiAmlReadFieldData (ObjDesc,
- ThisFieldByteOffset + ByteGranularity,
- BitGranularity, &ThisRawDatum);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
- /* Before merging the data, make sure the unused bits are clear */
-
- switch (ByteGranularity)
- {
- case 1:
- ThisRawDatum &= 0x000000FF;
- PreviousRawDatum &= 0x000000FF;
- break;
-
- case 2:
- ThisRawDatum &= 0x0000FFFF;
- PreviousRawDatum &= 0x0000FFFF;
- break;
- }
- }
-
-
- /*
- * Put together bits of the two raw data to make a complete
- * field datum
- */
-
-
- if (ObjDesc->Field.BitOffset != 0)
- {
- MergedDatum =
- (PreviousRawDatum >> ObjDesc->Field.BitOffset) |
- (ThisRawDatum << (BitGranularity - ObjDesc->Field.BitOffset));
- }
-
- else
- {
- MergedDatum = PreviousRawDatum;
- }
-
- /*
- * Prepare the merged datum for storing into the caller's
- * buffer. It is possible to have a 32-bit buffer
- * (ByteGranularity == 4), but a ObjDesc->Field.Length
- * of 8 or 16, meaning that the upper bytes of merged data
- * are undesired. This section fixes that.
- */
- switch (ObjDesc->Field.Length)
- {
- case 8:
- MergedDatum &= 0x000000FF;
- break;
-
- case 16:
- MergedDatum &= 0x0000FFFF;
- break;
- }
-
- /*
- * Now store the datum in the caller's buffer, according to
- * the data type
- */
- switch (ByteGranularity)
- {
- case 1:
- ((UINT8 *) Buffer) [ThisFieldDatumOffset] = (UINT8) MergedDatum;
- break;
-
- case 2:
- MOVE_UNALIGNED16_TO_16 (&(((UINT16 *) Buffer) [ThisFieldDatumOffset]), &MergedDatum);
- break;
-
- case 4:
- MOVE_UNALIGNED32_TO_32 (&(((UINT32 *) Buffer) [ThisFieldDatumOffset]), &MergedDatum);
- break;
- }
-
- /*
- * Save the most recent datum since it contains bits of
- * the *next* field datum
- */
-
- PreviousRawDatum = ThisRawDatum;
-
- ThisFieldByteOffset += ByteGranularity;
- ThisFieldDatumOffset++;
-
- } /* while */
- }
-
-Cleanup:
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlWriteFieldData
- *
- * PARAMETERS: *ObjDesc - Field to be set
- * Value - Value to store
- * FieldBitWidth - Field Width in bits (8, 16, or 32)
- *
- * RETURN: Status
- *
- * DESCRIPTION: Store the value into the given field
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiAmlWriteFieldData (
- ACPI_OPERAND_OBJECT *ObjDesc,
- UINT32 FieldByteOffset,
- UINT32 FieldBitWidth,
- UINT32 Value)
-{
- ACPI_STATUS Status = AE_OK;
- ACPI_OPERAND_OBJECT *RgnDesc = NULL;
- ACPI_PHYSICAL_ADDRESS Address;
- UINT32 FieldByteWidth;
-
-
- FUNCTION_TRACE ("AmlWriteFieldData");
-
-
- /* ObjDesc is validated by callers */
-
- if (ObjDesc)
- {
- RgnDesc = ObjDesc->Field.Container;
- }
-
- FieldByteWidth = DIV_8 (FieldBitWidth);
- Status = AcpiAmlSetupField (ObjDesc, RgnDesc, FieldBitWidth);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
-
- /*
- * Set offset to next multiple of field width,
- * add region base address and offset within the field
- */
- Address = RgnDesc->Region.Address +
- (ObjDesc->Field.Offset * FieldByteWidth) +
- FieldByteOffset;
-
- DEBUG_PRINT (TRACE_OPREGION,
- ("AmlWriteField: Store %lx in Region %s(%X) at %p width %X\n",
- Value, AcpiCmGetRegionName (RgnDesc->Region.SpaceId),
- RgnDesc->Region.SpaceId, Address,
- FieldBitWidth));
-
- /* Invoke the appropriate AddressSpace/OpRegion handler */
-
- Status = AcpiEvAddressSpaceDispatch (RgnDesc, ADDRESS_SPACE_WRITE,
- Address, FieldBitWidth, &Value);
-
- if (Status == AE_NOT_IMPLEMENTED)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlWriteField: **** Region type %s(%X) not implemented\n",
- AcpiCmGetRegionName (RgnDesc->Region.SpaceId),
- RgnDesc->Region.SpaceId));
- }
-
- else if (Status == AE_NOT_EXIST)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlWriteField: **** Region type %s(%X) does not have a handler\n",
- AcpiCmGetRegionName (RgnDesc->Region.SpaceId),
- RgnDesc->Region.SpaceId));
- }
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiAmlWriteFieldDataWithUpdateRule
- *
- * PARAMETERS: *ObjDesc - Field to be set
- * Value - Value to store
- * FieldBitWidth - Field Width in bits (8, 16, or 32)
- *
- * RETURN: Status
- *
- * DESCRIPTION: Apply the field update rule to a field write
- *
- ****************************************************************************/
-
-static ACPI_STATUS
-AcpiAmlWriteFieldDataWithUpdateRule (
- ACPI_OPERAND_OBJECT *ObjDesc,
- UINT32 Mask,
- UINT32 FieldValue,
- UINT32 ThisFieldByteOffset,
- UINT32 BitGranularity)
-{
- ACPI_STATUS Status = AE_OK;
- UINT32 MergedValue;
- UINT32 CurrentValue;
-
-
- /* Start with the new bits */
-
- MergedValue = FieldValue;
-
-
-
- /* Decode the update rule */
-
- switch (ObjDesc->Field.UpdateRule)
- {
-
- case UPDATE_PRESERVE:
-
- /* Check if update rule needs to be applied (not if mask is all ones) */
-
- /* The left shift drops the bits we want to ignore. */
- if ((~Mask << (sizeof(Mask)*8 - BitGranularity)) != 0)
- {
- /*
- * Read the current contents of the byte/word/dword containing
- * the field, and merge with the new field value.
- */
- Status = AcpiAmlReadFieldData (ObjDesc, ThisFieldByteOffset,
- BitGranularity, &CurrentValue);
- MergedValue |= (CurrentValue & ~Mask);
- }
- break;
-
-
- case UPDATE_WRITE_AS_ONES:
-
- /* Set positions outside the field to all ones */
-
- MergedValue |= ~Mask;
- break;
-
-
- case UPDATE_WRITE_AS_ZEROS:
-
- /* Set positions outside the field to all zeros */
-
- MergedValue &= Mask;
- break;
-
-
- default:
- DEBUG_PRINT (ACPI_ERROR,
- ("WriteFieldDataWithUpdateRule: Unknown UpdateRule setting: %x\n",
- ObjDesc->Field.UpdateRule));
- Status = AE_AML_OPERAND_VALUE;
- }
-
-
- /* Write the merged value */
-
- if (ACPI_SUCCESS (Status))
- {
- Status = AcpiAmlWriteFieldData (ObjDesc, ThisFieldByteOffset,
- BitGranularity, MergedValue);
- }
-
- return (Status);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiAmlWriteField
- *
- * PARAMETERS: *ObjDesc - Field to be set
- * Value - Value to store
- * FieldBitWidth - Field Width in bits (8, 16, or 32)
- *
- * RETURN: Status
- *
- * DESCRIPTION: Store the value into the given field
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiAmlWriteField (
- ACPI_OPERAND_OBJECT *ObjDesc,
- void *Buffer,
- UINT32 BufferLength,
- UINT32 ByteLength,
- UINT32 DatumLength,
- UINT32 BitGranularity,
- UINT32 ByteGranularity)
-{
- ACPI_STATUS Status;
- UINT32 ThisFieldByteOffset;
- UINT32 ThisFieldDatumOffset;
- UINT32 Mask;
- UINT32 MergedDatum;
- UINT32 PreviousRawDatum;
- UINT32 ThisRawDatum;
- UINT32 FieldValue;
- UINT32 ValidFieldBits;
-
-
- FUNCTION_TRACE ("AmlWriteField");
-
-
- /*
- * Break the request into up to three parts:
- * non-aligned part at start, aligned part in middle, non-aligned part
- * at end --- Just like an I/O request ---
- */
-
- ThisFieldByteOffset = 0;
- ThisFieldDatumOffset= 0;
-
- /* Get a datum */
-
- switch (ByteGranularity)
- {
- case 1:
- PreviousRawDatum = ((UINT8 *) Buffer) [ThisFieldDatumOffset];
- break;
-
- case 2:
- MOVE_UNALIGNED16_TO_32 (&PreviousRawDatum, &(((UINT16 *) Buffer) [ThisFieldDatumOffset]));
- break;
-
- case 4:
- MOVE_UNALIGNED32_TO_32 (&PreviousRawDatum, &(((UINT32 *) Buffer) [ThisFieldDatumOffset]));
- break;
-
- default:
- DEBUG_PRINT (ACPI_ERROR, ("AmlWriteField: Invalid granularity: %x\n",
- ByteGranularity));
- Status = AE_AML_OPERAND_VALUE;
- goto Cleanup;
- }
-
-
- /*
- * Write a partial field datum if field does not begin on a datum boundary
- *
- * Construct Mask with 1 bits where the field is, 0 bits elsewhere
- *
- * 1) Bits above the field
- */
-
- Mask = (((UINT32)(-1)) << (UINT32)ObjDesc->Field.BitOffset);
-
- /* 2) Only the bottom 5 bits are valid for a shift operation. */
-
- if ((ObjDesc->Field.BitOffset + ObjDesc->FieldUnit.Length) < 32)
- {
- /* Bits above the field */
-
- Mask &= (~(((UINT32)(-1)) << ((UINT32)ObjDesc->Field.BitOffset +
- (UINT32)ObjDesc->FieldUnit.Length)));
- }
-
- /* 3) Shift and mask the value into the field position */
-
- FieldValue = (PreviousRawDatum << ObjDesc->Field.BitOffset) & Mask;
-
- Status = AcpiAmlWriteFieldDataWithUpdateRule (ObjDesc, Mask, FieldValue,
- ThisFieldByteOffset,
- BitGranularity);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
-
- /* If the field fits within one datum, we are done. */
-
- if ((DatumLength == 1) &&
- ((ObjDesc->Field.BitOffset + ObjDesc->FieldUnit.Length) <=
- (UINT16) BitGranularity))
- {
- goto Cleanup;
- }
-
- /*
- * We don't need to worry about the update rule for these data, because
- * all of the bits are part of the field.
- *
- * Can't write the last datum, however, because it might contain bits that
- * are not part of the field -- the update rule must be applied.
- */
-
- while (ThisFieldDatumOffset < (DatumLength - 1))
- {
- ThisFieldDatumOffset++;
-
- /* Get the next raw datum, it contains bits of the current field datum... */
-
- switch (ByteGranularity)
- {
- case 1:
- ThisRawDatum = ((UINT8 *) Buffer) [ThisFieldDatumOffset];
- break;
-
- case 2:
- MOVE_UNALIGNED16_TO_32 (&ThisRawDatum, &(((UINT16 *) Buffer) [ThisFieldDatumOffset]));
- break;
-
- case 4:
- MOVE_UNALIGNED32_TO_32 (&ThisRawDatum, &(((UINT32 *) Buffer) [ThisFieldDatumOffset]));
- break;
-
- default:
- DEBUG_PRINT (ACPI_ERROR, ("AmlWriteField: Invalid Byte Granularity: %x\n",
- ByteGranularity));
- Status = AE_AML_OPERAND_VALUE;
- goto Cleanup;
- }
-
- /*
- * Put together bits of the two raw data to make a complete field
- * datum
- */
-
- if (ObjDesc->Field.BitOffset != 0)
- {
- MergedDatum =
- (PreviousRawDatum >> (BitGranularity - ObjDesc->Field.BitOffset)) |
- (ThisRawDatum << ObjDesc->Field.BitOffset);
- }
-
- else
- {
- MergedDatum = ThisRawDatum;
- }
-
- /* Now write the completed datum */
-
-
- Status = AcpiAmlWriteFieldData (ObjDesc,
- ThisFieldByteOffset + ByteGranularity,
- BitGranularity, MergedDatum);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
-
- /*
- * Save the most recent datum since it contains bits of
- * the *next* field datum
- */
-
- PreviousRawDatum = ThisRawDatum;
-
- ThisFieldByteOffset += ByteGranularity;
-
- } /* while */
-
-
- /* Write a partial field datum if field does not end on a datum boundary */
-
- if ((ObjDesc->FieldUnit.Length + ObjDesc->FieldUnit.BitOffset) %
- BitGranularity)
- {
- switch (ByteGranularity)
- {
- case 1:
- ThisRawDatum = ((UINT8 *) Buffer) [ThisFieldDatumOffset];
- break;
-
- case 2:
- MOVE_UNALIGNED16_TO_32 (&ThisRawDatum, &(((UINT16 *) Buffer) [ThisFieldDatumOffset]));
- break;
-
- case 4:
- MOVE_UNALIGNED32_TO_32 (&ThisRawDatum, &(((UINT32 *) Buffer) [ThisFieldDatumOffset]));
- break;
- }
-
- /* Construct Mask with 1 bits where the field is, 0 bits elsewhere */
-
- ValidFieldBits = ((ObjDesc->FieldUnit.Length % BitGranularity) +
- ObjDesc->Field.BitOffset);
-
- Mask = (((UINT32) 1 << ValidFieldBits) - (UINT32) 1);
-
- /* Shift and mask the value into the field position */
-
- FieldValue = (PreviousRawDatum >>
- (BitGranularity - ObjDesc->Field.BitOffset)) & Mask;
-
- Status = AcpiAmlWriteFieldDataWithUpdateRule (ObjDesc, Mask, FieldValue,
- ThisFieldByteOffset + ByteGranularity,
- BitGranularity);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
- }
-
-
-Cleanup:
-
- return_ACPI_STATUS (Status);
-}
-
-
diff --git a/sys/contrib/dev/acpica/Subsystem/Interpreter/ammisc.c b/sys/contrib/dev/acpica/Subsystem/Interpreter/ammisc.c
deleted file mode 100644
index 505d9d4d322f..000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Interpreter/ammisc.c
+++ /dev/null
@@ -1,682 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: ammisc - ACPI AML (p-code) execution - specific opcodes
- * $Revision: 73 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 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 __AMMISC_C__
-
-#include "acpi.h"
-#include "acparser.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acdispat.h"
-
-
-#define _COMPONENT INTERPRETER
- MODULE_NAME ("ammisc")
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlExecFatal
- *
- * PARAMETERS: none
- *
- * RETURN: Status. If the OS returns from the OSD call, we just keep
- * on going.
- *
- * DESCRIPTION: Execute Fatal operator
- *
- * ACPI SPECIFICATION REFERENCES:
- * DefFatal := FatalOp FatalType FatalCode FatalArg
- * FatalType := ByteData
- * FatalCode := DWordData
- * FatalArg := TermArg=>Integer
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlExecFatal (
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_OPERAND_OBJECT *TypeDesc;
- ACPI_OPERAND_OBJECT *CodeDesc;
- ACPI_OPERAND_OBJECT *ArgDesc;
- ACPI_STATUS Status;
-
-
- FUNCTION_TRACE ("AmlExecFatal");
-
-
- /* Resolve operands */
-
- Status = AcpiAmlResolveOperands (AML_FATAL_OP, WALK_OPERANDS, WalkState);
- DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE,
- AcpiPsGetOpcodeName (AML_FATAL_OP),
- 3, "after AcpiAmlResolveOperands");
-
- /* Get operands */
-
- Status |= AcpiDsObjStackPopObject (&ArgDesc, WalkState);
- Status |= AcpiDsObjStackPopObject (&CodeDesc, WalkState);
- Status |= AcpiDsObjStackPopObject (&TypeDesc, WalkState);
- if (ACPI_FAILURE (Status))
- {
- /* Invalid parameters on object stack */
-
- DEBUG_PRINT (ACPI_ERROR,
- ("AcpiAmlExecFatal/AML_FATAL_OP: bad operand(s) (Status=%X)\n",
- Status));
-
- goto Cleanup;
- }
-
-
- /* DefFatal := FatalOp FatalType FatalCode FatalArg */
-
-
- DEBUG_PRINT (ACPI_INFO,
- ("FatalOp: Type %x Code %x Arg %x <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
- TypeDesc->Integer.Value, CodeDesc->Integer.Value, ArgDesc->Integer.Value));
-
-
- /*
- * TBD: [Unhandled] call OSD interface to notify OS of fatal error
- * requiring shutdown!
- */
-
-
-Cleanup:
-
- /* Free the operands */
-
- AcpiCmRemoveReference (ArgDesc);
- AcpiCmRemoveReference (CodeDesc);
- AcpiCmRemoveReference (TypeDesc);
-
-
- /* If we get back from the OS call, we might as well keep going. */
-
- REPORT_WARNING (("An AML \"Fatal\" Opcode (FatalOp) was executed\n"));
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlExecIndex
- *
- * PARAMETERS: none
- *
- * RETURN: Status
- *
- * DESCRIPTION: Execute Index operator
- *
- * ALLOCATION: Deletes one operand descriptor -- other remains on stack
- *
- * ACPI SPECIFICATION REFERENCES:
- * DefIndex := IndexOp BuffPkgObj IndexValue Result
- * IndexValue := TermArg=>Integer
- * NameString := <RootChar NamePath> | <PrefixPath NamePath>
- * Result := SuperName
- * SuperName := NameString | ArgObj | LocalObj | DebugObj | DefIndex
- * Local4Op | Local5Op | Local6Op | Local7Op
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlExecIndex (
- ACPI_WALK_STATE *WalkState,
- ACPI_OPERAND_OBJECT **ReturnDesc)
-{
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_OPERAND_OBJECT *IdxDesc;
- ACPI_OPERAND_OBJECT *ResDesc;
- ACPI_OPERAND_OBJECT *RetDesc = NULL;
- ACPI_OPERAND_OBJECT *TmpDesc;
- ACPI_STATUS Status;
-
-
- FUNCTION_TRACE ("AmlExecIndex");
-
-
- /* Resolve operands */
- /* First operand can be either a package or a buffer */
-
- Status = AcpiAmlResolveOperands (AML_INDEX_OP, WALK_OPERANDS, WalkState);
- DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE,
- AcpiPsGetOpcodeName (AML_INDEX_OP),
- 3, "after AcpiAmlResolveOperands");
-
- /* Get all operands */
-
- Status |= AcpiDsObjStackPopObject (&ResDesc, WalkState);
- Status |= AcpiDsObjStackPopObject (&IdxDesc, WalkState);
- Status |= AcpiDsObjStackPopObject (&ObjDesc, WalkState);
- if (ACPI_FAILURE (Status))
- {
- /* Invalid parameters on object stack */
-
- DEBUG_PRINT (ACPI_ERROR,
- ("AcpiAmlExecIndex/AML_INDEX_OP: bad operand(s) (Status=%X)\n",
- Status));
-
- goto Cleanup;
- }
-
-
- /* Create the internal return object */
-
- RetDesc = AcpiCmCreateInternalObject (INTERNAL_TYPE_REFERENCE);
- if (!RetDesc)
- {
- Status = AE_NO_MEMORY;
- goto Cleanup;
- }
-
-
- /*
- * At this point, the ObjDesc operand is either a Package or a Buffer
- */
-
- if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE)
- {
- /* Object to be indexed is a Package */
-
- if (IdxDesc->Integer.Value >= ObjDesc->Package.Count)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlExecIndex: Index value out of range\n"));
- Status = AE_AML_PACKAGE_LIMIT;
- goto Cleanup;
- }
-
- if ((ResDesc->Common.Type == INTERNAL_TYPE_REFERENCE) &&
- (ResDesc->Reference.OpCode == AML_ZERO_OP))
- {
- /*
- * There is no actual result descriptor (the ZeroOp Result
- * descriptor is a placeholder), so just delete the placeholder and
- * return a reference to the package element
- */
-
- AcpiCmRemoveReference (ResDesc);
- }
-
- else
- {
- /*
- * Each element of the package is an internal object. Get the one
- * we are after.
- */
-
- TmpDesc = ObjDesc->Package.Elements[IdxDesc->Integer.Value];
- RetDesc->Reference.OpCode = AML_INDEX_OP;
- RetDesc->Reference.TargetType = TmpDesc->Common.Type;
- RetDesc->Reference.Object = TmpDesc;
-
- Status = AcpiAmlExecStore (RetDesc, ResDesc, WalkState);
- RetDesc->Reference.Object = NULL;
- }
-
- /*
- * The local return object must always be a reference to the package element,
- * not the element itself.
- */
- RetDesc->Reference.OpCode = AML_INDEX_OP;
- RetDesc->Reference.TargetType = ACPI_TYPE_PACKAGE;
- RetDesc->Reference.Where = &ObjDesc->Package.Elements[IdxDesc->Integer.Value];
- }
-
- else
- {
- /* Object to be indexed is a Buffer */
-
- if (IdxDesc->Integer.Value >= ObjDesc->Buffer.Length)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlExecIndex: Index value out of range\n"));
- Status = AE_AML_BUFFER_LIMIT;
- goto Cleanup;
- }
-
- RetDesc->Reference.OpCode = AML_INDEX_OP;
- RetDesc->Reference.TargetType = ACPI_TYPE_BUFFER_FIELD;
- RetDesc->Reference.Object = ObjDesc;
- RetDesc->Reference.Offset = (UINT32) IdxDesc->Integer.Value;
-
- Status = AcpiAmlExecStore (RetDesc, ResDesc, WalkState);
- }
-
-
-Cleanup:
-
- /* Always delete operands */
-
- AcpiCmRemoveReference (ObjDesc);
- AcpiCmRemoveReference (IdxDesc);
-
- /* Delete return object on error */
-
- if (ACPI_FAILURE (Status))
- {
- AcpiCmRemoveReference (ResDesc);
-
- if (RetDesc)
- {
- AcpiCmRemoveReference (RetDesc);
- RetDesc = NULL;
- }
- }
-
- /* Set the return object and exit */
-
- *ReturnDesc = RetDesc;
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlExecMatch
- *
- * PARAMETERS: none
- *
- * RETURN: Status
- *
- * DESCRIPTION: Execute Match operator
- *
- * ACPI SPECIFICATION REFERENCES:
- * DefMatch := MatchOp SearchPkg Opcode1 Operand1
- * Opcode2 Operand2 StartIndex
- * Opcode1 := ByteData: MTR, MEQ, MLE, MLT, MGE, or MGT
- * Opcode2 := ByteData: MTR, MEQ, MLE, MLT, MGE, or MGT
- * Operand1 := TermArg=>Integer
- * Operand2 := TermArg=>Integer
- * SearchPkg := TermArg=>PackageObject
- * StartIndex := TermArg=>Integer
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlExecMatch (
- ACPI_WALK_STATE *WalkState,
- ACPI_OPERAND_OBJECT **ReturnDesc)
-{
- ACPI_OPERAND_OBJECT *PkgDesc;
- ACPI_OPERAND_OBJECT *Op1Desc;
- ACPI_OPERAND_OBJECT *V1Desc;
- ACPI_OPERAND_OBJECT *Op2Desc;
- ACPI_OPERAND_OBJECT *V2Desc;
- ACPI_OPERAND_OBJECT *StartDesc;
- ACPI_OPERAND_OBJECT *RetDesc = NULL;
- ACPI_STATUS Status;
- UINT32 Index;
- UINT32 MatchValue = (UINT32) -1;
-
-
- FUNCTION_TRACE ("AmlExecMatch");
-
-
- /* Resolve all operands */
-
- Status = AcpiAmlResolveOperands (AML_MATCH_OP, WALK_OPERANDS, WalkState);
- DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE,
- AcpiPsGetOpcodeName (AML_MATCH_OP),
- 6, "after AcpiAmlResolveOperands");
-
- /* Get all operands */
-
- Status |= AcpiDsObjStackPopObject (&StartDesc, WalkState);
- Status |= AcpiDsObjStackPopObject (&V2Desc, WalkState);
- Status |= AcpiDsObjStackPopObject (&Op2Desc, WalkState);
- Status |= AcpiDsObjStackPopObject (&V1Desc, WalkState);
- Status |= AcpiDsObjStackPopObject (&Op1Desc, WalkState);
- Status |= AcpiDsObjStackPopObject (&PkgDesc, WalkState);
-
- if (ACPI_FAILURE (Status))
- {
- /* Invalid parameters on object stack */
-
- DEBUG_PRINT (ACPI_ERROR,
- ("ExecMatch/AML_MATCH_OP: bad operand(s) (Status=%X)\n",
- Status));
-
- goto Cleanup;
- }
-
- /* Validate match comparison sub-opcodes */
-
- if ((Op1Desc->Integer.Value > MAX_MATCH_OPERATOR) ||
- (Op2Desc->Integer.Value > MAX_MATCH_OPERATOR))
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlExecMatch: operation encoding out of range\n"));
- Status = AE_AML_OPERAND_VALUE;
- goto Cleanup;
- }
-
- Index = (UINT32) StartDesc->Integer.Value;
- if (Index >= (UINT32) PkgDesc->Package.Count)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlExecMatch: start position value out of range\n"));
- Status = AE_AML_PACKAGE_LIMIT;
- goto Cleanup;
- }
-
- RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER);
- if (!RetDesc)
- {
- Status = AE_NO_MEMORY;
- goto Cleanup;
-
- }
-
- /*
- * Examine each element until a match is found. Within the loop,
- * "continue" signifies that the current element does not match
- * and the next should be examined.
- * Upon finding a match, the loop will terminate via "break" at
- * the bottom. If it terminates "normally", MatchValue will be -1
- * (its initial value) indicating that no match was found. When
- * returned as a Number, this will produce the Ones value as specified.
- */
-
- for ( ; Index < PkgDesc->Package.Count; ++Index)
- {
- /*
- * Treat any NULL or non-numeric elements as non-matching.
- * TBD [Unhandled] - if an element is a Name,
- * should we examine its value?
- */
- if (!PkgDesc->Package.Elements[Index] ||
- ACPI_TYPE_INTEGER != PkgDesc->Package.Elements[Index]->Common.Type)
- {
- continue;
- }
-
- /*
- * Within these switch statements:
- * "break" (exit from the switch) signifies a match;
- * "continue" (proceed to next iteration of enclosing
- * "for" loop) signifies a non-match.
- */
- switch (Op1Desc->Integer.Value)
- {
-
- case MATCH_MTR: /* always true */
-
- break;
-
-
- case MATCH_MEQ: /* true if equal */
-
- if (PkgDesc->Package.Elements[Index]->Integer.Value
- != V1Desc->Integer.Value)
- {
- continue;
- }
- break;
-
-
- case MATCH_MLE: /* true if less than or equal */
-
- if (PkgDesc->Package.Elements[Index]->Integer.Value
- > V1Desc->Integer.Value)
- {
- continue;
- }
- break;
-
-
- case MATCH_MLT: /* true if less than */
-
- if (PkgDesc->Package.Elements[Index]->Integer.Value
- >= V1Desc->Integer.Value)
- {
- continue;
- }
- break;
-
-
- case MATCH_MGE: /* true if greater than or equal */
-
- if (PkgDesc->Package.Elements[Index]->Integer.Value
- < V1Desc->Integer.Value)
- {
- continue;
- }
- break;
-
-
- case MATCH_MGT: /* true if greater than */
-
- if (PkgDesc->Package.Elements[Index]->Integer.Value
- <= V1Desc->Integer.Value)
- {
- continue;
- }
- break;
-
-
- default: /* undefined */
-
- continue;
- }
-
-
- switch(Op2Desc->Integer.Value)
- {
-
- case MATCH_MTR:
-
- break;
-
-
- case MATCH_MEQ:
-
- if (PkgDesc->Package.Elements[Index]->Integer.Value
- != V2Desc->Integer.Value)
- {
- continue;
- }
- break;
-
-
- case MATCH_MLE:
-
- if (PkgDesc->Package.Elements[Index]->Integer.Value
- > V2Desc->Integer.Value)
- {
- continue;
- }
- break;
-
-
- case MATCH_MLT:
-
- if (PkgDesc->Package.Elements[Index]->Integer.Value
- >= V2Desc->Integer.Value)
- {
- continue;
- }
- break;
-
-
- case MATCH_MGE:
-
- if (PkgDesc->Package.Elements[Index]->Integer.Value
- < V2Desc->Integer.Value)
- {
- continue;
- }
- break;
-
-
- case MATCH_MGT:
-
- if (PkgDesc->Package.Elements[Index]->Integer.Value
- <= V2Desc->Integer.Value)
- {
- continue;
- }
- break;
-
-
- default:
-
- continue;
- }
-
- /* Match found: exit from loop */
-
- MatchValue = Index;
- break;
- }
-
- /* MatchValue is the return value */
-
- RetDesc->Integer.Value = MatchValue;
-
-
-Cleanup:
-
- /* Free the operands */
-
- AcpiCmRemoveReference (StartDesc);
- AcpiCmRemoveReference (V2Desc);
- AcpiCmRemoveReference (Op2Desc);
- AcpiCmRemoveReference (V1Desc);
- AcpiCmRemoveReference (Op1Desc);
- AcpiCmRemoveReference (PkgDesc);
-
-
- /* Delete return object on error */
-
- if (ACPI_FAILURE (Status) &&
- (RetDesc))
- {
- AcpiCmRemoveReference (RetDesc);
- RetDesc = NULL;
- }
-
-
- /* Set the return object and exit */
-
- *ReturnDesc = RetDesc;
- return_ACPI_STATUS (Status);
-}
diff --git a/sys/contrib/dev/acpica/Subsystem/Interpreter/ammonad.c b/sys/contrib/dev/acpica/Subsystem/Interpreter/ammonad.c
deleted file mode 100644
index 394780f286a1..000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Interpreter/ammonad.c
+++ /dev/null
@@ -1,1212 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: ammonad - ACPI AML (p-code) execution for monadic operators
- * $Revision: 89 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 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 __AMMONAD_C__
-
-#include "acpi.h"
-#include "acparser.h"
-#include "acdispat.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-
-
-#define _COMPONENT INTERPRETER
- MODULE_NAME ("ammonad")
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlGetObjectReference
- *
- * PARAMETERS: ObjDesc - Create a reference to this object
- * RetDesc - Where to store the reference
- *
- * RETURN: Status
- *
- * DESCRIPTION: Obtain and return a "reference" to the target object
- * Common code for the RefOfOp and the CondRefOfOp.
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiAmlGetObjectReference (
- ACPI_OPERAND_OBJECT *ObjDesc,
- ACPI_OPERAND_OBJECT **RetDesc,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_STATUS Status = AE_OK;
-
-
- FUNCTION_TRACE_PTR ("AmlGetObjectReference", ObjDesc);
-
-
- if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_INTERNAL))
- {
- if (ObjDesc->Common.Type != INTERNAL_TYPE_REFERENCE)
- {
- *RetDesc = NULL;
- Status = AE_TYPE;
- goto Cleanup;
- }
-
- /*
- * Not a Name -- an indirect name pointer would have
- * been converted to a direct name pointer in AcpiAmlResolveOperands
- */
- switch (ObjDesc->Reference.OpCode)
- {
- case AML_LOCAL_OP:
-
- *RetDesc = (void *) AcpiDsMethodDataGetNte (MTH_TYPE_LOCAL,
- (ObjDesc->Reference.Offset), WalkState);
- break;
-
-
- case AML_ARG_OP:
-
- *RetDesc = (void *) AcpiDsMethodDataGetNte (MTH_TYPE_ARG,
- (ObjDesc->Reference.Offset), WalkState);
- break;
-
-
- default:
-
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlGetObjectReference: (Internal) Unknown Ref subtype %02x\n",
- ObjDesc->Reference.OpCode));
- *RetDesc = NULL;
- Status = AE_AML_INTERNAL;
- goto Cleanup;
- }
-
- }
-
- else if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED))
- {
- /* Must be a named object; Just return the Node */
-
- *RetDesc = ObjDesc;
- }
-
- else
- {
- *RetDesc = NULL;
- Status = AE_TYPE;
- }
-
-
-Cleanup:
-
- DEBUG_PRINT (TRACE_EXEC,
- ("AmlGetObjectReference: Obj=%p Ref=%p\n", ObjDesc, *RetDesc));
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlExecMonadic1
- *
- * PARAMETERS: Opcode - The opcode to be executed
- *
- * RETURN: Status
- *
- * DESCRIPTION: Execute Type 1 monadic operator with numeric operand on
- * object stack
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlExecMonadic1 (
- UINT16 Opcode,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_STATUS Status;
-
-
- FUNCTION_TRACE_PTR ("AmlExecMonadic1", WALK_OPERANDS);
-
-
- /* Resolve all operands */
-
- Status = AcpiAmlResolveOperands (Opcode, WALK_OPERANDS, WalkState);
- DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE,
- AcpiPsGetOpcodeName (Opcode),
- 1, "after AcpiAmlResolveOperands");
-
- /* Get all operands */
-
- Status |= AcpiDsObjStackPopObject (&ObjDesc, WalkState);
- if (ACPI_FAILURE (Status))
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("ExecMonadic1/%s: bad operand(s) (Status=%s)\n",
- AcpiPsGetOpcodeName (Opcode), AcpiCmFormatException(Status)));
-
- goto Cleanup;
- }
-
-
- /* Examine the opcode */
-
- switch (Opcode)
- {
-
- /* DefRelease := ReleaseOp MutexObject */
-
- case AML_RELEASE_OP:
-
- Status = AcpiAmlSystemReleaseMutex (ObjDesc);
- break;
-
-
- /* DefReset := ResetOp AcpiEventObject */
-
- case AML_RESET_OP:
-
- Status = AcpiAmlSystemResetEvent (ObjDesc);
- break;
-
-
- /* DefSignal := SignalOp AcpiEventObject */
-
- case AML_SIGNAL_OP:
-
- Status = AcpiAmlSystemSignalEvent (ObjDesc);
- break;
-
-
- /* DefSleep := SleepOp MsecTime */
-
- case AML_SLEEP_OP:
-
- AcpiAmlSystemDoSuspend ((UINT32) ObjDesc->Integer.Value);
- break;
-
-
- /* DefStall := StallOp UsecTime */
-
- case AML_STALL_OP:
-
- AcpiAmlSystemDoStall ((UINT32) ObjDesc->Integer.Value);
- break;
-
-
- /* Unknown opcode */
-
- default:
-
- REPORT_ERROR (("AcpiAmlExecMonadic1: Unknown monadic opcode %X\n",
- Opcode));
- Status = AE_AML_BAD_OPCODE;
- break;
-
- } /* switch */
-
-
-Cleanup:
-
- /* Always delete the operand */
-
- AcpiCmRemoveReference (ObjDesc);
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlExecMonadic2R
- *
- * PARAMETERS: Opcode - The opcode to be executed
- *
- * RETURN: Status
- *
- * DESCRIPTION: Execute Type 2 monadic operator with numeric operand and
- * result operand on operand stack
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlExecMonadic2R (
- UINT16 Opcode,
- ACPI_WALK_STATE *WalkState,
- ACPI_OPERAND_OBJECT **ReturnDesc)
-{
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_OPERAND_OBJECT *ResDesc;
- ACPI_OPERAND_OBJECT *RetDesc = NULL;
- ACPI_OPERAND_OBJECT *RetDesc2 = NULL;
- UINT32 ResVal;
- ACPI_STATUS Status;
- UINT32 i;
- UINT32 j;
- ACPI_INTEGER Digit;
-
-
- FUNCTION_TRACE_PTR ("AmlExecMonadic2R", WALK_OPERANDS);
-
-
- /* Resolve all operands */
-
- Status = AcpiAmlResolveOperands (Opcode, WALK_OPERANDS, WalkState);
- DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE,
- AcpiPsGetOpcodeName (Opcode),
- 2, "after AcpiAmlResolveOperands");
-
- /* Get all operands */
-
- Status |= AcpiDsObjStackPopObject (&ResDesc, WalkState);
- Status |= AcpiDsObjStackPopObject (&ObjDesc, WalkState);
- if (ACPI_FAILURE (Status))
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("ExecMonadic2R/%s: bad operand(s) (Status=%s)\n",
- AcpiPsGetOpcodeName (Opcode), AcpiCmFormatException(Status)));
-
- goto Cleanup;
- }
-
-
- /* Create a return object of type NUMBER for most opcodes */
-
- switch (Opcode)
- {
- case AML_BIT_NOT_OP:
- case AML_FIND_SET_LEFT_BIT_OP:
- case AML_FIND_SET_RIGHT_BIT_OP:
- case AML_FROM_BCD_OP:
- case AML_TO_BCD_OP:
- case AML_COND_REF_OF_OP:
-
- RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER);
- if (!RetDesc)
- {
- Status = AE_NO_MEMORY;
- goto Cleanup;
- }
-
- break;
- }
-
-
- switch (Opcode)
- {
- /* DefNot := NotOp Operand Result */
-
- case AML_BIT_NOT_OP:
-
- RetDesc->Integer.Value = ~ObjDesc->Integer.Value;
- break;
-
-
- /* DefFindSetLeftBit := FindSetLeftBitOp Operand Result */
-
- case AML_FIND_SET_LEFT_BIT_OP:
-
- RetDesc->Integer.Value = ObjDesc->Integer.Value;
-
- /*
- * Acpi specification describes Integer type as a little
- * endian unsigned value, so this boundry condition is valid.
- */
- for (ResVal = 0; RetDesc->Integer.Value && ResVal < ACPI_INTEGER_BIT_SIZE; ++ResVal)
- {
- RetDesc->Integer.Value >>= 1;
- }
-
- RetDesc->Integer.Value = ResVal;
- break;
-
-
- /* DefFindSetRightBit := FindSetRightBitOp Operand Result */
-
- case AML_FIND_SET_RIGHT_BIT_OP:
-
- RetDesc->Integer.Value = ObjDesc->Integer.Value;
-
- /*
- * Acpi specification describes Integer type as a little
- * endian unsigned value, so this boundry condition is valid.
- */
- for (ResVal = 0; RetDesc->Integer.Value && ResVal < ACPI_INTEGER_BIT_SIZE; ++ResVal)
- {
- RetDesc->Integer.Value <<= 1;
- }
-
- /* Since returns must be 1-based, subtract from 33 (65) */
-
- RetDesc->Integer.Value = ResVal == 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - ResVal;
- break;
-
-
- /* DefFromBDC := FromBCDOp BCDValue Result */
-
- case AML_FROM_BCD_OP:
-
- /*
- * The 64-bit ACPI integer can hold 16 4-bit BCD integers
- */
- RetDesc->Integer.Value = 0;
- for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++)
- {
- /* Get one BCD digit */
-
- Digit = (ACPI_INTEGER) ((ObjDesc->Integer.Value >> (i * 4)) & 0xF);
-
- /* Check the range of the digit */
-
- if (Digit > 9)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("Monadic2R/FromBCDOp: BCD digit too large: \n",
- Digit));
- Status = AE_AML_NUMERIC_OVERFLOW;
- goto Cleanup;
- }
-
- if (Digit > 0)
- {
- /* Sum into the result with the appropriate power of 10 */
-
- for (j = 0; j < i; j++)
- {
- Digit *= 10;
- }
-
- RetDesc->Integer.Value += Digit;
- }
- }
- break;
-
-
- /* DefToBDC := ToBCDOp Operand Result */
-
- case AML_TO_BCD_OP:
-
-
- if (ObjDesc->Integer.Value > ACPI_MAX_BCD_VALUE)
- {
- DEBUG_PRINT (ACPI_ERROR, ("Monadic2R/ToBCDOp: BCD overflow: %d\n",
- ObjDesc->Integer.Value));
- Status = AE_AML_NUMERIC_OVERFLOW;
- goto Cleanup;
- }
-
- RetDesc->Integer.Value = 0;
- for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++)
- {
- /* Divide by nth factor of 10 */
-
- Digit = ObjDesc->Integer.Value;
- for (j = 0; j < i; j++)
- {
- Digit /= 10;
- }
-
- /* Create the BCD digit */
-
- if (Digit > 0)
- {
- RetDesc->Integer.Value += (ACPI_MODULO (Digit, 10) << (i * 4));
- }
- }
- break;
-
-
- /* DefCondRefOf := CondRefOfOp SourceObject Result */
-
- case AML_COND_REF_OF_OP:
-
- /*
- * This op is a little strange because the internal return value is
- * different than the return value stored in the result descriptor
- * (There are really two return values)
- */
-
- if ((ACPI_NAMESPACE_NODE *) ObjDesc == AcpiGbl_RootNode)
- {
- /*
- * This means that the object does not exist in the namespace,
- * return FALSE
- */
-
- RetDesc->Integer.Value = 0;
-
- /*
- * Must delete the result descriptor since there is no reference
- * being returned
- */
-
- AcpiCmRemoveReference (ResDesc);
- goto Cleanup;
- }
-
- /* Get the object reference and store it */
-
- Status = AcpiAmlGetObjectReference (ObjDesc, &RetDesc2, WalkState);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
- Status = AcpiAmlExecStore (RetDesc2, ResDesc, WalkState);
-
- /* The object exists in the namespace, return TRUE */
-
- RetDesc->Integer.Value = ACPI_INTEGER_MAX;
- goto Cleanup;
- break;
-
-
- case AML_STORE_OP:
-
- /*
- * A store operand is typically a number, string, buffer or lvalue
- * TBD: [Unhandled] What about a store to a package?
- */
-
- /*
- * Do the store, and be careful about deleting the source object,
- * since the object itself may have been stored.
- */
-
- Status = AcpiAmlExecStore (ObjDesc, ResDesc, WalkState);
- if (ACPI_FAILURE (Status))
- {
- /* On failure, just delete the ObjDesc */
-
- AcpiCmRemoveReference (ObjDesc);
- }
-
- else
- {
- /*
- * Normally, we would remove a reference on the ObjDesc parameter;
- * But since it is being used as the internal return object
- * (meaning we would normally increment it), the two cancel out,
- * and we simply don't do anything.
- */
- *ReturnDesc = ObjDesc;
- }
-
- ObjDesc = NULL;
- return_ACPI_STATUS (Status);
-
- break;
-
-
- case AML_DEBUG_OP:
-
- /* Reference, returning an Reference */
-
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlExecMonadic2R: DebugOp should never get here!\n"));
- return_ACPI_STATUS (AE_OK);
- break;
-
-
- /*
- * These are obsolete opcodes
- */
-
- /* DefShiftLeftBit := ShiftLeftBitOp Source BitNum */
- /* DefShiftRightBit := ShiftRightBitOp Source BitNum */
-
- case AML_SHIFT_LEFT_BIT_OP:
- case AML_SHIFT_RIGHT_BIT_OP:
-
- DEBUG_PRINT (ACPI_ERROR, ("AmlExecMonadic2R: %s unimplemented\n",
- AcpiPsGetOpcodeName (Opcode)));
- Status = AE_SUPPORT;
- goto Cleanup;
- break;
-
-
- default:
-
- REPORT_ERROR (("AcpiAmlExecMonadic2R: Unknown monadic opcode %X\n",
- Opcode));
- Status = AE_AML_BAD_OPCODE;
- goto Cleanup;
- }
-
-
- Status = AcpiAmlExecStore (RetDesc, ResDesc, WalkState);
-
-
-Cleanup:
- /* Always delete the operand object */
-
- AcpiCmRemoveReference (ObjDesc);
-
- /* Delete return object(s) on error */
-
- if (ACPI_FAILURE (Status))
- {
- AcpiCmRemoveReference (ResDesc); /* Result descriptor */
- if (RetDesc)
- {
- AcpiCmRemoveReference (RetDesc);
- RetDesc = NULL;
- }
- }
-
- /* Set the return object and exit */
-
- *ReturnDesc = RetDesc;
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlExecMonadic2
- *
- * PARAMETERS: Opcode - The opcode to be executed
- *
- * RETURN: Status
- *
- * DESCRIPTION: Execute Type 2 monadic operator with numeric operand:
- * DerefOfOp, RefOfOp, SizeOfOp, TypeOp, IncrementOp,
- * DecrementOp, LNotOp,
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlExecMonadic2 (
- UINT16 Opcode,
- ACPI_WALK_STATE *WalkState,
- ACPI_OPERAND_OBJECT **ReturnDesc)
-{
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_OPERAND_OBJECT *TmpDesc;
- ACPI_OPERAND_OBJECT *RetDesc = NULL;
- ACPI_STATUS ResolveStatus;
- ACPI_STATUS Status;
- UINT32 Type;
- ACPI_INTEGER Value;
-
-
- FUNCTION_TRACE_PTR ("AmlExecMonadic2", WALK_OPERANDS);
-
-
- /* Attempt to resolve the operands */
-
- ResolveStatus = AcpiAmlResolveOperands (Opcode, WALK_OPERANDS, WalkState);
- DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE,
- AcpiPsGetOpcodeName (Opcode),
- 1, "after AcpiAmlResolveOperands");
-
- /* Always get all operands */
-
- Status = AcpiDsObjStackPopObject (&ObjDesc, WalkState);
-
-
- /* Now we can check the status codes */
-
- if (ACPI_FAILURE (ResolveStatus))
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("ExecMonadic2[%s]: Could not resolve operands, %s\n",
- AcpiPsGetOpcodeName (Opcode), AcpiCmFormatException (ResolveStatus)));
-
- goto Cleanup;
- }
-
- if (ACPI_FAILURE (Status))
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("ExecMonadic2[%s]: Bad operand(s), %s\n",
- AcpiPsGetOpcodeName (Opcode), AcpiCmFormatException (Status)));
-
- goto Cleanup;
- }
-
-
- /* Get the operand and decode the opcode */
-
-
- switch (Opcode)
- {
-
- /* DefLNot := LNotOp Operand */
-
- case AML_LNOT_OP:
-
- RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER);
- if (!RetDesc)
- {
- Status = AE_NO_MEMORY;
- goto Cleanup;
- }
-
- RetDesc->Integer.Value = !ObjDesc->Integer.Value;
- break;
-
-
- /* DefDecrement := DecrementOp Target */
- /* DefIncrement := IncrementOp Target */
-
- case AML_DECREMENT_OP:
- case AML_INCREMENT_OP:
-
- /*
- * Since we are expecting an Reference on the top of the stack, it
- * can be either an Node or an internal object.
- *
- * TBD: [Future] This may be the prototype code for all cases where
- * an Reference is expected!! 10/99
- */
-
- if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED))
- {
- RetDesc = ObjDesc;
- }
-
- else
- {
- /*
- * Duplicate the Reference in a new object so that we can resolve it
- * without destroying the original Reference object
- */
-
- RetDesc = AcpiCmCreateInternalObject (INTERNAL_TYPE_REFERENCE);
- if (!RetDesc)
- {
- Status = AE_NO_MEMORY;
- goto Cleanup;
- }
-
- RetDesc->Reference.OpCode = ObjDesc->Reference.OpCode;
- RetDesc->Reference.Offset = ObjDesc->Reference.Offset;
- RetDesc->Reference.Object = ObjDesc->Reference.Object;
- }
-
-
- /*
- * Convert the RetDesc Reference to a Number
- * (This deletes the original RetDesc)
- */
-
- Status = AcpiAmlResolveOperands (AML_LNOT_OP, &RetDesc, WalkState);
- if (ACPI_FAILURE (Status))
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("ExecMonadic2/%s: bad operand(s) (Status=%s)\n",
- AcpiPsGetOpcodeName (Opcode), AcpiCmFormatException(Status)));
-
- goto Cleanup;
- }
-
- /* Do the actual increment or decrement */
-
- if (AML_INCREMENT_OP == Opcode)
- {
- RetDesc->Integer.Value++;
- }
- else
- {
- RetDesc->Integer.Value--;
- }
-
- /* Store the result back in the original descriptor */
-
- Status = AcpiAmlExecStore (RetDesc, ObjDesc, WalkState);
-
- /* Objdesc was just deleted (because it is an Reference) */
-
- ObjDesc = NULL;
-
- break;
-
-
- /* DefObjectType := ObjectTypeOp SourceObject */
-
- case AML_TYPE_OP:
-
- if (INTERNAL_TYPE_REFERENCE == ObjDesc->Common.Type)
- {
- /*
- * Not a Name -- an indirect name pointer would have
- * been converted to a direct name pointer in ResolveOperands
- */
- switch (ObjDesc->Reference.OpCode)
- {
- case AML_ZERO_OP:
- case AML_ONE_OP:
- case AML_ONES_OP:
-
- /* Constants are of type Number */
-
- Type = ACPI_TYPE_INTEGER;
- break;
-
-
- case AML_DEBUG_OP:
-
- /* Per 1.0b spec, Debug object is of type DebugObject */
-
- Type = ACPI_TYPE_DEBUG_OBJECT;
- break;
-
-
- case AML_INDEX_OP:
-
- /* Get the type of this reference (index into another object) */
-
- Type = ObjDesc->Reference.TargetType;
- if (Type == ACPI_TYPE_PACKAGE)
- {
- /*
- * The main object is a package, we want to get the type
- * of the individual package element that is referenced by
- * the index.
- */
- Type = (*(ObjDesc->Reference.Where))->Common.Type;
- }
-
- break;
-
-
- case AML_LOCAL_OP:
-
- Type = AcpiDsMethodDataGetType (MTH_TYPE_LOCAL,
- (ObjDesc->Reference.Offset), WalkState);
- break;
-
-
- case AML_ARG_OP:
-
- Type = AcpiDsMethodDataGetType (MTH_TYPE_ARG,
- (ObjDesc->Reference.Offset), WalkState);
- break;
-
-
- default:
-
- REPORT_ERROR (("AcpiAmlExecMonadic2/TypeOp: Internal error - Unknown Reference subtype %X\n",
- ObjDesc->Reference.OpCode));
- Status = AE_AML_INTERNAL;
- goto Cleanup;
- }
- }
-
- else
- {
- /*
- * It's not a Reference, so it must be a direct name pointer.
- */
- Type = AcpiNsGetType ((ACPI_HANDLE) ObjDesc);
- }
-
- /* Allocate a descriptor to hold the type. */
-
- RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER);
- if (!RetDesc)
- {
- Status = AE_NO_MEMORY;
- goto Cleanup;
- }
-
- RetDesc->Integer.Value = Type;
- break;
-
-
- /* DefSizeOf := SizeOfOp SourceObject */
-
- case AML_SIZE_OF_OP:
-
- if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED))
- {
- ObjDesc = AcpiNsGetAttachedObject (ObjDesc);
- }
-
- if (!ObjDesc)
- {
- Value = 0;
- }
-
- else
- {
- switch (ObjDesc->Common.Type)
- {
-
- case ACPI_TYPE_BUFFER:
-
- Value = ObjDesc->Buffer.Length;
- break;
-
-
- case ACPI_TYPE_STRING:
-
- Value = ObjDesc->String.Length;
- break;
-
-
- case ACPI_TYPE_PACKAGE:
-
- Value = ObjDesc->Package.Count;
- break;
-
- case INTERNAL_TYPE_REFERENCE:
-
- Value = 4;
- break;
-
- default:
-
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlExecMonadic2: Not Buf/Str/Pkg - found type %X\n",
- ObjDesc->Common.Type));
- Status = AE_AML_OPERAND_TYPE;
- goto Cleanup;
- }
- }
-
- /*
- * Now that we have the size of the object, create a result
- * object to hold the value
- */
-
- RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER);
- if (!RetDesc)
- {
- Status = AE_NO_MEMORY;
- goto Cleanup;
- }
-
- RetDesc->Integer.Value = Value;
- break;
-
-
- /* DefRefOf := RefOfOp SourceObject */
-
- case AML_REF_OF_OP:
-
- Status = AcpiAmlGetObjectReference (ObjDesc, &RetDesc, WalkState);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
- break;
-
-
- /* DefDerefOf := DerefOfOp ObjReference */
-
- case AML_DEREF_OF_OP:
-
-
- /* Check for a method local or argument */
-
- if (!VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED))
- {
- /*
- * Must resolve/dereference the local/arg reference first
- */
- switch (ObjDesc->Reference.OpCode)
- {
- /* Set ObjDesc to the value of the local/arg */
-
- case AML_LOCAL_OP:
-
- AcpiDsMethodDataGetValue (MTH_TYPE_LOCAL,
- (ObjDesc->Reference.Offset), WalkState, &TmpDesc);
-
- /*
- * Delete our reference to the input object and
- * point to the object just retrieved
- */
- AcpiCmRemoveReference (ObjDesc);
- ObjDesc = TmpDesc;
- break;
-
-
- case AML_ARG_OP:
-
- AcpiDsMethodDataGetValue (MTH_TYPE_ARG,
- (ObjDesc->Reference.Offset), WalkState, &TmpDesc);
-
- /*
- * Delete our reference to the input object and
- * point to the object just retrieved
- */
- AcpiCmRemoveReference (ObjDesc);
- ObjDesc = TmpDesc;
- break;
-
- default:
-
- /* Index op - handled below */
- break;
- }
- }
-
-
- /* ObjDesc may have changed from the code above */
-
- if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED))
- {
- /* Get the actual object from the Node (This is the dereference) */
-
- RetDesc = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Object;
-
- /* Returning a pointer to the object, add another reference! */
-
- AcpiCmAddReference (RetDesc);
- }
-
- else
- {
- /*
- * This must be a reference object produced by the Index
- * ASL operation -- check internal opcode
- */
-
- if ((ObjDesc->Reference.OpCode != AML_INDEX_OP) &&
- (ObjDesc->Reference.OpCode != AML_REF_OF_OP))
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlExecMonadic2: DerefOf, invalid obj ref %p\n",
- ObjDesc));
-
- Status = AE_TYPE;
- goto Cleanup;
- }
-
-
- switch (ObjDesc->Reference.OpCode)
- {
- case AML_INDEX_OP:
-
- /*
- * Supported target types for the Index operator are
- * 1) A Buffer
- * 2) A Package
- */
-
- if (ObjDesc->Reference.TargetType == ACPI_TYPE_BUFFER_FIELD)
- {
- /*
- * The target is a buffer, we must create a new object that
- * contains one element of the buffer, the element pointed
- * to by the index.
- *
- * NOTE: index into a buffer is NOT a pointer to a
- * sub-buffer of the main buffer, it is only a pointer to a
- * single element (byte) of the buffer!
- */
- RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER);
- if (!RetDesc)
- {
- Status = AE_NO_MEMORY;
- goto Cleanup;
- }
-
- TmpDesc = ObjDesc->Reference.Object;
- RetDesc->Integer.Value =
- TmpDesc->Buffer.Pointer[ObjDesc->Reference.Offset];
-
- /* TBD: [Investigate] (see below) Don't add an additional
- * ref!
- */
- }
-
- else if (ObjDesc->Reference.TargetType == ACPI_TYPE_PACKAGE)
- {
- /*
- * The target is a package, we want to return the referenced
- * element of the package. We must add another reference to
- * this object, however.
- */
-
- RetDesc = *(ObjDesc->Reference.Where);
- if (!RetDesc)
- {
- /*
- * We can't return a NULL dereferenced value. This is
- * an uninitialized package element and is thus a
- * severe error.
- */
-
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlExecMonadic2: DerefOf, NULL package element obj %p\n",
- ObjDesc));
- Status = AE_AML_UNINITIALIZED_ELEMENT;
- goto Cleanup;
- }
-
- AcpiCmAddReference (RetDesc);
- }
-
- else
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlExecMonadic2: DerefOf, Unknown TargetType %X in obj %p\n",
- ObjDesc->Reference.TargetType, ObjDesc));
- Status = AE_AML_OPERAND_TYPE;
- goto Cleanup;
- }
-
- break;
-
-
- case AML_REF_OF_OP:
-
- RetDesc = ObjDesc->Reference.Object;
-
- /* Add another reference to the object! */
-
- AcpiCmAddReference (RetDesc);
- break;
- }
- }
-
- break;
-
-
- default:
-
- REPORT_ERROR (("AcpiAmlExecMonadic2: Unknown monadic opcode %X\n",
- Opcode));
- Status = AE_AML_BAD_OPCODE;
- goto Cleanup;
- }
-
-
-Cleanup:
-
- if (ObjDesc)
- {
- AcpiCmRemoveReference (ObjDesc);
- }
-
- /* Delete return object on error */
-
- if (ACPI_FAILURE (Status) &&
- (RetDesc))
- {
- AcpiCmRemoveReference (RetDesc);
- RetDesc = NULL;
- }
-
- *ReturnDesc = RetDesc;
- return_ACPI_STATUS (Status);
-}
-
diff --git a/sys/contrib/dev/acpica/Subsystem/Interpreter/amnames.c b/sys/contrib/dev/acpica/Subsystem/Interpreter/amnames.c
deleted file mode 100644
index 9054e2e39bc4..000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Interpreter/amnames.c
+++ /dev/null
@@ -1,551 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: amnames - interpreter/scanner name load/execute
- * $Revision: 73 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 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 __AMNAMES_C__
-
-#include "acpi.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-
-#define _COMPONENT INTERPRETER
- MODULE_NAME ("amnames")
-
-
-/* AML Package Length encodings */
-
-#define ACPI_AML_PACKAGE_TYPE1 0x40
-#define ACPI_AML_PACKAGE_TYPE2 0x4000
-#define ACPI_AML_PACKAGE_TYPE3 0x400000
-#define ACPI_AML_PACKAGE_TYPE4 0x40000000
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlAllocateNameString
- *
- * PARAMETERS: PrefixCount - Count of parent levels. Special cases:
- * (-1) = root, 0 = none
- * NumNameSegs - count of 4-character name segments
- *
- * RETURN: A pointer to the allocated string segment. This segment must
- * be deleted by the caller.
- *
- * DESCRIPTION: Allocate a buffer for a name string. Ensure allocated name
- * string is long enough, and set up prefix if any.
- *
- ******************************************************************************/
-
-NATIVE_CHAR *
-AcpiAmlAllocateNameString (
- UINT32 PrefixCount,
- UINT32 NumNameSegs)
-{
- NATIVE_CHAR *TempPtr;
- NATIVE_CHAR *NameString;
- UINT32 SizeNeeded;
-
- FUNCTION_TRACE ("AmlAllocateNameString");
-
-
- /*
- * Allow room for all \ and ^ prefixes, all segments, and a MultiNamePrefix.
- * Also, one byte for the null terminator.
- * This may actually be somewhat longer than needed.
- */
-
- if (PrefixCount == (UINT32) -1)
- {
- /* Special case for root */
-
- SizeNeeded = 1 + (ACPI_NAME_SIZE * NumNameSegs) + 2 + 1;
- }
- else
- {
- SizeNeeded = PrefixCount + (ACPI_NAME_SIZE * NumNameSegs) + 2 + 1;
- }
-
- /*
- * Allocate a buffer for the name.
- * This buffer must be deleted by the caller!
- */
-
- NameString = AcpiCmAllocate (SizeNeeded);
- if (!NameString)
- {
- REPORT_ERROR (("AmlAllocateNameString: name allocation failure\n"));
- return_PTR (NULL);
- }
-
- TempPtr = NameString;
-
- /* Set up Root or Parent prefixes if needed */
-
- if (PrefixCount == (UINT32) -1)
- {
- *TempPtr++ = AML_ROOT_PREFIX;
- }
-
- else
- {
- while (PrefixCount--)
- {
- *TempPtr++ = AML_PARENT_PREFIX;
- }
- }
-
-
- /* Set up Dual or Multi prefixes if needed */
-
- if (NumNameSegs > 2)
- {
- /* Set up multi prefixes */
-
- *TempPtr++ = AML_MULTI_NAME_PREFIX_OP;
- *TempPtr++ = (char) NumNameSegs;
- }
-
- else if (2 == NumNameSegs)
- {
- /* Set up dual prefixes */
-
- *TempPtr++ = AML_DUAL_NAME_PREFIX;
- }
-
- /*
- * Terminate string following prefixes. AcpiAmlExecNameSegment() will
- * append the segment(s)
- */
-
- *TempPtr = 0;
-
- return_PTR (NameString);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlExecNameSegment
- *
- * PARAMETERS: InterpreterMode - Current running mode (load1/Load2/Exec)
- *
- * RETURN: Status
- *
- * DESCRIPTION: Execute a name segment (4 bytes)
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlExecNameSegment (
- UINT8 **InAmlAddress,
- NATIVE_CHAR *NameString)
-{
- UINT8 *AmlAddress = *InAmlAddress;
- ACPI_STATUS Status = AE_OK;
- UINT32 Index;
- NATIVE_CHAR CharBuf[5];
-
-
- FUNCTION_TRACE ("AmlExecNameSegment");
-
-
- /*
- * If first character is a digit, then we know that we aren't looking at a
- * valid name segment
- */
-
- CharBuf[0] = *AmlAddress;
-
- if ('0' <= CharBuf[0] && CharBuf[0] <= '9')
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlExecNameSegment: leading digit: %c\n", CharBuf[0]));
- return_ACPI_STATUS (AE_CTRL_PENDING);
- }
-
- DEBUG_PRINT (TRACE_LOAD, ("AmlExecNameSegment: Bytes from stream:\n"));
-
- for (Index = 4;
- (Index > 0) && (AcpiCmValidAcpiCharacter (*AmlAddress));
- --Index)
- {
- CharBuf[4 - Index] = *AmlAddress++;
- DEBUG_PRINT (TRACE_LOAD, ("%c\n", CharBuf[4 - Index]));
- }
-
-
- /* Valid name segment */
-
- if (0 == Index)
- {
- /* Found 4 valid characters */
-
- CharBuf[4] = '\0';
-
- if (NameString)
- {
- STRCAT (NameString, CharBuf);
- DEBUG_PRINT (TRACE_NAMES,
- ("AmlExecNameSegment: Appended to - %s \n", NameString));
- }
-
- else
- {
- DEBUG_PRINT (TRACE_NAMES,
- ("AmlExecNameSegment: No Name string - %s \n", CharBuf));
- }
- }
-
- else if (4 == Index)
- {
- /*
- * First character was not a valid name character,
- * so we are looking at something other than a name.
- */
- DEBUG_PRINT (ACPI_INFO,
- ("AmlExecNameSegment: Leading INT8 not alpha: %02Xh (not a name)\n",
- CharBuf[0]));
- Status = AE_CTRL_PENDING;
- }
-
- else
- {
- /* Segment started with one or more valid characters, but fewer than 4 */
-
- Status = AE_AML_BAD_NAME;
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlExecNameSegment: Bad INT8 %02x in name, at %p\n",
- *AmlAddress, AmlAddress));
- }
-
- DEBUG_PRINT (TRACE_EXEC, ("Leave AcpiAmlExecNameSegment %s \n",
- AcpiCmFormatException (Status)));
-
- *InAmlAddress = AmlAddress;
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlGetNameString
- *
- * PARAMETERS: DataType - Data type to be associated with this name
- *
- * RETURN: Status
- *
- * DESCRIPTION: Get a name, including any prefixes.
- *
- ******************************************************************************/
-
-
-ACPI_STATUS
-AcpiAmlGetNameString (
- OBJECT_TYPE_INTERNAL DataType,
- UINT8 *InAmlAddress,
- NATIVE_CHAR **OutNameString,
- UINT32 *OutNameLength)
-{
- ACPI_STATUS Status = AE_OK;
- UINT8 *AmlAddress = InAmlAddress;
- NATIVE_CHAR *NameString = NULL;
- UINT32 NumSegments;
- UINT32 PrefixCount = 0;
- UINT8 Prefix = 0;
- BOOLEAN HasPrefix = FALSE;
-
-
- FUNCTION_TRACE_PTR ("AmlGetNameString", AmlAddress);
-
-
- if (INTERNAL_TYPE_DEF_FIELD == DataType ||
- INTERNAL_TYPE_BANK_FIELD == DataType ||
- INTERNAL_TYPE_INDEX_FIELD == DataType)
- {
- /* Disallow prefixes for types associated with field names */
-
- NameString = AcpiAmlAllocateNameString (0, 1);
- if (!NameString)
- {
- Status = AE_NO_MEMORY;
- }
- else
- {
- Status = AcpiAmlExecNameSegment (&AmlAddress, NameString);
- }
- }
-
- else
- {
- /*
- * DataType is not a field name.
- * Examine first character of name for root or parent prefix operators
- */
-
- switch (*AmlAddress)
- {
-
- case AML_ROOT_PREFIX:
-
- Prefix = *AmlAddress++;
- DEBUG_PRINT (TRACE_LOAD, ("RootPrefix: %x\n", Prefix));
-
- /*
- * Remember that we have a RootPrefix --
- * see comment in AcpiAmlAllocateNameString()
- */
- PrefixCount = (UINT32) -1;
- HasPrefix = TRUE;
- break;
-
-
- case AML_PARENT_PREFIX:
-
- /* Increment past possibly multiple parent prefixes */
-
- do
- {
- Prefix = *AmlAddress++;
- DEBUG_PRINT (TRACE_LOAD, ("ParentPrefix: %x\n", Prefix));
-
- ++PrefixCount;
-
- } while (*AmlAddress == AML_PARENT_PREFIX);
- HasPrefix = TRUE;
- break;
-
-
- default:
-
- break;
- }
-
-
- /* Examine first character of name for name segment prefix operator */
-
- switch (*AmlAddress)
- {
-
- case AML_DUAL_NAME_PREFIX:
-
- Prefix = *AmlAddress++;
- DEBUG_PRINT (TRACE_LOAD, ("DualNamePrefix: %x\n", Prefix));
-
- NameString = AcpiAmlAllocateNameString (PrefixCount, 2);
- if (!NameString)
- {
- Status = AE_NO_MEMORY;
- break;
- }
-
- /* Indicate that we processed a prefix */
- HasPrefix = TRUE;
-
- Status = AcpiAmlExecNameSegment (&AmlAddress, NameString);
- if (ACPI_SUCCESS (Status))
- {
- Status = AcpiAmlExecNameSegment (&AmlAddress, NameString);
- }
- break;
-
-
- case AML_MULTI_NAME_PREFIX_OP:
-
- Prefix = *AmlAddress++;
- DEBUG_PRINT (TRACE_LOAD, ("MultiNamePrefix: %x\n", Prefix));
-
- /* Fetch count of segments remaining in name path */
-
- NumSegments = *AmlAddress++;
-
- NameString = AcpiAmlAllocateNameString (PrefixCount, NumSegments);
- if (!NameString)
- {
- Status = AE_NO_MEMORY;
- break;
- }
-
- /* Indicate that we processed a prefix */
- HasPrefix = TRUE;
-
- while (NumSegments &&
- (Status = AcpiAmlExecNameSegment (&AmlAddress, NameString)) == AE_OK)
- {
- --NumSegments;
- }
-
- break;
-
-
- case 0:
-
- /* NullName valid as of 8-12-98 ASL/AML Grammar Update */
-
- if (-1 == PrefixCount)
- {
- DEBUG_PRINT (TRACE_EXEC,
- ("AmlDoName: NameSeg is \"\\\" followed by NULL\n"));
- }
-
- /* Consume the NULL byte */
-
- AmlAddress++;
- NameString = AcpiAmlAllocateNameString (PrefixCount, 0);
- if (!NameString)
- {
- Status = AE_NO_MEMORY;
- break;
- }
-
- break;
-
-
- default:
-
- /* Name segment string */
-
- NameString = AcpiAmlAllocateNameString (PrefixCount, 1);
- if (!NameString)
- {
- Status = AE_NO_MEMORY;
- break;
- }
-
- Status = AcpiAmlExecNameSegment (&AmlAddress, NameString);
- break;
-
- } /* Switch (PeekOp ()) */
- }
-
-
- if (AE_CTRL_PENDING == Status && HasPrefix)
- {
- /* Ran out of segments after processing a prefix */
-
- REPORT_ERROR (
- ("AmlDoName: Malformed Name at %p\n", NameString));
- Status = AE_AML_BAD_NAME;
- }
-
-
- *OutNameString = NameString;
- *OutNameLength = (UINT32) (AmlAddress - InAmlAddress);
-
- return_ACPI_STATUS (Status);
-}
-
-
diff --git a/sys/contrib/dev/acpica/Subsystem/Interpreter/amprep.c b/sys/contrib/dev/acpica/Subsystem/Interpreter/amprep.c
deleted file mode 100644
index 13c7d0415118..000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Interpreter/amprep.c
+++ /dev/null
@@ -1,596 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: amprep - ACPI AML (p-code) execution - field prep utilities
- * $Revision: 73 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 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 __AMPREP_C__
-
-#include "acpi.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-#include "acparser.h"
-
-
-#define _COMPONENT INTERPRETER
- MODULE_NAME ("amprep")
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlDecodeFieldAccessType
- *
- * PARAMETERS: Access - Encoded field access bits
- *
- * RETURN: Field granularity (8, 16, or 32)
- *
- * DESCRIPTION: Decode the AccessType bits of a field definition.
- *
- ******************************************************************************/
-
-static UINT32
-AcpiAmlDecodeFieldAccessType (
- UINT32 Access,
- UINT16 Length)
-{
-
- switch (Access)
- {
- case ACCESS_ANY_ACC:
- if (Length <= 8)
- {
- return (8);
- }
- else if (Length <= 16)
- {
- return (16);
- }
- else if (Length <= 32)
- {
- return (32);
- }
- else
- {
- return (8);
- }
- break;
-
- case ACCESS_BYTE_ACC:
- return (8);
- break;
-
- case ACCESS_WORD_ACC:
- return (16);
- break;
-
- case ACCESS_DWORD_ACC:
- return (32);
- break;
-
- default:
- /* Invalid field access type */
-
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlDecodeFieldAccessType: Unknown field access type %x\n",
- Access));
- return (0);
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlPrepCommonFieldObjec
- *
- * PARAMETERS: ObjDesc - The field object
- * FieldFlags - Access, LockRule, or UpdateRule.
- * The format of a FieldFlag is described
- * in the ACPI specification
- * FieldPosition - Field position
- * FieldLength - Field length
- *
- * RETURN: Status
- *
- * DESCRIPTION: Initialize the areas of the field object that are common
- * to the various types of fields.
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiAmlPrepCommonFieldObject (
- ACPI_OPERAND_OBJECT *ObjDesc,
- UINT8 FieldFlags,
- UINT8 FieldAttribute,
- UINT32 FieldPosition,
- UINT32 FieldLength)
-{
- UINT32 Granularity;
-
-
- FUNCTION_TRACE ("AmlPrepCommonFieldObject");
-
-
- /*
- * Note: the structure being initialized is the
- * ACPI_COMMON_FIELD_INFO; Therefore, we can just use the Field union to
- * access this common area. No structure fields outside of the common area
- * are initialized by this procedure.
- */
-
- /* Decode the FieldFlags */
-
- ObjDesc->Field.Access = (UINT8) ((FieldFlags & ACCESS_TYPE_MASK)
- >> ACCESS_TYPE_SHIFT);
- ObjDesc->Field.LockRule = (UINT8) ((FieldFlags & LOCK_RULE_MASK)
- >> LOCK_RULE_SHIFT);
- ObjDesc->Field.UpdateRule = (UINT8) ((FieldFlags & UPDATE_RULE_MASK)
- >> UPDATE_RULE_SHIFT);
-
- /* Other misc fields */
-
- ObjDesc->Field.Length = (UINT16) FieldLength;
- ObjDesc->Field.AccessAttribute = FieldAttribute;
-
- /* Decode the access type so we can compute offsets */
-
- Granularity = AcpiAmlDecodeFieldAccessType (ObjDesc->Field.Access, ObjDesc->Field.Length);
- if (!Granularity)
- {
- return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
- }
-
- /* Access granularity based fields */
-
- ObjDesc->Field.Granularity = (UINT8) Granularity;
- ObjDesc->Field.BitOffset = (UINT8) (FieldPosition % Granularity);
- ObjDesc->Field.Offset = (UINT32) FieldPosition / Granularity;
-
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlPrepDefFieldValue
- *
- * PARAMETERS: Node - Owning Node
- * Region - Region in which field is being defined
- * FieldFlags - Access, LockRule, or UpdateRule.
- * The format of a FieldFlag is described
- * in the ACPI specification
- * FieldPosition - Field position
- * FieldLength - Field length
- *
- * RETURN: Status
- *
- * DESCRIPTION: Construct an ACPI_OPERAND_OBJECT of type DefField and
- * connect it to the parent Node.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlPrepDefFieldValue (
- ACPI_NAMESPACE_NODE *Node,
- ACPI_HANDLE Region,
- UINT8 FieldFlags,
- UINT8 FieldAttribute,
- UINT32 FieldPosition,
- UINT32 FieldLength)
-{
- ACPI_OPERAND_OBJECT *ObjDesc;
- UINT32 Type;
- ACPI_STATUS Status;
-
-
- FUNCTION_TRACE ("AmlPrepDefFieldValue");
-
-
- /* Parameter validation */
-
- if (!Region)
- {
- DEBUG_PRINT (ACPI_ERROR, ("AmlPrepDefFieldValue: null Region\n"));
- return_ACPI_STATUS (AE_AML_NO_OPERAND);
- }
-
- Type = AcpiNsGetType (Region);
- if (Type != ACPI_TYPE_REGION)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlPrepDefFieldValue: Needed Region, found type %X %s\n",
- Type, AcpiCmGetTypeName (Type)));
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
-
- /* Allocate a new object */
-
- ObjDesc = AcpiCmCreateInternalObject (INTERNAL_TYPE_DEF_FIELD);
- if (!ObjDesc)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
-
- /* ObjDesc and Region valid */
-
- DUMP_OPERANDS ((ACPI_OPERAND_OBJECT **) &Node, IMODE_EXECUTE,
- "AmlPrepDefFieldValue", 1, "case DefField");
- DUMP_OPERANDS ((ACPI_OPERAND_OBJECT **) &Region, IMODE_EXECUTE,
- "AmlPrepDefFieldValue", 1, "case DefField");
-
- /* Initialize areas of the object that are common to all fields */
-
- Status = AcpiAmlPrepCommonFieldObject (ObjDesc, FieldFlags, FieldAttribute,
- FieldPosition, FieldLength);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Initialize areas of the object that are specific to this field type */
-
- ObjDesc->Field.Container = AcpiNsGetAttachedObject (Region);
-
- /* An additional reference for the container */
-
- AcpiCmAddReference (ObjDesc->Field.Container);
-
-
- /* Debug info */
-
- DEBUG_PRINT (ACPI_INFO,
- ("AmlPrepDefFieldValue: bitoff=%X off=%X gran=%X\n",
- ObjDesc->Field.BitOffset, ObjDesc->Field.Offset,
- ObjDesc->Field.Granularity));
-
- DEBUG_PRINT (ACPI_INFO,
- ("AmlPrepDefFieldValue: set NamedObj %p (%4.4s) val = %p\n",
- Node, &(Node->Name), ObjDesc));
-
- DUMP_STACK_ENTRY (ObjDesc);
- DUMP_ENTRY (Region, ACPI_INFO);
- DEBUG_PRINT (ACPI_INFO, ("\t%p \n", ObjDesc->Field.Container));
- if (ObjDesc->Field.Container)
- {
- DUMP_STACK_ENTRY (ObjDesc->Field.Container);
- }
- DEBUG_PRINT (ACPI_INFO,
- ("============================================================\n"));
-
- /*
- * Store the constructed descriptor (ObjDesc) into the NamedObj whose
- * handle is on TOS, preserving the current type of that NamedObj.
- */
- Status = AcpiNsAttachObject ((ACPI_HANDLE) Node, ObjDesc,
- (UINT8) AcpiNsGetType ((ACPI_HANDLE) Node));
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlPrepBankFieldValue
- *
- * PARAMETERS: Node - Owning Node
- * Region - Region in which field is being defined
- * BankReg - Bank selection register
- * BankVal - Value to store in selection register
- * FieldFlags - Access, LockRule, or UpdateRule
- * FieldPosition - Field position
- * FieldLength - Field length
- *
- * RETURN: Status
- *
- * DESCRIPTION: Construct an ACPI_OPERAND_OBJECT of type BankField and
- * connect it to the parent Node.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlPrepBankFieldValue (
- ACPI_NAMESPACE_NODE *Node,
- ACPI_HANDLE Region,
- ACPI_HANDLE BankReg,
- UINT32 BankVal,
- UINT8 FieldFlags,
- UINT8 FieldAttribute,
- UINT32 FieldPosition,
- UINT32 FieldLength)
-{
- ACPI_OPERAND_OBJECT *ObjDesc;
- UINT32 Type;
- ACPI_STATUS Status;
-
-
- FUNCTION_TRACE ("AmlPrepBankFieldValue");
-
-
- /* Parameter validation */
-
- if (!Region)
- {
- DEBUG_PRINT (ACPI_ERROR, ("AmlPrepBankFieldValue: null Region\n"));
- return_ACPI_STATUS (AE_AML_NO_OPERAND);
- }
-
- Type = AcpiNsGetType (Region);
- if (Type != ACPI_TYPE_REGION)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlPrepBankFieldValue: Needed Region, found type %X %s\n",
- Type, AcpiCmGetTypeName (Type)));
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
-
- /* Allocate a new object */
-
- ObjDesc = AcpiCmCreateInternalObject (INTERNAL_TYPE_BANK_FIELD);
- if (!ObjDesc)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /* ObjDesc and Region valid */
-
- DUMP_OPERANDS ((ACPI_OPERAND_OBJECT **) &Node, IMODE_EXECUTE,
- "AmlPrepBankFieldValue", 1, "case BankField");
- DUMP_OPERANDS ((ACPI_OPERAND_OBJECT **) &Region, IMODE_EXECUTE,
- "AmlPrepBankFieldValue", 1, "case BankField");
-
- /* Initialize areas of the object that are common to all fields */
-
- Status = AcpiAmlPrepCommonFieldObject (ObjDesc, FieldFlags, FieldAttribute,
- FieldPosition, FieldLength);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Initialize areas of the object that are specific to this field type */
-
- ObjDesc->BankField.Value = BankVal;
- ObjDesc->BankField.Container = AcpiNsGetAttachedObject (Region);
- ObjDesc->BankField.BankSelect = AcpiNsGetAttachedObject (BankReg);
-
- /* An additional reference for the container and bank select */
- /* TBD: [Restructure] is "BankSelect" ever a real internal object?? */
-
- AcpiCmAddReference (ObjDesc->BankField.Container);
- AcpiCmAddReference (ObjDesc->BankField.BankSelect);
-
- /* Debug info */
-
- DEBUG_PRINT (ACPI_INFO,
- ("AmlPrepBankFieldValue: bitoff=%X off=%X gran=%X\n",
- ObjDesc->BankField.BitOffset, ObjDesc->BankField.Offset,
- ObjDesc->Field.Granularity));
-
- DEBUG_PRINT (ACPI_INFO,
- ("AmlPrepBankFieldValue: set NamedObj %p (%4.4s) val = %p\n",
- Node, &(Node->Name), ObjDesc));
-
- DUMP_STACK_ENTRY (ObjDesc);
- DUMP_ENTRY (Region, ACPI_INFO);
- DUMP_ENTRY (BankReg, ACPI_INFO);
- DEBUG_PRINT (ACPI_INFO,
- ("============================================================\n"));
-
- /*
- * Store the constructed descriptor (ObjDesc) into the NamedObj whose
- * handle is on TOS, preserving the current type of that NamedObj.
- */
- Status = AcpiNsAttachObject ((ACPI_HANDLE) Node, ObjDesc,
- (UINT8) AcpiNsGetType ((ACPI_HANDLE) Node));
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlPrepIndexFieldValue
- *
- * PARAMETERS: Node - Owning Node
- * IndexReg - Index register
- * DataReg - Data register
- * FieldFlags - Access, LockRule, or UpdateRule
- * FieldPosition - Field position
- * FieldLength - Field length
- *
- * RETURN: Status
- *
- * DESCRIPTION: Construct an ACPI_OPERAND_OBJECT of type IndexField and
- * connect it to the parent Node.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlPrepIndexFieldValue (
- ACPI_NAMESPACE_NODE *Node,
- ACPI_HANDLE IndexReg,
- ACPI_HANDLE DataReg,
- UINT8 FieldFlags,
- UINT8 FieldAttribute,
- UINT32 FieldPosition,
- UINT32 FieldLength)
-{
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_STATUS Status;
-
-
- FUNCTION_TRACE ("AmlPrepIndexFieldValue");
-
-
- /* Parameter validation */
-
- if (!IndexReg || !DataReg)
- {
- DEBUG_PRINT (ACPI_ERROR, ("AmlPrepIndexFieldValue: null handle\n"));
- return_ACPI_STATUS (AE_AML_NO_OPERAND);
- }
-
- /* Allocate a new object descriptor */
-
- ObjDesc = AcpiCmCreateInternalObject (INTERNAL_TYPE_INDEX_FIELD);
- if (!ObjDesc)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /* Initialize areas of the object that are common to all fields */
-
- Status = AcpiAmlPrepCommonFieldObject (ObjDesc, FieldFlags, FieldAttribute,
- FieldPosition, FieldLength);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Initialize areas of the object that are specific to this field type */
-
- ObjDesc->IndexField.Value = (UINT32) (FieldPosition /
- ObjDesc->Field.Granularity);
- ObjDesc->IndexField.Index = IndexReg;
- ObjDesc->IndexField.Data = DataReg;
-
- /* Debug info */
-
- DEBUG_PRINT (ACPI_INFO,
- ("AmlPrepIndexFieldValue: bitoff=%X off=%X gran=%X\n",
- ObjDesc->IndexField.BitOffset, ObjDesc->IndexField.Offset,
- ObjDesc->Field.Granularity));
-
- DEBUG_PRINT (ACPI_INFO,
- ("AmlPrepIndexFieldValue: set NamedObj %p (%4.4s) val = %p\n",
- Node, &(Node->Name), ObjDesc));
-
- DUMP_STACK_ENTRY (ObjDesc);
- DUMP_ENTRY (IndexReg, ACPI_INFO);
- DUMP_ENTRY (DataReg, ACPI_INFO);
- DEBUG_PRINT (ACPI_INFO,
- ("============================================================\n"));
-
- /*
- * Store the constructed descriptor (ObjDesc) into the NamedObj whose
- * handle is on TOS, preserving the current type of that NamedObj.
- */
- Status = AcpiNsAttachObject ((ACPI_HANDLE) Node, ObjDesc,
- (UINT8) AcpiNsGetType ((ACPI_HANDLE) Node));
-
- return_ACPI_STATUS (Status);
-}
-
diff --git a/sys/contrib/dev/acpica/Subsystem/Interpreter/amregion.c b/sys/contrib/dev/acpica/Subsystem/Interpreter/amregion.c
deleted file mode 100644
index ca019744f26f..000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Interpreter/amregion.c
+++ /dev/null
@@ -1,561 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: amregion - ACPI default OpRegion (address space) handlers
- * $Revision: 44 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 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 __AMREGION_C__
-
-#include "acpi.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-#include "achware.h"
-#include "acevents.h"
-
-
-#define _COMPONENT INTERPRETER
- MODULE_NAME ("amregion")
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlSystemMemorySpaceHandler
- *
- * PARAMETERS: Function - Read or Write operation
- * Address - Where in the space to read or write
- * BitWidth - Field width in bits (8, 16, or 32)
- * Value - Pointer to in or out value
- * HandlerContext - Pointer to Handler's context
- * RegionContext - Pointer to context specific to the
- * accessed region
- *
- * RETURN: Status
- *
- * DESCRIPTION: Handler for the System Memory address space (Op Region)
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlSystemMemorySpaceHandler (
- UINT32 Function,
- ACPI_PHYSICAL_ADDRESS Address,
- UINT32 BitWidth,
- UINT32 *Value,
- void *HandlerContext,
- void *RegionContext)
-{
- ACPI_STATUS Status = AE_OK;
- void *LogicalAddrPtr = NULL;
- MEM_HANDLER_CONTEXT *MemInfo = RegionContext;
- UINT32 Length;
-
-
- FUNCTION_TRACE ("AmlSystemMemorySpaceHandler");
-
-
- /* Validate and translate the bit width */
-
- switch (BitWidth)
- {
- case 8:
- Length = 1;
- break;
-
- case 16:
- Length = 2;
- break;
-
- case 32:
- Length = 4;
- break;
-
- default:
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlSystemMemorySpaceHandler: Invalid SystemMemory width %d\n",
- BitWidth));
- return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
- break;
- }
-
-
- /*
- * Does the request fit into the cached memory mapping?
- * Is 1) Address below the current mapping? OR
- * 2) Address beyond the current mapping?
- */
-
- if ((Address < MemInfo->MappedPhysicalAddress) ||
- (((ACPI_INTEGER) Address + Length) >
- ((ACPI_INTEGER) MemInfo->MappedPhysicalAddress + MemInfo->MappedLength)))
- {
- /*
- * The request cannot be resolved by the current memory mapping;
- * Delete the existing mapping and create a new one.
- */
-
- if (MemInfo->MappedLength)
- {
- /* Valid mapping, delete it */
-
- AcpiOsUnmapMemory (MemInfo->MappedLogicalAddress,
- MemInfo->MappedLength);
- }
-
- MemInfo->MappedLength = 0; /* In case of failure below */
-
- /* Create a new mapping starting at the address given */
-
- Status = AcpiOsMapMemory (Address, SYSMEM_REGION_WINDOW_SIZE,
- (void **) &MemInfo->MappedLogicalAddress);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* TBD: should these pointers go to 64-bit in all cases ? */
-
- MemInfo->MappedPhysicalAddress = Address;
- MemInfo->MappedLength = SYSMEM_REGION_WINDOW_SIZE;
- }
-
-
- /*
- * Generate a logical pointer corresponding to the address we want to
- * access
- */
-
- /* TBD: should these pointers go to 64-bit in all cases ? */
-
- LogicalAddrPtr = MemInfo->MappedLogicalAddress +
- ((ACPI_INTEGER) Address - (ACPI_INTEGER) MemInfo->MappedPhysicalAddress);
-
- /* Perform the memory read or write */
-
- switch (Function)
- {
-
- case ADDRESS_SPACE_READ:
-
- DEBUG_PRINT ((TRACE_OPREGION | VERBOSE_INFO),
- ("Read (%d width) Address=%p\n", BitWidth, Address));
-
- switch (BitWidth)
- {
- case 8:
- *Value = (UINT32)* (UINT8 *) LogicalAddrPtr;
- break;
-
- case 16:
- MOVE_UNALIGNED16_TO_32 (Value, LogicalAddrPtr);
- break;
-
- case 32:
- MOVE_UNALIGNED32_TO_32 (Value, LogicalAddrPtr);
- break;
- }
-
- break;
-
-
- case ADDRESS_SPACE_WRITE:
-
- DEBUG_PRINT ((TRACE_OPREGION | VERBOSE_INFO),
- ("Write (%d width) Address=%p Value %X\n",
- BitWidth, Address, *Value));
-
- switch (BitWidth)
- {
- case 8:
- *(UINT8 *) LogicalAddrPtr = (UINT8) *Value;
- break;
-
- case 16:
- MOVE_UNALIGNED16_TO_16 (LogicalAddrPtr, Value);
- break;
-
- case 32:
- MOVE_UNALIGNED32_TO_32 (LogicalAddrPtr, Value);
- break;
- }
-
- break;
-
-
- default:
- Status = AE_BAD_PARAMETER;
- break;
- }
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlSystemIoSpaceHandler
- *
- * PARAMETERS: Function - Read or Write operation
- * Address - Where in the space to read or write
- * BitWidth - Field width in bits (8, 16, or 32)
- * Value - Pointer to in or out value
- * HandlerContext - Pointer to Handler's context
- * RegionContext - Pointer to context specific to the
- * accessed region
- *
- * RETURN: Status
- *
- * DESCRIPTION: Handler for the System IO address space (Op Region)
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlSystemIoSpaceHandler (
- UINT32 Function,
- ACPI_PHYSICAL_ADDRESS Address,
- UINT32 BitWidth,
- UINT32 *Value,
- void *HandlerContext,
- void *RegionContext)
-{
- ACPI_STATUS Status = AE_OK;
-
-
- FUNCTION_TRACE ("AmlSystemIoSpaceHandler");
-
-
- /* Decode the function parameter */
-
- switch (Function)
- {
-
- case ADDRESS_SPACE_READ:
-
- DEBUG_PRINT ((TRACE_OPREGION | VERBOSE_INFO),
- ("Read(%d width) Address=%p\n", BitWidth, Address));
-
- switch (BitWidth)
- {
- /* I/O Port width */
-
- case 8:
- *Value = (UINT32) AcpiOsIn8 ((ACPI_IO_ADDRESS) Address);
- break;
-
- case 16:
- *Value = (UINT32) AcpiOsIn16 ((ACPI_IO_ADDRESS) Address);
- break;
-
- case 32:
- *Value = AcpiOsIn32 ((ACPI_IO_ADDRESS) Address);
- break;
-
- default:
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlSystemIoSpaceHandler: Invalid SystemIO width %d\n",
- BitWidth));
- Status = AE_AML_OPERAND_VALUE;
- }
-
- break;
-
-
- case ADDRESS_SPACE_WRITE:
-
- DEBUG_PRINT ((TRACE_OPREGION | VERBOSE_INFO),
- ("Write(%d width) Address=%p Value %X\n",
- BitWidth, Address, *Value));
-
- switch (BitWidth)
- {
- /* I/O Port width */
- case 8:
- AcpiOsOut8 ((ACPI_IO_ADDRESS) Address, (UINT8) *Value);
- break;
-
- case 16:
- AcpiOsOut16 ((ACPI_IO_ADDRESS) Address, (UINT16) *Value);
- break;
-
- case 32:
- AcpiOsOut32 ((ACPI_IO_ADDRESS) Address, *Value);
- break;
-
- default:
- DEBUG_PRINT (ACPI_ERROR, (
- "AmlSystemIoSpaceHandler: Invalid SystemIO width %d\n",
- BitWidth));
- Status = AE_AML_OPERAND_VALUE;
- }
-
- break;
-
-
- default:
- Status = AE_BAD_PARAMETER;
- break;
- }
-
- return_ACPI_STATUS (Status);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlPciConfigSpaceHandler
- *
- * PARAMETERS: Function - Read or Write operation
- * Address - Where in the space to read or write
- * BitWidth - Field width in bits (8, 16, or 32)
- * Value - Pointer to in or out value
- * HandlerContext - Pointer to Handler's context
- * RegionContext - Pointer to context specific to the
- * accessed region
- *
- * RETURN: Status
- *
- * DESCRIPTION: Handler for the PCI Config address space (Op Region)
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlPciConfigSpaceHandler (
- UINT32 Function,
- ACPI_PHYSICAL_ADDRESS Address,
- UINT32 BitWidth,
- UINT32 *Value,
- void *HandlerContext,
- void *RegionContext)
-{
- ACPI_STATUS Status = AE_OK;
- UINT32 PciBus;
- UINT32 DevFunc;
- UINT8 PciReg;
- PCI_HANDLER_CONTEXT *PCIContext;
-
-
- FUNCTION_TRACE ("AmlPciConfigSpaceHandler");
-
- /*
- * The arguments to AcpiOs(Read|Write)PciCfg(Byte|Word|Dword) are:
- *
- * SegBus - 0xSSSSBBBB - SSSS is the PCI bus segment
- * BBBB is the PCI bus number
- *
- * DevFunc - 0xDDDDFFFF - DDDD is the PCI device number
- * FFFF is the PCI device function number
- *
- * RegNum - Config space register must be < 40h
- *
- * Value - input value for write, output for read
- *
- */
-
- PCIContext = (PCI_HANDLER_CONTEXT *) RegionContext;
-
- PciBus = LOWORD(PCIContext->Seg) << 16;
- PciBus |= LOWORD(PCIContext->Bus);
-
- DevFunc = PCIContext->DevFunc;
-
- PciReg = (UINT8) Address;
-
- switch (Function)
- {
-
- case ADDRESS_SPACE_READ:
-
- DEBUG_PRINT ((TRACE_OPREGION | VERBOSE_INFO),
- ("R%d S(%04x) B(%04x) DF(%08x) R(%04x)\n", BitWidth,
- PCIContext->Seg,PCIContext->Bus,PCIContext->DevFunc, PciReg));
-
- *Value = 0;
-
- switch (BitWidth)
- {
- /* PCI Register width */
-
- case 8:
- Status = AcpiOsReadPciCfgByte (PciBus, DevFunc, PciReg,
- (UINT8 *) Value);
- break;
-
- case 16:
- Status = AcpiOsReadPciCfgWord (PciBus, DevFunc, PciReg,
- (UINT16 *) Value);
- break;
-
- case 32:
- Status = AcpiOsReadPciCfgDword (PciBus, DevFunc, PciReg,
- Value);
- break;
-
- default:
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlPciConfigSpaceHandler: Invalid PCIConfig width %d\n",
- BitWidth));
- Status = AE_AML_OPERAND_VALUE;
-
- } /* Switch bitWidth */
-
- break;
-
-
- case ADDRESS_SPACE_WRITE:
-
- DEBUG_PRINT ((TRACE_OPREGION | VERBOSE_INFO),
- ("W%d S(%04x) B(%04x) DF(%08x) R(%04x) D(%08x)\n", BitWidth,
- PCIContext->Seg,PCIContext->Bus,PCIContext->DevFunc,
- PciReg,*Value));
-
- switch (BitWidth)
- {
- /* PCI Register width */
-
- case 8:
- Status = AcpiOsWritePciCfgByte (PciBus, DevFunc, PciReg,
- *(UINT8 *) Value);
- break;
-
- case 16:
- Status = AcpiOsWritePciCfgWord (PciBus, DevFunc, PciReg,
- *(UINT16 *) Value);
- break;
-
- case 32:
- Status = AcpiOsWritePciCfgDword (PciBus, DevFunc, PciReg,
- *Value);
- break;
-
- default:
- DEBUG_PRINT (ACPI_ERROR, (
- "AmlPciConfigSpaceHandler: Invalid PCIConfig width %d\n",
- BitWidth));
- Status = AE_AML_OPERAND_VALUE;
-
- } /* Switch bitWidth */
-
- break;
-
-
- default:
-
- Status = AE_BAD_PARAMETER;
- break;
-
- }
-
- return_ACPI_STATUS (Status);
-}
-
diff --git a/sys/contrib/dev/acpica/Subsystem/Interpreter/amresnte.c b/sys/contrib/dev/acpica/Subsystem/Interpreter/amresnte.c
deleted file mode 100644
index 659d6f6ba944..000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Interpreter/amresnte.c
+++ /dev/null
@@ -1,697 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: amresnte - AML Interpreter object resolution
- * $Revision: 27 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 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 __AMRESNTE_C__
-
-#include "acpi.h"
-#include "amlcode.h"
-#include "acparser.h"
-#include "acdispat.h"
-#include "acinterp.h"
-#include "acnamesp.h"
-#include "actables.h"
-#include "acevents.h"
-
-
-#define _COMPONENT INTERPRETER
- MODULE_NAME ("amresnte")
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlResolveNodeToValue
- *
- * PARAMETERS: StackPtr - Pointer to a location on a stack that contains
- * a pointer to an Node
- *
- * RETURN: Status
- *
- * DESCRIPTION: Resolve a ACPI_NAMESPACE_NODE (Node,
- * A.K.A. a "direct name pointer")
- *
- * Note: for some of the data types, the pointer attached to the Node
- * can be either a pointer to an actual internal object or a pointer into the
- * AML stream itself. These types are currently:
- *
- * ACPI_TYPE_INTEGER
- * ACPI_TYPE_STRING
- * ACPI_TYPE_BUFFER
- * ACPI_TYPE_MUTEX
- * ACPI_TYPE_PACKAGE
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlResolveNodeToValue (
- ACPI_NAMESPACE_NODE **StackPtr,
- ACPI_WALK_STATE *WalkState)
-
-{
- ACPI_STATUS Status = AE_OK;
- ACPI_OPERAND_OBJECT *ValDesc = NULL;
- ACPI_OPERAND_OBJECT *ObjDesc = NULL;
- ACPI_NAMESPACE_NODE *Node;
- UINT8 *AmlPointer = NULL;
- OBJECT_TYPE_INTERNAL EntryType;
- BOOLEAN Locked;
- BOOLEAN AttachedAmlPointer = FALSE;
- UINT8 AmlOpcode = 0;
- ACPI_INTEGER TempVal;
- OBJECT_TYPE_INTERNAL ObjectType;
-
-
- FUNCTION_TRACE ("AmlResolveEntryToValue");
-
- Node = *StackPtr;
-
-
- /*
- * The stack pointer is a "Direct name ptr", and points to a
- * a ACPI_NAMESPACE_NODE (Node). Get the pointer that is attached to
- * the Node.
- */
-
- ValDesc = AcpiNsGetAttachedObject ((ACPI_HANDLE) Node);
- EntryType = AcpiNsGetType ((ACPI_HANDLE) Node);
-
- DEBUG_PRINT (TRACE_EXEC,
- ("AmlResolveEntryToValue: Entry=%p ValDesc=%p Type=%X\n",
- Node, ValDesc, EntryType));
-
- /*
- * The ValDesc attached to the Node can be either:
- * 1) An internal ACPI object
- * 2) A pointer into the AML stream (into one of the ACPI system tables)
- */
-
- if (AcpiTbSystemTablePointer (ValDesc))
- {
- AttachedAmlPointer = TRUE;
- AmlOpcode = *((UINT8 *) ValDesc);
- AmlPointer = ((UINT8 *) ValDesc) + 1;
-
- DEBUG_PRINT (TRACE_EXEC,
- ("AmlResolveEntryToValue: Unparsed AML: %p Len=%X\n",
- AmlOpcode, AmlPointer));
- }
-
-
- /*
- * Several EntryTypes do not require further processing, so
- * we will return immediately
- */
- /* Devices rarely have an attached object, return the Node
- * and Method locals and arguments have a pseudo-Node
- */
- if (EntryType == ACPI_TYPE_DEVICE ||
- (Node->Flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL)))
- {
- return_ACPI_STATUS (AE_OK);
- }
-
- if (!ValDesc)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlResolveEntryToValue: No object attached to node %p\n",
- Node));
- return_ACPI_STATUS (AE_AML_NO_OPERAND);
- }
-
- /*
- * Action is based on the type of the Node, which indicates the type
- * of the attached object or pointer
- */
- switch (EntryType)
- {
-
- case ACPI_TYPE_PACKAGE:
-
- if (AttachedAmlPointer)
- {
- /*
- * This means that the package initialization is not parsed
- * -- should not happen
- */
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlResolveEntryToValue: Unparsed Packages not supported!\n"));
- return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
- }
-
- /* ValDesc is an internal object in all cases by the time we get here */
-
- if (ACPI_TYPE_PACKAGE != ValDesc->Common.Type)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlResolveEntryToValue: Object not a package, type %X\n",
- ValDesc->Common.Type));
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
-
- /* Return an additional reference to the object */
-
- ObjDesc = ValDesc;
- AcpiCmAddReference (ObjDesc);
- break;
-
-
- case ACPI_TYPE_BUFFER:
-
- if (AttachedAmlPointer)
- {
- /*
- * This means that the buffer initialization is not parsed
- * -- should not happen
- */
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlResolveEntryToValue: Unparsed Buffers not supported!\n"));
- return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
- }
-
- /* ValDesc is an internal object in all cases by the time we get here */
-
- if (ACPI_TYPE_BUFFER != ValDesc->Common.Type)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlResolveEntryToValue: Object not a buffer, type %X\n",
- ValDesc->Common.Type));
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
-
- /* Return an additional reference to the object */
-
- ObjDesc = ValDesc;
- AcpiCmAddReference (ObjDesc);
- break;
-
-
- case ACPI_TYPE_STRING:
-
- if (AttachedAmlPointer)
- {
- /* Allocate a new string object */
-
- ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_STRING);
- if (!ObjDesc)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /* Init the internal object */
-
- ObjDesc->String.Pointer = (NATIVE_CHAR *) AmlPointer;
- ObjDesc->String.Length = STRLEN (ObjDesc->String.Pointer);
- }
-
- else
- {
- if (ACPI_TYPE_STRING != ValDesc->Common.Type)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlResolveEntryToValue: Object not a string, type %X\n",
- ValDesc->Common.Type));
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
-
- /* Return an additional reference to the object */
-
- ObjDesc = ValDesc;
- AcpiCmAddReference (ObjDesc);
- }
-
- break;
-
-
- case ACPI_TYPE_INTEGER:
-
- DEBUG_PRINT (TRACE_EXEC, ("AmlResolveEntryToValue: case Number \n"));
-
- /*
- * The Node has an attached internal object, make sure that it's a
- * number
- */
-
- if (ACPI_TYPE_INTEGER != ValDesc->Common.Type)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlResolveToValue: Object not a Number, type %X\n",
- ValDesc->Common.Type));
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
-
- /* Return an additional reference to the object */
-
- ObjDesc = ValDesc;
- AcpiCmAddReference (ObjDesc);
- break;
-
-
- case INTERNAL_TYPE_DEF_FIELD:
-
- /*
- * TBD: [Investigate] Is this the correct solution?
- *
- * This section was extended to convert to generic buffer if
- * the return length is greater than 32 bits, but still allows
- * for returning a type Number for smaller values because the
- * caller can then apply arithmetic operators on those fields.
- *
- * XXX - Implementation limitation: Fields are implemented as type
- * XXX - Number, but they really are supposed to be type Buffer.
- * XXX - The two are interchangeable only for lengths <= 32 bits.
- */
- if(ValDesc->Field.Length > 32)
- {
- ObjectType = ACPI_TYPE_BUFFER;
- }
- else
- {
- ObjectType = ACPI_TYPE_INTEGER;
- }
-
- /*
- * Create the destination buffer object and the buffer space.
- */
- ObjDesc = AcpiCmCreateInternalObject (ObjectType);
- if (!ObjDesc)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /*
- * Fill in the object specific details
- */
- if (ACPI_TYPE_BUFFER == ObjectType)
- {
- ObjDesc->Buffer.Pointer = AcpiCmCallocate (ValDesc->Field.Length);
- if (!ObjDesc->Buffer.Pointer)
- {
- AcpiCmRemoveReference(ObjDesc);
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- ObjDesc->Buffer.Length = ValDesc->Field.Length;
-
- Status = AcpiAmlAccessNamedField (ACPI_READ, (ACPI_HANDLE) Node,
- ObjDesc->Buffer.Pointer, ObjDesc->Buffer.Length);
-
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- }
- else
- {
- Status = AcpiAmlAccessNamedField (ACPI_READ, (ACPI_HANDLE) Node,
- &TempVal, sizeof (TempVal));
-
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- ObjDesc->Integer.Value = TempVal;
- }
-
-
- DEBUG_PRINT (TRACE_EXEC,
- ("AmlResolveEntryToValue: DefField Entry=%p ValDesc=%p Type=%X\n",
- Node, ValDesc, EntryType));
- break;
-
-
- case INTERNAL_TYPE_BANK_FIELD:
-
- if (AttachedAmlPointer)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlResolveEntryToValue: BankField cannot be an Aml ptr\n"));
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
-
- if (INTERNAL_TYPE_BANK_FIELD != ValDesc->Common.Type)
- {
- DEBUG_PRINT (ACPI_ERROR, (
- "AmlResolveToValue: Object not a BankField, type %X\n",
- ValDesc->Common.Type));
-
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
-
-
- /* Get the global lock if needed */
-
- ObjDesc = (ACPI_OPERAND_OBJECT *) *StackPtr;
- Locked = AcpiAmlAcquireGlobalLock (ObjDesc->FieldUnit.LockRule);
-
- /* Set Index value to select proper Data register */
- /* perform the update */
-
- Status = AcpiAmlAccessNamedField (ACPI_WRITE,
- ValDesc->BankField.BankSelect, &ValDesc->BankField.Value,
- sizeof (ValDesc->BankField.Value));
-
- AcpiAmlReleaseGlobalLock (Locked);
-
-
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Read Data value */
-
- Status = AcpiAmlAccessNamedField (ACPI_READ,
- (ACPI_HANDLE) ValDesc->BankField.Container,
- &TempVal, sizeof (TempVal));
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Create an object for the result */
-
- ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER);
- if (!ObjDesc)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- ObjDesc->Integer.Value = TempVal;
- break;
-
-
- case INTERNAL_TYPE_INDEX_FIELD:
-
- if (AttachedAmlPointer)
- {
- DEBUG_PRINT (ACPI_ERROR, ("AmlResolveEntryToValue: Internal - IndexField cannot be an Aml ptr\n"));
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
-
- if (INTERNAL_TYPE_INDEX_FIELD != ValDesc->Common.Type)
- {
- DEBUG_PRINT (ACPI_ERROR, (
- "AmlResolveToValue: Object not an IndexField, type %X\n",
- ValDesc->Common.Type));
-
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
-
-
- /* Set Index value to select proper Data register */
- /* Get the global lock if needed */
-
- ObjDesc = (ACPI_OPERAND_OBJECT *) *StackPtr;
- Locked = AcpiAmlAcquireGlobalLock (ObjDesc->FieldUnit.LockRule);
-
- /* Perform the update */
-
- Status = AcpiAmlAccessNamedField (ACPI_WRITE,
- ValDesc->IndexField.Index, &ValDesc->IndexField.Value,
- sizeof (ValDesc->IndexField.Value));
-
- AcpiAmlReleaseGlobalLock (Locked);
-
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Read Data value */
-
- Status = AcpiAmlAccessNamedField (ACPI_READ, ValDesc->IndexField.Data,
- &TempVal, sizeof (TempVal));
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Create an object for the result */
-
- ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER);
- if (!ObjDesc)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- ObjDesc->Integer.Value = TempVal;
- break;
-
-
- case ACPI_TYPE_FIELD_UNIT:
-
- if (AttachedAmlPointer)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlResolveEntryToValue: FieldUnit cannot be an Aml ptr\n"));
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
-
- if (ValDesc->Common.Type != (UINT8) EntryType)
- {
- DEBUG_PRINT (ACPI_ERROR, (
- "AmlResolveToValue: Object type %X not same as EntryType %X\n",
- ValDesc->Common.Type, EntryType));
-
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- break;
- }
-
- /* Create object for result */
-
- ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_ANY);
- if (!ObjDesc)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- Status = AcpiAmlGetFieldUnitValue (ValDesc, ObjDesc);
- if (ACPI_FAILURE (Status))
- {
- AcpiCmRemoveReference (ObjDesc);
- return_ACPI_STATUS (Status);
- }
-
- break;
-
-
- /*
- * For these objects, just return the object attached to the Node
- */
-
- case ACPI_TYPE_MUTEX:
- case ACPI_TYPE_METHOD:
- case ACPI_TYPE_POWER:
- case ACPI_TYPE_PROCESSOR:
- case ACPI_TYPE_THERMAL:
- case ACPI_TYPE_EVENT:
- case ACPI_TYPE_REGION:
-
-
- /* Return an additional reference to the object */
-
- ObjDesc = ValDesc;
- AcpiCmAddReference (ObjDesc);
- break;
-
-
- /* TYPE_Any is untyped, and thus there is no object associated with it */
-
- case ACPI_TYPE_ANY:
-
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlResolveEntryToValue: Untyped entry %p, no attached object!\n",
- Node));
-
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */
- break;
-
-
- /*
- * The only named references allowed are named constants
- *
- * e.g. Name (\OSFL, Ones)
- */
- case INTERNAL_TYPE_REFERENCE:
-
- switch (ValDesc->Reference.OpCode)
- {
-
- case AML_ZERO_OP:
-
- TempVal = 0;
- break;
-
-
- case AML_ONE_OP:
-
- TempVal = 1;
- break;
-
-
- case AML_ONES_OP:
-
- TempVal = ACPI_INTEGER_MAX;
- break;
-
-
- default:
-
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlResolveToValue/Number: Unsupported reference opcode %X\n",
- ValDesc->Reference.OpCode));
-
- return_ACPI_STATUS (AE_AML_BAD_OPCODE);
- }
-
- /* Create object for result */
-
- ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER);
- if (!ObjDesc)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- ObjDesc->Integer.Value = TempVal;
-
- /* Truncate value if we are executing from a 32-bit ACPI table */
-
- AcpiAmlTruncateFor32bitTable (ObjDesc, WalkState);
- break;
-
-
- /* Default case is for unknown types */
-
- default:
-
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlResolveEntryToValue: Node %p - Unknown object type %X\n",
- Node, EntryType));
-
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
-
- } /* switch (EntryType) */
-
-
- /* Put the object descriptor on the stack */
-
- *StackPtr = (void *) ObjDesc;
-
- return_ACPI_STATUS (Status);
-}
-
-
diff --git a/sys/contrib/dev/acpica/Subsystem/Interpreter/amresolv.c b/sys/contrib/dev/acpica/Subsystem/Interpreter/amresolv.c
deleted file mode 100644
index 26ecd3185f53..000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Interpreter/amresolv.c
+++ /dev/null
@@ -1,633 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: amresolv - AML Interpreter object resolution
- * $Revision: 81 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 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 __AMRESOLV_C__
-
-#include "acpi.h"
-#include "amlcode.h"
-#include "acparser.h"
-#include "acdispat.h"
-#include "acinterp.h"
-#include "acnamesp.h"
-#include "actables.h"
-#include "acevents.h"
-
-
-#define _COMPONENT INTERPRETER
- MODULE_NAME ("amresolv")
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlGetFieldUnitValue
- *
- * PARAMETERS: *FieldDesc - Pointer to a FieldUnit
- * *ResultDesc - Pointer to an empty descriptor
- * which will become a Number
- * containing the field's value.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Retrieve the value from a FieldUnit
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlGetFieldUnitValue (
- ACPI_OPERAND_OBJECT *FieldDesc,
- ACPI_OPERAND_OBJECT *ResultDesc)
-{
- ACPI_STATUS Status = AE_OK;
- UINT32 Mask;
- UINT8 *Location = NULL;
- BOOLEAN Locked = FALSE;
-
-
- FUNCTION_TRACE ("AmlGetFieldUnitValue");
-
-
- if (!FieldDesc)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlGetFieldUnitValue: Internal error - null field pointer\n"));
- Status = AE_AML_NO_OPERAND;
- }
-
- if (!(FieldDesc->Common.Flags & AOPOBJ_DATA_VALID))
- {
- Status = AcpiDsGetFieldUnitArguments (FieldDesc);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- }
-
- if (!FieldDesc->FieldUnit.Container)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlGetFieldUnitValue: Internal error - null container pointer\n"));
- Status = AE_AML_INTERNAL;
- }
-
- else if (ACPI_TYPE_BUFFER != FieldDesc->FieldUnit.Container->Common.Type)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlGetFieldUnitValue: Internal error - container is not a Buffer\n"));
- Status = AE_AML_OPERAND_TYPE;
- }
-
- else if (!ResultDesc)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlGetFieldUnitValue: Internal error - null result pointer\n"));
- Status = AE_AML_INTERNAL;
- }
-
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
-
- /* Get the global lock if needed */
-
- Locked = AcpiAmlAcquireGlobalLock (FieldDesc->FieldUnit.LockRule);
-
- /* Field location is (base of buffer) + (byte offset) */
-
- Location = FieldDesc->FieldUnit.Container->Buffer.Pointer
- + FieldDesc->FieldUnit.Offset;
-
- /*
- * Construct Mask with as many 1 bits as the field width
- *
- * NOTE: Only the bottom 5 bits are valid for a shift operation, so
- * special care must be taken for any shift greater than 31 bits.
- *
- * TBD: [Unhandled] Fields greater than 32-bits will not work.
- */
-
- if (FieldDesc->FieldUnit.Length < 32)
- {
- Mask = ((UINT32) 1 << FieldDesc->FieldUnit.Length) - (UINT32) 1;
- }
- else
- {
- Mask = ACPI_UINT32_MAX;
- }
-
- ResultDesc->Integer.Type = (UINT8) ACPI_TYPE_INTEGER;
-
- /* Get the 32 bit value at the location */
-
- MOVE_UNALIGNED32_TO_32 (&ResultDesc->Integer.Value, Location);
-
- /*
- * Shift the 32-bit word containing the field, and mask off the
- * resulting value
- */
-
- ResultDesc->Integer.Value =
- (ResultDesc->Integer.Value >> FieldDesc->FieldUnit.BitOffset) & Mask;
-
- DEBUG_PRINT (ACPI_INFO,
- ("** Read from buffer %p byte %ld bit %d width %d addr %p mask %08lx val %08lx\n",
- FieldDesc->FieldUnit.Container->Buffer.Pointer,
- FieldDesc->FieldUnit.Offset,
- FieldDesc->FieldUnit.BitOffset,
- FieldDesc->FieldUnit.Length,
- Location, Mask, ResultDesc->Integer.Value));
-
- /* Release global lock if we acquired it earlier */
-
- AcpiAmlReleaseGlobalLock (Locked);
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlResolveToValue
- *
- * PARAMETERS: **StackPtr - Points to entry on ObjStack, which can
- * be either an (ACPI_OPERAND_OBJECT *)
- * or an ACPI_HANDLE.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert Reference objects to values
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlResolveToValue (
- ACPI_OPERAND_OBJECT **StackPtr,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_STATUS Status = AE_OK;
-
-
- FUNCTION_TRACE_PTR ("AmlResolveToValue", StackPtr);
-
-
- if (!StackPtr || !*StackPtr)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlResolveToValue: Internal error - null pointer\n"));
- return_ACPI_STATUS (AE_AML_NO_OPERAND);
- }
-
-
- /*
- * The entity pointed to by the StackPtr can be either
- * 1) A valid ACPI_OPERAND_OBJECT, or
- * 2) A ACPI_NAMESPACE_NODE (NamedObj)
- */
-
- if (VALID_DESCRIPTOR_TYPE (*StackPtr, ACPI_DESC_TYPE_INTERNAL))
- {
-
- Status = AcpiAmlResolveObjectToValue (StackPtr, WalkState);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- }
-
- /*
- * Object on the stack may have changed if AcpiAmlResolveObjectToValue()
- * was called (i.e., we can't use an _else_ here.)
- */
-
- if (VALID_DESCRIPTOR_TYPE (*StackPtr, ACPI_DESC_TYPE_NAMED))
- {
- Status = AcpiAmlResolveNodeToValue ((ACPI_NAMESPACE_NODE **) StackPtr, WalkState);
- }
-
-
- DEBUG_PRINT (ACPI_INFO,
- ("AmlResolveToValue: Returning resolved object %p\n", *StackPtr));
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlResolveObjectToValue
- *
- * PARAMETERS: StackPtr - Pointer to a stack location that contains a
- * ptr to an internal object.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Retrieve the value from an internal object. The Reference type
- * uses the associated AML opcode to determine the value.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlResolveObjectToValue (
- ACPI_OPERAND_OBJECT **StackPtr,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_OPERAND_OBJECT *StackDesc;
- ACPI_STATUS Status = AE_OK;
- ACPI_HANDLE TempHandle = NULL;
- ACPI_OPERAND_OBJECT *ObjDesc = NULL;
- UINT32 Index = 0;
- UINT16 Opcode;
-
-
- FUNCTION_TRACE ("AmlResolveObjectToValue");
-
-
- StackDesc = *StackPtr;
-
- /* This is an ACPI_OPERAND_OBJECT */
-
- switch (StackDesc->Common.Type)
- {
-
- case INTERNAL_TYPE_REFERENCE:
-
- Opcode = StackDesc->Reference.OpCode;
-
- switch (Opcode)
- {
-
- case AML_NAME_OP:
-
- /*
- * Convert indirect name ptr to a direct name ptr.
- * Then, AcpiAmlResolveNodeToValue can be used to get the value
- */
-
- TempHandle = StackDesc->Reference.Object;
-
- /* Delete the Reference Object */
-
- AcpiCmRemoveReference (StackDesc);
-
- /* Put direct name pointer onto stack and exit */
-
- (*StackPtr) = TempHandle;
- Status = AE_OK;
- break;
-
-
- case AML_LOCAL_OP:
-
- Index = StackDesc->Reference.Offset;
-
- /*
- * Get the local from the method's state info
- * Note: this increments the local's object reference count
- */
-
- Status = AcpiDsMethodDataGetValue (MTH_TYPE_LOCAL, Index,
- WalkState, &ObjDesc);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /*
- * Now we can delete the original Reference Object and
- * replace it with the resolve value
- */
-
- AcpiCmRemoveReference (StackDesc);
- *StackPtr = ObjDesc;
-
- DEBUG_PRINT (ACPI_INFO,
- ("AmlResolveObjectToValue: [Local%d] ValueObj is %p\n",
- Index, ObjDesc));
-
- if (ACPI_TYPE_INTEGER == ObjDesc->Common.Type)
- {
- /* Value is a Number */
-
- DEBUG_PRINT (ACPI_INFO,
- ("AmlResolveObjectToValue: [Local%d] value=%X \n",
- Index, ObjDesc->Integer.Value));
- }
-
- break;
-
-
- case AML_ARG_OP:
-
- Index = StackDesc->Reference.Offset;
-
-
- /*
- * Get the argument from the method's state info
- * Note: this increments the object reference count
- */
-
- Status = AcpiDsMethodDataGetValue (MTH_TYPE_ARG, Index,
- WalkState, &ObjDesc);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /*
- * Now we can delete the original Reference Object and
- * replace it with the resolve value
- */
-
- AcpiCmRemoveReference (StackDesc);
- *StackPtr = ObjDesc;
-
- DEBUG_PRINT (TRACE_EXEC,
- ("AmlResolveObjectToValue: [Arg%d] ValueObj is %p\n",
- Index, ObjDesc));
-
- if (ACPI_TYPE_INTEGER == ObjDesc->Common.Type)
- {
- /* Value is a Number */
-
- DEBUG_PRINT (ACPI_INFO,
- ("AmlResolveObjectToValue: [Arg%d] value=%X\n",
- Index, ObjDesc->Integer.Value));
- }
-
- break;
-
-
- /*
- * TBD: [Restructure] These next three opcodes change the type of
- * the object, which is actually a no-no.
- */
-
- case AML_ZERO_OP:
-
- StackDesc->Common.Type = (UINT8) ACPI_TYPE_INTEGER;
- StackDesc->Integer.Value = 0;
- break;
-
-
- case AML_ONE_OP:
-
- StackDesc->Common.Type = (UINT8) ACPI_TYPE_INTEGER;
- StackDesc->Integer.Value = 1;
- break;
-
-
- case AML_ONES_OP:
-
- StackDesc->Common.Type = (UINT8) ACPI_TYPE_INTEGER;
- StackDesc->Integer.Value = ACPI_INTEGER_MAX;
-
- /* Truncate value if we are executing from a 32-bit ACPI table */
-
- AcpiAmlTruncateFor32bitTable (StackDesc, WalkState);
- break;
-
-
- case AML_INDEX_OP:
-
- switch (StackDesc->Reference.TargetType)
- {
- case ACPI_TYPE_BUFFER_FIELD:
-
- /* Just return - leave the Reference on the stack */
- break;
-
-
- case ACPI_TYPE_PACKAGE:
- ObjDesc = *StackDesc->Reference.Where;
- if (ObjDesc)
- {
- /*
- * Valid obj descriptor, copy pointer to return value
- * (i.e., dereference the package index)
- * Delete the ref object, increment the returned object
- */
- AcpiCmRemoveReference (StackDesc);
- AcpiCmAddReference (ObjDesc);
- *StackPtr = ObjDesc;
- }
-
- else
- {
- /*
- * A NULL object descriptor means an unitialized element of
- * the package, can't deref it
- */
-
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlResolveObjectToValue: Attempt to deref an Index to NULL pkg element Idx=%p\n", StackDesc));
- Status = AE_AML_UNINITIALIZED_ELEMENT;
- }
- break;
-
- default:
- /* Invalid reference OBJ*/
-
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlResolveObjectToValue: Unknown TargetType %X in Index/Reference obj %p\n",
- StackDesc->Reference.TargetType, StackDesc));
- Status = AE_AML_INTERNAL;
- break;
- }
-
- break;
-
-
- case AML_DEBUG_OP:
-
- /* Just leave the object as-is */
- break;
-
-
- default:
-
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlResolveObjectToValue: Unknown Reference object subtype %02X in %p\n",
- Opcode, StackDesc));
- Status = AE_AML_INTERNAL;
-
- } /* switch (Opcode) */
-
-
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- break; /* case INTERNAL_TYPE_REFERENCE */
-
-
- case ACPI_TYPE_FIELD_UNIT:
-
- ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_ANY);
- if (!ObjDesc)
- {
- /* Descriptor allocation failure */
-
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- Status = AcpiAmlGetFieldUnitValue (StackDesc, ObjDesc);
- if (ACPI_FAILURE (Status))
- {
- AcpiCmRemoveReference (ObjDesc);
- ObjDesc = NULL;
- }
-
- *StackPtr = (void *) ObjDesc;
- break;
-
-
- case INTERNAL_TYPE_BANK_FIELD:
-
- ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_ANY);
- if (!ObjDesc)
- {
- /* Descriptor allocation failure */
-
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- Status = AcpiAmlGetFieldUnitValue (StackDesc, ObjDesc);
- if (ACPI_FAILURE (Status))
- {
- AcpiCmRemoveReference (ObjDesc);
- ObjDesc = NULL;
- }
-
- *StackPtr = (void *) ObjDesc;
- break;
-
-
- /* TBD: [Future] - may need to handle IndexField, and DefField someday */
-
- default:
-
- break;
-
- } /* switch (StackDesc->Common.Type) */
-
-
- return_ACPI_STATUS (Status);
-}
-
-
diff --git a/sys/contrib/dev/acpica/Subsystem/Interpreter/amresop.c b/sys/contrib/dev/acpica/Subsystem/Interpreter/amresop.c
deleted file mode 100644
index d57d2fb785b8..000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Interpreter/amresop.c
+++ /dev/null
@@ -1,670 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: amresop - AML Interpreter operand/object resolution
- * $Revision: 22 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 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 __AMRESOP_C__
-
-#include "acpi.h"
-#include "amlcode.h"
-#include "acparser.h"
-#include "acdispat.h"
-#include "acinterp.h"
-#include "acnamesp.h"
-#include "actables.h"
-#include "acevents.h"
-
-
-#define _COMPONENT INTERPRETER
- MODULE_NAME ("amresop")
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlCheckObjectType
- *
- * PARAMETERS: TypeNeeded Object type needed
- * ThisType Actual object type
- * Object Object pointer
- *
- * RETURN: Status
- *
- * DESCRIPTION: Check required type against actual type
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlCheckObjectType (
- ACPI_OBJECT_TYPE TypeNeeded,
- ACPI_OBJECT_TYPE ThisType,
- void *Object)
-{
-
-
- if (TypeNeeded == ACPI_TYPE_ANY)
- {
- /* All types OK, so we don't perform any typechecks */
-
- return (AE_OK);
- }
-
-
- if (TypeNeeded != ThisType)
- {
- DEBUG_PRINT (ACPI_INFO,
- ("AmlResolveOperands: Needed [%s], found [%s] %p\n",
- AcpiCmGetTypeName (TypeNeeded),
- AcpiCmGetTypeName (ThisType), Object));
-
- return (AE_AML_OPERAND_TYPE);
- }
-
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlResolveOperands
- *
- * PARAMETERS: Opcode Opcode being interpreted
- * StackPtr Top of operand stack
- *
- * RETURN: Status
- *
- * DESCRIPTION: Convert stack entries to required types
- *
- * Each nibble in ArgTypes represents one required operand
- * and indicates the required Type:
- *
- * The corresponding stack entry will be converted to the
- * required type if possible, else return an exception
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlResolveOperands (
- UINT16 Opcode,
- ACPI_OPERAND_OBJECT **StackPtr,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_STATUS Status = AE_OK;
- UINT8 ObjectType;
- ACPI_HANDLE TempHandle;
- UINT32 ArgTypes;
- ACPI_OPCODE_INFO *OpInfo;
- UINT32 ThisArgType;
- ACPI_OBJECT_TYPE TypeNeeded;
-
-
- FUNCTION_TRACE_U32 ("AmlResolveOperands", Opcode);
-
-
- OpInfo = AcpiPsGetOpcodeInfo (Opcode);
- if (ACPI_GET_OP_TYPE (OpInfo) != ACPI_OP_TYPE_OPCODE)
- {
- return_ACPI_STATUS (AE_AML_BAD_OPCODE);
- }
-
-
- ArgTypes = OpInfo->RuntimeArgs;
- if (ArgTypes == ARGI_INVALID_OPCODE)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlResolveOperands: Internal error - %X is not a valid AML opcode\n", Opcode));
-
- return_ACPI_STATUS (AE_AML_INTERNAL);
- }
-
- DEBUG_PRINT (TRACE_EXEC,
- ("AmlResolveOperands: Opcode %X OperandTypes=%X \n",
- Opcode, ArgTypes));
-
-
- /*
- * Normal exit is with *Types == '\0' at end of string.
- * Function will return an exception from within the loop upon
- * finding an entry which is not, and cannot be converted
- * to, the required type; if stack underflows; or upon
- * finding a NULL stack entry (which "should never happen").
- */
-
- while (GET_CURRENT_ARG_TYPE (ArgTypes))
- {
- if (!StackPtr || !*StackPtr)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlResolveOperands: Internal error - null stack entry at %X\n", StackPtr));
-
- return_ACPI_STATUS (AE_AML_INTERNAL);
- }
-
- /* Extract useful items */
-
- ObjDesc = *StackPtr;
-
- /* Decode the descriptor type */
-
- if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED))
- {
- /* Node */
-
- ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
- }
-
- else if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_INTERNAL))
- {
- /* ACPI internal object */
-
- ObjectType = ObjDesc->Common.Type;
-
- /* Check for bad ACPI_OBJECT_TYPE */
-
- if (!AcpiAmlValidateObjectType (ObjectType))
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlResolveOperands: Bad operand object type [%X]\n",
- ObjectType));
-
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
-
- if (ObjectType == (UINT8) INTERNAL_TYPE_REFERENCE)
- {
- /*
- * Decode the Reference
- */
-
- OpInfo = AcpiPsGetOpcodeInfo (Opcode);
- if (ACPI_GET_OP_TYPE (OpInfo) != ACPI_OP_TYPE_OPCODE)
- {
- return_ACPI_STATUS (AE_AML_BAD_OPCODE);
- }
-
-
- switch (ObjDesc->Reference.OpCode)
- {
- case AML_ZERO_OP:
- case AML_ONE_OP:
- case AML_ONES_OP:
- case AML_DEBUG_OP:
- case AML_NAME_OP:
- case AML_INDEX_OP:
- case AML_ARG_OP:
- case AML_LOCAL_OP:
-
- DEBUG_ONLY_MEMBERS (DEBUG_PRINT (ACPI_INFO,
- ("Reference Opcode: %s\n", OpInfo->Name)));
- break;
-
- default:
- DEBUG_PRINT (ACPI_INFO,
- ("Reference Opcode: Unknown [%02x]\n",
- ObjDesc->Reference.OpCode));
-
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- break;
- }
- }
- }
-
- else
- {
- /* Invalid descriptor */
-
- DEBUG_PRINT (ACPI_ERROR,
- ("Bad descriptor type %X in Obj %p\n",
- ObjDesc->Common.DataType, ObjDesc));
-
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
-
-
- /*
- * Get one argument type, point to the next
- */
-
- ThisArgType = GET_CURRENT_ARG_TYPE (ArgTypes);
- INCREMENT_ARG_LIST (ArgTypes);
-
-
- /*
- * Handle cases where the object does not need to be
- * resolved to a value
- */
-
- switch (ThisArgType)
- {
-
- case ARGI_REFERENCE: /* References */
- case ARGI_INTEGER_REF:
- case ARGI_OBJECT_REF:
- case ARGI_DEVICE_REF:
- case ARGI_TARGETREF: /* TBD: must implement implicit conversion rules before store */
- case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */
- case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */
-
- /* Need an operand of type INTERNAL_TYPE_REFERENCE */
-
- if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED)) /* direct name ptr OK as-is */
- {
- goto NextOperand;
- }
-
- Status = AcpiAmlCheckObjectType (INTERNAL_TYPE_REFERENCE,
- ObjectType, ObjDesc);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
-
- if (AML_NAME_OP == ObjDesc->Reference.OpCode)
- {
- /*
- * Convert an indirect name ptr to direct name ptr and put
- * it on the stack
- */
-
- TempHandle = ObjDesc->Reference.Object;
- AcpiCmRemoveReference (ObjDesc);
- (*StackPtr) = TempHandle;
- }
-
- goto NextOperand;
- break;
-
-
- case ARGI_ANYTYPE:
-
- /*
- * We don't want to resolve IndexOp reference objects during
- * a store because this would be an implicit DeRefOf operation.
- * Instead, we just want to store the reference object.
- * -- All others must be resolved below.
- */
-
- if ((Opcode == AML_STORE_OP) &&
- ((*StackPtr)->Common.Type == INTERNAL_TYPE_REFERENCE) &&
- ((*StackPtr)->Reference.OpCode == AML_INDEX_OP))
- {
- goto NextOperand;
- }
- break;
- }
-
-
- /*
- * Resolve this object to a value
- */
-
- Status = AcpiAmlResolveToValue (StackPtr, WalkState);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
-
- /*
- * Check the resulting object (value) type
- */
- switch (ThisArgType)
- {
- /*
- * For the simple cases, only one type of resolved object
- * is allowed
- */
- case ARGI_MUTEX:
-
- /* Need an operand of type ACPI_TYPE_MUTEX */
-
- TypeNeeded = ACPI_TYPE_MUTEX;
- break;
-
- case ARGI_EVENT:
-
- /* Need an operand of type ACPI_TYPE_EVENT */
-
- TypeNeeded = ACPI_TYPE_EVENT;
- break;
-
- case ARGI_REGION:
-
- /* Need an operand of type ACPI_TYPE_REGION */
-
- TypeNeeded = ACPI_TYPE_REGION;
- break;
-
- case ARGI_IF: /* If */
-
- /* Need an operand of type INTERNAL_TYPE_IF */
-
- TypeNeeded = INTERNAL_TYPE_IF;
- break;
-
- case ARGI_PACKAGE: /* Package */
-
- /* Need an operand of type ACPI_TYPE_PACKAGE */
-
- TypeNeeded = ACPI_TYPE_PACKAGE;
- break;
-
- case ARGI_ANYTYPE:
-
- /* Any operand type will do */
-
- TypeNeeded = ACPI_TYPE_ANY;
- break;
-
-
- /*
- * The more complex cases allow multiple resolved object types
- */
-
- case ARGI_INTEGER: /* Number */
-
- /*
- * Need an operand of type ACPI_TYPE_INTEGER,
- * But we can implicitly convert from a STRING or BUFFER
- */
- Status = AcpiAmlConvertToInteger (StackPtr, WalkState);
- if (ACPI_FAILURE (Status))
- {
- if (Status == AE_TYPE)
- {
- DEBUG_PRINT (ACPI_INFO,
- ("AmlResolveOperands: Needed [Integer/String/Buffer], found [%s] %p\n",
- AcpiCmGetTypeName ((*StackPtr)->Common.Type), *StackPtr));
-
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
-
- return_ACPI_STATUS (Status);
- }
-
- goto NextOperand;
- break;
-
-
- case ARGI_BUFFER:
-
- /*
- * Need an operand of type ACPI_TYPE_BUFFER,
- * But we can implicitly convert from a STRING or INTEGER
- */
- Status = AcpiAmlConvertToBuffer (StackPtr, WalkState);
- if (ACPI_FAILURE (Status))
- {
- if (Status == AE_TYPE)
- {
- DEBUG_PRINT (ACPI_INFO,
- ("AmlResolveOperands: Needed [Integer/String/Buffer], found [%s] %p\n",
- AcpiCmGetTypeName ((*StackPtr)->Common.Type), *StackPtr));
-
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
-
- return_ACPI_STATUS (Status);
- }
-
- goto NextOperand;
- break;
-
-
- case ARGI_STRING:
-
- /*
- * Need an operand of type ACPI_TYPE_STRING,
- * But we can implicitly convert from a BUFFER or INTEGER
- */
- Status = AcpiAmlConvertToString (StackPtr, WalkState);
- if (ACPI_FAILURE (Status))
- {
- if (Status == AE_TYPE)
- {
- DEBUG_PRINT (ACPI_INFO,
- ("AmlResolveOperands: Needed [Integer/String/Buffer], found [%s] %p\n",
- AcpiCmGetTypeName ((*StackPtr)->Common.Type), *StackPtr));
-
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
-
- return_ACPI_STATUS (Status);
- }
-
- goto NextOperand;
- break;
-
-
- case ARGI_COMPUTEDATA:
-
- /* Need an operand of type INTEGER, STRING or BUFFER */
-
- if ((ACPI_TYPE_INTEGER != (*StackPtr)->Common.Type) &&
- (ACPI_TYPE_STRING != (*StackPtr)->Common.Type) &&
- (ACPI_TYPE_BUFFER != (*StackPtr)->Common.Type))
- {
- DEBUG_PRINT (ACPI_INFO,
- ("AmlResolveOperands: Needed [Integer/String/Buffer], found [%s] %p\n",
- AcpiCmGetTypeName ((*StackPtr)->Common.Type), *StackPtr));
-
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
- goto NextOperand;
- break;
-
-
- case ARGI_DATAOBJECT:
- /*
- * ARGI_DATAOBJECT is only used by the SizeOf operator.
- *
- * The ACPI specification allows SizeOf to return the size of
- * a Buffer, String or Package. However, the MS ACPI.SYS AML
- * Interpreter also allows an Node reference to return without
- * error with a size of 4.
- */
-
- /* Need a buffer, string, package or Node reference */
-
- if (((*StackPtr)->Common.Type != ACPI_TYPE_BUFFER) &&
- ((*StackPtr)->Common.Type != ACPI_TYPE_STRING) &&
- ((*StackPtr)->Common.Type != ACPI_TYPE_PACKAGE) &&
- ((*StackPtr)->Common.Type != INTERNAL_TYPE_REFERENCE))
- {
- DEBUG_PRINT (ACPI_INFO,
- ("AmlResolveOperands: Needed [Buf/Str/Pkg/Ref], found [%s] %p\n",
- AcpiCmGetTypeName ((*StackPtr)->Common.Type), *StackPtr));
-
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
-
- /*
- * If this is a reference, only allow a reference to an Node.
- */
- if ((*StackPtr)->Common.Type == INTERNAL_TYPE_REFERENCE)
- {
- if (!(*StackPtr)->Reference.Node)
- {
- DEBUG_PRINT (ACPI_INFO,
- ("AmlResolveOperands: Needed [Node Reference], found [%p]\n",
- *StackPtr));
-
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
- }
- goto NextOperand;
- break;
-
-
- case ARGI_COMPLEXOBJ:
-
- /* Need a buffer or package */
-
- if (((*StackPtr)->Common.Type != ACPI_TYPE_BUFFER) &&
- ((*StackPtr)->Common.Type != ACPI_TYPE_PACKAGE))
- {
- DEBUG_PRINT (ACPI_INFO,
- ("AmlResolveOperands: Needed [Buf/Pkg], found [%s] %p\n",
- AcpiCmGetTypeName ((*StackPtr)->Common.Type), *StackPtr));
-
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
- goto NextOperand;
- break;
-
-
- default:
-
- /* Unknown type */
-
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlResolveOperands: Internal error - Unknown ARGI type %X\n",
- ThisArgType));
-
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
-
- /*
- * Make sure that the original object was resolved to the
- * required object type (Simple cases only).
- */
- Status = AcpiAmlCheckObjectType (TypeNeeded,
- (*StackPtr)->Common.Type, *StackPtr);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
-
-NextOperand:
- /*
- * If more operands needed, decrement StackPtr to point
- * to next operand on stack
- */
- if (GET_CURRENT_ARG_TYPE (ArgTypes))
- {
- StackPtr--;
- }
-
- } /* while (*Types) */
-
-
- return_ACPI_STATUS (Status);
-}
-
-
diff --git a/sys/contrib/dev/acpica/Subsystem/Interpreter/amstore.c b/sys/contrib/dev/acpica/Subsystem/Interpreter/amstore.c
deleted file mode 100644
index c2c29d71ab99..000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Interpreter/amstore.c
+++ /dev/null
@@ -1,764 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: amstore - AML Interpreter object store support
- * $Revision: 123 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 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 __AMSTORE_C__
-
-#include "acpi.h"
-#include "acparser.h"
-#include "acdispat.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-#include "actables.h"
-
-
-#define _COMPONENT INTERPRETER
- MODULE_NAME ("amstore")
-
-
-
-
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlExecStore
- *
- * PARAMETERS: *ValDesc - Value to be stored
- * *DestDesc - Where to store it 0 Must be (ACPI_HANDLE)
- * or an ACPI_OPERAND_OBJECT of type
- * Reference; if the latter the descriptor
- * will be either reused or deleted.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Store the value described by ValDesc into the location
- * described by DestDesc. Called by various interpreter
- * functions to store the result of an operation into
- * the destination operand.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlExecStore (
- ACPI_OPERAND_OBJECT *ValDesc,
- ACPI_OPERAND_OBJECT *DestDesc,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_STATUS Status = AE_OK;
- ACPI_OPERAND_OBJECT *RefDesc = DestDesc;
-
-
- FUNCTION_TRACE_PTR ("AmlExecStore", DestDesc);
-
-
- /* Validate parameters */
-
- if (!ValDesc || !DestDesc)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlExecStore: Internal error - null pointer\n"));
- return_ACPI_STATUS (AE_AML_NO_OPERAND);
- }
-
- /* DestDesc can be either a namespace node or an ACPI object */
-
- if (VALID_DESCRIPTOR_TYPE (DestDesc, ACPI_DESC_TYPE_NAMED))
- {
- /*
- * Dest is a namespace node,
- * Storing an object into a Name "container"
- */
- Status = AcpiAmlStoreObjectToNode (ValDesc,
- (ACPI_NAMESPACE_NODE *) DestDesc, WalkState);
-
- /* All done, that's it */
-
- return_ACPI_STATUS (Status);
- }
-
-
- /* Destination object must be an object of type Reference */
-
- if (DestDesc->Common.Type != INTERNAL_TYPE_REFERENCE)
- {
- /* Destination is not an Reference */
-
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlExecStore: Destination is not a ReferenceObj [%p]\n", DestDesc));
-
- DUMP_STACK_ENTRY (ValDesc);
- DUMP_STACK_ENTRY (DestDesc);
- DUMP_OPERANDS (&DestDesc, IMODE_EXECUTE, "AmlExecStore",
- 2, "Target is not a ReferenceObj");
-
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
-
-
- /*
- * Examine the Reference opcode. These cases are handled:
- *
- * 1) Store to Name (Change the object associated with a name)
- * 2) Store to an indexed area of a Buffer or Package
- * 3) Store to a Method Local or Arg
- * 4) Store to the debug object
- * 5) Store to a constant -- a noop
- */
-
- switch (RefDesc->Reference.OpCode)
- {
-
- case AML_NAME_OP:
-
- /* Storing an object into a Name "container" */
-
- Status = AcpiAmlStoreObjectToNode (ValDesc, RefDesc->Reference.Object,
- WalkState);
- break;
-
-
- case AML_INDEX_OP:
-
- /* Storing to an Index (pointer into a packager or buffer) */
-
- Status = AcpiAmlStoreObjectToIndex (ValDesc, RefDesc, WalkState);
- break;
-
-
- case AML_LOCAL_OP:
-
- Status = AcpiDsMethodDataSetValue (MTH_TYPE_LOCAL,
- (RefDesc->Reference.Offset), ValDesc, WalkState);
- break;
-
-
- case AML_ARG_OP:
-
- Status = AcpiDsMethodDataSetValue (MTH_TYPE_ARG,
- (RefDesc->Reference.Offset), ValDesc, WalkState);
- break;
-
-
- case AML_DEBUG_OP:
-
- /*
- * Storing to the Debug object causes the value stored to be
- * displayed and otherwise has no effect -- see ACPI Specification
- *
- * TBD: print known object types "prettier".
- */
- DEBUG_PRINT (ACPI_INFO, ("**** Write to Debug Object: ****: \n"));
-
- if (ValDesc->Common.Type == ACPI_TYPE_STRING)
- {
- DEBUG_PRINT (ACPI_INFO, ("%s\n", ValDesc->String.Pointer));
- }
- else
- {
- DUMP_STACK_ENTRY (ValDesc);
- }
-
- break;
-
-
- case AML_ZERO_OP:
- case AML_ONE_OP:
- case AML_ONES_OP:
-
- /*
- * Storing to a constant is a no-op -- see ACPI Specification
- * Delete the reference descriptor, however
- */
- break;
-
-
- default:
-
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlExecStore: Internal error - Unknown Reference subtype %02x\n",
- RefDesc->Reference.OpCode));
-
- /* TBD: [Restructure] use object dump routine !! */
-
- DUMP_BUFFER (RefDesc, sizeof (ACPI_OPERAND_OBJECT));
-
- Status = AE_AML_INTERNAL;
- break;
-
- } /* switch (RefDesc->Reference.OpCode) */
-
-
-
- /* Always delete the reference descriptor object */
-
- if (RefDesc)
- {
- AcpiCmRemoveReference (RefDesc);
- }
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlStoreObjectToIndex
- *
- * PARAMETERS: *ValDesc - Value to be stored
- * *Node - Named object to recieve the value
- *
- * RETURN: Status
- *
- * DESCRIPTION: Store the object to the named object.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlStoreObjectToIndex (
- ACPI_OPERAND_OBJECT *ValDesc,
- ACPI_OPERAND_OBJECT *DestDesc,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_STATUS Status = AE_OK;
- ACPI_OPERAND_OBJECT *ObjDesc;
- UINT32 Length;
- UINT32 i;
- UINT8 Value = 0;
-
-
- FUNCTION_TRACE ("AcpiAmlStoreObjectToIndex");
-
-
- /*
- * Destination must be a reference pointer, and
- * must point to either a buffer or a package
- */
-
- switch (DestDesc->Reference.TargetType)
- {
- case ACPI_TYPE_PACKAGE:
- /*
- * Storing to a package element is not simple. The source must be
- * evaluated and converted to the type of the destination and then the
- * source is copied into the destination - we can't just point to the
- * source object.
- */
- if (DestDesc->Reference.TargetType == ACPI_TYPE_PACKAGE)
- {
- /*
- * The object at *(DestDesc->Reference.Where) is the
- * element within the package that is to be modified.
- */
- ObjDesc = *(DestDesc->Reference.Where);
- if (ObjDesc)
- {
- /*
- * If the Destination element is a package, we will delete
- * that object and construct a new one.
- *
- * TBD: [Investigate] Should both the src and dest be required
- * to be packages?
- * && (ValDesc->Common.Type == ACPI_TYPE_PACKAGE)
- */
- if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE)
- {
- /*
- * Take away the reference for being part of a package and
- * delete
- */
- AcpiCmRemoveReference (ObjDesc);
- AcpiCmRemoveReference (ObjDesc);
-
- ObjDesc = NULL;
- }
- }
-
- if (!ObjDesc)
- {
- /*
- * If the ObjDesc is NULL, it means that an uninitialized package
- * element has been used as a destination (this is OK), therefore,
- * we must create the destination element to match the type of the
- * source element NOTE: ValDesc can be of any type.
- */
- ObjDesc = AcpiCmCreateInternalObject (ValDesc->Common.Type);
- if (!ObjDesc)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /*
- * If the source is a package, copy the source to the new dest
- */
- if (ACPI_TYPE_PACKAGE == ObjDesc->Common.Type)
- {
- Status = AcpiCmCopyIpackageToIpackage (ValDesc, ObjDesc, WalkState);
- if (ACPI_FAILURE (Status))
- {
- AcpiCmRemoveReference (ObjDesc);
- return_ACPI_STATUS (Status);
- }
- }
-
- /*
- * Install the new descriptor into the package and add a
- * reference to the newly created descriptor for now being
- * part of the parent package
- */
-
- *(DestDesc->Reference.Where) = ObjDesc;
- AcpiCmAddReference (ObjDesc);
- }
-
- if (ACPI_TYPE_PACKAGE != ObjDesc->Common.Type)
- {
- /*
- * The destination element is not a package, so we need to
- * convert the contents of the source (ValDesc) and copy into
- * the destination (ObjDesc)
- */
- Status = AcpiAmlStoreObjectToObject (ValDesc, ObjDesc,
- WalkState);
- if (ACPI_FAILURE (Status))
- {
- /*
- * An error occurrered when copying the internal object
- * so delete the reference.
- */
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlExecStore/Index: Unable to copy the internal object\n"));
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
- }
- }
- break;
-
-
- case ACPI_TYPE_BUFFER_FIELD:
- /*
- * Storing into a buffer at a location defined by an Index.
- *
- * Each 8-bit element of the source object is written to the
- * 8-bit Buffer Field of the Index destination object.
- */
-
- /*
- * Set the ObjDesc to the destination object and type check.
- */
- ObjDesc = DestDesc->Reference.Object;
- if (ObjDesc->Common.Type != ACPI_TYPE_BUFFER)
- {
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
- }
-
- /*
- * The assignment of the individual elements will be slightly
- * different for each source type.
- */
-
- switch (ValDesc->Common.Type)
- {
- /*
- * If the type is Integer, assign bytewise
- * This loop to assign each of the elements is somewhat
- * backward because of the Big Endian-ness of IA-64
- */
- case ACPI_TYPE_INTEGER:
- Length = sizeof (ACPI_INTEGER);
- for (i = Length; i != 0; i--)
- {
- Value = (UINT8)(ValDesc->Integer.Value >> (MUL_8 (i - 1)));
- ObjDesc->Buffer.Pointer[DestDesc->Reference.Offset] = Value;
- }
- break;
-
- /*
- * If the type is Buffer, the Length is in the structure.
- * Just loop through the elements and assign each one in turn.
- */
- case ACPI_TYPE_BUFFER:
- Length = ValDesc->Buffer.Length;
- for (i = 0; i < Length; i++)
- {
- Value = *(ValDesc->Buffer.Pointer + i);
- ObjDesc->Buffer.Pointer[DestDesc->Reference.Offset] = Value;
- }
- break;
-
- /*
- * If the type is String, the Length is in the structure.
- * Just loop through the elements and assign each one in turn.
- */
- case ACPI_TYPE_STRING:
- Length = ValDesc->String.Length;
- for (i = 0; i < Length; i++)
- {
- Value = *(ValDesc->String.Pointer + i);
- ObjDesc->Buffer.Pointer[DestDesc->Reference.Offset] = Value;
- }
- break;
-
- /*
- * If source is not a valid type so return an error.
- */
- default:
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlExecStore/Index: Source must be Number/Buffer/String type, not %X\n",
- ValDesc->Common.Type));
- Status = AE_AML_OPERAND_TYPE;
- break;
- }
- break;
-
-
- default:
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlExecStoreIndex: Target is not a Package or BufferField\n"));
- Status = AE_AML_OPERAND_TYPE;
- break;
- }
-
-
- return_ACPI_STATUS (Status);
-}
-
-
-
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlStoreObjectToNode
- *
- * PARAMETERS: *SourceDesc - Value to be stored
- * *Node - Named object to recieve the value
- *
- * RETURN: Status
- *
- * DESCRIPTION: Store the object to the named object.
- *
- * The Assignment of an object to a named object is handled here
- * The val passed in will replace the current value (if any)
- * with the input value.
- *
- * When storing into an object the data is converted to the
- * target object type then stored in the object. This means
- * that the target object type (for an initialized target) will
- * not be changed by a store operation.
- *
- * NOTE: the global lock is acquired early. This will result
- * in the global lock being held a bit longer. Also, if the
- * function fails during set up we may get the lock when we
- * don't really need it. I don't think we care.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlStoreObjectToNode (
- ACPI_OPERAND_OBJECT *SourceDesc,
- ACPI_NAMESPACE_NODE *Node,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_STATUS Status = AE_OK;
- ACPI_OPERAND_OBJECT *TargetDesc;
- OBJECT_TYPE_INTERNAL TargetType = ACPI_TYPE_ANY;
-
-
- FUNCTION_TRACE ("AmlStoreObjectToNode");
-
- /*
- * Assuming the parameters were already validated
- */
- ACPI_ASSERT((Node) && (SourceDesc));
-
-
- /*
- * Get current type of the node, and object attached to Node
- */
- TargetType = AcpiNsGetType (Node);
- TargetDesc = AcpiNsGetAttachedObject (Node);
-
- DEBUG_PRINT (ACPI_INFO, ("AmlStoreObjectToNode: Storing %p(%s) into node %p(%s)\n",
- Node, AcpiCmGetTypeName (SourceDesc->Common.Type),
- SourceDesc, AcpiCmGetTypeName (TargetType)));
-
-
- /*
- * Resolve the source object to an actual value
- * (If it is a reference object)
- */
- Status = AcpiAmlResolveObject (&SourceDesc, TargetType, WalkState);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
-
- /*
- * Do the actual store operation
- */
- switch (TargetType)
- {
- case INTERNAL_TYPE_DEF_FIELD:
-
- /* Raw data copy for target types Integer/String/Buffer */
-
- Status = AcpiAmlCopyDataToNamedField (SourceDesc, Node);
- break;
-
-
- case ACPI_TYPE_INTEGER:
- case ACPI_TYPE_STRING:
- case ACPI_TYPE_BUFFER:
- case INTERNAL_TYPE_BANK_FIELD:
- case INTERNAL_TYPE_INDEX_FIELD:
- case ACPI_TYPE_FIELD_UNIT:
-
- /*
- * These target types are all of type Integer/String/Buffer, and
- * therefore support implicit conversion before the store.
- *
- * Copy and/or convert the source object to a new target object
- */
- Status = AcpiAmlStoreObject (SourceDesc, TargetType, &TargetDesc, WalkState);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /*
- * Store the new TargetDesc as the new value of the Name, and set
- * the Name's type to that of the value being stored in it.
- * SourceDesc reference count is incremented by AttachObject.
- */
- Status = AcpiNsAttachObject (Node, TargetDesc, TargetType);
- DEBUG_PRINT (ACPI_INFO,
- ("AmlStoreObjectToNode: Store %s into %s via Convert/Attach\n",
- AcpiCmGetTypeName (TargetDesc->Common.Type),
- AcpiCmGetTypeName (TargetType)));
- break;
-
-
- default:
-
- /* No conversions for all other types. Just attach the source object */
-
- Status = AcpiNsAttachObject (Node, SourceDesc, SourceDesc->Common.Type);
-
- DEBUG_PRINT (ACPI_INFO,
- ("AmlStoreObjectToNode: Store %s into %s via Attach only\n",
- AcpiCmGetTypeName (SourceDesc->Common.Type),
- AcpiCmGetTypeName (SourceDesc->Common.Type)));
- break;
- }
-
-
- return_ACPI_STATUS (Status);
-}
-
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlStoreObjectToObject
- *
- * PARAMETERS: *SourceDesc - Value to be stored
- * *DestDesc - Object to receive the value
- *
- * RETURN: Status
- *
- * DESCRIPTION: Store an object to another object.
- *
- * The Assignment of an object to another (not named) object
- * is handled here.
- * The val passed in will replace the current value (if any)
- * with the input value.
- *
- * When storing into an object the data is converted to the
- * target object type then stored in the object. This means
- * that the target object type (for an initialized target) will
- * not be changed by a store operation.
- *
- * This module allows destination types of Number, String,
- * and Buffer.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlStoreObjectToObject (
- ACPI_OPERAND_OBJECT *SourceDesc,
- ACPI_OPERAND_OBJECT *DestDesc,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_STATUS Status = AE_OK;
- OBJECT_TYPE_INTERNAL DestinationType = DestDesc->Common.Type;
-
-
- FUNCTION_TRACE ("AmlStoreObjectToObject");
-
-
- /*
- * Assuming the parameters are valid!
- */
- ACPI_ASSERT((DestDesc) && (SourceDesc));
-
- DEBUG_PRINT (ACPI_INFO, ("AmlStoreObjectToObject: Storing %p(%s) to %p(%s)\n",
- SourceDesc, AcpiCmGetTypeName (SourceDesc->Common.Type),
- DestDesc, AcpiCmGetTypeName (DestDesc->Common.Type)));
-
-
- /*
- * From this interface, we only support Integers/Strings/Buffers
- */
- switch (DestinationType)
- {
- case ACPI_TYPE_INTEGER:
- case ACPI_TYPE_STRING:
- case ACPI_TYPE_BUFFER:
- break;
-
- default:
- DEBUG_PRINT (ACPI_WARN,
- ("AmlStoreObjectToObject: Store into %s not implemented\n",
- AcpiCmGetTypeName (DestDesc->Common.Type)));
-
- return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
- }
-
-
-
- /*
- * Resolve the source object to an actual value
- * (If it is a reference object)
- */
- Status = AcpiAmlResolveObject (&SourceDesc, DestinationType, WalkState);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
-
- /*
- * Copy and/or convert the source object to the destination object
- */
- Status = AcpiAmlStoreObject (SourceDesc, DestinationType, &DestDesc, WalkState);
-
-
- return_ACPI_STATUS (Status);
-}
-
diff --git a/sys/contrib/dev/acpica/Subsystem/Interpreter/amstoren.c b/sys/contrib/dev/acpica/Subsystem/Interpreter/amstoren.c
deleted file mode 100644
index b6bd010b62fc..000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Interpreter/amstoren.c
+++ /dev/null
@@ -1,376 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: amstoren - AML Interpreter object store support,
- * Store to Node (namespace object)
- * $Revision: 28 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 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 __AMSTOREN_C__
-
-#include "acpi.h"
-#include "acparser.h"
-#include "acdispat.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-#include "actables.h"
-
-
-#define _COMPONENT INTERPRETER
- MODULE_NAME ("amstoren")
-
-
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlResolveObject
- *
- * PARAMETERS: SourceDescPtr - Pointer to the source object
- * TargetType - Current type of the target
- * WalkState - Current walk state
- *
- * RETURN: Status, resolved object in SourceDescPtr.
- *
- * DESCRIPTION: Resolve an object. If the object is a reference, dereference
- * it and return the actual object in the SourceDescPtr.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlResolveObject (
- ACPI_OPERAND_OBJECT **SourceDescPtr,
- OBJECT_TYPE_INTERNAL TargetType,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_OPERAND_OBJECT *SourceDesc = *SourceDescPtr;
- ACPI_STATUS Status = AE_OK;
-
-
- FUNCTION_TRACE ("AmlResolveObject");
-
-
- /*
- * Ensure we have a Source that can be stored in the target
- */
- switch (TargetType)
- {
-
- /* This case handles the "interchangeable" types Integer, String, and Buffer. */
-
- /*
- * These cases all require only Integers or values that
- * can be converted to Integers (Strings or Buffers)
- */
- case ACPI_TYPE_INTEGER:
- case ACPI_TYPE_FIELD_UNIT:
- case INTERNAL_TYPE_BANK_FIELD:
- case INTERNAL_TYPE_INDEX_FIELD:
-
- /*
- * Stores into a Field/Region or into a Buffer/String
- * are all essentially the same.
- */
- case ACPI_TYPE_STRING:
- case ACPI_TYPE_BUFFER:
- case INTERNAL_TYPE_DEF_FIELD:
-
- /*
- * If SourceDesc is not a valid type, try to resolve it to one.
- */
- if ((SourceDesc->Common.Type != ACPI_TYPE_INTEGER) &&
- (SourceDesc->Common.Type != ACPI_TYPE_BUFFER) &&
- (SourceDesc->Common.Type != ACPI_TYPE_STRING))
- {
- /*
- * Initially not a valid type, convert
- */
- Status = AcpiAmlResolveToValue (SourceDescPtr, WalkState);
- if (ACPI_SUCCESS (Status) &&
- (SourceDesc->Common.Type != ACPI_TYPE_INTEGER) &&
- (SourceDesc->Common.Type != ACPI_TYPE_BUFFER) &&
- (SourceDesc->Common.Type != ACPI_TYPE_STRING))
- {
- /*
- * Conversion successful but still not a valid type
- */
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlResolveObject: Cannot assign type %s to %s (must be type Int/Str/Buf)\n",
- AcpiCmGetTypeName ((*SourceDescPtr)->Common.Type),
- AcpiCmGetTypeName (TargetType)));
- Status = AE_AML_OPERAND_TYPE;
- }
- }
- break;
-
-
- case INTERNAL_TYPE_ALIAS:
-
- /*
- * Aliases are resolved by AcpiAmlPrepOperands
- */
- DEBUG_PRINT (ACPI_WARN,
- ("AmlResolveObject: Store into Alias - should never happen\n"));
-
- Status = AE_AML_INTERNAL;
- break;
-
-
- case ACPI_TYPE_PACKAGE:
- default:
-
- /*
- * All other types than Alias and the various Fields come here,
- * including the untyped case - ACPI_TYPE_ANY.
- */
- break;
- }
-
- return_ACPI_STATUS (Status);
-}
-
-
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlStoreObject
- *
- * PARAMETERS: SourceDesc - Object to store
- * TargetType - Current type of the target
- * TargetDescPtr - Pointer to the target
- * WalkState - Current walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION: "Store" an object to another object. This may include
- * converting the source type to the target type (implicit
- * conversion), and a copy of the value of the source to
- * the target.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlStoreObject (
- ACPI_OPERAND_OBJECT *SourceDesc,
- OBJECT_TYPE_INTERNAL TargetType,
- ACPI_OPERAND_OBJECT **TargetDescPtr,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_OPERAND_OBJECT *TargetDesc = *TargetDescPtr;
- ACPI_STATUS Status;
-
-
- FUNCTION_TRACE ("AmlStoreObject");
-
-
- /*
- * Perform the "implicit conversion" of the source to the current type
- * of the target - As per the ACPI specification.
- *
- * If no conversion performed, SourceDesc is left alone, otherwise it
- * is updated with a new object.
- */
- Status = AcpiAmlConvertToTargetType (TargetType, &SourceDesc, WalkState);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
-
- /*
- * We now have two objects of identical types, and we can perform a
- * copy of the *value* of the source object.
- */
- switch (TargetType)
- {
- case ACPI_TYPE_ANY:
- case INTERNAL_TYPE_DEF_ANY:
-
- /*
- * The target namespace node is uninitialized (has no target object),
- * and will take on the type of the source object
- */
-
- *TargetDescPtr = SourceDesc;
- break;
-
-
- case ACPI_TYPE_INTEGER:
-
- TargetDesc->Integer.Value = SourceDesc->Integer.Value;
-
- /* Truncate value if we are executing from a 32-bit ACPI table */
-
- AcpiAmlTruncateFor32bitTable (TargetDesc, WalkState);
- break;
-
-
- case ACPI_TYPE_FIELD_UNIT:
-
- Status = AcpiAmlCopyIntegerToFieldUnit (SourceDesc, TargetDesc);
- break;
-
-
- case INTERNAL_TYPE_BANK_FIELD:
-
- Status = AcpiAmlCopyIntegerToBankField (SourceDesc, TargetDesc);
- break;
-
-
- case INTERNAL_TYPE_INDEX_FIELD:
-
- Status = AcpiAmlCopyIntegerToIndexField (SourceDesc, TargetDesc);
- break;
-
-
- case ACPI_TYPE_STRING:
-
- Status = AcpiAmlCopyStringToString (SourceDesc, TargetDesc);
- break;
-
-
- case ACPI_TYPE_BUFFER:
-
- Status = AcpiAmlCopyBufferToBuffer (SourceDesc, TargetDesc);
- break;
-
-
- case ACPI_TYPE_PACKAGE:
-
- /*
- * TBD: [Unhandled] Not real sure what to do here
- */
- Status = AE_NOT_IMPLEMENTED;
- break;
-
-
- default:
-
- /*
- * All other types come here.
- */
- DEBUG_PRINT (ACPI_WARN,
- ("AmlStoreObject: Store into type %s not implemented\n",
- AcpiCmGetTypeName (TargetType)));
-
- Status = AE_NOT_IMPLEMENTED;
- break;
- }
-
-
- return_ACPI_STATUS (Status);
-}
-
-
diff --git a/sys/contrib/dev/acpica/Subsystem/Interpreter/amstorob.c b/sys/contrib/dev/acpica/Subsystem/Interpreter/amstorob.c
deleted file mode 100644
index a4bd94d6412c..000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Interpreter/amstorob.c
+++ /dev/null
@@ -1,596 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: amstorob - AML Interpreter object store support, store to object
- * $Revision: 23 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 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 __AMSTOROB_C__
-
-#include "acpi.h"
-#include "acparser.h"
-#include "acdispat.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-#include "actables.h"
-
-
-#define _COMPONENT INTERPRETER
- MODULE_NAME ("amstorob")
-
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlCopyBufferToBuffer
- *
- * PARAMETERS: SourceDesc - Source object to copy
- * TargetDesc - Destination object of the copy
- *
- * RETURN: Status
- *
- * DESCRIPTION: Copy a buffer object to another buffer object.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlCopyBufferToBuffer (
- ACPI_OPERAND_OBJECT *SourceDesc,
- ACPI_OPERAND_OBJECT *TargetDesc)
-{
- UINT32 Length;
- UINT8 *Buffer;
-
-
- /*
- * We know that SourceDesc is a buffer by now
- */
- Buffer = (UINT8 *) SourceDesc->Buffer.Pointer;
- Length = SourceDesc->Buffer.Length;
-
- /*
- * If target is a buffer of length zero, allocate a new
- * buffer of the proper length
- */
- if (TargetDesc->Buffer.Length == 0)
- {
- TargetDesc->Buffer.Pointer = AcpiCmAllocate (Length);
- if (!TargetDesc->Buffer.Pointer)
- {
- return (AE_NO_MEMORY);
- }
-
- TargetDesc->Buffer.Length = Length;
- }
-
- /*
- * Buffer is a static allocation,
- * only place what will fit in the buffer.
- */
- if (Length <= TargetDesc->Buffer.Length)
- {
- /* Clear existing buffer and copy in the new one */
-
- MEMSET(TargetDesc->Buffer.Pointer, 0, TargetDesc->Buffer.Length);
- MEMCPY(TargetDesc->Buffer.Pointer, Buffer, Length);
- }
-
- else
- {
- /*
- * Truncate the source, copy only what will fit
- */
- MEMCPY(TargetDesc->Buffer.Pointer, Buffer, TargetDesc->Buffer.Length);
-
- DEBUG_PRINT (ACPI_INFO,
- ("AmlCopyBufferToBuffer: Truncating src buffer from %X to %X\n",
- Length, TargetDesc->Buffer.Length));
- }
-
- return (AE_OK);
-}
-
-
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlCopyStringToString
- *
- * PARAMETERS: SourceDesc - Source object to copy
- * TargetDesc - Destination object of the copy
- *
- * RETURN: Status
- *
- * DESCRIPTION: Copy a String object to another String object
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlCopyStringToString (
- ACPI_OPERAND_OBJECT *SourceDesc,
- ACPI_OPERAND_OBJECT *TargetDesc)
-{
- UINT32 Length;
- UINT8 *Buffer;
-
-
- /*
- * We know that SourceDesc is a string by now.
- */
- Buffer = (UINT8 *) SourceDesc->String.Pointer;
- Length = SourceDesc->String.Length;
-
- /*
- * Setting a string value replaces the old string
- */
- if (Length < TargetDesc->String.Length)
- {
- /* Clear old string and copy in the new one */
-
- MEMSET(TargetDesc->String.Pointer, 0, TargetDesc->String.Length);
- MEMCPY(TargetDesc->String.Pointer, Buffer, Length);
- }
-
- else
- {
- /*
- * Free the current buffer, then allocate a buffer
- * large enough to hold the value
- */
- if (TargetDesc->String.Pointer &&
- !AcpiTbSystemTablePointer (TargetDesc->String.Pointer))
- {
- /*
- * Only free if not a pointer into the DSDT
- */
- AcpiCmFree(TargetDesc->String.Pointer);
- }
-
- TargetDesc->String.Pointer = AcpiCmAllocate (Length + 1);
- if (!TargetDesc->String.Pointer)
- {
- return (AE_NO_MEMORY);
- }
- TargetDesc->String.Length = Length;
-
-
- MEMCPY(TargetDesc->String.Pointer, Buffer, Length);
- }
-
- return (AE_OK);
-}
-
-
-
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlCopyIntegerToIndexField
- *
- * PARAMETERS: SourceDesc - Source object to copy
- * TargetDesc - Destination object of the copy
- *
- * RETURN: Status
- *
- * DESCRIPTION: Write an Integer to an Index Field
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlCopyIntegerToIndexField (
- ACPI_OPERAND_OBJECT *SourceDesc,
- ACPI_OPERAND_OBJECT *TargetDesc)
-{
- ACPI_STATUS Status;
- BOOLEAN Locked;
-
-
- /*
- * Get the global lock if needed
- */
- Locked = AcpiAmlAcquireGlobalLock (TargetDesc->IndexField.LockRule);
-
- /*
- * Set Index value to select proper Data register
- * perform the update (Set index)
- */
- Status = AcpiAmlAccessNamedField (ACPI_WRITE,
- TargetDesc->IndexField.Index,
- &TargetDesc->IndexField.Value,
- sizeof (TargetDesc->IndexField.Value));
- if (ACPI_SUCCESS (Status))
- {
- /* SetIndex was successful, next set Data value */
-
- Status = AcpiAmlAccessNamedField (ACPI_WRITE,
- TargetDesc->IndexField.Data,
- &SourceDesc->Integer.Value,
- sizeof (SourceDesc->Integer.Value));
-
- DEBUG_PRINT (ACPI_INFO,
- ("AmlCopyIntegerToIndexField: IndexField: set data returned %s\n",
- AcpiCmFormatException (Status)));
- }
-
- else
- {
- DEBUG_PRINT (ACPI_INFO,
- ("AmlCopyIntegerToIndexField: IndexField: set index returned %s\n",
- AcpiCmFormatException (Status)));
- }
-
-
- /*
- * Release global lock if we acquired it earlier
- */
- AcpiAmlReleaseGlobalLock (Locked);
-
- return (Status);
-}
-
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlCopyIntegerToBankField
- *
- * PARAMETERS: SourceDesc - Source object to copy
- * TargetDesc - Destination object of the copy
- *
- * RETURN: Status
- *
- * DESCRIPTION: Write an Integer to a Bank Field
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlCopyIntegerToBankField (
- ACPI_OPERAND_OBJECT *SourceDesc,
- ACPI_OPERAND_OBJECT *TargetDesc)
-{
- ACPI_STATUS Status;
- BOOLEAN Locked;
-
-
- /*
- * Get the global lock if needed
- */
- Locked = AcpiAmlAcquireGlobalLock (TargetDesc->IndexField.LockRule);
-
-
-
- /*
- * Set Bank value to select proper Bank
- * Perform the update (Set Bank Select)
- */
-
- Status = AcpiAmlAccessNamedField (ACPI_WRITE,
- TargetDesc->BankField.BankSelect,
- &TargetDesc->BankField.Value,
- sizeof (TargetDesc->BankField.Value));
- if (ACPI_SUCCESS (Status))
- {
- /* Set bank select successful, set data value */
-
- Status = AcpiAmlAccessNamedField (ACPI_WRITE,
- TargetDesc->BankField.BankSelect,
- &SourceDesc->BankField.Value,
- sizeof (SourceDesc->BankField.Value));
- }
-
- else
- {
- DEBUG_PRINT (ACPI_INFO,
- ("AmlCopyIntegerToBankField: BankField: set bakn returned %s\n",
- AcpiCmFormatException (Status)));
- }
-
-
- /*
- * Release global lock if we acquired it earlier
- */
- AcpiAmlReleaseGlobalLock (Locked);
-
- return (Status);
-}
-
-
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlCopyDataToNamedField
- *
- * PARAMETERS: SourceDesc - Source object to copy
- * Node - Destination Namespace node
- *
- * RETURN: Status
- *
- * DESCRIPTION: Copy raw data to a Named Field. No implicit conversion
- * is performed on the source object
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlCopyDataToNamedField (
- ACPI_OPERAND_OBJECT *SourceDesc,
- ACPI_NAMESPACE_NODE *Node)
-{
- ACPI_STATUS Status;
- BOOLEAN Locked;
- UINT32 Length;
- UINT8 *Buffer;
-
-
- /*
- * Named fields (CreateXxxField) - We don't perform any conversions on the
- * source operand, just use the raw data
- */
- switch (SourceDesc->Common.Type)
- {
- case ACPI_TYPE_INTEGER:
- Buffer = (UINT8 *) &SourceDesc->Integer.Value;
- Length = sizeof (SourceDesc->Integer.Value);
- break;
-
- case ACPI_TYPE_BUFFER:
- Buffer = (UINT8 *) SourceDesc->Buffer.Pointer;
- Length = SourceDesc->Buffer.Length;
- break;
-
- case ACPI_TYPE_STRING:
- Buffer = (UINT8 *) SourceDesc->String.Pointer;
- Length = SourceDesc->String.Length;
- break;
-
- default:
- return (AE_TYPE);
- }
-
- /*
- * Get the global lock if needed before the update
- * TBD: not needed!
- */
- Locked = AcpiAmlAcquireGlobalLock (SourceDesc->Field.LockRule);
-
- Status = AcpiAmlAccessNamedField (ACPI_WRITE,
- Node, Buffer, Length);
-
- AcpiAmlReleaseGlobalLock (Locked);
-
- return (Status);
-}
-
-
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlCopyIntegerToFieldUnit
- *
- * PARAMETERS: SourceDesc - Source object to copy
- * TargetDesc - Destination object of the copy
- *
- * RETURN: Status
- *
- * DESCRIPTION: Write an Integer to a Field Unit.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlCopyIntegerToFieldUnit (
- ACPI_OPERAND_OBJECT *SourceDesc,
- ACPI_OPERAND_OBJECT *TargetDesc)
-{
- ACPI_STATUS Status = AE_OK;
- UINT8 *Location = NULL;
- UINT32 Mask;
- UINT32 NewValue;
- BOOLEAN Locked = FALSE;
-
-
-
- FUNCTION_TRACE ("AmlCopyIntegerToFieldUnit");
-
- /*
- * If the Field Buffer and Index have not been previously evaluated,
- * evaluate them and save the results.
- */
- if (!(TargetDesc->Common.Flags & AOPOBJ_DATA_VALID))
- {
- Status = AcpiDsGetFieldUnitArguments (TargetDesc);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- }
-
- if ((!TargetDesc->FieldUnit.Container ||
- ACPI_TYPE_BUFFER != TargetDesc->FieldUnit.Container->Common.Type))
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("Null Container or wrong type: %p", TargetDesc->FieldUnit.Container));
-
- if (TargetDesc->FieldUnit.Container)
- {
- DEBUG_PRINT_RAW (ACPI_ERROR, (" Type %X",
- TargetDesc->FieldUnit.Container->Common.Type));
- }
- DEBUG_PRINT_RAW (ACPI_ERROR, ("\n"));
-
- return_ACPI_STATUS (AE_AML_INTERNAL);
- }
-
- /*
- * Get the global lock if needed
- */
- Locked = AcpiAmlAcquireGlobalLock (TargetDesc->FieldUnit.LockRule);
-
- /*
- * TBD: [Unhandled] REMOVE this limitation
- * Make sure the operation is within the limits of our implementation
- * this is not a Spec limitation!!
- */
- if (TargetDesc->FieldUnit.Length + TargetDesc->FieldUnit.BitOffset > 32)
- {
- DEBUG_PRINT (ACPI_ERROR,
- ("AmlCopyIntegerToFieldUnit: FieldUnit: Implementation limitation - Field exceeds UINT32\n"));
- return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
- }
-
- /* Field location is (base of buffer) + (byte offset) */
-
- Location = TargetDesc->FieldUnit.Container->Buffer.Pointer
- + TargetDesc->FieldUnit.Offset;
-
- /*
- * Construct Mask with 1 bits where the field is,
- * 0 bits elsewhere
- */
- Mask = ((UINT32) 1 << TargetDesc->FieldUnit.Length) - ((UINT32)1
- << TargetDesc->FieldUnit.BitOffset);
-
- DEBUG_PRINT (TRACE_EXEC,
- ("** Store %lx in buffer %p byte %ld bit %X width %d addr %p mask %08lx\n",
- SourceDesc->Integer.Value,
- TargetDesc->FieldUnit.Container->Buffer.Pointer,
- TargetDesc->FieldUnit.Offset, TargetDesc->FieldUnit.BitOffset,
- TargetDesc->FieldUnit.Length,Location, Mask));
-
- /* Zero out the field in the buffer */
-
- MOVE_UNALIGNED32_TO_32 (&NewValue, Location);
- NewValue &= ~Mask;
-
- /*
- * Shift and mask the new value into position,
- * and or it into the buffer.
- */
- NewValue |= (SourceDesc->Integer.Value << TargetDesc->FieldUnit.BitOffset) &
- Mask;
-
- /* Store back the value */
-
- MOVE_UNALIGNED32_TO_32 (Location, &NewValue);
-
- DEBUG_PRINT (TRACE_EXEC, ("New Field value %08lx\n", NewValue));
- return_ACPI_STATUS (AE_OK);
-}
-
-
-
-
-
diff --git a/sys/contrib/dev/acpica/Subsystem/Interpreter/amsystem.c b/sys/contrib/dev/acpica/Subsystem/Interpreter/amsystem.c
deleted file mode 100644
index e1f64ea00ec3..000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Interpreter/amsystem.c
+++ /dev/null
@@ -1,463 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: amsystem - Interface to OS services
- * $Revision: 54 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 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 __AMSYSTEM_C__
-
-#include "acpi.h"
-#include "acinterp.h"
-#include "acnamesp.h"
-#include "achware.h"
-#include "acevents.h"
-
-#define _COMPONENT INTERPRETER
- MODULE_NAME ("amsystem")
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlSystemThreadId
- *
- * PARAMETERS: None
- *
- * RETURN: Current Thread ID (for this implementation a 1 is returned)
- *
- * DESCRIPTION: An invocation is identified by its Thread ID. In a single
- * threaded OS the Thread ID is undefined so a 1 will be
- * returned.
- *
- ******************************************************************************/
-
-UINT16
-AcpiAmlSystemThreadId (void)
-{
- return (1);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlSystemWaitSemaphore
- *
- * PARAMETERS: Semaphore - OSD semaphore to wait on
- * Timeout - Max time to wait
- *
- * RETURN: Status
- *
- * DESCRIPTION: Implements a semaphore wait with a check to see if the
- * semaphore is available immediately. If it is not, the
- * interpreter is released.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlSystemWaitSemaphore (
- ACPI_HANDLE Semaphore,
- UINT32 Timeout)
-{
- ACPI_STATUS Status;
-
-
- FUNCTION_TRACE ("AcpiAmlSystemWaitSemaphore");
-
- Status = AcpiOsWaitSemaphore (Semaphore, 1, 0);
- if (ACPI_SUCCESS (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- if (Status == AE_TIME)
- {
- /* We must wait, so unlock the interpreter */
-
- AcpiAmlExitInterpreter ();
-
- Status = AcpiOsWaitSemaphore (Semaphore, 1, Timeout);
-
- /* Reacquire the interpreter */
-
- AcpiAmlEnterInterpreter ();
-
- DEBUG_PRINT (TRACE_EXEC,
- ("*** Thread awake and inside interpreter after blocking, %s\n",
- AcpiCmFormatException (Status)));
- }
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlSystemDoStall
- *
- * PARAMETERS: HowLong - The amount of time to stall
- *
- * RETURN: None
- *
- * DESCRIPTION: Suspend running thread for specified amount of time.
- *
- ******************************************************************************/
-
-void
-AcpiAmlSystemDoStall (
- UINT32 HowLong)
-{
-
- if (HowLong > 1000) /* 1 millisecond */
- {
- /* Since this thread will sleep, we must release the interpreter */
-
- AcpiAmlExitInterpreter ();
-
- AcpiOsSleepUsec (HowLong);
-
- /* And now we must get the interpreter again */
-
- AcpiAmlEnterInterpreter ();
- }
-
- else
- {
- AcpiOsSleepUsec (HowLong);
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlSystemDoSuspend
- *
- * PARAMETERS: HowLong - The amount of time to suspend
- *
- * RETURN: None
- *
- * DESCRIPTION: Suspend running thread for specified amount of time.
- *
- ******************************************************************************/
-
-void
-AcpiAmlSystemDoSuspend (
- UINT32 HowLong)
-{
- /* Since this thread will sleep, we must release the interpreter */
-
- AcpiAmlExitInterpreter ();
-
- AcpiOsSleep ((UINT16) (HowLong / (UINT32) 1000),
- (UINT16) (HowLong % (UINT32) 1000));
-
- /* And now we must get the interpreter again */
-
- AcpiAmlEnterInterpreter ();
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlSystemAcquireMutex
- *
- * PARAMETERS: *TimeDesc - The 'time to delay' object descriptor
- * *ObjDesc - The object descriptor for this op
- *
- * RETURN: Status
- *
- * DESCRIPTION: Provides an access point to perform synchronization operations
- * within the AML. This function will cause a lock to be generated
- * for the Mutex pointed to by ObjDesc.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlSystemAcquireMutex (
- ACPI_OPERAND_OBJECT *TimeDesc,
- ACPI_OPERAND_OBJECT *ObjDesc)
-{
- ACPI_STATUS Status = AE_OK;
-
-
- FUNCTION_TRACE_PTR ("AcpiAmlSystemAcquireMutex", ObjDesc);
-
- if (!ObjDesc)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- /*
- * Support for the _GL_ Mutex object -- go get the global lock
- */
-
- if (ObjDesc->Mutex.Semaphore == AcpiGbl_GlobalLockSemaphore)
- {
- Status = AcpiEvAcquireGlobalLock ();
- return_ACPI_STATUS (Status);
- }
-
- Status = AcpiAmlSystemWaitSemaphore (ObjDesc->Mutex.Semaphore,
- (UINT32) TimeDesc->Integer.Value);
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlSystemReleaseMutex
- *
- * PARAMETERS: *ObjDesc - The object descriptor for this op
- *
- * RETURN: Status
- *
- * DESCRIPTION: Provides an access point to perform synchronization operations
- * within the AML. This operation is a request to release a
- * previously acquired Mutex. If the Mutex variable is set then
- * it will be decremented.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlSystemReleaseMutex (
- ACPI_OPERAND_OBJECT *ObjDesc)
-{
- ACPI_STATUS Status = AE_OK;
-
-
- FUNCTION_TRACE ("AcpiAmlSystemReleaseMutex");
-
-
- if (!ObjDesc)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- /*
- * Support for the _GL_ Mutex object -- release the global lock
- */
- if (ObjDesc->Mutex.Semaphore == AcpiGbl_GlobalLockSemaphore)
- {
- AcpiEvReleaseGlobalLock ();
- return_ACPI_STATUS (AE_OK);
- }
-
- Status = AcpiOsSignalSemaphore (ObjDesc->Mutex.Semaphore, 1);
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlSystemSignalEvent
- *
- * PARAMETERS: *ObjDesc - The object descriptor for this op
- *
- * RETURN: AE_OK
- *
- * DESCRIPTION: Provides an access point to perform synchronization operations
- * within the AML.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlSystemSignalEvent (
- ACPI_OPERAND_OBJECT *ObjDesc)
-{
- ACPI_STATUS Status = AE_OK;
-
-
- FUNCTION_TRACE ("AcpiAmlSystemSignalEvent");
-
-
- if (ObjDesc)
- {
- Status = AcpiOsSignalSemaphore (ObjDesc->Event.Semaphore, 1);
- }
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlSystemWaitEvent
- *
- * PARAMETERS: *TimeDesc - The 'time to delay' object descriptor
- * *ObjDesc - The object descriptor for this op
- *
- * RETURN: Status
- *
- * DESCRIPTION: Provides an access point to perform synchronization operations
- * within the AML. This operation is a request to wait for an
- * event.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlSystemWaitEvent (
- ACPI_OPERAND_OBJECT *TimeDesc,
- ACPI_OPERAND_OBJECT *ObjDesc)
-{
- ACPI_STATUS Status = AE_OK;
-
-
- FUNCTION_TRACE ("AcpiAmlSystemWaitEvent");
-
-
- if (ObjDesc)
- {
- Status = AcpiAmlSystemWaitSemaphore (ObjDesc->Event.Semaphore,
- (UINT32) TimeDesc->Integer.Value);
- }
-
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlSystemResetEvent
- *
- * PARAMETERS: *ObjDesc - The object descriptor for this op
- *
- * RETURN: Status
- *
- * DESCRIPTION: Provides an access point to perform synchronization operations
- * within the AML.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlSystemResetEvent (
- ACPI_OPERAND_OBJECT *ObjDesc)
-{
- ACPI_STATUS Status = AE_OK;
- void *TempSemaphore;
-
-
- /*
- * We are going to simply delete the existing semaphore and
- * create a new one!
- */
-
- Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, 0, &TempSemaphore);
- if (ACPI_SUCCESS (Status))
- {
- AcpiOsDeleteSemaphore (ObjDesc->Mutex.Semaphore);
- ObjDesc->Mutex.Semaphore = TempSemaphore;
- }
-
- return (Status);
-}
-
diff --git a/sys/contrib/dev/acpica/Subsystem/Interpreter/amutils.c b/sys/contrib/dev/acpica/Subsystem/Interpreter/amutils.c
deleted file mode 100644
index 7f179917dd5b..000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Interpreter/amutils.c
+++ /dev/null
@@ -1,496 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: amutils - interpreter/scanner utilities
- * $Revision: 69 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 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 __AMUTILS_C__
-
-#include "acpi.h"
-#include "acparser.h"
-#include "acinterp.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-#include "acevents.h"
-
-#define _COMPONENT INTERPRETER
- MODULE_NAME ("amutils")
-
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlEnterInterpreter
- *
- * PARAMETERS: None
- *
- * DESCRIPTION: Enter the interpreter execution region
- *
- ******************************************************************************/
-
-void
-AcpiAmlEnterInterpreter (void)
-{
- FUNCTION_TRACE ("AmlEnterInterpreter");
-
-
- AcpiCmAcquireMutex (ACPI_MTX_EXECUTE);
-
- return_VOID;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlExitInterpreter
- *
- * PARAMETERS: None
- *
- * DESCRIPTION: Exit the interpreter execution region
- *
- * Cases where the interpreter is unlocked:
- * 1) Completion of the execution of a control method
- * 2) Method blocked on a Sleep() AML opcode
- * 3) Method blocked on an Acquire() AML opcode
- * 4) Method blocked on a Wait() AML opcode
- * 5) Method blocked to acquire the global lock
- * 6) Method blocked to execute a serialized control method that is
- * already executing
- * 7) About to invoke a user-installed opregion handler
- *
- ******************************************************************************/
-
-void
-AcpiAmlExitInterpreter (void)
-{
- FUNCTION_TRACE ("AmlExitInterpreter");
-
-
- AcpiCmReleaseMutex (ACPI_MTX_EXECUTE);
-
- return_VOID;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlValidateObjectType
- *
- * PARAMETERS: Type Object type to validate
- *
- * DESCRIPTION: Determine if a type is a valid ACPI object type
- *
- ******************************************************************************/
-
-BOOLEAN
-AcpiAmlValidateObjectType (
- ACPI_OBJECT_TYPE Type)
-{
-
- if ((Type > ACPI_TYPE_MAX && Type < INTERNAL_TYPE_BEGIN) ||
- (Type > INTERNAL_TYPE_MAX))
- {
- return (FALSE);
- }
-
- return (TRUE);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlTruncateFor32bitTable
- *
- * PARAMETERS: ObjDesc - Object to be truncated
- * WalkState - Current walk state
- * (A method must be executing)
- *
- * RETURN: none
- *
- * DESCRIPTION: Truncate a number to 32-bits if the currently executing method
- * belongs to a 32-bit ACPI table.
- *
- ******************************************************************************/
-
-void
-AcpiAmlTruncateFor32bitTable (
- ACPI_OPERAND_OBJECT *ObjDesc,
- ACPI_WALK_STATE *WalkState)
-{
-
- /*
- * Object must be a valid number and we must be executing
- * a control method
- */
-
- if ((!ObjDesc) ||
- (ObjDesc->Common.Type != ACPI_TYPE_INTEGER) ||
- (!WalkState->MethodNode))
- {
- return;
- }
-
- if (WalkState->MethodNode->Flags & ANOBJ_DATA_WIDTH_32)
- {
- /*
- * We are running a method that exists in a 32-bit ACPI table.
- * Truncate the value to 32 bits by zeroing out the upper 32-bit field
- */
- ObjDesc->Integer.Value &= (ACPI_INTEGER) ACPI_UINT32_MAX;
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlAcquireGlobalLock
- *
- * PARAMETERS: Rule - Lock rule: AlwaysLock, NeverLock
- *
- * RETURN: TRUE/FALSE indicating whether the lock was actually acquired
- *
- * DESCRIPTION: Obtain the global lock and keep track of this fact via two
- * methods. A global variable keeps the state of the lock, and
- * the state is returned to the caller.
- *
- ******************************************************************************/
-
-BOOLEAN
-AcpiAmlAcquireGlobalLock (
- UINT32 Rule)
-{
- BOOLEAN Locked = FALSE;
- ACPI_STATUS Status;
-
-
- FUNCTION_TRACE ("AmlAcquireGlobalLock");
-
-
- /* Only attempt lock if the Rule says so */
-
- if (Rule == (UINT32) GLOCK_ALWAYS_LOCK)
- {
- /* OK to get the lock */
-
- Status = AcpiEvAcquireGlobalLock ();
- if (ACPI_FAILURE (Status))
- {
- DEBUG_PRINT (ACPI_ERROR, ("Get Global Lock Failed!!\n"));
- }
-
- if (ACPI_SUCCESS (Status))
- {
- AcpiGbl_GlobalLockSet = TRUE;
- Locked = TRUE;
- }
- }
-
- return_VALUE (Locked);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlReleaseGlobalLock
- *
- * PARAMETERS: LockedByMe - Return value from corresponding call to
- * AcquireGlobalLock.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Release the global lock if it is locked.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlReleaseGlobalLock (
- BOOLEAN LockedByMe)
-{
-
- FUNCTION_TRACE ("AmlReleaseGlobalLock");
-
-
- /* Only attempt unlock if the caller locked it */
-
- if (LockedByMe)
- {
- /* Double check against the global flag */
-
- if (AcpiGbl_GlobalLockSet)
- {
- /* OK, now release the lock */
-
- AcpiEvReleaseGlobalLock ();
- AcpiGbl_GlobalLockSet = FALSE;
- }
-
- else
- {
- DEBUG_PRINT (ACPI_ERROR, ("Global lock was not set\n"));
- }
- }
-
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlDigitsNeeded
- *
- * PARAMETERS: val - Value to be represented
- * base - Base of representation
- *
- * RETURN: the number of digits needed to represent val in base
- *
- ******************************************************************************/
-
-UINT32
-AcpiAmlDigitsNeeded (
- ACPI_INTEGER val,
- UINT32 base)
-{
- UINT32 NumDigits = 0;
-
-
- FUNCTION_TRACE ("AmlDigitsNeeded");
-
-
- if (base < 1)
- {
- REPORT_ERROR (("AmlDigitsNeeded: Internal error - Invalid base\n"));
- }
-
- else
- {
- for (NumDigits = 1 + (val < 0); (val = ACPI_DIVIDE (val,base)); ++NumDigits)
- { ; }
- }
-
- return_VALUE (NumDigits);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: ntohl
- *
- * PARAMETERS: Value - Value to be converted
- *
- * DESCRIPTION: Convert a 32-bit value to big-endian (swap the bytes)
- *
- ******************************************************************************/
-
-static UINT32
-_ntohl (
- UINT32 Value)
-{
- union
- {
- UINT32 Value;
- UINT8 Bytes[4];
- } Out;
-
- union
- {
- UINT32 Value;
- UINT8 Bytes[4];
- } In;
-
-
- In.Value = Value;
-
- Out.Bytes[0] = In.Bytes[3];
- Out.Bytes[1] = In.Bytes[2];
- Out.Bytes[2] = In.Bytes[1];
- Out.Bytes[3] = In.Bytes[0];
-
- return (Out.Value);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlEisaIdToString
- *
- * PARAMETERS: NumericId - EISA ID to be converted
- * OutString - Where to put the converted string (8 bytes)
- *
- * DESCRIPTION: Convert a numeric EISA ID to string representation
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlEisaIdToString (
- UINT32 NumericId,
- NATIVE_CHAR *OutString)
-{
- UINT32 id;
-
- /* swap to big-endian to get contiguous bits */
-
- id = _ntohl (NumericId);
-
- OutString[0] = (char) ('@' + ((id >> 26) & 0x1f));
- OutString[1] = (char) ('@' + ((id >> 21) & 0x1f));
- OutString[2] = (char) ('@' + ((id >> 16) & 0x1f));
- OutString[3] = AcpiGbl_HexToAscii[(id >> 12) & 0xf];
- OutString[4] = AcpiGbl_HexToAscii[(id >> 8) & 0xf];
- OutString[5] = AcpiGbl_HexToAscii[(id >> 4) & 0xf];
- OutString[6] = AcpiGbl_HexToAscii[id & 0xf];
- OutString[7] = 0;
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlUnsignedIntegerToString
- *
- * PARAMETERS: Value - Value to be converted
- * OutString - Where to put the converted string (8 bytes)
- *
- * RETURN: Convert a number to string representation
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlUnsignedIntegerToString (
- ACPI_INTEGER Value,
- NATIVE_CHAR *OutString)
-{
- UINT32 Count;
- UINT32 DigitsNeeded;
-
-
- DigitsNeeded = AcpiAmlDigitsNeeded (Value, 10);
-
- OutString[DigitsNeeded] = '\0';
-
- for (Count = DigitsNeeded; Count > 0; Count--)
- {
- OutString[Count-1] = (NATIVE_CHAR) ('0' + (ACPI_MODULO (Value, 10)));
- Value = ACPI_DIVIDE (Value, 10);
- }
-
- return (AE_OK);
-}
-
-
-
-
-
-
diff --git a/sys/contrib/dev/acpica/Subsystem/Interpreter/amxface.c b/sys/contrib/dev/acpica/Subsystem/Interpreter/amxface.c
deleted file mode 100644
index 960677eb8745..000000000000
--- a/sys/contrib/dev/acpica/Subsystem/Interpreter/amxface.c
+++ /dev/null
@@ -1,190 +0,0 @@
-
-/******************************************************************************
- *
- * Module Name: amxface - External interpreter interfaces
- * $Revision: 24 $
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- * 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 __AMXFACE_C__
-
-#include "acpi.h"
-#include "acinterp.h"
-
-
-#define _COMPONENT INTERPRETER
- MODULE_NAME ("amxface")
-
-
-/*
- * DEFINE_AML_GLOBALS is tested in amlcode.h
- * to determine whether certain global names should be "defined" or only
- * "declared" in the current compilation. This enhances maintainability
- * by enabling a single header file to embody all knowledge of the names
- * in question.
- *
- * Exactly one module of any executable should #define DEFINE_GLOBALS
- * before #including the header files which use this convention. The
- * names in question will be defined and initialized in that module,
- * and declared as extern in all other modules which #include those
- * header files.
- */
-
-#define DEFINE_AML_GLOBALS
-#include "amlcode.h"
-#include "acparser.h"
-#include "acnamesp.h"
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAmlExecuteMethod
- *
- * PARAMETERS: Pcode - Pointer to the pcode stream
- * PcodeLength - Length of pcode that comprises the method
- * **Params - List of parameters to pass to method,
- * terminated by NULL. Params itself may be
- * NULL if no parameters are being passed.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Execute a control method
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAmlExecuteMethod (
- ACPI_NAMESPACE_NODE *MethodNode,
- ACPI_OPERAND_OBJECT **Params,
- ACPI_OPERAND_OBJECT **ReturnObjDesc)
-{
- ACPI_STATUS Status;
-
-
- FUNCTION_TRACE ("AmlExecuteMethod");
-
-
- /*
- * The point here is to lock the interpreter and call the low
- * level execute.
- */
-
- AcpiAmlEnterInterpreter ();
-
- Status = AcpiPsxExecute (MethodNode, Params, ReturnObjDesc);
-
- AcpiAmlExitInterpreter ();
-
- return_ACPI_STATUS (Status);
-}
-
-