summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/utdelete.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/utdelete.c')
-rw-r--r--sys/contrib/dev/acpica/utdelete.c171
1 files changed, 86 insertions, 85 deletions
diff --git a/sys/contrib/dev/acpica/utdelete.c b/sys/contrib/dev/acpica/utdelete.c
index 7714901..95d1feb 100644
--- a/sys/contrib/dev/acpica/utdelete.c
+++ b/sys/contrib/dev/acpica/utdelete.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: utdelete - object deletion and reference count utilities
- * $Revision: 100 $
+ * $Revision: 1.107 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -120,16 +120,28 @@
#include <contrib/dev/acpica/acinterp.h>
#include <contrib/dev/acpica/acnamesp.h>
#include <contrib/dev/acpica/acevents.h>
+#include <contrib/dev/acpica/amlcode.h>
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utdelete")
+/* Local prototypes */
+
+static void
+AcpiUtDeleteInternalObj (
+ ACPI_OPERAND_OBJECT *Object);
+
+static void
+AcpiUtUpdateRefCount (
+ ACPI_OPERAND_OBJECT *Object,
+ UINT32 Action);
+
/*******************************************************************************
*
* FUNCTION: AcpiUtDeleteInternalObj
*
- * PARAMETERS: *Object - Pointer to the list to be deleted
+ * PARAMETERS: Object - Object to be deleted
*
* RETURN: None
*
@@ -138,7 +150,7 @@
*
******************************************************************************/
-void
+static void
AcpiUtDeleteInternalObj (
ACPI_OPERAND_OBJECT *Object)
{
@@ -231,7 +243,8 @@ AcpiUtDeleteInternalObj (
case ACPI_TYPE_MUTEX:
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Mutex %p, Semaphore %p\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
+ "***** Mutex %p, Semaphore %p\n",
Object, Object->Mutex.Semaphore));
AcpiExUnlinkMutex (Object);
@@ -241,7 +254,8 @@ AcpiUtDeleteInternalObj (
case ACPI_TYPE_EVENT:
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Event %p, Semaphore %p\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
+ "***** Event %p, Semaphore %p\n",
Object, Object->Event.Semaphore));
(void) AcpiOsDeleteSemaphore (Object->Event.Semaphore);
@@ -251,7 +265,8 @@ AcpiUtDeleteInternalObj (
case ACPI_TYPE_METHOD:
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Method %p\n", Object));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
+ "***** Method %p\n", Object));
/* Delete the method semaphore if it exists */
@@ -265,7 +280,8 @@ AcpiUtDeleteInternalObj (
case ACPI_TYPE_REGION:
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Region %p\n", Object));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
+ "***** Region %p\n", Object));
SecondDesc = AcpiNsGetSecondaryObject (Object);
if (SecondDesc)
@@ -295,7 +311,8 @@ AcpiUtDeleteInternalObj (
case ACPI_TYPE_BUFFER_FIELD:
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Buffer Field %p\n", Object));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
+ "***** Buffer Field %p\n", Object));
SecondDesc = AcpiNsGetSecondaryObject (Object);
if (SecondDesc)
@@ -332,7 +349,7 @@ AcpiUtDeleteInternalObj (
*
* FUNCTION: AcpiUtDeleteInternalObjectList
*
- * PARAMETERS: *ObjList - Pointer to the list to be deleted
+ * PARAMETERS: ObjList - Pointer to the list to be deleted
*
* RETURN: None
*
@@ -369,7 +386,7 @@ AcpiUtDeleteInternalObjectList (
*
* FUNCTION: AcpiUtUpdateRefCount
*
- * PARAMETERS: *Object - Object whose ref count is to be updated
+ * PARAMETERS: Object - Object whose ref count is to be updated
* Action - What to do
*
* RETURN: New ref count
@@ -399,7 +416,8 @@ AcpiUtUpdateRefCount (
NewCount = Count;
/*
- * Perform the reference count action (increment, decrement, or force delete)
+ * Perform the reference count action
+ * (increment, decrement, or force delete)
*/
switch (Action)
{
@@ -409,7 +427,8 @@ AcpiUtUpdateRefCount (
NewCount++;
Object->Common.ReferenceCount = NewCount;
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, [Incremented]\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
+ "Obj %p Refs=%X, [Incremented]\n",
Object, NewCount));
break;
@@ -418,7 +437,8 @@ AcpiUtUpdateRefCount (
if (Count < 1)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, can't decrement! (Set to 0)\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
+ "Obj %p Refs=%X, can't decrement! (Set to 0)\n",
Object, NewCount));
NewCount = 0;
@@ -427,13 +447,15 @@ AcpiUtUpdateRefCount (
{
NewCount--;
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, [Decremented]\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
+ "Obj %p Refs=%X, [Decremented]\n",
Object, NewCount));
}
if (ACPI_GET_OBJECT_TYPE (Object) == ACPI_TYPE_METHOD)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Method Obj %p Refs=%X, [Decremented]\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
+ "Method Obj %p Refs=%X, [Decremented]\n",
Object, NewCount));
}
@@ -448,7 +470,8 @@ AcpiUtUpdateRefCount (
case REF_FORCE_DELETE:
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, Force delete! (Set to 0)\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
+ "Obj %p Refs=%X, Force delete! (Set to 0)\n",
Object, Count));
NewCount = 0;
@@ -483,7 +506,7 @@ AcpiUtUpdateRefCount (
*
* FUNCTION: AcpiUtUpdateObjectReference
*
- * PARAMETERS: *Object - Increment ref count for this object
+ * PARAMETERS: Object - Increment ref count for this object
* and all sub-objects
* Action - Either REF_INCREMENT or REF_DECREMENT or
* REF_FORCE_DELETE
@@ -506,37 +529,26 @@ AcpiUtUpdateObjectReference (
ACPI_OPERAND_OBJECT *Object,
UINT16 Action)
{
- ACPI_STATUS Status;
- UINT32 i;
- ACPI_GENERIC_STATE *StateList = NULL;
- ACPI_GENERIC_STATE *State;
+ ACPI_STATUS Status = AE_OK;
+ ACPI_GENERIC_STATE *StateList = NULL;
+ ACPI_OPERAND_OBJECT *NextObject = NULL;
+ ACPI_GENERIC_STATE *State;
+ ACPI_NATIVE_UINT i;
ACPI_FUNCTION_TRACE_PTR ("UtUpdateObjectReference", Object);
- /* Ignore a null object ptr */
-
- if (!Object)
+ while (Object)
{
- return_ACPI_STATUS (AE_OK);
- }
-
- /* Make sure that this isn't a namespace handle */
+ /* Make sure that this isn't a namespace handle */
- if (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p is NS handle\n", Object));
- return_ACPI_STATUS (AE_OK);
- }
-
- State = AcpiUtCreateUpdateState (Object, Action);
-
- while (State)
- {
- Object = State->Update.Object;
- Action = State->Update.Value;
- AcpiUtDeleteGenericState (State);
+ if (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
+ "Object %p is NS handle\n", Object));
+ return_ACPI_STATUS (AE_OK);
+ }
/*
* All sub-objects must have their reference count incremented also.
@@ -550,12 +562,10 @@ AcpiUtUpdateObjectReference (
AcpiUtUpdateRefCount (Object->Device.DeviceNotify, Action);
break;
-
case ACPI_TYPE_PACKAGE:
-
/*
- * We must update all the sub-objects of the package
- * (Each of whom may have their own sub-objects, etc.
+ * We must update all the sub-objects of the package,
+ * each of whom may have their own sub-objects.
*/
for (i = 0; i < Object->Package.Count; i++)
{
@@ -573,38 +583,19 @@ AcpiUtUpdateObjectReference (
}
break;
-
case ACPI_TYPE_BUFFER_FIELD:
- Status = AcpiUtCreateUpdateStateAndPush (
- Object->BufferField.BufferObj, Action, &StateList);
- if (ACPI_FAILURE (Status))
- {
- goto ErrorExit;
- }
+ NextObject = Object->BufferField.BufferObj;
break;
-
case ACPI_TYPE_LOCAL_REGION_FIELD:
- Status = AcpiUtCreateUpdateStateAndPush (
- Object->Field.RegionObj, Action, &StateList);
- if (ACPI_FAILURE (Status))
- {
- goto ErrorExit;
- }
- break;
-
+ NextObject = Object->Field.RegionObj;
+ break;
case ACPI_TYPE_LOCAL_BANK_FIELD:
- Status = AcpiUtCreateUpdateStateAndPush (
- Object->BankField.BankObj, Action, &StateList);
- if (ACPI_FAILURE (Status))
- {
- goto ErrorExit;
- }
-
+ NextObject = Object->BankField.BankObj;
Status = AcpiUtCreateUpdateStateAndPush (
Object->BankField.RegionObj, Action, &StateList);
if (ACPI_FAILURE (Status))
@@ -613,31 +604,31 @@ AcpiUtUpdateObjectReference (
}
break;
-
case ACPI_TYPE_LOCAL_INDEX_FIELD:
+ NextObject = Object->IndexField.IndexObj;
Status = AcpiUtCreateUpdateStateAndPush (
- Object->IndexField.IndexObj, Action, &StateList);
+ Object->IndexField.DataObj, Action, &StateList);
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
}
+ break;
- Status = AcpiUtCreateUpdateStateAndPush (
- Object->IndexField.DataObj, Action, &StateList);
- if (ACPI_FAILURE (Status))
+ case ACPI_TYPE_LOCAL_REFERENCE:
+ /*
+ * The target of an Index (a package, string, or buffer) must track
+ * changes to the ref count of the index.
+ */
+ if (Object->Reference.Opcode == AML_INDEX_OP)
{
- goto ErrorExit;
+ NextObject = Object->Reference.Object;
}
break;
-
case ACPI_TYPE_REGION:
- case ACPI_TYPE_LOCAL_REFERENCE:
default:
-
- /* No subobjects */
- break;
+ break;/* No subobjects */
}
/*
@@ -646,15 +637,25 @@ AcpiUtUpdateObjectReference (
* main object to be deleted.
*/
AcpiUtUpdateRefCount (Object, Action);
+ Object = NULL;
/* Move on to the next object to be updated */
- State = AcpiUtPopGenericState (&StateList);
+ if (NextObject)
+ {
+ Object = NextObject;
+ NextObject = NULL;
+ }
+ else if (StateList)
+ {
+ State = AcpiUtPopGenericState (&StateList);
+ Object = State->Update.Object;
+ AcpiUtDeleteGenericState (State);
+ }
}
return_ACPI_STATUS (AE_OK);
-
ErrorExit:
ACPI_REPORT_ERROR (("Could not update object reference count, %s\n",
@@ -668,8 +669,8 @@ ErrorExit:
*
* FUNCTION: AcpiUtAddReference
*
- * PARAMETERS: *Object - Object whose reference count is to be
- * incremented
+ * PARAMETERS: Object - Object whose reference count is to be
+ * incremented
*
* RETURN: None
*
@@ -707,7 +708,7 @@ AcpiUtAddReference (
*
* FUNCTION: AcpiUtRemoveReference
*
- * PARAMETERS: *Object - Object whose ref count will be decremented
+ * PARAMETERS: Object - Object whose ref count will be decremented
*
* RETURN: None
*
OpenPOWER on IntegriCloud