aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2016-12-23 04:35:14 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2016-12-23 04:35:14 +0000
commitf2e6c39316f68b7ccc7abb766f82ed421c8e22b4 (patch)
tree2c9acd96afc9afb47a31a88c97ac4907faee46d9
parenta56e3c255d5c5dfa4dd3a2fda4705a1607a6b7f3 (diff)
downloadsrc-f2e6c39316f68b7ccc7abb766f82ed421c8e22b4.tar.gz
src-f2e6c39316f68b7ccc7abb766f82ed421c8e22b4.zip
Import ACPICA 20161222.vendor/acpica/20161222
Notes
Notes: svn path=/vendor-sys/acpica/dist/; revision=310450 svn path=/vendor-sys/acpica/20161222/; revision=310451; tag=vendor/acpica/20161222
-rw-r--r--changes.txt89
-rw-r--r--generate/unix/acpiexec/Makefile1
-rw-r--r--generate/unix/acpihelp/Makefile2
-rw-r--r--source/common/acfileio.c2
-rw-r--r--source/common/ahtable.c6
-rw-r--r--source/common/ahuuids.c4
-rw-r--r--source/compiler/aslutils.c2
-rw-r--r--source/components/debugger/dbinput.c111
-rw-r--r--source/components/debugger/dbxface.c70
-rw-r--r--source/components/disassembler/dmopcode.c465
-rw-r--r--source/components/disassembler/dmwalk.c31
-rw-r--r--source/components/executer/exconfig.c2
-rw-r--r--source/components/executer/exfldio.c15
-rw-r--r--source/components/hardware/hwesleep.c27
-rw-r--r--source/components/hardware/hwregs.c230
-rw-r--r--source/components/hardware/hwsleep.c10
-rw-r--r--source/components/parser/psargs.c26
-rw-r--r--source/components/parser/pstree.c2
-rw-r--r--source/components/utilities/utclib.c142
-rw-r--r--source/components/utilities/utdecode.c4
-rw-r--r--source/components/utilities/utdelete.c5
-rw-r--r--source/components/utilities/utmutex.c19
-rw-r--r--source/components/utilities/utresrc.c2
-rw-r--r--source/include/acclib.h38
-rw-r--r--source/include/acdebug.h3
-rw-r--r--source/include/acdisasm.h6
-rw-r--r--source/include/acexcep.h8
-rw-r--r--source/include/acglobal.h5
-rw-r--r--source/include/aclocal.h7
-rw-r--r--source/include/acmacros.h85
-rw-r--r--source/include/acpiosxf.h34
-rw-r--r--source/include/acpixf.h15
-rw-r--r--source/include/platform/acefi.h4
-rw-r--r--source/include/platform/acefiex.h52
-rw-r--r--source/include/platform/acenv.h5
-rw-r--r--source/include/platform/aclinux.h5
-rw-r--r--source/include/platform/aclinuxex.h14
-rw-r--r--source/os_specific/service_layers/osgendbg.c366
-rw-r--r--source/os_specific/service_layers/osunixxf.c27
-rw-r--r--source/os_specific/service_layers/oswinxf.c27
-rw-r--r--source/tools/acpiexec/aemain.c65
-rw-r--r--source/tools/acpihelp/acpihelp.h74
-rw-r--r--source/tools/acpihelp/ahaml.c349
-rw-r--r--source/tools/acpihelp/ahamlops.c2
-rw-r--r--source/tools/acpihelp/ahasl.c319
-rw-r--r--source/tools/acpihelp/ahaslkey.c4
-rw-r--r--source/tools/acpihelp/ahaslops.c2
-rw-r--r--source/tools/acpihelp/ahdecode.c732
-rw-r--r--source/tools/acpihelp/ahgrammar.c2
-rw-r--r--source/tools/acpihelp/ahmain.c2
-rw-r--r--source/tools/efihello/efihello.c124
-rw-r--r--tests/misc/grammar.asl149
52 files changed, 2714 insertions, 1078 deletions
diff --git a/changes.txt b/changes.txt
index 52bc749dfe5c..ee16343813b0 100644
--- a/changes.txt
+++ b/changes.txt
@@ -1,4 +1,93 @@
----------------------------------------
+22 December 2016. Summary of changes for version 20161222:
+
+
+1) ACPICA kernel-resident subsystem:
+
+AML Debugger: Implemented a new mechanism to simplify and enhance
+debugger integration into all environments, including kernel debuggers
+and user-space utilities, as well as remote debug services. This
+mechanism essentially consists of new OSL interfaces to support debugger
+initialization/termination, as well as wait/notify interfaces to perform
+the debugger handshake with the host. Lv Zheng.
+
+ New OSL interfaces:
+ AcpiOsInitializeDebugger (void)
+ AcpiOsTerminateDebugger (void)
+ AcpiOsWaitCommandReady (void)
+ AcpiOsNotifyCommandComplete (void)
+
+ New OS services layer:
+ osgendbg.c -- Example implementation, and used for AcpiExec
+
+Update for Generic Address Space (GAS) support: Although the AccessWidth
+and/or BitOffset fields of the GAS are not often used, this change now
+fully supports these fields. This affects the internal support for FADT
+registers, registers in other ACPI data tables, and the AcpiRead and
+AcpiWrite public interfaces. Lv Zheng.
+
+Sleep support: In order to simplify integration of ACPI sleep for the
+various host operating systems, a new OSL interface has been introduced.
+AcpiOsEnterSleep allows the host to perform any required operations
+before the final write to the sleep control register(s) is performed by
+ACPICA. Lv Zheng.
+
+ New OSL interface:
+ AcpiOsEnterSleep(SleepState, RegisterAValue, RegisterBValue)
+
+ Called from these internal interfaces:
+ AcpiHwLegacySleep
+ AcpiHwExtendedSleep
+
+EFI support: Added a very small EFI/ACPICA example application. Provides
+a simple demo for EFI integration, as well as assisting with resolution
+of issues related to customer ACPICA/EFI integration. Lv Zheng. See:
+
+ source/tools/efihello/efihello.c
+
+Local C library: Implemented several new functions to enhance ACPICA
+portability, for environments where these clib functions are not
+available (such as EFI). Lv Zheng:
+ putchar
+ getchar
+ strpbrk
+ strtok
+ memmove
+
+Fixed a regression where occasionally a valid resource descriptor was
+incorrectly detected as invalid at runtime, and a
+AE_AML_NO_RESOURCE_END_TAG was returned.
+
+Fixed a problem with the recently implemented support that enables
+control method invocations as Target operands to many ASL operators.
+Warnings of this form: "Needed type [Reference], found [Processor]" were
+seen at runtime for some method invocations.
+
+Example Code and Data Size: These are the sizes for the OS-independent
+acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The
+debug version of the code includes the debug output trace mechanism and
+has a much larger code and data size.
+
+ Current Release:
+ Non-Debug Version: 141.5K Code, 58.5K Data, 200.0K Total
+ Debug Version: 201.7K Code, 82.7K Data, 284.4K Total
+ Previous Release:
+ Non-Debug Version: 140.5K Code, 58.5K Data, 198.9K Total
+ Debug Version: 201.3K Code, 82.7K Data, 284.0K Total
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+Disassembler: Enhanced output by adding the capability to detect and
+disassemble ASL Switch/Case statements back to the original ASL source
+code instead of if/else blocks. David Box.
+
+AcpiHelp: Split a large file into separate files based upon
+functionality/purpose. New files are:
+ ahaml.c
+ ahasl.c
+
+----------------------------------------
17 November 2016. Summary of changes for version 20161117:
diff --git a/generate/unix/acpiexec/Makefile b/generate/unix/acpiexec/Makefile
index 62850ac274bd..3191850adf72 100644
--- a/generate/unix/acpiexec/Makefile
+++ b/generate/unix/acpiexec/Makefile
@@ -163,6 +163,7 @@ OBJECTS = \
$(OBJDIR)/nsxfeval.o\
$(OBJDIR)/nsxfname.o\
$(OBJDIR)/nsxfobj.o\
+ $(OBJDIR)/osgendbg.o\
$(OBJDIR)/osunixxf.o\
$(OBJDIR)/psargs.o\
$(OBJDIR)/psloop.o\
diff --git a/generate/unix/acpihelp/Makefile b/generate/unix/acpihelp/Makefile
index b0896755c2b2..7f04770d357e 100644
--- a/generate/unix/acpihelp/Makefile
+++ b/generate/unix/acpihelp/Makefile
@@ -28,7 +28,9 @@ HEADERS = \
$(wildcard $(ACPIHELP)/*.h)
OBJECTS = \
+ $(OBJDIR)/ahaml.o\
$(OBJDIR)/ahamlops.o\
+ $(OBJDIR)/ahasl.o\
$(OBJDIR)/ahaslkey.o\
$(OBJDIR)/ahaslops.o\
$(OBJDIR)/ahdecode.o\
diff --git a/source/common/acfileio.c b/source/common/acfileio.c
index ffa23a64e25d..d13d1e7edcb6 100644
--- a/source/common/acfileio.c
+++ b/source/common/acfileio.c
@@ -403,7 +403,7 @@ AcValidateTableHeader (
UINT32 i;
- ACPI_FUNCTION_TRACE ("AcValidateTableHeader");
+ ACPI_FUNCTION_TRACE (AcValidateTableHeader);
/* Read a potential table header */
diff --git a/source/common/ahtable.c b/source/common/ahtable.c
index 67d1be06cc8c..43f2feecabcb 100644
--- a/source/common/ahtable.c
+++ b/source/common/ahtable.c
@@ -51,7 +51,7 @@ const AH_TABLE *
AcpiAhGetTableInfo (
char *Signature);
-extern const AH_TABLE AcpiSupportedTables[];
+extern const AH_TABLE Gbl_AcpiSupportedTables[];
/*******************************************************************************
@@ -73,7 +73,7 @@ AcpiAhGetTableInfo (
const AH_TABLE *Info;
- for (Info = AcpiSupportedTables; Info->Signature; Info++)
+ for (Info = Gbl_AcpiSupportedTables; Info->Signature; Info++)
{
if (ACPI_COMPARE_NAME (Signature, Info->Signature))
{
@@ -89,7 +89,7 @@ AcpiAhGetTableInfo (
* Note: Any tables added here should be duplicated within AcpiDmTableData
* in the file common/dmtable.c
*/
-const AH_TABLE AcpiSupportedTables[] =
+const AH_TABLE Gbl_AcpiSupportedTables[] =
{
{ACPI_SIG_ASF, "Alert Standard Format table"},
{ACPI_SIG_BERT, "Boot Error Record Table"},
diff --git a/source/common/ahuuids.c b/source/common/ahuuids.c
index ec75624d462e..5708a3c23930 100644
--- a/source/common/ahuuids.c
+++ b/source/common/ahuuids.c
@@ -52,7 +52,7 @@
/*
* Table of "known" (ACPI-related) UUIDs
*/
-const AH_UUID AcpiUuids[] =
+const AH_UUID Gbl_AcpiUuids[] =
{
{"[Controllers]", NULL},
{"GPIO Controller", UUID_GPIO_CONTROLLER},
@@ -112,7 +112,7 @@ AcpiAhMatchUuid (
/* Walk the table of known ACPI-related UUIDs */
- for (Info = AcpiUuids; Info->Description; Info++)
+ for (Info = Gbl_AcpiUuids; Info->Description; Info++)
{
/* Null string means desciption is a UUID class */
diff --git a/source/compiler/aslutils.c b/source/compiler/aslutils.c
index 990e72f02379..1599a2e5d953 100644
--- a/source/compiler/aslutils.c
+++ b/source/compiler/aslutils.c
@@ -155,7 +155,7 @@ UtDisplaySupportedTables (
/* All ACPI tables with the common table header */
printf ("\n Supported ACPI tables:\n");
- for (TableData = AcpiSupportedTables, i = 1;
+ for (TableData = Gbl_AcpiSupportedTables, i = 1;
TableData->Signature; TableData++, i++)
{
printf ("%8u) %s %s\n", i,
diff --git a/source/components/debugger/dbinput.c b/source/components/debugger/dbinput.c
index e2fa43274d34..eb8747069972 100644
--- a/source/components/debugger/dbinput.c
+++ b/source/components/debugger/dbinput.c
@@ -64,10 +64,6 @@ AcpiDbMatchCommand (
char *UserCommand);
static void
-AcpiDbSingleThread (
- void);
-
-static void
AcpiDbDisplayCommandInfo (
const char *Command,
BOOLEAN DisplayAll);
@@ -1231,61 +1227,17 @@ void ACPI_SYSTEM_XFACE
AcpiDbExecuteThread (
void *Context)
{
- ACPI_STATUS Status = AE_OK;
- ACPI_STATUS MStatus;
-
-
- while (Status != AE_CTRL_TERMINATE && !AcpiGbl_DbTerminateLoop)
- {
- AcpiGbl_MethodExecuting = FALSE;
- AcpiGbl_StepToNextCall = FALSE;
- MStatus = AcpiOsAcquireMutex (AcpiGbl_DbCommandReady,
- ACPI_WAIT_FOREVER);
- if (ACPI_FAILURE (MStatus))
- {
- return;
- }
-
- Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL);
-
- AcpiOsReleaseMutex (AcpiGbl_DbCommandComplete);
- }
+ (void) AcpiDbUserCommands ();
AcpiGbl_DbThreadsTerminated = TRUE;
}
/*******************************************************************************
*
- * FUNCTION: AcpiDbSingleThread
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Debugger execute thread. Waits for a command line, then
- * simply dispatches it.
- *
- ******************************************************************************/
-
-static void
-AcpiDbSingleThread (
- void)
-{
-
- AcpiGbl_MethodExecuting = FALSE;
- AcpiGbl_StepToNextCall = FALSE;
-
- (void) AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AcpiDbUserCommands
*
- * PARAMETERS: Prompt - User prompt (depends on mode)
- * Op - Current executing parse op
+ * PARAMETERS: None
*
* RETURN: None
*
@@ -1296,8 +1248,7 @@ AcpiDbSingleThread (
ACPI_STATUS
AcpiDbUserCommands (
- char Prompt,
- ACPI_PARSE_OBJECT *Op)
+ void)
{
ACPI_STATUS Status = AE_OK;
@@ -1308,55 +1259,33 @@ AcpiDbUserCommands (
while (!AcpiGbl_DbTerminateLoop)
{
- /* Force output to console until a command is entered */
-
- AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
-
- /* Different prompt if method is executing */
+ /* Wait the readiness of the command */
- if (!AcpiGbl_MethodExecuting)
- {
- AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT);
- }
- else
+ Status = AcpiOsWaitCommandReady ();
+ if (ACPI_FAILURE (Status))
{
- AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT);
+ break;
}
- /* Get the user input line */
+ /* Just call to the command line interpreter */
- 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);
- }
+ AcpiGbl_MethodExecuting = FALSE;
+ AcpiGbl_StepToNextCall = FALSE;
- /* Check for single or multithreaded debug */
+ (void) AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL);
- if (AcpiGbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED)
- {
- /*
- * Signal the debug thread that we have a command to execute,
- * and wait for the command to complete.
- */
- AcpiOsReleaseMutex (AcpiGbl_DbCommandReady);
-
- Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandComplete,
- ACPI_WAIT_FOREVER);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
- }
- else
- {
- /* Just call to the command line interpreter */
+ /* Notify the completion of the command */
- AcpiDbSingleThread ();
+ Status = AcpiOsNotifyCommandComplete ();
+ if (ACPI_FAILURE (Status))
+ {
+ break;
}
}
+ if (ACPI_FAILURE (Status) && Status != AE_CTRL_TERMINATE)
+ {
+ ACPI_EXCEPTION ((AE_INFO, Status, "While parsing command line"));
+ }
return (Status);
}
diff --git a/source/components/debugger/dbxface.c b/source/components/debugger/dbxface.c
index 7fdd2a1458ef..d921b924c69d 100644
--- a/source/components/debugger/dbxface.c
+++ b/source/components/debugger/dbxface.c
@@ -95,50 +95,23 @@ AcpiDbStartCommand (
AcpiGbl_MethodExecuting = TRUE;
Status = AE_CTRL_TRUE;
+
while (Status == AE_CTRL_TRUE)
{
- if (AcpiGbl_DebuggerConfiguration == DEBUGGER_MULTI_THREADED)
- {
- /* Handshake with the front-end that gets user command lines */
+ /* Notify the completion of the command */
- AcpiOsReleaseMutex (AcpiGbl_DbCommandComplete);
-
- Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandReady,
- ACPI_WAIT_FOREVER);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
- }
- else
+ Status = AcpiOsNotifyCommandComplete ();
+ if (ACPI_FAILURE (Status))
{
- /* Single threaded, we must get a command line ourselves */
-
- /* Force output to console until a command is entered */
-
- AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
-
- /* Different prompt if method is executing */
-
- if (!AcpiGbl_MethodExecuting)
- {
- AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT);
- }
- else
- {
- AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT);
- }
+ goto ErrorExit;
+ }
- /* Get the user input line */
+ /* Wait the readiness of the command */
- 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 = AcpiOsWaitCommandReady ();
+ if (ACPI_FAILURE (Status))
+ {
+ goto ErrorExit;
}
Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, WalkState, Op);
@@ -146,6 +119,12 @@ AcpiDbStartCommand (
/* AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); */
+ErrorExit:
+ if (ACPI_FAILURE (Status) && Status != AE_CTRL_TERMINATE)
+ {
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "While parsing/handling command line"));
+ }
return (Status);
}
@@ -493,16 +472,7 @@ AcpiInitializeDebugger (
{
/* These were created with one unit, grab it */
- Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandComplete,
- ACPI_WAIT_FOREVER);
- if (ACPI_FAILURE (Status))
- {
- AcpiOsPrintf ("Could not get debugger mutex\n");
- return_ACPI_STATUS (Status);
- }
-
- Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandReady,
- ACPI_WAIT_FOREVER);
+ Status = AcpiOsInitializeDebugger ();
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not get debugger mutex\n");
@@ -556,14 +526,14 @@ AcpiTerminateDebugger (
if (AcpiGbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED)
{
- AcpiOsReleaseMutex (AcpiGbl_DbCommandReady);
-
/* Wait the AML Debugger threads */
while (!AcpiGbl_DbThreadsTerminated)
{
AcpiOsSleep (100);
}
+
+ AcpiOsTerminateDebugger ();
}
if (AcpiGbl_DbBuffer)
diff --git a/source/components/disassembler/dmopcode.c b/source/components/disassembler/dmopcode.c
index 35fa5945bc19..6bcbc0700239 100644
--- a/source/components/disassembler/dmopcode.c
+++ b/source/components/disassembler/dmopcode.c
@@ -68,6 +68,13 @@ static void
AcpiDmPromoteSubtree (
ACPI_PARSE_OBJECT *StartOp);
+static BOOLEAN
+AcpiDmIsSwitchBlock (
+ ACPI_PARSE_OBJECT *Op);
+
+static BOOLEAN
+AcpiDmIsCaseBlock (
+ ACPI_PARSE_OBJECT *Op);
/*******************************************************************************
*
@@ -968,6 +975,28 @@ AcpiDmDisassembleOneOp (
AcpiDmNamestring (Op->Common.Value.Name);
break;
+ case AML_WHILE_OP:
+
+ if (AcpiDmIsSwitchBlock(Op))
+ {
+ AcpiOsPrintf ("%s", "Switch");
+ break;
+ }
+
+ AcpiOsPrintf ("%s", OpInfo->Name);
+ break;
+
+ case AML_IF_OP:
+
+ if (Op->Common.DisasmOpcode == ACPI_DASM_CASE)
+ {
+ AcpiOsPrintf ("%s", "Case");
+ break;
+ }
+
+ AcpiOsPrintf ("%s", OpInfo->Name);
+ break;
+
case AML_ELSE_OP:
AcpiDmConvertToElseIf (Op);
@@ -1078,6 +1107,12 @@ AcpiDmConvertToElseIf (
{
/* Not a proper Else..If sequence, cannot convert to ElseIf */
+ if (OriginalElseOp->Common.DisasmOpcode == ACPI_DASM_DEFAULT)
+ {
+ AcpiOsPrintf ("%s", "Default");
+ return;
+ }
+
AcpiOsPrintf ("%s", "Else");
return;
}
@@ -1087,13 +1122,42 @@ AcpiDmConvertToElseIf (
ElseOp = IfOp->Common.Next;
if (ElseOp && ElseOp->Common.Next)
{
+ if (OriginalElseOp->Common.DisasmOpcode == ACPI_DASM_DEFAULT)
+ {
+ AcpiOsPrintf ("%s", "Default");
+ return;
+ }
+
AcpiOsPrintf ("%s", "Else");
return;
}
- /* Emit ElseIf, mark the IF as now an ELSEIF */
+ if (OriginalElseOp->Common.DisasmOpcode == ACPI_DASM_DEFAULT)
+ {
+ /*
+ * There is an ElseIf but in this case the Else is actually
+ * a Default block for a Switch/Case statement. No conversion.
+ */
+ AcpiOsPrintf ("%s", "Default");
+ return;
+ }
+
+ if (OriginalElseOp->Common.DisasmOpcode == ACPI_DASM_CASE)
+ {
+ /*
+ * This ElseIf is actually a Case block for a Switch/Case
+ * statement. Print Case but do not return so that we can
+ * promote the subtree and keep the indentation level.
+ */
+ AcpiOsPrintf ("%s", "Case");
+ }
+ else
+ {
+ /* Emit ElseIf, mark the IF as now an ELSEIF */
+
+ AcpiOsPrintf ("%s", "ElseIf");
+ }
- AcpiOsPrintf ("%s", "ElseIf");
IfOp->Common.DisasmFlags |= ACPI_PARSEOP_ELSEIF;
/* The IF parent will now be the same as the original ELSE parent */
@@ -1184,3 +1248,400 @@ AcpiDmPromoteSubtree (
Op = Op->Common.Next;
}
}
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmIsTempName
+ *
+ * PARAMETERS: Op - Object to be examined
+ *
+ * RETURN: TRUE if object is a temporary (_T_x) name
+ *
+ * DESCRIPTION: Determine if an object is a temporary name and ignore it.
+ * Temporary names are only used for Switch statements. This
+ * function depends on this restriced usage.
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiDmIsTempName (
+ ACPI_PARSE_OBJECT *Op)
+{
+ char *Temp;
+
+ if (Op->Common.AmlOpcode != AML_NAME_OP)
+ {
+ return (FALSE);
+ }
+
+ Temp = (char *)(Op->Common.Aml);
+ ++Temp;
+
+ if (strncmp(Temp, "_T_", 3))
+ {
+ return (FALSE);
+ }
+
+ /* Ignore Op */
+
+ Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
+
+ return (TRUE);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmIsSwitchBlock
+ *
+ * PARAMETERS: Op - While Object
+ *
+ * RETURN: TRUE if While block can be converted to a Switch/Case block
+ *
+ * DESCRIPTION: Determines if While block is a Switch/Case statement. Modifies
+ * parse tree to allow for Switch/Case disassembly during walk.
+ *
+ * EXAMPLE: Example of parse tree to be converted
+ *
+ * While
+ * One
+ * Store
+ * ByteConst
+ * -NamePath-
+ * If
+ * LEqual
+ * -NamePath-
+ * Zero
+ * Return
+ * One
+ * Else
+ * Return
+ * WordConst
+ * Break
+ *
+ ******************************************************************************/
+
+static BOOLEAN
+AcpiDmIsSwitchBlock (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *OneOp;
+ ACPI_PARSE_OBJECT *StoreOp;
+ ACPI_PARSE_OBJECT *NamePathOp;
+ ACPI_PARSE_OBJECT *PredicateOp;
+ ACPI_PARSE_OBJECT *CurrentOp;
+ ACPI_PARSE_OBJECT *TempOp;
+
+ /* Check for One Op Predicate */
+
+ OneOp = AcpiPsGetArg (Op, 0);
+ if (!OneOp || (OneOp->Common.AmlOpcode != AML_ONE_OP))
+ {
+ return (FALSE);
+ }
+
+ /* Check for Store Op */
+
+ StoreOp = OneOp->Common.Next;
+ if (!StoreOp || (StoreOp->Common.AmlOpcode != AML_STORE_OP))
+ {
+ return (FALSE);
+ }
+
+ /* Check for Name Op with _T_ string */
+
+ NamePathOp = AcpiPsGetArg (StoreOp, 1);
+ if (!NamePathOp || (NamePathOp->Common.AmlOpcode != AML_INT_NAMEPATH_OP))
+ {
+ return (FALSE);
+ }
+
+ if (strncmp((char *)(NamePathOp->Common.Aml), "_T_", 3))
+ {
+ return (FALSE);
+ }
+
+ /* This is a Switch/Case control block */
+
+ /* Ignore the One Op Predicate */
+
+ OneOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
+
+ /* Ignore the Store Op, but not the children */
+
+ StoreOp->Common.DisasmOpcode = ACPI_DASM_IGNORE_SINGLE;
+
+ /*
+ * First arg of Store Op is the Switch condition.
+ * Mark it as a Switch predicate and as a parameter list for paren
+ * closing and correct indentation.
+ */
+ PredicateOp = AcpiPsGetArg (StoreOp, 0);
+ PredicateOp->Common.DisasmOpcode = ACPI_DASM_SWITCH_PREDICATE;
+ PredicateOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
+
+ /* Ignore the Name Op */
+
+ NamePathOp->Common.DisasmFlags = ACPI_PARSEOP_IGNORE;
+
+ /* Remaining opcodes are the Case statements (If/ElseIf's) */
+
+ CurrentOp = StoreOp->Common.Next;
+ while (AcpiDmIsCaseBlock (CurrentOp))
+ {
+ /* Block is a Case structure */
+
+ if (CurrentOp->Common.AmlOpcode == AML_ELSE_OP)
+ {
+ /* ElseIf */
+
+ CurrentOp->Common.DisasmOpcode = ACPI_DASM_CASE;
+ CurrentOp = AcpiPsGetArg (CurrentOp, 0);
+ }
+
+ /* If */
+
+ CurrentOp->Common.DisasmOpcode = ACPI_DASM_CASE;
+
+ /*
+ * Mark the parse tree for Case disassembly. There are two
+ * types of Case statements. The first type of statement begins with
+ * an LEqual. The second starts with an LNot and uses a Match statement
+ * on a Package of constants.
+ */
+ TempOp = AcpiPsGetArg (CurrentOp, 0);
+ switch (TempOp->Common.AmlOpcode)
+ {
+ case (AML_LEQUAL_OP):
+
+ /* Ignore just the LEqual Op */
+
+ TempOp->Common.DisasmOpcode = ACPI_DASM_IGNORE_SINGLE;
+
+ /* Ignore the NamePath Op */
+
+ TempOp = AcpiPsGetArg (TempOp, 0);
+ TempOp->Common.DisasmFlags = ACPI_PARSEOP_IGNORE;
+
+ /*
+ * Second arg of LEqual will be the Case predicate.
+ * Mark it as a predicate and also as a parameter list for paren
+ * closing and correct indentation.
+ */
+ PredicateOp = TempOp->Common.Next;
+ PredicateOp->Common.DisasmOpcode = ACPI_DASM_SWITCH_PREDICATE;
+ PredicateOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
+
+ break;
+
+ case (AML_LNOT_OP):
+
+ /*
+ * The Package will be the predicate of the Case statement.
+ * It's under:
+ * LNOT
+ * LEQUAL
+ * MATCH
+ * PACKAGE
+ */
+
+ /* Get the LEqual Op from LNot */
+
+ TempOp = AcpiPsGetArg (TempOp, 0);
+
+ /* Get the Match Op from LEqual */
+
+ TempOp = AcpiPsGetArg (TempOp, 0);
+
+ /* Get the Package Op from Match */
+
+ PredicateOp = AcpiPsGetArg (TempOp, 0);
+
+ /* Mark as parameter list for paren closing */
+
+ PredicateOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
+
+ /*
+ * The Package list would be too deeply indented if we
+ * chose to simply ignore the all the parent opcodes, so
+ * we rearrange the parse tree instead.
+ */
+
+ /*
+ * Save the second arg of the If/Else Op which is the
+ * block code of code for this Case statement.
+ */
+ TempOp = AcpiPsGetArg (CurrentOp, 1);
+
+ /*
+ * Move the Package Op to the child (predicate) of the
+ * Case statement.
+ */
+ CurrentOp->Common.Value.Arg = PredicateOp;
+ PredicateOp->Common.Parent = CurrentOp;
+
+ /* Add the block code */
+
+ PredicateOp->Common.Next = TempOp;
+
+ break;
+
+ default:
+
+ /* Should never get here */
+
+ break;
+ }
+
+ /* Advance to next Case block */
+
+ CurrentOp = CurrentOp->Common.Next;
+ }
+
+ /* If CurrentOp is now an Else, then this is a Default block */
+
+ if (CurrentOp && CurrentOp->Common.AmlOpcode == AML_ELSE_OP)
+ {
+ CurrentOp->Common.DisasmOpcode = ACPI_DASM_DEFAULT;
+ }
+
+ /*
+ * From the first If advance to the Break op. It's possible to
+ * have an Else (Default) op here when there is only one Case
+ * statement, so check for it.
+ */
+ CurrentOp = StoreOp->Common.Next->Common.Next;
+ if (CurrentOp->Common.AmlOpcode == AML_ELSE_OP)
+ {
+ CurrentOp = CurrentOp->Common.Next;
+ }
+
+ /* Ignore the Break Op */
+
+ CurrentOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
+
+ return (TRUE);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmIsCaseBlock
+ *
+ * PARAMETERS: Op - Object to test
+ *
+ * RETURN: TRUE if Object is beginning of a Case block.
+ *
+ * DESCRIPTION: Determines if an Object is the beginning of a Case block for a
+ * Switch/Case statement. Parse tree must be one of the following
+ * forms:
+ *
+ * Else (Optional)
+ * If
+ * LEqual
+ * -NamePath- _T_x
+ *
+ * Else (Optional)
+ * If
+ * LNot
+ * LEqual
+ * Match
+ * Package
+ * ByteConst
+ * -NamePath- _T_x
+ *
+ ******************************************************************************/
+
+static BOOLEAN
+AcpiDmIsCaseBlock (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *CurrentOp;
+
+ if (!Op)
+ {
+ return (FALSE);
+ }
+
+ /* Look for an If or ElseIf */
+
+ CurrentOp = Op;
+ if (CurrentOp->Common.AmlOpcode == AML_ELSE_OP)
+ {
+ CurrentOp = AcpiPsGetArg (CurrentOp, 0);
+ if (!CurrentOp)
+ {
+ return (FALSE);
+ }
+ }
+
+ if (!CurrentOp || CurrentOp->Common.AmlOpcode != AML_IF_OP)
+ {
+ return (FALSE);
+ }
+
+ /* Child must be LEqual or LNot */
+
+ CurrentOp = AcpiPsGetArg (CurrentOp, 0);
+ if (!CurrentOp)
+ {
+ return (FALSE);
+ }
+
+ switch (CurrentOp->Common.AmlOpcode)
+ {
+ case (AML_LEQUAL_OP):
+
+ /* Next child must be NamePath with string _T_ */
+
+ CurrentOp = AcpiPsGetArg (CurrentOp, 0);
+ if (!CurrentOp || !CurrentOp->Common.Value.Name ||
+ strncmp(CurrentOp->Common.Value.Name, "_T_", 3))
+ {
+ return (FALSE);
+ }
+
+ break;
+
+ case (AML_LNOT_OP):
+
+ /* Child of LNot must be LEqual op */
+
+ CurrentOp = AcpiPsGetArg (CurrentOp, 0);
+ if (!CurrentOp || (CurrentOp->Common.AmlOpcode != AML_LEQUAL_OP))
+ {
+ return (FALSE);
+ }
+
+ /* Child of LNot must be Match op */
+
+ CurrentOp = AcpiPsGetArg (CurrentOp, 0);
+ if (!CurrentOp || (CurrentOp->Common.AmlOpcode != AML_MATCH_OP))
+ {
+ return (FALSE);
+ }
+
+ /* First child of Match must be Package op */
+
+ CurrentOp = AcpiPsGetArg (CurrentOp, 0);
+ if (!CurrentOp || (CurrentOp->Common.AmlOpcode != AML_PACKAGE_OP))
+ {
+ return (FALSE);
+ }
+
+ /* Third child of Match must be NamePath with string _T_ */
+
+ CurrentOp = AcpiPsGetArg (CurrentOp->Common.Parent, 2);
+ if (!CurrentOp || !CurrentOp->Common.Value.Name ||
+ strncmp(CurrentOp->Common.Value.Name, "_T_", 3))
+ {
+ return (FALSE);
+ }
+
+ break;
+
+ default:
+
+ return (FALSE);
+ }
+
+ return (TRUE);
+}
diff --git a/source/components/disassembler/dmwalk.c b/source/components/disassembler/dmwalk.c
index 3c953f5465e1..5c7d600fd619 100644
--- a/source/components/disassembler/dmwalk.c
+++ b/source/components/disassembler/dmwalk.c
@@ -455,6 +455,20 @@ AcpiDmDescendingOp (
return (AE_CTRL_DEPTH);
}
+ if (AcpiDmIsTempName(Op))
+ {
+ /* Ignore compiler generated temporary names */
+
+ return (AE_CTRL_DEPTH);
+ }
+
+ if (Op->Common.DisasmOpcode == ACPI_DASM_IGNORE_SINGLE)
+ {
+ /* Ignore this op, but not it's children */
+
+ return (AE_OK);
+ }
+
if (Op->Common.AmlOpcode == AML_IF_OP)
{
NextOp = AcpiPsGetDepthNext (NULL, Op);
@@ -889,7 +903,8 @@ AcpiDmAscendingOp (
ACPI_PARSE_OBJECT *ParentOp;
- if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE)
+ if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE ||
+ Op->Common.DisasmOpcode == ACPI_DASM_IGNORE_SINGLE)
{
/* Ignore this op -- it was handled elsewhere */
@@ -1049,9 +1064,12 @@ AcpiDmAscendingOp (
/*
* Just completed a parameter node for something like "Buffer (param)".
- * Close the paren and open up the term list block with a brace
+ * Close the paren and open up the term list block with a brace.
+ *
+ * Switch predicates don't have a Next node but require a closing paren
+ * and opening brace.
*/
- if (Op->Common.Next)
+ if (Op->Common.Next || Op->Common.DisasmOpcode == ACPI_DASM_SWITCH_PREDICATE)
{
AcpiOsPrintf (")");
@@ -1066,6 +1084,13 @@ AcpiDmAscendingOp (
AcpiDmPredefinedDescription (ParentOp);
}
+ /* Correct the indentation level for Switch and Case predicates */
+
+ if (Op->Common.DisasmOpcode == ACPI_DASM_SWITCH_PREDICATE)
+ {
+ --Level;
+ }
+
AcpiOsPrintf ("\n");
AcpiDmIndent (Level - 1);
AcpiOsPrintf ("{\n");
diff --git a/source/components/executer/exconfig.c b/source/components/executer/exconfig.c
index f49b0a9fa9bb..c61b1489225e 100644
--- a/source/components/executer/exconfig.c
+++ b/source/components/executer/exconfig.c
@@ -224,7 +224,7 @@ AcpiExLoadTableOp (
AcpiExEnterInterpreter ();
if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (Status);
+ return_ACPI_STATUS (Status);
}
Status = AcpiExAddTable (TableIndex, &DdbHandle);
diff --git a/source/components/executer/exfldio.c b/source/components/executer/exfldio.c
index fd46a0c02367..a865a86ae1f3 100644
--- a/source/components/executer/exfldio.c
+++ b/source/components/executer/exfldio.c
@@ -946,20 +946,9 @@ AcpiExInsertIntoField (
AccessBitWidth = ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth);
- /*
- * Create the bitmasks used for bit insertion.
- * Note: This if/else is used to bypass compiler differences with the
- * shift operator
- */
- if (AccessBitWidth == ACPI_INTEGER_BIT_SIZE)
- {
- WidthMask = ACPI_UINT64_MAX;
- }
- else
- {
- WidthMask = ACPI_MASK_BITS_ABOVE (AccessBitWidth);
- }
+ /* Create the bitmasks used for bit insertion */
+ WidthMask = ACPI_MASK_BITS_ABOVE_64 (AccessBitWidth);
Mask = WidthMask &
ACPI_MASK_BITS_BELOW (ObjDesc->CommonField.StartFieldBitOffset);
diff --git a/source/components/hardware/hwesleep.c b/source/components/hardware/hwesleep.c
index de914df853a7..52b6964e695b 100644
--- a/source/components/hardware/hwesleep.c
+++ b/source/components/hardware/hwesleep.c
@@ -113,7 +113,7 @@ AcpiHwExtendedSleep (
UINT8 SleepState)
{
ACPI_STATUS Status;
- UINT8 SleepTypeValue;
+ UINT8 SleepControl;
UINT64 SleepStatus;
@@ -139,10 +139,6 @@ AcpiHwExtendedSleep (
AcpiGbl_SystemAwakeAndRunning = FALSE;
- /* Flush caches, as per ACPI specification */
-
- ACPI_FLUSH_CPU_CACHE ();
-
/*
* Set the SLP_TYP and SLP_EN bits.
*
@@ -152,11 +148,24 @@ AcpiHwExtendedSleep (
ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
"Entering sleep state [S%u]\n", SleepState));
- SleepTypeValue = ((AcpiGbl_SleepTypeA << ACPI_X_SLEEP_TYPE_POSITION) &
- ACPI_X_SLEEP_TYPE_MASK);
+ SleepControl = ((AcpiGbl_SleepTypeA << ACPI_X_SLEEP_TYPE_POSITION) &
+ ACPI_X_SLEEP_TYPE_MASK) | ACPI_X_SLEEP_ENABLE;
+
+ /* Flush caches, as per ACPI specification */
+
+ ACPI_FLUSH_CPU_CACHE ();
+
+ Status = AcpiOsEnterSleep (SleepState, SleepControl, 0);
+ if (Status == AE_CTRL_TERMINATE)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
- Status = AcpiWrite ((UINT64) (SleepTypeValue | ACPI_X_SLEEP_ENABLE),
- &AcpiGbl_FADT.SleepControl);
+ Status = AcpiWrite ((UINT64) SleepControl, &AcpiGbl_FADT.SleepControl);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
diff --git a/source/components/hardware/hwregs.c b/source/components/hardware/hwregs.c
index bc85c96b553f..744186b87c1d 100644
--- a/source/components/hardware/hwregs.c
+++ b/source/components/hardware/hwregs.c
@@ -54,6 +54,12 @@
/* Local Prototypes */
+static UINT8
+AcpiHwGetAccessBitWidth (
+ UINT64 Address,
+ ACPI_GENERIC_ADDRESS *Reg,
+ UINT8 MaxBitWidth);
+
static ACPI_STATUS
AcpiHwReadMultiple (
UINT32 *Value,
@@ -71,6 +77,90 @@ AcpiHwWriteMultiple (
/******************************************************************************
*
+ * FUNCTION: AcpiHwGetAccessBitWidth
+ *
+ * PARAMETERS: Address - GAS register address
+ * Reg - GAS register structure
+ * MaxBitWidth - Max BitWidth supported (32 or 64)
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Obtain optimal access bit width
+ *
+ ******************************************************************************/
+
+static UINT8
+AcpiHwGetAccessBitWidth (
+ UINT64 Address,
+ ACPI_GENERIC_ADDRESS *Reg,
+ UINT8 MaxBitWidth)
+{
+ UINT8 AccessBitWidth;
+
+
+ /*
+ * GAS format "register", used by FADT:
+ * 1. Detected if BitOffset is 0 and BitWidth is 8/16/32/64;
+ * 2. AccessSize field is ignored and BitWidth field is used for
+ * determining the boundary of the IO accesses.
+ * GAS format "region", used by APEI registers:
+ * 1. Detected if BitOffset is not 0 or BitWidth is not 8/16/32/64;
+ * 2. AccessSize field is used for determining the boundary of the
+ * IO accesses;
+ * 3. BitOffset/BitWidth fields are used to describe the "region".
+ *
+ * Note: This algorithm assumes that the "Address" fields should always
+ * contain aligned values.
+ */
+ if (!Reg->BitOffset && Reg->BitWidth &&
+ ACPI_IS_POWER_OF_TWO (Reg->BitWidth) &&
+ ACPI_IS_ALIGNED (Reg->BitWidth, 8))
+ {
+ AccessBitWidth = Reg->BitWidth;
+ }
+ else if (Reg->AccessWidth)
+ {
+ AccessBitWidth = (1 << (Reg->AccessWidth + 2));
+ }
+ else
+ {
+ AccessBitWidth = ACPI_ROUND_UP_POWER_OF_TWO_8 (
+ Reg->BitOffset + Reg->BitWidth);
+ if (AccessBitWidth <= 8)
+ {
+ AccessBitWidth = 8;
+ }
+ else
+ {
+ while (!ACPI_IS_ALIGNED (Address, AccessBitWidth >> 3))
+ {
+ AccessBitWidth >>= 1;
+ }
+ }
+ }
+
+ /* Maximum IO port access bit width is 32 */
+
+ if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_IO)
+ {
+ MaxBitWidth = 32;
+ }
+
+ /*
+ * Return access width according to the requested maximum access bit width,
+ * as the caller should know the format of the register and may enforce
+ * a 32-bit accesses.
+ */
+ if (AccessBitWidth < MaxBitWidth)
+ {
+ return (AccessBitWidth);
+ }
+ return (MaxBitWidth);
+}
+
+
+/******************************************************************************
+ *
* FUNCTION: AcpiHwValidateRegister
*
* PARAMETERS: Reg - GAS register structure
@@ -91,6 +181,9 @@ AcpiHwValidateRegister (
UINT8 MaxBitWidth,
UINT64 *Address)
{
+ UINT8 BitWidth;
+ UINT8 AccessWidth;
+
/* Must have a valid pointer to a GAS structure */
@@ -120,24 +213,25 @@ AcpiHwValidateRegister (
return (AE_SUPPORT);
}
- /* Validate the BitWidth */
+ /* Validate the AccessWidth */
- if ((Reg->BitWidth != 8) &&
- (Reg->BitWidth != 16) &&
- (Reg->BitWidth != 32) &&
- (Reg->BitWidth != MaxBitWidth))
+ if (Reg->AccessWidth > 4)
{
ACPI_ERROR ((AE_INFO,
- "Unsupported register bit width: 0x%X", Reg->BitWidth));
+ "Unsupported register access width: 0x%X", Reg->AccessWidth));
return (AE_SUPPORT);
}
- /* Validate the BitOffset. Just a warning for now. */
+ /* Validate the BitWidth, convert AccessWidth into number of bits */
- if (Reg->BitOffset != 0)
+ AccessWidth = AcpiHwGetAccessBitWidth (*Address, Reg, MaxBitWidth);
+ BitWidth = ACPI_ROUND_UP (Reg->BitOffset + Reg->BitWidth, AccessWidth);
+ if (MaxBitWidth < BitWidth)
{
ACPI_WARNING ((AE_INFO,
- "Unsupported register bit offset: 0x%X", Reg->BitOffset));
+ "Requested bit width 0x%X is smaller than register bit width 0x%X",
+ MaxBitWidth, BitWidth));
+ return (AE_SUPPORT);
}
return (AE_OK);
@@ -158,10 +252,7 @@ AcpiHwValidateRegister (
* 64-bit values is not needed.
*
* LIMITATIONS: <These limitations also apply to AcpiHwWrite>
- * BitWidth must be exactly 8, 16, or 32.
* SpaceID must be SystemMemory or SystemIO.
- * BitOffset and AccessWidth are currently ignored, as there has
- * not been a need to implement these.
*
******************************************************************************/
@@ -171,7 +262,12 @@ AcpiHwRead (
ACPI_GENERIC_ADDRESS *Reg)
{
UINT64 Address;
+ UINT8 AccessWidth;
+ UINT32 BitWidth;
+ UINT8 BitOffset;
UINT64 Value64;
+ UINT32 Value32;
+ UINT8 Index;
ACPI_STATUS Status;
@@ -186,30 +282,58 @@ AcpiHwRead (
return (Status);
}
- /* Initialize entire 32-bit return value to zero */
-
+ /*
+ * Initialize entire 32-bit return value to zero, convert AccessWidth
+ * into number of bits based
+ */
*Value = 0;
+ AccessWidth = AcpiHwGetAccessBitWidth (Address, Reg, 32);
+ BitWidth = Reg->BitOffset + Reg->BitWidth;
+ BitOffset = Reg->BitOffset;
/*
* Two address spaces supported: Memory or IO. PCI_Config is
* not supported here because the GAS structure is insufficient
*/
- if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY)
+ Index = 0;
+ while (BitWidth)
{
- Status = AcpiOsReadMemory ((ACPI_PHYSICAL_ADDRESS)
- Address, &Value64, Reg->BitWidth);
+ if (BitOffset >= AccessWidth)
+ {
+ Value32 = 0;
+ BitOffset -= AccessWidth;
+ }
+ else
+ {
+ if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY)
+ {
+ Status = AcpiOsReadMemory ((ACPI_PHYSICAL_ADDRESS)
+ Address + Index * ACPI_DIV_8 (AccessWidth),
+ &Value64, AccessWidth);
+ Value32 = (UINT32) Value64;
+ }
+ else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
+ {
+ Status = AcpiHwReadPort ((ACPI_IO_ADDRESS)
+ Address + Index * ACPI_DIV_8 (AccessWidth),
+ &Value32, AccessWidth);
+ }
+ }
- *Value = (UINT32) Value64;
- }
- else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
- {
- Status = AcpiHwReadPort ((ACPI_IO_ADDRESS)
- Address, Value, Reg->BitWidth);
+ /*
+ * Use offset style bit writes because "Index * AccessWidth" is
+ * ensured to be less than 32-bits by AcpiHwValidateRegister().
+ */
+ ACPI_SET_BITS (Value, Index * AccessWidth,
+ ACPI_MASK_BITS_ABOVE_32 (AccessWidth), Value32);
+
+ BitWidth -= BitWidth > AccessWidth ? AccessWidth : BitWidth;
+ Index++;
}
ACPI_DEBUG_PRINT ((ACPI_DB_IO,
"Read: %8.8X width %2d from %8.8X%8.8X (%s)\n",
- *Value, Reg->BitWidth, ACPI_FORMAT_UINT64 (Address),
+ *Value, AccessWidth, ACPI_FORMAT_UINT64 (Address),
AcpiUtGetRegionName (Reg->SpaceId)));
return (Status);
@@ -237,6 +361,12 @@ AcpiHwWrite (
ACPI_GENERIC_ADDRESS *Reg)
{
UINT64 Address;
+ UINT8 AccessWidth;
+ UINT32 BitWidth;
+ UINT8 BitOffset;
+ UINT64 Value64;
+ UINT32 Value32;
+ UINT8 Index;
ACPI_STATUS Status;
@@ -251,24 +381,58 @@ AcpiHwWrite (
return (Status);
}
+ /* Convert AccessWidth into number of bits based */
+
+ AccessWidth = AcpiHwGetAccessBitWidth (Address, Reg, 32);
+ BitWidth = Reg->BitOffset + Reg->BitWidth;
+ BitOffset = Reg->BitOffset;
+
/*
* Two address spaces supported: Memory or IO. PCI_Config is
* not supported here because the GAS structure is insufficient
*/
- if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY)
+ Index = 0;
+ while (BitWidth)
{
- Status = AcpiOsWriteMemory ((ACPI_PHYSICAL_ADDRESS)
- Address, (UINT64) Value, Reg->BitWidth);
- }
- else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
- {
- Status = AcpiHwWritePort ((ACPI_IO_ADDRESS)
- Address, Value, Reg->BitWidth);
+ /*
+ * Use offset style bit reads because "Index * AccessWidth" is
+ * ensured to be less than 32-bits by AcpiHwValidateRegister().
+ */
+ Value32 = ACPI_GET_BITS (&Value, Index * AccessWidth,
+ ACPI_MASK_BITS_ABOVE_32 (AccessWidth));
+
+ if (BitOffset >= AccessWidth)
+ {
+ BitOffset -= AccessWidth;
+ }
+ else
+ {
+ if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY)
+ {
+ Value64 = (UINT64) Value32;
+ Status = AcpiOsWriteMemory ((ACPI_PHYSICAL_ADDRESS)
+ Address + Index * ACPI_DIV_8 (AccessWidth),
+ Value64, AccessWidth);
+ }
+ else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
+ {
+ Status = AcpiHwWritePort ((ACPI_IO_ADDRESS)
+ Address + Index * ACPI_DIV_8 (AccessWidth),
+ Value32, AccessWidth);
+ }
+ }
+
+ /*
+ * Index * AccessWidth is ensured to be less than 32-bits by
+ * AcpiHwValidateRegister().
+ */
+ BitWidth -= BitWidth > AccessWidth ? AccessWidth : BitWidth;
+ Index++;
}
ACPI_DEBUG_PRINT ((ACPI_DB_IO,
"Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n",
- Value, Reg->BitWidth, ACPI_FORMAT_UINT64 (Address),
+ Value, AccessWidth, ACPI_FORMAT_UINT64 (Address),
AcpiUtGetRegionName (Reg->SpaceId)));
return (Status);
diff --git a/source/components/hardware/hwsleep.c b/source/components/hardware/hwsleep.c
index 13cf255137fc..2431d9a8d42b 100644
--- a/source/components/hardware/hwsleep.c
+++ b/source/components/hardware/hwsleep.c
@@ -159,6 +159,16 @@ AcpiHwLegacySleep (
ACPI_FLUSH_CPU_CACHE ();
+ Status = AcpiOsEnterSleep (SleepState, Pm1aControl, Pm1bControl);
+ if (Status == AE_CTRL_TERMINATE)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
/* Write #2: Write both SLP_TYP + SLP_EN */
Status = AcpiHwWritePm1Control (Pm1aControl, Pm1bControl);
diff --git a/source/components/parser/psargs.c b/source/components/parser/psargs.c
index 5cc328612e11..67d8aef26e29 100644
--- a/source/components/parser/psargs.c
+++ b/source/components/parser/psargs.c
@@ -298,6 +298,20 @@ AcpiPsGetNextNamepath (
PossibleMethodCall &&
(Node->Type == ACPI_TYPE_METHOD))
{
+ if ((GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) == ARGP_SUPERNAME) ||
+ (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) == ARGP_TARGET))
+ {
+ /*
+ * AcpiPsGetNextNamestring has increased the AML pointer past
+ * the method invocation namestring, so we need to restore the
+ * saved AML pointer back to the original method invocation
+ * namestring.
+ */
+ WalkState->ParserState.Aml = Start;
+ WalkState->ArgCount = 1;
+ AcpiPsInitOp (Arg, AML_INT_METHODCALL_OP);
+ }
+
/* This name is actually a control method invocation */
MethodDesc = AcpiNsGetAttachedObject (Node);
@@ -887,7 +901,10 @@ AcpiPsGetNextArg (
AcpiUtGetArgumentTypeName (ArgType), ArgType));
Subop = AcpiPsPeekOpcode (ParserState);
- if (Subop == 0)
+ if (Subop == 0 ||
+ AcpiPsIsLeadingChar (Subop) ||
+ ACPI_IS_ROOT_PREFIX (Subop) ||
+ ACPI_IS_PARENT_PREFIX (Subop))
{
/* NULL target (zero). Convert to a NULL namepath */
@@ -899,6 +916,13 @@ AcpiPsGetNextArg (
Status = AcpiPsGetNextNamepath (WalkState, ParserState,
Arg, ACPI_POSSIBLE_METHOD_CALL);
+
+ if (Arg->Common.AmlOpcode == AML_INT_METHODCALL_OP)
+ {
+ AcpiPsFreeOp (Arg);
+ Arg = NULL;
+ WalkState->ArgCount = 1;
+ }
}
else
{
diff --git a/source/components/parser/pstree.c b/source/components/parser/pstree.c
index 0d6ab6373b6e..a38eb435a28b 100644
--- a/source/components/parser/pstree.c
+++ b/source/components/parser/pstree.c
@@ -142,7 +142,7 @@ AcpiPsAppendArg (
const ACPI_OPCODE_INFO *OpInfo;
- ACPI_FUNCTION_TRACE ("PsAppendArg");
+ ACPI_FUNCTION_TRACE (PsAppendArg);
if (!Op)
diff --git a/source/components/utilities/utclib.c b/source/components/utilities/utclib.c
index 8c188d00a4cf..9b4c9c6f733d 100644
--- a/source/components/utilities/utclib.c
+++ b/source/components/utilities/utclib.c
@@ -129,6 +129,61 @@ memcmp (
/*******************************************************************************
*
+ * FUNCTION: memmove
+ *
+ * PARAMETERS: Dest - Target of the copy
+ * Src - Source buffer to copy
+ * Count - Number of bytes to copy
+ *
+ * RETURN: Dest
+ *
+ * DESCRIPTION: Copy arbitrary bytes of memory with respect to the overlapping
+ *
+ ******************************************************************************/
+
+void *
+memmove (
+ void *Dest,
+ const void *Src,
+ ACPI_SIZE Count)
+{
+ char *New = (char *) Dest;
+ char *Old = (char *) Src;
+
+
+ if (Old > New)
+ {
+ /* Copy from the beginning */
+
+ while (Count)
+ {
+ *New = *Old;
+ New++;
+ Old++;
+ Count--;
+ }
+ }
+ else if (Old < New)
+ {
+ /* Copy from the end */
+
+ New = New + Count - 1;
+ Old = Old + Count - 1;
+ while (Count)
+ {
+ *New = *Old;
+ New--;
+ Old--;
+ Count--;
+ }
+ }
+
+ return (Dest);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: memcpy
*
* PARAMETERS: Dest - Target of the copy
@@ -231,6 +286,93 @@ strlen (
/*******************************************************************************
*
+ * FUNCTION: strpbrk
+ *
+ * PARAMETERS: String - Null terminated string
+ * Delimiters - Delimiters to match
+ *
+ * RETURN: The first occurance in the string of any of the bytes in the
+ * delimiters
+ *
+ * DESCRIPTION: Search a string for any of a set of the delimiters
+ *
+ ******************************************************************************/
+
+char *
+strpbrk (
+ const char *String,
+ const char *Delimiters)
+{
+ const char *Delimiter;
+
+
+ for ( ; *String != '\0'; ++String)
+ {
+ for (Delimiter = Delimiters; *Delimiter != '\0'; Delimiter++)
+ {
+ if (*String == *Delimiter)
+ {
+ return (ACPI_CAST_PTR (char, String));
+ }
+ }
+ }
+
+ return (NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: strtok
+ *
+ * PARAMETERS: String - Null terminated string
+ * Delimiters - Delimiters to match
+ *
+ * RETURN: Pointer to the next token
+ *
+ * DESCRIPTION: Split string into tokens
+ *
+ ******************************************************************************/
+
+char*
+strtok (
+ char *String,
+ const char *Delimiters)
+{
+ char *Begin = String;
+ static char *SavedPtr;
+
+
+ if (Begin == NULL)
+ {
+ if (SavedPtr == NULL)
+ {
+ return (NULL);
+ }
+ Begin = SavedPtr;
+ }
+
+ SavedPtr = strpbrk (Begin, Delimiters);
+ while (SavedPtr == Begin)
+ {
+ *Begin++ = '\0';
+ SavedPtr = strpbrk (Begin, Delimiters);
+ }
+
+ if (SavedPtr)
+ {
+ *SavedPtr++ = '\0';
+ return (Begin);
+ }
+ else
+ {
+ return (NULL);
+ }
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: strcpy
*
* PARAMETERS: DstString - Target of the copy
diff --git a/source/components/utilities/utdecode.c b/source/components/utilities/utdecode.c
index 45adf14c6d9e..1a79286ccf36 100644
--- a/source/components/utilities/utdecode.c
+++ b/source/components/utilities/utdecode.c
@@ -269,7 +269,7 @@ AcpiUtGetObjectTypeName (
if (!ObjDesc)
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n"));
- return_PTR ("[NULL Object Descriptor]");
+ return_STR ("[NULL Object Descriptor]");
}
/* These descriptor types share a common area */
@@ -282,7 +282,7 @@ AcpiUtGetObjectTypeName (
ACPI_GET_DESCRIPTOR_TYPE (ObjDesc),
AcpiUtGetDescriptorName (ObjDesc), ObjDesc));
- return_PTR ("Invalid object");
+ return_STR ("Invalid object");
}
return_STR (AcpiUtGetTypeName (ObjDesc->Common.Type));
diff --git a/source/components/utilities/utdelete.c b/source/components/utilities/utdelete.c
index 95a98f568183..d36eedfe69e9 100644
--- a/source/components/utilities/utdelete.c
+++ b/source/components/utilities/utdelete.c
@@ -449,8 +449,9 @@ AcpiUtUpdateRefCount (
}
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
- "Obj %p Type %.2X Refs %.2X [Incremented]\n",
- Object, Object->Common.Type, NewCount));
+ "Obj %p Type %.2X [%s] Refs %.2X [Incremented]\n",
+ Object, Object->Common.Type,
+ AcpiUtGetObjectTypeName (Object), NewCount));
break;
case REF_DECREMENT:
diff --git a/source/components/utilities/utmutex.c b/source/components/utilities/utmutex.c
index 83b1cee0d79e..563ef600ccd1 100644
--- a/source/components/utilities/utmutex.c
+++ b/source/components/utilities/utmutex.c
@@ -129,19 +129,6 @@ AcpiUtMutexInitialize (
return_ACPI_STATUS (Status);
}
-#ifdef ACPI_DEBUGGER
-
- /* Debugger Support */
-
- Status = AcpiOsCreateMutex (&AcpiGbl_DbCommandReady);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- Status = AcpiOsCreateMutex (&AcpiGbl_DbCommandComplete);
-#endif
-
return_ACPI_STATUS (Status);
}
@@ -187,12 +174,6 @@ AcpiUtMutexTerminate (
/* Delete the reader/writer lock */
AcpiUtDeleteRwLock (&AcpiGbl_NamespaceRwLock);
-
-#ifdef ACPI_DEBUGGER
- AcpiOsDeleteMutex (AcpiGbl_DbCommandReady);
- AcpiOsDeleteMutex (AcpiGbl_DbCommandComplete);
-#endif
-
return_VOID;
}
diff --git a/source/components/utilities/utresrc.c b/source/components/utilities/utresrc.c
index 8c44a1cab8f8..a3b0523fc8da 100644
--- a/source/components/utilities/utresrc.c
+++ b/source/components/utilities/utresrc.c
@@ -472,7 +472,7 @@ AcpiUtWalkAmlResources (
* The absolute minimum resource template is one EndTag descriptor.
* However, we will treat a lone EndTag as just a simple buffer.
*/
- if (AmlLength <= sizeof (AML_RESOURCE_END_TAG))
+ if (AmlLength < sizeof (AML_RESOURCE_END_TAG))
{
return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG);
}
diff --git a/source/include/acclib.h b/source/include/acclib.h
index 0b104b6126e2..ab1c3d7676bc 100644
--- a/source/include/acclib.h
+++ b/source/include/acclib.h
@@ -104,6 +104,16 @@ strchr (
int ch);
char *
+strpbrk (
+ const char *String,
+ const char *Delimiters);
+
+char *
+strtok (
+ char *String,
+ const char *Delimiters);
+
+char *
strcpy (
char *DstString,
const char *SrcString);
@@ -165,6 +175,12 @@ memcpy (
ACPI_SIZE Count);
void *
+memmove (
+ void *Dest,
+ const void *Src,
+ ACPI_SIZE Count);
+
+void *
memset (
void *Dest,
int Value,
@@ -226,6 +242,13 @@ sprintf (
*/
extern int errno;
+#ifndef EOF
+#define EOF (-1)
+#endif
+
+#define putchar(c) fputc(stdout, c)
+#define getchar(c) fgetc(stdin)
+
int
vprintf (
const char *Format,
@@ -280,6 +303,21 @@ fseek (
long
ftell (
FILE *File);
+
+int
+fgetc (
+ FILE *File);
+
+int
+fputc (
+ FILE *File,
+ char c);
+
+char *
+fgets (
+ char *s,
+ ACPI_SIZE Size,
+ FILE *File);
#endif
#endif /* _ACCLIB_H */
diff --git a/source/include/acdebug.h b/source/include/acdebug.h
index 6dfa8a22ced6..56e01269fd30 100644
--- a/source/include/acdebug.h
+++ b/source/include/acdebug.h
@@ -421,8 +421,7 @@ AcpiDbExecuteThread (
ACPI_STATUS
AcpiDbUserCommands (
- char Prompt,
- ACPI_PARSE_OBJECT *Op);
+ void);
char *
AcpiDbGetNextToken (
diff --git a/source/include/acdisasm.h b/source/include/acdisasm.h
index 719ff859bc32..bbf727962c21 100644
--- a/source/include/acdisasm.h
+++ b/source/include/acdisasm.h
@@ -429,7 +429,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoGeneric[][2];
* dmtable and ahtable
*/
extern const ACPI_DMTABLE_DATA AcpiDmTableData[];
-extern const AH_TABLE AcpiSupportedTables[];
+extern const AH_TABLE Gbl_AcpiSupportedTables[];
UINT8
AcpiDmGenerateChecksum (
@@ -651,6 +651,10 @@ AcpiDmDisassembleOneOp (
ACPI_OP_WALK_INFO *Info,
ACPI_PARSE_OBJECT *Op);
+BOOLEAN
+AcpiDmIsTempName (
+ ACPI_PARSE_OBJECT *Op);
+
UINT32
AcpiDmListType (
ACPI_PARSE_OBJECT *Op);
diff --git a/source/include/acexcep.h b/source/include/acexcep.h
index 0f9a6aa5691b..2fe81dccce33 100644
--- a/source/include/acexcep.h
+++ b/source/include/acexcep.h
@@ -217,11 +217,10 @@ typedef struct acpi_exception_info
#define AE_CTRL_TRANSFER EXCEP_CTL (0x0008)
#define AE_CTRL_BREAK EXCEP_CTL (0x0009)
#define AE_CTRL_CONTINUE EXCEP_CTL (0x000A)
-#define AE_CTRL_SKIP EXCEP_CTL (0x000B)
-#define AE_CTRL_PARSE_CONTINUE EXCEP_CTL (0x000C)
-#define AE_CTRL_PARSE_PENDING EXCEP_CTL (0x000D)
+#define AE_CTRL_PARSE_CONTINUE EXCEP_CTL (0x000B)
+#define AE_CTRL_PARSE_PENDING EXCEP_CTL (0x000C)
-#define AE_CODE_CTRL_MAX 0x000D
+#define AE_CODE_CTRL_MAX 0x000C
/* Exception strings for AcpiFormatException */
@@ -344,7 +343,6 @@ static const ACPI_EXCEPTION_INFO AcpiGbl_ExceptionNames_Ctrl[] =
EXCEP_TXT ("AE_CTRL_TRANSFER", "Transfer control to called method"),
EXCEP_TXT ("AE_CTRL_BREAK", "A Break has been executed"),
EXCEP_TXT ("AE_CTRL_CONTINUE", "A Continue has been executed"),
- EXCEP_TXT ("AE_CTRL_SKIP", "Not currently used"),
EXCEP_TXT ("AE_CTRL_PARSE_CONTINUE", "Used to skip over bad opcodes"),
EXCEP_TXT ("AE_CTRL_PARSE_PENDING", "Used to implement AML While loops")
};
diff --git a/source/include/acglobal.h b/source/include/acglobal.h
index 1d5c17e6377a..60a2ffddfbf6 100644
--- a/source/include/acglobal.h
+++ b/source/include/acglobal.h
@@ -331,7 +331,6 @@ ACPI_GLOBAL (ACPI_EXTERNAL_FILE *, AcpiGbl_ExternalFileList);
#ifdef ACPI_DEBUGGER
ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_AbortMethod, FALSE);
-ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_MethodExecuting, FALSE);
ACPI_INIT_GLOBAL (ACPI_THREAD_ID, AcpiGbl_DbThreadId, ACPI_INVALID_THREAD_ID);
ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_NoIniMethods);
@@ -350,7 +349,6 @@ ACPI_GLOBAL (ACPI_OBJECT_TYPE, AcpiGbl_DbArgTypes[ACPI_DEBUGGER_MAX_ARG
/* These buffers should all be the same size */
-ACPI_GLOBAL (char, AcpiGbl_DbLineBuf[ACPI_DB_LINE_BUFFER_SIZE]);
ACPI_GLOBAL (char, AcpiGbl_DbParsedBuf[ACPI_DB_LINE_BUFFER_SIZE]);
ACPI_GLOBAL (char, AcpiGbl_DbScopeBuf[ACPI_DB_LINE_BUFFER_SIZE]);
ACPI_GLOBAL (char, AcpiGbl_DbDebugFilename[ACPI_DB_LINE_BUFFER_SIZE]);
@@ -365,9 +363,6 @@ ACPI_GLOBAL (UINT16, AcpiGbl_NodeTypeCountMisc);
ACPI_GLOBAL (UINT32, AcpiGbl_NumNodes);
ACPI_GLOBAL (UINT32, AcpiGbl_NumObjects);
-ACPI_GLOBAL (ACPI_MUTEX, AcpiGbl_DbCommandReady);
-ACPI_GLOBAL (ACPI_MUTEX, AcpiGbl_DbCommandComplete);
-
#endif /* ACPI_DEBUGGER */
#if defined (ACPI_DISASSEMBLER) || defined (ACPI_ASL_COMPILER)
diff --git a/source/include/aclocal.h b/source/include/aclocal.h
index f41160953b17..734cae17a3b7 100644
--- a/source/include/aclocal.h
+++ b/source/include/aclocal.h
@@ -923,7 +923,7 @@ typedef union acpi_parse_value
char AmlOpName[16]) /* Op name (debug only) */
-/* Flags for DisasmFlags field above */
+/* Internal opcodes for DisasmOpcode field above */
#define ACPI_DASM_BUFFER 0x00 /* Buffer is a simple data buffer */
#define ACPI_DASM_RESOURCE 0x01 /* Buffer is a Resource Descriptor */
@@ -936,7 +936,10 @@ typedef union acpi_parse_value
#define ACPI_DASM_LNOT_PREFIX 0x08 /* Start of a LNotEqual (etc.) pair of opcodes */
#define ACPI_DASM_LNOT_SUFFIX 0x09 /* End of a LNotEqual (etc.) pair of opcodes */
#define ACPI_DASM_HID_STRING 0x0A /* String is a _HID or _CID */
-#define ACPI_DASM_IGNORE 0x0B /* Not used at this time */
+#define ACPI_DASM_IGNORE_SINGLE 0x0B /* Ignore the opcode but not it's children */
+#define ACPI_DASM_SWITCH_PREDICATE 0x0C /* Object is a predicate for a Switch or Case block */
+#define ACPI_DASM_CASE 0x0D /* If/Else is a Case in a Switch/Case block */
+#define ACPI_DASM_DEFAULT 0x0E /* Else is a Default in a Switch/Case block */
/*
* Generic operation (for example: If, While, Store)
diff --git a/source/include/acmacros.h b/source/include/acmacros.h
index 21256cbba7b0..5a5e79318a77 100644
--- a/source/include/acmacros.h
+++ b/source/include/acmacros.h
@@ -47,7 +47,7 @@
/*
* Extract data using a pointer. Any more than a byte and we
- * get into potential aligment issues -- see the STORE macros below.
+ * get into potential alignment issues -- see the STORE macros below.
* Use with care.
*/
#define ACPI_CAST8(ptr) ACPI_CAST_PTR (UINT8, (ptr))
@@ -64,7 +64,7 @@
#define ACPI_SET64(ptr, val) (*ACPI_CAST64 (ptr) = (UINT64) (val))
/*
- * printf() format helper. This macros is a workaround for the difficulties
+ * printf() format helper. This macro is a workaround for the difficulties
* with emitting 64-bit integers and 64-bit pointers with the same code
* for both 32-bit and 64-bit hosts.
*/
@@ -264,14 +264,93 @@
#define ACPI_IS_MISALIGNED(value) (((ACPI_SIZE) value) & (sizeof(ACPI_SIZE)-1))
+/* Generic bit manipulation */
+
+#ifndef ACPI_USE_NATIVE_BIT_FINDER
+
+#define __ACPI_FIND_LAST_BIT_2(a, r) ((((UINT8) (a)) & 0x02) ? (r)+1 : (r))
+#define __ACPI_FIND_LAST_BIT_4(a, r) ((((UINT8) (a)) & 0x0C) ? \
+ __ACPI_FIND_LAST_BIT_2 ((a)>>2, (r)+2) : \
+ __ACPI_FIND_LAST_BIT_2 ((a), (r)))
+#define __ACPI_FIND_LAST_BIT_8(a, r) ((((UINT8) (a)) & 0xF0) ? \
+ __ACPI_FIND_LAST_BIT_4 ((a)>>4, (r)+4) : \
+ __ACPI_FIND_LAST_BIT_4 ((a), (r)))
+#define __ACPI_FIND_LAST_BIT_16(a, r) ((((UINT16) (a)) & 0xFF00) ? \
+ __ACPI_FIND_LAST_BIT_8 ((a)>>8, (r)+8) : \
+ __ACPI_FIND_LAST_BIT_8 ((a), (r)))
+#define __ACPI_FIND_LAST_BIT_32(a, r) ((((UINT32) (a)) & 0xFFFF0000) ? \
+ __ACPI_FIND_LAST_BIT_16 ((a)>>16, (r)+16) : \
+ __ACPI_FIND_LAST_BIT_16 ((a), (r)))
+#define __ACPI_FIND_LAST_BIT_64(a, r) ((((UINT64) (a)) & 0xFFFFFFFF00000000) ? \
+ __ACPI_FIND_LAST_BIT_32 ((a)>>32, (r)+32) : \
+ __ACPI_FIND_LAST_BIT_32 ((a), (r)))
+
+#define ACPI_FIND_LAST_BIT_8(a) ((a) ? __ACPI_FIND_LAST_BIT_8 (a, 1) : 0)
+#define ACPI_FIND_LAST_BIT_16(a) ((a) ? __ACPI_FIND_LAST_BIT_16 (a, 1) : 0)
+#define ACPI_FIND_LAST_BIT_32(a) ((a) ? __ACPI_FIND_LAST_BIT_32 (a, 1) : 0)
+#define ACPI_FIND_LAST_BIT_64(a) ((a) ? __ACPI_FIND_LAST_BIT_64 (a, 1) : 0)
+
+#define __ACPI_FIND_FIRST_BIT_2(a, r) ((((UINT8) (a)) & 0x01) ? (r) : (r)+1)
+#define __ACPI_FIND_FIRST_BIT_4(a, r) ((((UINT8) (a)) & 0x03) ? \
+ __ACPI_FIND_FIRST_BIT_2 ((a), (r)) : \
+ __ACPI_FIND_FIRST_BIT_2 ((a)>>2, (r)+2))
+#define __ACPI_FIND_FIRST_BIT_8(a, r) ((((UINT8) (a)) & 0x0F) ? \
+ __ACPI_FIND_FIRST_BIT_4 ((a), (r)) : \
+ __ACPI_FIND_FIRST_BIT_4 ((a)>>4, (r)+4))
+#define __ACPI_FIND_FIRST_BIT_16(a, r) ((((UINT16) (a)) & 0x00FF) ? \
+ __ACPI_FIND_FIRST_BIT_8 ((a), (r)) : \
+ __ACPI_FIND_FIRST_BIT_8 ((a)>>8, (r)+8))
+#define __ACPI_FIND_FIRST_BIT_32(a, r) ((((UINT32) (a)) & 0x0000FFFF) ? \
+ __ACPI_FIND_FIRST_BIT_16 ((a), (r)) : \
+ __ACPI_FIND_FIRST_BIT_16 ((a)>>16, (r)+16))
+#define __ACPI_FIND_FIRST_BIT_64(a, r) ((((UINT64) (a)) & 0x00000000FFFFFFFF) ? \
+ __ACPI_FIND_FIRST_BIT_32 ((a), (r)) : \
+ __ACPI_FIND_FIRST_BIT_32 ((a)>>32, (r)+32))
+
+#define ACPI_FIND_FIRST_BIT_8(a) ((a) ? __ACPI_FIND_FIRST_BIT_8 (a, 1) : 0)
+#define ACPI_FIND_FIRST_BIT_16(a) ((a) ? __ACPI_FIND_FIRST_BIT_16 (a, 1) : 0)
+#define ACPI_FIND_FIRST_BIT_32(a) ((a) ? __ACPI_FIND_FIRST_BIT_32 (a, 1) : 0)
+#define ACPI_FIND_FIRST_BIT_64(a) ((a) ? __ACPI_FIND_FIRST_BIT_64 (a, 1) : 0)
+
+#endif /* ACPI_USE_NATIVE_BIT_FINDER */
+
+/* Generic (power-of-two) rounding */
+
+#define ACPI_ROUND_UP_POWER_OF_TWO_8(a) ((UINT8) \
+ (((UINT16) 1) << ACPI_FIND_LAST_BIT_8 ((a) - 1)))
+#define ACPI_ROUND_DOWN_POWER_OF_TWO_8(a) ((UINT8) \
+ (((UINT16) 1) << (ACPI_FIND_LAST_BIT_8 ((a)) - 1)))
+#define ACPI_ROUND_UP_POWER_OF_TWO_16(a) ((UINT16) \
+ (((UINT32) 1) << ACPI_FIND_LAST_BIT_16 ((a) - 1)))
+#define ACPI_ROUND_DOWN_POWER_OF_TWO_16(a) ((UINT16) \
+ (((UINT32) 1) << (ACPI_FIND_LAST_BIT_16 ((a)) - 1)))
+#define ACPI_ROUND_UP_POWER_OF_TWO_32(a) ((UINT32) \
+ (((UINT64) 1) << ACPI_FIND_LAST_BIT_32 ((a) - 1)))
+#define ACPI_ROUND_DOWN_POWER_OF_TWO_32(a) ((UINT32) \
+ (((UINT64) 1) << (ACPI_FIND_LAST_BIT_32 ((a)) - 1)))
+#define ACPI_IS_ALIGNED(a, s) (((a) & ((s) - 1)) == 0)
+#define ACPI_IS_POWER_OF_TWO(a) ACPI_IS_ALIGNED(a, a)
+
/*
* Bitmask creation
* Bit positions start at zero.
* MASK_BITS_ABOVE creates a mask starting AT the position and above
* MASK_BITS_BELOW creates a mask starting one bit BELOW the position
+ * MASK_BITS_ABOVE/BELOW accepts a bit offset to create a mask
+ * MASK_BITS_ABOVE/BELOW_32/64 accepts a bit width to create a mask
+ * Note: The ACPI_INTEGER_BIT_SIZE check is used to bypass compiler
+ * differences with the shift operator
*/
#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_UINT64_MAX) << ((UINT32) (position))))
#define ACPI_MASK_BITS_BELOW(position) ((ACPI_UINT64_MAX) << ((UINT32) (position)))
+#define ACPI_MASK_BITS_ABOVE_32(width) ((UINT32) ACPI_MASK_BITS_ABOVE(width))
+#define ACPI_MASK_BITS_BELOW_32(width) ((UINT32) ACPI_MASK_BITS_BELOW(width))
+#define ACPI_MASK_BITS_ABOVE_64(width) ((width) == ACPI_INTEGER_BIT_SIZE ? \
+ ACPI_UINT64_MAX : \
+ ACPI_MASK_BITS_ABOVE(width))
+#define ACPI_MASK_BITS_BELOW_64(width) ((width) == ACPI_INTEGER_BIT_SIZE ? \
+ (UINT64) 0 : \
+ ACPI_MASK_BITS_BELOW(width))
/* Bitfields within ACPI registers */
@@ -376,7 +455,7 @@
*/
#ifndef ACPI_NO_ERROR_MESSAGES
/*
- * Error reporting. Callers module and line number are inserted by AE_INFO,
+ * Error reporting. The callers module and line number are inserted by AE_INFO,
* the plist contains a set of parens to allow variable-length lists.
* These macros are used for both the debug and non-debug versions of the code.
*/
diff --git a/source/include/acpiosxf.h b/source/include/acpiosxf.h
index 788e06644d13..9c5775f02398 100644
--- a/source/include/acpiosxf.h
+++ b/source/include/acpiosxf.h
@@ -456,6 +456,14 @@ AcpiOsSignal (
void *Info);
#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsEnterSleep
+ACPI_STATUS
+AcpiOsEnterSleep (
+ UINT8 SleepState,
+ UINT32 RegaValue,
+ UINT32 RegbValue);
+#endif
+
/*
* Debug print routines
@@ -482,7 +490,7 @@ AcpiOsRedirectOutput (
/*
- * Debug input
+ * Debug IO
*/
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetLine
ACPI_STATUS
@@ -492,6 +500,30 @@ AcpiOsGetLine (
UINT32 *BytesRead);
#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsInitializeDebugger
+ACPI_STATUS
+AcpiOsInitializeDebugger (
+ void);
+#endif
+
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTerminateDebugger
+void
+AcpiOsTerminateDebugger (
+ void);
+#endif
+
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWaitCommandReady
+ACPI_STATUS
+AcpiOsWaitCommandReady (
+ void);
+#endif
+
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsNotifyCommandComplete
+ACPI_STATUS
+AcpiOsNotifyCommandComplete (
+ void);
+#endif
+
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTracePoint
void
AcpiOsTracePoint (
diff --git a/source/include/acpixf.h b/source/include/acpixf.h
index f5f86d4fb252..ce470205411f 100644
--- a/source/include/acpixf.h
+++ b/source/include/acpixf.h
@@ -46,7 +46,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
-#define ACPI_CA_VERSION 0x20161117
+#define ACPI_CA_VERSION 0x20161222
#include "acconfig.h"
#include "actypes.h"
@@ -293,6 +293,15 @@ ACPI_INIT_GLOBAL (UINT32, AcpiDbgLayer, ACPI_COMPONENT_DEFAULT);
ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DisplayDebugTimer, FALSE);
/*
+ * Debugger command handshake globals. Host OSes need to access these
+ * variables to implement their own command handshake mechanism.
+ */
+#ifdef ACPI_DEBUGGER
+ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_MethodExecuting, FALSE);
+ACPI_GLOBAL (char, AcpiGbl_DbLineBuf[ACPI_DB_LINE_BUFFER_SIZE]);
+#endif
+
+/*
* Other miscellaneous globals
*/
ACPI_GLOBAL (ACPI_TABLE_FADT, AcpiGbl_FADT);
@@ -1267,6 +1276,10 @@ AcpiTerminateDebugger (
void);
void
+AcpiRunDebugger (
+ char *BatchBuffer);
+
+void
AcpiSetDebuggerThreadId (
ACPI_THREAD_ID ThreadId);
diff --git a/source/include/platform/acefi.h b/source/include/platform/acefi.h
index af3df6cd81e5..69f1e55c9a43 100644
--- a/source/include/platform/acefi.h
+++ b/source/include/platform/acefi.h
@@ -251,8 +251,10 @@ struct _ACPI_EFI_PCI_IO;
extern struct _ACPI_EFI_SYSTEM_TABLE *ST;
extern struct _ACPI_EFI_BOOT_SERVICES *BS;
-#define FILE struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE
+typedef union acpi_efi_file ACPI_EFI_FILE;
+#define FILE ACPI_EFI_FILE
+extern FILE *stdin;
extern FILE *stdout;
extern FILE *stderr;
diff --git a/source/include/platform/acefiex.h b/source/include/platform/acefiex.h
index 4ae0c6628087..c16c1afbbb84 100644
--- a/source/include/platform/acefiex.h
+++ b/source/include/platform/acefiex.h
@@ -95,6 +95,20 @@ typedef struct {
UINT8 Data4[8];
} ACPI_EFI_GUID;
+typedef struct {
+ UINT16 Year; /* 1998 - 20XX */
+ UINT8 Month; /* 1 - 12 */
+ UINT8 Day; /* 1 - 31 */
+ UINT8 Hour; /* 0 - 23 */
+ UINT8 Minute; /* 0 - 59 */
+ UINT8 Second; /* 0 - 59 */
+ UINT8 Pad1;
+ UINT32 Nanosecond; /* 0 - 999,999,999 */
+ INT16 TimeZone; /* -1440 to 1440 or 2047 */
+ UINT8 Daylight;
+ UINT8 Pad2;
+} ACPI_EFI_TIME;
+
typedef struct _ACPI_EFI_DEVICE_PATH {
UINT8 Type;
UINT8 SubType;
@@ -375,6 +389,22 @@ ACPI_EFI_STATUS
struct _ACPI_EFI_FILE_HANDLE *File,
UINT64 *Position);
+#define ACPI_EFI_FILE_INFO_ID \
+ { 0x9576e92, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
+
+typedef struct {
+ UINT64 Size;
+ UINT64 FileSize;
+ UINT64 PhysicalSize;
+ ACPI_EFI_TIME CreateTime;
+ ACPI_EFI_TIME LastAccessTime;
+ ACPI_EFI_TIME ModificationTime;
+ UINT64 Attribute;
+ CHAR16 FileName[1];
+} ACPI_EFI_FILE_INFO;
+
+#define SIZE_OF_ACPI_EFI_FILE_INFO ACPI_OFFSET(ACPI_EFI_FILE_INFO, FileName)
+
typedef
ACPI_EFI_STATUS
(ACPI_EFI_API *ACPI_EFI_FILE_GET_INFO) (
@@ -457,6 +487,15 @@ ACPI_EFI_STATUS
ACPI_EFI_HANDLE ImageHandle);
+typedef
+ACPI_EFI_STATUS
+(ACPI_EFI_API *ACPI_EFI_SET_WATCHDOG_TIMER) (
+ UINTN Timeout,
+ UINT64 WatchdogCode,
+ UINTN DataSize,
+ CHAR16 *WatchdogData);
+
+
#define EFI_IMAGE_INFORMATION_REVISION 0x1000
typedef struct {
UINT32 Revision;
@@ -744,13 +783,12 @@ typedef struct _ACPI_EFI_BOOT_SERVICES {
ACPI_EFI_EXIT_BOOT_SERVICES ExitBootServices;
ACPI_EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount;
ACPI_EFI_STALL Stall;
- ACPI_EFI_SET_WATCHDOG_TIMER SetWatchdogTimer;
#else
ACPI_EFI_UNKNOWN_INTERFACE ExitBootServices;
ACPI_EFI_UNKNOWN_INTERFACE GetNextMonotonicCount;
ACPI_EFI_UNKNOWN_INTERFACE Stall;
- ACPI_EFI_UNKNOWN_INTERFACE SetWatchdogTimer;
#endif
+ ACPI_EFI_SET_WATCHDOG_TIMER SetWatchdogTimer;
#if 0
ACPI_EFI_CONNECT_CONTROLLER ConnectController;
@@ -896,6 +934,15 @@ typedef struct _ACPI_EFI_PCI_IO {
VOID *RomImage;
} ACPI_EFI_PCI_IO;
+/* FILE abstraction */
+
+union acpi_efi_file {
+ struct _ACPI_EFI_FILE_HANDLE File;
+ struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE ConOut;
+ struct _ACPI_SIMPLE_INPUT_INTERFACE ConIn;
+};
+
+
/* GNU EFI definitions */
#if defined(_GNU_EFI)
@@ -929,5 +976,6 @@ extern ACPI_EFI_GUID AcpiGbl_LoadedImageProtocol;
extern ACPI_EFI_GUID AcpiGbl_TextInProtocol;
extern ACPI_EFI_GUID AcpiGbl_TextOutProtocol;
extern ACPI_EFI_GUID AcpiGbl_FileSystemProtocol;
+extern ACPI_EFI_GUID AcpiGbl_GenericFileInfo;
#endif /* __ACEFIEX_H__ */
diff --git a/source/include/platform/acenv.h b/source/include/platform/acenv.h
index 97187f8b0c1d..3fcc93b91b3c 100644
--- a/source/include/platform/acenv.h
+++ b/source/include/platform/acenv.h
@@ -76,7 +76,8 @@
(defined ACPI_NAMES_APP) || \
(defined ACPI_SRC_APP) || \
(defined ACPI_XTRACT_APP) || \
- (defined ACPI_EXAMPLE_APP)
+ (defined ACPI_EXAMPLE_APP) || \
+ (defined ACPI_EFI_HELLO)
#define ACPI_APPLICATION
#define ACPI_SINGLE_THREADED
#define USE_NATIVE_ALLOCATE_ZEROED
@@ -361,7 +362,7 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
-#ifdef ACPI_APPLICATION
+#if defined (ACPI_APPLICATION) || defined(ACPI_LIBRARY)
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
diff --git a/source/include/platform/aclinux.h b/source/include/platform/aclinux.h
index 048f76a598ac..c19a8e45f848 100644
--- a/source/include/platform/aclinux.h
+++ b/source/include/platform/aclinux.h
@@ -153,6 +153,8 @@
*/
#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadable
#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritable
+#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsInitializeDebugger
+#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTerminateDebugger
/*
* OSL interfaces used by utilities
@@ -193,7 +195,8 @@
#define ACPI_CAST_PTHREAD_T(Pthread) ((ACPI_THREAD_ID) (Pthread))
#if defined(__ia64__) || defined(__x86_64__) ||\
- defined(__aarch64__) || defined(__PPC64__)
+ defined(__aarch64__) || defined(__PPC64__) ||\
+ defined(__s390x__)
#define ACPI_MACHINE_WIDTH 64
#define COMPILER_DEPENDENT_INT64 long
#define COMPILER_DEPENDENT_UINT64 unsigned long
diff --git a/source/include/platform/aclinuxex.h b/source/include/platform/aclinuxex.h
index f1f9c9a21a23..2e2cc6aa8747 100644
--- a/source/include/platform/aclinuxex.h
+++ b/source/include/platform/aclinuxex.h
@@ -144,6 +144,20 @@ AcpiOsReadable (
return TRUE;
}
+static inline ACPI_STATUS
+AcpiOsInitializeDebugger (
+ void)
+{
+ return AE_OK;
+}
+
+static inline void
+AcpiOsTerminateDebugger (
+ void)
+{
+ return;
+}
+
/*
* OSL interfaces added by Linux
diff --git a/source/os_specific/service_layers/osgendbg.c b/source/os_specific/service_layers/osgendbg.c
new file mode 100644
index 000000000000..1b7079e1c813
--- /dev/null
+++ b/source/os_specific/service_layers/osgendbg.c
@@ -0,0 +1,366 @@
+/******************************************************************************
+ *
+ * Module Name: osgendbg - Generic debugger command singalling
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2016, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include "acpi.h"
+#include "accommon.h"
+#include "acdebug.h"
+
+
+#define _COMPONENT ACPI_CA_DEBUGGER
+ ACPI_MODULE_NAME ("osgendbg")
+
+
+/* Local prototypes */
+
+static void
+AcpiDbRunRemoteDebugger (
+ char *BatchBuffer);
+
+
+static ACPI_MUTEX AcpiGbl_DbCommandReady;
+static ACPI_MUTEX AcpiGbl_DbCommandComplete;
+static BOOLEAN AcpiGbl_DbCommandSignalsInitialized = FALSE;
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiDbRunRemoteDebugger
+ *
+ * PARAMETERS: BatchBuffer - Buffer containing commands running in
+ * the batch mode
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Run multi-threading debugger remotely
+ *
+ *****************************************************************************/
+
+static void
+AcpiDbRunRemoteDebugger (
+ char *BatchBuffer)
+{
+ ACPI_STATUS Status;
+ char *Ptr = BatchBuffer;
+ char *Cmd = Ptr;
+
+
+ while (!AcpiGbl_DbTerminateLoop)
+ {
+ if (BatchBuffer)
+ {
+ if (*Ptr)
+ {
+ while (*Ptr)
+ {
+ if (*Ptr == ',')
+ {
+ /* Convert commas to spaces */
+ *Ptr = ' ';
+ }
+ else if (*Ptr == ';')
+ {
+ *Ptr = '\0';
+ continue;
+ }
+
+ Ptr++;
+ }
+
+ strncpy (AcpiGbl_DbLineBuf, Cmd, ACPI_DB_LINE_BUFFER_SIZE);
+ Ptr++;
+ Cmd = Ptr;
+ }
+ else
+ {
+ return;
+ }
+ }
+ else
+ {
+ /* Force output to console until a command is entered */
+
+ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
+
+ /* Different prompt if method is executing */
+
+ if (!AcpiGbl_MethodExecuting)
+ {
+ AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT);
+ }
+ else
+ {
+ AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT);
+ }
+
+ /* Get the user input line */
+
+ Status = AcpiOsGetLine (AcpiGbl_DbLineBuf,
+ ACPI_DB_LINE_BUFFER_SIZE, NULL);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
+ }
+
+ /*
+ * Signal the debug thread that we have a command to execute,
+ * and wait for the command to complete.
+ */
+ AcpiOsReleaseMutex (AcpiGbl_DbCommandReady);
+
+ Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandComplete,
+ ACPI_WAIT_FOREVER);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
+ }
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsWaitCommandReady
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Negotiate with the debugger foreground thread (the user
+ * thread) to wait the readiness of a command.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsWaitCommandReady (
+ void)
+{
+ ACPI_STATUS Status = AE_OK;
+
+
+ if (AcpiGbl_DebuggerConfiguration == DEBUGGER_MULTI_THREADED)
+ {
+ Status = AE_TIME;
+
+ while (Status == AE_TIME)
+ {
+ if (AcpiGbl_DbTerminateLoop)
+ {
+ Status = AE_CTRL_TERMINATE;
+ }
+ else
+ {
+ Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandReady, 1000);
+ }
+ }
+ }
+ else
+ {
+ /* Force output to console until a command is entered */
+
+ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
+
+ /* Different prompt if method is executing */
+
+ if (!AcpiGbl_MethodExecuting)
+ {
+ AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT);
+ }
+ else
+ {
+ AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT);
+ }
+
+ /* Get the user input line */
+
+ Status = AcpiOsGetLine (AcpiGbl_DbLineBuf,
+ ACPI_DB_LINE_BUFFER_SIZE, NULL);
+ }
+
+ if (ACPI_FAILURE (Status) && Status != AE_CTRL_TERMINATE)
+ {
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "While parsing/handling command line"));
+ }
+ return (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsNotifyCommandComplete
+ *
+ * PARAMETERS: void
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Negotiate with the debugger foreground thread (the user
+ * thread) to notify the completion of a command.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsNotifyCommandComplete (
+ void)
+{
+
+ if (AcpiGbl_DebuggerConfiguration == DEBUGGER_MULTI_THREADED)
+ {
+ AcpiOsReleaseMutex (AcpiGbl_DbCommandComplete);
+ }
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsInitializeDebugger
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Initialize OSPM specific part of the debugger
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsInitializeDebugger (
+ void)
+{
+ ACPI_STATUS Status;
+
+
+ /* Create command signals */
+
+ Status = AcpiOsCreateMutex (&AcpiGbl_DbCommandReady);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ Status = AcpiOsCreateMutex (&AcpiGbl_DbCommandComplete);
+ if (ACPI_FAILURE (Status))
+ {
+ goto ErrorReady;
+ }
+
+ /* Initialize the states of the command signals */
+
+ Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandComplete,
+ ACPI_WAIT_FOREVER);
+ if (ACPI_FAILURE (Status))
+ {
+ goto ErrorComplete;
+ }
+ Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandReady,
+ ACPI_WAIT_FOREVER);
+ if (ACPI_FAILURE (Status))
+ {
+ goto ErrorComplete;
+ }
+
+ AcpiGbl_DbCommandSignalsInitialized = TRUE;
+ return (Status);
+
+ErrorComplete:
+ AcpiOsDeleteMutex (AcpiGbl_DbCommandComplete);
+ErrorReady:
+ AcpiOsDeleteMutex (AcpiGbl_DbCommandReady);
+ return (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsTerminateDebugger
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Terminate signals used by the multi-threading debugger
+ *
+ *****************************************************************************/
+
+void
+AcpiOsTerminateDebugger (
+ void)
+{
+
+ if (AcpiGbl_DbCommandSignalsInitialized)
+ {
+ AcpiOsDeleteMutex (AcpiGbl_DbCommandReady);
+ AcpiOsDeleteMutex (AcpiGbl_DbCommandComplete);
+ }
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiRunDebugger
+ *
+ * PARAMETERS: BatchBuffer - Buffer containing commands running in
+ * the batch mode
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Run a local/remote debugger
+ *
+ *****************************************************************************/
+
+void
+AcpiRunDebugger (
+ char *BatchBuffer)
+{
+ /* Check for single or multithreaded debug */
+
+ if (AcpiGbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED)
+ {
+ AcpiDbRunRemoteDebugger (BatchBuffer);
+ }
+ else
+ {
+ AcpiDbUserCommands ();
+ }
+}
+
+ACPI_EXPORT_SYMBOL (AcpiRunDebugger)
diff --git a/source/os_specific/service_layers/osunixxf.c b/source/os_specific/service_layers/osunixxf.c
index 3837b8e99d1d..47e358bc82bd 100644
--- a/source/os_specific/service_layers/osunixxf.c
+++ b/source/os_specific/service_layers/osunixxf.c
@@ -361,6 +361,33 @@ AcpiOsPhysicalTableOverride (
/******************************************************************************
*
+ * FUNCTION: AcpiOsEnterSleep
+ *
+ * PARAMETERS: SleepState - Which sleep state to enter
+ * RegaValue - Register A value
+ * RegbValue - Register B value
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: A hook before writing sleep registers to enter the sleep
+ * state. Return AE_CTRL_SKIP to skip further sleep register
+ * writes.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsEnterSleep (
+ UINT8 SleepState,
+ UINT32 RegaValue,
+ UINT32 RegbValue)
+{
+
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
* FUNCTION: AcpiOsRedirectOutput
*
* PARAMETERS: Destination - An open file handle/pointer
diff --git a/source/os_specific/service_layers/oswinxf.c b/source/os_specific/service_layers/oswinxf.c
index b4fc999c7bef..cc6a79a70f98 100644
--- a/source/os_specific/service_layers/oswinxf.c
+++ b/source/os_specific/service_layers/oswinxf.c
@@ -289,6 +289,33 @@ AcpiOsPhysicalTableOverride (
/******************************************************************************
*
+ * FUNCTION: AcpiOsEnterSleep
+ *
+ * PARAMETERS: SleepState - Which sleep state to enter
+ * RegaValue - Register A value
+ * RegbValue - Register B value
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: A hook before writing sleep registers to enter the sleep
+ * state. Return AE_CTRL_SKIP to skip further sleep register
+ * writes.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsEnterSleep (
+ UINT8 SleepState,
+ UINT32 RegaValue,
+ UINT32 RegbValue)
+{
+
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
* FUNCTION: AcpiOsGetTimer
*
* PARAMETERS: None
diff --git a/source/tools/acpiexec/aemain.c b/source/tools/acpiexec/aemain.c
index 826d60df1364..1f236f22440f 100644
--- a/source/tools/acpiexec/aemain.c
+++ b/source/tools/acpiexec/aemain.c
@@ -66,10 +66,6 @@ AeDoOptions (
int argc,
char **argv);
-static void
-AcpiDbRunBatchMode (
- void);
-
#define AE_BUFFER_SIZE 1024
#define ASL_MAX_FILES 256
@@ -663,12 +659,12 @@ EnterDebugger:
default:
case AE_MODE_COMMAND_LOOP:
- AcpiDbUserCommands (ACPI_DEBUGGER_COMMAND_PROMPT, NULL);
+ AcpiRunDebugger (NULL);
break;
case AE_MODE_BATCH_MULTIPLE:
- AcpiDbRunBatchMode ();
+ AcpiRunDebugger (BatchBuffer);
break;
case AE_MODE_BATCH_SINGLE:
@@ -679,12 +675,7 @@ EnterDebugger:
/* Shut down the debugger and ACPICA */
-#if 0
-
- /* Temporarily removed */
AcpiTerminateDebugger ();
- (void) AcpiTerminate ();
-#endif
NormalExit:
ExitCode = 0;
@@ -693,55 +684,3 @@ ErrorExit:
(void) AcpiOsTerminate ();
return (ExitCode);
}
-
-
-/******************************************************************************
- *
- * FUNCTION: AcpiDbRunBatchMode
- *
- * PARAMETERS: BatchCommandLine - A semicolon separated list of commands
- * to be executed.
- * Use only commas to separate elements of
- * particular command.
- * RETURN: None
- *
- * DESCRIPTION: For each command of list separated by ';' prepare the command
- * buffer and pass it to AcpiDbCommandDispatch.
- *
- *****************************************************************************/
-
-static void
-AcpiDbRunBatchMode (
- void)
-{
- char *Ptr = BatchBuffer;
- char *Cmd = Ptr;
- UINT8 Run = 0;
-
-
- AcpiGbl_MethodExecuting = FALSE;
- AcpiGbl_StepToNextCall = FALSE;
-
- while (*Ptr)
- {
- if (*Ptr == ',')
- {
- /* Convert commas to spaces */
- *Ptr = ' ';
- }
- else if (*Ptr == ';')
- {
- *Ptr = '\0';
- Run = 1;
- }
-
- Ptr++;
-
- if (Run || (*Ptr == '\0'))
- {
- (void) AcpiDbCommandDispatch (Cmd, NULL, NULL);
- Run = 0;
- Cmd = Ptr;
- }
- }
-}
diff --git a/source/tools/acpihelp/acpihelp.h b/source/tools/acpihelp/acpihelp.h
index 20055674762d..eb0c38d39bb3 100644
--- a/source/tools/acpihelp/acpihelp.h
+++ b/source/tools/acpihelp/acpihelp.h
@@ -56,6 +56,50 @@
#endif
+/*
+ * Global variables. Defined in ahmain.c only, externed in all other files
+ */
+#undef ACPI_GLOBAL
+#undef ACPI_INIT_GLOBAL
+
+#ifdef DEFINE_AHELP_GLOBALS
+#define ACPI_GLOBAL(type,name) \
+ extern type name; \
+ type name
+
+#define ACPI_INIT_GLOBAL(type,name,value) \
+ type name=value
+
+#else
+#ifndef ACPI_GLOBAL
+#define ACPI_GLOBAL(type,name) \
+ extern type name
+#endif
+
+#ifndef ACPI_INIT_GLOBAL
+#define ACPI_INIT_GLOBAL(type,name,value) \
+ extern type name
+#endif
+#endif
+
+
+#define AH_BUFFER_LENGTH 128
+#define AH_LINE_BUFFER_LENGTH 512
+#define AH_MAX_ASL_LINE_LENGTH 70
+#define AH_MAX_AML_LINE_LENGTH 100
+
+ACPI_GLOBAL (char, Gbl_Buffer[AH_BUFFER_LENGTH]);
+ACPI_GLOBAL (char, Gbl_LineBuffer[AH_LINE_BUFFER_LENGTH]);
+
+
+#define AH_DISPLAY_EXCEPTION(Status, Name) \
+ printf ("%.4X: %s\n", Status, Name)
+
+#define AH_DISPLAY_EXCEPTION_TEXT(Status, Exception) \
+ printf ("%.4X: %-28s (%s)\n", Status,\
+ Exception->Name, Exception->Description)
+
+
typedef enum
{
AH_DECODE_DEFAULT = 0,
@@ -75,10 +119,6 @@ typedef enum
} AH_OPTION_TYPES;
-#define AH_MAX_ASL_LINE_LENGTH 70
-#define AH_MAX_AML_LINE_LENGTH 100
-
-
typedef struct ah_aml_opcode
{
UINT16 OpcodeRangeStart;
@@ -122,14 +162,17 @@ typedef struct ah_directive_info
} AH_DIRECTIVE_INFO;
-extern const AH_AML_OPCODE AmlOpcodeInfo[];
-extern const AH_AML_TYPE AmlTypesInfo[];
-extern const AH_ASL_OPERATOR AslOperatorInfo[];
-extern const AH_ASL_KEYWORD AslKeywordInfo[];
-extern const AH_UUID AcpiUuids[];
-extern const AH_DIRECTIVE_INFO PreprocessorDirectives[];
-extern const AH_TABLE AcpiSupportedTables[];
-extern BOOLEAN AhDisplayAll;
+
+/* Externals for various data tables */
+
+extern const AH_AML_OPCODE Gbl_AmlOpcodeInfo[];
+extern const AH_AML_TYPE Gbl_AmlTypesInfo[];
+extern const AH_ASL_OPERATOR Gbl_AslOperatorInfo[];
+extern const AH_ASL_KEYWORD Gbl_AslKeywordInfo[];
+extern const AH_UUID Gbl_AcpiUuids[];
+extern const AH_DIRECTIVE_INFO Gbl_PreprocessorDirectives[];
+extern const AH_TABLE Gbl_AcpiSupportedTables[];
+
void
AhFindAmlOpcode (
@@ -183,4 +226,11 @@ void
AhDisplayDirectives (
void);
+void
+AhPrintOneField (
+ UINT32 Indent,
+ UINT32 CurrentPosition,
+ UINT32 MaxPosition,
+ const char *Field);
+
#endif /* __ACPIHELP_H */
diff --git a/source/tools/acpihelp/ahaml.c b/source/tools/acpihelp/ahaml.c
new file mode 100644
index 000000000000..dcd425815159
--- /dev/null
+++ b/source/tools/acpihelp/ahaml.c
@@ -0,0 +1,349 @@
+/******************************************************************************
+ *
+ * Module Name: ahaml - AML opcode decoding for acpihelp utility
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2016, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include "acpihelp.h"
+
+
+/* Local prototypes */
+
+static void
+AhDisplayAmlOpcode (
+ const AH_AML_OPCODE *Op);
+
+static void
+AhDisplayAmlType (
+ const AH_AML_TYPE *Op);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AhFindAmlOpcode (entry point for AML opcode name search)
+ *
+ * PARAMETERS: Name - Name or prefix for an AML opcode.
+ * NULL means "find all"
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Find all AML opcodes that match the input Name or name
+ * prefix.
+ *
+ ******************************************************************************/
+
+void
+AhFindAmlOpcode (
+ char *Name)
+{
+ const AH_AML_OPCODE *Op;
+ BOOLEAN Found = FALSE;
+
+
+ AcpiUtStrupr (Name);
+
+ /* Find/display all opcode names that match the input name prefix */
+
+ for (Op = Gbl_AmlOpcodeInfo; Op->OpcodeString; Op++)
+ {
+ if (!Op->OpcodeName) /* Unused opcodes */
+ {
+ continue;
+ }
+
+ if (!Name || (Name[0] == '*'))
+ {
+ AhDisplayAmlOpcode (Op);
+ Found = TRUE;
+ continue;
+ }
+
+ /* Upper case the opcode name before substring compare */
+
+ strcpy (Gbl_Buffer, Op->OpcodeName);
+ AcpiUtStrupr (Gbl_Buffer);
+
+ if (strstr (Gbl_Buffer, Name) == Gbl_Buffer)
+ {
+ AhDisplayAmlOpcode (Op);
+ Found = TRUE;
+ }
+ }
+
+ if (!Found)
+ {
+ printf ("%s, no matching AML operators\n", Name);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AhDecodeAmlOpcode (entry point for AML opcode search)
+ *
+ * PARAMETERS: OpcodeString - String version of AML opcode
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display information about the input AML opcode
+ *
+ ******************************************************************************/
+
+void
+AhDecodeAmlOpcode (
+ char *OpcodeString)
+{
+ const AH_AML_OPCODE *Op;
+ UINT32 Opcode;
+ UINT8 Prefix;
+
+
+ if (!OpcodeString)
+ {
+ AhFindAmlOpcode (NULL);
+ return;
+ }
+
+ Opcode = strtoul (OpcodeString, NULL, 16);
+ if (Opcode > ACPI_UINT16_MAX)
+ {
+ printf ("Invalid opcode (more than 16 bits)\n");
+ return;
+ }
+
+ /* Only valid opcode extension is 0x5B */
+
+ Prefix = (Opcode & 0x0000FF00) >> 8;
+ if (Prefix && (Prefix != 0x5B))
+ {
+ printf ("Invalid opcode (invalid extension prefix 0x%X)\n",
+ Prefix);
+ return;
+ }
+
+ /* Find/Display the opcode. May fall within an opcode range */
+
+ for (Op = Gbl_AmlOpcodeInfo; Op->OpcodeString; Op++)
+ {
+ if ((Opcode >= Op->OpcodeRangeStart) &&
+ (Opcode <= Op->OpcodeRangeEnd))
+ {
+ AhDisplayAmlOpcode (Op);
+ }
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AhDisplayAmlOpcode
+ *
+ * PARAMETERS: Op - An opcode info struct
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display the contents of an AML opcode information struct
+ *
+ ******************************************************************************/
+
+static void
+AhDisplayAmlOpcode (
+ const AH_AML_OPCODE *Op)
+{
+
+ if (!Op->OpcodeName)
+ {
+ printf ("%18s: Opcode=%-9s\n", "Reserved opcode", Op->OpcodeString);
+ return;
+ }
+
+ /* Opcode name and value(s) */
+
+ printf ("%18s: Opcode=%-9s Type (%s)",
+ Op->OpcodeName, Op->OpcodeString, Op->Type);
+
+ /* Optional fixed/static arguments */
+
+ if (Op->FixedArguments)
+ {
+ printf (" FixedArgs (");
+ AhPrintOneField (37, 36 + 7 + strlen (Op->Type) + 12,
+ AH_MAX_AML_LINE_LENGTH, Op->FixedArguments);
+ printf (")");
+ }
+
+ /* Optional variable-length argument list */
+
+ if (Op->VariableArguments)
+ {
+ if (Op->FixedArguments)
+ {
+ printf ("\n%*s", 36, " ");
+ }
+ printf (" VariableArgs (");
+ AhPrintOneField (37, 15, AH_MAX_AML_LINE_LENGTH, Op->VariableArguments);
+ printf (")");
+ }
+ printf ("\n");
+
+ /* Grammar specification */
+
+ if (Op->Grammar)
+ {
+ AhPrintOneField (37, 0, AH_MAX_AML_LINE_LENGTH, Op->Grammar);
+ printf ("\n");
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AhFindAmlTypes (entry point for AML grammar keyword search)
+ *
+ * PARAMETERS: Name - Name or prefix for an AML grammar element.
+ * NULL means "find all"
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Find all AML grammar keywords that match the input Name or name
+ * prefix.
+ *
+ ******************************************************************************/
+
+void
+AhFindAmlTypes (
+ char *Name)
+{
+ const AH_AML_TYPE *Keyword;
+ BOOLEAN Found = FALSE;
+
+
+ AcpiUtStrupr (Name);
+
+ for (Keyword = Gbl_AmlTypesInfo; Keyword->Name; Keyword++)
+ {
+ if (!Name)
+ {
+ printf (" %s\n", Keyword->Name);
+ Found = TRUE;
+ continue;
+ }
+
+ if (*Name == '*')
+ {
+ AhDisplayAmlType (Keyword);
+ Found = TRUE;
+ continue;
+ }
+
+ /* Upper case the operator name before substring compare */
+
+ strcpy (Gbl_Buffer, Keyword->Name);
+ AcpiUtStrupr (Gbl_Buffer);
+
+ if (strstr (Gbl_Buffer, Name) == Gbl_Buffer)
+ {
+ AhDisplayAmlType (Keyword);
+ Found = TRUE;
+ }
+ }
+
+ if (!Found)
+ {
+ printf ("%s, no matching AML grammar type\n", Name);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AhDisplayAmlType
+ *
+ * PARAMETERS: Op - Pointer to AML grammar info
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format and display info for an AML grammar element.
+ *
+ ******************************************************************************/
+
+static void
+AhDisplayAmlType (
+ const AH_AML_TYPE *Op)
+{
+ char *Description;
+
+
+ Description = Op->Description;
+ printf ("%4s", " "); /* Primary indent */
+
+ /* Emit the entire description string */
+
+ while (*Description)
+ {
+ /* Description can be multiple lines, must indent each */
+
+ while (*Description != '\n')
+ {
+ printf ("%c", *Description);
+ Description++;
+ }
+
+ printf ("\n");
+ Description++;
+
+ /* Do indent */
+
+ if (*Description)
+ {
+ printf ("%8s", " "); /* Secondary indent */
+
+ /* Index extra for a comment */
+
+ if ((Description[0] == '/') &&
+ (Description[1] == '/'))
+ {
+ printf ("%4s", " ");
+ }
+ }
+ }
+
+ printf ("\n");
+}
diff --git a/source/tools/acpihelp/ahamlops.c b/source/tools/acpihelp/ahamlops.c
index 57a0963c1f29..b2d7c8f0176f 100644
--- a/source/tools/acpihelp/ahamlops.c
+++ b/source/tools/acpihelp/ahamlops.c
@@ -48,7 +48,7 @@
* AML opcodes with related syntax and grammar information.
* This table was extracted from the ACPI specification.
*/
-const AH_AML_OPCODE AmlOpcodeInfo[] =
+const AH_AML_OPCODE Gbl_AmlOpcodeInfo[] =
{
{0x00, 0x00, "0x00", "ZeroOp", "DataObject", NULL, NULL,
NULL},
diff --git a/source/tools/acpihelp/ahasl.c b/source/tools/acpihelp/ahasl.c
new file mode 100644
index 000000000000..c9fd3a672e85
--- /dev/null
+++ b/source/tools/acpihelp/ahasl.c
@@ -0,0 +1,319 @@
+/******************************************************************************
+ *
+ * Module Name: ahasl - ASL operator decoding for acpihelp utility
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2016, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include "acpihelp.h"
+
+
+/* Local prototypes */
+
+static void
+AhDisplayAslOperator (
+ const AH_ASL_OPERATOR *Op);
+
+static void
+AhDisplayOperatorKeywords (
+ const AH_ASL_OPERATOR *Op);
+
+static void
+AhDisplayAslKeyword (
+ const AH_ASL_KEYWORD *Op);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AhFindAslKeywords (entry point for ASL keyword search)
+ *
+ * PARAMETERS: Name - Name or prefix for an ASL keyword.
+ * NULL means "find all"
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Find all ASL keywords that match the input Name or name
+ * prefix.
+ *
+ ******************************************************************************/
+
+void
+AhFindAslKeywords (
+ char *Name)
+{
+ const AH_ASL_KEYWORD *Keyword;
+ BOOLEAN Found = FALSE;
+
+
+ AcpiUtStrupr (Name);
+
+ for (Keyword = Gbl_AslKeywordInfo; Keyword->Name; Keyword++)
+ {
+ if (!Name || (Name[0] == '*'))
+ {
+ AhDisplayAslKeyword (Keyword);
+ Found = TRUE;
+ continue;
+ }
+
+ /* Upper case the operator name before substring compare */
+
+ strcpy (Gbl_Buffer, Keyword->Name);
+ AcpiUtStrupr (Gbl_Buffer);
+
+ if (strstr (Gbl_Buffer, Name) == Gbl_Buffer)
+ {
+ AhDisplayAslKeyword (Keyword);
+ Found = TRUE;
+ }
+ }
+
+ if (!Found)
+ {
+ printf ("%s, no matching ASL keywords\n", Name);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AhDisplayAslKeyword
+ *
+ * PARAMETERS: Op - Pointer to ASL keyword with syntax info
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format and display syntax info for an ASL keyword. Splits
+ * long lines appropriately for reading.
+ *
+ ******************************************************************************/
+
+static void
+AhDisplayAslKeyword (
+ const AH_ASL_KEYWORD *Op)
+{
+
+ /* ASL keyword name and description */
+
+ printf ("%22s: %s\n", Op->Name, Op->Description);
+ if (!Op->KeywordList)
+ {
+ return;
+ }
+
+ /* List of actual keywords */
+
+ AhPrintOneField (24, 0, AH_MAX_ASL_LINE_LENGTH, Op->KeywordList);
+ printf ("\n");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AhFindAslAndAmlOperators
+ *
+ * PARAMETERS: Name - Name or prefix for an ASL operator.
+ * NULL means "find all"
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Find all ASL operators that match the input Name or name
+ * prefix. Also displays the AML information if only one entry
+ * matches.
+ *
+ ******************************************************************************/
+
+void
+AhFindAslAndAmlOperators (
+ char *Name)
+{
+ UINT32 MatchCount;
+
+
+ MatchCount = AhFindAslOperators (Name);
+ if (MatchCount == 1)
+ {
+ AhFindAmlOpcode (Name);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AhFindAslOperators (entry point for ASL operator search)
+ *
+ * PARAMETERS: Name - Name or prefix for an ASL operator.
+ * NULL means "find all"
+ *
+ * RETURN: Number of operators that matched the name prefix.
+ *
+ * DESCRIPTION: Find all ASL operators that match the input Name or name
+ * prefix.
+ *
+ ******************************************************************************/
+
+UINT32
+AhFindAslOperators (
+ char *Name)
+{
+ const AH_ASL_OPERATOR *Operator;
+ BOOLEAN MatchCount = 0;
+
+
+ AcpiUtStrupr (Name);
+
+ /* Find/display all names that match the input name prefix */
+
+ for (Operator = Gbl_AslOperatorInfo; Operator->Name; Operator++)
+ {
+ if (!Name || (Name[0] == '*'))
+ {
+ AhDisplayAslOperator (Operator);
+ MatchCount++;
+ continue;
+ }
+
+ /* Upper case the operator name before substring compare */
+
+ strcpy (Gbl_Buffer, Operator->Name);
+ AcpiUtStrupr (Gbl_Buffer);
+
+ if (strstr (Gbl_Buffer, Name) == Gbl_Buffer)
+ {
+ AhDisplayAslOperator (Operator);
+ MatchCount++;
+ }
+ }
+
+ if (!MatchCount)
+ {
+ printf ("%s, no matching ASL operators\n", Name);
+ }
+
+ return (MatchCount);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AhDisplayAslOperator
+ *
+ * PARAMETERS: Op - Pointer to ASL operator with syntax info
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format and display syntax info for an ASL operator. Splits
+ * long lines appropriately for reading.
+ *
+ ******************************************************************************/
+
+static void
+AhDisplayAslOperator (
+ const AH_ASL_OPERATOR *Op)
+{
+
+ /* ASL operator name and description */
+
+ printf ("%16s: %s\n", Op->Name, Op->Description);
+ if (!Op->Syntax)
+ {
+ return;
+ }
+
+ /* Syntax for the operator */
+
+ AhPrintOneField (18, 0, AH_MAX_ASL_LINE_LENGTH, Op->Syntax);
+ printf ("\n");
+
+ AhDisplayOperatorKeywords (Op);
+ printf ("\n");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AhDisplayOperatorKeywords
+ *
+ * PARAMETERS: Op - Pointer to ASL keyword with syntax info
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display any/all keywords that are associated with the ASL
+ * operator.
+ *
+ ******************************************************************************/
+
+static void
+AhDisplayOperatorKeywords (
+ const AH_ASL_OPERATOR *Op)
+{
+ char *Token;
+ char *Separators = "(){}, ";
+ BOOLEAN FirstKeyword = TRUE;
+
+
+ if (!Op || !Op->Syntax)
+ {
+ return;
+ }
+
+ /*
+ * Find all parameters that have the word "keyword" within, and then
+ * display the info about that keyword
+ */
+ strcpy (Gbl_LineBuffer, Op->Syntax);
+ Token = strtok (Gbl_LineBuffer, Separators);
+ while (Token)
+ {
+ if (strstr (Token, "Keyword"))
+ {
+ if (FirstKeyword)
+ {
+ printf ("\n");
+ FirstKeyword = FALSE;
+ }
+
+ /* Found a keyword, display keyword information */
+
+ AhFindAslKeywords (Token);
+ }
+
+ Token = strtok (NULL, Separators);
+ }
+}
diff --git a/source/tools/acpihelp/ahaslkey.c b/source/tools/acpihelp/ahaslkey.c
index 62791801f0c8..37d3ee9c52e6 100644
--- a/source/tools/acpihelp/ahaslkey.c
+++ b/source/tools/acpihelp/ahaslkey.c
@@ -48,7 +48,7 @@
* ASL Keyword types and associated actual keywords.
* This table was extracted from the ACPI specification.
*/
-const AH_ASL_KEYWORD AslKeywordInfo[] =
+const AH_ASL_KEYWORD Gbl_AslKeywordInfo[] =
{
{"AccessAttribKeyword", "Serial Bus Attributes (with legacy SMBus aliases)",
":= AttribQuick (SMBusQuick) | AttribSendReceive (SMBusSendReceive) | "
@@ -151,7 +151,7 @@ const AH_ASL_KEYWORD AslKeywordInfo[] =
/* Preprocessor directives */
-const AH_DIRECTIVE_INFO PreprocessorDirectives[] =
+const AH_DIRECTIVE_INFO Gbl_PreprocessorDirectives[] =
{
{"#include \"Filename\"", "Standard include of an ASCII ASL source code file"},
{"#include <Filename>", "Alternate syntax for #include, alternate search path"},
diff --git a/source/tools/acpihelp/ahaslops.c b/source/tools/acpihelp/ahaslops.c
index 39abc31b44f5..7437fccd6379 100644
--- a/source/tools/acpihelp/ahaslops.c
+++ b/source/tools/acpihelp/ahaslops.c
@@ -48,7 +48,7 @@
* Note: All tokens require a space separator.
* Long lines are automatically split during output.
*/
-const AH_ASL_OPERATOR AslOperatorInfo[] =
+const AH_ASL_OPERATOR Gbl_AslOperatorInfo[] =
{
{"AccessAs", "(AccessType, AccessAttribKeyword | "
"ExtendedAttribKeyword (AccessLength))",
diff --git a/source/tools/acpihelp/ahdecode.c b/source/tools/acpihelp/ahdecode.c
index 5f422904a53c..c1ac74c3c0ed 100644
--- a/source/tools/acpihelp/ahdecode.c
+++ b/source/tools/acpihelp/ahdecode.c
@@ -1,6 +1,6 @@
/******************************************************************************
*
- * Module Name: ahdecode - Operator/Opcode decoding for acpihelp utility
+ * Module Name: ahdecode - Miscellaneous decoding for acpihelp utility
*
*****************************************************************************/
@@ -48,19 +48,6 @@
#include "acpredef.h"
-#define AH_DISPLAY_EXCEPTION(Status, Name) \
- printf ("%.4X: %s\n", Status, Name)
-
-#define AH_DISPLAY_EXCEPTION_TEXT(Status, Exception) \
- printf ("%.4X: %-28s (%s)\n", Status, Exception->Name, Exception->Description)
-
-#define BUFFER_LENGTH 128
-#define LINE_BUFFER_LENGTH 512
-
-static char Gbl_Buffer[BUFFER_LENGTH];
-static char Gbl_LineBuffer[LINE_BUFFER_LENGTH];
-
-
/* Local prototypes */
static BOOLEAN
@@ -76,32 +63,77 @@ static void
AhDisplayResourceName (
const ACPI_PREDEFINED_INFO *ThisName);
-static void
-AhDisplayAmlOpcode (
- const AH_AML_OPCODE *Op);
-
-static void
-AhDisplayAmlType (
- const AH_AML_TYPE *Op);
-
-static void
-AhDisplayAslOperator (
- const AH_ASL_OPERATOR *Op);
-
-static void
-AhDisplayOperatorKeywords (
- const AH_ASL_OPERATOR *Op);
-static void
-AhDisplayAslKeyword (
- const AH_ASL_KEYWORD *Op);
+/*******************************************************************************
+ *
+ * FUNCTION: AhPrintOneField
+ *
+ * PARAMETERS: Indent - Indent length for new line(s)
+ * CurrentPosition - Position on current line
+ * MaxPosition - Max allowed line length
+ * Field - Data to output
+ *
+ * RETURN: Line position after field is written
+ *
+ * DESCRIPTION: Split long lines appropriately for ease of reading.
+ *
+ ******************************************************************************/
-static void
+void
AhPrintOneField (
UINT32 Indent,
UINT32 CurrentPosition,
UINT32 MaxPosition,
- const char *Field);
+ const char *Field)
+{
+ UINT32 Position;
+ UINT32 TokenLength;
+ const char *This;
+ const char *Next;
+ const char *Last;
+
+
+ This = Field;
+ Position = CurrentPosition;
+
+ if (Position == 0)
+ {
+ printf ("%*s", (int) Indent, " ");
+ Position = Indent;
+ }
+
+ Last = This + strlen (This);
+ while ((Next = strpbrk (This, " ")))
+ {
+ TokenLength = Next - This;
+ Position += TokenLength;
+
+ /* Split long lines */
+
+ if (Position > MaxPosition)
+ {
+ printf ("\n%*s", (int) Indent, " ");
+ Position = TokenLength;
+ }
+
+ printf ("%.*s ", (int) TokenLength, This);
+ This = Next + 1;
+ }
+
+ /* Handle last token on the input line */
+
+ TokenLength = Last - This;
+ if (TokenLength > 0)
+ {
+ Position += TokenLength;
+ if (Position > MaxPosition)
+ {
+ printf ("\n%*s", (int) Indent, " ");
+ }
+
+ printf ("%s", This);
+ }
+}
/*******************************************************************************
@@ -125,7 +157,7 @@ AhDisplayDirectives (
printf ("iASL Preprocessor Directives\n\n");
- for (Info = PreprocessorDirectives; Info->Name; Info++)
+ for (Info = Gbl_PreprocessorDirectives; Info->Name; Info++)
{
printf (" %-36s : %s\n", Info->Name, Info->Description);
}
@@ -329,632 +361,6 @@ AhDisplayResourceName (
/*******************************************************************************
*
- * FUNCTION: AhFindAmlOpcode (entry point for AML opcode name search)
- *
- * PARAMETERS: Name - Name or prefix for an AML opcode.
- * NULL means "find all"
- *
- * RETURN: None
- *
- * DESCRIPTION: Find all AML opcodes that match the input Name or name
- * prefix.
- *
- ******************************************************************************/
-
-void
-AhFindAmlOpcode (
- char *Name)
-{
- const AH_AML_OPCODE *Op;
- BOOLEAN Found = FALSE;
-
-
- AcpiUtStrupr (Name);
-
- /* Find/display all opcode names that match the input name prefix */
-
- for (Op = AmlOpcodeInfo; Op->OpcodeString; Op++)
- {
- if (!Op->OpcodeName) /* Unused opcodes */
- {
- continue;
- }
-
- if (!Name || (Name[0] == '*'))
- {
- AhDisplayAmlOpcode (Op);
- Found = TRUE;
- continue;
- }
-
- /* Upper case the opcode name before substring compare */
-
- strcpy (Gbl_Buffer, Op->OpcodeName);
- AcpiUtStrupr (Gbl_Buffer);
-
- if (strstr (Gbl_Buffer, Name) == Gbl_Buffer)
- {
- AhDisplayAmlOpcode (Op);
- Found = TRUE;
- }
- }
-
- if (!Found)
- {
- printf ("%s, no matching AML operators\n", Name);
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AhDecodeAmlOpcode (entry point for AML opcode search)
- *
- * PARAMETERS: OpcodeString - String version of AML opcode
- *
- * RETURN: None
- *
- * DESCRIPTION: Display information about the input AML opcode
- *
- ******************************************************************************/
-
-void
-AhDecodeAmlOpcode (
- char *OpcodeString)
-{
- const AH_AML_OPCODE *Op;
- UINT32 Opcode;
- UINT8 Prefix;
-
-
- if (!OpcodeString)
- {
- AhFindAmlOpcode (NULL);
- return;
- }
-
- Opcode = strtoul (OpcodeString, NULL, 16);
- if (Opcode > ACPI_UINT16_MAX)
- {
- printf ("Invalid opcode (more than 16 bits)\n");
- return;
- }
-
- /* Only valid opcode extension is 0x5B */
-
- Prefix = (Opcode & 0x0000FF00) >> 8;
- if (Prefix && (Prefix != 0x5B))
- {
- printf ("Invalid opcode (invalid extension prefix 0x%X)\n",
- Prefix);
- return;
- }
-
- /* Find/Display the opcode. May fall within an opcode range */
-
- for (Op = AmlOpcodeInfo; Op->OpcodeString; Op++)
- {
- if ((Opcode >= Op->OpcodeRangeStart) &&
- (Opcode <= Op->OpcodeRangeEnd))
- {
- AhDisplayAmlOpcode (Op);
- }
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AhDisplayAmlOpcode
- *
- * PARAMETERS: Op - An opcode info struct
- *
- * RETURN: None
- *
- * DESCRIPTION: Display the contents of an AML opcode information struct
- *
- ******************************************************************************/
-
-static void
-AhDisplayAmlOpcode (
- const AH_AML_OPCODE *Op)
-{
-
- if (!Op->OpcodeName)
- {
- printf ("%18s: Opcode=%-9s\n", "Reserved opcode", Op->OpcodeString);
- return;
- }
-
- /* Opcode name and value(s) */
-
- printf ("%18s: Opcode=%-9s Type (%s)",
- Op->OpcodeName, Op->OpcodeString, Op->Type);
-
- /* Optional fixed/static arguments */
-
- if (Op->FixedArguments)
- {
- printf (" FixedArgs (");
- AhPrintOneField (37, 36 + 7 + strlen (Op->Type) + 12,
- AH_MAX_AML_LINE_LENGTH, Op->FixedArguments);
- printf (")");
- }
-
- /* Optional variable-length argument list */
-
- if (Op->VariableArguments)
- {
- if (Op->FixedArguments)
- {
- printf ("\n%*s", 36, " ");
- }
- printf (" VariableArgs (");
- AhPrintOneField (37, 15, AH_MAX_AML_LINE_LENGTH, Op->VariableArguments);
- printf (")");
- }
- printf ("\n");
-
- /* Grammar specification */
-
- if (Op->Grammar)
- {
- AhPrintOneField (37, 0, AH_MAX_AML_LINE_LENGTH, Op->Grammar);
- printf ("\n");
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AhFindAmlTypes (entry point for AML grammar keyword search)
- *
- * PARAMETERS: Name - Name or prefix for an AML grammar element.
- * NULL means "find all"
- *
- * RETURN: None
- *
- * DESCRIPTION: Find all AML grammar keywords that match the input Name or name
- * prefix.
- *
- ******************************************************************************/
-
-void
-AhFindAmlTypes (
- char *Name)
-{
- const AH_AML_TYPE *Keyword;
- BOOLEAN Found = FALSE;
-
-
- AcpiUtStrupr (Name);
-
- for (Keyword = AmlTypesInfo; Keyword->Name; Keyword++)
- {
- if (!Name)
- {
- printf (" %s\n", Keyword->Name);
- Found = TRUE;
- continue;
- }
-
- if (*Name == '*')
- {
- AhDisplayAmlType (Keyword);
- Found = TRUE;
- continue;
- }
-
- /* Upper case the operator name before substring compare */
-
- strcpy (Gbl_Buffer, Keyword->Name);
- AcpiUtStrupr (Gbl_Buffer);
-
- if (strstr (Gbl_Buffer, Name) == Gbl_Buffer)
- {
- AhDisplayAmlType (Keyword);
- Found = TRUE;
- }
- }
-
- if (!Found)
- {
- printf ("%s, no matching AML grammar type\n", Name);
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AhDisplayAmlType
- *
- * PARAMETERS: Op - Pointer to AML grammar info
- *
- * RETURN: None
- *
- * DESCRIPTION: Format and display info for an AML grammar element.
- *
- ******************************************************************************/
-
-static void
-AhDisplayAmlType (
- const AH_AML_TYPE *Op)
-{
- char *Description;
-
-
- Description = Op->Description;
- printf ("%4s", " "); /* Primary indent */
-
- /* Emit the entire description string */
-
- while (*Description)
- {
- /* Description can be multiple lines, must indent each */
-
- while (*Description != '\n')
- {
- printf ("%c", *Description);
- Description++;
- }
-
- printf ("\n");
- Description++;
-
- /* Do indent */
-
- if (*Description)
- {
- printf ("%8s", " "); /* Secondary indent */
-
- /* Index extra for a comment */
-
- if ((Description[0] == '/') &&
- (Description[1] == '/'))
- {
- printf ("%4s", " ");
- }
- }
- }
-
- printf ("\n");
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AhFindAslKeywords (entry point for ASL keyword search)
- *
- * PARAMETERS: Name - Name or prefix for an ASL keyword.
- * NULL means "find all"
- *
- * RETURN: None
- *
- * DESCRIPTION: Find all ASL keywords that match the input Name or name
- * prefix.
- *
- ******************************************************************************/
-
-void
-AhFindAslKeywords (
- char *Name)
-{
- const AH_ASL_KEYWORD *Keyword;
- BOOLEAN Found = FALSE;
-
-
- AcpiUtStrupr (Name);
-
- for (Keyword = AslKeywordInfo; Keyword->Name; Keyword++)
- {
- if (!Name || (Name[0] == '*'))
- {
- AhDisplayAslKeyword (Keyword);
- Found = TRUE;
- continue;
- }
-
- /* Upper case the operator name before substring compare */
-
- strcpy (Gbl_Buffer, Keyword->Name);
- AcpiUtStrupr (Gbl_Buffer);
-
- if (strstr (Gbl_Buffer, Name) == Gbl_Buffer)
- {
- AhDisplayAslKeyword (Keyword);
- Found = TRUE;
- }
- }
-
- if (!Found)
- {
- printf ("%s, no matching ASL keywords\n", Name);
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AhDisplayAslKeyword
- *
- * PARAMETERS: Op - Pointer to ASL keyword with syntax info
- *
- * RETURN: None
- *
- * DESCRIPTION: Format and display syntax info for an ASL keyword. Splits
- * long lines appropriately for reading.
- *
- ******************************************************************************/
-
-static void
-AhDisplayAslKeyword (
- const AH_ASL_KEYWORD *Op)
-{
-
- /* ASL keyword name and description */
-
- printf ("%22s: %s\n", Op->Name, Op->Description);
- if (!Op->KeywordList)
- {
- return;
- }
-
- /* List of actual keywords */
-
- AhPrintOneField (24, 0, AH_MAX_ASL_LINE_LENGTH, Op->KeywordList);
- printf ("\n");
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AhFindAslAndAmlOperators
- *
- * PARAMETERS: Name - Name or prefix for an ASL operator.
- * NULL means "find all"
- *
- * RETURN: None
- *
- * DESCRIPTION: Find all ASL operators that match the input Name or name
- * prefix. Also displays the AML information if only one entry
- * matches.
- *
- ******************************************************************************/
-
-void
-AhFindAslAndAmlOperators (
- char *Name)
-{
- UINT32 MatchCount;
-
-
- MatchCount = AhFindAslOperators (Name);
- if (MatchCount == 1)
- {
- AhFindAmlOpcode (Name);
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AhFindAslOperators (entry point for ASL operator search)
- *
- * PARAMETERS: Name - Name or prefix for an ASL operator.
- * NULL means "find all"
- *
- * RETURN: Number of operators that matched the name prefix.
- *
- * DESCRIPTION: Find all ASL operators that match the input Name or name
- * prefix.
- *
- ******************************************************************************/
-
-UINT32
-AhFindAslOperators (
- char *Name)
-{
- const AH_ASL_OPERATOR *Operator;
- BOOLEAN MatchCount = 0;
-
-
- AcpiUtStrupr (Name);
-
- /* Find/display all names that match the input name prefix */
-
- for (Operator = AslOperatorInfo; Operator->Name; Operator++)
- {
- if (!Name || (Name[0] == '*'))
- {
- AhDisplayAslOperator (Operator);
- MatchCount++;
- continue;
- }
-
- /* Upper case the operator name before substring compare */
-
- strcpy (Gbl_Buffer, Operator->Name);
- AcpiUtStrupr (Gbl_Buffer);
-
- if (strstr (Gbl_Buffer, Name) == Gbl_Buffer)
- {
- AhDisplayAslOperator (Operator);
- MatchCount++;
- }
- }
-
- if (!MatchCount)
- {
- printf ("%s, no matching ASL operators\n", Name);
- }
-
- return (MatchCount);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AhDisplayAslOperator
- *
- * PARAMETERS: Op - Pointer to ASL operator with syntax info
- *
- * RETURN: None
- *
- * DESCRIPTION: Format and display syntax info for an ASL operator. Splits
- * long lines appropriately for reading.
- *
- ******************************************************************************/
-
-static void
-AhDisplayAslOperator (
- const AH_ASL_OPERATOR *Op)
-{
-
- /* ASL operator name and description */
-
- printf ("%16s: %s\n", Op->Name, Op->Description);
- if (!Op->Syntax)
- {
- return;
- }
-
- /* Syntax for the operator */
-
- AhPrintOneField (18, 0, AH_MAX_ASL_LINE_LENGTH, Op->Syntax);
- printf ("\n");
-
- AhDisplayOperatorKeywords (Op);
- printf ("\n");
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AhDisplayOperatorKeywords
- *
- * PARAMETERS: Op - Pointer to ASL keyword with syntax info
- *
- * RETURN: None
- *
- * DESCRIPTION: Display any/all keywords that are associated with the ASL
- * operator.
- *
- ******************************************************************************/
-
-static void
-AhDisplayOperatorKeywords (
- const AH_ASL_OPERATOR *Op)
-{
- char *Token;
- char *Separators = "(){}, ";
- BOOLEAN FirstKeyword = TRUE;
-
-
- if (!Op || !Op->Syntax)
- {
- return;
- }
-
- /*
- * Find all parameters that have the word "keyword" within, and then
- * display the info about that keyword
- */
- strcpy (Gbl_LineBuffer, Op->Syntax);
- Token = strtok (Gbl_LineBuffer, Separators);
- while (Token)
- {
- if (strstr (Token, "Keyword"))
- {
- if (FirstKeyword)
- {
- printf ("\n");
- FirstKeyword = FALSE;
- }
-
- /* Found a keyword, display keyword information */
-
- AhFindAslKeywords (Token);
- }
-
- Token = strtok (NULL, Separators);
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AhPrintOneField
- *
- * PARAMETERS: Indent - Indent length for new line(s)
- * CurrentPosition - Position on current line
- * MaxPosition - Max allowed line length
- * Field - Data to output
- *
- * RETURN: Line position after field is written
- *
- * DESCRIPTION: Split long lines appropriately for ease of reading.
- *
- ******************************************************************************/
-
-static void
-AhPrintOneField (
- UINT32 Indent,
- UINT32 CurrentPosition,
- UINT32 MaxPosition,
- const char *Field)
-{
- UINT32 Position;
- UINT32 TokenLength;
- const char *This;
- const char *Next;
- const char *Last;
-
-
- This = Field;
- Position = CurrentPosition;
-
- if (Position == 0)
- {
- printf ("%*s", (int) Indent, " ");
- Position = Indent;
- }
-
- Last = This + strlen (This);
- while ((Next = strpbrk (This, " ")))
- {
- TokenLength = Next - This;
- Position += TokenLength;
-
- /* Split long lines */
-
- if (Position > MaxPosition)
- {
- printf ("\n%*s", (int) Indent, " ");
- Position = TokenLength;
- }
-
- printf ("%.*s ", (int) TokenLength, This);
- This = Next + 1;
- }
-
- /* Handle last token on the input line */
-
- TokenLength = Last - This;
- if (TokenLength > 0)
- {
- Position += TokenLength;
- if (Position > MaxPosition)
- {
- printf ("\n%*s", (int) Indent, " ");
- }
-
- printf ("%s", This);
- }
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AhDisplayDeviceIds
*
* PARAMETERS: Name - Device Hardware ID string.
@@ -1049,7 +455,7 @@ AhDisplayUuids (
/* Display entire table of known ACPI-related UUIDs/GUIDs */
- for (Info = AcpiUuids; Info->Description; Info++)
+ for (Info = Gbl_AcpiUuids; Info->Description; Info++)
{
if (!Info->String) /* Null UUID string means group description */
{
@@ -1096,7 +502,7 @@ AhDisplayTables (
printf ("Known ACPI tables:\n");
- for (Info = AcpiSupportedTables; Info->Signature; Info++)
+ for (Info = Gbl_AcpiSupportedTables; Info->Signature; Info++)
{
printf ("%8s : %s\n", Info->Signature, Info->Description);
i++;
diff --git a/source/tools/acpihelp/ahgrammar.c b/source/tools/acpihelp/ahgrammar.c
index 1e0d54974689..d345893a1fb7 100644
--- a/source/tools/acpihelp/ahgrammar.c
+++ b/source/tools/acpihelp/ahgrammar.c
@@ -43,7 +43,7 @@
#include "acpihelp.h"
-const AH_AML_TYPE AmlTypesInfo[] =
+const AH_AML_TYPE Gbl_AmlTypesInfo[] =
{
{"ComputationalData",
"ComputationalData :=\n"
diff --git a/source/tools/acpihelp/ahmain.c b/source/tools/acpihelp/ahmain.c
index 1c45e436269e..b62ec62f5eb1 100644
--- a/source/tools/acpihelp/ahmain.c
+++ b/source/tools/acpihelp/ahmain.c
@@ -41,6 +41,7 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
+#define DEFINE_AHELP_GLOBALS
#include "acpihelp.h"
@@ -61,6 +62,7 @@ AhDisplayUsage (
#define ACPI_OPTION(Name, Description) \
AcpiOsPrintf (" %-24s%s\n", Name, Description);
+
/******************************************************************************
*
* FUNCTION: AhDisplayUsage
diff --git a/source/tools/efihello/efihello.c b/source/tools/efihello/efihello.c
new file mode 100644
index 000000000000..ac7a64ce715b
--- /dev/null
+++ b/source/tools/efihello/efihello.c
@@ -0,0 +1,124 @@
+/******************************************************************************
+ *
+ * Module Name: efihello - very simple ACPICA/EFI integration example
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2016, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include "acpi.h"
+#include "accommon.h"
+#include "acapps.h"
+
+
+#define LINE_SIZE 256
+static char LineBuffer[LINE_SIZE];
+
+/******************************************************************************
+ *
+ * FUNCTION: main
+ *
+ * PARAMETERS: argc/argv - Standard argc/argv
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: C main function for efihello
+ *
+ ******************************************************************************/
+
+#ifndef _GNU_EFI
+int ACPI_SYSTEM_XFACE
+main (
+ int argc,
+ char *argv[])
+#else
+int ACPI_SYSTEM_XFACE
+acpi_main (
+ int argc,
+ char *argv[])
+#endif
+{
+ ACPI_FILE File;
+ BOOLEAN DoCloseFile = FALSE;
+ char *Result;
+
+
+ AcpiOsInitialize ();
+
+ printf ("argc=%d\n", argc);
+
+ if (argc > 1)
+ {
+ File = fopen (argv[1], "r");
+ if (!File)
+ {
+ printf ("Failed to open %s.\n", argv[1]);
+ return (-1);
+ }
+ DoCloseFile = TRUE;
+ }
+ else
+ {
+ File = stdin;
+ }
+
+ while (1)
+ {
+ Result = fgets (LineBuffer, LINE_SIZE, File);
+ if (!Result)
+ {
+ printf ("Failed to read %s.\n", argv[1]);
+ fclose (File);
+ return (-2);
+ }
+
+ printf ("%s", LineBuffer);
+
+ if (strncmp (Result, "exit", 4) == 0)
+ {
+ break;
+ }
+ }
+
+
+ if (DoCloseFile)
+ {
+ fclose (File);
+ }
+ return (0);
+}
diff --git a/tests/misc/grammar.asl b/tests/misc/grammar.asl
index 1b89e59993b7..080a36546a72 100644
--- a/tests/misc/grammar.asl
+++ b/tests/misc/grammar.asl
@@ -965,19 +965,20 @@ DefinitionBlock (
Store ("DIV0 - noabort", Debug)
}
- Method (ERR_, 1)
+ Method (ERR_, 2)
{
+ Local0 = ToDecimalString (Arg1)
if (LEqual (Arg0, 0))
{
- Store ("+*+*+*+* MTHD_ERROR: Results not equal!", Debug)
+ Printf ("+*+*+*+* MTHD_ERROR at line %o: Results not equal!", Local0)
}
if (LEqual (Arg0, 1))
{
- Store ("+*+*+*+* MTHD_ERROR: Numeric result is incorrect!", Debug)
+ Printf ("+*+*+*+* MTHD_ERROR at line %o: Numeric result is incorrect!", Local0)
}
if (LEqual (Arg0, 2))
{
- Store ("+*+*+*+* MTHD_ERROR: Operand was clobbered!", Debug)
+ Printf ("+*+*+*+* MTHD_ERROR at line %o: Operand was clobbered!", Local0)
}
Notify (DEV1, Arg0)
@@ -1033,245 +1034,245 @@ DefinitionBlock (
Store (\IFEL.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\NOSV.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\IDXF.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\_SB_.NSTL.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\RTBF.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\_SB_.RTLV.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\_SB_.RETP.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\WHLR.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\ANDO.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\BRKP.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\ADSU.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\INDC.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\LOPS.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\FDSO.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\MLDV.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\NBIT.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\SHFT.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\XORD.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\CRBF.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\IDX4.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\EVNT.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\SZLV.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\_SB_.BYTF.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\DWDF.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\DVAX.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\IDX6.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\IDX5.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\_SB_.IDX0.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\_SB_.IDX3.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\IDX7.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\MTCH.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\WHLB.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\_SB_.IDX2.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\SIZO.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
Store (\_SB_.SMIS.TEST(), Local0)
if (LGreater (Local0, 0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
Return(Local0)
}
@@ -1331,14 +1332,14 @@ DefinitionBlock (
Store (BIT2, Local0)
if (LNotEqual (Local0, 0x1))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
}
else
{
Store (DerefOf (Index (BUF2, 0)), Local0)
if (LNotEqual (Local0, 0x08))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
}
else
{
@@ -1350,7 +1351,7 @@ DefinitionBlock (
Store (BYT2, Local0)
if (LNotEqual (Local0, 0x1A))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
}
else
{
@@ -1361,7 +1362,7 @@ DefinitionBlock (
Store (WRD2, Local0)
if (LNotEqual (Local0, 0x1234))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
}
else
{
@@ -1372,7 +1373,7 @@ DefinitionBlock (
Store (FLD2, Local0)
if (LNotEqual (Local0, 0x123))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
}
else
{
@@ -1383,7 +1384,7 @@ DefinitionBlock (
Store (DWD2, Local0)
if (LNotEqual (Local0, 0x12345678))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
}
else
{
@@ -1394,7 +1395,7 @@ DefinitionBlock (
Store (QWD2, Local0)
if (LNotEqual (Local0, 0x1234567887654321))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
}
else
{
@@ -1546,7 +1547,7 @@ DefinitionBlock (
Store ("++++++++ Checking result from ADD", Debug)
if (LNotEqual (Local0, Local1))
{
- ERR_ (0)
+ ERR_ (0, __LINE__)
}
@@ -1561,7 +1562,7 @@ DefinitionBlock (
Store ("++++++++ Checking result from SUBTRACT", Debug)
if (LNotEqual (Local4, Local5))
{
- ERR_ (0)
+ ERR_ (0, __LINE__)
}
@@ -1577,7 +1578,7 @@ DefinitionBlock (
Store ("++++++++ Checking result from MULTIPLY", Debug)
if (LNotEqual (Local6, Local7))
{
- ERR_ (0)
+ ERR_ (0, __LINE__)
}
@@ -1592,7 +1593,7 @@ DefinitionBlock (
Store ("++++++++ Checking (quotient) result from DIVIDE", Debug)
if (LNotEqual (Local2, Local3))
{
- ERR_ (0)
+ ERR_ (0, __LINE__)
}
@@ -1606,7 +1607,7 @@ DefinitionBlock (
Store ("++++++++ Checking result from INCREMENT", Debug)
if (LNotEqual (Local0, Local1))
{
- ERR_ (0)
+ ERR_ (0, __LINE__)
}
@@ -1620,7 +1621,7 @@ DefinitionBlock (
Store ("++++++++ Checking result from DECREMENT", Debug)
if (LNotEqual (Local0, Local1))
{
- ERR_ (0)
+ ERR_ (0, __LINE__)
}
@@ -1649,22 +1650,22 @@ DefinitionBlock (
Add (Local0, Local1)
if (LNotEqual (Local0, 3))
{
- ERR_ (2)
+ ERR_ (2, __LINE__)
}
if (LNotEqual (Local1, 7))
{
- ERR_ (2)
+ ERR_ (2, __LINE__)
}
Add (Local0, Local1, Local2)
if (LNotEqual (Local0, 3))
{
- ERR_ (2)
+ ERR_ (2, __LINE__)
}
if (LNotEqual (Local1, 7))
{
- ERR_ (2)
+ ERR_ (2, __LINE__)
}
}
@@ -1692,63 +1693,63 @@ DefinitionBlock (
FindSetLeftBit (0x00100100, Local0)
if (LNotEqual (Local0, 21))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
}
Store ("++++++++ FindSetRightBit (0x00100100, Local1)", Debug)
FindSetRightBit (0x00100100, Local1)
if (LNotEqual (Local1, 9))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
}
Store ("++++++++ And (0xF0F0F0F0, 0x11111111, Local2)", Debug)
And (0xF0F0F0F0, 0x11111111, Local2)
if (LNotEqual (Local2, 0x10101010))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
}
Store ("++++++++ NAnd (0xF0F0F0F0, 0x11111111, Local3)", Debug)
NAnd (0xF0F0F0F0, 0x11111111, Local3)
if (LNotEqual (Local3, 0xEFEFEFEF))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
}
Store ("++++++++ Or (0x11111111, 0x22222222, Local4)", Debug)
Or (0x11111111, 0x22222222, Local4)
if (LNotEqual (Local4, 0x33333333))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
}
Store ("++++++++ NOr (0x11111111, 0x22222222, Local5)", Debug)
NOr (0x11111111, 0x22222222, Local5)
if (LNotEqual (Local5, 0xCCCCCCCC))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
}
Store ("++++++++ XOr (0x11113333, 0x22222222, Local6)", Debug)
XOr (0x11113333, 0x22222222, Local6)
if (LNotEqual (Local6, 0x33331111))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
}
Store ("++++++++ ShiftLeft (0x11112222, 2, Local7)", Debug)
ShiftLeft (0x11112222, 2, Local7)
if (LNotEqual (Local7, 0x44448888))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
}
Store ("++++++++ ShiftRight (Local7, 2, Local7)", Debug)
ShiftRight (Local7, 2, Local7)
if (LNotEqual (Local7, 0x11112222))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
}
@@ -1757,12 +1758,12 @@ DefinitionBlock (
Not (Local0, Local1)
if (LNotEqual (Local0, 0x22224444))
{
- ERR_ (2)
+ ERR_ (2, __LINE__)
}
if (LNotEqual (Local1, 0xDDDDBBBB))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
}
Return (Local7)
@@ -1795,12 +1796,12 @@ DefinitionBlock (
Store (LNot (Local6), Local7)
if (LNotEqual (Local6, 0x00001111))
{
- ERR_ (2)
+ ERR_ (2, __LINE__)
}
if (LNotEqual (Local7, 0x0))
{
- ERR_ (1)
+ ERR_ (1, __LINE__)
}
@@ -1933,25 +1934,25 @@ DefinitionBlock (
Store (CondRefOf (ABCD, Local0), Local1)
if (LNotEqual (Local1, 0))
{
- ERR_ (2)
+ ERR_ (2, __LINE__)
}
Store (CondRefOf (BBUF, Local0), Local1)
if (LNotEqual (Local1, Ones))
{
- ERR_ (2)
+ ERR_ (2, __LINE__)
}
Store (DeRefOf (Index (BBUF, 3)), Local6)
if (LNotEqual (Local6, 0xB3))
{
- ERR_ (2)
+ ERR_ (2, __LINE__)
}
Store (DeRefOf (Index (DeRefOf (Index (NEST, 1)), 3)), Local0)
if (LNotEqual (Local0, 0x14))
{
- ERR_ (2)
+ ERR_ (2, __LINE__)
}
@@ -1961,7 +1962,7 @@ DefinitionBlock (
Store (DerefOf (Local1), Local2)
If (LNotEqual (Local2, 0x11223344))
{
- ERR_ (2)
+ ERR_ (2, __LINE__)
}