diff options
author | Nate Lawson <njl@FreeBSD.org> | 2004-04-14 02:10:27 +0000 |
---|---|---|
committer | Nate Lawson <njl@FreeBSD.org> | 2004-04-14 02:10:27 +0000 |
commit | e0ef747b8917c3229c0e9d69b9eca49b05e2c0e5 (patch) | |
tree | 9c760be068e0b25d22acbac5eaeba299b68429ff /sys/contrib | |
parent | 731de42fc8f72f90153979636c1a2743fe5ba297 (diff) | |
download | src-test2-e0ef747b8917c3229c0e9d69b9eca49b05e2c0e5.tar.gz src-test2-e0ef747b8917c3229c0e9d69b9eca49b05e2c0e5.zip |
Notes
Diffstat (limited to 'sys/contrib')
37 files changed, 870 insertions, 259 deletions
diff --git a/sys/contrib/dev/acpica/CHANGES.txt b/sys/contrib/dev/acpica/CHANGES.txt index 54057f3752e5..5eac16fe2c71 100644 --- a/sys/contrib/dev/acpica/CHANGES.txt +++ b/sys/contrib/dev/acpica/CHANGES.txt @@ -1,4 +1,111 @@ ---------------------------------------- +02 April 2004. Summary of changes for version 20040402: + +1) ACPI CA Core Subsystem: + +Fixed an interpreter problem where an indirect store through an +ArgX parameter was incorrectly applying the "implicit conversion +rules" during the store. From the ACPI specification: "If the +target is a method local or argument (LocalX or ArgX), no +conversion is performed and the result is stored directly to the +target". The new behavior is to disable implicit conversion +during ALL stores to an ArgX. + +Changed the behavior of the _PRW method scan to ignore any and +all errors returned by a given _PRW. This prevents the scan from +aborting from the failure of any single _PRW. + +Moved the runtime configuration parameters from the global init +procedure to static variables in acglobal.h. This will allow the +host to override the default values easily. + +Code and Data Size: Current and previous core subsystem library +sizes are shown below. These are the code and data sizes for the +acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and +these values do not include any ACPI driver or OSPM code. The +debug version of the code includes the debug output trace +mechanism and has a much larger code and data size. Note that +these values will vary depending on the efficiency of the +compiler and the compiler options used during generation. + + Previous Release: + Non-Debug Version: 76.9K Code, 11.4K Data, 88.3K Total + Debug Version: 160.8K Code, 66.1K Data, 226.9K Total + Current Release: + Non-Debug Version: 77.0K Code, 11.4K Data, 88.4K Total + Debug Version: 161.0K Code, 66.3K Data, 227.3K Total + + +2) iASL Compiler/Disassembler: + +iASL now fully disassembles SSDTs. However, External() +statements are not generated automatically for unresolved symbols +at this time. This is a planned feature for future +implementation. + +Fixed a scoping problem in the disassembler that occurs when the +type of the target of a Scope() operator is overridden. This +problem caused an incorrectly nested internal namespace to be +constructed. + +Any warnings or errors that are emitted during disassembly are +now commented out automatically so that the resulting file can be +recompiled without any hand editing. + +---------------------------------------- +26 March 2004. Summary of changes for version 20040326: + +1) ACPI CA Core Subsystem: + +Implemented support for "wake" GPEs via interaction between GPEs +and the _PRW methods. Every GPE that is pointed to by one or +more _PRWs is identified as a WAKE GPE and by default will no +longer be enabled at runtime. Previously, we were blindly +enabling all GPEs with a corresponding _Lxx or _Exx method - but +most of these turn out to be WAKE GPEs anyway. We believe this +has been the cause of thousands of "spurious" GPEs on some +systems. + +This new GPE behavior is can be reverted to the original behavior +(enable ALL GPEs at runtime) via a runtime flag. + +Fixed a problem where aliased control methods could not access +objects properly. The proper scope within the namespace was not +initialized (transferred to the target of the aliased method) +before executing the target method. + +Fixed a potential race condition on internal object deletion on +the return object in AcpiEvaluateObject. + +Integrated a fix for resource descriptors where both _MEM and +_MTP were being extracted instead of just _MEM. (i.e. bitmask +was incorrectly too wide, 0x0F instead of 0x03.) + +Added a special case for ACPI_ROOT_OBJECT in AcpiUtGetNodeName, +preventing a fault in some cases. + +Updated Notify() values for debug statements in evmisc.c + +Return proper status from AcpiUtMutexInitialize, not just simply +AE_OK. + +Code and Data Size: Current and previous core subsystem library +sizes are shown below. These are the code and data sizes for the +acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and +these values do not include any ACPI driver or OSPM code. The +debug version of the code includes the debug output trace +mechanism and has a much larger code and data size. Note that +these values will vary depending on the efficiency of the +compiler and the compiler options used during generation. + + Previous Release: + Non-Debug Version: 76.5K Code, 11.3K Data, 87.8K Total + Debug Version: 160.3K Code, 66.0K Data, 226.3K Total + Current Release: + Non-Debug Version: 76.9K Code, 11.4K Data, 88.3K Total + Debug Version: 160.8K Code, 66.1K Data, 226.9K Total + +---------------------------------------- 11 March 2004. Summary of changes for version 20040311: 1) ACPI CA Core Subsystem: diff --git a/sys/contrib/dev/acpica/acconfig.h b/sys/contrib/dev/acpica/acconfig.h index b4effcbca27a..74895b5baf4d 100644 --- a/sys/contrib/dev/acpica/acconfig.h +++ b/sys/contrib/dev/acpica/acconfig.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acconfig.h - Global configuration constants - * $Revision: 150 $ + * $Revision: 152 $ * *****************************************************************************/ @@ -137,7 +137,7 @@ /* Version string */ -#define ACPI_CA_VERSION 0x20040311 +#define ACPI_CA_VERSION 0x20040402 /* Maximum objects in the various object caches */ diff --git a/sys/contrib/dev/acpica/acdisasm.h b/sys/contrib/dev/acpica/acdisasm.h index 488f48b8d2d6..3c2570129c74 100644 --- a/sys/contrib/dev/acpica/acdisasm.h +++ b/sys/contrib/dev/acpica/acdisasm.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acdisasm.h - AML disassembler - * $Revision: 11 $ + * $Revision: 12 $ * *****************************************************************************/ @@ -125,6 +125,14 @@ #define BLOCK_BRACE 2 #define BLOCK_COMMA_LIST 4 +typedef struct acpi_external_list +{ + char *Path; + struct acpi_external_list *Next; + +} ACPI_EXTERNAL_LIST; + +extern ACPI_EXTERNAL_LIST *AcpiGbl_ExternalList; extern const char *AcpiGbl_IoDecode[2]; extern const char *AcpiGbl_WordDecode[4]; extern const char *AcpiGbl_ConsumeDecode[2]; @@ -473,4 +481,12 @@ AcpiDmVendorSmallDescriptor ( UINT32 Level); +/* + * dmutils + */ + +void +AcpiDmAddToExternalList ( + char *Path); + #endif /* __ACDISASM_H__ */ diff --git a/sys/contrib/dev/acpica/acglobal.h b/sys/contrib/dev/acpica/acglobal.h index fedc2395dca8..0bf6ce10ca34 100644 --- a/sys/contrib/dev/acpica/acglobal.h +++ b/sys/contrib/dev/acpica/acglobal.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acglobal.h - Declarations for global variables - * $Revision: 148 $ + * $Revision: 152 $ * *****************************************************************************/ @@ -119,15 +119,17 @@ /* - * Ensure that the globals are actually defined only once. + * Ensure that the globals are actually defined and initialized only once. * - * The use of these defines allows a single list of globals (here) in order + * The use of these macros allows a single list of globals (here) in order * to simplify maintenance of the code. */ #ifdef DEFINE_ACPI_GLOBALS #define ACPI_EXTERN +#define ACPI_INIT_GLOBAL(a,b) a=b #else #define ACPI_EXTERN extern +#define ACPI_INIT_GLOBAL(a,b) a #endif /* @@ -137,6 +139,7 @@ ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1aEnable; ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1bEnable; + /***************************************************************************** * * Debug support @@ -152,14 +155,35 @@ extern UINT32 AcpiDbgLayer; extern UINT32 AcpiGbl_NestingLevel; + /***************************************************************************** * - * Runtime configuration + * Runtime configuration (static defaults that can be overriden at runtime) * ****************************************************************************/ -ACPI_EXTERN UINT8 AcpiGbl_CreateOsiMethod; -ACPI_EXTERN UINT8 AcpiGbl_AllMethodsSerialized; +/* + * Create the predefined _OSI method in the namespace? Default is TRUE + * because ACPI CA is fully compatible with other ACPI implementations. + * Changing this will revert ACPI CA (and machine ASL) to pre-OSI behavior. + */ +ACPI_EXTERN UINT8 ACPI_INIT_GLOBAL (AcpiGbl_CreateOsiMethod, TRUE); + +/* + * Automatically serialize ALL control methods? Default is FALSE, meaning + * to use the Serialized/NotSerialized method flags on a per method basis. + * Only change this if the ASL code is poorly written and cannot handle + * reentrancy even though methods are marked "NotSerialized". + */ +ACPI_EXTERN UINT8 ACPI_INIT_GLOBAL (AcpiGbl_AllMethodsSerialized, FALSE); + +/* + * Disable wakeup GPEs during runtime? Default is TRUE because WAKE and + * RUNTIME GPEs should never be shared, and WAKE GPEs should typically only + * be enabled just before going to sleep. + */ +ACPI_EXTERN UINT8 ACPI_INIT_GLOBAL (AcpiGbl_LeaveWakeGpesDisabled, TRUE); + /***************************************************************************** * @@ -174,7 +198,6 @@ ACPI_EXTERN UINT8 AcpiGbl_AllMethodsSerialized; * * These tables are single-table only; meaning that there can be at most one * of each in the system. Each global points to the actual table. - * */ ACPI_EXTERN UINT32 AcpiGbl_TableFlags; ACPI_EXTERN UINT32 AcpiGbl_RsdtTableCount; @@ -269,6 +292,7 @@ extern const char *AcpiGbl_ValidOsiStrings[ACPI_NUM_OSI_STR ACPI_EXTERN ACPI_NAMESPACE_NODE AcpiGbl_RootNodeStruct; ACPI_EXTERN ACPI_NAMESPACE_NODE *AcpiGbl_RootNode; +ACPI_EXTERN ACPI_NAMESPACE_NODE *AcpiGbl_FadtGpeDevice; extern const UINT8 AcpiGbl_NsProperties[NUM_NS_TYPES]; extern const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames [NUM_PREDEFINED_NAMES]; diff --git a/sys/contrib/dev/acpica/achware.h b/sys/contrib/dev/acpica/achware.h index 96ceb8e5c04c..dd33a4b6a184 100644 --- a/sys/contrib/dev/acpica/achware.h +++ b/sys/contrib/dev/acpica/achware.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: achware.h -- hardware specific interfaces - * $Revision: 68 $ + * $Revision: 69 $ * *****************************************************************************/ @@ -222,11 +222,11 @@ AcpiHwGetGpeStatus ( ACPI_EVENT_STATUS *EventStatus); ACPI_STATUS -AcpiHwDisableNonWakeupGpes ( +AcpiHwPrepareGpesForSleep ( void); ACPI_STATUS -AcpiHwEnableNonWakeupGpes ( +AcpiHwRestoreGpesOnWake ( void); diff --git a/sys/contrib/dev/acpica/acinterp.h b/sys/contrib/dev/acpica/acinterp.h index d4b7a7172366..a0f19a1c2fbe 100644 --- a/sys/contrib/dev/acpica/acinterp.h +++ b/sys/contrib/dev/acpica/acinterp.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acinterp.h - Interpreter subcomponent prototypes and defines - * $Revision: 147 $ + * $Revision: 148 $ * *****************************************************************************/ @@ -636,8 +636,11 @@ ACPI_STATUS AcpiExStoreObjectToNode ( ACPI_OPERAND_OBJECT *SourceDesc, ACPI_NAMESPACE_NODE *Node, - ACPI_WALK_STATE *WalkState); + ACPI_WALK_STATE *WalkState, + UINT8 ImplicitConversion); +#define ACPI_IMPLICIT_CONVERSION TRUE +#define ACPI_NO_IMPLICIT_CONVERSION FALSE /* * exstoren diff --git a/sys/contrib/dev/acpica/aclocal.h b/sys/contrib/dev/acpica/aclocal.h index 5d3425332f2b..98bee4991393 100644 --- a/sys/contrib/dev/acpica/aclocal.h +++ b/sys/contrib/dev/acpica/aclocal.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: aclocal.h - Internal data types used across the ACPI subsystem - * $Revision: 198 $ + * $Revision: 199 $ * *****************************************************************************/ @@ -447,6 +447,14 @@ typedef struct acpi_gpe_xrupt_info } ACPI_GPE_XRUPT_INFO; +typedef struct acpi_gpe_walk_info +{ + ACPI_NAMESPACE_NODE *GpeDevice; + ACPI_GPE_BLOCK_INFO *GpeBlock; + +} ACPI_GPE_WALK_INFO; + + typedef ACPI_STATUS (*ACPI_GPE_CALLBACK) ( ACPI_GPE_XRUPT_INFO *GpeXruptInfo, ACPI_GPE_BLOCK_INFO *GpeBlock); diff --git a/sys/contrib/dev/acpica/actypes.h b/sys/contrib/dev/acpica/actypes.h index 7e4ea1447301..8c3804f7f036 100644 --- a/sys/contrib/dev/acpica/actypes.h +++ b/sys/contrib/dev/acpica/actypes.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: actypes.h - Common data types for the entire ACPI subsystem - * $Revision: 265 $ + * $Revision: 266 $ * *****************************************************************************/ @@ -492,7 +492,7 @@ typedef UINT32 ACPI_TABLE_TYPE; * of the ACPI ObjectType() operator (See the ACPI Spec). Therefore, * only add to the first group if the spec changes. * - * Types must be kept in sync with the global AcpiNsProperties + * NOTE: Types must be kept in sync with the global AcpiNsProperties * and AcpiNsTypeNames arrays. */ typedef UINT32 ACPI_OBJECT_TYPE; @@ -529,26 +529,27 @@ typedef UINT32 ACPI_OBJECT_TYPE; #define ACPI_TYPE_LOCAL_INDEX_FIELD 0x13 #define ACPI_TYPE_LOCAL_REFERENCE 0x14 /* Arg#, Local#, Name, Debug, RefOf, Index */ #define ACPI_TYPE_LOCAL_ALIAS 0x15 -#define ACPI_TYPE_LOCAL_NOTIFY 0x16 -#define ACPI_TYPE_LOCAL_ADDRESS_HANDLER 0x17 -#define ACPI_TYPE_LOCAL_RESOURCE 0x18 -#define ACPI_TYPE_LOCAL_RESOURCE_FIELD 0x19 -#define ACPI_TYPE_LOCAL_SCOPE 0x1A /* 1 Name, multiple ObjectList Nodes */ +#define ACPI_TYPE_LOCAL_METHOD_ALIAS 0x16 +#define ACPI_TYPE_LOCAL_NOTIFY 0x17 +#define ACPI_TYPE_LOCAL_ADDRESS_HANDLER 0x18 +#define ACPI_TYPE_LOCAL_RESOURCE 0x19 +#define ACPI_TYPE_LOCAL_RESOURCE_FIELD 0x1A +#define ACPI_TYPE_LOCAL_SCOPE 0x1B /* 1 Name, multiple ObjectList Nodes */ -#define ACPI_TYPE_NS_NODE_MAX 0x1A /* Last typecode used within a NS Node */ +#define ACPI_TYPE_NS_NODE_MAX 0x1B /* Last typecode used within a NS Node */ /* * These are special object types that never appear in * a Namespace node, only in an ACPI_OPERAND_OBJECT */ -#define ACPI_TYPE_LOCAL_EXTRA 0x1B -#define ACPI_TYPE_LOCAL_DATA 0x1C +#define ACPI_TYPE_LOCAL_EXTRA 0x1C +#define ACPI_TYPE_LOCAL_DATA 0x1D -#define ACPI_TYPE_LOCAL_MAX 0x1C +#define ACPI_TYPE_LOCAL_MAX 0x1D /* All types above here are invalid */ -#define ACPI_TYPE_INVALID 0x1D +#define ACPI_TYPE_INVALID 0x1E #define ACPI_TYPE_NOT_FOUND 0xFF @@ -590,9 +591,8 @@ typedef UINT32 ACPI_OBJECT_TYPE; #define ACPI_WRITE 1 #define ACPI_IO_MASK 1 - /* - * Acpi Event Types: Fixed & General Purpose + * Event Types: Fixed & General Purpose */ typedef UINT32 ACPI_EVENT_TYPE; @@ -607,25 +607,8 @@ typedef UINT32 ACPI_EVENT_TYPE; #define ACPI_EVENT_MAX 4 #define ACPI_NUM_FIXED_EVENTS ACPI_EVENT_MAX + 1 -#define ACPI_GPE_INVALID 0xFF -#define ACPI_GPE_MAX 0xFF -#define ACPI_NUM_GPE 256 - -#define ACPI_EVENT_LEVEL_TRIGGERED 1 -#define ACPI_EVENT_EDGE_TRIGGERED 2 - -/* - * Flags for GPE and Lock interfaces - */ -#define ACPI_EVENT_WAKE_ENABLE 0x2 -#define ACPI_EVENT_WAKE_DISABLE 0x2 - -#define ACPI_NOT_ISR 0x1 -#define ACPI_ISR 0x0 - - /* - * AcpiEvent Status: + * Event Status - Per event * ------------- * The encoding of ACPI_EVENT_STATUS is illustrated below. * Note that a set bit (1) indicates the property is TRUE @@ -646,6 +629,45 @@ typedef UINT32 ACPI_EVENT_STATUS; #define ACPI_EVENT_FLAG_WAKE_ENABLED (ACPI_EVENT_STATUS) 0x02 #define ACPI_EVENT_FLAG_SET (ACPI_EVENT_STATUS) 0x04 +/* + * General Purpose Events (GPE) + */ +#define ACPI_GPE_INVALID 0xFF +#define ACPI_GPE_MAX 0xFF +#define ACPI_NUM_GPE 256 + +/* + * GPE info flags - Per GPE + * +---------+-+-+-+ + * |Bits 8:3 |2|1|0| + * +---------+-+-+-+ + * | | | | + * | | | +- Edge or Level Triggered + * | | +--- Type: Wake or Runtime + * | +----- Enabled for wake? + * +--------<Reserved> + */ +#define ACPI_GPE_XRUPT_TYPE_MASK (UINT8) 1 +#define ACPI_GPE_LEVEL_TRIGGERED (UINT8) 1 +#define ACPI_GPE_EDGE_TRIGGERED (UINT8) 0 + +#define ACPI_GPE_TYPE_MASK (UINT8) 2 +#define ACPI_GPE_TYPE_WAKE (UINT8) 2 +#define ACPI_GPE_TYPE_RUNTIME (UINT8) 0 /* Default */ + +#define ACPI_GPE_ENABLE_MASK (UINT8) 4 +#define ACPI_GPE_ENABLED (UINT8) 4 +#define ACPI_GPE_DISABLED (UINT8) 0 /* Default */ + +/* + * Flags for GPE and Lock interfaces + */ +#define ACPI_EVENT_WAKE_ENABLE 0x2 +#define ACPI_EVENT_WAKE_DISABLE 0x2 + +#define ACPI_NOT_ISR 0x1 +#define ACPI_ISR 0x0 + /* Notify types */ diff --git a/sys/contrib/dev/acpica/acutils.h b/sys/contrib/dev/acpica/acutils.h index 81e1df894a64..7aa8fe072336 100644 --- a/sys/contrib/dev/acpica/acutils.h +++ b/sys/contrib/dev/acpica/acutils.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures - * $Revision: 160 $ + * $Revision: 161 $ * *****************************************************************************/ @@ -545,6 +545,7 @@ AcpiUtDeleteInternalObjectList ( #define METHOD_NAME__PRT "_PRT" #define METHOD_NAME__CRS "_CRS" #define METHOD_NAME__PRS "_PRS" +#define METHOD_NAME__PRW "_PRW" ACPI_STATUS diff --git a/sys/contrib/dev/acpica/common/adisasm.c b/sys/contrib/dev/acpica/common/adisasm.c index e2c6f1b70fe2..a46d72ea4b39 100644 --- a/sys/contrib/dev/acpica/common/adisasm.c +++ b/sys/contrib/dev/acpica/common/adisasm.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: adisasm - Application-level disassembler routines - * $Revision: 64 $ + * $Revision: 65 $ * *****************************************************************************/ @@ -146,7 +146,6 @@ AcpiDsIsResultUsed ( } #endif - ACPI_STATUS AcpiDsRestartControlMethod ( ACPI_WALK_STATE *WalkState, @@ -548,6 +547,18 @@ AdAmlDisassemble ( goto Cleanup; } + /* + * TBD: We want to cross reference the namespace here, in order to + * generate External() statements. The problem is that the parse + * tree is in run-time (interpreter) format, not compiler format, + * so we cannot directly use the function below: + * + * Status = LkCrossReferenceNamespace (); + * + * We need to either convert the parse tree or create a new + * cross ref function that can handle interpreter parse trees + */ + /* Optional displays */ if (AcpiGbl_DbOpt_disasm) @@ -959,10 +970,6 @@ AdGetLocalTables ( } } -#ifdef _HPET - AfGetHpet (); -#endif - return AE_OK; } diff --git a/sys/contrib/dev/acpica/compiler/aslload.c b/sys/contrib/dev/acpica/compiler/aslload.c index 79e79bf0b031..45f292d6ff71 100644 --- a/sys/contrib/dev/acpica/compiler/aslload.c +++ b/sys/contrib/dev/acpica/compiler/aslload.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dswload - Dispatcher namespace load callbacks - * $Revision: 60 $ + * $Revision: 62 $ * *****************************************************************************/ @@ -518,14 +518,19 @@ LdNamespace1Begin ( * Which is used to workaround the fact that the MS interpreter * does not allow Scope() forward references. */ - sprintf (MsgBuffer, "%s, %s, Changing type to (Scope)", + sprintf (MsgBuffer, "%s [%s], changing type to [Scope]", Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type)); AslError (ASL_REMARK, ASL_MSG_SCOPE_TYPE, Op, MsgBuffer); /* - * Switch the type + * Switch the type to scope, open the new scope */ - Node->Type = ACPI_TYPE_ANY; + Node->Type = ACPI_TYPE_LOCAL_SCOPE; + Status = AcpiDsScopeStackPush (Node, ACPI_TYPE_LOCAL_SCOPE, WalkState); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } break; default: @@ -533,15 +538,20 @@ LdNamespace1Begin ( /* * All other types are an error */ - sprintf (MsgBuffer, "%s, %s", Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type)); + sprintf (MsgBuffer, "%s [%s]", Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type)); AslError (ASL_ERROR, ASL_MSG_SCOPE_TYPE, Op, MsgBuffer); /* * However, switch the type to be an actual scope so * that compilation can continue without generating a whole - * cascade of additional errors. + * cascade of additional errors. Open the new scope. */ - Node->Type = ACPI_TYPE_ANY; + Node->Type = ACPI_TYPE_LOCAL_SCOPE; + Status = AcpiDsScopeStackPush (Node, ACPI_TYPE_LOCAL_SCOPE, WalkState); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } break; } diff --git a/sys/contrib/dev/acpica/dbexec.c b/sys/contrib/dev/acpica/dbexec.c index 9eded346e275..e06edb8f023a 100644 --- a/sys/contrib/dev/acpica/dbexec.c +++ b/sys/contrib/dev/acpica/dbexec.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbexec - debugger control method execution - * $Revision: 59 $ + * $Revision: 60 $ * ******************************************************************************/ @@ -484,7 +484,7 @@ AcpiDbMethodThread ( } } - if ((i % 1000) == 0) + if ((i % 100) == 0) { AcpiOsPrintf ("%d executions\n", i); } diff --git a/sys/contrib/dev/acpica/dmutils.c b/sys/contrib/dev/acpica/dmutils.c index d65fded0574b..a8281810ed5e 100644 --- a/sys/contrib/dev/acpica/dmutils.c +++ b/sys/contrib/dev/acpica/dmutils.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dmutils - AML disassembler utilities - * $Revision: 9 $ + * $Revision: 10 $ * ******************************************************************************/ @@ -118,6 +118,7 @@ #include "acpi.h" #include "amlcode.h" #include "acdisasm.h" +#include "acnamesp.h" #ifdef ACPI_DISASSEMBLER @@ -126,6 +127,9 @@ ACPI_MODULE_NAME ("dmutils") +ACPI_EXTERNAL_LIST *AcpiGbl_ExternalList = NULL; + + /* Data used in keeping track of fields */ #if 0 const char *AcpiGbl_FENames[ACPI_NUM_FIELD_NAMES] = @@ -289,6 +293,56 @@ const char *AcpiGbl_SIZDecode[4] = /******************************************************************************* * + * FUNCTION: AcpiDmAddToExternalList + * + * PARAMETERS: Path - Internal (AML) path to the object + * + * RETURN: None + * + * DESCRIPTION: Insert a new path into the list of Externals which will in + * turn be emitted as an External() declaration in the disassembled + * output. + * + ******************************************************************************/ + +void +AcpiDmAddToExternalList ( + char *Path) +{ + char *ExternalPath; + ACPI_EXTERNAL_LIST *NewExternal; + ACPI_STATUS Status; + + + if (!Path) + { + return; + } + + /* Externalize the ACPI path */ + + Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, Path, + NULL, &ExternalPath); + if (ACPI_SUCCESS (Status)) + { + /* Allocate and init a new External() descriptor */ + + NewExternal = ACPI_MEM_CALLOCATE (sizeof (ACPI_EXTERNAL_LIST)); + NewExternal->Path = ExternalPath; + + /* Link the new descriptor into the global list */ + + if (AcpiGbl_ExternalList) + { + NewExternal->Next = AcpiGbl_ExternalList; + } + AcpiGbl_ExternalList = NewExternal; + } +} + + +/******************************************************************************* + * * FUNCTION: AcpiDmDecodeAttribute * * PARAMETERS: Attribute - Attribute field of AccessAs keyword diff --git a/sys/contrib/dev/acpica/dmwalk.c b/sys/contrib/dev/acpica/dmwalk.c index 8a19023be8b5..f9de88e3345e 100644 --- a/sys/contrib/dev/acpica/dmwalk.c +++ b/sys/contrib/dev/acpica/dmwalk.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dmwalk - AML disassembly tree walk - * $Revision: 11 $ + * $Revision: 12 $ * ******************************************************************************/ @@ -434,6 +434,7 @@ AcpiDmDescendingOp ( const ACPI_OPCODE_INFO *OpInfo; UINT32 Name; ACPI_PARSE_OBJECT *NextOp; + ACPI_EXTERNAL_LIST *NextExternal; if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE) @@ -443,6 +444,7 @@ AcpiDmDescendingOp ( return (AE_CTRL_DEPTH); } + /* Level 0 is at the Definition Block level */ if (Level == 0) { @@ -453,7 +455,30 @@ AcpiDmDescendingOp ( if (Op->Common.AmlOpcode == AML_SCOPE_OP) { + /* This is the beginning of the Definition Block */ + AcpiOsPrintf ("{\n"); + + /* Emit all External() declarations here */ + + if (AcpiGbl_ExternalList) + { + AcpiOsPrintf (" /*\n * These objects were referenced but not defined in this table\n */\n"); + + /* Walk the list of externals (unresolved references) found during parsing */ + + while (AcpiGbl_ExternalList) + { + AcpiOsPrintf (" External (%s)\n", AcpiGbl_ExternalList->Path); + + NextExternal = AcpiGbl_ExternalList->Next; + ACPI_MEM_FREE (AcpiGbl_ExternalList->Path); + ACPI_MEM_FREE (AcpiGbl_ExternalList); + AcpiGbl_ExternalList = NextExternal; + } + AcpiOsPrintf ("\n"); + } + return (AE_OK); } } diff --git a/sys/contrib/dev/acpica/dsmthdat.c b/sys/contrib/dev/acpica/dsmthdat.c index 2a49357ef7ec..1498cf556d2c 100644 --- a/sys/contrib/dev/acpica/dsmthdat.c +++ b/sys/contrib/dev/acpica/dsmthdat.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dsmthdat - control method arguments and local variables - * $Revision: 77 $ + * $Revision: 78 $ * ******************************************************************************/ @@ -760,11 +760,13 @@ AcpiDsStoreObjectToLocal ( NewObjDesc, CurrentObjDesc)); /* - * Store this object to the Node - * (perform the indirect store) + * Store this object to the Node (perform the indirect store) + * NOTE: No implicit conversion is performed, as per the ACPI + * specification rules on storing to Locals/Args. */ Status = AcpiExStoreObjectToNode (NewObjDesc, - CurrentObjDesc->Reference.Object, WalkState); + CurrentObjDesc->Reference.Object, WalkState, + ACPI_NO_IMPLICIT_CONVERSION); /* Remove local reference if we copied the object above */ diff --git a/sys/contrib/dev/acpica/dswload.c b/sys/contrib/dev/acpica/dswload.c index 7af6bc9dc78b..950262931cee 100644 --- a/sys/contrib/dev/acpica/dswload.c +++ b/sys/contrib/dev/acpica/dswload.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dswload - Dispatcher namespace load callbacks - * $Revision: 86 $ + * $Revision: 87 $ * *****************************************************************************/ @@ -124,6 +124,9 @@ #include "acnamesp.h" #include "acevents.h" +#ifdef _ACPI_ASL_COMPILER +#include "acdisasm.h" +#endif #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME ("dswload") @@ -261,7 +264,19 @@ AcpiDsLoad1BeginOp ( ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node)); if (ACPI_FAILURE (Status)) { +#ifdef _ACPI_ASL_COMPILER + if (Status == AE_NOT_FOUND) + { + AcpiDmAddToExternalList (Path); + Status = AE_OK; + } + else + { + ACPI_REPORT_NSERROR (Path, Status); + } +#else ACPI_REPORT_NSERROR (Path, Status); +#endif return (Status); } @@ -637,7 +652,18 @@ AcpiDsLoad2BeginOp ( ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node)); if (ACPI_FAILURE (Status)) { +#ifdef _ACPI_ASL_COMPILER + if (Status == AE_NOT_FOUND) + { + Status = AE_OK; + } + else + { + ACPI_REPORT_NSERROR (BufferPtr, Status); + } +#else ACPI_REPORT_NSERROR (BufferPtr, Status); +#endif return_ACPI_STATUS (Status); } /* diff --git a/sys/contrib/dev/acpica/evgpe.c b/sys/contrib/dev/acpica/evgpe.c index 95978fcbb16b..44d2665048d7 100644 --- a/sys/contrib/dev/acpica/evgpe.c +++ b/sys/contrib/dev/acpica/evgpe.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evgpe - General Purpose Event handling and dispatch - * $Revision: 34 $ + * $Revision: 35 $ * *****************************************************************************/ @@ -176,9 +176,8 @@ AcpiEvGetGpeEventInfo ( return (NULL); } - /* - * A Non-null GpeDevice means this is a GPE Block Device. - */ + /* A Non-NULL GpeDevice means this is a GPE Block Device */ + ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) GpeDevice); if (!ObjDesc || !ObjDesc->Device.GpeBlock) @@ -389,7 +388,7 @@ AcpiEvAsynchExecuteGpeMethod ( } } - if (LocalGpeEventInfo.Flags & ACPI_EVENT_LEVEL_TRIGGERED) + if ((LocalGpeEventInfo.Flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_LEVEL_TRIGGERED) { /* * GPE is level-triggered, we clear the GPE status bit after handling @@ -440,7 +439,7 @@ AcpiEvGpeDispatch ( * If edge-triggered, clear the GPE status bit now. Note that * level-triggered events are cleared after the GPE is serviced. */ - if (GpeEventInfo->Flags & ACPI_EVENT_EDGE_TRIGGERED) + if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_EDGE_TRIGGERED) { Status = AcpiHwClearGpe (GpeEventInfo); if (ACPI_FAILURE (Status)) @@ -466,7 +465,7 @@ AcpiEvGpeDispatch ( /* It is now safe to clear level-triggered events. */ - if (GpeEventInfo->Flags & ACPI_EVENT_LEVEL_TRIGGERED) + if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_LEVEL_TRIGGERED) { Status = AcpiHwClearGpe (GpeEventInfo); if (ACPI_FAILURE (Status)) diff --git a/sys/contrib/dev/acpica/evgpeblk.c b/sys/contrib/dev/acpica/evgpeblk.c index 75eed44f5028..c28f621b1055 100644 --- a/sys/contrib/dev/acpica/evgpeblk.c +++ b/sys/contrib/dev/acpica/evgpeblk.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evgpeblk - GPE block creation and initialization. - * $Revision: 27 $ + * $Revision: 29 $ * *****************************************************************************/ @@ -247,11 +247,11 @@ UnlockAndExit: * information for quick lookup during GPE dispatch * * The name of each GPE control method is of the form: - * "_Lnn" or "_Enn" - * Where: - * L - means that the GPE is level triggered - * E - means that the GPE is edge triggered - * nn - is the GPE number [in HEX] + * "_Lxx" or "_Exx" + * Where: + * L - means that the GPE is level triggered + * E - means that the GPE is edge triggered + * xx - is the GPE number [in HEX] * ******************************************************************************/ @@ -267,37 +267,42 @@ AcpiEvSaveMethodInfo ( UINT32 GpeNumber; char Name[ACPI_NAME_SIZE + 1]; UINT8 Type; - ACPI_STATUS Status; ACPI_FUNCTION_TRACE ("EvSaveMethodInfo"); - /* Extract the name from the object and convert to a string */ - + /* + * _Lxx and _Exx GPE method support + * + * 1) Extract the name from the object and convert to a string + */ ACPI_MOVE_32_TO_32 (Name, &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Integer); Name[ACPI_NAME_SIZE] = 0; /* - * Edge/Level determination is based on the 2nd character - * of the method name + * 2) Edge/Level determination is based on the 2nd character + * of the method name + * + * NOTE: Default GPE type is RUNTIME. May be changed later to WAKE if a + * _PRW object is found that points to this GPE. */ switch (Name[1]) { case 'L': - Type = ACPI_EVENT_LEVEL_TRIGGERED; + Type = ACPI_GPE_LEVEL_TRIGGERED | ACPI_GPE_TYPE_RUNTIME; break; case 'E': - Type = ACPI_EVENT_EDGE_TRIGGERED; + Type = ACPI_GPE_EDGE_TRIGGERED | ACPI_GPE_TYPE_RUNTIME; break; default: /* Unknown method type, just ignore it! */ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Unknown GPE method type: %s (name not of form _Lnn or _Enn)\n", + "Unknown GPE method type: %s (name not of form _Lxx or _Exx)\n", Name)); return_ACPI_STATUS (AE_OK); } @@ -310,7 +315,7 @@ AcpiEvSaveMethodInfo ( /* Conversion failed; invalid method, just ignore it */ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Could not extract GPE number from name: %s (name is not of form _Lnn or _Enn)\n", + "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)\n", Name)); return_ACPI_STATUS (AE_OK); } @@ -337,17 +342,130 @@ AcpiEvSaveMethodInfo ( GpeEventInfo->Flags = Type; GpeEventInfo->MethodNode = (ACPI_NAMESPACE_NODE *) ObjHandle; - /* Enable the GPE (SCIs should be disabled at this point) */ + ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, + "Registered GPE method %s as GPE number 0x%.2X\n", + Name, GpeNumber)); + return_ACPI_STATUS (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiEvGetGpeType + * + * PARAMETERS: Callback from WalkNamespace + * + * RETURN: Status + * + * DESCRIPTION: Called from AcpiWalkNamespace. Expects each object to be a + * Device. Run the _PRW method. If present, extract the GPE + * number and mark the GPE as a WAKE GPE. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiEvGetGpeType ( + ACPI_HANDLE ObjHandle, + UINT32 Level, + void *Info, + void **ReturnValue) +{ + ACPI_GPE_WALK_INFO *GpeInfo = (void *) Info; + ACPI_NAMESPACE_NODE *GpeDevice; + ACPI_GPE_BLOCK_INFO *GpeBlock; + ACPI_NAMESPACE_NODE *TargetGpeDevice; + ACPI_GPE_EVENT_INFO *GpeEventInfo; + ACPI_OPERAND_OBJECT *PkgDesc; + ACPI_OPERAND_OBJECT *ObjDesc; + UINT32 GpeNumber; + ACPI_STATUS Status; + - Status = AcpiHwEnableGpe (GpeEventInfo); + ACPI_FUNCTION_TRACE ("EvGetGpeType"); + + + /* Check for a _PRW method under this device */ + + Status = AcpiUtEvaluateObject (ObjHandle, METHOD_NAME__PRW, + ACPI_BTYPE_PACKAGE, &PkgDesc); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + /* Ignore all errors from _PRW, we don't want to abort the subsystem */ + + return_ACPI_STATUS (AE_OK); } - ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, - "Registered GPE method %s as GPE number 0x%.2X\n", - Name, GpeNumber)); + /* The returned _PRW package must have at least two elements */ + + if (PkgDesc->Package.Count < 2) + { + goto Cleanup; + } + + /* Extract pointers from the input context */ + + GpeDevice = GpeInfo->GpeDevice; + GpeBlock = GpeInfo->GpeBlock; + + /* + * The _PRW object must return a package, we are only interested + * in the first element + */ + ObjDesc = PkgDesc->Package.Elements[0]; + + if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) + { + /* Use FADT-defined GPE device (from definition of _PRW) */ + + TargetGpeDevice = AcpiGbl_FadtGpeDevice; + + /* Integer is the GPE number in the FADT described GPE blocks */ + + GpeNumber = (UINT32) ObjDesc->Integer.Value; + } + else if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_PACKAGE) + { + /* Package contains a GPE reference and GPE number within a GPE block */ + + if ((ObjDesc->Package.Count < 2) || + (ACPI_GET_OBJECT_TYPE (ObjDesc->Package.Elements[0]) != ACPI_TYPE_LOCAL_REFERENCE) || + (ACPI_GET_OBJECT_TYPE (ObjDesc->Package.Elements[1]) != ACPI_TYPE_INTEGER)) + { + goto Cleanup; + } + + /* Get GPE block reference and decode */ + + TargetGpeDevice = ObjDesc->Package.Elements[0]->Reference.Node; + GpeNumber = (UINT32) ObjDesc->Package.Elements[1]->Integer.Value; + } + else + { + /* Unknown type, just ignore it */ + + goto Cleanup; + } + + /* + * Is this GPE within this block? + * + * TRUE iff these conditions are true: + * 1) The GPE devices match. + * 2) The GPE index(number) is within the range of the Gpe Block + * associated with the GPE device. + */ + if ((GpeDevice == TargetGpeDevice) && + (GpeNumber >= GpeBlock->BlockBaseNumber) && + (GpeNumber < GpeBlock->BlockBaseNumber + (GpeBlock->RegisterCount * 8))) + { + /* Mark GPE for WAKE but DISABLED (even for wake) */ + + GpeEventInfo = &GpeBlock->EventInfo[GpeNumber - GpeBlock->BlockBaseNumber]; + GpeEventInfo->Flags |= ACPI_GPE_TYPE_WAKE; + } + +Cleanup: + AcpiUtRemoveReference (PkgDesc); return_ACPI_STATUS (AE_OK); } @@ -810,8 +928,13 @@ AcpiEvCreateGpeBlock ( ACPI_GPE_BLOCK_INFO **ReturnGpeBlock) { ACPI_GPE_BLOCK_INFO *GpeBlock; + ACPI_GPE_EVENT_INFO *GpeEventInfo; + ACPI_NATIVE_UINT i; + ACPI_NATIVE_UINT j; + UINT32 WakeGpeCount; + UINT32 GpeEnabledCount; ACPI_STATUS Status; - + ACPI_GPE_WALK_INFO GpeInfo; ACPI_FUNCTION_TRACE ("EvCreateGpeBlock"); @@ -856,7 +979,8 @@ AcpiEvCreateGpeBlock ( /* Dump info about this GPE block */ - ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "GPE %02d to %02d [%4.4s] %d regs at %8.8X%8.8X on int %d\n", + ACPI_DEBUG_PRINT ((ACPI_DB_INIT, + "GPE %02d to %02d [%4.4s] %d regs at %8.8X%8.8X on int %d\n", GpeBlock->BlockBaseNumber, (UINT32) (GpeBlock->BlockBaseNumber + ((GpeBlock->RegisterCount * ACPI_GPE_REGISTER_WIDTH) -1)), @@ -868,8 +992,66 @@ AcpiEvCreateGpeBlock ( /* Find all GPE methods (_Lxx, _Exx) for this block */ Status = AcpiNsWalkNamespace (ACPI_TYPE_METHOD, GpeDevice, - ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, AcpiEvSaveMethodInfo, - GpeBlock, NULL); + ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, AcpiEvSaveMethodInfo, + GpeBlock, NULL); + + /* + * Runtime option: Should Wake GPEs be enabled at runtime? The default is + * No,they should only be enabled just as the machine goes to sleep. + */ + if (AcpiGbl_LeaveWakeGpesDisabled) + { + /* + * Differentiate RUNTIME vs WAKE GPEs, via the _PRW control methods. (Each + * GPE that has one or more _PRWs that reference it is by definition a + * WAKE GPE and will not be enabled while the machine is running.) + */ + GpeInfo.GpeBlock = GpeBlock; + GpeInfo.GpeDevice = GpeDevice; + + Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, AcpiEvGetGpeType, + &GpeInfo, NULL); + } + + /* + * Enable all GPEs in this block that are 1) "runtime" GPEs, and 2) have + * a corresponding _Lxx or _Exx method. All other GPEs must be enabled via + * the AcpiEnableGpe() external interface. + */ + WakeGpeCount = 0; + GpeEnabledCount = 0; + + for (i = 0; i < GpeBlock->RegisterCount; i++) + { + for (j = 0; j < 8; j++) + { + /* Get the info block for this particular GPE */ + + GpeEventInfo = &GpeBlock->EventInfo[(i * ACPI_GPE_REGISTER_WIDTH) + j]; + if ((GpeEventInfo->MethodNode) && + ((GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK) == ACPI_GPE_TYPE_RUNTIME)) + { + /* Enable this GPE, it is 1) RUNTIME and 2) has an _Lxx or _Exx method */ + + Status = AcpiHwEnableGpe (GpeEventInfo); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + GpeEnabledCount++; + } + + if ((GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK) == ACPI_GPE_TYPE_WAKE) + { + WakeGpeCount++; + } + } + } + + ACPI_DEBUG_PRINT ((ACPI_DB_INIT, + "Found %u Wake, Enabled %u Runtime GPEs in this block\n", + WakeGpeCount, GpeEnabledCount)); /* Return the new block */ @@ -895,28 +1077,26 @@ AcpiEvCreateGpeBlock ( ******************************************************************************/ ACPI_STATUS -AcpiEvGpeInitialize (void) +AcpiEvGpeInitialize ( + void) { UINT32 RegisterCount0 = 0; UINT32 RegisterCount1 = 0; UINT32 GpeNumberMax = 0; - ACPI_HANDLE GpeDevice; ACPI_STATUS Status; ACPI_FUNCTION_TRACE ("EvGpeInitialize"); - /* Get a handle to the predefined _GPE object */ - - Status = AcpiGetHandle (NULL, "\\_GPE", &GpeDevice); + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* - * Initialize the GPE Blocks defined in the FADT + * Initialize the GPE Block(s) defined in the FADT * * Why the GPE register block lengths are divided by 2: From the ACPI Spec, * section "General-Purpose Event Registers", we have: @@ -951,8 +1131,9 @@ AcpiEvGpeInitialize (void) /* Install GPE Block 0 */ - Status = AcpiEvCreateGpeBlock (GpeDevice, &AcpiGbl_FADT->XGpe0Blk, + Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice, &AcpiGbl_FADT->XGpe0Blk, RegisterCount0, 0, AcpiGbl_FADT->SciInt, &AcpiGbl_GpeFadtBlocks[0]); + if (ACPI_FAILURE (Status)) { ACPI_REPORT_ERROR (( @@ -987,9 +1168,10 @@ AcpiEvGpeInitialize (void) { /* Install GPE Block 1 */ - Status = AcpiEvCreateGpeBlock (GpeDevice, &AcpiGbl_FADT->XGpe1Blk, + Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice, &AcpiGbl_FADT->XGpe1Blk, RegisterCount1, AcpiGbl_FADT->Gpe1Base, AcpiGbl_FADT->SciInt, &AcpiGbl_GpeFadtBlocks[1]); + if (ACPI_FAILURE (Status)) { ACPI_REPORT_ERROR (( @@ -1013,7 +1195,8 @@ AcpiEvGpeInitialize (void) /* GPEs are not required by ACPI, this is OK */ ACPI_REPORT_INFO (("There are no GPE blocks defined in the FADT\n")); - return_ACPI_STATUS (AE_OK); + Status = AE_OK; + goto Cleanup; } /* Check for Max GPE number out-of-range */ @@ -1022,9 +1205,12 @@ AcpiEvGpeInitialize (void) { ACPI_REPORT_ERROR (("Maximum GPE number from FADT is too large: 0x%X\n", GpeNumberMax)); - return_ACPI_STATUS (AE_BAD_VALUE); + Status = AE_BAD_VALUE; + goto Cleanup; } +Cleanup: + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/evmisc.c b/sys/contrib/dev/acpica/evmisc.c index 5cfad40ef05a..932a6ad08343 100644 --- a/sys/contrib/dev/acpica/evmisc.c +++ b/sys/contrib/dev/acpica/evmisc.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evmisc - Miscellaneous event manager support functions - * $Revision: 70 $ + * $Revision: 72 $ * *****************************************************************************/ @@ -171,6 +171,20 @@ AcpiEvIsNotifyObject ( * ******************************************************************************/ +#ifdef ACPI_DEBUG_OUTPUT +static const char *AcpiNotifyValueNames[] = +{ + "Bus Check", + "Device Check", + "Device Wake", + "Eject request", + "Device Check Light", + "Frequency Mismatch", + "Bus Mode Mismatch", + "Power Fault" +}; +#endif + ACPI_STATUS AcpiEvQueueNotifyRequest ( ACPI_NAMESPACE_NODE *Node, @@ -186,7 +200,7 @@ AcpiEvQueueNotifyRequest ( /* - * For value 1 (Ejection Request), some device method may need to be run. + * For value 3 (Ejection Request), some device method may need to be run. * For value 2 (Device Wake) if _PRW exists, the _PS0 method may need to be run. * For value 0x80 (Status Change) on the power button or sleep button, * initiate soft-off or sleep operation? @@ -194,27 +208,15 @@ AcpiEvQueueNotifyRequest ( ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Dispatching Notify(%X) on node %p\n", NotifyValue, Node)); - switch (NotifyValue) + if (NotifyValue <= 7) { - case 0: - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: Re-enumerate Devices\n")); - break; - - case 1: - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: Ejection Request\n")); - break; - - case 2: - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: Device Wake\n")); - break; - - case 0x80: - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: Status Change\n")); - break; - - default: - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Unknown Notify Value: %X \n", NotifyValue)); - break; + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: %s\n", + AcpiNotifyValueNames[NotifyValue])); + } + else + { + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: 0x%2.2X **Device Specific**\n", + NotifyValue)); } /* diff --git a/sys/contrib/dev/acpica/evxfevnt.c b/sys/contrib/dev/acpica/evxfevnt.c index 1ae6d5c6bcf2..45d2c4973677 100644 --- a/sys/contrib/dev/acpica/evxfevnt.c +++ b/sys/contrib/dev/acpica/evxfevnt.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evxfevnt - External Interfaces, ACPI event disable/enable - * $Revision: 74 $ + * $Revision: 75 $ * *****************************************************************************/ @@ -337,18 +337,33 @@ AcpiEnableGpe ( goto UnlockAndExit; } - /* Enable the requested GPE number */ - - Status = AcpiHwEnableGpe (GpeEventInfo); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } + /* Check for Wake vs Runtime GPE */ if (Flags & ACPI_EVENT_WAKE_ENABLE) { + /* Ensure the requested wake GPE is disabled */ + + Status = AcpiHwDisableGpe (GpeEventInfo); + if (ACPI_FAILURE (Status)) + { + goto UnlockAndExit; + } + + /* Defer Enable of Wake GPE until sleep time */ + AcpiHwEnableGpeForWakeup (GpeEventInfo); } + else + { + /* Enable the requested runtime GPE */ + + Status = AcpiHwEnableGpe (GpeEventInfo); + if (ACPI_FAILURE (Status)) + { + goto UnlockAndExit; + } + } + UnlockAndExit: if (Flags & ACPI_NOT_ISR) diff --git a/sys/contrib/dev/acpica/excreate.c b/sys/contrib/dev/acpica/excreate.c index 8f4be4c36219..fb6e5ab4a660 100644 --- a/sys/contrib/dev/acpica/excreate.c +++ b/sys/contrib/dev/acpica/excreate.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: excreate - Named object creation - * $Revision: 102 $ + * $Revision: 103 $ * *****************************************************************************/ @@ -159,7 +159,8 @@ AcpiExCreateAlias ( AliasNode = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0]; TargetNode = (ACPI_NAMESPACE_NODE *) WalkState->Operands[1]; - if (TargetNode->Type == ACPI_TYPE_LOCAL_ALIAS) + if ((TargetNode->Type == ACPI_TYPE_LOCAL_ALIAS) || + (TargetNode->Type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) { /* * Dereference an existing alias so that we don't create a chain @@ -167,7 +168,7 @@ AcpiExCreateAlias ( * always exactly one level of indirection away from the * actual aliased name. */ - TargetNode = (ACPI_NAMESPACE_NODE *) TargetNode->Object; + TargetNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, TargetNode->Object); } /* @@ -194,6 +195,17 @@ AcpiExCreateAlias ( AliasNode->Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode); break; + case ACPI_TYPE_METHOD: + + /* + * The new alias has the type ALIAS and points to the original + * NS node, not the object itself. This is because for these + * types, the object can change dynamically via a Store. + */ + AliasNode->Type = ACPI_TYPE_LOCAL_METHOD_ALIAS; + AliasNode->Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode); + break; + default: /* Attach the original source object to the new Alias Node */ diff --git a/sys/contrib/dev/acpica/exdump.c b/sys/contrib/dev/acpica/exdump.c index 0ce82141c138..300433d02d46 100644 --- a/sys/contrib/dev/acpica/exdump.c +++ b/sys/contrib/dev/acpica/exdump.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exdump - Interpreter debug output routines - * $Revision: 172 $ + * $Revision: 173 $ * *****************************************************************************/ @@ -881,6 +881,7 @@ AcpiExDumpObjectDescriptor ( case ACPI_TYPE_LOCAL_ALIAS: + case ACPI_TYPE_LOCAL_METHOD_ALIAS: case ACPI_TYPE_LOCAL_EXTRA: case ACPI_TYPE_LOCAL_DATA: default: diff --git a/sys/contrib/dev/acpica/exfldio.c b/sys/contrib/dev/acpica/exfldio.c index bc97ace1c681..b3dddc21a45f 100644 --- a/sys/contrib/dev/acpica/exfldio.c +++ b/sys/contrib/dev/acpica/exfldio.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exfldio - Aml Field I/O - * $Revision: 103 $ + * $Revision: 104 $ * *****************************************************************************/ @@ -333,7 +333,7 @@ AcpiExAccessRegion ( } else if (Status == AE_NOT_EXIST) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + ACPI_REPORT_ERROR (( "Region %s(%X) has no handler\n", AcpiUtGetRegionName (RgnDesc->Region.SpaceId), RgnDesc->Region.SpaceId)); diff --git a/sys/contrib/dev/acpica/exresnte.c b/sys/contrib/dev/acpica/exresnte.c index 6ca27ed74059..63cc25cabdb8 100644 --- a/sys/contrib/dev/acpica/exresnte.c +++ b/sys/contrib/dev/acpica/exresnte.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exresnte - AML Interpreter object resolution - * $Revision: 64 $ + * $Revision: 65 $ * *****************************************************************************/ @@ -182,11 +182,12 @@ AcpiExResolveNodeToValue ( ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Entry=%p SourceDesc=%p [%s]\n", Node, SourceDesc, AcpiUtGetTypeName (EntryType))); - if (EntryType == ACPI_TYPE_LOCAL_ALIAS) + if ((EntryType == ACPI_TYPE_LOCAL_ALIAS) || + (EntryType == ACPI_TYPE_LOCAL_METHOD_ALIAS)) { /* There is always exactly one level of indirection */ - Node = (ACPI_NAMESPACE_NODE *) Node->Object; + Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Node->Object); SourceDesc = AcpiNsGetAttachedObject (Node); EntryType = AcpiNsGetType ((ACPI_HANDLE) Node); *ObjectPtr = Node; diff --git a/sys/contrib/dev/acpica/exstore.c b/sys/contrib/dev/acpica/exstore.c index a86d17ad812f..48c594c30598 100644 --- a/sys/contrib/dev/acpica/exstore.c +++ b/sys/contrib/dev/acpica/exstore.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exstore - AML Interpreter object store support - * $Revision: 180 $ + * $Revision: 181 $ * *****************************************************************************/ @@ -178,7 +178,8 @@ AcpiExStore ( * Storing an object into a Named node. */ Status = AcpiExStoreObjectToNode (SourceDesc, - (ACPI_NAMESPACE_NODE *) DestDesc, WalkState); + (ACPI_NAMESPACE_NODE *) DestDesc, WalkState, + ACPI_IMPLICIT_CONVERSION); return_ACPI_STATUS (Status); } @@ -232,7 +233,7 @@ AcpiExStore ( /* Storing an object into a Name "container" */ Status = AcpiExStoreObjectToNode (SourceDesc, RefDesc->Reference.Object, - WalkState); + WalkState, ACPI_IMPLICIT_CONVERSION); break; @@ -486,6 +487,7 @@ AcpiExStoreObjectToIndex ( * PARAMETERS: SourceDesc - Value to be stored * Node - Named object to receive the value * WalkState - Current walk state + * ImplicitConversion - Perform implicit conversion (yes/no) * * RETURN: Status * @@ -508,7 +510,8 @@ ACPI_STATUS AcpiExStoreObjectToNode ( ACPI_OPERAND_OBJECT *SourceDesc, ACPI_NAMESPACE_NODE *Node, - ACPI_WALK_STATE *WalkState) + ACPI_WALK_STATE *WalkState, + UINT8 ImplicitConversion) { ACPI_STATUS Status = AE_OK; ACPI_OPERAND_OBJECT *TargetDesc; @@ -539,6 +542,15 @@ AcpiExStoreObjectToNode ( return_ACPI_STATUS (Status); } + /* If no implicit conversion, drop into the default case below */ + + if (!ImplicitConversion) + { + /* Force execution of default (no implicit conversion) */ + + TargetType = ACPI_TYPE_ANY; + } + /* * Do the actual store operation */ diff --git a/sys/contrib/dev/acpica/exstoren.c b/sys/contrib/dev/acpica/exstoren.c index 92fc07c003c3..31aab5020a5e 100644 --- a/sys/contrib/dev/acpica/exstoren.c +++ b/sys/contrib/dev/acpica/exstoren.c @@ -3,7 +3,7 @@ * * Module Name: exstoren - AML Interpreter object store support, * Store to Node (namespace object) - * $Revision: 58 $ + * $Revision: 59 $ * *****************************************************************************/ @@ -217,6 +217,7 @@ AcpiExResolveObject ( case ACPI_TYPE_LOCAL_ALIAS: + case ACPI_TYPE_LOCAL_METHOD_ALIAS: /* * Aliases are resolved by AcpiExPrepOperands diff --git a/sys/contrib/dev/acpica/hwgpe.c b/sys/contrib/dev/acpica/hwgpe.c index 27d94ae24eb2..db2b43bdd4e1 100644 --- a/sys/contrib/dev/acpica/hwgpe.c +++ b/sys/contrib/dev/acpica/hwgpe.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: hwgpe - Low level GPE enable/disable/clear functions - * $Revision: 56 $ + * $Revision: 57 $ * *****************************************************************************/ @@ -126,9 +126,9 @@ * * FUNCTION: AcpiHwEnableGpe * - * PARAMETERS: GpeNumber - The GPE + * PARAMETERS: GpeEventInfo - Info block for the GPE to be enabled * - * RETURN: None + * RETURN: Status * * DESCRIPTION: Enable a single GPE. * @@ -169,7 +169,7 @@ AcpiHwEnableGpe ( * * FUNCTION: AcpiHwEnableGpeForWakeup * - * PARAMETERS: GpeNumber - The GPE + * PARAMETERS: GpeEventInfo - Info block for the GPE to be enabled * * RETURN: None * @@ -197,9 +197,11 @@ AcpiHwEnableGpeForWakeup ( } /* - * Set the bit so we will not disable this when sleeping + * Set the bit so we will not enable this GPE when sleeping (and disable + * it upon wake) */ GpeRegisterInfo->WakeEnable |= GpeEventInfo->BitMask; + GpeEventInfo->Flags |= (ACPI_GPE_TYPE_WAKE | ACPI_GPE_ENABLED); } @@ -207,9 +209,9 @@ AcpiHwEnableGpeForWakeup ( * * FUNCTION: AcpiHwDisableGpe * - * PARAMETERS: GpeNumber - The GPE + * PARAMETERS: GpeEventInfo - Info block for the GPE to be disabled * - * RETURN: None + * RETURN: Status * * DESCRIPTION: Disable a single GPE. * @@ -255,6 +257,8 @@ AcpiHwDisableGpe ( return (Status); } + /* Make sure this GPE is disabled for wake, also */ + AcpiHwDisableGpeForWakeup (GpeEventInfo); return (AE_OK); } @@ -264,7 +268,7 @@ AcpiHwDisableGpe ( * * FUNCTION: AcpiHwDisableGpeForWakeup * - * PARAMETERS: GpeNumber - The GPE + * PARAMETERS: GpeEventInfo - Info block for the GPE to be disabled * * RETURN: None * @@ -291,9 +295,8 @@ AcpiHwDisableGpeForWakeup ( return; } - /* - * Clear the bit so we will disable this when sleeping - */ + /* Clear the bit so we will disable this when sleeping */ + GpeRegisterInfo->WakeEnable &= ~(GpeEventInfo->BitMask); } @@ -302,11 +305,11 @@ AcpiHwDisableGpeForWakeup ( * * FUNCTION: AcpiHwClearGpe * - * PARAMETERS: GpeNumber - The GPE + * PARAMETERS: GpeEventInfo - Info block for the GPE to be cleared * - * RETURN: None + * RETURN: StatusStatus * - * DESCRIPTION: Clear a single GPE. + * DESCRIPTION: Clear the status bit for a single GPE. * ******************************************************************************/ @@ -335,9 +338,10 @@ AcpiHwClearGpe ( * * FUNCTION: AcpiHwGetGpeStatus * - * PARAMETERS: GpeNumber - The GPE + * PARAMETERS: GpeEventInfo - Info block for the GPE to queried + * EventStatus - Where the GPE status is returned * - * RETURN: None + * RETURN: Status * * DESCRIPTION: Return the status of a single GPE. * @@ -463,7 +467,7 @@ AcpiHwDisableGpeBlock ( * * RETURN: Status * - * DESCRIPTION: Clear all GPEs within a GPE block + * DESCRIPTION: Clear status bits for all GPEs within a GPE block * ******************************************************************************/ @@ -480,7 +484,7 @@ AcpiHwClearGpeBlock ( for (i = 0; i < GpeBlock->RegisterCount; i++) { - /* Clear all GPEs in this register */ + /* Clear status on all GPEs in this register */ Status = AcpiHwLowLevelWrite (8, 0xFF, &GpeBlock->RegisterInfo[i].StatusAddress); @@ -496,19 +500,20 @@ AcpiHwClearGpeBlock ( /****************************************************************************** * - * FUNCTION: AcpiHwDisableNonWakeupGpeBlock + * FUNCTION: AcpiHwPrepareGpeBlockForSleep * * PARAMETERS: GpeXruptInfo - GPE Interrupt info * GpeBlock - Gpe Block info * * RETURN: Status * - * DESCRIPTION: Disable all GPEs except wakeup GPEs in a GPE block + * DESCRIPTION: Disable all runtime GPEs and enable all wakeup GPEs -- within + * a single GPE block * ******************************************************************************/ static ACPI_STATUS -AcpiHwDisableNonWakeupGpeBlock ( +AcpiHwPrepareGpeBlockForSleep ( ACPI_GPE_XRUPT_INFO *GpeXruptInfo, ACPI_GPE_BLOCK_INFO *GpeBlock) { @@ -527,8 +532,11 @@ AcpiHwDisableNonWakeupGpeBlock ( for (i = 0; i < GpeBlock->RegisterCount; i++) { /* - * Read the enabled status of all GPEs. We + * Read the enabled/disabled status of all GPEs. We * will be using it to restore all the GPEs later. + * + * NOTE: Wake GPEs are are ALL disabled at this time, so when we wake + * and restore this register, they will be automatically disabled. */ Status = AcpiHwLowLevelRead (8, &InValue, &GpeRegisterInfo->EnableAddress); @@ -540,7 +548,8 @@ AcpiHwDisableNonWakeupGpeBlock ( GpeRegisterInfo->Enable = (UINT8) InValue; /* - * Disable all GPEs except wakeup GPEs. + * 1) Disable all runtime GPEs + * 2) Enable all wakeup GPEs */ Status = AcpiHwLowLevelWrite (8, GpeRegisterInfo->WakeEnable, &GpeRegisterInfo->EnableAddress); @@ -549,6 +558,8 @@ AcpiHwDisableNonWakeupGpeBlock ( return (Status); } + /* Point to next GPE register */ + GpeRegisterInfo++; } @@ -558,22 +569,22 @@ AcpiHwDisableNonWakeupGpeBlock ( /****************************************************************************** * - * FUNCTION: AcpiHwDisableNonWakeupGpes + * FUNCTION: AcpiHwPrepareGpesForSleep * * PARAMETERS: None * - * RETURN: None + * RETURN: Status * - * DESCRIPTION: Disable all non-wakeup GPEs + * DESCRIPTION: Disable all runtime GPEs, enable all wake GPEs. * Called with interrupts disabled. The interrupt handler also * modifies GpeRegisterInfo->Enable, so it should not be - * given the chance to run until after non-wake GPEs are + * given the chance to run until after the runtime GPEs are * re-enabled. * ******************************************************************************/ ACPI_STATUS -AcpiHwDisableNonWakeupGpes ( +AcpiHwPrepareGpesForSleep ( void) { ACPI_STATUS Status; @@ -582,27 +593,27 @@ AcpiHwDisableNonWakeupGpes ( ACPI_FUNCTION_ENTRY (); - Status = AcpiEvWalkGpeList (AcpiHwDisableNonWakeupGpeBlock); - + Status = AcpiEvWalkGpeList (AcpiHwPrepareGpeBlockForSleep); return (Status); } /****************************************************************************** * - * FUNCTION: AcpiHwEnableNonWakeupGpeBlock + * FUNCTION: AcpiHwRestoreGpeBlockOnWake * * PARAMETERS: GpeXruptInfo - GPE Interrupt info * GpeBlock - Gpe Block info * * RETURN: Status * - * DESCRIPTION: Enable a single GPE. + * DESCRIPTION: Enable all runtime GPEs and disable all wake GPEs -- in one + * GPE block * ******************************************************************************/ static ACPI_STATUS -AcpiHwEnableNonWakeupGpeBlock ( +AcpiHwRestoreGpeBlockOnWake ( ACPI_GPE_XRUPT_INFO *GpeXruptInfo, ACPI_GPE_BLOCK_INFO *GpeBlock) { @@ -631,8 +642,12 @@ AcpiHwEnableNonWakeupGpeBlock ( } /* - * We previously stored the enabled status of all GPEs. - * Blast them back in. + * Restore the GPE Enable register, which will do the following: + * + * 1) Disable all wakeup GPEs + * 2) Enable all runtime GPEs + * + * (On sleep, we saved the enabled status of all GPEs) */ Status = AcpiHwLowLevelWrite (8, GpeRegisterInfo->Enable, &GpeRegisterInfo->EnableAddress); @@ -641,28 +656,30 @@ AcpiHwEnableNonWakeupGpeBlock ( return (Status); } + /* Point to next GPE register */ + GpeRegisterInfo++; } - return (AE_OK); } /****************************************************************************** * - * FUNCTION: AcpiHwEnableNonWakeupGpes + * FUNCTION: AcpiHwRestoreGpesOnWake * * PARAMETERS: None * - * RETURN: None + * RETURN: Status * - * DESCRIPTION: Enable all non-wakeup GPEs we previously enabled. + * DESCRIPTION: Enable all runtime GPEs and disable all wake GPEs -- in all + * GPE blocks * ******************************************************************************/ ACPI_STATUS -AcpiHwEnableNonWakeupGpes ( +AcpiHwRestoreGpesOnWake ( void) { ACPI_STATUS Status; @@ -671,7 +688,6 @@ AcpiHwEnableNonWakeupGpes ( ACPI_FUNCTION_ENTRY (); - Status = AcpiEvWalkGpeList (AcpiHwEnableNonWakeupGpeBlock); - + Status = AcpiEvWalkGpeList (AcpiHwRestoreGpeBlockOnWake); return (Status); } diff --git a/sys/contrib/dev/acpica/hwsleep.c b/sys/contrib/dev/acpica/hwsleep.c index 1c0ba84c8dc6..13224c72494c 100644 --- a/sys/contrib/dev/acpica/hwsleep.c +++ b/sys/contrib/dev/acpica/hwsleep.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface - * $Revision: 65 $ + * $Revision: 66 $ * *****************************************************************************/ @@ -374,7 +374,11 @@ AcpiEnterSleepState ( } } - Status = AcpiHwDisableNonWakeupGpes (); + /* + * 1) Disable all runtime GPEs + * 2) Enable all wakeup GPEs + */ + Status = AcpiHwPrepareGpesForSleep (); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -515,7 +519,11 @@ AcpiEnterSleepStateS4bios ( return_ACPI_STATUS (Status); } - Status = AcpiHwDisableNonWakeupGpes (); + /* + * 1) Disable all runtime GPEs + * 2) Enable all wakeup GPEs + */ + Status = AcpiHwPrepareGpesForSleep (); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -635,10 +643,14 @@ AcpiLeaveSleepState ( { ACPI_REPORT_ERROR (("Method _WAK failed, %s\n", AcpiFormatException (Status))); } + /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */ - /* _WAK returns stuff - do we want to look at it? */ - - Status = AcpiHwEnableNonWakeupGpes (); + /* + * Restore the GPEs: + * 1) Disable all wakeup GPEs + * 2) Enable all runtime GPEs + */ + Status = AcpiHwRestoreGpesOnWake (); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); diff --git a/sys/contrib/dev/acpica/nsaccess.c b/sys/contrib/dev/acpica/nsaccess.c index a01b22d3a158..d602e5bc3399 100644 --- a/sys/contrib/dev/acpica/nsaccess.c +++ b/sys/contrib/dev/acpica/nsaccess.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: nsaccess - Top-level functions for accessing ACPI namespace - * $Revision: 179 $ + * $Revision: 180 $ * ******************************************************************************/ @@ -335,6 +335,15 @@ AcpiNsRootInitialize (void) UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + + /* Save a handle to "_GPE", it is always present */ + + if (ACPI_SUCCESS (Status)) + { + Status = AcpiNsGetNodeByPath ("\\_GPE", NULL, ACPI_NS_NO_UPSEARCH, + &AcpiGbl_FadtGpeDevice); + } + return_ACPI_STATUS (Status); } @@ -685,6 +694,7 @@ AcpiNsLookup ( if ((NumSegments == 0) && (TypeToCheckFor != ACPI_TYPE_ANY) && (TypeToCheckFor != ACPI_TYPE_LOCAL_ALIAS) && + (TypeToCheckFor != ACPI_TYPE_LOCAL_METHOD_ALIAS) && (TypeToCheckFor != ACPI_TYPE_LOCAL_SCOPE) && (ThisNode->Type != ACPI_TYPE_ANY) && (ThisNode->Type != TypeToCheckFor)) diff --git a/sys/contrib/dev/acpica/nsdump.c b/sys/contrib/dev/acpica/nsdump.c index 1558421c688c..2a01996099bc 100644 --- a/sys/contrib/dev/acpica/nsdump.c +++ b/sys/contrib/dev/acpica/nsdump.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nsdump - table dumping routines for debug - * $Revision: 157 $ + * $Revision: 158 $ * *****************************************************************************/ @@ -447,6 +447,7 @@ AcpiNsDumpOneObject ( case ACPI_TYPE_LOCAL_ALIAS: + case ACPI_TYPE_LOCAL_METHOD_ALIAS: AcpiOsPrintf ("Target %4.4s (%p)\n", AcpiUtGetNodeName (ObjDesc), ObjDesc); break; diff --git a/sys/contrib/dev/acpica/nseval.c b/sys/contrib/dev/acpica/nseval.c index cb509d3ae6cc..688f92b60cfb 100644 --- a/sys/contrib/dev/acpica/nseval.c +++ b/sys/contrib/dev/acpica/nseval.c @@ -2,7 +2,7 @@ * * Module Name: nseval - Object evaluation interfaces -- includes control * method lookup and execution. - * $Revision: 124 $ + * $Revision: 125 $ * ******************************************************************************/ @@ -401,6 +401,16 @@ AcpiNsEvaluateByHandle ( } /* + * For a method alias, we must grab the actual method node + * so that proper scoping context will be established + * before execution. + */ + if (AcpiNsGetType (Node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) + { + Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Node->Object); + } + + /* * Two major cases here: * 1) The object is an actual control method -- execute it. * 2) The object is not a method -- just return it's current diff --git a/sys/contrib/dev/acpica/nssearch.c b/sys/contrib/dev/acpica/nssearch.c index 8616277a80e7..03f6cc435ca0 100644 --- a/sys/contrib/dev/acpica/nssearch.c +++ b/sys/contrib/dev/acpica/nssearch.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: nssearch - Namespace search - * $Revision: 100 $ + * $Revision: 101 $ * ******************************************************************************/ @@ -191,6 +191,13 @@ AcpiNsSearchNode ( if (NextNode->Name.Integer == TargetName) { + /* Resolve a control method alias if any */ + + if (AcpiNsGetType (NextNode) == ACPI_TYPE_LOCAL_METHOD_ALIAS) + { + NextNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, NextNode->Object); + } + /* * Found matching entry. */ diff --git a/sys/contrib/dev/acpica/nsutils.c b/sys/contrib/dev/acpica/nsutils.c index b06ab99d1b8a..e8eb69101f33 100644 --- a/sys/contrib/dev/acpica/nsutils.c +++ b/sys/contrib/dev/acpica/nsutils.c @@ -2,7 +2,7 @@ * * Module Name: nsutils - Utilities for accessing ACPI namespace, accessing * parents and siblings and Scope manipulation - * $Revision: 133 $ + * $Revision: 134 $ * *****************************************************************************/ @@ -341,7 +341,7 @@ AcpiNsGetType ( if (!Node) { - ACPI_REPORT_WARNING (("NsGetType: Null Node ptr")); + ACPI_REPORT_WARNING (("NsGetType: Null Node input pointer\n")); return_VALUE (ACPI_TYPE_ANY); } diff --git a/sys/contrib/dev/acpica/nsxfeval.c b/sys/contrib/dev/acpica/nsxfeval.c index cc75b68c98da..4184bffd0b70 100644 --- a/sys/contrib/dev/acpica/nsxfeval.c +++ b/sys/contrib/dev/acpica/nsxfeval.c @@ -2,7 +2,7 @@ * * Module Name: nsxfeval - Public interfaces to the ACPI subsystem * ACPI Object evaluation interfaces - * $Revision: 11 $ + * $Revision: 12 $ * ******************************************************************************/ @@ -120,6 +120,7 @@ #include "acpi.h" #include "acnamesp.h" +#include "acinterp.h" #define _COMPONENT ACPI_NAMESPACE @@ -231,11 +232,11 @@ AcpiEvaluateObjectTyped ( * FUNCTION: AcpiEvaluateObject * * PARAMETERS: Handle - Object handle (optional) - * *Pathname - Object pathname (optional) - * **ExternalParams - List of parameters to pass to method, + * Pathname - Object pathname (optional) + * ExternalParams - List of parameters to pass to method, * terminated by NULL. May be NULL * if no parameters are being passed. - * *ReturnBuffer - Where to put method's return value (if + * ReturnBuffer - Where to put method's return value (if * any). If NULL, no value is returned. * * RETURN: Status @@ -254,6 +255,7 @@ AcpiEvaluateObject ( ACPI_BUFFER *ReturnBuffer) { ACPI_STATUS Status; + ACPI_STATUS Status2; ACPI_OPERAND_OBJECT **InternalParams = NULL; ACPI_OPERAND_OBJECT *InternalReturnObj = NULL; ACPI_SIZE BufferSpaceNeeded; @@ -288,7 +290,7 @@ AcpiEvaluateObject ( for (i = 0; i < ExternalParams->Count; i++) { Status = AcpiUtCopyEobjectToIobject (&ExternalParams->Pointer[i], - &InternalParams[i]); + &InternalParams[i]); if (ACPI_FAILURE (Status)) { AcpiUtDeleteInternalObjectList (InternalParams); @@ -422,15 +424,22 @@ AcpiEvaluateObject ( } } - /* Delete the return and parameter objects */ - if (InternalReturnObj) { - /* - * Delete the internal return object. (Or at least - * decrement the reference count by one) + /* + * Delete the internal return object. NOTE: Interpreter + * must be locked to avoid race condition. */ - AcpiUtRemoveReference (InternalReturnObj); + Status2 = AcpiExEnterInterpreter (); + if (ACPI_SUCCESS (Status2)) + { + /* + * Delete the internal return object. (Or at least + * decrement the reference count by one) + */ + AcpiUtRemoveReference (InternalReturnObj); + AcpiExExitInterpreter (); + } } /* diff --git a/sys/contrib/dev/acpica/rsaddr.c b/sys/contrib/dev/acpica/rsaddr.c index 50fdec399caa..938e85ed699e 100644 --- a/sys/contrib/dev/acpica/rsaddr.c +++ b/sys/contrib/dev/acpica/rsaddr.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsaddr - Address resource descriptors (16/32/64) - * $Revision: 34 $ + * $Revision: 35 $ * ******************************************************************************/ @@ -162,6 +162,7 @@ AcpiRsAddress16Resource ( ACPI_FUNCTION_TRACE ("RsAddress16Resource"); + /* * Point past the Descriptor to get the number of bytes consumed */ @@ -226,7 +227,7 @@ AcpiRsAddress16Resource ( OutputStruct->Data.Address16.Attribute.Memory.ReadWriteAttribute = (UINT16) (Temp8 & 0x01); OutputStruct->Data.Address16.Attribute.Memory.CacheAttribute = - (UINT16) ((Temp8 >> 1) & 0x0F); + (UINT16) ((Temp8 >> 1) & 0x03); } else { @@ -431,7 +432,7 @@ AcpiRsAddress16Stream ( Temp8 |= (LinkedList->Data.Address16.Attribute.Memory.CacheAttribute & - 0x0F) << 1; + 0x03) << 1; } else if (ACPI_IO_RANGE == LinkedList->Data.Address16.ResourceType) { @@ -628,7 +629,7 @@ AcpiRsAddress32Resource ( (UINT16) (Temp8 & 0x01); OutputStruct->Data.Address32.Attribute.Memory.CacheAttribute = - (UINT16) ((Temp8 >> 1) & 0x0F); + (UINT16) ((Temp8 >> 1) & 0x03); } else { @@ -831,7 +832,7 @@ AcpiRsAddress32Stream ( Temp8 |= (LinkedList->Data.Address32.Attribute.Memory.CacheAttribute & - 0x0F) << 1; + 0x03) << 1; } else if (ACPI_IO_RANGE == LinkedList->Data.Address32.ResourceType) { @@ -1027,7 +1028,7 @@ AcpiRsAddress64Resource ( (UINT16) (Temp8 & 0x01); OutputStruct->Data.Address64.Attribute.Memory.CacheAttribute = - (UINT16) ((Temp8 >> 1) & 0x0F); + (UINT16) ((Temp8 >> 1) & 0x03); } else { @@ -1232,7 +1233,7 @@ AcpiRsAddress64Stream ( Temp8 |= (LinkedList->Data.Address64.Attribute.Memory.CacheAttribute & - 0x0F) << 1; + 0x03) << 1; } else if (ACPI_IO_RANGE == LinkedList->Data.Address64.ResourceType) { diff --git a/sys/contrib/dev/acpica/utglobal.c b/sys/contrib/dev/acpica/utglobal.c index d3ad37a27c53..0db55dee0c7c 100644 --- a/sys/contrib/dev/acpica/utglobal.c +++ b/sys/contrib/dev/acpica/utglobal.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utglobal - Global variables for the ACPI subsystem - * $Revision: 194 $ + * $Revision: 198 $ * *****************************************************************************/ @@ -334,14 +334,15 @@ const UINT8 AcpiGbl_NsProperties[] = ACPI_NS_NORMAL, /* 19 IndexField */ ACPI_NS_NORMAL, /* 20 Reference */ ACPI_NS_NORMAL, /* 21 Alias */ - ACPI_NS_NORMAL, /* 22 Notify */ - ACPI_NS_NORMAL, /* 23 Address Handler */ - ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 24 Resource Desc */ - ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Field */ - ACPI_NS_NEWSCOPE, /* 26 Scope */ - ACPI_NS_NORMAL, /* 27 Extra */ - ACPI_NS_NORMAL, /* 28 Data */ - ACPI_NS_NORMAL /* 29 Invalid */ + ACPI_NS_NORMAL, /* 22 MethodAlias */ + ACPI_NS_NORMAL, /* 23 Notify */ + ACPI_NS_NORMAL, /* 24 Address Handler */ + ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Desc */ + ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 26 Resource Field */ + ACPI_NS_NEWSCOPE, /* 27 Scope */ + ACPI_NS_NORMAL, /* 28 Extra */ + ACPI_NS_NORMAL, /* 29 Data */ + ACPI_NS_NORMAL /* 30 Invalid */ }; @@ -582,14 +583,15 @@ static const char *AcpiGbl_NsTypeNames[] = /* printable names of AC /* 19 */ "IndexField", /* 20 */ "Reference", /* 21 */ "Alias", - /* 22 */ "Notify", - /* 23 */ "AddrHandler", - /* 24 */ "ResourceDesc", - /* 25 */ "ResourceFld", - /* 26 */ "Scope", - /* 27 */ "Extra", - /* 28 */ "Data", - /* 39 */ "Invalid" + /* 22 */ "MethodAlias", + /* 23 */ "Notify", + /* 24 */ "AddrHandler", + /* 25 */ "ResourceDesc", + /* 26 */ "ResourceFld", + /* 27 */ "Scope", + /* 28 */ "Extra", + /* 29 */ "Data", + /* 30 */ "Invalid" }; @@ -637,26 +639,40 @@ char * AcpiUtGetNodeName ( void *Object) { - ACPI_NAMESPACE_NODE *Node; + ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) Object; + /* Must return a string of exactly 4 characters == ACPI_NAME_SIZE */ + if (!Object) { - return ("NULL NODE"); + return ("NULL"); + } + + /* Check for Root node */ + + if ((Object == ACPI_ROOT_OBJECT) || + (Object == AcpiGbl_RootNode)) + { + return ("\"\\\" "); } - Node = (ACPI_NAMESPACE_NODE *) Object; + /* Descriptor must be a namespace node */ if (Node->Descriptor != ACPI_DESC_TYPE_NAMED) { - return ("****"); + return ("####"); } + /* Name must be a valid ACPI name */ + if (!AcpiUtValidAcpiName (* (UINT32 *) Node->Name.Ascii)) { - return ("----"); + return ("????"); } + /* Return the name */ + return (Node->Name.Ascii); } @@ -859,10 +875,6 @@ AcpiUtInitGlobals ( ACPI_FUNCTION_TRACE ("UtInitGlobals"); - /* Runtime configuration */ - - AcpiGbl_CreateOsiMethod = TRUE; - AcpiGbl_AllMethodsSerialized = FALSE; /* Memory allocation and cache lists */ diff --git a/sys/contrib/dev/acpica/utmisc.c b/sys/contrib/dev/acpica/utmisc.c index 3c4f19eba02f..3727002e25eb 100644 --- a/sys/contrib/dev/acpica/utmisc.c +++ b/sys/contrib/dev/acpica/utmisc.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: utmisc - common utility procedures - * $Revision: 99 $ + * $Revision: 100 $ * ******************************************************************************/ @@ -636,6 +636,7 @@ AcpiUtStrupr ( return (SrcString); } + /******************************************************************************* * * FUNCTION: AcpiUtMutexInitialize @@ -671,10 +672,8 @@ AcpiUtMutexInitialize ( } } - Status = AcpiOsCreateLock (&AcpiGbl_GpeLock); - - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS (Status); } |