utdelete.c revision 1.1.1.2.8.2 1 1.1.1.2.8.2 jruoho /*******************************************************************************
2 1.1.1.2.8.2 jruoho *
3 1.1.1.2.8.2 jruoho * Module Name: utdelete - object deletion and reference count utilities
4 1.1.1.2.8.2 jruoho *
5 1.1.1.2.8.2 jruoho ******************************************************************************/
6 1.1.1.2.8.2 jruoho
7 1.1.1.2.8.2 jruoho /*
8 1.1.1.2.8.2 jruoho * Copyright (C) 2000 - 2011, Intel Corp.
9 1.1.1.2.8.2 jruoho * All rights reserved.
10 1.1.1.2.8.2 jruoho *
11 1.1.1.2.8.2 jruoho * Redistribution and use in source and binary forms, with or without
12 1.1.1.2.8.2 jruoho * modification, are permitted provided that the following conditions
13 1.1.1.2.8.2 jruoho * are met:
14 1.1.1.2.8.2 jruoho * 1. Redistributions of source code must retain the above copyright
15 1.1.1.2.8.2 jruoho * notice, this list of conditions, and the following disclaimer,
16 1.1.1.2.8.2 jruoho * without modification.
17 1.1.1.2.8.2 jruoho * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 1.1.1.2.8.2 jruoho * substantially similar to the "NO WARRANTY" disclaimer below
19 1.1.1.2.8.2 jruoho * ("Disclaimer") and any redistribution must be conditioned upon
20 1.1.1.2.8.2 jruoho * including a substantially similar Disclaimer requirement for further
21 1.1.1.2.8.2 jruoho * binary redistribution.
22 1.1.1.2.8.2 jruoho * 3. Neither the names of the above-listed copyright holders nor the names
23 1.1.1.2.8.2 jruoho * of any contributors may be used to endorse or promote products derived
24 1.1.1.2.8.2 jruoho * from this software without specific prior written permission.
25 1.1.1.2.8.2 jruoho *
26 1.1.1.2.8.2 jruoho * Alternatively, this software may be distributed under the terms of the
27 1.1.1.2.8.2 jruoho * GNU General Public License ("GPL") version 2 as published by the Free
28 1.1.1.2.8.2 jruoho * Software Foundation.
29 1.1.1.2.8.2 jruoho *
30 1.1.1.2.8.2 jruoho * NO WARRANTY
31 1.1.1.2.8.2 jruoho * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 1.1.1.2.8.2 jruoho * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 1.1.1.2.8.2 jruoho * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 1.1.1.2.8.2 jruoho * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 1.1.1.2.8.2 jruoho * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 1.1.1.2.8.2 jruoho * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 1.1.1.2.8.2 jruoho * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 1.1.1.2.8.2 jruoho * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 1.1.1.2.8.2 jruoho * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 1.1.1.2.8.2 jruoho * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 1.1.1.2.8.2 jruoho * POSSIBILITY OF SUCH DAMAGES.
42 1.1.1.2.8.2 jruoho */
43 1.1.1.2.8.2 jruoho
44 1.1.1.2.8.2 jruoho #define __UTDELETE_C__
45 1.1.1.2.8.2 jruoho
46 1.1.1.2.8.2 jruoho #include "acpi.h"
47 1.1.1.2.8.2 jruoho #include "accommon.h"
48 1.1.1.2.8.2 jruoho #include "acinterp.h"
49 1.1.1.2.8.2 jruoho #include "acnamesp.h"
50 1.1.1.2.8.2 jruoho #include "acevents.h"
51 1.1.1.2.8.2 jruoho
52 1.1.1.2.8.2 jruoho
53 1.1.1.2.8.2 jruoho #define _COMPONENT ACPI_UTILITIES
54 1.1.1.2.8.2 jruoho ACPI_MODULE_NAME ("utdelete")
55 1.1.1.2.8.2 jruoho
56 1.1.1.2.8.2 jruoho /* Local prototypes */
57 1.1.1.2.8.2 jruoho
58 1.1.1.2.8.2 jruoho static void
59 1.1.1.2.8.2 jruoho AcpiUtDeleteInternalObj (
60 1.1.1.2.8.2 jruoho ACPI_OPERAND_OBJECT *Object);
61 1.1.1.2.8.2 jruoho
62 1.1.1.2.8.2 jruoho static void
63 1.1.1.2.8.2 jruoho AcpiUtUpdateRefCount (
64 1.1.1.2.8.2 jruoho ACPI_OPERAND_OBJECT *Object,
65 1.1.1.2.8.2 jruoho UINT32 Action);
66 1.1.1.2.8.2 jruoho
67 1.1.1.2.8.2 jruoho
68 1.1.1.2.8.2 jruoho /*******************************************************************************
69 1.1.1.2.8.2 jruoho *
70 1.1.1.2.8.2 jruoho * FUNCTION: AcpiUtDeleteInternalObj
71 1.1.1.2.8.2 jruoho *
72 1.1.1.2.8.2 jruoho * PARAMETERS: Object - Object to be deleted
73 1.1.1.2.8.2 jruoho *
74 1.1.1.2.8.2 jruoho * RETURN: None
75 1.1.1.2.8.2 jruoho *
76 1.1.1.2.8.2 jruoho * DESCRIPTION: Low level object deletion, after reference counts have been
77 1.1.1.2.8.2 jruoho * updated (All reference counts, including sub-objects!)
78 1.1.1.2.8.2 jruoho *
79 1.1.1.2.8.2 jruoho ******************************************************************************/
80 1.1.1.2.8.2 jruoho
81 1.1.1.2.8.2 jruoho static void
82 1.1.1.2.8.2 jruoho AcpiUtDeleteInternalObj (
83 1.1.1.2.8.2 jruoho ACPI_OPERAND_OBJECT *Object)
84 1.1.1.2.8.2 jruoho {
85 1.1.1.2.8.2 jruoho void *ObjPointer = NULL;
86 1.1.1.2.8.2 jruoho ACPI_OPERAND_OBJECT *HandlerDesc;
87 1.1.1.2.8.2 jruoho ACPI_OPERAND_OBJECT *SecondDesc;
88 1.1.1.2.8.2 jruoho ACPI_OPERAND_OBJECT *NextDesc;
89 1.1.1.2.8.2 jruoho ACPI_OPERAND_OBJECT **LastObjPtr;
90 1.1.1.2.8.2 jruoho
91 1.1.1.2.8.2 jruoho
92 1.1.1.2.8.2 jruoho ACPI_FUNCTION_TRACE_PTR (UtDeleteInternalObj, Object);
93 1.1.1.2.8.2 jruoho
94 1.1.1.2.8.2 jruoho
95 1.1.1.2.8.2 jruoho if (!Object)
96 1.1.1.2.8.2 jruoho {
97 1.1.1.2.8.2 jruoho return_VOID;
98 1.1.1.2.8.2 jruoho }
99 1.1.1.2.8.2 jruoho
100 1.1.1.2.8.2 jruoho /*
101 1.1.1.2.8.2 jruoho * Must delete or free any pointers within the object that are not
102 1.1.1.2.8.2 jruoho * actual ACPI objects (for example, a raw buffer pointer).
103 1.1.1.2.8.2 jruoho */
104 1.1.1.2.8.2 jruoho switch (Object->Common.Type)
105 1.1.1.2.8.2 jruoho {
106 1.1.1.2.8.2 jruoho case ACPI_TYPE_STRING:
107 1.1.1.2.8.2 jruoho
108 1.1.1.2.8.2 jruoho ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "**** String %p, ptr %p\n",
109 1.1.1.2.8.2 jruoho Object, Object->String.Pointer));
110 1.1.1.2.8.2 jruoho
111 1.1.1.2.8.2 jruoho /* Free the actual string buffer */
112 1.1.1.2.8.2 jruoho
113 1.1.1.2.8.2 jruoho if (!(Object->Common.Flags & AOPOBJ_STATIC_POINTER))
114 1.1.1.2.8.2 jruoho {
115 1.1.1.2.8.2 jruoho /* But only if it is NOT a pointer into an ACPI table */
116 1.1.1.2.8.2 jruoho
117 1.1.1.2.8.2 jruoho ObjPointer = Object->String.Pointer;
118 1.1.1.2.8.2 jruoho }
119 1.1.1.2.8.2 jruoho break;
120 1.1.1.2.8.2 jruoho
121 1.1.1.2.8.2 jruoho
122 1.1.1.2.8.2 jruoho case ACPI_TYPE_BUFFER:
123 1.1.1.2.8.2 jruoho
124 1.1.1.2.8.2 jruoho ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "**** Buffer %p, ptr %p\n",
125 1.1.1.2.8.2 jruoho Object, Object->Buffer.Pointer));
126 1.1.1.2.8.2 jruoho
127 1.1.1.2.8.2 jruoho /* Free the actual buffer */
128 1.1.1.2.8.2 jruoho
129 1.1.1.2.8.2 jruoho if (!(Object->Common.Flags & AOPOBJ_STATIC_POINTER))
130 1.1.1.2.8.2 jruoho {
131 1.1.1.2.8.2 jruoho /* But only if it is NOT a pointer into an ACPI table */
132 1.1.1.2.8.2 jruoho
133 1.1.1.2.8.2 jruoho ObjPointer = Object->Buffer.Pointer;
134 1.1.1.2.8.2 jruoho }
135 1.1.1.2.8.2 jruoho break;
136 1.1.1.2.8.2 jruoho
137 1.1.1.2.8.2 jruoho
138 1.1.1.2.8.2 jruoho case ACPI_TYPE_PACKAGE:
139 1.1.1.2.8.2 jruoho
140 1.1.1.2.8.2 jruoho ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, " **** Package of count %X\n",
141 1.1.1.2.8.2 jruoho Object->Package.Count));
142 1.1.1.2.8.2 jruoho
143 1.1.1.2.8.2 jruoho /*
144 1.1.1.2.8.2 jruoho * Elements of the package are not handled here, they are deleted
145 1.1.1.2.8.2 jruoho * separately
146 1.1.1.2.8.2 jruoho */
147 1.1.1.2.8.2 jruoho
148 1.1.1.2.8.2 jruoho /* Free the (variable length) element pointer array */
149 1.1.1.2.8.2 jruoho
150 1.1.1.2.8.2 jruoho ObjPointer = Object->Package.Elements;
151 1.1.1.2.8.2 jruoho break;
152 1.1.1.2.8.2 jruoho
153 1.1.1.2.8.2 jruoho
154 1.1.1.2.8.2 jruoho /*
155 1.1.1.2.8.2 jruoho * These objects have a possible list of notify handlers.
156 1.1.1.2.8.2 jruoho * Device object also may have a GPE block.
157 1.1.1.2.8.2 jruoho */
158 1.1.1.2.8.2 jruoho case ACPI_TYPE_DEVICE:
159 1.1.1.2.8.2 jruoho
160 1.1.1.2.8.2 jruoho if (Object->Device.GpeBlock)
161 1.1.1.2.8.2 jruoho {
162 1.1.1.2.8.2 jruoho (void) AcpiEvDeleteGpeBlock (Object->Device.GpeBlock);
163 1.1.1.2.8.2 jruoho }
164 1.1.1.2.8.2 jruoho
165 1.1.1.2.8.2 jruoho /*lint -fallthrough */
166 1.1.1.2.8.2 jruoho
167 1.1.1.2.8.2 jruoho case ACPI_TYPE_PROCESSOR:
168 1.1.1.2.8.2 jruoho case ACPI_TYPE_THERMAL:
169 1.1.1.2.8.2 jruoho
170 1.1.1.2.8.2 jruoho /* Walk the notify handler list for this object */
171 1.1.1.2.8.2 jruoho
172 1.1.1.2.8.2 jruoho HandlerDesc = Object->CommonNotify.Handler;
173 1.1.1.2.8.2 jruoho while (HandlerDesc)
174 1.1.1.2.8.2 jruoho {
175 1.1.1.2.8.2 jruoho NextDesc = HandlerDesc->AddressSpace.Next;
176 1.1.1.2.8.2 jruoho AcpiUtRemoveReference (HandlerDesc);
177 1.1.1.2.8.2 jruoho HandlerDesc = NextDesc;
178 1.1.1.2.8.2 jruoho }
179 1.1.1.2.8.2 jruoho break;
180 1.1.1.2.8.2 jruoho
181 1.1.1.2.8.2 jruoho
182 1.1.1.2.8.2 jruoho case ACPI_TYPE_MUTEX:
183 1.1.1.2.8.2 jruoho
184 1.1.1.2.8.2 jruoho ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
185 1.1.1.2.8.2 jruoho "***** Mutex %p, OS Mutex %p\n",
186 1.1.1.2.8.2 jruoho Object, Object->Mutex.OsMutex));
187 1.1.1.2.8.2 jruoho
188 1.1.1.2.8.2 jruoho if (Object == AcpiGbl_GlobalLockMutex)
189 1.1.1.2.8.2 jruoho {
190 1.1.1.2.8.2 jruoho /* Global Lock has extra semaphore */
191 1.1.1.2.8.2 jruoho
192 1.1.1.2.8.2 jruoho (void) AcpiOsDeleteSemaphore (AcpiGbl_GlobalLockSemaphore);
193 1.1.1.2.8.2 jruoho AcpiGbl_GlobalLockSemaphore = NULL;
194 1.1.1.2.8.2 jruoho
195 1.1.1.2.8.2 jruoho AcpiOsDeleteMutex (Object->Mutex.OsMutex);
196 1.1.1.2.8.2 jruoho AcpiGbl_GlobalLockMutex = NULL;
197 1.1.1.2.8.2 jruoho }
198 1.1.1.2.8.2 jruoho else
199 1.1.1.2.8.2 jruoho {
200 1.1.1.2.8.2 jruoho AcpiExUnlinkMutex (Object);
201 1.1.1.2.8.2 jruoho AcpiOsDeleteMutex (Object->Mutex.OsMutex);
202 1.1.1.2.8.2 jruoho }
203 1.1.1.2.8.2 jruoho break;
204 1.1.1.2.8.2 jruoho
205 1.1.1.2.8.2 jruoho
206 1.1.1.2.8.2 jruoho case ACPI_TYPE_EVENT:
207 1.1.1.2.8.2 jruoho
208 1.1.1.2.8.2 jruoho ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
209 1.1.1.2.8.2 jruoho "***** Event %p, OS Semaphore %p\n",
210 1.1.1.2.8.2 jruoho Object, Object->Event.OsSemaphore));
211 1.1.1.2.8.2 jruoho
212 1.1.1.2.8.2 jruoho (void) AcpiOsDeleteSemaphore (Object->Event.OsSemaphore);
213 1.1.1.2.8.2 jruoho Object->Event.OsSemaphore = NULL;
214 1.1.1.2.8.2 jruoho break;
215 1.1.1.2.8.2 jruoho
216 1.1.1.2.8.2 jruoho
217 1.1.1.2.8.2 jruoho case ACPI_TYPE_METHOD:
218 1.1.1.2.8.2 jruoho
219 1.1.1.2.8.2 jruoho ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
220 1.1.1.2.8.2 jruoho "***** Method %p\n", Object));
221 1.1.1.2.8.2 jruoho
222 1.1.1.2.8.2 jruoho /* Delete the method mutex if it exists */
223 1.1.1.2.8.2 jruoho
224 1.1.1.2.8.2 jruoho if (Object->Method.Mutex)
225 1.1.1.2.8.2 jruoho {
226 1.1.1.2.8.2 jruoho AcpiOsDeleteMutex (Object->Method.Mutex->Mutex.OsMutex);
227 1.1.1.2.8.2 jruoho AcpiUtDeleteObjectDesc (Object->Method.Mutex);
228 1.1.1.2.8.2 jruoho Object->Method.Mutex = NULL;
229 1.1.1.2.8.2 jruoho }
230 1.1.1.2.8.2 jruoho break;
231 1.1.1.2.8.2 jruoho
232 1.1.1.2.8.2 jruoho
233 1.1.1.2.8.2 jruoho case ACPI_TYPE_REGION:
234 1.1.1.2.8.2 jruoho
235 1.1.1.2.8.2 jruoho ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
236 1.1.1.2.8.2 jruoho "***** Region %p\n", Object));
237 1.1.1.2.8.2 jruoho
238 1.1.1.2.8.2 jruoho SecondDesc = AcpiNsGetSecondaryObject (Object);
239 1.1.1.2.8.2 jruoho if (SecondDesc)
240 1.1.1.2.8.2 jruoho {
241 1.1.1.2.8.2 jruoho /*
242 1.1.1.2.8.2 jruoho * Free the RegionContext if and only if the handler is one of the
243 1.1.1.2.8.2 jruoho * default handlers -- and therefore, we created the context object
244 1.1.1.2.8.2 jruoho * locally, it was not created by an external caller.
245 1.1.1.2.8.2 jruoho */
246 1.1.1.2.8.2 jruoho HandlerDesc = Object->Region.Handler;
247 1.1.1.2.8.2 jruoho if (HandlerDesc)
248 1.1.1.2.8.2 jruoho {
249 1.1.1.2.8.2 jruoho NextDesc = HandlerDesc->AddressSpace.RegionList;
250 1.1.1.2.8.2 jruoho LastObjPtr = &HandlerDesc->AddressSpace.RegionList;
251 1.1.1.2.8.2 jruoho
252 1.1.1.2.8.2 jruoho /* Remove the region object from the handler's list */
253 1.1.1.2.8.2 jruoho
254 1.1.1.2.8.2 jruoho while (NextDesc)
255 1.1.1.2.8.2 jruoho {
256 1.1.1.2.8.2 jruoho if (NextDesc == Object)
257 1.1.1.2.8.2 jruoho {
258 1.1.1.2.8.2 jruoho *LastObjPtr = NextDesc->Region.Next;
259 1.1.1.2.8.2 jruoho break;
260 1.1.1.2.8.2 jruoho }
261 1.1.1.2.8.2 jruoho
262 1.1.1.2.8.2 jruoho /* Walk the linked list of handler */
263 1.1.1.2.8.2 jruoho
264 1.1.1.2.8.2 jruoho LastObjPtr = &NextDesc->Region.Next;
265 1.1.1.2.8.2 jruoho NextDesc = NextDesc->Region.Next;
266 1.1.1.2.8.2 jruoho }
267 1.1.1.2.8.2 jruoho
268 1.1.1.2.8.2 jruoho if (HandlerDesc->AddressSpace.HandlerFlags &
269 1.1.1.2.8.2 jruoho ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)
270 1.1.1.2.8.2 jruoho {
271 1.1.1.2.8.2 jruoho /* Deactivate region and free region context */
272 1.1.1.2.8.2 jruoho
273 1.1.1.2.8.2 jruoho if (HandlerDesc->AddressSpace.Setup)
274 1.1.1.2.8.2 jruoho {
275 1.1.1.2.8.2 jruoho (void) HandlerDesc->AddressSpace.Setup (Object,
276 1.1.1.2.8.2 jruoho ACPI_REGION_DEACTIVATE,
277 1.1.1.2.8.2 jruoho HandlerDesc->AddressSpace.Context,
278 1.1.1.2.8.2 jruoho &SecondDesc->Extra.RegionContext);
279 1.1.1.2.8.2 jruoho }
280 1.1.1.2.8.2 jruoho }
281 1.1.1.2.8.2 jruoho
282 1.1.1.2.8.2 jruoho AcpiUtRemoveReference (HandlerDesc);
283 1.1.1.2.8.2 jruoho }
284 1.1.1.2.8.2 jruoho
285 1.1.1.2.8.2 jruoho /* Now we can free the Extra object */
286 1.1.1.2.8.2 jruoho
287 1.1.1.2.8.2 jruoho AcpiUtDeleteObjectDesc (SecondDesc);
288 1.1.1.2.8.2 jruoho }
289 1.1.1.2.8.2 jruoho break;
290 1.1.1.2.8.2 jruoho
291 1.1.1.2.8.2 jruoho
292 1.1.1.2.8.2 jruoho case ACPI_TYPE_BUFFER_FIELD:
293 1.1.1.2.8.2 jruoho
294 1.1.1.2.8.2 jruoho ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
295 1.1.1.2.8.2 jruoho "***** Buffer Field %p\n", Object));
296 1.1.1.2.8.2 jruoho
297 1.1.1.2.8.2 jruoho SecondDesc = AcpiNsGetSecondaryObject (Object);
298 1.1.1.2.8.2 jruoho if (SecondDesc)
299 1.1.1.2.8.2 jruoho {
300 1.1.1.2.8.2 jruoho AcpiUtDeleteObjectDesc (SecondDesc);
301 1.1.1.2.8.2 jruoho }
302 1.1.1.2.8.2 jruoho break;
303 1.1.1.2.8.2 jruoho
304 1.1.1.2.8.2 jruoho
305 1.1.1.2.8.2 jruoho case ACPI_TYPE_LOCAL_BANK_FIELD:
306 1.1.1.2.8.2 jruoho
307 1.1.1.2.8.2 jruoho ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
308 1.1.1.2.8.2 jruoho "***** Bank Field %p\n", Object));
309 1.1.1.2.8.2 jruoho
310 1.1.1.2.8.2 jruoho SecondDesc = AcpiNsGetSecondaryObject (Object);
311 1.1.1.2.8.2 jruoho if (SecondDesc)
312 1.1.1.2.8.2 jruoho {
313 1.1.1.2.8.2 jruoho AcpiUtDeleteObjectDesc (SecondDesc);
314 1.1.1.2.8.2 jruoho }
315 1.1.1.2.8.2 jruoho break;
316 1.1.1.2.8.2 jruoho
317 1.1.1.2.8.2 jruoho
318 1.1.1.2.8.2 jruoho default:
319 1.1.1.2.8.2 jruoho break;
320 1.1.1.2.8.2 jruoho }
321 1.1.1.2.8.2 jruoho
322 1.1.1.2.8.2 jruoho /* Free any allocated memory (pointer within the object) found above */
323 1.1.1.2.8.2 jruoho
324 1.1.1.2.8.2 jruoho if (ObjPointer)
325 1.1.1.2.8.2 jruoho {
326 1.1.1.2.8.2 jruoho ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Deleting Object Subptr %p\n",
327 1.1.1.2.8.2 jruoho ObjPointer));
328 1.1.1.2.8.2 jruoho ACPI_FREE (ObjPointer);
329 1.1.1.2.8.2 jruoho }
330 1.1.1.2.8.2 jruoho
331 1.1.1.2.8.2 jruoho /* Now the object can be safely deleted */
332 1.1.1.2.8.2 jruoho
333 1.1.1.2.8.2 jruoho ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Deleting Object %p [%s]\n",
334 1.1.1.2.8.2 jruoho Object, AcpiUtGetObjectTypeName (Object)));
335 1.1.1.2.8.2 jruoho
336 1.1.1.2.8.2 jruoho AcpiUtDeleteObjectDesc (Object);
337 1.1.1.2.8.2 jruoho return_VOID;
338 1.1.1.2.8.2 jruoho }
339 1.1.1.2.8.2 jruoho
340 1.1.1.2.8.2 jruoho
341 1.1.1.2.8.2 jruoho /*******************************************************************************
342 1.1.1.2.8.2 jruoho *
343 1.1.1.2.8.2 jruoho * FUNCTION: AcpiUtDeleteInternalObjectList
344 1.1.1.2.8.2 jruoho *
345 1.1.1.2.8.2 jruoho * PARAMETERS: ObjList - Pointer to the list to be deleted
346 1.1.1.2.8.2 jruoho *
347 1.1.1.2.8.2 jruoho * RETURN: None
348 1.1.1.2.8.2 jruoho *
349 1.1.1.2.8.2 jruoho * DESCRIPTION: This function deletes an internal object list, including both
350 1.1.1.2.8.2 jruoho * simple objects and package objects
351 1.1.1.2.8.2 jruoho *
352 1.1.1.2.8.2 jruoho ******************************************************************************/
353 1.1.1.2.8.2 jruoho
354 1.1.1.2.8.2 jruoho void
355 1.1.1.2.8.2 jruoho AcpiUtDeleteInternalObjectList (
356 1.1.1.2.8.2 jruoho ACPI_OPERAND_OBJECT **ObjList)
357 1.1.1.2.8.2 jruoho {
358 1.1.1.2.8.2 jruoho ACPI_OPERAND_OBJECT **InternalObj;
359 1.1.1.2.8.2 jruoho
360 1.1.1.2.8.2 jruoho
361 1.1.1.2.8.2 jruoho ACPI_FUNCTION_TRACE (UtDeleteInternalObjectList);
362 1.1.1.2.8.2 jruoho
363 1.1.1.2.8.2 jruoho
364 1.1.1.2.8.2 jruoho /* Walk the null-terminated internal list */
365 1.1.1.2.8.2 jruoho
366 1.1.1.2.8.2 jruoho for (InternalObj = ObjList; *InternalObj; InternalObj++)
367 1.1.1.2.8.2 jruoho {
368 1.1.1.2.8.2 jruoho AcpiUtRemoveReference (*InternalObj);
369 1.1.1.2.8.2 jruoho }
370 1.1.1.2.8.2 jruoho
371 1.1.1.2.8.2 jruoho /* Free the combined parameter pointer list and object array */
372 1.1.1.2.8.2 jruoho
373 1.1.1.2.8.2 jruoho ACPI_FREE (ObjList);
374 1.1.1.2.8.2 jruoho return_VOID;
375 1.1.1.2.8.2 jruoho }
376 1.1.1.2.8.2 jruoho
377 1.1.1.2.8.2 jruoho
378 1.1.1.2.8.2 jruoho /*******************************************************************************
379 1.1.1.2.8.2 jruoho *
380 1.1.1.2.8.2 jruoho * FUNCTION: AcpiUtUpdateRefCount
381 1.1.1.2.8.2 jruoho *
382 1.1.1.2.8.2 jruoho * PARAMETERS: Object - Object whose ref count is to be updated
383 1.1.1.2.8.2 jruoho * Action - What to do
384 1.1.1.2.8.2 jruoho *
385 1.1.1.2.8.2 jruoho * RETURN: New ref count
386 1.1.1.2.8.2 jruoho *
387 1.1.1.2.8.2 jruoho * DESCRIPTION: Modify the ref count and return it.
388 1.1.1.2.8.2 jruoho *
389 1.1.1.2.8.2 jruoho ******************************************************************************/
390 1.1.1.2.8.2 jruoho
391 1.1.1.2.8.2 jruoho static void
392 1.1.1.2.8.2 jruoho AcpiUtUpdateRefCount (
393 1.1.1.2.8.2 jruoho ACPI_OPERAND_OBJECT *Object,
394 1.1.1.2.8.2 jruoho UINT32 Action)
395 1.1.1.2.8.2 jruoho {
396 1.1.1.2.8.2 jruoho UINT16 Count;
397 1.1.1.2.8.2 jruoho UINT16 NewCount;
398 1.1.1.2.8.2 jruoho
399 1.1.1.2.8.2 jruoho
400 1.1.1.2.8.2 jruoho ACPI_FUNCTION_NAME (UtUpdateRefCount);
401 1.1.1.2.8.2 jruoho
402 1.1.1.2.8.2 jruoho
403 1.1.1.2.8.2 jruoho if (!Object)
404 1.1.1.2.8.2 jruoho {
405 1.1.1.2.8.2 jruoho return;
406 1.1.1.2.8.2 jruoho }
407 1.1.1.2.8.2 jruoho
408 1.1.1.2.8.2 jruoho Count = Object->Common.ReferenceCount;
409 1.1.1.2.8.2 jruoho NewCount = Count;
410 1.1.1.2.8.2 jruoho
411 1.1.1.2.8.2 jruoho /*
412 1.1.1.2.8.2 jruoho * Perform the reference count action (increment, decrement, force delete)
413 1.1.1.2.8.2 jruoho */
414 1.1.1.2.8.2 jruoho switch (Action)
415 1.1.1.2.8.2 jruoho {
416 1.1.1.2.8.2 jruoho case REF_INCREMENT:
417 1.1.1.2.8.2 jruoho
418 1.1.1.2.8.2 jruoho NewCount++;
419 1.1.1.2.8.2 jruoho Object->Common.ReferenceCount = NewCount;
420 1.1.1.2.8.2 jruoho
421 1.1.1.2.8.2 jruoho ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
422 1.1.1.2.8.2 jruoho "Obj %p Refs=%X, [Incremented]\n",
423 1.1.1.2.8.2 jruoho Object, NewCount));
424 1.1.1.2.8.2 jruoho break;
425 1.1.1.2.8.2 jruoho
426 1.1.1.2.8.2 jruoho case REF_DECREMENT:
427 1.1.1.2.8.2 jruoho
428 1.1.1.2.8.2 jruoho if (Count < 1)
429 1.1.1.2.8.2 jruoho {
430 1.1.1.2.8.2 jruoho ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
431 1.1.1.2.8.2 jruoho "Obj %p Refs=%X, can't decrement! (Set to 0)\n",
432 1.1.1.2.8.2 jruoho Object, NewCount));
433 1.1.1.2.8.2 jruoho
434 1.1.1.2.8.2 jruoho NewCount = 0;
435 1.1.1.2.8.2 jruoho }
436 1.1.1.2.8.2 jruoho else
437 1.1.1.2.8.2 jruoho {
438 1.1.1.2.8.2 jruoho NewCount--;
439 1.1.1.2.8.2 jruoho
440 1.1.1.2.8.2 jruoho ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
441 1.1.1.2.8.2 jruoho "Obj %p Refs=%X, [Decremented]\n",
442 1.1.1.2.8.2 jruoho Object, NewCount));
443 1.1.1.2.8.2 jruoho }
444 1.1.1.2.8.2 jruoho
445 1.1.1.2.8.2 jruoho if (Object->Common.Type == ACPI_TYPE_METHOD)
446 1.1.1.2.8.2 jruoho {
447 1.1.1.2.8.2 jruoho ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
448 1.1.1.2.8.2 jruoho "Method Obj %p Refs=%X, [Decremented]\n", Object, NewCount));
449 1.1.1.2.8.2 jruoho }
450 1.1.1.2.8.2 jruoho
451 1.1.1.2.8.2 jruoho Object->Common.ReferenceCount = NewCount;
452 1.1.1.2.8.2 jruoho if (NewCount == 0)
453 1.1.1.2.8.2 jruoho {
454 1.1.1.2.8.2 jruoho AcpiUtDeleteInternalObj (Object);
455 1.1.1.2.8.2 jruoho }
456 1.1.1.2.8.2 jruoho break;
457 1.1.1.2.8.2 jruoho
458 1.1.1.2.8.2 jruoho case REF_FORCE_DELETE:
459 1.1.1.2.8.2 jruoho
460 1.1.1.2.8.2 jruoho ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
461 1.1.1.2.8.2 jruoho "Obj %p Refs=%X, Force delete! (Set to 0)\n", Object, Count));
462 1.1.1.2.8.2 jruoho
463 1.1.1.2.8.2 jruoho NewCount = 0;
464 1.1.1.2.8.2 jruoho Object->Common.ReferenceCount = NewCount;
465 1.1.1.2.8.2 jruoho AcpiUtDeleteInternalObj (Object);
466 1.1.1.2.8.2 jruoho break;
467 1.1.1.2.8.2 jruoho
468 1.1.1.2.8.2 jruoho default:
469 1.1.1.2.8.2 jruoho
470 1.1.1.2.8.2 jruoho ACPI_ERROR ((AE_INFO, "Unknown action (0x%X)", Action));
471 1.1.1.2.8.2 jruoho break;
472 1.1.1.2.8.2 jruoho }
473 1.1.1.2.8.2 jruoho
474 1.1.1.2.8.2 jruoho /*
475 1.1.1.2.8.2 jruoho * Sanity check the reference count, for debug purposes only.
476 1.1.1.2.8.2 jruoho * (A deleted object will have a huge reference count)
477 1.1.1.2.8.2 jruoho */
478 1.1.1.2.8.2 jruoho if (Count > ACPI_MAX_REFERENCE_COUNT)
479 1.1.1.2.8.2 jruoho {
480 1.1.1.2.8.2 jruoho ACPI_WARNING ((AE_INFO,
481 1.1.1.2.8.2 jruoho "Large Reference Count (0x%X) in object %p", Count, Object));
482 1.1.1.2.8.2 jruoho }
483 1.1.1.2.8.2 jruoho }
484 1.1.1.2.8.2 jruoho
485 1.1.1.2.8.2 jruoho
486 1.1.1.2.8.2 jruoho /*******************************************************************************
487 1.1.1.2.8.2 jruoho *
488 1.1.1.2.8.2 jruoho * FUNCTION: AcpiUtUpdateObjectReference
489 1.1.1.2.8.2 jruoho *
490 1.1.1.2.8.2 jruoho * PARAMETERS: Object - Increment ref count for this object
491 1.1.1.2.8.2 jruoho * and all sub-objects
492 1.1.1.2.8.2 jruoho * Action - Either REF_INCREMENT or REF_DECREMENT or
493 1.1.1.2.8.2 jruoho * REF_FORCE_DELETE
494 1.1.1.2.8.2 jruoho *
495 1.1.1.2.8.2 jruoho * RETURN: Status
496 1.1.1.2.8.2 jruoho *
497 1.1.1.2.8.2 jruoho * DESCRIPTION: Increment the object reference count
498 1.1.1.2.8.2 jruoho *
499 1.1.1.2.8.2 jruoho * Object references are incremented when:
500 1.1.1.2.8.2 jruoho * 1) An object is attached to a Node (namespace object)
501 1.1.1.2.8.2 jruoho * 2) An object is copied (all subobjects must be incremented)
502 1.1.1.2.8.2 jruoho *
503 1.1.1.2.8.2 jruoho * Object references are decremented when:
504 1.1.1.2.8.2 jruoho * 1) An object is detached from an Node
505 1.1.1.2.8.2 jruoho *
506 1.1.1.2.8.2 jruoho ******************************************************************************/
507 1.1.1.2.8.2 jruoho
508 1.1.1.2.8.2 jruoho ACPI_STATUS
509 1.1.1.2.8.2 jruoho AcpiUtUpdateObjectReference (
510 1.1.1.2.8.2 jruoho ACPI_OPERAND_OBJECT *Object,
511 1.1.1.2.8.2 jruoho UINT16 Action)
512 1.1.1.2.8.2 jruoho {
513 1.1.1.2.8.2 jruoho ACPI_STATUS Status = AE_OK;
514 1.1.1.2.8.2 jruoho ACPI_GENERIC_STATE *StateList = NULL;
515 1.1.1.2.8.2 jruoho ACPI_OPERAND_OBJECT *NextObject = NULL;
516 1.1.1.2.8.2 jruoho ACPI_GENERIC_STATE *State;
517 1.1.1.2.8.2 jruoho UINT32 i;
518 1.1.1.2.8.2 jruoho
519 1.1.1.2.8.2 jruoho
520 1.1.1.2.8.2 jruoho ACPI_FUNCTION_TRACE_PTR (UtUpdateObjectReference, Object);
521 1.1.1.2.8.2 jruoho
522 1.1.1.2.8.2 jruoho
523 1.1.1.2.8.2 jruoho while (Object)
524 1.1.1.2.8.2 jruoho {
525 1.1.1.2.8.2 jruoho /* Make sure that this isn't a namespace handle */
526 1.1.1.2.8.2 jruoho
527 1.1.1.2.8.2 jruoho if (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED)
528 1.1.1.2.8.2 jruoho {
529 1.1.1.2.8.2 jruoho ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
530 1.1.1.2.8.2 jruoho "Object %p is NS handle\n", Object));
531 1.1.1.2.8.2 jruoho return_ACPI_STATUS (AE_OK);
532 1.1.1.2.8.2 jruoho }
533 1.1.1.2.8.2 jruoho
534 1.1.1.2.8.2 jruoho /*
535 1.1.1.2.8.2 jruoho * All sub-objects must have their reference count incremented also.
536 1.1.1.2.8.2 jruoho * Different object types have different subobjects.
537 1.1.1.2.8.2 jruoho */
538 1.1.1.2.8.2 jruoho switch (Object->Common.Type)
539 1.1.1.2.8.2 jruoho {
540 1.1.1.2.8.2 jruoho case ACPI_TYPE_DEVICE:
541 1.1.1.2.8.2 jruoho case ACPI_TYPE_PROCESSOR:
542 1.1.1.2.8.2 jruoho case ACPI_TYPE_POWER:
543 1.1.1.2.8.2 jruoho case ACPI_TYPE_THERMAL:
544 1.1.1.2.8.2 jruoho
545 1.1.1.2.8.2 jruoho /* Update the notify objects for these types (if present) */
546 1.1.1.2.8.2 jruoho
547 1.1.1.2.8.2 jruoho AcpiUtUpdateRefCount (Object->CommonNotify.SystemNotify, Action);
548 1.1.1.2.8.2 jruoho AcpiUtUpdateRefCount (Object->CommonNotify.DeviceNotify, Action);
549 1.1.1.2.8.2 jruoho break;
550 1.1.1.2.8.2 jruoho
551 1.1.1.2.8.2 jruoho case ACPI_TYPE_PACKAGE:
552 1.1.1.2.8.2 jruoho /*
553 1.1.1.2.8.2 jruoho * We must update all the sub-objects of the package,
554 1.1.1.2.8.2 jruoho * each of whom may have their own sub-objects.
555 1.1.1.2.8.2 jruoho */
556 1.1.1.2.8.2 jruoho for (i = 0; i < Object->Package.Count; i++)
557 1.1.1.2.8.2 jruoho {
558 1.1.1.2.8.2 jruoho /*
559 1.1.1.2.8.2 jruoho * Push each element onto the stack for later processing.
560 1.1.1.2.8.2 jruoho * Note: There can be null elements within the package,
561 1.1.1.2.8.2 jruoho * these are simply ignored
562 1.1.1.2.8.2 jruoho */
563 1.1.1.2.8.2 jruoho Status = AcpiUtCreateUpdateStateAndPush (
564 1.1.1.2.8.2 jruoho Object->Package.Elements[i], Action, &StateList);
565 1.1.1.2.8.2 jruoho if (ACPI_FAILURE (Status))
566 1.1.1.2.8.2 jruoho {
567 1.1.1.2.8.2 jruoho goto ErrorExit;
568 1.1.1.2.8.2 jruoho }
569 1.1.1.2.8.2 jruoho }
570 1.1.1.2.8.2 jruoho break;
571 1.1.1.2.8.2 jruoho
572 1.1.1.2.8.2 jruoho case ACPI_TYPE_BUFFER_FIELD:
573 1.1.1.2.8.2 jruoho
574 1.1.1.2.8.2 jruoho NextObject = Object->BufferField.BufferObj;
575 1.1.1.2.8.2 jruoho break;
576 1.1.1.2.8.2 jruoho
577 1.1.1.2.8.2 jruoho case ACPI_TYPE_LOCAL_REGION_FIELD:
578 1.1.1.2.8.2 jruoho
579 1.1.1.2.8.2 jruoho NextObject = Object->Field.RegionObj;
580 1.1.1.2.8.2 jruoho break;
581 1.1.1.2.8.2 jruoho
582 1.1.1.2.8.2 jruoho case ACPI_TYPE_LOCAL_BANK_FIELD:
583 1.1.1.2.8.2 jruoho
584 1.1.1.2.8.2 jruoho NextObject = Object->BankField.BankObj;
585 1.1.1.2.8.2 jruoho Status = AcpiUtCreateUpdateStateAndPush (
586 1.1.1.2.8.2 jruoho Object->BankField.RegionObj, Action, &StateList);
587 1.1.1.2.8.2 jruoho if (ACPI_FAILURE (Status))
588 1.1.1.2.8.2 jruoho {
589 1.1.1.2.8.2 jruoho goto ErrorExit;
590 1.1.1.2.8.2 jruoho }
591 1.1.1.2.8.2 jruoho break;
592 1.1.1.2.8.2 jruoho
593 1.1.1.2.8.2 jruoho case ACPI_TYPE_LOCAL_INDEX_FIELD:
594 1.1.1.2.8.2 jruoho
595 1.1.1.2.8.2 jruoho NextObject = Object->IndexField.IndexObj;
596 1.1.1.2.8.2 jruoho Status = AcpiUtCreateUpdateStateAndPush (
597 1.1.1.2.8.2 jruoho Object->IndexField.DataObj, Action, &StateList);
598 1.1.1.2.8.2 jruoho if (ACPI_FAILURE (Status))
599 1.1.1.2.8.2 jruoho {
600 1.1.1.2.8.2 jruoho goto ErrorExit;
601 1.1.1.2.8.2 jruoho }
602 1.1.1.2.8.2 jruoho break;
603 1.1.1.2.8.2 jruoho
604 1.1.1.2.8.2 jruoho case ACPI_TYPE_LOCAL_REFERENCE:
605 1.1.1.2.8.2 jruoho /*
606 1.1.1.2.8.2 jruoho * The target of an Index (a package, string, or buffer) or a named
607 1.1.1.2.8.2 jruoho * reference must track changes to the ref count of the index or
608 1.1.1.2.8.2 jruoho * target object.
609 1.1.1.2.8.2 jruoho */
610 1.1.1.2.8.2 jruoho if ((Object->Reference.Class == ACPI_REFCLASS_INDEX) ||
611 1.1.1.2.8.2 jruoho (Object->Reference.Class== ACPI_REFCLASS_NAME))
612 1.1.1.2.8.2 jruoho {
613 1.1.1.2.8.2 jruoho NextObject = Object->Reference.Object;
614 1.1.1.2.8.2 jruoho }
615 1.1.1.2.8.2 jruoho break;
616 1.1.1.2.8.2 jruoho
617 1.1.1.2.8.2 jruoho case ACPI_TYPE_REGION:
618 1.1.1.2.8.2 jruoho default:
619 1.1.1.2.8.2 jruoho break; /* No subobjects for all other types */
620 1.1.1.2.8.2 jruoho }
621 1.1.1.2.8.2 jruoho
622 1.1.1.2.8.2 jruoho /*
623 1.1.1.2.8.2 jruoho * Now we can update the count in the main object. This can only
624 1.1.1.2.8.2 jruoho * happen after we update the sub-objects in case this causes the
625 1.1.1.2.8.2 jruoho * main object to be deleted.
626 1.1.1.2.8.2 jruoho */
627 1.1.1.2.8.2 jruoho AcpiUtUpdateRefCount (Object, Action);
628 1.1.1.2.8.2 jruoho Object = NULL;
629 1.1.1.2.8.2 jruoho
630 1.1.1.2.8.2 jruoho /* Move on to the next object to be updated */
631 1.1.1.2.8.2 jruoho
632 1.1.1.2.8.2 jruoho if (NextObject)
633 1.1.1.2.8.2 jruoho {
634 1.1.1.2.8.2 jruoho Object = NextObject;
635 1.1.1.2.8.2 jruoho NextObject = NULL;
636 1.1.1.2.8.2 jruoho }
637 1.1.1.2.8.2 jruoho else if (StateList)
638 1.1.1.2.8.2 jruoho {
639 1.1.1.2.8.2 jruoho State = AcpiUtPopGenericState (&StateList);
640 1.1.1.2.8.2 jruoho Object = State->Update.Object;
641 1.1.1.2.8.2 jruoho AcpiUtDeleteGenericState (State);
642 1.1.1.2.8.2 jruoho }
643 1.1.1.2.8.2 jruoho }
644 1.1.1.2.8.2 jruoho
645 1.1.1.2.8.2 jruoho return_ACPI_STATUS (AE_OK);
646 1.1.1.2.8.2 jruoho
647 1.1.1.2.8.2 jruoho
648 1.1.1.2.8.2 jruoho ErrorExit:
649 1.1.1.2.8.2 jruoho
650 1.1.1.2.8.2 jruoho ACPI_EXCEPTION ((AE_INFO, Status,
651 1.1.1.2.8.2 jruoho "Could not update object reference count"));
652 1.1.1.2.8.2 jruoho
653 1.1.1.2.8.2 jruoho /* Free any stacked Update State objects */
654 1.1.1.2.8.2 jruoho
655 1.1.1.2.8.2 jruoho while (StateList)
656 1.1.1.2.8.2 jruoho {
657 1.1.1.2.8.2 jruoho State = AcpiUtPopGenericState (&StateList);
658 1.1.1.2.8.2 jruoho AcpiUtDeleteGenericState (State);
659 1.1.1.2.8.2 jruoho }
660 1.1.1.2.8.2 jruoho
661 1.1.1.2.8.2 jruoho return_ACPI_STATUS (Status);
662 1.1.1.2.8.2 jruoho }
663 1.1.1.2.8.2 jruoho
664 1.1.1.2.8.2 jruoho
665 1.1.1.2.8.2 jruoho /*******************************************************************************
666 1.1.1.2.8.2 jruoho *
667 1.1.1.2.8.2 jruoho * FUNCTION: AcpiUtAddReference
668 1.1.1.2.8.2 jruoho *
669 1.1.1.2.8.2 jruoho * PARAMETERS: Object - Object whose reference count is to be
670 1.1.1.2.8.2 jruoho * incremented
671 1.1.1.2.8.2 jruoho *
672 1.1.1.2.8.2 jruoho * RETURN: None
673 1.1.1.2.8.2 jruoho *
674 1.1.1.2.8.2 jruoho * DESCRIPTION: Add one reference to an ACPI object
675 1.1.1.2.8.2 jruoho *
676 1.1.1.2.8.2 jruoho ******************************************************************************/
677 1.1.1.2.8.2 jruoho
678 1.1.1.2.8.2 jruoho void
679 1.1.1.2.8.2 jruoho AcpiUtAddReference (
680 1.1.1.2.8.2 jruoho ACPI_OPERAND_OBJECT *Object)
681 1.1.1.2.8.2 jruoho {
682 1.1.1.2.8.2 jruoho
683 1.1.1.2.8.2 jruoho ACPI_FUNCTION_TRACE_PTR (UtAddReference, Object);
684 1.1.1.2.8.2 jruoho
685 1.1.1.2.8.2 jruoho
686 1.1.1.2.8.2 jruoho /* Ensure that we have a valid object */
687 1.1.1.2.8.2 jruoho
688 1.1.1.2.8.2 jruoho if (!AcpiUtValidInternalObject (Object))
689 1.1.1.2.8.2 jruoho {
690 1.1.1.2.8.2 jruoho return_VOID;
691 1.1.1.2.8.2 jruoho }
692 1.1.1.2.8.2 jruoho
693 1.1.1.2.8.2 jruoho ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
694 1.1.1.2.8.2 jruoho "Obj %p Current Refs=%X [To Be Incremented]\n",
695 1.1.1.2.8.2 jruoho Object, Object->Common.ReferenceCount));
696 1.1.1.2.8.2 jruoho
697 1.1.1.2.8.2 jruoho /* Increment the reference count */
698 1.1.1.2.8.2 jruoho
699 1.1.1.2.8.2 jruoho (void) AcpiUtUpdateObjectReference (Object, REF_INCREMENT);
700 1.1.1.2.8.2 jruoho return_VOID;
701 1.1.1.2.8.2 jruoho }
702 1.1.1.2.8.2 jruoho
703 1.1.1.2.8.2 jruoho
704 1.1.1.2.8.2 jruoho /*******************************************************************************
705 1.1.1.2.8.2 jruoho *
706 1.1.1.2.8.2 jruoho * FUNCTION: AcpiUtRemoveReference
707 1.1.1.2.8.2 jruoho *
708 1.1.1.2.8.2 jruoho * PARAMETERS: Object - Object whose ref count will be decremented
709 1.1.1.2.8.2 jruoho *
710 1.1.1.2.8.2 jruoho * RETURN: None
711 1.1.1.2.8.2 jruoho *
712 1.1.1.2.8.2 jruoho * DESCRIPTION: Decrement the reference count of an ACPI internal object
713 1.1.1.2.8.2 jruoho *
714 1.1.1.2.8.2 jruoho ******************************************************************************/
715 1.1.1.2.8.2 jruoho
716 1.1.1.2.8.2 jruoho void
717 1.1.1.2.8.2 jruoho AcpiUtRemoveReference (
718 1.1.1.2.8.2 jruoho ACPI_OPERAND_OBJECT *Object)
719 1.1.1.2.8.2 jruoho {
720 1.1.1.2.8.2 jruoho
721 1.1.1.2.8.2 jruoho ACPI_FUNCTION_TRACE_PTR (UtRemoveReference, Object);
722 1.1.1.2.8.2 jruoho
723 1.1.1.2.8.2 jruoho
724 1.1.1.2.8.2 jruoho /*
725 1.1.1.2.8.2 jruoho * Allow a NULL pointer to be passed in, just ignore it. This saves
726 1.1.1.2.8.2 jruoho * each caller from having to check. Also, ignore NS nodes.
727 1.1.1.2.8.2 jruoho *
728 1.1.1.2.8.2 jruoho */
729 1.1.1.2.8.2 jruoho if (!Object ||
730 1.1.1.2.8.2 jruoho (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED))
731 1.1.1.2.8.2 jruoho
732 1.1.1.2.8.2 jruoho {
733 1.1.1.2.8.2 jruoho return_VOID;
734 1.1.1.2.8.2 jruoho }
735 1.1.1.2.8.2 jruoho
736 1.1.1.2.8.2 jruoho /* Ensure that we have a valid object */
737 1.1.1.2.8.2 jruoho
738 1.1.1.2.8.2 jruoho if (!AcpiUtValidInternalObject (Object))
739 1.1.1.2.8.2 jruoho {
740 1.1.1.2.8.2 jruoho return_VOID;
741 1.1.1.2.8.2 jruoho }
742 1.1.1.2.8.2 jruoho
743 1.1.1.2.8.2 jruoho ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
744 1.1.1.2.8.2 jruoho "Obj %p Current Refs=%X [To Be Decremented]\n",
745 1.1.1.2.8.2 jruoho Object, Object->Common.ReferenceCount));
746 1.1.1.2.8.2 jruoho
747 1.1.1.2.8.2 jruoho /*
748 1.1.1.2.8.2 jruoho * Decrement the reference count, and only actually delete the object
749 1.1.1.2.8.2 jruoho * if the reference count becomes 0. (Must also decrement the ref count
750 1.1.1.2.8.2 jruoho * of all subobjects!)
751 1.1.1.2.8.2 jruoho */
752 1.1.1.2.8.2 jruoho (void) AcpiUtUpdateObjectReference (Object, REF_DECREMENT);
753 1.1.1.2.8.2 jruoho return_VOID;
754 1.1.1.2.8.2 jruoho }
755 1.1.1.2.8.2 jruoho
756 1.1.1.2.8.2 jruoho
757