aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2011-05-31 17:33:30 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2011-05-31 17:33:30 +0000
commiteb16cf140e9ac2743140a477895264ce7dd69ec0 (patch)
treea4b5e9ea11023a137a0c3714f61e913e6ee89686
parent848049e223ef408a308cd85e7784b4ea4bc6e54a (diff)
downloadsrc-eb16cf140e9ac2743140a477895264ce7dd69ec0.tar.gz
src-eb16cf140e9ac2743140a477895264ce7dd69ec0.zip
Import ACPICA 20110527.vendor/acpica/20110527
Notes
Notes: svn path=/vendor-sys/acpica/dist/; revision=222538 svn path=/vendor-sys/acpica/20110527/; revision=222539; tag=vendor/acpica/20110527
-rw-r--r--changes.txt129
-rw-r--r--debugger/dbexec.c405
-rw-r--r--debugger/dbinput.c112
-rw-r--r--debugger/dbutils.c7
-rw-r--r--debugger/dbxface.c8
-rw-r--r--generate/unix/Makefile.config4
-rw-r--r--include/acconfig.h3
-rw-r--r--include/acdebug.h7
-rw-r--r--include/acglobal.h9
-rw-r--r--include/aclocal.h2
-rw-r--r--include/acpiosxf.h6
-rw-r--r--include/acpixf.h2
-rw-r--r--include/acpredef.h1
-rw-r--r--os_specific/service_layers/osunixxf.c24
-rw-r--r--os_specific/service_layers/oswinxf.c23
-rw-r--r--osunixxf.c24
-rw-r--r--tables/tbinstal.c26
-rw-r--r--tools/acpiexec/aemain.c2
18 files changed, 698 insertions, 96 deletions
diff --git a/changes.txt b/changes.txt
index 68dda91e7013..f53fd426da4a 100644
--- a/changes.txt
+++ b/changes.txt
@@ -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 the pending flag being set. Upon a GL
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 compiler, and template generator. Bob Moore,
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).
----------------------------------------
diff --git a/debugger/dbexec.c b/debugger/dbexec.c
index b66fa2930a9b..bcbc7a8daf69 100644
--- a/debugger/dbexec.c
+++ b/debugger/dbexec.c
@@ -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);
diff --git a/debugger/dbinput.c b/debugger/dbinput.c
index dffa531ceea3..1d716cfb1bd2 100644
--- a/debugger/dbinput.c
+++ b/debugger/dbinput.c
@@ -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 */
diff --git a/debugger/dbutils.c b/debugger/dbutils.c
index 346d6c087e58..5b071e87b61b 100644
--- a/debugger/dbutils.c
+++ b/debugger/dbutils.c
@@ -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;
diff --git a/debugger/dbxface.c b/debugger/dbxface.c
index 9578f992486e..e638733c2256 100644
--- a/debugger/dbxface.c
+++ b/debugger/dbxface.c
@@ -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);
diff --git a/generate/unix/Makefile.config b/generate/unix/Makefile.config
index 8a32bdfd40ba..c9bf6873a214 100644
--- a/generate/unix/Makefile.config
+++ b/generate/unix/Makefile.config
@@ -9,9 +9,11 @@
#
# Configuration
+# Note: gcc should be version 4 or greater, otherwise some of the
+# options used won't be recognized (see below)
#
HOST = _CYGWIN
-CC = gcc-4
+CC = gcc
ACPICA_SRC = ../../../source
DIRS = acpiexec acpinames acpisrc acpixtract iasl
INSTALLDIR = /usr/bin
diff --git a/include/acconfig.h b/include/acconfig.h
index 4b05ed383105..7a2107aa7699 100644
--- a/include/acconfig.h
+++ b/include/acconfig.h
@@ -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 '%'
diff --git a/include/acdebug.h b/include/acdebug.h
index 9b4822d14ae1..2c1fe73429d1 100644
--- a/include/acdebug.h
+++ b/include/acdebug.h
@@ -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
diff --git a/include/acglobal.h b/include/acglobal.h
index fc20994fea42..ebbae0f59597 100644
--- a/include/acglobal.h
+++ b/include/acglobal.h
@@ -425,10 +425,11 @@ ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_ini_methods;
ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_NoRegionSupport;
ACPI_EXTERN char *AcpiGbl_DbArgs[ACPI_DEBUGGER_MAX_ARGS];
-ACPI_EXTERN char AcpiGbl_DbLineBuf[80];
-ACPI_EXTERN char AcpiGbl_DbParsedBuf[80];
-ACPI_EXTERN char AcpiGbl_DbScopeBuf[40];
-ACPI_EXTERN char AcpiGbl_DbDebugFilename[40];
+ACPI_EXTERN ACPI_OBJECT_TYPE AcpiGbl_DbArgTypes[ACPI_DEBUGGER_MAX_ARGS];
+ACPI_EXTERN char AcpiGbl_DbLineBuf[ACPI_DB_LINE_BUFFER_SIZE];
+ACPI_EXTERN char AcpiGbl_DbParsedBuf[ACPI_DB_LINE_BUFFER_SIZE];
+ACPI_EXTERN char AcpiGbl_DbScopeBuf[80];
+ACPI_EXTERN char AcpiGbl_DbDebugFilename[80];
ACPI_EXTERN BOOLEAN AcpiGbl_DbOutputToFile;
ACPI_EXTERN char *AcpiGbl_DbBuffer;
ACPI_EXTERN char *AcpiGbl_DbFilename;
diff --git a/include/aclocal.h b/include/aclocal.h
index bdefb7671f60..2eb6fc21d465 100644
--- a/include/aclocal.h
+++ b/include/aclocal.h
@@ -1198,6 +1198,7 @@ typedef struct acpi_db_method_info
UINT32 NumLoops;
char Pathname[128];
char **Args;
+ ACPI_OBJECT_TYPE *Types;
/*
* Arguments to be passed to method for the command
@@ -1206,6 +1207,7 @@ typedef struct acpi_db_method_info
* Index of current thread inside all them created.
*/
char InitArgs;
+ ACPI_OBJECT_TYPE ArgTypes[4];
char *Arguments[4];
char NumThreadsStr[11];
char IdOfThreadStr[11];
diff --git a/include/acpiosxf.h b/include/acpiosxf.h
index 7560b37b501b..85b0ff61088b 100644
--- a/include/acpiosxf.h
+++ b/include/acpiosxf.h
@@ -376,9 +376,11 @@ AcpiOsRedirectOutput (
/*
* Debug input
*/
-UINT32
+ACPI_STATUS
AcpiOsGetLine (
- char *Buffer);
+ char *Buffer,
+ UINT32 BufferLength,
+ UINT32 *BytesRead);
/*
diff --git a/include/acpixf.h b/include/acpixf.h
index 37074d9289f7..82b677e615cc 100644
--- a/include/acpixf.h
+++ b/include/acpixf.h
@@ -48,7 +48,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
-#define ACPI_CA_VERSION 0x20110413
+#define ACPI_CA_VERSION 0x20110527
#include "actypes.h"
#include "actbl.h"
diff --git a/include/acpredef.h b/include/acpredef.h
index 884f118043a1..0496767a8675 100644
--- a/include/acpredef.h
+++ b/include/acpredef.h
@@ -470,6 +470,7 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] =
{{"_SWS", 0, ACPI_RTYPE_INTEGER}},
{{"_TC1", 0, ACPI_RTYPE_INTEGER}},
{{"_TC2", 0, ACPI_RTYPE_INTEGER}},
+ {{"_TDL", 0, ACPI_RTYPE_INTEGER}},
{{"_TIP", 1, ACPI_RTYPE_INTEGER}},
{{"_TIV", 1, ACPI_RTYPE_INTEGER}},
{{"_TMP", 0, ACPI_RTYPE_INTEGER}},
diff --git a/os_specific/service_layers/osunixxf.c b/os_specific/service_layers/osunixxf.c
index 8a23d3635b72..434e5fe1a41e 100644
--- a/os_specific/service_layers/osunixxf.c
+++ b/os_specific/service_layers/osunixxf.c
@@ -311,18 +311,21 @@ AcpiOsVprintf (
*
* FUNCTION: AcpiOsGetLine
*
- * PARAMETERS: fmt - Standard printf format
- * args - Argument list
+ * PARAMETERS: Buffer - Where to return the command line
+ * BufferLength - Maximum length of Buffer
+ * BytesRead - Where the actual byte count is returned
*
- * RETURN: Actual bytes read
+ * RETURN: Status and actual bytes read
*
* DESCRIPTION: Formatted input with argument list pointer
*
*****************************************************************************/
-UINT32
+ACPI_STATUS
AcpiOsGetLine (
- char *Buffer)
+ char *Buffer,
+ UINT32 BufferLength,
+ UINT32 *BytesRead)
{
UINT8 Temp;
UINT32 i;
@@ -330,6 +333,11 @@ AcpiOsGetLine (
for (i = 0; ; i++)
{
+ if (i >= BufferLength)
+ {
+ return (AE_BUFFER_OVERFLOW);
+ }
+
scanf ("%1c", &Temp);
if (!Temp || Temp == '\n')
{
@@ -345,7 +353,11 @@ AcpiOsGetLine (
/* Return the number of bytes in the string */
- return (i);
+ if (BytesRead)
+ {
+ *BytesRead = i;
+ }
+ return (AE_OK);
}
diff --git a/os_specific/service_layers/oswinxf.c b/os_specific/service_layers/oswinxf.c
index c9545216eb9c..e8a49190ecf9 100644
--- a/os_specific/service_layers/oswinxf.c
+++ b/os_specific/service_layers/oswinxf.c
@@ -477,17 +477,21 @@ AcpiOsVprintf (
*
* FUNCTION: AcpiOsGetLine
*
- * PARAMETERS: Buffer - Where to store the line
+ * PARAMETERS: Buffer - Where to return the command line
+ * BufferLength - Maximum length of Buffer
+ * BytesRead - Where the actual byte count is returned
*
- * RETURN: Actual bytes read
+ * RETURN: Status and actual bytes read
*
* DESCRIPTION: Formatted input with argument list pointer
*
*****************************************************************************/
-UINT32
+ACPI_STATUS
AcpiOsGetLine (
- char *Buffer)
+ char *Buffer,
+ UINT32 BufferLength,
+ UINT32 *BytesRead)
{
char Temp;
UINT32 i;
@@ -495,6 +499,11 @@ AcpiOsGetLine (
for (i = 0; ; i++)
{
+ if (i >= BufferLength)
+ {
+ return (AE_BUFFER_OVERFLOW);
+ }
+
scanf ("%1c", &Temp);
if (!Temp || Temp == '\n')
{
@@ -510,7 +519,11 @@ AcpiOsGetLine (
/* Return the number of bytes in the string */
- return (i);
+ if (BytesRead)
+ {
+ *BytesRead = i;
+ }
+ return (AE_OK);
}
diff --git a/osunixxf.c b/osunixxf.c
index 8a23d3635b72..434e5fe1a41e 100644
--- a/osunixxf.c
+++ b/osunixxf.c
@@ -311,18 +311,21 @@ AcpiOsVprintf (
*
* FUNCTION: AcpiOsGetLine
*
- * PARAMETERS: fmt - Standard printf format
- * args - Argument list
+ * PARAMETERS: Buffer - Where to return the command line
+ * BufferLength - Maximum length of Buffer
+ * BytesRead - Where the actual byte count is returned
*
- * RETURN: Actual bytes read
+ * RETURN: Status and actual bytes read
*
* DESCRIPTION: Formatted input with argument list pointer
*
*****************************************************************************/
-UINT32
+ACPI_STATUS
AcpiOsGetLine (
- char *Buffer)
+ char *Buffer,
+ UINT32 BufferLength,
+ UINT32 *BytesRead)
{
UINT8 Temp;
UINT32 i;
@@ -330,6 +333,11 @@ AcpiOsGetLine (
for (i = 0; ; i++)
{
+ if (i >= BufferLength)
+ {
+ return (AE_BUFFER_OVERFLOW);
+ }
+
scanf ("%1c", &Temp);
if (!Temp || Temp == '\n')
{
@@ -345,7 +353,11 @@ AcpiOsGetLine (
/* Return the number of bytes in the string */
- return (i);
+ if (BytesRead)
+ {
+ *BytesRead = i;
+ }
+ return (AE_OK);
}
diff --git a/tables/tbinstal.c b/tables/tbinstal.c
index 0876987858bd..ab69691a1e3a 100644
--- a/tables/tbinstal.c
+++ b/tables/tbinstal.c
@@ -144,12 +144,28 @@ AcpiTbAddTable (
}
/*
- * Originally, we checked the table signature for "SSDT" or "PSDT" here.
- * Next, we added support for OEMx tables, signature "OEM".
- * Valid tables were encountered with a null signature, so we've just
- * given up on validating the signature, since it seems to be a waste
- * of code. The original code was removed (05/2008).
+ * Validate the incoming table signature.
+ *
+ * 1) Originally, we checked the table signature for "SSDT" or "PSDT".
+ * 2) We added support for OEMx tables, signature "OEM".
+ * 3) Valid tables were encountered with a null signature, so we just
+ * gave up on validating the signature, (05/2008).
+ * 4) We encountered non-AML tables such as the MADT, which caused
+ * interpreter errors and kernel faults. So now, we once again allow
+ * only "SSDT", "OEMx", and now, also a null signature. (05/2011).
*/
+ if ((TableDesc->Pointer->Signature[0] != 0x00) &&
+ (!ACPI_COMPARE_NAME (TableDesc->Pointer->Signature, ACPI_SIG_SSDT)) &&
+ (ACPI_STRNCMP (TableDesc->Pointer->Signature, "OEM", 3)))
+ {
+ ACPI_ERROR ((AE_INFO,
+ "Table has invalid signature [%4.4s] (0x%8.8X), must be SSDT or OEMx",
+ AcpiUtValidAcpiName (*(UINT32 *) TableDesc->Pointer->Signature) ?
+ TableDesc->Pointer->Signature : "????",
+ *(UINT32 *) TableDesc->Pointer->Signature));
+
+ return_ACPI_STATUS (AE_BAD_SIGNATURE);
+ }
(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
diff --git a/tools/acpiexec/aemain.c b/tools/acpiexec/aemain.c
index 5c59573dcd8e..ec1801c6d0d8 100644
--- a/tools/acpiexec/aemain.c
+++ b/tools/acpiexec/aemain.c
@@ -659,7 +659,7 @@ enterloop:
}
else if (AcpiGbl_BatchMode == 2)
{
- AcpiDbExecute (BatchBuffer, NULL, EX_NO_SINGLE_STEP);
+ AcpiDbExecute (BatchBuffer, NULL, NULL, EX_NO_SINGLE_STEP);
}
else
{