void AcpiDmMemory24Descriptor ( AML_RESOURCE *Resource, UINT32 Length, UINT32 Level) { /* Dump name and read/write flag */ AcpiDmIndent (Level); AcpiOsPrintf ("Memory24 (%s,\n", AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->Memory24.Flags)]); /* Dump the 4 contiguous WORD values */ AcpiDmMemoryFields (&Resource->Memory24.Minimum, 16, Level); /* Insert a descriptor name */ AcpiDmIndent (Level + 1); AcpiDmDescriptorName (); AcpiOsPrintf (")\n"); }
void AcpiDmFixedIoDescriptor ( ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level) { AcpiDmIndent (Level); AcpiOsPrintf ("FixedIO (\n"); AcpiDmIndent (Level + 1); AcpiDmDumpInteger16 (Resource->FixedIo.Address, "Address"); AcpiDmIndent (Level + 1); AcpiDmDumpInteger8 (Resource->FixedIo.AddressLength, "Length"); /* Insert a descriptor name */ AcpiDmIndent (Level + 1); AcpiDmDescriptorName (); AcpiOsPrintf (")\n"); }
void AcpiDmStartDependentDescriptor ( AML_RESOURCE *Resource, UINT32 Length, UINT32 Level) { AcpiDmIndent (Level); if (Length & 1) { AcpiOsPrintf ("StartDependentFn (0x%2.2X, 0x%2.2X)\n", (UINT32) ACPI_GET_2BIT_FLAG (Resource->StartDpf.Flags), (UINT32) ACPI_EXTRACT_2BIT_FLAG (Resource->StartDpf.Flags, 2)); } else { AcpiOsPrintf ("StartDependentFnNoPri ()\n"); } AcpiDmIndent (Level); AcpiOsPrintf ("{\n"); }
void AcpiDmIrqDescriptor ( ASL_IRQ_FORMAT_DESC *Resource, UINT32 Length, UINT32 Level) { AcpiDmIndent (Level); AcpiOsPrintf ("%s (", AcpiGbl_IrqDecode [Length & 1]); if (Length & 1) { AcpiOsPrintf ("%s, %s, %s", AcpiGbl_HEDecode [Resource->Flags & 1], AcpiGbl_LLDecode [(Resource->Flags >> 3) & 1], AcpiGbl_SHRDecode [(Resource->Flags >> 4) & 1]); }
static void AcpiDmGpioCommon ( AML_RESOURCE *Resource, UINT32 Level) { UINT32 PinCount; UINT16 *PinList; UINT8 *VendorData; UINT32 i; /* ResourceSource, ResourceSourceIndex, ResourceType */ AcpiDmIndent (Level + 1); if (Resource->Gpio.ResSourceOffset) { AcpiUtPrintString ( ACPI_ADD_PTR (char, Resource, Resource->Gpio.ResSourceOffset), ACPI_UINT16_MAX); }
void AcpiDmIrqDescriptor ( AML_RESOURCE *Resource, UINT32 Length, UINT32 Level) { AcpiDmIndent (Level); AcpiOsPrintf ("%s (", AcpiGbl_IrqDecode [Length & 1]); /* Decode flags byte if present */ if (Length & 1) { AcpiOsPrintf ("%s, %s, %s, ", AcpiGbl_HeDecode [Resource->Irq.Flags & 1], AcpiGbl_LlDecode [(Resource->Irq.Flags >> 3) & 1], AcpiGbl_ShrDecode [(Resource->Irq.Flags >> 4) & 1]); }
static void AcpiDmAddressFields ( void *Source, UINT8 Type, UINT32 Level) { UINT32 i; AcpiOsPrintf ("\n"); for (i = 0; i < 5; i++) { AcpiDmIndent (Level + 1); switch (Type) { case 16: AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i], AcpiDmAddressNames[i]); break; case 32: AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i], AcpiDmAddressNames[i]); break; case 64: AcpiDmDumpInteger64 (ACPI_CAST_PTR (UINT64, Source)[i], AcpiDmAddressNames[i]); break; default: return; } } }
static void AcpiDmGpioCommon ( ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Level) { UINT16 *PinList; UINT8 *VendorData; char *DeviceName = NULL; UINT32 PinCount; UINT32 i; /* ResourceSource, ResourceSourceIndex, ResourceType */ AcpiDmIndent (Level + 1); if (Resource->Gpio.ResSourceOffset) { DeviceName = ACPI_ADD_PTR (char, Resource, Resource->Gpio.ResSourceOffset), AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX); }
void AcpiDmGenericRegisterDescriptor ( ACPI_OP_WALK_INFO *Info, AML_RESOURCE *Resource, UINT32 Length, UINT32 Level) { AcpiDmIndent (Level); AcpiOsPrintf ("Register ("); AcpiDmAddressSpace (Resource->GenericReg.AddressSpaceId); AcpiOsPrintf ("\n"); AcpiDmIndent (Level + 1); AcpiDmDumpInteger8 (Resource->GenericReg.BitWidth, "Bit Width"); AcpiDmIndent (Level + 1); AcpiDmDumpInteger8 (Resource->GenericReg.BitOffset, "Bit Offset"); AcpiDmIndent (Level + 1); AcpiDmDumpInteger64 (Resource->GenericReg.Address, "Address"); /* Optional field for ACPI 3.0 */ AcpiDmIndent (Level + 1); if (Resource->GenericReg.AccessSize) { AcpiOsPrintf ("0x%2.2X, // %s\n", Resource->GenericReg.AccessSize, "Access Size"); AcpiDmIndent (Level + 1); } else { AcpiOsPrintf (","); } /* DescriptorName was added for ACPI 3.0+ */ AcpiDmDescriptorName (); AcpiOsPrintf (")\n"); }
void AcpiDmResourceTemplate ( ACPI_OP_WALK_INFO *Info, ACPI_PARSE_OBJECT *Op, UINT8 *ByteData, UINT32 ByteCount) { ACPI_STATUS Status; UINT32 CurrentByteOffset; UINT8 ResourceType; UINT32 ResourceLength; void *Aml; UINT32 Level; BOOLEAN DependentFns = FALSE; UINT8 ResourceIndex; ACPI_NAMESPACE_NODE *Node; if (Op->Asl.AmlOpcode != AML_FIELD_OP) { Info->MappingOp = Op; } Level = Info->Level; ResourceName = ACPI_DEFAULT_RESNAME; Node = Op->Common.Node; if (Node) { Node = Node->Child; } for (CurrentByteOffset = 0; CurrentByteOffset < ByteCount;) { Aml = &ByteData[CurrentByteOffset]; /* Get the descriptor type and length */ ResourceType = AcpiUtGetResourceType (Aml); ResourceLength = AcpiUtGetResourceLength (Aml); /* Validate the Resource Type and Resource Length */ Status = AcpiUtValidateResource (NULL, Aml, &ResourceIndex); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("/*** Could not validate Resource, type (%X) %s***/\n", ResourceType, AcpiFormatException (Status)); return; } /* Point to next descriptor */ CurrentByteOffset += AcpiUtGetDescriptorLength (Aml); /* Descriptor pre-processing */ switch (ResourceType) { case ACPI_RESOURCE_NAME_START_DEPENDENT: /* Finish a previous StartDependentFns */ if (DependentFns) { Level--; AcpiDmIndent (Level); AcpiOsPrintf ("}\n"); } break; case ACPI_RESOURCE_NAME_END_DEPENDENT: Level--; DependentFns = FALSE; break; case ACPI_RESOURCE_NAME_END_TAG: /* Normal exit, the resource list is finished */ if (DependentFns) { /* * Close an open StartDependentDescriptor. This indicates a * missing EndDependentDescriptor. */ Level--; DependentFns = FALSE; /* Go ahead and insert EndDependentFn() */ AcpiDmEndDependentDescriptor (Info, Aml, ResourceLength, Level); AcpiDmIndent (Level); AcpiOsPrintf ( "/*** Disassembler: inserted missing EndDependentFn () ***/\n"); } return; default: break; } /* Disassemble the resource structure */ if (Node) { ResourceName = Node->Name.Integer; Node = Node->Peer; } AcpiGbl_DmResourceDispatch [ResourceIndex] ( Info, Aml, ResourceLength, Level); /* Descriptor post-processing */ if (ResourceType == ACPI_RESOURCE_NAME_START_DEPENDENT) { DependentFns = TRUE; Level++; } } }
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 AcpiDmDescendingOp ( ACPI_PARSE_OBJECT *Op, UINT32 Level, void *Context) { ACPI_OP_WALK_INFO *Info = Context; const ACPI_OPCODE_INFO *OpInfo; UINT32 Name; ACPI_PARSE_OBJECT *NextOp; if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE) { /* Ignore this op -- it was handled elsewhere */ return (AE_CTRL_DEPTH); } /* Level 0 is at the Definition Block level */ if (Level == 0) { /* In verbose mode, print the AML offset, opcode and depth count */ if (Info->WalkState) { VERBOSE_PRINT ((DB_FULL_OP_INFO, (Info->WalkState->MethodNode ? Info->WalkState->MethodNode->Name.Ascii : " "), Op->Common.AmlOffset, (UINT32) Op->Common.AmlOpcode)); } if (Op->Common.AmlOpcode == AML_SCOPE_OP) { /* This is the beginning of the Definition Block */ AcpiOsPrintf ("{\n"); /* Emit all External() declarations here */ AcpiDmEmitExternals (); return (AE_OK); } } else 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, * indent a new line */ switch (Op->Common.AmlOpcode) { case AML_NOOP_OP: /* * Optionally just ignore this opcode. Some tables use * NoOp opcodes for "padding" out packages that the BIOS * changes dynamically. This can leave hundreds or * thousands of NoOp opcodes that if disassembled, * cannot be compiled because they are syntactically * incorrect. */ if (AcpiGbl_IgnoreNoopOperator) { Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; return (AE_OK); } /* Fallthrough */ default: AcpiDmIndent (Level); break; } Info->LastLevel = Level; Info->Count = 0; } /* * This is an inexpensive mechanism to try and keep lines from getting * too long. When the limit is hit, start a new line at the previous * indent plus one. A better but more expensive mechanism would be to * keep track of the current column. */ Info->Count++; if (Info->Count /* +Info->LastLevel */ > 12) { Info->Count = 0; AcpiOsPrintf ("\n"); AcpiDmIndent (Info->LastLevel + 1); } /* If ASL+ is enabled, check for a C-style operator */ if (AcpiDmCheckForSymbolicOpcode (Op, Info)) { return (AE_OK); } /* Print the opcode name */ AcpiDmDisassembleOneOp (NULL, Info, Op); if ((Op->Common.DisasmOpcode == ACPI_DASM_LNOT_PREFIX) || (Op->Common.AmlOpcode == AML_INT_CONNECTION_OP)) { return (AE_OK); } if ((Op->Common.AmlOpcode == AML_NAME_OP) || (Op->Common.AmlOpcode == AML_RETURN_OP)) { Info->Level--; } /* Start the opcode argument list if necessary */ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); if ((OpInfo->Flags & AML_HAS_ARGS) || (Op->Common.AmlOpcode == AML_EVENT_OP)) { /* This opcode has an argument list */ if (AcpiDmBlockType (Op) & BLOCK_PAREN) { AcpiOsPrintf (" ("); } /* If this is a named opcode, print the associated name value */ if (OpInfo->Flags & AML_NAMED) { switch (Op->Common.AmlOpcode) { case AML_ALIAS_OP: NextOp = AcpiPsGetDepthNext (NULL, Op); NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; AcpiDmNamestring (NextOp->Common.Value.Name); AcpiOsPrintf (", "); /*lint -fallthrough */ default: Name = AcpiPsGetName (Op); if (Op->Named.Path) { AcpiDmNamestring ((char *) Op->Named.Path); } else { AcpiDmDumpName (Name); } if (Op->Common.AmlOpcode != AML_INT_NAMEDFIELD_OP) { if (AcpiGbl_DbOpt_Verbose) { (void) AcpiPsDisplayObjectPathname (NULL, Op); } } break; } switch (Op->Common.AmlOpcode) { case AML_METHOD_OP: AcpiDmMethodFlags (Op); AcpiOsPrintf (")"); /* Emit description comment for Method() with a predefined ACPI name */ AcpiDmPredefinedDescription (Op); break; case AML_NAME_OP: /* Check for _HID and related EISAID() */ AcpiDmCheckForHardwareId (Op); AcpiOsPrintf (", "); break; case AML_REGION_OP: AcpiDmRegionFlags (Op); break; case AML_POWER_RES_OP: /* Mark the next two Ops as part of the parameter list */ AcpiOsPrintf (", "); NextOp = AcpiPsGetDepthNext (NULL, Op); NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST; NextOp = NextOp->Common.Next; NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST; return (AE_OK); case AML_PROCESSOR_OP: /* Mark the next three Ops as part of the parameter list */ AcpiOsPrintf (", "); NextOp = AcpiPsGetDepthNext (NULL, Op); NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST; NextOp = NextOp->Common.Next; NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST; NextOp = NextOp->Common.Next; NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST; return (AE_OK); case AML_MUTEX_OP: case AML_DATA_REGION_OP: AcpiOsPrintf (", "); return (AE_OK); case AML_EVENT_OP: case AML_ALIAS_OP: return (AE_OK); case AML_SCOPE_OP: case AML_DEVICE_OP: case AML_THERMAL_ZONE_OP: AcpiOsPrintf (")"); break; default: AcpiOsPrintf ("*** Unhandled named opcode %X\n", Op->Common.AmlOpcode); break; } } else switch (Op->Common.AmlOpcode) { case AML_FIELD_OP: case AML_BANK_FIELD_OP: case AML_INDEX_FIELD_OP: Info->BitOffset = 0; /* Name of the parent OperationRegion */ NextOp = AcpiPsGetDepthNext (NULL, Op); AcpiDmNamestring (NextOp->Common.Value.Name); AcpiOsPrintf (", "); NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; switch (Op->Common.AmlOpcode) { case AML_BANK_FIELD_OP: /* Namestring - Bank Name */ NextOp = AcpiPsGetDepthNext (NULL, NextOp); AcpiDmNamestring (NextOp->Common.Value.Name); NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; AcpiOsPrintf (", "); /* * Bank Value. This is a TermArg in the middle of the parameter * list, must handle it here. * * Disassemble the TermArg parse tree. ACPI_PARSEOP_PARAMLIST * eliminates newline in the output. */ NextOp = NextOp->Common.Next; Info->Flags = ACPI_PARSEOP_PARAMLIST; AcpiDmWalkParseTree (NextOp, AcpiDmDescendingOp, AcpiDmAscendingOp, Info); Info->Flags = 0; Info->Level = Level; NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; AcpiOsPrintf (", "); break; case AML_INDEX_FIELD_OP: /* Namestring - Data Name */ NextOp = AcpiPsGetDepthNext (NULL, NextOp); AcpiDmNamestring (NextOp->Common.Value.Name); AcpiOsPrintf (", "); NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; break; default: break; } AcpiDmFieldFlags (NextOp); break; case AML_BUFFER_OP: /* The next op is the size parameter */ NextOp = AcpiPsGetDepthNext (NULL, Op); if (!NextOp) { /* Single-step support */ return (AE_OK); } if (Op->Common.DisasmOpcode == ACPI_DASM_RESOURCE) { /* * We have a resource list. Don't need to output * the buffer size Op. Open up a new block */ NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; NextOp = NextOp->Common.Next; AcpiOsPrintf (")"); /* Emit description comment for Name() with a predefined ACPI name */ AcpiDmPredefinedDescription (Op->Asl.Parent); AcpiOsPrintf ("\n"); AcpiDmIndent (Info->Level); AcpiOsPrintf ("{\n"); return (AE_OK); } /* Normal Buffer, mark size as in the parameter list */ NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST; return (AE_OK); case AML_VAR_PACKAGE_OP: case AML_IF_OP: case AML_WHILE_OP: /* The next op is the size or predicate parameter */ NextOp = AcpiPsGetDepthNext (NULL, Op); if (NextOp) { NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST; } return (AE_OK); case AML_PACKAGE_OP: /* The next op is the size parameter */ NextOp = AcpiPsGetDepthNext (NULL, Op); if (NextOp) { NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST; } return (AE_OK); case AML_MATCH_OP: AcpiDmMatchOp (Op); break; default: break; } if (AcpiDmBlockType (Op) & BLOCK_BRACE) { AcpiOsPrintf ("\n"); AcpiDmIndent (Level); AcpiOsPrintf ("{\n"); } } return (AE_OK); }
static ACPI_STATUS AcpiDmDumpDescending ( ACPI_PARSE_OBJECT *Op, UINT32 Level, void *Context) { ACPI_OP_WALK_INFO *Info = Context; const ACPI_OPCODE_INFO *OpInfo; char *Path; if (!Op) { return (AE_OK); } OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); Info->Count++; /* Most of the information (count, level, name) here */ AcpiOsPrintf ("% 5d [%2.2d] ", Info->Count, Level); AcpiDmIndent (Level); AcpiOsPrintf ("%-28s", AcpiPsGetOpcodeName (Op->Common.AmlOpcode)); /* Extra info is helpful */ switch (Op->Common.AmlOpcode) { case AML_BYTE_OP: case AML_WORD_OP: case AML_DWORD_OP: AcpiOsPrintf ("%X", (UINT32) Op->Common.Value.Integer); break; case AML_INT_NAMEPATH_OP: if (Op->Common.Value.String) { AcpiNsExternalizeName (ACPI_UINT32_MAX, Op->Common.Value.String, NULL, &Path); AcpiOsPrintf ("%s %p", Path, Op->Common.Node); ACPI_FREE (Path); } else { AcpiOsPrintf ("[NULL]"); } break; case AML_NAME_OP: case AML_METHOD_OP: case AML_DEVICE_OP: case AML_INT_NAMEDFIELD_OP: AcpiOsPrintf ("%4.4s", &Op->Named.Name); break; default: break; } AcpiOsPrintf ("\n"); return (AE_OK); }
static void AcpiDmAddressCommon ( AML_RESOURCE *Resource, UINT8 Type, UINT32 Level) { UINT8 ResourceType; UINT8 SpecificFlags; UINT8 Flags; ResourceType = Resource->Address.ResourceType; SpecificFlags = Resource->Address.SpecificFlags; Flags = Resource->Address.Flags; AcpiDmIndent (Level); /* Validate ResourceType */ if ((ResourceType > 2) && (ResourceType < 0xC0)) { AcpiOsPrintf ( "/**** Invalid Resource Type: 0x%X ****/", ResourceType); return; } /* Prefix is either Word, DWord, QWord, or Extended */ AcpiDmAddressPrefix (Type); /* Resource Types above 0xC0 are vendor-defined */ if (ResourceType > 2) { AcpiOsPrintf ("Space (0x%2.2X, ", ResourceType); AcpiDmSpaceFlags (Flags); AcpiOsPrintf (" 0x%2.2X,", SpecificFlags); return; } /* This is either a Memory, IO, or BusNumber descriptor (0,1,2) */ AcpiOsPrintf ("%s (", AcpiGbl_WordDecode [ACPI_GET_2BIT_FLAG (ResourceType)]); /* Decode the general and type-specific flags */ if (ResourceType == ACPI_MEMORY_RANGE) { AcpiDmMemoryFlags (Flags, SpecificFlags); } else /* IO range or BusNumberRange */ { AcpiDmIoFlags (Flags); if (ResourceType == ACPI_IO_RANGE) { AcpiOsPrintf (" %s,", AcpiGbl_RngDecode [ACPI_GET_2BIT_FLAG (SpecificFlags)]); } } }
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); }
static ACPI_STATUS AcpiDmDescendingOp ( ACPI_PARSE_OBJECT *Op, UINT32 Level, void *Context) { ACPI_OP_WALK_INFO *Info = Context; const ACPI_OPCODE_INFO *OpInfo; UINT32 Name; ACPI_PARSE_OBJECT *NextOp; ACPI_PARSE_OBJECT *NextOp2; UINT32 AmlOffset; /* Determine which file this parse node is contained in. */ if (AcpiGbl_CaptureComments) { ASL_CV_LABEL_FILENODE (Op); if (Level != 0 && ASL_CV_FILE_HAS_SWITCHED (Op)) { ASL_CV_SWITCH_FILES (Level, Op); } /* If this parse node has regular comments, print them here. */ ASL_CV_PRINT_ONE_COMMENT (Op, AML_COMMENT_STANDARD, NULL, Level); } OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); /* Listing support to dump the AML code after the ASL statement */ if (AcpiGbl_DmOpt_Listing) { /* We only care about these classes of objects */ if ((OpInfo->Class == AML_CLASS_NAMED_OBJECT) || (OpInfo->Class == AML_CLASS_CONTROL) || (OpInfo->Class == AML_CLASS_CREATE) || ((OpInfo->Class == AML_CLASS_EXECUTE) && (!Op->Common.Next))) { if (AcpiGbl_DmOpt_Listing && Info->PreviousAml) { /* Dump the AML byte code for the previous Op */ if (Op->Common.Aml > Info->PreviousAml) { AcpiOsPrintf ("\n"); AcpiUtDumpBuffer ( (Info->StartAml + Info->AmlOffset), (Op->Common.Aml - Info->PreviousAml), DB_BYTE_DISPLAY, Info->AmlOffset); AcpiOsPrintf ("\n"); } Info->AmlOffset = (Op->Common.Aml - Info->StartAml); } Info->PreviousAml = Op->Common.Aml; } } if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE) { /* Ignore this op -- it was handled elsewhere */ return (AE_CTRL_DEPTH); } if (Op->Common.DisasmOpcode == ACPI_DASM_IGNORE_SINGLE) { /* Ignore this op, but not it's children */ return (AE_OK); } if (Op->Common.AmlOpcode == AML_IF_OP) { NextOp = AcpiPsGetDepthNext (NULL, Op); if (NextOp) { NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST; /* Don't emit the actual embedded externals unless asked */ if (!AcpiGbl_DmEmitExternalOpcodes) { /* * A Zero predicate indicates the possibility of one or more * External() opcodes within the If() block. */ if (NextOp->Common.AmlOpcode == AML_ZERO_OP) { NextOp2 = NextOp->Common.Next; if (NextOp2 && (NextOp2->Common.AmlOpcode == AML_EXTERNAL_OP)) { /* Ignore the If 0 block and all children */ Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; return (AE_CTRL_DEPTH); } } } } } /* Level 0 is at the Definition Block level */ if (Level == 0) { /* In verbose mode, print the AML offset, opcode and depth count */ if (Info->WalkState) { AmlOffset = (UINT32) ACPI_PTR_DIFF (Op->Common.Aml, Info->WalkState->ParserState.AmlStart); if (AcpiGbl_DmOpt_Verbose) { if (AcpiGbl_CmSingleStep) { AcpiOsPrintf ("%5.5X/%4.4X: ", AmlOffset, (UINT32) Op->Common.AmlOpcode); } else { AcpiOsPrintf ("AML Offset %5.5X, Opcode %4.4X: ", AmlOffset, (UINT32) Op->Common.AmlOpcode); } } } if (Op->Common.AmlOpcode == AML_SCOPE_OP) { /* This is the beginning of the Definition Block */ AcpiOsPrintf ("{\n"); /* Emit all External() declarations here */ if (!AcpiGbl_DmEmitExternalOpcodes) { AcpiDmEmitExternals (); } return (AE_OK); } } else if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) && (!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMETER_LIST)) && (!(Op->Common.DisasmFlags & ACPI_PARSEOP_ELSEIF)) && (Op->Common.AmlOpcode != AML_INT_BYTELIST_OP)) { /* * This is a first-level element of a term list, * indent a new line */ switch (Op->Common.AmlOpcode) { case AML_NOOP_OP: /* * Optionally just ignore this opcode. Some tables use * NoOp opcodes for "padding" out packages that the BIOS * changes dynamically. This can leave hundreds or * thousands of NoOp opcodes that if disassembled, * cannot be compiled because they are syntactically * incorrect. */ if (AcpiGbl_IgnoreNoopOperator) { Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; return (AE_OK); } /* Fallthrough */ default: AcpiDmIndent (Level); break; } Info->LastLevel = Level; Info->Count = 0; } /* * This is an inexpensive mechanism to try and keep lines from getting * too long. When the limit is hit, start a new line at the previous * indent plus one. A better but more expensive mechanism would be to * keep track of the current column. */ Info->Count++; if (Info->Count /* +Info->LastLevel */ > 12) { Info->Count = 0; AcpiOsPrintf ("\n"); AcpiDmIndent (Info->LastLevel + 1); } /* If ASL+ is enabled, check for a C-style operator */ if (AcpiDmCheckForSymbolicOpcode (Op, Info)) { return (AE_OK); } /* Print the opcode name */ AcpiDmDisassembleOneOp (NULL, Info, Op); if ((Op->Common.DisasmOpcode == ACPI_DASM_LNOT_PREFIX) || (Op->Common.AmlOpcode == AML_INT_CONNECTION_OP)) { return (AE_OK); } if ((Op->Common.AmlOpcode == AML_NAME_OP) || (Op->Common.AmlOpcode == AML_RETURN_OP)) { Info->Level--; } if (Op->Common.AmlOpcode == AML_EXTERNAL_OP) { Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; return (AE_CTRL_DEPTH); } /* Start the opcode argument list if necessary */ if ((OpInfo->Flags & AML_HAS_ARGS) || (Op->Common.AmlOpcode == AML_EVENT_OP)) { /* This opcode has an argument list */ if (AcpiDmBlockType (Op) & BLOCK_PAREN) { AcpiOsPrintf (" ("); if (!(AcpiDmBlockType (Op) & BLOCK_BRACE)) { ASL_CV_PRINT_ONE_COMMENT (Op, AMLCOMMENT_INLINE, " ", 0); } } /* If this is a named opcode, print the associated name value */ if (OpInfo->Flags & AML_NAMED) { switch (Op->Common.AmlOpcode) { case AML_ALIAS_OP: NextOp = AcpiPsGetDepthNext (NULL, Op); NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; AcpiDmNamestring (NextOp->Common.Value.Name); AcpiOsPrintf (", "); /*lint -fallthrough */ default: Name = AcpiPsGetName (Op); if (Op->Named.Path) { AcpiDmNamestring (Op->Named.Path); } else { AcpiDmDumpName (Name); } if (Op->Common.AmlOpcode != AML_INT_NAMEDFIELD_OP) { if (AcpiGbl_DmOpt_Verbose) { (void) AcpiPsDisplayObjectPathname (NULL, Op); } } break; } switch (Op->Common.AmlOpcode) { case AML_METHOD_OP: AcpiDmMethodFlags (Op); ASL_CV_CLOSE_PAREN (Op, Level); /* Emit description comment for Method() with a predefined ACPI name */ AcpiDmPredefinedDescription (Op); break; case AML_NAME_OP: /* Check for _HID and related EISAID() */ AcpiDmCheckForHardwareId (Op); AcpiOsPrintf (", "); ASL_CV_PRINT_ONE_COMMENT (Op, AML_NAMECOMMENT, NULL, 0); break; case AML_REGION_OP: AcpiDmRegionFlags (Op); break; case AML_POWER_RESOURCE_OP: /* Mark the next two Ops as part of the parameter list */ AcpiOsPrintf (", "); NextOp = AcpiPsGetDepthNext (NULL, Op); NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST; NextOp = NextOp->Common.Next; NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST; return (AE_OK); case AML_PROCESSOR_OP: /* Mark the next three Ops as part of the parameter list */ AcpiOsPrintf (", "); NextOp = AcpiPsGetDepthNext (NULL, Op); NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST; NextOp = NextOp->Common.Next; NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST; NextOp = NextOp->Common.Next; NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST; return (AE_OK); case AML_MUTEX_OP: case AML_DATA_REGION_OP: AcpiOsPrintf (", "); return (AE_OK); case AML_EVENT_OP: case AML_ALIAS_OP: return (AE_OK); case AML_SCOPE_OP: case AML_DEVICE_OP: case AML_THERMAL_ZONE_OP: ASL_CV_CLOSE_PAREN (Op, Level); break; default: AcpiOsPrintf ("*** Unhandled named opcode %X\n", Op->Common.AmlOpcode); break; } } else switch (Op->Common.AmlOpcode) { case AML_FIELD_OP: case AML_BANK_FIELD_OP: case AML_INDEX_FIELD_OP: Info->BitOffset = 0; /* Name of the parent OperationRegion */ NextOp = AcpiPsGetDepthNext (NULL, Op); AcpiDmNamestring (NextOp->Common.Value.Name); AcpiOsPrintf (", "); NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; switch (Op->Common.AmlOpcode) { case AML_BANK_FIELD_OP: /* Namestring - Bank Name */ NextOp = AcpiPsGetDepthNext (NULL, NextOp); AcpiDmNamestring (NextOp->Common.Value.Name); NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; AcpiOsPrintf (", "); /* * Bank Value. This is a TermArg in the middle of the parameter * list, must handle it here. * * Disassemble the TermArg parse tree. ACPI_PARSEOP_PARAMETER_LIST * eliminates newline in the output. */ NextOp = NextOp->Common.Next; Info->Flags = ACPI_PARSEOP_PARAMETER_LIST; AcpiDmWalkParseTree (NextOp, AcpiDmDescendingOp, AcpiDmAscendingOp, Info); Info->Flags = 0; Info->Level = Level; NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; AcpiOsPrintf (", "); break; case AML_INDEX_FIELD_OP: /* Namestring - Data Name */ NextOp = AcpiPsGetDepthNext (NULL, NextOp); AcpiDmNamestring (NextOp->Common.Value.Name); AcpiOsPrintf (", "); NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; break; default: break; } AcpiDmFieldFlags (NextOp); break; case AML_BUFFER_OP: /* The next op is the size parameter */ NextOp = AcpiPsGetDepthNext (NULL, Op); if (!NextOp) { /* Single-step support */ return (AE_OK); } if (Op->Common.DisasmOpcode == ACPI_DASM_RESOURCE) { /* * We have a resource list. Don't need to output * the buffer size Op. Open up a new block */ NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; NextOp = NextOp->Common.Next; ASL_CV_CLOSE_PAREN (Op, Level); /* Emit description comment for Name() with a predefined ACPI name */ AcpiDmPredefinedDescription (Op->Asl.Parent); AcpiOsPrintf ("\n"); AcpiDmIndent (Info->Level); AcpiOsPrintf ("{\n"); return (AE_OK); } /* Normal Buffer, mark size as in the parameter list */ NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST; return (AE_OK); case AML_IF_OP: case AML_VARIABLE_PACKAGE_OP: case AML_WHILE_OP: /* The next op is the size or predicate parameter */ NextOp = AcpiPsGetDepthNext (NULL, Op); if (NextOp) { NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST; } return (AE_OK); case AML_PACKAGE_OP: /* The next op is the size parameter */ NextOp = AcpiPsGetDepthNext (NULL, Op); if (NextOp) { NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST; } return (AE_OK); case AML_MATCH_OP: AcpiDmMatchOp (Op); break; default: break; } if (AcpiDmBlockType (Op) & BLOCK_BRACE) { AcpiOsPrintf ("\n"); AcpiDmIndent (Level); AcpiOsPrintf ("{\n"); } } return (AE_OK); }