summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/components/dispatcher/dsmethod.c
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2016-09-30 22:40:58 +0000
committerjkim <jkim@FreeBSD.org>2016-09-30 22:40:58 +0000
commitdba8c0a565199df70a86f6a036d00c92f0c7675f (patch)
treecf4924274c6e92898c01efb3c8ba31b34f0630f2 /sys/contrib/dev/acpica/components/dispatcher/dsmethod.c
parent0f41551ef9dde560d9d191d7190af02904dbf611 (diff)
downloadFreeBSD-src-dba8c0a565199df70a86f6a036d00c92f0c7675f.zip
FreeBSD-src-dba8c0a565199df70a86f6a036d00c92f0c7675f.tar.gz
MFC: r284583, r285797, r285799, r287168, r298714, r298720, r298838,
r300879 Merge ACPICA up to 20160527. Requested by: mav
Diffstat (limited to 'sys/contrib/dev/acpica/components/dispatcher/dsmethod.c')
-rw-r--r--sys/contrib/dev/acpica/components/dispatcher/dsmethod.c108
1 files changed, 72 insertions, 36 deletions
diff --git a/sys/contrib/dev/acpica/components/dispatcher/dsmethod.c b/sys/contrib/dev/acpica/components/dispatcher/dsmethod.c
index 9845025..2c0e7ab 100644
--- a/sys/contrib/dev/acpica/components/dispatcher/dsmethod.c
+++ b/sys/contrib/dev/acpica/components/dispatcher/dsmethod.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2015, Intel Corp.
+ * Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -46,9 +46,9 @@
#include <contrib/dev/acpica/include/acdispat.h>
#include <contrib/dev/acpica/include/acinterp.h>
#include <contrib/dev/acpica/include/acnamesp.h>
-#include <contrib/dev/acpica/include/acdisasm.h>
#include <contrib/dev/acpica/include/acparser.h>
#include <contrib/dev/acpica/include/amlcode.h>
+#include <contrib/dev/acpica/include/acdebug.h>
#define _COMPONENT ACPI_DISPATCHER
@@ -109,7 +109,7 @@ AcpiDsAutoSerializeMethod (
/* Create/Init a root op for the method parse tree */
- Op = AcpiPsAllocOp (AML_METHOD_OP);
+ Op = AcpiPsAllocOp (AML_METHOD_OP, ObjDesc->Method.AmlStart);
if (!Op)
{
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -127,8 +127,8 @@ AcpiDsAutoSerializeMethod (
return_ACPI_STATUS (AE_NO_MEMORY);
}
- Status = AcpiDsInitAmlWalk (WalkState, Op, Node, ObjDesc->Method.AmlStart,
- ObjDesc->Method.AmlLength, NULL, 0);
+ Status = AcpiDsInitAmlWalk (WalkState, Op, Node,
+ ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength, NULL, 0);
if (ACPI_FAILURE (Status))
{
AcpiDsDeleteWalkState (WalkState);
@@ -213,7 +213,7 @@ AcpiDsDetectNamedOpcodes (
* RETURN: Status
*
* DESCRIPTION: Called on method error. Invoke the global exception handler if
- * present, dump the method data if the disassembler is configured
+ * present, dump the method data if the debugger is configured
*
* Note: Allows the exception handler to change the status code
*
@@ -224,6 +224,9 @@ AcpiDsMethodError (
ACPI_STATUS Status,
ACPI_WALK_STATE *WalkState)
{
+ UINT32 AmlOffset;
+
+
ACPI_FUNCTION_ENTRY ();
@@ -247,23 +250,28 @@ AcpiDsMethodError (
* Handler can map the exception code to anything it wants, including
* AE_OK, in which case the executing method will not be aborted.
*/
+ AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->Aml,
+ WalkState->ParserState.AmlStart);
+
Status = AcpiGbl_ExceptionHandler (Status,
- WalkState->MethodNode ?
- WalkState->MethodNode->Name.Integer : 0,
- WalkState->Opcode, WalkState->AmlOffset, NULL);
+ WalkState->MethodNode ?
+ WalkState->MethodNode->Name.Integer : 0,
+ WalkState->Opcode, AmlOffset, NULL);
AcpiExEnterInterpreter ();
}
AcpiDsClearImplicitReturn (WalkState);
-#ifdef ACPI_DISASSEMBLER
if (ACPI_FAILURE (Status))
{
- /* Display method locals/args if disassembler is present */
+ AcpiDsDumpMethodStack (Status, WalkState, WalkState->Op);
- AcpiDmDumpMethodInfo (Status, WalkState, WalkState->Op);
- }
+ /* Display method locals/args if debugger is present */
+
+#ifdef ACPI_DEBUGGER
+ AcpiDbDumpMethodInfo (Status, WalkState);
#endif
+ }
return (Status);
}
@@ -349,6 +357,8 @@ AcpiDsBeginMethodExecution (
return_ACPI_STATUS (AE_NULL_ENTRY);
}
+ AcpiExStartTraceMethod (MethodNode, ObjDesc, WalkState);
+
/* Prevent wraparound of thread count */
if (ObjDesc->Method.ThreadCount == ACPI_UINT8_MAX)
@@ -390,10 +400,12 @@ AcpiDsBeginMethodExecution (
*/
if (WalkState &&
(!(ObjDesc->Method.InfoFlags & ACPI_METHOD_IGNORE_SYNC_LEVEL)) &&
- (WalkState->Thread->CurrentSyncLevel > ObjDesc->Method.Mutex->Mutex.SyncLevel))
+ (WalkState->Thread->CurrentSyncLevel >
+ ObjDesc->Method.Mutex->Mutex.SyncLevel))
{
ACPI_ERROR ((AE_INFO,
- "Cannot acquire Mutex for method [%4.4s], current SyncLevel is too large (%u)",
+ "Cannot acquire Mutex for method [%4.4s]"
+ ", current SyncLevel is too large (%u)",
AcpiUtGetNodeName (MethodNode),
WalkState->Thread->CurrentSyncLevel));
@@ -406,14 +418,15 @@ AcpiDsBeginMethodExecution (
*/
if (!WalkState ||
!ObjDesc->Method.Mutex->Mutex.ThreadId ||
- (WalkState->Thread->ThreadId != ObjDesc->Method.Mutex->Mutex.ThreadId))
+ (WalkState->Thread->ThreadId !=
+ ObjDesc->Method.Mutex->Mutex.ThreadId))
{
/*
* Acquire the method mutex. This releases the interpreter if we
* block (and reacquires it before it returns)
*/
- Status = AcpiExSystemWaitMutex (ObjDesc->Method.Mutex->Mutex.OsMutex,
- ACPI_WAIT_FOREVER);
+ Status = AcpiExSystemWaitMutex (
+ ObjDesc->Method.Mutex->Mutex.OsMutex, ACPI_WAIT_FOREVER);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -426,13 +439,30 @@ AcpiDsBeginMethodExecution (
ObjDesc->Method.Mutex->Mutex.OriginalSyncLevel =
WalkState->Thread->CurrentSyncLevel;
- ObjDesc->Method.Mutex->Mutex.ThreadId = WalkState->Thread->ThreadId;
- WalkState->Thread->CurrentSyncLevel = ObjDesc->Method.SyncLevel;
+ ObjDesc->Method.Mutex->Mutex.ThreadId =
+ WalkState->Thread->ThreadId;
+
+ /*
+ * Update the current SyncLevel only if this is not an auto-
+ * serialized method. In the auto case, we have to ignore
+ * the sync level for the method mutex (created for the
+ * auto-serialization) because we have no idea of what the
+ * sync level should be. Therefore, just ignore it.
+ */
+ if (!(ObjDesc->Method.InfoFlags &
+ ACPI_METHOD_IGNORE_SYNC_LEVEL))
+ {
+ WalkState->Thread->CurrentSyncLevel =
+ ObjDesc->Method.SyncLevel;
+ }
}
else
{
ObjDesc->Method.Mutex->Mutex.OriginalSyncLevel =
ObjDesc->Method.Mutex->Mutex.SyncLevel;
+
+ ObjDesc->Method.Mutex->Mutex.ThreadId =
+ AcpiOsGetThreadId ();
}
}
@@ -505,7 +535,8 @@ AcpiDsCallControlMethod (
ACPI_FUNCTION_TRACE_PTR (DsCallControlMethod, ThisWalkState);
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Calling method %p, currentstate=%p\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "Calling method %p, currentstate=%p\n",
ThisWalkState->PrevOp, ThisWalkState));
/*
@@ -525,8 +556,8 @@ AcpiDsCallControlMethod (
/* Init for new method, possibly wait on method mutex */
- Status = AcpiDsBeginMethodExecution (MethodNode, ObjDesc,
- ThisWalkState);
+ Status = AcpiDsBeginMethodExecution (
+ MethodNode, ObjDesc, ThisWalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -534,8 +565,8 @@ AcpiDsCallControlMethod (
/* Begin method parse/execution. Create a new walk state */
- NextWalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwnerId,
- NULL, ObjDesc, Thread);
+ NextWalkState = AcpiDsCreateWalkState (
+ ObjDesc->Method.OwnerId, NULL, ObjDesc, Thread);
if (!NextWalkState)
{
Status = AE_NO_MEMORY;
@@ -564,8 +595,8 @@ AcpiDsCallControlMethod (
Info->Parameters = &ThisWalkState->Operands[0];
Status = AcpiDsInitAmlWalk (NextWalkState, NULL, MethodNode,
- ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength,
- Info, ACPI_IMODE_EXECUTE);
+ ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength,
+ Info, ACPI_IMODE_EXECUTE);
ACPI_FREE (Info);
if (ACPI_FAILURE (Status))
@@ -610,10 +641,7 @@ Cleanup:
/* On error, we must terminate the method properly */
AcpiDsTerminateControlMethod (ObjDesc, NextWalkState);
- if (NextWalkState)
- {
- AcpiDsDeleteWalkState (NextWalkState);
- }
+ AcpiDsDeleteWalkState (NextWalkState);
return_ACPI_STATUS (Status);
}
@@ -763,7 +791,8 @@ AcpiDsTerminateControlMethod (
WalkState->Thread->CurrentSyncLevel =
MethodDesc->Method.Mutex->Mutex.OriginalSyncLevel;
- AcpiOsReleaseMutex (MethodDesc->Method.Mutex->Mutex.OsMutex);
+ AcpiOsReleaseMutex (
+ MethodDesc->Method.Mutex->Mutex.OsMutex);
MethodDesc->Method.Mutex->Mutex.ThreadId = 0;
}
}
@@ -793,7 +822,8 @@ AcpiDsTerminateControlMethod (
if (MethodDesc->Method.InfoFlags & ACPI_METHOD_MODIFIED_NAMESPACE)
{
AcpiNsDeleteNamespaceByOwner (MethodDesc->Method.OwnerId);
- MethodDesc->Method.InfoFlags &= ~ACPI_METHOD_MODIFIED_NAMESPACE;
+ MethodDesc->Method.InfoFlags &=
+ ~ACPI_METHOD_MODIFIED_NAMESPACE;
}
}
}
@@ -840,8 +870,9 @@ AcpiDsTerminateControlMethod (
{
if (WalkState)
{
- ACPI_INFO ((AE_INFO,
- "Marking method %4.4s as Serialized because of AE_ALREADY_EXISTS error",
+ ACPI_INFO ((
+ "Marking method %4.4s as Serialized "
+ "because of AE_ALREADY_EXISTS error",
WalkState->MethodNode->Name.Ascii));
}
@@ -856,7 +887,9 @@ AcpiDsTerminateControlMethod (
* marking the method permanently as Serialized when the last
* thread exits here.
*/
- MethodDesc->Method.InfoFlags &= ~ACPI_METHOD_SERIALIZED_PENDING;
+ MethodDesc->Method.InfoFlags &=
+ ~ACPI_METHOD_SERIALIZED_PENDING;
+
MethodDesc->Method.InfoFlags |=
(ACPI_METHOD_SERIALIZED | ACPI_METHOD_IGNORE_SYNC_LEVEL);
MethodDesc->Method.SyncLevel = 0;
@@ -870,5 +903,8 @@ AcpiDsTerminateControlMethod (
}
}
+ AcpiExStopTraceMethod ((ACPI_NAMESPACE_NODE *) MethodDesc->Method.Node,
+ MethodDesc, WalkState);
+
return_VOID;
}
OpenPOWER on IntegriCloud