xref: /titanic_51/usr/src/uts/intel/io/acpica/utilities/utdelete.c (revision 53a7b6b6763f5865522a76e5e887390a8f4777d7)
1 /*******************************************************************************
2  *
3  * Module Name: utdelete - object deletion and reference count utilities
4  *              $Revision: 1.126 $
5  *
6  ******************************************************************************/
7 
8 /******************************************************************************
9  *
10  * 1. Copyright Notice
11  *
12  * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
13  * All rights reserved.
14  *
15  * 2. License
16  *
17  * 2.1. This is your license from Intel Corp. under its intellectual property
18  * rights.  You may have additional license terms from the party that provided
19  * you this software, covering your right to use that party's intellectual
20  * property rights.
21  *
22  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23  * copy of the source code appearing in this file ("Covered Code") an
24  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25  * base code distributed originally by Intel ("Original Intel Code") to copy,
26  * make derivatives, distribute, use and display any portion of the Covered
27  * Code in any form, with the right to sublicense such rights; and
28  *
29  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30  * license (with the right to sublicense), under only those claims of Intel
31  * patents that are infringed by the Original Intel Code, to make, use, sell,
32  * offer to sell, and import the Covered Code and derivative works thereof
33  * solely to the minimum extent necessary to exercise the above copyright
34  * license, and in no event shall the patent license extend to any additions
35  * to or modifications of the Original Intel Code.  No other license or right
36  * is granted directly or by implication, estoppel or otherwise;
37  *
38  * The above copyright and patent license is granted only if the following
39  * conditions are met:
40  *
41  * 3. Conditions
42  *
43  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44  * Redistribution of source code of any substantial portion of the Covered
45  * Code or modification with rights to further distribute source must include
46  * the above Copyright Notice, the above License, this list of Conditions,
47  * and the following Disclaimer and Export Compliance provision.  In addition,
48  * Licensee must cause all Covered Code to which Licensee contributes to
49  * contain a file documenting the changes Licensee made to create that Covered
50  * Code and the date of any change.  Licensee must include in that file the
51  * documentation of any changes made by any predecessor Licensee.  Licensee
52  * must include a prominent statement that the modification is derived,
53  * directly or indirectly, from Original Intel Code.
54  *
55  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56  * Redistribution of source code of any substantial portion of the Covered
57  * Code or modification without rights to further distribute source must
58  * include the following Disclaimer and Export Compliance provision in the
59  * documentation and/or other materials provided with distribution.  In
60  * addition, Licensee may not authorize further sublicense of source of any
61  * portion of the Covered Code, and must include terms to the effect that the
62  * license from Licensee to its licensee is limited to the intellectual
63  * property embodied in the software Licensee provides to its licensee, and
64  * not to intellectual property embodied in modifications its licensee may
65  * make.
66  *
67  * 3.3. Redistribution of Executable. Redistribution in executable form of any
68  * substantial portion of the Covered Code or modification must reproduce the
69  * above Copyright Notice, and the following Disclaimer and Export Compliance
70  * provision in the documentation and/or other materials provided with the
71  * distribution.
72  *
73  * 3.4. Intel retains all right, title, and interest in and to the Original
74  * Intel Code.
75  *
76  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77  * Intel shall be used in advertising or otherwise to promote the sale, use or
78  * other dealings in products derived from or relating to the Covered Code
79  * without prior written authorization from Intel.
80  *
81  * 4. Disclaimer and Export Compliance
82  *
83  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
86  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
87  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
88  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89  * PARTICULAR PURPOSE.
90  *
91  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
97  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98  * LIMITED REMEDY.
99  *
100  * 4.3. Licensee shall not export, either directly or indirectly, any of this
101  * software or system incorporating such software without first obtaining any
102  * required license or other approval from the U. S. Department of Commerce or
103  * any other agency or department of the United States Government.  In the
104  * event Licensee exports any such software from the United States or
105  * re-exports any such software from a foreign destination, Licensee shall
106  * ensure that the distribution and export/re-export of the software is in
107  * compliance with all laws, regulations, orders, or other restrictions of the
108  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109  * any of its subsidiaries will export/re-export any technical data, process,
110  * software, or service, directly or indirectly, to any country for which the
111  * United States government or any agency thereof requires an export license,
112  * other governmental approval, or letter of assurance, without first obtaining
113  * such license, approval or letter.
114  *
115  *****************************************************************************/
116 
117 #define __UTDELETE_C__
118 
119 #include "acpi.h"
120 #include "acinterp.h"
121 #include "acnamesp.h"
122 #include "acevents.h"
123 
124 
125 #define _COMPONENT          ACPI_UTILITIES
126         ACPI_MODULE_NAME    ("utdelete")
127 
128 /* Local prototypes */
129 
130 static void
131 AcpiUtDeleteInternalObj (
132     ACPI_OPERAND_OBJECT     *Object);
133 
134 static void
135 AcpiUtUpdateRefCount (
136     ACPI_OPERAND_OBJECT     *Object,
137     UINT32                  Action);
138 
139 
140 /*******************************************************************************
141  *
142  * FUNCTION:    AcpiUtDeleteInternalObj
143  *
144  * PARAMETERS:  Object         - Object to be deleted
145  *
146  * RETURN:      None
147  *
148  * DESCRIPTION: Low level object deletion, after reference counts have been
149  *              updated (All reference counts, including sub-objects!)
150  *
151  ******************************************************************************/
152 
153 static void
154 AcpiUtDeleteInternalObj (
155     ACPI_OPERAND_OBJECT     *Object)
156 {
157     void                    *ObjPointer = NULL;
158     ACPI_OPERAND_OBJECT     *HandlerDesc;
159     ACPI_OPERAND_OBJECT     *SecondDesc;
160     ACPI_OPERAND_OBJECT     *NextDesc;
161 
162 
163     ACPI_FUNCTION_TRACE_PTR (UtDeleteInternalObj, Object);
164 
165 
166     if (!Object)
167     {
168         return_VOID;
169     }
170 
171     /*
172      * Must delete or free any pointers within the object that are not
173      * actual ACPI objects (for example, a raw buffer pointer).
174      */
175     switch (ACPI_GET_OBJECT_TYPE (Object))
176     {
177     case ACPI_TYPE_STRING:
178 
179         ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "**** String %p, ptr %p\n",
180             Object, Object->String.Pointer));
181 
182         /* Free the actual string buffer */
183 
184         if (!(Object->Common.Flags & AOPOBJ_STATIC_POINTER))
185         {
186             /* But only if it is NOT a pointer into an ACPI table */
187 
188             ObjPointer = Object->String.Pointer;
189         }
190         break;
191 
192 
193     case ACPI_TYPE_BUFFER:
194 
195         ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "**** Buffer %p, ptr %p\n",
196             Object, Object->Buffer.Pointer));
197 
198         /* Free the actual buffer */
199 
200         if (!(Object->Common.Flags & AOPOBJ_STATIC_POINTER))
201         {
202             /* But only if it is NOT a pointer into an ACPI table */
203 
204             ObjPointer = Object->Buffer.Pointer;
205         }
206         break;
207 
208 
209     case ACPI_TYPE_PACKAGE:
210 
211         ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, " **** Package of count %X\n",
212             Object->Package.Count));
213 
214         /*
215          * Elements of the package are not handled here, they are deleted
216          * separately
217          */
218 
219         /* Free the (variable length) element pointer array */
220 
221         ObjPointer = Object->Package.Elements;
222         break;
223 
224 
225     /*
226      * These objects have a possible list of notify handlers.
227      * Device object also may have a GPE block.
228      */
229     case ACPI_TYPE_DEVICE:
230 
231         if (Object->Device.GpeBlock)
232         {
233             (void) AcpiEvDeleteGpeBlock (Object->Device.GpeBlock);
234         }
235 
236         /*lint -fallthrough */
237 
238     case ACPI_TYPE_PROCESSOR:
239     case ACPI_TYPE_THERMAL:
240 
241         /* Walk the notify handler list for this object */
242 
243         HandlerDesc = Object->CommonNotify.Handler;
244         while (HandlerDesc)
245         {
246             NextDesc = HandlerDesc->AddressSpace.Next;
247             AcpiUtRemoveReference (HandlerDesc);
248             HandlerDesc = NextDesc;
249         }
250         break;
251 
252 
253     case ACPI_TYPE_MUTEX:
254 
255         ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
256             "***** Mutex %p, OS Mutex %p\n",
257             Object, Object->Mutex.OsMutex));
258 
259         if (Object == AcpiGbl_GlobalLockMutex)
260         {
261             /* Global Lock has extra semaphore */
262 
263             (void) AcpiOsDeleteSemaphore (AcpiGbl_GlobalLockSemaphore);
264             AcpiGbl_GlobalLockSemaphore = NULL;
265 
266             AcpiOsDeleteMutex (Object->Mutex.OsMutex);
267             AcpiGbl_GlobalLockMutex = NULL;
268         }
269         else
270         {
271             AcpiExUnlinkMutex (Object);
272             AcpiOsDeleteMutex (Object->Mutex.OsMutex);
273         }
274         break;
275 
276 
277     case ACPI_TYPE_EVENT:
278 
279         ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
280             "***** Event %p, OS Semaphore %p\n",
281             Object, Object->Event.OsSemaphore));
282 
283         (void) AcpiOsDeleteSemaphore (Object->Event.OsSemaphore);
284         Object->Event.OsSemaphore = NULL;
285         break;
286 
287 
288     case ACPI_TYPE_METHOD:
289 
290         ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
291             "***** Method %p\n", Object));
292 
293         /* Delete the method mutex if it exists */
294 
295         if (Object->Method.Mutex)
296         {
297             AcpiOsDeleteMutex (Object->Method.Mutex->Mutex.OsMutex);
298             AcpiUtDeleteObjectDesc (Object->Method.Mutex);
299             Object->Method.Mutex = NULL;
300         }
301         break;
302 
303 
304     case ACPI_TYPE_REGION:
305 
306         ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
307             "***** Region %p\n", Object));
308 
309         SecondDesc = AcpiNsGetSecondaryObject (Object);
310         if (SecondDesc)
311         {
312             /*
313              * Free the RegionContext if and only if the handler is one of the
314              * default handlers -- and therefore, we created the context object
315              * locally, it was not created by an external caller.
316              */
317             HandlerDesc = Object->Region.Handler;
318             if (HandlerDesc)
319             {
320                 if (HandlerDesc->AddressSpace.HandlerFlags &
321                     ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)
322                 {
323                     /* Deactivate region and free region context */
324 
325                     if (HandlerDesc->AddressSpace.Setup)
326                     {
327                         (void) HandlerDesc->AddressSpace.Setup (Object,
328                             ACPI_REGION_DEACTIVATE,
329                             HandlerDesc->AddressSpace.Context,
330                             &SecondDesc->Extra.RegionContext);
331                     }
332                 }
333 
334                 AcpiUtRemoveReference (HandlerDesc);
335             }
336 
337             /* Now we can free the Extra object */
338 
339             AcpiUtDeleteObjectDesc (SecondDesc);
340         }
341         break;
342 
343 
344     case ACPI_TYPE_BUFFER_FIELD:
345 
346         ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
347             "***** Buffer Field %p\n", Object));
348 
349         SecondDesc = AcpiNsGetSecondaryObject (Object);
350         if (SecondDesc)
351         {
352             AcpiUtDeleteObjectDesc (SecondDesc);
353         }
354         break;
355 
356 
357     case ACPI_TYPE_LOCAL_BANK_FIELD:
358 
359         ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
360             "***** Bank Field %p\n", Object));
361 
362         SecondDesc = AcpiNsGetSecondaryObject (Object);
363         if (SecondDesc)
364         {
365             AcpiUtDeleteObjectDesc (SecondDesc);
366         }
367         break;
368 
369 
370     default:
371         break;
372     }
373 
374     /* Free any allocated memory (pointer within the object) found above */
375 
376     if (ObjPointer)
377     {
378         ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Deleting Object Subptr %p\n",
379             ObjPointer));
380         ACPI_FREE (ObjPointer);
381     }
382 
383     /* Now the object can be safely deleted */
384 
385     ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Deleting Object %p [%s]\n",
386         Object, AcpiUtGetObjectTypeName (Object)));
387 
388     AcpiUtDeleteObjectDesc (Object);
389     return_VOID;
390 }
391 
392 
393 /*******************************************************************************
394  *
395  * FUNCTION:    AcpiUtDeleteInternalObjectList
396  *
397  * PARAMETERS:  ObjList         - Pointer to the list to be deleted
398  *
399  * RETURN:      None
400  *
401  * DESCRIPTION: This function deletes an internal object list, including both
402  *              simple objects and package objects
403  *
404  ******************************************************************************/
405 
406 void
407 AcpiUtDeleteInternalObjectList (
408     ACPI_OPERAND_OBJECT     **ObjList)
409 {
410     ACPI_OPERAND_OBJECT     **InternalObj;
411 
412 
413     ACPI_FUNCTION_TRACE (UtDeleteInternalObjectList);
414 
415 
416     /* Walk the null-terminated internal list */
417 
418     for (InternalObj = ObjList; *InternalObj; InternalObj++)
419     {
420         AcpiUtRemoveReference (*InternalObj);
421     }
422 
423     /* Free the combined parameter pointer list and object array */
424 
425     ACPI_FREE (ObjList);
426     return_VOID;
427 }
428 
429 
430 /*******************************************************************************
431  *
432  * FUNCTION:    AcpiUtUpdateRefCount
433  *
434  * PARAMETERS:  Object          - Object whose ref count is to be updated
435  *              Action          - What to do
436  *
437  * RETURN:      New ref count
438  *
439  * DESCRIPTION: Modify the ref count and return it.
440  *
441  ******************************************************************************/
442 
443 static void
444 AcpiUtUpdateRefCount (
445     ACPI_OPERAND_OBJECT     *Object,
446     UINT32                  Action)
447 {
448     UINT16                  Count;
449     UINT16                  NewCount;
450 
451 
452     ACPI_FUNCTION_NAME (UtUpdateRefCount);
453 
454 
455     if (!Object)
456     {
457         return;
458     }
459 
460     Count = Object->Common.ReferenceCount;
461     NewCount = Count;
462 
463     /*
464      * Perform the reference count action (increment, decrement, force delete)
465      */
466     switch (Action)
467     {
468     case REF_INCREMENT:
469 
470         NewCount++;
471         Object->Common.ReferenceCount = NewCount;
472 
473         ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
474             "Obj %p Refs=%X, [Incremented]\n",
475             Object, NewCount));
476         break;
477 
478     case REF_DECREMENT:
479 
480         if (Count < 1)
481         {
482             ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
483                 "Obj %p Refs=%X, can't decrement! (Set to 0)\n",
484                 Object, NewCount));
485 
486             NewCount = 0;
487         }
488         else
489         {
490             NewCount--;
491 
492             ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
493                 "Obj %p Refs=%X, [Decremented]\n",
494                 Object, NewCount));
495         }
496 
497         if (ACPI_GET_OBJECT_TYPE (Object) == ACPI_TYPE_METHOD)
498         {
499             ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
500                 "Method Obj %p Refs=%X, [Decremented]\n", Object, NewCount));
501         }
502 
503         Object->Common.ReferenceCount = NewCount;
504         if (NewCount == 0)
505         {
506             AcpiUtDeleteInternalObj (Object);
507         }
508         break;
509 
510     case REF_FORCE_DELETE:
511 
512         ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
513             "Obj %p Refs=%X, Force delete! (Set to 0)\n", Object, Count));
514 
515         NewCount = 0;
516         Object->Common.ReferenceCount = NewCount;
517         AcpiUtDeleteInternalObj (Object);
518         break;
519 
520     default:
521 
522         ACPI_ERROR ((AE_INFO, "Unknown action (%X)", Action));
523         break;
524     }
525 
526     /*
527      * Sanity check the reference count, for debug purposes only.
528      * (A deleted object will have a huge reference count)
529      */
530     if (Count > ACPI_MAX_REFERENCE_COUNT)
531     {
532         ACPI_WARNING ((AE_INFO,
533             "Large Reference Count (%X) in object %p", Count, Object));
534     }
535 }
536 
537 
538 /*******************************************************************************
539  *
540  * FUNCTION:    AcpiUtUpdateObjectReference
541  *
542  * PARAMETERS:  Object              - Increment ref count for this object
543  *                                    and all sub-objects
544  *              Action              - Either REF_INCREMENT or REF_DECREMENT or
545  *                                    REF_FORCE_DELETE
546  *
547  * RETURN:      Status
548  *
549  * DESCRIPTION: Increment the object reference count
550  *
551  * Object references are incremented when:
552  * 1) An object is attached to a Node (namespace object)
553  * 2) An object is copied (all subobjects must be incremented)
554  *
555  * Object references are decremented when:
556  * 1) An object is detached from an Node
557  *
558  ******************************************************************************/
559 
560 ACPI_STATUS
561 AcpiUtUpdateObjectReference (
562     ACPI_OPERAND_OBJECT     *Object,
563     UINT16                  Action)
564 {
565     ACPI_STATUS             Status = AE_OK;
566     ACPI_GENERIC_STATE      *StateList = NULL;
567     ACPI_OPERAND_OBJECT     *NextObject = NULL;
568     ACPI_GENERIC_STATE      *State;
569     UINT32                  i;
570 
571 
572     ACPI_FUNCTION_TRACE_PTR (UtUpdateObjectReference, Object);
573 
574 
575     while (Object)
576     {
577         /* Make sure that this isn't a namespace handle */
578 
579         if (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED)
580         {
581             ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
582                 "Object %p is NS handle\n", Object));
583             return_ACPI_STATUS (AE_OK);
584         }
585 
586         /*
587          * All sub-objects must have their reference count incremented also.
588          * Different object types have different subobjects.
589          */
590         switch (ACPI_GET_OBJECT_TYPE (Object))
591         {
592         case ACPI_TYPE_DEVICE:
593         case ACPI_TYPE_PROCESSOR:
594         case ACPI_TYPE_POWER:
595         case ACPI_TYPE_THERMAL:
596 
597             /* Update the notify objects for these types (if present) */
598 
599             AcpiUtUpdateRefCount (Object->CommonNotify.SystemNotify, Action);
600             AcpiUtUpdateRefCount (Object->CommonNotify.DeviceNotify, Action);
601             break;
602 
603         case ACPI_TYPE_PACKAGE:
604             /*
605              * We must update all the sub-objects of the package,
606              * each of whom may have their own sub-objects.
607              */
608             for (i = 0; i < Object->Package.Count; i++)
609             {
610                 /*
611                  * Push each element onto the stack for later processing.
612                  * Note: There can be null elements within the package,
613                  * these are simply ignored
614                  */
615                 Status = AcpiUtCreateUpdateStateAndPush (
616                             Object->Package.Elements[i], Action, &StateList);
617                 if (ACPI_FAILURE (Status))
618                 {
619                     goto ErrorExit;
620                 }
621             }
622             break;
623 
624         case ACPI_TYPE_BUFFER_FIELD:
625 
626             NextObject = Object->BufferField.BufferObj;
627             break;
628 
629         case ACPI_TYPE_LOCAL_REGION_FIELD:
630 
631             NextObject = Object->Field.RegionObj;
632             break;
633 
634         case ACPI_TYPE_LOCAL_BANK_FIELD:
635 
636             NextObject = Object->BankField.BankObj;
637             Status = AcpiUtCreateUpdateStateAndPush (
638                         Object->BankField.RegionObj, Action, &StateList);
639             if (ACPI_FAILURE (Status))
640             {
641                 goto ErrorExit;
642             }
643             break;
644 
645         case ACPI_TYPE_LOCAL_INDEX_FIELD:
646 
647             NextObject = Object->IndexField.IndexObj;
648             Status = AcpiUtCreateUpdateStateAndPush (
649                         Object->IndexField.DataObj, Action, &StateList);
650             if (ACPI_FAILURE (Status))
651             {
652                 goto ErrorExit;
653             }
654             break;
655 
656         case ACPI_TYPE_LOCAL_REFERENCE:
657             /*
658              * The target of an Index (a package, string, or buffer) or a named
659              * reference must track changes to the ref count of the index or
660              * target object.
661              */
662             if ((Object->Reference.Class == ACPI_REFCLASS_INDEX) ||
663                 (Object->Reference.Class== ACPI_REFCLASS_NAME))
664             {
665                 NextObject = Object->Reference.Object;
666             }
667             break;
668 
669         case ACPI_TYPE_REGION:
670         default:
671             break; /* No subobjects for all other types */
672         }
673 
674         /*
675          * Now we can update the count in the main object. This can only
676          * happen after we update the sub-objects in case this causes the
677          * main object to be deleted.
678          */
679         AcpiUtUpdateRefCount (Object, Action);
680         Object = NULL;
681 
682         /* Move on to the next object to be updated */
683 
684         if (NextObject)
685         {
686             Object = NextObject;
687             NextObject = NULL;
688         }
689         else if (StateList)
690         {
691             State = AcpiUtPopGenericState (&StateList);
692             Object = State->Update.Object;
693             AcpiUtDeleteGenericState (State);
694         }
695     }
696 
697     return_ACPI_STATUS (AE_OK);
698 
699 ErrorExit:
700 
701     ACPI_EXCEPTION ((AE_INFO, Status,
702         "Could not update object reference count"));
703 
704     return_ACPI_STATUS (Status);
705 }
706 
707 
708 /*******************************************************************************
709  *
710  * FUNCTION:    AcpiUtAddReference
711  *
712  * PARAMETERS:  Object          - Object whose reference count is to be
713  *                                incremented
714  *
715  * RETURN:      None
716  *
717  * DESCRIPTION: Add one reference to an ACPI object
718  *
719  ******************************************************************************/
720 
721 void
722 AcpiUtAddReference (
723     ACPI_OPERAND_OBJECT     *Object)
724 {
725 
726     ACPI_FUNCTION_TRACE_PTR (UtAddReference, Object);
727 
728 
729     /* Ensure that we have a valid object */
730 
731     if (!AcpiUtValidInternalObject (Object))
732     {
733         return_VOID;
734     }
735 
736     ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
737         "Obj %p Current Refs=%X [To Be Incremented]\n",
738         Object, Object->Common.ReferenceCount));
739 
740     /* Increment the reference count */
741 
742     (void) AcpiUtUpdateObjectReference (Object, REF_INCREMENT);
743     return_VOID;
744 }
745 
746 
747 /*******************************************************************************
748  *
749  * FUNCTION:    AcpiUtRemoveReference
750  *
751  * PARAMETERS:  Object         - Object whose ref count will be decremented
752  *
753  * RETURN:      None
754  *
755  * DESCRIPTION: Decrement the reference count of an ACPI internal object
756  *
757  ******************************************************************************/
758 
759 void
760 AcpiUtRemoveReference (
761     ACPI_OPERAND_OBJECT     *Object)
762 {
763 
764     ACPI_FUNCTION_TRACE_PTR (UtRemoveReference, Object);
765 
766 
767     /*
768      * Allow a NULL pointer to be passed in, just ignore it. This saves
769      * each caller from having to check. Also, ignore NS nodes.
770      *
771      */
772     if (!Object ||
773         (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED))
774 
775     {
776         return_VOID;
777     }
778 
779     /* Ensure that we have a valid object */
780 
781     if (!AcpiUtValidInternalObject (Object))
782     {
783         return_VOID;
784     }
785 
786     ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
787         "Obj %p Current Refs=%X [To Be Decremented]\n",
788         Object, Object->Common.ReferenceCount));
789 
790     /*
791      * Decrement the reference count, and only actually delete the object
792      * if the reference count becomes 0. (Must also decrement the ref count
793      * of all subobjects!)
794      */
795     (void) AcpiUtUpdateObjectReference (Object, REF_DECREMENT);
796     return_VOID;
797 }
798 
799 
800