diff options
author | jkim <jkim@FreeBSD.org> | 2012-09-19 23:25:24 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2012-09-19 23:25:24 +0000 |
commit | 2851848add470d66b9b6966f9eb4c7d6698416a5 (patch) | |
tree | 12889f8250981e5573d1dfc5e18a7d7a6f54fbc7 /sys/contrib | |
parent | 56d694b07204b875d67b7772b1ecb02cbff8790e (diff) | |
download | FreeBSD-src-2851848add470d66b9b6966f9eb4c7d6698416a5.zip FreeBSD-src-2851848add470d66b9b6966f9eb4c7d6698416a5.tar.gz |
Merge ACPICA 20120913.
Diffstat (limited to 'sys/contrib')
30 files changed, 721 insertions, 278 deletions
diff --git a/sys/contrib/dev/acpica/changes.txt b/sys/contrib/dev/acpica/changes.txt index abe6a33..b2793f2 100644 --- a/sys/contrib/dev/acpica/changes.txt +++ b/sys/contrib/dev/acpica/changes.txt @@ -1,4 +1,75 @@ ---------------------------------------- +13 September 2012. Summary of changes for version 20120913: + +This release is available at https://www.acpica.org/downloads The ACPI 5.0 +specification is available at www.acpi.info + +1) ACPICA Kernel-resident Subsystem: + +ACPI 5.0: Added two new notify types for the Hardware Error Notification +Structure within the Hardware Error Source Table (HEST) table -- CMCI(5) and +MCE(6). + +Table Manager: Merged/removed duplicate code in the root table resize +functions. One function is external, the other is internal. Lv Zheng, ACPICA +BZ 846. + +Makefiles: Completely removed the obsolete "Linux" makefiles under +acpica/generate/linux. These makefiles are obsolete and have been replaced by +the generic unix makefiles under acpica/generate/unix. + +Makefiles: Ensure that binary files always copied properly. Minor rule change +to ensure that the final binary output files are always copied up to the +appropriate binary directory (bin32 or bin64.) + +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. + + Previous Release: + Non-Debug Version: 93.8K Code, 25.3K Data, 119.1K Total + Debug Version: 175.7K Code, 74.8K Data, 250.5K Total + Current Release: + Non-Debug Version: 93.7K Code, 25.3K Data, 119.0K Total + Debug Version: 175.0K Code, 74.4K Data, 249.4K Total + + +2) iASL Compiler/Disassembler and Tools: + +Disassembler: Fixed a possible fault during the disassembly of resource +descriptors when a second parse is required because of the invocation of +external control methods within the table. With assistance from +adq@lidskialf.net. ACPICA BZ 976. + +iASL: Fixed a namepath optimization problem. An error can occur if the parse +node that contains the namepath to be optimized does not have a parent node +that is a named object. This change fixes the problem. + +iASL: Fixed a regression where the AML file is not deleted on errors. The AML +output file should be deleted if there are any errors during the compiler. The +only exception is if the -f (force output) option is used. ACPICA BZ 974. + +iASL: Added a feature to automatically increase internal line buffer sizes. +Via realloc(), automatically increase the internal line buffer sizes as +necessary to support very long source code lines. The current version of the +preprocessor requires a buffer long enough to contain full source code lines. +This change increases the line buffer(s) if the input lines go beyond the +current buffer size. This eliminates errors that occurred when a source code +line was longer than the buffer. + +iASL: Fixed a problem with constant folding in method declarations. The +SyncLevel term is a ByteConstExpr, and incorrect code would be generated if a +Type3 opcode was used. + +Debugger: Improved command help support. For incorrect argument count, display +full help for the command. For help command itself, allow an argument to +specify a command. + +Test Suites: Several bug fixes for the ASLTS suite reduces the number of +errors during execution of the suite. Guan Chao. + +---------------------------------------- 16 August 2012. Summary of changes for version 20120816: This release is available at https://www.acpica.org/downloads diff --git a/sys/contrib/dev/acpica/common/dmrestag.c b/sys/contrib/dev/acpica/common/dmrestag.c index eaf412e..1168db0 100644 --- a/sys/contrib/dev/acpica/common/dmrestag.c +++ b/sys/contrib/dev/acpica/common/dmrestag.c @@ -469,6 +469,11 @@ AcpiDmCheckResourceReference ( /* Get the Index term, must be an integer constant to convert */ IndexOp = BufferNameOp->Common.Next; + + /* Major cheat: The Node field is also used for the Tag ptr. Clear it now */ + + IndexOp->Common.Node = NULL; + OpInfo = AcpiPsGetOpcodeInfo (IndexOp->Common.AmlOpcode); if (OpInfo->ObjectType != ACPI_TYPE_INTEGER) { diff --git a/sys/contrib/dev/acpica/compiler/aslcompile.c b/sys/contrib/dev/acpica/compiler/aslcompile.c index 36842cb..bec0ba3 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompile.c +++ b/sys/contrib/dev/acpica/compiler/aslcompile.c @@ -800,6 +800,7 @@ CmCleanupAndExit ( void) { UINT32 i; + BOOLEAN DeleteAmlFile = FALSE; AePrintErrorLog (ASL_FILE_STDERR); @@ -851,6 +852,16 @@ CmCleanupAndExit ( UtDisplaySummary (ASL_FILE_STDOUT); + /* + * We will delete the AML file if there are errors and the + * force AML output option has not been used. + */ + if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && (!Gbl_IgnoreErrors) && + Gbl_Files[ASL_FILE_AML_OUTPUT].Handle) + { + DeleteAmlFile = TRUE; + } + /* Close all open files */ Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; /* the .i file is same as source file */ @@ -862,29 +873,17 @@ CmCleanupAndExit ( /* Delete AML file if there are errors */ - if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && (!Gbl_IgnoreErrors) && - Gbl_Files[ASL_FILE_AML_OUTPUT].Handle) + if (DeleteAmlFile) { - if (remove (Gbl_Files[ASL_FILE_AML_OUTPUT].Filename)) - { - printf ("%s: ", - Gbl_Files[ASL_FILE_AML_OUTPUT].Filename); - perror ("Could not delete AML file"); - } + FlDeleteFile (ASL_FILE_AML_OUTPUT); } /* Delete the preprocessor output file (.i) unless -li flag is set */ if (!Gbl_PreprocessorOutputFlag && - Gbl_PreprocessFlag && - Gbl_Files[ASL_FILE_PREPROCESSOR].Filename) + Gbl_PreprocessFlag) { - if (remove (Gbl_Files[ASL_FILE_PREPROCESSOR].Filename)) - { - printf ("%s: ", - Gbl_Files[ASL_FILE_PREPROCESSOR].Filename); - perror ("Could not delete preprocessor .i file"); - } + FlDeleteFile (ASL_FILE_PREPROCESSOR); } /* @@ -901,14 +900,9 @@ CmCleanupAndExit ( * * TBD: SourceOutput should be .TMP, then rename if we want to keep it? */ - if (!Gbl_SourceOutputFlag && Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename) + if (!Gbl_SourceOutputFlag) { - if (remove (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename)) - { - printf ("%s: ", - Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); - perror ("Could not delete SRC file"); - } + FlDeleteFile (ASL_FILE_SOURCE_OUTPUT); } } diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.h b/sys/contrib/dev/acpica/compiler/aslcompiler.h index 15ede1d..960574d 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompiler.h +++ b/sys/contrib/dev/acpica/compiler/aslcompiler.h @@ -661,6 +661,10 @@ FlPrintFile ( ...); void +FlDeleteFile ( + UINT32 FileId); + +void FlSetLineNumber ( UINT32 LineNumber); @@ -779,6 +783,10 @@ char * UtGetStringBuffer ( UINT32 Length); +void +UtExpandLineBuffers ( + void); + ACPI_STATUS UtInternalizeName ( char *ExternalName, diff --git a/sys/contrib/dev/acpica/compiler/aslerror.c b/sys/contrib/dev/acpica/compiler/aslerror.c index 6d858d8..ae222ff 100644 --- a/sys/contrib/dev/acpica/compiler/aslerror.c +++ b/sys/contrib/dev/acpica/compiler/aslerror.c @@ -183,6 +183,7 @@ AePrintException ( FILE *SourceFile = NULL; long FileSize; BOOLEAN PrematureEOF = FALSE; + UINT32 Total = 0; if (Gbl_NoErrors) @@ -300,11 +301,21 @@ AePrintException ( "[*** iASL: Read error on source code temp file %s ***]", Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); } - - else while (RActual && SourceByte && (SourceByte != '\n')) + else { - fwrite (&SourceByte, 1, 1, OutputFile); - RActual = fread (&SourceByte, 1, 1, SourceFile); + while (RActual && SourceByte && (SourceByte != '\n') && (Total < 256)) + { + fwrite (&SourceByte, 1, 1, OutputFile); + RActual = fread (&SourceByte, 1, 1, SourceFile); + Total++; + } + + if (Total >= 256) + { + fprintf (OutputFile, + "\n[*** iASL: Long input line, an error occurred at column %u ***]", + Enode->Column); + } } } } @@ -381,20 +392,28 @@ AePrintException ( if (Gbl_VerboseErrors && !PrematureEOF) { - SourceColumn = Enode->Column + Enode->FilenameLength + 6 + 2; - ErrorColumn = ASL_ERROR_LEVEL_LENGTH + 5 + 2 + 1; - - if ((MsgLength + ErrorColumn) < (SourceColumn - 1)) + if (Total >= 256) { - fprintf (OutputFile, "%*s%s", - (int) ((SourceColumn - 1) - ErrorColumn), - MainMessage, " ^ "); + fprintf (OutputFile, " %s", + MainMessage); } else { - fprintf (OutputFile, "%*s %s", - (int) ((SourceColumn - ErrorColumn) + 1), "^", - MainMessage); + SourceColumn = Enode->Column + Enode->FilenameLength + 6 + 2; + ErrorColumn = ASL_ERROR_LEVEL_LENGTH + 5 + 2 + 1; + + if ((MsgLength + ErrorColumn) < (SourceColumn - 1)) + { + fprintf (OutputFile, "%*s%s", + (int) ((SourceColumn - 1) - ErrorColumn), + MainMessage, " ^ "); + } + else + { + fprintf (OutputFile, "%*s %s", + (int) ((SourceColumn - ErrorColumn) + 1), "^", + MainMessage); + } } } else diff --git a/sys/contrib/dev/acpica/compiler/aslfiles.c b/sys/contrib/dev/acpica/compiler/aslfiles.c index dfcbf90..d94fc87 100644 --- a/sys/contrib/dev/acpica/compiler/aslfiles.c +++ b/sys/contrib/dev/acpica/compiler/aslfiles.c @@ -63,6 +63,7 @@ FlParseInputPathname ( #endif + /******************************************************************************* * * FUNCTION: AslAbort @@ -376,6 +377,42 @@ FlCloseFile ( /******************************************************************************* * + * FUNCTION: FlDeleteFile + * + * PARAMETERS: FileId - Index into file info array + * + * RETURN: None + * + * DESCRIPTION: Delete a file. + * + ******************************************************************************/ + +void +FlDeleteFile ( + UINT32 FileId) +{ + ASL_FILE_INFO *Info = &Gbl_Files[FileId]; + + + if (!Info->Filename) + { + return; + } + + if (remove (Info->Filename)) + { + printf ("%s (%s file) ", + Info->Filename, Info->Description); + perror ("Could not delete"); + } + + Info->Filename = NULL; + return; +} + + +/******************************************************************************* + * * FUNCTION: FlSetLineNumber * * PARAMETERS: Op - Parse node for the LINE asl statement diff --git a/sys/contrib/dev/acpica/compiler/aslfold.c b/sys/contrib/dev/acpica/compiler/aslfold.c index 888a94a..9f84262 100644 --- a/sys/contrib/dev/acpica/compiler/aslfold.c +++ b/sys/contrib/dev/acpica/compiler/aslfold.c @@ -200,6 +200,19 @@ OpcAmlCheckForConstant ( DbgPrint (ASL_PARSE_OUTPUT, "[%.4d] Opcode: %12.12s ", Op->Asl.LogicalLineNumber, Op->Asl.ParseOpName); + /* + * These opcodes do not appear in the OpcodeInfo table, but + * they represent constants, so abort the constant walk now. + */ + if ((WalkState->Opcode == AML_RAW_DATA_BYTE) || + (WalkState->Opcode == AML_RAW_DATA_WORD) || + (WalkState->Opcode == AML_RAW_DATA_DWORD) || + (WalkState->Opcode == AML_RAW_DATA_QWORD)) + { + WalkState->WalkType = ACPI_WALK_CONST_OPTIONAL; + return (AE_TYPE); + } + if (!(WalkState->OpInfo->Flags & AML_CONSTANT)) { /* The opcode is not a Type 3/4/5 opcode */ @@ -254,8 +267,8 @@ OpcAmlCheckForConstant ( { DbgPrint (ASL_PARSE_OUTPUT, " TERMARG"); } - DbgPrint (ASL_PARSE_OUTPUT, "\n"); + DbgPrint (ASL_PARSE_OUTPUT, "\n"); return (AE_OK); } diff --git a/sys/contrib/dev/acpica/compiler/aslglobal.h b/sys/contrib/dev/acpica/compiler/aslglobal.h index 64cb76b..0451fec 100644 --- a/sys/contrib/dev/acpica/compiler/aslglobal.h +++ b/sys/contrib/dev/acpica/compiler/aslglobal.h @@ -63,6 +63,41 @@ #endif +#ifdef _DECLARE_GLOBALS +UINT32 Gbl_ExceptionCount[ASL_NUM_REPORT_LEVELS] = {0,0,0,0,0,0}; +char AslHexLookup[] = +{ + '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' +}; + + +/* Table below must match ASL_FILE_TYPES in asltypes.h */ + +ASL_FILE_INFO Gbl_Files [ASL_NUM_FILES] = +{ + {NULL, NULL, "stdout: ", "Standard Output"}, + {NULL, NULL, "stderr: ", "Standard Error"}, + {NULL, NULL, "Table Input: ", "Source Input"}, + {NULL, NULL, "Binary Output:", "AML Output"}, + {NULL, NULL, "Source Output:", "Source Output"}, + {NULL, NULL, "Preprocessor: ", "Preprocessor Output"}, + {NULL, NULL, "Listing File: ", "Listing Output"}, + {NULL, NULL, "Hex Dump: ", "Hex Table Output"}, + {NULL, NULL, "Namespace: ", "Namespace Output"}, + {NULL, NULL, "Debug File: ", "Debug Output"}, + {NULL, NULL, "ASM Source: ", "Assembly Code Output"}, + {NULL, NULL, "C Source: ", "C Code Output"}, + {NULL, NULL, "ASM Include: ", "Assembly Header Output"}, + {NULL, NULL, "C Include: ", "C Header Output"} +}; + +#else +extern UINT32 Gbl_ExceptionCount[ASL_NUM_REPORT_LEVELS]; +extern char AslHexLookup[]; +extern ASL_FILE_INFO Gbl_Files [ASL_NUM_FILES]; +#endif + + /* * Parser and other externals */ @@ -74,21 +109,22 @@ extern int PrParserdebug; extern const ASL_MAPPING_ENTRY AslKeywordMapping[]; extern char *AslCompilertext; -#define ASL_LINE_BUFFER_SIZE (4096 * 4) /* 16K */ -#define ASL_MSG_BUFFER_SIZE 4096 -#define HEX_TABLE_LINE_SIZE 8 -#define HEX_LISTING_LINE_SIZE 8 +#define ASL_DEFAULT_LINE_BUFFER_SIZE (1024 * 32) /* 32K */ +#define ASL_MSG_BUFFER_SIZE 4096 +#define HEX_TABLE_LINE_SIZE 8 +#define HEX_LISTING_LINE_SIZE 8 /* Source code buffers and pointers for error reporting */ -ASL_EXTERN char Gbl_CurrentLineBuffer[ASL_LINE_BUFFER_SIZE]; +ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_CurrentLineBuffer, NULL); +ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_LineBufPtr, NULL); +ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_LineBufferSize, ASL_DEFAULT_LINE_BUFFER_SIZE); ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentColumn, 0); ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_PreviousLineNumber, 0); ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLineNumber, 1); ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_LogicalLineNumber, 1); ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLineOffset, 0); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_LineBufPtr, Gbl_CurrentLineBuffer); /* Exception reporting */ @@ -135,18 +171,16 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoTemplates, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CompileGeneric, FALSE); -#define HEX_OUTPUT_NONE 0 -#define HEX_OUTPUT_C 1 -#define HEX_OUTPUT_ASM 2 -#define HEX_OUTPUT_ASL 3 +#define HEX_OUTPUT_NONE 0 +#define HEX_OUTPUT_C 1 +#define HEX_OUTPUT_ASM 2 +#define HEX_OUTPUT_ASL 3 ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HexOutputFlag, HEX_OUTPUT_NONE); /* Files */ -ASL_EXTERN ASL_FILE_INFO Gbl_Files [ASL_NUM_FILES]; - ASL_EXTERN char *Gbl_DirectoryPath; ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_IncludeFilename, NULL); ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_OutputFilenamePrefix, NULL); @@ -203,7 +237,6 @@ ASL_EXTERN FILE *AcpiGbl_DebugFile; /* Placeholder for oswin ASL_EXTERN ASL_ANALYSIS_WALK_INFO AnalysisWalkInfo; ASL_EXTERN ACPI_TABLE_HEADER TableHeader; -extern char AslHexLookup[]; /* Event timing */ @@ -220,11 +253,5 @@ ASL_EXTERN char StringBuffer[ASL_MSG_BUFFER_SIZE]; ASL_EXTERN char StringBuffer2[ASL_MSG_BUFFER_SIZE]; -#ifdef _DECLARE_GLOBALS -UINT32 Gbl_ExceptionCount[ASL_NUM_REPORT_LEVELS] = {0,0,0,0,0,0}; -#else -extern UINT32 Gbl_ExceptionCount[ASL_NUM_REPORT_LEVELS]; -#endif - #endif /* __ASLGLOBAL_H */ diff --git a/sys/contrib/dev/acpica/compiler/aslmain.c b/sys/contrib/dev/acpica/compiler/aslmain.c index 5a8fa2f..116597a 100644 --- a/sys/contrib/dev/acpica/compiler/aslmain.c +++ b/sys/contrib/dev/acpica/compiler/aslmain.c @@ -48,6 +48,7 @@ #include <contrib/dev/acpica/compiler/aslcompiler.h> #include <contrib/dev/acpica/include/acapps.h> #include <contrib/dev/acpica/include/acdisasm.h> +#include <signal.h> #ifdef _DEBUG #include <crtdbg.h> @@ -70,6 +71,10 @@ static void Usage ( void); +static void ACPI_SYSTEM_XFACE +AslSignalHandler ( + int Sig); + static void AslInitialize ( void); @@ -96,7 +101,7 @@ AslDoResponseFile ( #define ASL_TOKEN_SEPARATORS " \t\n" -#define ASL_SUPPORTED_OPTIONS "@:2b|c|d^D:e:fgh^i|I:l^mno|p:P^r:s|t|T:G^v^w|x:z" +#define ASL_SUPPORTED_OPTIONS "@:2b|c|d^D:e:fgh^i|I:l^m:no|p:P^r:s|t|T:G^v^w|x:z" /******************************************************************************* @@ -163,10 +168,10 @@ Options ( printf ("\nAML Disassembler:\n"); ACPI_OPTION ("-d [file]", "Disassemble or decode binary ACPI table to file (*.dsl)"); ACPI_OPTION ("-da [f1,f2]", "Disassemble multiple tables from single namespace"); + ACPI_OPTION ("-db", "Do not translate Buffers to Resource Templates"); ACPI_OPTION ("-dc [file]", "Disassemble AML and immediately compile it"); ACPI_OPTION ("", "(Obtain DSDT from current system if no input file)"); ACPI_OPTION ("-e [f1,f2]", "Include ACPI table(s) for external symbol resolution"); - ACPI_OPTION ("-m", "Do not translate Buffers to Resource Templates"); ACPI_OPTION ("-2", "Emit ACPI 2.0 compatible ASL code"); ACPI_OPTION ("-g", "Get ACPI tables and write to files (*.dat)"); @@ -238,6 +243,49 @@ Usage ( } +/****************************************************************************** + * + * FUNCTION: AslSignalHandler + * + * PARAMETERS: Sig - Signal that invoked this handler + * + * RETURN: None + * + * DESCRIPTION: Control-C handler. Delete any intermediate files and any + * output files that may be left in an indeterminate state. + * + *****************************************************************************/ + +static void ACPI_SYSTEM_XFACE +AslSignalHandler ( + int Sig) +{ + UINT32 i; + + + signal (Sig, SIG_IGN); + printf ("Aborting\n\n"); + + /* Close all open files */ + + Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; /* the .i file is same as source file */ + + for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++) + { + FlCloseFile (i); + } + + /* Delete any output files */ + + for (i = ASL_FILE_AML_OUTPUT; i < ASL_MAX_FILE_TYPE; i++) + { + FlDeleteFile (i); + } + + exit (0); +} + + /******************************************************************************* * * FUNCTION: AslInitialize @@ -261,7 +309,6 @@ AslInitialize ( _CrtSetDbgFlag (_CRTDBG_CHECK_ALWAYS_DF | _CrtSetDbgFlag(0)); #endif - AcpiDbgLevel = 0; for (i = 0; i < ASL_NUM_FILES; i++) { @@ -274,6 +321,11 @@ AslInitialize ( Gbl_Files[ASL_FILE_STDERR].Handle = stderr; Gbl_Files[ASL_FILE_STDERR].Filename = "STDERR"; + + /* Allocate the line buffer(s) */ + + Gbl_LineBufferSize /= 2; + UtExpandLineBuffers (); } @@ -475,6 +527,10 @@ AslDoOptions ( Gbl_DisassembleAll = TRUE; break; + case 'b': /* Do not convert buffers to resource descriptors */ + AcpiGbl_NoResourceDisassembly = TRUE; + break; + case 'c': break; @@ -613,8 +669,13 @@ AslDoOptions ( break; - case 'm': /* Do not convert buffers to resource descriptors */ - AcpiGbl_NoResourceDisassembly = TRUE; + case 'm': /* Set line buffer size */ + Gbl_LineBufferSize = (UINT32) strtoul (AcpiGbl_Optarg, NULL, 0) * 1024; + if (Gbl_LineBufferSize < ASL_DEFAULT_LINE_BUFFER_SIZE) + { + Gbl_LineBufferSize = ASL_DEFAULT_LINE_BUFFER_SIZE; + } + printf ("Line Buffer Size: %u\n", Gbl_LineBufferSize); break; @@ -946,7 +1007,10 @@ main ( int Index2; + signal (SIGINT, AslSignalHandler); + AcpiGbl_ExternalFileList = NULL; + AcpiDbgLevel = 0; #ifdef _DEBUG _CrtSetDbgFlag (_CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF | @@ -955,9 +1019,10 @@ main ( /* Init and command line */ + Index1 = Index2 = AslCommandLine (argc, argv); + AslInitialize (); PrInitializePreprocessor (); - Index1 = Index2 = AslCommandLine (argc, argv); /* Options that have no additional parameters or pathnames */ diff --git a/sys/contrib/dev/acpica/compiler/aslmessages.h b/sys/contrib/dev/acpica/compiler/aslmessages.h index 4c4e79a..f2d86d0 100644 --- a/sys/contrib/dev/acpica/compiler/aslmessages.h +++ b/sys/contrib/dev/acpica/compiler/aslmessages.h @@ -198,6 +198,7 @@ typedef enum ASL_MSG_VENDOR_LIST, ASL_MSG_WRITE, ASL_MSG_RANGE, + ASL_MSG_BUFFER_ALLOCATION, /* These messages are used by the Preprocessor only */ @@ -373,6 +374,7 @@ char *AslMessages [] = { /* ASL_MSG_VENDOR_LIST */ "Too many vendor data bytes (7 max)", /* ASL_MSG_WRITE */ "Could not write file", /* ASL_MSG_RANGE */ "Constant out of range", +/* ASL_MSG_BUFFER_ALLOCATION */ "Could not allocate line buffer", /* Preprocessor */ diff --git a/sys/contrib/dev/acpica/compiler/asloperands.c b/sys/contrib/dev/acpica/compiler/asloperands.c index cecf5d9..21a9313 100644 --- a/sys/contrib/dev/acpica/compiler/asloperands.c +++ b/sys/contrib/dev/acpica/compiler/asloperands.c @@ -182,6 +182,10 @@ OpnDoMethod ( Next = Next->Asl.Next; if (Next->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) { + /* This is a ByteConstExpr, so eval the constant now */ + + OpcAmlConstantWalk (Next, 0, NULL); + if (Next->Asl.Value.Integer > 15) { AslError (ASL_ERROR, ASL_MSG_SYNC_LEVEL, Next, NULL); diff --git a/sys/contrib/dev/acpica/compiler/aslopt.c b/sys/contrib/dev/acpica/compiler/aslopt.c index 904c329..691f802 100644 --- a/sys/contrib/dev/acpica/compiler/aslopt.c +++ b/sys/contrib/dev/acpica/compiler/aslopt.c @@ -441,7 +441,6 @@ OptOptimizeNameDeclaration ( { ACPI_STATUS Status; char *NewPathExternal; - ACPI_GENERIC_STATE ScopeInfo; ACPI_NAMESPACE_NODE *Node; @@ -473,9 +472,10 @@ OptOptimizeNameDeclaration ( * Check to make sure that the optimization finds the node we are * looking for. This is simply a sanity check on the new * path that has been created. + * + * We know that we are at the root, so NULL is used for the scope. */ - ScopeInfo.Scope.Node = CurrentNode; - Status = AcpiNsLookup (&ScopeInfo, *NewPath, + Status = AcpiNsLookup (NULL, *NewPath, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node)); if (ACPI_SUCCESS (Status)) @@ -624,11 +624,21 @@ OptOptimizeNamePath ( ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "NAME")); /* - * The node of interest is the parent of this node - * (the containing scope) + * The node of interest is the parent of this node (the containing + * scope). The actual namespace node may be up more than one level + * of parse op or it may not exist at all (if we traverse back + * up to the root.) */ - CurrentNode = Op->Asl.Parent->Asl.Node; - if (!CurrentNode) + NextOp = Op->Asl.Parent; + while (NextOp && (!NextOp->Asl.Node)) + { + NextOp = NextOp->Asl.Parent; + } + if (NextOp && NextOp->Asl.Node) + { + CurrentNode = NextOp->Asl.Node; + } + else { CurrentNode = AcpiGbl_RootNode; } diff --git a/sys/contrib/dev/acpica/compiler/aslstartup.c b/sys/contrib/dev/acpica/compiler/aslstartup.c index 4011bde..0f4c1a5 100644 --- a/sys/contrib/dev/acpica/compiler/aslstartup.c +++ b/sys/contrib/dev/acpica/compiler/aslstartup.c @@ -239,7 +239,7 @@ AslDetectSourceFileType ( * File is ASCII. Determine if this is an ASL file or an ACPI data * table file. */ - while (fgets (Gbl_CurrentLineBuffer, ASL_LINE_BUFFER_SIZE, Info->Handle)) + while (fgets (Gbl_CurrentLineBuffer, Gbl_LineBufferSize, Info->Handle)) { /* Uppercase the buffer for caseless compare */ diff --git a/sys/contrib/dev/acpica/compiler/aslsupport.l b/sys/contrib/dev/acpica/compiler/aslsupport.l index f63519c..eef9411 100644 --- a/sys/contrib/dev/acpica/compiler/aslsupport.l +++ b/sys/contrib/dev/acpica/compiler/aslsupport.l @@ -343,14 +343,14 @@ AslInsertLineBuffer ( *Gbl_LineBufPtr = (UINT8) SourceChar; Gbl_LineBufPtr++; - if (Gbl_LineBufPtr > (Gbl_CurrentLineBuffer + (ASL_LINE_BUFFER_SIZE - 1))) + if (Gbl_LineBufPtr > (Gbl_CurrentLineBuffer + (Gbl_LineBufferSize - 1))) { #if 0 /* * Warning if we have split a long source line. * <Probably overkill> */ - sprintf (MsgBuffer, "Max %u", ASL_LINE_BUFFER_SIZE); + sprintf (MsgBuffer, "Max %u", Gbl_LineBufferSize); AslCommonError (ASL_WARNING, ASL_MSG_LONG_LINE, Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, Gbl_CurrentLineOffset, Gbl_CurrentColumn, diff --git a/sys/contrib/dev/acpica/compiler/asltypes.h b/sys/contrib/dev/acpica/compiler/asltypes.h index 7e3bd0a..b9f4fbe 100644 --- a/sys/contrib/dev/acpica/compiler/asltypes.h +++ b/sys/contrib/dev/acpica/compiler/asltypes.h @@ -133,6 +133,8 @@ typedef struct asl_file_info { FILE *Handle; char *Filename; + const char *ShortDescription; + const char *Description; } ASL_FILE_INFO; @@ -146,14 +148,14 @@ typedef struct asl_file_status /* * File types. Note: Any changes to this table must also be reflected - * in the AslFileTypeNames array. + * in the Gbl_Files array. */ typedef enum { ASL_FILE_STDOUT = 0, ASL_FILE_STDERR, - ASL_FILE_INPUT, /* Don't move these first 3 file types */ - ASL_FILE_AML_OUTPUT, + ASL_FILE_INPUT, + ASL_FILE_AML_OUTPUT, /* Don't move these first 4 file types */ ASL_FILE_SOURCE_OUTPUT, ASL_FILE_PREPROCESSOR, ASL_FILE_LISTING_OUTPUT, diff --git a/sys/contrib/dev/acpica/compiler/aslutils.c b/sys/contrib/dev/acpica/compiler/aslutils.c index db9c784..3deeacb 100644 --- a/sys/contrib/dev/acpica/compiler/aslutils.c +++ b/sys/contrib/dev/acpica/compiler/aslutils.c @@ -54,31 +54,6 @@ ACPI_MODULE_NAME ("aslutils") -char AslHexLookup[] = -{ - '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' -}; - -/* Table below must match ASL_FILE_TYPES in asltypes.h */ - -static const char *AslFileTypeNames [ASL_NUM_FILES] = -{ - "stdout: ", - "stderr: ", - "Table Input: ", - "Binary Output:", - "Source Output:", - "Preprocessor: ", - "Listing File: ", - "Hex Dump: ", - "Namespace: ", - "Debug File: ", - "ASM Source: ", - "C Source: ", - "ASM Include: ", - "C Include: " -}; - /* Local prototypes */ @@ -547,7 +522,7 @@ UtDisplaySummary ( } FlPrintFile (FileId, "%14s %s - %u bytes\n", - AslFileTypeNames [i], + Gbl_Files[i].ShortDescription, Gbl_Files[i].Filename, FlGetFileSize (i)); } @@ -646,6 +621,79 @@ UtGetStringBuffer ( } +/****************************************************************************** + * + * FUNCTION: UtExpandLineBuffers + * + * PARAMETERS: None. Updates global line buffer pointers. + * + * RETURN: None. Reallocates the global line buffers + * + * DESCRIPTION: Called if the current line buffer becomes filled. Reallocates + * all global line buffers and updates Gbl_LineBufferSize. NOTE: + * Also used for the initial allocation of the buffers, when + * all of the buffer pointers are NULL. Initial allocations are + * of size ASL_DEFAULT_LINE_BUFFER_SIZE + * + *****************************************************************************/ + +void +UtExpandLineBuffers ( + void) +{ + UINT32 NewSize; + + + /* Attempt to double the size of all line buffers */ + + NewSize = Gbl_LineBufferSize * 2; + if (Gbl_CurrentLineBuffer) + { + DbgPrint (ASL_DEBUG_OUTPUT,"Increasing line buffer size from %u to %u\n", + Gbl_LineBufferSize, NewSize); + } + + Gbl_CurrentLineBuffer = realloc (Gbl_CurrentLineBuffer, NewSize); + Gbl_LineBufPtr = Gbl_CurrentLineBuffer; + if (!Gbl_CurrentLineBuffer) + { + goto ErrorExit; + } + + Gbl_MainTokenBuffer = realloc (Gbl_MainTokenBuffer, NewSize); + if (!Gbl_MainTokenBuffer) + { + goto ErrorExit; + } + + Gbl_MacroTokenBuffer = realloc (Gbl_MacroTokenBuffer, NewSize); + if (!Gbl_MacroTokenBuffer) + { + goto ErrorExit; + } + + Gbl_ExpressionTokenBuffer = realloc (Gbl_ExpressionTokenBuffer, NewSize); + if (!Gbl_ExpressionTokenBuffer) + { + goto ErrorExit; + } + + Gbl_LineBufferSize = NewSize; + return; + + + /* On error above, simply issue error messages and abort, cannot continue */ + +ErrorExit: + printf ("Could not increase line buffer size from %u to %u\n", + Gbl_LineBufferSize, Gbl_LineBufferSize * 2); + + AslError (ASL_ERROR, ASL_MSG_BUFFER_ALLOCATION, + NULL, NULL); + AslAbort (); +} + + /******************************************************************************* * * FUNCTION: UtInternalizeName diff --git a/sys/contrib/dev/acpica/compiler/dtio.c b/sys/contrib/dev/acpica/compiler/dtio.c index 1d08389d..3992795 100644 --- a/sys/contrib/dev/acpica/compiler/dtio.c +++ b/sys/contrib/dev/acpica/compiler/dtio.c @@ -413,13 +413,21 @@ DtGetNextLine ( BOOLEAN LineNotAllBlanks = FALSE; UINT32 State = DT_NORMAL_TEXT; UINT32 CurrentLineOffset; - UINT32 BeyondBufferCount; UINT32 i; char c; - for (i = 0; i < ASL_LINE_BUFFER_SIZE;) + for (i = 0; ;) { + /* + * If line is too long, expand the line buffers. Also increases + * Gbl_LineBufferSize. + */ + if (i >= Gbl_LineBufferSize) + { + UtExpandLineBuffers (); + } + c = (char) getc (Handle); if (c == EOF) { @@ -491,6 +499,11 @@ DtGetNextLine ( */ if ((i != 0) && LineNotAllBlanks) { + if ((i + 1) >= Gbl_LineBufferSize) + { + UtExpandLineBuffers (); + } + Gbl_CurrentLineBuffer[i+1] = 0; /* Terminate string */ return (CurrentLineOffset); } @@ -565,6 +578,11 @@ DtGetNextLine ( default: /* Not a comment */ i++; /* Save the preceeding slash */ + if (i >= Gbl_LineBufferSize) + { + UtExpandLineBuffers (); + } + Gbl_CurrentLineBuffer[i] = c; i++; State = DT_NORMAL_TEXT; @@ -668,21 +686,6 @@ DtGetNextLine ( return (ASL_EOF); } } - - /* Line is too long for internal buffer. Determine actual length */ - - BeyondBufferCount = 1; - c = (char) getc (Handle); - while (c != '\n') - { - c = (char) getc (Handle); - BeyondBufferCount++; - } - - printf ("ERROR - At %u: Input line (%u bytes) is too long (max %u)\n", - Gbl_CurrentLineNumber++, ASL_LINE_BUFFER_SIZE + BeyondBufferCount, - ASL_LINE_BUFFER_SIZE); - return (ASL_EOF); } diff --git a/sys/contrib/dev/acpica/compiler/preprocess.h b/sys/contrib/dev/acpica/compiler/preprocess.h index 920c0b9..f97434f 100644 --- a/sys/contrib/dev/acpica/compiler/preprocess.h +++ b/sys/contrib/dev/acpica/compiler/preprocess.h @@ -128,10 +128,13 @@ typedef struct pr_file_node /* * Globals */ -PR_EXTERN char XXXEvalBuffer[ASL_LINE_BUFFER_SIZE]; -PR_EXTERN char Gbl_MainTokenBuffer[ASL_LINE_BUFFER_SIZE]; -PR_EXTERN char Gbl_MacroTokenBuffer[ASL_LINE_BUFFER_SIZE]; -PR_EXTERN char Gbl_ExpressionTokenBuffer[ASL_LINE_BUFFER_SIZE]; +#if 0 /* TBD for macros */ +PR_EXTERN char PR_INIT_GLOBAL (*XXXEvalBuffer, NULL); /* [ASL_LINE_BUFFER_SIZE]; */ +#endif + +PR_EXTERN char PR_INIT_GLOBAL (*Gbl_MainTokenBuffer, NULL); /* [ASL_LINE_BUFFER_SIZE]; */ +PR_EXTERN char PR_INIT_GLOBAL (*Gbl_MacroTokenBuffer, NULL); /* [ASL_LINE_BUFFER_SIZE]; */ +PR_EXTERN char PR_INIT_GLOBAL (*Gbl_ExpressionTokenBuffer, NULL); /* [ASL_LINE_BUFFER_SIZE]; */ PR_EXTERN PR_FILE_NODE *Gbl_InputFileList; PR_EXTERN PR_DEFINE_INFO PR_INIT_GLOBAL (*Gbl_DefineList, NULL); diff --git a/sys/contrib/dev/acpica/components/debugger/dbexec.c b/sys/contrib/dev/acpica/components/debugger/dbexec.c index 541e9a3..e4fa031 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbexec.c +++ b/sys/contrib/dev/acpica/components/debugger/dbexec.c @@ -607,7 +607,7 @@ AcpiDbExecuteSetup ( AcpiDbPrepNamestring (Info->Pathname); AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); - AcpiOsPrintf ("Executing %s\n", Info->Pathname); + AcpiOsPrintf ("Evaluating %s\n", Info->Pathname); if (Info->Flags & EX_SINGLE_STEP) { @@ -701,7 +701,7 @@ AcpiDbExecutionWalk ( ReturnObj.Pointer = NULL; ReturnObj.Length = ACPI_ALLOCATE_BUFFER; - AcpiNsPrintNodePathname (Node, "Execute"); + AcpiNsPrintNodePathname (Node, "Evaluating"); /* Do the actual method execution */ @@ -710,7 +710,7 @@ AcpiDbExecutionWalk ( Status = AcpiEvaluateObject (Node, NULL, NULL, &ReturnObj); - AcpiOsPrintf ("[%4.4s] returned %s\n", AcpiUtGetNodeName (Node), + AcpiOsPrintf ("Evaluation of [%4.4s] returned %s\n", AcpiUtGetNodeName (Node), AcpiFormatException (Status)); AcpiGbl_MethodExecuting = FALSE; @@ -1009,14 +1009,14 @@ AcpiDbExecute ( if (Allocations > 0) { - AcpiOsPrintf ("Outstanding: 0x%X allocations after execution\n", - Allocations); + AcpiOsPrintf ("0x%X Outstanding allocations after evaluation of %s\n", + Allocations, AcpiGbl_DbMethodInfo.Pathname); } #endif if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("Execution of %s failed with status %s\n", + AcpiOsPrintf ("Evaluation of %s failed with status %s\n", AcpiGbl_DbMethodInfo.Pathname, AcpiFormatException (Status)); } else @@ -1025,7 +1025,8 @@ AcpiDbExecute ( if (ReturnObj.Length) { - AcpiOsPrintf ("Execution of %s returned object %p Buflen %X\n", + AcpiOsPrintf ( + "Evaluation of %s returned object %p, external buffer length %X\n", AcpiGbl_DbMethodInfo.Pathname, ReturnObj.Pointer, (UINT32) ReturnObj.Length); AcpiDbDumpExternalObject (ReturnObj.Pointer, 1); @@ -1040,7 +1041,7 @@ AcpiDbExecute ( } else { - AcpiOsPrintf ("No return object from execution of %s\n", + AcpiOsPrintf ("No object was returned from evaluation of %s\n", AcpiGbl_DbMethodInfo.Pathname); } } @@ -1111,7 +1112,7 @@ AcpiDbMethodThread ( Status = AcpiDbExecuteMethod (&LocalInfo, &ReturnObj); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("%s During execution of %s at iteration %X\n", + AcpiOsPrintf ("%s During evaluation of %s at iteration %X\n", AcpiFormatException (Status), Info->Pathname, i); if (Status == AE_ABORT_METHOD) { @@ -1122,12 +1123,12 @@ AcpiDbMethodThread ( #if 0 if ((i % 100) == 0) { - AcpiOsPrintf ("%u executions, Thread 0x%x\n", i, AcpiOsGetThreadId ()); + AcpiOsPrintf ("%u loops, Thread 0x%x\n", i, AcpiOsGetThreadId ()); } if (ReturnObj.Length) { - AcpiOsPrintf ("Execution of %s returned object %p Buflen %X\n", + AcpiOsPrintf ("Evaluation of %s returned object %p Buflen %X\n", Info->Pathname, ReturnObj.Pointer, (UINT32) ReturnObj.Length); AcpiDbDumpExternalObject (ReturnObj.Pointer, 1); } diff --git a/sys/contrib/dev/acpica/components/debugger/dbinput.c b/sys/contrib/dev/acpica/components/debugger/dbinput.c index f18398c..0fd76dd 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbinput.c +++ b/sys/contrib/dev/acpica/components/debugger/dbinput.c @@ -67,8 +67,18 @@ AcpiDbSingleThread ( void); static void +AcpiDbDisplayCommandInfo ( + char *Command, + BOOLEAN DisplayAll); + +static void AcpiDbDisplayHelp ( - void); + char *Command); + +static BOOLEAN +AcpiDbMatchCommandHelp ( + char *Command, + const ACPI_DB_COMMAND_HELP *Help); /* @@ -92,6 +102,7 @@ enum AcpiExDebuggerCommands CMD_DISASSEMBLE, CMD_DUMP, CMD_ENABLEACPI, + CMD_EVALUATE, CMD_EVENT, CMD_EXECUTE, CMD_EXIT, @@ -145,7 +156,7 @@ enum AcpiExDebuggerCommands /* Second parameter is the required argument count */ -static const COMMAND_INFO AcpiGbl_DbCommands[] = +static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands[] = { {"<NOT FOUND>", 0}, {"<NULL>", 0}, @@ -161,6 +172,7 @@ static const COMMAND_INFO AcpiGbl_DbCommands[] = {"DISASSEMBLE", 1}, {"DUMP", 1}, {"ENABLEACPI", 0}, + {"EVALUATE", 1}, {"EVENT", 1}, {"EXECUTE", 1}, {"EXIT", 0}, @@ -197,7 +209,7 @@ static const COMMAND_INFO AcpiGbl_DbCommands[] = {"RESULTS", 0}, {"SET", 3}, {"SLEEP", 1}, - {"STATS", 0}, + {"STATS", 1}, {"STOP", 0}, {"TABLES", 0}, {"TEMPLATE", 1}, @@ -210,100 +222,229 @@ static const COMMAND_INFO AcpiGbl_DbCommands[] = {NULL, 0} }; +/* + * Help for all debugger commands. First argument is the number of lines + * of help to output for the command. + */ +static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] = +{ + {0, "\nGeneral-Purpose Commands:", "\n"}, + {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"}, + {1, " Level <DebugLevel>] [console]", "Get/Set debug level for file or console\n"}, + {1, " Locks", "Current status of internal mutexes\n"}, + {1, " Osi [Install|Remove <name>]", "Display or modify global _OSI list\n"}, + {1, " Quit or Exit", "Exit this command\n"}, + {9, " Stats [Allocations|Memory|Misc|", "\n"}, + {1, " Objects|Sizes|Stack|Tables]", "Display namespace and memory statistics\n"}, + {1, " Allocations", "Display list of current memory allocations\n"}, + {1, " Memory", "Dump internal memory lists\n"}, + {1, " Misc", "Namespace search and mutex stats\n"}, + {1, " Objects", "Summary of namespace objects\n"}, + {1, " Sizes", "Sizes for each of the internal objects\n"}, + {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"}, + + {0, "\nNamespace Access Commands:", "\n"}, + {1, " Businfo", "Display system bus info\n"}, + {1, " Disassemble <Method>", "Disassemble a control method\n"}, + {1, " Event <F|G> <Value>", "Generate AcpiEvent (Fixed/GPE)\n"}, + {1, " Find <AcpiName> (? is wildcard)", "Find ACPI name(s) with wildcards\n"}, + {1, " Gpe <GpeNum> <GpeBlock>", "Simulate a GPE\n"}, + {1, " Gpes", "Display info on all GPEs\n"}, + {1, " Integrity", "Validate namespace integrity\n"}, + {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, " Owner <OwnerId> [Depth]", "Display loaded namespace by object owner\n"}, + {1, " Predefined", "Check all predefined names\n"}, + {1, " Prefix [<NamePath>]", "Set or Get current execution prefix\n"}, + {1, " References <Addr>", "Find all references to object at addr\n"}, + {1, " Resources <DeviceName | *>", "Display Device resources (* = all devices)\n"}, + {1, " Set N <NamedObject> <Value>", "Set value for named integer\n"}, + {1, " Sleep <SleepState>", "Simulate sleep/wake sequence\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"}, + {1, " Arguments (or Args)", "Display method arguments\n"}, + {1, " Breakpoint <AmlOffset>", "Set an AML execution breakpoint\n"}, + {1, " Call", "Run to next control method invocation\n"}, + {1, " Debug <Namepath> [Arguments]", "Single Step a control method\n"}, + {6, " Evaluate", "Synonym for Execute\n"}, + {5, " Execute <Namepath> [Arguments]", "Execute control method\n"}, + {1, " Hex Integer", "Integer method argument\n"}, + {1, " \"Ascii String\"", "String method argument\n"}, + {1, " (Byte List)", "Buffer method argument\n"}, + {1, " [Package Element List]", "Package method argument\n"}, + {1, " Go", "Allow method to run to completion\n"}, + {1, " Information", "Display info about the current method\n"}, + {1, " Into", "Step into (not over) a method call\n"}, + {1, " List [# of Aml Opcodes]", "Display method ASL statements\n"}, + {1, " Locals", "Display method local variables\n"}, + {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"}, + {1, " Trace <method name>", "Trace method execution\n"}, + {1, " Tree", "Display control method calling tree\n"}, + {1, " <Enter>", "Single step next AML opcode (over calls)\n"}, + + {0, "\nFile I/O Commands:", "\n"}, + {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"}, + {0, NULL, NULL} +}; + + +/******************************************************************************* + * + * FUNCTION: AcpiDbMatchCommandHelp + * + * PARAMETERS: Command - Command string to match + * Help - Help table entry to attempt match + * + * RETURN: TRUE if command matched, FALSE otherwise + * + * DESCRIPTION: Attempt to match a command in the help table in order to + * print help information for a single command. + * + ******************************************************************************/ + +static BOOLEAN +AcpiDbMatchCommandHelp ( + char *Command, + const ACPI_DB_COMMAND_HELP *Help) +{ + char *Invocation = Help->Invocation; + UINT32 LineCount; + + + /* Valid commands in the help table begin with a couple of spaces */ + + if (*Invocation != ' ') + { + return (FALSE); + } + + while (*Invocation == ' ') + { + Invocation++; + } + + /* Match command name (full command or substring) */ + + while ((*Command) && (*Invocation) && (*Invocation != ' ')) + { + if (ACPI_TOLOWER (*Command) != ACPI_TOLOWER (*Invocation)) + { + return (FALSE); + } + + Invocation++; + Command++; + } + + /* Print the appropriate number of help lines */ + + LineCount = Help->LineCount; + while (LineCount) + { + AcpiOsPrintf ("%-38s : %s", Help->Invocation, Help->Description); + Help++; + LineCount--; + } + + return (TRUE); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbDisplayCommandInfo + * + * PARAMETERS: Command - Command string to match + * DisplayAll - Display all matching commands, or just + * the first one (substring match) + * + * RETURN: None + * + * DESCRIPTION: Display help information for a Debugger command. + * + ******************************************************************************/ + +static void +AcpiDbDisplayCommandInfo ( + char *Command, + BOOLEAN DisplayAll) +{ + const ACPI_DB_COMMAND_HELP *Next; + BOOLEAN Matched; + + + Next = AcpiGbl_DbCommandHelp; + while (Next->Invocation) + { + Matched = AcpiDbMatchCommandHelp (Command, Next); + if (!DisplayAll && Matched) + { + return; + } + + Next++; + } +} + /******************************************************************************* * * FUNCTION: AcpiDbDisplayHelp * - * PARAMETERS: None + * PARAMETERS: Command - Optional command string to display help. + * if not specified, all debugger command + * help strings are displayed * * RETURN: None * - * DESCRIPTION: Print a usage message. + * DESCRIPTION: Display help for a single debugger command, or all of them. * ******************************************************************************/ static void AcpiDbDisplayHelp ( - void) + char *Command) { + const ACPI_DB_COMMAND_HELP *Next = AcpiGbl_DbCommandHelp; + - AcpiOsPrintf ("\nGeneral-Purpose Commands:\n"); - AcpiOsPrintf (" Allocations Display list of current memory allocations\n"); - AcpiOsPrintf (" Dump <Address>|<Namepath>\n"); - AcpiOsPrintf (" [Byte|Word|Dword|Qword] Display ACPI objects or memory\n"); - AcpiOsPrintf (" EnableAcpi Enable ACPI (hardware) mode\n"); - AcpiOsPrintf (" Handlers Info about global handlers\n"); - AcpiOsPrintf (" Help This help screen\n"); - AcpiOsPrintf (" History Display command history buffer\n"); - AcpiOsPrintf (" Level [<DebugLevel>] [console] Get/Set debug level for file or console\n"); - AcpiOsPrintf (" Locks Current status of internal mutexes\n"); - AcpiOsPrintf (" Osi [Install|Remove <name>] Display or modify global _OSI list\n"); - AcpiOsPrintf (" Quit or Exit Exit this command\n"); - AcpiOsPrintf (" Stats [Allocations|Memory|Misc|\n"); - AcpiOsPrintf (" Objects|Sizes|Stack|Tables] Display namespace and memory statistics\n"); - AcpiOsPrintf (" Allocations Display list of current memory allocations\n"); - AcpiOsPrintf (" Memory Dump internal memory lists\n"); - AcpiOsPrintf (" Misc Namespace search and mutex stats\n"); - AcpiOsPrintf (" Objects Summary of namespace objects\n"); - AcpiOsPrintf (" Sizes Sizes for each of the internal objects\n"); - AcpiOsPrintf (" Stack Display CPU stack usage\n"); - AcpiOsPrintf (" Tables Info about current ACPI table(s)\n"); - AcpiOsPrintf (" Tables Display info about loaded ACPI tables\n"); - AcpiOsPrintf (" Unload <Namepath> Unload an ACPI table via namespace object\n"); - AcpiOsPrintf (" ! <CommandNumber> Execute command from history buffer\n"); - AcpiOsPrintf (" !! Execute last command again\n"); - - AcpiOsPrintf ("\nNamespace Access Commands:\n"); - AcpiOsPrintf (" Businfo Display system bus info\n"); - AcpiOsPrintf (" Disassemble <Method> Disassemble a control method\n"); - AcpiOsPrintf (" Event <F|G> <Value> Generate AcpiEvent (Fixed/GPE)\n"); - AcpiOsPrintf (" Find <AcpiName> (? is wildcard) Find ACPI name(s) with wildcards\n"); - AcpiOsPrintf (" Gpe <GpeNum> <GpeBlock> Simulate a GPE\n"); - AcpiOsPrintf (" Gpes Display info on all GPEs\n"); - AcpiOsPrintf (" Integrity Validate namespace integrity\n"); - AcpiOsPrintf (" Methods Display list of loaded control methods\n"); - AcpiOsPrintf (" Namespace [Object] [Depth] Display loaded namespace tree/subtree\n"); - AcpiOsPrintf (" Notify <Object> <Value> Send a notification on Object\n"); - AcpiOsPrintf (" Objects <ObjectType> Display all objects of the given type\n"); - AcpiOsPrintf (" Owner <OwnerId> [Depth] Display loaded namespace by object owner\n"); - AcpiOsPrintf (" Predefined Check all predefined names\n"); - AcpiOsPrintf (" Prefix [<NamePath>] Set or Get current execution prefix\n"); - AcpiOsPrintf (" References <Addr> Find all references to object at addr\n"); - AcpiOsPrintf (" Resources <DeviceName | *> Display Device resources (* = all devices)\n"); - AcpiOsPrintf (" Set N <NamedObject> <Value> Set value for named integer\n"); - AcpiOsPrintf (" Sleep <SleepState> Simulate sleep/wake sequence\n"); - AcpiOsPrintf (" Template <Object> Format/dump a Buffer/ResourceTemplate\n"); - AcpiOsPrintf (" Terminate Delete namespace and all internal objects\n"); - AcpiOsPrintf (" Type <Object> Display object type\n"); - - AcpiOsPrintf ("\nControl Method Execution Commands:\n"); - AcpiOsPrintf (" Arguments (or Args) Display method arguments\n"); - AcpiOsPrintf (" Breakpoint <AmlOffset> Set an AML execution breakpoint\n"); - AcpiOsPrintf (" Call Run to next control method invocation\n"); - AcpiOsPrintf (" Debug <Namepath> [Arguments] Single Step a control method\n"); - AcpiOsPrintf (" Execute <Namepath> [Arguments] Execute control method\n"); - AcpiOsPrintf (" Hex Integer Integer method argument\n"); - AcpiOsPrintf (" \"Ascii String\" String method argument\n"); - AcpiOsPrintf (" (Byte List) Buffer method argument\n"); - AcpiOsPrintf (" [Package Element List] Package method argument\n"); - AcpiOsPrintf (" Go Allow method to run to completion\n"); - AcpiOsPrintf (" Information Display info about the current method\n"); - AcpiOsPrintf (" Into Step into (not over) a method call\n"); - AcpiOsPrintf (" List [# of Aml Opcodes] Display method ASL statements\n"); - AcpiOsPrintf (" Locals Display method local variables\n"); - AcpiOsPrintf (" Results Display method result stack\n"); - AcpiOsPrintf (" Set <A|L> <#> <Value> Set method data (Arguments/Locals)\n"); - AcpiOsPrintf (" Stop Terminate control method\n"); - AcpiOsPrintf (" Thread <Threads><Loops><NamePath> Spawn threads to execute method(s)\n"); - AcpiOsPrintf (" Trace <method name> Trace method execution\n"); - AcpiOsPrintf (" Tree Display control method calling tree\n"); - AcpiOsPrintf (" <Enter> Single step next AML opcode (over calls)\n"); - - AcpiOsPrintf ("\nFile I/O Commands:\n"); - AcpiOsPrintf (" Close Close debug output file\n"); - AcpiOsPrintf (" Load <Input Filename> Load ACPI table from a file\n"); - AcpiOsPrintf (" Open <Output Filename> Open a file for debug output\n"); + if (!Command) + { + /* No argument to help, display help for all commands */ + + while (Next->Invocation) + { + AcpiOsPrintf ("%-38s%s", Next->Invocation, Next->Description); + Next++; + } + } + else + { + /* Display help for all commands that match the subtring */ + + AcpiDbDisplayCommandInfo (Command, TRUE); + } } @@ -601,6 +742,7 @@ AcpiDbCommandDispatch ( ParamCount, AcpiGbl_DbCommands[CommandIndex].Name, AcpiGbl_DbCommands[CommandIndex].MinArgs); + AcpiDbDisplayCommandInfo (AcpiGbl_DbCommands[CommandIndex].Name, FALSE); return (AE_CTRL_TRUE); } @@ -677,6 +819,7 @@ AcpiDbCommandDispatch ( AcpiOsPrintf ("Event command not implemented\n"); break; + case CMD_EVALUATE: case CMD_EXECUTE: AcpiDbExecute (AcpiGbl_DbArgs[1], &AcpiGbl_DbArgs[2], &AcpiGbl_DbArgTypes[2], EX_NO_SINGLE_STEP); @@ -704,7 +847,7 @@ AcpiDbCommandDispatch ( case CMD_HELP: case CMD_HELP2: - AcpiDbDisplayHelp (); + AcpiDbDisplayHelp (AcpiGbl_DbArgs[1]); break; case CMD_HISTORY: diff --git a/sys/contrib/dev/acpica/components/debugger/dbmethod.c b/sys/contrib/dev/acpica/components/debugger/dbmethod.c index ee6677d..eb265d3 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbmethod.c +++ b/sys/contrib/dev/acpica/components/debugger/dbmethod.c @@ -406,7 +406,7 @@ AcpiDbWalkForExecute ( void **ReturnValue) { ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - ACPI_EXECUTE_WALK *Info = (ACPI_EXECUTE_WALK *) Context; + ACPI_DB_EXECUTE_WALK *Info = (ACPI_DB_EXECUTE_WALK *) Context; ACPI_BUFFER ReturnObj; ACPI_STATUS Status; char *Pathname; @@ -506,7 +506,7 @@ void AcpiDbBatchExecute ( char *CountArg) { - ACPI_EXECUTE_WALK Info; + ACPI_DB_EXECUTE_WALK Info; Info.Count = 0; @@ -523,7 +523,7 @@ AcpiDbBatchExecute ( (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, AcpiDbWalkForExecute, NULL, (void *) &Info, NULL); - AcpiOsPrintf ("Executed %u predefined names in the namespace\n", Info.Count); + AcpiOsPrintf ("Evaluated %u predefined names in the namespace\n", Info.Count); } #endif /* ACPI_DEBUGGER */ diff --git a/sys/contrib/dev/acpica/components/debugger/dbnames.c b/sys/contrib/dev/acpica/components/debugger/dbnames.c index c55ff72..d206d1b 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbnames.c +++ b/sys/contrib/dev/acpica/components/debugger/dbnames.c @@ -102,7 +102,7 @@ AcpiDbBusWalk ( * Arguments for the Objects command * These object types map directly to the ACPI_TYPES */ -static ARGUMENT_INFO AcpiDbObjectTypes [] = +static ACPI_DB_ARGUMENT_INFO AcpiDbObjectTypes [] = { {"ANY"}, {"INTEGERS"}, diff --git a/sys/contrib/dev/acpica/components/debugger/dbstats.c b/sys/contrib/dev/acpica/components/debugger/dbstats.c index ff12117..8ec42aa 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbstats.c +++ b/sys/contrib/dev/acpica/components/debugger/dbstats.c @@ -79,7 +79,7 @@ AcpiDbListInfo ( /* * Statistics subcommands */ -static ARGUMENT_INFO AcpiDbStatTypes [] = +static ACPI_DB_ARGUMENT_INFO AcpiDbStatTypes [] = { {"ALLOCATIONS"}, {"OBJECTS"}, @@ -398,12 +398,6 @@ AcpiDbDisplayStatistics ( UINT32 Temp; - if (!TypeArg) - { - AcpiOsPrintf ("The following subcommands are available:\n ALLOCATIONS, OBJECTS, MEMORY, MISC, SIZES, TABLES\n"); - return (AE_OK); - } - AcpiUtStrupr (TypeArg); Temp = AcpiDbMatchArgument (TypeArg, AcpiDbStatTypes); if (Temp == (UINT32) -1) diff --git a/sys/contrib/dev/acpica/components/debugger/dbutils.c b/sys/contrib/dev/acpica/components/debugger/dbutils.c index 6f5869a..393831be 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbutils.c +++ b/sys/contrib/dev/acpica/components/debugger/dbutils.c @@ -85,7 +85,7 @@ static char *Converter = "0123456789ABCDEF"; ACPI_OBJECT_TYPE AcpiDbMatchArgument ( char *UserArgument, - ARGUMENT_INFO *Arguments) + ACPI_DB_ARGUMENT_INFO *Arguments) { UINT32 i; diff --git a/sys/contrib/dev/acpica/components/disassembler/dmopcode.c b/sys/contrib/dev/acpica/components/disassembler/dmopcode.c index f77240a..095b6c2 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmopcode.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmopcode.c @@ -254,6 +254,10 @@ AcpiDmFieldPredefinedDescription ( /* Major cheat: We previously put the Tag ptr in the Node field */ Tag = ACPI_CAST_PTR (char, IndexOp->Common.Node); + if (!Tag) + { + return; + } /* Match the name in the info table */ diff --git a/sys/contrib/dev/acpica/components/tables/tbinstal.c b/sys/contrib/dev/acpica/components/tables/tbinstal.c index f56144c..1601c65 100644 --- a/sys/contrib/dev/acpica/components/tables/tbinstal.c +++ b/sys/contrib/dev/acpica/components/tables/tbinstal.c @@ -374,6 +374,7 @@ AcpiTbResizeRootTableList ( void) { ACPI_TABLE_DESC *Tables; + UINT32 TableCount; ACPI_FUNCTION_TRACE (TbResizeRootTableList); @@ -389,9 +390,17 @@ AcpiTbResizeRootTableList ( /* Increase the Table Array size */ + if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED) + { + TableCount = AcpiGbl_RootTableList.MaxTableCount; + } + else + { + TableCount = AcpiGbl_RootTableList.CurrentTableCount; + } + Tables = ACPI_ALLOCATE_ZEROED ( - ((ACPI_SIZE) AcpiGbl_RootTableList.MaxTableCount + - ACPI_ROOT_TABLE_SIZE_INCREMENT) * + ((ACPI_SIZE) TableCount + ACPI_ROOT_TABLE_SIZE_INCREMENT) * sizeof (ACPI_TABLE_DESC)); if (!Tables) { @@ -404,7 +413,7 @@ AcpiTbResizeRootTableList ( if (AcpiGbl_RootTableList.Tables) { ACPI_MEMCPY (Tables, AcpiGbl_RootTableList.Tables, - (ACPI_SIZE) AcpiGbl_RootTableList.MaxTableCount * sizeof (ACPI_TABLE_DESC)); + (ACPI_SIZE) TableCount * sizeof (ACPI_TABLE_DESC)); if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED) { @@ -413,8 +422,9 @@ AcpiTbResizeRootTableList ( } AcpiGbl_RootTableList.Tables = Tables; - AcpiGbl_RootTableList.MaxTableCount += ACPI_ROOT_TABLE_SIZE_INCREMENT; - AcpiGbl_RootTableList.Flags |= (UINT8) ACPI_ROOT_ORIGIN_ALLOCATED; + AcpiGbl_RootTableList.MaxTableCount = + TableCount + ACPI_ROOT_TABLE_SIZE_INCREMENT; + AcpiGbl_RootTableList.Flags |= ACPI_ROOT_ORIGIN_ALLOCATED; return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/components/tables/tbxface.c b/sys/contrib/dev/acpica/components/tables/tbxface.c index f4a1e52..bc8c3e1 100644 --- a/sys/contrib/dev/acpica/components/tables/tbxface.c +++ b/sys/contrib/dev/acpica/components/tables/tbxface.c @@ -175,7 +175,7 @@ ACPI_EXPORT_SYMBOL (AcpiInitializeTables) * DESCRIPTION: Reallocate Root Table List into dynamic memory. Copies the * root list from the previously provided scratch area. Should * be called once dynamic memory allocation is available in the - * kernel + * kernel. * ******************************************************************************/ @@ -183,9 +183,7 @@ ACPI_STATUS AcpiReallocateRootTable ( void) { - ACPI_TABLE_DESC *Tables; - ACPI_SIZE NewSize; - ACPI_SIZE CurrentSize; + ACPI_STATUS Status; ACPI_FUNCTION_TRACE (AcpiReallocateRootTable); @@ -200,38 +198,10 @@ AcpiReallocateRootTable ( return_ACPI_STATUS (AE_SUPPORT); } - /* - * Get the current size of the root table and add the default - * increment to create the new table size. - */ - CurrentSize = (ACPI_SIZE) - AcpiGbl_RootTableList.CurrentTableCount * sizeof (ACPI_TABLE_DESC); - - NewSize = CurrentSize + - (ACPI_ROOT_TABLE_SIZE_INCREMENT * sizeof (ACPI_TABLE_DESC)); - - /* Create new array and copy the old array */ - - Tables = ACPI_ALLOCATE_ZEROED (NewSize); - if (!Tables) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - ACPI_MEMCPY (Tables, AcpiGbl_RootTableList.Tables, CurrentSize); + AcpiGbl_RootTableList.Flags |= ACPI_ROOT_ALLOW_RESIZE; - /* - * Update the root table descriptor. The new size will be the current - * number of tables plus the increment, independent of the reserved - * size of the original table list. - */ - AcpiGbl_RootTableList.Tables = Tables; - AcpiGbl_RootTableList.MaxTableCount = - AcpiGbl_RootTableList.CurrentTableCount + ACPI_ROOT_TABLE_SIZE_INCREMENT; - AcpiGbl_RootTableList.Flags = - ACPI_ROOT_ORIGIN_ALLOCATED | ACPI_ROOT_ALLOW_RESIZE; - - return_ACPI_STATUS (AE_OK); + Status = AcpiTbResizeRootTableList (); + return_ACPI_STATUS (Status); } ACPI_EXPORT_SYMBOL (AcpiReallocateRootTable) diff --git a/sys/contrib/dev/acpica/include/acdebug.h b/sys/contrib/dev/acpica/include/acdebug.h index 5c91c87..de915b4 100644 --- a/sys/contrib/dev/acpica/include/acdebug.h +++ b/sys/contrib/dev/acpica/include/acdebug.h @@ -47,25 +47,33 @@ #define ACPI_DEBUG_BUFFER_SIZE 0x4000 /* 16K buffer for return objects */ -typedef struct CommandInfo +typedef struct acpi_db_command_info { char *Name; /* Command Name */ UINT8 MinArgs; /* Minimum arguments required */ -} COMMAND_INFO; +} ACPI_DB_COMMAND_INFO; -typedef struct ArgumentInfo +typedef struct acpi_db_command_help +{ + UINT8 LineCount; /* Number of help lines */ + char *Invocation; /* Command Invocation */ + char *Description; /* Command Description */ + +} ACPI_DB_COMMAND_HELP; + +typedef struct acpi_db_argument_info { char *Name; /* Argument Name */ -} ARGUMENT_INFO; +} ACPI_DB_ARGUMENT_INFO; -typedef struct acpi_execute_walk +typedef struct acpi_db_execute_walk { UINT32 Count; UINT32 MaxCount; -} ACPI_EXECUTE_WALK; +} ACPI_DB_EXECUTE_WALK; #define PARAM_LIST(pl) pl @@ -304,7 +312,7 @@ AcpiDbGetCacheInfo ( ACPI_OBJECT_TYPE AcpiDbMatchArgument ( char *UserArgument, - ARGUMENT_INFO *Arguments); + ACPI_DB_ARGUMENT_INFO *Arguments); void AcpiDbCloseDebugFile ( diff --git a/sys/contrib/dev/acpica/include/acpixf.h b/sys/contrib/dev/acpica/include/acpixf.h index fa0c5d5..cb7ce52 100644 --- a/sys/contrib/dev/acpica/include/acpixf.h +++ b/sys/contrib/dev/acpica/include/acpixf.h @@ -48,7 +48,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20120816 +#define ACPI_CA_VERSION 0x20120913 #include <contrib/dev/acpica/include/acconfig.h> #include <contrib/dev/acpica/include/actypes.h> diff --git a/sys/contrib/dev/acpica/include/actbl1.h b/sys/contrib/dev/acpica/include/actbl1.h index c95d0c9..d7cc59b 100644 --- a/sys/contrib/dev/acpica/include/actbl1.h +++ b/sys/contrib/dev/acpica/include/actbl1.h @@ -567,7 +567,9 @@ enum AcpiHestNotifyTypes ACPI_HEST_NOTIFY_LOCAL = 2, ACPI_HEST_NOTIFY_SCI = 3, ACPI_HEST_NOTIFY_NMI = 4, - ACPI_HEST_NOTIFY_RESERVED = 5 /* 5 and greater are reserved */ + ACPI_HEST_NOTIFY_CMCI = 5, /* ACPI 5.0 */ + ACPI_HEST_NOTIFY_MCE = 6, /* ACPI 5.0 */ + ACPI_HEST_NOTIFY_RESERVED = 7 /* 7 and greater are reserved */ }; /* Values for ConfigWriteEnable bitfield above */ |