svn commit: r311462 - in head: sys/conf sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/debugger sys/contrib/dev/acpica/compon...
Jung-uk Kim
jkim at FreeBSD.org
Thu Jan 5 21:28:28 UTC 2017
Author: jkim
Date: Thu Jan 5 21:28:25 2017
New Revision: 311462
URL: https://svnweb.freebsd.org/changeset/base/311462
Log:
Merge ACPICA 20161222.
Added:
head/sys/contrib/dev/acpica/os_specific/service_layers/osgendbg.c
- copied, changed from r310450, vendor-sys/acpica/dist/source/os_specific/service_layers/osgendbg.c
Modified:
head/sys/conf/files
head/sys/contrib/dev/acpica/acpica_prep.sh
head/sys/contrib/dev/acpica/changes.txt
head/sys/contrib/dev/acpica/common/acfileio.c
head/sys/contrib/dev/acpica/common/ahtable.c
head/sys/contrib/dev/acpica/common/ahuuids.c
head/sys/contrib/dev/acpica/compiler/aslutils.c
head/sys/contrib/dev/acpica/components/debugger/dbinput.c
head/sys/contrib/dev/acpica/components/debugger/dbxface.c
head/sys/contrib/dev/acpica/components/disassembler/dmopcode.c
head/sys/contrib/dev/acpica/components/disassembler/dmwalk.c
head/sys/contrib/dev/acpica/components/executer/exconfig.c
head/sys/contrib/dev/acpica/components/executer/exfldio.c
head/sys/contrib/dev/acpica/components/hardware/hwesleep.c
head/sys/contrib/dev/acpica/components/hardware/hwregs.c
head/sys/contrib/dev/acpica/components/hardware/hwsleep.c
head/sys/contrib/dev/acpica/components/parser/psargs.c
head/sys/contrib/dev/acpica/components/parser/pstree.c
head/sys/contrib/dev/acpica/components/utilities/utdecode.c
head/sys/contrib/dev/acpica/components/utilities/utdelete.c
head/sys/contrib/dev/acpica/components/utilities/utmutex.c
head/sys/contrib/dev/acpica/components/utilities/utresrc.c
head/sys/contrib/dev/acpica/include/acclib.h
head/sys/contrib/dev/acpica/include/acdebug.h
head/sys/contrib/dev/acpica/include/acdisasm.h
head/sys/contrib/dev/acpica/include/acexcep.h
head/sys/contrib/dev/acpica/include/acglobal.h
head/sys/contrib/dev/acpica/include/aclocal.h
head/sys/contrib/dev/acpica/include/acmacros.h
head/sys/contrib/dev/acpica/include/acpiosxf.h
head/sys/contrib/dev/acpica/include/acpixf.h
head/sys/contrib/dev/acpica/include/platform/acenv.h
head/sys/contrib/dev/acpica/os_specific/service_layers/osunixxf.c
head/sys/dev/acpica/Osd/OsdDebug.c
head/sys/dev/acpica/Osd/OsdHardware.c
head/usr.sbin/acpi/acpidb/Makefile
head/usr.sbin/acpi/acpidb/acpidb.c
Directory Properties:
head/sys/contrib/dev/acpica/ (props changed)
Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files Thu Jan 5 21:17:10 2017 (r311461)
+++ head/sys/conf/files Thu Jan 5 21:28:25 2017 (r311462)
@@ -496,7 +496,7 @@ contrib/dev/acpica/components/utilities/
contrib/dev/acpica/components/utilities/utxface.c optional acpi
contrib/dev/acpica/components/utilities/utxferror.c optional acpi
contrib/dev/acpica/components/utilities/utxfinit.c optional acpi
-#contrib/dev/acpica/components/utilities/utxfmutex.c optional acpi
+contrib/dev/acpica/os_specific/service_layers/osgendbg.c optional acpi acpi_debug
contrib/ipfilter/netinet/fil.c optional ipfilter inet \
compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN} -Wno-unused -I$S/contrib/ipfilter"
contrib/ipfilter/netinet/ip_auth.c optional ipfilter inet \
Modified: head/sys/contrib/dev/acpica/acpica_prep.sh
==============================================================================
--- head/sys/contrib/dev/acpica/acpica_prep.sh Thu Jan 5 21:17:10 2017 (r311461)
+++ head/sys/contrib/dev/acpica/acpica_prep.sh Thu Jan 5 21:28:25 2017 (r311462)
@@ -17,7 +17,7 @@ dst="$(realpath .)/acpi_ca_destination"
fulldirs="common compiler components include os_specific"
# files to remove
-stripdirs="generate libraries tests tools"
+stripdirs="generate libraries parsers preprocessor tests tools"
stripfiles="Makefile README accygwin.h acdragonfly.h acdragonflyex.h \
acefi.h acefiex.h achaiku.h acintel.h aclinux.h aclinuxex.h \
acmacosx.h acmsvc.h acmsvcex.h acnetbsd.h acos2.h acqnx.h \
Modified: head/sys/contrib/dev/acpica/changes.txt
==============================================================================
--- head/sys/contrib/dev/acpica/changes.txt Thu Jan 5 21:17:10 2017 (r311461)
+++ head/sys/contrib/dev/acpica/changes.txt Thu Jan 5 21:28:25 2017 (r311462)
@@ -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:
Modified: head/sys/contrib/dev/acpica/common/acfileio.c
==============================================================================
--- head/sys/contrib/dev/acpica/common/acfileio.c Thu Jan 5 21:17:10 2017 (r311461)
+++ head/sys/contrib/dev/acpica/common/acfileio.c Thu Jan 5 21:28:25 2017 (r311462)
@@ -403,7 +403,7 @@ AcValidateTableHeader (
UINT32 i;
- ACPI_FUNCTION_TRACE ("AcValidateTableHeader");
+ ACPI_FUNCTION_TRACE (AcValidateTableHeader);
/* Read a potential table header */
Modified: head/sys/contrib/dev/acpica/common/ahtable.c
==============================================================================
--- head/sys/contrib/dev/acpica/common/ahtable.c Thu Jan 5 21:17:10 2017 (r311461)
+++ head/sys/contrib/dev/acpica/common/ahtable.c Thu Jan 5 21:28:25 2017 (r311462)
@@ -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"},
Modified: head/sys/contrib/dev/acpica/common/ahuuids.c
==============================================================================
--- head/sys/contrib/dev/acpica/common/ahuuids.c Thu Jan 5 21:17:10 2017 (r311461)
+++ head/sys/contrib/dev/acpica/common/ahuuids.c Thu Jan 5 21:28:25 2017 (r311462)
@@ -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 */
Modified: head/sys/contrib/dev/acpica/compiler/aslutils.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslutils.c Thu Jan 5 21:17:10 2017 (r311461)
+++ head/sys/contrib/dev/acpica/compiler/aslutils.c Thu Jan 5 21:28:25 2017 (r311462)
@@ -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,
Modified: head/sys/contrib/dev/acpica/components/debugger/dbinput.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/debugger/dbinput.c Thu Jan 5 21:17:10 2017 (r311461)
+++ head/sys/contrib/dev/acpica/components/debugger/dbinput.c Thu Jan 5 21:28:25 2017 (r311462)
@@ -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);
}
Modified: head/sys/contrib/dev/acpica/components/debugger/dbxface.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/debugger/dbxface.c Thu Jan 5 21:17:10 2017 (r311461)
+++ head/sys/contrib/dev/acpica/components/debugger/dbxface.c Thu Jan 5 21:28:25 2017 (r311462)
@@ -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)
Modified: head/sys/contrib/dev/acpica/components/disassembler/dmopcode.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/disassembler/dmopcode.c Thu Jan 5 21:17:10 2017 (r311461)
+++ head/sys/contrib/dev/acpica/components/disassembler/dmopcode.c Thu Jan 5 21:28:25 2017 (r311462)
@@ -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);
+}
Modified: head/sys/contrib/dev/acpica/components/disassembler/dmwalk.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/disassembler/dmwalk.c Thu Jan 5 21:17:10 2017 (r311461)
+++ head/sys/contrib/dev/acpica/components/disassembler/dmwalk.c Thu Jan 5 21:28:25 2017 (r311462)
@@ -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 (
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-all
mailing list