BOOLEAN ApIsValidHeader ( ACPI_TABLE_HEADER *Table) { if (!ACPI_VALIDATE_RSDP_SIG (Table->Signature)) { /* Make sure signature is all ASCII and a valid ACPI name */ if (!AcpiUtValidAcpiName (Table->Signature)) { AcpiLogError ("Table signature (0x%8.8X) is invalid\n", *(UINT32 *) Table->Signature); return (FALSE); } /* Check for minimum table length */ if (Table->Length < sizeof (ACPI_TABLE_HEADER)) { AcpiLogError ("Table length (0x%8.8X) is invalid\n", Table->Length); return (FALSE); } } return (TRUE); }
ACPI_STATUS AcpiTbVerifyTempTable ( ACPI_TABLE_DESC *TableDesc, char *Signature) { ACPI_STATUS Status = AE_OK; ACPI_FUNCTION_TRACE (TbVerifyTempTable); /* Validate the table */ Status = AcpiTbValidateTempTable (TableDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (AE_NO_MEMORY); } /* If a particular signature is expected (DSDT/FACS), it must match */ if (Signature && !ACPI_COMPARE_NAME (&TableDesc->Signature, Signature)) { ACPI_BIOS_ERROR ((AE_INFO, "Invalid signature 0x%X for ACPI table, expected [%s]", TableDesc->Signature.Integer, Signature)); Status = AE_BAD_SIGNATURE; goto InvalidateAndExit; } /* Verify the checksum */ if (AcpiGbl_VerifyTableChecksum) { Status = AcpiTbVerifyChecksum (TableDesc->Pointer, TableDesc->Length); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, AE_NO_MEMORY, "%4.4s 0x%8.8X%8.8X" " Attempted table install failed", AcpiUtValidAcpiName (TableDesc->Signature.Ascii) ? TableDesc->Signature.Ascii : "????", ACPI_FORMAT_UINT64 (TableDesc->Address))); goto InvalidateAndExit; } } return_ACPI_STATUS (AE_OK); InvalidateAndExit: AcpiTbInvalidateTable (TableDesc); return_ACPI_STATUS (Status); }
static BOOLEAN AbValidateHeader ( ACPI_TABLE_HEADER *Header) { if (!AcpiUtValidAcpiName (Header->Signature)) { printf ("Header signature is invalid\n"); return (FALSE); } return (TRUE); }
static BOOLEAN AbValidateHeader ( ACPI_TABLE_HEADER *Header) { if (!AcpiUtValidAcpiName (* (UINT32 *) &Header->Signature)) { printf ("Header signature is invalid\n"); return FALSE; } return TRUE; }
const char * AcpiUtGetNodeName ( void *Object) { ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) Object; /* Must return a string of exactly 4 characters == ACPI_NAME_SIZE */ if (!Object) { return ("NULL"); } /* Check for Root node */ if ((Object == ACPI_ROOT_OBJECT) || (Object == AcpiGbl_RootNode)) { return ("\"\\\" "); } /* Descriptor must be a namespace node */ if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) { return ("####"); } /* Name must be a valid ACPI name */ if (!AcpiUtValidAcpiName (Node->Name.Integer)) { Node->Name.Integer = AcpiUtRepairName (Node->Name.Ascii); } /* Return the name */ return (Node->Name.Ascii); }
static ACPI_STATUS AcpiDbIntegrityWalk ( ACPI_HANDLE ObjHandle, UINT32 NestingLevel, void *Context, void **ReturnValue) { ACPI_INTEGRITY_INFO *Info = (ACPI_INTEGRITY_INFO *) Context; ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; ACPI_OPERAND_OBJECT *Object; BOOLEAN Alias = TRUE; Info->Nodes++; /* Verify the NS node, and dereference aliases */ while (Alias) { if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) { AcpiOsPrintf ("Invalid Descriptor Type for Node %p [%s] - is %2.2X should be %2.2X\n", Node, AcpiUtGetDescriptorName (Node), ACPI_GET_DESCRIPTOR_TYPE (Node), ACPI_DESC_TYPE_NAMED); return (AE_OK); } if ((Node->Type == ACPI_TYPE_LOCAL_ALIAS) || (Node->Type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) { Node = (ACPI_NAMESPACE_NODE *) Node->Object; } else { Alias = FALSE; } } if (Node->Type > ACPI_TYPE_LOCAL_MAX) { AcpiOsPrintf ("Invalid Object Type for Node %p, Type = %X\n", Node, Node->Type); return (AE_OK); } if (!AcpiUtValidAcpiName (Node->Name.Ascii)) { AcpiOsPrintf ("Invalid AcpiName for Node %p\n", Node); return (AE_OK); } Object = AcpiNsGetAttachedObject (Node); if (Object) { Info->Objects++; if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND) { AcpiOsPrintf ("Invalid Descriptor Type for Object %p [%s]\n", Object, AcpiUtGetDescriptorName (Object)); } } return (AE_OK); }
ACPI_STATUS AcpiTbAddTable ( ACPI_TABLE_DESC *TableDesc, UINT32 *TableIndex) { UINT32 i; ACPI_STATUS Status = AE_OK; ACPI_FUNCTION_TRACE (TbAddTable); if (!TableDesc->Pointer) { Status = AcpiTbVerifyTable (TableDesc); if (ACPI_FAILURE (Status) || !TableDesc->Pointer) { return_ACPI_STATUS (Status); } } /* * Validate the incoming table signature. * * 1) Originally, we checked the table signature for "SSDT" or "PSDT". * 2) We added support for OEMx tables, signature "OEM". * 3) Valid tables were encountered with a null signature, so we just * gave up on validating the signature, (05/2008). * 4) We encountered non-AML tables such as the MADT, which caused * interpreter errors and kernel faults. So now, we once again allow * only "SSDT", "OEMx", and now, also a null signature. (05/2011). */ if ((TableDesc->Pointer->Signature[0] != 0x00) && (!ACPI_COMPARE_NAME (TableDesc->Pointer->Signature, ACPI_SIG_SSDT)) && (ACPI_STRNCMP (TableDesc->Pointer->Signature, "OEM", 3))) { ACPI_BIOS_ERROR ((AE_INFO, "Table has invalid signature [%4.4s] (0x%8.8X), " "must be SSDT or OEMx", AcpiUtValidAcpiName (TableDesc->Pointer->Signature) ? TableDesc->Pointer->Signature : "????", *(UINT32 *) TableDesc->Pointer->Signature)); return_ACPI_STATUS (AE_BAD_SIGNATURE); } (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); /* Check if table is already registered */ for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i) { if (!AcpiGbl_RootTableList.Tables[i].Pointer) { Status = AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[i]); if (ACPI_FAILURE (Status) || !AcpiGbl_RootTableList.Tables[i].Pointer) { continue; } } /* * Check for a table match on the entire table length, * not just the header. */ if (TableDesc->Length != AcpiGbl_RootTableList.Tables[i].Length) { continue; } if (ACPI_MEMCMP (TableDesc->Pointer, AcpiGbl_RootTableList.Tables[i].Pointer, AcpiGbl_RootTableList.Tables[i].Length)) { continue; } /* * Note: the current mechanism does not unregister a table if it is * dynamically unloaded. The related namespace entries are deleted, * but the table remains in the root table list. * * The assumption here is that the number of different tables that * will be loaded is actually small, and there is minimal overhead * in just keeping the table in case it is needed again. * * If this assumption changes in the future (perhaps on large * machines with many table load/unload operations), tables will * need to be unregistered when they are unloaded, and slots in the * root table list should be reused when empty. */ /* * Table is already registered. * We can delete the table that was passed as a parameter. */ AcpiTbDeleteTable (TableDesc); *TableIndex = i; if (AcpiGbl_RootTableList.Tables[i].Flags & ACPI_TABLE_IS_LOADED) { /* Table is still loaded, this is an error */ Status = AE_ALREADY_EXISTS; goto Release; } else { /* Table was unloaded, allow it to be reloaded */ TableDesc->Pointer = AcpiGbl_RootTableList.Tables[i].Pointer; TableDesc->Address = AcpiGbl_RootTableList.Tables[i].Address; Status = AE_OK; goto PrintHeader; } } /* * ACPI Table Override: * Allow the host to override dynamically loaded tables. * NOTE: the table is fully mapped at this point, and the mapping will * be deleted by TbTableOverride if the table is actually overridden. */ (void) AcpiTbTableOverride (TableDesc->Pointer, TableDesc); /* Add the table to the global root table list */ Status = AcpiTbStoreTable (TableDesc->Address, TableDesc->Pointer, TableDesc->Length, TableDesc->Flags, TableIndex); if (ACPI_FAILURE (Status)) { goto Release; } PrintHeader: AcpiTbPrintTableHeader (TableDesc->Address, TableDesc->Pointer); Release: (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); return_ACPI_STATUS (Status); }
static ACPI_STATUS AcpiNsDumpOneObject ( ACPI_HANDLE ObjHandle, UINT32 Level, void *Context, void **ReturnValue) { ACPI_WALK_INFO *Info = (ACPI_WALK_INFO *) Context; ACPI_NAMESPACE_NODE *ThisNode; UINT8 *Value; ACPI_OPERAND_OBJECT *ObjDesc = NULL; ACPI_OBJECT_TYPE8 ObjType; ACPI_OBJECT_TYPE8 Type; UINT32 BytesToDump; UINT32 DownstreamSiblingMask = 0; UINT32 LevelTmp; UINT32 WhichBit; PROC_NAME ("NsDumpOneObject"); ThisNode = AcpiNsConvertHandleToEntry (ObjHandle); LevelTmp = Level; Type = ThisNode->Type; WhichBit = 1; if (!(AcpiDbgLevel & Info->DebugLevel)) { return (AE_OK); } if (!ObjHandle) { ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n")); return (AE_OK); } /* Check if the owner matches */ if ((Info->OwnerId != ACPI_UINT32_MAX) && (Info->OwnerId != ThisNode->OwnerId)) { return (AE_OK); } /* Indent the object according to the level */ while (LevelTmp--) { /* Print appropriate characters to form tree structure */ if (LevelTmp) { if (DownstreamSiblingMask & WhichBit) { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "|")); } else { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " ")); } WhichBit <<= 1; } else { if (AcpiNsExistDownstreamSibling (ThisNode + 1)) { DownstreamSiblingMask |= (1 << (Level - 1)); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "+")); } else { DownstreamSiblingMask &= ACPI_UINT32_MAX ^ (1 << (Level - 1)); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "+")); } if (ThisNode->Child == NULL) { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "-")); } else if (AcpiNsExistDownstreamSibling (ThisNode->Child)) { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "+")); } else { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "-")); } } } /* Check the integrity of our data */ if (Type > INTERNAL_TYPE_MAX) { Type = INTERNAL_TYPE_DEF_ANY; /* prints as *ERROR* */ } if (!AcpiUtValidAcpiName (ThisNode->Name)) { REPORT_WARNING (("Invalid ACPI Name %08X\n", ThisNode->Name)); } /* * Now we can print out the pertinent information */ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " %4.4s %-9s ", &ThisNode->Name, AcpiUtGetTypeName (Type))); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "%p S:%p O:%p", ThisNode, ThisNode->Child, ThisNode->Object)); if (!ThisNode->Object) { /* No attached object, we are done */ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n")); return (AE_OK); } switch (Type) { case ACPI_TYPE_METHOD: /* Name is a Method and its AML offset/length are set */ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " M:%p-%X\n", ((ACPI_OPERAND_OBJECT *) ThisNode->Object)->Method.Pcode, ((ACPI_OPERAND_OBJECT *) ThisNode->Object)->Method.PcodeLength)); break; case ACPI_TYPE_INTEGER: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " N:%X\n", ((ACPI_OPERAND_OBJECT *) ThisNode->Object)->Integer.Value)); break; case ACPI_TYPE_STRING: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " S:%p-%X\n", ((ACPI_OPERAND_OBJECT *) ThisNode->Object)->String.Pointer, ((ACPI_OPERAND_OBJECT *) ThisNode->Object)->String.Length)); break; case ACPI_TYPE_BUFFER: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " B:%p-%X\n", ((ACPI_OPERAND_OBJECT *) ThisNode->Object)->Buffer.Pointer, ((ACPI_OPERAND_OBJECT *) ThisNode->Object)->Buffer.Length)); break; default: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n")); break; } /* If debug turned off, done */ if (!(AcpiDbgLevel & ACPI_LV_VALUES)) { return (AE_OK); } /* If there is an attached object, display it */ Value = ThisNode->Object; /* Dump attached objects */ while (Value) { ObjType = INTERNAL_TYPE_INVALID; /* Decode the type of attached object and dump the contents */ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Attached Object %p: ", Value)); if (AcpiTbSystemTablePointer (Value)) { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(Ptr to AML Code)\n")); BytesToDump = 16; } else if (VALID_DESCRIPTOR_TYPE (Value, ACPI_DESC_TYPE_NAMED)) { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(Ptr to Node)\n")); BytesToDump = sizeof (ACPI_NAMESPACE_NODE); } else if (VALID_DESCRIPTOR_TYPE (Value, ACPI_DESC_TYPE_INTERNAL)) { ObjDesc = (ACPI_OPERAND_OBJECT *) Value; ObjType = ObjDesc->Common.Type; if (ObjType > INTERNAL_TYPE_MAX) { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(Ptr to ACPI Object type %X [UNKNOWN])\n", ObjType)); BytesToDump = 32; } else { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(Ptr to ACPI Object type %X [%s])\n", ObjType, AcpiUtGetTypeName (ObjType))); BytesToDump = sizeof (ACPI_OPERAND_OBJECT); } } else { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(String or Buffer - not descriptor)\n", Value)); BytesToDump = 16; } DUMP_BUFFER (Value, BytesToDump); /* If value is NOT an internal object, we are done */ if ((AcpiTbSystemTablePointer (Value)) || (VALID_DESCRIPTOR_TYPE (Value, ACPI_DESC_TYPE_NAMED))) { goto Cleanup; } /* * Valid object, get the pointer to next level, if any */ switch (ObjType) { case ACPI_TYPE_STRING: Value = (UINT8 *) ObjDesc->String.Pointer; break; case ACPI_TYPE_BUFFER: Value = (UINT8 *) ObjDesc->Buffer.Pointer; break; case ACPI_TYPE_BUFFER_FIELD: Value = (UINT8 *) ObjDesc->BufferField.BufferObj; break; case ACPI_TYPE_PACKAGE: Value = (UINT8 *) ObjDesc->Package.Elements; break; case ACPI_TYPE_METHOD: Value = (UINT8 *) ObjDesc->Method.Pcode; break; case INTERNAL_TYPE_REGION_FIELD: Value = (UINT8 *) ObjDesc->Field.RegionObj; break; case INTERNAL_TYPE_BANK_FIELD: Value = (UINT8 *) ObjDesc->BankField.RegionObj; break; case INTERNAL_TYPE_INDEX_FIELD: Value = (UINT8 *) ObjDesc->IndexField.IndexObj; break; default: goto Cleanup; } ObjType = INTERNAL_TYPE_INVALID; /* Terminate loop after next pass */ } Cleanup: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n")); return (AE_OK); }
ACPI_STATUS AcpiTbInstallStandardTable ( ACPI_PHYSICAL_ADDRESS Address, UINT8 Flags, BOOLEAN Reload, BOOLEAN Override, UINT32 *TableIndex) { UINT32 i; ACPI_STATUS Status = AE_OK; ACPI_TABLE_DESC NewTableDesc; ACPI_FUNCTION_TRACE (TbInstallStandardTable); /* Acquire a temporary table descriptor for validation */ Status = AcpiTbAcquireTempTable (&NewTableDesc, Address, Flags); if (ACPI_FAILURE (Status)) { ACPI_ERROR ((AE_INFO, "Could not acquire table length at %8.8X%8.8X", ACPI_FORMAT_UINT64 (Address))); return_ACPI_STATUS (Status); } /* * Optionally do not load any SSDTs from the RSDT/XSDT. This can * be useful for debugging ACPI problems on some machines. */ if (!Reload && AcpiGbl_DisableSsdtTableInstall && ACPI_COMPARE_NAME (&NewTableDesc.Signature, ACPI_SIG_SSDT)) { ACPI_INFO ((AE_INFO, "Ignoring installation of %4.4s at %8.8X%8.8X", NewTableDesc.Signature.Ascii, ACPI_FORMAT_UINT64 (Address))); goto ReleaseAndExit; } /* Validate and verify a table before installation */ Status = AcpiTbVerifyTempTable (&NewTableDesc, NULL); if (ACPI_FAILURE (Status)) { goto ReleaseAndExit; } if (Reload) { /* * Validate the incoming table signature. * * 1) Originally, we checked the table signature for "SSDT" or "PSDT". * 2) We added support for OEMx tables, signature "OEM". * 3) Valid tables were encountered with a null signature, so we just * gave up on validating the signature, (05/2008). * 4) We encountered non-AML tables such as the MADT, which caused * interpreter errors and kernel faults. So now, we once again allow * only "SSDT", "OEMx", and now, also a null signature. (05/2011). */ if ((NewTableDesc.Signature.Ascii[0] != 0x00) && (!ACPI_COMPARE_NAME (&NewTableDesc.Signature, ACPI_SIG_SSDT)) && (strncmp (NewTableDesc.Signature.Ascii, "OEM", 3))) { ACPI_BIOS_ERROR ((AE_INFO, "Table has invalid signature [%4.4s] (0x%8.8X), " "must be SSDT or OEMx", AcpiUtValidAcpiName (NewTableDesc.Signature.Ascii) ? NewTableDesc.Signature.Ascii : "????", NewTableDesc.Signature.Integer)); Status = AE_BAD_SIGNATURE; goto ReleaseAndExit; } /* Check if table is already registered */ for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i) { /* * Check for a table match on the entire table length, * not just the header. */ if (!AcpiTbCompareTables (&NewTableDesc, i)) { continue; } /* * Note: the current mechanism does not unregister a table if it is * dynamically unloaded. The related namespace entries are deleted, * but the table remains in the root table list. * * The assumption here is that the number of different tables that * will be loaded is actually small, and there is minimal overhead * in just keeping the table in case it is needed again. * * If this assumption changes in the future (perhaps on large * machines with many table load/unload operations), tables will * need to be unregistered when they are unloaded, and slots in the * root table list should be reused when empty. */ if (AcpiGbl_RootTableList.Tables[i].Flags & ACPI_TABLE_IS_LOADED) { /* Table is still loaded, this is an error */ Status = AE_ALREADY_EXISTS; goto ReleaseAndExit; } else { /* * Table was unloaded, allow it to be reloaded. * As we are going to return AE_OK to the caller, we should * take the responsibility of freeing the input descriptor. * Refill the input descriptor to ensure * AcpiTbInstallTableWithOverride() can be called again to * indicate the re-installation. */ AcpiTbUninstallTable (&NewTableDesc); *TableIndex = i; return_ACPI_STATUS (AE_OK); } } } /* Add the table to the global root table list */ AcpiTbInstallTableWithOverride (&NewTableDesc, Override, TableIndex); ReleaseAndExit: /* Release the temporary table descriptor */ AcpiTbReleaseTempTable (&NewTableDesc); return_ACPI_STATUS (Status); }
ACPI_STATUS AcpiNsDumpOneObject ( ACPI_HANDLE ObjHandle, UINT32 Level, void *Context, void **ReturnValue) { ACPI_WALK_INFO *Info = (ACPI_WALK_INFO *) Context; ACPI_NAMESPACE_NODE *ThisNode; ACPI_OPERAND_OBJECT *ObjDesc = NULL; ACPI_OBJECT_TYPE ObjType; ACPI_OBJECT_TYPE Type; UINT32 BytesToDump; UINT32 DbgLevel; UINT32 i; ACPI_FUNCTION_NAME ("NsDumpOneObject"); /* Is output enabled? */ if (!(AcpiDbgLevel & Info->DebugLevel)) { return (AE_OK); } if (!ObjHandle) { ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n")); return (AE_OK); } ThisNode = AcpiNsMapHandleToNode (ObjHandle); Type = ThisNode->Type; /* Check if the owner matches */ if ((Info->OwnerId != ACPI_UINT32_MAX) && (Info->OwnerId != ThisNode->OwnerId)) { return (AE_OK); } /* Indent the object according to the level */ AcpiOsPrintf ("%2d%*s", (UINT32) Level - 1, (int) Level * 2, " "); /* Check the node type and name */ if (Type > ACPI_TYPE_LOCAL_MAX) { ACPI_REPORT_WARNING (("Invalid ACPI Type %08X\n", Type)); } if (!AcpiUtValidAcpiName (ThisNode->Name.Integer)) { ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n", ThisNode->Name.Integer)); } /* * Now we can print out the pertinent information */ AcpiOsPrintf ("%4.4s %-12s %p ", ThisNode->Name.Ascii, AcpiUtGetTypeName (Type), ThisNode); DbgLevel = AcpiDbgLevel; AcpiDbgLevel = 0; ObjDesc = AcpiNsGetAttachedObject (ThisNode); AcpiDbgLevel = DbgLevel; switch (Info->DisplayType) { case ACPI_DISPLAY_SUMMARY: if (!ObjDesc) { /* No attached object, we are done */ AcpiOsPrintf ("\n"); return (AE_OK); } switch (Type) { case ACPI_TYPE_PROCESSOR: AcpiOsPrintf ("ID %X Len %.4X Addr %p\n", ObjDesc->Processor.ProcId, ObjDesc->Processor.Length, (char *) ObjDesc->Processor.Address); break; case ACPI_TYPE_DEVICE: AcpiOsPrintf ("Notify object: %p", ObjDesc); break; case ACPI_TYPE_METHOD: AcpiOsPrintf ("Args %X Len %.4X Aml %p\n", (UINT32) ObjDesc->Method.ParamCount, ObjDesc->Method.AmlLength, ObjDesc->Method.AmlStart); break; case ACPI_TYPE_INTEGER: AcpiOsPrintf ("= %8.8X%8.8X\n", ACPI_HIDWORD (ObjDesc->Integer.Value), ACPI_LODWORD (ObjDesc->Integer.Value)); break; case ACPI_TYPE_PACKAGE: if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) { AcpiOsPrintf ("Elements %.2X\n", ObjDesc->Package.Count); } else { AcpiOsPrintf ("[Length not yet evaluated]\n"); } break; case ACPI_TYPE_BUFFER: if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) { AcpiOsPrintf ("Len %.2X", ObjDesc->Buffer.Length); /* Dump some of the buffer */ if (ObjDesc->Buffer.Length > 0) { AcpiOsPrintf (" ="); for (i = 0; (i < ObjDesc->Buffer.Length && i < 12); i++) { AcpiOsPrintf (" %.2hX", ObjDesc->Buffer.Pointer[i]); } } AcpiOsPrintf ("\n"); } else { AcpiOsPrintf ("[Length not yet evaluated]\n"); } break; case ACPI_TYPE_STRING: AcpiOsPrintf ("Len %.2X ", ObjDesc->String.Length); AcpiUtPrintString (ObjDesc->String.Pointer, 32); AcpiOsPrintf ("\n"); break; case ACPI_TYPE_REGION: AcpiOsPrintf ("[%s]", AcpiUtGetRegionName (ObjDesc->Region.SpaceId)); if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID) { AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n", ACPI_HIDWORD (ObjDesc->Region.Address), ACPI_LODWORD (ObjDesc->Region.Address), ObjDesc->Region.Length); } else { AcpiOsPrintf (" [Address/Length not yet evaluated]\n"); } break; case ACPI_TYPE_LOCAL_REFERENCE: AcpiOsPrintf ("[%s]\n", AcpiPsGetOpcodeName (ObjDesc->Reference.Opcode)); break; case ACPI_TYPE_BUFFER_FIELD: if (ObjDesc->BufferField.BufferObj && ObjDesc->BufferField.BufferObj->Buffer.Node) { AcpiOsPrintf ("Buf [%4.4s]", ObjDesc->BufferField.BufferObj->Buffer.Node->Name.Ascii); } break; case ACPI_TYPE_LOCAL_REGION_FIELD: AcpiOsPrintf ("Rgn [%4.4s]", ObjDesc->CommonField.RegionObj->Region.Node->Name.Ascii); break; case ACPI_TYPE_LOCAL_BANK_FIELD: AcpiOsPrintf ("Rgn [%4.4s] Bnk [%4.4s]", ObjDesc->CommonField.RegionObj->Region.Node->Name.Ascii, ObjDesc->BankField.BankObj->CommonField.Node->Name.Ascii); break; case ACPI_TYPE_LOCAL_INDEX_FIELD: AcpiOsPrintf ("Idx [%4.4s] Dat [%4.4s]", ObjDesc->IndexField.IndexObj->CommonField.Node->Name.Ascii, ObjDesc->IndexField.DataObj->CommonField.Node->Name.Ascii); break; case ACPI_TYPE_LOCAL_ALIAS: AcpiOsPrintf ("Target %4.4s (%p)\n", ((ACPI_NAMESPACE_NODE *) ObjDesc)->Name.Ascii, ObjDesc); break; default: AcpiOsPrintf ("Object %p\n", ObjDesc); break; } /* Common field handling */ switch (Type) { case ACPI_TYPE_BUFFER_FIELD: case ACPI_TYPE_LOCAL_REGION_FIELD: case ACPI_TYPE_LOCAL_BANK_FIELD: case ACPI_TYPE_LOCAL_INDEX_FIELD: AcpiOsPrintf (" Off %.2X Len %.2X Acc %.2hd\n", (ObjDesc->CommonField.BaseByteOffset * 8) + ObjDesc->CommonField.StartFieldBitOffset, ObjDesc->CommonField.BitLength, ObjDesc->CommonField.AccessByteWidth); break; default: break; } break; case ACPI_DISPLAY_OBJECTS: AcpiOsPrintf ("O:%p", ObjDesc); if (!ObjDesc) { /* No attached object, we are done */ AcpiOsPrintf ("\n"); return (AE_OK); } AcpiOsPrintf ("(R%d)", ObjDesc->Common.ReferenceCount); switch (Type) { case ACPI_TYPE_METHOD: /* Name is a Method and its AML offset/length are set */ AcpiOsPrintf (" M:%p-%X\n", ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength); break; case ACPI_TYPE_INTEGER: AcpiOsPrintf (" N:%X%X\n", ACPI_HIDWORD(ObjDesc->Integer.Value), ACPI_LODWORD(ObjDesc->Integer.Value)); break; case ACPI_TYPE_STRING: AcpiOsPrintf (" S:%p-%X\n", ObjDesc->String.Pointer, ObjDesc->String.Length); break; case ACPI_TYPE_BUFFER: AcpiOsPrintf (" B:%p-%X\n", ObjDesc->Buffer.Pointer, ObjDesc->Buffer.Length); break; default: AcpiOsPrintf ("\n"); break; } break; default: AcpiOsPrintf ("\n"); break; } /* If debug turned off, done */ if (!(AcpiDbgLevel & ACPI_LV_VALUES)) { return (AE_OK); } /* If there is an attached object, display it */ DbgLevel = AcpiDbgLevel; AcpiDbgLevel = 0; ObjDesc = AcpiNsGetAttachedObject (ThisNode); AcpiDbgLevel = DbgLevel; /* Dump attached objects */ while (ObjDesc) { ObjType = ACPI_TYPE_INVALID; AcpiOsPrintf (" Attached Object %p: ", ObjDesc); /* Decode the type of attached object and dump the contents */ switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)) { case ACPI_DESC_TYPE_NAMED: AcpiOsPrintf ("(Ptr to Node)\n"); BytesToDump = sizeof (ACPI_NAMESPACE_NODE); break; case ACPI_DESC_TYPE_OPERAND: ObjType = ACPI_GET_OBJECT_TYPE (ObjDesc); if (ObjType > ACPI_TYPE_LOCAL_MAX) { AcpiOsPrintf ("(Ptr to ACPI Object type %X [UNKNOWN])\n", ObjType); BytesToDump = 32; } else { AcpiOsPrintf ("(Ptr to ACPI Object type %s, %X)\n", AcpiUtGetTypeName (ObjType), ObjType); BytesToDump = sizeof (ACPI_OPERAND_OBJECT); } break; default: AcpiOsPrintf ("(String or Buffer ptr - not an object descriptor)\n"); BytesToDump = 16; break; } ACPI_DUMP_BUFFER (ObjDesc, BytesToDump); /* If value is NOT an internal object, we are done */ if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) { goto Cleanup; } /* * Valid object, get the pointer to next level, if any */ switch (ObjType) { case ACPI_TYPE_STRING: ObjDesc = (void *) ObjDesc->String.Pointer; break; case ACPI_TYPE_BUFFER: ObjDesc = (void *) ObjDesc->Buffer.Pointer; break; case ACPI_TYPE_BUFFER_FIELD: ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BufferField.BufferObj; break; case ACPI_TYPE_PACKAGE: ObjDesc = (void *) ObjDesc->Package.Elements; break; case ACPI_TYPE_METHOD: ObjDesc = (void *) ObjDesc->Method.AmlStart; break; case ACPI_TYPE_LOCAL_REGION_FIELD: ObjDesc = (void *) ObjDesc->Field.RegionObj; break; case ACPI_TYPE_LOCAL_BANK_FIELD: ObjDesc = (void *) ObjDesc->BankField.RegionObj; break; case ACPI_TYPE_LOCAL_INDEX_FIELD: ObjDesc = (void *) ObjDesc->IndexField.IndexObj; break; default: goto Cleanup; } ObjType = ACPI_TYPE_INVALID; /* Terminate loop after next pass */ } Cleanup: AcpiOsPrintf ("\n"); return (AE_OK); }