diff options
Diffstat (limited to 'sys/contrib/dev/acpica/components/dispatcher')
15 files changed, 670 insertions, 311 deletions
diff --git a/sys/contrib/dev/acpica/components/dispatcher/dsargs.c b/sys/contrib/dev/acpica/components/dispatcher/dsargs.c index 254f704..b669b56 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dsargs.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dsargs.c @@ -6,7 +6,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 @@ -94,7 +94,7 @@ AcpiDsExecuteArguments ( /* Allocate a new parser op to be the root of the parsed tree */ - Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP); + Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP, AmlStart); if (!Op) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -114,7 +114,7 @@ AcpiDsExecuteArguments ( } Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart, - AmlLength, NULL, ACPI_IMODE_LOAD_PASS1); + AmlLength, NULL, ACPI_IMODE_LOAD_PASS1); if (ACPI_FAILURE (Status)) { AcpiDsDeleteWalkState (WalkState); @@ -141,7 +141,7 @@ AcpiDsExecuteArguments ( /* Evaluate the deferred arguments */ - Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP); + Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP, AmlStart); if (!Op) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -161,7 +161,7 @@ AcpiDsExecuteArguments ( /* Execute the opcode and arguments */ Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart, - AmlLength, NULL, ACPI_IMODE_EXECUTE); + AmlLength, NULL, ACPI_IMODE_EXECUTE); if (ACPI_FAILURE (Status)) { AcpiDsDeleteWalkState (WalkState); @@ -214,8 +214,8 @@ AcpiDsGetBufferFieldArguments ( ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc); Node = ObjDesc->BufferField.Node; - ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_BUFFER_FIELD, - Node, NULL)); + ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname ( + ACPI_TYPE_BUFFER_FIELD, Node, NULL)); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BufferField Arg Init\n", AcpiUtGetNodeName (Node))); @@ -223,7 +223,7 @@ AcpiDsGetBufferFieldArguments ( /* Execute the AML code for the TermArg arguments */ Status = AcpiDsExecuteArguments (Node, Node->Parent, - ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); + ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); return_ACPI_STATUS (Status); } @@ -263,8 +263,8 @@ AcpiDsGetBankFieldArguments ( ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc); Node = ObjDesc->BankField.Node; - ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_LOCAL_BANK_FIELD, - Node, NULL)); + ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname ( + ACPI_TYPE_LOCAL_BANK_FIELD, Node, NULL)); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BankField Arg Init\n", AcpiUtGetNodeName (Node))); @@ -272,7 +272,7 @@ AcpiDsGetBankFieldArguments ( /* Execute the AML code for the TermArg arguments */ Status = AcpiDsExecuteArguments (Node, Node->Parent, - ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); + ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); return_ACPI_STATUS (Status); } @@ -312,7 +312,8 @@ AcpiDsGetBufferArguments ( if (!Node) { ACPI_ERROR ((AE_INFO, - "No pointer back to namespace node in buffer object %p", ObjDesc)); + "No pointer back to namespace node in buffer object %p", + ObjDesc)); return_ACPI_STATUS (AE_AML_INTERNAL); } @@ -321,7 +322,7 @@ AcpiDsGetBufferArguments ( /* Execute the AML code for the TermArg arguments */ Status = AcpiDsExecuteArguments (Node, Node, - ObjDesc->Buffer.AmlLength, ObjDesc->Buffer.AmlStart); + ObjDesc->Buffer.AmlLength, ObjDesc->Buffer.AmlStart); return_ACPI_STATUS (Status); } @@ -370,7 +371,7 @@ AcpiDsGetPackageArguments ( /* Execute the AML code for the TermArg arguments */ Status = AcpiDsExecuteArguments (Node, Node, - ObjDesc->Package.AmlLength, ObjDesc->Package.AmlStart); + ObjDesc->Package.AmlLength, ObjDesc->Package.AmlStart); return_ACPI_STATUS (Status); } @@ -415,22 +416,23 @@ AcpiDsGetRegionArguments ( Node = ObjDesc->Region.Node; - ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_REGION, Node, NULL)); + ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname ( + ACPI_TYPE_REGION, Node, NULL)); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] OpRegion Arg Init at AML %p\n", + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "[%4.4s] OpRegion Arg Init at AML %p\n", AcpiUtGetNodeName (Node), ExtraDesc->Extra.AmlStart)); /* Execute the argument AML */ Status = AcpiDsExecuteArguments (Node, ExtraDesc->Extra.ScopeNode, - ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); + ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } Status = AcpiUtAddAddressRange (ObjDesc->Region.SpaceId, - ObjDesc->Region.Address, ObjDesc->Region.Length, - Node); + ObjDesc->Region.Address, ObjDesc->Region.Length, Node); return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/components/dispatcher/dscontrol.c b/sys/contrib/dev/acpica/components/dispatcher/dscontrol.c index bb23156..e3c68b7 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dscontrol.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dscontrol.c @@ -6,7 +6,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 @@ -47,6 +47,7 @@ #include <contrib/dev/acpica/include/amlcode.h> #include <contrib/dev/acpica/include/acdispat.h> #include <contrib/dev/acpica/include/acinterp.h> +#include <contrib/dev/acpica/include/acdebug.h> #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME ("dscontrol") @@ -119,9 +120,12 @@ AcpiDsExecBeginControlOp ( * Save a pointer to the predicate for multiple executions * of a loop */ - ControlState->Control.AmlPredicateStart = WalkState->ParserState.Aml - 1; - ControlState->Control.PackageEnd = WalkState->ParserState.PkgEnd; - ControlState->Control.Opcode = Op->Common.AmlOpcode; + ControlState->Control.AmlPredicateStart = + WalkState->ParserState.Aml - 1; + ControlState->Control.PackageEnd = + WalkState->ParserState.PkgEnd; + ControlState->Control.Opcode = + Op->Common.AmlOpcode; /* Push the control state on this walk's control stack */ @@ -221,7 +225,7 @@ AcpiDsExecEndControlOp ( * loop does not implement a timeout. */ ControlState->Control.LoopCount++; - if (ControlState->Control.LoopCount > ACPI_MAX_LOOP_ITERATIONS) + if (ControlState->Control.LoopCount > AcpiGbl_MaxLoopIterations) { Status = AE_AML_INFINITE_LOOP; break; @@ -232,7 +236,8 @@ AcpiDsExecEndControlOp ( * another time */ Status = AE_CTRL_PENDING; - WalkState->AmlLastWhile = ControlState->Control.AmlPredicateStart; + WalkState->AmlLastWhile = + ControlState->Control.AmlPredicateStart; break; } @@ -276,7 +281,8 @@ AcpiDsExecEndControlOp ( * an arg or local), resolve it now because it may * cease to exist at the end of the method. */ - Status = AcpiExResolveToValue (&WalkState->Operands [0], WalkState); + Status = AcpiExResolveToValue ( + &WalkState->Operands [0], WalkState); if (ACPI_FAILURE (Status)) { return (Status); @@ -305,11 +311,15 @@ AcpiDsExecEndControlOp ( * Allow references created by the Index operator to return * unchanged. */ - if ((ACPI_GET_DESCRIPTOR_TYPE (WalkState->Results->Results.ObjDesc[0]) == ACPI_DESC_TYPE_OPERAND) && - ((WalkState->Results->Results.ObjDesc [0])->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) && - ((WalkState->Results->Results.ObjDesc [0])->Reference.Class != ACPI_REFCLASS_INDEX)) + if ((ACPI_GET_DESCRIPTOR_TYPE (WalkState->Results->Results.ObjDesc[0]) == + ACPI_DESC_TYPE_OPERAND) && + ((WalkState->Results->Results.ObjDesc [0])->Common.Type == + ACPI_TYPE_LOCAL_REFERENCE) && + ((WalkState->Results->Results.ObjDesc [0])->Reference.Class != + ACPI_REFCLASS_INDEX)) { - Status = AcpiExResolveToValue (&WalkState->Results->Results.ObjDesc [0], WalkState); + Status = AcpiExResolveToValue ( + &WalkState->Results->Results.ObjDesc [0], WalkState); if (ACPI_FAILURE (Status)) { return (Status); @@ -327,9 +337,9 @@ AcpiDsExecEndControlOp ( AcpiUtRemoveReference (WalkState->Operands [0]); } - WalkState->Operands [0] = NULL; - WalkState->NumOperands = 0; - WalkState->ReturnDesc = NULL; + WalkState->Operands[0] = NULL; + WalkState->NumOperands = 0; + WalkState->ReturnDesc = NULL; } @@ -350,20 +360,12 @@ AcpiDsExecEndControlOp ( case AML_BREAK_POINT_OP: - /* - * Set the single-step flag. This will cause the debugger (if present) - * to break to the console within the AML debugger at the start of the - * next AML instruction. - */ - ACPI_DEBUGGER_EXEC ( - AcpiGbl_CmSingleStep = TRUE); - ACPI_DEBUGGER_EXEC ( - AcpiOsPrintf ("**break** Executed AML BreakPoint opcode\n")); + AcpiDbSignalBreakPoint (WalkState); /* Call to the OSL in case OS wants a piece of the action */ Status = AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT, - "Executed AML Breakpoint opcode"); + "Executed AML Breakpoint opcode"); break; case AML_BREAK_OP: @@ -387,7 +389,8 @@ AcpiDsExecEndControlOp ( /* Was: WalkState->AmlLastWhile = WalkState->ControlState->Control.AmlPredicateStart; */ - WalkState->AmlLastWhile = WalkState->ControlState->Control.PackageEnd; + WalkState->AmlLastWhile = + WalkState->ControlState->Control.PackageEnd; /* Return status depending on opcode */ diff --git a/sys/contrib/dev/acpica/components/dispatcher/dsdebug.c b/sys/contrib/dev/acpica/components/dispatcher/dsdebug.c new file mode 100644 index 0000000..9db1b7b --- /dev/null +++ b/sys/contrib/dev/acpica/components/dispatcher/dsdebug.c @@ -0,0 +1,250 @@ +/****************************************************************************** + * + * Module Name: dsdebug - Parser/Interpreter interface - debugging + * + *****************************************************************************/ + +/* + * 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 <contrib/dev/acpica/include/acpi.h> +#include <contrib/dev/acpica/include/accommon.h> +#include <contrib/dev/acpica/include/acdispat.h> +#include <contrib/dev/acpica/include/acnamesp.h> +#include <contrib/dev/acpica/include/acdisasm.h> +#include <contrib/dev/acpica/include/acinterp.h> + + +#define _COMPONENT ACPI_DISPATCHER + ACPI_MODULE_NAME ("dsdebug") + + +#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) + +/* Local prototypes */ + +static void +AcpiDsPrintNodePathname ( + ACPI_NAMESPACE_NODE *Node, + const char *Message); + + +/******************************************************************************* + * + * FUNCTION: AcpiDsPrintNodePathname + * + * PARAMETERS: Node - Object + * Message - Prefix message + * + * DESCRIPTION: Print an object's full namespace pathname + * Manages allocation/freeing of a pathname buffer + * + ******************************************************************************/ + +static void +AcpiDsPrintNodePathname ( + ACPI_NAMESPACE_NODE *Node, + const char *Message) +{ + ACPI_BUFFER Buffer; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (DsPrintNodePathname); + + if (!Node) + { + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "[NULL NAME]")); + return_VOID; + } + + /* Convert handle to full pathname and print it (with supplied message) */ + + Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; + + Status = AcpiNsHandleToPathname (Node, &Buffer, TRUE); + if (ACPI_SUCCESS (Status)) + { + if (Message) + { + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "%s ", Message)); + } + + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "[%s] (Node %p)", + (char *) Buffer.Pointer, Node)); + ACPI_FREE (Buffer.Pointer); + } + + return_VOID; +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDsDumpMethodStack + * + * PARAMETERS: Status - Method execution status + * WalkState - Current state of the parse tree walk + * Op - Executing parse op + * + * RETURN: None + * + * DESCRIPTION: Called when a method has been aborted because of an error. + * Dumps the method execution stack. + * + ******************************************************************************/ + +void +AcpiDsDumpMethodStack ( + ACPI_STATUS Status, + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op) +{ + ACPI_PARSE_OBJECT *Next; + ACPI_THREAD_STATE *Thread; + ACPI_WALK_STATE *NextWalkState; + ACPI_NAMESPACE_NODE *PreviousMethod = NULL; + ACPI_OPERAND_OBJECT *MethodDesc; + + + ACPI_FUNCTION_TRACE (DsDumpMethodStack); + + /* Ignore control codes, they are not errors */ + + if ((Status & AE_CODE_MASK) == AE_CODE_CONTROL) + { + return_VOID; + } + + /* We may be executing a deferred opcode */ + + if (WalkState->DeferredNode) + { + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "Executing subtree for Buffer/Package/Region\n")); + return_VOID; + } + + /* + * If there is no Thread, we are not actually executing a method. + * This can happen when the iASL compiler calls the interpreter + * to perform constant folding. + */ + Thread = WalkState->Thread; + if (!Thread) + { + return_VOID; + } + + /* Display exception and method name */ + + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "\n**** Exception %s during execution of method ", + AcpiFormatException (Status))); + + AcpiDsPrintNodePathname (WalkState->MethodNode, NULL); + + /* Display stack of executing methods */ + + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, + "\n\nMethod Execution Stack:\n")); + NextWalkState = Thread->WalkStateList; + + /* Walk list of linked walk states */ + + while (NextWalkState) + { + MethodDesc = NextWalkState->MethodDesc; + if (MethodDesc) + { + AcpiExStopTraceMethod ( + (ACPI_NAMESPACE_NODE *) MethodDesc->Method.Node, + MethodDesc, WalkState); + } + + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + " Method [%4.4s] executing: ", + AcpiUtGetNodeName (NextWalkState->MethodNode))); + + /* First method is the currently executing method */ + + if (NextWalkState == WalkState) + { + if (Op) + { + /* Display currently executing ASL statement */ + + Next = Op->Common.Next; + Op->Common.Next = NULL; + +#ifdef ACPI_DISASSEMBLER + AcpiDmDisassemble (NextWalkState, Op, ACPI_UINT32_MAX); +#endif + Op->Common.Next = Next; + } + } + else + { + /* + * This method has called another method + * NOTE: the method call parse subtree is already deleted at + * this point, so we cannot disassemble the method invocation. + */ + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "Call to method ")); + AcpiDsPrintNodePathname (PreviousMethod, NULL); + } + + PreviousMethod = NextWalkState->MethodNode; + NextWalkState = NextWalkState->Next; + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DISPATCH, "\n")); + } + + return_VOID; +} + +#else + +void +AcpiDsDumpMethodStack ( + ACPI_STATUS Status, + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op) +{ + return; +} + +#endif diff --git a/sys/contrib/dev/acpica/components/dispatcher/dsfield.c b/sys/contrib/dev/acpica/components/dispatcher/dsfield.c index d376bb1..4e3c29a 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dsfield.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dsfield.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 @@ -115,6 +115,7 @@ AcpiDsCreateExternalRegion ( * insert the name into the namespace. */ AcpiDmAddOpToExternalList (Op, Path, ACPI_TYPE_REGION, 0, 0); + Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_REGION, ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, WalkState, Node); if (ACPI_FAILURE (Status)) @@ -210,7 +211,7 @@ AcpiDsCreateBufferField ( /* Creating new namespace node, should not already exist */ Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | - ACPI_NS_ERROR_IF_FOUND; + ACPI_NS_ERROR_IF_FOUND; /* * Mark node temporary if we are executing a normal control @@ -224,9 +225,9 @@ AcpiDsCreateBufferField ( /* Enter the NameString into the namespace */ - Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, - ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS1, - Flags, WalkState, &Node); + Status = AcpiNsLookup (WalkState->ScopeInfo, + Arg->Common.Value.String, ACPI_TYPE_ANY, + ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node); if (ACPI_FAILURE (Status)) { ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); @@ -267,13 +268,13 @@ AcpiDsCreateBufferField ( } /* - * Remember location in AML stream of the field unit opcode and operands -- - * since the buffer and index operands must be evaluated. + * Remember location in AML stream of the field unit opcode and operands + * -- since the buffer and index operands must be evaluated. */ - SecondDesc = ObjDesc->Common.NextObject; - SecondDesc->Extra.AmlStart = Op->Named.Data; + SecondDesc = ObjDesc->Common.NextObject; + SecondDesc->Extra.AmlStart = Op->Named.Data; SecondDesc->Extra.AmlLength = Op->Named.Length; - ObjDesc->BufferField.Node = Node; + ObjDesc->BufferField.Node = Node; /* Attach constructed field descriptors to parent node */ @@ -341,8 +342,8 @@ AcpiDsGetFieldNames ( { case AML_INT_RESERVEDFIELD_OP: - Position = (UINT64) Info->FieldBitPosition - + (UINT64) Arg->Common.Value.Size; + Position = (UINT64) Info->FieldBitPosition + + (UINT64) Arg->Common.Value.Size; if (Position > ACPI_UINT32_MAX) { @@ -375,11 +376,13 @@ AcpiDsGetFieldNames ( /* AccessAttribute (AttribQuick, AttribByte, etc.) */ - Info->Attribute = (UINT8) ((Arg->Common.Value.Integer >> 8) & 0xFF); + Info->Attribute = (UINT8) + ((Arg->Common.Value.Integer >> 8) & 0xFF); /* AccessLength (for serial/buffer protocols) */ - Info->AccessLength = (UINT8) ((Arg->Common.Value.Integer >> 16) & 0xFF); + Info->AccessLength = (UINT8) + ((Arg->Common.Value.Integer >> 16) & 0xFF); break; case AML_INT_CONNECTION_OP: @@ -406,9 +409,9 @@ AcpiDsGetFieldNames ( /* Lookup the Connection() namepath, it should already exist */ Status = AcpiNsLookup (WalkState->ScopeInfo, - Child->Common.Value.Name, ACPI_TYPE_ANY, - ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, - WalkState, &Info->ConnectionNode); + Child->Common.Value.Name, ACPI_TYPE_ANY, + ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, + WalkState, &Info->ConnectionNode); if (ACPI_FAILURE (Status)) { ACPI_ERROR_NAMESPACE (Child->Common.Value.Name, Status); @@ -422,9 +425,9 @@ AcpiDsGetFieldNames ( /* Lookup the name, it should already exist */ Status = AcpiNsLookup (WalkState->ScopeInfo, - (char *) &Arg->Named.Name, Info->FieldType, - ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, - WalkState, &Info->FieldNode); + (char *) &Arg->Named.Name, Info->FieldType, + ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, + WalkState, &Info->FieldNode); if (ACPI_FAILURE (Status)) { ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status); @@ -453,8 +456,8 @@ AcpiDsGetFieldNames ( /* Keep track of bit position for the next field */ - Position = (UINT64) Info->FieldBitPosition - + (UINT64) Arg->Common.Value.Size; + Position = (UINT64) Info->FieldBitPosition + + (UINT64) Arg->Common.Value.Size; if (Position > ACPI_UINT32_MAX) { @@ -471,7 +474,8 @@ AcpiDsGetFieldNames ( default: ACPI_ERROR ((AE_INFO, - "Invalid opcode in field list: 0x%X", Arg->Common.AmlOpcode)); + "Invalid opcode in field list: 0x%X", + Arg->Common.AmlOpcode)); return_ACPI_STATUS (AE_AML_BAD_OPCODE); } @@ -517,8 +521,8 @@ AcpiDsCreateField ( if (!RegionNode) { Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name, - ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode); + ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, + ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode); #ifdef ACPI_ASL_COMPILER Status = AcpiDsCreateExternalRegion (Status, Arg, Arg->Common.Value.Name, WalkState, &RegionNode); @@ -530,7 +534,7 @@ AcpiDsCreateField ( } } - ACPI_MEMSET (&Info, 0, sizeof (ACPI_CREATE_FIELD_INFO)); + memset (&Info, 0, sizeof (ACPI_CREATE_FIELD_INFO)); /* Second arg is the field flags */ @@ -624,7 +628,7 @@ AcpiDsInitFieldObjects ( /* Creating new namespace node(s), should not already exist */ Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | - ACPI_NS_ERROR_IF_FOUND; + ACPI_NS_ERROR_IF_FOUND; /* * Mark node(s) temporary if we are executing a normal control @@ -649,8 +653,8 @@ AcpiDsInitFieldObjects ( if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP) { Status = AcpiNsLookup (WalkState->ScopeInfo, - (char *) &Arg->Named.Name, Type, ACPI_IMODE_LOAD_PASS1, - Flags, WalkState, &Node); + (char *) &Arg->Named.Name, Type, ACPI_IMODE_LOAD_PASS1, + Flags, WalkState, &Node); if (ACPI_FAILURE (Status)) { ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status); @@ -710,8 +714,8 @@ AcpiDsCreateBankField ( if (!RegionNode) { Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name, - ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode); + ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, + ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode); #ifdef ACPI_ASL_COMPILER Status = AcpiDsCreateExternalRegion (Status, Arg, Arg->Common.Value.Name, WalkState, &RegionNode); @@ -727,8 +731,8 @@ AcpiDsCreateBankField ( Arg = Arg->Common.Next; Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode); + ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, + ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode); if (ACPI_FAILURE (Status)) { ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); @@ -754,11 +758,12 @@ AcpiDsCreateBankField ( /* * Use Info.DataRegisterNode to store BankField Op - * It's safe because DataRegisterNode will never be used when create bank field - * We store AmlStart and AmlLength in the BankField Op for late evaluation - * Used in AcpiExPrepFieldValue(Info) + * It's safe because DataRegisterNode will never be used when create + * bank field \we store AmlStart and AmlLength in the BankField Op for + * late evaluation. Used in AcpiExPrepFieldValue(Info) * - * TBD: Or, should we add a field in ACPI_CREATE_FIELD_INFO, like "void *ParentOp"? + * TBD: Or, should we add a field in ACPI_CREATE_FIELD_INFO, like + * "void *ParentOp"? */ Info.DataRegisterNode = (ACPI_NAMESPACE_NODE*) Op; @@ -799,8 +804,8 @@ AcpiDsCreateIndexField ( Arg = Op->Common.Value.Arg; Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode); + ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, + ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode); if (ACPI_FAILURE (Status)) { ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); @@ -811,8 +816,8 @@ AcpiDsCreateIndexField ( Arg = Arg->Common.Next; Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT, WalkState, &Info.DataRegisterNode); + ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, + ACPI_NS_SEARCH_PARENT, WalkState, &Info.DataRegisterNode); if (ACPI_FAILURE (Status)) { ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); diff --git a/sys/contrib/dev/acpica/components/dispatcher/dsinit.c b/sys/contrib/dev/acpica/components/dispatcher/dsinit.c index 62f9bde..e5d9929 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dsinit.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dsinit.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 @@ -224,7 +224,7 @@ AcpiDsInitializeObjects ( /* Set all init info to zero */ - ACPI_MEMSET (&Info, 0, sizeof (ACPI_INIT_WALK_INFO)); + memset (&Info, 0, sizeof (ACPI_INIT_WALK_INFO)); Info.OwnerId = OwnerId; Info.TableIndex = TableIndex; @@ -242,7 +242,7 @@ AcpiDsInitializeObjects ( * the namespace reader lock. */ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, StartNode, ACPI_UINT32_MAX, - ACPI_NS_WALK_UNLOCK, AcpiDsInitOneObject, NULL, &Info, NULL); + ACPI_NS_WALK_UNLOCK, AcpiDsInitOneObject, NULL, &Info, NULL); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace")); @@ -255,12 +255,23 @@ AcpiDsInitializeObjects ( return_ACPI_STATUS (Status); } + /* DSDT is always the first AML table */ + + if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_DSDT)) + { + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, + "\nInitializing Namespace objects:\n")); + } + + /* Summary of objects initialized */ + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "Table [%4.4s] (id %4.4X) - %4u Objects with %3u Devices, " - "%3u Regions, %3u Methods (%u/%u/%u Serial/Non/Cvt)\n", - Table->Signature, OwnerId, Info.ObjectCount, Info.DeviceCount, - Info.OpRegionCount, Info.MethodCount, Info.SerialMethodCount, - Info.NonSerialMethodCount, Info.SerializedMethodCount)); + "Table [%4.4s: %-8.8s] (id %.2X) - %4u Objects with %3u Devices, " + "%3u Regions, %4u Methods (%u/%u/%u Serial/Non/Cvt)\n", + Table->Signature, Table->OemTableId, OwnerId, Info.ObjectCount, + Info.DeviceCount,Info.OpRegionCount, Info.MethodCount, + Info.SerialMethodCount, Info.NonSerialMethodCount, + Info.SerializedMethodCount)); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "%u Methods, %u Regions\n", Info.MethodCount, Info.OpRegionCount)); 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; } diff --git a/sys/contrib/dev/acpica/components/dispatcher/dsmthdat.c b/sys/contrib/dev/acpica/components/dispatcher/dsmthdat.c index 4b998d9..6e0fc7e 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dsmthdat.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dsmthdat.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 @@ -110,7 +110,9 @@ AcpiDsMethodDataInit ( for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) { - ACPI_MOVE_32_TO_32 (&WalkState->Arguments[i].Name, NAMEOF_ARG_NTE); + ACPI_MOVE_32_TO_32 (&WalkState->Arguments[i].Name, + NAMEOF_ARG_NTE); + WalkState->Arguments[i].Name.Integer |= (i << 24); WalkState->Arguments[i].DescriptorType = ACPI_DESC_TYPE_NAMED; WalkState->Arguments[i].Type = ACPI_TYPE_ANY; @@ -121,7 +123,8 @@ AcpiDsMethodDataInit ( for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++) { - ACPI_MOVE_32_TO_32 (&WalkState->LocalVariables[i].Name, NAMEOF_LOCAL_NTE); + ACPI_MOVE_32_TO_32 (&WalkState->LocalVariables[i].Name, + NAMEOF_LOCAL_NTE); WalkState->LocalVariables[i].Name.Integer |= (i << 24); WalkState->LocalVariables[i].DescriptorType = ACPI_DESC_TYPE_NAMED; @@ -163,7 +166,7 @@ AcpiDsMethodDataDeleteAll ( if (WalkState->LocalVariables[Index].Object) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Local%u=%p\n", - Index, WalkState->LocalVariables[Index].Object)); + Index, WalkState->LocalVariables[Index].Object)); /* Detach object (if present) and remove a reference */ @@ -178,7 +181,7 @@ AcpiDsMethodDataDeleteAll ( if (WalkState->Arguments[Index].Object) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Arg%u=%p\n", - Index, WalkState->Arguments[Index].Object)); + Index, WalkState->Arguments[Index].Object)); /* Detach object (if present) and remove a reference */ @@ -221,7 +224,8 @@ AcpiDsMethodDataInitArgs ( if (!Params) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "No param list passed to method\n")); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "No parameter list passed to method\n")); return_ACPI_STATUS (AE_OK); } @@ -236,8 +240,8 @@ AcpiDsMethodDataInitArgs ( * Store the argument in the method/walk descriptor. * Do not copy the arg in order to implement call by reference */ - Status = AcpiDsMethodDataSetValue (ACPI_REFCLASS_ARG, Index, - Params[Index], WalkState); + Status = AcpiDsMethodDataSetValue ( + ACPI_REFCLASS_ARG, Index, Params[Index], WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -627,7 +631,8 @@ AcpiDsStoreObjectToLocal ( NewObjDesc = ObjDesc; if (ObjDesc->Common.ReferenceCount > 1) { - Status = AcpiUtCopyIobjectToIobject (ObjDesc, &NewObjDesc, WalkState); + Status = AcpiUtCopyIobjectToIobject ( + ObjDesc, &NewObjDesc, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -664,13 +669,16 @@ AcpiDsStoreObjectToLocal ( * If we have a valid reference object that came from RefOf(), * do the indirect store */ - if ((ACPI_GET_DESCRIPTOR_TYPE (CurrentObjDesc) == ACPI_DESC_TYPE_OPERAND) && - (CurrentObjDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) && - (CurrentObjDesc->Reference.Class == ACPI_REFCLASS_REFOF)) + if ((ACPI_GET_DESCRIPTOR_TYPE (CurrentObjDesc) == + ACPI_DESC_TYPE_OPERAND) && + (CurrentObjDesc->Common.Type == + ACPI_TYPE_LOCAL_REFERENCE) && + (CurrentObjDesc->Reference.Class == + ACPI_REFCLASS_REFOF)) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Arg (%p) is an ObjRef(Node), storing in node %p\n", - NewObjDesc, CurrentObjDesc)); + "Arg (%p) is an ObjRef(Node), storing in node %p\n", + NewObjDesc, CurrentObjDesc)); /* * Store this object to the Node (perform the indirect store) @@ -678,8 +686,8 @@ AcpiDsStoreObjectToLocal ( * specification rules on storing to Locals/Args. */ Status = AcpiExStoreObjectToNode (NewObjDesc, - CurrentObjDesc->Reference.Object, WalkState, - ACPI_NO_IMPLICIT_CONVERSION); + CurrentObjDesc->Reference.Object, WalkState, + ACPI_NO_IMPLICIT_CONVERSION); /* Remove local reference if we copied the object above */ @@ -687,6 +695,7 @@ AcpiDsStoreObjectToLocal ( { AcpiUtRemoveReference (NewObjDesc); } + return_ACPI_STATUS (Status); } } diff --git a/sys/contrib/dev/acpica/components/dispatcher/dsobject.c b/sys/contrib/dev/acpica/components/dispatcher/dsobject.c index 106c6ab..da9512f 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dsobject.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dsobject.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 @@ -102,10 +102,10 @@ AcpiDsBuildInternalObject ( if (!Op->Common.Node) { Status = AcpiNsLookup (WalkState->ScopeInfo, - Op->Common.Value.String, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, - ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &(Op->Common.Node))); + Op->Common.Value.String, + ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, + ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, + ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &(Op->Common.Node))); if (ACPI_FAILURE (Status)) { /* Check if we are resolving a named reference within a package */ @@ -161,8 +161,8 @@ AcpiDsBuildInternalObject ( ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Op->Common.Node); Status = AcpiExResolveNodeToValue ( - ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &ObjDesc), - WalkState); + ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &ObjDesc), + WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -222,14 +222,14 @@ AcpiDsBuildInternalObject ( /* Create and init a new internal ACPI object */ ObjDesc = AcpiUtCreateInternalObject ( - (AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode))->ObjectType); + (AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode))->ObjectType); if (!ObjDesc) { return_ACPI_STATUS (AE_NO_MEMORY); } - Status = AcpiDsInitObjectFromOp (WalkState, Op, Op->Common.AmlOpcode, - &ObjDesc); + Status = AcpiDsInitObjectFromOp ( + WalkState, Op, Op->Common.AmlOpcode, &ObjDesc); if (ACPI_FAILURE (Status)) { AcpiUtRemoveReference (ObjDesc); @@ -336,8 +336,8 @@ AcpiDsBuildInternalBufferObj ( } else { - ObjDesc->Buffer.Pointer = ACPI_ALLOCATE_ZEROED ( - ObjDesc->Buffer.Length); + ObjDesc->Buffer.Pointer = + ACPI_ALLOCATE_ZEROED (ObjDesc->Buffer.Length); if (!ObjDesc->Buffer.Pointer) { AcpiUtDeleteObjectDesc (ObjDesc); @@ -348,8 +348,8 @@ AcpiDsBuildInternalBufferObj ( if (ByteList) { - ACPI_MEMCPY (ObjDesc->Buffer.Pointer, ByteList->Named.Data, - ByteListLength); + memcpy (ObjDesc->Buffer.Pointer, ByteList->Named.Data, + ByteListLength); } } @@ -468,8 +468,8 @@ AcpiDsBuildInternalPackageObj ( * invocation, so we special case it here */ Arg->Common.AmlOpcode = AML_INT_NAMEPATH_OP; - Status = AcpiDsBuildInternalObject (WalkState, Arg, - &ObjDesc->Package.Elements[i]); + Status = AcpiDsBuildInternalObject ( + WalkState, Arg, &ObjDesc->Package.Elements[i]); } else { @@ -481,8 +481,8 @@ AcpiDsBuildInternalPackageObj ( } else { - Status = AcpiDsBuildInternalObject (WalkState, Arg, - &ObjDesc->Package.Elements[i]); + Status = AcpiDsBuildInternalObject ( + WalkState, Arg, &ObjDesc->Package.Elements[i]); } if (*ObjDescPtr) @@ -538,8 +538,9 @@ AcpiDsBuildInternalPackageObj ( Arg = Arg->Common.Next; } - ACPI_INFO ((AE_INFO, - "Actual Package length (%u) is larger than NumElements field (%u), truncated", + ACPI_INFO (( + "Actual Package length (%u) is larger than " + "NumElements field (%u), truncated", i, ElementCount)); } else if (i < ElementCount) @@ -549,7 +550,8 @@ AcpiDsBuildInternalPackageObj ( * Note: this is not an error, the package is padded out with NULLs. */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Package List length (%u) smaller than NumElements count (%u), padded with null elements\n", + "Package List length (%u) smaller than NumElements " + "count (%u), padded with null elements\n", i, ElementCount)); } @@ -605,8 +607,8 @@ AcpiDsCreateNode ( /* Build an internal object for the argument(s) */ - Status = AcpiDsBuildInternalObject (WalkState, Op->Common.Value.Arg, - &ObjDesc); + Status = AcpiDsBuildInternalObject ( + WalkState, Op->Common.Value.Arg, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -678,9 +680,9 @@ AcpiDsInitObjectFromOp ( /* * Defer evaluation of Buffer TermArg operand */ - ObjDesc->Buffer.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, - WalkState->Operands[0]); - ObjDesc->Buffer.AmlStart = Op->Named.Data; + ObjDesc->Buffer.Node = ACPI_CAST_PTR ( + ACPI_NAMESPACE_NODE, WalkState->Operands[0]); + ObjDesc->Buffer.AmlStart = Op->Named.Data; ObjDesc->Buffer.AmlLength = Op->Named.Length; break; @@ -688,9 +690,9 @@ AcpiDsInitObjectFromOp ( /* * Defer evaluation of Package TermArg operand */ - ObjDesc->Package.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, - WalkState->Operands[0]); - ObjDesc->Package.AmlStart = Op->Named.Data; + ObjDesc->Package.Node = ACPI_CAST_PTR ( + ACPI_NAMESPACE_NODE, WalkState->Operands[0]); + ObjDesc->Package.AmlStart = Op->Named.Data; ObjDesc->Package.AmlLength = Op->Named.Length; break; @@ -775,7 +777,7 @@ AcpiDsInitObjectFromOp ( case ACPI_TYPE_STRING: ObjDesc->String.Pointer = Op->Common.Value.String; - ObjDesc->String.Length = (UINT32) ACPI_STRLEN (Op->Common.Value.String); + ObjDesc->String.Length = (UINT32) strlen (Op->Common.Value.String); /* * The string is contained in the ACPI table, don't ever try @@ -800,9 +802,9 @@ AcpiDsInitObjectFromOp ( #ifndef ACPI_NO_METHOD_EXECUTION Status = AcpiDsMethodDataGetNode (ACPI_REFCLASS_LOCAL, - ObjDesc->Reference.Value, WalkState, - ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, - &ObjDesc->Reference.Object)); + ObjDesc->Reference.Value, WalkState, + ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, + &ObjDesc->Reference.Object)); #endif break; @@ -815,9 +817,9 @@ AcpiDsInitObjectFromOp ( #ifndef ACPI_NO_METHOD_EXECUTION Status = AcpiDsMethodDataGetNode (ACPI_REFCLASS_ARG, - ObjDesc->Reference.Value, WalkState, - ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, - &ObjDesc->Reference.Object)); + ObjDesc->Reference.Value, WalkState, + ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, + &ObjDesc->Reference.Object)); #endif break; diff --git a/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c b/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c index 157e4ce..826866b 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dsopcode.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 @@ -259,8 +259,8 @@ AcpiDsInitBufferField ( * For FieldFlags, use LOCK_RULE = 0 (NO_LOCK), * UPDATE_RULE = 0 (UPDATE_PRESERVE) */ - Status = AcpiExPrepCommonFieldObject (ObjDesc, FieldFlags, 0, - BitOffset, BitCount); + Status = AcpiExPrepCommonFieldObject ( + ObjDesc, FieldFlags, 0, BitOffset, BitCount); if (ACPI_FAILURE (Status)) { goto Cleanup; @@ -357,8 +357,8 @@ AcpiDsEvalBufferFieldOperands ( /* Resolve the operands */ - Status = AcpiExResolveOperands (Op->Common.AmlOpcode, - ACPI_WALK_OPERANDS, WalkState); + Status = AcpiExResolveOperands ( + Op->Common.AmlOpcode, ACPI_WALK_OPERANDS, WalkState); if (ACPI_FAILURE (Status)) { ACPI_ERROR ((AE_INFO, "(%s) bad operand(s), status 0x%X", @@ -374,16 +374,16 @@ AcpiDsEvalBufferFieldOperands ( /* NOTE: Slightly different operands for this opcode */ Status = AcpiDsInitBufferField (Op->Common.AmlOpcode, ObjDesc, - WalkState->Operands[0], WalkState->Operands[1], - WalkState->Operands[2], WalkState->Operands[3]); + WalkState->Operands[0], WalkState->Operands[1], + WalkState->Operands[2], WalkState->Operands[3]); } else { /* All other, CreateXxxField opcodes */ Status = AcpiDsInitBufferField (Op->Common.AmlOpcode, ObjDesc, - WalkState->Operands[0], WalkState->Operands[1], - NULL, WalkState->Operands[2]); + WalkState->Operands[0], WalkState->Operands[1], + NULL, WalkState->Operands[2]); } return_ACPI_STATUS (Status); @@ -443,8 +443,8 @@ AcpiDsEvalRegionOperands ( /* Resolve the length and address operands to numbers */ - Status = AcpiExResolveOperands (Op->Common.AmlOpcode, - ACPI_WALK_OPERANDS, WalkState); + Status = AcpiExResolveOperands ( + Op->Common.AmlOpcode, ACPI_WALK_OPERANDS, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -472,18 +472,16 @@ AcpiDsEvalRegionOperands ( OperandDesc = WalkState->Operands[WalkState->NumOperands - 2]; ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS) - OperandDesc->Integer.Value; + OperandDesc->Integer.Value; AcpiUtRemoveReference (OperandDesc); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", - ObjDesc, - ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), + ObjDesc, ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), ObjDesc->Region.Length)); /* Now the address and length are valid for this opregion */ ObjDesc->Region.Flags |= AOPOBJ_DATA_VALID; - return_ACPI_STATUS (Status); } @@ -513,8 +511,8 @@ AcpiDsEvalTableRegionOperands ( ACPI_OPERAND_OBJECT **Operand; ACPI_NAMESPACE_NODE *Node; ACPI_PARSE_OBJECT *NextOp; - UINT32 TableIndex; ACPI_TABLE_HEADER *Table; + UINT32 TableIndex; ACPI_FUNCTION_TRACE_PTR (DsEvalTableRegionOperands, Op); @@ -540,57 +538,67 @@ AcpiDsEvalTableRegionOperands ( return_ACPI_STATUS (Status); } + Operand = &WalkState->Operands[0]; + /* * Resolve the Signature string, OemId string, * and OemTableId string operands */ - Status = AcpiExResolveOperands (Op->Common.AmlOpcode, - ACPI_WALK_OPERANDS, WalkState); + Status = AcpiExResolveOperands ( + Op->Common.AmlOpcode, ACPI_WALK_OPERANDS, WalkState); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + goto Cleanup; } - Operand = &WalkState->Operands[0]; - /* Find the ACPI table */ - Status = AcpiTbFindTable (Operand[0]->String.Pointer, - Operand[1]->String.Pointer, Operand[2]->String.Pointer, - &TableIndex); + Status = AcpiTbFindTable ( + Operand[0]->String.Pointer, + Operand[1]->String.Pointer, + Operand[2]->String.Pointer, &TableIndex); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + if (Status == AE_NOT_FOUND) + { + ACPI_ERROR ((AE_INFO, + "ACPI Table [%4.4s] OEM:(%s, %s) not found in RSDT/XSDT", + Operand[0]->String.Pointer, + Operand[1]->String.Pointer, + Operand[2]->String.Pointer)); + } + goto Cleanup; } - AcpiUtRemoveReference (Operand[0]); - AcpiUtRemoveReference (Operand[1]); - AcpiUtRemoveReference (Operand[2]); - Status = AcpiGetTableByIndex (TableIndex, &Table); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + goto Cleanup; } ObjDesc = AcpiNsGetAttachedObject (Node); if (!ObjDesc) { - return_ACPI_STATUS (AE_NOT_EXIST); + Status = AE_NOT_EXIST; + goto Cleanup; } ObjDesc->Region.Address = ACPI_PTR_TO_PHYSADDR (Table); ObjDesc->Region.Length = Table->Length; ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", - ObjDesc, - ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), + ObjDesc, ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), ObjDesc->Region.Length)); /* Now the address and length are valid for this opregion */ ObjDesc->Region.Flags |= AOPOBJ_DATA_VALID; +Cleanup: + AcpiUtRemoveReference (Operand[0]); + AcpiUtRemoveReference (Operand[1]); + AcpiUtRemoveReference (Operand[2]); + return_ACPI_STATUS (Status); } @@ -639,8 +647,8 @@ AcpiDsEvalDataObjectOperands ( } Status = AcpiExResolveOperands (WalkState->Opcode, - &(WalkState->Operands [WalkState->NumOperands -1]), - WalkState); + &(WalkState->Operands [WalkState->NumOperands -1]), + WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -668,13 +676,15 @@ AcpiDsEvalDataObjectOperands ( { case AML_BUFFER_OP: - Status = AcpiDsBuildInternalBufferObj (WalkState, Op, Length, &ObjDesc); + Status = AcpiDsBuildInternalBufferObj ( + WalkState, Op, Length, &ObjDesc); break; case AML_PACKAGE_OP: case AML_VAR_PACKAGE_OP: - Status = AcpiDsBuildInternalPackageObj (WalkState, Op, Length, &ObjDesc); + Status = AcpiDsBuildInternalPackageObj ( + WalkState, Op, Length, &ObjDesc); break; default: diff --git a/sys/contrib/dev/acpica/components/dispatcher/dsutils.c b/sys/contrib/dev/acpica/components/dispatcher/dsutils.c index a115b2e..1ffd0cb 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dsutils.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dsutils.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 @@ -140,9 +140,9 @@ AcpiDsDoImplicitReturn ( } ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Result %p will be implicitly returned; Prev=%p\n", - ReturnDesc, - WalkState->ImplicitReturnObj)); + "Result %p will be implicitly returned; Prev=%p\n", + ReturnDesc, + WalkState->ImplicitReturnObj)); /* * Delete any "stale" implicit return value first. However, in @@ -266,7 +266,8 @@ AcpiDsIsResultUsed ( * If we are executing the predicate AND this is the predicate op, * we will use the return value */ - if ((WalkState->ControlState->Common.State == ACPI_CONTROL_PREDICATE_EXECUTING) && + if ((WalkState->ControlState->Common.State == + ACPI_CONTROL_PREDICATE_EXECUTING) && (WalkState->ControlState->Control.PredicateOp == Op)) { goto ResultUsed; @@ -523,8 +524,8 @@ AcpiDsCreateOperand ( /* Get the entire name string from the AML stream */ - Status = AcpiExGetNameString (ACPI_TYPE_ANY, Arg->Common.Value.Buffer, - &NameString, &NameLength); + Status = AcpiExGetNameString (ACPI_TYPE_ANY, + Arg->Common.Value.Buffer, &NameString, &NameLength); if (ACPI_FAILURE (Status)) { @@ -544,10 +545,11 @@ AcpiDsCreateOperand ( */ if ((WalkState->DeferredNode) && (WalkState->DeferredNode->Type == ACPI_TYPE_BUFFER_FIELD) && - (ArgIndex == (UINT32) ((WalkState->Opcode == AML_CREATE_FIELD_OP) ? 3 : 2))) + (ArgIndex == (UINT32) + ((WalkState->Opcode == AML_CREATE_FIELD_OP) ? 3 : 2))) { ObjDesc = ACPI_CAST_PTR ( - ACPI_OPERAND_OBJECT, WalkState->DeferredNode); + ACPI_OPERAND_OBJECT, WalkState->DeferredNode); Status = AE_OK; } else /* All other opcodes */ @@ -560,6 +562,7 @@ AcpiDsCreateOperand ( */ ParentOp = Arg->Common.Parent; OpInfo = AcpiPsGetOpcodeInfo (ParentOp->Common.AmlOpcode); + if ((OpInfo->Flags & AML_NSNODE) && (ParentOp->Common.AmlOpcode != AML_INT_METHODCALL_OP) && (ParentOp->Common.AmlOpcode != AML_REGION_OP) && @@ -577,10 +580,9 @@ AcpiDsCreateOperand ( } Status = AcpiNsLookup (WalkState->ScopeInfo, NameString, - ACPI_TYPE_ANY, InterpreterMode, - ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, - WalkState, - ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &ObjDesc)); + ACPI_TYPE_ANY, InterpreterMode, + ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, WalkState, + ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &ObjDesc)); /* * The only case where we pass through (ignore) a NOT_FOUND * error is for the CondRefOf opcode. @@ -596,17 +598,19 @@ AcpiDsCreateOperand ( * object to the root */ ObjDesc = ACPI_CAST_PTR ( - ACPI_OPERAND_OBJECT, AcpiGbl_RootNode); + ACPI_OPERAND_OBJECT, AcpiGbl_RootNode); Status = AE_OK; } else if (ParentOp->Common.AmlOpcode == AML_EXTERNAL_OP) { - /* TBD: May only be temporary */ - - ObjDesc = AcpiUtCreateStringObject ((ACPI_SIZE) NameLength); - - ACPI_STRNCPY (ObjDesc->String.Pointer, NameString, NameLength); - Status = AE_OK; + /* + * This opcode should never appear here. It is used only + * by AML disassemblers and is surrounded by an If(0) + * by the ASL compiler. + * + * Therefore, if we see it here, it is a serious error. + */ + Status = AE_AML_BAD_OPCODE; } else { @@ -642,7 +646,8 @@ AcpiDsCreateOperand ( { return_ACPI_STATUS (Status); } - ACPI_DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (ObjDesc, WalkState)); + + AcpiDbDisplayArgumentObject (ObjDesc, WalkState); } else { @@ -675,13 +680,14 @@ AcpiDsCreateOperand ( return_ACPI_STATUS (AE_NOT_IMPLEMENTED); } - if ((OpInfo->Flags & AML_HAS_RETVAL) || (Arg->Common.Flags & ACPI_PARSEOP_IN_STACK)) + if ((OpInfo->Flags & AML_HAS_RETVAL) || + (Arg->Common.Flags & ACPI_PARSEOP_IN_STACK)) { ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Argument previously created, already stacked\n")); - ACPI_DEBUGGER_EXEC (AcpiDbDisplayArgumentObject ( - WalkState->Operands [WalkState->NumOperands - 1], WalkState)); + AcpiDbDisplayArgumentObject ( + WalkState->Operands [WalkState->NumOperands - 1], WalkState); /* * Use value that was already previously returned @@ -712,7 +718,7 @@ AcpiDsCreateOperand ( /* Initialize the new object */ Status = AcpiDsInitObjectFromOp ( - WalkState, Arg, Opcode, &ObjDesc); + WalkState, Arg, Opcode, &ObjDesc); if (ACPI_FAILURE (Status)) { AcpiUtDeleteObjectDesc (ObjDesc); @@ -728,7 +734,7 @@ AcpiDsCreateOperand ( return_ACPI_STATUS (Status); } - ACPI_DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (ObjDesc, WalkState)); + AcpiDbDisplayArgumentObject (ObjDesc, WalkState); } return_ACPI_STATUS (AE_OK); @@ -898,7 +904,8 @@ AcpiDsEvaluateNamePath ( AcpiUtRemoveReference (*Operand); - Status = AcpiUtCopyIobjectToIobject (*Operand, &NewObjDesc, WalkState); + Status = AcpiUtCopyIobjectToIobject ( + *Operand, &NewObjDesc, WalkState); if (ACPI_FAILURE (Status)) { goto Exit; diff --git a/sys/contrib/dev/acpica/components/dispatcher/dswexec.c b/sys/contrib/dev/acpica/components/dispatcher/dswexec.c index f391fe0..5873ed3 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dswexec.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dswexec.c @@ -6,7 +6,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 @@ -189,12 +189,13 @@ AcpiDsGetPredicateValue ( Cleanup: - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%p\n", + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Completed a predicate eval=%X Op=%p\n", WalkState->ControlState->Common.Value, WalkState->Op)); - /* Break to debugger to display result */ + /* Break to debugger to display result */ - ACPI_DEBUGGER_EXEC (AcpiDbDisplayResultObject (LocalObjDesc, WalkState)); + AcpiDbDisplayResultObject (LocalObjDesc, WalkState); /* * Delete the predicate result object (we know that @@ -286,10 +287,12 @@ AcpiDsExecBeginOp ( (WalkState->ControlState->Common.State == ACPI_CONTROL_CONDITIONAL_EXECUTING)) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Exec predicate Op=%p State=%p\n", - Op, WalkState)); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Exec predicate Op=%p State=%p\n", + Op, WalkState)); - WalkState->ControlState->Common.State = ACPI_CONTROL_PREDICATE_EXECUTING; + WalkState->ControlState->Common.State = + ACPI_CONTROL_PREDICATE_EXECUTING; /* Save start of predicate */ @@ -337,8 +340,8 @@ AcpiDsExecBeginOp ( } else { - Status = AcpiDsScopeStackPush (Op->Named.Node, - Op->Named.Node->Type, WalkState); + Status = AcpiDsScopeStackPush ( + Op->Named.Node, Op->Named.Node->Type, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -397,8 +400,8 @@ AcpiDsExecEndOp ( ACPI_FUNCTION_TRACE_PTR (DsExecEndOp, WalkState); - Op = WalkState->Op; - OpType = WalkState->OpInfo->Type; + Op = WalkState->Op; + OpType = WalkState->OpInfo->Type; OpClass = WalkState->OpInfo->Class; if (OpClass == AML_CLASS_UNKNOWN) @@ -418,8 +421,11 @@ AcpiDsExecEndOp ( /* Call debugger for single step support (DEBUG build only) */ - ACPI_DEBUGGER_EXEC (Status = AcpiDbSingleStep (WalkState, Op, OpClass)); - ACPI_DEBUGGER_EXEC (if (ACPI_FAILURE (Status)) {return_ACPI_STATUS (Status);}); + Status = AcpiDbSingleStep (WalkState, Op, OpClass); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } /* Decode the Opcode Class */ @@ -456,8 +462,8 @@ AcpiDsExecEndOp ( /* Resolve all operands */ Status = AcpiExResolveOperands (WalkState->Opcode, - &(WalkState->Operands [WalkState->NumOperands -1]), - WalkState); + &(WalkState->Operands [WalkState->NumOperands -1]), + WalkState); } if (ACPI_SUCCESS (Status)) @@ -534,7 +540,8 @@ AcpiDsExecEndOp ( ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Method Reference in a Package, Op=%p\n", Op)); - Op->Common.Node = (ACPI_NAMESPACE_NODE *) Op->Asl.Value.Arg->Asl.Node; + Op->Common.Node = (ACPI_NAMESPACE_NODE *) + Op->Asl.Value.Arg->Asl.Node; AcpiUtAddReference (Op->Asl.Value.Arg->Asl.Node->Object); return_ACPI_STATUS (AE_OK); } @@ -616,12 +623,12 @@ AcpiDsExecEndOp ( * Put the Node on the object stack (Contains the ACPI Name * of this object) */ - WalkState->Operands[0] = (void *) Op->Common.Parent->Common.Node; + WalkState->Operands[0] = (void *) + Op->Common.Parent->Common.Node; WalkState->NumOperands = 1; Status = AcpiDsCreateNode (WalkState, - Op->Common.Parent->Common.Node, - Op->Common.Parent); + Op->Common.Parent->Common.Node, Op->Common.Parent); if (ACPI_FAILURE (Status)) { break; @@ -633,7 +640,7 @@ AcpiDsExecEndOp ( case AML_INT_EVAL_SUBTREE_OP: Status = AcpiDsEvalDataObjectOperands (WalkState, Op, - AcpiNsGetAttachedObject (Op->Common.Parent->Common.Node)); + AcpiNsGetAttachedObject (Op->Common.Parent->Common.Node)); break; default: @@ -714,7 +721,8 @@ AcpiDsExecEndOp ( default: ACPI_ERROR ((AE_INFO, - "Unimplemented opcode, class=0x%X type=0x%X Opcode=0x%X Op=%p", + "Unimplemented opcode, class=0x%X " + "type=0x%X Opcode=0x%X Op=%p", OpClass, OpType, Op->Common.AmlOpcode, Op)); Status = AE_NOT_IMPLEMENTED; @@ -749,8 +757,7 @@ Cleanup: { /* Break to debugger to display result */ - ACPI_DEBUGGER_EXEC (AcpiDbDisplayResultObject (WalkState->ResultObj, - WalkState)); + AcpiDbDisplayResultObject (WalkState->ResultObj,WalkState); /* * Delete the result op if and only if: diff --git a/sys/contrib/dev/acpica/components/dispatcher/dswload.c b/sys/contrib/dev/acpica/components/dispatcher/dswload.c index 8bc425a..ff14300 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dswload.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dswload.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 @@ -188,7 +188,8 @@ AcpiDsLoad1BeginOp ( ObjectType = WalkState->OpInfo->ObjectType; ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "State=%p Op=%p [%s]\n", WalkState, Op, AcpiUtGetTypeName (ObjectType))); + "State=%p Op=%p [%s]\n", WalkState, Op, + AcpiUtGetTypeName (ObjectType))); switch (WalkState->Opcode) { @@ -199,7 +200,7 @@ AcpiDsLoad1BeginOp ( * Allow search-to-root for single namesegs. */ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, - ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node)); + ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node)); #ifdef ACPI_ASL_COMPILER if (Status == AE_NOT_FOUND) { @@ -210,8 +211,8 @@ AcpiDsLoad1BeginOp ( */ AcpiDmAddOpToExternalList (Op, Path, ACPI_TYPE_DEVICE, 0, 0); Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, - ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, - WalkState, &Node); + ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, + WalkState, &Node); } #endif if (ACPI_FAILURE (Status)) @@ -325,15 +326,24 @@ AcpiDsLoad1BeginOp ( if ((WalkState->Opcode != AML_SCOPE_OP) && (!(WalkState->ParseFlags & ACPI_PARSE_DEFERRED_OP))) { - Flags |= ACPI_NS_ERROR_IF_FOUND; - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Cannot already exist\n", + if (WalkState->NamespaceOverride) + { + Flags |= ACPI_NS_OVERRIDE_IF_FOUND; + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Override allowed\n", + AcpiUtGetTypeName (ObjectType))); + } + else + { + Flags |= ACPI_NS_ERROR_IF_FOUND; + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Cannot already exist\n", AcpiUtGetTypeName (ObjectType))); + } } else { ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Both Find or Create allowed\n", - AcpiUtGetTypeName (ObjectType))); + AcpiUtGetTypeName (ObjectType))); } /* @@ -343,7 +353,7 @@ AcpiDsLoad1BeginOp ( * parse tree later. */ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, - ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node); + ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node); if (ACPI_FAILURE (Status)) { if (Status == AE_ALREADY_EXISTS) @@ -363,7 +373,8 @@ AcpiDsLoad1BeginOp ( if (AcpiNsOpensScope (ObjectType)) { - Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); + Status = AcpiDsScopeStackPush ( + Node, ObjectType, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -389,7 +400,7 @@ AcpiDsLoad1BeginOp ( { /* Create a new op */ - Op = AcpiPsAllocOp (WalkState->Opcode); + Op = AcpiPsAllocOp (WalkState->Opcode, WalkState->Aml); if (!Op) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -485,8 +496,9 @@ AcpiDsLoad1EndOp ( if (Op->Common.AmlOpcode == AML_REGION_OP) { Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length, - (ACPI_ADR_SPACE_TYPE) ((Op->Common.Value.Arg)->Common.Value.Integer), - WalkState); + (ACPI_ADR_SPACE_TYPE) + ((Op->Common.Value.Arg)->Common.Value.Integer), + WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -495,7 +507,7 @@ AcpiDsLoad1EndOp ( else if (Op->Common.AmlOpcode == AML_DATA_REGION_OP) { Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length, - ACPI_ADR_SPACE_DATA_TABLE, WalkState); + ACPI_ADR_SPACE_DATA_TABLE, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -547,11 +559,12 @@ AcpiDsLoad1EndOp ( WalkState->Operands[0] = ACPI_CAST_PTR (void, Op->Named.Node); WalkState->NumOperands = 1; - Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg); + Status = AcpiDsCreateOperands ( + WalkState, Op->Common.Value.Arg); if (ACPI_SUCCESS (Status)) { Status = AcpiExCreateMethod (Op->Named.Data, - Op->Named.Length, WalkState); + Op->Named.Length, WalkState); } WalkState->Operands[0] = NULL; diff --git a/sys/contrib/dev/acpica/components/dispatcher/dswload2.c b/sys/contrib/dev/acpica/components/dispatcher/dswload2.c index 4728774..09fbb88 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dswload2.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dswload2.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 @@ -159,8 +159,8 @@ AcpiDsLoad2BeginOp ( * for use later. */ Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, - ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, - WalkState, &(Node)); + ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, + WalkState, &(Node)); break; case AML_SCOPE_OP: @@ -185,8 +185,8 @@ AcpiDsLoad2BeginOp ( * for use later. */ Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, - ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, - WalkState, &(Node)); + ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, + WalkState, &(Node)); if (ACPI_FAILURE (Status)) { #ifdef ACPI_ASL_COMPILER @@ -323,7 +323,7 @@ AcpiDsLoad2BeginOp ( /* Add new entry or lookup existing entry */ Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, - ACPI_IMODE_LOAD_PASS2, Flags, WalkState, &Node); + ACPI_IMODE_LOAD_PASS2, Flags, WalkState, &Node); if (ACPI_SUCCESS (Status) && (Flags & ACPI_NS_TEMPORARY)) { @@ -344,7 +344,7 @@ AcpiDsLoad2BeginOp ( { /* Create a new op */ - Op = AcpiPsAllocOp (WalkState->Opcode); + Op = AcpiPsAllocOp (WalkState->Opcode, WalkState->Aml); if (!Op) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -401,7 +401,7 @@ AcpiDsLoad2EndOp ( Op = WalkState->Op; ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n", - WalkState->OpInfo->Name, Op, WalkState)); + WalkState->OpInfo->Name, Op, WalkState)); /* Check if opcode had an associated namespace object */ @@ -507,8 +507,8 @@ AcpiDsLoad2EndOp ( { case AML_INDEX_FIELD_OP: - Status = AcpiDsCreateIndexField (Op, (ACPI_HANDLE) Arg->Common.Node, - WalkState); + Status = AcpiDsCreateIndexField ( + Op, (ACPI_HANDLE) Arg->Common.Node, WalkState); break; case AML_BANK_FIELD_OP: @@ -593,7 +593,7 @@ AcpiDsLoad2EndOp ( if (Op->Common.AmlOpcode == AML_REGION_OP) { RegionSpace = (ACPI_ADR_SPACE_TYPE) - ((Op->Common.Value.Arg)->Common.Value.Integer); + ((Op->Common.Value.Arg)->Common.Value.Integer); } else { @@ -618,8 +618,8 @@ AcpiDsLoad2EndOp ( * Executing a method: initialize the region and unlock * the interpreter */ - Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length, - RegionSpace, WalkState); + Status = AcpiExCreateRegion (Op->Named.Data, + Op->Named.Length, RegionSpace, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -628,8 +628,8 @@ AcpiDsLoad2EndOp ( AcpiExExitInterpreter (); } - Status = AcpiEvInitializeRegion (AcpiNsGetAttachedObject (Node), - FALSE); + Status = AcpiEvInitializeRegion ( + AcpiNsGetAttachedObject (Node), FALSE); if (WalkState->MethodNode) { AcpiExEnterInterpreter (); @@ -672,12 +672,14 @@ AcpiDsLoad2EndOp ( WalkState->Operands[0] = ACPI_CAST_PTR (void, Op->Named.Node); WalkState->NumOperands = 1; - Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg); + Status = AcpiDsCreateOperands ( + WalkState, Op->Common.Value.Arg); if (ACPI_SUCCESS (Status)) { - Status = AcpiExCreateMethod (Op->Named.Data, - Op->Named.Length, WalkState); + Status = AcpiExCreateMethod ( + Op->Named.Data, Op->Named.Length, WalkState); } + WalkState->Operands[0] = NULL; WalkState->NumOperands = 0; @@ -712,9 +714,9 @@ AcpiDsLoad2EndOp ( * Lookup the method name and save the Node */ Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, - ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2, - ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, - WalkState, &(NewNode)); + ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2, + ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, + WalkState, &(NewNode)); if (ACPI_SUCCESS (Status)) { /* diff --git a/sys/contrib/dev/acpica/components/dispatcher/dswscope.c b/sys/contrib/dev/acpica/components/dispatcher/dswscope.c index dc1fedc..ba99d1e 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dswscope.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dswscope.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 @@ -82,6 +82,7 @@ AcpiDsScopeStackClear ( ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Popped object type (%s)\n", AcpiUtGetTypeName (ScopeInfo->Common.Value))); + AcpiUtDeleteGenericState (ScopeInfo); } } diff --git a/sys/contrib/dev/acpica/components/dispatcher/dswstate.c b/sys/contrib/dev/acpica/components/dispatcher/dswstate.c index 5211666..b19d6a9 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dswstate.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dswstate.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 @@ -299,8 +299,8 @@ AcpiDsResultStackPop ( if (WalkState->Results == NULL) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Result stack underflow - State=%p\n", - WalkState)); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Result stack underflow - State=%p\n", WalkState)); return (AE_AML_NO_OPERAND); } @@ -707,7 +707,8 @@ AcpiDsInitAmlWalk ( /* Push start scope on scope stack and make it current */ - Status = AcpiDsScopeStackPush (MethodNode, ACPI_TYPE_METHOD, WalkState); + Status = AcpiDsScopeStackPush ( + MethodNode, ACPI_TYPE_METHOD, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -750,7 +751,7 @@ AcpiDsInitAmlWalk ( /* Push start scope on scope stack and make it current */ Status = AcpiDsScopeStackPush (ParserState->StartNode, - ParserState->StartNode->Type, WalkState); + ParserState->StartNode->Type, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); |