Print this page
acpica-unix2-20130823
PANKOVs restructure
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/intel/io/acpica/utilities/utstate.c
+++ new/usr/src/common/acpica/components/utilities/utstate.c
1 1 /*******************************************************************************
2 2 *
3 3 * Module Name: utstate - state object support procedures
4 4 *
5 5 ******************************************************************************/
6 6
7 7 /*
8 - * Copyright (C) 2000 - 2011, Intel Corp.
8 + * Copyright (C) 2000 - 2013, Intel Corp.
9 9 * All rights reserved.
10 10 *
11 11 * Redistribution and use in source and binary forms, with or without
12 12 * modification, are permitted provided that the following conditions
13 13 * are met:
14 14 * 1. Redistributions of source code must retain the above copyright
15 15 * notice, this list of conditions, and the following disclaimer,
16 16 * without modification.
17 17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 18 * substantially similar to the "NO WARRANTY" disclaimer below
19 19 * ("Disclaimer") and any redistribution must be conditioned upon
20 20 * including a substantially similar Disclaimer requirement for further
21 21 * binary redistribution.
22 22 * 3. Neither the names of the above-listed copyright holders nor the names
23 23 * of any contributors may be used to endorse or promote products derived
24 24 * from this software without specific prior written permission.
25 25 *
26 26 * Alternatively, this software may be distributed under the terms of the
27 27 * GNU General Public License ("GPL") version 2 as published by the Free
28 28 * Software Foundation.
29 29 *
30 30 * NO WARRANTY
31 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 41 * POSSIBILITY OF SUCH DAMAGES.
42 42 */
43 43
44 44
45 45 #define __UTSTATE_C__
46 46
47 47 #include "acpi.h"
48 48 #include "accommon.h"
49 49
50 50 #define _COMPONENT ACPI_UTILITIES
51 51 ACPI_MODULE_NAME ("utstate")
52 52
53 53
54 54 /*******************************************************************************
55 55 *
56 56 * FUNCTION: AcpiUtCreatePkgStateAndPush
57 57 *
58 58 * PARAMETERS: Object - Object to be added to the new state
59 59 * Action - Increment/Decrement
60 60 * StateList - List the state will be added to
61 61 *
62 62 * RETURN: Status
63 63 *
64 64 * DESCRIPTION: Create a new state and push it
65 65 *
66 66 ******************************************************************************/
67 67
68 68 ACPI_STATUS
69 69 AcpiUtCreatePkgStateAndPush (
70 70 void *InternalObject,
71 71 void *ExternalObject,
72 72 UINT16 Index,
73 73 ACPI_GENERIC_STATE **StateList)
74 74 {
75 75 ACPI_GENERIC_STATE *State;
76 76
77 77
78 78 ACPI_FUNCTION_ENTRY ();
79 79
80 80
81 81 State = AcpiUtCreatePkgState (InternalObject, ExternalObject, Index);
82 82 if (!State)
83 83 {
84 84 return (AE_NO_MEMORY);
85 85 }
86 86
87 87 AcpiUtPushGenericState (StateList, State);
88 88 return (AE_OK);
89 89 }
90 90
91 91
92 92 /*******************************************************************************
93 93 *
94 94 * FUNCTION: AcpiUtPushGenericState
95 95 *
96 96 * PARAMETERS: ListHead - Head of the state stack
97 97 * State - State object to push
98 98 *
99 99 * RETURN: None
↓ open down ↓ |
81 lines elided |
↑ open up ↑ |
100 100 *
101 101 * DESCRIPTION: Push a state object onto a state stack
102 102 *
103 103 ******************************************************************************/
104 104
105 105 void
106 106 AcpiUtPushGenericState (
107 107 ACPI_GENERIC_STATE **ListHead,
108 108 ACPI_GENERIC_STATE *State)
109 109 {
110 - ACPI_FUNCTION_TRACE (UtPushGenericState);
110 + ACPI_FUNCTION_ENTRY ();
111 111
112 112
113 113 /* Push the state object onto the front of the list (stack) */
114 114
115 115 State->Common.Next = *ListHead;
116 116 *ListHead = State;
117 -
118 - return_VOID;
117 + return;
119 118 }
120 119
121 120
122 121 /*******************************************************************************
123 122 *
124 123 * FUNCTION: AcpiUtPopGenericState
125 124 *
126 125 * PARAMETERS: ListHead - Head of the state stack
127 126 *
128 127 * RETURN: The popped state object
129 128 *
130 129 * DESCRIPTION: Pop a state object from a state stack
↓ open down ↓ |
2 lines elided |
↑ open up ↑ |
131 130 *
132 131 ******************************************************************************/
133 132
134 133 ACPI_GENERIC_STATE *
135 134 AcpiUtPopGenericState (
136 135 ACPI_GENERIC_STATE **ListHead)
137 136 {
138 137 ACPI_GENERIC_STATE *State;
139 138
140 139
141 - ACPI_FUNCTION_TRACE (UtPopGenericState);
140 + ACPI_FUNCTION_ENTRY ();
142 141
143 142
144 143 /* Remove the state object at the head of the list (stack) */
145 144
146 145 State = *ListHead;
147 146 if (State)
148 147 {
149 148 /* Update the list head */
150 149
151 150 *ListHead = State->Common.Next;
152 151 }
153 152
154 - return_PTR (State);
153 + return (State);
155 154 }
156 155
157 156
158 157 /*******************************************************************************
159 158 *
160 159 * FUNCTION: AcpiUtCreateGenericState
161 160 *
162 161 * PARAMETERS: None
163 162 *
164 163 * RETURN: The new state object. NULL on failure.
165 164 *
166 - * DESCRIPTION: Create a generic state object. Attempt to obtain one from
165 + * DESCRIPTION: Create a generic state object. Attempt to obtain one from
167 166 * the global state cache; If none available, create a new one.
168 167 *
169 168 ******************************************************************************/
170 169
171 170 ACPI_GENERIC_STATE *
172 171 AcpiUtCreateGenericState (
173 172 void)
174 173 {
175 174 ACPI_GENERIC_STATE *State;
176 175
177 176
178 177 ACPI_FUNCTION_ENTRY ();
179 178
180 179
181 180 State = AcpiOsAcquireObject (AcpiGbl_StateCache);
182 181 if (State)
183 182 {
184 183 /* Initialize */
185 184 State->Common.DescriptorType = ACPI_DESC_TYPE_STATE;
186 185 }
187 186
188 187 return (State);
189 188 }
190 189
191 190
192 191 /*******************************************************************************
193 192 *
194 193 * FUNCTION: AcpiUtCreateThreadState
195 194 *
196 195 * PARAMETERS: None
197 196 *
198 197 * RETURN: New Thread State. NULL on failure
199 198 *
200 199 * DESCRIPTION: Create a "Thread State" - a flavor of the generic state used
201 200 * to track per-thread info during method execution
↓ open down ↓ |
25 lines elided |
↑ open up ↑ |
202 201 *
203 202 ******************************************************************************/
204 203
205 204 ACPI_THREAD_STATE *
206 205 AcpiUtCreateThreadState (
207 206 void)
208 207 {
209 208 ACPI_GENERIC_STATE *State;
210 209
211 210
212 - ACPI_FUNCTION_TRACE (UtCreateThreadState);
211 + ACPI_FUNCTION_ENTRY ();
213 212
214 213
215 214 /* Create the generic state object */
216 215
217 216 State = AcpiUtCreateGenericState ();
218 217 if (!State)
219 218 {
220 - return_PTR (NULL);
219 + return (NULL);
221 220 }
222 221
223 222 /* Init fields specific to the update struct */
224 223
225 224 State->Common.DescriptorType = ACPI_DESC_TYPE_STATE_THREAD;
226 225 State->Thread.ThreadId = AcpiOsGetThreadId ();
227 226
228 227 /* Check for invalid thread ID - zero is very bad, it will break things */
229 228
230 229 if (!State->Thread.ThreadId)
231 230 {
232 231 ACPI_ERROR ((AE_INFO, "Invalid zero ID from AcpiOsGetThreadId"));
233 232 State->Thread.ThreadId = (ACPI_THREAD_ID) 1;
234 233 }
235 234
236 - return_PTR ((ACPI_THREAD_STATE *) State);
235 + return ((ACPI_THREAD_STATE *) State);
237 236 }
238 237
239 238
240 239 /*******************************************************************************
241 240 *
242 241 * FUNCTION: AcpiUtCreateUpdateState
243 242 *
244 243 * PARAMETERS: Object - Initial Object to be installed in the state
245 244 * Action - Update action to be performed
246 245 *
247 246 * RETURN: New state object, null on failure
248 247 *
249 248 * DESCRIPTION: Create an "Update State" - a flavor of the generic state used
250 249 * to update reference counts and delete complex objects such
251 250 * as packages.
252 251 *
↓ open down ↓ |
6 lines elided |
↑ open up ↑ |
253 252 ******************************************************************************/
254 253
255 254 ACPI_GENERIC_STATE *
256 255 AcpiUtCreateUpdateState (
257 256 ACPI_OPERAND_OBJECT *Object,
258 257 UINT16 Action)
259 258 {
260 259 ACPI_GENERIC_STATE *State;
261 260
262 261
263 - ACPI_FUNCTION_TRACE_PTR (UtCreateUpdateState, Object);
262 + ACPI_FUNCTION_ENTRY ();
264 263
265 264
266 265 /* Create the generic state object */
267 266
268 267 State = AcpiUtCreateGenericState ();
269 268 if (!State)
270 269 {
271 - return_PTR (NULL);
270 + return (NULL);
272 271 }
273 272
274 273 /* Init fields specific to the update struct */
275 274
276 275 State->Common.DescriptorType = ACPI_DESC_TYPE_STATE_UPDATE;
277 276 State->Update.Object = Object;
278 277 State->Update.Value = Action;
279 -
280 - return_PTR (State);
278 + return (State);
281 279 }
282 280
283 281
284 282 /*******************************************************************************
285 283 *
286 284 * FUNCTION: AcpiUtCreatePkgState
287 285 *
288 286 * PARAMETERS: Object - Initial Object to be installed in the state
289 287 * Action - Update action to be performed
290 288 *
291 289 * RETURN: New state object, null on failure
292 290 *
293 291 * DESCRIPTION: Create a "Package State"
294 292 *
295 293 ******************************************************************************/
↓ open down ↓ |
5 lines elided |
↑ open up ↑ |
296 294
297 295 ACPI_GENERIC_STATE *
298 296 AcpiUtCreatePkgState (
299 297 void *InternalObject,
300 298 void *ExternalObject,
301 299 UINT16 Index)
302 300 {
303 301 ACPI_GENERIC_STATE *State;
304 302
305 303
306 - ACPI_FUNCTION_TRACE_PTR (UtCreatePkgState, InternalObject);
304 + ACPI_FUNCTION_ENTRY ();
307 305
308 306
309 307 /* Create the generic state object */
310 308
311 309 State = AcpiUtCreateGenericState ();
312 310 if (!State)
313 311 {
314 - return_PTR (NULL);
312 + return (NULL);
315 313 }
316 314
317 315 /* Init fields specific to the update struct */
318 316
319 317 State->Common.DescriptorType = ACPI_DESC_TYPE_STATE_PACKAGE;
320 318 State->Pkg.SourceObject = (ACPI_OPERAND_OBJECT *) InternalObject;
321 319 State->Pkg.DestObject = ExternalObject;
322 320 State->Pkg.Index= Index;
323 321 State->Pkg.NumPackages = 1;
324 -
325 - return_PTR (State);
322 + return (State);
326 323 }
327 324
328 325
329 326 /*******************************************************************************
330 327 *
331 328 * FUNCTION: AcpiUtCreateControlState
332 329 *
333 330 * PARAMETERS: None
334 331 *
335 332 * RETURN: New state object, null on failure
336 333 *
337 334 * DESCRIPTION: Create a "Control State" - a flavor of the generic state used
338 335 * to support nested IF/WHILE constructs in the AML.
↓ open down ↓ |
3 lines elided |
↑ open up ↑ |
339 336 *
340 337 ******************************************************************************/
341 338
342 339 ACPI_GENERIC_STATE *
343 340 AcpiUtCreateControlState (
344 341 void)
345 342 {
346 343 ACPI_GENERIC_STATE *State;
347 344
348 345
349 - ACPI_FUNCTION_TRACE (UtCreateControlState);
346 + ACPI_FUNCTION_ENTRY ();
350 347
351 348
352 349 /* Create the generic state object */
353 350
354 351 State = AcpiUtCreateGenericState ();
355 352 if (!State)
356 353 {
357 - return_PTR (NULL);
354 + return (NULL);
358 355 }
359 356
360 357 /* Init fields specific to the control struct */
361 358
362 359 State->Common.DescriptorType = ACPI_DESC_TYPE_STATE_CONTROL;
363 360 State->Common.State = ACPI_CONTROL_CONDITIONAL_EXECUTING;
364 -
365 - return_PTR (State);
361 + return (State);
366 362 }
367 363
368 364
369 365 /*******************************************************************************
370 366 *
371 367 * FUNCTION: AcpiUtDeleteGenericState
372 368 *
373 369 * PARAMETERS: State - The state object to be deleted
374 370 *
375 371 * RETURN: None
376 372 *
377 373 * DESCRIPTION: Release a state object to the state cache. NULL state objects
378 374 * are ignored.
379 375 *
380 376 ******************************************************************************/
381 377
382 378 void
383 379 AcpiUtDeleteGenericState (
384 380 ACPI_GENERIC_STATE *State)
385 381 {
386 - ACPI_FUNCTION_TRACE (UtDeleteGenericState);
382 + ACPI_FUNCTION_ENTRY ();
387 383
388 384
389 385 /* Ignore null state */
390 386
391 387 if (State)
392 388 {
393 389 (void) AcpiOsReleaseObject (AcpiGbl_StateCache, State);
394 390 }
395 - return_VOID;
391 + return;
396 392 }
397 -
398 -
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX