ACPI_NAMESPACE_NODE * AcpiDbConvertToNode ( char *InString) { ACPI_NAMESPACE_NODE *Node; ACPI_SIZE Address; if ((*InString >= 0x30) && (*InString <= 0x39)) { /* Numeric argument, convert */ Address = strtoul (InString, NULL, 16); Node = ACPI_TO_POINTER (Address); if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE))) { AcpiOsPrintf ("Address %p is invalid", Node); return (NULL); } /* Make sure pointer is valid NS node */ if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) { AcpiOsPrintf ("Address %p is not a valid namespace node [%s]\n", Node, AcpiUtGetDescriptorName (Node)); return (NULL); } } else { /* * Alpha argument: The parameter is a name string that must be * resolved to a Namespace object. */ Node = AcpiDbLocalNsLookup (InString); if (!Node) { AcpiOsPrintf ( "Could not find [%s] in namespace, defaulting to root node\n", InString); Node = AcpiGbl_RootNode; } } return (Node); }
ACPI_NAMESPACE_NODE * AcpiDbConvertToNode ( char *InString) { ACPI_NAMESPACE_NODE *Node; if ((*InString >= 0x30) && (*InString <= 0x39)) { /* Numeric argument, convert */ Node = ACPI_TO_POINTER (ACPI_STRTOUL (InString, NULL, 16)); if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE))) { AcpiOsPrintf ("Address %p is invalid in this address space\n", Node); return (NULL); } /* Make sure pointer is valid NS node */ if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) { AcpiOsPrintf ("Address %p is not a valid NS node [%s]\n", Node, AcpiUtGetDescriptorName (Node)); return (NULL); } } else { /* Alpha argument */ /* The parameter is a name string that must be resolved to a * Named obj */ Node = AcpiDbLocalNsLookup (InString); if (!Node) { Node = AcpiGbl_RootNode; } } return (Node); }
void AcpiDbDecodeAndDisplayObject ( char *Target, char *OutputType) { void *ObjPtr; ACPI_NAMESPACE_NODE *Node; ACPI_OPERAND_OBJECT *ObjDesc; UINT32 Display = DB_BYTE_DISPLAY; char Buffer[80]; ACPI_BUFFER RetBuf; ACPI_STATUS Status; UINT32 Size; if (!Target) { return; } /* Decode the output type */ if (OutputType) { AcpiUtStrupr (OutputType); if (OutputType[0] == 'W') { Display = DB_WORD_DISPLAY; } else if (OutputType[0] == 'D') { Display = DB_DWORD_DISPLAY; } else if (OutputType[0] == 'Q') { Display = DB_QWORD_DISPLAY; } } RetBuf.Length = sizeof (Buffer); RetBuf.Pointer = Buffer; /* Differentiate between a number and a name */ if ((Target[0] >= 0x30) && (Target[0] <= 0x39)) { ObjPtr = AcpiDbGetPointer (Target); if (!AcpiOsReadable (ObjPtr, 16)) { AcpiOsPrintf ( "Address %p is invalid in this address space\n", ObjPtr); return; } /* Decode the object type */ switch (ACPI_GET_DESCRIPTOR_TYPE (ObjPtr)) { case ACPI_DESC_TYPE_NAMED: /* This is a namespace Node */ if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_NAMESPACE_NODE))) { AcpiOsPrintf ( "Cannot read entire Named object at address %p\n", ObjPtr); return; } Node = ObjPtr; goto DumpNode; case ACPI_DESC_TYPE_OPERAND: /* This is a ACPI OPERAND OBJECT */ if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_OPERAND_OBJECT))) { AcpiOsPrintf ( "Cannot read entire ACPI object at address %p\n", ObjPtr); return; } AcpiUtDebugDumpBuffer (ObjPtr, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX); AcpiExDumpObjectDescriptor (ObjPtr, 1); break; case ACPI_DESC_TYPE_PARSER: /* This is a Parser Op object */ if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_PARSE_OBJECT))) { AcpiOsPrintf ( "Cannot read entire Parser object at address %p\n", ObjPtr); return; } AcpiUtDebugDumpBuffer (ObjPtr, sizeof (ACPI_PARSE_OBJECT), Display, ACPI_UINT32_MAX); AcpiDbDumpParserDescriptor ((ACPI_PARSE_OBJECT *) ObjPtr); break; default: /* Is not a recognizeable object */ AcpiOsPrintf ( "Not a known ACPI internal object, descriptor type %2.2X\n", ACPI_GET_DESCRIPTOR_TYPE (ObjPtr)); Size = 16; if (AcpiOsReadable (ObjPtr, 64)) { Size = 64; } /* Just dump some memory */ AcpiUtDebugDumpBuffer (ObjPtr, Size, Display, ACPI_UINT32_MAX); break; } return; } /* The parameter is a name string that must be resolved to a Named obj */ Node = AcpiDbLocalNsLookup (Target); if (!Node) { return; } DumpNode: /* Now dump the NS node */ Status = AcpiGetName (Node, ACPI_FULL_PATHNAME_NO_TRAILING, &RetBuf); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Could not convert name to pathname\n"); } else { AcpiOsPrintf ("Object (%p) Pathname: %s\n", Node, (char *) RetBuf.Pointer); } if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE))) { AcpiOsPrintf ("Invalid Named object at address %p\n", Node); return; } AcpiUtDebugDumpBuffer ((void *) Node, sizeof (ACPI_NAMESPACE_NODE), Display, ACPI_UINT32_MAX); AcpiExDumpNamespaceNode (Node, 1); ObjDesc = AcpiNsGetAttachedObject (Node); if (ObjDesc) { AcpiOsPrintf ("\nAttached Object (%p):\n", ObjDesc); if (!AcpiOsReadable (ObjDesc, sizeof (ACPI_OPERAND_OBJECT))) { AcpiOsPrintf ("Invalid internal ACPI Object at address %p\n", ObjDesc); return; } AcpiUtDebugDumpBuffer ((void *) ObjDesc, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX); AcpiExDumpObjectDescriptor (ObjDesc, 1); } }