Indentation fix, cleanup.
[AROS.git] / arch / all-pc / acpica / source / components / disassembler / dmwalk.c
blob863471a04dae45397be076661be601f4344bff3b
1 /*******************************************************************************
3 * Module Name: dmwalk - AML disassembly tree walk
5 ******************************************************************************/
7 /*
8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved.
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.
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.
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.
45 #include "acpi.h"
46 #include "accommon.h"
47 #include "acparser.h"
48 #include "amlcode.h"
49 #include "acdisasm.h"
50 #include "acdebug.h"
53 #ifdef ACPI_DISASSEMBLER
55 #define _COMPONENT ACPI_CA_DEBUGGER
56 ACPI_MODULE_NAME ("dmwalk")
59 #define DB_FULL_OP_INFO "[%4.4s] @%5.5X #%4.4X: "
61 /* Stub for non-compiler code */
63 #ifndef ACPI_ASL_COMPILER
64 void
65 AcpiDmEmitExternals (
66 void)
68 return;
70 #endif
72 /* Local prototypes */
74 static ACPI_STATUS
75 AcpiDmDescendingOp (
76 ACPI_PARSE_OBJECT *Op,
77 UINT32 Level,
78 void *Context);
80 static ACPI_STATUS
81 AcpiDmAscendingOp (
82 ACPI_PARSE_OBJECT *Op,
83 UINT32 Level,
84 void *Context);
86 static UINT32
87 AcpiDmBlockType (
88 ACPI_PARSE_OBJECT *Op);
91 /*******************************************************************************
93 * FUNCTION: AcpiDmDisassemble
95 * PARAMETERS: WalkState - Current state
96 * Origin - Starting object
97 * NumOpcodes - Max number of opcodes to be displayed
99 * RETURN: None
101 * DESCRIPTION: Disassemble parser object and its children. This is the
102 * main entry point of the disassembler.
104 ******************************************************************************/
106 void
107 AcpiDmDisassemble (
108 ACPI_WALK_STATE *WalkState,
109 ACPI_PARSE_OBJECT *Origin,
110 UINT32 NumOpcodes)
112 ACPI_PARSE_OBJECT *Op = Origin;
113 ACPI_OP_WALK_INFO Info;
116 if (!Op)
118 return;
121 Info.Flags = 0;
122 Info.Level = 0;
123 Info.Count = 0;
124 Info.WalkState = WalkState;
125 AcpiDmWalkParseTree (Op, AcpiDmDescendingOp, AcpiDmAscendingOp, &Info);
126 return;
130 /*******************************************************************************
132 * FUNCTION: AcpiDmWalkParseTree
134 * PARAMETERS: Op - Root Op object
135 * DescendingCallback - Called during tree descent
136 * AscendingCallback - Called during tree ascent
137 * Context - To be passed to the callbacks
139 * RETURN: Status from callback(s)
141 * DESCRIPTION: Walk the entire parse tree.
143 ******************************************************************************/
145 void
146 AcpiDmWalkParseTree (
147 ACPI_PARSE_OBJECT *Op,
148 ASL_WALK_CALLBACK DescendingCallback,
149 ASL_WALK_CALLBACK AscendingCallback,
150 void *Context)
152 BOOLEAN NodePreviouslyVisited;
153 ACPI_PARSE_OBJECT *StartOp = Op;
154 ACPI_STATUS Status;
155 ACPI_PARSE_OBJECT *Next;
156 ACPI_OP_WALK_INFO *Info = Context;
159 Info->Level = 0;
160 NodePreviouslyVisited = FALSE;
162 while (Op)
164 if (NodePreviouslyVisited)
166 if (AscendingCallback)
168 Status = AscendingCallback (Op, Info->Level, Context);
169 if (ACPI_FAILURE (Status))
171 return;
175 else
177 /* Let the callback process the node */
179 Status = DescendingCallback (Op, Info->Level, Context);
180 if (ACPI_SUCCESS (Status))
182 /* Visit children first, once */
184 Next = AcpiPsGetArg (Op, 0);
185 if (Next)
187 Info->Level++;
188 Op = Next;
189 continue;
192 else if (Status != AE_CTRL_DEPTH)
194 /* Exit immediately on any error */
196 return;
200 /* Terminate walk at start op */
202 if (Op == StartOp)
204 break;
207 /* No more children, re-visit this node */
209 if (!NodePreviouslyVisited)
211 NodePreviouslyVisited = TRUE;
212 continue;
215 /* No more children, visit peers */
217 if (Op->Common.Next)
219 Op = Op->Common.Next;
220 NodePreviouslyVisited = FALSE;
222 else
224 /* No peers, re-visit parent */
226 if (Info->Level != 0 )
228 Info->Level--;
231 Op = Op->Common.Parent;
232 NodePreviouslyVisited = TRUE;
236 /* If we get here, the walk completed with no errors */
238 return;
242 /*******************************************************************************
244 * FUNCTION: AcpiDmBlockType
246 * PARAMETERS: Op - Object to be examined
248 * RETURN: BlockType - not a block, parens, braces, or even both.
250 * DESCRIPTION: Type of block for this op (parens or braces)
252 ******************************************************************************/
254 static UINT32
255 AcpiDmBlockType (
256 ACPI_PARSE_OBJECT *Op)
258 const ACPI_OPCODE_INFO *OpInfo;
261 if (!Op)
263 return (BLOCK_NONE);
266 switch (Op->Common.AmlOpcode)
268 case AML_ELSE_OP:
270 return (BLOCK_BRACE);
272 case AML_METHOD_OP:
273 case AML_DEVICE_OP:
274 case AML_SCOPE_OP:
275 case AML_PROCESSOR_OP:
276 case AML_POWER_RES_OP:
277 case AML_THERMAL_ZONE_OP:
278 case AML_IF_OP:
279 case AML_WHILE_OP:
280 case AML_FIELD_OP:
281 case AML_INDEX_FIELD_OP:
282 case AML_BANK_FIELD_OP:
284 return (BLOCK_PAREN | BLOCK_BRACE);
286 case AML_BUFFER_OP:
288 if (Op->Common.DisasmOpcode == ACPI_DASM_UNICODE)
290 return (BLOCK_NONE);
293 /*lint -fallthrough */
295 case AML_PACKAGE_OP:
296 case AML_VAR_PACKAGE_OP:
298 return (BLOCK_PAREN | BLOCK_BRACE);
300 case AML_EVENT_OP:
302 return (BLOCK_PAREN);
304 default:
306 OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
307 if (OpInfo->Flags & AML_HAS_ARGS)
309 return (BLOCK_PAREN);
312 return (BLOCK_NONE);
317 /*******************************************************************************
319 * FUNCTION: AcpiDmListType
321 * PARAMETERS: Op - Object to be examined
323 * RETURN: ListType - has commas or not.
325 * DESCRIPTION: Type of block for this op (parens or braces)
327 ******************************************************************************/
329 UINT32
330 AcpiDmListType (
331 ACPI_PARSE_OBJECT *Op)
333 const ACPI_OPCODE_INFO *OpInfo;
336 if (!Op)
338 return (BLOCK_NONE);
341 switch (Op->Common.AmlOpcode)
344 case AML_ELSE_OP:
345 case AML_METHOD_OP:
346 case AML_DEVICE_OP:
347 case AML_SCOPE_OP:
348 case AML_POWER_RES_OP:
349 case AML_PROCESSOR_OP:
350 case AML_THERMAL_ZONE_OP:
351 case AML_IF_OP:
352 case AML_WHILE_OP:
353 case AML_FIELD_OP:
354 case AML_INDEX_FIELD_OP:
355 case AML_BANK_FIELD_OP:
357 return (BLOCK_NONE);
359 case AML_BUFFER_OP:
360 case AML_PACKAGE_OP:
361 case AML_VAR_PACKAGE_OP:
363 return (BLOCK_COMMA_LIST);
365 default:
367 OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
368 if (OpInfo->Flags & AML_HAS_ARGS)
370 return (BLOCK_COMMA_LIST);
373 return (BLOCK_NONE);
378 /*******************************************************************************
380 * FUNCTION: AcpiDmDescendingOp
382 * PARAMETERS: ASL_WALK_CALLBACK
384 * RETURN: Status
386 * DESCRIPTION: First visitation of a parse object during tree descent.
387 * Decode opcode name and begin parameter list(s), if any.
389 ******************************************************************************/
391 static ACPI_STATUS
392 AcpiDmDescendingOp (
393 ACPI_PARSE_OBJECT *Op,
394 UINT32 Level,
395 void *Context)
397 ACPI_OP_WALK_INFO *Info = Context;
398 const ACPI_OPCODE_INFO *OpInfo;
399 UINT32 Name;
400 ACPI_PARSE_OBJECT *NextOp;
403 if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE)
405 /* Ignore this op -- it was handled elsewhere */
407 return (AE_CTRL_DEPTH);
410 /* Level 0 is at the Definition Block level */
412 if (Level == 0)
414 /* In verbose mode, print the AML offset, opcode and depth count */
416 if (Info->WalkState)
418 VERBOSE_PRINT ((DB_FULL_OP_INFO,
419 (Info->WalkState->MethodNode ?
420 Info->WalkState->MethodNode->Name.Ascii : " "),
421 Op->Common.AmlOffset, (UINT32) Op->Common.AmlOpcode));
424 if (Op->Common.AmlOpcode == AML_SCOPE_OP)
426 /* This is the beginning of the Definition Block */
428 AcpiOsPrintf ("{\n");
430 /* Emit all External() declarations here */
432 AcpiDmEmitExternals ();
433 return (AE_OK);
436 else if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
437 (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) &&
438 (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
441 * This is a first-level element of a term list,
442 * indent a new line
444 switch (Op->Common.AmlOpcode)
446 case AML_NOOP_OP:
448 * Optionally just ignore this opcode. Some tables use
449 * NoOp opcodes for "padding" out packages that the BIOS
450 * changes dynamically. This can leave hundreds or
451 * thousands of NoOp opcodes that if disassembled,
452 * cannot be compiled because they are syntactically
453 * incorrect.
455 if (AcpiGbl_IgnoreNoopOperator)
457 Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
458 return (AE_OK);
461 /* Fallthrough */
463 default:
465 AcpiDmIndent (Level);
466 break;
469 Info->LastLevel = Level;
470 Info->Count = 0;
474 * This is an inexpensive mechanism to try and keep lines from getting
475 * too long. When the limit is hit, start a new line at the previous
476 * indent plus one. A better but more expensive mechanism would be to
477 * keep track of the current column.
479 Info->Count++;
480 if (Info->Count /* +Info->LastLevel */ > 10)
482 Info->Count = 0;
483 AcpiOsPrintf ("\n");
484 AcpiDmIndent (Info->LastLevel + 1);
487 /* Print the opcode name */
489 AcpiDmDisassembleOneOp (NULL, Info, Op);
491 if ((Op->Common.DisasmOpcode == ACPI_DASM_LNOT_PREFIX) ||
492 (Op->Common.AmlOpcode == AML_INT_CONNECTION_OP))
494 return (AE_OK);
497 if ((Op->Common.AmlOpcode == AML_NAME_OP) ||
498 (Op->Common.AmlOpcode == AML_RETURN_OP))
500 Info->Level--;
503 /* Start the opcode argument list if necessary */
505 OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
507 if ((OpInfo->Flags & AML_HAS_ARGS) ||
508 (Op->Common.AmlOpcode == AML_EVENT_OP))
510 /* This opcode has an argument list */
512 if (AcpiDmBlockType (Op) & BLOCK_PAREN)
514 AcpiOsPrintf (" (");
517 /* If this is a named opcode, print the associated name value */
519 if (OpInfo->Flags & AML_NAMED)
521 switch (Op->Common.AmlOpcode)
523 case AML_ALIAS_OP:
525 NextOp = AcpiPsGetDepthNext (NULL, Op);
526 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
527 AcpiDmNamestring (NextOp->Common.Value.Name);
528 AcpiOsPrintf (", ");
530 /*lint -fallthrough */
532 default:
534 Name = AcpiPsGetName (Op);
535 if (Op->Named.Path)
537 AcpiDmNamestring ((char *) Op->Named.Path);
539 else
541 AcpiDmDumpName (Name);
544 if (Op->Common.AmlOpcode != AML_INT_NAMEDFIELD_OP)
546 if (AcpiGbl_DbOpt_verbose)
548 (void) AcpiPsDisplayObjectPathname (NULL, Op);
551 break;
554 switch (Op->Common.AmlOpcode)
556 case AML_METHOD_OP:
558 AcpiDmMethodFlags (Op);
559 AcpiOsPrintf (")");
561 /* Emit description comment for Method() with a predefined ACPI name */
563 AcpiDmPredefinedDescription (Op);
564 break;
567 case AML_NAME_OP:
569 /* Check for _HID and related EISAID() */
571 AcpiDmIsEisaId (Op);
572 AcpiOsPrintf (", ");
573 break;
576 case AML_REGION_OP:
578 AcpiDmRegionFlags (Op);
579 break;
582 case AML_POWER_RES_OP:
584 /* Mark the next two Ops as part of the parameter list */
586 AcpiOsPrintf (", ");
587 NextOp = AcpiPsGetDepthNext (NULL, Op);
588 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
590 NextOp = NextOp->Common.Next;
591 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
592 return (AE_OK);
595 case AML_PROCESSOR_OP:
597 /* Mark the next three Ops as part of the parameter list */
599 AcpiOsPrintf (", ");
600 NextOp = AcpiPsGetDepthNext (NULL, Op);
601 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
603 NextOp = NextOp->Common.Next;
604 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
606 NextOp = NextOp->Common.Next;
607 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
608 return (AE_OK);
611 case AML_MUTEX_OP:
612 case AML_DATA_REGION_OP:
614 AcpiOsPrintf (", ");
615 return (AE_OK);
618 case AML_EVENT_OP:
619 case AML_ALIAS_OP:
621 return (AE_OK);
624 case AML_SCOPE_OP:
625 case AML_DEVICE_OP:
626 case AML_THERMAL_ZONE_OP:
628 AcpiOsPrintf (")");
629 break;
632 default:
634 AcpiOsPrintf ("*** Unhandled named opcode %X\n",
635 Op->Common.AmlOpcode);
636 break;
640 else switch (Op->Common.AmlOpcode)
642 case AML_FIELD_OP:
643 case AML_BANK_FIELD_OP:
644 case AML_INDEX_FIELD_OP:
646 Info->BitOffset = 0;
648 /* Name of the parent OperationRegion */
650 NextOp = AcpiPsGetDepthNext (NULL, Op);
651 AcpiDmNamestring (NextOp->Common.Value.Name);
652 AcpiOsPrintf (", ");
653 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
655 switch (Op->Common.AmlOpcode)
657 case AML_BANK_FIELD_OP:
659 /* Namestring - Bank Name */
661 NextOp = AcpiPsGetDepthNext (NULL, NextOp);
662 AcpiDmNamestring (NextOp->Common.Value.Name);
663 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
664 AcpiOsPrintf (", ");
667 * Bank Value. This is a TermArg in the middle of the parameter
668 * list, must handle it here.
670 * Disassemble the TermArg parse tree. ACPI_PARSEOP_PARAMLIST
671 * eliminates newline in the output.
673 NextOp = NextOp->Common.Next;
675 Info->Flags = ACPI_PARSEOP_PARAMLIST;
676 AcpiDmWalkParseTree (NextOp, AcpiDmDescendingOp,
677 AcpiDmAscendingOp, Info);
678 Info->Flags = 0;
679 Info->Level = Level;
681 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
682 AcpiOsPrintf (", ");
683 break;
685 case AML_INDEX_FIELD_OP:
687 /* Namestring - Data Name */
689 NextOp = AcpiPsGetDepthNext (NULL, NextOp);
690 AcpiDmNamestring (NextOp->Common.Value.Name);
691 AcpiOsPrintf (", ");
692 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
693 break;
695 default:
697 break;
700 AcpiDmFieldFlags (NextOp);
701 break;
703 case AML_BUFFER_OP:
705 /* The next op is the size parameter */
707 NextOp = AcpiPsGetDepthNext (NULL, Op);
708 if (!NextOp)
710 /* Single-step support */
712 return (AE_OK);
715 if (Op->Common.DisasmOpcode == ACPI_DASM_RESOURCE)
718 * We have a resource list. Don't need to output
719 * the buffer size Op. Open up a new block
721 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
722 NextOp = NextOp->Common.Next;
723 AcpiOsPrintf (")");
725 /* Emit description comment for Name() with a predefined ACPI name */
727 AcpiDmPredefinedDescription (Op->Asl.Parent);
729 AcpiOsPrintf ("\n");
730 AcpiDmIndent (Info->Level);
731 AcpiOsPrintf ("{\n");
732 return (AE_OK);
735 /* Normal Buffer, mark size as in the parameter list */
737 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
738 return (AE_OK);
740 case AML_VAR_PACKAGE_OP:
741 case AML_IF_OP:
742 case AML_WHILE_OP:
744 /* The next op is the size or predicate parameter */
746 NextOp = AcpiPsGetDepthNext (NULL, Op);
747 if (NextOp)
749 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
751 return (AE_OK);
753 case AML_PACKAGE_OP:
755 /* The next op is the size parameter */
757 NextOp = AcpiPsGetDepthNext (NULL, Op);
758 if (NextOp)
760 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
762 return (AE_OK);
764 case AML_MATCH_OP:
766 AcpiDmMatchOp (Op);
767 break;
769 default:
771 break;
774 if (AcpiDmBlockType (Op) & BLOCK_BRACE)
776 AcpiOsPrintf ("\n");
777 AcpiDmIndent (Level);
778 AcpiOsPrintf ("{\n");
782 return (AE_OK);
786 /*******************************************************************************
788 * FUNCTION: AcpiDmAscendingOp
790 * PARAMETERS: ASL_WALK_CALLBACK
792 * RETURN: Status
794 * DESCRIPTION: Second visitation of a parse object, during ascent of parse
795 * tree. Close out any parameter lists and complete the opcode.
797 ******************************************************************************/
799 static ACPI_STATUS
800 AcpiDmAscendingOp (
801 ACPI_PARSE_OBJECT *Op,
802 UINT32 Level,
803 void *Context)
805 ACPI_OP_WALK_INFO *Info = Context;
806 ACPI_PARSE_OBJECT *ParentOp;
809 if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE)
811 /* Ignore this op -- it was handled elsewhere */
813 return (AE_OK);
816 if ((Level == 0) && (Op->Common.AmlOpcode == AML_SCOPE_OP))
818 /* Indicates the end of the current descriptor block (table) */
820 AcpiOsPrintf ("}\n\n");
821 return (AE_OK);
824 switch (AcpiDmBlockType (Op))
826 case BLOCK_PAREN:
828 /* Completed an op that has arguments, add closing paren */
830 AcpiOsPrintf (")");
832 if (Op->Common.AmlOpcode == AML_NAME_OP)
834 /* Emit description comment for Name() with a predefined ACPI name */
836 AcpiDmPredefinedDescription (Op);
838 else
840 /* For Create* operators, attempt to emit resource tag description */
842 AcpiDmFieldPredefinedDescription (Op);
845 /* Could be a nested operator, check if comma required */
847 if (!AcpiDmCommaIfListMember (Op))
849 if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
850 (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) &&
851 (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
854 * This is a first-level element of a term list
855 * start a new line
857 if (!(Info->Flags & ACPI_PARSEOP_PARAMLIST))
859 AcpiOsPrintf ("\n");
863 break;
865 case BLOCK_BRACE:
866 case (BLOCK_BRACE | BLOCK_PAREN):
868 /* Completed an op that has a term list, add closing brace */
870 if (Op->Common.DisasmFlags & ACPI_PARSEOP_EMPTY_TERMLIST)
872 AcpiOsPrintf ("}");
874 else
876 AcpiDmIndent (Level);
877 AcpiOsPrintf ("}");
880 AcpiDmCommaIfListMember (Op);
882 if (AcpiDmBlockType (Op->Common.Parent) != BLOCK_PAREN)
884 AcpiOsPrintf ("\n");
885 if (!(Op->Common.DisasmFlags & ACPI_PARSEOP_EMPTY_TERMLIST))
887 if ((Op->Common.AmlOpcode == AML_IF_OP) &&
888 (Op->Common.Next) &&
889 (Op->Common.Next->Common.AmlOpcode == AML_ELSE_OP))
891 break;
894 if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
895 (!Op->Common.Next))
897 break;
899 AcpiOsPrintf ("\n");
902 break;
904 case BLOCK_NONE:
905 default:
907 /* Could be a nested operator, check if comma required */
909 if (!AcpiDmCommaIfListMember (Op))
911 if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&
912 (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) &&
913 (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
916 * This is a first-level element of a term list
917 * start a new line
919 AcpiOsPrintf ("\n");
922 else if (Op->Common.Parent)
924 switch (Op->Common.Parent->Common.AmlOpcode)
926 case AML_PACKAGE_OP:
927 case AML_VAR_PACKAGE_OP:
929 if (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST))
931 AcpiOsPrintf ("\n");
933 break;
935 default:
937 break;
940 break;
943 if (Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)
945 if ((Op->Common.Next) &&
946 (Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST))
948 return (AE_OK);
952 * Just completed a parameter node for something like "Buffer (param)".
953 * Close the paren and open up the term list block with a brace
955 if (Op->Common.Next)
957 AcpiOsPrintf (")");
959 /* Emit description comment for Name() with a predefined ACPI name */
961 ParentOp = Op->Common.Parent;
962 if (ParentOp)
964 ParentOp = ParentOp->Common.Parent;
965 if (ParentOp && ParentOp->Asl.AmlOpcode == AML_NAME_OP)
967 AcpiDmPredefinedDescription (ParentOp);
970 AcpiOsPrintf ("\n");
971 AcpiDmIndent (Level - 1);
972 AcpiOsPrintf ("{\n");
974 else
976 Op->Common.Parent->Common.DisasmFlags |=
977 ACPI_PARSEOP_EMPTY_TERMLIST;
978 AcpiOsPrintf (") {");
982 if ((Op->Common.AmlOpcode == AML_NAME_OP) ||
983 (Op->Common.AmlOpcode == AML_RETURN_OP))
985 Info->Level++;
987 return (AE_OK);
991 #endif /* ACPI_DISASSEMBLER */