diff options
72 files changed, 1041 insertions, 661 deletions
diff --git a/sys/conf/files b/sys/conf/files index 8da969c..7462906 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -401,7 +401,7 @@ contrib/dev/acpica/components/parser/psxface.c optional acpi contrib/dev/acpica/components/resources/rsaddr.c optional acpi contrib/dev/acpica/components/resources/rscalc.c optional acpi contrib/dev/acpica/components/resources/rscreate.c optional acpi -contrib/dev/acpica/components/resources/rsdump.c optional acpi +contrib/dev/acpica/components/resources/rsdump.c optional acpi acpi_debug contrib/dev/acpica/components/resources/rsdumpinfo.c optional acpi contrib/dev/acpica/components/resources/rsinfo.c optional acpi contrib/dev/acpica/components/resources/rsio.c optional acpi diff --git a/sys/contrib/dev/acpica/changes.txt b/sys/contrib/dev/acpica/changes.txt index 4a4f073..2782921 100644 --- a/sys/contrib/dev/acpica/changes.txt +++ b/sys/contrib/dev/acpica/changes.txt @@ -1,4 +1,90 @@ ---------------------------------------- +18 August 2015. Summary of changes for version 20150818: + +This release is available at https://acpica.org/downloads + +1) ACPICA kernel-resident subsystem: + +Fix a regression for AcpiGetTableByIndex interface causing it to fail. Lv +Zheng. ACPICA BZ 1186. + +Completed development to ensure that the ACPICA Disassembler and Debugger +are fully standalone components of ACPICA. Removed cross-component +dependences. Lv Zheng. + +The max-number-of-AML-loops is now runtime configurable (previously was +compile-time only). This is essentially a loop timeout to force-abort +infinite AML loops. ACPCIA BZ 1192. + +Debugger: Cleanup output to dump ACPI names and namepaths without any +trailing underscores. Lv Zheng. ACPICA BZ 1135. + +Removed unnecessary conditional compilations across the Debugger and +Disassembler components where entire modules could be left uncompiled. + +The aapits test is deprecated and has been removed from the ACPICA git +tree. The test has never been completed and has not been maintained, thus +becoming rather useless. ACPICA BZ 1015, 794. + +A batch of small changes to close bugzilla and other reports: +- Remove duplicate code for _PLD processing. ACPICA BZ 1176. +- Correctly cleanup after a ACPI table load failure. ACPICA BZ 1185. +- iASL: Support POSIX yacc again in makefile. Jung-uk Kim. +- ACPI table support: general cleanup and simplification. Lv Zheng, Bob +Moore. +- ACPI table support: fix for a buffer read overrun in AcpiTbFindTable. +ACPICA BZ 1184. +- Enhance parameter validation for DataTableRegion and LoadTable ASL/AML +operators. +- Debugger: Split debugger initialization/termination interfaces. Lv +Zheng. +- AcpiExec: Emit OemTableId for SSDTs during the load phase for table +identification. +- AcpiExec: Add debug message during _REG method phase during table +load/init. +- AcpiNames: Fix a regression where some output was missing and no longer +emitted. +- Debugger: General cleanup and simplification. Lv Zheng. +- Disassembler: Cleanup use of several global option variables. Lv Zheng. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. + + Current Release: + Non-Debug Version: 101.3K Code, 27.7K Data, 129.0K Total + Debug Version: 198.6K Code, 80.9K Data, 279.5K Total + Previous Release: + Non-Debug Version: 100.9K Code, 24.5K Data, 125.4K Total + Debug Version: 197.8K Code, 81.5K Data, 279.3K Total + + +2) iASL Compiler/Disassembler and Tools: + +AcpiExec: Fixed a problem where any more than 32 ACPI tables in the XSDT +were not handled properly and caused load errors. Now, properly invoke +and use the ACPICA auto-reallocate mechanism for ACPI table data +structures. ACPICA BZ 1188 + +AcpiNames: Add command-line wildcard support for ACPI table files. ACPICA +BZ 1190. + +AcpiExec and AcpiNames: Add -l option to load ACPI tables only. For +AcpiExec, this means that no control methods (like _REG/_INI/_STA) are +executed during initialization. ACPICA BZ 1187, 1189. + +iASL/Disassembler: Implemented a prototype "listing" mode that emits AML +that corresponds to each disassembled ASL statement, to simplify +debugging. ACPICA BZ 1191. + +Debugger: Add option to the "objects" command to display a summary of the +current namespace objects (Object type and count). This is displayed if +the command is entered with no arguments. + +AcpiNames: Add -x option to specify debug level, similar to AcpiExec. + +---------------------------------------- 17 July 2015. Summary of changes for version 20150717: 1) ACPICA kernel-resident subsystem: diff --git a/sys/contrib/dev/acpica/common/adisasm.c b/sys/contrib/dev/acpica/common/adisasm.c index a2cd226..68df6db 100644 --- a/sys/contrib/dev/acpica/common/adisasm.c +++ b/sys/contrib/dev/acpica/common/adisasm.c @@ -133,7 +133,7 @@ AcpiDsMethodDataInitArgs ( static ACPI_TABLE_DESC LocalTables[1]; -ACPI_PARSE_OBJECT *AcpiGbl_ParseOpRoot; +static ACPI_PARSE_OBJECT *AcpiGbl_ParseOpRoot; /******************************************************************************* @@ -187,7 +187,6 @@ AdInitialize ( AcpiGbl_RootTableList.CurrentTableCount = 0; AcpiGbl_RootTableList.Tables = LocalTables; - AcpiGbl_PreviousOp = NULL; return (Status); } @@ -317,7 +316,7 @@ AdAmlDisassemble ( return (Status); } - if (!AcpiGbl_DbOpt_Disasm) + if (!AcpiGbl_DmOpt_Disasm) { return (AE_OK); } @@ -506,7 +505,7 @@ AdAmlDisassemble ( /* Optional displays */ - if (AcpiGbl_DbOpt_Disasm) + if (AcpiGbl_DmOpt_Disasm) { /* This is the real disassembly */ @@ -742,7 +741,7 @@ AdDisplayTables ( return (AE_NOT_EXIST); } - if (!AcpiGbl_DbOpt_Verbose) + if (!AcpiGbl_DmOpt_Listing) { AdCreateTableHeader (Filename, Table); } @@ -750,7 +749,7 @@ AdDisplayTables ( AcpiDmDisassemble (NULL, AcpiGbl_ParseOpRoot, ACPI_UINT32_MAX); MpEmitMappingInfo (); - if (AcpiGbl_DbOpt_Verbose) + if (AcpiGbl_DmOpt_Listing) { AcpiOsPrintf ("\n\nTable Header:\n"); AcpiUtDebugDumpBuffer ((UINT8 *) Table, sizeof (ACPI_TABLE_HEADER), diff --git a/sys/contrib/dev/acpica/common/dmtable.c b/sys/contrib/dev/acpica/common/dmtable.c index 1e97658..44657d8 100644 --- a/sys/contrib/dev/acpica/common/dmtable.c +++ b/sys/contrib/dev/acpica/common/dmtable.c @@ -702,7 +702,7 @@ AcpiDmLineHeader2 ( * SubtableLength - Length of this sub-descriptor * Info - Info table for this ACPI table * - * RETURN: None + * RETURN: Status * * DESCRIPTION: Display ACPI table contents by walking the Info table. * diff --git a/sys/contrib/dev/acpica/compiler/aslmain.c b/sys/contrib/dev/acpica/compiler/aslmain.c index 611183a..47b8b6c 100644 --- a/sys/contrib/dev/acpica/compiler/aslmain.c +++ b/sys/contrib/dev/acpica/compiler/aslmain.c @@ -192,6 +192,7 @@ Usage ( ACPI_OPTION ("-e <f1 f2 ...>", "Include ACPI table(s) for external symbol resolution"); ACPI_OPTION ("-fe <file>", "Specify external symbol declaration file"); ACPI_OPTION ("-in", "Ignore NoOp opcodes"); + ACPI_OPTION ("-l", "Disassemble to mixed ASL and AML code"); ACPI_OPTION ("-vt", "Dump binary table data in hex format within output file"); printf ("\nDebug Options:\n"); @@ -298,6 +299,8 @@ AslInitialize ( UINT32 i; + AcpiGbl_DmOpt_Verbose = FALSE; + for (i = 0; i < ASL_NUM_FILES; i++) { Gbl_Files[i].Handle = NULL; diff --git a/sys/contrib/dev/acpica/compiler/asloperands.c b/sys/contrib/dev/acpica/compiler/asloperands.c index df63357..5b16ea1 100644 --- a/sys/contrib/dev/acpica/compiler/asloperands.c +++ b/sys/contrib/dev/acpica/compiler/asloperands.c @@ -932,13 +932,13 @@ OpnDoDefinitionBlock ( if (Child->Asl.Value.String) { Gbl_TableSignature = Child->Asl.Value.String; - if (strlen (Gbl_TableSignature) != 4) + if (strlen (Gbl_TableSignature) != ACPI_NAME_SIZE) { AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child, - "Length not exactly 4"); + "Length is not exactly 4"); } - for (i = 0; i < 4; i++) + for (i = 0; i < ACPI_NAME_SIZE; i++) { if (!isalnum ((int) Gbl_TableSignature[i])) { diff --git a/sys/contrib/dev/acpica/compiler/asloptions.c b/sys/contrib/dev/acpica/compiler/asloptions.c index 89d42ce..a211749 100644 --- a/sys/contrib/dev/acpica/compiler/asloptions.c +++ b/sys/contrib/dev/acpica/compiler/asloptions.c @@ -286,11 +286,6 @@ AslDoOptions ( AcpiGbl_CstyleDisassembly = FALSE; break; - case 'v': - - AcpiGbl_DbOpt_Verbose = TRUE; - break; - default: printf ("Unknown option: -d%s\n", AcpiGbl_Optarg); @@ -445,6 +440,7 @@ AslDoOptions ( /* Produce listing file (Mixed source/aml) */ Gbl_ListingFlag = TRUE; + AcpiGbl_DmOpt_Listing = TRUE; break; case 'i': diff --git a/sys/contrib/dev/acpica/compiler/aslstartup.c b/sys/contrib/dev/acpica/compiler/aslstartup.c index d20cc1f..39fad4f 100644 --- a/sys/contrib/dev/acpica/compiler/aslstartup.c +++ b/sys/contrib/dev/acpica/compiler/aslstartup.c @@ -253,7 +253,7 @@ AslDoDisassembly ( /* This is where the disassembly happens */ - AcpiGbl_DbOpt_Disasm = TRUE; + AcpiGbl_DmOpt_Disasm = TRUE; Status = AdAmlDisassemble (AslToFile, Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_OutputFilenamePrefix, &Gbl_Files[ASL_FILE_INPUT].Filename); diff --git a/sys/contrib/dev/acpica/components/debugger/dbcmds.c b/sys/contrib/dev/acpica/components/debugger/dbcmds.c index fd98281..e504130 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbcmds.c +++ b/sys/contrib/dev/acpica/components/debugger/dbcmds.c @@ -49,7 +49,6 @@ #include <contrib/dev/acpica/include/acresrc.h> #include <contrib/dev/acpica/include/actables.h> -#ifdef ACPI_DEBUGGER #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dbcmds") @@ -88,6 +87,7 @@ AcpiDbDoOneSleepState ( static char *AcpiDbTraceMethodName = NULL; + /******************************************************************************* * * FUNCTION: AcpiDbConvertToNode @@ -140,7 +140,8 @@ AcpiDbConvertToNode ( Node = AcpiDbLocalNsLookup (InString); if (!Node) { - AcpiOsPrintf ("Could not find [%s] in namespace, defaulting to root node\n", + AcpiOsPrintf ( + "Could not find [%s] in namespace, defaulting to root node\n", InString); Node = AcpiGbl_RootNode; } @@ -203,7 +204,7 @@ AcpiDbSleep ( * * PARAMETERS: SleepState - Desired sleep state (0-5) * - * RETURN: Status + * RETURN: None * * DESCRIPTION: Simulate a sleep/wake sequence * @@ -340,7 +341,8 @@ AcpiDbDisplayTableInfo ( /* Header */ - AcpiOsPrintf ("Idx ID Status Type TableHeader (Sig, Address, Length)\n"); + AcpiOsPrintf ("Idx ID Status Type " + "TableHeader (Sig, Address, Length, Misc)\n"); /* Walk the entire root table list */ @@ -499,7 +501,8 @@ AcpiDbSendNotify ( else { AcpiOsPrintf ( - "Named object [%4.4s] Type %s, must be Device/Thermal/Processor type\n", + "Named object [%4.4s] Type %s, " + "must be Device/Thermal/Processor type\n", AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type)); } } @@ -532,8 +535,7 @@ AcpiDbDisplayInterfaces ( if (!ActionArg) { - (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, - ACPI_WAIT_FOREVER); + (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); NextInterface = AcpiGbl_SupportedInterfaces; while (NextInterface) @@ -542,6 +544,7 @@ AcpiDbDisplayInterfaces ( { AcpiOsPrintf ("%s\n", NextInterface->Name); } + NextInterface = NextInterface->Next; } @@ -647,7 +650,8 @@ AcpiDbDisplayTemplate ( if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("Could not convert Buffer to a resource list: %s, %s\n", + AcpiOsPrintf ( + "Could not convert Buffer to a resource list: %s, %s\n", BufferArg, AcpiFormatException (Status)); goto DumpBuffer; } @@ -708,7 +712,8 @@ AcpiDmCompareAmlResources ( if (Aml1BufferLength != Aml2BufferLength) { AcpiOsPrintf ( - "**** Buffer length mismatch in converted AML: Original %X, New %X ****\n", + "**** Buffer length mismatch in converted " + "AML: Original %X, New %X ****\n", Aml1BufferLength, Aml2BufferLength); } @@ -732,7 +737,8 @@ AcpiDmCompareAmlResources ( if (Aml1Length != Aml2Length) { AcpiOsPrintf ( - "**** Length mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X Len1 %X, Len2 %X ****\n", + "**** Length mismatch in descriptor [%.2X] type %2.2X, " + "Offset %8.8X Len1 %X, Len2 %X ****\n", Count, ResourceType, Offset, Aml1Length, Aml2Length); } @@ -741,7 +747,8 @@ AcpiDmCompareAmlResources ( else if (memcmp (Aml1, Aml2, Aml1Length)) { AcpiOsPrintf ( - "**** Data mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X ****\n", + "**** Data mismatch in descriptor [%.2X] type %2.2X, " + "Offset %8.8X ****\n", Count, ResourceType, Offset); for (i = 0; i < Aml1Length; i++) @@ -749,7 +756,8 @@ AcpiDmCompareAmlResources ( if (Aml1[i] != Aml2[i]) { AcpiOsPrintf ( - "Mismatch at byte offset %.2X: is %2.2X, should be %2.2X\n", + "Mismatch at byte offset %.2X: is %2.2X, " + "should be %2.2X\n", i, Aml2[i], Aml1[i]); } } @@ -914,10 +922,15 @@ AcpiDbDeviceResources ( /* Get handles to the resource methods for this device */ - (void) AcpiGetHandle (Node, METHOD_NAME__PRT, ACPI_CAST_PTR (ACPI_HANDLE, &PrtNode)); - (void) AcpiGetHandle (Node, METHOD_NAME__CRS, ACPI_CAST_PTR (ACPI_HANDLE, &CrsNode)); - (void) AcpiGetHandle (Node, METHOD_NAME__PRS, ACPI_CAST_PTR (ACPI_HANDLE, &PrsNode)); - (void) AcpiGetHandle (Node, METHOD_NAME__AEI, ACPI_CAST_PTR (ACPI_HANDLE, &AeiNode)); + (void) AcpiGetHandle (Node, METHOD_NAME__PRT, + ACPI_CAST_PTR (ACPI_HANDLE, &PrtNode)); + (void) AcpiGetHandle (Node, METHOD_NAME__CRS, + ACPI_CAST_PTR (ACPI_HANDLE, &CrsNode)); + (void) AcpiGetHandle (Node, METHOD_NAME__PRS, + ACPI_CAST_PTR (ACPI_HANDLE, &PrsNode)); + (void) AcpiGetHandle (Node, METHOD_NAME__AEI, + ACPI_CAST_PTR (ACPI_HANDLE, &AeiNode)); + if (!PrtNode && !CrsNode && !PrsNode && !AeiNode) { goto Cleanup; /* Nothing to do */ @@ -1071,7 +1084,8 @@ GetPrs: goto GetAei; } - AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer)); + AcpiRsDumpResourceList (ACPI_CAST_PTR ( + ACPI_RESOURCE, AcpiGbl_DbBuffer)); } @@ -1104,7 +1118,8 @@ GetAei: goto Cleanup; } - AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer)); + AcpiRsDumpResourceList (ACPI_CAST_PTR ( + ACPI_RESOURCE, AcpiGbl_DbBuffer)); } @@ -1143,7 +1158,7 @@ AcpiDbDisplayResources ( if (!ObjectArg || (!strcmp (ObjectArg, "*"))) { (void) AcpiWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, AcpiDbDeviceResources, NULL, NULL, NULL); + ACPI_UINT32_MAX, AcpiDbDeviceResources, NULL, NULL, NULL); } else { @@ -1154,7 +1169,8 @@ AcpiDbDisplayResources ( { if (Node->Type != ACPI_TYPE_DEVICE) { - AcpiOsPrintf ("%4.4s: Name is not a device object (%s)\n", + AcpiOsPrintf ( + "%4.4s: Name is not a device object (%s)\n", Node->Name.Ascii, AcpiUtGetTypeName (Node->Type)); } else @@ -1219,6 +1235,19 @@ AcpiDbGenerateGpe ( (void) AcpiEvGpeDispatch (NULL, GpeEventInfo, GpeNumber); } + +/******************************************************************************* + * + * FUNCTION: AcpiDbGenerateSci + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Simulate an SCI -- just call the SCI dispatch. + * + ******************************************************************************/ + void AcpiDbGenerateSci ( void) @@ -1259,10 +1288,12 @@ AcpiDbTrace ( { AcpiUtStrupr (EnableArg); } + if (OnceArg) { AcpiUtStrupr (OnceArg); } + if (MethodArg) { if (AcpiDbTraceMethodName) @@ -1270,14 +1301,18 @@ AcpiDbTrace ( ACPI_FREE (AcpiDbTraceMethodName); AcpiDbTraceMethodName = NULL; } + AcpiDbTraceMethodName = ACPI_ALLOCATE (strlen (MethodArg) + 1); if (!AcpiDbTraceMethodName) { - AcpiOsPrintf ("Failed to allocate method name (%s)\n", MethodArg); + AcpiOsPrintf ("Failed to allocate method name (%s)\n", + MethodArg); return; } + strcpy (AcpiDbTraceMethodName, MethodArg); } + if (!strcmp (EnableArg, "ENABLE") || !strcmp (EnableArg, "METHOD") || !strcmp (EnableArg, "OPCODE")) @@ -1298,10 +1333,12 @@ AcpiDbTrace ( } Flags = ACPI_TRACE_ENABLED; + if (!strcmp (EnableArg, "OPCODE")) { Flags |= ACPI_TRACE_OPCODE; } + if (OnceArg && !strcmp (OnceArg, "ONCE")) { Flags |= ACPI_TRACE_ONESHOT; @@ -1309,7 +1346,5 @@ AcpiDbTrace ( } (void) AcpiDebugTrace (AcpiDbTraceMethodName, - DebugLevel, DebugLayer, Flags); + DebugLevel, DebugLayer, Flags); } - -#endif /* ACPI_DEBUGGER */ diff --git a/sys/contrib/dev/acpica/components/debugger/dbconvert.c b/sys/contrib/dev/acpica/components/debugger/dbconvert.c index 08931e4..bb024e0 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbconvert.c +++ b/sys/contrib/dev/acpica/components/debugger/dbconvert.c @@ -45,7 +45,6 @@ #include <contrib/dev/acpica/include/accommon.h> #include <contrib/dev/acpica/include/acdebug.h> -#ifdef ACPI_DEBUGGER #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dbconvert") @@ -528,5 +527,3 @@ AcpiDbDumpPldBuffer ( ACPI_FREE (PldInfo); ACPI_FREE (NewBuffer); } - -#endif /* ACPI_DEBUGGER */ diff --git a/sys/contrib/dev/acpica/components/debugger/dbdisply.c b/sys/contrib/dev/acpica/components/debugger/dbdisply.c index 94080f3..697cb21 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbdisply.c +++ b/sys/contrib/dev/acpica/components/debugger/dbdisply.c @@ -51,8 +51,6 @@ #include <contrib/dev/acpica/include/acdebug.h> -#ifdef ACPI_DEBUGGER - #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dbdisply") @@ -242,7 +240,8 @@ AcpiDbDecodeAndDisplayObject ( ObjPtr = AcpiDbGetPointer (Target); if (!AcpiOsReadable (ObjPtr, 16)) { - AcpiOsPrintf ("Address %p is invalid in this address space\n", + AcpiOsPrintf ( + "Address %p is invalid in this address space\n", ObjPtr); return; } @@ -258,7 +257,8 @@ AcpiDbDecodeAndDisplayObject ( if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_NAMESPACE_NODE))) { AcpiOsPrintf ( - "Cannot read entire Named object at address %p\n", ObjPtr); + "Cannot read entire Named object at address %p\n", + ObjPtr); return; } @@ -271,13 +271,14 @@ AcpiDbDecodeAndDisplayObject ( if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_OPERAND_OBJECT))) { - AcpiOsPrintf ("Cannot read entire ACPI object at address %p\n", + AcpiOsPrintf ( + "Cannot read entire ACPI object at address %p\n", ObjPtr); return; } - AcpiUtDebugDumpBuffer (ObjPtr, sizeof (ACPI_OPERAND_OBJECT), Display, - ACPI_UINT32_MAX); + AcpiUtDebugDumpBuffer (ObjPtr, sizeof (ACPI_OPERAND_OBJECT), + Display, ACPI_UINT32_MAX); AcpiExDumpObjectDescriptor (ObjPtr, 1); break; @@ -288,12 +289,13 @@ AcpiDbDecodeAndDisplayObject ( if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_PARSE_OBJECT))) { AcpiOsPrintf ( - "Cannot read entire Parser object at address %p\n", ObjPtr); + "Cannot read entire Parser object at address %p\n", + ObjPtr); return; } - AcpiUtDebugDumpBuffer (ObjPtr, sizeof (ACPI_PARSE_OBJECT), Display, - ACPI_UINT32_MAX); + AcpiUtDebugDumpBuffer (ObjPtr, sizeof (ACPI_PARSE_OBJECT), + Display, ACPI_UINT32_MAX); AcpiDbDumpParserDescriptor ((ACPI_PARSE_OBJECT *) ObjPtr); break; @@ -332,7 +334,7 @@ AcpiDbDecodeAndDisplayObject ( DumpNode: /* Now dump the NS node */ - Status = AcpiGetName (Node, ACPI_FULL_PATHNAME, &RetBuf); + Status = AcpiGetName (Node, ACPI_FULL_PATHNAME_NO_TRAILING, &RetBuf); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Could not convert name to pathname\n"); @@ -365,8 +367,8 @@ DumpNode: return; } - AcpiUtDebugDumpBuffer ((void *) ObjDesc, sizeof (ACPI_OPERAND_OBJECT), - Display, ACPI_UINT32_MAX); + AcpiUtDebugDumpBuffer ((void *) ObjDesc, + sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX); AcpiExDumpObjectDescriptor (ObjDesc, 1); } } @@ -587,7 +589,7 @@ AcpiDbDisplayResults ( } AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n", - AcpiUtGetNodeName (Node), ResultCount); + AcpiUtGetNodeName (Node), ResultCount); /* From the top element of result stack */ @@ -599,11 +601,13 @@ AcpiDbDisplayResults ( ObjDesc = Frame->Results.ObjDesc[Index]; AcpiOsPrintf ("Result%u: ", i); AcpiDbDisplayInternalObject (ObjDesc, WalkState); + if (Index == 0) { Frame = Frame->Results.Next; Index = ACPI_RESULTS_FRAME_OBJ_NUM; } + Index--; } } @@ -642,7 +646,6 @@ AcpiDbDisplayCallingTree ( while (WalkState) { Node = WalkState->MethodNode; - AcpiOsPrintf (" [%4.4s]\n", AcpiUtGetNodeName (Node)); WalkState = WalkState->Next; @@ -710,14 +713,17 @@ AcpiDbDisplayObjectType ( { AcpiOsPrintf ("HID: %s\n", Info->HardwareId.String); } + if (Info->Valid & ACPI_VALID_UID) { AcpiOsPrintf ("UID: %s\n", Info->UniqueId.String); } + if (Info->Valid & ACPI_VALID_SUB) { AcpiOsPrintf ("SUB: %s\n", Info->SubsystemId.String); } + if (Info->Valid & ACPI_VALID_CID) { for (i = 0; i < Info->CompatibleIdList.Count; i++) @@ -842,7 +848,8 @@ AcpiDbDisplayGpes ( GpeBlock = GpeXruptInfo->GpeBlockListHead; while (GpeBlock) { - Status = AcpiGetName (GpeBlock->Node, ACPI_FULL_PATHNAME, &RetBuf); + Status = AcpiGetName (GpeBlock->Node, + ACPI_FULL_PATHNAME_NO_TRAILING, &RetBuf); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Could not convert name to pathname\n"); @@ -857,13 +864,16 @@ AcpiDbDisplayGpes ( GpeType = "GPE Block Device"; } - AcpiOsPrintf ("\nBlock %u - Info %p DeviceNode %p [%s] - %s\n", + AcpiOsPrintf ( + "\nBlock %u - Info %p DeviceNode %p [%s] - %s\n", Block, GpeBlock, GpeBlock->Node, Buffer, GpeType); - AcpiOsPrintf (" Registers: %u (%u GPEs)\n", + AcpiOsPrintf ( + " Registers: %u (%u GPEs)\n", GpeBlock->RegisterCount, GpeBlock->GpeCount); - AcpiOsPrintf (" GPE range: 0x%X to 0x%X on interrupt %u\n", + AcpiOsPrintf ( + " GPE range: 0x%X to 0x%X on interrupt %u\n", GpeBlock->BlockBaseNumber, GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1), GpeXruptInfo->InterruptNumber); @@ -871,8 +881,10 @@ AcpiDbDisplayGpes ( AcpiOsPrintf ( " RegisterInfo: %p Status %8.8X%8.8X Enable %8.8X%8.8X\n", GpeBlock->RegisterInfo, - ACPI_FORMAT_UINT64 (GpeBlock->RegisterInfo->StatusAddress.Address), - ACPI_FORMAT_UINT64 (GpeBlock->RegisterInfo->EnableAddress.Address)); + ACPI_FORMAT_UINT64 ( + GpeBlock->RegisterInfo->StatusAddress.Address), + ACPI_FORMAT_UINT64 ( + GpeBlock->RegisterInfo->EnableAddress.Address)); AcpiOsPrintf (" EventInfo: %p\n", GpeBlock->EventInfo); @@ -883,14 +895,18 @@ AcpiDbDisplayGpes ( GpeRegisterInfo = &GpeBlock->RegisterInfo[i]; AcpiOsPrintf ( - " Reg %u: (GPE %.2X-%.2X) RunEnable %2.2X WakeEnable %2.2X" + " Reg %u: (GPE %.2X-%.2X) " + "RunEnable %2.2X WakeEnable %2.2X" " Status %8.8X%8.8X Enable %8.8X%8.8X\n", i, GpeRegisterInfo->BaseGpeNumber, - GpeRegisterInfo->BaseGpeNumber + (ACPI_GPE_REGISTER_WIDTH - 1), + GpeRegisterInfo->BaseGpeNumber + + (ACPI_GPE_REGISTER_WIDTH - 1), GpeRegisterInfo->EnableForRun, GpeRegisterInfo->EnableForWake, - ACPI_FORMAT_UINT64 (GpeRegisterInfo->StatusAddress.Address), - ACPI_FORMAT_UINT64 (GpeRegisterInfo->EnableAddress.Address)); + ACPI_FORMAT_UINT64 ( + GpeRegisterInfo->StatusAddress.Address), + ACPI_FORMAT_UINT64 ( + GpeRegisterInfo->EnableAddress.Address)); /* Now look at the individual GPEs in this byte register */ @@ -958,7 +974,9 @@ AcpiDbDisplayGpes ( Count++; Notify = Notify->Next; } - AcpiOsPrintf ("Implicit Notify on %u devices", Count); + + AcpiOsPrintf ("Implicit Notify on %u devices", + Count); break; case ACPI_GPE_DISPATCH_RAW_HANDLER: @@ -976,9 +994,11 @@ AcpiDbDisplayGpes ( AcpiOsPrintf (")\n"); } } + Block++; GpeBlock = GpeBlock->Next; } + GpeXruptInfo = GpeXruptInfo->Next; } } @@ -1024,12 +1044,15 @@ AcpiDbDisplayHandlers ( while (HandlerObj) { - if (AcpiGbl_SpaceIdList[i] == HandlerObj->AddressSpace.SpaceId) + if (AcpiGbl_SpaceIdList[i] == + HandlerObj->AddressSpace.SpaceId) { AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, (HandlerObj->AddressSpace.HandlerFlags & - ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User", + ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? + "Default" : "User", HandlerObj->AddressSpace.Handler); + goto FoundHandler; } @@ -1054,7 +1077,8 @@ AcpiDbDisplayHandlers ( "User-defined ID", HandlerObj->AddressSpace.SpaceId); AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, (HandlerObj->AddressSpace.HandlerFlags & - ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User", + ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? + "Default" : "User", HandlerObj->AddressSpace.Handler); } @@ -1090,7 +1114,9 @@ AcpiDbDisplayHandlers ( for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiGbl_HandlerList); i++) { - AcpiOsPrintf (ACPI_HANDLER_NAME_STRING, AcpiGbl_HandlerList[i].Name); + AcpiOsPrintf (ACPI_HANDLER_NAME_STRING, + AcpiGbl_HandlerList[i].Name); + if (AcpiGbl_HandlerList[i].Handler) { AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User", @@ -1108,8 +1134,8 @@ AcpiDbDisplayHandlers ( AcpiOsPrintf ("\nOperation Region Handlers for specific devices:\n"); (void) AcpiWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, AcpiDbDisplayNonRootHandlers, - NULL, NULL, NULL); + ACPI_UINT32_MAX, AcpiDbDisplayNonRootHandlers, + NULL, NULL, NULL); } @@ -1173,5 +1199,3 @@ AcpiDbDisplayNonRootHandlers ( ACPI_FREE (Pathname); return (AE_OK); } - -#endif /* ACPI_DEBUGGER */ diff --git a/sys/contrib/dev/acpica/components/debugger/dbexec.c b/sys/contrib/dev/acpica/components/debugger/dbexec.c index c8a4112..c4bcbb4 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbexec.c +++ b/sys/contrib/dev/acpica/components/debugger/dbexec.c @@ -46,7 +46,6 @@ #include <contrib/dev/acpica/include/acdebug.h> #include <contrib/dev/acpica/include/acnamesp.h> -#ifdef ACPI_DEBUGGER #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dbexec") @@ -213,7 +212,8 @@ AcpiDbExecuteMethod ( if (Status == AE_BUFFER_OVERFLOW) { ACPI_ERROR ((AE_INFO, - "Possible overflow of internal debugger buffer (size 0x%X needed 0x%X)", + "Possible overflow of internal debugger " + "buffer (size 0x%X needed 0x%X)", ACPI_DEBUG_BUFFER_SIZE, (UINT32) ReturnObj->Length)); } } @@ -380,10 +380,11 @@ AcpiDbExecutionWalk ( Status = AcpiEvaluateObject (Node, NULL, NULL, &ReturnObj); - AcpiOsPrintf ("Evaluation of [%4.4s] returned %s\n", AcpiUtGetNodeName (Node), - AcpiFormatException (Status)); - AcpiGbl_MethodExecuting = FALSE; + AcpiOsPrintf ("Evaluation of [%4.4s] returned %s\n", + AcpiUtGetNodeName (Node), + AcpiFormatException (Status)); + AcpiGbl_MethodExecuting = FALSE; return (AE_OK); } @@ -394,6 +395,7 @@ AcpiDbExecutionWalk ( * * PARAMETERS: Name - Name of method to execute * Args - Parameters to the method + * Types - * Flags - single step/no single step * * RETURN: None @@ -414,7 +416,6 @@ AcpiDbExecute ( ACPI_BUFFER ReturnObj; char *NameString; - #ifdef ACPI_DEBUG_OUTPUT UINT32 PreviousAllocations; UINT32 Allocations; @@ -428,7 +429,7 @@ AcpiDbExecute ( if (*Name == '*') { (void) AcpiWalkNamespace (ACPI_TYPE_METHOD, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, AcpiDbExecutionWalk, NULL, NULL, NULL); + ACPI_UINT32_MAX, AcpiDbExecutionWalk, NULL, NULL, NULL); return; } else @@ -464,7 +465,8 @@ AcpiDbExecute ( &AcpiGbl_DbMethodInfo.Method); if (ACPI_SUCCESS (Status)) { - Status = AcpiDbExecuteMethod (&AcpiGbl_DbMethodInfo, &ReturnObj); + Status = AcpiDbExecuteMethod (&AcpiGbl_DbMethodInfo, + &ReturnObj); } ACPI_FREE (NameString); } @@ -485,15 +487,17 @@ AcpiDbExecute ( if (Allocations > 0) { - AcpiOsPrintf ("0x%X Outstanding allocations after evaluation of %s\n", - Allocations, AcpiGbl_DbMethodInfo.Pathname); + AcpiOsPrintf ( + "0x%X Outstanding allocations after evaluation of %s\n", + Allocations, AcpiGbl_DbMethodInfo.Pathname); } #endif if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Evaluation of %s failed with status %s\n", - AcpiGbl_DbMethodInfo.Pathname, AcpiFormatException (Status)); + AcpiGbl_DbMethodInfo.Pathname, + AcpiFormatException (Status)); } else { @@ -502,15 +506,18 @@ AcpiDbExecute ( if (ReturnObj.Length) { AcpiOsPrintf ( - "Evaluation of %s returned object %p, external buffer length %X\n", + "Evaluation of %s returned object %p, " + "external buffer length %X\n", AcpiGbl_DbMethodInfo.Pathname, ReturnObj.Pointer, (UINT32) ReturnObj.Length); + AcpiDbDumpExternalObject (ReturnObj.Pointer, 1); /* Dump a _PLD buffer if present */ if (ACPI_COMPARE_NAME ((ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, - AcpiGbl_DbMethodInfo.Method)->Name.Ascii), METHOD_NAME__PLD)) + AcpiGbl_DbMethodInfo.Method)->Name.Ascii), + METHOD_NAME__PLD)) { AcpiDbDumpPldBuffer (ReturnObj.Pointer); } @@ -563,8 +570,10 @@ AcpiDbMethodThread ( if (Info->InitArgs) { - AcpiDbUint32ToHexString (Info->NumCreated, Info->IndexOfThreadStr); - AcpiDbUint32ToHexString ((UINT32) AcpiOsGetThreadId (), Info->IdOfThreadStr); + AcpiDbUint32ToHexString (Info->NumCreated, + Info->IndexOfThreadStr); + AcpiDbUint32ToHexString ((UINT32) AcpiOsGetThreadId (), + Info->IdOfThreadStr); } if (Info->Threads && (Info->NumCreated < Info->NumThreads)) @@ -599,7 +608,8 @@ AcpiDbMethodThread ( #if 0 if ((i % 100) == 0) { - AcpiOsPrintf ("%u loops, Thread 0x%x\n", i, AcpiOsGetThreadId ()); + AcpiOsPrintf ("%u loops, Thread 0x%x\n", + i, AcpiOsGetThreadId ()); } if (ReturnObj.Length) @@ -614,7 +624,8 @@ AcpiDbMethodThread ( /* Signal our completion */ Allow = 0; - (void) AcpiOsWaitSemaphore (Info->ThreadCompleteGate, 1, ACPI_WAIT_FOREVER); + (void) AcpiOsWaitSemaphore (Info->ThreadCompleteGate, + 1, ACPI_WAIT_FOREVER); Info->NumCompleted++; if (Info->NumCompleted == Info->NumThreads) @@ -630,7 +641,8 @@ AcpiDbMethodThread ( Status = AcpiOsSignalSemaphore (Info->MainThreadGate, 1); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("Could not signal debugger thread sync semaphore, %s\n", + AcpiOsPrintf ( + "Could not signal debugger thread sync semaphore, %s\n", AcpiFormatException (Status)); } } @@ -686,7 +698,8 @@ AcpiDbCreateExecutionThreads ( Status = AcpiOsCreateSemaphore (1, 0, &MainThreadGate); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("Could not create semaphore for synchronization with the main thread, %s\n", + AcpiOsPrintf ("Could not create semaphore for " + "synchronization with the main thread, %s\n", AcpiFormatException (Status)); return; } @@ -698,8 +711,10 @@ AcpiDbCreateExecutionThreads ( Status = AcpiOsCreateSemaphore (1, 1, &ThreadCompleteGate); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("Could not create semaphore for synchronization between the created threads, %s\n", + AcpiOsPrintf ("Could not create semaphore for " + "synchronization between the created threads, %s\n", AcpiFormatException (Status)); + (void) AcpiOsDeleteSemaphore (MainThreadGate); return; } @@ -707,8 +722,10 @@ AcpiDbCreateExecutionThreads ( Status = AcpiOsCreateSemaphore (1, 1, &InfoGate); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("Could not create semaphore for synchronization of AcpiGbl_DbMethodInfo, %s\n", + AcpiOsPrintf ("Could not create semaphore for " + "synchronization of AcpiGbl_DbMethodInfo, %s\n", AcpiFormatException (Status)); + (void) AcpiOsDeleteSemaphore (ThreadCompleteGate); (void) AcpiOsDeleteSemaphore (MainThreadGate); return; @@ -720,6 +737,7 @@ AcpiDbCreateExecutionThreads ( AcpiGbl_DbMethodInfo.NumThreads = NumThreads; Size = sizeof (ACPI_THREAD_ID) * AcpiGbl_DbMethodInfo.NumThreads; + AcpiGbl_DbMethodInfo.Threads = AcpiOsAllocate (Size); if (AcpiGbl_DbMethodInfo.Threads == NULL) { @@ -807,5 +825,3 @@ CleanupAndExit: AcpiOsFree (AcpiGbl_DbMethodInfo.Threads); AcpiGbl_DbMethodInfo.Threads = NULL; } - -#endif /* ACPI_DEBUGGER */ diff --git a/sys/contrib/dev/acpica/components/debugger/dbfileio.c b/sys/contrib/dev/acpica/components/debugger/dbfileio.c index f39fac1..ff9c870 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbfileio.c +++ b/sys/contrib/dev/acpica/components/debugger/dbfileio.c @@ -47,13 +47,12 @@ #include <contrib/dev/acpica/include/acdebug.h> #include <contrib/dev/acpica/include/actables.h> -#if (defined ACPI_DEBUGGER || defined ACPI_DISASSEMBLER) #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dbfileio") -#ifdef ACPI_DEBUGGER +#ifdef ACPI_DEBUGGER /******************************************************************************* * * FUNCTION: AcpiDbCloseDebugFile @@ -78,7 +77,8 @@ AcpiDbCloseDebugFile ( fclose (AcpiGbl_DebugFile); AcpiGbl_DebugFile = NULL; AcpiGbl_DbOutputToFile = FALSE; - AcpiOsPrintf ("Debug output file %s closed\n", AcpiGbl_DbDebugFilename); + AcpiOsPrintf ("Debug output file %s closed\n", + AcpiGbl_DbDebugFilename); } #endif } @@ -145,12 +145,12 @@ AeLocalLoadTable ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status = AE_OK; -/* ACPI_TABLE_DESC TableInfo; */ ACPI_FUNCTION_TRACE (AeLocalLoadTable); -#if 0 +#if 0 +/* ACPI_TABLE_DESC TableInfo; */ if (!Table) { @@ -282,5 +282,3 @@ AcpiDbGetTableFromFile ( #endif /* ACPI_APPLICATION */ return (AE_OK); } - -#endif /* ACPI_DEBUGGER */ diff --git a/sys/contrib/dev/acpica/components/debugger/dbhistry.c b/sys/contrib/dev/acpica/components/debugger/dbhistry.c index 6674fdb..2d602d1 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbhistry.c +++ b/sys/contrib/dev/acpica/components/debugger/dbhistry.c @@ -45,7 +45,6 @@ #include <contrib/dev/acpica/include/accommon.h> #include <contrib/dev/acpica/include/acdebug.h> -#ifdef ACPI_DEBUGGER #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dbhistry") @@ -102,6 +101,7 @@ AcpiDbAddToHistory ( { BufferLen = (UINT16) strlen ( AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command); + if (CmdLen > BufferLen) { AcpiOsFree (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex]. @@ -269,5 +269,3 @@ AcpiDbGetHistoryByIndex ( AcpiOsPrintf ("Invalid history number: %u\n", HistoryIndex); return (NULL); } - -#endif /* ACPI_DEBUGGER */ diff --git a/sys/contrib/dev/acpica/components/debugger/dbinput.c b/sys/contrib/dev/acpica/components/debugger/dbinput.c index 630f399..447f5d2 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbinput.c +++ b/sys/contrib/dev/acpica/components/debugger/dbinput.c @@ -46,11 +46,10 @@ #include <contrib/dev/acpica/include/acdebug.h> -#ifdef ACPI_DEBUGGER - #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dbinput") + /* Local prototypes */ static UINT32 @@ -95,20 +94,15 @@ enum AcpiExDebuggerCommands CMD_BREAKPOINT, CMD_BUSINFO, CMD_CALL, - CMD_CLOSE, CMD_DEBUG, CMD_DISASSEMBLE, CMD_DISASM, CMD_DUMP, - CMD_ENABLEACPI, CMD_EVALUATE, - CMD_EVENT, CMD_EXECUTE, CMD_EXIT, CMD_FIND, CMD_GO, - CMD_GPE, - CMD_GPES, CMD_HANDLERS, CMD_HELP, CMD_HELP2, @@ -120,37 +114,47 @@ enum AcpiExDebuggerCommands CMD_INTO, CMD_LEVEL, CMD_LIST, - CMD_LOAD, CMD_LOCALS, CMD_LOCKS, CMD_METHODS, CMD_NAMESPACE, CMD_NOTIFY, CMD_OBJECTS, - CMD_OPEN, CMD_OSI, CMD_OWNER, CMD_PATHS, - CMD_PREDEFINED, CMD_PREFIX, CMD_QUIT, CMD_REFERENCES, CMD_RESOURCES, CMD_RESULTS, - CMD_SCI, CMD_SET, - CMD_SLEEP, CMD_STATS, CMD_STOP, CMD_TABLES, CMD_TEMPLATE, - CMD_TERMINATE, - CMD_TEST, - CMD_THREADS, CMD_TRACE, CMD_TREE, CMD_TYPE, - CMD_UNLOAD +#ifdef ACPI_APPLICATION + CMD_ENABLEACPI, + CMD_EVENT, + CMD_GPE, + CMD_GPES, + CMD_SCI, + CMD_SLEEP, + + CMD_CLOSE, + CMD_LOAD, + CMD_OPEN, + CMD_UNLOAD, + + CMD_TERMINATE, + CMD_THREADS, + + CMD_PREDEFINED, + CMD_TEST, +#endif }; #define CMD_FIRST_VALID 2 @@ -168,20 +172,15 @@ static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands[] = {"BREAKPOINT", 1}, {"BUSINFO", 0}, {"CALL", 0}, - {"CLOSE", 0}, {"DEBUG", 1}, {"DISASSEMBLE", 1}, {"DISASM", 1}, {"DUMP", 1}, - {"ENABLEACPI", 0}, {"EVALUATE", 1}, - {"EVENT", 1}, {"EXECUTE", 1}, {"EXIT", 0}, {"FIND", 1}, {"GO", 0}, - {"GPE", 1}, - {"GPES", 0}, {"HANDLERS", 0}, {"HELP", 0}, {"?", 0}, @@ -193,37 +192,47 @@ static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands[] = {"INTO", 0}, {"LEVEL", 0}, {"LIST", 0}, - {"LOAD", 1}, {"LOCALS", 0}, {"LOCKS", 0}, {"METHODS", 0}, {"NAMESPACE", 0}, {"NOTIFY", 2}, - {"OBJECTS", 1}, - {"OPEN", 1}, + {"OBJECTS", 0}, {"OSI", 0}, {"OWNER", 1}, {"PATHS", 0}, - {"PREDEFINED", 0}, {"PREFIX", 0}, {"QUIT", 0}, {"REFERENCES", 1}, {"RESOURCES", 0}, {"RESULTS", 0}, - {"SCI", 0}, {"SET", 3}, - {"SLEEP", 0}, {"STATS", 1}, {"STOP", 0}, {"TABLES", 0}, {"TEMPLATE", 1}, - {"TERMINATE", 0}, - {"TEST", 1}, - {"THREADS", 3}, {"TRACE", 1}, {"TREE", 0}, {"TYPE", 1}, +#ifdef ACPI_APPLICATION + {"ENABLEACPI", 0}, + {"EVENT", 1}, + {"GPE", 1}, + {"GPES", 0}, + {"SCI", 0}, + {"SLEEP", 0}, + + {"CLOSE", 0}, + {"LOAD", 1}, + {"OPEN", 1}, {"UNLOAD", 1}, + + {"TERMINATE", 0}, + {"THREADS", 3}, + + {"PREDEFINED", 0}, + {"TEST", 1}, +#endif {NULL, 0} }; @@ -237,7 +246,6 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] = {1, " Allocations", "Display list of current memory allocations\n"}, {2, " Dump <Address>|<Namepath>", "\n"}, {0, " [Byte|Word|Dword|Qword]", "Display ACPI objects or memory\n"}, - {1, " EnableAcpi", "Enable ACPI (hardware) mode\n"}, {1, " Handlers", "Info about global handlers\n"}, {1, " Help [Command]", "This help screen or individual command\n"}, {1, " History", "Display command history buffer\n"}, @@ -254,7 +262,6 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] = {1, " Stack", "Display CPU stack usage\n"}, {1, " Tables", "Info about current ACPI table(s)\n"}, {1, " Tables", "Display info about loaded ACPI tables\n"}, - {1, " Unload <Namepath>", "Unload an ACPI table via namespace object\n"}, {1, " ! <CommandNumber>", "Execute command from history buffer\n"}, {1, " !!", "Execute last command again\n"}, @@ -266,7 +273,7 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] = {1, " Methods", "Display list of loaded control methods\n"}, {1, " Namespace [Object] [Depth]", "Display loaded namespace tree/subtree\n"}, {1, " Notify <Object> <Value>", "Send a notification on Object\n"}, - {1, " Objects <ObjectType>", "Display all objects of the given type\n"}, + {1, " Objects [ObjectType]", "Display summary of all objects or just given type\n"}, {1, " Owner <OwnerId> [Depth]", "Display loaded namespace by object owner\n"}, {1, " Paths", "Display full pathnames of namespace objects\n"}, {1, " Predefined", "Check all predefined names\n"}, @@ -275,7 +282,6 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] = {1, " Resources [DeviceName]", "Display Device resources (no arg = all devices)\n"}, {1, " Set N <NamedObject> <Value>", "Set value for named integer\n"}, {1, " Template <Object>", "Format/dump a Buffer/ResourceTemplate\n"}, - {1, " Terminate", "Delete namespace and all internal objects\n"}, {1, " Type <Object>", "Display object type\n"}, {0, "\nControl Method Execution Commands:","\n"}, @@ -297,7 +303,6 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] = {1, " Results", "Display method result stack\n"}, {1, " Set <A|L> <#> <Value>", "Set method data (Arguments/Locals)\n"}, {1, " Stop", "Terminate control method\n"}, - {1, " Thread <Threads><Loops><Namepath>", "Spawn threads to execute method(s)\n"}, {5, " Trace <State> [<Namepath>] [Once]", "Trace control method execution\n"}, {1, " Enable", "Enable all messages\n"}, {1, " Disable", "Disable tracing\n"}, @@ -306,10 +311,12 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] = {1, " Tree", "Display control method calling tree\n"}, {1, " <Enter>", "Single step next AML opcode (over calls)\n"}, - {0, "\nHardware Related Commands:", "\n"}, +#ifdef ACPI_APPLICATION + {0, "\nHardware Simulation Commands:", "\n"}, + {1, " EnableAcpi", "Enable ACPI (hardware) mode\n"}, {1, " Event <F|G> <Value>", "Generate AcpiEvent (Fixed/GPE)\n"}, {1, " Gpe <GpeNum> [GpeBlockDevice]", "Simulate a GPE\n"}, - {1, " Gpes", "Display info on all GPEs\n"}, + {1, " Gpes", "Display info on all GPE devices\n"}, {1, " Sci", "Generate an SCI\n"}, {1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"}, @@ -317,11 +324,17 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] = {1, " Close", "Close debug output file\n"}, {1, " Load <Input Filename>", "Load ACPI table from a file\n"}, {1, " Open <Output Filename>", "Open a file for debug output\n"}, + {1, " Unload <Namepath>", "Unload an ACPI table via namespace object\n"}, + + {0, "\nUser Space Commands:", "\n"}, + {1, " Terminate", "Delete namespace and all internal objects\n"}, + {1, " Thread <Threads><Loops><NamePath>", "Spawn threads to execute method(s)\n"}, {0, "\nDebug Test Commands:", "\n"}, {3, " Test <TestName>", "Invoke a debug test\n"}, {1, " Objects", "Read/write/compare all namespace data objects\n"}, {1, " Predefined", "Execute all ACPI predefined names (_STA, etc.)\n"}, +#endif {0, NULL, NULL} }; @@ -645,7 +658,8 @@ AcpiDbGetLine ( if (AcpiUtSafeStrcpy (AcpiGbl_DbParsedBuf, sizeof (AcpiGbl_DbParsedBuf), InputBuffer)) { - AcpiOsPrintf ("Buffer overflow while parsing input line (max %u characters)\n", + AcpiOsPrintf ( + "Buffer overflow while parsing input line (max %u characters)\n", sizeof (AcpiGbl_DbParsedBuf)); return (0); } @@ -707,7 +721,7 @@ AcpiDbMatchCommand ( for (i = CMD_FIRST_VALID; AcpiGbl_DbCommands[i].Name; i++) { if (strstr (AcpiGbl_DbCommands[i].Name, UserCommand) == - AcpiGbl_DbCommands[i].Name) + AcpiGbl_DbCommands[i].Name) { return (i); } @@ -777,7 +791,8 @@ AcpiDbCommandDispatch ( ParamCount, AcpiGbl_DbCommands[CommandIndex].Name, AcpiGbl_DbCommands[CommandIndex].MinArgs); - AcpiDbDisplayCommandInfo (AcpiGbl_DbCommands[CommandIndex].Name, FALSE); + AcpiDbDisplayCommandInfo ( + AcpiGbl_DbCommands[CommandIndex].Name, FALSE); return (AE_CTRL_TRUE); } @@ -822,11 +837,6 @@ AcpiDbCommandDispatch ( Status = AE_OK; break; - case CMD_CLOSE: - - AcpiDbCloseDebugFile (); - break; - case CMD_DEBUG: AcpiDbExecute (AcpiGbl_DbArgs[1], @@ -844,23 +854,6 @@ AcpiDbCommandDispatch ( AcpiDbDecodeAndDisplayObject (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); break; - case CMD_ENABLEACPI: -#if (!ACPI_REDUCED_HARDWARE) - - Status = AcpiEnable(); - if (ACPI_FAILURE(Status)) - { - AcpiOsPrintf("AcpiEnable failed (Status=%X)\n", Status); - return (Status); - } -#endif /* !ACPI_REDUCED_HARDWARE */ - break; - - case CMD_EVENT: - - AcpiOsPrintf ("Event command not implemented\n"); - break; - case CMD_EVALUATE: case CMD_EXECUTE: @@ -878,16 +871,6 @@ AcpiDbCommandDispatch ( AcpiGbl_CmSingleStep = FALSE; return (AE_OK); - case CMD_GPE: - - AcpiDbGenerateGpe (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); - break; - - case CMD_GPES: - - AcpiDbDisplayGpes (); - break; - case CMD_HANDLERS: AcpiDbDisplayHandlers (); @@ -949,9 +932,11 @@ AcpiDbCommandDispatch ( if (ParamCount == 0) { - AcpiOsPrintf ("Current debug level for file output is: %8.8lX\n", + AcpiOsPrintf ( + "Current debug level for file output is: %8.8lX\n", AcpiGbl_DbDebugLevel); - AcpiOsPrintf ("Current debug level for console output is: %8.8lX\n", + AcpiOsPrintf ( + "Current debug level for console output is: %8.8lX\n", AcpiGbl_DbConsoleDebugLevel); } else if (ParamCount == 2) @@ -978,11 +963,6 @@ AcpiDbCommandDispatch ( AcpiDbDisassembleAml (AcpiGbl_DbArgs[1], Op); break; - case CMD_LOAD: - - Status = AcpiDbGetTableFromFile (AcpiGbl_DbArgs[1], NULL, FALSE); - break; - case CMD_LOCKS: AcpiDbDisplayLocks (); @@ -1015,11 +995,6 @@ AcpiDbCommandDispatch ( Status = AcpiDbDisplayObjects (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); break; - case CMD_OPEN: - - AcpiDbOpenDebugFile (AcpiGbl_DbArgs[1]); - break; - case CMD_OSI: AcpiDbDisplayInterfaces (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); @@ -1035,11 +1010,6 @@ AcpiDbCommandDispatch ( AcpiDbDumpNamespacePaths (); break; - case CMD_PREDEFINED: - - AcpiDbCheckPredefinedNames (); - break; - case CMD_PREFIX: AcpiDbSetScope (AcpiGbl_DbArgs[1]); @@ -1060,22 +1030,12 @@ AcpiDbCommandDispatch ( AcpiDbDisplayResults (); break; - case CMD_SCI: - - AcpiDbGenerateSci (); - break; - case CMD_SET: AcpiDbSetMethodData (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], AcpiGbl_DbArgs[3]); break; - case CMD_SLEEP: - - Status = AcpiDbSleep (AcpiGbl_DbArgs[1]); - break; - case CMD_STATS: Status = AcpiDbDisplayStatistics (AcpiGbl_DbArgs[1]); @@ -1095,6 +1055,81 @@ AcpiDbCommandDispatch ( AcpiDbDisplayTemplate (AcpiGbl_DbArgs[1]); break; + case CMD_TRACE: + + AcpiDbTrace (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], AcpiGbl_DbArgs[3]); + break; + + case CMD_TREE: + + AcpiDbDisplayCallingTree (); + break; + + case CMD_TYPE: + + AcpiDbDisplayObjectType (AcpiGbl_DbArgs[1]); + break; + +#ifdef ACPI_APPLICATION + + /* Hardware simulation commands. */ + + case CMD_ENABLEACPI: +#if (!ACPI_REDUCED_HARDWARE) + + Status = AcpiEnable(); + if (ACPI_FAILURE(Status)) + { + AcpiOsPrintf("AcpiEnable failed (Status=%X)\n", Status); + return (Status); + } +#endif /* !ACPI_REDUCED_HARDWARE */ + break; + + case CMD_EVENT: + + AcpiOsPrintf ("Event command not implemented\n"); + break; + + case CMD_GPE: + + AcpiDbGenerateGpe (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); + break; + + case CMD_GPES: + + AcpiDbDisplayGpes (); + break; + + case CMD_SCI: + + AcpiDbGenerateSci (); + break; + + case CMD_SLEEP: + + Status = AcpiDbSleep (AcpiGbl_DbArgs[1]); + break; + + /* File I/O commands. */ + + case CMD_CLOSE: + + AcpiDbCloseDebugFile (); + break; + + case CMD_LOAD: + + Status = AcpiDbGetTableFromFile (AcpiGbl_DbArgs[1], NULL, FALSE); + break; + + case CMD_OPEN: + + AcpiDbOpenDebugFile (AcpiGbl_DbArgs[1]); + break; + + /* User space commands. */ + case CMD_TERMINATE: AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); @@ -1108,36 +1143,29 @@ AcpiDbCommandDispatch ( /* AcpiInitialize (NULL); */ break; - case CMD_TEST: - - AcpiDbExecuteTest (AcpiGbl_DbArgs[1]); - break; - case CMD_THREADS: AcpiDbCreateExecutionThreads (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], AcpiGbl_DbArgs[3]); break; - case CMD_TRACE: - - AcpiDbTrace (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], AcpiGbl_DbArgs[3]); - break; + /* Debug test commands. */ - case CMD_TREE: + case CMD_PREDEFINED: - AcpiDbDisplayCallingTree (); + AcpiDbCheckPredefinedNames (); break; - case CMD_TYPE: + case CMD_TEST: - AcpiDbDisplayObjectType (AcpiGbl_DbArgs[1]); + AcpiDbExecuteTest (AcpiGbl_DbArgs[1]); break; case CMD_UNLOAD: AcpiDbUnloadAcpiTable (AcpiGbl_DbArgs[1]); break; +#endif case CMD_EXIT: case CMD_QUIT: @@ -1153,7 +1181,9 @@ AcpiDbCommandDispatch ( AcpiDbgLevel = ACPI_DEBUG_DEFAULT; } +#ifdef ACPI_APPLICATION AcpiDbCloseDebugFile (); +#endif AcpiGbl_DbTerminateThreads = TRUE; return (AE_CTRL_TERMINATE); @@ -1322,6 +1352,10 @@ AcpiDbUserCommands ( } } + /* Shut down the debugger */ + + AcpiTerminateDebugger (); + /* * Only this thread (the original thread) should actually terminate the * subsystem, because all the semaphores are deleted during termination @@ -1329,5 +1363,3 @@ AcpiDbUserCommands ( Status = AcpiTerminate (); return (Status); } - -#endif /* ACPI_DEBUGGER */ diff --git a/sys/contrib/dev/acpica/components/debugger/dbmethod.c b/sys/contrib/dev/acpica/components/debugger/dbmethod.c index 13b7bdd..243a66d 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbmethod.c +++ b/sys/contrib/dev/acpica/components/debugger/dbmethod.c @@ -46,15 +46,10 @@ #include <contrib/dev/acpica/include/acdispat.h> #include <contrib/dev/acpica/include/acnamesp.h> #include <contrib/dev/acpica/include/acdebug.h> -#ifdef ACPI_DISASSEMBLER -#include <contrib/dev/acpica/include/acdisasm.h> -#endif #include <contrib/dev/acpica/include/acparser.h> #include <contrib/dev/acpica/include/acpredef.h> -#ifdef ACPI_DEBUGGER - #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dbmethod") @@ -229,12 +224,13 @@ AcpiDbSetMethodData ( if (Index > ACPI_METHOD_MAX_ARG) { - AcpiOsPrintf ("Arg%u - Invalid argument name\n", Index); + AcpiOsPrintf ("Arg%u - Invalid argument name\n", + Index); goto Cleanup; } - Status = AcpiDsStoreObjectToLocal (ACPI_REFCLASS_ARG, Index, ObjDesc, - WalkState); + Status = AcpiDsStoreObjectToLocal (ACPI_REFCLASS_ARG, + Index, ObjDesc, WalkState); if (ACPI_FAILURE (Status)) { goto Cleanup; @@ -252,12 +248,13 @@ AcpiDbSetMethodData ( if (Index > ACPI_METHOD_MAX_LOCAL) { - AcpiOsPrintf ("Local%u - Invalid local variable name\n", Index); + AcpiOsPrintf ("Local%u - Invalid local variable name\n", + Index); goto Cleanup; } - Status = AcpiDsStoreObjectToLocal (ACPI_REFCLASS_LOCAL, Index, ObjDesc, - WalkState); + Status = AcpiDsStoreObjectToLocal (ACPI_REFCLASS_LOCAL, + Index, ObjDesc, WalkState); if (ACPI_FAILURE (Status)) { goto Cleanup; @@ -398,14 +395,14 @@ AcpiDbDisassembleMethod ( Status = AcpiPsParseAml (WalkState); -#ifdef ACPI_DISASSEMBER +#ifdef ACPI_DISASSEMBLER (void) AcpiDmParseDeferredOps (Op); /* Now we can disassemble the method */ - AcpiGbl_DbOpt_Verbose = FALSE; + AcpiGbl_DmOpt_Verbose = FALSE; AcpiDmDisassemble (NULL, Op, 0); - AcpiGbl_DbOpt_Verbose = TRUE; + AcpiGbl_DmOpt_Verbose = TRUE; #endif AcpiPsDeleteParseTree (Op); @@ -417,5 +414,3 @@ AcpiDbDisassembleMethod ( AcpiUtReleaseOwnerId (&ObjDesc->Method.OwnerId); return (AE_OK); } - -#endif /* ACPI_DEBUGGER */ diff --git a/sys/contrib/dev/acpica/components/debugger/dbnames.c b/sys/contrib/dev/acpica/components/debugger/dbnames.c index e52064c..e152be5 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbnames.c +++ b/sys/contrib/dev/acpica/components/debugger/dbnames.c @@ -48,8 +48,6 @@ #include <contrib/dev/acpica/include/acpredef.h> -#ifdef ACPI_DEBUGGER - #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dbnames") @@ -78,6 +76,13 @@ AcpiDbWalkForSpecificObjects ( void **ReturnValue); static ACPI_STATUS +AcpiDbWalkForObjectCounts ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue); + +static ACPI_STATUS AcpiDbIntegrityWalk ( ACPI_HANDLE ObjHandle, UINT32 NestingLevel, @@ -125,7 +130,13 @@ static ACPI_DB_ARGUMENT_INFO AcpiDbObjectTypes [] = {"BANKFIELDS"}, {"INDEXFIELDS"}, {"REFERENCES"}, - {"ALIAS"}, + {"ALIASES"}, + {"METHODALIASES"}, + {"NOTIFY"}, + {"ADDRESSHANDLER"}, + {"RESOURCE"}, + {"RESOURCEFIELD"}, + {"SCOPES"}, {NULL} /* Must be null terminated */ }; @@ -163,8 +174,8 @@ AcpiDbSetScope ( { /* Validate new scope from the root */ - Status = AcpiNsGetNode (AcpiGbl_RootNode, Name, ACPI_NS_NO_UPSEARCH, - &Node); + Status = AcpiNsGetNode (AcpiGbl_RootNode, Name, + ACPI_NS_NO_UPSEARCH, &Node); if (ACPI_FAILURE (Status)) { goto ErrorExit; @@ -176,8 +187,8 @@ AcpiDbSetScope ( { /* Validate new scope relative to old scope */ - Status = AcpiNsGetNode (AcpiGbl_DbScopeNode, Name, ACPI_NS_NO_UPSEARCH, - &Node); + Status = AcpiNsGetNode (AcpiGbl_DbScopeNode, Name, + ACPI_NS_NO_UPSEARCH, &Node); if (ACPI_FAILURE (Status)) { goto ErrorExit; @@ -187,14 +198,14 @@ AcpiDbSetScope ( /* Build the final pathname */ if (AcpiUtSafeStrcat (AcpiGbl_DbScopeBuf, sizeof (AcpiGbl_DbScopeBuf), - Name)) + Name)) { Status = AE_BUFFER_OVERFLOW; goto ErrorExit; } if (AcpiUtSafeStrcat (AcpiGbl_DbScopeBuf, sizeof (AcpiGbl_DbScopeBuf), - "\\")) + "\\")) { Status = AE_BUFFER_OVERFLOW; goto ErrorExit; @@ -334,8 +345,8 @@ AcpiDbDumpNamespaceByOwner ( /* Display the subtree */ AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); - AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth, OwnerId, - SubtreeEntry); + AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth, + OwnerId, SubtreeEntry); AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); } @@ -374,7 +385,8 @@ AcpiDbWalkAndMatchName ( /* Wildcard support */ if ((RequestedName[i] != '?') && - (RequestedName[i] != ((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Ascii[i])) + (RequestedName[i] != ((ACPI_NAMESPACE_NODE *) + ObjHandle)->Name.Ascii[i])) { /* No match, just exit */ @@ -385,10 +397,11 @@ AcpiDbWalkAndMatchName ( /* Get the full pathname to this object */ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, FALSE); + Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, TRUE); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle); + AcpiOsPrintf ("Could Not get pathname for object %p\n", + ObjHandle); } else { @@ -426,7 +439,7 @@ AcpiDbFindNameInNamespace ( char *AcpiNamePtr = AcpiName; - if (strlen (NameArg) > 4) + if (strlen (NameArg) > ACPI_NAME_SIZE) { AcpiOsPrintf ("Name must be no longer than 4 characters\n"); return (AE_OK); @@ -444,8 +457,8 @@ AcpiDbFindNameInNamespace ( /* Walk the namespace from the root */ - (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, - AcpiDbWalkAndMatchName, NULL, AcpiName, NULL); + (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, AcpiDbWalkAndMatchName, NULL, AcpiName, NULL); AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); return (AE_OK); @@ -546,8 +559,8 @@ AcpiDbCheckPredefinedNames ( /* Search all nodes in namespace */ - (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, - AcpiDbWalkForPredefinedNames, NULL, (void *) &Count, NULL); + (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, AcpiDbWalkForPredefinedNames, NULL, (void *) &Count, NULL); AcpiOsPrintf ("Found %u predefined names in the namespace\n", Count); } @@ -555,6 +568,43 @@ AcpiDbCheckPredefinedNames ( /******************************************************************************* * + * FUNCTION: AcpiDbWalkForObjectCounts + * + * PARAMETERS: Callback from WalkNamespace + * + * RETURN: Status + * + * DESCRIPTION: Display short info about objects in the namespace + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDbWalkForObjectCounts ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue) +{ + ACPI_OBJECT_INFO *Info = (ACPI_OBJECT_INFO *) Context; + ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; + + + if (Node->Type > ACPI_TYPE_NS_NODE_MAX) + { + AcpiOsPrintf ("[%4.4s]: Unknown object type %X\n", + Node->Name.Ascii, Node->Type); + } + else + { + Info->Types[Node->Type]++; + } + + return (AE_OK); +} + + +/******************************************************************************* + * * FUNCTION: AcpiDbWalkForSpecificObjects * * PARAMETERS: Callback from WalkNamespace @@ -582,7 +632,7 @@ AcpiDbWalkForSpecificObjects ( /* Get and display the full pathname to this object */ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, FALSE); + Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, TRUE); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle); @@ -619,7 +669,39 @@ AcpiDbDisplayObjects ( { ACPI_WALK_INFO Info; ACPI_OBJECT_TYPE Type; + ACPI_OBJECT_INFO *ObjectInfo; + UINT32 i; + UINT32 TotalObjects = 0; + + + /* No argument means display summary/count of all object types */ + if (!ObjTypeArg) + { + ObjectInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_OBJECT_INFO)); + + /* Walk the namespace from the root */ + + (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, AcpiDbWalkForObjectCounts, NULL, + (void *) ObjectInfo, NULL); + + AcpiOsPrintf ("\nSummary of namespace objects:\n\n"); + + for (i = 0; i < ACPI_TOTAL_TYPES; i++) + { + AcpiOsPrintf ("%8u %s\n", ObjectInfo->Types[i], + AcpiUtGetTypeName (i)); + + TotalObjects += ObjectInfo->Types[i]; + } + + AcpiOsPrintf ("\n%8u Total namespace objects\n\n", + TotalObjects); + + ACPI_FREE (ObjectInfo); + return (AE_OK); + } /* Get the object type */ @@ -645,7 +727,7 @@ AcpiDbDisplayObjects ( /* Walk the namespace from the root */ (void) AcpiWalkNamespace (Type, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, - AcpiDbWalkForSpecificObjects, NULL, (void *) &Info, NULL); + AcpiDbWalkForSpecificObjects, NULL, (void *) &Info, NULL); AcpiOsPrintf ( "\nFound %u objects of type [%s] in the current ACPI Namespace\n", @@ -689,9 +771,11 @@ AcpiDbIntegrityWalk ( { 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); + 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); } @@ -754,8 +838,8 @@ AcpiDbCheckIntegrity ( /* Search all nodes in namespace */ - (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, - AcpiDbIntegrityWalk, NULL, (void *) &Info, NULL); + (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, AcpiDbIntegrityWalk, NULL, (void *) &Info, NULL); AcpiOsPrintf ("Verified %u namespace nodes with %u Objects\n", Info.Nodes, Info.Objects); @@ -835,8 +919,9 @@ AcpiDbFindReferences ( /* Search all nodes in namespace */ - (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, - AcpiDbWalkForReferences, NULL, (void *) ObjDesc, NULL); + (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, AcpiDbWalkForReferences, NULL, + (void *) ObjDesc, NULL); } @@ -886,10 +971,11 @@ AcpiDbBusWalk ( /* Get the full path to this device object */ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, FALSE); + Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, TRUE); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle); + AcpiOsPrintf ("Could Not get pathname for object %p\n", + ObjHandle); return (AE_OK); } @@ -918,7 +1004,8 @@ AcpiDbBusWalk ( if (Info->Valid & ACPI_VALID_ADR) { - AcpiOsPrintf ("_ADR: %8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Info->Address)); + AcpiOsPrintf ("_ADR: %8.8X%8.8X\n", + ACPI_FORMAT_UINT64 (Info->Address)); } else { @@ -979,8 +1066,6 @@ AcpiDbGetBusInfo ( { /* Search all nodes in namespace */ - (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, - AcpiDbBusWalk, NULL, NULL, NULL); + (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, AcpiDbBusWalk, NULL, NULL, NULL); } - -#endif /* ACPI_DEBUGGER */ diff --git a/sys/contrib/dev/acpica/components/debugger/dbobject.c b/sys/contrib/dev/acpica/components/debugger/dbobject.c index f9f05e4..f93778c 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbobject.c +++ b/sys/contrib/dev/acpica/components/debugger/dbobject.c @@ -45,16 +45,12 @@ #include <contrib/dev/acpica/include/accommon.h> #include <contrib/dev/acpica/include/acnamesp.h> #include <contrib/dev/acpica/include/acdebug.h> -#ifdef ACPI_DISASSEMBLER -#include <contrib/dev/acpica/include/acdisasm.h> -#endif -#ifdef ACPI_DEBUGGER - #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dbobject") + /* Local prototypes */ static void @@ -148,7 +144,8 @@ AcpiDbDecodeInternalObject ( if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) { - AcpiOsPrintf (" %p [%s]", ObjDesc, AcpiUtGetDescriptorName (ObjDesc)); + AcpiOsPrintf (" %p [%s]", ObjDesc, + AcpiUtGetDescriptorName (ObjDesc)); return; } @@ -159,13 +156,13 @@ AcpiDbDecodeInternalObject ( case ACPI_TYPE_INTEGER: AcpiOsPrintf (" %8.8X%8.8X", - ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); + ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); break; case ACPI_TYPE_STRING: AcpiOsPrintf ("(%u) \"%.24s", - ObjDesc->String.Length, ObjDesc->String.Pointer); + ObjDesc->String.Length, ObjDesc->String.Pointer); if (ObjDesc->String.Length > 24) { @@ -212,7 +209,7 @@ AcpiDbDecodeNode ( { AcpiOsPrintf ("<Node> Name %4.4s", - AcpiUtGetNodeName (Node)); + AcpiUtGetNodeName (Node)); if (Node->Flags & ANOBJ_METHOD_ARG) { @@ -315,7 +312,7 @@ AcpiDbDisplayInternalObject ( if (WalkState) { ObjDesc = WalkState->LocalVariables - [ObjDesc->Reference.Value].Object; + [ObjDesc->Reference.Value].Object; AcpiOsPrintf ("%p", ObjDesc); AcpiDbDecodeInternalObject (ObjDesc); } @@ -327,7 +324,7 @@ AcpiDbDisplayInternalObject ( if (WalkState) { ObjDesc = WalkState->Arguments - [ObjDesc->Reference.Value].Object; + [ObjDesc->Reference.Value].Object; AcpiOsPrintf ("%p", ObjDesc); AcpiDbDecodeInternalObject (ObjDesc); } @@ -368,7 +365,8 @@ AcpiDbDisplayInternalObject ( if (!ObjDesc->Reference.Object) { - AcpiOsPrintf ("Uninitialized reference subobject pointer"); + AcpiOsPrintf ( + "Uninitialized reference subobject pointer"); break; } @@ -377,10 +375,12 @@ AcpiDbDisplayInternalObject ( switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc->Reference.Object)) { case ACPI_DESC_TYPE_NAMED: + AcpiDbDecodeNode (ObjDesc->Reference.Object); break; case ACPI_DESC_TYPE_OPERAND: + AcpiDbDecodeInternalObject (ObjDesc->Reference.Object); break; @@ -449,6 +449,7 @@ AcpiDbDecodeLocals ( ObjDesc = WalkState->MethodDesc; Node = WalkState->MethodNode; + if (!Node) { AcpiOsPrintf ( @@ -463,7 +464,7 @@ AcpiDbDecodeLocals ( } AcpiOsPrintf ("Local Variables for method [%4.4s]:\n", - AcpiUtGetNodeName (Node)); + AcpiUtGetNodeName (Node)); for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++) { @@ -497,6 +498,7 @@ AcpiDbDecodeArguments ( ObjDesc = WalkState->MethodDesc; Node = WalkState->MethodNode; + if (!Node) { AcpiOsPrintf ( @@ -511,8 +513,10 @@ AcpiDbDecodeArguments ( } AcpiOsPrintf ( - "Arguments for Method [%4.4s]: (%X arguments defined, max concurrency = %X)\n", - AcpiUtGetNodeName (Node), ObjDesc->Method.ParamCount, ObjDesc->Method.SyncLevel); + "Arguments for Method [%4.4s]: " + "(%X arguments defined, max concurrency = %X)\n", + AcpiUtGetNodeName (Node), ObjDesc->Method.ParamCount, + ObjDesc->Method.SyncLevel); for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) { @@ -521,5 +525,3 @@ AcpiDbDecodeArguments ( AcpiDbDisplayInternalObject (ObjDesc, WalkState); } } - -#endif diff --git a/sys/contrib/dev/acpica/components/debugger/dbstats.c b/sys/contrib/dev/acpica/components/debugger/dbstats.c index ecedcf9..7a89b4a 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbstats.c +++ b/sys/contrib/dev/acpica/components/debugger/dbstats.c @@ -46,11 +46,11 @@ #include <contrib/dev/acpica/include/acdebug.h> #include <contrib/dev/acpica/include/acnamesp.h> -#ifdef ACPI_DEBUGGER #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dbstats") + /* Local prototypes */ static void @@ -127,7 +127,8 @@ AcpiDbListInfo ( if (List->MaxDepth > 0) { AcpiOsPrintf ( - " Cache: [Depth MaxD Avail Size] %8.2X %8.2X %8.2X %8.2X\n", + " Cache: [Depth MaxD Avail Size] " + "%8.2X %8.2X %8.2X %8.2X\n", List->CurrentDepth, List->MaxDepth, List->MaxDepth - List->CurrentDepth, @@ -138,7 +139,8 @@ AcpiDbListInfo ( if (List->MaxDepth > 0) { AcpiOsPrintf ( - " Cache: [Requests Hits Misses ObjSize] %8.2X %8.2X %8.2X %8.2X\n", + " Cache: [Requests Hits Misses ObjSize] " + "%8.2X %8.2X %8.2X %8.2X\n", List->Requests, List->Hits, List->Requests - List->Hits, @@ -150,7 +152,8 @@ AcpiDbListInfo ( if (List->ObjectSize) { AcpiOsPrintf ( - " Mem: [Alloc Free Max CurSize Outstanding] %8.2X %8.2X %8.2X %8.2X %8.2X\n", + " Mem: [Alloc Free Max CurSize Outstanding] " + "%8.2X %8.2X %8.2X %8.2X %8.2X\n", List->TotalAllocated, List->TotalFreed, List->MaxOccupied, @@ -160,7 +163,8 @@ AcpiDbListInfo ( else { AcpiOsPrintf ( - " Mem: [Alloc Free Max CurSize Outstanding Total] %8.2X %8.2X %8.2X %8.2X %8.2X %8.2X\n", + " Mem: [Alloc Free Max CurSize Outstanding Total] " + "%8.2X %8.2X %8.2X %8.2X %8.2X %8.2X\n", List->TotalAllocated, List->TotalFreed, List->MaxOccupied, @@ -374,7 +378,7 @@ AcpiDbCountNamespaceObjects ( } (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, AcpiDbClassifyOneObject, NULL, NULL, NULL); + ACPI_UINT32_MAX, FALSE, AcpiDbClassifyOneObject, NULL, NULL, NULL); } @@ -532,7 +536,8 @@ AcpiDbDisplayStatistics ( case CMD_STAT_STACK: #if defined(ACPI_DEBUG_OUTPUT) - Temp = (UINT32) ACPI_PTR_DIFF (AcpiGbl_EntryStackPointer, AcpiGbl_LowestStackPointer); + Temp = (UINT32) ACPI_PTR_DIFF ( + AcpiGbl_EntryStackPointer, AcpiGbl_LowestStackPointer); AcpiOsPrintf ("\nSubsystem Stack Usage:\n\n"); AcpiOsPrintf ("Entry Stack Pointer %p\n", AcpiGbl_EntryStackPointer); @@ -550,5 +555,3 @@ AcpiDbDisplayStatistics ( AcpiOsPrintf ("\n"); return (AE_OK); } - -#endif /* ACPI_DEBUGGER */ diff --git a/sys/contrib/dev/acpica/components/debugger/dbtest.c b/sys/contrib/dev/acpica/components/debugger/dbtest.c index ce3347c..a859c64 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbtest.c +++ b/sys/contrib/dev/acpica/components/debugger/dbtest.c @@ -47,7 +47,6 @@ #include <contrib/dev/acpica/include/acnamesp.h> #include <contrib/dev/acpica/include/acpredef.h> -#ifdef ACPI_DEBUGGER #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dbtest") @@ -124,8 +123,8 @@ static ACPI_DB_ARGUMENT_INFO AcpiDbTestTypes [] = * used to read and write the various namespace objects. The point * is to force the AML interpreter do all of the work. */ -#define ACPI_DB_READ_METHOD "\\_T98" -#define ACPI_DB_WRITE_METHOD "\\_T99" +#define ACPI_DB_READ_METHOD "\\_T98" +#define ACPI_DB_WRITE_METHOD "\\_T99" static ACPI_HANDLE ReadHandle = NULL; static ACPI_HANDLE WriteHandle = NULL; @@ -283,7 +282,7 @@ AcpiDbTestAllObjects ( /* Walk the entire namespace, testing each supported named data object */ (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, AcpiDbTestOneObject, NULL, NULL, NULL); + ACPI_UINT32_MAX, AcpiDbTestOneObject, NULL, NULL, NULL); } @@ -695,7 +694,8 @@ AcpiDbTestBufferType ( goto Exit; } - if (memcmp (Temp1->Buffer.Pointer, Temp3->Buffer.Pointer, ByteLength)) + if (memcmp (Temp1->Buffer.Pointer, + Temp3->Buffer.Pointer, ByteLength)) { AcpiOsPrintf (" MISMATCH 3: While restoring original buffer"); } @@ -847,7 +847,8 @@ AcpiDbReadFromObject ( ReturnObj.Length = ACPI_ALLOCATE_BUFFER; AcpiGbl_MethodExecuting = TRUE; - Status = AcpiEvaluateObject (ReadHandle, NULL, &ParamObjects, &ReturnObj); + Status = AcpiEvaluateObject (ReadHandle, NULL, + &ParamObjects, &ReturnObj); AcpiGbl_MethodExecuting = FALSE; if (ACPI_FAILURE (Status)) @@ -885,8 +886,8 @@ AcpiDbReadFromObject ( AcpiOsPrintf (" Unsupported return object type, %s", AcpiUtGetTypeName (RetValue->Type)); - AcpiOsFree (ReturnObj.Pointer); + AcpiOsFree (ReturnObj.Pointer); return (AE_TYPE); } @@ -975,8 +976,9 @@ AcpiDbEvaluateAllPredefinedNames ( /* Search all nodes in namespace */ - (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, - AcpiDbEvaluateOnePredefinedName, NULL, (void *) &Info, NULL); + (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, AcpiDbEvaluateOnePredefinedName, NULL, + (void *) &Info, NULL); AcpiOsPrintf ("Evaluated %u predefined names in the namespace\n", Info.Count); } @@ -1076,8 +1078,10 @@ AcpiDbEvaluateOnePredefinedName ( case ACPI_TYPE_STRING: - ThisParam->String.Pointer = "This is the default argument string"; - ThisParam->String.Length = strlen (ThisParam->String.Pointer); + ThisParam->String.Pointer = + "This is the default argument string"; + ThisParam->String.Length = + strlen (ThisParam->String.Pointer); break; case ACPI_TYPE_BUFFER: @@ -1116,7 +1120,8 @@ AcpiDbEvaluateOnePredefinedName ( Status = AcpiEvaluateObject (Node, NULL, &ParamObjects, &ReturnObj); - AcpiOsPrintf ("%-32s returned %s\n", Pathname, AcpiFormatException (Status)); + AcpiOsPrintf ("%-32s returned %s\n", + Pathname, AcpiFormatException (Status)); AcpiGbl_MethodExecuting = FALSE; ACPI_FREE (Pathname); @@ -1134,5 +1139,3 @@ AcpiDbEvaluateOnePredefinedName ( return (Status); } - -#endif /* ACPI_DEBUGGER */ diff --git a/sys/contrib/dev/acpica/components/debugger/dbutils.c b/sys/contrib/dev/acpica/components/debugger/dbutils.c index 16ec190..8e97254 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbutils.c +++ b/sys/contrib/dev/acpica/components/debugger/dbutils.c @@ -47,11 +47,10 @@ #include <contrib/dev/acpica/include/acdebug.h> -#ifdef ACPI_DEBUGGER - #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dbutils") + /* Local prototypes */ #ifdef ACPI_OBSOLETE_FUNCTIONS @@ -64,7 +63,7 @@ AcpiDbDumpBuffer ( UINT32 Address); #endif -static char *Converter = "0123456789ABCDEF"; +static char *Gbl_HexToAscii = "0123456789ABCDEF"; /******************************************************************************* @@ -127,7 +126,8 @@ AcpiDbSetOutputDestination ( AcpiGbl_DbOutputFlags = (UINT8) OutputFlags; - if ((OutputFlags & ACPI_DB_REDIRECTABLE_OUTPUT) && AcpiGbl_DbOutputToFile) + if ((OutputFlags & ACPI_DB_REDIRECTABLE_OUTPUT) && + AcpiGbl_DbOutputToFile) { AcpiDbgLevel = AcpiGbl_DbDebugLevel; } @@ -180,7 +180,7 @@ AcpiDbDumpExternalObject ( case ACPI_TYPE_INTEGER: AcpiOsPrintf ("[Integer] = %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); + ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); break; case ACPI_TYPE_STRING: @@ -199,8 +199,9 @@ AcpiDbDumpExternalObject ( { AcpiOsPrintf ("\n"); } - AcpiUtDebugDumpBuffer (ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer), - ObjDesc->Buffer.Length, DB_BYTE_DISPLAY, _COMPONENT); + AcpiUtDebugDumpBuffer ( + ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer), + ObjDesc->Buffer.Length, DB_BYTE_DISPLAY, _COMPONENT); } else { @@ -211,11 +212,12 @@ AcpiDbDumpExternalObject ( case ACPI_TYPE_PACKAGE: AcpiOsPrintf ("[Package] Contains %u Elements:\n", - ObjDesc->Package.Count); + ObjDesc->Package.Count); for (i = 0; i < ObjDesc->Package.Count; i++) { - AcpiDbDumpExternalObject (&ObjDesc->Package.Elements[i], Level+1); + AcpiDbDumpExternalObject ( + &ObjDesc->Package.Elements[i], Level+1); } break; @@ -335,12 +337,13 @@ AcpiDbLocalNsLookup ( * Lookup the name. * (Uses root node as the search starting point) */ - Status = AcpiNsLookup (NULL, InternalPath, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node); + Status = AcpiNsLookup (NULL, InternalPath, ACPI_TYPE_ANY, + ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE, + NULL, &Node); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Could not locate name: %s, %s\n", - Name, AcpiFormatException (Status)); + Name, AcpiFormatException (Status)); } ACPI_FREE (InternalPath); @@ -382,7 +385,7 @@ AcpiDbUint32ToHexString ( for (i = 7; i >= 0; i--) { - Buffer[i] = Converter [Value & 0x0F]; + Buffer[i] = Gbl_HexToAscii [Value & 0x0F]; Value = Value >> 4; } } @@ -504,8 +507,6 @@ AcpiDbDumpBuffer ( AcpiDbgLevel |= ACPI_LV_TABLES; AcpiUtDebugDumpBuffer (ACPI_TO_POINTER (Address), 64, DB_BYTE_DISPLAY, - ACPI_UINT32_MAX); + ACPI_UINT32_MAX); } #endif - -#endif /* ACPI_DEBUGGER */ diff --git a/sys/contrib/dev/acpica/components/debugger/dbxface.c b/sys/contrib/dev/acpica/components/debugger/dbxface.c index 2425929..0902434 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbxface.c +++ b/sys/contrib/dev/acpica/components/debugger/dbxface.c @@ -45,12 +45,7 @@ #include <contrib/dev/acpica/include/accommon.h> #include <contrib/dev/acpica/include/amlcode.h> #include <contrib/dev/acpica/include/acdebug.h> -#ifdef ACPI_DISASSEMBLER -#include <contrib/dev/acpica/include/acdisasm.h> -#endif - -#ifdef ACPI_DEBUGGER #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dbxface") @@ -142,7 +137,8 @@ AcpiDbStartCommand ( ACPI_DB_LINE_BUFFER_SIZE, NULL); if (ACPI_FAILURE (Status)) { - ACPI_EXCEPTION ((AE_INFO, Status, "While parsing command line")); + ACPI_EXCEPTION ((AE_INFO, Status, + "While parsing command line")); return (Status); } } @@ -196,7 +192,7 @@ AcpiDbSingleStep ( } AmlOffset = (UINT32) ACPI_PTR_DIFF (Op->Common.Aml, - WalkState->ParserState.AmlStart); + WalkState->ParserState.AmlStart); /* Check for single-step breakpoint */ @@ -400,7 +396,7 @@ AcpiDbSingleStep ( /******************************************************************************* * - * FUNCTION: AcpiDbInitialize + * FUNCTION: AcpiInitializeDebugger * * PARAMETERS: None * @@ -411,13 +407,13 @@ AcpiDbSingleStep ( ******************************************************************************/ ACPI_STATUS -AcpiDbInitialize ( +AcpiInitializeDebugger ( void) { ACPI_STATUS Status; - ACPI_FUNCTION_TRACE (DbInitialize); + ACPI_FUNCTION_TRACE (AcpiInitializeDebugger); /* Init globals */ @@ -430,10 +426,6 @@ AcpiDbInitialize ( AcpiGbl_DbConsoleDebugLevel = ACPI_NORMAL_DEFAULT | ACPI_LV_TABLES; AcpiGbl_DbOutputFlags = ACPI_DB_CONSOLE_OUTPUT; - AcpiGbl_DbOpt_Disasm = FALSE; -#ifndef _KERNEL - AcpiGbl_DbOpt_Verbose = TRUE; -#endif AcpiGbl_DbOpt_NoIniMethods = FALSE; AcpiGbl_DbBuffer = AcpiOsAllocate (ACPI_DEBUG_BUFFER_SIZE); @@ -474,28 +466,25 @@ AcpiDbInitialize ( /* Create the debug execution thread to execute commands */ - Status = AcpiOsExecute (OSL_DEBUGGER_THREAD, AcpiDbExecuteThread, NULL); + Status = AcpiOsExecute (OSL_DEBUGGER_THREAD, + AcpiDbExecuteThread, NULL); if (ACPI_FAILURE (Status)) { - ACPI_EXCEPTION ((AE_INFO, Status, "Could not start debugger thread")); + ACPI_EXCEPTION ((AE_INFO, Status, + "Could not start debugger thread")); return_ACPI_STATUS (Status); } } -#ifndef _KERNEL - if (!AcpiGbl_DbOpt_Verbose) - { - AcpiGbl_DbOpt_Disasm = TRUE; - } -#endif - return_ACPI_STATUS (AE_OK); } +ACPI_EXPORT_SYMBOL (AcpiInitializeDebugger) + /******************************************************************************* * - * FUNCTION: AcpiDbTerminate + * FUNCTION: AcpiTerminateDebugger * * PARAMETERS: None * @@ -506,7 +495,7 @@ AcpiDbInitialize ( ******************************************************************************/ void -AcpiDbTerminate ( +AcpiTerminateDebugger ( void) { @@ -521,6 +510,8 @@ AcpiDbTerminate ( AcpiGbl_DbOutputFlags = ACPI_DB_DISABLE_OUTPUT; } +ACPI_EXPORT_SYMBOL (AcpiTerminateDebugger) + #ifdef ACPI_OBSOLETE_FUNCTIONS /******************************************************************************* @@ -550,5 +541,3 @@ AcpiDbMethodEnd ( AcpiDbStartCommand (WalkState, NULL); } #endif - -#endif /* ACPI_DEBUGGER */ diff --git a/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c b/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c index fbd8f0b..1b0f495 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c @@ -50,8 +50,6 @@ #include <contrib/dev/acpica/include/acinterp.h> -#ifdef ACPI_DISASSEMBLER - #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dmbuffer") @@ -773,22 +771,19 @@ AcpiDmPldBuffer ( AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Reference", PldInfo->Reference); AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Rotation", PldInfo->Rotation); - if (ByteCount < ACPI_PLD_REV1_BUFFER_SIZE) - { - AcpiOsPrintf (ACPI_PLD_OUTPUT08P, "PLD_Order", PldInfo->Order); - } - else + if (ByteCount >= ACPI_PLD_REV2_BUFFER_SIZE) { AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Order", PldInfo->Order); - } - /* Fifth 32-bit dword */ + /* Fifth 32-bit dword */ - if (ByteCount >= ACPI_PLD_REV1_BUFFER_SIZE) - { - AcpiOsPrintf (ACPI_PLD_OUTPUT16, "PLD_VerticalOffset", PldInfo->VerticalOffset); + AcpiOsPrintf (ACPI_PLD_OUTPUT16, "PLD_VerticalOffset", PldInfo->VerticalOffset); AcpiOsPrintf (ACPI_PLD_OUTPUT16P, "PLD_HorizontalOffset", PldInfo->HorizontalOffset); } + else /* Rev 1 buffer */ + { + AcpiOsPrintf (ACPI_PLD_OUTPUT08P, "PLD_Order", PldInfo->Order); + } ACPI_FREE (PldInfo); } @@ -1030,5 +1025,3 @@ AcpiDmDecompressEisaId ( AcpiOsPrintf (" /* %s */", Info->Description); } } - -#endif diff --git a/sys/contrib/dev/acpica/components/disassembler/dmcstyle.c b/sys/contrib/dev/acpica/components/disassembler/dmcstyle.c index 11814a4..e758283 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmcstyle.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmcstyle.c @@ -45,10 +45,8 @@ #include <contrib/dev/acpica/include/accommon.h> #include <contrib/dev/acpica/include/acparser.h> #include <contrib/dev/acpica/include/amlcode.h> -#include <contrib/dev/acpica/include/acdisasm.h> #include <contrib/dev/acpica/include/acdebug.h> -#ifdef ACPI_DISASSEMBLER #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dmcstyle") @@ -826,5 +824,3 @@ AcpiDmIsTargetAnOperand ( } return (TRUE); } - -#endif diff --git a/sys/contrib/dev/acpica/components/disassembler/dmnames.c b/sys/contrib/dev/acpica/components/disassembler/dmnames.c index 98d4679..5537778 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmnames.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmnames.c @@ -48,8 +48,6 @@ #include <contrib/dev/acpica/include/acdisasm.h> -#ifdef ACPI_DISASSEMBLER - #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dmnames") @@ -414,6 +412,8 @@ AcpiDmValidateName ( char *Name, ACPI_PARSE_OBJECT *Op) { + ACPI_PARSE_OBJECT *TargetOp; + if ((!Name) || (!Op->Common.Parent)) @@ -427,9 +427,6 @@ AcpiDmValidateName ( " /**** Name not found or not accessible from this scope ****/ "); } - ACPI_PARSE_OBJECT *TargetOp; - - if ((!Name) || (!Op->Common.Parent)) { @@ -450,5 +447,3 @@ AcpiDmValidateName ( } } #endif - -#endif diff --git a/sys/contrib/dev/acpica/components/disassembler/dmopcode.c b/sys/contrib/dev/acpica/components/disassembler/dmopcode.c index f76e420..9df0b37 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmopcode.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmopcode.c @@ -45,12 +45,10 @@ #include <contrib/dev/acpica/include/accommon.h> #include <contrib/dev/acpica/include/acparser.h> #include <contrib/dev/acpica/include/amlcode.h> -#include <contrib/dev/acpica/include/acdisasm.h> #include <contrib/dev/acpica/include/acinterp.h> #include <contrib/dev/acpica/include/acnamesp.h> #include <contrib/dev/acpica/include/acdebug.h> -#ifdef ACPI_DISASSEMBLER #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dmopcode") @@ -978,5 +976,3 @@ AcpiDmDisassembleOneOp ( break; } } - -#endif /* ACPI_DISASSEMBLER */ diff --git a/sys/contrib/dev/acpica/components/disassembler/dmresrc.c b/sys/contrib/dev/acpica/components/disassembler/dmresrc.c index 2a8147e..7d82621 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmresrc.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmresrc.c @@ -46,7 +46,6 @@ #include <contrib/dev/acpica/include/amlcode.h> #include <contrib/dev/acpica/include/acdisasm.h> -#ifdef ACPI_DISASSEMBLER #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dbresrc") @@ -444,5 +443,3 @@ AcpiDmIsResourceTemplate ( */ return (AE_OK); } - -#endif diff --git a/sys/contrib/dev/acpica/components/disassembler/dmresrcl.c b/sys/contrib/dev/acpica/components/disassembler/dmresrcl.c index b0cf41e..9dd5ef6 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmresrcl.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmresrcl.c @@ -46,8 +46,6 @@ #include <contrib/dev/acpica/include/acdisasm.h> -#ifdef ACPI_DISASSEMBLER - #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dbresrcl") @@ -1079,5 +1077,3 @@ AcpiDmVendorLargeDescriptor ( ACPI_ADD_PTR (UINT8, Resource, sizeof (AML_RESOURCE_LARGE_HEADER)), Length, Level); } - -#endif diff --git a/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c b/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c index ff5fabc..171e6a1 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c @@ -46,8 +46,6 @@ #include <contrib/dev/acpica/include/acdisasm.h> -#ifdef ACPI_DISASSEMBLER - #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dbresrcl2") @@ -734,5 +732,3 @@ AcpiDmSerialBusDescriptor ( SerialBusResourceDispatch [Resource->CommonSerialBus.Type] ( Info, Resource, Length, Level); } - -#endif diff --git a/sys/contrib/dev/acpica/components/disassembler/dmresrcs.c b/sys/contrib/dev/acpica/components/disassembler/dmresrcs.c index 31b68b2..6902f03 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmresrcs.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmresrcs.c @@ -46,8 +46,6 @@ #include <contrib/dev/acpica/include/acdisasm.h> -#ifdef ACPI_DISASSEMBLER - #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dbresrcs") @@ -368,5 +366,3 @@ AcpiDmVendorSmallDescriptor ( ACPI_ADD_PTR (UINT8, Resource, sizeof (AML_RESOURCE_SMALL_HEADER)), Length, Level); } - -#endif diff --git a/sys/contrib/dev/acpica/components/disassembler/dmutils.c b/sys/contrib/dev/acpica/components/disassembler/dmutils.c index bdc252e..876f404 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmutils.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmutils.c @@ -50,7 +50,6 @@ #include <contrib/dev/acpica/include/acnamesp.h> #endif -#ifdef ACPI_DISASSEMBLER #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dmutils") @@ -329,5 +328,3 @@ AcpiDmCommaIfFieldMember ( AcpiOsPrintf (", "); } } - -#endif diff --git a/sys/contrib/dev/acpica/components/disassembler/dmwalk.c b/sys/contrib/dev/acpica/components/disassembler/dmwalk.c index da8c88b..fd2d28b 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmwalk.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmwalk.c @@ -45,12 +45,9 @@ #include <contrib/dev/acpica/include/accommon.h> #include <contrib/dev/acpica/include/acparser.h> #include <contrib/dev/acpica/include/amlcode.h> -#include <contrib/dev/acpica/include/acdisasm.h> #include <contrib/dev/acpica/include/acdebug.h> -#ifdef ACPI_DISASSEMBLER - #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dmwalk") @@ -117,10 +114,11 @@ AcpiDmDisassemble ( return; } - Info.Flags = 0; - Info.Level = 0; - Info.Count = 0; + memset (&Info, 0, sizeof (ACPI_OP_WALK_INFO)); Info.WalkState = WalkState; + Info.StartAml = Op->Common.Aml - sizeof (ACPI_TABLE_HEADER); + Info.AmlOffset = Op->Common.Aml - Info.StartAml; + AcpiDmWalkParseTree (Op, AcpiDmDescendingOp, AcpiDmAscendingOp, &Info); return; } @@ -415,20 +413,40 @@ AcpiDmDescendingOp ( UINT32 AmlOffset; - if (AcpiGbl_DbOpt_Verbose && AcpiGbl_PreviousOp) + OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); + + /* Listing support to dump the AML code after the ASL statement */ + + if (AcpiGbl_DmOpt_Listing) { - /* Dump the entire statement in AML byte code */ + /* We only care about these classes of objects */ - if (Op->Common.Aml > AcpiGbl_PreviousOp->Common.Aml) + 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))) { - AcpiOsPrintf ("\n"); - AcpiUtDumpBuffer (AcpiGbl_PreviousOp->Common.Aml, - (Op->Common.Aml - AcpiGbl_PreviousOp->Common.Aml), - DB_BYTE_DISPLAY, 0); - AcpiDmIndent (Level); + 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; } } - AcpiGbl_PreviousOp = Op; if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE) { @@ -447,10 +465,13 @@ AcpiDmDescendingOp ( { AmlOffset = (UINT32) ACPI_PTR_DIFF (Op->Common.Aml, Info->WalkState->ParserState.AmlStart); - VERBOSE_PRINT ((DB_FULL_OP_INFO, - (Info->WalkState->MethodNode ? - Info->WalkState->MethodNode->Name.Ascii : " "), - AmlOffset, (UINT32) Op->Common.AmlOpcode)); + if (AcpiGbl_DmOpt_Verbose) + { + AcpiOsPrintf (DB_FULL_OP_INFO, + (Info->WalkState->MethodNode ? + Info->WalkState->MethodNode->Name.Ascii : " "), + AmlOffset, (UINT32) Op->Common.AmlOpcode); + } } if (Op->Common.AmlOpcode == AML_SCOPE_OP) @@ -541,8 +562,6 @@ AcpiDmDescendingOp ( /* Start the opcode argument list if necessary */ - OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - if ((OpInfo->Flags & AML_HAS_ARGS) || (Op->Common.AmlOpcode == AML_EVENT_OP)) { @@ -582,7 +601,7 @@ AcpiDmDescendingOp ( if (Op->Common.AmlOpcode != AML_INT_NAMEDFIELD_OP) { - if (AcpiGbl_DbOpt_Verbose) + if (AcpiGbl_DmOpt_Verbose) { (void) AcpiPsDisplayObjectPathname (NULL, Op); } @@ -1046,5 +1065,3 @@ AcpiDmAscendingOp ( return (AE_OK); } - -#endif /* ACPI_DISASSEMBLER */ diff --git a/sys/contrib/dev/acpica/components/dispatcher/dscontrol.c b/sys/contrib/dev/acpica/components/dispatcher/dscontrol.c index bb23156..5986183 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dscontrol.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dscontrol.c @@ -221,7 +221,7 @@ AcpiDsExecEndControlOp ( * loop does not implement a timeout. */ ControlState->Control.LoopCount++; - if (ControlState->Control.LoopCount > ACPI_MAX_LOOP_ITERATIONS) + if (ControlState->Control.LoopCount > AcpiGbl_MaxLoopIterations) { Status = AE_AML_INFINITE_LOOP; break; diff --git a/sys/contrib/dev/acpica/components/dispatcher/dsdebug.c b/sys/contrib/dev/acpica/components/dispatcher/dsdebug.c index 9fab3da..78206c0 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dsdebug.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dsdebug.c @@ -96,7 +96,7 @@ AcpiDsPrintNodePathname ( Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (Node, &Buffer, FALSE); + Status = AcpiNsHandleToPathname (Node, &Buffer, TRUE); if (ACPI_SUCCESS (Status)) { if (Message) diff --git a/sys/contrib/dev/acpica/components/dispatcher/dsinit.c b/sys/contrib/dev/acpica/components/dispatcher/dsinit.c index 921f556..48b2799 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dsinit.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dsinit.c @@ -255,10 +255,19 @@ AcpiDsInitializeObjects ( return_ACPI_STATUS (Status); } + /* DSDT is always the first AML table */ + + if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_DSDT)) + { + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "\nInitializing Namespace objects:\n")); + } + + /* Summary of objects initialized */ + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "Table [%4.4s] (id %4.4X) - %4u Objects with %3u Devices, " - "%3u Regions, %3u Methods (%u/%u/%u Serial/Non/Cvt)\n", - Table->Signature, OwnerId, Info.ObjectCount, Info.DeviceCount, + "Table [%4.4s:%8.8s] (id %.2X) - %4u Objects with %3u Devices, " + "%3u Regions, %4u Methods (%u/%u/%u Serial/Non/Cvt)\n", + Table->Signature, Table->OemTableId, OwnerId, Info.ObjectCount, Info.DeviceCount, Info.OpRegionCount, Info.MethodCount, Info.SerialMethodCount, Info.NonSerialMethodCount, Info.SerializedMethodCount)); diff --git a/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c b/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c index 157e4ce..c69d9bd 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c @@ -513,8 +513,8 @@ AcpiDsEvalTableRegionOperands ( ACPI_OPERAND_OBJECT **Operand; ACPI_NAMESPACE_NODE *Node; ACPI_PARSE_OBJECT *NextOp; - UINT32 TableIndex; ACPI_TABLE_HEADER *Table; + UINT32 TableIndex; ACPI_FUNCTION_TRACE_PTR (DsEvalTableRegionOperands, Op); @@ -540,6 +540,8 @@ AcpiDsEvalTableRegionOperands ( return_ACPI_STATUS (Status); } + Operand = &WalkState->Operands[0]; + /* * Resolve the Signature string, OemId string, * and OemTableId string operands @@ -548,49 +550,57 @@ AcpiDsEvalTableRegionOperands ( ACPI_WALK_OPERANDS, WalkState); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + goto Cleanup; } - Operand = &WalkState->Operands[0]; - /* Find the ACPI table */ - Status = AcpiTbFindTable (Operand[0]->String.Pointer, - Operand[1]->String.Pointer, Operand[2]->String.Pointer, - &TableIndex); + Status = AcpiTbFindTable ( + Operand[0]->String.Pointer, + Operand[1]->String.Pointer, + Operand[2]->String.Pointer, &TableIndex); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + if (Status == AE_NOT_FOUND) + { + ACPI_ERROR ((AE_INFO, + "ACPI Table [%4.4s] OEM:(%s, %s) not found in RSDT/XSDT", + Operand[0]->String.Pointer, + Operand[1]->String.Pointer, + Operand[2]->String.Pointer)); + } + goto Cleanup; } - AcpiUtRemoveReference (Operand[0]); - AcpiUtRemoveReference (Operand[1]); - AcpiUtRemoveReference (Operand[2]); - Status = AcpiGetTableByIndex (TableIndex, &Table); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + goto Cleanup; } ObjDesc = AcpiNsGetAttachedObject (Node); if (!ObjDesc) { - return_ACPI_STATUS (AE_NOT_EXIST); + Status = AE_NOT_EXIST; + goto Cleanup; } ObjDesc->Region.Address = ACPI_PTR_TO_PHYSADDR (Table); ObjDesc->Region.Length = Table->Length; ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", - ObjDesc, - ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), + ObjDesc, ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), ObjDesc->Region.Length)); /* Now the address and length are valid for this opregion */ ObjDesc->Region.Flags |= AOPOBJ_DATA_VALID; +Cleanup: + AcpiUtRemoveReference (Operand[0]); + AcpiUtRemoveReference (Operand[1]); + AcpiUtRemoveReference (Operand[2]); + return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/components/events/evregion.c b/sys/contrib/dev/acpica/components/events/evregion.c index 54171b6..5904e31 100644 --- a/sys/contrib/dev/acpica/components/events/evregion.c +++ b/sys/contrib/dev/acpica/components/events/evregion.c @@ -660,10 +660,17 @@ AcpiEvExecuteRegMethods ( ACPI_ADR_SPACE_TYPE SpaceId) { ACPI_STATUS Status; + ACPI_REG_WALK_INFO Info; ACPI_FUNCTION_TRACE (EvExecuteRegMethods); + Info.SpaceId = SpaceId; + Info.RegRunCount = 0; + + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_NAMES, + " Running _REG methods for SpaceId %s\n", + AcpiUtGetRegionName (Info.SpaceId))); /* * Run all _REG methods for all Operation Regions for this space ID. This @@ -672,8 +679,7 @@ AcpiEvExecuteRegMethods ( * regions of this Space ID before we can run any _REG methods) */ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, ACPI_UINT32_MAX, - ACPI_NS_WALK_UNLOCK, AcpiEvRegRun, NULL, - &SpaceId, NULL); + ACPI_NS_WALK_UNLOCK, AcpiEvRegRun, NULL, &Info, NULL); /* Special case for EC: handle "orphan" _REG methods with no region */ @@ -682,6 +688,10 @@ AcpiEvExecuteRegMethods ( AcpiEvOrphanEcRegMethod (Node); } + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_NAMES, + " Executed %u _REG methods for SpaceId %s\n", + Info.RegRunCount, AcpiUtGetRegionName (Info.SpaceId))); + return_ACPI_STATUS (Status); } @@ -705,11 +715,11 @@ AcpiEvRegRun ( { ACPI_OPERAND_OBJECT *ObjDesc; ACPI_NAMESPACE_NODE *Node; - ACPI_ADR_SPACE_TYPE SpaceId; ACPI_STATUS Status; + ACPI_REG_WALK_INFO *Info; - SpaceId = *ACPI_CAST_PTR (ACPI_ADR_SPACE_TYPE, Context); + Info = ACPI_CAST_PTR (ACPI_REG_WALK_INFO, Context); /* Convert and validate the device handle */ @@ -741,13 +751,14 @@ AcpiEvRegRun ( /* Object is a Region */ - if (ObjDesc->Region.SpaceId != SpaceId) + if (ObjDesc->Region.SpaceId != Info->SpaceId) { /* This region is for a different address space, just ignore it */ return (AE_OK); } + Info->RegRunCount++; Status = AcpiEvExecuteRegMethod (ObjDesc, ACPI_REG_CONNECT); return (Status); } diff --git a/sys/contrib/dev/acpica/components/executer/exconfig.c b/sys/contrib/dev/acpica/components/executer/exconfig.c index 96188e6..c78f1a2 100644 --- a/sys/contrib/dev/acpica/components/executer/exconfig.c +++ b/sys/contrib/dev/acpica/components/executer/exconfig.c @@ -178,15 +178,6 @@ AcpiExLoadTableOp ( ACPI_FUNCTION_TRACE (ExLoadTableOp); - /* Validate lengths for the Signature, OemId, and OemTableId strings */ - - if ((Operand[0]->String.Length > ACPI_NAME_SIZE) || - (Operand[1]->String.Length > ACPI_OEM_ID_SIZE) || - (Operand[2]->String.Length > ACPI_OEM_TABLE_ID_SIZE)) - { - return_ACPI_STATUS (AE_AML_STRING_LIMIT); - } - /* Find the ACPI table in the RSDT/XSDT */ Status = AcpiTbFindTable ( diff --git a/sys/contrib/dev/acpica/components/executer/exdump.c b/sys/contrib/dev/acpica/components/executer/exdump.c index bfb66a6..eacbdc4 100644 --- a/sys/contrib/dev/acpica/components/executer/exdump.c +++ b/sys/contrib/dev/acpica/components/executer/exdump.c @@ -1040,7 +1040,7 @@ AcpiExDumpReferenceObj ( AcpiOsPrintf (" %p ", ObjDesc->Reference.Node); Status = AcpiNsHandleToPathname (ObjDesc->Reference.Node, - &RetBuf, FALSE); + &RetBuf, TRUE); if (ACPI_FAILURE (Status)) { AcpiOsPrintf (" Could not convert name to pathname\n"); diff --git a/sys/contrib/dev/acpica/components/executer/exresnte.c b/sys/contrib/dev/acpica/components/executer/exresnte.c index 99b64c2..ee4f819 100644 --- a/sys/contrib/dev/acpica/components/executer/exresnte.c +++ b/sys/contrib/dev/acpica/components/executer/exresnte.c @@ -134,7 +134,7 @@ AcpiExResolveNodeToValue ( { ACPI_ERROR ((AE_INFO, "No object attached to node [%4.4s] %p", Node->Name.Ascii, Node)); - return_ACPI_STATUS (AE_AML_NO_OPERAND); + return_ACPI_STATUS (AE_AML_UNINITIALIZED_NODE); } /* diff --git a/sys/contrib/dev/acpica/components/executer/exresolv.c b/sys/contrib/dev/acpica/components/executer/exresolv.c index 32862a9..bead3e4 100644 --- a/sys/contrib/dev/acpica/components/executer/exresolv.c +++ b/sys/contrib/dev/acpica/components/executer/exresolv.c @@ -351,8 +351,8 @@ AcpiExResolveMultiple ( ACPI_OBJECT_TYPE *ReturnType, ACPI_OPERAND_OBJECT **ReturnDesc) { - ACPI_OPERAND_OBJECT *ObjDesc = (void *) Operand; - ACPI_NAMESPACE_NODE *Node; + ACPI_OPERAND_OBJECT *ObjDesc = ACPI_CAST_PTR (void, Operand); + ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Operand); ACPI_OBJECT_TYPE Type; ACPI_STATUS Status; @@ -372,7 +372,7 @@ AcpiExResolveMultiple ( case ACPI_DESC_TYPE_NAMED: Type = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type; - ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ObjDesc); + ObjDesc = AcpiNsGetAttachedObject (Node); /* If we had an Alias node, use the attached object for type info */ @@ -381,6 +381,14 @@ AcpiExResolveMultiple ( Type = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type; ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ObjDesc); } + + if (!ObjDesc) + { + ACPI_ERROR ((AE_INFO, + "[%4.4s] Node is unresolved or uninitialized", + AcpiUtGetNodeName (Node))); + return_ACPI_STATUS (AE_AML_UNINITIALIZED_NODE); + } break; default: diff --git a/sys/contrib/dev/acpica/components/hardware/hwxfsleep.c b/sys/contrib/dev/acpica/components/hardware/hwxfsleep.c index 5610398..e6d99e4 100644 --- a/sys/contrib/dev/acpica/components/hardware/hwxfsleep.c +++ b/sys/contrib/dev/acpica/components/hardware/hwxfsleep.c @@ -169,21 +169,9 @@ AcpiSetFirmwareWakingVector ( ACPI_FUNCTION_TRACE (AcpiSetFirmwareWakingVector); - /* If Hardware Reduced flag is set, there is no FACS */ - - if (AcpiGbl_ReducedHardware) - { - return_ACPI_STATUS (AE_OK); - } - - if (AcpiGbl_Facs32) - { - (void) AcpiHwSetFirmwareWakingVector (AcpiGbl_Facs32, - PhysicalAddress, PhysicalAddress64); - } - if (AcpiGbl_Facs64) + if (AcpiGbl_FACS) { - (void) AcpiHwSetFirmwareWakingVector (AcpiGbl_Facs64, + (void) AcpiHwSetFirmwareWakingVector (AcpiGbl_FACS, PhysicalAddress, PhysicalAddress64); } diff --git a/sys/contrib/dev/acpica/components/namespace/nseval.c b/sys/contrib/dev/acpica/components/namespace/nseval.c index fb39171..a8c9d89 100644 --- a/sys/contrib/dev/acpica/components/namespace/nseval.c +++ b/sys/contrib/dev/acpica/components/namespace/nseval.c @@ -284,6 +284,7 @@ AcpiNsEvaluate ( if (ACPI_FAILURE (Status)) { + Info->ReturnObject = NULL; goto Cleanup; } @@ -489,7 +490,8 @@ AcpiNsExecModuleCode ( Status = AcpiNsEvaluate (Info); - ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "Executed module-level code at %p\n", + ACPI_DEBUG_PRINT ((ACPI_DB_INIT_NAMES, + "Executed module-level code at %p\n", MethodObj->Method.AmlStart)); /* Delete a possible implicit return value (in slack mode) */ diff --git a/sys/contrib/dev/acpica/components/namespace/nsload.c b/sys/contrib/dev/acpica/components/namespace/nsload.c index c9b1174..4b4dc13 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsload.c +++ b/sys/contrib/dev/acpica/components/namespace/nsload.c @@ -128,7 +128,21 @@ AcpiNsLoadTable ( } else { - (void) AcpiTbReleaseOwnerId (TableIndex); + /* + * On error, delete any namespace objects created by this table. + * We cannot initialize these objects, so delete them. There are + * a couple of expecially bad cases: + * AE_ALREADY_EXISTS - namespace collision. + * AE_NOT_FOUND - the target of a Scope operator does not + * exist. This target of Scope must already exist in the + * namespace, as per the ACPI specification. + */ + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + AcpiNsDeleteNamespaceByOwner ( + AcpiGbl_RootTableList.Tables[TableIndex].OwnerId); + AcpiTbReleaseOwnerId (TableIndex); + + return_ACPI_STATUS (Status); } Unlock: diff --git a/sys/contrib/dev/acpica/components/namespace/nsutils.c b/sys/contrib/dev/acpica/components/namespace/nsutils.c index 0c794cf..2b9ffa1 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsutils.c +++ b/sys/contrib/dev/acpica/components/namespace/nsutils.c @@ -90,7 +90,7 @@ AcpiNsPrintNodePathname ( Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (Node, &Buffer, FALSE); + Status = AcpiNsHandleToPathname (Node, &Buffer, TRUE); if (ACPI_SUCCESS (Status)) { if (Message) @@ -697,6 +697,24 @@ AcpiNsTerminate ( ACPI_FUNCTION_TRACE (NsTerminate); +#ifdef ACPI_EXEC_APP + { + ACPI_OPERAND_OBJECT *Prev; + ACPI_OPERAND_OBJECT *Next; + + /* Delete any module-level code blocks */ + + Next = AcpiGbl_ModuleCodeList; + while (Next) + { + Prev = Next; + Next = Next->Method.Mutex; + Prev->Method.Mutex = NULL; /* Clear the Mutex (cheated) field */ + AcpiUtRemoveReference (Prev); + } + } +#endif + /* * Free the entire namespace -- all nodes and all objects * attached to the nodes diff --git a/sys/contrib/dev/acpica/components/parser/psloop.c b/sys/contrib/dev/acpica/components/parser/psloop.c index b31a573..01b84b9 100644 --- a/sys/contrib/dev/acpica/components/parser/psloop.c +++ b/sys/contrib/dev/acpica/components/parser/psloop.c @@ -318,6 +318,9 @@ AcpiPsLinkModuleCode ( ACPI_NAMESPACE_NODE *ParentNode; + ACPI_FUNCTION_TRACE (PsLinkModuleCode); + + /* Get the tail of the list */ Prev = Next = AcpiGbl_ModuleCodeList; @@ -339,9 +342,12 @@ AcpiPsLinkModuleCode ( MethodObj = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD); if (!MethodObj) { - return; + return_VOID; } + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, + "Create/Link new code block: %p\n", MethodObj)); + if (ParentOp->Common.Node) { ParentNode = ParentOp->Common.Node; @@ -374,8 +380,13 @@ AcpiPsLinkModuleCode ( } else { + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, + "Appending to existing code block: %p\n", Prev)); + Prev->Method.AmlLength += AmlLength; } + + return_VOID; } /******************************************************************************* diff --git a/sys/contrib/dev/acpica/components/resources/rsdump.c b/sys/contrib/dev/acpica/components/resources/rsdump.c index 9c1a7ec..c88ff7c 100644 --- a/sys/contrib/dev/acpica/components/resources/rsdump.c +++ b/sys/contrib/dev/acpica/components/resources/rsdump.c @@ -51,7 +51,6 @@ /* * All functions in this module are used by the AML Debugger only */ -#if defined(ACPI_DEBUGGER) /* Local prototypes */ @@ -667,5 +666,3 @@ AcpiRsDumpWordList ( "Word", i, Data[i]); } } - -#endif diff --git a/sys/contrib/dev/acpica/components/tables/tbfadt.c b/sys/contrib/dev/acpica/components/tables/tbfadt.c index 0917157..f3b39ec 100644 --- a/sys/contrib/dev/acpica/components/tables/tbfadt.c +++ b/sys/contrib/dev/acpica/components/tables/tbfadt.c @@ -376,7 +376,7 @@ AcpiTbParseFadt ( /* Obtain the DSDT and FACS tables via their addresses within the FADT */ AcpiTbInstallFixedTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XDsdt, - ACPI_SIG_DSDT, ACPI_TABLE_INDEX_DSDT); + ACPI_SIG_DSDT, &AcpiGbl_DsdtIndex); /* If Hardware Reduced flag is set, there is no FACS */ @@ -385,12 +385,12 @@ AcpiTbParseFadt ( if (AcpiGbl_FADT.Facs) { AcpiTbInstallFixedTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.Facs, - ACPI_SIG_FACS, ACPI_TABLE_INDEX_FACS); + ACPI_SIG_FACS, &AcpiGbl_FacsIndex); } if (AcpiGbl_FADT.XFacs) { AcpiTbInstallFixedTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs, - ACPI_SIG_FACS, ACPI_TABLE_INDEX_X_FACS); + ACPI_SIG_FACS, &AcpiGbl_XFacsIndex); } } } diff --git a/sys/contrib/dev/acpica/components/tables/tbfind.c b/sys/contrib/dev/acpica/components/tables/tbfind.c index e5c4cee..eff0167 100644 --- a/sys/contrib/dev/acpica/components/tables/tbfind.c +++ b/sys/contrib/dev/acpica/components/tables/tbfind.c @@ -73,14 +73,29 @@ AcpiTbFindTable ( char *OemTableId, UINT32 *TableIndex) { - UINT32 i; ACPI_STATUS Status; ACPI_TABLE_HEADER Header; + UINT32 i; ACPI_FUNCTION_TRACE (TbFindTable); + /* Validate the input table signature */ + + if (!AcpiIsValidSignature (Signature)) + { + return_ACPI_STATUS (AE_BAD_SIGNATURE); + } + + /* Don't allow the OEM strings to be too long */ + + if ((strlen (OemId) > ACPI_OEM_ID_SIZE) || + (strlen (OemTableId) > ACPI_OEM_TABLE_ID_SIZE)) + { + return_ACPI_STATUS (AE_AML_STRING_LIMIT); + } + /* Normalize the input strings */ memset (&Header, 0, sizeof (ACPI_TABLE_HEADER)); diff --git a/sys/contrib/dev/acpica/components/tables/tbinstal.c b/sys/contrib/dev/acpica/components/tables/tbinstal.c index a6680cf..9484906 100644 --- a/sys/contrib/dev/acpica/components/tables/tbinstal.c +++ b/sys/contrib/dev/acpica/components/tables/tbinstal.c @@ -108,9 +108,9 @@ AcpiTbCompareTables ( * * FUNCTION: AcpiTbInstallTableWithOverride * - * PARAMETERS: TableIndex - Index into root table array - * NewTableDesc - New table descriptor to install + * PARAMETERS: NewTableDesc - New table descriptor to install * Override - Whether override should be performed + * TableIndex - Where the table index is returned * * RETURN: None * @@ -123,12 +123,16 @@ AcpiTbCompareTables ( void AcpiTbInstallTableWithOverride ( - UINT32 TableIndex, ACPI_TABLE_DESC *NewTableDesc, - BOOLEAN Override) + BOOLEAN Override, + UINT32 *TableIndex) { + UINT32 i; + ACPI_STATUS Status; + - if (TableIndex >= AcpiGbl_RootTableList.CurrentTableCount) + Status = AcpiTbGetNextTableDescriptor (&i, NULL); + if (ACPI_FAILURE (Status)) { return; } @@ -145,14 +149,18 @@ AcpiTbInstallTableWithOverride ( AcpiTbOverrideTable (NewTableDesc); } - AcpiTbInitTableDescriptor (&AcpiGbl_RootTableList.Tables[TableIndex], + AcpiTbInitTableDescriptor (&AcpiGbl_RootTableList.Tables[i], NewTableDesc->Address, NewTableDesc->Flags, NewTableDesc->Pointer); AcpiTbPrintTableHeader (NewTableDesc->Address, NewTableDesc->Pointer); + /* This synchronizes AcpiGbl_DsdtIndex */ + + *TableIndex = i; + /* Set the global integer width (based upon revision of the DSDT) */ - if (TableIndex == ACPI_TABLE_INDEX_DSDT) + if (i == AcpiGbl_DsdtIndex) { AcpiUtSetIntegerWidth (NewTableDesc->Pointer->Revision); } @@ -166,7 +174,7 @@ AcpiTbInstallTableWithOverride ( * PARAMETERS: Address - Physical address of DSDT or FACS * Signature - Table signature, NULL if no need to * match - * TableIndex - Index into root table array + * TableIndex - Where the table index is returned * * RETURN: Status * @@ -179,7 +187,7 @@ ACPI_STATUS AcpiTbInstallFixedTable ( ACPI_PHYSICAL_ADDRESS Address, char *Signature, - UINT32 TableIndex) + UINT32 *TableIndex) { ACPI_TABLE_DESC NewTableDesc; ACPI_STATUS Status; @@ -214,7 +222,9 @@ AcpiTbInstallFixedTable ( goto ReleaseAndExit; } - AcpiTbInstallTableWithOverride (TableIndex, &NewTableDesc, TRUE); + /* Add the table to the global root table list */ + + AcpiTbInstallTableWithOverride (&NewTableDesc, TRUE, TableIndex); ReleaseAndExit: @@ -375,14 +385,7 @@ AcpiTbInstallStandardTable ( /* Add the table to the global root table list */ - Status = AcpiTbGetNextTableDescriptor (&i, NULL); - if (ACPI_FAILURE (Status)) - { - goto ReleaseAndExit; - } - - *TableIndex = i; - AcpiTbInstallTableWithOverride (i, &NewTableDesc, Override); + AcpiTbInstallTableWithOverride (&NewTableDesc, Override, TableIndex); ReleaseAndExit: diff --git a/sys/contrib/dev/acpica/components/tables/tbutils.c b/sys/contrib/dev/acpica/components/tables/tbutils.c index 94ac4f9..b575933 100644 --- a/sys/contrib/dev/acpica/components/tables/tbutils.c +++ b/sys/contrib/dev/acpica/components/tables/tbutils.c @@ -75,6 +75,8 @@ ACPI_STATUS AcpiTbInitializeFacs ( void) { + ACPI_TABLE_FACS *Facs; + /* If Hardware Reduced flag is set, there is no FACS */ @@ -83,19 +85,18 @@ AcpiTbInitializeFacs ( AcpiGbl_FACS = NULL; return (AE_OK); } - - (void) AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS, - ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &AcpiGbl_Facs32)); - (void) AcpiGetTableByIndex (ACPI_TABLE_INDEX_X_FACS, - ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &AcpiGbl_Facs64)); - - if (AcpiGbl_Facs64 && (!AcpiGbl_Facs32 || !AcpiGbl_Use32BitFacsAddresses)) + else if (AcpiGbl_FADT.XFacs && + (!AcpiGbl_FADT.Facs || !AcpiGbl_Use32BitFacsAddresses)) { - AcpiGbl_FACS = AcpiGbl_Facs64; + (void) AcpiGetTableByIndex (AcpiGbl_XFacsIndex, + ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Facs)); + AcpiGbl_FACS = Facs; } - else if (AcpiGbl_Facs32) + else if (AcpiGbl_FADT.Facs) { - AcpiGbl_FACS = AcpiGbl_Facs32; + (void) AcpiGetTableByIndex (AcpiGbl_FacsIndex, + ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Facs)); + AcpiGbl_FACS = Facs; } /* If there is no FACS, just continue. There was already an error msg */ @@ -206,7 +207,7 @@ AcpiTbCopyDsdt ( AcpiTbUninstallTable (TableDesc); AcpiTbInitTableDescriptor ( - &AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT], + &AcpiGbl_RootTableList.Tables[AcpiGbl_DsdtIndex], ACPI_PTR_TO_PHYSADDR (NewTable), ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, NewTable); @@ -400,13 +401,6 @@ AcpiTbParseRootTable ( TableEntrySize); TableEntry = ACPI_ADD_PTR (UINT8, Table, sizeof (ACPI_TABLE_HEADER)); - /* - * First three entries in the table array are reserved for the DSDT - * and 32bit/64bit FACS, which are not actually present in the - * RSDT/XSDT - they come from the FADT - */ - AcpiGbl_RootTableList.CurrentTableCount = 3; - /* Initialize the root table array from the RSDT/XSDT */ for (i = 0; i < TableCount; i++) @@ -441,3 +435,43 @@ NextTable: return_ACPI_STATUS (AE_OK); } + + +/******************************************************************************* + * + * FUNCTION: AcpiIsValidSignature + * + * PARAMETERS: Signature - Sig string to be validated + * + * RETURN: TRUE if signature is correct length and has valid characters + * + * DESCRIPTION: Validate an ACPI table signature. + * + ******************************************************************************/ + +BOOLEAN +AcpiIsValidSignature ( + char *Signature) +{ + UINT32 i; + + + /* Validate the signature length */ + + if (strlen (Signature) != ACPI_NAME_SIZE) + { + return (FALSE); + } + + /* Validate each character in the signature */ + + for (i = 0; i < ACPI_NAME_SIZE; i++) + { + if (!AcpiUtValidAcpiChar (Signature[i], i)) + { + return (FALSE); + } + } + + return (TRUE); +} diff --git a/sys/contrib/dev/acpica/components/tables/tbxfload.c b/sys/contrib/dev/acpica/components/tables/tbxfload.c index 014d68b..52abb84 100644 --- a/sys/contrib/dev/acpica/components/tables/tbxfload.c +++ b/sys/contrib/dev/acpica/components/tables/tbxfload.c @@ -51,12 +51,6 @@ #define _COMPONENT ACPI_TABLES ACPI_MODULE_NAME ("tbxfload") -/* Local prototypes */ - -static ACPI_STATUS -AcpiTbLoadNamespace ( - void); - /******************************************************************************* * @@ -83,6 +77,14 @@ AcpiLoadTables ( /* Load the namespace from the tables */ Status = AcpiTbLoadNamespace (); + + /* Don't let single failures abort the load */ + + if (Status == AE_CTRL_TERMINATE) + { + Status = AE_OK; + } + if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, @@ -108,13 +110,16 @@ ACPI_EXPORT_SYMBOL_INIT (AcpiLoadTables) * ******************************************************************************/ -static ACPI_STATUS +ACPI_STATUS AcpiTbLoadNamespace ( void) { ACPI_STATUS Status; UINT32 i; ACPI_TABLE_HEADER *NewDsdt; + ACPI_TABLE_DESC *Table; + UINT32 TablesLoaded = 0; + UINT32 TablesFailed = 0; ACPI_FUNCTION_TRACE (TbLoadNamespace); @@ -126,12 +131,11 @@ AcpiTbLoadNamespace ( * Load the namespace. The DSDT is required, but any SSDT and * PSDT tables are optional. Verify the DSDT. */ + Table = &AcpiGbl_RootTableList.Tables[AcpiGbl_DsdtIndex]; + if (!AcpiGbl_RootTableList.CurrentTableCount || - !ACPI_COMPARE_NAME ( - &(AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Signature), - ACPI_SIG_DSDT) || - ACPI_FAILURE (AcpiTbValidateTable ( - &AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT]))) + !ACPI_COMPARE_NAME (Table->Signature.Ascii, ACPI_SIG_DSDT) || + ACPI_FAILURE (AcpiTbValidateTable (Table))) { Status = AE_NO_ACPI_TABLES; goto UnlockAndExit; @@ -143,7 +147,7 @@ AcpiTbLoadNamespace ( * array can change dynamically as tables are loaded at run-time. Note: * .Pointer field is not validated until after call to AcpiTbValidateTable. */ - AcpiGbl_DSDT = AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Pointer; + AcpiGbl_DSDT = Table->Pointer; /* * Optionally copy the entire DSDT to local memory (instead of simply @@ -153,7 +157,7 @@ AcpiTbLoadNamespace ( */ if (AcpiGbl_CopyDsdtLocally) { - NewDsdt = AcpiTbCopyDsdt (ACPI_TABLE_INDEX_DSDT); + NewDsdt = AcpiTbCopyDsdt (AcpiGbl_DsdtIndex); if (NewDsdt) { AcpiGbl_DSDT = NewDsdt; @@ -171,10 +175,15 @@ AcpiTbLoadNamespace ( /* Load and parse tables */ - Status = AcpiNsLoadTable (ACPI_TABLE_INDEX_DSDT, AcpiGbl_RootNode); + Status = AcpiNsLoadTable (AcpiGbl_DsdtIndex, AcpiGbl_RootNode); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + ACPI_EXCEPTION ((AE_INFO, Status, "[DSDT] table load failed")); + TablesFailed++; + } + else + { + TablesLoaded++; } /* Load any SSDT or PSDT tables. Note: Loop leaves tables locked */ @@ -182,15 +191,13 @@ AcpiTbLoadNamespace ( (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i) { + Table = &AcpiGbl_RootTableList.Tables[i]; + if (!AcpiGbl_RootTableList.Tables[i].Address || - (!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), - ACPI_SIG_SSDT) && - !ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), - ACPI_SIG_PSDT) && - !ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), - ACPI_SIG_OSDT)) || - ACPI_FAILURE (AcpiTbValidateTable ( - &AcpiGbl_RootTableList.Tables[i]))) + (!ACPI_COMPARE_NAME (Table->Signature.Ascii, ACPI_SIG_SSDT) && + !ACPI_COMPARE_NAME (Table->Signature.Ascii, ACPI_SIG_PSDT) && + !ACPI_COMPARE_NAME (Table->Signature.Ascii, ACPI_SIG_OSDT)) || + ACPI_FAILURE (AcpiTbValidateTable (Table))) { continue; } @@ -198,11 +205,41 @@ AcpiTbLoadNamespace ( /* Ignore errors while loading tables, get as many as possible */ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - (void) AcpiNsLoadTable (i, AcpiGbl_RootNode); + Status = AcpiNsLoadTable (i, AcpiGbl_RootNode); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, "(%4.4s:%8.8s) while loading table", + Table->Signature.Ascii, Table->Pointer->OemTableId)); + TablesFailed++; + + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, + "Table [%4.4s:%8.8s] (id FF) - Table namespace load failed\n\n", + Table->Signature.Ascii, Table->Pointer->OemTableId)); + } + else + { + TablesLoaded++; + } + (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); } - ACPI_INFO ((AE_INFO, "All ACPI Tables successfully acquired")); + if (!TablesFailed) + { + ACPI_INFO ((AE_INFO, + "%u ACPI AML tables successfully acquired and loaded", + TablesLoaded)); + } + else + { + ACPI_ERROR ((AE_INFO, + "%u table load failures, %u successful", + TablesFailed, TablesLoaded)); + + /* Indicate at least one failure */ + + Status = AE_CTRL_TERMINATE; + } UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); diff --git a/sys/contrib/dev/acpica/components/utilities/utfileio.c b/sys/contrib/dev/acpica/components/utilities/utfileio.c index 15cb3d0..a0075ad 100644 --- a/sys/contrib/dev/acpica/components/utilities/utfileio.c +++ b/sys/contrib/dev/acpica/components/utilities/utfileio.c @@ -341,7 +341,8 @@ AcpiUtReadTableFromFile ( /* Get the entire file */ - fprintf (stderr, "Reading ACPI table from file %10s - Length %.8u (0x%06X)\n", + fprintf (stderr, + "Reading ACPI table from file %12s - Length %.8u (0x%06X)\n", Filename, FileSize, FileSize); Status = AcpiUtReadTable (File, Table, &TableLength); diff --git a/sys/contrib/dev/acpica/components/utilities/utinit.c b/sys/contrib/dev/acpica/components/utilities/utinit.c index ee2851c..ea96178 100644 --- a/sys/contrib/dev/acpica/components/utilities/utinit.c +++ b/sys/contrib/dev/acpica/components/utilities/utinit.c @@ -227,6 +227,7 @@ AcpiUtInitGlobals ( AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING; AcpiGbl_OsiMutex = NULL; AcpiGbl_RegMethodsExecuted = FALSE; + AcpiGbl_MaxLoopIterations = 0xFFFF; /* Hardware oriented */ diff --git a/sys/contrib/dev/acpica/components/utilities/utmisc.c b/sys/contrib/dev/acpica/components/utilities/utmisc.c index 912949f..47f3717 100644 --- a/sys/contrib/dev/acpica/components/utilities/utmisc.c +++ b/sys/contrib/dev/acpica/components/utilities/utmisc.c @@ -84,7 +84,7 @@ AcpiUtIsPciRootBridge ( } -#if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP) +#if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP || defined ACPI_NAMES_APP) /******************************************************************************* * * FUNCTION: AcpiUtIsAmlTable @@ -418,7 +418,7 @@ AcpiUtDisplayInitPathname ( /* Get the full pathname to the node */ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, FALSE); + Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, TRUE); if (ACPI_FAILURE (Status)) { return; diff --git a/sys/contrib/dev/acpica/components/utilities/utnonansi.c b/sys/contrib/dev/acpica/components/utilities/utnonansi.c index 4ba96a1..7bd6997 100644 --- a/sys/contrib/dev/acpica/components/utilities/utnonansi.c +++ b/sys/contrib/dev/acpica/components/utilities/utnonansi.c @@ -380,7 +380,7 @@ ErrorExit: #if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) /******************************************************************************* * - * FUNCTION: AcpiUtSafeStrcpy, AcpiUtSafeStrcat, AcpiUtSafeStrncat + * FUNCTION: AcpiUtSafeStrcpy, AcpiUtSafeStrcat * * PARAMETERS: Adds a "DestSize" parameter to each of the standard string * functions. This is the size of the Destination buffer. @@ -429,27 +429,4 @@ AcpiUtSafeStrcat ( strcat (Dest, Source); return (FALSE); } - -#ifndef _KERNEL -BOOLEAN -AcpiUtSafeStrncat ( - char *Dest, - ACPI_SIZE DestSize, - char *Source, - ACPI_SIZE MaxTransferLength) -{ - ACPI_SIZE ActualTransferLength; - - - ActualTransferLength = ACPI_MIN (MaxTransferLength, strlen (Source)); - - if ((strlen (Dest) + ActualTransferLength) >= DestSize) - { - return (TRUE); - } - - strncat (Dest, Source, MaxTransferLength); - return (FALSE); -} -#endif #endif diff --git a/sys/contrib/dev/acpica/components/utilities/utxface.c b/sys/contrib/dev/acpica/components/utilities/utxface.c index eb311ec..c3fc066 100644 --- a/sys/contrib/dev/acpica/components/utilities/utxface.c +++ b/sys/contrib/dev/acpica/components/utilities/utxface.c @@ -99,14 +99,6 @@ AcpiTerminate ( AcpiUtMutexTerminate (); - -#ifdef ACPI_DEBUGGER - - /* Shut down the debugger */ - - AcpiDbTerminate (); -#endif - /* Now we can shutdown the OS-dependent layer */ Status = AcpiOsTerminate (); @@ -604,7 +596,7 @@ AcpiDecodePldBuffer ( /* Parameter validation */ - if (!InBuffer || !ReturnBuffer || (Length < 16)) + if (!InBuffer || !ReturnBuffer || (Length < ACPI_PLD_REV1_BUFFER_SIZE)) { return (AE_BAD_PARAMETER); } @@ -656,7 +648,7 @@ AcpiDecodePldBuffer ( PldInfo->Rotation = ACPI_PLD_GET_ROTATION (&Dword); PldInfo->Order = ACPI_PLD_GET_ORDER (&Dword); - if (Length >= ACPI_PLD_BUFFER_SIZE) + if (Length >= ACPI_PLD_REV2_BUFFER_SIZE) { /* Fifth 32-bit DWord (Revision 2 of _PLD) */ diff --git a/sys/contrib/dev/acpica/components/utilities/utxfinit.c b/sys/contrib/dev/acpica/components/utilities/utxfinit.c index 04cd24f..afeacdd 100644 --- a/sys/contrib/dev/acpica/components/utilities/utxfinit.c +++ b/sys/contrib/dev/acpica/components/utilities/utxfinit.c @@ -132,17 +132,6 @@ AcpiInitializeSubsystem ( return_ACPI_STATUS (Status); } - /* If configured, initialize the AML debugger */ - -#ifdef ACPI_DEBUGGER - Status = AcpiDbInitialize (); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, "During Debugger initialization")); - return_ACPI_STATUS (Status); - } -#endif - return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/include/acbuffer.h b/sys/contrib/dev/acpica/include/acbuffer.h index 37f4170..e52bc7d 100644 --- a/sys/contrib/dev/acpica/include/acbuffer.h +++ b/sys/contrib/dev/acpica/include/acbuffer.h @@ -157,6 +157,7 @@ typedef struct acpi_pld_info * (Intended for BIOS use only) */ #define ACPI_PLD_REV1_BUFFER_SIZE 16 /* For Revision 1 of the buffer (From ACPI spec) */ +#define ACPI_PLD_REV2_BUFFER_SIZE 20 /* For Revision 2 of the buffer (From ACPI spec) */ #define ACPI_PLD_BUFFER_SIZE 20 /* For Revision 2 of the buffer (From ACPI spec) */ /* First 32-bit dword, bits 0:32 */ diff --git a/sys/contrib/dev/acpica/include/acconfig.h b/sys/contrib/dev/acpica/include/acconfig.h index 46dbc31..8441551 100644 --- a/sys/contrib/dev/acpica/include/acconfig.h +++ b/sys/contrib/dev/acpica/include/acconfig.h @@ -138,10 +138,6 @@ #define ACPI_ROOT_TABLE_SIZE_INCREMENT 4 -/* Maximum number of While() loop iterations before forced abort */ - -#define ACPI_MAX_LOOP_ITERATIONS 0xFFFF - /* Maximum sleep allowed via Sleep() operator */ #define ACPI_MAX_SLEEP 2000 /* 2000 millisec == two seconds */ diff --git a/sys/contrib/dev/acpica/include/acdebug.h b/sys/contrib/dev/acpica/include/acdebug.h index 8b6ac89..cf989a8 100644 --- a/sys/contrib/dev/acpica/include/acdebug.h +++ b/sys/contrib/dev/acpica/include/acdebug.h @@ -44,6 +44,12 @@ #ifndef __ACDEBUG_H__ #define __ACDEBUG_H__ +/* The debugger is used in conjunction with the disassembler most of time */ + +#ifdef ACPI_DISASSEMBLER +#include <contrib/dev/acpica/include/acdisasm.h> +#endif + #define ACPI_DEBUG_BUFFER_SIZE 0x4000 /* 16K buffer for return objects */ @@ -77,9 +83,6 @@ typedef struct acpi_db_execute_walk #define PARAM_LIST(pl) pl -#define DBTEST_OUTPUT_LEVEL(lvl) if (AcpiGbl_DbOpt_Verbose) -#define VERBOSE_PRINT(fp) DBTEST_OUTPUT_LEVEL(lvl) {\ - AcpiOsPrintf PARAM_LIST(fp);} #define EX_NO_SINGLE_STEP 1 #define EX_SINGLE_STEP 2 @@ -89,14 +92,6 @@ typedef struct acpi_db_execute_walk * dbxface - external debugger interfaces */ ACPI_STATUS -AcpiDbInitialize ( - void); - -void -AcpiDbTerminate ( - void); - -ACPI_STATUS AcpiDbSingleStep ( ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, diff --git a/sys/contrib/dev/acpica/include/acdisasm.h b/sys/contrib/dev/acpica/include/acdisasm.h index e7c2814e..5bfe881 100644 --- a/sys/contrib/dev/acpica/include/acdisasm.h +++ b/sys/contrib/dev/acpica/include/acdisasm.h @@ -186,13 +186,16 @@ typedef struct acpi_dmtable_data typedef struct acpi_op_walk_info { + ACPI_WALK_STATE *WalkState; + ACPI_PARSE_OBJECT *MappingOp; + UINT8 *PreviousAml; + UINT8 *StartAml; UINT32 Level; UINT32 LastLevel; UINT32 Count; UINT32 BitOffset; UINT32 Flags; - ACPI_WALK_STATE *WalkState; - ACPI_PARSE_OBJECT *MappingOp; + UINT32 AmlOffset; } ACPI_OP_WALK_INFO; diff --git a/sys/contrib/dev/acpica/include/acexcep.h b/sys/contrib/dev/acpica/include/acexcep.h index 7a3fdcb..714e3b1 100644 --- a/sys/contrib/dev/acpica/include/acexcep.h +++ b/sys/contrib/dev/acpica/include/acexcep.h @@ -197,8 +197,9 @@ typedef struct acpi_exception_info #define AE_AML_BAD_RESOURCE_LENGTH EXCEP_AML (0x001F) #define AE_AML_ILLEGAL_ADDRESS EXCEP_AML (0x0020) #define AE_AML_INFINITE_LOOP EXCEP_AML (0x0021) +#define AE_AML_UNINITIALIZED_NODE EXCEP_AML (0x0022) -#define AE_CODE_AML_MAX 0x0021 +#define AE_CODE_AML_MAX 0x0022 /* @@ -322,7 +323,8 @@ static const ACPI_EXCEPTION_INFO AcpiGbl_ExceptionNames_Aml[] = EXCEP_TXT ("AE_AML_CIRCULAR_REFERENCE", "Two references refer to each other"), EXCEP_TXT ("AE_AML_BAD_RESOURCE_LENGTH", "The length of a Resource Descriptor in the AML is incorrect"), EXCEP_TXT ("AE_AML_ILLEGAL_ADDRESS", "A memory, I/O, or PCI configuration address is invalid"), - EXCEP_TXT ("AE_AML_INFINITE_LOOP", "An apparent infinite AML While loop, method was aborted") + EXCEP_TXT ("AE_AML_INFINITE_LOOP", "An apparent infinite AML While loop, method was aborted"), + EXCEP_TXT ("AE_AML_UNINITIALIZED_NODE", "A namespace node is uninitialized or unresolved") }; static const ACPI_EXCEPTION_INFO AcpiGbl_ExceptionNames_Ctrl[] = diff --git a/sys/contrib/dev/acpica/include/acglobal.h b/sys/contrib/dev/acpica/include/acglobal.h index eaa364d..08d60fd 100644 --- a/sys/contrib/dev/acpica/include/acglobal.h +++ b/sys/contrib/dev/acpica/include/acglobal.h @@ -59,11 +59,12 @@ ACPI_GLOBAL (ACPI_TABLE_LIST, AcpiGbl_RootTableList); ACPI_GLOBAL (ACPI_TABLE_HEADER *, AcpiGbl_DSDT); ACPI_GLOBAL (ACPI_TABLE_HEADER, AcpiGbl_OriginalDsdtHeader); +ACPI_INIT_GLOBAL (UINT32, AcpiGbl_DsdtIndex, ACPI_INVALID_TABLE_INDEX); +ACPI_INIT_GLOBAL (UINT32, AcpiGbl_FacsIndex, ACPI_INVALID_TABLE_INDEX); +ACPI_INIT_GLOBAL (UINT32, AcpiGbl_XFacsIndex, ACPI_INVALID_TABLE_INDEX); #if (!ACPI_REDUCED_HARDWARE) ACPI_GLOBAL (ACPI_TABLE_FACS *, AcpiGbl_FACS); -ACPI_GLOBAL (ACPI_TABLE_FACS *, AcpiGbl_Facs32); -ACPI_GLOBAL (ACPI_TABLE_FACS *, AcpiGbl_Facs64); #endif /* !ACPI_REDUCED_HARDWARE */ @@ -240,6 +241,10 @@ ACPI_INIT_GLOBAL (UINT32, AcpiGbl_NestingLevel, 0); ACPI_GLOBAL (ACPI_THREAD_STATE *, AcpiGbl_CurrentWalkList); +/* Maximum number of While() loop iterations before forced abort */ + +ACPI_GLOBAL (UINT16, AcpiGbl_MaxLoopIterations); + /* Control method single step flag */ ACPI_GLOBAL (UINT8, AcpiGbl_CmSingleStep); @@ -311,10 +316,10 @@ ACPI_INIT_GLOBAL (UINT8, AcpiGbl_NoResourceDisassembly, FALSE); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_IgnoreNoopOperator, FALSE); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_CstyleDisassembly, TRUE); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_ForceAmlDisassembly, FALSE); -ACPI_INIT_GLOBAL (ACPI_PARSE_OBJECT *, AcpiGbl_PreviousOp, NULL); +ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DmOpt_Verbose, TRUE); -ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_Disasm); -ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_Verbose); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_DmOpt_Disasm); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_DmOpt_Listing); ACPI_GLOBAL (BOOLEAN, AcpiGbl_NumExternalMethods); ACPI_GLOBAL (UINT32, AcpiGbl_ResolvedExternalMethods); ACPI_GLOBAL (ACPI_EXTERNAL_LIST *, AcpiGbl_ExternalList); @@ -349,8 +354,8 @@ ACPI_GLOBAL (char, AcpiGbl_DbDebugFilename[ACPI_DB_LINE_BUF /* * Statistic globals */ -ACPI_GLOBAL (UINT16, AcpiGbl_ObjTypeCount[ACPI_TYPE_NS_NODE_MAX+1]); -ACPI_GLOBAL (UINT16, AcpiGbl_NodeTypeCount[ACPI_TYPE_NS_NODE_MAX+1]); +ACPI_GLOBAL (UINT16, AcpiGbl_ObjTypeCount[ACPI_TOTAL_TYPES]); +ACPI_GLOBAL (UINT16, AcpiGbl_NodeTypeCount[ACPI_TOTAL_TYPES]); ACPI_GLOBAL (UINT16, AcpiGbl_ObjTypeCountMisc); ACPI_GLOBAL (UINT16, AcpiGbl_NodeTypeCountMisc); ACPI_GLOBAL (UINT32, AcpiGbl_NumNodes); diff --git a/sys/contrib/dev/acpica/include/aclocal.h b/sys/contrib/dev/acpica/include/aclocal.h index 7f62cc8..ea3d219 100644 --- a/sys/contrib/dev/acpica/include/aclocal.h +++ b/sys/contrib/dev/acpica/include/aclocal.h @@ -238,11 +238,9 @@ typedef struct acpi_table_list #define ACPI_ROOT_ALLOW_RESIZE (2) -/* Predefined (fixed) table indexes */ +/* Predefined table indexes */ -#define ACPI_TABLE_INDEX_DSDT (0) -#define ACPI_TABLE_INDEX_FACS (1) -#define ACPI_TABLE_INDEX_X_FACS (2) +#define ACPI_INVALID_TABLE_INDEX (0xFFFFFFFF) typedef struct acpi_find_context @@ -465,6 +463,16 @@ typedef struct acpi_simple_repair_info #define ACPI_NUM_RTYPES 5 /* Number of actual object types */ +/* Info for running the _REG methods */ + +typedef struct acpi_reg_walk_info +{ + ACPI_ADR_SPACE_TYPE SpaceId; + UINT32 RegRunCount; + +} ACPI_REG_WALK_INFO; + + /***************************************************************************** * * Event typedefs and structs @@ -1319,6 +1327,13 @@ typedef struct acpi_integrity_info #define ACPI_DB_DUPLICATE_OUTPUT 0x03 +typedef struct acpi_object_info +{ + UINT32 Types[ACPI_TOTAL_TYPES]; + +} ACPI_OBJECT_INFO; + + /***************************************************************************** * * Debug diff --git a/sys/contrib/dev/acpica/include/acpixf.h b/sys/contrib/dev/acpica/include/acpixf.h index 9796379..ca7c905 100644 --- a/sys/contrib/dev/acpica/include/acpixf.h +++ b/sys/contrib/dev/acpica/include/acpixf.h @@ -46,7 +46,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20150717 +#define ACPI_CA_VERSION 0x20150818 #include <contrib/dev/acpica/include/acconfig.h> #include <contrib/dev/acpica/include/actypes.h> @@ -1208,4 +1208,12 @@ AcpiLogError ( const char *Format, ...)) +ACPI_STATUS +AcpiInitializeDebugger ( + void); + +void +AcpiTerminateDebugger ( + void); + #endif /* __ACXFACE_H__ */ diff --git a/sys/contrib/dev/acpica/include/actables.h b/sys/contrib/dev/acpica/include/actables.h index 3eb02d3..0f8fdd5 100644 --- a/sys/contrib/dev/acpica/include/actables.h +++ b/sys/contrib/dev/acpica/include/actables.h @@ -236,18 +236,30 @@ AcpiTbCopyDsdt ( void AcpiTbInstallTableWithOverride ( - UINT32 TableIndex, ACPI_TABLE_DESC *NewTableDesc, - BOOLEAN Override); + BOOLEAN Override, + UINT32 *TableIndex); ACPI_STATUS AcpiTbInstallFixedTable ( ACPI_PHYSICAL_ADDRESS Address, char *Signature, - UINT32 TableIndex); + UINT32 *TableIndex); ACPI_STATUS AcpiTbParseRootTable ( ACPI_PHYSICAL_ADDRESS RsdpAddress); +BOOLEAN +AcpiIsValidSignature ( + char *Signature); + + +/* + * tbxfload + */ +ACPI_STATUS +AcpiTbLoadNamespace ( + void); + #endif /* __ACTABLES_H__ */ diff --git a/sys/contrib/dev/acpica/include/actypes.h b/sys/contrib/dev/acpica/include/actypes.h index dbc8e3a..cbae6f0 100644 --- a/sys/contrib/dev/acpica/include/actypes.h +++ b/sys/contrib/dev/acpica/include/actypes.h @@ -674,6 +674,7 @@ typedef UINT32 ACPI_OBJECT_TYPE; #define ACPI_TYPE_DEBUG_OBJECT 0x10 #define ACPI_TYPE_EXTERNAL_MAX 0x10 +#define ACPI_NUM_TYPES (ACPI_TYPE_EXTERNAL_MAX + 1) /* * These are object types that do not map directly to the ACPI @@ -695,6 +696,7 @@ typedef UINT32 ACPI_OBJECT_TYPE; #define ACPI_TYPE_LOCAL_SCOPE 0x1B /* 1 Name, multiple ObjectList Nodes */ #define ACPI_TYPE_NS_NODE_MAX 0x1B /* Last typecode used within a NS Node */ +#define ACPI_TOTAL_TYPES (ACPI_TYPE_NS_NODE_MAX + 1) /* * These are special object types that never appear in diff --git a/sys/contrib/dev/acpica/include/acutils.h b/sys/contrib/dev/acpica/include/acutils.h index a2bcf2f..1cbaf6a 100644 --- a/sys/contrib/dev/acpica/include/acutils.h +++ b/sys/contrib/dev/acpica/include/acutils.h @@ -742,7 +742,7 @@ BOOLEAN AcpiUtIsPciRootBridge ( char *Id); -#if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP) +#if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP || defined ACPI_NAMES_APP) BOOLEAN AcpiUtIsAmlTable ( ACPI_TABLE_HEADER *Table); @@ -867,15 +867,6 @@ AcpiUtSafeStrcat ( char *Dest, ACPI_SIZE DestSize, char *Source); - -#ifndef _KERNEL -BOOLEAN -AcpiUtSafeStrncat ( - char *Dest, - ACPI_SIZE DestSize, - char *Source, - ACPI_SIZE MaxTransferLength); -#endif #endif diff --git a/sys/contrib/dev/acpica/include/platform/acenv.h b/sys/contrib/dev/acpica/include/platform/acenv.h index 90ace88..b5a12e5 100644 --- a/sys/contrib/dev/acpica/include/platform/acenv.h +++ b/sys/contrib/dev/acpica/include/platform/acenv.h @@ -71,13 +71,14 @@ #ifdef ACPI_ASL_COMPILER #define ACPI_APPLICATION -#define ACPI_DISASSEMBLER #define ACPI_DEBUG_OUTPUT #define ACPI_CONSTANT_EVAL_ONLY #define ACPI_LARGE_NAMESPACE_NODE #define ACPI_DATA_TABLE_DISASSEMBLY #define ACPI_SINGLE_THREADED #define ACPI_32BIT_PHYSICAL_ADDRESS + +#define ACPI_DISASSEMBLER 1 #endif /* AcpiExec configuration. Multithreaded with full AML debugger */ @@ -90,8 +91,8 @@ #endif /* - * AcpiBin/AcpiDump/AcpiHelp/AcpiNames/AcpiSrc/AcpiXtract/Example configuration. - * All single threaded. + * AcpiBin/AcpiDump/AcpiHelp/AcpiNames/AcpiSrc/AcpiXtract/Example + * configuration. All single threaded. */ #if (defined ACPI_BIN_APP) || \ (defined ACPI_DUMP_APP) || \ @@ -124,7 +125,7 @@ #define ACPI_USE_NATIVE_RSDP_POINTER #endif -/* AcpiDump configuration. Native mapping used if provied by OSPMs */ +/* AcpiDump configuration. Native mapping used if provided by the host */ #ifdef ACPI_DUMP_APP #define ACPI_USE_NATIVE_MEMORY_MAPPING @@ -142,6 +143,7 @@ #ifdef ACPI_LIBRARY #define ACPI_USE_LOCAL_CACHE +#define ACPI_FULL_DEBUG #endif /* Common for all ACPICA applications */ @@ -151,15 +153,14 @@ #define ACPI_USE_LOCAL_CACHE #endif -/* Common debug support */ +/* Common debug/disassembler support */ #ifdef ACPI_FULL_DEBUG -#define ACPI_DEBUGGER #define ACPI_DEBUG_OUTPUT -#define ACPI_DISASSEMBLER +#define ACPI_DEBUGGER 1 +#define ACPI_DISASSEMBLER 1 #endif - /*! [Begin] no source code translation */ /****************************************************************************** @@ -326,8 +327,8 @@ * ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and * the standard header files may be used. * - * The ACPICA subsystem only uses low level C library functions that do not call - * operating system services and may therefore be inlined in the code. + * The ACPICA subsystem only uses low level C library functions that do not + * call operating system services and may therefore be inlined in the code. * * It may be necessary to tailor these include files to the target * generation environment. diff --git a/sys/dev/acpica/Osd/OsdDebug.c b/sys/dev/acpica/Osd/OsdDebug.c index 0547f75..5664719 100644 --- a/sys/dev/acpica/Osd/OsdDebug.c +++ b/sys/dev/acpica/Osd/OsdDebug.c @@ -104,7 +104,7 @@ acpi_EnterDebugger(void) if (!initted) { printf("Initialising ACPICA debugger...\n"); - AcpiDbInitialize(); + AcpiInitializeDebugger(); initted = 1; } diff --git a/usr.sbin/acpi/acpidb/acpidb.c b/usr.sbin/acpi/acpidb/acpidb.c index b3d0021..6b71961 100644 --- a/usr.sbin/acpi/acpidb/acpidb.c +++ b/usr.sbin/acpi/acpidb/acpidb.c @@ -480,7 +480,7 @@ load_dsdt(const char *dsdtfile) AcpiDbGetTableFromFile(filetmp, NULL, TRUE); - AcpiDbInitialize(); + AcpiInitializeDebugger(); AcpiGbl_DebuggerConfiguration = 0; AcpiDbUserCommands(':', NULL); |