summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/excreate.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/excreate.c')
-rw-r--r--sys/contrib/dev/acpica/excreate.c117
1 files changed, 91 insertions, 26 deletions
diff --git a/sys/contrib/dev/acpica/excreate.c b/sys/contrib/dev/acpica/excreate.c
index 0410fe5..e14b28d 100644
--- a/sys/contrib/dev/acpica/excreate.c
+++ b/sys/contrib/dev/acpica/excreate.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: excreate - Named object creation
- * $Revision: 79 $
+ * $Revision: 89 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,10 +124,11 @@
#include "acnamesp.h"
#include "acevents.h"
#include "acdispat.h"
+#include "actables.h"
#define _COMPONENT ACPI_EXECUTER
- MODULE_NAME ("excreate")
+ ACPI_MODULE_NAME ("excreate")
/*****************************************************************************
@@ -151,7 +152,7 @@ AcpiExCreateAlias (
ACPI_STATUS Status;
- FUNCTION_TRACE ("ExCreateAlias");
+ ACPI_FUNCTION_TRACE ("ExCreateAlias");
/* Get the source/alias operands (both namespace nodes) */
@@ -198,7 +199,7 @@ AcpiExCreateEvent (
ACPI_OPERAND_OBJECT *ObjDesc;
- FUNCTION_TRACE ("ExCreateEvent");
+ ACPI_FUNCTION_TRACE ("ExCreateEvent");
ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_EVENT);
@@ -208,7 +209,7 @@ AcpiExCreateEvent (
goto Cleanup;
}
- /*
+ /*
* Create the actual OS semaphore, with zero initial units -- meaning
* that the event is created in an unsignalled state
*/
@@ -222,7 +223,7 @@ AcpiExCreateEvent (
/* Attach object to the Node */
Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) WalkState->Operands[0],
- ObjDesc, (UINT8) ACPI_TYPE_EVENT);
+ ObjDesc, ACPI_TYPE_EVENT);
Cleanup:
/*
@@ -256,7 +257,7 @@ AcpiExCreateMutex (
ACPI_OPERAND_OBJECT *ObjDesc;
- FUNCTION_TRACE_PTR ("ExCreateMutex", WALK_OPERANDS);
+ ACPI_FUNCTION_TRACE_PTR ("ExCreateMutex", ACPI_WALK_OPERANDS);
/* Create the new mutex object */
@@ -268,7 +269,7 @@ AcpiExCreateMutex (
goto Cleanup;
}
- /*
+ /*
* Create the actual OS semaphore.
* One unit max to make it a mutex, with one initial unit to allow
* the mutex to be acquired.
@@ -284,7 +285,7 @@ AcpiExCreateMutex (
ObjDesc->Mutex.SyncLevel = (UINT8) WalkState->Operands[1]->Integer.Value;
Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) WalkState->Operands[0],
- ObjDesc, (UINT8) ACPI_TYPE_MUTEX);
+ ObjDesc, ACPI_TYPE_MUTEX);
Cleanup:
@@ -322,10 +323,10 @@ AcpiExCreateRegion (
ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_NAMESPACE_NODE *Node;
- ACPI_OPERAND_OBJECT *RegionObj2 = NULL;
+ ACPI_OPERAND_OBJECT *RegionObj2;
- FUNCTION_TRACE ("ExCreateRegion");
+ ACPI_FUNCTION_TRACE ("ExCreateRegion");
/* Get the Node from the object stack */
@@ -348,7 +349,7 @@ AcpiExCreateRegion (
if ((RegionSpace >= ACPI_NUM_PREDEFINED_REGIONS) &&
(RegionSpace < ACPI_USER_REGION_BEGIN))
{
- REPORT_ERROR (("Invalid AddressSpace type %X\n", RegionSpace));
+ ACPI_REPORT_ERROR (("Invalid AddressSpace type %X\n", RegionSpace));
return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID);
}
@@ -382,7 +383,7 @@ AcpiExCreateRegion (
/* Install the new region object in the parent Node */
- Status = AcpiNsAttachObject (Node, ObjDesc, (UINT8) ACPI_TYPE_REGION);
+ Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_REGION);
Cleanup:
@@ -410,24 +411,88 @@ ACPI_STATUS
AcpiExCreateTableRegion (
ACPI_WALK_STATE *WalkState)
{
- ACPI_STATUS Status = AE_OK;
+ ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_TABLE_HEADER *Table;
+ ACPI_OPERAND_OBJECT *RegionObj2;
- FUNCTION_TRACE ("ExCreateTableRegion");
+ ACPI_FUNCTION_TRACE ("ExCreateTableRegion");
+
+ /* Get the Node from the object stack */
+
+ Node = WalkState->Op->Node;
+
+ /*
+ * If the region object is already attached to this node,
+ * just return
+ */
+ if (AcpiNsGetAttachedObject (Node))
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Find the ACPI table */
+
+ Status = AcpiTbFindTable (Operand[1]->String.Pointer,
+ Operand[2]->String.Pointer,
+ Operand[3]->String.Pointer, &Table);
+
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Create the region descriptor */
-/*
- ACPI_OPERAND_OBJECT *ObjDesc;
ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_REGION);
if (!ObjDesc)
{
- Status = AE_NO_MEMORY;
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ RegionObj2 = ObjDesc->Common.NextObject;
+ RegionObj2->Extra.RegionContext = NULL;
+
+ /* Init the region from the operands */
+
+ ObjDesc->Region.SpaceId = REGION_DATA_TABLE;
+ ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS) ACPI_TO_INTEGER (Table);
+ ObjDesc->Region.Length = Table->Length;
+ ObjDesc->Region.Node = Node;
+ ObjDesc->Region.Flags = AOPOBJ_DATA_VALID;
+
+ /* Install the new region object in the parent Node */
+
+ Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_REGION);
+ if (ACPI_FAILURE (Status))
+ {
goto Cleanup;
}
+ Status = AcpiEvInitializeRegion (ObjDesc, FALSE);
+ if (ACPI_FAILURE (Status))
+ {
+ if (Status == AE_NOT_EXIST)
+ {
+ Status = AE_OK;
+ }
+ else
+ {
+ goto Cleanup;
+ }
+ }
+
+ ObjDesc->Region.Flags |= AOPOBJ_SETUP_COMPLETE;
+
Cleanup:
-*/
+ /* Remove local reference to the object */
+
+ AcpiUtRemoveReference (ObjDesc);
return_ACPI_STATUS (Status);
}
@@ -457,7 +522,7 @@ AcpiExCreateProcessor (
ACPI_STATUS Status;
- FUNCTION_TRACE_PTR ("ExCreateProcessor", WalkState);
+ ACPI_FUNCTION_TRACE_PTR ("ExCreateProcessor", WalkState);
/* Create the processor object */
@@ -478,7 +543,7 @@ AcpiExCreateProcessor (
/* Install the processor object in the parent Node */
Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0],
- ObjDesc, (UINT8) ACPI_TYPE_PROCESSOR);
+ ObjDesc, ACPI_TYPE_PROCESSOR);
/* Remove local reference to the object */
@@ -513,7 +578,7 @@ AcpiExCreatePowerResource (
ACPI_OPERAND_OBJECT *ObjDesc;
- FUNCTION_TRACE_PTR ("ExCreatePowerResource", WalkState);
+ ACPI_FUNCTION_TRACE_PTR ("ExCreatePowerResource", WalkState);
/* Create the power resource object */
@@ -532,7 +597,7 @@ AcpiExCreatePowerResource (
/* Install the power resource object in the parent Node */
Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0],
- ObjDesc, (UINT8) ACPI_TYPE_POWER);
+ ObjDesc, ACPI_TYPE_POWER);
/* Remove local reference to the object */
@@ -569,7 +634,7 @@ AcpiExCreateMethod (
UINT8 MethodFlags;
- FUNCTION_TRACE_PTR ("ExCreateMethod", WalkState);
+ ACPI_FUNCTION_TRACE_PTR ("ExCreateMethod", WalkState);
/* Create a new method object */
@@ -614,7 +679,7 @@ AcpiExCreateMethod (
/* Attach the new object to the method Node */
Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0],
- ObjDesc, (UINT8) ACPI_TYPE_METHOD);
+ ObjDesc, ACPI_TYPE_METHOD);
/* Remove local reference to the object */
OpenPOWER on IntegriCloud