mirror of
https://github.com/acpica/acpica/
synced 2025-03-04 21:31:41 +03:00
Comments from 07/18/00 code review
date 2000.07.19.22.55.00; author rmoore1; state Exp;
This commit is contained in:
parent
b6f565c95f
commit
7d5d1b0e91
@ -554,7 +554,7 @@ AcpiDsExecEndControlOp (
|
||||
break;
|
||||
|
||||
|
||||
case AML_NOOP_CODE:
|
||||
case AML_NOOP_OP:
|
||||
|
||||
/* Just do nothing! */
|
||||
break;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -294,7 +294,7 @@ AcpiDsExecEndOp (
|
||||
/* Call debugger for single step support (DEBUG build only) */
|
||||
|
||||
DEBUG_EXEC (Status = AcpiDbSingleStep (WalkState, Op, Optype));
|
||||
DEBUG_EXEC (if (Status != AE_OK) {return_ACPI_STATUS (Status);});
|
||||
DEBUG_EXEC (if (ACPI_FAILURE (Status)) {return_ACPI_STATUS (Status);});
|
||||
|
||||
|
||||
/* Decode the opcode */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes)
|
||||
* $Revision: 1.66 $
|
||||
* Module Name: amconfig - Namespace reconfiguration (Load/Unload opcodes)
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -9,8 +9,8 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
|
||||
* All rights reserved.
|
||||
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
|
||||
* reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
@ -115,65 +115,128 @@
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#define __EXCONFIG_C__
|
||||
#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 ACPI_EXECUTER
|
||||
ACPI_MODULE_NAME ("exconfig")
|
||||
#define _COMPONENT INTERPRETER
|
||||
MODULE_NAME ("amconfig");
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
/*****************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiExAddTable
|
||||
* FUNCTION: AcpiAmlExecLoadTable
|
||||
*
|
||||
* PARAMETERS: Table - Pointer to raw table
|
||||
* ParentNode - Where to load the table (scope)
|
||||
* DdbHandle - Where to return the table handle.
|
||||
* PARAMETERS: RgnDesc - Op region where the table will be obtained
|
||||
* DdbHandle - Where a handle to the table will be returned
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Common function to Install and Load an ACPI table with a
|
||||
* returned table handle.
|
||||
* DESCRIPTION: Load an ACPI table
|
||||
*
|
||||
******************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiExAddTable (
|
||||
ACPI_TABLE_HEADER *Table,
|
||||
ACPI_NAMESPACE_NODE *ParentNode,
|
||||
ACPI_OPERAND_OBJECT **DdbHandle)
|
||||
AcpiAmlExecLoadTable (
|
||||
ACPI_OBJECT_INTERNAL *RgnDesc,
|
||||
ACPI_HANDLE *DdbHandle)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_OBJECT_INTERNAL *TableDesc = NULL;
|
||||
INT8 *TablePtr;
|
||||
INT8 *TableDataPtr;
|
||||
ACPI_TABLE_HEADER TableHeader;
|
||||
ACPI_TABLE_DESC TableInfo;
|
||||
ACPI_OPERAND_OBJECT *ObjDesc;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("ExAddTable");
|
||||
FUNCTION_TRACE ("AmlExecLoadTable");
|
||||
|
||||
/* TBD: [Unhandled] Object can be either a field or an opregion */
|
||||
|
||||
|
||||
/* Create an object to be the table handle */
|
||||
/* Get the table header */
|
||||
|
||||
ObjDesc = AcpiUtCreateInternalObject (INTERNAL_TYPE_REFERENCE);
|
||||
if (!ObjDesc)
|
||||
TableHeader.Length = 0;
|
||||
for (i = 0; i < sizeof (ACPI_TABLE_HEADER); i++)
|
||||
{
|
||||
Status = AcpiEvAddressSpaceDispatch (RgnDesc, ADDRESS_SPACE_READ,
|
||||
i, 8, (UINT32 *) ((INT8 *) &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,
|
||||
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 = Table;
|
||||
TableInfo.Length = (ACPI_SIZE) Table->Length;
|
||||
TableInfo.Pointer = (ACPI_TABLE_HEADER *) TablePtr;
|
||||
TableInfo.Length = TableHeader.Length;
|
||||
TableInfo.Allocation = ACPI_MEM_ALLOCATED;
|
||||
TableInfo.BasePointer = Table;
|
||||
TableInfo.BasePointer = TablePtr;
|
||||
|
||||
Status = AcpiTbInstallTable (&TableInfo);
|
||||
Status = AcpiTbInstallTable (NULL, &TableInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto Cleanup;
|
||||
@ -181,331 +244,38 @@ AcpiExAddTable (
|
||||
|
||||
/* Add the table to the namespace */
|
||||
|
||||
Status = AcpiNsLoadTable (TableInfo.InstalledDesc, ParentNode);
|
||||
Status = AcpiLoadNamespace ();
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
/* Uninstall table on error */
|
||||
/* TBD: [Errors] Unload the table on failure ? */
|
||||
|
||||
(void) AcpiTbUninstallTable (TableInfo.InstalledDesc);
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
/* TBD: [Investigate] we need a pointer to the table desc */
|
||||
|
||||
/* Init the table handle */
|
||||
|
||||
ObjDesc->Reference.Opcode = AML_LOAD_OP;
|
||||
ObjDesc->Reference.Object = TableInfo.InstalledDesc;
|
||||
*DdbHandle = ObjDesc;
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
TableDesc->Reference.OpCode = AML_LOAD_OP;
|
||||
TableDesc->Reference.Object = TableInfo.InstalledDesc;
|
||||
|
||||
|
||||
Cleanup:
|
||||
AcpiUtRemoveReference (ObjDesc);
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiExLoadTableOp
|
||||
*
|
||||
* PARAMETERS: WalkState - Current state with operands
|
||||
* ReturnDesc - Where to store the return object
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Load an ACPI table
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiExLoadTableOp (
|
||||
ACPI_WALK_STATE *WalkState,
|
||||
ACPI_OPERAND_OBJECT **ReturnDesc)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
|
||||
ACPI_TABLE_HEADER *Table;
|
||||
ACPI_NAMESPACE_NODE *ParentNode;
|
||||
ACPI_NAMESPACE_NODE *StartNode;
|
||||
ACPI_NAMESPACE_NODE *ParameterNode = NULL;
|
||||
ACPI_OPERAND_OBJECT *DdbHandle;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("ExLoadTableOp");
|
||||
|
||||
|
||||
/*
|
||||
* Make sure that the signature does not match one of the tables that
|
||||
* is already loaded.
|
||||
*/
|
||||
Status = AcpiTbMatchSignature (Operand[0]->String.Pointer, NULL);
|
||||
if (Status == AE_OK)
|
||||
{
|
||||
/* Signature matched -- don't allow override */
|
||||
|
||||
return_ACPI_STATUS (AE_ALREADY_EXISTS);
|
||||
}
|
||||
|
||||
/* Find the ACPI table */
|
||||
|
||||
Status = AcpiTbFindTable (Operand[0]->String.Pointer,
|
||||
Operand[1]->String.Pointer,
|
||||
Operand[2]->String.Pointer, &Table);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
if (Status != AE_NOT_FOUND)
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* Not found, return an Integer=0 and AE_OK */
|
||||
|
||||
DdbHandle = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
|
||||
if (!DdbHandle)
|
||||
{
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
DdbHandle->Integer.Value = 0;
|
||||
*ReturnDesc = DdbHandle;
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
/* Default nodes */
|
||||
|
||||
StartNode = WalkState->ScopeInfo->Scope.Node;
|
||||
ParentNode = AcpiGbl_RootNode;
|
||||
|
||||
/* RootPath (optional parameter) */
|
||||
|
||||
if (Operand[3]->String.Length > 0)
|
||||
{
|
||||
/*
|
||||
* Find the node referenced by the RootPathString. This is the
|
||||
* location within the namespace where the table will be loaded.
|
||||
*/
|
||||
Status = AcpiNsGetNodeByPath (Operand[3]->String.Pointer, StartNode,
|
||||
ACPI_NS_SEARCH_PARENT, &ParentNode);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
}
|
||||
|
||||
/* ParameterPath (optional parameter) */
|
||||
|
||||
if (Operand[4]->String.Length > 0)
|
||||
{
|
||||
if ((Operand[4]->String.Pointer[0] != '\\') &&
|
||||
(Operand[4]->String.Pointer[0] != '^'))
|
||||
{
|
||||
/*
|
||||
* Path is not absolute, so it will be relative to the node
|
||||
* referenced by the RootPathString (or the NS root if omitted)
|
||||
*/
|
||||
StartNode = ParentNode;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the node referenced by the ParameterPathString
|
||||
*/
|
||||
Status = AcpiNsGetNodeByPath (Operand[4]->String.Pointer, StartNode,
|
||||
ACPI_NS_SEARCH_PARENT, &ParameterNode);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
}
|
||||
|
||||
/* Load the table into the namespace */
|
||||
|
||||
Status = AcpiExAddTable (Table, ParentNode, &DdbHandle);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* Parameter Data (optional) */
|
||||
|
||||
if (ParameterNode)
|
||||
{
|
||||
/* Store the parameter data into the optional parameter object */
|
||||
|
||||
Status = AcpiExStore (Operand[5], ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, ParameterNode),
|
||||
WalkState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
(void) AcpiExUnloadTable (DdbHandle);
|
||||
}
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiExLoadOp
|
||||
*
|
||||
* PARAMETERS: ObjDesc - Region or Field where the table will be
|
||||
* obtained
|
||||
* Target - Where a handle to the table will be stored
|
||||
* WalkState - Current state
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Load an ACPI table from a field or operation region
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiExLoadOp (
|
||||
ACPI_OPERAND_OBJECT *ObjDesc,
|
||||
ACPI_OPERAND_OBJECT *Target,
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
ACPI_STATUS Status;
|
||||
ACPI_OPERAND_OBJECT *DdbHandle;
|
||||
ACPI_OPERAND_OBJECT *BufferDesc = NULL;
|
||||
ACPI_TABLE_HEADER *TablePtr = NULL;
|
||||
UINT8 *TableDataPtr;
|
||||
ACPI_TABLE_HEADER TableHeader;
|
||||
UINT32 i;
|
||||
|
||||
ACPI_FUNCTION_TRACE ("ExLoadOp");
|
||||
|
||||
|
||||
/* Object can be either an OpRegion or a Field */
|
||||
|
||||
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
|
||||
{
|
||||
case ACPI_TYPE_REGION:
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Region %p %s\n",
|
||||
ObjDesc, AcpiUtGetObjectTypeName (ObjDesc)));
|
||||
|
||||
/* Get the table header */
|
||||
|
||||
TableHeader.Length = 0;
|
||||
for (i = 0; i < sizeof (ACPI_TABLE_HEADER); i++)
|
||||
{
|
||||
Status = AcpiEvAddressSpaceDispatch (ObjDesc, ACPI_READ,
|
||||
(ACPI_PHYSICAL_ADDRESS) i, 8,
|
||||
((UINT8 *) &TableHeader) + i);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
}
|
||||
|
||||
/* Allocate a buffer for the entire table */
|
||||
|
||||
TablePtr = ACPI_MEM_ALLOCATE (TableHeader.Length);
|
||||
if (!TablePtr)
|
||||
{
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
}
|
||||
|
||||
/* Copy the header to the buffer */
|
||||
|
||||
ACPI_MEMCPY (TablePtr, &TableHeader, sizeof (ACPI_TABLE_HEADER));
|
||||
TableDataPtr = ACPI_PTR_ADD (UINT8, TablePtr, sizeof (ACPI_TABLE_HEADER));
|
||||
|
||||
/* Get the table from the op region */
|
||||
|
||||
for (i = 0; i < TableHeader.Length; i++)
|
||||
{
|
||||
Status = AcpiEvAddressSpaceDispatch (ObjDesc, ACPI_READ,
|
||||
(ACPI_PHYSICAL_ADDRESS) i, 8,
|
||||
((UINT8 *) TableDataPtr + i));
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case ACPI_TYPE_BUFFER_FIELD:
|
||||
case INTERNAL_TYPE_REGION_FIELD:
|
||||
case INTERNAL_TYPE_BANK_FIELD:
|
||||
case INTERNAL_TYPE_INDEX_FIELD:
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Field %p %s\n",
|
||||
ObjDesc, AcpiUtGetObjectTypeName (ObjDesc)));
|
||||
|
||||
/*
|
||||
* The length of the field must be at least as large as the table.
|
||||
* Read the entire field and thus the entire table. Buffer is
|
||||
* allocated during the read.
|
||||
*/
|
||||
Status = AcpiExReadDataFromField (WalkState, ObjDesc, &BufferDesc);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
TablePtr = ACPI_CAST_PTR (ACPI_TABLE_HEADER, BufferDesc->Buffer.Pointer);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
||||
}
|
||||
|
||||
/* The table must be either an SSDT or a PSDT */
|
||||
|
||||
if ((!ACPI_STRNCMP (TablePtr->Signature,
|
||||
AcpiGbl_AcpiTableData[ACPI_TABLE_PSDT].Signature,
|
||||
AcpiGbl_AcpiTableData[ACPI_TABLE_PSDT].SigLength)) &&
|
||||
(!ACPI_STRNCMP (TablePtr->Signature,
|
||||
AcpiGbl_AcpiTableData[ACPI_TABLE_SSDT].Signature,
|
||||
AcpiGbl_AcpiTableData[ACPI_TABLE_SSDT].SigLength)))
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
||||
"Table has invalid signature [%4.4s], must be SSDT or PSDT\n",
|
||||
TablePtr->Signature));
|
||||
Status = AE_BAD_SIGNATURE;
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
/* Install the new table into the local data structures */
|
||||
|
||||
Status = AcpiExAddTable (TablePtr, AcpiGbl_RootNode, &DdbHandle);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
/* Store the DdbHandle into the Target operand */
|
||||
|
||||
Status = AcpiExStore (DdbHandle, Target, WalkState);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
(void) AcpiExUnloadTable (DdbHandle);
|
||||
}
|
||||
*DdbHandle = TableDesc;
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
|
||||
|
||||
Cleanup:
|
||||
|
||||
if (BufferDesc)
|
||||
{
|
||||
AcpiUtRemoveReference (BufferDesc);
|
||||
}
|
||||
else
|
||||
{
|
||||
ACPI_MEM_FREE (TablePtr);
|
||||
}
|
||||
AcpiCmFree (TableDesc);
|
||||
AcpiCmFree (TablePtr);
|
||||
return_ACPI_STATUS (Status);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
/*****************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiExUnloadTable
|
||||
* FUNCTION: AcpiAmlExecUnloadTable
|
||||
*
|
||||
* PARAMETERS: DdbHandle - Handle to a previously loaded table
|
||||
*
|
||||
@ -513,50 +283,143 @@ Cleanup:
|
||||
*
|
||||
* DESCRIPTION: Unload an ACPI table
|
||||
*
|
||||
******************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiExUnloadTable (
|
||||
ACPI_OPERAND_OBJECT *DdbHandle)
|
||||
AcpiAmlExecUnloadTable (
|
||||
ACPI_HANDLE DdbHandle)
|
||||
{
|
||||
ACPI_STATUS Status = AE_NOT_IMPLEMENTED;
|
||||
ACPI_OPERAND_OBJECT *TableDesc = DdbHandle;
|
||||
ACPI_OBJECT_INTERNAL *TableDesc = (ACPI_OBJECT_INTERNAL *) DdbHandle;
|
||||
ACPI_TABLE_DESC *TableInfo;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("ExUnloadTable");
|
||||
FUNCTION_TRACE ("AmlExecUnloadTable");
|
||||
|
||||
|
||||
/*
|
||||
* Validate the handle
|
||||
* Although the handle is partially validated in AcpiExReconfiguration(),
|
||||
* when it calls AcpiExResolveOperands(), the handle is more completely
|
||||
* validated here.
|
||||
*/
|
||||
/* Validate the handle */
|
||||
/* TBD: [Errors] Wasn't this done earlier? */
|
||||
|
||||
if ((!DdbHandle) ||
|
||||
(ACPI_GET_DESCRIPTOR_TYPE (DdbHandle) != ACPI_DESC_TYPE_OPERAND) ||
|
||||
(ACPI_GET_OBJECT_TYPE (DdbHandle) != INTERNAL_TYPE_REFERENCE))
|
||||
(!VALID_DESCRIPTOR_TYPE (DdbHandle, ACPI_DESC_TYPE_INTERNAL)) ||
|
||||
(((ACPI_OBJECT_INTERNAL *)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
|
||||
* Delete the entire namespace under this table NTE
|
||||
* (Offset contains the TableId)
|
||||
*/
|
||||
AcpiNsDeleteNamespaceByOwner (TableInfo->TableId);
|
||||
|
||||
Status = AcpiNsDeleteNamespaceByOwner (TableInfo->TableId);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
/* Delete the table itself */
|
||||
|
||||
(void) AcpiTbUninstallTable (TableInfo->InstalledDesc);
|
||||
AcpiTbDeleteSingleTable (TableInfo->InstalledDesc);
|
||||
|
||||
/* Delete the table descriptor (DdbHandle) */
|
||||
|
||||
AcpiUtRemoveReference (TableDesc);
|
||||
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_OBJECT_INTERNAL *RegionDesc = NULL;
|
||||
ACPI_HANDLE *DdbHandle;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("AmlExecReconfiguration");
|
||||
|
||||
|
||||
/* Resolve the operands */
|
||||
|
||||
Status = AcpiAmlResolveOperands (Opcode, WALK_OPERANDS);
|
||||
DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (Opcode),
|
||||
2, "after AcpiAmlResolveOperands");
|
||||
|
||||
/* Get the table handle, common for both opcodes */
|
||||
|
||||
Status |= AcpiDsObjStackPopObject ((ACPI_OBJECT_INTERNAL **) &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) (0x%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) (0x%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);
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,6 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: amdump - Interpreter debug output routines
|
||||
* $Revision: 1.85 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -151,13 +150,13 @@
|
||||
|
||||
void
|
||||
AcpiAmlShowHexValue (
|
||||
UINT32 ByteCount,
|
||||
INT32 ByteCount,
|
||||
UINT8 *AmlPtr,
|
||||
UINT32 LeadSpace)
|
||||
INT32 LeadSpace)
|
||||
{
|
||||
UINT32 Value; /* Value retrieved from AML stream */
|
||||
UINT32 ShowDecimalValue;
|
||||
UINT32 Length; /* Length of printed field */
|
||||
INT32 Value; /* Value retrieved from AML stream */
|
||||
INT32 ShowDecimalValue;
|
||||
INT32 Length; /* Length of printed field */
|
||||
UINT8 *CurrentAmlPtr = NULL; /* Pointer to current byte of AML value */
|
||||
|
||||
|
||||
@ -177,7 +176,7 @@ AcpiAmlShowHexValue (
|
||||
Value = 0;
|
||||
CurrentAmlPtr > AmlPtr; )
|
||||
{
|
||||
Value = (Value << 8) + (UINT32)* --CurrentAmlPtr;
|
||||
Value = (Value << 8) + (INT32)* --CurrentAmlPtr;
|
||||
}
|
||||
|
||||
Length = LeadSpace * ByteCount + 2;
|
||||
@ -254,15 +253,15 @@ AcpiAmlDumpOperand (
|
||||
*/
|
||||
DEBUG_PRINT (ACPI_INFO,
|
||||
("AmlDumpOperand: *** Possible error: Null stack entry ptr\n"));
|
||||
return (AE_OK);
|
||||
return AE_OK;
|
||||
}
|
||||
|
||||
if (VALID_DESCRIPTOR_TYPE (EntryDesc, ACPI_DESC_TYPE_NAMED))
|
||||
{
|
||||
DEBUG_PRINT (ACPI_INFO,
|
||||
("AmlDumpOperand: Named Object: \n"));
|
||||
("AmlDumpOperand: Name Table Entry (NTE): \n"));
|
||||
DUMP_ENTRY (EntryDesc, ACPI_INFO);
|
||||
return (AE_OK);
|
||||
return AE_OK;
|
||||
}
|
||||
|
||||
if (AcpiTbSystemTablePointer (EntryDesc))
|
||||
@ -270,7 +269,7 @@ AcpiAmlDumpOperand (
|
||||
DEBUG_PRINT (ACPI_INFO,
|
||||
("AmlDumpOperand: %p is a Pcode pointer\n",
|
||||
EntryDesc));
|
||||
return (AE_OK);
|
||||
return AE_OK;
|
||||
}
|
||||
|
||||
if (!VALID_DESCRIPTOR_TYPE (EntryDesc, ACPI_DESC_TYPE_INTERNAL))
|
||||
@ -278,7 +277,7 @@ AcpiAmlDumpOperand (
|
||||
DEBUG_PRINT (ACPI_INFO,
|
||||
("AmlDumpOperand: %p Not a local object \n", EntryDesc));
|
||||
DUMP_BUFFER (EntryDesc, sizeof (ACPI_OBJECT_INTERNAL));
|
||||
return (AE_OK);
|
||||
return AE_OK;
|
||||
}
|
||||
|
||||
/* EntryDesc is a valid object */
|
||||
@ -366,8 +365,8 @@ AcpiAmlDumpOperand (
|
||||
|
||||
|
||||
case AML_NAMEPATH_OP:
|
||||
DEBUG_PRINT_RAW (ACPI_INFO, ("Reference.NameDesc->Name %x\n",
|
||||
EntryDesc->Reference.NameDesc->Name));
|
||||
DEBUG_PRINT_RAW (ACPI_INFO, ("Reference.Nte->Name %x\n",
|
||||
EntryDesc->Reference.Nte->Name));
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -574,8 +573,8 @@ AcpiAmlDumpOperand (
|
||||
case ACPI_TYPE_METHOD:
|
||||
|
||||
DEBUG_PRINT_RAW (ACPI_INFO,
|
||||
("Method(%d) @ %p:%lx\n",
|
||||
EntryDesc->Method.ParamCount,
|
||||
("Method(%d) @ %p:%lx:%lx\n",
|
||||
EntryDesc->Method.ParamCount, EntryDesc->Method.AcpiTable,
|
||||
EntryDesc->Method.Pcode, EntryDesc->Method.PcodeLength));
|
||||
break;
|
||||
|
||||
@ -632,7 +631,7 @@ AcpiAmlDumpOperand (
|
||||
|
||||
}
|
||||
|
||||
return (AE_OK);
|
||||
return AE_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -653,11 +652,11 @@ void
|
||||
AcpiAmlDumpOperands (
|
||||
ACPI_OBJECT_INTERNAL **Operands,
|
||||
OPERATING_MODE InterpreterMode,
|
||||
NATIVE_CHAR *Ident,
|
||||
UINT32 NumLevels,
|
||||
NATIVE_CHAR *Note,
|
||||
NATIVE_CHAR *ModuleName,
|
||||
UINT32 LineNumber)
|
||||
INT8 *Ident,
|
||||
INT32 NumLevels,
|
||||
INT8 *Note,
|
||||
INT8 *ModuleName,
|
||||
INT32 LineNumber)
|
||||
{
|
||||
UINT32 i;
|
||||
ACPI_OBJECT_INTERNAL **EntryDesc;
|
||||
@ -703,16 +702,16 @@ AcpiAmlDumpOperands (
|
||||
*
|
||||
* FUNCTION: AcpiAmlDumpAcpiNamedObject
|
||||
*
|
||||
* PARAMETERS: *NameDesc - Descriptor to dump
|
||||
* PARAMETERS: *Entry - Descriptor to dump
|
||||
* Flags - Force display
|
||||
*
|
||||
* DESCRIPTION: Dumps the members of the given.NamedObject
|
||||
* DESCRIPTION: Dumps the members of the NTE given.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void
|
||||
AcpiAmlDumpAcpiNamedObject (
|
||||
ACPI_NAMED_OBJECT *NameDesc,
|
||||
ACPI_NAMED_OBJECT *Entry,
|
||||
UINT32 Flags)
|
||||
{
|
||||
|
||||
@ -725,15 +724,14 @@ AcpiAmlDumpAcpiNamedObject (
|
||||
}
|
||||
|
||||
|
||||
AcpiOsPrintf ("%20s : %4.4s\n", "Name", &NameDesc->Name);
|
||||
AcpiOsPrintf ("%20s : %s\n", "Type", AcpiCmGetTypeName (NameDesc->Type));
|
||||
AcpiOsPrintf ("%20s : 0x%X\n", "Flags", NameDesc->Flags);
|
||||
AcpiOsPrintf ("%20s : 0x%X\n", "Owner Id", NameDesc->OwnerId);
|
||||
AcpiOsPrintf ("%20s : 0x%X\n", "Reference Count", NameDesc->ReferenceCount);
|
||||
AcpiOsPrintf ("%20s : 0x%p\n", "Attached Object", NameDesc->Object);
|
||||
AcpiOsPrintf ("%20s : 0x%p\n", "ChildList", NameDesc->Child);
|
||||
AcpiOsPrintf ("%20s : 0x%p\n", "NextPeer", NameDesc->Peer);
|
||||
AcpiOsPrintf ("%20s : 0x%p\n", "Parent", AcpiNsGetParentObject (NameDesc));
|
||||
AcpiOsPrintf ("%20s : %4.4s\n", "Name", &Entry->Name);
|
||||
AcpiOsPrintf ("%20s : %s\n", "Type", AcpiCmGetTypeName (Entry->Type));
|
||||
AcpiOsPrintf ("%20s : 0x%X\n", "Flags", Entry->Flags);
|
||||
AcpiOsPrintf ("%20s : 0x%X\n", "Owner Id", Entry->OwnerId);
|
||||
AcpiOsPrintf ("%20s : 0x%X\n", "Reference Count", Entry->ReferenceCount);
|
||||
AcpiOsPrintf ("%20s : 0x%p\n", "Attached Object", Entry->Object);
|
||||
AcpiOsPrintf ("%20s : 0x%p\n", "ChildTable", Entry->ChildTable);
|
||||
AcpiOsPrintf ("%20s : 0x%p\n", "Parent", AcpiNsGetParentEntry (Entry));
|
||||
}
|
||||
|
||||
|
||||
@ -853,6 +851,7 @@ AcpiAmlDumpObjectDescriptor (
|
||||
AcpiOsPrintf ("%20s : 0x%p\n", "Semaphore", ObjDesc->Method.Semaphore);
|
||||
AcpiOsPrintf ("%20s : 0x%X\n", "PcodeLength", ObjDesc->Method.PcodeLength);
|
||||
AcpiOsPrintf ("%20s : 0x%X\n", "Pcode", ObjDesc->Method.Pcode);
|
||||
AcpiOsPrintf ("%20s : 0x%X\n", "AcpiTable", ObjDesc->Method.AcpiTable);
|
||||
break;
|
||||
|
||||
|
||||
@ -948,7 +947,7 @@ AcpiAmlDumpObjectDescriptor (
|
||||
AcpiOsPrintf ("%20s : 0x%X\n", "SpaceId", ObjDesc->AddrHandler.SpaceId);
|
||||
AcpiOsPrintf ("%20s : 0x%p\n", "Link", ObjDesc->AddrHandler.Link);
|
||||
AcpiOsPrintf ("%20s : 0x%p\n", "RegionList", ObjDesc->AddrHandler.RegionList);
|
||||
AcpiOsPrintf ("%20s : 0x%p\n", "NameDesc", ObjDesc->AddrHandler.NameDesc);
|
||||
AcpiOsPrintf ("%20s : 0x%p\n", "Nte", ObjDesc->AddrHandler.Nte);
|
||||
AcpiOsPrintf ("%20s : 0x%p\n", "Handler", ObjDesc->AddrHandler.Handler);
|
||||
AcpiOsPrintf ("%20s : 0x%p\n", "Context", ObjDesc->AddrHandler.Context);
|
||||
break;
|
||||
@ -957,7 +956,7 @@ AcpiAmlDumpObjectDescriptor (
|
||||
case INTERNAL_TYPE_NOTIFY:
|
||||
|
||||
AcpiOsPrintf ("%20s : %s\n", "Type", "Notify Handler");
|
||||
AcpiOsPrintf ("%20s : 0x%p\n", "NameDesc", ObjDesc->NotifyHandler.NameDesc);
|
||||
AcpiOsPrintf ("%20s : 0x%p\n", "Nte", ObjDesc->NotifyHandler.Nte);
|
||||
AcpiOsPrintf ("%20s : 0x%p\n", "Handler", ObjDesc->NotifyHandler.Handler);
|
||||
AcpiOsPrintf ("%20s : 0x%p\n", "Context", ObjDesc->NotifyHandler.Context);
|
||||
break;
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,8 +1,7 @@
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exnames - interpreter/scanner name load/execute
|
||||
* $Revision: 1.96 $
|
||||
* Module Name: amnames - interpreter/scanner name load/execute
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -10,8 +9,8 @@
|
||||
*
|
||||
* 1. Copyright Notice
|
||||
*
|
||||
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
|
||||
* All rights reserved.
|
||||
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
|
||||
* reserved.
|
||||
*
|
||||
* 2. License
|
||||
*
|
||||
@ -115,14 +114,15 @@
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#define __EXNAMES_C__
|
||||
#define __AMNAMES_C__
|
||||
|
||||
#include "acpi.h"
|
||||
#include "acinterp.h"
|
||||
#include "amlcode.h"
|
||||
#include "acnamesp.h"
|
||||
|
||||
#define _COMPONENT ACPI_EXECUTER
|
||||
ACPI_MODULE_NAME ("exnames")
|
||||
#define _COMPONENT INTERPRETER
|
||||
MODULE_NAME ("amnames");
|
||||
|
||||
|
||||
/* AML Package Length encodings */
|
||||
@ -135,7 +135,7 @@
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiExAllocateNameString
|
||||
* FUNCTION: AcpiAmlAllocateNameString
|
||||
*
|
||||
* PARAMETERS: PrefixCount - Count of parent levels. Special cases:
|
||||
* (-1) = root, 0 = none
|
||||
@ -149,16 +149,16 @@
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
char *
|
||||
AcpiExAllocateNameString (
|
||||
INT8 *
|
||||
AcpiAmlAllocateNameString (
|
||||
UINT32 PrefixCount,
|
||||
UINT32 NumNameSegs)
|
||||
{
|
||||
char *TempPtr;
|
||||
char *NameString;
|
||||
INT8 *TempPtr;
|
||||
INT8 *NameString;
|
||||
UINT32 SizeNeeded;
|
||||
|
||||
ACPI_FUNCTION_TRACE ("ExAllocateNameString");
|
||||
FUNCTION_TRACE ("AmlAllocateNameString");
|
||||
|
||||
|
||||
/*
|
||||
@ -166,7 +166,8 @@ AcpiExAllocateNameString (
|
||||
* Also, one byte for the null terminator.
|
||||
* This may actually be somewhat longer than needed.
|
||||
*/
|
||||
if (PrefixCount == ACPI_UINT32_MAX)
|
||||
|
||||
if (PrefixCount == (UINT32) -1)
|
||||
{
|
||||
/* Special case for root */
|
||||
|
||||
@ -181,10 +182,11 @@ AcpiExAllocateNameString (
|
||||
* Allocate a buffer for the name.
|
||||
* This buffer must be deleted by the caller!
|
||||
*/
|
||||
NameString = ACPI_MEM_ALLOCATE (SizeNeeded);
|
||||
|
||||
NameString = AcpiCmAllocate (SizeNeeded);
|
||||
if (!NameString)
|
||||
{
|
||||
ACPI_REPORT_ERROR (("ExAllocateNameString: Could not allocate size %d\n", SizeNeeded));
|
||||
REPORT_ERROR ("AmlAllocateNameString: name allocation failure");
|
||||
return_PTR (NULL);
|
||||
}
|
||||
|
||||
@ -192,10 +194,11 @@ AcpiExAllocateNameString (
|
||||
|
||||
/* Set up Root or Parent prefixes if needed */
|
||||
|
||||
if (PrefixCount == ACPI_UINT32_MAX)
|
||||
if (PrefixCount == (UINT32) -1)
|
||||
{
|
||||
*TempPtr++ = AML_ROOT_PREFIX;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
while (PrefixCount--)
|
||||
@ -214,6 +217,7 @@ AcpiExAllocateNameString (
|
||||
*TempPtr++ = AML_MULTI_NAME_PREFIX_OP;
|
||||
*TempPtr++ = (char) NumNameSegs;
|
||||
}
|
||||
|
||||
else if (2 == NumNameSegs)
|
||||
{
|
||||
/* Set up dual prefixes */
|
||||
@ -222,17 +226,71 @@ AcpiExAllocateNameString (
|
||||
}
|
||||
|
||||
/*
|
||||
* Terminate string following prefixes. AcpiExNameSegment() will
|
||||
* Terminate string following prefixes. AcpiAmlExecNameSegment() will
|
||||
* append the segment(s)
|
||||
*/
|
||||
|
||||
*TempPtr = 0;
|
||||
|
||||
return_PTR (NameString);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiExNameSegment
|
||||
* FUNCTION: AcpiAmlDecodePackageLength
|
||||
*
|
||||
* PARAMETERS: LastPkgLen - latest value decoded by DoPkgLength() for
|
||||
* most recently examined package or field
|
||||
*
|
||||
* RETURN: Number of bytes contained in package length encoding
|
||||
*
|
||||
* DESCRIPTION: Decodes the Package Length. Upper 2 bits are are used to
|
||||
* tell if type 1, 2, 3, or 4.
|
||||
* 0x3F = Max 1 byte encoding,
|
||||
* 0xFFF = Max 2 byte encoding,
|
||||
* 0xFFFFF = Max 3 Byte encoding,
|
||||
* 0xFFFFFFFFF = Max 4 Byte encoding.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
UINT32
|
||||
AcpiAmlDecodePackageLength (
|
||||
UINT32 LastPkgLen)
|
||||
{
|
||||
UINT32 NumBytes = 0;
|
||||
|
||||
|
||||
FUNCTION_TRACE ("AmlDecodePackageLength");
|
||||
|
||||
|
||||
if (LastPkgLen < ACPI_AML_PACKAGE_TYPE1)
|
||||
{
|
||||
NumBytes = 1;
|
||||
}
|
||||
|
||||
else if (LastPkgLen < ACPI_AML_PACKAGE_TYPE2)
|
||||
{
|
||||
NumBytes = 2;
|
||||
}
|
||||
|
||||
else if (LastPkgLen < ACPI_AML_PACKAGE_TYPE3)
|
||||
{
|
||||
NumBytes = 3;
|
||||
}
|
||||
|
||||
else if (LastPkgLen < ACPI_AML_PACKAGE_TYPE4)
|
||||
{
|
||||
NumBytes = 4;
|
||||
}
|
||||
|
||||
return_VALUE (NumBytes);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiAmlExecNameSegment
|
||||
*
|
||||
* PARAMETERS: InterpreterMode - Current running mode (load1/Load2/Exec)
|
||||
*
|
||||
@ -243,45 +301,47 @@ AcpiExAllocateNameString (
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiExNameSegment (
|
||||
AcpiAmlExecNameSegment (
|
||||
UINT8 **InAmlAddress,
|
||||
char *NameString)
|
||||
INT8 *NameString)
|
||||
{
|
||||
char *AmlAddress = (void *) *InAmlAddress;
|
||||
UINT8 *AmlAddress = *InAmlAddress;
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
UINT32 Index;
|
||||
char CharBuf[5];
|
||||
INT32 Index;
|
||||
INT8 CharBuf[5];
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("ExNameSegment");
|
||||
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')
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "leading digit: %c\n", CharBuf[0]));
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("AmlExecNameSegment: leading digit: %c\n", CharBuf[0]));
|
||||
return_ACPI_STATUS (AE_CTRL_PENDING);
|
||||
}
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Bytes from stream:\n"));
|
||||
DEBUG_PRINT (TRACE_LOAD, ("AmlExecNameSegment: Bytes from stream:\n"));
|
||||
|
||||
for (Index = 0;
|
||||
(Index < ACPI_NAME_SIZE) && (AcpiUtValidAcpiCharacter (*AmlAddress));
|
||||
Index++)
|
||||
for (Index = 4;
|
||||
(Index > 0) && (AcpiCmValidAcpiCharacter (*AmlAddress));
|
||||
--Index)
|
||||
{
|
||||
CharBuf[Index] = *AmlAddress++;
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "%c\n", CharBuf[Index]));
|
||||
CharBuf[4 - Index] = *AmlAddress++;
|
||||
DEBUG_PRINT (TRACE_LOAD, ("%c\n", CharBuf[4 - Index]));
|
||||
}
|
||||
|
||||
|
||||
/* Valid name segment */
|
||||
|
||||
if (Index == 4)
|
||||
if (0 == Index)
|
||||
{
|
||||
/* Found 4 valid characters */
|
||||
|
||||
@ -289,44 +349,52 @@ AcpiExNameSegment (
|
||||
|
||||
if (NameString)
|
||||
{
|
||||
ACPI_STRCAT (NameString, CharBuf);
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
|
||||
"Appended to - %s \n", NameString));
|
||||
STRCAT (NameString, CharBuf);
|
||||
DEBUG_PRINT (TRACE_NAMES,
|
||||
("AmlExecNameSegment: Appended to - %s \n", NameString));
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
|
||||
"No Name string - %s \n", CharBuf));
|
||||
DEBUG_PRINT (TRACE_NAMES,
|
||||
("AmlExecNameSegment: No Name string - %s \n", CharBuf));
|
||||
}
|
||||
}
|
||||
else if (Index == 0)
|
||||
|
||||
else if (4 == Index)
|
||||
{
|
||||
/*
|
||||
* First character was not a valid name character,
|
||||
* so we are looking at something other than a name.
|
||||
*/
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
||||
"Leading character is not alpha: %02Xh (not a name)\n",
|
||||
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;
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad character %02x in name, at %p\n",
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("AmlExecNameSegment: Bad INT8 %02x in name, at %p\n",
|
||||
*AmlAddress, AmlAddress));
|
||||
}
|
||||
|
||||
*InAmlAddress = (UINT8 *) AmlAddress;
|
||||
DEBUG_PRINT (TRACE_EXEC, ("Leave AcpiAmlExecNameSegment %s \n",
|
||||
AcpiCmFormatException (Status)));
|
||||
|
||||
*InAmlAddress = AmlAddress;
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiExGetNameString
|
||||
* FUNCTION: AcpiAmlGetNameString
|
||||
*
|
||||
* PARAMETERS: DataType - Data type to be associated with this name
|
||||
*
|
||||
@ -336,59 +404,62 @@ AcpiExNameSegment (
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiExGetNameString (
|
||||
ACPI_OBJECT_TYPE DataType,
|
||||
AcpiAmlGetNameString (
|
||||
OBJECT_TYPE_INTERNAL DataType,
|
||||
UINT8 *InAmlAddress,
|
||||
char **OutNameString,
|
||||
INT8 **OutNameString,
|
||||
UINT32 *OutNameLength)
|
||||
{
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
UINT8 *AmlAddress = InAmlAddress;
|
||||
char *NameString = NULL;
|
||||
UINT32 NumSegments;
|
||||
UINT32 PrefixCount = 0;
|
||||
BOOLEAN HasPrefix = FALSE;
|
||||
INT8 *NameString = NULL;
|
||||
INT32 NumSegments;
|
||||
INT32 PrefixCount = 0;
|
||||
UINT8 Prefix = 0;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE_PTR ("ExGetNameString", AmlAddress);
|
||||
FUNCTION_TRACE_PTR ("AmlGetNameString", AmlAddress);
|
||||
|
||||
|
||||
if (ACPI_TYPE_LOCAL_REGION_FIELD == DataType ||
|
||||
ACPI_TYPE_LOCAL_BANK_FIELD == DataType ||
|
||||
ACPI_TYPE_LOCAL_INDEX_FIELD == DataType)
|
||||
if (INTERNAL_TYPE_DEF_FIELD == DataType ||
|
||||
INTERNAL_TYPE_BANK_FIELD == DataType ||
|
||||
INTERNAL_TYPE_INDEX_FIELD == DataType)
|
||||
{
|
||||
/* Disallow prefixes for types associated with FieldUnit names */
|
||||
/* Disallow prefixes for types associated with field names */
|
||||
|
||||
NameString = AcpiExAllocateNameString (0, 1);
|
||||
NameString = AcpiAmlAllocateNameString (0, 1);
|
||||
if (!NameString)
|
||||
{
|
||||
Status = AE_NO_MEMORY;
|
||||
}
|
||||
else
|
||||
{
|
||||
Status = AcpiExNameSegment (&AmlAddress, NameString);
|
||||
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:
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "RootPrefix(\\) at %p\n", AmlAddress));
|
||||
Prefix = *AmlAddress++;
|
||||
DEBUG_PRINT (TRACE_LOAD, ("RootPrefix: %x\n", Prefix));
|
||||
|
||||
/*
|
||||
* Remember that we have a RootPrefix --
|
||||
* see comment in AcpiExAllocateNameString()
|
||||
* see comment in AcpiAmlAllocateNameString()
|
||||
*/
|
||||
AmlAddress++;
|
||||
PrefixCount = ACPI_UINT32_MAX;
|
||||
HasPrefix = TRUE;
|
||||
PrefixCount = -1;
|
||||
break;
|
||||
|
||||
|
||||
@ -398,21 +469,18 @@ AcpiExGetNameString (
|
||||
|
||||
do
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "ParentPrefix (^) at %p\n", AmlAddress));
|
||||
Prefix = *AmlAddress++;
|
||||
DEBUG_PRINT (TRACE_LOAD, ("ParentPrefix: %x\n", Prefix));
|
||||
|
||||
AmlAddress++;
|
||||
PrefixCount++;
|
||||
++PrefixCount;
|
||||
|
||||
} while (*AmlAddress == AML_PARENT_PREFIX);
|
||||
|
||||
HasPrefix = TRUE;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
/* Not a prefix character */
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@ -421,55 +489,55 @@ AcpiExGetNameString (
|
||||
|
||||
switch (*AmlAddress)
|
||||
{
|
||||
|
||||
case AML_DUAL_NAME_PREFIX:
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "DualNamePrefix at %p\n", AmlAddress));
|
||||
Prefix = *AmlAddress++;
|
||||
DEBUG_PRINT (TRACE_LOAD, ("DualNamePrefix: %x\n", Prefix));
|
||||
|
||||
AmlAddress++;
|
||||
NameString = AcpiExAllocateNameString (PrefixCount, 2);
|
||||
NameString = AcpiAmlAllocateNameString (PrefixCount, 2);
|
||||
if (!NameString)
|
||||
{
|
||||
Status = AE_NO_MEMORY;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Indicate that we processed a prefix */
|
||||
/* Ensure PrefixCount != 0 to remember processing a prefix */
|
||||
|
||||
HasPrefix = TRUE;
|
||||
PrefixCount += 2;
|
||||
|
||||
Status = AcpiExNameSegment (&AmlAddress, NameString);
|
||||
Status = AcpiAmlExecNameSegment (&AmlAddress, NameString);
|
||||
if (ACPI_SUCCESS (Status))
|
||||
{
|
||||
Status = AcpiExNameSegment (&AmlAddress, NameString);
|
||||
Status = AcpiAmlExecNameSegment (&AmlAddress, NameString);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case AML_MULTI_NAME_PREFIX_OP:
|
||||
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "MultiNamePrefix at %p\n", AmlAddress));
|
||||
Prefix = *AmlAddress++;
|
||||
DEBUG_PRINT (TRACE_LOAD, ("MultiNamePrefix: %x\n", Prefix));
|
||||
|
||||
/* Fetch count of segments remaining in name path */
|
||||
|
||||
AmlAddress++;
|
||||
NumSegments = *AmlAddress;
|
||||
NumSegments = *AmlAddress++;
|
||||
|
||||
NameString = AcpiExAllocateNameString (PrefixCount, NumSegments);
|
||||
NameString = AcpiAmlAllocateNameString (PrefixCount, NumSegments);
|
||||
if (!NameString)
|
||||
{
|
||||
Status = AE_NO_MEMORY;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Indicate that we processed a prefix */
|
||||
/* Ensure PrefixCount != 0 to remember processing a prefix */
|
||||
|
||||
AmlAddress++;
|
||||
HasPrefix = TRUE;
|
||||
PrefixCount += 2;
|
||||
|
||||
while (NumSegments &&
|
||||
(Status = AcpiExNameSegment (&AmlAddress, NameString)) == AE_OK)
|
||||
(Status = AcpiAmlExecNameSegment (&AmlAddress, NameString)) == AE_OK)
|
||||
{
|
||||
NumSegments--;
|
||||
--NumSegments;
|
||||
}
|
||||
|
||||
break;
|
||||
@ -479,15 +547,16 @@ AcpiExGetNameString (
|
||||
|
||||
/* NullName valid as of 8-12-98 ASL/AML Grammar Update */
|
||||
|
||||
if (PrefixCount == ACPI_UINT32_MAX)
|
||||
if (-1 == PrefixCount)
|
||||
{
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "NameSeg is \"\\\" followed by NULL\n"));
|
||||
DEBUG_PRINT (TRACE_EXEC,
|
||||
("AmlDoName: NameSeg is \"\\\" followed by NULL\n"));
|
||||
}
|
||||
|
||||
/* Consume the NULL byte */
|
||||
|
||||
AmlAddress++;
|
||||
NameString = AcpiExAllocateNameString (PrefixCount, 0);
|
||||
NameString = AcpiAmlAllocateNameString (PrefixCount, 0);
|
||||
if (!NameString)
|
||||
{
|
||||
Status = AE_NO_MEMORY;
|
||||
@ -501,27 +570,32 @@ AcpiExGetNameString (
|
||||
|
||||
/* Name segment string */
|
||||
|
||||
NameString = AcpiExAllocateNameString (PrefixCount, 1);
|
||||
NameString = AcpiAmlAllocateNameString (PrefixCount, 1);
|
||||
if (!NameString)
|
||||
{
|
||||
Status = AE_NO_MEMORY;
|
||||
break;
|
||||
}
|
||||
|
||||
Status = AcpiExNameSegment (&AmlAddress, NameString);
|
||||
Status = AcpiAmlExecNameSegment (&AmlAddress, NameString);
|
||||
break;
|
||||
}
|
||||
|
||||
} /* Switch (PeekOp ()) */
|
||||
}
|
||||
|
||||
if (AE_CTRL_PENDING == Status && HasPrefix)
|
||||
|
||||
if (AE_CTRL_PENDING == Status && PrefixCount != 0)
|
||||
{
|
||||
/* Ran out of segments after processing a prefix */
|
||||
|
||||
ACPI_REPORT_ERROR (
|
||||
("ExDoName: Malformed Name at %p\n", NameString));
|
||||
DEBUG_PRINT (ACPI_ERROR,
|
||||
("AmlDoName: Malformed Name at %p\n", NameString));
|
||||
REPORT_ERROR ("Ran out of segments after processing a prefix");
|
||||
|
||||
Status = AE_AML_BAD_NAME;
|
||||
}
|
||||
|
||||
|
||||
*OutNameString = NameString;
|
||||
*OutNameLength = (UINT32) (AmlAddress - InAmlAddress);
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user