Merge from vendor branch LIBSTDC++:
[dragonfly.git] / sys / contrib / dev / acpica / utdelete.c
1 /*******************************************************************************
2  *
3  * Module Name: utdelete - object deletion and reference count utilities
4  *              $Revision: 95 $
5  *
6  ******************************************************************************/
7
8 /******************************************************************************
9  *
10  * 1. Copyright Notice
11  *
12  * Some or all of this work - Copyright (c) 1999 - 2003, 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 /* $DragonFly: src/sys/contrib/dev/acpica/Attic/utdelete.c,v 1.1 2003/09/24 03:32:16 drhodus Exp $                                                               */
117
118 #define __UTDELETE_C__
119
120 #include "acpi.h"
121 #include "acinterp.h"
122 #include "acnamesp.h"
123
124 #define _COMPONENT          ACPI_UTILITIES
125         ACPI_MODULE_NAME    ("utdelete")
126
127
128 /*******************************************************************************
129  *
130  * FUNCTION:    AcpiUtDeleteInternalObj
131  *
132  * PARAMETERS:  *Object        - Pointer to the list to be deleted
133  *
134  * RETURN:      None
135  *
136  * DESCRIPTION: Low level object deletion, after reference counts have been
137  *              updated (All reference counts, including sub-objects!)
138  *
139  ******************************************************************************/
140
141 void
142 AcpiUtDeleteInternalObj (
143     ACPI_OPERAND_OBJECT     *Object)
144 {
145     void                    *ObjPointer = NULL;
146     ACPI_OPERAND_OBJECT     *HandlerDesc;
147     ACPI_OPERAND_OBJECT     *SecondDesc;
148
149
150     ACPI_FUNCTION_TRACE_PTR ("UtDeleteInternalObj", Object);
151
152
153     if (!Object)
154     {
155         return_VOID;
156     }
157
158     /*
159      * Must delete or free any pointers within the object that are not
160      * actual ACPI objects (for example, a raw buffer pointer).
161      */
162     switch (ACPI_GET_OBJECT_TYPE (Object))
163     {
164     case ACPI_TYPE_STRING:
165
166         ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "**** String %p, ptr %p\n",
167             Object, Object->String.Pointer));
168
169         /* Free the actual string buffer */
170
171         if (!(Object->Common.Flags & AOPOBJ_STATIC_POINTER))
172         {
173             /* But only if it is NOT a pointer into an ACPI table */
174
175             ObjPointer = Object->String.Pointer;
176         }
177         break;
178
179
180     case ACPI_TYPE_BUFFER:
181
182         ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "**** Buffer %p, ptr %p\n",
183             Object, Object->Buffer.Pointer));
184
185         /* Free the actual buffer */
186
187         if (!(Object->Common.Flags & AOPOBJ_STATIC_POINTER))
188         {
189             /* But only if it is NOT a pointer into an ACPI table */
190
191             ObjPointer = Object->Buffer.Pointer;
192         }
193         break;
194
195
196     case ACPI_TYPE_PACKAGE:
197
198         ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, " **** Package of count %X\n",
199             Object->Package.Count));
200
201         /*
202          * Elements of the package are not handled here, they are deleted
203          * separately
204          */
205
206         /* Free the (variable length) element pointer array */
207
208         ObjPointer = Object->Package.Elements;
209         break;
210
211
212     case ACPI_TYPE_MUTEX:
213
214         ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Mutex %p, Semaphore %p\n",
215             Object, Object->Mutex.Semaphore));
216
217         AcpiExUnlinkMutex (Object);
218         (void) AcpiOsDeleteSemaphore (Object->Mutex.Semaphore);
219         break;
220
221
222     case ACPI_TYPE_EVENT:
223
224         ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Event %p, Semaphore %p\n",
225             Object, Object->Event.Semaphore));
226
227         (void) AcpiOsDeleteSemaphore (Object->Event.Semaphore);
228         Object->Event.Semaphore = NULL;
229         break;
230
231
232     case ACPI_TYPE_METHOD:
233
234         ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Method %p\n", Object));
235
236         /* Delete the method semaphore if it exists */
237
238         if (Object->Method.Semaphore)
239         {
240             (void) AcpiOsDeleteSemaphore (Object->Method.Semaphore);
241             Object->Method.Semaphore = NULL;
242         }
243         break;
244
245
246     case ACPI_TYPE_REGION:
247
248         ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Region %p\n", Object));
249
250         SecondDesc = AcpiNsGetSecondaryObject (Object);
251         if (SecondDesc)
252         {
253             /*
254              * Free the RegionContext if and only if the handler is one of the
255              * default handlers -- and therefore, we created the context object
256              * locally, it was not created by an external caller.
257              */
258             HandlerDesc = Object->Region.AddrHandler;
259             if ((HandlerDesc) &&
260                 (HandlerDesc->AddrHandler.Hflags == ACPI_ADDR_HANDLER_DEFAULT_INSTALLED))
261             {
262                 ObjPointer = SecondDesc->Extra.RegionContext;
263             }
264
265             /* Now we can free the Extra object */
266
267             AcpiUtDeleteObjectDesc (SecondDesc);
268         }
269         break;
270
271
272     case ACPI_TYPE_BUFFER_FIELD:
273
274         ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Buffer Field %p\n", Object));
275
276         SecondDesc = AcpiNsGetSecondaryObject (Object);
277         if (SecondDesc)
278         {
279             AcpiUtDeleteObjectDesc (SecondDesc);
280         }
281         break;
282
283
284     default:
285         break;
286     }
287
288
289     /* Free any allocated memory (pointer within the object) found above */
290
291     if (ObjPointer)
292     {
293         ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Deleting Object Subptr %p\n",
294                 ObjPointer));
295         ACPI_MEM_FREE (ObjPointer);
296     }
297
298     /* Now the object can be safely deleted */
299
300     ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Deleting Object %p [%s]\n",
301             Object, AcpiUtGetObjectTypeName (Object)));
302
303     AcpiUtDeleteObjectDesc (Object);
304     return_VOID;
305 }
306
307
308 /*******************************************************************************
309  *
310  * FUNCTION:    AcpiUtDeleteInternalObjectList
311  *
312  * PARAMETERS:  *ObjList        - Pointer to the list to be deleted
313  *
314  * RETURN:      None
315  *
316  * DESCRIPTION: This function deletes an internal object list, including both
317  *              simple objects and package objects
318  *
319  ******************************************************************************/
320
321 void
322 AcpiUtDeleteInternalObjectList (
323     ACPI_OPERAND_OBJECT     **ObjList)
324 {
325     ACPI_OPERAND_OBJECT     **InternalObj;
326
327
328     ACPI_FUNCTION_TRACE ("UtDeleteInternalObjectList");
329
330
331     /* Walk the null-terminated internal list */
332
333     for (InternalObj = ObjList; *InternalObj; InternalObj++)
334     {
335         AcpiUtRemoveReference (*InternalObj);
336     }
337
338     /* Free the combined parameter pointer list and object array */
339
340     ACPI_MEM_FREE (ObjList);
341     return_VOID;
342 }
343
344
345 /*******************************************************************************
346  *
347  * FUNCTION:    AcpiUtUpdateRefCount
348  *
349  * PARAMETERS:  *Object         - Object whose ref count is to be updated
350  *              Action          - What to do
351  *
352  * RETURN:      New ref count
353  *
354  * DESCRIPTION: Modify the ref count and return it.
355  *
356  ******************************************************************************/
357
358 static void
359 AcpiUtUpdateRefCount (
360     ACPI_OPERAND_OBJECT     *Object,
361     UINT32                  Action)
362 {
363     UINT16                  Count;
364     UINT16                  NewCount;
365
366
367     ACPI_FUNCTION_NAME ("UtUpdateRefCount");
368
369
370     if (!Object)
371     {
372         return;
373     }
374
375     Count = Object->Common.ReferenceCount;
376     NewCount = Count;
377
378     /*
379      * Reference count action (increment, decrement, or force delete)
380      */
381     switch (Action)
382     {
383
384     case REF_INCREMENT:
385
386         NewCount++;
387         Object->Common.ReferenceCount = NewCount;
388
389         ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, [Incremented]\n",
390             Object, NewCount));
391         break;
392
393
394     case REF_DECREMENT:
395
396         if (Count < 1)
397         {
398             ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, can't decrement! (Set to 0)\n",
399                 Object, NewCount));
400
401             NewCount = 0;
402         }
403         else
404         {
405             NewCount--;
406
407             ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, [Decremented]\n",
408                 Object, NewCount));
409         }
410
411         if (ACPI_GET_OBJECT_TYPE (Object) == ACPI_TYPE_METHOD)
412         {
413             ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Method Obj %p Refs=%X, [Decremented]\n",
414                 Object, NewCount));
415         }
416
417         Object->Common.ReferenceCount = NewCount;
418         if (NewCount == 0)
419         {
420             AcpiUtDeleteInternalObj (Object);
421         }
422
423         break;
424
425
426     case REF_FORCE_DELETE:
427
428         ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, Force delete! (Set to 0)\n",
429             Object, Count));
430
431         NewCount = 0;
432         Object->Common.ReferenceCount = NewCount;
433         AcpiUtDeleteInternalObj (Object);
434         break;
435
436
437     default:
438
439         ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown action (%X)\n", Action));
440         break;
441     }
442
443     /*
444      * Sanity check the reference count, for debug purposes only.
445      * (A deleted object will have a huge reference count)
446      */
447     if (Count > ACPI_MAX_REFERENCE_COUNT)
448     {
449
450         ACPI_DEBUG_PRINT ((ACPI_DB_WARN,
451             "**** Warning **** Large Reference Count (%X) in object %p\n\n",
452             Count, Object));
453     }
454
455     return;
456 }
457
458
459 /*******************************************************************************
460  *
461  * FUNCTION:    AcpiUtUpdateObjectReference
462  *
463  * PARAMETERS:  *Object             - Increment ref count for this object
464  *                                    and all sub-objects
465  *              Action              - Either REF_INCREMENT or REF_DECREMENT or
466  *                                    REF_FORCE_DELETE
467  *
468  * RETURN:      Status
469  *
470  * DESCRIPTION: Increment the object reference count
471  *
472  * Object references are incremented when:
473  * 1) An object is attached to a Node (namespace object)
474  * 2) An object is copied (all subobjects must be incremented)
475  *
476  * Object references are decremented when:
477  * 1) An object is detached from an Node
478  *
479  ******************************************************************************/
480
481 ACPI_STATUS
482 AcpiUtUpdateObjectReference (
483     ACPI_OPERAND_OBJECT     *Object,
484     UINT16                  Action)
485 {
486     ACPI_STATUS             Status;
487     UINT32                  i;
488     ACPI_OPERAND_OBJECT     *Next;
489     ACPI_OPERAND_OBJECT     *New;
490     ACPI_GENERIC_STATE       *StateList = NULL;
491     ACPI_GENERIC_STATE       *State;
492
493
494     ACPI_FUNCTION_TRACE_PTR ("UtUpdateObjectReference", Object);
495
496
497     /* Ignore a null object ptr */
498
499     if (!Object)
500     {
501         return_ACPI_STATUS (AE_OK);
502     }
503
504     /*
505      * Make sure that this isn't a namespace handle
506      */
507     if (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED)
508     {
509         ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p is NS handle\n", Object));
510         return_ACPI_STATUS (AE_OK);
511     }
512
513     State = AcpiUtCreateUpdateState (Object, Action);
514
515     while (State)
516     {
517         Object = State->Update.Object;
518         Action = State->Update.Value;
519         AcpiUtDeleteGenericState (State);
520
521         /*
522          * All sub-objects must have their reference count incremented also.
523          * Different object types have different subobjects.
524          */
525         switch (ACPI_GET_OBJECT_TYPE (Object))
526         {
527         case ACPI_TYPE_DEVICE:
528
529             Status = AcpiUtCreateUpdateStateAndPush (Object->Device.AddrHandler,
530                                                      Action, &StateList);
531             if (ACPI_FAILURE (Status))
532             {
533                 goto ErrorExit;
534             }
535
536             AcpiUtUpdateRefCount (Object->Device.SysHandler, Action);
537             AcpiUtUpdateRefCount (Object->Device.DrvHandler, Action);
538             break;
539
540
541         case ACPI_TYPE_LOCAL_ADDRESS_HANDLER:
542
543             /* Must walk list of address handlers */
544
545             Next = Object->AddrHandler.Next;
546             while (Next)
547             {
548                 New = Next->AddrHandler.Next;
549                 AcpiUtUpdateRefCount (Next, Action);
550
551                 Next = New;
552             }
553             break;
554
555
556         case ACPI_TYPE_PACKAGE:
557
558             /*
559              * We must update all the sub-objects of the package
560              * (Each of whom may have their own sub-objects, etc.
561              */
562             for (i = 0; i < Object->Package.Count; i++)
563             {
564                 /*
565                  * Push each element onto the stack for later processing.
566                  * Note: There can be null elements within the package,
567                  * these are simply ignored
568                  */
569                 Status = AcpiUtCreateUpdateStateAndPush (
570                             Object->Package.Elements[i], Action, &StateList);
571                 if (ACPI_FAILURE (Status))
572                 {
573                     goto ErrorExit;
574                 }
575             }
576             break;
577
578
579         case ACPI_TYPE_BUFFER_FIELD:
580
581             Status = AcpiUtCreateUpdateStateAndPush (
582                         Object->BufferField.BufferObj, Action, &StateList);
583             if (ACPI_FAILURE (Status))
584             {
585                 goto ErrorExit;
586             }
587             break;
588
589
590         case ACPI_TYPE_LOCAL_REGION_FIELD:
591
592             Status = AcpiUtCreateUpdateStateAndPush (
593                         Object->Field.RegionObj, Action, &StateList);
594             if (ACPI_FAILURE (Status))
595             {
596                 goto ErrorExit;
597             }
598            break;
599
600
601         case ACPI_TYPE_LOCAL_BANK_FIELD:
602
603             Status = AcpiUtCreateUpdateStateAndPush (
604                         Object->BankField.BankObj, Action, &StateList);
605             if (ACPI_FAILURE (Status))
606             {
607                 goto ErrorExit;
608             }
609
610             Status = AcpiUtCreateUpdateStateAndPush (
611                         Object->BankField.RegionObj, Action, &StateList);
612             if (ACPI_FAILURE (Status))
613             {
614                 goto ErrorExit;
615             }
616             break;
617
618
619         case ACPI_TYPE_LOCAL_INDEX_FIELD:
620
621             Status = AcpiUtCreateUpdateStateAndPush (
622                         Object->IndexField.IndexObj, Action, &StateList);
623             if (ACPI_FAILURE (Status))
624             {
625                 goto ErrorExit;
626             }
627
628             Status = AcpiUtCreateUpdateStateAndPush (
629                         Object->IndexField.DataObj, Action, &StateList);
630             if (ACPI_FAILURE (Status))
631             {
632                 goto ErrorExit;
633             }
634             break;
635
636
637         case ACPI_TYPE_REGION:
638         case ACPI_TYPE_LOCAL_REFERENCE:
639         default:
640
641             /* No subobjects */
642             break;
643         }
644
645         /*
646          * Now we can update the count in the main object.  This can only
647          * happen after we update the sub-objects in case this causes the
648          * main object to be deleted.
649          */
650         AcpiUtUpdateRefCount (Object, Action);
651
652         /* Move on to the next object to be updated */
653
654         State = AcpiUtPopGenericState (&StateList);
655     }
656
657     return_ACPI_STATUS (AE_OK);
658
659
660 ErrorExit:
661
662     ACPI_REPORT_ERROR (("Could not update object reference count, %s\n",
663         AcpiFormatException (Status)));
664
665     return_ACPI_STATUS (Status);
666 }
667
668
669 /*******************************************************************************
670  *
671  * FUNCTION:    AcpiUtAddReference
672  *
673  * PARAMETERS:  *Object        - Object whose reference count is to be
674  *                                  incremented
675  *
676  * RETURN:      None
677  *
678  * DESCRIPTION: Add one reference to an ACPI object
679  *
680  ******************************************************************************/
681
682 void
683 AcpiUtAddReference (
684     ACPI_OPERAND_OBJECT     *Object)
685 {
686
687     ACPI_FUNCTION_TRACE_PTR ("UtAddReference", Object);
688
689
690     /*
691      * Ensure that we have a valid object
692      */
693     if (!AcpiUtValidInternalObject (Object))
694     {
695         return_VOID;
696     }
697
698     /*
699      * We have a valid ACPI internal object, now increment the reference count
700      */
701     (void) AcpiUtUpdateObjectReference  (Object, REF_INCREMENT);
702     return_VOID;
703 }
704
705
706 /*******************************************************************************
707  *
708  * FUNCTION:    AcpiUtRemoveReference
709  *
710  * PARAMETERS:  *Object        - Object whose ref count will be decremented
711  *
712  * RETURN:      None
713  *
714  * DESCRIPTION: Decrement the reference count of an ACPI internal object
715  *
716  ******************************************************************************/
717
718 void
719 AcpiUtRemoveReference (
720     ACPI_OPERAND_OBJECT     *Object)
721 {
722
723     ACPI_FUNCTION_TRACE_PTR ("UtRemoveReference", Object);
724
725     /*
726      * Allow a NULL pointer to be passed in, just ignore it.  This saves
727      * each caller from having to check.  Also, ignore NS nodes.
728      *
729      */
730     if (!Object ||
731         (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED))
732
733     {
734         return_VOID;
735     }
736
737     /*
738      * Ensure that we have a valid object
739      */
740     if (!AcpiUtValidInternalObject (Object))
741     {
742         return_VOID;
743     }
744
745     ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X\n",
746             Object, Object->Common.ReferenceCount));
747
748     /*
749      * Decrement the reference count, and only actually delete the object
750      * if the reference count becomes 0.  (Must also decrement the ref count
751      * of all subobjects!)
752      */
753     (void) AcpiUtUpdateObjectReference  (Object, REF_DECREMENT);
754     return_VOID;
755 }
756
757