2000-10-28 05:01:06 +00:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
2001-05-29 19:52:40 +00:00
|
|
|
* Module Name: utcopy - Internal to external object translation utilities
|
2002-02-23 05:10:40 +00:00
|
|
|
* $Revision: 94 $
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* 1. Copyright Notice
|
|
|
|
*
|
2002-02-23 05:10:40 +00:00
|
|
|
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
|
2000-12-21 06:56:46 +00:00
|
|
|
* All rights reserved.
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2001-05-29 19:52:40 +00:00
|
|
|
#define __UTCOPY_C__
|
2000-10-28 05:01:06 +00:00
|
|
|
|
|
|
|
#include "acpi.h"
|
|
|
|
#include "acinterp.h"
|
|
|
|
#include "acnamesp.h"
|
2001-03-05 02:15:19 +00:00
|
|
|
#include "amlcode.h"
|
2000-10-28 05:01:06 +00:00
|
|
|
|
|
|
|
|
2001-05-29 19:52:40 +00:00
|
|
|
#define _COMPONENT ACPI_UTILITIES
|
2002-02-23 05:10:40 +00:00
|
|
|
ACPI_MODULE_NAME ("utcopy")
|
2000-10-28 05:01:06 +00:00
|
|
|
|
|
|
|
|
2001-03-05 02:15:19 +00:00
|
|
|
/*******************************************************************************
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
2001-05-29 19:52:40 +00:00
|
|
|
* FUNCTION: AcpiUtCopyIsimpleToEsimple
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
2001-03-05 02:15:19 +00:00
|
|
|
* PARAMETERS: *InternalObject - Pointer to the object we are examining
|
|
|
|
* *Buffer - Where the object is returned
|
|
|
|
* *SpaceUsed - Where the data length is returned
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
2001-03-05 02:15:19 +00:00
|
|
|
* RETURN: Status
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
|
|
|
* DESCRIPTION: This function is called to place a simple object in a user
|
2001-03-05 02:15:19 +00:00
|
|
|
* buffer.
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
|
|
|
* The buffer is assumed to have sufficient space for the object.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2000-12-01 09:36:25 +00:00
|
|
|
static ACPI_STATUS
|
2001-05-29 19:52:40 +00:00
|
|
|
AcpiUtCopyIsimpleToEsimple (
|
2001-03-05 02:15:19 +00:00
|
|
|
ACPI_OPERAND_OBJECT *InternalObject,
|
|
|
|
ACPI_OBJECT *ExternalObject,
|
2000-10-28 05:01:06 +00:00
|
|
|
UINT8 *DataSpace,
|
2002-02-23 05:10:40 +00:00
|
|
|
ACPI_SIZE *BufferSpaceUsed)
|
2000-10-28 05:01:06 +00:00
|
|
|
{
|
2002-02-23 05:10:40 +00:00
|
|
|
ACPI_BUFFER Buffer;
|
2001-03-05 02:15:19 +00:00
|
|
|
ACPI_STATUS Status = AE_OK;
|
2000-10-28 05:01:06 +00:00
|
|
|
|
|
|
|
|
2002-02-23 05:10:40 +00:00
|
|
|
ACPI_FUNCTION_TRACE ("UtCopyIsimpleToEsimple");
|
|
|
|
|
2000-10-28 05:01:06 +00:00
|
|
|
|
2002-02-23 05:10:40 +00:00
|
|
|
*BufferSpaceUsed = 0;
|
2000-10-28 05:01:06 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Check for NULL object case (could be an uninitialized
|
|
|
|
* package element
|
|
|
|
*/
|
2001-03-05 02:15:19 +00:00
|
|
|
if (!InternalObject)
|
2000-10-28 05:01:06 +00:00
|
|
|
{
|
|
|
|
return_ACPI_STATUS (AE_OK);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Always clear the external object */
|
|
|
|
|
2002-02-23 05:10:40 +00:00
|
|
|
ACPI_MEMSET (ExternalObject, 0, sizeof (ACPI_OBJECT));
|
2000-10-28 05:01:06 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* In general, the external object will be the same type as
|
|
|
|
* the internal object
|
|
|
|
*/
|
2001-03-05 02:15:19 +00:00
|
|
|
ExternalObject->Type = InternalObject->Common.Type;
|
2000-10-28 05:01:06 +00:00
|
|
|
|
|
|
|
/* However, only a limited number of external types are supported */
|
|
|
|
|
2001-03-05 02:15:19 +00:00
|
|
|
switch (InternalObject->Common.Type)
|
2000-10-28 05:01:06 +00:00
|
|
|
{
|
|
|
|
case ACPI_TYPE_STRING:
|
|
|
|
|
2001-03-05 02:15:19 +00:00
|
|
|
ExternalObject->String.Pointer = (NATIVE_CHAR *) DataSpace;
|
2002-02-23 05:10:40 +00:00
|
|
|
ExternalObject->String.Length = InternalObject->String.Length;
|
|
|
|
*BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD (InternalObject->String.Length + 1);
|
|
|
|
|
|
|
|
ACPI_MEMCPY ((void *) DataSpace, (void *) InternalObject->String.Pointer,
|
|
|
|
InternalObject->String.Length + 1);
|
2000-10-28 05:01:06 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case ACPI_TYPE_BUFFER:
|
|
|
|
|
2001-03-05 02:15:19 +00:00
|
|
|
ExternalObject->Buffer.Pointer = DataSpace;
|
2002-02-23 05:10:40 +00:00
|
|
|
ExternalObject->Buffer.Length = InternalObject->Buffer.Length;
|
|
|
|
*BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD (InternalObject->String.Length);
|
|
|
|
|
|
|
|
ACPI_MEMCPY ((void *) DataSpace, (void *) InternalObject->Buffer.Pointer,
|
|
|
|
InternalObject->Buffer.Length);
|
2000-10-28 05:01:06 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
2001-01-31 09:17:50 +00:00
|
|
|
case ACPI_TYPE_INTEGER:
|
2000-10-28 05:01:06 +00:00
|
|
|
|
2002-02-23 05:10:40 +00:00
|
|
|
ExternalObject->Integer.Value = InternalObject->Integer.Value;
|
2000-10-28 05:01:06 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case INTERNAL_TYPE_REFERENCE:
|
|
|
|
|
|
|
|
/*
|
2001-03-05 02:15:19 +00:00
|
|
|
* This is an object reference. Attempt to dereference it.
|
2000-10-28 05:01:06 +00:00
|
|
|
*/
|
2001-05-29 19:52:40 +00:00
|
|
|
switch (InternalObject->Reference.Opcode)
|
2001-03-05 02:15:19 +00:00
|
|
|
{
|
|
|
|
case AML_ZERO_OP:
|
|
|
|
ExternalObject->Type = ACPI_TYPE_INTEGER;
|
|
|
|
ExternalObject->Integer.Value = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AML_ONE_OP:
|
|
|
|
ExternalObject->Type = ACPI_TYPE_INTEGER;
|
|
|
|
ExternalObject->Integer.Value = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AML_ONES_OP:
|
|
|
|
ExternalObject->Type = ACPI_TYPE_INTEGER;
|
|
|
|
ExternalObject->Integer.Value = ACPI_INTEGER_MAX;
|
|
|
|
break;
|
|
|
|
|
2001-10-04 23:12:13 +00:00
|
|
|
case AML_REVISION_OP:
|
|
|
|
ExternalObject->Type = ACPI_TYPE_INTEGER;
|
2001-10-31 02:32:29 +00:00
|
|
|
ExternalObject->Integer.Value = ACPI_CA_SUPPORT_LEVEL;
|
2001-10-04 23:12:13 +00:00
|
|
|
break;
|
|
|
|
|
2001-05-29 19:52:40 +00:00
|
|
|
case AML_INT_NAMEPATH_OP:
|
2001-03-05 02:15:19 +00:00
|
|
|
/*
|
|
|
|
* This is a named reference, get the string. We already know that
|
|
|
|
* we have room for it, use max length
|
|
|
|
*/
|
|
|
|
ExternalObject->Type = ACPI_TYPE_STRING;
|
|
|
|
ExternalObject->String.Pointer = (NATIVE_CHAR *) DataSpace;
|
2002-02-23 05:10:40 +00:00
|
|
|
|
|
|
|
Buffer.Length = MAX_STRING_LENGTH;
|
|
|
|
Buffer.Pointer = DataSpace;
|
|
|
|
|
2001-03-05 02:15:19 +00:00
|
|
|
Status = AcpiNsHandleToPathname ((ACPI_HANDLE *) InternalObject->Reference.Node,
|
2002-02-23 05:10:40 +00:00
|
|
|
&Buffer);
|
2001-05-29 19:52:40 +00:00
|
|
|
|
|
|
|
/* Converted (external) string length is returned from above */
|
|
|
|
|
2002-02-23 05:10:40 +00:00
|
|
|
ExternalObject->String.Length = Buffer.Length;
|
|
|
|
*BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD (Buffer.Length);
|
2001-03-05 02:15:19 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2001-05-29 19:52:40 +00:00
|
|
|
/*
|
2001-03-05 02:15:19 +00:00
|
|
|
* Use the object type of "Any" to indicate a reference
|
|
|
|
* to object containing a handle to an ACPI named object.
|
2001-05-29 19:52:40 +00:00
|
|
|
*/
|
2001-03-05 02:15:19 +00:00
|
|
|
ExternalObject->Type = ACPI_TYPE_ANY;
|
|
|
|
ExternalObject->Reference.Handle = InternalObject->Reference.Node;
|
|
|
|
break;
|
|
|
|
}
|
2000-10-28 05:01:06 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case ACPI_TYPE_PROCESSOR:
|
|
|
|
|
2001-03-05 02:15:19 +00:00
|
|
|
ExternalObject->Processor.ProcId = InternalObject->Processor.ProcId;
|
|
|
|
ExternalObject->Processor.PblkAddress = InternalObject->Processor.Address;
|
|
|
|
ExternalObject->Processor.PblkLength = InternalObject->Processor.Length;
|
2000-10-28 05:01:06 +00:00
|
|
|
break;
|
|
|
|
|
2001-03-05 02:15:19 +00:00
|
|
|
|
2000-10-28 05:01:06 +00:00
|
|
|
case ACPI_TYPE_POWER:
|
|
|
|
|
2001-05-29 19:52:40 +00:00
|
|
|
ExternalObject->PowerResource.SystemLevel =
|
2001-03-05 02:15:19 +00:00
|
|
|
InternalObject->PowerResource.SystemLevel;
|
2000-10-28 05:01:06 +00:00
|
|
|
|
2001-03-05 02:15:19 +00:00
|
|
|
ExternalObject->PowerResource.ResourceOrder =
|
|
|
|
InternalObject->PowerResource.ResourceOrder;
|
2000-10-28 05:01:06 +00:00
|
|
|
break;
|
|
|
|
|
2001-03-05 02:15:19 +00:00
|
|
|
|
2000-10-28 05:01:06 +00:00
|
|
|
default:
|
2001-03-05 02:15:19 +00:00
|
|
|
/*
|
|
|
|
* There is no corresponding external object type
|
|
|
|
*/
|
|
|
|
return_ACPI_STATUS (AE_SUPPORT);
|
2000-10-28 05:01:06 +00:00
|
|
|
}
|
|
|
|
|
2001-03-05 02:15:19 +00:00
|
|
|
return_ACPI_STATUS (Status);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
2001-05-29 19:52:40 +00:00
|
|
|
* FUNCTION: AcpiUtCopyIelementToEelement
|
2001-03-05 02:15:19 +00:00
|
|
|
*
|
|
|
|
* PARAMETERS: ACPI_PKG_CALLBACK
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Copy one package element to another package element
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
ACPI_STATUS
|
2001-05-29 19:52:40 +00:00
|
|
|
AcpiUtCopyIelementToEelement (
|
2001-03-05 02:15:19 +00:00
|
|
|
UINT8 ObjectType,
|
|
|
|
ACPI_OPERAND_OBJECT *SourceObject,
|
|
|
|
ACPI_GENERIC_STATE *State,
|
|
|
|
void *Context)
|
|
|
|
{
|
|
|
|
ACPI_STATUS Status = AE_OK;
|
|
|
|
ACPI_PKG_INFO *Info = (ACPI_PKG_INFO *) Context;
|
2002-02-23 05:10:40 +00:00
|
|
|
ACPI_SIZE ObjectSpace;
|
2001-03-05 02:15:19 +00:00
|
|
|
UINT32 ThisIndex;
|
|
|
|
ACPI_OBJECT *TargetObject;
|
|
|
|
|
|
|
|
|
2002-02-23 05:10:40 +00:00
|
|
|
ACPI_FUNCTION_ENTRY ();
|
2001-09-07 01:22:25 +00:00
|
|
|
|
|
|
|
|
2001-08-26 22:28:18 +00:00
|
|
|
ThisIndex = State->Pkg.Index;
|
|
|
|
TargetObject = (ACPI_OBJECT *)
|
|
|
|
&((ACPI_OBJECT *)(State->Pkg.DestObject))->Package.Elements[ThisIndex];
|
2001-03-05 02:15:19 +00:00
|
|
|
|
|
|
|
switch (ObjectType)
|
2000-10-28 05:01:06 +00:00
|
|
|
{
|
2001-05-29 19:52:40 +00:00
|
|
|
case ACPI_COPY_TYPE_SIMPLE:
|
2001-03-05 02:15:19 +00:00
|
|
|
|
2000-10-28 05:01:06 +00:00
|
|
|
/*
|
2001-11-28 04:29:40 +00:00
|
|
|
* This is a simple or null object
|
2000-10-28 05:01:06 +00:00
|
|
|
*/
|
2001-05-29 19:52:40 +00:00
|
|
|
Status = AcpiUtCopyIsimpleToEsimple (SourceObject,
|
2001-03-05 02:15:19 +00:00
|
|
|
TargetObject, Info->FreeSpace, &ObjectSpace);
|
|
|
|
if (ACPI_FAILURE (Status))
|
|
|
|
{
|
|
|
|
return (Status);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2001-11-28 04:29:40 +00:00
|
|
|
|
2001-05-29 19:52:40 +00:00
|
|
|
case ACPI_COPY_TYPE_PACKAGE:
|
2001-03-05 02:15:19 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Build the package object
|
|
|
|
*/
|
|
|
|
TargetObject->Type = ACPI_TYPE_PACKAGE;
|
|
|
|
TargetObject->Package.Count = SourceObject->Package.Count;
|
|
|
|
TargetObject->Package.Elements = (ACPI_OBJECT *) Info->FreeSpace;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Pass the new package object back to the package walk routine
|
|
|
|
*/
|
|
|
|
State->Pkg.ThisTargetObj = TargetObject;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Save space for the array of objects (Package elements)
|
|
|
|
* update the buffer length counter
|
|
|
|
*/
|
2002-02-23 05:10:40 +00:00
|
|
|
ObjectSpace = ACPI_ROUND_UP_TO_NATIVE_WORD (
|
2001-03-05 02:15:19 +00:00
|
|
|
TargetObject->Package.Count * sizeof (ACPI_OBJECT));
|
|
|
|
break;
|
|
|
|
|
2001-11-28 04:29:40 +00:00
|
|
|
|
2001-03-05 02:15:19 +00:00
|
|
|
default:
|
|
|
|
return (AE_BAD_PARAMETER);
|
2000-10-28 05:01:06 +00:00
|
|
|
}
|
|
|
|
|
2001-03-05 02:15:19 +00:00
|
|
|
Info->FreeSpace += ObjectSpace;
|
|
|
|
Info->Length += ObjectSpace;
|
|
|
|
return (Status);
|
2000-10-28 05:01:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-03-05 02:15:19 +00:00
|
|
|
/*******************************************************************************
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
2001-05-29 19:52:40 +00:00
|
|
|
* FUNCTION: AcpiUtCopyIpackageToEpackage
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
2001-03-05 02:15:19 +00:00
|
|
|
* PARAMETERS: *InternalObject - Pointer to the object we are returning
|
|
|
|
* *Buffer - Where the object is returned
|
|
|
|
* *SpaceUsed - Where the object length is returned
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
2001-03-05 02:15:19 +00:00
|
|
|
* RETURN: Status
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
|
|
|
* DESCRIPTION: This function is called to place a package object in a user
|
|
|
|
* buffer. A package object by definition contains other objects.
|
|
|
|
*
|
|
|
|
* The buffer is assumed to have sufficient space for the object.
|
|
|
|
* The caller must have verified the buffer length needed using the
|
2001-05-29 19:52:40 +00:00
|
|
|
* AcpiUtGetObjectSize function before calling this function.
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2000-12-01 09:36:25 +00:00
|
|
|
static ACPI_STATUS
|
2001-05-29 19:52:40 +00:00
|
|
|
AcpiUtCopyIpackageToEpackage (
|
2001-03-05 02:15:19 +00:00
|
|
|
ACPI_OPERAND_OBJECT *InternalObject,
|
2000-10-28 05:01:06 +00:00
|
|
|
UINT8 *Buffer,
|
2002-02-23 05:10:40 +00:00
|
|
|
ACPI_SIZE *SpaceUsed)
|
2000-10-28 05:01:06 +00:00
|
|
|
{
|
2001-03-05 02:15:19 +00:00
|
|
|
ACPI_OBJECT *ExternalObject;
|
2000-10-28 05:01:06 +00:00
|
|
|
ACPI_STATUS Status;
|
2001-03-05 02:15:19 +00:00
|
|
|
ACPI_PKG_INFO Info;
|
2000-10-28 05:01:06 +00:00
|
|
|
|
|
|
|
|
2002-02-23 05:10:40 +00:00
|
|
|
ACPI_FUNCTION_TRACE ("UtCopyIpackageToEpackage");
|
2000-10-28 05:01:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* First package at head of the buffer
|
|
|
|
*/
|
2001-03-05 02:15:19 +00:00
|
|
|
ExternalObject = (ACPI_OBJECT *) Buffer;
|
2000-10-28 05:01:06 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Free space begins right after the first package
|
|
|
|
*/
|
2001-03-05 02:15:19 +00:00
|
|
|
Info.Length = 0;
|
|
|
|
Info.ObjectSpace = 0;
|
|
|
|
Info.NumPackages = 1;
|
2002-02-23 05:10:40 +00:00
|
|
|
Info.FreeSpace = Buffer + ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT));
|
2000-10-28 05:01:06 +00:00
|
|
|
|
2001-03-05 02:15:19 +00:00
|
|
|
ExternalObject->Type = InternalObject->Common.Type;
|
|
|
|
ExternalObject->Package.Count = InternalObject->Package.Count;
|
|
|
|
ExternalObject->Package.Elements = (ACPI_OBJECT *) Info.FreeSpace;
|
2000-10-28 05:01:06 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Build an array of ACPI_OBJECTS in the buffer
|
|
|
|
* and move the free space past it
|
|
|
|
*/
|
2001-03-05 02:15:19 +00:00
|
|
|
Info.FreeSpace += ExternalObject->Package.Count *
|
2002-02-23 05:10:40 +00:00
|
|
|
ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT));
|
2000-10-28 05:01:06 +00:00
|
|
|
|
2001-05-29 19:52:40 +00:00
|
|
|
Status = AcpiUtWalkPackageTree (InternalObject, ExternalObject,
|
|
|
|
AcpiUtCopyIelementToEelement, &Info);
|
2000-10-28 05:01:06 +00:00
|
|
|
|
2001-03-05 02:15:19 +00:00
|
|
|
*SpaceUsed = Info.Length;
|
|
|
|
return_ACPI_STATUS (Status);
|
2000-10-28 05:01:06 +00:00
|
|
|
}
|
|
|
|
|
2001-11-28 04:29:40 +00:00
|
|
|
|
2001-03-05 02:15:19 +00:00
|
|
|
/*******************************************************************************
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
2001-05-29 19:52:40 +00:00
|
|
|
* FUNCTION: AcpiUtCopyIobjectToEobject
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
2001-03-05 02:15:19 +00:00
|
|
|
* PARAMETERS: *InternalObject - The internal object to be converted
|
|
|
|
* *BufferPtr - Where the object is returned
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
2001-05-29 19:52:40 +00:00
|
|
|
* RETURN: Status
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
|
|
|
* DESCRIPTION: This function is called to build an API object to be returned to
|
|
|
|
* the caller.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
ACPI_STATUS
|
2001-05-29 19:52:40 +00:00
|
|
|
AcpiUtCopyIobjectToEobject (
|
2001-03-05 02:15:19 +00:00
|
|
|
ACPI_OPERAND_OBJECT *InternalObject,
|
2000-10-28 05:01:06 +00:00
|
|
|
ACPI_BUFFER *RetBuffer)
|
|
|
|
{
|
|
|
|
ACPI_STATUS Status;
|
|
|
|
|
|
|
|
|
2002-02-23 05:10:40 +00:00
|
|
|
ACPI_FUNCTION_TRACE ("UtCopyIobjectToEobject");
|
2000-10-28 05:01:06 +00:00
|
|
|
|
|
|
|
|
2002-02-23 05:10:40 +00:00
|
|
|
if (InternalObject->Common.Type == ACPI_TYPE_PACKAGE)
|
2000-10-28 05:01:06 +00:00
|
|
|
{
|
|
|
|
/*
|
2001-05-29 19:52:40 +00:00
|
|
|
* Package object: Copy all subobjects (including
|
2001-03-05 02:15:19 +00:00
|
|
|
* nested packages)
|
2000-10-28 05:01:06 +00:00
|
|
|
*/
|
2001-05-29 19:52:40 +00:00
|
|
|
Status = AcpiUtCopyIpackageToEpackage (InternalObject,
|
2001-03-05 02:15:19 +00:00
|
|
|
RetBuffer->Pointer, &RetBuffer->Length);
|
2000-10-28 05:01:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Build a simple object (no nested objects)
|
|
|
|
*/
|
2001-05-29 19:52:40 +00:00
|
|
|
Status = AcpiUtCopyIsimpleToEsimple (InternalObject,
|
2001-03-05 02:15:19 +00:00
|
|
|
(ACPI_OBJECT *) RetBuffer->Pointer,
|
|
|
|
((UINT8 *) RetBuffer->Pointer +
|
2002-02-23 05:10:40 +00:00
|
|
|
ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT))),
|
2001-03-05 02:15:19 +00:00
|
|
|
&RetBuffer->Length);
|
2000-10-28 05:01:06 +00:00
|
|
|
/*
|
|
|
|
* build simple does not include the object size in the length
|
|
|
|
* so we add it in here
|
|
|
|
*/
|
|
|
|
RetBuffer->Length += sizeof (ACPI_OBJECT);
|
|
|
|
}
|
|
|
|
|
|
|
|
return_ACPI_STATUS (Status);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-03-05 02:15:19 +00:00
|
|
|
/*******************************************************************************
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
2001-05-29 19:52:40 +00:00
|
|
|
* FUNCTION: AcpiUtCopyEsimpleToIsimple
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
2001-03-05 02:15:19 +00:00
|
|
|
* PARAMETERS: *ExternalObject - The external object to be converted
|
|
|
|
* *InternalObject - Where the internal object is returned
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
2001-03-05 02:15:19 +00:00
|
|
|
* RETURN: Status
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
|
|
|
* DESCRIPTION: This function copies an external object to an internal one.
|
|
|
|
* NOTE: Pointers can be copied, we don't need to copy data.
|
|
|
|
* (The pointers have to be valid in our address space no matter
|
|
|
|
* what we do with them!)
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
ACPI_STATUS
|
2001-05-29 19:52:40 +00:00
|
|
|
AcpiUtCopyEsimpleToIsimple (
|
2001-03-05 02:15:19 +00:00
|
|
|
ACPI_OBJECT *ExternalObject,
|
2001-10-04 23:12:13 +00:00
|
|
|
ACPI_OPERAND_OBJECT **RetInternalObject)
|
2000-10-28 05:01:06 +00:00
|
|
|
{
|
2001-10-04 23:12:13 +00:00
|
|
|
ACPI_OPERAND_OBJECT *InternalObject;
|
|
|
|
|
2000-10-28 05:01:06 +00:00
|
|
|
|
2002-02-23 05:10:40 +00:00
|
|
|
ACPI_FUNCTION_TRACE ("UtCopyEsimpleToIsimple");
|
2000-10-28 05:01:06 +00:00
|
|
|
|
|
|
|
|
2001-07-21 03:55:17 +00:00
|
|
|
/*
|
|
|
|
* Simple types supported are: String, Buffer, Integer
|
|
|
|
*/
|
2001-03-05 02:15:19 +00:00
|
|
|
switch (ExternalObject->Type)
|
2000-10-28 05:01:06 +00:00
|
|
|
{
|
2001-10-04 23:12:13 +00:00
|
|
|
case ACPI_TYPE_STRING:
|
|
|
|
case ACPI_TYPE_BUFFER:
|
|
|
|
case ACPI_TYPE_INTEGER:
|
|
|
|
|
|
|
|
InternalObject = AcpiUtCreateInternalObject ((UINT8) ExternalObject->Type);
|
|
|
|
if (!InternalObject)
|
|
|
|
{
|
|
|
|
return_ACPI_STATUS (AE_NO_MEMORY);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
/*
|
|
|
|
* Whatever other type -- it is not supported
|
|
|
|
*/
|
|
|
|
return_ACPI_STATUS (AE_SUPPORT);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch (ExternalObject->Type)
|
|
|
|
{
|
|
|
|
|
|
|
|
/* Must COPY string and buffer contents */
|
2000-10-28 05:01:06 +00:00
|
|
|
|
|
|
|
case ACPI_TYPE_STRING:
|
|
|
|
|
2001-10-04 23:12:13 +00:00
|
|
|
InternalObject->String.Pointer = ACPI_MEM_CALLOCATE (ExternalObject->String.Length + 1);
|
|
|
|
if (!InternalObject->String.Pointer)
|
|
|
|
{
|
|
|
|
return_ACPI_STATUS (AE_NO_MEMORY);
|
|
|
|
}
|
|
|
|
|
2002-02-23 05:10:40 +00:00
|
|
|
ACPI_MEMCPY (InternalObject->String.Pointer,
|
|
|
|
ExternalObject->String.Pointer,
|
|
|
|
ExternalObject->String.Length);
|
2001-10-04 23:12:13 +00:00
|
|
|
|
2001-03-05 02:15:19 +00:00
|
|
|
InternalObject->String.Length = ExternalObject->String.Length;
|
2000-10-28 05:01:06 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case ACPI_TYPE_BUFFER:
|
|
|
|
|
2001-10-04 23:12:13 +00:00
|
|
|
InternalObject->Buffer.Pointer = ACPI_MEM_CALLOCATE (ExternalObject->Buffer.Length);
|
|
|
|
if (!InternalObject->Buffer.Pointer)
|
|
|
|
{
|
|
|
|
return_ACPI_STATUS (AE_NO_MEMORY);
|
|
|
|
}
|
|
|
|
|
2002-02-23 05:10:40 +00:00
|
|
|
ACPI_MEMCPY (InternalObject->Buffer.Pointer,
|
|
|
|
ExternalObject->Buffer.Pointer,
|
|
|
|
ExternalObject->Buffer.Length);
|
2001-10-04 23:12:13 +00:00
|
|
|
|
2001-03-05 02:15:19 +00:00
|
|
|
InternalObject->Buffer.Length = ExternalObject->Buffer.Length;
|
2000-10-28 05:01:06 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
2001-01-31 09:17:50 +00:00
|
|
|
case ACPI_TYPE_INTEGER:
|
2001-07-21 03:55:17 +00:00
|
|
|
|
2001-03-05 02:15:19 +00:00
|
|
|
InternalObject->Integer.Value = ExternalObject->Integer.Value;
|
2000-10-28 05:01:06 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2001-10-04 23:12:13 +00:00
|
|
|
*RetInternalObject = InternalObject;
|
2000-10-28 05:01:06 +00:00
|
|
|
return_ACPI_STATUS (AE_OK);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-12-01 09:36:25 +00:00
|
|
|
#ifdef ACPI_FUTURE_IMPLEMENTATION
|
|
|
|
|
|
|
|
/* Code to convert packages that are parameters to control methods */
|
|
|
|
|
2001-03-05 02:15:19 +00:00
|
|
|
/*******************************************************************************
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
2001-05-29 19:52:40 +00:00
|
|
|
* FUNCTION: AcpiUtCopyEpackageToIpackage
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
2001-03-05 02:15:19 +00:00
|
|
|
* PARAMETERS: *InternalObject - Pointer to the object we are returning
|
2000-10-28 05:01:06 +00:00
|
|
|
* *Buffer - Where the object is returned
|
|
|
|
* *SpaceUsed - Where the length of the object is returned
|
|
|
|
*
|
|
|
|
* RETURN: Status - the status of the call
|
|
|
|
*
|
|
|
|
* DESCRIPTION: This function is called to place a package object in a user
|
|
|
|
* buffer. A package object by definition contains other objects.
|
|
|
|
*
|
|
|
|
* The buffer is assumed to have sufficient space for the object.
|
|
|
|
* The caller must have verified the buffer length needed using the
|
2001-05-29 19:52:40 +00:00
|
|
|
* AcpiUtGetObjectSize function before calling this function.
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2000-12-01 09:36:25 +00:00
|
|
|
static ACPI_STATUS
|
2001-05-29 19:52:40 +00:00
|
|
|
AcpiUtCopyEpackageToIpackage (
|
2001-03-05 02:15:19 +00:00
|
|
|
ACPI_OPERAND_OBJECT *InternalObject,
|
2000-10-28 05:01:06 +00:00
|
|
|
UINT8 *Buffer,
|
|
|
|
UINT32 *SpaceUsed)
|
|
|
|
{
|
|
|
|
UINT8 *FreeSpace;
|
2001-03-05 02:15:19 +00:00
|
|
|
ACPI_OBJECT *ExternalObject;
|
2000-10-28 05:01:06 +00:00
|
|
|
UINT32 Length = 0;
|
|
|
|
UINT32 ThisIndex;
|
|
|
|
UINT32 ObjectSpace = 0;
|
|
|
|
ACPI_OPERAND_OBJECT *ThisInternalObj;
|
|
|
|
ACPI_OBJECT *ThisExternalObj;
|
|
|
|
|
|
|
|
|
2002-02-23 05:10:40 +00:00
|
|
|
ACPI_FUNCTION_TRACE ("UtCopyEpackageToIpackage");
|
2000-10-28 05:01:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* First package at head of the buffer
|
|
|
|
*/
|
2001-03-05 02:15:19 +00:00
|
|
|
ExternalObject = (ACPI_OBJECT *)Buffer;
|
2000-10-28 05:01:06 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Free space begins right after the first package
|
|
|
|
*/
|
|
|
|
FreeSpace = Buffer + sizeof(ACPI_OBJECT);
|
|
|
|
|
|
|
|
|
2001-03-05 02:15:19 +00:00
|
|
|
ExternalObject->Type = InternalObject->Common.Type;
|
|
|
|
ExternalObject->Package.Count = InternalObject->Package.Count;
|
|
|
|
ExternalObject->Package.Elements = (ACPI_OBJECT *)FreeSpace;
|
2000-10-28 05:01:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Build an array of ACPI_OBJECTS in the buffer
|
|
|
|
* and move the free space past it
|
|
|
|
*/
|
2001-03-05 02:15:19 +00:00
|
|
|
FreeSpace += ExternalObject->Package.Count * sizeof(ACPI_OBJECT);
|
2000-10-28 05:01:06 +00:00
|
|
|
|
|
|
|
|
2001-03-05 02:15:19 +00:00
|
|
|
/* Call WalkPackage */
|
2000-10-28 05:01:06 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2000-12-01 09:36:25 +00:00
|
|
|
#endif /* Future implementation */
|
|
|
|
|
2000-10-28 05:01:06 +00:00
|
|
|
|
2001-03-05 02:15:19 +00:00
|
|
|
/*******************************************************************************
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
2001-05-29 19:52:40 +00:00
|
|
|
* FUNCTION: AcpiUtCopyEobjectToIobject
|
2000-10-28 05:01:06 +00:00
|
|
|
*
|
2001-03-05 02:15:19 +00:00
|
|
|
* PARAMETERS: *InternalObject - The external object to be converted
|
2000-10-28 05:01:06 +00:00
|
|
|
* *BufferPtr - Where the internal object is returned
|
|
|
|
*
|
|
|
|
* RETURN: Status - the status of the call
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Converts an external object to an internal object.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
ACPI_STATUS
|
2001-05-29 19:52:40 +00:00
|
|
|
AcpiUtCopyEobjectToIobject (
|
2001-03-05 02:15:19 +00:00
|
|
|
ACPI_OBJECT *ExternalObject,
|
2001-10-04 23:12:13 +00:00
|
|
|
ACPI_OPERAND_OBJECT **InternalObject)
|
2000-10-28 05:01:06 +00:00
|
|
|
{
|
|
|
|
ACPI_STATUS Status;
|
|
|
|
|
|
|
|
|
2002-02-23 05:10:40 +00:00
|
|
|
ACPI_FUNCTION_TRACE ("UtCopyEobjectToIobject");
|
2000-10-28 05:01:06 +00:00
|
|
|
|
|
|
|
|
2001-03-05 02:15:19 +00:00
|
|
|
if (ExternalObject->Type == ACPI_TYPE_PACKAGE)
|
2000-10-28 05:01:06 +00:00
|
|
|
{
|
|
|
|
/*
|
2001-11-28 04:29:40 +00:00
|
|
|
* Packages as external input to control methods are not supported,
|
2000-10-28 05:01:06 +00:00
|
|
|
*/
|
2001-09-07 01:22:25 +00:00
|
|
|
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
2001-08-26 22:28:18 +00:00
|
|
|
"Packages as parameters not implemented!\n"));
|
2000-10-28 05:01:06 +00:00
|
|
|
|
|
|
|
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Build a simple object (no nested objects)
|
|
|
|
*/
|
2001-05-29 19:52:40 +00:00
|
|
|
Status = AcpiUtCopyEsimpleToIsimple (ExternalObject, InternalObject);
|
2000-10-28 05:01:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return_ACPI_STATUS (Status);
|
|
|
|
}
|
|
|
|
|
2001-03-05 02:15:19 +00:00
|
|
|
|
2002-02-23 05:10:40 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: AcpiUtCopySimpleObject
|
|
|
|
*
|
|
|
|
* PARAMETERS: SourceDesc - The internal object to be copied
|
|
|
|
* DestDesc - New target object
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Simple copy of one internal object to another. Reference count
|
|
|
|
* of the destination object is preserved.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
ACPI_STATUS
|
|
|
|
AcpiUtCopySimpleObject (
|
|
|
|
ACPI_OPERAND_OBJECT *SourceDesc,
|
|
|
|
ACPI_OPERAND_OBJECT *DestDesc)
|
|
|
|
{
|
|
|
|
UINT16 ReferenceCount;
|
|
|
|
ACPI_OPERAND_OBJECT *NextObject;
|
|
|
|
|
|
|
|
|
|
|
|
/* Save fields from destination that we don't want to overwrite */
|
|
|
|
|
|
|
|
ReferenceCount = DestDesc->Common.ReferenceCount;
|
|
|
|
NextObject = DestDesc->Common.NextObject;
|
|
|
|
|
|
|
|
/* Copy the entire source object over the destination object*/
|
|
|
|
|
|
|
|
ACPI_MEMCPY ((char *) DestDesc, (char *) SourceDesc, sizeof (ACPI_OPERAND_OBJECT));
|
|
|
|
|
|
|
|
/* Restore the saved fields */
|
|
|
|
|
|
|
|
DestDesc->Common.ReferenceCount = ReferenceCount;
|
|
|
|
DestDesc->Common.NextObject = NextObject;
|
|
|
|
|
|
|
|
/* Handle the objects with extra data */
|
|
|
|
|
|
|
|
switch (DestDesc->Common.Type)
|
|
|
|
{
|
|
|
|
case ACPI_TYPE_BUFFER:
|
|
|
|
|
|
|
|
DestDesc->Buffer.Node = NULL;
|
|
|
|
|
|
|
|
case ACPI_TYPE_STRING:
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Allocate and copy the actual string if and only if:
|
|
|
|
* 1) There is a valid string (length > 0)
|
|
|
|
* 2) The string is not static (not in an ACPI table) (in this case,
|
|
|
|
* the actual pointer was already copied above)
|
|
|
|
*/
|
|
|
|
if ((SourceDesc->String.Length) &&
|
|
|
|
(!(SourceDesc->Common.Flags & AOPOBJ_STATIC_POINTER)))
|
|
|
|
{
|
|
|
|
DestDesc->String.Pointer = ACPI_MEM_ALLOCATE (SourceDesc->String.Length);
|
|
|
|
if (!DestDesc->String.Pointer)
|
|
|
|
{
|
|
|
|
return (AE_NO_MEMORY);
|
|
|
|
}
|
|
|
|
|
|
|
|
ACPI_MEMCPY (DestDesc->String.Pointer, SourceDesc->String.Pointer,
|
|
|
|
SourceDesc->String.Length);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (AE_OK);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-03-05 02:15:19 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
2001-05-29 19:52:40 +00:00
|
|
|
* FUNCTION: AcpiUtCopyIelementToIelement
|
2001-03-05 02:15:19 +00:00
|
|
|
*
|
|
|
|
* PARAMETERS: ACPI_PKG_CALLBACK
|
|
|
|
*
|
2002-02-23 05:10:40 +00:00
|
|
|
* RETURN: Status
|
2001-03-05 02:15:19 +00:00
|
|
|
*
|
|
|
|
* DESCRIPTION: Copy one package element to another package element
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
ACPI_STATUS
|
2001-05-29 19:52:40 +00:00
|
|
|
AcpiUtCopyIelementToIelement (
|
2001-03-05 02:15:19 +00:00
|
|
|
UINT8 ObjectType,
|
|
|
|
ACPI_OPERAND_OBJECT *SourceObject,
|
|
|
|
ACPI_GENERIC_STATE *State,
|
|
|
|
void *Context)
|
|
|
|
{
|
|
|
|
ACPI_STATUS Status = AE_OK;
|
|
|
|
UINT32 ThisIndex;
|
|
|
|
ACPI_OPERAND_OBJECT **ThisTargetPtr;
|
|
|
|
ACPI_OPERAND_OBJECT *TargetObject;
|
|
|
|
|
|
|
|
|
2002-02-23 05:10:40 +00:00
|
|
|
ACPI_FUNCTION_ENTRY ();
|
2001-09-07 01:22:25 +00:00
|
|
|
|
|
|
|
|
2001-03-05 02:15:19 +00:00
|
|
|
ThisIndex = State->Pkg.Index;
|
2001-05-29 19:52:40 +00:00
|
|
|
ThisTargetPtr = (ACPI_OPERAND_OBJECT **)
|
2001-03-05 02:15:19 +00:00
|
|
|
&State->Pkg.DestObject->Package.Elements[ThisIndex];
|
|
|
|
|
|
|
|
switch (ObjectType)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This is a simple object, just copy it
|
|
|
|
*/
|
2001-05-29 19:52:40 +00:00
|
|
|
TargetObject = AcpiUtCreateInternalObject (SourceObject->Common.Type);
|
2001-03-05 02:15:19 +00:00
|
|
|
if (!TargetObject)
|
|
|
|
{
|
|
|
|
return (AE_NO_MEMORY);
|
|
|
|
}
|
|
|
|
|
2002-02-23 05:10:40 +00:00
|
|
|
Status = AcpiUtCopySimpleObject (SourceObject, TargetObject);
|
2001-03-05 02:15:19 +00:00
|
|
|
if (ACPI_FAILURE (Status))
|
|
|
|
{
|
|
|
|
return (Status);
|
|
|
|
}
|
|
|
|
|
|
|
|
*ThisTargetPtr = TargetObject;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 1:
|
2001-11-28 04:29:40 +00:00
|
|
|
|
2001-03-05 02:15:19 +00:00
|
|
|
/*
|
2001-05-29 19:52:40 +00:00
|
|
|
* This object is a package - go down another nesting level
|
2001-03-05 02:15:19 +00:00
|
|
|
* Create and build the package object
|
|
|
|
*/
|
2001-05-29 19:52:40 +00:00
|
|
|
TargetObject = AcpiUtCreateInternalObject (ACPI_TYPE_PACKAGE);
|
2001-03-05 02:15:19 +00:00
|
|
|
if (!TargetObject)
|
|
|
|
{
|
|
|
|
return (AE_NO_MEMORY);
|
|
|
|
}
|
|
|
|
|
|
|
|
TargetObject->Package.Count = SourceObject->Package.Count;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Pass the new package object back to the package walk routine
|
|
|
|
*/
|
|
|
|
State->Pkg.ThisTargetObj = TargetObject;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Store the object pointer in the parent package object
|
|
|
|
*/
|
|
|
|
*ThisTargetPtr = TargetObject;
|
|
|
|
break;
|
|
|
|
|
2001-11-28 04:29:40 +00:00
|
|
|
|
2001-03-05 02:15:19 +00:00
|
|
|
default:
|
|
|
|
return (AE_BAD_PARAMETER);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (Status);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
2001-05-29 19:52:40 +00:00
|
|
|
* FUNCTION: AcpiUtCopyIpackageToIpackage
|
2001-03-05 02:15:19 +00:00
|
|
|
*
|
|
|
|
* PARAMETERS: *SourceObj - Pointer to the source package object
|
|
|
|
* *DestObj - Where the internal object is returned
|
|
|
|
*
|
|
|
|
* RETURN: Status - the status of the call
|
|
|
|
*
|
|
|
|
* DESCRIPTION: This function is called to copy an internal package object
|
|
|
|
* into another internal package object.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
ACPI_STATUS
|
2001-05-29 19:52:40 +00:00
|
|
|
AcpiUtCopyIpackageToIpackage (
|
2001-03-05 02:15:19 +00:00
|
|
|
ACPI_OPERAND_OBJECT *SourceObj,
|
|
|
|
ACPI_OPERAND_OBJECT *DestObj,
|
|
|
|
ACPI_WALK_STATE *WalkState)
|
|
|
|
{
|
|
|
|
ACPI_STATUS Status = AE_OK;
|
|
|
|
|
2001-09-07 01:22:25 +00:00
|
|
|
|
2002-02-23 05:10:40 +00:00
|
|
|
ACPI_FUNCTION_TRACE ("UtCopyIpackageToIpackage");
|
2001-03-05 02:15:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
DestObj->Common.Type = SourceObj->Common.Type;
|
|
|
|
DestObj->Package.Count = SourceObj->Package.Count;
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Create the object array and walk the source package tree
|
|
|
|
*/
|
2001-07-21 03:55:17 +00:00
|
|
|
DestObj->Package.Elements = ACPI_MEM_CALLOCATE ((SourceObj->Package.Count + 1) *
|
2001-03-05 02:15:19 +00:00
|
|
|
sizeof (void *));
|
|
|
|
if (!DestObj->Package.Elements)
|
|
|
|
{
|
2002-02-23 05:10:40 +00:00
|
|
|
ACPI_REPORT_ERROR (
|
2001-03-05 02:15:19 +00:00
|
|
|
("AmlBuildCopyInternalPackageObject: Package allocation failure\n"));
|
|
|
|
return_ACPI_STATUS (AE_NO_MEMORY);
|
|
|
|
}
|
|
|
|
|
2001-11-28 04:29:40 +00:00
|
|
|
/* Init */
|
2001-03-05 02:15:19 +00:00
|
|
|
|
2001-11-28 04:29:40 +00:00
|
|
|
DestObj->Package.NextElement = DestObj->Package.Elements;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copy the package element-by-element by walking the package "tree".
|
|
|
|
* This handles nested packages of arbitrary depth.
|
|
|
|
*/
|
2001-05-29 19:52:40 +00:00
|
|
|
Status = AcpiUtWalkPackageTree (SourceObj, DestObj,
|
|
|
|
AcpiUtCopyIelementToIelement, WalkState);
|
2001-11-28 04:29:40 +00:00
|
|
|
if (ACPI_FAILURE (Status))
|
|
|
|
{
|
|
|
|
/* On failure, delete the destination package object */
|
|
|
|
|
|
|
|
AcpiUtRemoveReference (DestObj);
|
|
|
|
}
|
2001-03-05 02:15:19 +00:00
|
|
|
|
|
|
|
return_ACPI_STATUS (Status);
|
|
|
|
}
|
|
|
|
|
2002-02-23 05:10:40 +00:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: AcpiUtCopyIobjectToIobject
|
|
|
|
*
|
|
|
|
* PARAMETERS: WalkState - Current walk state
|
|
|
|
* SourceDesc - The internal object to be copied
|
|
|
|
* DestDesc - Where the copied object is returned
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Copy an internal object to a new internal object
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
ACPI_STATUS
|
|
|
|
AcpiUtCopyIobjectToIobject (
|
|
|
|
ACPI_OPERAND_OBJECT *SourceDesc,
|
|
|
|
ACPI_OPERAND_OBJECT **DestDesc,
|
|
|
|
ACPI_WALK_STATE *WalkState)
|
|
|
|
{
|
|
|
|
ACPI_STATUS Status = AE_OK;
|
|
|
|
|
|
|
|
|
|
|
|
ACPI_FUNCTION_TRACE ("UtCopyIobjectToIobject");
|
|
|
|
|
|
|
|
|
|
|
|
/* Create the top level object */
|
|
|
|
|
|
|
|
*DestDesc = AcpiUtCreateInternalObject (SourceDesc->Common.Type);
|
|
|
|
if (!*DestDesc)
|
|
|
|
{
|
|
|
|
return_ACPI_STATUS (AE_NO_MEMORY);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Copy the object and possible subobjects */
|
|
|
|
|
|
|
|
if (SourceDesc->Common.Type == ACPI_TYPE_PACKAGE)
|
|
|
|
{
|
|
|
|
Status = AcpiUtCopyIpackageToIpackage (SourceDesc, *DestDesc,
|
|
|
|
WalkState);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Status = AcpiUtCopySimpleObject (SourceDesc, *DestDesc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return_ACPI_STATUS (Status);
|
|
|
|
}
|
|
|
|
|
|
|
|
|