mirror of
https://github.com/acpica/acpica/
synced 2025-01-01 07:04:27 +03:00
Global rename of identifiers and constants
date 2000.06.13.18.19.00; author rmoore1; state Exp;
This commit is contained in:
parent
6bf5602952
commit
c8d9ab124d
@ -116,9 +116,9 @@
|
||||
|
||||
#define __DSWSCOPE_C__
|
||||
|
||||
#include <acpi.h>
|
||||
#include <interp.h>
|
||||
#include <dispatch.h>
|
||||
#include "acpi.h"
|
||||
#include "interp.h"
|
||||
#include "dispatch.h"
|
||||
|
||||
|
||||
#define _COMPONENT NAMESPACE
|
||||
@ -131,7 +131,7 @@
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* FUNCTION: DsScopeStackClear
|
||||
* FUNCTION: AcpiDsScopeStackClear
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
@ -141,7 +141,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
void
|
||||
DsScopeStackClear (
|
||||
AcpiDsScopeStackClear (
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
ACPI_GENERIC_STATE *ScopeInfo;
|
||||
@ -155,7 +155,7 @@ DsScopeStackClear (
|
||||
WalkState->ScopeInfo = ScopeInfo->Scope.Next;
|
||||
|
||||
DEBUG_PRINT (TRACE_EXEC, ("Popped object type 0x%X\n", ScopeInfo->Common.Value));
|
||||
CmDeleteGenericState (ScopeInfo);
|
||||
AcpiCmDeleteGenericState (ScopeInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,7 +163,7 @@ DsScopeStackClear (
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* FUNCTION: DsScopeStackPush
|
||||
* FUNCTION: AcpiDsScopeStackPush
|
||||
*
|
||||
* PARAMETERS: *NewScope, - Name to be made current
|
||||
* Type, - Type of frame being pushed
|
||||
@ -174,7 +174,7 @@ DsScopeStackClear (
|
||||
***************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
DsScopeStackPush (
|
||||
AcpiDsScopeStackPush (
|
||||
NAME_TABLE_ENTRY *NewScope,
|
||||
OBJECT_TYPE_INTERNAL Type,
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
@ -195,7 +195,7 @@ DsScopeStackPush (
|
||||
|
||||
/* Make sure object type is valid */
|
||||
|
||||
if (!AmlValidateObjectType (Type))
|
||||
if (!AcpiAmlValidateObjectType (Type))
|
||||
{
|
||||
REPORT_WARNING ("DsScopeStackPush: type code out of range");
|
||||
}
|
||||
@ -203,7 +203,7 @@ DsScopeStackPush (
|
||||
|
||||
/* Allocate a new scope object */
|
||||
|
||||
ScopeInfo = CmCreateGenericState ();
|
||||
ScopeInfo = AcpiCmCreateGenericState ();
|
||||
if (!ScopeInfo)
|
||||
{
|
||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
||||
@ -216,7 +216,7 @@ DsScopeStackPush (
|
||||
|
||||
/* Push new scope object onto stack */
|
||||
|
||||
CmPushGenericState (&WalkState->ScopeInfo, ScopeInfo);
|
||||
AcpiCmPushGenericState (&WalkState->ScopeInfo, ScopeInfo);
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
@ -224,7 +224,7 @@ DsScopeStackPush (
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* FUNCTION: DsScopeStackPop
|
||||
* FUNCTION: AcpiDsScopeStackPop
|
||||
*
|
||||
* PARAMETERS: Type - The type of frame to be found
|
||||
*
|
||||
@ -240,7 +240,7 @@ DsScopeStackPush (
|
||||
***************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
DsScopeStackPop (
|
||||
AcpiDsScopeStackPop (
|
||||
ACPI_WALK_STATE *WalkState)
|
||||
{
|
||||
ACPI_GENERIC_STATE *ScopeInfo;
|
||||
@ -252,7 +252,7 @@ DsScopeStackPop (
|
||||
* Pop scope info object off the stack.
|
||||
*/
|
||||
|
||||
ScopeInfo = CmPopGenericState (&WalkState->ScopeInfo);
|
||||
ScopeInfo = AcpiCmPopGenericState (&WalkState->ScopeInfo);
|
||||
if (!ScopeInfo)
|
||||
{
|
||||
return_ACPI_STATUS (AE_STACK_UNDERFLOW);
|
||||
@ -260,7 +260,7 @@ DsScopeStackPop (
|
||||
|
||||
DEBUG_PRINT (TRACE_EXEC, ("Popped object type 0x%X\n", ScopeInfo->Common.Value));
|
||||
|
||||
CmDeleteGenericState (ScopeInfo);
|
||||
AcpiCmDeleteGenericState (ScopeInfo);
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes)
|
||||
* $Revision: 1.63 $
|
||||
*
|
||||
* Module Name: ieconfig - 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
|
||||
*
|
||||
@ -38,9 +38,9 @@
|
||||
* The above copyright and patent license is granted only if the following
|
||||
* conditions are met:
|
||||
*
|
||||
* 3. Conditions
|
||||
* 3. Conditions
|
||||
*
|
||||
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
|
||||
* 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,
|
||||
@ -48,11 +48,11 @@
|
||||
* 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
|
||||
* 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.
|
||||
* 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
|
||||
@ -87,7 +87,7 @@
|
||||
|
||||
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE.
|
||||
* 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
|
||||
@ -115,63 +115,121 @@
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#define __EXCONFIG_C__
|
||||
#define __IECONFIG_C__
|
||||
|
||||
#include "acpi.h"
|
||||
#include "acinterp.h"
|
||||
#include "parser.h"
|
||||
#include "interp.h"
|
||||
#include "amlcode.h"
|
||||
#include "acnamesp.h"
|
||||
#include "acevents.h"
|
||||
#include "actables.h"
|
||||
#include "namesp.h"
|
||||
#include "events.h"
|
||||
#include "tables.h"
|
||||
#include "dispatch.h"
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_EXECUTER
|
||||
ACPI_MODULE_NAME ("exconfig")
|
||||
#define _COMPONENT INTERPRETER
|
||||
MODULE_NAME ("ieconfig");
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiAmlExecLoadTable
|
||||
*
|
||||
* FUNCTION: AcpiExAddTable
|
||||
*
|
||||
* 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;
|
||||
char *TablePtr;
|
||||
char *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 *) ((char *) &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, Acpi_GblAcpiTableData[TABLE_PSDT].Signature, Acpi_GblAcpiTableData[TABLE_PSDT].SigLength)) &&
|
||||
(!STRNCMP (TableHeader.Signature, Acpi_GblAcpiTableData[TABLE_SSDT].Signature, Acpi_GblAcpiTableData[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 = 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 (NULL, &TableInfo);
|
||||
if (ACPI_FAILURE (Status))
|
||||
@ -181,331 +239,39 @@ 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, AcpiUtGetTypeName (ObjDesc->Common.Type)));
|
||||
|
||||
/* 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, AcpiUtGetTypeName (ObjDesc->Common.Type)));
|
||||
|
||||
/*
|
||||
* 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,51 +279,139 @@ 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_OPERAND_OBJECT *)DdbHandle)->Common.Type !=
|
||||
INTERNAL_TYPE_REFERENCE))
|
||||
(!VALID_DESCRIPTOR_TYPE (DdbHandle, DESC_TYPE_ACPI_OBJ)) ||
|
||||
(((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 (Status != AE_OK)
|
||||
{
|
||||
AcpiAmlAppendOperandDiag (_THIS_MODULE, __LINE__, Opcode, WALK_OPERANDS, 2);
|
||||
goto Cleanup2;
|
||||
}
|
||||
|
||||
Status = AcpiAmlExecLoadTable (RegionDesc, DdbHandle);
|
||||
break;
|
||||
|
||||
|
||||
case AML_UN_LOAD_OP:
|
||||
|
||||
if (Status != AE_OK)
|
||||
{
|
||||
AcpiAmlAppendOperandDiag (_THIS_MODULE, __LINE__, Opcode, WALK_OPERANDS, 1);
|
||||
goto Cleanup1;
|
||||
}
|
||||
|
||||
Status = AcpiAmlExecUnloadTable (DdbHandle);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
DEBUG_PRINT (ACPI_ERROR, ("AmlExecReconfiguration: bad opcode=%X\n", Opcode));
|
||||
|
||||
Status = AE_AML_BAD_OPCODE;
|
||||
break;
|
||||
}
|
||||
|
||||
Cleanup2:
|
||||
AcpiCmRemoveReference (RegionDesc);
|
||||
|
||||
Cleanup1:
|
||||
// AcpiCmRemoveReference (DdbHandle);
|
||||
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user