Print this page
update to acpica-unix2-20140114
acpica-unix2-20130823
PANKOVs restructure
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/intel/io/acpica/parser/psparse.c
+++ new/usr/src/common/acpica/components/parser/psparse.c
1 1 /******************************************************************************
2 2 *
3 3 * Module Name: psparse - Parser top level AML parse routines
4 4 *
5 5 *****************************************************************************/
6 6
7 7 /*
8 - * Copyright (C) 2000 - 2011, Intel Corp.
8 + * Copyright (C) 2000 - 2014, 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
↓ open down ↓ |
18 lines elided |
↑ open up ↑ |
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 /*
46 46 * Parse the AML and build an operation tree as most interpreters,
47 - * like Perl, do. Parsing is done by hand rather than with a YACC
47 + * like Perl, do. Parsing is done by hand rather than with a YACC
48 48 * generated parser to tightly constrain stack and dynamic memory
49 - * usage. At the same time, parsing is kept flexible and the code
49 + * usage. At the same time, parsing is kept flexible and the code
50 50 * fairly compact by parsing based on a list of AML opcode
51 51 * templates in AmlOpInfo[]
52 52 */
53 53
54 54 #include "acpi.h"
55 55 #include "accommon.h"
56 56 #include "acparser.h"
57 57 #include "acdispat.h"
58 58 #include "amlcode.h"
59 59 #include "acinterp.h"
60 60
61 61 #define _COMPONENT ACPI_PARSER
62 62 ACPI_MODULE_NAME ("psparse")
63 63
64 64
65 65 /*******************************************************************************
66 66 *
67 67 * FUNCTION: AcpiPsGetOpcodeSize
68 68 *
69 69 * PARAMETERS: Opcode - An AML opcode
70 70 *
71 71 * RETURN: Size of the opcode, in bytes (1 or 2)
72 72 *
73 73 * DESCRIPTION: Get the size of the current opcode.
74 74 *
75 75 ******************************************************************************/
76 76
77 77 UINT32
78 78 AcpiPsGetOpcodeSize (
79 79 UINT32 Opcode)
80 80 {
81 81
82 82 /* Extended (2-byte) opcode if > 255 */
83 83
84 84 if (Opcode > 0x00FF)
85 85 {
86 86 return (2);
87 87 }
88 88
89 89 /* Otherwise, just a single byte opcode */
90 90
91 91 return (1);
92 92 }
93 93
94 94
95 95 /*******************************************************************************
96 96 *
97 97 * FUNCTION: AcpiPsPeekOpcode
98 98 *
99 99 * PARAMETERS: ParserState - A parser state object
100 100 *
101 101 * RETURN: Next AML opcode
102 102 *
103 103 * DESCRIPTION: Get next AML opcode (without incrementing AML pointer)
104 104 *
105 105 ******************************************************************************/
106 106
107 107 UINT16
108 108 AcpiPsPeekOpcode (
109 109 ACPI_PARSE_STATE *ParserState)
110 110 {
111 111 UINT8 *Aml;
112 112 UINT16 Opcode;
113 113
114 114
115 115 Aml = ParserState->Aml;
116 116 Opcode = (UINT16) ACPI_GET8 (Aml);
117 117
118 118 if (Opcode == AML_EXTENDED_OP_PREFIX)
119 119 {
120 120 /* Extended opcode, get the second opcode byte */
121 121
122 122 Aml++;
123 123 Opcode = (UINT16) ((Opcode << 8) | ACPI_GET8 (Aml));
124 124 }
125 125
126 126 return (Opcode);
127 127 }
128 128
129 129
130 130 /*******************************************************************************
131 131 *
132 132 * FUNCTION: AcpiPsCompleteThisOp
133 133 *
134 134 * PARAMETERS: WalkState - Current State
135 135 * Op - Op to complete
136 136 *
137 137 * RETURN: Status
138 138 *
139 139 * DESCRIPTION: Perform any cleanup at the completion of an Op.
140 140 *
141 141 ******************************************************************************/
142 142
143 143 ACPI_STATUS
144 144 AcpiPsCompleteThisOp (
145 145 ACPI_WALK_STATE *WalkState,
146 146 ACPI_PARSE_OBJECT *Op)
147 147 {
148 148 ACPI_PARSE_OBJECT *Prev;
149 149 ACPI_PARSE_OBJECT *Next;
150 150 const ACPI_OPCODE_INFO *ParentInfo;
151 151 ACPI_PARSE_OBJECT *ReplacementOp = NULL;
152 152 ACPI_STATUS Status = AE_OK;
153 153
154 154
155 155 ACPI_FUNCTION_TRACE_PTR (PsCompleteThisOp, Op);
156 156
157 157
158 158 /* Check for null Op, can happen if AML code is corrupt */
159 159
160 160 if (!Op)
161 161 {
162 162 return_ACPI_STATUS (AE_OK); /* OK for now */
163 163 }
164 164
165 165 /* Delete this op and the subtree below it if asked to */
166 166
167 167 if (((WalkState->ParseFlags & ACPI_PARSE_TREE_MASK) != ACPI_PARSE_DELETE_TREE) ||
168 168 (WalkState->OpInfo->Class == AML_CLASS_ARGUMENT))
169 169 {
170 170 return_ACPI_STATUS (AE_OK);
171 171 }
172 172
173 173 /* Make sure that we only delete this subtree */
174 174
175 175 if (Op->Common.Parent)
176 176 {
177 177 Prev = Op->Common.Parent->Common.Value.Arg;
178 178 if (!Prev)
179 179 {
180 180 /* Nothing more to do */
181 181
182 182 goto Cleanup;
183 183 }
↓ open down ↓ |
124 lines elided |
↑ open up ↑ |
184 184
185 185 /*
186 186 * Check if we need to replace the operator and its subtree
187 187 * with a return value op (placeholder op)
188 188 */
189 189 ParentInfo = AcpiPsGetOpcodeInfo (Op->Common.Parent->Common.AmlOpcode);
190 190
191 191 switch (ParentInfo->Class)
192 192 {
193 193 case AML_CLASS_CONTROL:
194 +
194 195 break;
195 196
196 197 case AML_CLASS_CREATE:
197 -
198 198 /*
199 - * These opcodes contain TermArg operands. The current
199 + * These opcodes contain TermArg operands. The current
200 200 * op must be replaced by a placeholder return op
201 201 */
202 202 ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
203 203 if (!ReplacementOp)
204 204 {
205 205 Status = AE_NO_MEMORY;
206 206 }
207 207 break;
208 208
209 209 case AML_CLASS_NAMED_OBJECT:
210 -
211 210 /*
212 - * These opcodes contain TermArg operands. The current
211 + * These opcodes contain TermArg operands. The current
213 212 * op must be replaced by a placeholder return op
214 213 */
215 214 if ((Op->Common.Parent->Common.AmlOpcode == AML_REGION_OP) ||
216 215 (Op->Common.Parent->Common.AmlOpcode == AML_DATA_REGION_OP) ||
217 216 (Op->Common.Parent->Common.AmlOpcode == AML_BUFFER_OP) ||
218 217 (Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
219 218 (Op->Common.Parent->Common.AmlOpcode == AML_BANK_FIELD_OP) ||
220 219 (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP))
221 220 {
222 221 ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
223 222 if (!ReplacementOp)
224 223 {
225 224 Status = AE_NO_MEMORY;
226 225 }
227 226 }
228 227 else if ((Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) &&
229 228 (WalkState->PassNumber <= ACPI_IMODE_LOAD_PASS2))
230 229 {
231 230 if ((Op->Common.AmlOpcode == AML_BUFFER_OP) ||
232 231 (Op->Common.AmlOpcode == AML_PACKAGE_OP) ||
233 232 (Op->Common.AmlOpcode == AML_VAR_PACKAGE_OP))
234 233 {
235 234 ReplacementOp = AcpiPsAllocOp (Op->Common.AmlOpcode);
236 235 if (!ReplacementOp)
237 236 {
238 237 Status = AE_NO_MEMORY;
239 238 }
240 239 else
241 240 {
242 241 ReplacementOp->Named.Data = Op->Named.Data;
243 242 ReplacementOp->Named.Length = Op->Named.Length;
244 243 }
245 244 }
246 245 }
247 246 break;
248 247
249 248 default:
250 249
251 250 ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
252 251 if (!ReplacementOp)
253 252 {
254 253 Status = AE_NO_MEMORY;
255 254 }
256 255 }
257 256
258 257 /* We must unlink this op from the parent tree */
259 258
260 259 if (Prev == Op)
261 260 {
262 261 /* This op is the first in the list */
263 262
264 263 if (ReplacementOp)
265 264 {
266 265 ReplacementOp->Common.Parent = Op->Common.Parent;
267 266 ReplacementOp->Common.Value.Arg = NULL;
268 267 ReplacementOp->Common.Node = Op->Common.Node;
269 268 Op->Common.Parent->Common.Value.Arg = ReplacementOp;
270 269 ReplacementOp->Common.Next = Op->Common.Next;
271 270 }
272 271 else
273 272 {
274 273 Op->Common.Parent->Common.Value.Arg = Op->Common.Next;
275 274 }
276 275 }
277 276
278 277 /* Search the parent list */
279 278
280 279 else while (Prev)
281 280 {
282 281 /* Traverse all siblings in the parent's argument list */
283 282
284 283 Next = Prev->Common.Next;
285 284 if (Next == Op)
286 285 {
287 286 if (ReplacementOp)
288 287 {
289 288 ReplacementOp->Common.Parent = Op->Common.Parent;
290 289 ReplacementOp->Common.Value.Arg = NULL;
291 290 ReplacementOp->Common.Node = Op->Common.Node;
292 291 Prev->Common.Next = ReplacementOp;
293 292 ReplacementOp->Common.Next = Op->Common.Next;
294 293 Next = NULL;
295 294 }
296 295 else
297 296 {
298 297 Prev->Common.Next = Op->Common.Next;
299 298 Next = NULL;
300 299 }
301 300 }
302 301 Prev = Next;
303 302 }
304 303 }
305 304
306 305
307 306 Cleanup:
308 307
309 308 /* Now we can actually delete the subtree rooted at Op */
310 309
311 310 AcpiPsDeleteParseTree (Op);
312 311 return_ACPI_STATUS (Status);
313 312 }
314 313
315 314
316 315 /*******************************************************************************
317 316 *
318 317 * FUNCTION: AcpiPsNextParseState
319 318 *
320 319 * PARAMETERS: WalkState - Current state
321 320 * Op - Current parse op
322 321 * CallbackStatus - Status from previous operation
323 322 *
324 323 * RETURN: Status
325 324 *
326 325 * DESCRIPTION: Update the parser state based upon the return exception from
327 326 * the parser callback.
328 327 *
329 328 ******************************************************************************/
330 329
331 330 ACPI_STATUS
332 331 AcpiPsNextParseState (
333 332 ACPI_WALK_STATE *WalkState,
334 333 ACPI_PARSE_OBJECT *Op,
335 334 ACPI_STATUS CallbackStatus)
336 335 {
337 336 ACPI_PARSE_STATE *ParserState = &WalkState->ParserState;
338 337 ACPI_STATUS Status = AE_CTRL_PENDING;
339 338
340 339
341 340 ACPI_FUNCTION_TRACE_PTR (PsNextParseState, Op);
342 341
343 342
344 343 switch (CallbackStatus)
↓ open down ↓ |
122 lines elided |
↑ open up ↑ |
345 344 {
346 345 case AE_CTRL_TERMINATE:
347 346 /*
348 347 * A control method was terminated via a RETURN statement.
349 348 * The walk of this method is complete.
350 349 */
351 350 ParserState->Aml = ParserState->AmlEnd;
352 351 Status = AE_CTRL_TERMINATE;
353 352 break;
354 353
355 -
356 354 case AE_CTRL_BREAK:
357 355
358 356 ParserState->Aml = WalkState->AmlLastWhile;
359 357 WalkState->ControlState->Common.Value = FALSE;
360 358 Status = AE_CTRL_BREAK;
361 359 break;
362 360
363 -
364 361 case AE_CTRL_CONTINUE:
365 362
366 363 ParserState->Aml = WalkState->AmlLastWhile;
367 364 Status = AE_CTRL_CONTINUE;
368 365 break;
369 366
370 -
371 367 case AE_CTRL_PENDING:
372 368
373 369 ParserState->Aml = WalkState->AmlLastWhile;
374 370 break;
375 371
376 372 #if 0
377 373 case AE_CTRL_SKIP:
378 374
379 375 ParserState->Aml = ParserState->Scope->ParseScope.PkgEnd;
380 376 Status = AE_OK;
381 377 break;
382 378 #endif
↓ open down ↓ |
2 lines elided |
↑ open up ↑ |
383 379
384 380 case AE_CTRL_TRUE:
385 381 /*
386 382 * Predicate of an IF was true, and we are at the matching ELSE.
387 383 * Just close out this package
388 384 */
389 385 ParserState->Aml = AcpiPsGetNextPackageEnd (ParserState);
390 386 Status = AE_CTRL_PENDING;
391 387 break;
392 388
393 -
394 389 case AE_CTRL_FALSE:
395 390 /*
396 391 * Either an IF/WHILE Predicate was false or we encountered a BREAK
397 - * opcode. In both cases, we do not execute the rest of the
392 + * opcode. In both cases, we do not execute the rest of the
398 393 * package; We simply close out the parent (finishing the walk of
399 394 * this branch of the tree) and continue execution at the parent
400 395 * level.
401 396 */
402 397 ParserState->Aml = ParserState->Scope->ParseScope.PkgEnd;
403 398
404 399 /* In the case of a BREAK, just force a predicate (if any) to FALSE */
405 400
406 401 WalkState->ControlState->Common.Value = FALSE;
407 402 Status = AE_CTRL_END;
408 403 break;
409 404
410 -
411 405 case AE_CTRL_TRANSFER:
412 406
413 407 /* A method call (invocation) -- transfer control */
414 408
415 409 Status = AE_CTRL_TRANSFER;
416 410 WalkState->PrevOp = Op;
417 411 WalkState->MethodCallOp = Op;
418 412 WalkState->MethodCallNode = (Op->Common.Value.Arg)->Common.Node;
419 413
420 414 /* Will return value (if any) be used by the caller? */
421 415
422 416 WalkState->ReturnUsed = AcpiDsIsResultUsed (Op, WalkState);
423 417 break;
424 418
425 -
426 419 default:
427 420
428 421 Status = CallbackStatus;
429 422 if ((CallbackStatus & AE_CODE_MASK) == AE_CODE_CONTROL)
430 423 {
431 424 Status = AE_OK;
432 425 }
433 426 break;
434 427 }
435 428
436 429 return_ACPI_STATUS (Status);
437 430 }
438 431
439 432
440 433 /*******************************************************************************
441 434 *
442 435 * FUNCTION: AcpiPsParseAml
443 436 *
444 437 * PARAMETERS: WalkState - Current state
445 438 *
446 439 *
447 440 * RETURN: Status
448 441 *
449 442 * DESCRIPTION: Parse raw AML and return a tree of ops
450 443 *
451 444 ******************************************************************************/
452 445
453 446 ACPI_STATUS
454 447 AcpiPsParseAml (
455 448 ACPI_WALK_STATE *WalkState)
456 449 {
457 450 ACPI_STATUS Status;
458 451 ACPI_THREAD_STATE *Thread;
459 452 ACPI_THREAD_STATE *PrevWalkList = AcpiGbl_CurrentWalkList;
460 453 ACPI_WALK_STATE *PreviousWalkState;
461 454
462 455
463 456 ACPI_FUNCTION_TRACE (PsParseAml);
464 457
465 458 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
466 459 "Entered with WalkState=%p Aml=%p size=%X\n",
467 460 WalkState, WalkState->ParserState.Aml,
468 461 WalkState->ParserState.AmlSize));
469 462
470 463 if (!WalkState->ParserState.Aml)
471 464 {
472 465 return_ACPI_STATUS (AE_NULL_OBJECT);
473 466 }
474 467
475 468 /* Create and initialize a new thread state */
476 469
477 470 Thread = AcpiUtCreateThreadState ();
478 471 if (!Thread)
479 472 {
480 473 if (WalkState->MethodDesc)
481 474 {
482 475 /* Executing a control method - additional cleanup */
483 476
484 477 AcpiDsTerminateControlMethod (WalkState->MethodDesc, WalkState);
485 478 }
486 479
487 480 AcpiDsDeleteWalkState (WalkState);
488 481 return_ACPI_STATUS (AE_NO_MEMORY);
489 482 }
490 483
491 484 WalkState->Thread = Thread;
492 485
493 486 /*
494 487 * If executing a method, the starting SyncLevel is this method's
495 488 * SyncLevel
496 489 */
497 490 if (WalkState->MethodDesc)
498 491 {
499 492 WalkState->Thread->CurrentSyncLevel = WalkState->MethodDesc->Method.SyncLevel;
500 493 }
↓ open down ↓ |
65 lines elided |
↑ open up ↑ |
501 494
502 495 AcpiDsPushWalkState (WalkState, Thread);
503 496
504 497 /*
505 498 * This global allows the AML debugger to get a handle to the currently
506 499 * executing control method.
507 500 */
508 501 AcpiGbl_CurrentWalkList = Thread;
509 502
510 503 /*
511 - * Execute the walk loop as long as there is a valid Walk State. This
504 + * Execute the walk loop as long as there is a valid Walk State. This
512 505 * handles nested control method invocations without recursion.
513 506 */
514 507 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "State=%p\n", WalkState));
515 508
516 509 Status = AE_OK;
517 510 while (WalkState)
518 511 {
519 512 if (ACPI_SUCCESS (Status))
520 513 {
521 514 /*
522 515 * The ParseLoop executes AML until the method terminates
523 516 * or calls another method.
524 517 */
525 518 Status = AcpiPsParseLoop (WalkState);
526 519 }
527 520
528 521 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
529 522 "Completed one call to walk loop, %s State=%p\n",
530 523 AcpiFormatException (Status), WalkState));
531 524
532 525 if (Status == AE_CTRL_TRANSFER)
533 526 {
534 527 /*
535 528 * A method call was detected.
536 529 * Transfer control to the called control method
537 530 */
538 531 Status = AcpiDsCallControlMethod (Thread, WalkState, NULL);
539 532 if (ACPI_FAILURE (Status))
540 533 {
541 534 Status = AcpiDsMethodError (Status, WalkState);
542 535 }
543 536
544 537 /*
545 538 * If the transfer to the new method method call worked, a new walk
546 539 * state was created -- get it
547 540 */
548 541 WalkState = AcpiDsGetCurrentWalkState (Thread);
549 542 continue;
550 543 }
551 544 else if (Status == AE_CTRL_TERMINATE)
552 545 {
553 546 Status = AE_OK;
554 547 }
555 548 else if ((Status != AE_OK) && (WalkState->MethodDesc))
556 549 {
557 550 /* Either the method parse or actual execution failed */
558 551
559 552 ACPI_ERROR_METHOD ("Method parse/execution failed",
560 553 WalkState->MethodNode, NULL, Status);
561 554
562 555 /* Check for possible multi-thread reentrancy problem */
563 556
564 557 if ((Status == AE_ALREADY_EXISTS) &&
565 558 (!(WalkState->MethodDesc->Method.InfoFlags & ACPI_METHOD_SERIALIZED)))
566 559 {
567 560 /*
568 561 * Method is not serialized and tried to create an object
569 562 * twice. The probable cause is that the method cannot
570 563 * handle reentrancy. Mark as "pending serialized" now, and
571 564 * then mark "serialized" when the last thread exits.
572 565 */
573 566 WalkState->MethodDesc->Method.InfoFlags |=
574 567 ACPI_METHOD_SERIALIZED_PENDING;
575 568 }
576 569 }
577 570
578 571 /* We are done with this walk, move on to the parent if any */
579 572
580 573 WalkState = AcpiDsPopWalkState (Thread);
581 574
582 575 /* Reset the current scope to the beginning of scope stack */
583 576
584 577 AcpiDsScopeStackClear (WalkState);
585 578
586 579 /*
587 580 * If we just returned from the execution of a control method or if we
588 581 * encountered an error during the method parse phase, there's lots of
589 582 * cleanup to do
590 583 */
591 584 if (((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) ||
592 585 (ACPI_FAILURE (Status)))
593 586 {
594 587 AcpiDsTerminateControlMethod (WalkState->MethodDesc, WalkState);
595 588 }
596 589
597 590 /* Delete this walk state and all linked control states */
598 591
599 592 AcpiPsCleanupScope (&WalkState->ParserState);
600 593 PreviousWalkState = WalkState;
601 594
602 595 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
603 596 "ReturnValue=%p, ImplicitValue=%p State=%p\n",
604 597 WalkState->ReturnDesc, WalkState->ImplicitReturnObj, WalkState));
605 598
606 599 /* Check if we have restarted a preempted walk */
607 600
608 601 WalkState = AcpiDsGetCurrentWalkState (Thread);
609 602 if (WalkState)
610 603 {
611 604 if (ACPI_SUCCESS (Status))
612 605 {
613 606 /*
614 607 * There is another walk state, restart it.
615 608 * If the method return value is not used by the parent,
616 609 * The object is deleted
617 610 */
618 611 if (!PreviousWalkState->ReturnDesc)
619 612 {
620 613 /*
621 614 * In slack mode execution, if there is no return value
622 615 * we should implicitly return zero (0) as a default value.
623 616 */
624 617 if (AcpiGbl_EnableInterpreterSlack &&
625 618 !PreviousWalkState->ImplicitReturnObj)
626 619 {
627 620 PreviousWalkState->ImplicitReturnObj =
628 621 AcpiUtCreateIntegerObject ((UINT64) 0);
629 622 if (!PreviousWalkState->ImplicitReturnObj)
630 623 {
631 624 return_ACPI_STATUS (AE_NO_MEMORY);
632 625 }
633 626 }
634 627
635 628 /* Restart the calling control method */
636 629
637 630 Status = AcpiDsRestartControlMethod (WalkState,
638 631 PreviousWalkState->ImplicitReturnObj);
639 632 }
640 633 else
641 634 {
642 635 /*
643 636 * We have a valid return value, delete any implicit
644 637 * return value.
645 638 */
646 639 AcpiDsClearImplicitReturn (PreviousWalkState);
647 640
648 641 Status = AcpiDsRestartControlMethod (WalkState,
649 642 PreviousWalkState->ReturnDesc);
650 643 }
651 644 if (ACPI_SUCCESS (Status))
652 645 {
653 646 WalkState->WalkType |= ACPI_WALK_METHOD_RESTART;
654 647 }
655 648 }
656 649 else
657 650 {
658 651 /* On error, delete any return object or implicit return */
659 652
660 653 AcpiUtRemoveReference (PreviousWalkState->ReturnDesc);
661 654 AcpiDsClearImplicitReturn (PreviousWalkState);
662 655 }
663 656 }
664 657
665 658 /*
666 659 * Just completed a 1st-level method, save the final internal return
667 660 * value (if any)
668 661 */
669 662 else if (PreviousWalkState->CallerReturnDesc)
670 663 {
671 664 if (PreviousWalkState->ImplicitReturnObj)
672 665 {
673 666 *(PreviousWalkState->CallerReturnDesc) =
674 667 PreviousWalkState->ImplicitReturnObj;
675 668 }
676 669 else
677 670 {
678 671 /* NULL if no return value */
679 672
680 673 *(PreviousWalkState->CallerReturnDesc) =
681 674 PreviousWalkState->ReturnDesc;
682 675 }
683 676 }
684 677 else
685 678 {
686 679 if (PreviousWalkState->ReturnDesc)
687 680 {
688 681 /* Caller doesn't want it, must delete it */
689 682
690 683 AcpiUtRemoveReference (PreviousWalkState->ReturnDesc);
691 684 }
692 685 if (PreviousWalkState->ImplicitReturnObj)
693 686 {
694 687 /* Caller doesn't want it, must delete it */
695 688
696 689 AcpiUtRemoveReference (PreviousWalkState->ImplicitReturnObj);
697 690 }
698 691 }
699 692
↓ open down ↓ |
178 lines elided |
↑ open up ↑ |
700 693 AcpiDsDeleteWalkState (PreviousWalkState);
701 694 }
702 695
703 696 /* Normal exit */
704 697
705 698 AcpiExReleaseAllMutexes (Thread);
706 699 AcpiUtDeleteGenericState (ACPI_CAST_PTR (ACPI_GENERIC_STATE, Thread));
707 700 AcpiGbl_CurrentWalkList = PrevWalkList;
708 701 return_ACPI_STATUS (Status);
709 702 }
710 -
711 -
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX