--- sys/contrib/dev/acpica/CHANGES.txt Wed Mar 21 17:35:29 2007 +++ sys/contrib/dev/acpica/CHANGES.txt Wed Mar 21 14:41:22 2007 @@ -1,4 +1,68 @@ ---------------------------------------- +20 March 2007. Summary of changes for version 20070320: + +1) ACPI CA Core Subsystem: + +Implemented a change to the order of interpretation and +evaluation of AML operand objects within the AML interpreter. The +interpreter now evaluates operands in the order that they appear +in the AML stream (and the corresponding ASL code), instead of in +the reverse order (after the entire operand list has been +parsed). The previous behavior caused several subtle +incompatibilities with the Microsoft AML interpreter as well as +being somewhat non-intuitive. BZ 7871, local BZ 263. Valery +Podrezov. + +Implemented a change to the ACPI Global Lock support. All +interfaces to the global lock now allow the same thread to +acquire the lock multiple times. This affects the +AcpiAcquireGlobalLock external interface to the global lock as +well as the internal use of the global lock to support AML fields +-- a control method that is holding the global lock can now +simultaneously access AML fields that require global lock +protection. Previously, in both cases, this would have resulted +in an AE_ALREADY_ACQUIRED exception. The change to +AcpiAcquireGlobalLock is of special interest to drivers for the +Embedded Controller. There is no change to the behavior of the +AML Acquire operator, as this can already be used to acquire a +mutex multiple times by the same thread. BZ 8066. With assistance +from Alexey Starikovskiy. + +Fixed a problem where invalid objects could be referenced in the +AML Interpreter after error conditions. During operand +evaluation, ensure that the internal "Return Object" field is +cleared on error and only valid pointers are stored there. Caused +occasional access to deleted objects that resulted in "large +reference count" warning messages. Valery Podrezov. + +Fixed a problem where an AE_STACK_OVERFLOW internal exception +could occur on deeply nested control method invocations. BZ 7873, +local BZ 487. Valery Podrezov. + +Fixed an internal problem with the handling of result objects on +the interpreter result stack. BZ 7872. Valery Podrezov. + +Removed obsolete code that handled the case where AML_NAME_OP is +the target of a reference (Reference.Opcode). This code was no +longer necessary. BZ 7874. Valery Podrezov. + +Removed obsolete ACPI_NO_INTEGER64_SUPPORT from two header files. +This was a remnant from the previously discontinued 16-bit +support. + +Example Code and Data Size: These are the sizes for the OS- +independent acpica.lib produced by the Microsoft Visual C++ 6.0 +32-bit compiler. The debug version of the code includes the debug +output trace mechanism and has a much larger code and data size. + + Previous Release: + Non-Debug Version: 78.0K Code, 17.1K Data, 95.1K Total + Debug Version: 155.8K Code, 63.3K Data, 219.1K Total + Current Release: + Non-Debug Version: 78.0K Code, 17.1K Data, 95.1K Total + Debug Version: 155.9K Code, 63.1K Data, 219.0K Total + +---------------------------------------- 26 January 2007. Summary of changes for version 20070126: 1) ACPI CA Core Subsystem: --- sys/contrib/dev/acpica/acconfig.h Wed Mar 21 17:35:29 2007 +++ sys/contrib/dev/acpica/acconfig.h Wed Mar 21 14:41:22 2007 @@ -137,7 +137,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20070126 +#define ACPI_CA_VERSION 0x20070320 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, @@ -225,6 +225,17 @@ */ #define ACPI_OBJ_NUM_OPERANDS 8 #define ACPI_OBJ_MAX_OPERAND 7 + +/* Number of elements in the Result Stack frame, can be an arbitrary value */ + +#define ACPI_RESULTS_FRAME_OBJ_NUM 8 + +/* + * Maximal number of elements the Result Stack can contain, + * it may be an arbitray value not exceeding the types of + * ResultSize and ResultCount (now UINT8). + */ +#define ACPI_RESULTS_OBJ_NUM_MAX 255 /* Names within the namespace are 4 bytes long */ --- sys/contrib/dev/acpica/acdispat.h Wed Mar 21 17:35:29 2007 +++ sys/contrib/dev/acpica/acdispat.h Wed Mar 21 14:41:22 2007 @@ -421,6 +421,10 @@ AcpiDsClearOperands ( ACPI_WALK_STATE *WalkState); +ACPI_STATUS +AcpiDsEvaluateNamePath ( + ACPI_WALK_STATE *WalkState); + /* * dswscope - Scope Stack manipulation @@ -471,7 +475,7 @@ ACPI_EVALUATE_INFO *Info, UINT8 PassNumber); -ACPI_STATUS +void AcpiDsObjStackPopAndDelete ( UINT32 PopCount, ACPI_WALK_STATE *WalkState); @@ -490,14 +494,6 @@ ACPI_THREAD_STATE *Thread); ACPI_STATUS -AcpiDsResultStackPop ( - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiDsResultStackPush ( - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS AcpiDsResultStackClear ( ACPI_WALK_STATE *WalkState); @@ -506,12 +502,6 @@ ACPI_THREAD_STATE *Thread); ACPI_STATUS -AcpiDsResultRemove ( - ACPI_OPERAND_OBJECT **Object, - UINT32 Index, - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS AcpiDsResultPop ( ACPI_OPERAND_OBJECT **Object, ACPI_WALK_STATE *WalkState); @@ -519,11 +509,6 @@ ACPI_STATUS AcpiDsResultPush ( ACPI_OPERAND_OBJECT *Object, - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiDsResultPopFromBottom ( - ACPI_OPERAND_OBJECT **Object, ACPI_WALK_STATE *WalkState); #endif /* _ACDISPAT_H_ */ --- sys/contrib/dev/acpica/acfreebsd.h Wed Mar 21 17:35:29 2007 +++ sys/contrib/dev/acpica/acfreebsd.h Wed Mar 21 14:41:22 2007 @@ -179,22 +179,22 @@ #if defined(_KERNEL) && (__FreeBSD_version < 700020) /* Or strstr (used in debugging mode, also move to libkern) */ static __inline char * -strstr(char *s, char *find) +strstr (char *s, char *find) { char c, sc; size_t len; if ((c = *find++) != 0) { - len = strlen(find); - do { - do { - if ((sc = *s++) == 0) - return (NULL); - } while (sc != c); - } while (strncmp(s, find, len) != 0); - s--; + len = strlen (find); + do { + do { + if ((sc = *s++) == 0) + return (NULL); + } while (sc != c); + } while (strncmp (s, find, len) != 0); + s--; } - return ((char *)s); + return ((char *) s); } #endif /* _KERNEL */ --- sys/contrib/dev/acpica/acglobal.h Wed Mar 21 17:35:29 2007 +++ sys/contrib/dev/acpica/acglobal.h Wed Mar 21 14:41:22 2007 @@ -180,35 +180,6 @@ /***************************************************************************** * - * Debug support - * - ****************************************************************************/ - -/* Runtime configuration of debug print levels */ - -extern UINT32 AcpiDbgLevel; -extern UINT32 AcpiDbgLayer; - -/* Procedure nesting level for debug output */ - -extern UINT32 AcpiGbl_NestingLevel; - -/* Event counters */ - -ACPI_EXTERN UINT32 AcpiGpeCount; - -/* Support for dynamic control method tracing mechanism */ - -ACPI_EXTERN UINT32 AcpiGbl_OriginalDbgLevel; -ACPI_EXTERN UINT32 AcpiGbl_OriginalDbgLayer; -ACPI_EXTERN ACPI_NAME AcpiGbl_TraceMethodName; -ACPI_EXTERN UINT32 AcpiGbl_TraceDbgLevel; -ACPI_EXTERN UINT32 AcpiGbl_TraceDbgLayer; -ACPI_EXTERN UINT32 AcpiGbl_TraceFlags; - - -/***************************************************************************** - * * ACPI Table globals * ****************************************************************************/ @@ -251,10 +222,14 @@ ACPI_EXTERN ACPI_MUTEX_INFO AcpiGbl_MutexInfo[ACPI_NUM_MUTEX]; /* - * Global lock semaphore works in conjunction with the actual HW global lock + * Global lock mutex is an actual AML mutex object + * Global lock semaphore works in conjunction with the HW global lock */ -ACPI_EXTERN ACPI_MUTEX AcpiGbl_GlobalLockMutex; +ACPI_EXTERN ACPI_OPERAND_OBJECT *AcpiGbl_GlobalLockMutex; ACPI_EXTERN ACPI_SEMAPHORE AcpiGbl_GlobalLockSemaphore; +ACPI_EXTERN UINT16 AcpiGbl_GlobalLockHandle; +ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockAcquired; +ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockPresent; /* * Spinlocks are used for interfaces that can be possibly called at @@ -270,15 +245,6 @@ * ****************************************************************************/ -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - -/* Lists for tracking memory allocations */ - -ACPI_EXTERN ACPI_MEMORY_LIST *AcpiGbl_GlobalList; -ACPI_EXTERN ACPI_MEMORY_LIST *AcpiGbl_NsNodeList; -ACPI_EXTERN BOOLEAN AcpiGbl_DisplayFinalMemStats; -#endif - /* Object caches */ ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_NamespaceCache; @@ -295,40 +261,54 @@ ACPI_EXTERN ACPI_INIT_HANDLER AcpiGbl_InitHandler; ACPI_EXTERN ACPI_WALK_STATE *AcpiGbl_BreakpointWalk; +/* Owner ID support */ + +ACPI_EXTERN UINT32 AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS]; +ACPI_EXTERN UINT8 AcpiGbl_LastOwnerIdIndex; +ACPI_EXTERN UINT8 AcpiGbl_NextOwnerIdOffset; + /* Misc */ ACPI_EXTERN UINT32 AcpiGbl_OriginalMode; ACPI_EXTERN UINT32 AcpiGbl_RsdpOriginalLocation; ACPI_EXTERN UINT32 AcpiGbl_NsLookupCount; ACPI_EXTERN UINT32 AcpiGbl_PsFindCount; -ACPI_EXTERN UINT32 AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS]; ACPI_EXTERN UINT16 AcpiGbl_Pm1EnableRegisterSave; -ACPI_EXTERN UINT16 AcpiGbl_GlobalLockHandle; -ACPI_EXTERN UINT8 AcpiGbl_LastOwnerIdIndex; -ACPI_EXTERN UINT8 AcpiGbl_NextOwnerIdOffset; ACPI_EXTERN UINT8 AcpiGbl_DebuggerConfiguration; -ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockAcquired; ACPI_EXTERN BOOLEAN AcpiGbl_StepToNextCall; ACPI_EXTERN BOOLEAN AcpiGbl_AcpiHardwarePresent; -ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockPresent; ACPI_EXTERN BOOLEAN AcpiGbl_EventsInitialized; ACPI_EXTERN BOOLEAN AcpiGbl_SystemAwakeAndRunning; + +#ifndef DEFINE_ACPI_GLOBALS + +/* Exception codes */ + +extern char const *AcpiGbl_ExceptionNames_Env[]; +extern char const *AcpiGbl_ExceptionNames_Pgm[]; +extern char const *AcpiGbl_ExceptionNames_Tbl[]; +extern char const *AcpiGbl_ExceptionNames_Aml[]; +extern char const *AcpiGbl_ExceptionNames_Ctrl[]; + +/* Other miscellaneous */ + extern BOOLEAN AcpiGbl_Shutdown; extern UINT32 AcpiGbl_StartupFlags; extern const char *AcpiGbl_SleepStateNames[ACPI_S_STATE_COUNT]; extern const char *AcpiGbl_HighestDstateNames[4]; extern const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES]; extern const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS]; +#endif -/* Exception codes */ -#ifndef DEFINE_ACPI_GLOBALS -extern char const *AcpiGbl_ExceptionNames_Env[]; -extern char const *AcpiGbl_ExceptionNames_Pgm[]; -extern char const *AcpiGbl_ExceptionNames_Tbl[]; -extern char const *AcpiGbl_ExceptionNames_Aml[]; -extern char const *AcpiGbl_ExceptionNames_Ctrl[]; +#ifdef ACPI_DBG_TRACK_ALLOCATIONS + +/* Lists for tracking memory allocations */ + +ACPI_EXTERN ACPI_MEMORY_LIST *AcpiGbl_GlobalList; +ACPI_EXTERN ACPI_MEMORY_LIST *AcpiGbl_NsNodeList; +ACPI_EXTERN BOOLEAN AcpiGbl_DisplayFinalMemStats; #endif @@ -398,6 +378,35 @@ ACPI_EXTERN ACPI_FIXED_EVENT_HANDLER AcpiGbl_FixedEventHandlers[ACPI_NUM_FIXED_EVENTS]; ACPI_EXTERN ACPI_GPE_XRUPT_INFO *AcpiGbl_GpeXruptListHead; ACPI_EXTERN ACPI_GPE_BLOCK_INFO *AcpiGbl_GpeFadtBlocks[ACPI_MAX_GPE_BLOCKS]; + + +/***************************************************************************** + * + * Debug support + * + ****************************************************************************/ + +/* Runtime configuration of debug print levels */ + +extern UINT32 AcpiDbgLevel; +extern UINT32 AcpiDbgLayer; + +/* Procedure nesting level for debug output */ + +extern UINT32 AcpiGbl_NestingLevel; + +/* Event counters */ + +ACPI_EXTERN UINT32 AcpiGpeCount; + +/* Support for dynamic control method tracing mechanism */ + +ACPI_EXTERN UINT32 AcpiGbl_OriginalDbgLevel; +ACPI_EXTERN UINT32 AcpiGbl_OriginalDbgLayer; +ACPI_EXTERN ACPI_NAME AcpiGbl_TraceMethodName; +ACPI_EXTERN UINT32 AcpiGbl_TraceDbgLevel; +ACPI_EXTERN UINT32 AcpiGbl_TraceDbgLayer; +ACPI_EXTERN UINT32 AcpiGbl_TraceFlags; /***************************************************************************** --- sys/contrib/dev/acpica/acinterp.h Wed Mar 21 17:35:29 2007 +++ sys/contrib/dev/acpica/acinterp.h Wed Mar 21 14:41:22 2007 @@ -381,10 +381,20 @@ ACPI_WALK_STATE *WalkState); ACPI_STATUS +AcpiExAcquireMutexObject ( + UINT16 Timeout, + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_THREAD_ID ThreadId); + +ACPI_STATUS AcpiExReleaseMutex ( ACPI_OPERAND_OBJECT *ObjDesc, ACPI_WALK_STATE *WalkState); +ACPI_STATUS +AcpiExReleaseMutexObject ( + ACPI_OPERAND_OBJECT *ObjDesc); + void AcpiExReleaseAllMutexes ( ACPI_THREAD_STATE *Thread); @@ -685,13 +695,13 @@ AcpiExTruncateFor32bitTable ( ACPI_OPERAND_OBJECT *ObjDesc); -BOOLEAN +void AcpiExAcquireGlobalLock ( UINT32 Rule); void AcpiExReleaseGlobalLock ( - BOOLEAN Locked); + UINT32 Rule); void AcpiExEisaIdToString ( --- sys/contrib/dev/acpica/aclocal.h Wed Mar 21 17:35:29 2007 +++ sys/contrib/dev/acpica/aclocal.h Wed Mar 21 14:41:22 2007 @@ -693,9 +693,7 @@ typedef struct acpi_result_values { ACPI_STATE_COMMON - UINT8 NumResults; - UINT8 LastInsert; - union acpi_operand_object *ObjDesc [ACPI_OBJ_NUM_OPERANDS]; + union acpi_operand_object *ObjDesc [ACPI_RESULTS_FRAME_OBJ_NUM]; } ACPI_RESULT_VALUES; @@ -795,6 +793,7 @@ union acpi_parse_object *Next; /* Next op */\ ACPI_NAMESPACE_NODE *Node; /* For use by interpreter */\ ACPI_PARSE_VALUE Value; /* Value or args associated with the opcode */\ + UINT8 ArgListLength; /* Number of elements in the arg list */\ ACPI_DISASM_ONLY_MEMBERS (\ UINT8 DisasmFlags; /* Used during AML disassembly */\ UINT8 DisasmOpcode; /* Subtype used for disassembly */\ @@ -904,6 +903,8 @@ #define ACPI_PARSEOP_NAMED 0x02 #define ACPI_PARSEOP_DEFERRED 0x04 #define ACPI_PARSEOP_BYTELIST 0x08 +#define ACPI_PARSEOP_IN_STACK 0x10 +#define ACPI_PARSEOP_TARGET 0x20 #define ACPI_PARSEOP_IN_CACHE 0x80 /* Parse object DisasmFlags */ --- sys/contrib/dev/acpica/acmacros.h Wed Mar 21 17:35:29 2007 +++ sys/contrib/dev/acpica/acmacros.h Wed Mar 21 14:41:22 2007 @@ -136,21 +136,12 @@ #define ACPI_ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0])) -#ifdef ACPI_NO_INTEGER64_SUPPORT /* - * ACPI_INTEGER is 32-bits, no 64-bit support on this platform - */ -#define ACPI_LODWORD(l) ((UINT32)(l)) -#define ACPI_HIDWORD(l) ((UINT32)(0)) - -#else - -/* - * Full 64-bit address/integer on both 32-bit and 64-bit platforms + * Full 64-bit integer must be available on both 32-bit and 64-bit platforms */ #define ACPI_LODWORD(l) ((UINT32)(UINT64)(l)) #define ACPI_HIDWORD(l) ((UINT32)(((*(UINT64_STRUCT *)(void *)(&l))).Hi)) -#endif + /* * printf() format helpers --- sys/contrib/dev/acpica/acobject.h Wed Mar 21 17:35:29 2007 +++ sys/contrib/dev/acpica/acobject.h Wed Mar 21 14:41:22 2007 @@ -257,8 +257,9 @@ ACPI_OBJECT_COMMON_HEADER UINT8 SyncLevel; /* 0-15, specified in Mutex() call */ UINT16 AcquisitionDepth; /* Allow multiple Acquires, same thread */ - struct acpi_thread_state *OwnerThread; /* Current owner of the mutex */ ACPI_MUTEX OsMutex; /* Actual OS synchronization object */ + ACPI_THREAD_ID ThreadId; /* Current owner of the mutex */ + struct acpi_thread_state *OwnerThread; /* Current owner of the mutex */ union acpi_operand_object *Prev; /* Link for list of acquired mutexes */ union acpi_operand_object *Next; /* Link for list of acquired mutexes */ ACPI_NAMESPACE_NODE *Node; /* Containing namespace node */ --- sys/contrib/dev/acpica/acparser.h Wed Mar 21 17:35:29 2007 +++ sys/contrib/dev/acpica/acparser.h Wed Mar 21 14:41:22 2007 @@ -211,6 +211,10 @@ AcpiPsGetOpcodeName ( UINT16 Opcode); +UINT8 +AcpiPsGetArgumentCount ( + UINT32 OpType); + /* * psparse - top level parsing routines --- sys/contrib/dev/acpica/acpica_prep.sh Wed Mar 21 17:35:29 2007 +++ sys/contrib/dev/acpica/acpica_prep.sh Wed Mar 21 14:41:22 2007 @@ -19,7 +19,8 @@ stripdirs="generate acpisrc" stripfiles="16bit.h Makefile README a16find.c a16utils.asm a16utils.obj \ acdos16.h acintel.h aclinux.h acmsvc.h acnetbsd.h acpixtract.c \ - acwin.h acwin64.h aeexec.c aemain.c aemain.c.orig osdosxf.c \ osunixdir.c oswindir.c oswinxf.c readme.txt" + acwin.h acwin64.h aeexec.c aemain.c osdosxf.c osunixdir.c \ + oswindir.c oswinxf.c readme.txt" # include files to canonify src_headers="acapps.h acconfig.h acdebug.h acdisasm.h acdispat.h \ acenv.h acevents.h acexcep.h acfreebsd.h acgcc.h acglobal.h \ --- sys/contrib/dev/acpica/acstruct.h Wed Mar 21 17:35:29 2007 +++ sys/contrib/dev/acpica/acstruct.h Wed Mar 21 14:41:22 2007 @@ -156,12 +156,15 @@ UINT16 Opcode; /* Current AML opcode */ UINT8 NextOpInfo; /* Info about NextOp */ UINT8 NumOperands; /* Stack pointer for Operands[] array */ + UINT8 OperandIndex; /* Index into operand stack, to be used by AcpiDsObjStackPush */ ACPI_OWNER_ID OwnerId; /* Owner of objects created during the walk */ BOOLEAN LastPredicate; /* Result of last predicate */ UINT8 CurrentResult; UINT8 ReturnUsed; UINT8 ScopeDepth; UINT8 PassNumber; /* Parse pass during table load */ + UINT8 ResultSize; /* Total elements for the result stack */ + UINT8 ResultCount; /* Current number of occupied elements of result stack */ UINT32 AmlOffset; UINT32 ArgTypes; UINT32 MethodBreakpoint; /* For single stepping */ --- sys/contrib/dev/acpica/actypes.h Wed Mar 21 17:35:29 2007 +++ sys/contrib/dev/acpica/actypes.h Wed Mar 21 14:41:22 2007 @@ -414,28 +414,11 @@ /* - * Acpi integer width. In ACPI version 1, integers are - * 32 bits. In ACPI version 2, integers are 64 bits. - * Note that this pertains to the ACPI integer type only, not - * other integers used in the implementation of the ACPI CA + * Acpi integer width. In ACPI version 1, integers are 32 bits. In ACPI + * version 2, integers are 64 bits. Note that this pertains to the ACPI integer + * type only, not other integers used in the implementation of the ACPI CA * subsystem. */ -#ifdef ACPI_NO_INTEGER64_SUPPORT - -/* 32-bit integers only, no 64-bit support */ - -typedef UINT32 ACPI_INTEGER; -#define ACPI_INTEGER_MAX ACPI_UINT32_MAX -#define ACPI_INTEGER_BIT_SIZE 32 -#define ACPI_MAX_DECIMAL_DIGITS 10 /* 2^32 = 4,294,967,296 */ - -#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 32-bit divide */ - - -#else - -/* 64-bit integers */ - typedef UINT64 ACPI_INTEGER; #define ACPI_INTEGER_MAX ACPI_UINT64_MAX #define ACPI_INTEGER_BIT_SIZE 64 @@ -444,7 +427,6 @@ #if ACPI_MACHINE_WIDTH == 64 #define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 64-bit divide */ -#endif #endif #define ACPI_MAX64_DECIMAL_DIGITS 20 --- sys/contrib/dev/acpica/dbdisply.c Wed Mar 21 17:35:29 2007 +++ sys/contrib/dev/acpica/dbdisply.c Wed Mar 21 14:41:22 2007 @@ -580,8 +580,10 @@ UINT32 i; ACPI_WALK_STATE *WalkState; ACPI_OPERAND_OBJECT *ObjDesc; - UINT32 NumResults = 0; + UINT32 ResultCount = 0; ACPI_NAMESPACE_NODE *Node; + ACPI_GENERIC_STATE *Frame; + UINT32 Index; /* Index onto current frame */ WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); @@ -596,17 +598,28 @@ if (WalkState->Results) { - NumResults = WalkState->Results->Results.NumResults; + ResultCount = WalkState->ResultCount; } AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n", - AcpiUtGetNodeName (Node), NumResults); + AcpiUtGetNodeName (Node), ResultCount); - for (i = 0; i < NumResults; i++) + /* From the top element of result stack */ + + Frame = WalkState->Results; + Index = (ResultCount - 1) % ACPI_RESULTS_FRAME_OBJ_NUM; + + for (i = 0; i < ResultCount; i++) { - ObjDesc = WalkState->Results->Results.ObjDesc[i]; + ObjDesc = Frame->Results.ObjDesc[Index]; AcpiOsPrintf ("Result%d: ", i); AcpiDmDisplayInternalObject (ObjDesc, WalkState); + if (Index == 0) + { + Frame = Frame->Results.Next; + Index = ACPI_RESULTS_FRAME_OBJ_NUM; + } + Index--; } } --- sys/contrib/dev/acpica/dbstats.c Wed Mar 21 17:35:29 2007 +++ sys/contrib/dev/acpica/dbstats.c Wed Mar 21 14:41:22 2007 @@ -201,7 +201,7 @@ if (List->MaxDepth > 0) { AcpiOsPrintf ( - " Cache: [Depth MaxD Avail Size] %8.2X %8.2X %8.2X %8.2X B\n", + " Cache: [Depth MaxD Avail Size] %8.2X %8.2X %8.2X %8.2X\n", List->CurrentDepth, List->MaxDepth, List->MaxDepth - List->CurrentDepth, @@ -212,7 +212,7 @@ if (List->MaxDepth > 0) { AcpiOsPrintf ( - " Cache: [Requests Hits Misses ObjSize] %8.2X %8.2X %8.2X %8.2X B\n", + " Cache: [Requests Hits Misses ObjSize] %8.2X %8.2X %8.2X %8.2X\n", List->Requests, List->Hits, List->Requests - List->Hits, @@ -224,23 +224,23 @@ if (List->ObjectSize) { AcpiOsPrintf ( - " Mem: [Alloc Free Max CurSize Outstanding] %8.2X %8.2X %8.2X %8.2X Kb %8.2X\n", + " Mem: [Alloc Free Max CurSize Outstanding] %8.2X %8.2X %8.2X %8.2X %8.2X\n", List->TotalAllocated, List->TotalFreed, List->MaxOccupied, - ACPI_ROUND_UP_TO_1K (Outstanding * List->ObjectSize), + Outstanding * List->ObjectSize, Outstanding); } else { AcpiOsPrintf ( - " Mem: [Alloc Free Max CurSize Outstanding Total] %8.2X %8.2X %8.2X Kb %8.2X Kb %8.2X %8.2X Kb\n", + " Mem: [Alloc Free Max CurSize Outstanding Total] %8.2X %8.2X %8.2X %8.2X %8.2X %8.2X\n", List->TotalAllocated, List->TotalFreed, - ACPI_ROUND_UP_TO_1K (List->MaxOccupied), - ACPI_ROUND_UP_TO_1K (List->CurrentTotalSize), + List->MaxOccupied, + List->CurrentTotalSize, Outstanding, - ACPI_ROUND_UP_TO_1K (List->TotalSize)); + List->TotalSize); } #endif } --- sys/contrib/dev/acpica/dmopcode.c Wed Mar 21 17:35:30 2007 +++ sys/contrib/dev/acpica/dmopcode.c Wed Mar 21 14:41:22 2007 @@ -615,13 +615,15 @@ if ((Op->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP) && (WalkState) && (WalkState->Results) && - (WalkState->Results->Results.NumResults)) + (WalkState->ResultCount)) { AcpiDmDecodeInternalObject ( WalkState->Results->Results.ObjDesc [ - WalkState->Results->Results.NumResults-1]); + (WalkState->ResultCount - 1) % + ACPI_RESULTS_FRAME_OBJ_NUM]); } #endif + break; } } --- sys/contrib/dev/acpica/dsmethod.c Wed Mar 21 17:35:30 2007 +++ sys/contrib/dev/acpica/dsmethod.c Wed Mar 21 14:41:22 2007 @@ -329,8 +329,8 @@ * recursive call. */ if (!WalkState || - !ObjDesc->Method.Mutex->Mutex.OwnerThread || - (WalkState->Thread != ObjDesc->Method.Mutex->Mutex.OwnerThread)) + !ObjDesc->Method.Mutex->Mutex.ThreadId || + (WalkState->Thread->ThreadId != ObjDesc->Method.Mutex->Mutex.ThreadId)) { /* * Acquire the method mutex. This releases the interpreter if we @@ -350,7 +350,7 @@ ObjDesc->Method.Mutex->Mutex.OriginalSyncLevel = WalkState->Thread->CurrentSyncLevel; - ObjDesc->Method.Mutex->Mutex.OwnerThread = WalkState->Thread; + ObjDesc->Method.Mutex->Mutex.ThreadId = WalkState->Thread->ThreadId; WalkState->Thread->CurrentSyncLevel = ObjDesc->Method.SyncLevel; } else @@ -651,7 +651,6 @@ ACPI_OPERAND_OBJECT *MethodDesc, ACPI_WALK_STATE *WalkState) { - ACPI_NAMESPACE_NODE *MethodNode; ACPI_STATUS Status; @@ -687,18 +686,12 @@ MethodDesc->Method.Mutex->Mutex.OriginalSyncLevel; AcpiOsReleaseMutex (MethodDesc->Method.Mutex->Mutex.OsMutex); - MethodDesc->Method.Mutex->Mutex.OwnerThread = NULL; + MethodDesc->Method.Mutex->Mutex.ThreadId = 0; } } if (WalkState) { - /* - * Delete any objects created by this method during execution. - * The method Node is stored in the walk state - */ - MethodNode = WalkState->MethodNode; - /* * Delete any namespace objects created anywhere within * the namespace by the execution of this method --- sys/contrib/dev/acpica/dsobject.c Wed Mar 21 17:35:30 2007 +++ sys/contrib/dev/acpica/dsobject.c Wed Mar 21 14:41:22 2007 @@ -393,6 +393,8 @@ ACPI_OPERAND_OBJECT *ObjDesc = NULL; ACPI_STATUS Status = AE_OK; ACPI_NATIVE_UINT i; + UINT16 Index; + UINT16 ReferenceCount; ACPI_FUNCTION_TRACE (DsBuildInternalPackageObj); @@ -462,6 +464,23 @@ Status = AcpiDsBuildInternalObject (WalkState, Arg, &ObjDesc->Package.Elements[i]); } + + if (*ObjDescPtr) + { + /* Existing package, get existing reference count */ + + ReferenceCount = (*ObjDescPtr)->Common.ReferenceCount; + if (ReferenceCount > 1) + { + /* Make new element ref count match original ref count */ + + for (Index = 0; Index < (ReferenceCount - 1); Index++) + { + AcpiUtAddReference ((ObjDesc->Package.Elements[i])); + } + } + } + Arg = Arg->Common.Next; } --- sys/contrib/dev/acpica/dsopcode.c Wed Mar 21 17:35:30 2007 +++ sys/contrib/dev/acpica/dsopcode.c Wed Mar 21 14:41:22 2007 @@ -947,6 +947,12 @@ /* The first operand (for all of these data objects) is the length */ + /* + * Set proper index into operand stack for AcpiDsObjStackPush + * invoked inside AcpiDsCreateOperand. + */ + WalkState->OperandIndex = WalkState->NumOperands; + Status = AcpiDsCreateOperand (WalkState, Op->Common.Value.Arg, 1); if (ACPI_FAILURE (Status)) { @@ -1217,8 +1223,7 @@ */ WalkState->ReturnDesc = WalkState->Operands[0]; } - else if ((WalkState->Results) && - (WalkState->Results->Results.NumResults > 0)) + else if (WalkState->ResultCount) { /* Since we have a real Return(), delete any implicit return */ --- sys/contrib/dev/acpica/dsutils.c Wed Mar 21 17:35:30 2007 +++ sys/contrib/dev/acpica/dsutils.c Wed Mar 21 14:41:22 2007 @@ -593,7 +593,8 @@ /* A valid name must be looked up in the namespace */ if ((Arg->Common.AmlOpcode == AML_INT_NAMEPATH_OP) && - (Arg->Common.Value.String)) + (Arg->Common.Value.String) && + !(Arg->Common.Flags & ACPI_PARSEOP_IN_STACK)) { ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Getting a name: Arg=%p\n", Arg)); @@ -715,7 +716,8 @@ { /* Check for null name case */ - if (Arg->Common.AmlOpcode == AML_INT_NAMEPATH_OP) + if ((Arg->Common.AmlOpcode == AML_INT_NAMEPATH_OP) && + !(Arg->Common.Flags & ACPI_PARSEOP_IN_STACK)) { /* * If the name is null, this means that this is an @@ -741,7 +743,7 @@ return_ACPI_STATUS (AE_NOT_IMPLEMENTED); } - if (OpInfo->Flags & AML_HAS_RETVAL) + 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")); @@ -753,7 +755,7 @@ * Use value that was already previously returned * by the evaluation of this argument */ - Status = AcpiDsResultPopFromBottom (&ObjDesc, WalkState); + Status = AcpiDsResultPop (&ObjDesc, WalkState); if (ACPI_FAILURE (Status)) { /* @@ -823,30 +825,59 @@ { ACPI_STATUS Status = AE_OK; ACPI_PARSE_OBJECT *Arg; - UINT32 ArgCount = 0; + ACPI_PARSE_OBJECT *Arguments[ACPI_OBJ_NUM_OPERANDS]; + UINT8 ArgCount = 0; + UINT8 Count = 0; + UINT8 Index = WalkState->NumOperands; + UINT8 i; ACPI_FUNCTION_TRACE_PTR (DsCreateOperands, FirstArg); - /* For all arguments in the list... */ + /* Get all arguments in the list */ Arg = FirstArg; while (Arg) { - Status = AcpiDsCreateOperand (WalkState, Arg, ArgCount); - if (ACPI_FAILURE (Status)) + if (Index >= ACPI_OBJ_NUM_OPERANDS) { - goto Cleanup; + return_ACPI_STATUS (AE_BAD_DATA); } - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%d (%p) done, Arg1=%p\n", - ArgCount, Arg, FirstArg)); + Arguments[Index] = Arg; + WalkState->Operands [Index] = NULL; /* Move on to next argument, if any */ Arg = Arg->Common.Next; ArgCount++; + Index++; + } + + Index--; + + /* It is the appropriate order to get objects from the Result stack */ + + for (i = 0; i < ArgCount; i++) + { + Arg = Arguments[Index]; + + /* Force the filling of the operand stack in inverse order */ + + WalkState->OperandIndex = Index; + + Status = AcpiDsCreateOperand (WalkState, Arg, Index); + if (ACPI_FAILURE (Status)) + { + goto Cleanup; + } + + Count++; + Index--; + + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%d (%p) done, Arg1=%p\n", + Index, Arg, FirstArg)); } return_ACPI_STATUS (Status); @@ -858,11 +889,122 @@ * pop everything off of the operand stack and delete those * objects */ - (void) AcpiDsObjStackPopAndDelete (ArgCount, WalkState); + AcpiDsObjStackPopAndDelete (ArgCount, WalkState); - ACPI_EXCEPTION ((AE_INFO, Status, "While creating Arg %d", - (ArgCount + 1))); + ACPI_EXCEPTION ((AE_INFO, Status, "While creating Arg %d", Index)); return_ACPI_STATUS (Status); } +/***************************************************************************** + * + * FUNCTION: AcpiDsEvaluateNamePath + * + * PARAMETERS: WalkState - Current state of the parse tree walk, + * the opcode of current operation should be + * AML_INT_NAMEPATH_OP + * + * RETURN: Status + * + * DESCRIPTION: Translate the -NamePath- parse tree object to the equivalent + * interpreter object, convert it to value, if needed, duplicate + * it, if needed, and push it onto the current result stack. + * + ****************************************************************************/ + +ACPI_STATUS +AcpiDsEvaluateNamePath ( + ACPI_WALK_STATE *WalkState) +{ + ACPI_STATUS Status = AE_OK; + ACPI_PARSE_OBJECT *Op = WalkState->Op; + ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; + ACPI_OPERAND_OBJECT *NewObjDesc; + UINT8 Type; + + + ACPI_FUNCTION_TRACE_PTR (DsEvaluateNamePath, WalkState); + + + if (!Op->Common.Parent) + { + /* This happens after certain exception processing */ + + goto Exit; + } + + if ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) || + (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP) || + (Op->Common.Parent->Common.AmlOpcode == AML_REF_OF_OP)) + { + /* TBD: Should we specify this feature as a bit of OpInfo->Flags of these opcodes? */ + + goto Exit; + } + + Status = AcpiDsCreateOperand (WalkState, Op, 0); + if (ACPI_FAILURE (Status)) + { + goto Exit; + } + + if (Op->Common.Flags & ACPI_PARSEOP_TARGET) + { + NewObjDesc = *Operand; + goto PushResult; + } + + Type = ACPI_GET_OBJECT_TYPE (*Operand); + + Status = AcpiExResolveToValue (Operand, WalkState); + if (ACPI_FAILURE (Status)) + { + goto Exit; + } + + if (Type == ACPI_TYPE_INTEGER) + { + /* It was incremented by AcpiExResolveToValue */ + + AcpiUtRemoveReference (*Operand); + + Status = AcpiUtCopyIobjectToIobject (*Operand, &NewObjDesc, WalkState); + if (ACPI_FAILURE (Status)) + { + goto Exit; + } + } + else + { + /* + * The object either was anew created or is + * a Namespace node - don't decrement it. + */ + NewObjDesc = *Operand; + } + + /* Cleanup for name-path operand */ + + Status = AcpiDsObjStackPop (1, WalkState); + if (ACPI_FAILURE (Status)) + { + WalkState->ResultObj = NewObjDesc; + goto Exit; + } + +PushResult: + + WalkState->ResultObj = NewObjDesc; + + Status = AcpiDsResultPush (WalkState->ResultObj, WalkState); + if (ACPI_SUCCESS (Status)) + { + /* Force to take it from stack */ + + Op->Common.Flags |= ACPI_PARSEOP_IN_STACK; + } + +Exit: + + return_ACPI_STATUS (Status); +} --- sys/contrib/dev/acpica/dswexec.c Wed Mar 21 17:35:30 2007 +++ sys/contrib/dev/acpica/dswexec.c Wed Mar 21 14:41:22 2007 @@ -383,12 +383,6 @@ { case AML_CLASS_CONTROL: - Status = AcpiDsResultStackPush (WalkState); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } - Status = AcpiDsExecBeginControlOp (WalkState, Op); break; @@ -406,23 +400,12 @@ Status = AcpiDsLoad2BeginOp (WalkState, NULL); } - if (Op->Common.AmlOpcode == AML_REGION_OP) - { - Status = AcpiDsResultStackPush (WalkState); - } break; case AML_CLASS_EXECUTE: case AML_CLASS_CREATE: - /* - * Most operators with arguments (except CreateXxxField operators) - * Start a new result/operand state - */ - if (WalkState->OpInfo->ObjectType != ACPI_TYPE_BUFFER_FIELD) - { - Status = AcpiDsResultStackPush (WalkState); - } + break; @@ -485,6 +468,7 @@ /* Init the walk state */ WalkState->NumOperands = 0; + WalkState->OperandIndex = 0; WalkState->ReturnDesc = NULL; WalkState->ResultObj = NULL; @@ -497,11 +481,20 @@ switch (OpClass) { - case AML_CLASS_ARGUMENT: /* constants, literals, etc. - do nothing */ + case AML_CLASS_ARGUMENT: /* Constants, literals, etc. */ + + if (WalkState->Opcode == AML_INT_NAMEPATH_OP) + { + Status = AcpiDsEvaluateNamePath (WalkState); + if (ACPI_FAILURE (Status)) + { + goto Cleanup; + } + } break; - case AML_CLASS_EXECUTE: /* most operators with arguments */ + case AML_CLASS_EXECUTE: /* Most operators with arguments */ /* Build resolved operand stack */ @@ -511,14 +504,6 @@ goto Cleanup; } - /* Done with this result state (Now that operand stack is built) */ - - Status = AcpiDsResultStackPop (WalkState); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - /* * All opcodes require operand resolution, with the only exceptions * being the ObjectType and SizeOf operators. @@ -598,20 +583,6 @@ Status = AcpiDsExecEndControlOp (WalkState, Op); - /* Make sure to properly pop the result stack */ - - if (ACPI_SUCCESS (Status)) - { - Status = AcpiDsResultStackPop (WalkState); - } - else if (Status == AE_CTRL_PENDING) - { - Status = AcpiDsResultStackPop (WalkState); - if (ACPI_SUCCESS (Status)) - { - Status = AE_CTRL_PENDING; - } - } break; @@ -738,14 +709,6 @@ break; } - /* Done with result state (Now that operand stack is built) */ - - Status = AcpiDsResultStackPop (WalkState); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - /* * If a result object was returned from above, push it on the * current result stack @@ -778,8 +741,6 @@ { break; } - - Status = AcpiDsResultStackPop (WalkState); } break; --- sys/contrib/dev/acpica/dswstate.c Wed Mar 21 17:35:30 2007 +++ sys/contrib/dev/acpica/dswstate.c Wed Mar 21 14:41:22 2007 @@ -127,261 +127,146 @@ /* Local prototypes */ -#ifdef ACPI_OBSOLETE_FUNCTIONS -ACPI_STATUS -AcpiDsResultInsert ( - void *Object, - UINT32 Index, - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiDsObjStackDeleteAll ( +static ACPI_STATUS +AcpiDsResultStackPush ( ACPI_WALK_STATE *WalkState); -ACPI_STATUS -AcpiDsObjStackPopObject ( - ACPI_OPERAND_OBJECT **Object, +static ACPI_STATUS +AcpiDsResultStackPop ( ACPI_WALK_STATE *WalkState); -void * -AcpiDsObjStackGetValue ( - UINT32 Index, - ACPI_WALK_STATE *WalkState); -#endif - /******************************************************************************* * - * FUNCTION: AcpiDsResultRemove + * FUNCTION: AcpiDsResultPop * * PARAMETERS: Object - Where to return the popped object - * Index - Where to extract the object * WalkState - Current Walk state * * RETURN: Status * - * DESCRIPTION: Pop an object off the bottom of this walk's result stack. In - * other words, this is a FIFO. + * DESCRIPTION: Pop an object off the top of this walk's result stack * ******************************************************************************/ ACPI_STATUS -AcpiDsResultRemove ( +AcpiDsResultPop ( ACPI_OPERAND_OBJECT **Object, - UINT32 Index, ACPI_WALK_STATE *WalkState) { + ACPI_NATIVE_UINT Index; ACPI_GENERIC_STATE *State; + ACPI_STATUS Status; - ACPI_FUNCTION_NAME (DsResultRemove); + ACPI_FUNCTION_NAME (DsResultPop); State = WalkState->Results; - if (!State) + + /* Incorrect state of result stack */ + + if (State && !WalkState->ResultCount) { - ACPI_ERROR ((AE_INFO, "No result object pushed! State=%p", - WalkState)); - return (AE_NOT_EXIST); + ACPI_ERROR ((AE_INFO, "No results on result stack")); + return (AE_AML_INTERNAL); } - if (Index >= ACPI_OBJ_MAX_OPERAND) + if (!State && WalkState->ResultCount) { - ACPI_ERROR ((AE_INFO, - "Index out of range: %X State=%p Num=%X", - Index, WalkState, State->Results.NumResults)); + ACPI_ERROR ((AE_INFO, "No result state for result stack")); + return (AE_AML_INTERNAL); } - /* Check for a valid result object */ + /* Empty result stack */ - if (!State->Results.ObjDesc [Index]) + if (!State) { - ACPI_ERROR ((AE_INFO, - "Null operand! State=%p #Ops=%X, Index=%X", - WalkState, State->Results.NumResults, Index)); + ACPI_ERROR ((AE_INFO, "Result stack is empty! State=%p", WalkState)); return (AE_AML_NO_RETURN_VALUE); } - /* Remove the object */ + /* Return object of the top element and clean that top element result stack */ - State->Results.NumResults--; + WalkState->ResultCount--; + Index = WalkState->ResultCount % ACPI_RESULTS_FRAME_OBJ_NUM; *Object = State->Results.ObjDesc [Index]; - State->Results.ObjDesc [Index] = NULL; - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Obj=%p [%s] Index=%X State=%p Num=%X\n", - *Object, (*Object) ? AcpiUtGetObjectTypeName (*Object) : "NULL", - Index, WalkState, State->Results.NumResults)); - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsResultPop - * - * PARAMETERS: Object - Where to return the popped object - * WalkState - Current Walk state - * - * RETURN: Status - * - * DESCRIPTION: Pop an object off the bottom of this walk's result stack. In - * other words, this is a FIFO. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsResultPop ( - ACPI_OPERAND_OBJECT **Object, - ACPI_WALK_STATE *WalkState) -{ - ACPI_NATIVE_UINT Index; - ACPI_GENERIC_STATE *State; - - - ACPI_FUNCTION_NAME (DsResultPop); - - - State = WalkState->Results; - if (!State) - { - return (AE_OK); - } - - if (!State->Results.NumResults) + if (!*Object) { - ACPI_ERROR ((AE_INFO, "Result stack is empty! State=%p", + ACPI_ERROR ((AE_INFO, "No result objects on result stack, State=%p", WalkState)); return (AE_AML_NO_RETURN_VALUE); } - /* Remove top element */ - - State->Results.NumResults--; - - for (Index = ACPI_OBJ_NUM_OPERANDS; Index; Index--) + State->Results.ObjDesc [Index] = NULL; + if (Index == 0) { - /* Check for a valid result object */ - - if (State->Results.ObjDesc [Index -1]) + Status = AcpiDsResultStackPop (WalkState); + if (ACPI_FAILURE (Status)) { - *Object = State->Results.ObjDesc [Index -1]; - State->Results.ObjDesc [Index -1] = NULL; - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Obj=%p [%s] Index=%X State=%p Num=%X\n", - *Object, - (*Object) ? AcpiUtGetObjectTypeName (*Object) : "NULL", - (UINT32) Index -1, WalkState, State->Results.NumResults)); - - return (AE_OK); + return (Status); } } - ACPI_ERROR ((AE_INFO, - "No result objects! State=%p", WalkState)); - return (AE_AML_NO_RETURN_VALUE); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Obj=%p [%s] Index=%X State=%p Num=%X\n", *Object, + AcpiUtGetObjectTypeName (*Object), + (UINT32) Index, WalkState, WalkState->ResultCount)); + + return (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiDsResultPopFromBottom + * FUNCTION: AcpiDsResultPush * * PARAMETERS: Object - Where to return the popped object * WalkState - Current Walk state * * RETURN: Status * - * DESCRIPTION: Pop an object off the bottom of this walk's result stack. In - * other words, this is a FIFO. + * DESCRIPTION: Push an object onto the current result stack * ******************************************************************************/ ACPI_STATUS -AcpiDsResultPopFromBottom ( - ACPI_OPERAND_OBJECT **Object, +AcpiDsResultPush ( + ACPI_OPERAND_OBJECT *Object, ACPI_WALK_STATE *WalkState) { - ACPI_NATIVE_UINT Index; ACPI_GENERIC_STATE *State; + ACPI_STATUS Status; + ACPI_NATIVE_UINT Index; - ACPI_FUNCTION_NAME (DsResultPopFromBottom); + ACPI_FUNCTION_NAME (DsResultPush); - State = WalkState->Results; - if (!State) + if (WalkState->ResultCount > WalkState->ResultSize) { - ACPI_ERROR ((AE_INFO, - "No result object pushed! State=%p", WalkState)); - return (AE_NOT_EXIST); + ACPI_ERROR ((AE_INFO, "Result stack is full")); + return (AE_AML_INTERNAL); } - - if (!State->Results.NumResults) + else if (WalkState->ResultCount == WalkState->ResultSize) { - ACPI_ERROR ((AE_INFO, "No result objects! State=%p", - WalkState)); - return (AE_AML_NO_RETURN_VALUE); - } - - /* Remove Bottom element */ - - *Object = State->Results.ObjDesc [0]; + /* Extend the result stack */ - /* Push entire stack down one element */ - - for (Index = 0; Index < State->Results.NumResults; Index++) - { - State->Results.ObjDesc [Index] = State->Results.ObjDesc [Index + 1]; + Status = AcpiDsResultStackPush (WalkState); + if (ACPI_FAILURE (Status)) + { + ACPI_ERROR ((AE_INFO, "Failed to extend the result stack")); + return (Status); + } } - State->Results.NumResults--; - - /* Check for a valid result object */ - - if (!*Object) + if (!(WalkState->ResultCount < WalkState->ResultSize)) { - ACPI_ERROR ((AE_INFO, - "Null operand! State=%p #Ops=%X Index=%X", - WalkState, State->Results.NumResults, (UINT32) Index)); - return (AE_AML_NO_RETURN_VALUE); + ACPI_ERROR ((AE_INFO, "No free elements in result stack")); + return (AE_AML_INTERNAL); } - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Results=%p State=%p\n", - *Object, (*Object) ? AcpiUtGetObjectTypeName (*Object) : "NULL", - State, WalkState)); - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsResultPush - * - * PARAMETERS: Object - Where to return the popped object - * WalkState - Current Walk state - * - * RETURN: Status - * - * DESCRIPTION: Push an object onto the current result stack - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsResultPush ( - ACPI_OPERAND_OBJECT *Object, - ACPI_WALK_STATE *WalkState) -{ - ACPI_GENERIC_STATE *State; - - - ACPI_FUNCTION_NAME (DsResultPush); - - State = WalkState->Results; if (!State) { @@ -389,28 +274,23 @@ return (AE_AML_INTERNAL); } - if (State->Results.NumResults == ACPI_OBJ_NUM_OPERANDS) - { - ACPI_ERROR ((AE_INFO, - "Result stack overflow: Obj=%p State=%p Num=%X", - Object, WalkState, State->Results.NumResults)); - return (AE_STACK_OVERFLOW); - } - if (!Object) { ACPI_ERROR ((AE_INFO, "Null Object! Obj=%p State=%p Num=%X", - Object, WalkState, State->Results.NumResults)); + Object, WalkState, WalkState->ResultCount)); return (AE_BAD_PARAMETER); } - State->Results.ObjDesc [State->Results.NumResults] = Object; - State->Results.NumResults++; + /* Assign the address of object to the top free element of result stack */ + + Index = WalkState->ResultCount % ACPI_RESULTS_FRAME_OBJ_NUM; + State->Results.ObjDesc [Index] = Object; + WalkState->ResultCount++; ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p Num=%X Cur=%X\n", - Object, Object ? AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object) : "NULL", - WalkState, State->Results.NumResults, WalkState->CurrentResult)); + Object, AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object), + WalkState, WalkState->ResultCount, WalkState->CurrentResult)); return (AE_OK); } @@ -424,19 +304,30 @@ * * RETURN: Status * - * DESCRIPTION: Push an object onto the WalkState result stack. + * DESCRIPTION: Push an object onto the WalkState result stack * ******************************************************************************/ -ACPI_STATUS +static ACPI_STATUS AcpiDsResultStackPush ( ACPI_WALK_STATE *WalkState) { ACPI_GENERIC_STATE *State; + ACPI_FUNCTION_NAME (DsResultStackPush); + /* Check for stack overflow */ + + if ((WalkState->ResultSize + ACPI_RESULTS_FRAME_OBJ_NUM) > + ACPI_RESULTS_OBJ_NUM_MAX) + { + ACPI_ERROR ((AE_INFO, "Result stack overflow: State=%p Num=%X", + WalkState, WalkState->ResultSize)); + return (AE_STACK_OVERFLOW); + } + State = AcpiUtCreateGenericState (); if (!State) { @@ -446,6 +337,10 @@ State->Common.DescriptorType = ACPI_DESC_TYPE_STATE_RESULT; AcpiUtPushGenericState (&WalkState->Results, State); + /* Increase the length of the result stack by the length of frame */ + + WalkState->ResultSize += ACPI_RESULTS_FRAME_OBJ_NUM; + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Results=%p State=%p\n", State, WalkState)); @@ -461,16 +356,17 @@ * * RETURN: Status * - * DESCRIPTION: Pop an object off of the WalkState result stack. + * DESCRIPTION: Pop an object off of the WalkState result stack * ******************************************************************************/ -ACPI_STATUS +static ACPI_STATUS AcpiDsResultStackPop ( ACPI_WALK_STATE *WalkState) { ACPI_GENERIC_STATE *State; + ACPI_FUNCTION_NAME (DsResultStackPop); @@ -478,18 +374,27 @@ if (WalkState->Results == NULL) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Underflow - State=%p\n", + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Result stack underflow - State=%p\n", WalkState)); return (AE_AML_NO_OPERAND); } + if (WalkState->ResultSize < ACPI_RESULTS_FRAME_OBJ_NUM) + { + ACPI_ERROR ((AE_INFO, "Insufficient result stack size")); + return (AE_AML_INTERNAL); + } + State = AcpiUtPopGenericState (&WalkState->Results); + AcpiUtDeleteGenericState (State); + + /* Decrease the length of result stack by the length of frame */ + + WalkState->ResultSize -= ACPI_RESULTS_FRAME_OBJ_NUM; ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Result=%p RemainingResults=%X State=%p\n", - State, State->Results.NumResults, WalkState)); - - AcpiUtDeleteGenericState (State); + State, WalkState->ResultCount, WalkState)); return (AE_OK); } @@ -528,12 +433,16 @@ /* Put the object onto the stack */ - WalkState->Operands [WalkState->NumOperands] = Object; + WalkState->Operands [WalkState->OperandIndex] = Object; WalkState->NumOperands++; + /* For the usual order of filling the operand stack */ + + WalkState->OperandIndex++; + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n", - Object, AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object), - WalkState, WalkState->NumOperands)); + Object, AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object), + WalkState, WalkState->NumOperands)); return (AE_OK); } @@ -560,6 +469,7 @@ { UINT32 i; + ACPI_FUNCTION_NAME (DsObjStackPop); @@ -582,7 +492,7 @@ } ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n", - PopCount, WalkState, WalkState->NumOperands)); + PopCount, WalkState, WalkState->NumOperands)); return (AE_OK); } @@ -602,7 +512,7 @@ * ******************************************************************************/ -ACPI_STATUS +void AcpiDsObjStackPopAndDelete ( UINT32 PopCount, ACPI_WALK_STATE *WalkState) @@ -614,33 +524,31 @@ ACPI_FUNCTION_NAME (DsObjStackPopAndDelete); - for (i = 0; i < PopCount; i++) + if (PopCount == 0) { - /* Check for stack underflow */ + return; + } + for (i = (PopCount - 1); i >= 0; i--) + { if (WalkState->NumOperands == 0) { - ACPI_ERROR ((AE_INFO, - "Object stack underflow! Count=%X State=%p #Ops=%X", - PopCount, WalkState, WalkState->NumOperands)); - return (AE_STACK_UNDERFLOW); + return; } /* Pop the stack and delete an object if present in this stack entry */ WalkState->NumOperands--; - ObjDesc = WalkState->Operands [WalkState->NumOperands]; + ObjDesc = WalkState->Operands [i]; if (ObjDesc) { - AcpiUtRemoveReference (WalkState->Operands [WalkState->NumOperands]); - WalkState->Operands [WalkState->NumOperands] = NULL; + AcpiUtRemoveReference (WalkState->Operands [i]); + WalkState->Operands [i] = NULL; } } ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n", - PopCount, WalkState, WalkState->NumOperands)); - - return (AE_OK); + PopCount, WalkState, WalkState->NumOperands)); } @@ -660,7 +568,6 @@ ACPI_WALK_STATE * AcpiDsGetCurrentWalkState ( ACPI_THREAD_STATE *Thread) - { ACPI_FUNCTION_NAME (DsGetCurrentWalkState); @@ -686,7 +593,7 @@ * * RETURN: None * - * DESCRIPTION: Place the Thread state at the head of the state list. + * DESCRIPTION: Place the Thread state at the head of the state list * ******************************************************************************/ @@ -698,7 +605,7 @@ ACPI_FUNCTION_TRACE (DsPushWalkState); - WalkState->Next = Thread->WalkStateList; + WalkState->Next = Thread->WalkStateList; Thread->WalkStateList = WalkState; return_VOID; @@ -772,7 +679,6 @@ ACPI_THREAD_STATE *Thread) { ACPI_WALK_STATE *WalkState; - ACPI_STATUS Status; ACPI_FUNCTION_TRACE (DsCreateWalkState); @@ -798,15 +704,6 @@ AcpiDsMethodDataInit (WalkState); #endif - /* Create an initial result stack entry */ - - Status = AcpiDsResultStackPush (WalkState); - if (ACPI_FAILURE (Status)) - { - ACPI_FREE (WalkState); - return_PTR (NULL); - } - /* Put the new state at the head of the walk list */ if (Thread) @@ -1025,211 +922,5 @@ ACPI_FREE (WalkState); return_VOID; } - - -#ifdef ACPI_OBSOLETE_FUNCTIONS -/******************************************************************************* - * - * FUNCTION: AcpiDsResultInsert - * - * PARAMETERS: Object - Object to push - * Index - Where to insert the object - * WalkState - Current Walk state - * - * RETURN: Status - * - * DESCRIPTION: Insert an object onto this walk's result stack - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsResultInsert ( - void *Object, - UINT32 Index, - ACPI_WALK_STATE *WalkState) -{ - ACPI_GENERIC_STATE *State; - - - ACPI_FUNCTION_NAME (DsResultInsert); - - - State = WalkState->Results; - if (!State) - { - ACPI_ERROR ((AE_INFO, "No result object pushed! State=%p", - WalkState)); - return (AE_NOT_EXIST); - } - - if (Index >= ACPI_OBJ_NUM_OPERANDS) - { - ACPI_ERROR ((AE_INFO, - "Index out of range: %X Obj=%p State=%p Num=%X", - Index, Object, WalkState, State->Results.NumResults)); - return (AE_BAD_PARAMETER); - } - - if (!Object) - { - ACPI_ERROR ((AE_INFO, - "Null Object! Index=%X Obj=%p State=%p Num=%X", - Index, Object, WalkState, State->Results.NumResults)); - return (AE_BAD_PARAMETER); - } - - State->Results.ObjDesc [Index] = Object; - State->Results.NumResults++; - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Obj=%p [%s] State=%p Num=%X Cur=%X\n", - Object, Object ? AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object) : "NULL", - WalkState, State->Results.NumResults, WalkState->CurrentResult)); - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsObjStackDeleteAll - * - * PARAMETERS: WalkState - Current Walk state - * - * RETURN: Status - * - * DESCRIPTION: Clear the object stack by deleting all objects that are on it. - * Should be used with great care, if at all! - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsObjStackDeleteAll ( - ACPI_WALK_STATE *WalkState) -{ - UINT32 i; - - - ACPI_FUNCTION_TRACE_PTR (DsObjStackDeleteAll, WalkState); - - - /* The stack size is configurable, but fixed */ - - for (i = 0; i < ACPI_OBJ_NUM_OPERANDS; i++) - { - if (WalkState->Operands[i]) - { - AcpiUtRemoveReference (WalkState->Operands[i]); - WalkState->Operands[i] = NULL; - } - } - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsObjStackPopObject - * - * PARAMETERS: Object - Where to return the popped object - * WalkState - Current Walk state - * - * RETURN: Status - * - * DESCRIPTION: Pop this walk's object stack. Objects on the stack are NOT - * deleted by this routine. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiDsObjStackPopObject ( - ACPI_OPERAND_OBJECT **Object, - ACPI_WALK_STATE *WalkState) -{ - ACPI_FUNCTION_NAME (DsObjStackPopObject); - - - /* Check for stack underflow */ - - if (WalkState->NumOperands == 0) - { - ACPI_ERROR ((AE_INFO, - "Missing operand/stack empty! State=%p #Ops=%X", - WalkState, WalkState->NumOperands)); - *Object = NULL; - return (AE_AML_NO_OPERAND); - } - - /* Pop the stack */ - - WalkState->NumOperands--; - - /* Check for a valid operand */ - - if (!WalkState->Operands [WalkState->NumOperands]) - { - ACPI_ERROR ((AE_INFO, - "Null operand! State=%p #Ops=%X", - WalkState, WalkState->NumOperands)); - *Object = NULL; - return (AE_AML_NO_OPERAND); - } - - /* Get operand and set stack entry to null */ - - *Object = WalkState->Operands [WalkState->NumOperands]; - WalkState->Operands [WalkState->NumOperands] = NULL; - - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n", - *Object, AcpiUtGetObjectTypeName (*Object), - WalkState, WalkState->NumOperands)); - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsObjStackGetValue - * - * PARAMETERS: Index - Stack index whose value is desired. Based - * on the top of the stack (index=0 == top) - * WalkState - Current Walk state - * - * RETURN: Pointer to the requested operand - * - * DESCRIPTION: Retrieve an object from this walk's operand stack. Index must - * be within the range of the current stack pointer. - * - ******************************************************************************/ - -void * -AcpiDsObjStackGetValue ( - UINT32 Index, - ACPI_WALK_STATE *WalkState) -{ - - ACPI_FUNCTION_TRACE_PTR (DsObjStackGetValue, WalkState); - - - /* Can't do it if the stack is empty */ - - if (WalkState->NumOperands == 0) - { - return_PTR (NULL); - } - - /* or if the index is past the top of the stack */ - - if (Index > (WalkState->NumOperands - (UINT32) 1)) - { - return_PTR (NULL); - } - - return_PTR (WalkState->Operands[(ACPI_NATIVE_UINT)(WalkState->NumOperands - 1) - - Index]); -} -#endif --- sys/contrib/dev/acpica/evmisc.c Wed Mar 21 17:35:30 2007 +++ sys/contrib/dev/acpica/evmisc.c Wed Mar 21 14:41:22 2007 @@ -559,7 +559,8 @@ * Only one thread can acquire the GL at a time, the GlobalLockMutex * enforces this. This interface releases the interpreter if we must wait. */ - Status = AcpiExSystemWaitMutex (AcpiGbl_GlobalLockMutex, Timeout); + Status = AcpiExSystemWaitMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex, + Timeout); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -660,7 +661,7 @@ /* Release the local GL mutex */ - AcpiOsReleaseMutex (AcpiGbl_GlobalLockMutex); + AcpiOsReleaseMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex); return_ACPI_STATUS (Status); } --- sys/contrib/dev/acpica/evxface.c Wed Mar 21 17:35:30 2007 +++ sys/contrib/dev/acpica/evxface.c Wed Mar 21 14:41:22 2007 @@ -891,6 +891,12 @@ * * DESCRIPTION: Acquire the ACPI Global Lock * + * Note: Allows callers with the same thread ID to acquire the global lock + * multiple times. In other words, externally, the behavior of the global lock + * is identical to an AML mutex. On the first acquire, a new handle is + * returned. On any subsequent calls to acquire by the same thread, the same + * handle is returned. + * ******************************************************************************/ ACPI_STATUS @@ -909,15 +915,27 @@ /* Must lock interpreter to prevent race conditions */ AcpiExEnterInterpreter (); - Status = AcpiEvAcquireGlobalLock (Timeout); - AcpiExExitInterpreter (); + + Status = AcpiExAcquireMutexObject (Timeout, + AcpiGbl_GlobalLockMutex, AcpiOsGetThreadId ()); if (ACPI_SUCCESS (Status)) { - AcpiGbl_GlobalLockHandle++; + /* + * If this was the first acquisition of the Global Lock by this thread, + * create a new handle. Otherwise, return the existing handle. + */ + if (AcpiGbl_GlobalLockMutex->Mutex.AcquisitionDepth == 1) + { + AcpiGbl_GlobalLockHandle++; + } + + /* Return the global lock handle */ + *Handle = AcpiGbl_GlobalLockHandle; } + AcpiExExitInterpreter (); return (Status); } @@ -943,12 +961,12 @@ ACPI_STATUS Status; - if (Handle != AcpiGbl_GlobalLockHandle) + if (!Handle || (Handle != AcpiGbl_GlobalLockHandle)) { return (AE_NOT_ACQUIRED); } - Status = AcpiEvReleaseGlobalLock (); + Status = AcpiExReleaseMutexObject (AcpiGbl_GlobalLockMutex); return (Status); } --- sys/contrib/dev/acpica/exdump.c Wed Mar 21 17:35:30 2007 +++ sys/contrib/dev/acpica/exdump.c Wed Mar 21 14:41:22 2007 @@ -601,14 +601,6 @@ break; - case AML_NAME_OP: - - ACPI_DUMP_PATHNAME (ObjDesc->Reference.Object, - "Reference: Name: ", ACPI_LV_INFO, _COMPONENT); - ACPI_DUMP_ENTRY (ObjDesc->Reference.Object, ACPI_LV_INFO); - break; - - case AML_INDEX_OP: AcpiOsPrintf ("Reference: Index %p\n", --- sys/contrib/dev/acpica/exfield.c Wed Mar 21 17:35:30 2007 +++ sys/contrib/dev/acpica/exfield.c Wed Mar 21 14:41:22 2007 @@ -151,7 +151,6 @@ ACPI_OPERAND_OBJECT *BufferDesc; ACPI_SIZE Length; void *Buffer; - BOOLEAN Locked; ACPI_FUNCTION_TRACE_PTR (ExReadDataFromField, ObjDesc); @@ -198,7 +197,7 @@ /* Lock entire transaction if requested */ - Locked = AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); + AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); /* * Perform the read. @@ -207,7 +206,7 @@ Status = AcpiExAccessRegion (ObjDesc, 0, ACPI_CAST_PTR (ACPI_INTEGER, BufferDesc->Buffer.Pointer), ACPI_READ | (ObjDesc->Field.Attribute << 16)); - AcpiExReleaseGlobalLock (Locked); + AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); goto Exit; } @@ -259,12 +258,12 @@ /* Lock entire transaction if requested */ - Locked = AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); + AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); /* Read from the field */ Status = AcpiExExtractFromField (ObjDesc, Buffer, (UINT32) Length); - AcpiExReleaseGlobalLock (Locked); + AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); Exit: @@ -306,7 +305,6 @@ UINT32 RequiredLength; void *Buffer; void *NewBuffer; - BOOLEAN Locked; ACPI_OPERAND_OBJECT *BufferDesc; @@ -373,7 +371,7 @@ /* Lock entire transaction if requested */ - Locked = AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); + AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); /* * Perform the write (returns status and perhaps data in the @@ -383,7 +381,7 @@ Status = AcpiExAccessRegion (ObjDesc, 0, (ACPI_INTEGER *) Buffer, ACPI_WRITE | (ObjDesc->Field.Attribute << 16)); - AcpiExReleaseGlobalLock (Locked); + AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); *ResultDesc = BufferDesc; return_ACPI_STATUS (Status); @@ -457,12 +455,12 @@ /* Lock entire transaction if requested */ - Locked = AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); + AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); /* Write to the field */ Status = AcpiExInsertIntoField (ObjDesc, Buffer, Length); - AcpiExReleaseGlobalLock (Locked); + AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); /* Free temporary buffer if we used one */ --- sys/contrib/dev/acpica/exmutex.c Wed Mar 21 17:35:30 2007 +++ sys/contrib/dev/acpica/exmutex.c Wed Mar 21 14:41:22 2007 @@ -217,6 +217,88 @@ /******************************************************************************* * + * FUNCTION: AcpiExAcquireMutexObject + * + * PARAMETERS: TimeDesc - Timeout in milliseconds + * ObjDesc - Mutex object + * Thread - Current thread state + * + * RETURN: Status + * + * DESCRIPTION: Acquire an AML mutex, low-level interface. Provides a common + * path that supports multiple acquires by the same thread. + * + * MUTEX: Interpreter must be locked + * + * NOTE: This interface is called from three places: + * 1) From AcpiExAcquireMutex, via an AML Acquire() operator + * 2) From AcpiExAcquireGlobalLock when an AML Field access requires the + * global lock + * 3) From the external interface, AcpiAcquireGlobalLock + * + ******************************************************************************/ + +ACPI_STATUS +AcpiExAcquireMutexObject ( + UINT16 Timeout, + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_THREAD_ID ThreadId) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE_PTR (ExAcquireMutexObject, ObjDesc); + + + if (!ObjDesc) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + /* Support for multiple acquires by the owning thread */ + + if (ObjDesc->Mutex.ThreadId == ThreadId) + { + /* + * The mutex is already owned by this thread, just increment the + * acquisition depth + */ + ObjDesc->Mutex.AcquisitionDepth++; + return_ACPI_STATUS (AE_OK); + } + + /* Acquire the mutex, wait if necessary. Special case for Global Lock */ + + if (ObjDesc == AcpiGbl_GlobalLockMutex) + { + Status = AcpiEvAcquireGlobalLock (Timeout); + } + else + { + Status = AcpiExSystemWaitMutex (ObjDesc->Mutex.OsMutex, + Timeout); + } + + if (ACPI_FAILURE (Status)) + { + /* Includes failure from a timeout on TimeDesc */ + + return_ACPI_STATUS (Status); + } + + /* Acquired the mutex: update mutex object */ + + ObjDesc->Mutex.ThreadId = ThreadId; + ObjDesc->Mutex.AcquisitionDepth = 1; + ObjDesc->Mutex.OriginalSyncLevel = 0; + ObjDesc->Mutex.OwnerThread = NULL; /* Used only for AML Acquire() */ + + return_ACPI_STATUS (AE_OK); +} + + +/******************************************************************************* + * * FUNCTION: AcpiExAcquireMutex * * PARAMETERS: TimeDesc - Timeout integer @@ -246,7 +328,7 @@ return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* Sanity check: we must have a valid thread ID */ + /* Must have a valid thread ID */ if (!WalkState->Thread) { @@ -256,7 +338,7 @@ } /* - * Current Sync must be less than or equal to the sync level of the + * Current sync level must be less than or equal to the sync level of the * mutex. This mechanism provides some deadlock prevention */ if (WalkState->Thread->CurrentSyncLevel > ObjDesc->Mutex.SyncLevel) @@ -268,53 +350,95 @@ return_ACPI_STATUS (AE_AML_MUTEX_ORDER); } - /* Support for multiple acquires by the owning thread */ - - if (ObjDesc->Mutex.OwnerThread) + Status = AcpiExAcquireMutexObject ((UINT16) TimeDesc->Integer.Value, + ObjDesc, WalkState->Thread->ThreadId); + if (ACPI_SUCCESS (Status) && ObjDesc->Mutex.AcquisitionDepth == 1) { - if (ObjDesc->Mutex.OwnerThread->ThreadId == - WalkState->Thread->ThreadId) - { - /* - * The mutex is already owned by this thread, just increment the - * acquisition depth - */ - ObjDesc->Mutex.AcquisitionDepth++; - return_ACPI_STATUS (AE_OK); - } + /* Save Thread object, original/current sync levels */ + + ObjDesc->Mutex.OwnerThread = WalkState->Thread; + ObjDesc->Mutex.OriginalSyncLevel = WalkState->Thread->CurrentSyncLevel; + WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.SyncLevel; + + /* Link the mutex to the current thread for force-unlock at method exit */ + + AcpiExLinkMutex (ObjDesc, WalkState->Thread); } - /* Acquire the mutex, wait if necessary. Special case for Global Lock */ + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiExReleaseMutexObject + * + * PARAMETERS: ObjDesc - The object descriptor for this op + * + * RETURN: Status + * + * DESCRIPTION: Release a previously acquired Mutex, low level interface. + * Provides a common path that supports multiple releases (after + * previous multiple acquires) by the same thread. + * + * MUTEX: Interpreter must be locked + * + * NOTE: This interface is called from three places: + * 1) From AcpiExReleaseMutex, via an AML Acquire() operator + * 2) From AcpiExReleaseGlobalLock when an AML Field access requires the + * global lock + * 3) From the external interface, AcpiReleaseGlobalLock + * + ******************************************************************************/ + +ACPI_STATUS +AcpiExReleaseMutexObject ( + ACPI_OPERAND_OBJECT *ObjDesc) +{ + ACPI_STATUS Status = AE_OK; + + + ACPI_FUNCTION_TRACE (ExReleaseMutexObject); - if (ObjDesc->Mutex.OsMutex == AcpiGbl_GlobalLockMutex) + + if (ObjDesc->Mutex.AcquisitionDepth == 0) { - Status = AcpiEvAcquireGlobalLock ((UINT16) TimeDesc->Integer.Value); + return (AE_NOT_ACQUIRED); } - else + + /* Match multiple Acquires with multiple Releases */ + + ObjDesc->Mutex.AcquisitionDepth--; + if (ObjDesc->Mutex.AcquisitionDepth != 0) { - Status = AcpiExSystemWaitMutex (ObjDesc->Mutex.OsMutex, - (UINT16) TimeDesc->Integer.Value); + /* Just decrement the depth and return */ + + return_ACPI_STATUS (AE_OK); } - if (ACPI_FAILURE (Status)) + if (ObjDesc->Mutex.OwnerThread) { - /* Includes failure from a timeout on TimeDesc */ + /* Unlink the mutex from the owner's list */ - return_ACPI_STATUS (Status); + AcpiExUnlinkMutex (ObjDesc); + ObjDesc->Mutex.OwnerThread = NULL; } - /* Have the mutex: update mutex and walk info and save the SyncLevel */ - - ObjDesc->Mutex.OwnerThread = WalkState->Thread; - ObjDesc->Mutex.AcquisitionDepth = 1; - ObjDesc->Mutex.OriginalSyncLevel = WalkState->Thread->CurrentSyncLevel; + /* Release the mutex, special case for Global Lock */ - WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.SyncLevel; + if (ObjDesc == AcpiGbl_GlobalLockMutex) + { + Status = AcpiEvReleaseGlobalLock (); + } + else + { + AcpiOsReleaseMutex (ObjDesc->Mutex.OsMutex); + } - /* Link the mutex to the current thread for force-unlock at method exit */ + /* Clear mutex info */ - AcpiExLinkMutex (ObjDesc, WalkState->Thread); - return_ACPI_STATUS (AE_OK); + ObjDesc->Mutex.ThreadId = 0; + return_ACPI_STATUS (Status); } @@ -356,21 +480,12 @@ return_ACPI_STATUS (AE_AML_MUTEX_NOT_ACQUIRED); } - /* Sanity check: we must have a valid thread ID */ - - if (!WalkState->Thread) - { - ACPI_ERROR ((AE_INFO, "Cannot release Mutex [%4.4s], null thread info", - AcpiUtGetNodeName (ObjDesc->Mutex.Node))); - return_ACPI_STATUS (AE_AML_INTERNAL); - } - /* * The Mutex is owned, but this thread must be the owner. * Special case for Global Lock, any thread can release */ if ((ObjDesc->Mutex.OwnerThread->ThreadId != WalkState->Thread->ThreadId) && - (ObjDesc->Mutex.OsMutex != AcpiGbl_GlobalLockMutex)) + (ObjDesc != AcpiGbl_GlobalLockMutex)) { ACPI_ERROR ((AE_INFO, "Thread %X cannot release Mutex [%4.4s] acquired by thread %X", @@ -380,6 +495,15 @@ return_ACPI_STATUS (AE_AML_NOT_OWNER); } + /* Must have a valid thread ID */ + + if (!WalkState->Thread) + { + ACPI_ERROR ((AE_INFO, "Cannot release Mutex [%4.4s], null thread info", + AcpiUtGetNodeName (ObjDesc->Mutex.Node))); + return_ACPI_STATUS (AE_AML_INTERNAL); + } + /* * The sync level of the mutex must be less than or equal to the current * sync level @@ -387,41 +511,20 @@ if (ObjDesc->Mutex.SyncLevel > WalkState->Thread->CurrentSyncLevel) { ACPI_ERROR ((AE_INFO, - "Cannot release Mutex [%4.4s], incorrect SyncLevel", - AcpiUtGetNodeName (ObjDesc->Mutex.Node))); + "Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %d current %d", + AcpiUtGetNodeName (ObjDesc->Mutex.Node), + ObjDesc->Mutex.SyncLevel, WalkState->Thread->CurrentSyncLevel)); return_ACPI_STATUS (AE_AML_MUTEX_ORDER); } - /* Match multiple Acquires with multiple Releases */ + Status = AcpiExReleaseMutexObject (ObjDesc); - ObjDesc->Mutex.AcquisitionDepth--; - if (ObjDesc->Mutex.AcquisitionDepth != 0) + if (ObjDesc->Mutex.AcquisitionDepth == 0) { - /* Just decrement the depth and return */ - - return_ACPI_STATUS (AE_OK); - } - - /* Unlink the mutex from the owner's list */ - - AcpiExUnlinkMutex (ObjDesc); - - /* Release the mutex, special case for Global Lock */ + /* Restore the original SyncLevel */ - if (ObjDesc->Mutex.OsMutex == AcpiGbl_GlobalLockMutex) - { - Status = AcpiEvReleaseGlobalLock (); + WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.OriginalSyncLevel; } - else - { - AcpiOsReleaseMutex (ObjDesc->Mutex.OsMutex); - } - - /* Update the mutex and restore SyncLevel */ - - ObjDesc->Mutex.OwnerThread = NULL; - WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.OriginalSyncLevel; - return_ACPI_STATUS (Status); } @@ -468,7 +571,7 @@ /* Release the mutex, special case for Global Lock */ - if (ObjDesc->Mutex.OsMutex == AcpiGbl_GlobalLockMutex) + if (ObjDesc == AcpiGbl_GlobalLockMutex) { /* Ignore errors */ @@ -482,6 +585,7 @@ /* Mark mutex unowned */ ObjDesc->Mutex.OwnerThread = NULL; + ObjDesc->Mutex.ThreadId = 0; /* Update Thread SyncLevel (Last mutex is the important one) */ --- sys/contrib/dev/acpica/exoparg1.c Wed Mar 21 17:35:30 2007 +++ sys/contrib/dev/acpica/exoparg1.c Wed Mar 21 14:41:22 2007 @@ -207,6 +207,7 @@ if ((ACPI_FAILURE (Status)) || WalkState->ResultObj) { AcpiUtRemoveReference (ReturnDesc); + WalkState->ResultObj = NULL; } else { --- sys/contrib/dev/acpica/exoparg2.c Wed Mar 21 17:35:30 2007 +++ sys/contrib/dev/acpica/exoparg2.c Wed Mar 21 14:41:22 2007 @@ -339,11 +339,6 @@ goto Cleanup; } - /* Return the remainder */ - - WalkState->ResultObj = ReturnDesc1; - - Cleanup: /* * Since the remainder is not returned indirectly, remove a reference to @@ -358,6 +353,13 @@ AcpiUtRemoveReference (ReturnDesc1); } + /* Save return object (the remainder) on success */ + + else + { + WalkState->ResultObj = ReturnDesc1; + } + return_ACPI_STATUS (Status); } @@ -612,6 +614,7 @@ if (ACPI_FAILURE (Status)) { AcpiUtRemoveReference (ReturnDesc); + WalkState->ResultObj = NULL; } return_ACPI_STATUS (Status); @@ -716,9 +719,6 @@ ReturnDesc->Integer.Value = ACPI_INTEGER_MAX; } - WalkState->ResultObj = ReturnDesc; - - Cleanup: /* Delete return object on error */ @@ -726,6 +726,13 @@ if (ACPI_FAILURE (Status)) { AcpiUtRemoveReference (ReturnDesc); + } + + /* Save return object on success */ + + else + { + WalkState->ResultObj = ReturnDesc; } return_ACPI_STATUS (Status); --- sys/contrib/dev/acpica/exoparg3.c Wed Mar 21 17:35:30 2007 +++ sys/contrib/dev/acpica/exoparg3.c Wed Mar 21 14:41:22 2007 @@ -362,6 +362,7 @@ if (ACPI_FAILURE (Status) || WalkState->ResultObj) { AcpiUtRemoveReference (ReturnDesc); + WalkState->ResultObj = NULL; } /* Set the return object and exit */ --- sys/contrib/dev/acpica/exoparg6.c Wed Mar 21 17:35:30 2007 +++ sys/contrib/dev/acpica/exoparg6.c Wed Mar 21 14:41:22 2007 @@ -420,8 +420,6 @@ goto Cleanup; } - WalkState->ResultObj = ReturnDesc; - Cleanup: @@ -430,6 +428,13 @@ if (ACPI_FAILURE (Status)) { AcpiUtRemoveReference (ReturnDesc); + } + + /* Save return object on success */ + + else + { + WalkState->ResultObj = ReturnDesc; } return_ACPI_STATUS (Status); --- sys/contrib/dev/acpica/exresolv.c Wed Mar 21 17:35:30 2007 +++ sys/contrib/dev/acpica/exresolv.c Wed Mar 21 14:41:22 2007 @@ -229,7 +229,6 @@ { ACPI_STATUS Status = AE_OK; ACPI_OPERAND_OBJECT *StackDesc; - void *TempNode; ACPI_OPERAND_OBJECT *ObjDesc = NULL; UINT16 Opcode; @@ -249,24 +248,6 @@ switch (Opcode) { - case AML_NAME_OP: - - /* - * Convert name reference to a namespace node - * Then, AcpiExResolveNodeToValue can be used to get the value - */ - TempNode = StackDesc->Reference.Object; - - /* Delete the Reference Object */ - - AcpiUtRemoveReference (StackDesc); - - /* Return the namespace node */ - - (*StackPtr) = TempNode; - break; - - case AML_LOCAL_OP: case AML_ARG_OP: --- sys/contrib/dev/acpica/exresop.c Wed Mar 21 17:35:30 2007 +++ sys/contrib/dev/acpica/exresop.c Wed Mar 21 14:41:22 2007 @@ -224,7 +224,6 @@ ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STATUS Status = AE_OK; UINT8 ObjectType; - void *TempNode; UINT32 ArgTypes; const ACPI_OPCODE_INFO *OpInfo; UINT32 ThisArgType; @@ -333,7 +332,6 @@ /*lint -fallthrough */ - case AML_NAME_OP: case AML_INDEX_OP: case AML_REF_OF_OP: case AML_ARG_OP: @@ -419,15 +417,6 @@ if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); - } - - if (ObjDesc->Reference.Opcode == AML_NAME_OP) - { - /* Convert a named reference to the actual named object */ - - TempNode = ObjDesc->Reference.Object; - AcpiUtRemoveReference (ObjDesc); - (*StackPtr) = TempNode; } goto NextOperand; --- sys/contrib/dev/acpica/exstore.c Wed Mar 21 17:35:30 2007 +++ sys/contrib/dev/acpica/exstore.c Wed Mar 21 14:41:22 2007 @@ -233,7 +233,7 @@ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]\n", (UINT32) SourceDesc->Buffer.Length)); ACPI_DUMP_BUFFER (SourceDesc->Buffer.Pointer, - (SourceDesc->Buffer.Length < 32) ? SourceDesc->Buffer.Length : 32); + (SourceDesc->Buffer.Length < 256) ? SourceDesc->Buffer.Length : 256); break; case ACPI_TYPE_STRING: @@ -404,7 +404,6 @@ */ switch (RefDesc->Reference.Opcode) { - case AML_NAME_OP: case AML_REF_OF_OP: /* Storing an object into a Name "container" */ --- sys/contrib/dev/acpica/exutils.c Wed Mar 21 17:35:30 2007 +++ sys/contrib/dev/acpica/exutils.c Wed Mar 21 14:41:22 2007 @@ -320,9 +320,10 @@ /* * Object must be a valid number and we must be executing - * a control method + * a control method. NS node could be there for AML_INT_NAMEPATH_OP. */ if ((!ObjDesc) || + (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) || (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_INTEGER)) { return; @@ -346,44 +347,42 @@ * PARAMETERS: FieldFlags - Flags with Lock rule: * AlwaysLock or NeverLock * - * RETURN: TRUE/FALSE indicating whether the lock was actually acquired + * RETURN: None * - * DESCRIPTION: Obtain the global lock and keep track of this fact via two - * methods. A global variable keeps the state of the lock, and - * the state is returned to the caller. + * DESCRIPTION: Obtain the ACPI hardware Global Lock, only if the field + * flags specifiy that it is to be obtained before field access. * ******************************************************************************/ -BOOLEAN +void AcpiExAcquireGlobalLock ( UINT32 FieldFlags) { - BOOLEAN Locked = FALSE; ACPI_STATUS Status; ACPI_FUNCTION_TRACE (ExAcquireGlobalLock); - /* Only attempt lock if the AlwaysLock bit is set */ + /* Only use the lock if the AlwaysLock bit is set */ - if (FieldFlags & AML_FIELD_LOCK_RULE_MASK) + if (!(FieldFlags & AML_FIELD_LOCK_RULE_MASK)) { - /* We should attempt to get the lock, wait forever */ + return_VOID; + } - Status = AcpiEvAcquireGlobalLock (ACPI_WAIT_FOREVER); - if (ACPI_SUCCESS (Status)) - { - Locked = TRUE; - } - else - { - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not acquire Global Lock")); - } + /* Attempt to get the global lock, wait forever */ + + Status = AcpiExAcquireMutexObject (ACPI_WAIT_FOREVER, + AcpiGbl_GlobalLockMutex, AcpiOsGetThreadId ()); + + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, + "Could not acquire Global Lock")); } - return_UINT8 (Locked); + return_VOID; } @@ -391,18 +390,18 @@ * * FUNCTION: AcpiExReleaseGlobalLock * - * PARAMETERS: LockedByMe - Return value from corresponding call to - * AcquireGlobalLock. + * PARAMETERS: FieldFlags - Flags with Lock rule: + * AlwaysLock or NeverLock * * RETURN: None * - * DESCRIPTION: Release the global lock if it is locked. + * DESCRIPTION: Release the ACPI hardware Global Lock * ******************************************************************************/ void AcpiExReleaseGlobalLock ( - BOOLEAN LockedByMe) + UINT32 FieldFlags) { ACPI_STATUS Status; @@ -410,20 +409,22 @@ ACPI_FUNCTION_TRACE (ExReleaseGlobalLock); - /* Only attempt unlock if the caller locked it */ + /* Only use the lock if the AlwaysLock bit is set */ - if (LockedByMe) + if (!(FieldFlags & AML_FIELD_LOCK_RULE_MASK)) { - /* OK, now release the lock */ + return_VOID; + } + + /* Release the global lock */ - Status = AcpiEvReleaseGlobalLock (); - if (ACPI_FAILURE (Status)) - { - /* Report the error, but there isn't much else we can do */ + Status = AcpiExReleaseMutexObject (AcpiGbl_GlobalLockMutex); + if (ACPI_FAILURE (Status)) + { + /* Report the error, but there isn't much else we can do */ - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not release ACPI Global Lock")); - } + ACPI_EXCEPTION ((AE_INFO, Status, + "Could not release Global Lock")); } return_VOID; --- sys/contrib/dev/acpica/nsaccess.c Wed Mar 21 17:35:30 2007 +++ sys/contrib/dev/acpica/nsaccess.c Wed Mar 21 14:41:22 2007 @@ -294,7 +294,7 @@ if (ACPI_STRCMP (InitVal->Name, "_GL_") == 0) { - AcpiGbl_GlobalLockMutex = ObjDesc->Mutex.OsMutex; + AcpiGbl_GlobalLockMutex = ObjDesc; /* Create additional counting semaphore for global lock */ --- sys/contrib/dev/acpica/nswalk.c Wed Mar 21 17:35:30 2007 +++ sys/contrib/dev/acpica/nswalk.c Wed Mar 21 14:41:22 2007 @@ -160,10 +160,7 @@ { /* It's really the parent's _scope_ that we want */ - if (ParentNode->Child) - { - NextNode = ParentNode->Child; - } + NextNode = ParentNode->Child; } else --- sys/contrib/dev/acpica/psloop.c Wed Mar 21 17:35:30 2007 +++ sys/contrib/dev/acpica/psloop.c Wed Mar 21 14:41:22 2007 @@ -274,6 +274,7 @@ UnnamedOp->Common.Value.Arg = NULL; + UnnamedOp->Common.ArgListLength = 0; UnnamedOp->Common.AmlOpcode = WalkState->Opcode; /* @@ -380,6 +381,9 @@ ACPI_STATUS Status = AE_OK; ACPI_PARSE_OBJECT *Op; ACPI_PARSE_OBJECT *NamedOp = NULL; + ACPI_PARSE_OBJECT *ParentScope; + UINT8 ArgumentCount; + const ACPI_OPCODE_INFO *OpInfo; ACPI_FUNCTION_TRACE_PTR (PsCreateOp, WalkState); @@ -425,7 +429,25 @@ Op->Named.Length = 0; } - AcpiPsAppendArg (AcpiPsGetParentScope (&(WalkState->ParserState)), Op); + ParentScope = AcpiPsGetParentScope (&(WalkState->ParserState)); + AcpiPsAppendArg (ParentScope, Op); + + if (ParentScope) + { + OpInfo = AcpiPsGetOpcodeInfo (ParentScope->Common.AmlOpcode); + if (OpInfo->Flags & AML_HAS_TARGET) + { + ArgumentCount = AcpiPsGetArgumentCount (OpInfo->Type); + if (ParentScope->Common.ArgListLength > ArgumentCount) + { + Op->Common.Flags |= ACPI_PARSEOP_TARGET; + } + } + else if (ParentScope->Common.AmlOpcode == AML_INCREMENT_OP) + { + Op->Common.Flags |= ACPI_PARSEOP_TARGET; + } + } if (WalkState->DescendingCallback != NULL) { @@ -716,15 +738,6 @@ { AcpiPsPopScope (&(WalkState->ParserState), Op, &WalkState->ArgTypes, &WalkState->ArgCount); - - if ((*Op)->Common.AmlOpcode != AML_WHILE_OP) - { - Status2 = AcpiDsResultStackPop (WalkState); - if (ACPI_FAILURE (Status2)) - { - return_ACPI_STATUS (Status2); - } - } } /* Close this iteration of the While loop */ @@ -754,11 +767,6 @@ if (*Op) { Status2 = AcpiPsCompleteThisOp (WalkState, *Op); - if (ACPI_FAILURE (Status2)) - { - return_ACPI_STATUS (Status2); - } - Status2 = AcpiDsResultStackPop (WalkState); if (ACPI_FAILURE (Status2)) { return_ACPI_STATUS (Status2); --- sys/contrib/dev/acpica/psopcode.c Wed Mar 21 17:35:30 2007 +++ sys/contrib/dev/acpica/psopcode.c Wed Mar 21 14:41:22 2007 @@ -125,6 +125,9 @@ ACPI_MODULE_NAME ("psopcode") +const UINT8 AcpiGbl_ArgumentCount[] = {0,1,1,1,1,2,2,2,2,3,3,6}; + + /******************************************************************************* * * NAME: AcpiGbl_AmlOpInfo @@ -559,3 +562,28 @@ #endif } + +/******************************************************************************* + * + * FUNCTION: AcpiPsGetArgumentCount + * + * PARAMETERS: OpType - Type associated with the AML opcode + * + * RETURN: Argument count + * + * DESCRIPTION: Obtain the number of expected arguments for an AML opcode + * + ******************************************************************************/ + +UINT8 +AcpiPsGetArgumentCount ( + UINT32 OpType) +{ + + if (OpType <= AML_TYPE_EXEC_6A_0T_1R) + { + return (AcpiGbl_ArgumentCount[OpType]); + } + + return (0); +} --- sys/contrib/dev/acpica/psparse.c Wed Mar 21 17:35:30 2007 +++ sys/contrib/dev/acpica/psparse.c Wed Mar 21 14:41:22 2007 @@ -434,22 +434,14 @@ ParserState->Aml = WalkState->AmlLastWhile; WalkState->ControlState->Common.Value = FALSE; - Status = AcpiDsResultStackPop (WalkState); - if (ACPI_SUCCESS (Status)) - { - Status = AE_CTRL_BREAK; - } + Status = AE_CTRL_BREAK; break; case AE_CTRL_CONTINUE: ParserState->Aml = WalkState->AmlLastWhile; - Status = AcpiDsResultStackPop (WalkState); - if (ACPI_SUCCESS (Status)) - { - Status = AE_CTRL_CONTINUE; - } + Status = AE_CTRL_CONTINUE; break; @@ -472,11 +464,7 @@ * Just close out this package */ ParserState->Aml = AcpiPsGetNextPackageEnd (ParserState); - Status = AcpiDsResultStackPop (WalkState); - if (ACPI_SUCCESS (Status)) - { - Status = AE_CTRL_PENDING; - } + Status = AE_CTRL_PENDING; break; --- sys/contrib/dev/acpica/pstree.c Wed Mar 21 17:35:30 2007 +++ sys/contrib/dev/acpica/pstree.c Wed Mar 21 14:41:22 2007 @@ -267,6 +267,8 @@ { Arg->Common.Parent = Op; Arg = Arg->Common.Next; + + Op->Common.ArgListLength++; } } --- sys/contrib/dev/acpica/utdelete.c Wed Mar 21 17:35:31 2007 +++ sys/contrib/dev/acpica/utdelete.c Wed Mar 21 14:41:22 2007 @@ -247,7 +247,7 @@ "***** Mutex %p, OS Mutex %p\n", Object, Object->Mutex.OsMutex)); - if (Object->Mutex.OsMutex == AcpiGbl_GlobalLockMutex) + if (Object == AcpiGbl_GlobalLockMutex) { /* Global Lock has extra semaphore */