1 /*******************************************************************************
3 * Module Name: utdelete - object deletion and reference count utilities
5 ******************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2020, Intel Corp.
12 * All rights reserved.
16 * 2.1. This is your license from Intel Corp. under its intellectual property
17 * rights. You may have additional license terms from the party that provided
18 * you this software, covering your right to use that party's intellectual
21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22 * copy of the source code appearing in this file ("Covered Code") an
23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24 * base code distributed originally by Intel ("Original Intel Code") to copy,
25 * make derivatives, distribute, use and display any portion of the Covered
26 * Code in any form, with the right to sublicense such rights; and
28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29 * license (with the right to sublicense), under only those claims of Intel
30 * patents that are infringed by the Original Intel Code, to make, use, sell,
31 * offer to sell, and import the Covered Code and derivative works thereof
32 * solely to the minimum extent necessary to exercise the above copyright
33 * license, and in no event shall the patent license extend to any additions
34 * to or modifications of the Original Intel Code. No other license or right
35 * is granted directly or by implication, estoppel or otherwise;
37 * The above copyright and patent license is granted only if the following
42 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43 * Redistribution of source code of any substantial portion of the Covered
44 * Code or modification with rights to further distribute source must include
45 * the above Copyright Notice, the above License, this list of Conditions,
46 * and the following Disclaimer and Export Compliance provision. In addition,
47 * Licensee must cause all Covered Code to which Licensee contributes to
48 * contain a file documenting the changes Licensee made to create that Covered
49 * Code and the date of any change. Licensee must include in that file the
50 * documentation of any changes made by any predecessor Licensee. Licensee
51 * must include a prominent statement that the modification is derived,
52 * directly or indirectly, from Original Intel Code.
54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55 * Redistribution of source code of any substantial portion of the Covered
56 * Code or modification without rights to further distribute source must
57 * include the following Disclaimer and Export Compliance provision in the
58 * documentation and/or other materials provided with distribution. In
59 * addition, Licensee may not authorize further sublicense of source of any
60 * portion of the Covered Code, and must include terms to the effect that the
61 * license from Licensee to its licensee is limited to the intellectual
62 * property embodied in the software Licensee provides to its licensee, and
63 * not to intellectual property embodied in modifications its licensee may
66 * 3.3. Redistribution of Executable. Redistribution in executable form of any
67 * substantial portion of the Covered Code or modification must reproduce the
68 * above Copyright Notice, and the following Disclaimer and Export Compliance
69 * provision in the documentation and/or other materials provided with the
72 * 3.4. Intel retains all right, title, and interest in and to the Original
75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76 * Intel shall be used in advertising or otherwise to promote the sale, use or
77 * other dealings in products derived from or relating to the Covered Code
78 * without prior written authorization from Intel.
80 * 4. Disclaimer and Export Compliance
82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99 * 4.3. Licensee shall not export, either directly or indirectly, any of this
100 * software or system incorporating such software without first obtaining any
101 * required license or other approval from the U. S. Department of Commerce or
102 * any other agency or department of the United States Government. In the
103 * event Licensee exports any such software from the United States or
104 * re-exports any such software from a foreign destination, Licensee shall
105 * ensure that the distribution and export/re-export of the software is in
106 * compliance with all laws, regulations, orders, or other restrictions of the
107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108 * any of its subsidiaries will export/re-export any technical data, process,
109 * software, or service, directly or indirectly, to any country for which the
110 * United States government or any agency thereof requires an export license,
111 * other governmental approval, or letter of assurance, without first obtaining
112 * such license, approval or letter.
114 *****************************************************************************
116 * Alternatively, you may choose to be licensed under the terms of the
119 * Redistribution and use in source and binary forms, with or without
120 * modification, are permitted provided that the following conditions
122 * 1. Redistributions of source code must retain the above copyright
123 * notice, this list of conditions, and the following disclaimer,
124 * without modification.
125 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126 * substantially similar to the "NO WARRANTY" disclaimer below
127 * ("Disclaimer") and any redistribution must be conditioned upon
128 * including a substantially similar Disclaimer requirement for further
129 * binary redistribution.
130 * 3. Neither the names of the above-listed copyright holders nor the names
131 * of any contributors may be used to endorse or promote products derived
132 * from this software without specific prior written permission.
134 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
146 * Alternatively, you may choose to be licensed under the terms of the
147 * GNU General Public License ("GPL") version 2 as published by the Free
148 * Software Foundation.
150 *****************************************************************************/
153 #include "accommon.h"
154 #include "acinterp.h"
155 #include "acnamesp.h"
156 #include "acevents.h"
159 #define _COMPONENT ACPI_UTILITIES
160 ACPI_MODULE_NAME ("utdelete")
162 /* Local prototypes */
165 AcpiUtDeleteInternalObj (
166 ACPI_OPERAND_OBJECT *Object);
169 AcpiUtUpdateRefCount (
170 ACPI_OPERAND_OBJECT *Object,
174 /*******************************************************************************
176 * FUNCTION: AcpiUtDeleteInternalObj
178 * PARAMETERS: Object - Object to be deleted
182 * DESCRIPTION: Low level object deletion, after reference counts have been
183 * updated (All reference counts, including sub-objects!)
185 ******************************************************************************/
188 AcpiUtDeleteInternalObj (
189 ACPI_OPERAND_OBJECT *Object)
191 void *ObjPointer = NULL;
192 ACPI_OPERAND_OBJECT *HandlerDesc;
193 ACPI_OPERAND_OBJECT *SecondDesc;
194 ACPI_OPERAND_OBJECT *NextDesc;
195 ACPI_OPERAND_OBJECT *StartDesc;
196 ACPI_OPERAND_OBJECT **LastObjPtr;
199 ACPI_FUNCTION_TRACE_PTR (UtDeleteInternalObj, Object);
208 * Must delete or free any pointers within the object that are not
209 * actual ACPI objects (for example, a raw buffer pointer).
211 switch (Object->Common.Type)
213 case ACPI_TYPE_STRING:
215 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "**** String %p, ptr %p\n",
216 Object, Object->String.Pointer));
218 /* Free the actual string buffer */
220 if (!(Object->Common.Flags & AOPOBJ_STATIC_POINTER))
222 /* But only if it is NOT a pointer into an ACPI table */
224 ObjPointer = Object->String.Pointer;
228 case ACPI_TYPE_BUFFER:
230 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "**** Buffer %p, ptr %p\n",
231 Object, Object->Buffer.Pointer));
233 /* Free the actual buffer */
235 if (!(Object->Common.Flags & AOPOBJ_STATIC_POINTER))
237 /* But only if it is NOT a pointer into an ACPI table */
239 ObjPointer = Object->Buffer.Pointer;
243 case ACPI_TYPE_PACKAGE:
245 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, " **** Package of count %X\n",
246 Object->Package.Count));
249 * Elements of the package are not handled here, they are deleted
253 /* Free the (variable length) element pointer array */
255 ObjPointer = Object->Package.Elements;
259 * These objects have a possible list of notify handlers.
260 * Device object also may have a GPE block.
262 case ACPI_TYPE_DEVICE:
264 if (Object->Device.GpeBlock)
266 (void) AcpiEvDeleteGpeBlock (Object->Device.GpeBlock);
269 /*lint -fallthrough */
271 case ACPI_TYPE_PROCESSOR:
272 case ACPI_TYPE_THERMAL:
274 /* Walk the address handler list for this object */
276 HandlerDesc = Object->CommonNotify.Handler;
279 NextDesc = HandlerDesc->AddressSpace.Next;
280 AcpiUtRemoveReference (HandlerDesc);
281 HandlerDesc = NextDesc;
285 case ACPI_TYPE_MUTEX:
287 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
288 "***** Mutex %p, OS Mutex %p\n",
289 Object, Object->Mutex.OsMutex));
291 if (Object == AcpiGbl_GlobalLockMutex)
293 /* Global Lock has extra semaphore */
295 (void) AcpiOsDeleteSemaphore (AcpiGbl_GlobalLockSemaphore);
296 AcpiGbl_GlobalLockSemaphore = NULL;
298 AcpiOsDeleteMutex (Object->Mutex.OsMutex);
299 AcpiGbl_GlobalLockMutex = NULL;
303 AcpiExUnlinkMutex (Object);
304 AcpiOsDeleteMutex (Object->Mutex.OsMutex);
308 case ACPI_TYPE_EVENT:
310 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
311 "***** Event %p, OS Semaphore %p\n",
312 Object, Object->Event.OsSemaphore));
314 (void) AcpiOsDeleteSemaphore (Object->Event.OsSemaphore);
315 Object->Event.OsSemaphore = NULL;
318 case ACPI_TYPE_METHOD:
320 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
321 "***** Method %p\n", Object));
323 /* Delete the method mutex if it exists */
325 if (Object->Method.Mutex)
327 AcpiOsDeleteMutex (Object->Method.Mutex->Mutex.OsMutex);
328 AcpiUtDeleteObjectDesc (Object->Method.Mutex);
329 Object->Method.Mutex = NULL;
332 if (Object->Method.Node)
334 Object->Method.Node = NULL;
338 case ACPI_TYPE_REGION:
340 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
341 "***** Region %p\n", Object));
344 * Update AddressRange list. However, only permanent regions
345 * are installed in this list. (Not created within a method)
347 if (!(Object->Region.Node->Flags & ANOBJ_TEMPORARY))
349 AcpiUtRemoveAddressRange (Object->Region.SpaceId,
350 Object->Region.Node);
353 SecondDesc = AcpiNsGetSecondaryObject (Object);
357 * Free the RegionContext if and only if the handler is one of the
358 * default handlers -- and therefore, we created the context object
359 * locally, it was not created by an external caller.
361 HandlerDesc = Object->Region.Handler;
364 NextDesc = HandlerDesc->AddressSpace.RegionList;
365 StartDesc = NextDesc;
366 LastObjPtr = &HandlerDesc->AddressSpace.RegionList;
368 /* Remove the region object from the handler list */
372 if (NextDesc == Object)
374 *LastObjPtr = NextDesc->Region.Next;
378 /* Walk the linked list of handlers */
380 LastObjPtr = &NextDesc->Region.Next;
381 NextDesc = NextDesc->Region.Next;
383 /* Prevent infinite loop if list is corrupted */
385 if (NextDesc == StartDesc)
387 ACPI_ERROR ((AE_INFO,
388 "Circular region list in address handler object %p",
394 if (HandlerDesc->AddressSpace.HandlerFlags &
395 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)
397 /* Deactivate region and free region context */
399 if (HandlerDesc->AddressSpace.Setup)
401 (void) HandlerDesc->AddressSpace.Setup (Object,
402 ACPI_REGION_DEACTIVATE,
403 HandlerDesc->AddressSpace.Context,
404 &SecondDesc->Extra.RegionContext);
408 AcpiUtRemoveReference (HandlerDesc);
411 /* Now we can free the Extra object */
413 AcpiUtDeleteObjectDesc (SecondDesc);
415 if (Object->Field.InternalPccBuffer)
417 ACPI_FREE(Object->Field.InternalPccBuffer);
422 case ACPI_TYPE_BUFFER_FIELD:
424 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
425 "***** Buffer Field %p\n", Object));
427 SecondDesc = AcpiNsGetSecondaryObject (Object);
430 AcpiUtDeleteObjectDesc (SecondDesc);
434 case ACPI_TYPE_LOCAL_BANK_FIELD:
436 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
437 "***** Bank Field %p\n", Object));
439 SecondDesc = AcpiNsGetSecondaryObject (Object);
442 AcpiUtDeleteObjectDesc (SecondDesc);
451 /* Free any allocated memory (pointer within the object) found above */
455 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Deleting Object Subptr %p\n",
457 ACPI_FREE (ObjPointer);
460 /* Now the object can be safely deleted */
462 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ALLOCATIONS, "%s: Deleting Object %p [%s]\n",
463 ACPI_GET_FUNCTION_NAME, Object, AcpiUtGetObjectTypeName (Object)));
465 AcpiUtDeleteObjectDesc (Object);
470 /*******************************************************************************
472 * FUNCTION: AcpiUtDeleteInternalObjectList
474 * PARAMETERS: ObjList - Pointer to the list to be deleted
478 * DESCRIPTION: This function deletes an internal object list, including both
479 * simple objects and package objects
481 ******************************************************************************/
484 AcpiUtDeleteInternalObjectList (
485 ACPI_OPERAND_OBJECT **ObjList)
487 ACPI_OPERAND_OBJECT **InternalObj;
490 ACPI_FUNCTION_ENTRY ();
493 /* Walk the null-terminated internal list */
495 for (InternalObj = ObjList; *InternalObj; InternalObj++)
497 AcpiUtRemoveReference (*InternalObj);
500 /* Free the combined parameter pointer list and object array */
507 /*******************************************************************************
509 * FUNCTION: AcpiUtUpdateRefCount
511 * PARAMETERS: Object - Object whose ref count is to be updated
512 * Action - What to do (REF_INCREMENT or REF_DECREMENT)
514 * RETURN: None. Sets new reference count within the object
516 * DESCRIPTION: Modify the reference count for an internal acpi object
518 ******************************************************************************/
521 AcpiUtUpdateRefCount (
522 ACPI_OPERAND_OBJECT *Object,
525 UINT16 OriginalCount;
527 ACPI_CPU_FLAGS LockFlags;
531 ACPI_FUNCTION_NAME (UtUpdateRefCount);
540 * Always get the reference count lock. Note: Interpreter and/or
541 * Namespace is not always locked when this function is called.
543 LockFlags = AcpiOsAcquireLock (AcpiGbl_ReferenceCountLock);
544 OriginalCount = Object->Common.ReferenceCount;
546 /* Perform the reference count action (increment, decrement) */
552 NewCount = OriginalCount + 1;
553 Object->Common.ReferenceCount = NewCount;
554 AcpiOsReleaseLock (AcpiGbl_ReferenceCountLock, LockFlags);
556 /* The current reference count should never be zero here */
560 ACPI_WARNING ((AE_INFO,
561 "Obj %p, Reference Count was zero before increment\n",
565 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
566 "Obj %p Type %.2X [%s] Refs %.2X [Incremented]\n",
567 Object, Object->Common.Type,
568 AcpiUtGetObjectTypeName (Object), NewCount));
569 Message = "Incremement";
574 /* The current reference count must be non-zero */
578 NewCount = OriginalCount - 1;
579 Object->Common.ReferenceCount = NewCount;
582 AcpiOsReleaseLock (AcpiGbl_ReferenceCountLock, LockFlags);
586 ACPI_WARNING ((AE_INFO,
587 "Obj %p, Reference Count is already zero, cannot decrement\n",
591 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ALLOCATIONS,
592 "%s: Obj %p Type %.2X Refs %.2X [Decremented]\n",
593 ACPI_GET_FUNCTION_NAME, Object, Object->Common.Type, NewCount));
595 /* Actually delete the object on a reference count of zero */
599 AcpiUtDeleteInternalObj (Object);
601 Message = "Decrement";
606 AcpiOsReleaseLock (AcpiGbl_ReferenceCountLock, LockFlags);
607 ACPI_ERROR ((AE_INFO, "Unknown Reference Count action (0x%X)",
613 * Sanity check the reference count, for debug purposes only.
614 * (A deleted object will have a huge reference count)
616 if (NewCount > ACPI_MAX_REFERENCE_COUNT)
618 ACPI_WARNING ((AE_INFO,
619 "Large Reference Count (0x%X) in object %p, Type=0x%.2X Operation=%s",
620 NewCount, Object, Object->Common.Type, Message));
625 /*******************************************************************************
627 * FUNCTION: AcpiUtUpdateObjectReference
629 * PARAMETERS: Object - Increment or decrement the ref count for
630 * this object and all sub-objects
631 * Action - Either REF_INCREMENT or REF_DECREMENT
635 * DESCRIPTION: Increment or decrement the object reference count
637 * Object references are incremented when:
638 * 1) An object is attached to a Node (namespace object)
639 * 2) An object is copied (all subobjects must be incremented)
641 * Object references are decremented when:
642 * 1) An object is detached from an Node
644 ******************************************************************************/
647 AcpiUtUpdateObjectReference (
648 ACPI_OPERAND_OBJECT *Object,
651 ACPI_STATUS Status = AE_OK;
652 ACPI_GENERIC_STATE *StateList = NULL;
653 ACPI_OPERAND_OBJECT *NextObject = NULL;
654 ACPI_OPERAND_OBJECT *PrevObject;
655 ACPI_GENERIC_STATE *State;
659 ACPI_FUNCTION_NAME (UtUpdateObjectReference);
664 /* Make sure that this isn't a namespace handle */
666 if (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED)
668 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
669 "Object %p is NS handle\n", Object));
674 * All sub-objects must have their reference count updated
675 * also. Different object types have different subobjects.
677 switch (Object->Common.Type)
679 case ACPI_TYPE_DEVICE:
680 case ACPI_TYPE_PROCESSOR:
681 case ACPI_TYPE_POWER:
682 case ACPI_TYPE_THERMAL:
684 * Update the notify objects for these types (if present)
685 * Two lists, system and device notify handlers.
687 for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++)
689 PrevObject = Object->CommonNotify.NotifyList[i];
692 NextObject = PrevObject->Notify.Next[i];
693 AcpiUtUpdateRefCount (PrevObject, Action);
694 PrevObject = NextObject;
699 case ACPI_TYPE_PACKAGE:
701 * We must update all the sub-objects of the package,
702 * each of whom may have their own sub-objects.
704 for (i = 0; i < Object->Package.Count; i++)
707 * Null package elements are legal and can be simply
710 NextObject = Object->Package.Elements[i];
716 switch (NextObject->Common.Type)
718 case ACPI_TYPE_INTEGER:
719 case ACPI_TYPE_STRING:
720 case ACPI_TYPE_BUFFER:
722 * For these very simple sub-objects, we can just
723 * update the reference count here and continue.
724 * Greatly increases performance of this operation.
726 AcpiUtUpdateRefCount (NextObject, Action);
731 * For complex sub-objects, push them onto the stack
732 * for later processing (this eliminates recursion.)
734 Status = AcpiUtCreateUpdateStateAndPush (
735 NextObject, Action, &StateList);
736 if (ACPI_FAILURE (Status))
747 case ACPI_TYPE_BUFFER_FIELD:
749 NextObject = Object->BufferField.BufferObj;
752 case ACPI_TYPE_LOCAL_BANK_FIELD:
754 NextObject = Object->BankField.BankObj;
755 Status = AcpiUtCreateUpdateStateAndPush (
756 Object->BankField.RegionObj, Action, &StateList);
757 if (ACPI_FAILURE (Status))
763 case ACPI_TYPE_LOCAL_INDEX_FIELD:
765 NextObject = Object->IndexField.IndexObj;
766 Status = AcpiUtCreateUpdateStateAndPush (
767 Object->IndexField.DataObj, Action, &StateList);
768 if (ACPI_FAILURE (Status))
774 case ACPI_TYPE_LOCAL_REFERENCE:
776 * The target of an Index (a package, string, or buffer) or a named
777 * reference must track changes to the ref count of the index or
780 if ((Object->Reference.Class == ACPI_REFCLASS_INDEX) ||
781 (Object->Reference.Class== ACPI_REFCLASS_NAME))
783 NextObject = Object->Reference.Object;
787 case ACPI_TYPE_LOCAL_REGION_FIELD:
788 case ACPI_TYPE_REGION:
791 break; /* No subobjects for all other types */
795 * Now we can update the count in the main object. This can only
796 * happen after we update the sub-objects in case this causes the
797 * main object to be deleted.
799 AcpiUtUpdateRefCount (Object, Action);
802 /* Move on to the next object to be updated */
811 State = AcpiUtPopGenericState (&StateList);
812 Object = State->Update.Object;
813 AcpiUtDeleteGenericState (State);
822 ACPI_EXCEPTION ((AE_INFO, Status,
823 "Could not update object reference count"));
825 /* Free any stacked Update State objects */
829 State = AcpiUtPopGenericState (&StateList);
830 AcpiUtDeleteGenericState (State);
837 /*******************************************************************************
839 * FUNCTION: AcpiUtAddReference
841 * PARAMETERS: Object - Object whose reference count is to be
846 * DESCRIPTION: Add one reference to an ACPI object
848 ******************************************************************************/
852 ACPI_OPERAND_OBJECT *Object)
855 ACPI_FUNCTION_NAME (UtAddReference);
858 /* Ensure that we have a valid object */
860 if (!AcpiUtValidInternalObject (Object))
865 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
866 "Obj %p Current Refs=%X [To Be Incremented]\n",
867 Object, Object->Common.ReferenceCount));
869 /* Increment the reference count */
871 (void) AcpiUtUpdateObjectReference (Object, REF_INCREMENT);
876 /*******************************************************************************
878 * FUNCTION: AcpiUtRemoveReference
880 * PARAMETERS: Object - Object whose ref count will be decremented
884 * DESCRIPTION: Decrement the reference count of an ACPI internal object
886 ******************************************************************************/
889 AcpiUtRemoveReference (
890 ACPI_OPERAND_OBJECT *Object)
893 ACPI_FUNCTION_NAME (UtRemoveReference);
897 * Allow a NULL pointer to be passed in, just ignore it. This saves
898 * each caller from having to check. Also, ignore NS nodes.
901 (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED))
907 /* Ensure that we have a valid object */
909 if (!AcpiUtValidInternalObject (Object))
914 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ALLOCATIONS,
915 "%s: Obj %p Current Refs=%X [To Be Decremented]\n",
916 ACPI_GET_FUNCTION_NAME, Object, Object->Common.ReferenceCount));
919 * Decrement the reference count, and only actually delete the object
920 * if the reference count becomes 0. (Must also decrement the ref count
921 * of all subobjects!)
923 (void) AcpiUtUpdateObjectReference (Object, REF_DECREMENT);