Date: Tue, 31 May 2011 19:45:58 +0000 (UTC) From: Jung-uk Kim <jkim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r222544 - in head/sys: contrib/dev/acpica contrib/dev/acpica/debugger contrib/dev/acpica/include contrib/dev/acpica/tables dev/acpica/Osd Message-ID: <201105311945.p4VJjwMk037631@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jkim Date: Tue May 31 19:45:58 2011 New Revision: 222544 URL: http://svn.freebsd.org/changeset/base/222544 Log: Merge ACPICA 20110527. Modified: head/sys/contrib/dev/acpica/changes.txt head/sys/contrib/dev/acpica/debugger/dbexec.c head/sys/contrib/dev/acpica/debugger/dbinput.c head/sys/contrib/dev/acpica/debugger/dbutils.c head/sys/contrib/dev/acpica/debugger/dbxface.c head/sys/contrib/dev/acpica/include/acconfig.h head/sys/contrib/dev/acpica/include/acdebug.h head/sys/contrib/dev/acpica/include/acglobal.h head/sys/contrib/dev/acpica/include/aclocal.h head/sys/contrib/dev/acpica/include/acpiosxf.h head/sys/contrib/dev/acpica/include/acpixf.h head/sys/contrib/dev/acpica/include/acpredef.h head/sys/contrib/dev/acpica/osunixxf.c head/sys/contrib/dev/acpica/tables/tbinstal.c head/sys/dev/acpica/Osd/OsdDebug.c Directory Properties: head/sys/contrib/dev/acpica/ (props changed) Modified: head/sys/contrib/dev/acpica/changes.txt ============================================================================== --- head/sys/contrib/dev/acpica/changes.txt Tue May 31 19:08:25 2011 (r222543) +++ head/sys/contrib/dev/acpica/changes.txt Tue May 31 19:45:58 2011 (r222544) @@ -1,31 +1,99 @@ ---------------------------------------- +27 May 2011. Summary of changes for version 20110527: + +This release is available at www.acpica.org/downloads + +1) ACPI CA Core Subsystem: + +ASL Load() operator: Reinstate most restrictions on the incoming ACPI table +signature. Now, only allow SSDT, OEMx, and a null signature. History: + 1) Originally, we checked the table signature for "SSDT" or "PSDT". + (PSDT is now obsolete.) + 2) We added support for OEMx tables, signature "OEM" plus a fourth + "don't care" character. + 3) Valid tables were encountered with a null signature, so we just + gave up on validating the signature, (05/2008). + 4) We encountered non-AML tables such as the MADT, which caused + interpreter errors and kernel faults. So now, we once again allow + only SSDT, OEMx, and now, also a null signature. (05/2011). + +Added the missing _TDL predefined name to the global name list in order to +enable validation. Affects both the core ACPICA code and the iASL compiler. + +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 (VC 9.0): + Non-Debug Version: 90.0K Code, 23.8K Data, 113.8K Total + Debug Version: 164.5K Code, 68.0K Data, 232.5K Total + Current Release (VC 9.0): + Non-Debug Version: 90.1K Code, 23.9K Data, 114.0K Total + Debug Version: 165.6K Code, 68.4K Data, 234.0K Total + +2) iASL Compiler/Disassembler and Tools: + +Debugger/AcpiExec: Implemented support for "complex" method arguments on the +debugger command line. This adds support beyond simple integers -- including +Strings, Buffers, and Packages. Includes support for nested packages. +Increased the default command line buffer size to accommodate these arguments. +See the ACPICA reference for details and syntax. ACPICA BZ 917. + +Debugger/AcpiExec: Implemented support for "default" method arguments for the +Execute/Debug command. Now, the debugger will always invoke a control method +with the required number of arguments -- even if the command line specifies +none or insufficient arguments. It uses default integer values for any missing +arguments. Also fixes a bug where only six method arguments maximum were +supported instead of the required seven. + +Debugger/AcpiExec: Add a maximum buffer length parameter to AcpiOsGetLine and +also return status in order to prevent buffer overruns. See the ACPICA +reference for details and syntax. ACPICA BZ 921 + +iASL: Cleaned up support for Berkeley yacc. A general cleanup of code and +makefiles to simplify support for the two different but similar parser +generators, bison and yacc. + +Updated the generic unix makefile for gcc 4. The default gcc version is now +expected to be 4 or greater, since options specific to gcc 4 are used. + +---------------------------------------- 13 April 2011. Summary of changes for version 20110413: 1) ACPI CA Core Subsystem: Implemented support to execute a so-called "orphan" _REG method under the EC -device. This change will force the execution of a _REG method underneath the EC +device. This change will force the execution of a _REG method underneath the +EC device even if there is no corresponding operation region of type EmbeddedControl. Fixes a problem seen on some machines and apparently is compatible with Windows behavior. ACPICA BZ 875. Added more predefined methods that are eligible for automatic NULL package -element removal. This change adds another group of predefined names to the list +element removal. This change adds another group of predefined names to the +list of names that can be repaired by having NULL package elements dynamically removed. This group are those methods that return a single variable-length package containing simple data types such as integers, buffers, strings. This -includes: _ALx, _BCL, _CID,_ DOD, _EDL, _FIX, _PCL, _PLD, _PMD, _PRx, _PSL, _Sx, +includes: _ALx, _BCL, _CID,_ DOD, _EDL, _FIX, _PCL, _PLD, _PMD, _PRx, _PSL, +_Sx, and _TZD. ACPICA BZ 914. -Split and segregated all internal global lock functions to a new file, evglock.c. +Split and segregated all internal global lock functions to a new file, +evglock.c. -Updated internal address SpaceID for DataTable regions. Moved this internal space -id in preparation for ACPI 5.0 changes that will include some new space IDs. This +Updated internal address SpaceID for DataTable regions. Moved this internal +space +id in preparation for ACPI 5.0 changes that will include some new space IDs. +This change should not affect user/host code. -Example Code and Data Size: These are the sizes for the OS-independent acpica.lib +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 +the code includes the debug output trace mechanism and has a much larger code +and data size. Previous Release (VC 9.0): @@ -40,34 +108,44 @@ data size. iASL/DTC: Major update for new grammar features. Allow generic data types in custom ACPI tables. Field names are now optional. Any line can be split to multiple lines using the continuation char (\). Large buffers now use line- -continuation character(s) and no colon on the continuation lines. See the grammar +continuation character(s) and no colon on the continuation lines. See the +grammar update in the iASL compiler reference. ACPI BZ 910,911. Lin Ming, Bob Moore. iASL: Mark ASL "Return()" and the simple "Return" as "Null" return statements. -Since the parser stuffs a "zero" as the return value for these statements (due to +Since the parser stuffs a "zero" as the return value for these statements (due +to the underlying AML grammar), they were seen as "return with value" by the iASL semantic checking. They are now seen correctly as "null" return statements. iASL: Check if a_REG declaration has a corresponding Operation Region. Adds a check for each _REG to ensure that there is in fact a corresponding operation -region declaration in the same scope. If not, the _REG method is not very useful +region declaration in the same scope. If not, the _REG method is not very +useful since it probably won't be executed. ACPICA BZ 915. -iASL/DTC: Finish support for expression evaluation. Added a new expression parser -that implements c-style operator precedence and parenthesization. ACPICA bugzilla +iASL/DTC: Finish support for expression evaluation. Added a new expression +parser +that implements c-style operator precedence and parenthesization. ACPICA +bugzilla 908. -Disassembler/DTC: Remove support for () and <> style comments in data tables. Now -that DTC has full expression support, we don't want to have comment strings that -start with a parentheses or a less-than symbol. Now, only the standard /* and // +Disassembler/DTC: Remove support for () and <> style comments in data tables. +Now +that DTC has full expression support, we don't want to have comment strings +that +start with a parentheses or a less-than symbol. Now, only the standard /* and +// comments are supported, as well as the bracket [] comments. -AcpiXtract: Fix for RSDP and dynamic SSDT extraction. These tables have "unusual" +AcpiXtract: Fix for RSDP and dynamic SSDT extraction. These tables have +"unusual" headers in the acpidump file. Update the header validation to support these tables. Problem introduced in previous AcpiXtract version in the change to support "wrong checksum" error messages emitted by acpidump utility. -iASL: Add a * option to generate all template files (as a synonym for ALL) as in +iASL: Add a * option to generate all template files (as a synonym for ALL) as +in "iasl -T *" or "iasl -T ALL". iASL/DTC: Do not abort compiler on fatal errors. We do not want to completely @@ -81,7 +159,8 @@ invocation. 1) ACPI CA Core Subsystem: Fixed a problem caused by a _PRW method appearing at the namespace root scope -during the setup of wake GPEs. A fault could occur if a _PRW directly under the +during the setup of wake GPEs. A fault could occur if a _PRW directly under +the root object was passed to the AcpiSetupGpeForWake interface. Lin Ming. Implemented support for "spurious" Global Lock interrupts. On some systems, a @@ -89,9 +168,11 @@ global lock interrupt can occur without interrupt, we now ensure that a thread is actually waiting for the lock before signaling GL availability. Rafael Wysocki, Bob Moore. -Example Code and Data Size: These are the sizes for the OS-independent acpica.lib +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 +the code includes the debug output trace mechanism and has a much larger code +and data size. Previous Release (VC 9.0): @@ -108,14 +189,16 @@ header files, disassembler, table compil Lin Ming. AcpiXtract: Correctly handle embedded comments and messages from AcpiDump. -Apparently some or all versions of acpidump will occasionally emit a comment like +Apparently some or all versions of acpidump will occasionally emit a comment +like "Wrong checksum", etc., into the dump file. This was causing problems for AcpiXtract. ACPICA BZ 905. iASL: Fix the Linux makefile by removing an inadvertent double file inclusion. ACPICA BZ 913. -AcpiExec: Update installation of operation region handlers. Install one handler +AcpiExec: Update installation of operation region handlers. Install one +handler for a user-defined address space. This is used by the ASL test suite (ASLTS). ---------------------------------------- Modified: head/sys/contrib/dev/acpica/debugger/dbexec.c ============================================================================== --- head/sys/contrib/dev/acpica/debugger/dbexec.c Tue May 31 19:08:25 2011 (r222543) +++ head/sys/contrib/dev/acpica/debugger/dbexec.c Tue May 31 19:45:58 2011 (r222544) @@ -53,7 +53,8 @@ ACPI_MODULE_NAME ("dbexec") -static ACPI_DB_METHOD_INFO AcpiGbl_DbMethodInfo; +static ACPI_DB_METHOD_INFO AcpiGbl_DbMethodInfo; +#define DB_DEFAULT_PKG_ELEMENTS 33 /* Local prototypes */ @@ -81,6 +82,348 @@ AcpiDbExecutionWalk ( void *Context, void **ReturnValue); +static ACPI_STATUS +AcpiDbHexCharToValue ( + int HexChar, + UINT8 *ReturnValue); + +static ACPI_STATUS +AcpiDbConvertToPackage ( + char *String, + ACPI_OBJECT *Object); + +static ACPI_STATUS +AcpiDbConvertToObject ( + ACPI_OBJECT_TYPE Type, + char *String, + ACPI_OBJECT *Object); + +static void +AcpiDbDeleteObjects ( + UINT32 Count, + ACPI_OBJECT *Objects); + + +/******************************************************************************* + * + * FUNCTION: AcpiDbHexCharToValue + * + * PARAMETERS: HexChar - Ascii Hex digit, 0-9|a-f|A-F + * ReturnValue - Where the converted value is returned + * + * RETURN: Status + * + * DESCRIPTION: Convert a single hex character to a 4-bit number (0-16). + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDbHexCharToValue ( + int HexChar, + UINT8 *ReturnValue) +{ + UINT8 Value; + + + /* Digit must be ascii [0-9a-fA-F] */ + + if (!ACPI_IS_XDIGIT (HexChar)) + { + return (AE_BAD_HEX_CONSTANT); + } + + if (HexChar <= 0x39) + { + Value = (UINT8) (HexChar - 0x30); + } + else + { + Value = (UINT8) (ACPI_TOUPPER (HexChar) - 0x37); + } + + *ReturnValue = Value; + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbHexByteToBinary + * + * PARAMETERS: HexByte - Double hex digit (0x00 - 0xFF) in format: + * HiByte then LoByte. + * ReturnValue - Where the converted value is returned + * + * RETURN: Status + * + * DESCRIPTION: Convert two hex characters to an 8 bit number (0 - 255). + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDbHexByteToBinary ( + char *HexByte, + UINT8 *ReturnValue) +{ + UINT8 Local0; + UINT8 Local1; + ACPI_STATUS Status; + + + /* High byte */ + + Status = AcpiDbHexCharToValue (HexByte[0], &Local0); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Low byte */ + + Status = AcpiDbHexCharToValue (HexByte[1], &Local1); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + *ReturnValue = (UINT8) ((Local0 << 4) | Local1); + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbConvertToBuffer + * + * PARAMETERS: String - Input string to be converted + * Object - Where the buffer object is returned + * + * RETURN: Status + * + * DESCRIPTION: Convert a string to a buffer object. String is treated a list + * of buffer elements, each separated by a space or comma. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDbConvertToBuffer ( + char *String, + ACPI_OBJECT *Object) +{ + UINT32 i; + UINT32 j; + UINT32 Length; + UINT8 *Buffer; + ACPI_STATUS Status; + + + /* Generate the final buffer length */ + + for (i = 0, Length = 0; String[i];) + { + i+=2; + Length++; + + while (String[i] && + ((String[i] == ',') || (String[i] == ' '))) + { + i++; + } + } + + Buffer = ACPI_ALLOCATE (Length); + if (!Buffer) + { + return (AE_NO_MEMORY); + } + + /* Convert the command line bytes to the buffer */ + + for (i = 0, j = 0; String[i];) + { + Status = AcpiDbHexByteToBinary (&String[i], &Buffer[j]); + if (ACPI_FAILURE (Status)) + { + ACPI_FREE (Buffer); + return (Status); + } + + j++; + i+=2; + while (String[i] && + ((String[i] == ',') || (String[i] == ' '))) + { + i++; + } + } + + Object->Type = ACPI_TYPE_BUFFER; + Object->Buffer.Pointer = Buffer; + Object->Buffer.Length = Length; + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbConvertToPackage + * + * PARAMETERS: String - Input string to be converted + * Object - Where the package object is returned + * + * RETURN: Status + * + * DESCRIPTION: Convert a string to a package object. Handles nested packages + * via recursion with AcpiDbConvertToObject. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDbConvertToPackage ( + char *String, + ACPI_OBJECT *Object) +{ + char *This; + char *Next; + UINT32 i; + ACPI_OBJECT_TYPE Type; + ACPI_OBJECT *Elements; + ACPI_STATUS Status; + + + Elements = ACPI_ALLOCATE_ZEROED ( + DB_DEFAULT_PKG_ELEMENTS * sizeof (ACPI_OBJECT)); + + This = String; + for (i = 0; i < (DB_DEFAULT_PKG_ELEMENTS - 1); i++) + { + This = AcpiDbGetNextToken (This, &Next, &Type); + if (!This) + { + break; + } + + /* Recursive call to convert each package element */ + + Status = AcpiDbConvertToObject (Type, This, &Elements[i]); + if (ACPI_FAILURE (Status)) + { + AcpiDbDeleteObjects (i + 1, Elements); + ACPI_FREE (Elements); + return (Status); + } + + This = Next; + } + + Object->Type = ACPI_TYPE_PACKAGE; + Object->Package.Count = i; + Object->Package.Elements = Elements; + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbConvertToObject + * + * PARAMETERS: Type - Object type as determined by parser + * String - Input string to be converted + * Object - Where the new object is returned + * + * RETURN: Status + * + * DESCRIPTION: Convert a typed and tokenized string to an ACPI_OBJECT. Typing: + * 1) String objects were surrounded by quotes. + * 2) Buffer objects were surrounded by parentheses. + * 3) Package objects were surrounded by brackets "[]". + * 4) All standalone tokens are treated as integers. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDbConvertToObject ( + ACPI_OBJECT_TYPE Type, + char *String, + ACPI_OBJECT *Object) +{ + ACPI_STATUS Status = AE_OK; + + + switch (Type) + { + case ACPI_TYPE_STRING: + Object->Type = ACPI_TYPE_STRING; + Object->String.Pointer = String; + Object->String.Length = (UINT32) ACPI_STRLEN (String); + break; + + case ACPI_TYPE_BUFFER: + Status = AcpiDbConvertToBuffer (String, Object); + break; + + case ACPI_TYPE_PACKAGE: + Status = AcpiDbConvertToPackage (String, Object); + break; + + default: + Object->Type = ACPI_TYPE_INTEGER; + Status = AcpiUtStrtoul64 (String, 16, &Object->Integer.Value); + break; + } + + return (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbDeleteObjects + * + * PARAMETERS: Count - Count of objects in the list + * Objects - Array of ACPI_OBJECTs to be deleted + * + * RETURN: None + * + * DESCRIPTION: Delete a list of ACPI_OBJECTS. Handles packages and nested + * packages via recursion. + * + ******************************************************************************/ + +static void +AcpiDbDeleteObjects ( + UINT32 Count, + ACPI_OBJECT *Objects) +{ + UINT32 i; + + + for (i = 0; i < Count; i++) + { + switch (Objects[i].Type) + { + case ACPI_TYPE_BUFFER: + ACPI_FREE (Objects[i].Buffer.Pointer); + break; + + case ACPI_TYPE_PACKAGE: + + /* Recursive call to delete package elements */ + + AcpiDbDeleteObjects (Objects[i].Package.Count, + Objects[i].Package.Elements); + + /* Free the elements array */ + + ACPI_FREE (Objects[i].Package.Elements); + break; + + default: + break; + } + } +} + /******************************************************************************* * @@ -104,8 +447,8 @@ AcpiDbExecuteMethod ( ACPI_OBJECT_LIST ParamObjects; ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS]; ACPI_HANDLE Handle; - UINT32 i; ACPI_DEVICE_INFO *ObjInfo; + UINT32 i; ACPI_FUNCTION_TRACE (DbExecuteMethod); @@ -139,25 +482,37 @@ AcpiDbExecuteMethod ( { /* Are there arguments to the method? */ + i = 0; if (Info->Args && Info->Args[0]) { - for (i = 0; Info->Args[i] && + /* Get arguments passed on the command line */ + + for (; Info->Args[i] && (i < ACPI_METHOD_NUM_ARGS) && (i < ObjInfo->ParamCount); i++) { - Params[i].Type = ACPI_TYPE_INTEGER; - Params[i].Integer.Value = ACPI_STRTOUL (Info->Args[i], NULL, 16); - } + /* Convert input string (token) to an actual ACPI_OBJECT */ - ParamObjects.Pointer = Params; - ParamObjects.Count = i; + Status = AcpiDbConvertToObject (Info->Types[i], + Info->Args[i], &Params[i]); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, + "While parsing method arguments")); + goto Cleanup; + } + } } - else + + /* Create additional "default" parameters as needed */ + + if (i < ObjInfo->ParamCount) { - /* Setup default parameters */ + AcpiOsPrintf ("Adding %u arguments containing default values\n", + ObjInfo->ParamCount - i); - for (i = 0; i < ObjInfo->ParamCount; i++) + for (; i < ObjInfo->ParamCount; i++) { switch (i) { @@ -181,13 +536,11 @@ AcpiDbExecuteMethod ( break; } } - - ParamObjects.Pointer = Params; - ParamObjects.Count = ObjInfo->ParamCount; } - } - ACPI_FREE (ObjInfo); + ParamObjects.Count = ObjInfo->ParamCount; + ParamObjects.Pointer = Params; + } /* Prepare for a return object of arbitrary size */ @@ -198,7 +551,7 @@ AcpiDbExecuteMethod ( AcpiGbl_MethodExecuting = TRUE; Status = AcpiEvaluateObject (NULL, - Info->Pathname, &ParamObjects, ReturnObj); + Info->Pathname, &ParamObjects, ReturnObj); AcpiGbl_CmSingleStep = FALSE; AcpiGbl_MethodExecuting = FALSE; @@ -206,16 +559,20 @@ AcpiDbExecuteMethod ( if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, - "while executing %s from debugger", Info->Pathname)); + "while executing %s from debugger", Info->Pathname)); 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)); } } +Cleanup: + AcpiDbDeleteObjects (ObjInfo->ParamCount, Params); + ACPI_FREE (ObjInfo); + return_ACPI_STATUS (Status); } @@ -380,6 +737,7 @@ void AcpiDbExecute ( char *Name, char **Args, + ACPI_OBJECT_TYPE *Types, UINT32 Flags) { ACPI_STATUS Status; @@ -417,6 +775,7 @@ AcpiDbExecute ( AcpiUtStrupr (NameString); AcpiGbl_DbMethodInfo.Name = NameString; AcpiGbl_DbMethodInfo.Args = Args; + AcpiGbl_DbMethodInfo.Types = Types; AcpiGbl_DbMethodInfo.Flags = Flags; ReturnObj.Pointer = NULL; @@ -529,6 +888,8 @@ AcpiDbMethodThread ( LocalInfo.Arguments[2] = LocalInfo.IndexOfThreadStr; LocalInfo.Arguments[3] = NULL; + LocalInfo.Types = LocalInfo.ArgTypes; + (void) AcpiOsSignalSemaphore (Info->InfoGate, 1); for (i = 0; i < Info->NumLoops; i++) @@ -696,6 +1057,12 @@ AcpiDbCreateExecutionThreads ( AcpiGbl_DbMethodInfo.Arguments[1] = AcpiGbl_DbMethodInfo.IdOfThreadStr; AcpiGbl_DbMethodInfo.Arguments[2] = AcpiGbl_DbMethodInfo.IndexOfThreadStr; AcpiGbl_DbMethodInfo.Arguments[3] = NULL; + + AcpiGbl_DbMethodInfo.Types = AcpiGbl_DbMethodInfo.ArgTypes; + AcpiGbl_DbMethodInfo.ArgTypes[0] = ACPI_TYPE_INTEGER; + AcpiGbl_DbMethodInfo.ArgTypes[1] = ACPI_TYPE_INTEGER; + AcpiGbl_DbMethodInfo.ArgTypes[2] = ACPI_TYPE_INTEGER; + AcpiDbUInt32ToHexString (NumThreads, AcpiGbl_DbMethodInfo.NumThreadsStr); AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo); Modified: head/sys/contrib/dev/acpica/debugger/dbinput.c ============================================================================== --- head/sys/contrib/dev/acpica/debugger/dbinput.c Tue May 31 19:08:25 2011 (r222543) +++ head/sys/contrib/dev/acpica/debugger/dbinput.c Tue May 31 19:45:58 2011 (r222544) @@ -54,11 +54,6 @@ /* Local prototypes */ -static char * -AcpiDbGetNextToken ( - char *String, - char **Next); - static UINT32 AcpiDbGetLine ( char *InputBuffer); @@ -285,6 +280,10 @@ AcpiDbDisplayHelp ( 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"); @@ -318,12 +317,15 @@ AcpiDbDisplayHelp ( * ******************************************************************************/ -static char * +char * AcpiDbGetNextToken ( char *String, - char **Next) + char **Next, + ACPI_OBJECT_TYPE *ReturnType) { char *Start; + UINT32 Depth; + ACPI_OBJECT_TYPE Type = ACPI_TYPE_INTEGER; /* At end of buffer? */ @@ -333,7 +335,7 @@ AcpiDbGetNextToken ( return (NULL); } - /* Get rid of any spaces at the beginning */ + /* Remove any spaces at the beginning */ if (*String == ' ') { @@ -348,22 +350,88 @@ AcpiDbGetNextToken ( } } - if (*String == '"') + switch (*String) { + case '"': + /* This is a quoted string, scan until closing quote */ String++; Start = String; + Type = ACPI_TYPE_STRING; - /* Find end of token */ + /* Find end of string */ while (*String && (*String != '"')) { String++; } - } - else - { + break; + + case '(': + + /* This is the start of a buffer, scan until closing paren */ + + String++; + Start = String; + Type = ACPI_TYPE_BUFFER; + + /* Find end of buffer */ + + while (*String && (*String != ')')) + { + String++; + } + break; + + case '[': + + /* This is the start of a package, scan until closing bracket */ + + String++; + Depth = 1; + Start = String; + Type = ACPI_TYPE_PACKAGE; + + /* Find end of package (closing bracket) */ + + while (*String) + { + /* Handle String package elements */ + + if (*String == '"') + { + /* Find end of string */ + + String++; + while (*String && (*String != '"')) + { + String++; + } + if (!(*String)) + { + break; + } + } + else if (*String == '[') + { + Depth++; /* A nested package declaration */ + } + else if (*String == ']') + { + Depth--; + if (Depth == 0) /* Found final package closing bracket */ + { + break; + } + } + + String++; + } + break; + + default: + Start = String; /* Find end of token */ @@ -372,6 +440,7 @@ AcpiDbGetNextToken ( { String++; } + break; } if (!(*String)) @@ -384,6 +453,7 @@ AcpiDbGetNextToken ( *Next = String + 1; } + *ReturnType = Type; return (Start); } @@ -416,7 +486,8 @@ AcpiDbGetLine ( This = AcpiGbl_DbParsedBuf; for (i = 0; i < ACPI_DEBUGGER_MAX_ARGS; i++) { - AcpiGbl_DbArgs[i] = AcpiDbGetNextToken (This, &Next); + AcpiGbl_DbArgs[i] = AcpiDbGetNextToken (This, &Next, + &AcpiGbl_DbArgTypes[i]); if (!AcpiGbl_DbArgs[i]) { break; @@ -575,7 +646,8 @@ AcpiDbCommandDispatch ( break; case CMD_DEBUG: - AcpiDbExecute (AcpiGbl_DbArgs[1], &AcpiGbl_DbArgs[2], EX_SINGLE_STEP); + AcpiDbExecute (AcpiGbl_DbArgs[1], + &AcpiGbl_DbArgs[2], &AcpiGbl_DbArgTypes[2], EX_SINGLE_STEP); break; case CMD_DISASSEMBLE: @@ -601,7 +673,7 @@ AcpiDbCommandDispatch ( case CMD_EXECUTE: AcpiDbExecute (AcpiGbl_DbArgs[1], - &AcpiGbl_DbArgs[2], EX_NO_SINGLE_STEP); + &AcpiGbl_DbArgs[2], &AcpiGbl_DbArgTypes[2], EX_NO_SINGLE_STEP); break; case CMD_FIND: @@ -961,7 +1033,13 @@ AcpiDbUserCommands ( /* Get the user input line */ - (void) AcpiOsGetLine (AcpiGbl_DbLineBuf); + Status = AcpiOsGetLine (AcpiGbl_DbLineBuf, + ACPI_DB_LINE_BUFFER_SIZE, NULL); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, "While parsing command line")); + return (Status); + } /* Check for single or multithreaded debug */ Modified: head/sys/contrib/dev/acpica/debugger/dbutils.c ============================================================================== --- head/sys/contrib/dev/acpica/debugger/dbutils.c Tue May 31 19:08:25 2011 (r222543) +++ head/sys/contrib/dev/acpica/debugger/dbutils.c Tue May 31 19:45:58 2011 (r222544) @@ -382,7 +382,7 @@ AcpiDbUInt32ToHexString ( UINT32 Value, char *Buffer) { - UINT8 i; + int i; if (Value == 0) @@ -391,10 +391,9 @@ AcpiDbUInt32ToHexString ( return; } - ACPI_STRCPY (Buffer, "0x"); - Buffer[10] = '\0'; + Buffer[8] = '\0'; - for (i = 9; i > 1; i--) + for (i = 7; i >= 0; i--) { Buffer[i] = Converter [Value & 0x0F]; Value = Value >> 4; Modified: head/sys/contrib/dev/acpica/debugger/dbxface.c ============================================================================== --- head/sys/contrib/dev/acpica/debugger/dbxface.c Tue May 31 19:08:25 2011 (r222543) +++ head/sys/contrib/dev/acpica/debugger/dbxface.c Tue May 31 19:45:58 2011 (r222544) @@ -137,7 +137,13 @@ AcpiDbStartCommand ( /* Get the user input line */ - (void) AcpiOsGetLine (AcpiGbl_DbLineBuf); + Status = AcpiOsGetLine (AcpiGbl_DbLineBuf, + ACPI_DB_LINE_BUFFER_SIZE, NULL); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, "While parsing command line")); + return (Status); + } } Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, WalkState, Op); Modified: head/sys/contrib/dev/acpica/include/acconfig.h ============================================================================== --- head/sys/contrib/dev/acpica/include/acconfig.h Tue May 31 19:08:25 2011 (r222543) +++ head/sys/contrib/dev/acpica/include/acconfig.h Tue May 31 19:45:58 2011 (r222544) @@ -200,7 +200,8 @@ * *****************************************************************************/ -#define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */ +#define ACPI_DEBUGGER_MAX_ARGS ACPI_METHOD_NUM_ARGS + 2 /* Max command line arguments */ +#define ACPI_DB_LINE_BUFFER_SIZE 512 #define ACPI_DEBUGGER_COMMAND_PROMPT '-' #define ACPI_DEBUGGER_EXECUTE_PROMPT '%' Modified: head/sys/contrib/dev/acpica/include/acdebug.h ============================================================================== --- head/sys/contrib/dev/acpica/include/acdebug.h Tue May 31 19:08:25 2011 (r222543) +++ head/sys/contrib/dev/acpica/include/acdebug.h Tue May 31 19:45:58 2011 (r222544) @@ -277,6 +277,7 @@ void AcpiDbExecute ( char *Name, char **Args, + ACPI_OBJECT_TYPE *Types, UINT32 Flags); void @@ -357,6 +358,12 @@ AcpiDbUserCommands ( char Prompt, ACPI_PARSE_OBJECT *Op); +char * +AcpiDbGetNextToken ( + char *String, + char **Next, + ACPI_OBJECT_TYPE *ReturnType); + /* * dbstats - Generation and display of ACPI table statistics Modified: head/sys/contrib/dev/acpica/include/acglobal.h ============================================================================== --- head/sys/contrib/dev/acpica/include/acglobal.h Tue May 31 19:08:25 2011 (r222543) +++ head/sys/contrib/dev/acpica/include/acglobal.h Tue May 31 19:45:58 2011 (r222544) @@ -425,10 +425,11 @@ ACPI_EXTERN BOOLEAN ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_NoRegionSupport; *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105311945.p4VJjwMk037631>