static ACPI_STATUS AcpiDmAscendingOp ( ACPI_PARSE_OBJECT *Op, UINT32 Level, void *Context) { ACPI_OP_WALK_INFO *Info = Context; ACPI_PARSE_OBJECT *ParentOp; if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE) { /* Ignore this op -- it was handled elsewhere */ return (AE_OK); } if ((Level == 0) && (Op->Common.AmlOpcode == AML_SCOPE_OP)) { /* Indicates the end of the current descriptor block (table) */ AcpiOsPrintf ("}\n\n"); return (AE_OK); } switch (AcpiDmBlockType (Op)) { case BLOCK_PAREN: /* Completed an op that has arguments, add closing paren if needed */ AcpiDmCloseOperator (Op); if (Op->Common.AmlOpcode == AML_NAME_OP) { /* Emit description comment for Name() with a predefined ACPI name */ AcpiDmPredefinedDescription (Op); } else { /* For Create* operators, attempt to emit resource tag description */ AcpiDmFieldPredefinedDescription (Op); } /* Decode Notify() values */ if (Op->Common.AmlOpcode == AML_NOTIFY_OP) { AcpiDmNotifyDescription (Op); } AcpiDmDisplayTargetPathname (Op); /* Could be a nested operator, check if comma required */ if (!AcpiDmCommaIfListMember (Op)) { if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) && (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) && (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP)) { /* * This is a first-level element of a term list * start a new line */ if (!(Info->Flags & ACPI_PARSEOP_PARAMLIST)) { AcpiOsPrintf ("\n"); } } } break; case BLOCK_BRACE: case (BLOCK_BRACE | BLOCK_PAREN): /* Completed an op that has a term list, add closing brace */ if (Op->Common.DisasmFlags & ACPI_PARSEOP_EMPTY_TERMLIST) { AcpiOsPrintf ("}"); } else { AcpiDmIndent (Level); AcpiOsPrintf ("}"); } AcpiDmCommaIfListMember (Op); if (AcpiDmBlockType (Op->Common.Parent) != BLOCK_PAREN) { AcpiOsPrintf ("\n"); if (!(Op->Common.DisasmFlags & ACPI_PARSEOP_EMPTY_TERMLIST)) { if ((Op->Common.AmlOpcode == AML_IF_OP) && (Op->Common.Next) && (Op->Common.Next->Common.AmlOpcode == AML_ELSE_OP)) { break; } if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) && (!Op->Common.Next)) { break; } AcpiOsPrintf ("\n"); } } break; case BLOCK_NONE: default: /* Could be a nested operator, check if comma required */ if (!AcpiDmCommaIfListMember (Op)) { if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) && (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) && (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP)) { /* * This is a first-level element of a term list * start a new line */ AcpiOsPrintf ("\n"); } } else if (Op->Common.Parent) { switch (Op->Common.Parent->Common.AmlOpcode) { case AML_PACKAGE_OP: case AML_VAR_PACKAGE_OP: if (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) { AcpiOsPrintf ("\n"); } break; default: break; } } break; } if (Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST) { if ((Op->Common.Next) && (Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) { return (AE_OK); } /* * The parent Op is guaranteed to be valid because of the flag * ACPI_PARSEOP_PARAMLIST -- which means that this op is part of * a parameter list and thus has a valid parent. */ ParentOp = Op->Common.Parent; /* * Just completed a parameter node for something like "Buffer (param)". * Close the paren and open up the term list block with a brace */ if (Op->Common.Next) { AcpiOsPrintf (")"); /* * Emit a description comment for a Name() operator that is a * predefined ACPI name. Must check the grandparent. */ ParentOp = ParentOp->Common.Parent; if (ParentOp && (ParentOp->Asl.AmlOpcode == AML_NAME_OP)) { AcpiDmPredefinedDescription (ParentOp); } AcpiOsPrintf ("\n"); AcpiDmIndent (Level - 1); AcpiOsPrintf ("{\n"); } else { ParentOp->Common.DisasmFlags |= ACPI_PARSEOP_EMPTY_TERMLIST; AcpiOsPrintf (") {"); } } if ((Op->Common.AmlOpcode == AML_NAME_OP) || (Op->Common.AmlOpcode == AML_RETURN_OP)) { Info->Level++; } /* * For ASL+, check for and emit a C-style symbol. If valid, the * symbol string has been deferred until after the first operand */ if (AcpiGbl_CstyleDisassembly) { if (Op->Asl.OperatorSymbol) { AcpiOsPrintf ("%s", Op->Asl.OperatorSymbol); Op->Asl.OperatorSymbol = NULL; } } return (AE_OK); }
static ACPI_STATUS AcpiDmAscendingOp ( ACPI_PARSE_OBJECT *Op, UINT32 Level, void *Context) { ACPI_OP_WALK_INFO *Info = Context; ACPI_PARSE_OBJECT *ParentOp; if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE) { /* Ignore this op -- it was handled elsewhere */ return (AE_OK); } if ((Level == 0) && (Op->Common.AmlOpcode == AML_SCOPE_OP)) { /* Indicates the end of the current descriptor block (table) */ AcpiOsPrintf ("}\n\n"); return (AE_OK); } switch (AcpiDmBlockType (Op)) { case BLOCK_PAREN: /* Completed an op that has arguments, add closing paren */ AcpiOsPrintf (")"); if (Op->Common.AmlOpcode == AML_NAME_OP) { /* Emit description comment for Name() with a predefined ACPI name */ AcpiDmPredefinedDescription (Op); } else { /* For Create* operators, attempt to emit resource tag description */ AcpiDmFieldPredefinedDescription (Op); } /* Could be a nested operator, check if comma required */ if (!AcpiDmCommaIfListMember (Op)) { if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) && (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) && (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP)) { /* * This is a first-level element of a term list * start a new line */ if (!(Info->Flags & ACPI_PARSEOP_PARAMLIST)) { AcpiOsPrintf ("\n"); } } } break; case BLOCK_BRACE: case (BLOCK_BRACE | BLOCK_PAREN): /* Completed an op that has a term list, add closing brace */ if (Op->Common.DisasmFlags & ACPI_PARSEOP_EMPTY_TERMLIST) { AcpiOsPrintf ("}"); } else { AcpiDmIndent (Level); AcpiOsPrintf ("}"); } AcpiDmCommaIfListMember (Op); if (AcpiDmBlockType (Op->Common.Parent) != BLOCK_PAREN) { AcpiOsPrintf ("\n"); if (!(Op->Common.DisasmFlags & ACPI_PARSEOP_EMPTY_TERMLIST)) { if ((Op->Common.AmlOpcode == AML_IF_OP) && (Op->Common.Next) && (Op->Common.Next->Common.AmlOpcode == AML_ELSE_OP)) { break; } if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) && (!Op->Common.Next)) { break; } AcpiOsPrintf ("\n"); } } break; case BLOCK_NONE: default: /* Could be a nested operator, check if comma required */ if (!AcpiDmCommaIfListMember (Op)) { if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) && (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) && (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP)) { /* * This is a first-level element of a term list * start a new line */ AcpiOsPrintf ("\n"); } } else if (Op->Common.Parent) { switch (Op->Common.Parent->Common.AmlOpcode) { case AML_PACKAGE_OP: case AML_VAR_PACKAGE_OP: if (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) { AcpiOsPrintf ("\n"); } break; default: break; } } break; } if (Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST) { if ((Op->Common.Next) && (Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) { return (AE_OK); } /* * Just completed a parameter node for something like "Buffer (param)". * Close the paren and open up the term list block with a brace */ if (Op->Common.Next) { AcpiOsPrintf (")"); /* Emit description comment for Name() with a predefined ACPI name */ ParentOp = Op->Common.Parent; if (ParentOp) { ParentOp = ParentOp->Common.Parent; if (ParentOp && ParentOp->Asl.AmlOpcode == AML_NAME_OP) { AcpiDmPredefinedDescription (ParentOp); } } AcpiOsPrintf ("\n"); AcpiDmIndent (Level - 1); AcpiOsPrintf ("{\n"); } else { Op->Common.Parent->Common.DisasmFlags |= ACPI_PARSEOP_EMPTY_TERMLIST; AcpiOsPrintf (") {"); } } if ((Op->Common.AmlOpcode == AML_NAME_OP) || (Op->Common.AmlOpcode == AML_RETURN_OP)) { Info->Level++; } return (AE_OK); }