ReactOS  0.4.14-dev-317-g96040ec
psobject.c
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * Module Name: psobject - Support for parse objects
4  *
5  *****************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2019, Intel Corp.
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  * notice, this list of conditions, and the following disclaimer,
16  * without modification.
17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18  * substantially similar to the "NO WARRANTY" disclaimer below
19  * ("Disclaimer") and any redistribution must be conditioned upon
20  * including a substantially similar Disclaimer requirement for further
21  * binary redistribution.
22  * 3. Neither the names of the above-listed copyright holders nor the names
23  * of any contributors may be used to endorse or promote products derived
24  * from this software without specific prior written permission.
25  *
26  * Alternatively, this software may be distributed under the terms of the
27  * GNU General Public License ("GPL") version 2 as published by the Free
28  * Software Foundation.
29  *
30  * NO WARRANTY
31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41  * POSSIBILITY OF SUCH DAMAGES.
42  */
43 
44 #include "acpi.h"
45 #include "accommon.h"
46 #include "acparser.h"
47 #include "amlcode.h"
48 #include "acconvert.h"
49 #include "acnamesp.h"
50 
51 #define _COMPONENT ACPI_PARSER
52  ACPI_MODULE_NAME ("psobject")
53 
54 
55 /* Local prototypes */
56 
57 static ACPI_STATUS
59  ACPI_WALK_STATE *WalkState);
60 
61 
62 /*******************************************************************************
63  *
64  * FUNCTION: AcpiPsGetAmlOpcode
65  *
66  * PARAMETERS: WalkState - Current state
67  *
68  * RETURN: Status
69  *
70  * DESCRIPTION: Extract the next AML opcode from the input stream.
71  *
72  ******************************************************************************/
73 
74 static ACPI_STATUS
76  ACPI_WALK_STATE *WalkState)
77 {
78  ACPI_ERROR_ONLY (UINT32 AmlOffset);
79 
80 
81  ACPI_FUNCTION_TRACE_PTR (PsGetAmlOpcode, WalkState);
82 
83 
84  WalkState->Aml = WalkState->ParserState.Aml;
85  WalkState->Opcode = AcpiPsPeekOpcode (&(WalkState->ParserState));
86 
87  /*
88  * First cut to determine what we have found:
89  * 1) A valid AML opcode
90  * 2) A name string
91  * 3) An unknown/invalid opcode
92  */
93  WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode);
94 
95  switch (WalkState->OpInfo->Class)
96  {
97  case AML_CLASS_ASCII:
98  case AML_CLASS_PREFIX:
99  /*
100  * Starts with a valid prefix or ASCII char, this is a name
101  * string. Convert the bare name string to a namepath.
102  */
103  WalkState->Opcode = AML_INT_NAMEPATH_OP;
104  WalkState->ArgTypes = ARGP_NAMESTRING;
105  break;
106 
107  case AML_CLASS_UNKNOWN:
108 
109  /* The opcode is unrecognized. Complain and skip unknown opcodes */
110 
111  if (WalkState->PassNumber == 2)
112  {
113  ACPI_ERROR_ONLY(AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->Aml,
114  WalkState->ParserState.AmlStart));
115 
117  "Unknown opcode 0x%.2X at table offset 0x%.4X, ignoring",
118  WalkState->Opcode,
119  (UINT32) (AmlOffset + sizeof (ACPI_TABLE_HEADER))));
120 
121  ACPI_DUMP_BUFFER ((WalkState->ParserState.Aml - 16), 48);
122 
123 #ifdef ACPI_ASL_COMPILER
124  /*
125  * This is executed for the disassembler only. Output goes
126  * to the disassembled ASL output file.
127  */
128  AcpiOsPrintf (
129  "/*\nError: Unknown opcode 0x%.2X at table offset 0x%.4X, context:\n",
130  WalkState->Opcode,
131  (UINT32) (AmlOffset + sizeof (ACPI_TABLE_HEADER)));
132 
134  "Aborting disassembly, AML byte code is corrupt"));
135 
136  /* Dump the context surrounding the invalid opcode */
137 
138  AcpiUtDumpBuffer (((UINT8 *) WalkState->ParserState.Aml - 16),
139  48, DB_BYTE_DISPLAY,
140  (AmlOffset + sizeof (ACPI_TABLE_HEADER) - 16));
141  AcpiOsPrintf (" */\n");
142 
143  /*
144  * Just abort the disassembly, cannot continue because the
145  * parser is essentially lost. The disassembler can then
146  * randomly fail because an ill-constructed parse tree
147  * can result.
148  */
150 #endif
151  }
152 
153  /* Increment past one-byte or two-byte opcode */
154 
155  WalkState->ParserState.Aml++;
156  if (WalkState->Opcode > 0xFF) /* Can only happen if first byte is 0x5B */
157  {
158  WalkState->ParserState.Aml++;
159  }
160 
162 
163  default:
164 
165  /* Found opcode info, this is a normal opcode */
166 
167  WalkState->ParserState.Aml +=
168  AcpiPsGetOpcodeSize (WalkState->Opcode);
169  WalkState->ArgTypes = WalkState->OpInfo->ParseArgs;
170  break;
171  }
172 
174 }
175 
176 
177 /*******************************************************************************
178  *
179  * FUNCTION: AcpiPsBuildNamedOp
180  *
181  * PARAMETERS: WalkState - Current state
182  * AmlOpStart - Begin of named Op in AML
183  * UnnamedOp - Early Op (not a named Op)
184  * Op - Returned Op
185  *
186  * RETURN: Status
187  *
188  * DESCRIPTION: Parse a named Op
189  *
190  ******************************************************************************/
191 
194  ACPI_WALK_STATE *WalkState,
195  UINT8 *AmlOpStart,
196  ACPI_PARSE_OBJECT *UnnamedOp,
197  ACPI_PARSE_OBJECT **Op)
198 {
200  ACPI_PARSE_OBJECT *Arg = NULL;
201 
202 
203  ACPI_FUNCTION_TRACE_PTR (PsBuildNamedOp, WalkState);
204 
205 
206  UnnamedOp->Common.Value.Arg = NULL;
207  UnnamedOp->Common.ArgListLength = 0;
208  UnnamedOp->Common.AmlOpcode = WalkState->Opcode;
209 
210  /*
211  * Get and append arguments until we find the node that contains
212  * the name (the type ARGP_NAME).
213  */
214  while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) &&
215  (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) != ARGP_NAME))
216  {
217  ASL_CV_CAPTURE_COMMENTS (WalkState);
218  Status = AcpiPsGetNextArg (WalkState, &(WalkState->ParserState),
219  GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg);
220  if (ACPI_FAILURE (Status))
221  {
223  }
224 
225  AcpiPsAppendArg (UnnamedOp, Arg);
226  INCREMENT_ARG_LIST (WalkState->ArgTypes);
227  }
228 
229  /* are there any inline comments associated with the NameSeg?? If so, save this. */
230 
231  ASL_CV_CAPTURE_COMMENTS (WalkState);
232 
233 #ifdef ACPI_ASL_COMPILER
234  if (AcpiGbl_CurrentInlineComment != NULL)
235  {
236  UnnamedOp->Common.NameComment = AcpiGbl_CurrentInlineComment;
237  AcpiGbl_CurrentInlineComment = NULL;
238  }
239 #endif
240 
241  /*
242  * Make sure that we found a NAME and didn't run out of arguments
243  */
244  if (!GET_CURRENT_ARG_TYPE (WalkState->ArgTypes))
245  {
247  }
248 
249  /* We know that this arg is a name, move to next arg */
250 
251  INCREMENT_ARG_LIST (WalkState->ArgTypes);
252 
253  /*
254  * Find the object. This will either insert the object into
255  * the namespace or simply look it up
256  */
257  WalkState->Op = NULL;
258 
259  Status = WalkState->DescendingCallback (WalkState, Op);
260  if (ACPI_FAILURE (Status))
261  {
262  if (Status != AE_CTRL_TERMINATE)
263  {
264  ACPI_EXCEPTION ((AE_INFO, Status, "During name lookup/catalog"));
265  }
267  }
268 
269  if (!*Op)
270  {
272  }
273 
274  Status = AcpiPsNextParseState (WalkState, *Op, Status);
275  if (ACPI_FAILURE (Status))
276  {
277  if (Status == AE_CTRL_PENDING)
278  {
280  }
282  }
283 
284  AcpiPsAppendArg (*Op, UnnamedOp->Common.Value.Arg);
285 
286 #ifdef ACPI_ASL_COMPILER
287 
288  /* save any comments that might be associated with UnnamedOp. */
289 
290  (*Op)->Common.InlineComment = UnnamedOp->Common.InlineComment;
291  (*Op)->Common.EndNodeComment = UnnamedOp->Common.EndNodeComment;
292  (*Op)->Common.CloseBraceComment = UnnamedOp->Common.CloseBraceComment;
293  (*Op)->Common.NameComment = UnnamedOp->Common.NameComment;
294  (*Op)->Common.CommentList = UnnamedOp->Common.CommentList;
295  (*Op)->Common.EndBlkComment = UnnamedOp->Common.EndBlkComment;
296  (*Op)->Common.CvFilename = UnnamedOp->Common.CvFilename;
297  (*Op)->Common.CvParentFilename = UnnamedOp->Common.CvParentFilename;
298  (*Op)->Named.Aml = UnnamedOp->Common.Aml;
299 
300  UnnamedOp->Common.InlineComment = NULL;
301  UnnamedOp->Common.EndNodeComment = NULL;
302  UnnamedOp->Common.CloseBraceComment = NULL;
303  UnnamedOp->Common.NameComment = NULL;
304  UnnamedOp->Common.CommentList = NULL;
305  UnnamedOp->Common.EndBlkComment = NULL;
306 #endif
307 
308  if ((*Op)->Common.AmlOpcode == AML_REGION_OP ||
309  (*Op)->Common.AmlOpcode == AML_DATA_REGION_OP)
310  {
311  /*
312  * Defer final parsing of an OperationRegion body, because we don't
313  * have enough info in the first pass to parse it correctly (i.e.,
314  * there may be method calls within the TermArg elements of the body.)
315  *
316  * However, we must continue parsing because the opregion is not a
317  * standalone package -- we don't know where the end is at this point.
318  *
319  * (Length is unknown until parse of the body complete)
320  */
321  (*Op)->Named.Data = AmlOpStart;
322  (*Op)->Named.Length = 0;
323  }
324 
326 }
327 
328 
329 /*******************************************************************************
330  *
331  * FUNCTION: AcpiPsCreateOp
332  *
333  * PARAMETERS: WalkState - Current state
334  * AmlOpStart - Op start in AML
335  * NewOp - Returned Op
336  *
337  * RETURN: Status
338  *
339  * DESCRIPTION: Get Op from AML
340  *
341  ******************************************************************************/
342 
345  ACPI_WALK_STATE *WalkState,
346  UINT8 *AmlOpStart,
347  ACPI_PARSE_OBJECT **NewOp)
348 {
350  ACPI_PARSE_OBJECT *Op;
351  ACPI_PARSE_OBJECT *NamedOp = NULL;
352  ACPI_PARSE_OBJECT *ParentScope;
353  UINT8 ArgumentCount;
354  const ACPI_OPCODE_INFO *OpInfo;
355 
356 
357  ACPI_FUNCTION_TRACE_PTR (PsCreateOp, WalkState);
358 
359 
360  Status = AcpiPsGetAmlOpcode (WalkState);
362  {
364  }
365  if (ACPI_FAILURE (Status))
366  {
368  }
369 
370  /* Create Op structure and append to parent's argument list */
371 
372  WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode);
373  Op = AcpiPsAllocOp (WalkState->Opcode, AmlOpStart);
374  if (!Op)
375  {
377  }
378 
379  if (WalkState->OpInfo->Flags & AML_NAMED)
380  {
381  Status = AcpiPsBuildNamedOp (WalkState, AmlOpStart, Op, &NamedOp);
382  AcpiPsFreeOp (Op);
383 
384 #ifdef ACPI_ASL_COMPILER
385  if (AcpiGbl_DisasmFlag && WalkState->Opcode == AML_EXTERNAL_OP &&
386  Status == AE_NOT_FOUND)
387  {
388  /*
389  * If parsing of AML_EXTERNAL_OP's name path fails, then skip
390  * past this opcode and keep parsing. This is a much better
391  * alternative than to abort the entire disassembler. At this
392  * point, the ParserState is at the end of the namepath of the
393  * external declaration opcode. Setting WalkState->Aml to
394  * WalkState->ParserState.Aml + 2 moves increments the
395  * WalkState->Aml past the object type and the paramcount of the
396  * external opcode.
397  */
398  WalkState->Aml = WalkState->ParserState.Aml + 2;
399  WalkState->ParserState.Aml = WalkState->Aml;
401  }
402 #endif
403  if (ACPI_FAILURE (Status))
404  {
406  }
407 
408  *NewOp = NamedOp;
410  }
411 
412  /* Not a named opcode, just allocate Op and append to parent */
413 
414  if (WalkState->OpInfo->Flags & AML_CREATE)
415  {
416  /*
417  * Backup to beginning of CreateXXXfield declaration
418  * BodyLength is unknown until we parse the body
419  */
420  Op->Named.Data = AmlOpStart;
421  Op->Named.Length = 0;
422  }
423 
424  if (WalkState->Opcode == AML_BANK_FIELD_OP)
425  {
426  /*
427  * Backup to beginning of BankField declaration
428  * BodyLength is unknown until we parse the body
429  */
430  Op->Named.Data = AmlOpStart;
431  Op->Named.Length = 0;
432  }
433 
434  ParentScope = AcpiPsGetParentScope (&(WalkState->ParserState));
435  AcpiPsAppendArg (ParentScope, Op);
436 
437  if (ParentScope)
438  {
439  OpInfo = AcpiPsGetOpcodeInfo (ParentScope->Common.AmlOpcode);
440  if (OpInfo->Flags & AML_HAS_TARGET)
441  {
442  ArgumentCount = AcpiPsGetArgumentCount (OpInfo->Type);
443  if (ParentScope->Common.ArgListLength > ArgumentCount)
444  {
445  Op->Common.Flags |= ACPI_PARSEOP_TARGET;
446  }
447  }
448 
449  /*
450  * Special case for both Increment() and Decrement(), where
451  * the lone argument is both a source and a target.
452  */
453  else if ((ParentScope->Common.AmlOpcode == AML_INCREMENT_OP) ||
454  (ParentScope->Common.AmlOpcode == AML_DECREMENT_OP))
455  {
456  Op->Common.Flags |= ACPI_PARSEOP_TARGET;
457  }
458  }
459 
460  if (WalkState->DescendingCallback != NULL)
461  {
462  /*
463  * Find the object. This will either insert the object into
464  * the namespace or simply look it up
465  */
466  WalkState->Op = *NewOp = Op;
467 
468  Status = WalkState->DescendingCallback (WalkState, &Op);
469  Status = AcpiPsNextParseState (WalkState, Op, Status);
470  if (Status == AE_CTRL_PENDING)
471  {
473  }
474  }
475 
477 }
478 
479 
480 /*******************************************************************************
481  *
482  * FUNCTION: AcpiPsCompleteOp
483  *
484  * PARAMETERS: WalkState - Current state
485  * Op - Returned Op
486  * Status - Parse status before complete Op
487  *
488  * RETURN: Status
489  *
490  * DESCRIPTION: Complete Op
491  *
492  ******************************************************************************/
493 
496  ACPI_WALK_STATE *WalkState,
497  ACPI_PARSE_OBJECT **Op,
499 {
500  ACPI_STATUS Status2;
501 
502 
503  ACPI_FUNCTION_TRACE_PTR (PsCompleteOp, WalkState);
504 
505 
506  /*
507  * Finished one argument of the containing scope
508  */
509  WalkState->ParserState.Scope->ParseScope.ArgCount--;
510 
511  /* Close this Op (will result in parse subtree deletion) */
512 
513  Status2 = AcpiPsCompleteThisOp (WalkState, *Op);
514  if (ACPI_FAILURE (Status2))
515  {
516  return_ACPI_STATUS (Status2);
517  }
518 
519  *Op = NULL;
520 
521  switch (Status)
522  {
523  case AE_OK:
524 
525  break;
526 
527  case AE_CTRL_TRANSFER:
528 
529  /* We are about to transfer to a called method */
530 
531  WalkState->PrevOp = NULL;
532  WalkState->PrevArgTypes = WalkState->ArgTypes;
534 
535  case AE_CTRL_END:
536 
537  AcpiPsPopScope (&(WalkState->ParserState), Op,
538  &WalkState->ArgTypes, &WalkState->ArgCount);
539 
540  if (*Op)
541  {
542  WalkState->Op = *Op;
543  WalkState->OpInfo = AcpiPsGetOpcodeInfo ((*Op)->Common.AmlOpcode);
544  WalkState->Opcode = (*Op)->Common.AmlOpcode;
545 
546  Status = WalkState->AscendingCallback (WalkState);
547  Status = AcpiPsNextParseState (WalkState, *Op, Status);
548 
549  Status2 = AcpiPsCompleteThisOp (WalkState, *Op);
550  if (ACPI_FAILURE (Status2))
551  {
552  return_ACPI_STATUS (Status2);
553  }
554  }
555 
556  Status = AE_OK;
557  break;
558 
559  case AE_CTRL_BREAK:
560  case AE_CTRL_CONTINUE:
561 
562  /* Pop off scopes until we find the While */
563 
564  while (!(*Op) || ((*Op)->Common.AmlOpcode != AML_WHILE_OP))
565  {
566  AcpiPsPopScope (&(WalkState->ParserState), Op,
567  &WalkState->ArgTypes, &WalkState->ArgCount);
568  }
569 
570  /* Close this iteration of the While loop */
571 
572  WalkState->Op = *Op;
573  WalkState->OpInfo = AcpiPsGetOpcodeInfo ((*Op)->Common.AmlOpcode);
574  WalkState->Opcode = (*Op)->Common.AmlOpcode;
575 
576  Status = WalkState->AscendingCallback (WalkState);
577  Status = AcpiPsNextParseState (WalkState, *Op, Status);
578 
579  Status2 = AcpiPsCompleteThisOp (WalkState, *Op);
580  if (ACPI_FAILURE (Status2))
581  {
582  return_ACPI_STATUS (Status2);
583  }
584 
585  Status = AE_OK;
586  break;
587 
588  case AE_CTRL_TERMINATE:
589 
590  /* Clean up */
591  do
592  {
593  if (*Op)
594  {
595  Status2 = AcpiPsCompleteThisOp (WalkState, *Op);
596  if (ACPI_FAILURE (Status2))
597  {
598  return_ACPI_STATUS (Status2);
599  }
600 
602  AcpiUtPopGenericState (&WalkState->ControlState));
603  }
604 
605  AcpiPsPopScope (&(WalkState->ParserState), Op,
606  &WalkState->ArgTypes, &WalkState->ArgCount);
607 
608  } while (*Op);
609 
611 
612  default: /* All other non-AE_OK status */
613 
614  do
615  {
616  if (*Op)
617  {
618  /*
619  * These Opcodes need to be removed from the namespace because they
620  * get created even if these opcodes cannot be created due to
621  * errors.
622  */
623  if (((*Op)->Common.AmlOpcode == AML_REGION_OP) ||
624  ((*Op)->Common.AmlOpcode == AML_DATA_REGION_OP))
625  {
626  AcpiNsDeleteChildren ((*Op)->Common.Node);
627  AcpiNsRemoveNode ((*Op)->Common.Node);
628  (*Op)->Common.Node = NULL;
629  AcpiPsDeleteParseTree (*Op);
630  }
631 
632  Status2 = AcpiPsCompleteThisOp (WalkState, *Op);
633  if (ACPI_FAILURE (Status2))
634  {
635  return_ACPI_STATUS (Status2);
636  }
637  }
638 
639  AcpiPsPopScope (&(WalkState->ParserState), Op,
640  &WalkState->ArgTypes, &WalkState->ArgCount);
641 
642  } while (*Op);
643 
644 
645 #if 0
646  /*
647  * TBD: Cleanup parse ops on error
648  */
649  if (*Op == NULL)
650  {
651  AcpiPsPopScope (ParserState, Op,
652  &WalkState->ArgTypes, &WalkState->ArgCount);
653  }
654 #endif
655  WalkState->PrevOp = NULL;
656  WalkState->PrevArgTypes = WalkState->ArgTypes;
657 
658  if (WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL)
659  {
660  /*
661  * There was something that went wrong while executing code at the
662  * module-level. We need to skip parsing whatever caused the
663  * error and keep going. One runtime error during the table load
664  * should not cause the entire table to not be loaded. This is
665  * because there could be correct AML beyond the parts that caused
666  * the runtime error.
667  */
668  ACPI_INFO (("Ignoring error and continuing table load"));
670  }
672  }
673 
674  /* This scope complete? */
675 
676  if (AcpiPsHasCompletedScope (&(WalkState->ParserState)))
677  {
678  AcpiPsPopScope (&(WalkState->ParserState), Op,
679  &WalkState->ArgTypes, &WalkState->ArgCount);
680  ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", *Op));
681  }
682  else
683  {
684  *Op = NULL;
685  }
686 
688 }
689 
690 
691 /*******************************************************************************
692  *
693  * FUNCTION: AcpiPsCompleteFinalOp
694  *
695  * PARAMETERS: WalkState - Current state
696  * Op - Current Op
697  * Status - Current parse status before complete last
698  * Op
699  *
700  * RETURN: Status
701  *
702  * DESCRIPTION: Complete last Op.
703  *
704  ******************************************************************************/
705 
708  ACPI_WALK_STATE *WalkState,
709  ACPI_PARSE_OBJECT *Op,
711 {
712  ACPI_STATUS Status2;
713 
714 
715  ACPI_FUNCTION_TRACE_PTR (PsCompleteFinalOp, WalkState);
716 
717 
718  /*
719  * Complete the last Op (if not completed), and clear the scope stack.
720  * It is easily possible to end an AML "package" with an unbounded number
721  * of open scopes (such as when several ASL blocks are closed with
722  * sequential closing braces). We want to terminate each one cleanly.
723  */
724  ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "AML package complete at Op %p\n", Op));
725  do
726  {
727  if (Op)
728  {
729  if (WalkState->AscendingCallback != NULL)
730  {
731  WalkState->Op = Op;
732  WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
733  WalkState->Opcode = Op->Common.AmlOpcode;
734 
735  Status = WalkState->AscendingCallback (WalkState);
736  Status = AcpiPsNextParseState (WalkState, Op, Status);
737  if (Status == AE_CTRL_PENDING)
738  {
739  Status = AcpiPsCompleteOp (WalkState, &Op, AE_OK);
740  if (ACPI_FAILURE (Status))
741  {
743  }
744  }
745 
746  if (Status == AE_CTRL_TERMINATE)
747  {
748  Status = AE_OK;
749 
750  /* Clean up */
751  do
752  {
753  if (Op)
754  {
755  Status2 = AcpiPsCompleteThisOp (WalkState, Op);
756  if (ACPI_FAILURE (Status2))
757  {
758  return_ACPI_STATUS (Status2);
759  }
760  }
761 
762  AcpiPsPopScope (&(WalkState->ParserState), &Op,
763  &WalkState->ArgTypes, &WalkState->ArgCount);
764 
765  } while (Op);
766 
768  }
769 
770  else if (ACPI_FAILURE (Status))
771  {
772  /* First error is most important */
773 
774  (void) AcpiPsCompleteThisOp (WalkState, Op);
776  }
777  }
778 
779  Status2 = AcpiPsCompleteThisOp (WalkState, Op);
780  if (ACPI_FAILURE (Status2))
781  {
782  return_ACPI_STATUS (Status2);
783  }
784  }
785 
786  AcpiPsPopScope (&(WalkState->ParserState), &Op, &WalkState->ArgTypes,
787  &WalkState->ArgCount);
788 
789  } while (Op);
790 
792 }
ACPI_STATUS AcpiPsCompleteOp(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT **Op, ACPI_STATUS Status)
Definition: psobject.c:495
void AcpiNsRemoveNode(ACPI_NAMESPACE_NODE *Node)
Definition: nsalloc.c:188
#define ACPI_EXCEPTION(plist)
Definition: acoutput.h:239
#define AML_CLASS_ASCII
Definition: amlcode.h:405
#define AE_CTRL_PARSE_PENDING
Definition: acexcep.h:235
#define AE_CTRL_END
Definition: acexcep.h:230
void AcpiPsDeleteParseTree(ACPI_PARSE_OBJECT *root)
Definition: pswalk.c:67
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
#define AML_NAMED
Definition: amlcode.h:323
void AcpiUtDeleteGenericState(ACPI_GENERIC_STATE *State)
Definition: utstate.c:340
ACPI_PARSE_OBJECT * PrevOp
Definition: acstruct.h:125
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define ARGP_NAMESTRING
Definition: amlcode.h:232
ACPI_STATE_COMMON UINT32 ArgCount
Definition: aclocal.h:748
void AcpiNsDeleteChildren(ACPI_NAMESPACE_NODE *Parent)
Definition: nsalloc.c:341
#define AML_CLASS_UNKNOWN
Definition: amlcode.h:410
#define ACPI_ERROR_ONLY(s)
Definition: acmacros.h:467
#define AE_NO_MEMORY
Definition: acexcep.h:112
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
#define ACPI_PARSEOP_TARGET
Definition: aclocal.h:1122
#define AML_WHILE_OP
Definition: amlcode.h:136
#define AML_CLASS_PREFIX
Definition: amlcode.h:406
ACPI_STATUS AcpiPsGetNextArg(ACPI_WALK_STATE *WalkState, ACPI_PARSE_STATE *ParserState, UINT32 ArgType, ACPI_PARSE_OBJECT **ReturnArg)
Definition: psargs.c:785
#define AE_AML_NO_OPERAND
Definition: acexcep.h:181
#define ACPI_PTR_DIFF(a, b)
Definition: actypes.h:548
UINT32 ArgTypes
Definition: acstruct.h:92
const ACPI_OPCODE_INFO * AcpiPsGetOpcodeInfo(UINT16 Opcode)
Definition: psopinfo.c:72
ACPI_PARSE_OBJECT * AcpiPsGetParentScope(ACPI_PARSE_STATE *state)
Definition: psscope.c:65
#define AE_CTRL_TRANSFER
Definition: acexcep.h:231
ACPI_PARSE_OBJECT * AcpiPsAllocOp(UINT16 Opcode, UINT8 *Aml)
Definition: psutils.c:130
UINT8 AcpiPsGetArgumentCount(UINT32 OpType)
Definition: psopinfo.c:203
#define ACPI_DB_PARSE
Definition: acoutput.h:162
UINT32 ParseFlags
Definition: acstruct.h:95
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_DUMP_BUFFER(a, b)
Definition: acoutput.h:489
ACPI_GENERIC_STATE * ControlState
Definition: acstruct.h:110
#define AML_EXTERNAL_OP
Definition: amlcode.h:65
#define AML_REGION_OP
Definition: amlcode.h:180
#define AML_INT_NAMEPATH_OP
Definition: amlcode.h:205
#define AE_CTRL_PENDING
Definition: acexcep.h:225
ACPI_GENERIC_STATE * AcpiUtPopGenericState(ACPI_GENERIC_STATE **ListHead)
Definition: utstate.c:93
#define ASL_CV_CAPTURE_COMMENTS(a)
Definition: acmacros.h:526
void AcpiPsPopScope(ACPI_PARSE_STATE *ParserState, ACPI_PARSE_OBJECT **Op, UINT32 *ArgList, UINT32 *ArgCount)
Definition: psscope.c:219
ACPI_PARSE_UPWARDS AscendingCallback
Definition: acstruct.h:129
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define AML_HAS_TARGET
Definition: amlcode.h:328
#define DB_BYTE_DISPLAY
Definition: acutils.h:185
#define AML_CREATE
Definition: amlcode.h:320
#define AE_CTRL_TERMINATE
Definition: acexcep.h:226
unsigned int UINT32
#define ACPI_MODULE_NAME(Name)
Definition: acoutput.h:216
#define AE_CTRL_PARSE_CONTINUE
Definition: acexcep.h:234
ACPI_STATUS AcpiPsCompleteFinalOp(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, ACPI_STATUS Status)
Definition: psobject.c:707
ACPI_STATUS AcpiPsNextParseState(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, ACPI_STATUS CallbackStatus)
Definition: psparse.c:337
smooth NULL
Definition: ftsmooth.c:416
#define AE_INFO
Definition: acoutput.h:230
#define AE_AML_BAD_OPCODE
Definition: acexcep.h:180
#define AE_CTRL_CONTINUE
Definition: acexcep.h:233
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
ACPI_STATUS AcpiPsCompleteThisOp(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
Definition: psparse.c:144
ACPI_PARSE_OBJ_NAMED Named
Definition: aclocal.h:1079
UINT16 AcpiPsPeekOpcode(ACPI_PARSE_STATE *state)
Definition: psparse.c:108
static ACPI_STATUS AcpiPsGetAmlOpcode(ACPI_WALK_STATE *WalkState)
Definition: psobject.c:75
#define AML_BANK_FIELD_OP
Definition: amlcode.h:187
ACPI_STATUS AcpiPsCreateOp(ACPI_WALK_STATE *WalkState, UINT8 *AmlOpStart, ACPI_PARSE_OBJECT **NewOp)
Definition: psobject.c:344
ACPI_PARSE_OBJECT * Op
Definition: acstruct.h:118
BOOLEAN AcpiPsHasCompletedScope(ACPI_PARSE_STATE *ParserState)
Definition: psscope.c:88
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
void AcpiPsAppendArg(ACPI_PARSE_OBJECT *op, ACPI_PARSE_OBJECT *arg)
Definition: pstree.c:138
#define AE_NOT_FOUND
Definition: acexcep.h:113
const ACPI_OPCODE_INFO * OpInfo
Definition: acstruct.h:119
ACPI_STATUS AcpiPsBuildNamedOp(ACPI_WALK_STATE *WalkState, UINT8 *AmlOpStart, ACPI_PARSE_OBJECT *UnnamedOp, ACPI_PARSE_OBJECT **Op)
Definition: psobject.c:193
void ACPI_INTERNAL_VAR_XFACE AcpiOsPrintf(const char *Format,...)
Definition: osl.c:851
ACPI_PARSE_STATE ParserState
Definition: acstruct.h:97
void AcpiUtDumpBuffer(UINT8 *Buffer, UINT32 Count, UINT32 Display, UINT32 Offset)
Definition: utbuffer.c:71
#define ACPI_INFO(plist)
Definition: acoutput.h:237
Status
Definition: gdiplustypes.h:24
ACPI_PARSE_DOWNWARDS DescendingCallback
Definition: acstruct.h:128
UINT32 ArgCount
Definition: acstruct.h:99
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define AE_CTRL_BREAK
Definition: acexcep.h:232
#define ACPI_PARSE_MODULE_LEVEL
Definition: acparser.h:67
#define GET_CURRENT_ARG_TYPE(List)
Definition: acmacros.h:450
#define INCREMENT_ARG_LIST(List)
Definition: acmacros.h:451
#define AML_DECREMENT_OP
Definition: amlcode.h:94
#define AML_INCREMENT_OP
Definition: amlcode.h:93
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
void AcpiPsFreeOp(ACPI_PARSE_OBJECT *Op)
Definition: psutils.c:212
ACPI_PSCOPE_STATE ParseScope
Definition: aclocal.h:826
union acpi_generic_state * Scope
Definition: aclocal.h:1108
UINT16 Opcode
Definition: acstruct.h:78
UINT32 PrevArgTypes
Definition: acstruct.h:98
unsigned char UINT8
#define ARGP_NAME
Definition: amlcode.h:231
#define AML_DATA_REGION_OP
Definition: amlcode.h:188
#define AE_OK
Definition: acexcep.h:97
UINT16 Flags
Definition: aclocal.h:873
UINT32 AcpiPsGetOpcodeSize(UINT32 Opcode)
Definition: psparse.c:78
UINT8 * Aml
Definition: acstruct.h:91