diff options
author | msmith <msmith@FreeBSD.org> | 2001-11-28 04:29:40 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 2001-11-28 04:29:40 +0000 |
commit | 78af3c27c3ad5c006fccb4da47d94b0b4a6e41a5 (patch) | |
tree | 0c31c343a3bcd338031dfa7ffecb38450cabc5ef | |
parent | d03f718884612e91eef85c79832b389a30988784 (diff) | |
parent | fe76969b7da935c578de24725d0e86947a339135 (diff) | |
download | FreeBSD-src-78af3c27c3ad5c006fccb4da47d94b0b4a6e41a5.zip FreeBSD-src-78af3c27c3ad5c006fccb4da47d94b0b4a6e41a5.tar.gz |
This commit was generated by cvs2svn to compensate for changes in r87031,
which included commits to RCS files with non-trunk default branches.
89 files changed, 3280 insertions, 3982 deletions
diff --git a/sys/contrib/dev/acpica/acdispat.h b/sys/contrib/dev/acpica/acdispat.h index cb357d6..d62f237 100644 --- a/sys/contrib/dev/acpica/acdispat.h +++ b/sys/contrib/dev/acpica/acdispat.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acdispat.h - dispatcher (parser to interpreter interface) - * $Revision: 45 $ + * $Revision: 48 $ * *****************************************************************************/ @@ -214,6 +214,11 @@ AcpiDsCreateBufferField ( ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState); +ACPI_STATUS +AcpiDsInitFieldObjects ( + ACPI_PARSE_OBJECT *Op, + ACPI_WALK_STATE *WalkState); + /* dsload - Parser/Interpreter interface, namespace load callbacks */ @@ -291,18 +296,19 @@ AcpiDsMethodDataInitArgs ( UINT32 MaxParamCount, ACPI_WALK_STATE *WalkState); -ACPI_NAMESPACE_NODE * +ACPI_STATUS AcpiDsMethodDataGetNode ( UINT16 Opcode, UINT32 Index, - ACPI_WALK_STATE *WalkState); + ACPI_WALK_STATE *WalkState, + ACPI_NAMESPACE_NODE **Node); ACPI_STATUS AcpiDsMethodDataInit ( ACPI_WALK_STATE *WalkState); ACPI_STATUS -AcpiDsMethodDataSetEntry ( +AcpiDsMethodDataSetValue ( UINT16 Opcode, UINT32 Index, ACPI_OPERAND_OBJECT *Object, @@ -317,7 +323,7 @@ AcpiDsParseMethod ( ACPI_STATUS AcpiDsCallControlMethod ( - ACPI_WALK_LIST *WalkList, + ACPI_THREAD_STATE *Thread, ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op); @@ -422,15 +428,6 @@ ACPI_STATUS AcpiDsResolveOperands ( ACPI_WALK_STATE *WalkState); -ACPI_OBJECT_TYPE8 -AcpiDsMapOpcodeToDataType ( - UINT16 Opcode, - UINT32 *OutFlags); - -ACPI_OBJECT_TYPE8 -AcpiDsMapNamedOpcodeToDataType ( - UINT16 Opcode); - /* * dswscope - Scope Stack manipulation @@ -459,7 +456,7 @@ AcpiDsCreateWalkState ( ACPI_OWNER_ID OwnerId, ACPI_PARSE_OBJECT *Origin, ACPI_OPERAND_OBJECT *MthDesc, - ACPI_WALK_LIST *WalkList); + ACPI_THREAD_STATE *Thread); ACPI_STATUS AcpiDsInitAmlWalk ( @@ -487,12 +484,12 @@ AcpiDsDeleteWalkState ( ACPI_WALK_STATE * AcpiDsPopWalkState ( - ACPI_WALK_LIST *WalkList); + ACPI_THREAD_STATE *Thread); void AcpiDsPushWalkState ( ACPI_WALK_STATE *WalkState, - ACPI_WALK_LIST *WalkList); + ACPI_THREAD_STATE *Thread); ACPI_STATUS AcpiDsResultStackPop ( @@ -508,7 +505,7 @@ AcpiDsResultStackClear ( ACPI_WALK_STATE * AcpiDsGetCurrentWalkState ( - ACPI_WALK_LIST *WalkList); + ACPI_THREAD_STATE *Thread); void AcpiDsDeleteWalkStateCache ( diff --git a/sys/contrib/dev/acpica/acevents.h b/sys/contrib/dev/acpica/acevents.h index 9ef26b7..c9045af 100644 --- a/sys/contrib/dev/acpica/acevents.h +++ b/sys/contrib/dev/acpica/acevents.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acevents.h - Event subcomponent prototypes and defines - * $Revision: 66 $ + * $Revision: 67 $ * *****************************************************************************/ @@ -205,8 +205,7 @@ AcpiEvAddressSpaceDispatch ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - UINT32 *Value); - + ACPI_INTEGER *Value); ACPI_STATUS AcpiEvAddrHandlerHelper ( @@ -220,7 +219,6 @@ AcpiEvDisassociateRegionFromHandler( ACPI_OPERAND_OBJECT *RegionObj, BOOLEAN AcpiNsIsLocked); - ACPI_STATUS AcpiEvAssociateRegionAndHandler ( ACPI_OPERAND_OBJECT *HandlerObj, diff --git a/sys/contrib/dev/acpica/acexcep.h b/sys/contrib/dev/acpica/acexcep.h index 44bc2cb..278dc51 100644 --- a/sys/contrib/dev/acpica/acexcep.h +++ b/sys/contrib/dev/acpica/acexcep.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acexcep.h - Exception codes returned by the ACPI subsystem - * $Revision: 50 $ + * $Revision: 53 $ * *****************************************************************************/ @@ -145,7 +145,7 @@ #define AE_NO_MEMORY (ACPI_STATUS) (0x0004 | AE_CODE_ENVIRONMENTAL) #define AE_NOT_FOUND (ACPI_STATUS) (0x0005 | AE_CODE_ENVIRONMENTAL) #define AE_NOT_EXIST (ACPI_STATUS) (0x0006 | AE_CODE_ENVIRONMENTAL) -#define AE_EXIST (ACPI_STATUS) (0x0007 | AE_CODE_ENVIRONMENTAL) +#define AE_ALREADY_EXISTS (ACPI_STATUS) (0x0007 | AE_CODE_ENVIRONMENTAL) #define AE_TYPE (ACPI_STATUS) (0x0008 | AE_CODE_ENVIRONMENTAL) #define AE_NULL_OBJECT (ACPI_STATUS) (0x0009 | AE_CODE_ENVIRONMENTAL) #define AE_NULL_ENTRY (ACPI_STATUS) (0x000A | AE_CODE_ENVIRONMENTAL) @@ -220,8 +220,10 @@ #define AE_AML_MUTEX_ORDER (ACPI_STATUS) (0x0017 | AE_CODE_AML) #define AE_AML_MUTEX_NOT_ACQUIRED (ACPI_STATUS) (0x0018 | AE_CODE_AML) #define AE_AML_INVALID_RESOURCE_TYPE (ACPI_STATUS) (0x0019 | AE_CODE_AML) +#define AE_AML_INVALID_INDEX (ACPI_STATUS) (0x001A | AE_CODE_AML) +#define AE_AML_REGISTER_LIMIT (ACPI_STATUS) (0x001B | AE_CODE_AML) -#define AE_CODE_AML_MAX 0x0019 +#define AE_CODE_AML_MAX 0x001B /* * Internal exceptions used for control @@ -253,7 +255,7 @@ NATIVE_CHAR const *AcpiGbl_ExceptionNames_Env[] = "AE_NO_MEMORY", "AE_NOT_FOUND", "AE_NOT_EXIST", - "AE_EXIST", + "AE_ALREADY_EXISTS", "AE_TYPE", "AE_NULL_OBJECT", "AE_NULL_ENTRY", @@ -319,6 +321,8 @@ NATIVE_CHAR const *AcpiGbl_ExceptionNames_Aml[] = "AE_AML_MUTEX_ORDER", "AE_AML_MUTEX_NOT_ACQUIRED", "AE_AML_INVALID_RESOURCE_TYPE", + "AE_AML_INVALID_INDEX", + "AE_AML_REGISTER_LIMIT", }; NATIVE_CHAR const *AcpiGbl_ExceptionNames_Ctrl[] = diff --git a/sys/contrib/dev/acpica/acglobal.h b/sys/contrib/dev/acpica/acglobal.h index bf05740..62d938b 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: 106 $ + * $Revision: 109 $ * *****************************************************************************/ @@ -221,7 +221,6 @@ ACPI_EXTERN BOOLEAN AcpiGbl_AcpiHardwarePresent; ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockPresent; extern BOOLEAN AcpiGbl_Shutdown; -extern UINT32 AcpiGbl_SystemFlags; extern UINT32 AcpiGbl_StartupFlags; extern const UINT8 AcpiGbl_DecodeTo8bit[8]; extern const NATIVE_CHAR *AcpiGbl_DbSleepStates[ACPI_NUM_SLEEP_STATES]; @@ -259,11 +258,7 @@ ACPI_EXTERN UINT32 AcpiGbl_DeepestNesting; ****************************************************************************/ -ACPI_EXTERN ACPI_WALK_LIST *AcpiGbl_CurrentWalkList; - -/* Address Space handlers */ - -ACPI_EXTERN ACPI_ADR_SPACE_INFO AcpiGbl_AddressSpaces[ACPI_NUM_ADDRESS_SPACES]; +ACPI_EXTERN ACPI_THREAD_STATE *AcpiGbl_CurrentWalkList; /* Control method single step flag */ diff --git a/sys/contrib/dev/acpica/acinterp.h b/sys/contrib/dev/acpica/acinterp.h index 373136d..a917e15 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: 116 $ + * $Revision: 122 $ * *****************************************************************************/ @@ -118,24 +118,7 @@ #define __ACINTERP_H__ -#define WALK_OPERANDS &(WalkState->Operands [WalkState->NumOperands -1]) - - -/* Interpreter constants */ - -#define AML_END_OF_BLOCK -1 -#define PUSH_PKG_LENGTH 1 -#define DO_NOT_PUSH_PKG_LENGTH 0 - - -#define STACK_TOP 0 -#define STACK_BOTTOM (UINT32) -1 - -/* Constants for global "WhenToParseMethods" */ - -#define METHOD_PARSE_AT_INIT 0x0 -#define METHOD_PARSE_JUST_IN_TIME 0x1 -#define METHOD_DELETE_AT_COMPLETION 0x2 +#define WALK_OPERANDS (&(WalkState->Operands [WalkState->NumOperands -1])) ACPI_STATUS @@ -208,52 +191,49 @@ AcpiExInsertIntoField ( UINT32 BufferLength); ACPI_STATUS -AcpiExSetupField ( +AcpiExSetupRegion ( ACPI_OPERAND_OBJECT *ObjDesc, - UINT32 FieldByteOffset); + UINT32 FieldDatumByteOffset); ACPI_STATUS -AcpiExReadFieldDatum ( +AcpiExAccessRegion ( ACPI_OPERAND_OBJECT *ObjDesc, - UINT32 FieldByteOffset, - UINT32 *Value); + UINT32 FieldDatumByteOffset, + ACPI_INTEGER *Value, + UINT32 ReadWrite); -ACPI_STATUS -AcpiExCommonAccessField ( - UINT32 Mode, +BOOLEAN +AcpiExRegisterOverflow ( ACPI_OPERAND_OBJECT *ObjDesc, - void *Buffer, - UINT32 BufferLength); - + ACPI_INTEGER Value); ACPI_STATUS -AcpiExAccessIndexField ( - UINT32 Mode, +AcpiExFieldDatumIo ( ACPI_OPERAND_OBJECT *ObjDesc, - void *Buffer, - UINT32 BufferLength); + UINT32 FieldDatumByteOffset, + ACPI_INTEGER *Value, + UINT32 ReadWrite); ACPI_STATUS -AcpiExAccessBankField ( - UINT32 Mode, +AcpiExWriteWithUpdateRule ( ACPI_OPERAND_OBJECT *ObjDesc, - void *Buffer, - UINT32 BufferLength); + ACPI_INTEGER Mask, + ACPI_INTEGER FieldValue, + UINT32 FieldDatumByteOffset); -ACPI_STATUS -AcpiExAccessRegionField ( - UINT32 Mode, - ACPI_OPERAND_OBJECT *ObjDesc, +void +AcpiExGetBufferDatum( + ACPI_INTEGER *Datum, void *Buffer, - UINT32 BufferLength); - + UINT32 ByteGranularity, + UINT32 Offset); -ACPI_STATUS -AcpiExAccessBufferField ( - UINT32 Mode, - ACPI_OPERAND_OBJECT *ObjDesc, +void +AcpiExSetBufferDatum ( + ACPI_INTEGER MergedDatum, void *Buffer, - UINT32 BufferLength); + UINT32 ByteGranularity, + UINT32 Offset); ACPI_STATUS AcpiExReadDataFromField ( @@ -370,12 +350,16 @@ AcpiExReleaseMutex ( ACPI_STATUS AcpiExReleaseAllMutexes ( - ACPI_OPERAND_OBJECT *MutexList); + ACPI_THREAD_STATE *Thread); void AcpiExUnlinkMutex ( ACPI_OPERAND_OBJECT *ObjDesc); +void +AcpiExLinkMutex ( + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_THREAD_STATE *Thread); /* * amprep - ACPI AML (p-code) execution - prep utilities @@ -385,35 +369,9 @@ ACPI_STATUS AcpiExPrepCommonFieldObject ( ACPI_OPERAND_OBJECT *ObjDesc, UINT8 FieldFlags, - UINT32 FieldPosition, - UINT32 FieldLength); - -ACPI_STATUS -AcpiExPrepRegionFieldValue ( - ACPI_NAMESPACE_NODE *Node, - ACPI_HANDLE Region, - UINT8 FieldFlags, - UINT32 FieldPosition, - UINT32 FieldLength); - -ACPI_STATUS -AcpiExPrepBankFieldValue ( - ACPI_NAMESPACE_NODE *Node, - ACPI_NAMESPACE_NODE *RegionNode, - ACPI_NAMESPACE_NODE *BankRegisterNode, - UINT32 BankVal, - UINT8 FieldFlags, - UINT32 FieldPosition, - UINT32 FieldLength); - -ACPI_STATUS -AcpiExPrepIndexFieldValue ( - ACPI_NAMESPACE_NODE *Node, - ACPI_NAMESPACE_NODE *IndexReg, - ACPI_NAMESPACE_NODE *DataReg, - UINT8 FieldFlags, - UINT32 FieldPosition, - UINT32 FieldLength); + UINT8 FieldAttribute, + UINT32 FieldBitPosition, + UINT32 FieldBitLength); ACPI_STATUS AcpiExPrepFieldValue ( @@ -524,11 +482,6 @@ AcpiExResolveObjectToValue ( ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState); -ACPI_STATUS -AcpiExGetBufferFieldValue ( - ACPI_OPERAND_OBJECT *FieldDesc, - ACPI_OPERAND_OBJECT *ResultDesc); - /* * amdump - Scanner debug output routines @@ -733,7 +686,7 @@ AcpiExSystemMemorySpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - UINT32 *Value, + ACPI_INTEGER *Value, void *HandlerContext, void *RegionContext); @@ -742,7 +695,7 @@ AcpiExSystemIoSpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - UINT32 *Value, + ACPI_INTEGER *Value, void *HandlerContext, void *RegionContext); @@ -751,7 +704,7 @@ AcpiExPciConfigSpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - UINT32 *Value, + ACPI_INTEGER *Value, void *HandlerContext, void *RegionContext); @@ -760,7 +713,7 @@ AcpiExCmosSpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - UINT32 *Value, + ACPI_INTEGER *Value, void *HandlerContext, void *RegionContext); @@ -769,7 +722,7 @@ AcpiExPciBarSpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - UINT32 *Value, + ACPI_INTEGER *Value, void *HandlerContext, void *RegionContext); @@ -778,7 +731,7 @@ AcpiExEmbeddedControllerSpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - UINT32 *Value, + ACPI_INTEGER *Value, void *HandlerContext, void *RegionContext); @@ -787,7 +740,7 @@ AcpiExSmBusSpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - UINT32 *Value, + ACPI_INTEGER *Value, void *HandlerContext, void *RegionContext); diff --git a/sys/contrib/dev/acpica/aclocal.h b/sys/contrib/dev/acpica/aclocal.h index bf99fd1..3a3e77c 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: 138 $ + * $Revision: 145 $ * *****************************************************************************/ @@ -140,6 +140,7 @@ typedef UINT32 ACPI_MUTEX_HANDLE; #define ACPI_DESC_TYPE_STATE_WSCOPE 0x26 #define ACPI_DESC_TYPE_STATE_RESULT 0x27 #define ACPI_DESC_TYPE_STATE_NOTIFY 0x28 +#define ACPI_DESC_TYPE_STATE_THREAD 0x29 #define ACPI_DESC_TYPE_WALK 0x44 #define ACPI_DESC_TYPE_PARSER 0x66 #define ACPI_DESC_TYPE_INTERNAL 0x88 @@ -294,7 +295,7 @@ typedef struct acpi_node /* Node flags */ -#define ANOBJ_AML_ATTACHMENT 0x01 +#define ANOBJ_RESERVED 0x01 #define ANOBJ_END_OF_PEER_LIST 0x02 #define ANOBJ_DATA_WIDTH_32 0x04 /* Parent table is 64-bits */ #define ANOBJ_METHOD_ARG 0x08 @@ -388,19 +389,11 @@ typedef struct UINT32 FieldBitPosition; UINT32 FieldBitLength; UINT8 FieldFlags; + UINT8 Attribute; UINT8 FieldType; } ACPI_CREATE_FIELD_INFO; -/* - * Field flags: Bits 00 - 03 : AccessType (AnyAcc, ByteAcc, etc.) - * 04 : LockRule (1 == Lock) - * 05 - 06 : UpdateRule - */ - -#define FIELD_ACCESS_TYPE_MASK 0x0F -#define FIELD_LOCK_RULE_MASK 0x10 -#define FIELD_UPDATE_RULE_MASK 0x60 /***************************************************************************** @@ -428,18 +421,6 @@ typedef struct #define ACPI_ENABLE_RTC_ALARM 0x0400 -/* - * Entry in the AddressSpace (AKA Operation Region) table - */ - -typedef struct -{ - ACPI_ADR_SPACE_HANDLER Handler; - void *Context; - -} ACPI_ADR_SPACE_INFO; - - /* Values and addresses of the GPE registers (both banks) */ typedef struct @@ -508,7 +489,6 @@ typedef struct /* Forward declarations */ struct acpi_walk_state; -struct acpi_walk_list; struct acpi_parse_obj; struct acpi_obj_mutex; @@ -562,7 +542,7 @@ typedef struct acpi_control_state { ACPI_STATE_COMMON struct acpi_parse_obj *PredicateOp; - UINT8 *AmlPredicateStart; /* Start of if/while predicate */ + UINT8 *AmlPredicateStart; /* Start of if/while predicate */ } ACPI_CONTROL_STATE; @@ -581,16 +561,31 @@ typedef struct acpi_scope_state typedef struct acpi_pscope_state { ACPI_STATE_COMMON - struct acpi_parse_obj *Op; /* current op being parsed */ - UINT8 *ArgEnd; /* current argument end */ - UINT8 *PkgEnd; /* current package end */ - UINT32 ArgList; /* next argument to parse */ - UINT32 ArgCount; /* Number of fixed arguments */ + struct acpi_parse_obj *Op; /* current op being parsed */ + UINT8 *ArgEnd; /* current argument end */ + UINT8 *PkgEnd; /* current package end */ + UINT32 ArgList; /* next argument to parse */ + UINT32 ArgCount; /* Number of fixed arguments */ } ACPI_PSCOPE_STATE; /* + * Thread state - one per thread across multiple walk states. Multiple walk + * states are created when there are nested control methods executing. + */ +typedef struct acpi_thread_state +{ + ACPI_STATE_COMMON + struct acpi_walk_state *WalkStateList; /* Head of list of WalkStates for this thread */ + union acpi_operand_obj *AcquiredMutexList; /* List of all currently acquired mutexes */ + UINT32 ThreadId; /* Running thread ID */ + UINT16 CurrentSyncLevel; /* Mutex Sync (nested acquire) level */ + +} ACPI_THREAD_STATE; + + +/* * Result values - used to accumulate the results of nested * AML arguments */ @@ -637,13 +632,13 @@ typedef union acpi_gen_state ACPI_SCOPE_STATE Scope; ACPI_PSCOPE_STATE ParseScope; ACPI_PKG_STATE Pkg; + ACPI_THREAD_STATE Thread; ACPI_RESULT_VALUES Results; ACPI_NOTIFY_INFO Notify; } ACPI_GENERIC_STATE; - /***************************************************************************** * * Interpreter typedefs and structs @@ -666,15 +661,16 @@ ACPI_STATUS (*ACPI_EXECUTE_OP) ( */ typedef struct acpi_opcode_info { +#ifdef _OPCODE_NAMES + NATIVE_CHAR *Name; /* Opcode name (debug only) */ +#endif UINT32 ParseArgs; /* Grammar/Parse time arguments */ UINT32 RuntimeArgs; /* Interpret time arguments */ - UINT16 Flags; /* Misc flags */ + UINT32 Flags; /* Misc flags */ + UINT8 ObjectType; /* Corresponding internal object type */ UINT8 Class; /* Opcode class */ UINT8 Type; /* Opcode type */ -#ifdef _OPCODE_NAMES - NATIVE_CHAR *Name; /* op name (debug only) */ -#endif } ACPI_OPCODE_INFO; @@ -753,8 +749,6 @@ typedef struct acpi_parse_state struct acpi_parse_obj *StartScope; - - } ACPI_PARSE_STATE; @@ -891,10 +885,6 @@ typedef struct acpi_parse_state #define GPE1_EN_MASK -#define ACPI_READ 1 -#define ACPI_WRITE 2 - - /***************************************************************************** * * Resource descriptors diff --git a/sys/contrib/dev/acpica/acmacros.h b/sys/contrib/dev/acpica/acmacros.h index d024dbf..e73f8c7 100644 --- a/sys/contrib/dev/acpica/acmacros.h +++ b/sys/contrib/dev/acpica/acmacros.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acmacros.h - C macros for the entire subsystem. - * $Revision: 97 $ + * $Revision: 100 $ * *****************************************************************************/ @@ -321,8 +321,8 @@ * MASK_BITS_ABOVE creates a mask starting AT the position and above * MASK_BITS_BELOW creates a mask starting one bit BELOW the position */ -#define MASK_BITS_ABOVE(position) (~(((UINT32)(-1)) << ((UINT32) (position)))) -#define MASK_BITS_BELOW(position) (((UINT32)(-1)) << ((UINT32) (position))) +#define MASK_BITS_ABOVE(position) (~(((ACPI_INTEGER)(-1)) << ((UINT32) (position)))) +#define MASK_BITS_BELOW(position) (((ACPI_INTEGER)(-1)) << ((UINT32) (position))) /* Macros for GAS addressing */ @@ -348,8 +348,8 @@ #endif /* - * An ACPI_HANDLE (which is actually an ACPI_NAMESPACE_NODE *) can appear in some contexts, - * such as on apObjStack, where a pointer to an ACPI_OPERAND_OBJECT can also + * An ACPI_NAMESPACE_NODE * can appear in some contexts, + * where a pointer to an ACPI_OPERAND_OBJECT can also * appear. This macro is used to distinguish them. * * The DataType field is the first field in both structures. @@ -385,9 +385,9 @@ * Macros for the master AML opcode table */ #ifdef ACPI_DEBUG -#define ACPI_OP(Name,PArgs,IArgs,Class,Type,Flags) {PArgs,IArgs,Flags,Class,Type,Name} +#define ACPI_OP(Name,PArgs,IArgs,ObjType,Class,Type,Flags) {Name,PArgs,IArgs,Flags,ObjType,Class,Type} #else -#define ACPI_OP(Name,PArgs,IArgs,Class,Type,Flags) {PArgs,IArgs,Flags,Class,Type} +#define ACPI_OP(Name,PArgs,IArgs,ObjType,Class,Type,Flags) {PArgs,IArgs,Flags,ObjType,Class,Type} #endif #define ARG_TYPE_WIDTH 5 diff --git a/sys/contrib/dev/acpica/acnamesp.h b/sys/contrib/dev/acpica/acnamesp.h index 3c8f6cc..2c94fa4 100644 --- a/sys/contrib/dev/acpica/acnamesp.h +++ b/sys/contrib/dev/acpica/acnamesp.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acnamesp.h - Namespace subcomponent prototypes and defines - * $Revision: 110 $ + * $Revision: 115 $ * *****************************************************************************/ @@ -137,7 +137,7 @@ #define ACPI_ROOT_NAME (UINT32) 0x2F202020 /* Root name is "/ " */ #define ACPI_SYS_BUS_NAME (UINT32) 0x5F53425F /* Sys bus name is "_SB_" */ -#define NS_ROOT_PATH "/" +#define NS_ROOT_PATH "\\" #define NS_SYSTEM_BUS "_SB_" @@ -307,6 +307,11 @@ AcpiNsDumpPathname ( UINT32 Component); void +AcpiNsPrintPathname ( + UINT32 NumSegments, + char *Pathname); + +void AcpiNsDumpRootDevices ( void); @@ -415,6 +420,31 @@ AcpiNsAttachObject ( ACPI_OPERAND_OBJECT *Object, ACPI_OBJECT_TYPE8 Type); +ACPI_OPERAND_OBJECT * +AcpiNsGetAttachedObject ( + ACPI_NAMESPACE_NODE *Node); + +ACPI_OPERAND_OBJECT * +AcpiNsGetSecondaryObject ( + ACPI_OPERAND_OBJECT *ObjDesc); + +ACPI_STATUS +AcpiNsAttachData ( + ACPI_NAMESPACE_NODE *Node, + ACPI_OBJECT_HANDLER Handler, + void *Data); + +ACPI_STATUS +AcpiNsDetachData ( + ACPI_NAMESPACE_NODE *Node, + ACPI_OBJECT_HANDLER Handler); + +ACPI_STATUS +AcpiNsGetAttachedData ( + ACPI_NAMESPACE_NODE *Node, + ACPI_OBJECT_HANDLER Handler, + void **Data); + /* * Namespace searching and entry - nssearch @@ -461,10 +491,6 @@ ACPI_OBJECT_TYPE8 AcpiNsGetType ( ACPI_NAMESPACE_NODE *Node); -void * -AcpiNsGetAttachedObject ( - ACPI_NAMESPACE_NODE *Node); - UINT32 AcpiNsLocal ( ACPI_OBJECT_TYPE8 Type); diff --git a/sys/contrib/dev/acpica/acobject.h b/sys/contrib/dev/acpica/acobject.h index f8a2e38..edc3375 100644 --- a/sys/contrib/dev/acpica/acobject.h +++ b/sys/contrib/dev/acpica/acobject.h @@ -2,7 +2,7 @@ /****************************************************************************** * * Name: acobject.h - Definition of ACPI_OPERAND_OBJECT (Internal object only) - * $Revision: 93 $ + * $Revision: 101 $ * *****************************************************************************/ @@ -149,19 +149,21 @@ */ -#define ACPI_OBJECT_COMMON_HEADER /* SIZE/ALIGNMENT: 32-bits plus trailing 8-bit flag */\ +#define ACPI_OBJECT_COMMON_HEADER /* SIZE/ALIGNMENT: 32 bits, one ptr plus trailing 8-bit flag */\ UINT8 DataType; /* To differentiate various internal objs */\ UINT8 Type; /* ACPI_OBJECT_TYPE */\ UINT16 ReferenceCount; /* For object deletion management */\ + union acpi_operand_obj *NextObject; /* Objects linked to parent NS node */\ UINT8 Flags; \ /* Defines for flag byte above */ -#define AOPOBJ_STATIC_ALLOCATION 0x1 -#define AOPOBJ_STATIC_POINTER 0x2 -#define AOPOBJ_DATA_VALID 0x4 -#define AOPOBJ_ZERO_CONST 0x4 -#define AOPOBJ_INITIALIZED 0x8 +#define AOPOBJ_STATIC_ALLOCATION 0x01 +#define AOPOBJ_STATIC_POINTER 0x02 +#define AOPOBJ_DATA_VALID 0x04 +#define AOPOBJ_OBJECT_INITIALIZED 0x08 +#define AOPOBJ_SETUP_COMPLETE 0x10 +#define AOPOBJ_SINGLE_DATUM 0x20 /* @@ -170,23 +172,19 @@ * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field */ #define ACPI_COMMON_FIELD_INFO /* SIZE/ALIGNMENT: 24 bits + three 32-bit values */\ - UINT8 AccessFlags;\ + UINT8 FieldFlags; /* Access, update, and lock bits */\ UINT16 BitLength; /* Length of field in bits */\ UINT32 BaseByteOffset; /* Byte offset within containing object */\ UINT8 AccessBitWidth; /* Read/Write size in bits (from ASL AccessType)*/\ UINT8 AccessByteWidth; /* Read/Write size in bytes */\ - UINT8 UpdateRule; /* How neighboring field bits are handled */\ - UINT8 LockRule; /* Global Lock: 1 = "Must Lock" */\ + UINT8 Attribute ; /* From AccessAs keyword */\ UINT8 StartFieldBitOffset;/* Bit offset within first field datum (0-63) */\ UINT8 DatumValidBits; /* Valid bit in first "Field datum" */\ UINT8 EndFieldValidBits; /* Valid bits in the last "field datum" */\ UINT8 EndBufferValidBits; /* Valid bits in the last "buffer datum" */\ - UINT32 Value; /* Value to store into the Bank or Index register */ - - -/* Access flag bits */ - -#define AFIELD_SINGLE_DATUM 0x1 + UINT8 Reserved; /* Reserved for future use */\ + UINT32 Value; /* Value to store into the Bank or Index register */\ + ACPI_NAMESPACE_NODE *Node; /* Link back to parent node */ /* @@ -196,7 +194,6 @@ UINT32 Length; - /****************************************************************************** * * Individual Object Descriptors @@ -242,6 +239,7 @@ typedef struct /* BUFFER - has length and pointer - not null terminated */ ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO UINT8 *Pointer; /* Buffer value in AML stream or in allocated space */ + ACPI_NAMESPACE_NODE *Node; /* Link back to parent node */ } ACPI_OBJECT_BUFFER; @@ -302,8 +300,8 @@ typedef struct acpi_obj_mutex /* MUTEX */ UINT16 SyncLevel; UINT16 AcquisitionDepth; + struct acpi_thread_state *OwnerThread; void *Semaphore; - void *Owner; union acpi_operand_obj *Prev; /* Link for list of acquired mutexes */ union acpi_operand_obj *Next; /* Link for list of acquired mutexes */ @@ -317,7 +315,6 @@ typedef struct /* REGION */ UINT8 SpaceId; UINT32 Length; ACPI_PHYSICAL_ADDRESS Address; - union acpi_operand_obj *Extra; /* Pointer to executable AML (in region definition) */ union acpi_operand_obj *AddrHandler; /* Handler for system notifies */ ACPI_NAMESPACE_NODE *Node; /* containing object */ @@ -393,7 +390,7 @@ typedef struct /* BANK FIELD */ ACPI_COMMON_FIELD_INFO union acpi_operand_obj *RegionObj; /* Containing OpRegion object */ - union acpi_operand_obj *BankRegisterObj; /* BankSelect Register object */ + union acpi_operand_obj *BankObj; /* BankSelect Register object */ } ACPI_OBJECT_BANK_FIELD; @@ -421,8 +418,6 @@ typedef struct /* BUFFER FIELD */ ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO - union acpi_operand_obj *Extra; /* Pointer to executable AML (in field definition) */ - ACPI_NAMESPACE_NODE *Node; /* Parent (containing) object node */ union acpi_operand_obj *BufferObj; /* Containing Buffer object */ } ACPI_OBJECT_BUFFER_FIELD; @@ -506,6 +501,15 @@ typedef struct /* EXTRA */ } ACPI_OBJECT_EXTRA; +typedef struct /* DATA */ +{ + ACPI_OBJECT_COMMON_HEADER + ACPI_OBJECT_HANDLER Handler; + void *Pointer; + +} ACPI_OBJECT_DATA; + + /****************************************************************************** * * ACPI_OPERAND_OBJECT Descriptor - a giant union of all of the above @@ -537,6 +541,7 @@ typedef union acpi_operand_obj ACPI_OBJECT_NOTIFY_HANDLER NotifyHandler; ACPI_OBJECT_ADDR_HANDLER AddrHandler; ACPI_OBJECT_EXTRA Extra; + ACPI_OBJECT_DATA Data; } ACPI_OPERAND_OBJECT; diff --git a/sys/contrib/dev/acpica/acparser.h b/sys/contrib/dev/acpica/acparser.h index 396cdb2..3a321d7 100644 --- a/sys/contrib/dev/acpica/acparser.h +++ b/sys/contrib/dev/acpica/acparser.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: acparser.h - AML Parser subcomponent prototypes and defines - * $Revision: 54 $ + * $Revision: 55 $ * *****************************************************************************/ @@ -119,15 +119,15 @@ #define __ACPARSER_H__ -#define OP_HAS_RETURN_VALUE 1 +#define OP_HAS_RETURN_VALUE 1 /* variable # arguments */ -#define ACPI_VAR_ARGS ACPI_UINT32_MAX +#define ACPI_VAR_ARGS ACPI_UINT32_MAX /* maximum virtual address */ -#define ACPI_MAX_AML ((UINT8 *)(~0UL)) +#define ACPI_MAX_AML ((UINT8 *)(~0UL)) #define ACPI_PARSE_DELETE_TREE 0x0001 @@ -139,7 +139,8 @@ #define ACPI_PARSE_EXECUTE 0x0030 #define ACPI_PARSE_MODE_MASK 0x0030 -/* psapi - Parser external interfaces */ + +/* Parser external interfaces */ ACPI_STATUS AcpiPsxLoadTable ( @@ -152,6 +153,7 @@ AcpiPsxExecute ( ACPI_OPERAND_OBJECT **Params, ACPI_OPERAND_OBJECT **ReturnObjDesc); + /****************************************************************************** * * Parser interfaces @@ -176,8 +178,8 @@ AcpiPsGetNextNamestring ( void AcpiPsGetNextSimpleArg ( ACPI_PARSE_STATE *ParserState, - UINT32 ArgType, /* type of argument */ - ACPI_PARSE_OBJECT *Arg); /* (OUT) argument data */ + UINT32 ArgType, + ACPI_PARSE_OBJECT *Arg); void AcpiPsGetNextNamepath ( @@ -197,6 +199,19 @@ AcpiPsGetNextArg ( UINT32 *ArgCount); +/* psfind */ + +ACPI_PARSE_OBJECT * +AcpiPsFindName ( + ACPI_PARSE_OBJECT *Scope, + UINT32 Name, + UINT32 Opcode); + +ACPI_PARSE_OBJECT* +AcpiPsGetParent ( + ACPI_PARSE_OBJECT *Op); + + /* psopcode - AML Opcode information */ const ACPI_OPCODE_INFO * @@ -210,6 +225,21 @@ AcpiPsGetOpcodeName ( /* psparse - top level parsing routines */ +UINT32 +AcpiPsGetOpcodeSize ( + UINT32 Opcode); + +BOOLEAN +AcpiPsCompleteThisOp ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op); + +ACPI_STATUS +AcpiPsNextParseState ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op, + ACPI_STATUS CallbackStatus); + ACPI_STATUS AcpiPsFindObject ( ACPI_WALK_STATE *WalkState, @@ -324,6 +354,10 @@ AcpiPsGetNextWalkOp ( ACPI_PARSE_OBJECT *Op, ACPI_PARSE_UPWARDS AscendingCallback); +ACPI_STATUS +AcpiPsDeleteCompletedOp ( + ACPI_WALK_STATE *WalkState); + /* psutils - parser utilities */ diff --git a/sys/contrib/dev/acpica/acstruct.h b/sys/contrib/dev/acpica/acstruct.h index bfd62ef..f214ced 100644 --- a/sys/contrib/dev/acpica/acstruct.h +++ b/sys/contrib/dev/acpica/acstruct.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acstruct.h - Internal structs - * $Revision: 10 $ + * $Revision: 12 $ * *****************************************************************************/ @@ -125,6 +125,7 @@ ****************************************************************************/ + /* * Walk state - current state of a parse tree walk. Used for both a leisurely stroll through * the tree (for whatever reason), and for control method execution. @@ -147,7 +148,6 @@ typedef struct acpi_walk_state UINT8 NumOperands; /* Stack pointer for Operands[] array */ UINT8 ReturnUsed; UINT8 WalkType; - UINT16 CurrentSyncLevel; /* Mutex Sync (nested acquire) level */ UINT16 Opcode; /* Current AML opcode */ UINT32 ArgCount; /* push for fixed or var args */ UINT32 AmlOffset; @@ -184,26 +184,13 @@ typedef struct acpi_walk_state ACPI_PARSE_DOWNWARDS DescendingCallback; ACPI_PARSE_UPWARDS AscendingCallback; - struct acpi_walk_list *WalkList; + ACPI_THREAD_STATE *Thread; struct acpi_walk_state *Next; /* Next WalkState in list */ - } ACPI_WALK_STATE; -/* - * Walk list - head of a tree of walk states. Multiple walk states are created when there - * are nested control methods executing. - */ -typedef struct acpi_walk_list -{ - - ACPI_WALK_STATE *WalkState; - ACPI_OBJECT_MUTEX AcquiredMutexList; /* List of all currently acquired mutexes */ - -} ACPI_WALK_LIST; - /* Info used by AcpiPsInitObjects */ @@ -256,8 +243,6 @@ typedef struct acpi_get_devices_info } ACPI_GET_DEVICES_INFO; - - typedef union acpi_aml_operands { ACPI_OPERAND_OBJECT *Operands[7]; @@ -290,5 +275,4 @@ typedef union acpi_aml_operands } ACPI_AML_OPERANDS; - #endif diff --git a/sys/contrib/dev/acpica/actypes.h b/sys/contrib/dev/acpica/actypes.h index 4c825ec..31e1b6c 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: 193 $ + * $Revision: 199 $ * *****************************************************************************/ @@ -384,6 +384,12 @@ typedef UINT64 ACPI_INTEGER; #define ACPI_D_STATE_COUNT 4 /* + * Sleep type invalid value + */ +#define ACPI_SLEEP_TYPE_MAX 0x7 +#define ACPI_SLEEP_TYPE_INVALID 0xFF + +/* * Standard notify values */ #define ACPI_NOTIFY_BUS_CHECK (UINT8) 0 @@ -427,25 +433,25 @@ typedef UINT32 ACPI_OBJECT_TYPE; typedef UINT8 ACPI_OBJECT_TYPE8; -#define ACPI_TYPE_ANY 0 /* 0x00 */ -#define ACPI_TYPE_INTEGER 1 /* 0x01 Byte/Word/Dword/Zero/One/Ones */ -#define ACPI_TYPE_STRING 2 /* 0x02 */ -#define ACPI_TYPE_BUFFER 3 /* 0x03 */ -#define ACPI_TYPE_PACKAGE 4 /* 0x04 ByteConst, multiple DataTerm/Constant/SuperName */ -#define ACPI_TYPE_FIELD_UNIT 5 /* 0x05 */ -#define ACPI_TYPE_DEVICE 6 /* 0x06 Name, multiple Node */ -#define ACPI_TYPE_EVENT 7 /* 0x07 */ -#define ACPI_TYPE_METHOD 8 /* 0x08 Name, ByteConst, multiple Code */ -#define ACPI_TYPE_MUTEX 9 /* 0x09 */ -#define ACPI_TYPE_REGION 10 /* 0x0A */ -#define ACPI_TYPE_POWER 11 /* 0x0B Name,ByteConst,WordConst,multi Node */ -#define ACPI_TYPE_PROCESSOR 12 /* 0x0C Name,ByteConst,DWordConst,ByteConst,multi NmO */ -#define ACPI_TYPE_THERMAL 13 /* 0x0D Name, multiple Node */ -#define ACPI_TYPE_BUFFER_FIELD 14 /* 0x0E */ -#define ACPI_TYPE_DDB_HANDLE 15 /* 0x0F */ -#define ACPI_TYPE_DEBUG_OBJECT 16 /* 0x10 */ - -#define ACPI_TYPE_MAX 16 +#define ACPI_TYPE_ANY 0x00 +#define ACPI_TYPE_INTEGER 0x01 /* Byte/Word/Dword/Zero/One/Ones */ +#define ACPI_TYPE_STRING 0x02 +#define ACPI_TYPE_BUFFER 0x03 +#define ACPI_TYPE_PACKAGE 0x04 /* ByteConst, multiple DataTerm/Constant/SuperName */ +#define ACPI_TYPE_FIELD_UNIT 0x05 +#define ACPI_TYPE_DEVICE 0x06 /* Name, multiple Node */ +#define ACPI_TYPE_EVENT 0x07 +#define ACPI_TYPE_METHOD 0x08 /* Name, ByteConst, multiple Code */ +#define ACPI_TYPE_MUTEX 0x09 +#define ACPI_TYPE_REGION 0x0A +#define ACPI_TYPE_POWER 0x0B /* Name,ByteConst,WordConst,multi Node */ +#define ACPI_TYPE_PROCESSOR 0x0C /* Name,ByteConst,DWordConst,ByteConst,multi NmO */ +#define ACPI_TYPE_THERMAL 0x0D /* Name, multiple Node */ +#define ACPI_TYPE_BUFFER_FIELD 0x0E +#define ACPI_TYPE_DDB_HANDLE 0x0F +#define ACPI_TYPE_DEBUG_OBJECT 0x10 + +#define ACPI_TYPE_MAX 0x10 /* * This section contains object types that do not relate to the ACPI ObjectType operator. @@ -454,36 +460,37 @@ typedef UINT8 ACPI_OBJECT_TYPE8; * Also, values exceeding the largest official ACPI ObjectType must not overlap with * defined AML opcodes. */ -#define INTERNAL_TYPE_BEGIN 17 +#define INTERNAL_TYPE_BEGIN 0x11 -#define INTERNAL_TYPE_REGION_FIELD 17 /* 0x11 */ -#define INTERNAL_TYPE_BANK_FIELD 18 /* 0x12 */ -#define INTERNAL_TYPE_INDEX_FIELD 19 /* 0x13 */ -#define INTERNAL_TYPE_REFERENCE 20 /* 0x14 Arg#, Local#, Name, Debug; used only in descriptors */ -#define INTERNAL_TYPE_ALIAS 21 /* 0x15 */ -#define INTERNAL_TYPE_NOTIFY 22 /* 0x16 */ -#define INTERNAL_TYPE_ADDRESS_HANDLER 23 /* 0x17 */ -#define INTERNAL_TYPE_RESOURCE 24 /* 0x18 */ -#define INTERNAL_TYPE_RESOURCE_FIELD 25 /* 0x19 */ +#define INTERNAL_TYPE_REGION_FIELD 0x11 +#define INTERNAL_TYPE_BANK_FIELD 0x12 +#define INTERNAL_TYPE_INDEX_FIELD 0x13 +#define INTERNAL_TYPE_REFERENCE 0x14 /* Arg#, Local#, Name, Debug; used only in descriptors */ +#define INTERNAL_TYPE_ALIAS 0x15 +#define INTERNAL_TYPE_NOTIFY 0x16 +#define INTERNAL_TYPE_ADDRESS_HANDLER 0x17 +#define INTERNAL_TYPE_RESOURCE 0x18 +#define INTERNAL_TYPE_RESOURCE_FIELD 0x19 -#define INTERNAL_TYPE_NODE_MAX 25 +#define INTERNAL_TYPE_NODE_MAX 0x19 /* These are pseudo-types because there are never any namespace nodes with these types */ -#define INTERNAL_TYPE_FIELD_DEFN 26 /* 0x1A Name, ByteConst, multiple FieldElement */ -#define INTERNAL_TYPE_BANK_FIELD_DEFN 27 /* 0x1B 2 Name,DWordConst,ByteConst,multi FieldElement */ -#define INTERNAL_TYPE_INDEX_FIELD_DEFN 28 /* 0x1C 2 Name, ByteConst, multiple FieldElement */ -#define INTERNAL_TYPE_IF 29 /* 0x1D */ -#define INTERNAL_TYPE_ELSE 30 /* 0x1E */ -#define INTERNAL_TYPE_WHILE 31 /* 0x1F */ -#define INTERNAL_TYPE_SCOPE 32 /* 0x20 Name, multiple Node */ -#define INTERNAL_TYPE_DEF_ANY 33 /* 0x21 type is Any, suppress search of enclosing scopes */ -#define INTERNAL_TYPE_EXTRA 34 /* 0x22 */ +#define INTERNAL_TYPE_FIELD_DEFN 0x1A /* Name, ByteConst, multiple FieldElement */ +#define INTERNAL_TYPE_BANK_FIELD_DEFN 0x1B /* 2 Name,DWordConst,ByteConst,multi FieldElement */ +#define INTERNAL_TYPE_INDEX_FIELD_DEFN 0x1C /* 2 Name, ByteConst, multiple FieldElement */ +#define INTERNAL_TYPE_IF 0x1D +#define INTERNAL_TYPE_ELSE 0x1E +#define INTERNAL_TYPE_WHILE 0x1F +#define INTERNAL_TYPE_SCOPE 0x20 /* Name, multiple Node */ +#define INTERNAL_TYPE_DEF_ANY 0x21 /* type is Any, suppress search of enclosing scopes */ +#define INTERNAL_TYPE_EXTRA 0x22 +#define INTERNAL_TYPE_DATA 0x23 -#define INTERNAL_TYPE_MAX 34 +#define INTERNAL_TYPE_MAX 0x23 -#define INTERNAL_TYPE_INVALID 35 +#define INTERNAL_TYPE_INVALID 0x24 #define ACPI_TYPE_NOT_FOUND 0xFF @@ -519,6 +526,12 @@ typedef UINT8 ACPI_OBJECT_TYPE8; #define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ #define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF +/* + * All I/O + */ +#define ACPI_READ 0 +#define ACPI_WRITE 1 + /* * AcpiEvent Types: @@ -560,7 +573,7 @@ typedef UINT32 ACPI_EVENT_TYPE; * GPEs */ #define ACPI_EVENT_ENABLE 0x1 -#define ACPI_EVENT_WAKE_ENABLE 0x2 +#define ACPI_EVENT_WAKE_ENABLE 0x2 #define ACPI_EVENT_DISABLE 0x1 #define ACPI_EVENT_WAKE_DISABLE 0x2 @@ -760,18 +773,21 @@ void (*ACPI_NOTIFY_HANDLER) ( UINT32 Value, void *Context); +typedef +void (*ACPI_OBJECT_HANDLER) ( + ACPI_HANDLE Object, + UINT32 Function, + void *Data); -/* Address Spaces (Operation Regions */ -#define ACPI_READ_ADR_SPACE 1 -#define ACPI_WRITE_ADR_SPACE 2 +/* Address Spaces (Operation Regions */ typedef ACPI_STATUS (*ACPI_ADR_SPACE_HANDLER) ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - UINT32 *Value, + ACPI_INTEGER *Value, void *HandlerContext, void *RegionContext); diff --git a/sys/contrib/dev/acpica/acutils.h b/sys/contrib/dev/acpica/acutils.h index e583185..f526376 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: 117 $ + * $Revision: 119 $ * *****************************************************************************/ @@ -474,6 +474,7 @@ AcpiUtDeleteInternalObjectList ( /* Method name strings */ #define METHOD_NAME__HID "_HID" +#define METHOD_NAME__CID "_CID" #define METHOD_NAME__UID "_UID" #define METHOD_NAME__ADR "_ADR" #define METHOD_NAME__STA "_STA" @@ -495,6 +496,11 @@ AcpiUtExecute_HID ( ACPI_DEVICE_ID *Hid); ACPI_STATUS +AcpiUtExecute_CID ( + ACPI_NAMESPACE_NODE *DeviceNode, + ACPI_DEVICE_ID *Cid); + +ACPI_STATUS AcpiUtExecute_STA ( ACPI_NAMESPACE_NODE *DeviceNode, UINT32 *StatusFlags); @@ -613,6 +619,10 @@ ACPI_GENERIC_STATE * AcpiUtCreateGenericState ( void); +ACPI_THREAD_STATE * +AcpiUtCreateThreadState ( + void); + ACPI_GENERIC_STATE * AcpiUtCreateUpdateState ( ACPI_OPERAND_OBJECT *Object, diff --git a/sys/contrib/dev/acpica/amlcode.h b/sys/contrib/dev/acpica/amlcode.h index 763f160..effe2ca 100644 --- a/sys/contrib/dev/acpica/amlcode.h +++ b/sys/contrib/dev/acpica/amlcode.h @@ -3,7 +3,7 @@ * Name: amlcode.h - Definitions for AML, as included in "definition blocks" * Declarations and definitions contained herein are derived * directly from the ACPI specification. - * $Revision: 58 $ + * $Revision: 62 $ * *****************************************************************************/ @@ -358,8 +358,8 @@ #define OPGRP_BYTELIST 0x04 -/* - * Opcode information +/* + * Opcode information */ /* Opcode flags */ @@ -433,8 +433,8 @@ #define AML_TYPE_BOGUS 0x19 -/* - * Opcode classes +/* + * Opcode classes */ #define AML_CLASS_EXECUTE 0x00 #define AML_CLASS_CREATE 0x01 @@ -481,52 +481,76 @@ typedef enum #define MAX_MATCH_OPERATOR 5 -/* Field Access Types */ +/* + * FieldFlags + * + * This byte is extracted from the AML and includes three separate + * pieces of information about the field: + * 1) The field access type + * 2) The field update rule + * 3) The lock rule for the field + * + * Bits 00 - 03 : AccessType (AnyAcc, ByteAcc, etc.) + * 04 : LockRule (1 == Lock) + * 05 - 06 : UpdateRule + */ +#define AML_FIELD_ACCESS_TYPE_MASK 0x0F +#define AML_FIELD_LOCK_RULE_MASK 0x10 +#define AML_FIELD_UPDATE_RULE_MASK 0x60 + -#define ACCESS_TYPE_MASK 0x0f -#define ACCESS_TYPE_SHIFT 0 +/* 1) Field Access Types */ typedef enum { - ACCESS_ANY_ACC = 0, - ACCESS_BYTE_ACC = 1, - ACCESS_WORD_ACC = 2, - ACCESS_DWORD_ACC = 3, - ACCESS_QWORD_ACC = 4, /* ACPI 2.0 */ - ACCESS_BLOCK_ACC = 4, - ACCESS_SMBSEND_RECV_ACC = 5, - ACCESS_SMBQUICK_ACC = 6 + AML_FIELD_ACCESS_ANY = 0x00, + AML_FIELD_ACCESS_BYTE = 0x01, + AML_FIELD_ACCESS_WORD = 0x02, + AML_FIELD_ACCESS_DWORD = 0x03, + AML_FIELD_ACCESS_QWORD = 0x04, /* ACPI 2.0 */ + AML_FIELD_ACCESS_BUFFER = 0x05, /* ACPI 2.0 */ } AML_ACCESS_TYPE; -/* Field Lock Rules */ - -#define LOCK_RULE_MASK 0x10 -#define LOCK_RULE_SHIFT 4 +/* 2) Field Lock Rules */ typedef enum { - GLOCK_NEVER_LOCK = 0, - GLOCK_ALWAYS_LOCK = 1 + AML_FIELD_LOCK_NEVER = 0x00, + AML_FIELD_LOCK_ALWAYS = 0x10, } AML_LOCK_RULE; -/* Field Update Rules */ - -#define UPDATE_RULE_MASK 0x060 -#define UPDATE_RULE_SHIFT 5 +/* 3) Field Update Rules */ typedef enum { - UPDATE_PRESERVE = 0, - UPDATE_WRITE_AS_ONES = 1, - UPDATE_WRITE_AS_ZEROS = 2 + AML_FIELD_UPDATE_PRESERVE = 0x00, + AML_FIELD_UPDATE_WRITE_AS_ONES = 0x20, + AML_FIELD_UPDATE_WRITE_AS_ZEROS = 0x40, } AML_UPDATE_RULE; +/* + * Field Access Attributes. + * This byte is extracted from the AML via the + * AccessAs keyword + */ +typedef enum +{ + AML_FIELD_ATTRIB_SMB_QUICK = 0x02, + AML_FIELD_ATTRIB_SMB_SEND_RCV = 0x04, + AML_FIELD_ATTRIB_SMB_BYTE = 0x06, + AML_FIELD_ATTRIB_SMB_WORD = 0x08, + AML_FIELD_ATTRIB_SMB_BLOCK = 0x0A, + AML_FIELD_ATTRIB_SMB_CALL = 0x0E, + +} AML_ACCESS_ATTRIBUTE; + + /* bit fields in MethodFlags byte */ #define METHOD_FLAGS_ARG_COUNT 0x07 @@ -536,15 +560,11 @@ typedef enum /* Array sizes. Used for range checking also */ -#define NUM_REGION_TYPES 7 -#define NUM_ACCESS_TYPES 7 +#define NUM_ACCESS_TYPES 6 #define NUM_UPDATE_RULES 3 #define NUM_MATCH_OPS 7 #define NUM_OPCODES 256 #define NUM_FIELD_NAMES 2 -#define USER_REGION_BEGIN 0x80 - - #endif /* __AMLCODE_H__ */ diff --git a/sys/contrib/dev/acpica/dbcmds.c b/sys/contrib/dev/acpica/dbcmds.c index 1ba6a4d..89002d7 100644 --- a/sys/contrib/dev/acpica/dbcmds.c +++ b/sys/contrib/dev/acpica/dbcmds.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbcmds - debug commands and output routines - * $Revision: 66 $ + * $Revision: 67 $ * ******************************************************************************/ @@ -193,7 +193,7 @@ AcpiDbWalkForReferences ( /* Check for match against the object attached to the node */ - if (Node->Object == ObjDesc) + if (AcpiNsGetAttachedObject (Node) == ObjDesc) { AcpiOsPrintf ("Reference at Node->Object %p [%4.4s]\n", Node, &Node->Name); } @@ -769,7 +769,7 @@ AcpiDbWalkForSpecificObjects ( NATIVE_CHAR Buffer[64]; - ObjDesc = ((ACPI_NAMESPACE_NODE *)ObjHandle)->Object; + ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ObjHandle); BufSize = sizeof (Buffer) / sizeof (*Buffer); /* Get and display the full pathname to this object */ diff --git a/sys/contrib/dev/acpica/dbdisasm.c b/sys/contrib/dev/acpica/dbdisasm.c index 2ada95d..dc24edc 100644 --- a/sys/contrib/dev/acpica/dbdisasm.c +++ b/sys/contrib/dev/acpica/dbdisasm.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbdisasm - parser op tree display routines - * $Revision: 50 $ + * $Revision: 53 $ * ******************************************************************************/ @@ -208,7 +208,6 @@ AcpiPsDisplayObjectPathname ( */ AcpiOsPrintf (" **** Path not found in parse tree"); } - else { /* The target was found, print the name and complete path */ @@ -316,139 +315,135 @@ AcpiDbDisplayOp ( UINT32 j; - if (Op) + if (!Op) + { + AcpiDbDisplayOpcode (WalkState, Op); + return; + } + + + while (Op) { - while (Op) + /* Indentation */ + + DepthCount = 0; + if (!AcpiGbl_DbOpt_verbose) { - /* indentation */ + DepthCount++; + } + + /* Determine the nesting depth of this argument */ - DepthCount = 0; - if (!AcpiGbl_DbOpt_verbose) + for (depth = Op->Parent; depth; depth = depth->Parent) + { + arg = AcpiPsGetArg (depth, 0); + while (arg && arg != Origin) { - DepthCount++; + arg = arg->Next; } - /* Determine the nesting depth of this argument */ - - for (depth = Op->Parent; depth; depth = depth->Parent) + if (arg) { - arg = AcpiPsGetArg (depth, 0); - while (arg && arg != Origin) - { - arg = arg->Next; - } + break; + } - if (arg) - { - break; - } + DepthCount++; + } + + /* Open a new block if we are nested further than last time */ - DepthCount++; + if (DepthCount > LastDepth) + { + VERBOSE_PRINT ((DB_NO_OP_INFO, LastDepth)); + for (i = 0; i < LastDepth; i++) + { + AcpiOsPrintf ("%s", AcpiGbl_DbDisasmIndent); } + if (AcpiDbBlockType (Op) == BLOCK_PAREN) + { + AcpiOsPrintf ("(\n"); + } + else + { + AcpiOsPrintf ("{\n"); + } + } - /* Open a new block if we are nested further than last time */ + /* Close a block if we are nested less than last time */ - if (DepthCount > LastDepth) + else if (DepthCount < LastDepth) + { + for (j = 0; j < (LastDepth - DepthCount); j++) { - VERBOSE_PRINT ((DB_NO_OP_INFO, LastDepth)); - for (i = 0; i < LastDepth; i++) + VERBOSE_PRINT ((DB_NO_OP_INFO, LastDepth - j)); + for (i = 0; i < (LastDepth - j - 1); i++) { AcpiOsPrintf ("%s", AcpiGbl_DbDisasmIndent); } if (AcpiDbBlockType (Op) == BLOCK_PAREN) { - AcpiOsPrintf ("(\n"); + AcpiOsPrintf (")\n"); } else { - AcpiOsPrintf ("{\n"); + AcpiOsPrintf ("}\n"); } } + } - /* Close a block if we are nested less than last time */ - - else if (DepthCount < LastDepth) - { - for (j = 0; j < (LastDepth - DepthCount); j++) - { - VERBOSE_PRINT ((DB_NO_OP_INFO, LastDepth - j)); - for (i = 0; i < (LastDepth - j - 1); i++) - { - AcpiOsPrintf ("%s", AcpiGbl_DbDisasmIndent); - } - - if (AcpiDbBlockType (Op) == BLOCK_PAREN) - { - AcpiOsPrintf (")\n"); - } - else - { - AcpiOsPrintf ("}\n"); - } - } - } - - /* In verbose mode, print the AML offset, opcode and depth count */ - - VERBOSE_PRINT ((DB_FULL_OP_INFO, (unsigned) Op->AmlOffset, Op->Opcode, DepthCount)); - + /* In verbose mode, print the AML offset, opcode and depth count */ - /* Indent the output according to the depth count */ + VERBOSE_PRINT ((DB_FULL_OP_INFO, (unsigned) Op->AmlOffset, Op->Opcode, DepthCount)); - for (i = 0; i < DepthCount; i++) - { - AcpiOsPrintf ("%s", AcpiGbl_DbDisasmIndent); - } + /* Indent the output according to the depth count */ - /* Now print the opcode */ + for (i = 0; i < DepthCount; i++) + { + AcpiOsPrintf ("%s", AcpiGbl_DbDisasmIndent); + } - AcpiDbDisplayOpcode (WalkState, Op); + /* Now print the opcode */ - /* Resolve a name reference */ + AcpiDbDisplayOpcode (WalkState, Op); - if ((Op->Opcode == AML_INT_NAMEPATH_OP && Op->Value.Name) && - (Op->Parent) && - (AcpiGbl_DbOpt_verbose)) - { - AcpiPsDisplayObjectPathname (WalkState, Op); - } + /* Resolve a name reference */ - AcpiOsPrintf ("\n"); + if ((Op->Opcode == AML_INT_NAMEPATH_OP && Op->Value.Name) && + (Op->Parent) && + (AcpiGbl_DbOpt_verbose)) + { + AcpiPsDisplayObjectPathname (WalkState, Op); + } - /* Get the next node in the tree */ + AcpiOsPrintf ("\n"); - Op = AcpiPsGetDepthNext (Origin, Op); - LastDepth = DepthCount; + /* Get the next node in the tree */ - NumOpcodes--; - if (!NumOpcodes) - { - Op = NULL; - } - } - - /* Close the last block(s) */ + Op = AcpiPsGetDepthNext (Origin, Op); + LastDepth = DepthCount; - DepthCount = LastDepth -1; - for (i = 0; i < LastDepth; i++) + NumOpcodes--; + if (!NumOpcodes) { - VERBOSE_PRINT ((DB_NO_OP_INFO, LastDepth - i)); - for (j = 0; j < DepthCount; j++) - { - AcpiOsPrintf ("%s", AcpiGbl_DbDisasmIndent); - } - AcpiOsPrintf ("}\n"); - DepthCount--; + Op = NULL; } - } - else + /* Close the last block(s) */ + + DepthCount = LastDepth -1; + for (i = 0; i < LastDepth; i++) { - AcpiDbDisplayOpcode (WalkState, Op); + VERBOSE_PRINT ((DB_NO_OP_INFO, LastDepth - i)); + for (j = 0; j < DepthCount; j++) + { + AcpiOsPrintf ("%s", AcpiGbl_DbDisasmIndent); + } + AcpiOsPrintf ("}\n"); + DepthCount--; } } @@ -557,7 +552,6 @@ AcpiDbDisplayPath ( return; } - if (OpInfo->Flags & AML_CREATE) { /* Field creation - check for a fully qualified namepath */ @@ -630,7 +624,6 @@ AcpiDbDisplayPath ( AcpiOsPrintf ("%4.4s", NamePath->Value.String); } } - else { Name = AcpiPsGetName (Search); @@ -678,24 +671,20 @@ AcpiDbDisplayOpcode ( AcpiOsPrintf ("<NULL OP PTR>"); } - /* op and arguments */ switch (Op->Opcode) { - case AML_BYTE_OP: if (AcpiGbl_DbOpt_verbose) { AcpiOsPrintf ("(UINT8) 0x%2.2X", Op->Value.Integer8); } - else { AcpiOsPrintf ("0x%2.2X", Op->Value.Integer8); } - break; @@ -705,12 +694,10 @@ AcpiDbDisplayOpcode ( { AcpiOsPrintf ("(UINT16) 0x%4.4X", Op->Value.Integer16); } - else { AcpiOsPrintf ("0x%4.4X", Op->Value.Integer16); } - break; @@ -720,12 +707,10 @@ AcpiDbDisplayOpcode ( { AcpiOsPrintf ("(UINT32) 0x%8.8X", Op->Value.Integer32); } - else { AcpiOsPrintf ("0x%8.8X", Op->Value.Integer32); } - break; @@ -736,13 +721,11 @@ AcpiDbDisplayOpcode ( AcpiOsPrintf ("(UINT64) 0x%8.8X%8.8X", Op->Value.Integer64.Hi, Op->Value.Integer64.Lo); } - else { AcpiOsPrintf ("0x%8.8X%8.8X", Op->Value.Integer64.Hi, Op->Value.Integer64.Lo); } - break; @@ -752,12 +735,10 @@ AcpiDbDisplayOpcode ( { AcpiOsPrintf ("\"%s\"", Op->Value.String); } - else { AcpiOsPrintf ("<\"NULL STRING PTR\">"); } - break; @@ -767,12 +748,10 @@ AcpiDbDisplayOpcode ( { AcpiOsPrintf ("\"%s\"", Op->Value.String); } - else { AcpiOsPrintf ("\"<NULL STATIC STRING PTR>\""); } - break; @@ -806,7 +785,6 @@ AcpiDbDisplayOpcode ( { AcpiOsPrintf ("ByteList (Length 0x%8.8X) ", Op->Value.Integer32); } - else { AcpiOsPrintf ("0x%2.2X", Op->Value.Integer32); @@ -819,7 +797,6 @@ AcpiDbDisplayOpcode ( AcpiOsPrintf (", 0x%2.2X", ByteData[i]); } } - break; @@ -839,7 +816,6 @@ AcpiDbDisplayOpcode ( AcpiDbDecodeInternalObject (WalkState->Results->Results.ObjDesc [WalkState->Results->Results.NumResults-1]); } #endif - break; } @@ -862,15 +838,12 @@ AcpiDbDisplayOpcode ( Name = AcpiPsGetName (Op); AcpiOsPrintf (" %4.4s", &Name); - if (AcpiGbl_DbOpt_verbose) + if ((AcpiGbl_DbOpt_verbose) && (Op->Opcode != AML_INT_NAMEDFIELD_OP)) { - AcpiOsPrintf (" (Path \\"); - AcpiDbDisplayPath (Op); - AcpiOsPrintf (")"); + AcpiPsDisplayObjectPathname (WalkState, Op); } } } - #endif /* ENABLE_DEBUGGER */ diff --git a/sys/contrib/dev/acpica/dbdisply.c b/sys/contrib/dev/acpica/dbdisply.c index 01489d8..df43e85 100644 --- a/sys/contrib/dev/acpica/dbdisply.c +++ b/sys/contrib/dev/acpica/dbdisply.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbdisply - debug display commands - * $Revision: 57 $ + * $Revision: 60 $ * ******************************************************************************/ @@ -168,7 +168,6 @@ AcpiDbGetPointer ( /* Simple flat pointer */ ObjPtr = (void *) STRTOUL (Target, NULL, 16); - #endif return (ObjPtr); @@ -228,6 +227,7 @@ AcpiDbDecodeAndDisplayObject ( { void *ObjPtr; ACPI_NAMESPACE_NODE *Node; + ACPI_OPERAND_OBJECT *ObjDesc; UINT32 Display = DB_BYTE_DISPLAY; NATIVE_CHAR Buffer[80]; ACPI_BUFFER RetBuf; @@ -259,7 +259,6 @@ AcpiDbDecodeAndDisplayObject ( } } - RetBuf.Length = sizeof (Buffer); RetBuf.Pointer = Buffer; @@ -314,7 +313,6 @@ AcpiDbDecodeAndDisplayObject ( return; } - AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_PARSE_OBJECT), Display, ACPI_UINT32_MAX); AcpiDbDumpParserDescriptor ((ACPI_PARSE_OBJECT *) ObjPtr); } @@ -368,17 +366,18 @@ DumpNte: AcpiUtDumpBuffer ((void *) Node, sizeof (ACPI_NAMESPACE_NODE), Display, ACPI_UINT32_MAX); AcpiExDumpNode (Node, 1); - if (Node->Object) + ObjDesc = AcpiNsGetAttachedObject (Node); + if (ObjDesc) { - AcpiOsPrintf ("\nAttached Object (%p):\n", Node->Object); - if (!AcpiOsReadable (Node->Object, sizeof (ACPI_OPERAND_OBJECT))) + AcpiOsPrintf ("\nAttached Object (%p):\n", ObjDesc); + if (!AcpiOsReadable (ObjDesc, sizeof (ACPI_OPERAND_OBJECT))) { - AcpiOsPrintf ("Invalid internal ACPI Object at address %p\n", Node->Object); + AcpiOsPrintf ("Invalid internal ACPI Object at address %p\n", ObjDesc); return; } - AcpiUtDumpBuffer ((void *) Node->Object, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX); - AcpiExDumpObjectDescriptor (Node->Object, 1); + AcpiUtDumpBuffer ((void *) ObjDesc, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX); + AcpiExDumpObjectDescriptor (ObjDesc, 1); } } @@ -475,7 +474,6 @@ AcpiDbDisplayInternalObject ( return; } - /* Decode the object type */ else if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_PARSER)) @@ -488,6 +486,7 @@ AcpiDbDisplayInternalObject ( AcpiOsPrintf ("<Node> Name %4.4s Type-%s", &((ACPI_NAMESPACE_NODE *)ObjDesc)->Name, AcpiUtGetTypeName (((ACPI_NAMESPACE_NODE *) ObjDesc)->Type)); + if (((ACPI_NAMESPACE_NODE *) ObjDesc)->Flags & ANOBJ_METHOD_ARG) { AcpiOsPrintf (" [Method Arg]"); @@ -623,9 +622,9 @@ AcpiDbDisplayMethodInfo ( } ObjDesc = WalkState->MethodDesc; - Node = WalkState->MethodNode; + Node = WalkState->MethodNode; - NumArgs = ObjDesc->Method.ParamCount; + NumArgs = ObjDesc->Method.ParamCount; Concurrency = ObjDesc->Method.Concurrency; AcpiOsPrintf ("Currently executing control method is [%4.4s]\n", &Node->Name); @@ -682,7 +681,6 @@ AcpiDbDisplayMethodInfo ( break; } - Op = AcpiPsGetDepthNext (StartOp, Op); } @@ -724,8 +722,6 @@ AcpiDbDisplayLocals (void) ObjDesc = WalkState->MethodDesc; Node = WalkState->MethodNode; - - AcpiOsPrintf ("Local Variables for method [%4.4s]:\n", &Node->Name); for (i = 0; i < MTH_NUM_LOCALS; i++) @@ -768,12 +764,13 @@ AcpiDbDisplayArguments (void) } ObjDesc = WalkState->MethodDesc; - Node = WalkState->MethodNode; + Node = WalkState->MethodNode; - NumArgs = ObjDesc->Method.ParamCount; + NumArgs = ObjDesc->Method.ParamCount; Concurrency = ObjDesc->Method.Concurrency; - AcpiOsPrintf ("Method [%4.4s] has %X arguments, max concurrency = %X\n", &Node->Name, NumArgs, Concurrency); + AcpiOsPrintf ("Method [%4.4s] has %X arguments, max concurrency = %X\n", + &Node->Name, NumArgs, Concurrency); for (i = 0; i < NumArgs; i++) { @@ -821,7 +818,8 @@ AcpiDbDisplayResults (void) NumResults = WalkState->Results->Results.NumResults; } - AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n", &Node->Name, NumResults); + AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n", + &Node->Name, NumResults); for (i = 0; i < NumResults; i++) { @@ -860,7 +858,6 @@ AcpiDbDisplayCallingTree (void) } Node = WalkState->MethodNode; - AcpiOsPrintf ("Current Control Method Call Tree\n"); for (i = 0; WalkState; i++) @@ -927,7 +924,6 @@ AcpiDbDisplayArgumentObject ( ACPI_WALK_STATE *WalkState) { - if (!AcpiGbl_CmSingleStep) { return; diff --git a/sys/contrib/dev/acpica/dbfileio.c b/sys/contrib/dev/acpica/dbfileio.c index cfc366f..1ab4dbf 100644 --- a/sys/contrib/dev/acpica/dbfileio.c +++ b/sys/contrib/dev/acpica/dbfileio.c @@ -2,7 +2,7 @@ * * Module Name: dbfileio - Debugger file I/O commands. These can't usually * be used when running the debugger in Ring 0 (Kernel mode) - * $Revision: 53 $ + * $Revision: 54 $ * ******************************************************************************/ @@ -463,7 +463,7 @@ AcpiDbLoadAcpiTable ( Status = AeLocalLoadTable (AcpiGbl_DbTablePtr); if (ACPI_FAILURE (Status)) { - if (Status == AE_EXIST) + if (Status == AE_ALREADY_EXISTS) { AcpiOsPrintf ("Table %4.4s is already installed\n", &AcpiGbl_DbTablePtr->Signature); diff --git a/sys/contrib/dev/acpica/dbstats.c b/sys/contrib/dev/acpica/dbstats.c index 8a60c11..566e57d 100644 --- a/sys/contrib/dev/acpica/dbstats.c +++ b/sys/contrib/dev/acpica/dbstats.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbstats - Generation and display of ACPI table statistics - * $Revision: 47 $ + * $Revision: 49 $ * ******************************************************************************/ @@ -169,6 +169,7 @@ void AcpiDbEnumerateObject ( ACPI_OPERAND_OBJECT *ObjDesc) { + ACPI_OPERAND_OBJECT *ObjDesc2; UINT32 Type; UINT32 i; @@ -210,7 +211,16 @@ AcpiDbEnumerateObject ( AcpiDbEnumerateObject (ObjDesc->Device.AddrHandler); break; + case ACPI_TYPE_BUFFER_FIELD: + ObjDesc2 = AcpiNsGetSecondaryObject (ObjDesc); + if (ObjDesc2) + { + AcpiGbl_ObjTypeCount [INTERNAL_TYPE_EXTRA]++; + } + break; + case ACPI_TYPE_REGION: + AcpiGbl_ObjTypeCount [INTERNAL_TYPE_EXTRA]++; AcpiDbEnumerateObject (ObjDesc->Region.AddrHandler); break; @@ -264,7 +274,7 @@ AcpiDbClassifyOneObject ( AcpiGbl_NumNodes++; Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - ObjDesc = ((ACPI_NAMESPACE_NODE *) ObjHandle)->Object; + ObjDesc = AcpiNsGetAttachedObject (Node); AcpiDbEnumerateObject (ObjDesc); @@ -517,6 +527,7 @@ AcpiDbDisplayStatistics ( AcpiOsPrintf ("NotifyHandler %3d\n", sizeof (ACPI_OBJECT_NOTIFY_HANDLER)); AcpiOsPrintf ("AddrHandler %3d\n", sizeof (ACPI_OBJECT_ADDR_HANDLER)); AcpiOsPrintf ("Extra %3d\n", sizeof (ACPI_OBJECT_EXTRA)); + AcpiOsPrintf ("Data %3d\n", sizeof (ACPI_OBJECT_DATA)); AcpiOsPrintf ("\n"); diff --git a/sys/contrib/dev/acpica/dbxface.c b/sys/contrib/dev/acpica/dbxface.c index 5dbd8dc..1833c97 100644 --- a/sys/contrib/dev/acpica/dbxface.c +++ b/sys/contrib/dev/acpica/dbxface.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbxface - AML Debugger external interfaces - * $Revision: 45 $ + * $Revision: 46 $ * ******************************************************************************/ @@ -434,5 +434,4 @@ AcpiDbTerminate (void) } - #endif /* ENABLE_DEBUGGER */ diff --git a/sys/contrib/dev/acpica/dsfield.c b/sys/contrib/dev/acpica/dsfield.c index b0955e1..e58f1be 100644 --- a/sys/contrib/dev/acpica/dsfield.c +++ b/sys/contrib/dev/acpica/dsfield.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dsfield - Dispatcher field routines - * $Revision: 46 $ + * $Revision: 56 $ * *****************************************************************************/ @@ -127,7 +127,6 @@ #define _COMPONENT ACPI_DISPATCHER MODULE_NAME ("dsfield") - /******************************************************************************* * @@ -139,10 +138,10 @@ * * RETURN: Status * - * DESCRIPTION: Execute the CreateField operators: + * DESCRIPTION: Execute the CreateField operators: * CreateBitFieldOp, - * CreateByteFieldOp, - * CreateWordFieldOp, + * CreateByteFieldOp, + * CreateWordFieldOp, * CreateDWordFieldOp, * CreateQWordFieldOp, * CreateFieldOp (all of which define fields in buffers) @@ -158,6 +157,8 @@ AcpiDsCreateBufferField ( ACPI_NAMESPACE_NODE *Node; ACPI_STATUS Status; ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_OPERAND_OBJECT *SecondDesc = NULL; + UINT32 Flags; FUNCTION_TRACE ("DsCreateBufferField"); @@ -182,11 +183,25 @@ AcpiDsCreateBufferField ( } /* + * During the load phase, we want to enter the name of the field into + * the namespace. During the execute phase (when we evaluate the size + * operand), we want to lookup the name + */ + if (WalkState->ParseFlags & ACPI_PARSE_EXECUTE) + { + Flags = NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE; + } + else + { + Flags = NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE | NS_ERROR_IF_FOUND; + } + + /* * Enter the NameString into the namespace */ Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String, INTERNAL_TYPE_DEF_ANY, IMODE_LOAD_PASS1, - NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, + Flags, WalkState, &(Node)); if (ACPI_FAILURE (Status)) { @@ -204,7 +219,8 @@ AcpiDsCreateBufferField ( * we need to create the field object. Otherwise, this was a lookup of an * existing node and we don't want to create the field object again. */ - if (Node->Object) + ObjDesc = AcpiNsGetAttachedObject (Node); + if (ObjDesc) { return_ACPI_STATUS (AE_OK); } @@ -224,28 +240,22 @@ AcpiDsCreateBufferField ( } /* - * Allocate a method object for this field unit - */ - ObjDesc->BufferField.Extra = AcpiUtCreateInternalObject ( - INTERNAL_TYPE_EXTRA); - if (!ObjDesc->BufferField.Extra) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - /* * Remember location in AML stream of the field unit * opcode and operands -- since the buffer and index * operands must be evaluated. */ - ObjDesc->BufferField.Extra->Extra.AmlStart = ((ACPI_PARSE2_OBJECT *) Op)->Data; - ObjDesc->BufferField.Extra->Extra.AmlLength = ((ACPI_PARSE2_OBJECT *) Op)->Length; - ObjDesc->BufferField.Node = Node; + SecondDesc = ObjDesc->Common.NextObject; + SecondDesc->Extra.AmlStart = ((ACPI_PARSE2_OBJECT *) Op)->Data; + SecondDesc->Extra.AmlLength = ((ACPI_PARSE2_OBJECT *) Op)->Length; + ObjDesc->BufferField.Node = Node; - /* Attach constructed field descriptor to parent node */ + /* Attach constructed field descriptors to parent node */ Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_BUFFER_FIELD); + if (ACPI_FAILURE (Status)) + { + goto Cleanup; + } Cleanup: @@ -257,7 +267,6 @@ Cleanup: } - /******************************************************************************* * * FUNCTION: AcpiDsGetFieldNames @@ -310,36 +319,48 @@ AcpiDsGetFieldNames ( case AML_INT_ACCESSFIELD_OP: /* - * Get a new AccessType and AccessAttribute for all - * entries (until end or another AccessAs keyword) + * Get a new AccessType and AccessAttribute -- to be used for all + * field units that follow, until field end or another AccessAs keyword. + * + * In FieldFlags, preserve the flag bits other than the ACCESS_TYPE bits */ - Info->FieldFlags = (UINT8) ((Info->FieldFlags & FIELD_ACCESS_TYPE_MASK) || - ((UINT8) (Arg->Value.Integer >> 8))); + Info->FieldFlags = (UINT8) ((Info->FieldFlags & ~(AML_FIELD_ACCESS_TYPE_MASK)) | + ((UINT8) (Arg->Value.Integer32 >> 8))); + + Info->Attribute = (UINT8) (Arg->Value.Integer32); break; case AML_INT_NAMEDFIELD_OP: - /* Enter a new field name into the namespace */ + /* Lookup the name */ Status = AcpiNsLookup (WalkState->ScopeInfo, (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)Arg)->Name, - Info->FieldType, IMODE_LOAD_PASS1, - NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, + Info->FieldType, IMODE_EXECUTE, NS_DONT_OPEN_SCOPE, NULL, &Info->FieldNode); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); - } + if (Status != AE_ALREADY_EXISTS) + { + return_ACPI_STATUS (Status); + } - /* Create and initialize an object for the new Field Node */ + REPORT_ERROR (("Field name [%4.4s] already exists in current scope\n", + &((ACPI_PARSE2_OBJECT *)Arg)->Name)); + } + else + { + Arg->Node = Info->FieldNode; + Info->FieldBitLength = Arg->Value.Size; - Info->FieldBitLength = Arg->Value.Size; + /* Create and initialize an object for the new Field Node */ - Status = AcpiExPrepFieldValue (Info); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); + Status = AcpiExPrepFieldValue (Info); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } } /* Keep track of bit position for the next field */ @@ -409,6 +430,7 @@ AcpiDsCreateField ( Arg = Arg->Next; Info.FieldFlags = Arg->Value.Integer8; + Info.Attribute = 0; /* Each remaining arg is a Named Field */ @@ -423,6 +445,90 @@ AcpiDsCreateField ( /******************************************************************************* * + * FUNCTION: AcpiDsInitFieldObjects + * + * PARAMETERS: Op - Op containing the Field definition and args + * ` WalkState - Current method state + * + * RETURN: Status + * + * DESCRIPTION: For each "Field Unit" name in the argument list that is + * part of the field declaration, enter the name into the + * namespace. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsInitFieldObjects ( + ACPI_PARSE_OBJECT *Op, + ACPI_WALK_STATE *WalkState) +{ + ACPI_STATUS Status = AE_AML_ERROR; + ACPI_PARSE_OBJECT *Arg = NULL; + ACPI_NAMESPACE_NODE *Node; + UINT8 Type = 0; + + + FUNCTION_TRACE_PTR ("DsInitFieldObjects", Op); + + + switch (WalkState->Opcode) + { + case AML_FIELD_OP: + Arg = AcpiPsGetArg (Op, 2); + Type = INTERNAL_TYPE_REGION_FIELD; + break; + + case AML_BANK_FIELD_OP: + Arg = AcpiPsGetArg (Op, 4); + Type = INTERNAL_TYPE_BANK_FIELD; + break; + + case AML_INDEX_FIELD_OP: + Arg = AcpiPsGetArg (Op, 3); + Type = INTERNAL_TYPE_INDEX_FIELD; + break; + } + + /* + * Walk the list of entries in the FieldList + */ + while (Arg) + { + /* Ignore OFFSET and ACCESSAS terms here */ + + if (Arg->Opcode == AML_INT_NAMEDFIELD_OP) + { + Status = AcpiNsLookup (WalkState->ScopeInfo, + (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)Arg)->Name, + Type, IMODE_LOAD_PASS1, + NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE | NS_ERROR_IF_FOUND, + NULL, &Node); + if (ACPI_FAILURE (Status)) + { + if (Status != AE_ALREADY_EXISTS) + { + return_ACPI_STATUS (Status); + } + + REPORT_ERROR (("Field name [%4.4s] already exists in current scope\n", + &((ACPI_PARSE2_OBJECT *)Arg)->Name)); + } + + Arg->Node = Node; + } + + /* Move on to next field in the list */ + + Arg = Arg->Next; + } + + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * * FUNCTION: AcpiDsCreateBankField * * PARAMETERS: Op - Op containing the Field definition and args diff --git a/sys/contrib/dev/acpica/dsmethod.c b/sys/contrib/dev/acpica/dsmethod.c index decc393..147a4ee 100644 --- a/sys/contrib/dev/acpica/dsmethod.c +++ b/sys/contrib/dev/acpica/dsmethod.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dsmethod - Parser/Interpreter interface - control method parsing - * $Revision: 69 $ + * $Revision: 73 $ * *****************************************************************************/ @@ -177,7 +177,7 @@ AcpiDsParseMethod ( /* Extract the method object from the method Node */ Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - ObjDesc = Node->Object; + ObjDesc = AcpiNsGetAttachedObject (Node); if (!ObjDesc) { return_ACPI_STATUS (AE_NULL_OBJECT); @@ -221,11 +221,11 @@ AcpiDsParseMethod ( return_ACPI_STATUS (AE_NO_MEMORY); } - Status = AcpiDsInitAmlWalk (WalkState, Op, Node, ObjDesc->Method.AmlStart, + Status = AcpiDsInitAmlWalk (WalkState, Op, Node, ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength, NULL, NULL, 1); if (ACPI_FAILURE (Status)) { - /* TBD: delete walk state */ + AcpiDsDeleteWalkState (WalkState); return_ACPI_STATUS (Status); } @@ -351,7 +351,7 @@ AcpiDsBeginMethodExecution ( ACPI_STATUS AcpiDsCallControlMethod ( - ACPI_WALK_LIST *WalkList, + ACPI_THREAD_STATE *Thread, ACPI_WALK_STATE *ThisWalkState, ACPI_PARSE_OBJECT *Op) /* TBD: This operand is obsolete */ { @@ -411,12 +411,12 @@ AcpiDsCallControlMethod ( goto Cleanup; } - Status = AcpiDsInitAmlWalk (NextWalkState, Op, MethodNode, - ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength, + Status = AcpiDsInitAmlWalk (NextWalkState, Op, MethodNode, + ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength, NULL, NULL, 1); if (ACPI_FAILURE (Status)) { - /* TBD: delete walk state */ + AcpiDsDeleteWalkState (NextWalkState); goto Cleanup; } @@ -429,7 +429,7 @@ AcpiDsCallControlMethod ( /* 2) Execute: Create a new state for the preempting walk */ NextWalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwningId, - NULL, ObjDesc, WalkList); + NULL, ObjDesc, Thread); if (!NextWalkState) { Status = AE_NO_MEMORY; @@ -440,12 +440,12 @@ AcpiDsCallControlMethod ( * The resolved arguments were put on the previous walk state's operand * stack. Operands on the previous walk state stack always * start at index 0. - * Null terminate the list of arguments + * Null terminate the list of arguments */ ThisWalkState->Operands [ThisWalkState->NumOperands] = NULL; - Status = AcpiDsInitAmlWalk (NextWalkState, NULL, MethodNode, - ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength, + Status = AcpiDsInitAmlWalk (NextWalkState, NULL, MethodNode, + ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength, &ThisWalkState->Operands[0], NULL, 3); if (ACPI_FAILURE (Status)) { diff --git a/sys/contrib/dev/acpica/dsmthdat.c b/sys/contrib/dev/acpica/dsmthdat.c index e44829d..e597976 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: 49 $ + * $Revision: 53 $ * ******************************************************************************/ @@ -141,6 +141,12 @@ * This allows RefOf and DeRefOf to work properly for these * special data types. * + * NOTES: WalkState fields are initialized to zero by the + * ACPI_MEM_CALLOCATE(). + * + * A pseudo-Namespace Node is assigned to each argument and local + * so that RefOf() can return a pointer to the Node. + * ******************************************************************************/ ACPI_STATUS @@ -152,13 +158,6 @@ AcpiDsMethodDataInit ( FUNCTION_TRACE ("DsMethodDataInit"); - /* - * WalkState fields are initialized to zero by the - * ACPI_MEM_CALLOCATE(). - * - * An Node is assigned to each argument and local so - * that RefOf() can return a pointer to the Node. - */ /* Init the method arguments */ @@ -207,52 +206,38 @@ AcpiDsMethodDataDeleteAll ( ACPI_WALK_STATE *WalkState) { UINT32 Index; - ACPI_OPERAND_OBJECT *Object; FUNCTION_TRACE ("DsMethodDataDeleteAll"); - /* Delete the locals */ - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Deleting local variables in %p\n", WalkState)); + /* Detach the locals */ for (Index = 0; Index < MTH_NUM_LOCALS; Index++) { - Object = WalkState->LocalVariables[Index].Object; - if (Object) + if (WalkState->LocalVariables[Index].Object) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Local%d=%p\n", Index, Object)); - - /* Remove first */ + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Local%d=%p\n", + Index, WalkState->LocalVariables[Index].Object)); - WalkState->LocalVariables[Index].Object = NULL; + /* Detach object (if present) and remove a reference */ - /* Was given a ref when stored */ - - AcpiUtRemoveReference (Object); + AcpiNsDetachObject (&WalkState->LocalVariables[Index]); } } - - /* Delete the arguments */ - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Deleting arguments in %p\n", WalkState)); + /* Detach the arguments */ for (Index = 0; Index < MTH_NUM_ARGS; Index++) { - Object = WalkState->Arguments[Index].Object; - if (Object) + if (WalkState->Arguments[Index].Object) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Arg%d=%p\n", Index, Object)); - - /* Remove first */ + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Arg%d=%p\n", + Index, WalkState->Arguments[Index].Object)); - WalkState->Arguments[Index].Object = NULL; + /* Detach object (if present) and remove a reference */ - /* Was given a ref when stored */ - - AcpiUtRemoveReference (Object); + AcpiNsDetachObject (&WalkState->Arguments[Index]); } } @@ -270,7 +255,9 @@ AcpiDsMethodDataDeleteAll ( * * RETURN: Status * - * DESCRIPTION: Initialize arguments for a method + * DESCRIPTION: Initialize arguments for a method. The parameter list is a list + * of ACPI operand objects, either null terminated or whose length + * is defined by MaxParamCount. * ******************************************************************************/ @@ -281,8 +268,7 @@ AcpiDsMethodDataInitArgs ( ACPI_WALK_STATE *WalkState) { ACPI_STATUS Status; - UINT32 Mindex; - UINT32 Pindex; + UINT32 Index = 0; FUNCTION_TRACE_PTR ("DsMethodDataInitArgs", Params); @@ -296,85 +282,68 @@ AcpiDsMethodDataInitArgs ( /* Copy passed parameters into the new method stack frame */ - for (Pindex = Mindex = 0; - (Mindex < MTH_NUM_ARGS) && (Pindex < MaxParamCount); - Mindex++) + while ((Index < MTH_NUM_ARGS) && (Index < MaxParamCount) && Params[Index]) { - if (Params[Pindex]) + /* + * A valid parameter. + * Store the argument in the method/walk descriptor + */ + Status = AcpiDsStoreObjectToLocal (AML_ARG_OP, Index, Params[Index], + WalkState); + if (ACPI_FAILURE (Status)) { - /* - * A valid parameter. - * Set the current method argument to the - * Params[Pindex++] argument object descriptor - */ - Status = AcpiDsStoreObjectToLocal (AML_ARG_OP, Mindex, - Params[Pindex], WalkState); - if (ACPI_FAILURE (Status)) - { - break; - } - - Pindex++; + return_ACPI_STATUS (Status); } - else - { - break; - } + Index++; } - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%d args passed to method\n", Pindex)); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%d args passed to method\n", Index)); return_ACPI_STATUS (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiDsMethodDataGetEntry + * FUNCTION: AcpiDsMethodDataGetNode * * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP - * Index - Which localVar or argument to get - * Entry - Pointer to where a pointer to the stack - * entry is returned. + * Index - Which localVar or argument whose type + * to get * WalkState - Current walk state object * - * RETURN: Status - * - * DESCRIPTION: Get the address of the object entry given by Opcode:Index + * RETURN: Get the Node associated with a local or arg. * ******************************************************************************/ ACPI_STATUS -AcpiDsMethodDataGetEntry ( +AcpiDsMethodDataGetNode ( UINT16 Opcode, UINT32 Index, ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT ***Entry) + ACPI_NAMESPACE_NODE **Node) { - - FUNCTION_TRACE_U32 ("DsMethodDataGetEntry", Index); + FUNCTION_TRACE ("DsMethodDataGetNode"); /* - * Get the requested object. - * The stack "Opcode" is either a LocalVariable or an Argument + * Method Locals and Arguments are supported */ switch (Opcode) { - case AML_LOCAL_OP: if (Index > MTH_MAX_LOCAL) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "LocalVar index %d is invalid (max %d)\n", + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Local index %d is invalid (max %d)\n", Index, MTH_MAX_LOCAL)); - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS (AE_AML_INVALID_INDEX); } - *Entry = (ACPI_OPERAND_OBJECT **) - &WalkState->LocalVariables[Index].Object; - break; + /* Return a pointer to the pseudo-node */ + *Node = &WalkState->LocalVariables[Index]; + break; case AML_ARG_OP: @@ -382,27 +351,27 @@ AcpiDsMethodDataGetEntry ( { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Arg index %d is invalid (max %d)\n", Index, MTH_MAX_ARG)); - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS (AE_AML_INVALID_INDEX); } - *Entry = (ACPI_OPERAND_OBJECT **) - &WalkState->Arguments[Index].Object; - break; + /* Return a pointer to the pseudo-node */ + *Node = &WalkState->Arguments[Index]; + break; default: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Opcode %d is invalid\n", Opcode)); - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS (AE_AML_BAD_OPCODE); + break; } - return_ACPI_STATUS (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiDsMethodDataSetEntry + * FUNCTION: AcpiDsMethodDataSetValue * * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP * Index - Which localVar or argument to get @@ -416,22 +385,22 @@ AcpiDsMethodDataGetEntry ( ******************************************************************************/ ACPI_STATUS -AcpiDsMethodDataSetEntry ( +AcpiDsMethodDataSetValue ( UINT16 Opcode, UINT32 Index, ACPI_OPERAND_OBJECT *Object, ACPI_WALK_STATE *WalkState) { ACPI_STATUS Status; - ACPI_OPERAND_OBJECT **Entry; + ACPI_NAMESPACE_NODE *Node; - FUNCTION_TRACE ("DsMethodDataSetEntry"); + FUNCTION_TRACE ("DsMethodDataSetValue"); - /* Get a pointer to the stack entry to set */ + /* Get the namespace node for the arg/local */ - Status = AcpiDsMethodDataGetEntry (Opcode, Index, WalkState, &Entry); + Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -443,8 +412,7 @@ AcpiDsMethodDataSetEntry ( /* Install the object into the stack entry */ - *Entry = Object; - + Node->Object = Object; return_ACPI_STATUS (AE_OK); } @@ -458,8 +426,7 @@ AcpiDsMethodDataSetEntry ( * to get * WalkState - Current walk state object * - * RETURN: Data type of selected Arg or Local - * Used only in ExecMonadic2()/TypeOp. + * RETURN: Data type of current value of the selected Arg or Local * ******************************************************************************/ @@ -470,98 +437,34 @@ AcpiDsMethodDataGetType ( ACPI_WALK_STATE *WalkState) { ACPI_STATUS Status; - ACPI_OPERAND_OBJECT **Entry; + ACPI_NAMESPACE_NODE *Node; ACPI_OPERAND_OBJECT *Object; FUNCTION_TRACE ("DsMethodDataGetType"); - /* Get a pointer to the requested stack entry */ + /* Get the namespace node for the arg/local */ - Status = AcpiDsMethodDataGetEntry (Opcode, Index, WalkState, &Entry); + Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node); if (ACPI_FAILURE (Status)) { return_VALUE ((ACPI_TYPE_NOT_FOUND)); } - /* Get the object from the method stack */ - - Object = *Entry; - - /* Get the object type */ + /* Get the object */ + Object = AcpiNsGetAttachedObject (Node); if (!Object) { - /* Any == 0 => "uninitialized" -- see spec 15.2.3.5.2.28 */ - return_VALUE (ACPI_TYPE_ANY); - } - - return_VALUE (Object->Common.Type); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsMethodDataGetNode - * - * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP - * Index - Which localVar or argument whose type - * to get - * WalkState - Current walk state object - * - * RETURN: Get the Node associated with a local or arg. - * - ******************************************************************************/ - -ACPI_NAMESPACE_NODE * -AcpiDsMethodDataGetNode ( - UINT16 Opcode, - UINT32 Index, - ACPI_WALK_STATE *WalkState) -{ - ACPI_NAMESPACE_NODE *Node = NULL; - - - FUNCTION_TRACE ("DsMethodDataGetNode"); - - - switch (Opcode) - { - - case AML_LOCAL_OP: - - if (Index > MTH_MAX_LOCAL) - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Local index %d is invalid (max %d)\n", - Index, MTH_MAX_LOCAL)); - return_PTR (Node); - } - - Node = &WalkState->LocalVariables[Index]; - break; - - - case AML_ARG_OP: - - if (Index > MTH_MAX_ARG) - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Arg index %d is invalid (max %d)\n", - Index, MTH_MAX_ARG)); - return_PTR (Node); - } - - Node = &WalkState->Arguments[Index]; - break; - + /* Uninitialized local/arg, return TYPE_ANY */ - default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Opcode %d is invalid\n", Opcode)); - break; + return_VALUE (ACPI_TYPE_ANY); } + /* Get the object type */ - return_PTR (Node); + return_VALUE (Object->Common.Type); } @@ -591,7 +494,7 @@ AcpiDsMethodDataGetValue ( ACPI_OPERAND_OBJECT **DestDesc) { ACPI_STATUS Status; - ACPI_OPERAND_OBJECT **Entry; + ACPI_NAMESPACE_NODE *Node; ACPI_OPERAND_OBJECT *Object; @@ -606,26 +509,24 @@ AcpiDsMethodDataGetValue ( return_ACPI_STATUS (AE_BAD_PARAMETER); } + /* Get the namespace node for the arg/local */ - /* Get a pointer to the requested method stack entry */ - - Status = AcpiDsMethodDataGetEntry (Opcode, Index, WalkState, &Entry); + Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - /* Get the object from the method stack */ - - Object = *Entry; + /* Get the object from the node */ + Object = Node->Object; /* Examine the returned object, it must be valid. */ if (!Object) { /* - * Index points to uninitialized object stack value. + * Index points to uninitialized object. * This means that either 1) The expected argument was * not passed to the method, or 2) A local variable * was referenced by the method (via the ASL) @@ -635,25 +536,24 @@ AcpiDsMethodDataGetValue ( { case AML_ARG_OP: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Arg[%d] at entry %p\n", - Index, Entry)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Arg[%d] at node %p\n", + Index, Node)); return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG); break; case AML_LOCAL_OP: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Local[%d] at entry %p\n", - Index, Entry)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Local[%d] at node %p\n", + Index, Node)); return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL); break; } } - /* - * Index points to initialized and valid object stack value. + * The Index points to an initialized and valid object. * Return an additional reference to the object */ *DestDesc = Object; @@ -685,39 +585,39 @@ AcpiDsMethodDataDeleteValue ( ACPI_WALK_STATE *WalkState) { ACPI_STATUS Status; - ACPI_OPERAND_OBJECT **Entry; + ACPI_NAMESPACE_NODE *Node; ACPI_OPERAND_OBJECT *Object; FUNCTION_TRACE ("DsMethodDataDeleteValue"); - /* Get a pointer to the requested entry */ + /* Get the namespace node for the arg/local */ - Status = AcpiDsMethodDataGetEntry (Opcode, Index, WalkState, &Entry); + Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - /* Get the current entry in this slot k */ + /* Get the associated object */ - Object = *Entry; + Object = AcpiNsGetAttachedObject (Node); /* * Undefine the Arg or Local by setting its descriptor * pointer to NULL. Locals/Args can contain both * ACPI_OPERAND_OBJECTS and ACPI_NAMESPACE_NODEs */ - *Entry = NULL; + Node->Object = NULL; if ((Object) && (VALID_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_INTERNAL))) { /* - * There is a valid object in this slot + * There is a valid object. * Decrement the reference count by one to balance the - * increment when the object was stored in the slot. + * increment when the object was stored. */ AcpiUtRemoveReference (Object); } @@ -732,14 +632,14 @@ AcpiDsMethodDataDeleteValue ( * * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP * Index - Which localVar or argument to set - * SrcDesc - Value to be stored + * ObjDesc - Value to be stored * WalkState - Current walk state * * RETURN: Status * - * DESCRIPTION: Store a value in an Arg or Local. The SrcDesc is installed + * DESCRIPTION: Store a value in an Arg or Local. The ObjDesc is installed * as the new value for the Arg or Local and the reference count - * for SrcDesc is incremented. + * for ObjDesc is incremented. * ******************************************************************************/ @@ -747,48 +647,48 @@ ACPI_STATUS AcpiDsStoreObjectToLocal ( UINT16 Opcode, UINT32 Index, - ACPI_OPERAND_OBJECT *SrcDesc, + ACPI_OPERAND_OBJECT *ObjDesc, ACPI_WALK_STATE *WalkState) { ACPI_STATUS Status; - ACPI_OPERAND_OBJECT **Entry; + ACPI_NAMESPACE_NODE *Node; + ACPI_OPERAND_OBJECT *CurrentObjDesc; - FUNCTION_TRACE ("DsMethodDataSetValue"); + FUNCTION_TRACE ("DsStoreObjectToLocal"); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode=%d Idx=%d Obj=%p\n", - Opcode, Index, SrcDesc)); + Opcode, Index, ObjDesc)); /* Parameter validation */ - if (!SrcDesc) + if (!ObjDesc) { return_ACPI_STATUS (AE_BAD_PARAMETER); } + /* Get the namespace node for the arg/local */ - /* Get a pointer to the requested method stack entry */ - - Status = AcpiDsMethodDataGetEntry (Opcode, Index, WalkState, &Entry); + Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node); if (ACPI_FAILURE (Status)) { - goto Cleanup; + return_ACPI_STATUS (Status); } - if (*Entry == SrcDesc) + CurrentObjDesc = AcpiNsGetAttachedObject (Node); + if (CurrentObjDesc == ObjDesc) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p already installed!\n", SrcDesc)); - goto Cleanup; + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p already installed!\n", ObjDesc)); + return_ACPI_STATUS (Status); } - /* * If there is an object already in this slot, we either * have to delete it, or if this is an argument and there * is an object reference stored there, we have to do * an indirect store! */ - if (*Entry) + if (CurrentObjDesc) { /* * Check for an indirect store if an argument @@ -807,38 +707,25 @@ AcpiDsStoreObjectToLocal ( * Weird, but true. */ if ((Opcode == AML_ARG_OP) && - (VALID_DESCRIPTOR_TYPE (*Entry, ACPI_DESC_TYPE_NAMED))) + (VALID_DESCRIPTOR_TYPE (CurrentObjDesc, ACPI_DESC_TYPE_NAMED))) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Arg (%p) is an ObjRef(Node), storing in %p\n", - SrcDesc, *Entry)); + "Arg (%p) is an ObjRef(Node), storing in node %p\n", + ObjDesc, CurrentObjDesc)); /* Detach an existing object from the Node */ - AcpiNsDetachObject ((ACPI_NAMESPACE_NODE *) *Entry); + AcpiNsDetachObject ((ACPI_NAMESPACE_NODE *) CurrentObjDesc); /* * Store this object into the Node - * (do the indirect store) + * (perform the indirect store) */ - Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) *Entry, SrcDesc, - SrcDesc->Common.Type); + Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) CurrentObjDesc, + ObjDesc, ObjDesc->Common.Type); return_ACPI_STATUS (Status); } - -#ifdef ACPI_ENABLE_IMPLICIT_CONVERSION - /* - * Perform "Implicit conversion" of the new object to the type of the - * existing object - */ - Status = AcpiExConvertToTargetType ((*Entry)->Common.Type, &SrcDesc, WalkState); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } -#endif - /* * Delete the existing object * before storing the new one @@ -846,28 +733,14 @@ AcpiDsStoreObjectToLocal ( AcpiDsMethodDataDeleteValue (Opcode, Index, WalkState); } - /* - * Install the ObjStack descriptor (*SrcDesc) into + * Install the ObjStack descriptor (*ObjDesc) into * the descriptor for the Arg or Local. * Install the new object in the stack entry * (increments the object reference count by one) */ - Status = AcpiDsMethodDataSetEntry (Opcode, Index, SrcDesc, WalkState); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - /* Normal exit */ - - return_ACPI_STATUS (AE_OK); - - - /* Error exit */ - -Cleanup: - + Status = AcpiDsMethodDataSetValue (Opcode, Index, ObjDesc, WalkState); return_ACPI_STATUS (Status); } + diff --git a/sys/contrib/dev/acpica/dsobject.c b/sys/contrib/dev/acpica/dsobject.c index a997831..6264038 100644 --- a/sys/contrib/dev/acpica/dsobject.c +++ b/sys/contrib/dev/acpica/dsobject.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dsobject - Dispatcher object management routines - * $Revision: 81 $ + * $Revision: 85 $ * *****************************************************************************/ @@ -352,6 +352,8 @@ AcpiDsInitObjectFromOp ( { case ACPI_TYPE_BUFFER: + ObjDesc->Buffer.Node = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0]; + /* First arg is a number */ AcpiDsCreateOperand (WalkState, Op->Value.Arg, 0); @@ -448,11 +450,11 @@ AcpiDsInitObjectFromOp ( ObjDesc->String.Pointer = Op->Value.String; ObjDesc->String.Length = STRLEN (Op->Value.String); - /* + /* * The string is contained in the ACPI table, don't ever try * to delete it */ - ObjDesc->Common.Flags |= AOPOBJ_STATIC_POINTER; + ObjDesc->Common.Flags |= AOPOBJ_STATIC_POINTER; break; @@ -531,7 +533,6 @@ AcpiDsBuildInternalSimpleObj ( ACPI_OPERAND_OBJECT **ObjDescPtr) { ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OBJECT_TYPE8 Type; ACPI_STATUS Status; UINT32 Length; char *Name; @@ -543,17 +544,15 @@ AcpiDsBuildInternalSimpleObj ( if (Op->Opcode == AML_INT_NAMEPATH_OP) { /* - * This is an object reference. If The name was - * previously looked up in the NS, it is stored in this op. + * This is an object reference. If this name was + * previously looked up in the namespace, it was stored in this op. * Otherwise, go ahead and look it up now */ if (!Op->Node) { - Status = AcpiNsLookup (WalkState->ScopeInfo, - Op->Value.String, ACPI_TYPE_ANY, - IMODE_EXECUTE, - NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE, - NULL, + Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Value.String, + ACPI_TYPE_ANY, IMODE_EXECUTE, + NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE, NULL, (ACPI_NAMESPACE_NODE **)&(Op->Node)); if (ACPI_FAILURE (Status)) @@ -585,24 +584,11 @@ AcpiDsBuildInternalSimpleObj ( } } } - - /* - * The reference will be a Reference - * TBD: [Restructure] unless we really need a separate - * type of INTERNAL_TYPE_REFERENCE change - * AcpiDsMapOpcodeToDataType to handle this case - */ - Type = INTERNAL_TYPE_REFERENCE; - } - else - { - Type = AcpiDsMapOpcodeToDataType (Op->Opcode, NULL); } - /* Create and init the internal ACPI object */ - ObjDesc = AcpiUtCreateInternalObject (Type); + ObjDesc = AcpiUtCreateInternalObject ((AcpiPsGetOpcodeInfo (Op->Opcode))->ObjectType); if (!ObjDesc) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -785,7 +771,7 @@ AcpiDsCreateNode ( * parts of the table, we can arrive here twice. Only init * the named object node the first time through */ - if (Node->Object) + if (AcpiNsGetAttachedObject (Node)) { return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/dsopcode.c b/sys/contrib/dev/acpica/dsopcode.c index 52dec60..1787efd 100644 --- a/sys/contrib/dev/acpica/dsopcode.c +++ b/sys/contrib/dev/acpica/dsopcode.c @@ -2,7 +2,7 @@ * * Module Name: dsopcode - Dispatcher Op Region support and handling of * "control" opcodes - * $Revision: 56 $ + * $Revision: 66 $ * *****************************************************************************/ @@ -132,90 +132,61 @@ /***************************************************************************** * - * FUNCTION: AcpiDsGetBufferFieldArguments + * FUNCTION: AcpiDsExecuteArguments * - * PARAMETERS: ObjDesc - A valid BufferField object + * PARAMETERS: Node - Parent NS node + * ExtraDesc - Has AML pointer and length * * RETURN: Status. * - * DESCRIPTION: Get BufferField Buffer and Index. This implements the late - * evaluation of these field attributes. + * DESCRIPTION: Late execution of region or field arguments * ****************************************************************************/ ACPI_STATUS -AcpiDsGetBufferFieldArguments ( - ACPI_OPERAND_OBJECT *ObjDesc) +AcpiDsExecuteArguments ( + ACPI_NAMESPACE_NODE *Node, + ACPI_OPERAND_OBJECT *ExtraDesc) { - ACPI_OPERAND_OBJECT *ExtraDesc; - ACPI_NAMESPACE_NODE *Node; - ACPI_PARSE_OBJECT *Op; - ACPI_PARSE_OBJECT *FieldOp; ACPI_STATUS Status; - ACPI_TABLE_DESC *TableDesc; + ACPI_PARSE_OBJECT *Op; ACPI_WALK_STATE *WalkState; + ACPI_PARSE_OBJECT *Arg; - FUNCTION_TRACE_PTR ("DsGetBufferFieldArguments", ObjDesc); - - - if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) - { - return_ACPI_STATUS (AE_OK); - } - - - /* Get the AML pointer (method object) and BufferField node */ - - ExtraDesc = ObjDesc->BufferField.Extra; - Node = ObjDesc->BufferField.Node; - - DEBUG_EXEC(AcpiUtDisplayInitPathname (Node, " [Field]")); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BufferField JIT Init\n", - (char*)&Node->Name)); + FUNCTION_TRACE ("AcpiDsExecuteArguments"); /* * Allocate a new parser op to be the root of the parsed - * OpRegion tree + * BufferField tree */ Op = AcpiPsAllocOp (AML_SCOPE_OP); if (!Op) { - return (AE_NO_MEMORY); + return_ACPI_STATUS (AE_NO_MEMORY); } /* Save the Node for use in AcpiPsParseAml */ Op->Node = AcpiNsGetParentObject (Node); - /* Get a handle to the parent ACPI table */ - - Status = AcpiTbHandleToObject (Node->OwnerId, &TableDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* Create and initialize a new parser state */ - WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, - NULL, NULL, NULL); + WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, NULL, NULL, NULL); if (!WalkState) { return_ACPI_STATUS (AE_NO_MEMORY); } - Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, ExtraDesc->Extra.AmlStart, + Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, ExtraDesc->Extra.AmlStart, ExtraDesc->Extra.AmlLength, NULL, NULL, 1); if (ACPI_FAILURE (Status)) { - /* TBD: delete walk state */ + AcpiDsDeleteWalkState (WalkState); return_ACPI_STATUS (Status); } - /* TBD: No Walk flags?? */ - WalkState->ParseFlags = 0; /* Pass1: Parse the entire BufferField declaration */ @@ -229,28 +200,24 @@ AcpiDsGetBufferFieldArguments ( /* Get and init the actual FieldUnit Op created above */ - FieldOp = Op->Value.Arg; + Arg = Op->Value.Arg; Op->Node = Node; - - - FieldOp = Op->Value.Arg; - FieldOp->Node = Node; + Arg->Node = Node; AcpiPsDeleteParseTree (Op); - /* Evaluate the address and length arguments for the OpRegion */ + /* Evaluate the address and length arguments for the Buffer Field */ Op = AcpiPsAllocOp (AML_SCOPE_OP); if (!Op) { - return (AE_NO_MEMORY); + return_ACPI_STATUS (AE_NO_MEMORY); } Op->Node = AcpiNsGetParentObject (Node); /* Create and initialize a new parser state */ - WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, - NULL, NULL, NULL); + WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, NULL, NULL, NULL); if (!WalkState) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -260,160 +227,110 @@ AcpiDsGetBufferFieldArguments ( ExtraDesc->Extra.AmlLength, NULL, NULL, 3); if (ACPI_FAILURE (Status)) { - /* TBD: delete walk state */ + AcpiDsDeleteWalkState (WalkState); return_ACPI_STATUS (Status); } Status = AcpiPsParseAml (WalkState); AcpiPsDeleteParseTree (Op); - /* - * The pseudo-method object is no longer needed since the region is - * now initialized - */ - AcpiUtRemoveReference (ObjDesc->BufferField.Extra); - ObjDesc->BufferField.Extra = NULL; - return_ACPI_STATUS (Status); } /***************************************************************************** * - * FUNCTION: AcpiDsGetRegionArguments + * FUNCTION: AcpiDsGetBufferFieldArguments * - * PARAMETERS: ObjDesc - A valid region object + * PARAMETERS: ObjDesc - A valid BufferField object * * RETURN: Status. * - * DESCRIPTION: Get region address and length. This implements the late - * evaluation of these region attributes. + * DESCRIPTION: Get BufferField Buffer and Index. This implements the late + * evaluation of these field attributes. * ****************************************************************************/ ACPI_STATUS -AcpiDsGetRegionArguments ( +AcpiDsGetBufferFieldArguments ( ACPI_OPERAND_OBJECT *ObjDesc) { - ACPI_OPERAND_OBJECT *ExtraDesc = NULL; + ACPI_OPERAND_OBJECT *ExtraDesc; ACPI_NAMESPACE_NODE *Node; - ACPI_PARSE_OBJECT *Op; - ACPI_PARSE_OBJECT *RegionOp; ACPI_STATUS Status; - ACPI_TABLE_DESC *TableDesc; - ACPI_WALK_STATE *WalkState; - FUNCTION_TRACE_PTR ("DsGetRegionArguments", ObjDesc); + FUNCTION_TRACE_PTR ("DsGetBufferFieldArguments", ObjDesc); - if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID) + if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) { return_ACPI_STATUS (AE_OK); } + /* Get the AML pointer (method object) and BufferField node */ - /* Get the AML pointer (method object) and region node */ - - ExtraDesc = ObjDesc->Region.Extra; - Node = ObjDesc->Region.Node; + ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc); + Node = ObjDesc->BufferField.Node; - DEBUG_EXEC(AcpiUtDisplayInitPathname (Node, " [Operation Region]")); + DEBUG_EXEC(AcpiUtDisplayInitPathname (Node, " [Field]")); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BufferField JIT Init\n", + (char *) &Node->Name)); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] OpRegion Init at AML %p\n", - (char*)&Node->Name, ExtraDesc->Extra.AmlStart)); + /* Execute the AML code for the TermArg arguments */ - /* - * Allocate a new parser op to be the root of the parsed - * OpRegion tree - */ - Op = AcpiPsAllocOp (AML_SCOPE_OP); - if (!Op) - { - return (AE_NO_MEMORY); - } + Status = AcpiDsExecuteArguments (Node, ExtraDesc); + return_ACPI_STATUS (Status); +} - /* Save the Node for use in AcpiPsParseAml */ - Op->Node = AcpiNsGetParentObject (Node); +/***************************************************************************** + * + * FUNCTION: AcpiDsGetRegionArguments + * + * PARAMETERS: ObjDesc - A valid region object + * + * RETURN: Status. + * + * DESCRIPTION: Get region address and length. This implements the late + * evaluation of these region attributes. + * + ****************************************************************************/ - /* Get a handle to the parent ACPI table */ +ACPI_STATUS +AcpiDsGetRegionArguments ( + ACPI_OPERAND_OBJECT *ObjDesc) +{ + ACPI_NAMESPACE_NODE *Node; + ACPI_STATUS Status; + ACPI_OPERAND_OBJECT *RegionObj2; - Status = AcpiTbHandleToObject (Node->OwnerId, &TableDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* Create and initialize a new parser state */ + FUNCTION_TRACE_PTR ("DsGetRegionArguments", ObjDesc); - WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, - Op, NULL, NULL); - if (!WalkState) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, ExtraDesc->Extra.AmlStart, - ExtraDesc->Extra.AmlLength, NULL, NULL, 1); - if (ACPI_FAILURE (Status)) + if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID) { - /* TBD: delete walk state */ - return_ACPI_STATUS (Status); + return_ACPI_STATUS (AE_OK); } - /* TBD: No Walk flags?? */ - - WalkState->ParseFlags = 0; - - /* Parse the entire OpRegion declaration, creating a parse tree */ - - Status = AcpiPsParseAml (WalkState); - if (ACPI_FAILURE (Status)) + RegionObj2 = AcpiNsGetSecondaryObject (ObjDesc); + if (!RegionObj2) { - AcpiPsDeleteParseTree (Op); - return_ACPI_STATUS (Status); + return_ACPI_STATUS (AE_NOT_EXIST); } - /* Get and init the actual RegionOp created above */ - - RegionOp = Op->Value.Arg; - Op->Node = Node; - - - RegionOp = Op->Value.Arg; - RegionOp->Node = Node; - AcpiPsDeleteParseTree (Op); - - /* Evaluate the address and length arguments for the OpRegion */ - - Op = AcpiPsAllocOp (AML_SCOPE_OP); - if (!Op) - { - return (AE_NO_MEMORY); - } + /* Get the AML pointer (method object) and region node */ - Op->Node = AcpiNsGetParentObject (Node); + Node = ObjDesc->Region.Node; - /* Create and initialize a new parser state */ + DEBUG_EXEC(AcpiUtDisplayInitPathname (Node, " [Operation Region]")); - WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, - Op, NULL, NULL); - if (!WalkState) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] OpRegion Init at AML %p\n", + (char *) &Node->Name, RegionObj2->Extra.AmlStart)); - Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, ExtraDesc->Extra.AmlStart, - ExtraDesc->Extra.AmlLength, NULL, NULL, 3); - if (ACPI_FAILURE (Status)) - { - /* TBD: delete walk state */ - return_ACPI_STATUS (Status); - } - Status = AcpiPsParseAml (WalkState); - AcpiPsDeleteParseTree (Op); + Status = AcpiDsExecuteArguments (Node, RegionObj2); return_ACPI_STATUS (Status); } @@ -460,21 +377,6 @@ AcpiDsInitializeRegion ( * DESCRIPTION: Get BufferField Buffer and Index * Called from AcpiDsExecEndOp during BufferField parse tree walk * - * ACPI SPECIFICATION REFERENCES: - * Each of the Buffer Field opcodes is defined as specified in in-line - * comments below. For each one, use the following definitions. - * - * DefBitField := BitFieldOp SrcBuf BitIdx Destination - * DefByteField := ByteFieldOp SrcBuf ByteIdx Destination - * DefCreateField := CreateFieldOp SrcBuf BitIdx NumBits NameString - * DefDWordField := DWordFieldOp SrcBuf ByteIdx Destination - * DefWordField := WordFieldOp SrcBuf ByteIdx Destination - * BitIndex := TermArg=>Integer - * ByteIndex := TermArg=>Integer - * Destination := NameString - * NumBits := TermArg=>Integer - * SourceBuf := TermArg=>Buffer - * ****************************************************************************/ ACPI_STATUS @@ -523,7 +425,6 @@ AcpiDsEvalBufferFieldOperands ( return_ACPI_STATUS (AE_NOT_EXIST); } - /* Resolve the operands */ Status = AcpiExResolveOperands (Op->Opcode, WALK_OPERANDS, WalkState); @@ -552,10 +453,7 @@ AcpiDsEvalBufferFieldOperands ( OffDesc = WalkState->Operands[1]; SrcDesc = WalkState->Operands[0]; - - - - Offset = (UINT32) OffDesc->Integer.Value; + Offset = (UINT32) OffDesc->Integer.Value; /* * If ResDesc is a Name, it will be a direct name pointer after @@ -576,78 +474,60 @@ AcpiDsEvalBufferFieldOperands ( switch (Op->Opcode) { - /* DefCreateField */ - case AML_CREATE_FIELD_OP: /* Offset is in bits, count is in bits */ BitOffset = Offset; BitCount = (UINT32) CntDesc->Integer.Value; - FieldFlags = ACCESS_BYTE_ACC; + FieldFlags = AML_FIELD_ACCESS_BYTE; break; - - /* DefCreateBitField */ - case AML_CREATE_BIT_FIELD_OP: /* Offset is in bits, Field is one bit */ BitOffset = Offset; BitCount = 1; - FieldFlags = ACCESS_BYTE_ACC; + FieldFlags = AML_FIELD_ACCESS_BYTE; break; - - /* DefCreateByteField */ - case AML_CREATE_BYTE_FIELD_OP: /* Offset is in bytes, field is one byte */ BitOffset = 8 * Offset; BitCount = 8; - FieldFlags = ACCESS_BYTE_ACC; + FieldFlags = AML_FIELD_ACCESS_BYTE; break; - - /* DefCreateWordField */ - case AML_CREATE_WORD_FIELD_OP: /* Offset is in bytes, field is one word */ BitOffset = 8 * Offset; BitCount = 16; - FieldFlags = ACCESS_WORD_ACC; + FieldFlags = AML_FIELD_ACCESS_WORD; break; - - /* DefCreateDWordField */ - case AML_CREATE_DWORD_FIELD_OP: /* Offset is in bytes, field is one dword */ BitOffset = 8 * Offset; BitCount = 32; - FieldFlags = ACCESS_DWORD_ACC; + FieldFlags = AML_FIELD_ACCESS_DWORD; break; - - /* DefCreateQWordField */ - case AML_CREATE_QWORD_FIELD_OP: /* Offset is in bytes, field is one qword */ BitOffset = 8 * Offset; BitCount = 64; - FieldFlags = ACCESS_QWORD_ACC; + FieldFlags = AML_FIELD_ACCESS_QWORD; break; - default: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, @@ -657,7 +537,6 @@ AcpiDsEvalBufferFieldOperands ( goto Cleanup; } - /* * Setup field according to the object type */ @@ -678,12 +557,11 @@ AcpiDsEvalBufferFieldOperands ( goto Cleanup; } - /* * Initialize areas of the field object that are common to all fields * For FieldFlags, use LOCK_RULE = 0 (NO_LOCK), UPDATE_RULE = 0 (UPDATE_PRESERVE) */ - Status = AcpiExPrepCommonFieldObject (ObjDesc, FieldFlags, + Status = AcpiExPrepCommonFieldObject (ObjDesc, FieldFlags, 0, BitOffset, BitCount); if (ACPI_FAILURE (Status)) { @@ -696,7 +574,6 @@ AcpiDsEvalBufferFieldOperands ( SrcDesc->Common.ReferenceCount = (UINT16) (SrcDesc->Common.ReferenceCount + ObjDesc->Common.ReferenceCount); - break; @@ -704,7 +581,7 @@ AcpiDsEvalBufferFieldOperands ( default: - if ((SrcDesc->Common.Type > (UINT8) INTERNAL_TYPE_REFERENCE) || !AcpiUtValidObjectType (SrcDesc->Common.Type)) /* TBD: This line MUST be a single line until AcpiSrc can handle it (block deletion) */ + if ((SrcDesc->Common.Type > (UINT8) INTERNAL_TYPE_REFERENCE) || !AcpiUtValidObjectType (SrcDesc->Common.Type)) /* This line MUST be a single line until AcpiSrc can handle it (block deletion) */ { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Tried to create field in invalid object type %X\n", @@ -915,11 +792,8 @@ AcpiDsExecBeginControlOp ( */ WalkState->ControlState->Control.AmlPredicateStart = WalkState->ParserState.Aml - 1; - /* TBD: can this be removed? */ - /*AcpiPsPkgLengthEncodingSize (GET8 (WalkState->ParserState->Aml));*/ break; - case AML_ELSE_OP: /* Predicate is in the state object */ @@ -932,12 +806,10 @@ AcpiDsExecBeginControlOp ( break; - case AML_RETURN_OP: break; - default: break; } @@ -958,7 +830,6 @@ AcpiDsExecBeginControlOp ( * DESCRIPTION: Handles all control ops encountered during control method * execution. * - * ******************************************************************************/ ACPI_STATUS @@ -1077,11 +948,11 @@ AcpiDsExecEndControlOp ( ((WalkState->Results->Results.ObjDesc [0])->Common.Type == INTERNAL_TYPE_REFERENCE) && ((WalkState->Results->Results.ObjDesc [0])->Reference.Opcode != AML_INDEX_OP)) { - Status = AcpiExResolveToValue (&WalkState->Results->Results.ObjDesc [0], WalkState); - if (ACPI_FAILURE (Status)) - { - return (Status); - } + Status = AcpiExResolveToValue (&WalkState->Results->Results.ObjDesc [0], WalkState); + if (ACPI_FAILURE (Status)) + { + return (Status); + } } WalkState->ReturnDesc = WalkState->Results->Results.ObjDesc [0]; @@ -1166,7 +1037,6 @@ AcpiDsExecEndControlOp ( break; } - return (Status); } diff --git a/sys/contrib/dev/acpica/dsutils.c b/sys/contrib/dev/acpica/dsutils.c index 011db55..68a2ff8 100644 --- a/sys/contrib/dev/acpica/dsutils.c +++ b/sys/contrib/dev/acpica/dsutils.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dsutils - Dispatcher utilities - * $Revision: 80 $ + * $Revision: 84 $ * ******************************************************************************/ @@ -161,7 +161,6 @@ AcpiDsIsResultUsed ( return_VALUE (TRUE); } - /* * If there is no parent, the result can't possibly be used! * (An executing method typically has no parent, since each @@ -173,11 +172,9 @@ AcpiDsIsResultUsed ( return_VALUE (FALSE); } - /* * Get info on the parent. The root Op is AML_SCOPE */ - ParentInfo = AcpiPsGetOpcodeInfo (Op->Parent->Opcode); if (ParentInfo->Class == AML_CLASS_UNKNOWN) { @@ -185,7 +182,6 @@ AcpiDsIsResultUsed ( return_VALUE (FALSE); } - /* * Decide what to do with the result based on the parent. If * the parent opcode will not use the result, delete the object. @@ -194,10 +190,7 @@ AcpiDsIsResultUsed ( */ switch (ParentInfo->Class) { - /* - * In these cases, the parent will never use the return object - */ - case AML_CLASS_CONTROL: /* IF, ELSE, WHILE only */ + case AML_CLASS_CONTROL: switch (Op->Parent->Opcode) { @@ -205,9 +198,7 @@ AcpiDsIsResultUsed ( /* Never delete the return value associated with a return opcode */ - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Result used, [RETURN] opcode=%X Op=%p\n", Op->Opcode, Op)); - return_VALUE (TRUE); + goto ResultUsed; break; case AML_IF_OP: @@ -215,60 +206,72 @@ AcpiDsIsResultUsed ( /* * If we are executing the predicate AND this is the predicate op, - * we will use the return value! + * we will use the return value */ if ((WalkState->ControlState->Common.State == CONTROL_PREDICATE_EXECUTING) && (WalkState->ControlState->Control.PredicateOp == Op)) { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Result used as a predicate, [IF/WHILE] opcode=%X Op=%p\n", - Op->Opcode, Op)); - return_VALUE (TRUE); + goto ResultUsed; } - - break; } + /* The general control opcode returns no result */ - /* Fall through to not used case below */ + goto ResultNotUsed; + break; - case AML_CLASS_NAMED_OBJECT: /* Scope, method, etc. */ case AML_CLASS_CREATE: /* * These opcodes allow TermArg(s) as operands and therefore - * method calls. The result is used. + * the operands can be method calls. The result is used. */ - if ((Op->Parent->Opcode == AML_REGION_OP) || - (Op->Parent->Opcode == AML_CREATE_FIELD_OP) || - (Op->Parent->Opcode == AML_CREATE_BIT_FIELD_OP) || - (Op->Parent->Opcode == AML_CREATE_BYTE_FIELD_OP) || - (Op->Parent->Opcode == AML_CREATE_WORD_FIELD_OP) || - (Op->Parent->Opcode == AML_CREATE_DWORD_FIELD_OP) || - (Op->Parent->Opcode == AML_CREATE_QWORD_FIELD_OP)) + goto ResultUsed; + break; + + + case AML_CLASS_NAMED_OBJECT: + + if ((Op->Parent->Opcode == AML_REGION_OP) || + (Op->Parent->Opcode == AML_DATA_REGION_OP)) { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Result used, [Region or CreateField] opcode=%X Op=%p\n", - Op->Opcode, Op)); - return_VALUE (TRUE); + /* + * These opcodes allow TermArg(s) as operands and therefore + * the operands can be method calls. The result is used. + */ + goto ResultUsed; } - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Result not used, Parent opcode=%X Op=%p\n", Op->Opcode, Op)); - - return_VALUE (FALSE); + goto ResultNotUsed; break; + /* * In all other cases. the parent will actually use the return * object, so keep it. */ default: + goto ResultUsed; break; } + +ResultUsed: + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] used by Parent [%s] Op=%p\n", + AcpiPsGetOpcodeName (Op->Opcode), + AcpiPsGetOpcodeName (Op->Parent->Opcode), Op)); + return_VALUE (TRUE); + + +ResultNotUsed: + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] not used by Parent [%s] Op=%p\n", + AcpiPsGetOpcodeName (Op->Opcode), + AcpiPsGetOpcodeName (Op->Parent->Opcode), Op)); + + return_VALUE (FALSE); + } @@ -355,11 +358,9 @@ AcpiDsCreateOperand ( ACPI_STATUS Status = AE_OK; NATIVE_CHAR *NameString; UINT32 NameLength; - ACPI_OBJECT_TYPE8 DataType; ACPI_OPERAND_OBJECT *ObjDesc; ACPI_PARSE_OBJECT *ParentOp; UINT16 Opcode; - UINT32 Flags; OPERATING_MODE InterpreterMode; const ACPI_OPCODE_INFO *OpInfo; @@ -452,7 +453,7 @@ AcpiDsCreateOperand ( /* TBD: Externalize NameString and print */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object name was not found in namespace\n")); } } @@ -490,11 +491,6 @@ AcpiDsCreateOperand ( Opcode = AML_ZERO_OP; /* Has no arguments! */ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Null namepath: Arg=%p\n", Arg)); - - /* - * TBD: [Investigate] anything else needed for the - * zero op lvalue? - */ } else @@ -502,16 +498,15 @@ AcpiDsCreateOperand ( Opcode = Arg->Opcode; } + /* Get the object type of the argument */ - /* Get the data type of the argument */ - - DataType = AcpiDsMapOpcodeToDataType (Opcode, &Flags); - if (DataType == INTERNAL_TYPE_INVALID) + OpInfo = AcpiPsGetOpcodeInfo (Opcode); + if (OpInfo->ObjectType == INTERNAL_TYPE_INVALID) { return_ACPI_STATUS (AE_NOT_IMPLEMENTED); } - if (Flags & OP_HAS_RETURN_VALUE) + if (OpInfo->Flags & AML_HAS_RETVAL) { ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Argument previously created, already stacked \n")); @@ -533,14 +528,13 @@ AcpiDsCreateOperand ( AcpiFormatException (Status))); return_ACPI_STATUS (Status); } - } else { /* Create an ACPI_INTERNAL_OBJECT for the argument */ - ObjDesc = AcpiUtCreateInternalObject (DataType); + ObjDesc = AcpiUtCreateInternalObject (OpInfo->ObjectType); if (!ObjDesc) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -665,11 +659,6 @@ AcpiDsResolveOperands ( * Attempt to resolve each of the valid operands * Method arguments are passed by value, not by reference */ - - /* - * TBD: [Investigate] Note from previous parser: - * RefOf problem with AcpiExResolveToValue() conversion. - */ for (i = 0; i < WalkState->NumOperands; i++) { Status = AcpiExResolveToValue (&WalkState->Operands[i], WalkState); @@ -682,269 +671,3 @@ AcpiDsResolveOperands ( return_ACPI_STATUS (Status); } - -/******************************************************************************* - * - * FUNCTION: AcpiDsMapOpcodeToDataType - * - * PARAMETERS: Opcode - AML opcode to map - * OutFlags - Additional info about the opcode - * - * RETURN: The ACPI type associated with the opcode - * - * DESCRIPTION: Convert a raw AML opcode to the associated ACPI data type, - * if any. If the opcode returns a value as part of the - * intepreter execution, a flag is returned in OutFlags. - * - ******************************************************************************/ - -ACPI_OBJECT_TYPE8 -AcpiDsMapOpcodeToDataType ( - UINT16 Opcode, - UINT32 *OutFlags) -{ - ACPI_OBJECT_TYPE8 DataType = INTERNAL_TYPE_INVALID; - const ACPI_OPCODE_INFO *OpInfo; - UINT32 Flags = 0; - - - PROC_NAME ("DsMapOpcodeToDataType"); - - - OpInfo = AcpiPsGetOpcodeInfo (Opcode); - if (OpInfo->Class == AML_CLASS_UNKNOWN) - { - /* Unknown opcode */ - - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown AML opcode: %x\n", Opcode)); - return (DataType); - } - - -/* - * TBD: Use op class - */ - - switch (OpInfo->Type) - { - - case AML_TYPE_LITERAL: - - switch (Opcode) - { - case AML_BYTE_OP: - case AML_WORD_OP: - case AML_DWORD_OP: - case AML_QWORD_OP: - - DataType = ACPI_TYPE_INTEGER; - break; - - - case AML_STRING_OP: - - DataType = ACPI_TYPE_STRING; - break; - - case AML_INT_NAMEPATH_OP: - DataType = INTERNAL_TYPE_REFERENCE; - break; - - default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Unknown (type LITERAL) AML opcode: %x\n", Opcode)); - break; - } - break; - - - case AML_TYPE_DATA_TERM: - - switch (Opcode) - { - case AML_BUFFER_OP: - - DataType = ACPI_TYPE_BUFFER; - break; - - case AML_PACKAGE_OP: - case AML_VAR_PACKAGE_OP: - - DataType = ACPI_TYPE_PACKAGE; - break; - - default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Unknown (type DATA_TERM) AML opcode: %x\n", Opcode)); - break; - } - break; - - - case AML_TYPE_CONSTANT: - case AML_TYPE_METHOD_ARGUMENT: - case AML_TYPE_LOCAL_VARIABLE: - - DataType = INTERNAL_TYPE_REFERENCE; - break; - - - case AML_TYPE_EXEC_1A_0T_1R: - case AML_TYPE_EXEC_1A_1T_1R: - case AML_TYPE_EXEC_2A_0T_1R: - case AML_TYPE_EXEC_2A_1T_1R: - case AML_TYPE_EXEC_2A_2T_1R: - case AML_TYPE_EXEC_3A_1T_1R: - case AML_TYPE_EXEC_6A_0T_1R: - case AML_TYPE_RETURN: - - Flags = OP_HAS_RETURN_VALUE; - DataType = ACPI_TYPE_ANY; - break; - - - case AML_TYPE_METHOD_CALL: - - Flags = OP_HAS_RETURN_VALUE; - DataType = ACPI_TYPE_METHOD; - break; - - - case AML_TYPE_NAMED_FIELD: - case AML_TYPE_NAMED_SIMPLE: - case AML_TYPE_NAMED_COMPLEX: - case AML_TYPE_NAMED_NO_OBJ: - - DataType = AcpiDsMapNamedOpcodeToDataType (Opcode); - break; - - - case AML_TYPE_EXEC_1A_0T_0R: - case AML_TYPE_EXEC_2A_0T_0R: - case AML_TYPE_EXEC_3A_0T_0R: - case AML_TYPE_EXEC_1A_1T_0R: - case AML_TYPE_CONTROL: - - /* No mapping needed at this time */ - - break; - - - default: - - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Unimplemented data type opcode: %x\n", Opcode)); - break; - } - - /* Return flags to caller if requested */ - - if (OutFlags) - { - *OutFlags = Flags; - } - - return (DataType); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDsMapNamedOpcodeToDataType - * - * PARAMETERS: Opcode - The Named AML opcode to map - * - * RETURN: The ACPI type associated with the named opcode - * - * DESCRIPTION: Convert a raw Named AML opcode to the associated data type. - * Named opcodes are a subsystem of the AML opcodes. - * - ******************************************************************************/ - -ACPI_OBJECT_TYPE8 -AcpiDsMapNamedOpcodeToDataType ( - UINT16 Opcode) -{ - ACPI_OBJECT_TYPE8 DataType; - - - FUNCTION_ENTRY (); - - - /* Decode Opcode */ - - switch (Opcode) - { - case AML_SCOPE_OP: - DataType = INTERNAL_TYPE_SCOPE; - break; - - case AML_DEVICE_OP: - DataType = ACPI_TYPE_DEVICE; - break; - - case AML_THERMAL_ZONE_OP: - DataType = ACPI_TYPE_THERMAL; - break; - - case AML_METHOD_OP: - DataType = ACPI_TYPE_METHOD; - break; - - case AML_POWER_RES_OP: - DataType = ACPI_TYPE_POWER; - break; - - case AML_PROCESSOR_OP: - DataType = ACPI_TYPE_PROCESSOR; - break; - - case AML_FIELD_OP: /* FieldOp */ - DataType = INTERNAL_TYPE_FIELD_DEFN; - break; - - case AML_INDEX_FIELD_OP: /* IndexFieldOp */ - DataType = INTERNAL_TYPE_INDEX_FIELD_DEFN; - break; - - case AML_BANK_FIELD_OP: /* BankFieldOp */ - DataType = INTERNAL_TYPE_BANK_FIELD_DEFN; - break; - - case AML_INT_NAMEDFIELD_OP: /* NO CASE IN ORIGINAL */ - DataType = ACPI_TYPE_ANY; - break; - - case AML_NAME_OP: /* NameOp - special code in original */ - case AML_INT_NAMEPATH_OP: - DataType = ACPI_TYPE_ANY; - break; - - case AML_ALIAS_OP: - DataType = INTERNAL_TYPE_ALIAS; - break; - - case AML_MUTEX_OP: - DataType = ACPI_TYPE_MUTEX; - break; - - case AML_EVENT_OP: - DataType = ACPI_TYPE_EVENT; - break; - - case AML_DATA_REGION_OP: - case AML_REGION_OP: - DataType = ACPI_TYPE_REGION; - break; - - - default: - DataType = ACPI_TYPE_ANY; - break; - - } - - return (DataType); -} - - diff --git a/sys/contrib/dev/acpica/dswexec.c b/sys/contrib/dev/acpica/dswexec.c index 95c5a3e..26aa247 100644 --- a/sys/contrib/dev/acpica/dswexec.c +++ b/sys/contrib/dev/acpica/dswexec.c @@ -2,7 +2,7 @@ * * Module Name: dswexec - Dispatcher method execution callbacks; * dispatch to interpreter. - * $Revision: 79 $ + * $Revision: 82 $ * *****************************************************************************/ @@ -130,7 +130,7 @@ MODULE_NAME ("dswexec") /* - * Dispatch tables for opcode classes + * Dispatch table for opcode classes */ ACPI_EXECUTE_OP AcpiGbl_OpTypeDispatch [] = { AcpiExOpcode_1A_0T_0R, @@ -183,7 +183,6 @@ AcpiDsGetPredicateValue ( return_ACPI_STATUS (Status); } } - else { Status = AcpiDsCreateOperand (WalkState, WalkState->Op, 0); @@ -209,7 +208,6 @@ AcpiDsGetPredicateValue ( return_ACPI_STATUS (AE_AML_NO_OPERAND); } - /* * Result of predicate evaluation currently must * be a number @@ -224,7 +222,6 @@ AcpiDsGetPredicateValue ( goto Cleanup; } - /* Truncate the predicate to 32-bits if necessary */ AcpiExTruncateFor32bitTable (ObjDesc, WalkState); @@ -237,7 +234,6 @@ AcpiDsGetPredicateValue ( { WalkState->ControlState->Common.Value = TRUE; } - else { /* @@ -251,7 +247,7 @@ AcpiDsGetPredicateValue ( Cleanup: - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%pn", + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%p\n", WalkState->ControlState->Common.Value, WalkState->Op)); /* Break to debugger to display result */ @@ -382,20 +378,17 @@ AcpiDsExecBeginOp ( Status = AcpiDsLoad2BeginOp (WalkState, NULL); } - if (Op->Opcode == AML_REGION_OP) { Status = AcpiDsResultStackPush (WalkState); } - break; - /* most operators with arguments */ - case AML_CLASS_EXECUTE: case AML_CLASS_CREATE: + /* most operators with arguments */ /* Start a new result/operand state */ Status = AcpiDsResultStackPush (WalkState); @@ -462,23 +455,20 @@ AcpiDsExecEndOp ( WalkState->ReturnDesc = NULL; WalkState->ResultObj = NULL; - /* Call debugger for single step support (DEBUG build only) */ DEBUGGER_EXEC (Status = AcpiDbSingleStep (WalkState, Op, OpClass)); DEBUGGER_EXEC (if (ACPI_FAILURE (Status)) {return_ACPI_STATUS (Status);}); + /* Decode the Opcode Class */ switch (OpClass) { - /* Decode the Opcode Class */ - - case AML_CLASS_ARGUMENT: /* constants, literals, etc. do nothing */ + case AML_CLASS_ARGUMENT: /* constants, literals, etc. -- do nothing */ break; - /* most operators with arguments */ - - case AML_CLASS_EXECUTE: + + case AML_CLASS_EXECUTE: /* most operators with arguments */ /* Build resolved operand stack */ @@ -498,53 +488,41 @@ AcpiDsExecEndOp ( /* Resolve all operands */ - Status = AcpiExResolveOperands (WalkState->Opcode, - &(WalkState->Operands [WalkState->NumOperands -1]), + Status = AcpiExResolveOperands (WalkState->Opcode, + &(WalkState->Operands [WalkState->NumOperands -1]), WalkState); - if (ACPI_FAILURE (Status)) + if (ACPI_SUCCESS (Status)) { - /* TBD: must pop and delete operands */ - - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "[%s]: Could not resolve operands, %s\n", - AcpiPsGetOpcodeName (WalkState->Opcode), AcpiFormatException (Status))); + DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, + AcpiPsGetOpcodeName (WalkState->Opcode), + WalkState->NumOperands, "after ExResolveOperands"); /* - * On error, we must delete all the operands and clear the - * operand stack + * Dispatch the request to the appropriate interpreter handler + * routine. There is one routine per opcode "type" based upon the + * number of opcode arguments and return type. */ - for (i = 0; i < WalkState->NumOperands; i++) - { - AcpiUtRemoveReference (WalkState->Operands[i]); - WalkState->Operands[i] = NULL; - } - - WalkState->NumOperands = 0; - goto Cleanup; + Status = AcpiGbl_OpTypeDispatch [OpType] (WalkState); + } + else + { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "[%s]: Could not resolve operands, %s\n", + AcpiPsGetOpcodeName (WalkState->Opcode), + AcpiFormatException (Status))); } - DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (WalkState->Opcode), - WalkState->NumOperands, "after ExResolveOperands"); - - /* - * Dispatch the request to the appropriate interpreter handler - * routine. There is one routine per opcode "type" based upon the - * number of opcode arguments and return type. - */ - Status = AcpiGbl_OpTypeDispatch [OpType] (WalkState); - - - /* Delete argument objects and clear the operand stack */ + /* Always delete the argument objects and clear the operand stack */ for (i = 0; i < WalkState->NumOperands; i++) { /* - * Remove a reference to all operands, including both + * Remove a reference to all operands, including both * "Arguments" and "Targets". */ AcpiUtRemoveReference (WalkState->Operands[i]); WalkState->Operands[i] = NULL; } - WalkState->NumOperands = 0; /* @@ -600,10 +578,9 @@ AcpiDsExecEndOp ( } /* - * Since the operands will be passed to another - * control method, we must resolve all local - * references here (Local variables, arguments - * to *this* method, etc.) + * Since the operands will be passed to another control method, + * we must resolve all local references here (Local variables, + * arguments to *this* method, etc.) */ Status = AcpiDsResolveOperands (WalkState); if (ACPI_FAILURE (Status)) @@ -666,6 +643,7 @@ AcpiDsExecEndOp ( break; + case AML_TYPE_UNDEFINED: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Undefined opcode type Op=%p\n", Op)); @@ -674,10 +652,13 @@ AcpiDsExecEndOp ( case AML_TYPE_BOGUS: - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Internal opcode=%X type Op=%p\n", + + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "Internal opcode=%X type Op=%p\n", WalkState->Opcode, Op)); break; + default: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, @@ -690,8 +671,8 @@ AcpiDsExecEndOp ( } /* - * ACPI 2.0 support for 64-bit integers: - * Truncate numeric result value if we are executing from a 32-bit ACPI table + * ACPI 2.0 support for 64-bit integers: Truncate numeric + * result value if we are executing from a 32-bit ACPI table */ AcpiExTruncateFor32bitTable (WalkState->ResultObj, WalkState); diff --git a/sys/contrib/dev/acpica/dswload.c b/sys/contrib/dev/acpica/dswload.c index 844aa01..c18e251 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: 50 $ + * $Revision: 54 $ * *****************************************************************************/ @@ -177,7 +177,6 @@ AcpiDsInitCallbacks ( } - /******************************************************************************* * * FUNCTION: AcpiDsLoad1BeginOp @@ -200,7 +199,7 @@ AcpiDsLoad1BeginOp ( ACPI_PARSE_OBJECT *Op; ACPI_NAMESPACE_NODE *Node; ACPI_STATUS Status; - ACPI_OBJECT_TYPE8 DataType; + ACPI_OBJECT_TYPE8 ObjectType; NATIVE_CHAR *Path; @@ -210,6 +209,11 @@ AcpiDsLoad1BeginOp ( ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState)); + if (Op && (Op->Opcode == AML_INT_NAMEDFIELD_OP)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState)); + } + /* We are only interested in opcodes that have an associated name */ if (WalkState->Op) @@ -233,25 +237,17 @@ AcpiDsLoad1BeginOp ( /* Map the raw opcode into an internal object type */ - DataType = AcpiDsMapNamedOpcodeToDataType (WalkState->Opcode); - + ObjectType = WalkState->OpInfo->ObjectType; ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "State=%p Op=%p Type=%x\n", WalkState, Op, DataType)); - - - if (WalkState->Opcode == AML_SCOPE_OP) - { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "State=%p Op=%p Type=%x\n", WalkState, Op, DataType)); - } + "State=%p Op=%p Type=%x\n", WalkState, Op, ObjectType)); /* * Enter the named type into the internal namespace. We enter the name * as we go downward in the parse tree. Any necessary subobjects that involve * arguments to the opcode must be created as we go back up the parse tree later. */ - Status = AcpiNsLookup (WalkState->ScopeInfo, Path, DataType, + Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, IMODE_LOAD_PASS1, NS_NO_UPSEARCH, WalkState, &(Node)); if (ACPI_FAILURE (Status)) @@ -306,7 +302,7 @@ AcpiDsLoad1EndOp ( ACPI_WALK_STATE *WalkState) { ACPI_PARSE_OBJECT *Op; - ACPI_OBJECT_TYPE8 DataType; + ACPI_OBJECT_TYPE8 ObjectType; PROC_NAME ("DsLoad1EndOp"); @@ -317,34 +313,51 @@ AcpiDsLoad1EndOp ( /* We are only interested in opcodes that have an associated name */ - if (!(WalkState->OpInfo->Flags & AML_NAMED)) + if (!(WalkState->OpInfo->Flags & (AML_NAMED | AML_FIELD))) { return (AE_OK); } - /* Get the type to determine if we should pop the scope */ + /* Get the object type to determine if we should pop the scope */ - DataType = AcpiDsMapNamedOpcodeToDataType (Op->Opcode); + ObjectType = WalkState->OpInfo->ObjectType; + + if (WalkState->OpInfo->Flags & AML_FIELD) + { + if (WalkState->Opcode == AML_FIELD_OP || + WalkState->Opcode == AML_BANK_FIELD_OP || + WalkState->Opcode == AML_INDEX_FIELD_OP) + { + AcpiDsInitFieldObjects (Op, WalkState); + } + return (AE_OK); + } + + + if (Op->Opcode == AML_REGION_OP) + { + /*Status = */AcpiExCreateRegion (((ACPI_PARSE2_OBJECT *) Op)->Data, + ((ACPI_PARSE2_OBJECT *) Op)->Length, + (ACPI_ADR_SPACE_TYPE) ((Op->Value.Arg)->Value.Integer), WalkState); + } if (Op->Opcode == AML_NAME_OP) { - /* For Name opcode, check the argument */ + /* For Name opcode, get the object type from the argument */ if (Op->Value.Arg) { - DataType = AcpiDsMapOpcodeToDataType ( - (Op->Value.Arg)->Opcode, NULL); - ((ACPI_NAMESPACE_NODE *)Op->Node)->Type = - (UINT8) DataType; + ObjectType = (AcpiPsGetOpcodeInfo ((Op->Value.Arg)->Opcode))->ObjectType; + Op->Node->Type = (UINT8) ObjectType; } } /* Pop the scope stack */ - if (AcpiNsOpensScope (DataType)) + if (AcpiNsOpensScope (ObjectType)) { ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s): Popping scope for Op %p\n", - AcpiUtGetTypeName (DataType), Op)); + AcpiUtGetTypeName (ObjectType), Op)); AcpiDsScopeStackPop (WalkState); } @@ -375,7 +388,7 @@ AcpiDsLoad2BeginOp ( ACPI_PARSE_OBJECT *Op; ACPI_NAMESPACE_NODE *Node; ACPI_STATUS Status; - ACPI_OBJECT_TYPE8 DataType; + ACPI_OBJECT_TYPE8 ObjectType; NATIVE_CHAR *BufferPtr; void *Original = NULL; @@ -433,10 +446,10 @@ AcpiDsLoad2BeginOp ( /* Map the raw opcode into an internal object type */ - DataType = AcpiDsMapNamedOpcodeToDataType (WalkState->Opcode); + ObjectType = WalkState->OpInfo->ObjectType; ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "State=%p Op=%p Type=%x\n", WalkState, Op, DataType)); + "State=%p Op=%p Type=%x\n", WalkState, Op, ObjectType)); if (WalkState->Opcode == AML_FIELD_OP || @@ -453,7 +466,7 @@ AcpiDsLoad2BeginOp ( * The NamePath is an object reference to an existing object. Don't enter the * name into the namespace, but look it up for use later */ - Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, DataType, + Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, IMODE_EXECUTE, NS_SEARCH_PARENT, WalkState, &(Node)); } @@ -464,9 +477,9 @@ AcpiDsLoad2BeginOp ( Original = Op->Node; Node = Op->Node; - if (AcpiNsOpensScope (DataType)) + if (AcpiNsOpensScope (ObjectType)) { - Status = AcpiDsScopeStackPush (Node, DataType, WalkState); + Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); if (ACPI_FAILURE (Status)) { return (Status); @@ -481,7 +494,7 @@ AcpiDsLoad2BeginOp ( * as we go downward in the parse tree. Any necessary subobjects that involve * arguments to the opcode must be created as we go back up the parse tree later. */ - Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, DataType, + Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, IMODE_EXECUTE, NS_NO_UPSEARCH, WalkState, &(Node)); } @@ -546,7 +559,7 @@ AcpiDsLoad2EndOp ( { ACPI_PARSE_OBJECT *Op; ACPI_STATUS Status = AE_OK; - ACPI_OBJECT_TYPE8 DataType; + ACPI_OBJECT_TYPE8 ObjectType; ACPI_NAMESPACE_NODE *Node; ACPI_PARSE_OBJECT *Arg; ACPI_NAMESPACE_NODE *NewNode; @@ -580,7 +593,7 @@ AcpiDsLoad2EndOp ( } - DataType = AcpiDsMapNamedOpcodeToDataType (Op->Opcode); + ObjectType = WalkState->OpInfo->ObjectType; /* * Get the Node/name from the earlier lookup @@ -597,11 +610,10 @@ AcpiDsLoad2EndOp ( /* Pop the scope stack */ - if (AcpiNsOpensScope (DataType)) + if (AcpiNsOpensScope (ObjectType)) { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", - AcpiUtGetTypeName (DataType), Op)); + AcpiUtGetTypeName (ObjectType), Op)); AcpiDsScopeStackPop (WalkState); } @@ -655,7 +667,6 @@ AcpiDsLoad2EndOp ( case AML_TYPE_NAMED_FIELD: - Arg = Op->Value.Arg; switch (Op->Opcode) { case AML_INDEX_FIELD_OP: @@ -664,13 +675,11 @@ AcpiDsLoad2EndOp ( WalkState); break; - case AML_BANK_FIELD_OP: Status = AcpiDsCreateBankField (Op, Arg->Node, WalkState); break; - case AML_FIELD_OP: Status = AcpiDsCreateField (Op, Arg->Node, WalkState); @@ -694,25 +703,21 @@ AcpiDsLoad2EndOp ( Status = AcpiExCreateProcessor (WalkState); break; - case AML_POWER_RES_OP: Status = AcpiExCreatePowerResource (WalkState); break; - case AML_MUTEX_OP: Status = AcpiExCreateMutex (WalkState); break; - case AML_EVENT_OP: Status = AcpiExCreateEvent (WalkState); break; - case AML_DATA_REGION_OP: Status = AcpiExCreateTableRegion (WalkState); @@ -748,13 +753,13 @@ AcpiDsLoad2EndOp ( { case AML_METHOD_OP: /* - * MethodOp PkgLength NamesString MethodFlags TermList + * MethodOp PkgLength NameString MethodFlags TermList */ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "LOADING-Method: State=%p Op=%p NamedObj=%p\n", WalkState, Op, Node)); - if (!Node->Object) + if (!AcpiNsGetAttachedObject (Node)) { Status = AcpiDsCreateOperands (WalkState, Arg); if (ACPI_FAILURE (Status)) @@ -774,9 +779,23 @@ AcpiDsLoad2EndOp ( * The OpRegion is not fully parsed at this time. Only valid argument is the SpaceId. * (We must save the address of the AML of the address and length operands) */ - Status = AcpiExCreateRegion (((ACPI_PARSE2_OBJECT *) Op)->Data, - ((ACPI_PARSE2_OBJECT *) Op)->Length, - (ACPI_ADR_SPACE_TYPE) Arg->Value.Integer, WalkState); + /* + * If we have a valid region, initialize it + * Namespace is NOT locked at this point. + */ + Status = AcpiEvInitializeRegion (AcpiNsGetAttachedObject (Node), FALSE); + if (ACPI_FAILURE (Status)) + { + /* + * If AE_NOT_EXIST is returned, it is not fatal + * because many regions get created before a handler + * is installed for said region. + */ + if (AE_NOT_EXIST == Status) + { + Status = AE_OK; + } + } break; @@ -809,10 +828,14 @@ AcpiDsLoad2EndOp ( WalkState, &(NewNode)); if (ACPI_SUCCESS (Status)) { - /* TBD: has name already been resolved by here ??*/ - - /* TBD: [Restructure] Make sure that what we found is indeed a method! */ - /* We didn't search for a method on purpose, to see if the name would resolve! */ + /* + * Make sure that what we found is indeed a method + * We didn't search for a method on purpose, to see if the name would resolve + */ + if (NewNode->Type != ACPI_TYPE_METHOD) + { + Status = AE_AML_OPERAND_TYPE; + } /* We could put the returned object (Node) on the object stack for later, but * for now, we will put it in the "op" object that the parser uses, so we diff --git a/sys/contrib/dev/acpica/dswstate.c b/sys/contrib/dev/acpica/dswstate.c index 321e2bb..0de7fa3 100644 --- a/sys/contrib/dev/acpica/dswstate.c +++ b/sys/contrib/dev/acpica/dswstate.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dswstate - Dispatcher parse tree walk management routines - * $Revision: 54 $ + * $Revision: 57 $ * *****************************************************************************/ @@ -828,32 +828,33 @@ AcpiDsObjStackGetValue ( * * FUNCTION: AcpiDsGetCurrentWalkState * - * PARAMETERS: WalkList - Get current active state for this walk list + * PARAMETERS: Thread - Get current active state for this Thread * * RETURN: Pointer to the current walk state * * DESCRIPTION: Get the walk state that is at the head of the list (the "current" - * walk state. + * walk state.) * ******************************************************************************/ ACPI_WALK_STATE * AcpiDsGetCurrentWalkState ( - ACPI_WALK_LIST *WalkList) + ACPI_THREAD_STATE *Thread) { PROC_NAME ("DsGetCurrentWalkState"); - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "DsGetCurrentWalkState, =%p\n", - WalkList->WalkState)); - - if (!WalkList) + if (!Thread) { return (NULL); } - return (WalkList->WalkState); + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "DsGetCurrentWalkState, =%p\n", + Thread->WalkStateList)); + + + return (Thread->WalkStateList); } @@ -873,13 +874,13 @@ AcpiDsGetCurrentWalkState ( void AcpiDsPushWalkState ( ACPI_WALK_STATE *WalkState, - ACPI_WALK_LIST *WalkList) + ACPI_THREAD_STATE *Thread) { FUNCTION_TRACE ("DsPushWalkState"); - WalkState->Next = WalkList->WalkState; - WalkList->WalkState = WalkState; + WalkState->Next = Thread->WalkStateList; + Thread->WalkStateList = WalkState; return_VOID; } @@ -901,7 +902,7 @@ AcpiDsPushWalkState ( ACPI_WALK_STATE * AcpiDsPopWalkState ( - ACPI_WALK_LIST *WalkList) + ACPI_THREAD_STATE *Thread) { ACPI_WALK_STATE *WalkState; @@ -909,18 +910,18 @@ AcpiDsPopWalkState ( FUNCTION_TRACE ("DsPopWalkState"); - WalkState = WalkList->WalkState; + WalkState = Thread->WalkStateList; if (WalkState) { /* Next walk state becomes the current walk state */ - WalkList->WalkState = WalkState->Next; + Thread->WalkStateList = WalkState->Next; /* * Don't clear the NEXT field, this serves as an indicator * that there is a parent WALK STATE - * WalkState->Next = NULL; + * NO: WalkState->Next = NULL; */ } @@ -933,12 +934,12 @@ AcpiDsPopWalkState ( * FUNCTION: AcpiDsCreateWalkState * * PARAMETERS: Origin - Starting point for this walk - * WalkList - Owning walk list + * Thread - Current thread state * * RETURN: Pointer to the new walk state. * - * DESCRIPTION: Allocate and initialize a new walk state. The current walk state - * is set to this new state. + * DESCRIPTION: Allocate and initialize a new walk state. The current walk + * state is set to this new state. * ******************************************************************************/ @@ -947,7 +948,7 @@ AcpiDsCreateWalkState ( ACPI_OWNER_ID OwnerId, ACPI_PARSE_OBJECT *Origin, ACPI_OPERAND_OBJECT *MthDesc, - ACPI_WALK_LIST *WalkList) + ACPI_THREAD_STATE *Thread) { ACPI_WALK_STATE *WalkState; ACPI_STATUS Status; @@ -966,7 +967,7 @@ AcpiDsCreateWalkState ( WalkState->OwnerId = OwnerId; WalkState->Origin = Origin; WalkState->MethodDesc = MthDesc; - WalkState->WalkList = WalkList; + WalkState->Thread = Thread; /* Init the method args/local */ @@ -984,9 +985,9 @@ AcpiDsCreateWalkState ( /* Put the new state at the head of the walk list */ - if (WalkList) + if (Thread) { - AcpiDsPushWalkState (WalkState, WalkList); + AcpiDsPushWalkState (WalkState, Thread); } return_PTR (WalkState); @@ -1030,7 +1031,6 @@ AcpiDsInitAmlWalk ( WalkState->ParserState.PkgEnd = AmlStart + AmlLength; /* The NextOp of the NextWalk will be the beginning of the method */ - /* TBD: [Restructure] -- obsolete? */ WalkState->NextOp = NULL; WalkState->Params = Params; @@ -1062,7 +1062,7 @@ AcpiDsInitAmlWalk ( AcpiDsMethodDataInitArgs (Params, MTH_NUM_ARGS, WalkState); } - + else { /* Setup the current scope */ @@ -1088,7 +1088,6 @@ AcpiDsInitAmlWalk ( #endif - /******************************************************************************* * * FUNCTION: AcpiDsDeleteWalkState diff --git a/sys/contrib/dev/acpica/evevent.c b/sys/contrib/dev/acpica/evevent.c index fc52268..20c9953 100644 --- a/sys/contrib/dev/acpica/evevent.c +++ b/sys/contrib/dev/acpica/evevent.c @@ -2,7 +2,7 @@ * * Module Name: evevent - Fixed and General Purpose AcpiEvent * handling and dispatch - * $Revision: 51 $ + * $Revision: 54 $ * *****************************************************************************/ @@ -156,18 +156,6 @@ AcpiEvInitialize ( return_ACPI_STATUS (AE_NO_ACPI_TABLES); } - - /* Make sure the BIOS supports ACPI mode */ - - if (SYS_MODE_LEGACY == AcpiHwGetModeCapabilities()) - { - ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "ACPI Mode is not supported!\n")); - return_ACPI_STATUS (AE_ERROR); - } - - - AcpiGbl_OriginalMode = AcpiHwGetMode(); - /* * Initialize the Fixed and General Purpose AcpiEvents prior. This is * done prior to enabling SCIs to prevent interrupts from occuring @@ -196,7 +184,6 @@ AcpiEvInitialize ( return_ACPI_STATUS (Status); } - /* Install handlers for control method GPE handlers (_Lxx, _Exx) */ Status = AcpiEvInitGpeControlMethods (); @@ -215,7 +202,6 @@ AcpiEvInitialize ( return_ACPI_STATUS (Status); } - return_ACPI_STATUS (Status); } @@ -235,7 +221,8 @@ AcpiEvInitialize ( ACPI_STATUS AcpiEvFixedEventInitialize(void) { - int i = 0; + NATIVE_UINT i; + /* Initialize the structure that keeps track of fixed event handlers */ @@ -289,8 +276,7 @@ AcpiEvFixedEventDetect (void) "Fixed AcpiEvent Block: Enable %08X Status %08X\n", EnableRegister, StatusRegister)); - - /* power management timer roll over */ + /* Power management timer roll over */ if ((StatusRegister & ACPI_STATUS_PMTIMER) && (EnableRegister & ACPI_ENABLE_PMTIMER)) @@ -298,7 +284,7 @@ AcpiEvFixedEventDetect (void) IntStatus |= AcpiEvFixedEventDispatch (ACPI_EVENT_PMTIMER); } - /* global event (BIOS wants the global lock) */ + /* Global event (BIOS wants the global lock) */ if ((StatusRegister & ACPI_STATUS_GLOBAL) && (EnableRegister & ACPI_ENABLE_GLOBAL)) @@ -306,7 +292,7 @@ AcpiEvFixedEventDetect (void) IntStatus |= AcpiEvFixedEventDispatch (ACPI_EVENT_GLOBAL); } - /* power button event */ + /* Power button event */ if ((StatusRegister & ACPI_STATUS_POWER_BUTTON) && (EnableRegister & ACPI_ENABLE_POWER_BUTTON)) @@ -314,7 +300,7 @@ AcpiEvFixedEventDetect (void) IntStatus |= AcpiEvFixedEventDispatch (ACPI_EVENT_POWER_BUTTON); } - /* sleep button event */ + /* Sleep button event */ if ((StatusRegister & ACPI_STATUS_SLEEP_BUTTON) && (EnableRegister & ACPI_ENABLE_SLEEP_BUTTON)) @@ -654,7 +640,6 @@ AcpiEvSaveMethodInfo ( AcpiGbl_GpeInfo [GpeNumber].Type = Type; AcpiGbl_GpeInfo [GpeNumber].MethodHandle = ObjHandle; - /* * Enable the GPE (SCIs should be disabled at this point) */ @@ -811,6 +796,7 @@ AcpiEvAsynchExecuteGpeMethod ( FUNCTION_TRACE ("EvAsynchExecuteGpeMethod"); + /* * Take a snapshot of the GPE info for this level */ diff --git a/sys/contrib/dev/acpica/evmisc.c b/sys/contrib/dev/acpica/evmisc.c index b1010f3..7e1ecda 100644 --- a/sys/contrib/dev/acpica/evmisc.c +++ b/sys/contrib/dev/acpica/evmisc.c @@ -2,7 +2,7 @@ * * Module Name: evmisc - ACPI device notification handler dispatch * and ACPI Global Lock support - * $Revision: 35 $ + * $Revision: 36 $ * *****************************************************************************/ @@ -220,7 +220,6 @@ AcpiEvQueueNotifyRequest ( } } - /* If there is any handler to run, schedule the dispatcher */ if ((AcpiGbl_SysNotify.Handler && (NotifyValue <= MAX_SYS_NOTIFY)) || @@ -298,7 +297,6 @@ AcpiEvNotifyDispatch ( GlobalContext = AcpiGbl_SysNotify.Context; } } - else { /* Global driver notification handler */ @@ -310,7 +308,6 @@ AcpiEvNotifyDispatch ( } } - /* Invoke the system handler first, if present */ if (GlobalHandler) @@ -476,7 +473,6 @@ AcpiEvAcquireGlobalLock(void) AcpiGbl_GlobalLockThreadCount++; - /* If we (OS side) have the hardware lock already, we are done */ if (AcpiGbl_GlobalLockAcquired) @@ -491,7 +487,6 @@ AcpiEvAcquireGlobalLock(void) return_ACPI_STATUS (AE_OK); } - /* We must acquire the actual hardware lock */ GlobalLock = AcpiGbl_FACS->GlobalLock; @@ -506,7 +501,6 @@ AcpiEvAcquireGlobalLock(void) return_ACPI_STATUS (AE_OK); } - /* * Did not get the lock. The pending bit was set above, and we must now * wait until we get the global lock released interrupt. diff --git a/sys/contrib/dev/acpica/evregion.c b/sys/contrib/dev/acpica/evregion.c index f0e35b2..544e7fb 100644 --- a/sys/contrib/dev/acpica/evregion.c +++ b/sys/contrib/dev/acpica/evregion.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evregion - ACPI AddressSpace (OpRegion) handler dispatch - * $Revision: 113 $ + * $Revision: 120 $ * *****************************************************************************/ @@ -161,14 +161,14 @@ AcpiEvInstallDefaultAddressSpaceHandlers ( * space must be always available -- even though we are nowhere * near ready to find the PCI root buses at this point. * - * NOTE: We ignore AE_EXIST because this means that a handler has - * already been installed (via AcpiInstallAddressSpaceHandler) + * NOTE: We ignore AE_ALREADY_EXISTS because this means that a handler + * has already been installed (via AcpiInstallAddressSpaceHandler) */ Status = AcpiInstallAddressSpaceHandler (AcpiGbl_RootNode, ACPI_ADR_SPACE_SYSTEM_MEMORY, ACPI_DEFAULT_HANDLER, NULL, NULL); if ((ACPI_FAILURE (Status)) && - (Status != AE_EXIST)) + (Status != AE_ALREADY_EXISTS)) { return_ACPI_STATUS (Status); } @@ -177,7 +177,7 @@ AcpiEvInstallDefaultAddressSpaceHandlers ( ACPI_ADR_SPACE_SYSTEM_IO, ACPI_DEFAULT_HANDLER, NULL, NULL); if ((ACPI_FAILURE (Status)) && - (Status != AE_EXIST)) + (Status != AE_ALREADY_EXISTS)) { return_ACPI_STATUS (Status); } @@ -186,7 +186,7 @@ AcpiEvInstallDefaultAddressSpaceHandlers ( ACPI_ADR_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL); if ((ACPI_FAILURE (Status)) && - (Status != AE_EXIST)) + (Status != AE_ALREADY_EXISTS)) { return_ACPI_STATUS (Status); } @@ -196,8 +196,6 @@ AcpiEvInstallDefaultAddressSpaceHandlers ( } -/* TBD: [Restructure] Move elsewhere */ - /******************************************************************************* * * FUNCTION: AcpiEvExecuteRegMethod @@ -217,13 +215,20 @@ AcpiEvExecuteRegMethod ( UINT32 Function) { ACPI_OPERAND_OBJECT *Params[3]; + ACPI_OPERAND_OBJECT *RegionObj2; ACPI_STATUS Status; FUNCTION_TRACE ("EvExecuteRegMethod"); - if (RegionObj->Region.Extra->Extra.Method_REG == NULL) + RegionObj2 = AcpiNsGetSecondaryObject (RegionObj); + if (!RegionObj2) + { + return_ACPI_STATUS (AE_NOT_EXIST); + } + + if (RegionObj2->Extra.Method_REG == NULL) { return_ACPI_STATUS (AE_OK); } @@ -260,8 +265,8 @@ AcpiEvExecuteRegMethod ( /* * Execute the method, no return value */ - DEBUG_EXEC(AcpiUtDisplayInitPathname (RegionObj->Region.Extra->Extra.Method_REG, " [Method]")); - Status = AcpiNsEvaluateByHandle (RegionObj->Region.Extra->Extra.Method_REG, Params, NULL); + DEBUG_EXEC(AcpiUtDisplayInitPathname (RegionObj2->Extra.Method_REG, " [Method]")); + Status = AcpiNsEvaluateByHandle (RegionObj2->Extra.Method_REG, Params, NULL); AcpiUtRemoveReference (Params[1]); @@ -280,7 +285,7 @@ Cleanup: * SpaceId - ID of the address space (0-255) * Function - Read or Write operation * Address - Where in the space to read or write - * BitWidth - Field width in bits (8, 16, or 32) + * BitWidth - Field width in bits (8, 16, 32, or 64) * Value - Pointer to in or out value * * RETURN: Status @@ -296,18 +301,25 @@ AcpiEvAddressSpaceDispatch ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - UINT32 *Value) + ACPI_INTEGER *Value) { ACPI_STATUS Status; ACPI_ADR_SPACE_HANDLER Handler; ACPI_ADR_SPACE_SETUP RegionSetup; ACPI_OPERAND_OBJECT *HandlerDesc; + ACPI_OPERAND_OBJECT *RegionObj2; void *RegionContext = NULL; FUNCTION_TRACE ("EvAddressSpaceDispatch"); + RegionObj2 = AcpiNsGetSecondaryObject (RegionObj); + if (!RegionObj2) + { + return_ACPI_STATUS (AE_NOT_EXIST); + } + /* * Ensure that there is a handler associated with this region */ @@ -317,14 +329,14 @@ AcpiEvAddressSpaceDispatch ( ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "no handler for region(%p) [%s]\n", RegionObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId))); - return_ACPI_STATUS(AE_NOT_EXIST); + return_ACPI_STATUS (AE_NOT_EXIST); } /* * It may be the case that the region has never been initialized * Some types of regions require special init code */ - if (!(RegionObj->Region.Flags & AOPOBJ_INITIALIZED)) + if (!(RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE)) { /* * This region has not been initialized yet, do it @@ -361,16 +373,16 @@ AcpiEvAddressSpaceDispatch ( ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region Init: %s [%s]\n", AcpiFormatException (Status), AcpiUtGetRegionName (RegionObj->Region.SpaceId))); - return_ACPI_STATUS(Status); + return_ACPI_STATUS (Status); } - RegionObj->Region.Flags |= AOPOBJ_INITIALIZED; + RegionObj->Region.Flags |= AOPOBJ_SETUP_COMPLETE; /* * Save the returned context for use in all accesses to * this particular region. */ - RegionObj->Region.Extra->Extra.RegionContext = RegionContext; + RegionObj2->Extra.RegionContext = RegionContext; } /* @@ -398,7 +410,7 @@ AcpiEvAddressSpaceDispatch ( */ Status = Handler (Function, Address, BitWidth, Value, HandlerDesc->AddrHandler.Context, - RegionObj->Region.Extra->Extra.RegionContext); + RegionObj2->Extra.RegionContext); if (ACPI_FAILURE (Status)) { @@ -443,13 +455,19 @@ AcpiEvDisassociateRegionFromHandler( ACPI_OPERAND_OBJECT **LastObjPtr; ACPI_ADR_SPACE_SETUP RegionSetup; void *RegionContext; + ACPI_OPERAND_OBJECT *RegionObj2; ACPI_STATUS Status; FUNCTION_TRACE ("EvDisassociateRegionFromHandler"); - RegionContext = RegionObj->Region.Extra->Extra.RegionContext; + RegionObj2 = AcpiNsGetSecondaryObject (RegionObj); + if (!RegionObj2) + { + return; + } + RegionContext = RegionObj2->Extra.RegionContext; /* * Get the address handler from the region object @@ -518,7 +536,7 @@ AcpiEvDisassociateRegionFromHandler( AcpiUtGetRegionName (RegionObj->Region.SpaceId))); } - RegionObj->Region.Flags &= ~(AOPOBJ_INITIALIZED); + RegionObj->Region.Flags &= ~(AOPOBJ_SETUP_COMPLETE); /* * Remove handler reference in the region @@ -587,18 +605,19 @@ AcpiEvAssociateRegionAndHandler ( /* - * Link this region to the front of the handler's list + * Link this region to the front of the handler's list */ RegionObj->Region.Next = HandlerObj->AddrHandler.RegionList; HandlerObj->AddrHandler.RegionList = RegionObj; /* - * set the region's handler + * Set the region's handler */ RegionObj->Region.AddrHandler = HandlerObj; /* - * Last thing, tell all users that this region is usable + * Tell all users that this region is usable by running the _REG + * method */ if (AcpiNsIsLocked) { @@ -624,8 +643,8 @@ AcpiEvAssociateRegionAndHandler ( * Level - Nesting level of the handle * Context - Passed into AcpiNsWalkNamespace * - * DESCRIPTION: This routine checks to see if the object is a Region if it - * is then the address handler is installed in it. + * DESCRIPTION: This routine installs an address handler into objects that are + * of type Region. * * If the Object is a Device, and the device has a handler of * the same type then the search is terminated in that branch. diff --git a/sys/contrib/dev/acpica/evrgnini.c b/sys/contrib/dev/acpica/evrgnini.c index 17adfdd..23e0c2b 100644 --- a/sys/contrib/dev/acpica/evrgnini.c +++ b/sys/contrib/dev/acpica/evrgnini.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evrgnini- ACPI AddressSpace (OpRegion) init - * $Revision: 48 $ + * $Revision: 51 $ * *****************************************************************************/ @@ -371,7 +371,6 @@ AcpiEvPciConfigRegionSetup ( } - /******************************************************************************* * * FUNCTION: AcpiEvPciBarRegionSetup @@ -507,6 +506,7 @@ AcpiEvInitializeRegion ( ACPI_STATUS Status; ACPI_NAMESPACE_NODE *MethodNode; ACPI_NAME *RegNamePtr = (ACPI_NAME *) METHOD_NAME__REG; + ACPI_OPERAND_OBJECT *RegionObj2; FUNCTION_TRACE_U32 ("EvInitializeRegion", AcpiNsLocked); @@ -517,12 +517,25 @@ AcpiEvInitializeRegion ( return_ACPI_STATUS (AE_BAD_PARAMETER); } + if (RegionObj->Common.Flags & AOPOBJ_OBJECT_INITIALIZED) + { + return_ACPI_STATUS (AE_OK); + } + + RegionObj2 = AcpiNsGetSecondaryObject (RegionObj); + if (!RegionObj2) + { + return_ACPI_STATUS (AE_NOT_EXIST); + } Node = AcpiNsGetParentObject (RegionObj->Region.Node); + + SpaceId = RegionObj->Region.SpaceId; RegionObj->Region.AddrHandler = NULL; - RegionObj->Region.Extra->Extra.Method_REG = NULL; - RegionObj->Region.Flags &= ~(AOPOBJ_INITIALIZED); + RegionObj2->Extra.Method_REG = NULL; + RegionObj->Common.Flags &= ~(AOPOBJ_SETUP_COMPLETE); + RegionObj->Common.Flags |= AOPOBJ_OBJECT_INITIALIZED; /* * Find any "_REG" associated with this region definition @@ -536,7 +549,7 @@ AcpiEvInitializeRegion ( * definition. This will be executed when the handler is attached * or removed */ - RegionObj->Region.Extra->Extra.Method_REG = MethodNode; + RegionObj2->Extra.Method_REG = MethodNode; } /* @@ -590,6 +603,7 @@ AcpiEvInitializeRegion ( */ AcpiEvAssociateRegionAndHandler (HandlerObj, RegionObj, AcpiNsLocked); + return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/evxface.c b/sys/contrib/dev/acpica/evxface.c index 1fa9432..42828ac 100644 --- a/sys/contrib/dev/acpica/evxface.c +++ b/sys/contrib/dev/acpica/evxface.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evxface - External interfaces for ACPI events - * $Revision: 116 $ + * $Revision: 118 $ * *****************************************************************************/ @@ -169,7 +169,7 @@ AcpiInstallFixedEventHandler ( if (NULL != AcpiGbl_FixedEventHandlers[Event].Handler) { - Status = AE_EXIST; + Status = AE_ALREADY_EXISTS; goto Cleanup; } @@ -327,7 +327,7 @@ AcpiInstallNotifyHandler ( ((HandlerType == ACPI_DEVICE_NOTIFY) && AcpiGbl_DrvNotify.Handler)) { - Status = AE_EXIST; + Status = AE_ALREADY_EXISTS; goto UnlockAndExit; } @@ -352,7 +352,7 @@ AcpiInstallNotifyHandler ( * Caller will only receive notifications specific to the target object. * Note that only certain object types can receive notifications. */ - else + else { /* * These are the ONLY objects that can receive ACPI notifications @@ -379,7 +379,7 @@ AcpiInstallNotifyHandler ( ((HandlerType == ACPI_DEVICE_NOTIFY) && ObjDesc->Device.DrvHandler)) { - Status = AE_EXIST; + Status = AE_ALREADY_EXISTS; goto UnlockAndExit; } } @@ -488,7 +488,7 @@ AcpiRemoveNotifyHandler ( /* * Root Object */ - if (Device == ACPI_ROOT_OBJECT) + if (Device == ACPI_ROOT_OBJECT) { ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing notify handler for ROOT object.\n")); @@ -501,13 +501,13 @@ AcpiRemoveNotifyHandler ( goto UnlockAndExit; } - if (HandlerType == ACPI_SYSTEM_NOTIFY) + if (HandlerType == ACPI_SYSTEM_NOTIFY) { AcpiGbl_SysNotify.Node = NULL; AcpiGbl_SysNotify.Handler = NULL; AcpiGbl_SysNotify.Context = NULL; } - else + else { AcpiGbl_DrvNotify.Node = NULL; AcpiGbl_DrvNotify.Handler = NULL; @@ -518,7 +518,7 @@ AcpiRemoveNotifyHandler ( /* * All Other Objects */ - else + else { /* * These are the ONLY objects that can receive ACPI notifications @@ -630,7 +630,7 @@ AcpiInstallGpeHandler ( if (AcpiGbl_GpeInfo[GpeNumber].Handler) { - Status = AE_EXIST; + Status = AE_ALREADY_EXISTS; goto Cleanup; } diff --git a/sys/contrib/dev/acpica/evxfevnt.c b/sys/contrib/dev/acpica/evxfevnt.c index 9abf4eb..3e123ea 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: 38 $ + * $Revision: 42 $ * *****************************************************************************/ @@ -143,13 +143,13 @@ ACPI_STATUS AcpiEnable (void) { - ACPI_STATUS Status; + ACPI_STATUS Status = AE_OK; FUNCTION_TRACE ("AcpiEnable"); - /* Make sure we've got ACPI tables */ + /* Make sure we have ACPI tables */ if (!AcpiGbl_DSDT) { @@ -157,24 +157,26 @@ AcpiEnable (void) return_ACPI_STATUS (AE_NO_ACPI_TABLES); } - /* Make sure the BIOS supports ACPI mode */ + AcpiGbl_OriginalMode = AcpiHwGetMode (); - if (SYS_MODE_LEGACY == AcpiHwGetModeCapabilities()) + if (AcpiGbl_OriginalMode == SYS_MODE_ACPI) { - ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Only legacy mode supported!\n")); - return_ACPI_STATUS (AE_ERROR); + ACPI_DEBUG_PRINT ((ACPI_DB_OK, "Already in ACPI mode.\n")); } - /* Transition to ACPI mode */ - - Status = AcpiHwSetMode (SYS_MODE_ACPI); - if (ACPI_FAILURE (Status)) + else { - ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Could not transition to ACPI mode.\n")); - return_ACPI_STATUS (Status); - } + /* Transition to ACPI mode */ - ACPI_DEBUG_PRINT ((ACPI_DB_OK, "Transition to ACPI mode successful\n")); + Status = AcpiHwSetMode (SYS_MODE_ACPI); + if (ACPI_FAILURE (Status)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_FATAL, "Could not transition to ACPI mode.\n")); + return_ACPI_STATUS (Status); + } + + ACPI_DEBUG_PRINT ((ACPI_DB_OK, "Transition to ACPI mode successful\n")); + } return_ACPI_STATUS (Status); } @@ -196,19 +198,22 @@ AcpiEnable (void) ACPI_STATUS AcpiDisable (void) { - ACPI_STATUS Status; + ACPI_STATUS Status = AE_OK; FUNCTION_TRACE ("AcpiDisable"); - /* Restore original mode */ - - Status = AcpiHwSetMode (AcpiGbl_OriginalMode); - if (ACPI_FAILURE (Status)) + if (AcpiHwGetMode () != AcpiGbl_OriginalMode) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unable to transition to original mode")); - return_ACPI_STATUS (Status); + /* Restore original mode */ + + Status = AcpiHwSetMode (AcpiGbl_OriginalMode); + if (ACPI_FAILURE (Status)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unable to transition to original mode")); + return_ACPI_STATUS (Status); + } } /* Unload the SCI interrupt handler */ diff --git a/sys/contrib/dev/acpica/evxfregn.c b/sys/contrib/dev/acpica/evxfregn.c index 6e93229..5b8e728 100644 --- a/sys/contrib/dev/acpica/evxfregn.c +++ b/sys/contrib/dev/acpica/evxfregn.c @@ -2,7 +2,7 @@ * * Module Name: evxfregn - External Interfaces, ACPI Operation Regions and * Address Spaces. - * $Revision: 40 $ + * $Revision: 41 $ * *****************************************************************************/ @@ -265,7 +265,7 @@ AcpiInstallAddressSpaceHandler ( */ if(HandlerObj->AddrHandler.SpaceId == SpaceId) { - Status = AE_EXIST; + Status = AE_ALREADY_EXISTS; goto UnlockAndExit; } diff --git a/sys/contrib/dev/acpica/exconfig.c b/sys/contrib/dev/acpica/exconfig.c index ec9b923..f8c1a1c 100644 --- a/sys/contrib/dev/acpica/exconfig.c +++ b/sys/contrib/dev/acpica/exconfig.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes) - * $Revision: 44 $ + * $Revision: 47 $ * *****************************************************************************/ @@ -160,7 +160,9 @@ AcpiExLoadOp ( FUNCTION_TRACE ("ExLoadOp"); - /* TBD: [Unhandled] Object can be either a field or an opregion */ + /* Object can be either a field or an opregion */ + + /* TBD: Handle field vs. Opregion *? /* Get the table header */ @@ -168,9 +170,9 @@ AcpiExLoadOp ( TableHeader.Length = 0; for (i = 0; i < sizeof (ACPI_TABLE_HEADER); i++) { - Status = AcpiEvAddressSpaceDispatch (RgnDesc, ACPI_READ_ADR_SPACE, + Status = AcpiEvAddressSpaceDispatch (RgnDesc, ACPI_READ, (ACPI_PHYSICAL_ADDRESS) i, 8, - (UINT32 *) ((UINT8 *) &TableHeader + i)); + (ACPI_INTEGER *) ((UINT8 *) &TableHeader + i)); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -195,16 +197,15 @@ AcpiExLoadOp ( for (i = 0; i < TableHeader.Length; i++) { - Status = AcpiEvAddressSpaceDispatch (RgnDesc, ACPI_READ_ADR_SPACE, + Status = AcpiEvAddressSpaceDispatch (RgnDesc, ACPI_READ, (ACPI_PHYSICAL_ADDRESS) i, 8, - (UINT32 *) (TableDataPtr + i)); + (ACPI_INTEGER *) (TableDataPtr + i)); if (ACPI_FAILURE (Status)) { goto Cleanup; } } - /* Table must be either an SSDT or a PSDT */ if ((!STRNCMP (TableHeader.Signature, @@ -230,7 +231,6 @@ AcpiExLoadOp ( goto Cleanup; } - /* Install the new table into the local data structures */ TableInfo.Pointer = (ACPI_TABLE_HEADER *) TablePtr; @@ -246,27 +246,24 @@ AcpiExLoadOp ( /* Add the table to the namespace */ - /* TBD: [Restructure] - change to whatever new interface is appropriate */ -/* - Status = AcpiLoadNamespace (); + Status = AcpiNsLoadTable (TableInfo.InstalledDesc, AcpiGbl_RootNode); if (ACPI_FAILURE (Status)) { -*/ - /* TBD: [Errors] Unload the table on failure ? */ -/* + /* Uninstall table and free the buffer */ + + AcpiTbUninstallTable (TableInfo.InstalledDesc); goto Cleanup; } -*/ - /* TBD: [Investigate] we need a pointer to the table desc */ + /* We need a pointer to the table desc */ /* Init the table handle */ TableDesc->Reference.Opcode = AML_LOAD_OP; TableDesc->Reference.Object = TableInfo.InstalledDesc; - /* TBD: store the tabledesc into the DdbHandle target */ + /* Store the tabledesc into the DdbHandle target */ /* DdbHandle = TableDesc; */ return_ACPI_STATUS (Status); diff --git a/sys/contrib/dev/acpica/excreate.c b/sys/contrib/dev/acpica/excreate.c index 0a86f6d..0410fe5 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: 71 $ + * $Revision: 79 $ * *****************************************************************************/ @@ -130,7 +130,6 @@ MODULE_NAME ("excreate") - /***************************************************************************** * * FUNCTION: AcpiExCreateAlias @@ -162,8 +161,8 @@ AcpiExCreateAlias ( /* Attach the original source object to the new Alias Node */ - Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) WalkState->Operands[0], - SourceNode->Object, + Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) WalkState->Operands[0], + AcpiNsGetAttachedObject (SourceNode), SourceNode->Type); /* @@ -209,11 +208,11 @@ AcpiExCreateEvent ( goto Cleanup; } - /* Create the actual OS semaphore */ - - /* TBD: [Investigate] should be created with 0 or 1 units? */ - - Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, 1, + /* + * Create the actual OS semaphore, with zero initial units -- meaning + * that the event is created in an unsignalled state + */ + Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, 0, &ObjDesc->Event.Semaphore); if (ACPI_FAILURE (Status)) { @@ -226,7 +225,7 @@ AcpiExCreateEvent ( ObjDesc, (UINT8) ACPI_TYPE_EVENT); Cleanup: - /* + /* * Remove local reference to the object (on error, will cause deletion * of both object and semaphore if present.) */ @@ -269,8 +268,11 @@ AcpiExCreateMutex ( goto Cleanup; } - /* Create the actual OS semaphore */ - + /* + * Create the actual OS semaphore. + * One unit max to make it a mutex, with one initial unit to allow + * the mutex to be acquired. + */ Status = AcpiOsCreateSemaphore (1, 1, &ObjDesc->Mutex.Semaphore); if (ACPI_FAILURE (Status)) { @@ -286,7 +288,7 @@ AcpiExCreateMutex ( Cleanup: - /* + /* * Remove local reference to the object (on error, will cause deletion * of both object and semaphore if present.) */ @@ -320,6 +322,7 @@ AcpiExCreateRegion ( ACPI_STATUS Status; ACPI_OPERAND_OBJECT *ObjDesc; ACPI_NAMESPACE_NODE *Node; + ACPI_OPERAND_OBJECT *RegionObj2 = NULL; FUNCTION_TRACE ("ExCreateRegion"); @@ -327,13 +330,13 @@ AcpiExCreateRegion ( /* Get the Node from the object stack */ - Node = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0]; + Node = WalkState->Op->Node; /* * If the region object is already attached to this node, * just return */ - if (Node->Object) + if (AcpiNsGetAttachedObject (Node)) { return_ACPI_STATUS (AE_OK); } @@ -342,8 +345,8 @@ AcpiExCreateRegion ( * Space ID must be one of the predefined IDs, or in the user-defined * range */ - if ((RegionSpace >= NUM_REGION_TYPES) && - (RegionSpace < USER_REGION_BEGIN)) + if ((RegionSpace >= ACPI_NUM_PREDEFINED_REGIONS) && + (RegionSpace < ACPI_USER_REGION_BEGIN)) { REPORT_ERROR (("Invalid AddressSpace type %X\n", RegionSpace)); return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID); @@ -362,22 +365,13 @@ AcpiExCreateRegion ( goto Cleanup; } - /* Allocate a method object for this region */ - - ObjDesc->Region.Extra = AcpiUtCreateInternalObject ( - INTERNAL_TYPE_EXTRA); - if (!ObjDesc->Region.Extra) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - /* * Remember location in AML stream of address & length * operands since they need to be evaluated at run time. */ - ObjDesc->Region.Extra->Extra.AmlStart = AmlStart; - ObjDesc->Region.Extra->Extra.AmlLength = AmlLength; + RegionObj2 = ObjDesc->Common.NextObject; + RegionObj2->Extra.AmlStart = AmlStart; + RegionObj2->Extra.AmlLength = AmlLength; /* Init the region from the operands */ @@ -388,37 +382,14 @@ AcpiExCreateRegion ( /* Install the new region object in the parent Node */ - Status = AcpiNsAttachObject (Node, ObjDesc, - (UINT8) ACPI_TYPE_REGION); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } + Status = AcpiNsAttachObject (Node, ObjDesc, (UINT8) ACPI_TYPE_REGION); - /* - * If we have a valid region, initialize it - * Namespace is NOT locked at this point. - */ - Status = AcpiEvInitializeRegion (ObjDesc, FALSE); - if (ACPI_FAILURE (Status)) - { - /* - * If AE_NOT_EXIST is returned, it is not fatal - * because many regions get created before a handler - * is installed for said region. - */ - if (AE_NOT_EXIST == Status) - { - Status = AE_OK; - } - } Cleanup: /* Remove local reference to the object */ AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); } @@ -506,7 +477,7 @@ AcpiExCreateProcessor ( /* Install the processor object in the parent Node */ - Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0], + Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0], ObjDesc, (UINT8) ACPI_TYPE_PROCESSOR); @@ -560,7 +531,7 @@ AcpiExCreatePowerResource ( /* Install the power resource object in the parent Node */ - Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0], + Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0], ObjDesc, (UINT8) ACPI_TYPE_POWER); @@ -642,7 +613,7 @@ AcpiExCreateMethod ( /* Attach the new object to the method Node */ - Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0], + Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0], ObjDesc, (UINT8) ACPI_TYPE_METHOD); /* Remove local reference to the object */ diff --git a/sys/contrib/dev/acpica/exdump.c b/sys/contrib/dev/acpica/exdump.c index 63ea268..6b0a455 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: 126 $ + * $Revision: 138 $ * *****************************************************************************/ @@ -164,9 +164,15 @@ AcpiExShowHexValue ( FUNCTION_TRACE ("ExShowHexValue"); + if (!((ACPI_LV_LOAD & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer))) + { + return; + } + if (!AmlStart) { REPORT_ERROR (("ExShowHexValue: null pointer\n")); + return; } /* @@ -194,30 +200,29 @@ AcpiExShowHexValue ( for (Length = LeadSpace; Length; --Length ) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, " ")); + AcpiOsPrintf (" "); } while (ByteCount--) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, "%02x", *AmlStart++)); - + AcpiOsPrintf ("%02x", *AmlStart++); if (ByteCount) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, " ")); + AcpiOsPrintf (" "); } } if (ShowDecimalValue) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, " [%d]", Value)); + AcpiOsPrintf (" [%d]", Value); } if (0 == LeadSpace) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, " ")); + AcpiOsPrintf (" "); } - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, "\n")); + AcpiOsPrintf ("\n"); return_VOID; } @@ -246,6 +251,11 @@ AcpiExDumpOperand ( PROC_NAME ("ExDumpOperand") + if (!((ACPI_LV_INFO & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer))) + { + return (AE_OK); + } + if (!EntryDesc) { /* @@ -283,31 +293,31 @@ AcpiExDumpOperand ( { case AML_ZERO_OP: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Zero\n")); + AcpiOsPrintf ("Reference: Zero\n"); break; case AML_ONE_OP: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: One\n")); + AcpiOsPrintf ("Reference: One\n"); break; case AML_ONES_OP: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Ones\n")); + AcpiOsPrintf ("Reference: Ones\n"); break; case AML_REVISION_OP: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Revision\n")); + AcpiOsPrintf ("Reference: Revision\n"); break; case AML_DEBUG_OP: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Debug\n")); + AcpiOsPrintf ("Reference: Debug\n"); break; @@ -321,59 +331,59 @@ AcpiExDumpOperand ( case AML_INDEX_OP: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Index %p\n", - EntryDesc->Reference.Object)); + AcpiOsPrintf ("Reference: Index %p\n", + EntryDesc->Reference.Object); break; case AML_ARG_OP: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Arg%d", - EntryDesc->Reference.Offset)); + AcpiOsPrintf ("Reference: Arg%d", + EntryDesc->Reference.Offset); if (ACPI_TYPE_INTEGER == EntryDesc->Common.Type) { /* Value is a Number */ - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, " value is [%8.8X%8.8x]", + AcpiOsPrintf (" value is [%8.8X%8.8x]", HIDWORD(EntryDesc->Integer.Value), - LODWORD(EntryDesc->Integer.Value))); + LODWORD(EntryDesc->Integer.Value)); } - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n")); + AcpiOsPrintf ("\n"); break; case AML_LOCAL_OP: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Local%d", - EntryDesc->Reference.Offset)); + AcpiOsPrintf ("Reference: Local%d", + EntryDesc->Reference.Offset); if (ACPI_TYPE_INTEGER == EntryDesc->Common.Type) { /* Value is a Number */ - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, " value is [%8.8X%8.8x]", + AcpiOsPrintf (" value is [%8.8X%8.8x]", HIDWORD(EntryDesc->Integer.Value), - LODWORD(EntryDesc->Integer.Value))); + LODWORD(EntryDesc->Integer.Value)); } - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n")); + AcpiOsPrintf ("\n"); break; case AML_INT_NAMEPATH_OP: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference.Node->Name %X\n", - EntryDesc->Reference.Node->Name)); + AcpiOsPrintf ("Reference.Node->Name %X\n", + EntryDesc->Reference.Node->Name); break; default: /* unknown opcode */ - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Unknown opcode=%X\n", - EntryDesc->Reference.Opcode)); + AcpiOsPrintf ("Unknown opcode=%X\n", + EntryDesc->Reference.Opcode); break; } @@ -383,9 +393,9 @@ AcpiExDumpOperand ( case ACPI_TYPE_BUFFER: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Buffer len %X @ %p \n", + AcpiOsPrintf ("Buffer len %X @ %p \n", EntryDesc->Buffer.Length, - EntryDesc->Buffer.Pointer)); + EntryDesc->Buffer.Pointer); Length = EntryDesc->Buffer.Length; @@ -398,13 +408,13 @@ AcpiExDumpOperand ( if (EntryDesc->Buffer.Pointer) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Buffer Contents: ")); + AcpiOsPrintf ("Buffer Contents: "); for (Buf = EntryDesc->Buffer.Pointer; Length--; ++Buf) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, " %02x", *Buf)); + AcpiOsPrintf (" %02x", *Buf); } - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO,"\n")); + AcpiOsPrintf ("\n"); } break; @@ -412,32 +422,32 @@ AcpiExDumpOperand ( case ACPI_TYPE_INTEGER: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Integer %8.8X%8.8X\n", + AcpiOsPrintf ("Integer %8.8X%8.8X\n", HIDWORD (EntryDesc->Integer.Value), - LODWORD (EntryDesc->Integer.Value))); + LODWORD (EntryDesc->Integer.Value)); break; case INTERNAL_TYPE_IF: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "If [Integer] %8.8X%8.8X\n", + AcpiOsPrintf ("If [Integer] %8.8X%8.8X\n", HIDWORD (EntryDesc->Integer.Value), - LODWORD (EntryDesc->Integer.Value))); + LODWORD (EntryDesc->Integer.Value)); break; case INTERNAL_TYPE_WHILE: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "While [Integer] %8.8X%8.8X\n", + AcpiOsPrintf ("While [Integer] %8.8X%8.8X\n", HIDWORD (EntryDesc->Integer.Value), - LODWORD (EntryDesc->Integer.Value))); + LODWORD (EntryDesc->Integer.Value)); break; case ACPI_TYPE_PACKAGE: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Package count %X @ %p\n", - EntryDesc->Package.Count, EntryDesc->Package.Elements)); + AcpiOsPrintf ("Package count %X @ %p\n", + EntryDesc->Package.Count, EntryDesc->Package.Elements); /* * If elements exist, package vector pointer is valid, @@ -458,16 +468,16 @@ AcpiExDumpOperand ( } } - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n")); + AcpiOsPrintf ("\n"); break; case ACPI_TYPE_REGION: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Region %s (%X)", + AcpiOsPrintf ("Region %s (%X)", AcpiUtGetRegionName (EntryDesc->Region.SpaceId), - EntryDesc->Region.SpaceId)); + EntryDesc->Region.SpaceId); /* * If the address and length have not been evaluated, @@ -475,62 +485,63 @@ AcpiExDumpOperand ( */ if (!(EntryDesc->Region.Flags & AOPOBJ_DATA_VALID)) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\n")); + AcpiOsPrintf ("\n"); } else { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, " base %8.8X%8.8X Length %X\n", + AcpiOsPrintf (" base %8.8X%8.8X Length %X\n", HIDWORD(EntryDesc->Region.Address), LODWORD(EntryDesc->Region.Address), - EntryDesc->Region.Length)); + EntryDesc->Region.Length); } break; case ACPI_TYPE_STRING: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "String length %X @ %p \"", - EntryDesc->String.Length, EntryDesc->String.Pointer)); + AcpiOsPrintf ("String length %X @ %p \"", + EntryDesc->String.Length, EntryDesc->String.Pointer); for (i = 0; i < EntryDesc->String.Length; i++) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "%c", - EntryDesc->String.Pointer[i])); + AcpiOsPrintf ("%c", + EntryDesc->String.Pointer[i]); } - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "\"\n")); + AcpiOsPrintf ("\"\n"); break; case INTERNAL_TYPE_BANK_FIELD: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "BankField\n")); + AcpiOsPrintf ("BankField\n"); break; case INTERNAL_TYPE_REGION_FIELD: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, - "RegionField: bits=%X bitaccwidth=%X lock=%X update=%X at byte=%X bit=%X of below:\n", + AcpiOsPrintf ( + "RegionField: Bits=%X BitAccWidth=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n", EntryDesc->Field.BitLength, EntryDesc->Field.AccessBitWidth, - EntryDesc->Field.LockRule, EntryDesc->Field.UpdateRule, - EntryDesc->Field.BaseByteOffset, EntryDesc->Field.StartFieldBitOffset)); + EntryDesc->Field.FieldFlags & AML_FIELD_LOCK_RULE_MASK, + EntryDesc->Field.FieldFlags & AML_FIELD_UPDATE_RULE_MASK, + EntryDesc->Field.BaseByteOffset, EntryDesc->Field.StartFieldBitOffset); DUMP_STACK_ENTRY (EntryDesc->Field.RegionObj); break; case INTERNAL_TYPE_INDEX_FIELD: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "IndexField\n")); + AcpiOsPrintf ("IndexField\n"); break; case ACPI_TYPE_BUFFER_FIELD: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, + AcpiOsPrintf ( "BufferField: %X bits at byte %X bit %X of \n", EntryDesc->BufferField.BitLength, EntryDesc->BufferField.BaseByteOffset, - EntryDesc->BufferField.StartFieldBitOffset)); + EntryDesc->BufferField.StartFieldBitOffset); if (!EntryDesc->BufferField.BufferObj) { @@ -540,7 +551,7 @@ AcpiExDumpOperand ( else if (ACPI_TYPE_BUFFER != EntryDesc->BufferField.BufferObj->Common.Type) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "*not a Buffer* \n")); + AcpiOsPrintf ("*not a Buffer* \n"); } else @@ -553,68 +564,54 @@ AcpiExDumpOperand ( case ACPI_TYPE_EVENT: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Event\n")); + AcpiOsPrintf ("Event\n"); break; case ACPI_TYPE_METHOD: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, + AcpiOsPrintf ( "Method(%X) @ %p:%X\n", EntryDesc->Method.ParamCount, - EntryDesc->Method.AmlStart, EntryDesc->Method.AmlLength)); + EntryDesc->Method.AmlStart, EntryDesc->Method.AmlLength); break; case ACPI_TYPE_MUTEX: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Mutex\n")); + AcpiOsPrintf ("Mutex\n"); break; case ACPI_TYPE_DEVICE: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Device\n")); + AcpiOsPrintf ("Device\n"); break; case ACPI_TYPE_POWER: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Power\n")); + AcpiOsPrintf ("Power\n"); break; case ACPI_TYPE_PROCESSOR: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Processor\n")); + AcpiOsPrintf ("Processor\n"); break; case ACPI_TYPE_THERMAL: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Thermal\n")); + AcpiOsPrintf ("Thermal\n"); break; default: /* unknown EntryDesc->Common.Type value */ - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Unknown Type %X\n", - EntryDesc->Common.Type)); - - /* Back up to previous entry */ - - EntryDesc--; - - - /* TBD: [Restructure] Change to use dump object routine !! */ - /* What is all of this?? */ - - DUMP_BUFFER (EntryDesc, sizeof (ACPI_OPERAND_OBJECT)); - DUMP_BUFFER (++EntryDesc, sizeof (ACPI_OPERAND_OBJECT)); - DUMP_BUFFER (++EntryDesc, sizeof (ACPI_OPERAND_OBJECT)); + AcpiOsPrintf ("Unknown Type %X\n", EntryDesc->Common.Type); break; - } return (AE_OK); @@ -692,6 +689,57 @@ AcpiExDumpOperands ( /***************************************************************************** * + * FUNCTION: AcpiExOut* + * + * PARAMETERS: Title - Descriptive text + * Value - Value to be displayed + * + * DESCRIPTION: Object dump output formatting functions. These functions + * reduce the number of format strings required and keeps them + * all in one place for easy modification. + * + ****************************************************************************/ + +void +AcpiExOutString ( + char *Title, + char *Value) +{ + AcpiOsPrintf ("%20s : %s\n", Title, Value); +} + +void +AcpiExOutPointer ( + char *Title, + void *Value) +{ + AcpiOsPrintf ("%20s : %p\n", Title, Value); +} + +void +AcpiExOutInteger ( + char *Title, + UINT32 Value) +{ + AcpiOsPrintf ("%20s : %X\n", Title, Value); +} + +void +AcpiExOutAddress ( + char *Title, + ACPI_PHYSICAL_ADDRESS Value) +{ +#ifdef _IA16 + AcpiOsPrintf ("%20s : %p\n", Title, Value); +#else + AcpiOsPrintf ("%20s : %8.8X%8.8X\n", Title, + HIDWORD (Value), LODWORD (Value)); +#endif +} + + +/***************************************************************************** + * * FUNCTION: AcpiExDumpNode * * PARAMETERS: *Node - Descriptor to dump @@ -720,14 +768,14 @@ AcpiExDumpNode ( AcpiOsPrintf ("%20s : %4.4s\n", "Name", (char*)&Node->Name); - AcpiOsPrintf ("%20s : %s\n", "Type", AcpiUtGetTypeName (Node->Type)); - AcpiOsPrintf ("%20s : %X\n", "Flags", Node->Flags); - AcpiOsPrintf ("%20s : %X\n", "Owner Id", Node->OwnerId); - AcpiOsPrintf ("%20s : %X\n", "Reference Count", Node->ReferenceCount); - AcpiOsPrintf ("%20s : %p\n", "Attached Object", Node->Object); - AcpiOsPrintf ("%20s : %p\n", "ChildList", Node->Child); - AcpiOsPrintf ("%20s : %p\n", "NextPeer", Node->Peer); - AcpiOsPrintf ("%20s : %p\n", "Parent", AcpiNsGetParentObject (Node)); + AcpiExOutString ("Type", AcpiUtGetTypeName (Node->Type)); + AcpiExOutInteger ("Flags", Node->Flags); + AcpiExOutInteger ("Owner Id", Node->OwnerId); + AcpiExOutInteger ("Reference Count", Node->ReferenceCount); + AcpiExOutPointer ("Attached Object", AcpiNsGetAttachedObject (Node)); + AcpiExOutPointer ("ChildList", Node->Child); + AcpiExOutPointer ("NextPeer", Node->Peer); + AcpiExOutPointer ("Parent", AcpiNsGetParentObject (Node)); } @@ -747,7 +795,7 @@ AcpiExDumpObjectDescriptor ( ACPI_OPERAND_OBJECT *ObjDesc, UINT32 Flags) { - const ACPI_OPCODE_INFO *OpInfo; + UINT32 i; FUNCTION_TRACE ("ExDumpObjectDescriptor"); @@ -763,14 +811,15 @@ AcpiExDumpObjectDescriptor ( if (!(VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_INTERNAL))) { - AcpiOsPrintf ("%p is not a valid ACPI object\n", ObjDesc); + AcpiOsPrintf ("ExDumpObjectDescriptor: %p is not a valid ACPI object\n", ObjDesc); return; } /* Common Fields */ - AcpiOsPrintf ("%20s : %X\n", "Reference Count", ObjDesc->Common.ReferenceCount); - AcpiOsPrintf ("%20s : %X\n", "Flags", ObjDesc->Common.Flags); + AcpiExOutString ("Type", AcpiUtGetTypeName (ObjDesc->Common.Type)); + AcpiExOutInteger ("Reference Count", ObjDesc->Common.ReferenceCount); + AcpiExOutInteger ("Flags", ObjDesc->Common.Flags); /* Object-specific Fields */ @@ -778,7 +827,6 @@ AcpiExDumpObjectDescriptor ( { case ACPI_TYPE_INTEGER: - AcpiOsPrintf ("%20s : %s\n", "Type", "Integer"); AcpiOsPrintf ("%20s : %X%8.8X\n", "Value", HIDWORD (ObjDesc->Integer.Value), LODWORD (ObjDesc->Integer.Value)); break; @@ -786,190 +834,181 @@ AcpiExDumpObjectDescriptor ( case ACPI_TYPE_STRING: - AcpiOsPrintf ("%20s : %s\n", "Type", "String"); - AcpiOsPrintf ("%20s : %X\n", "Length", ObjDesc->String.Length); - AcpiOsPrintf ("%20s : %p\n", "Pointer", ObjDesc->String.Pointer); + AcpiExOutInteger ("Length", ObjDesc->String.Length); + AcpiExOutPointer ("Pointer", ObjDesc->String.Pointer); break; case ACPI_TYPE_BUFFER: - AcpiOsPrintf ("%20s : %s\n", "Type", "Buffer"); - AcpiOsPrintf ("%20s : %X\n", "Length", ObjDesc->Buffer.Length); - AcpiOsPrintf ("%20s : %p\n", "Pointer", ObjDesc->Buffer.Pointer); + AcpiExOutInteger ("Length", ObjDesc->Buffer.Length); + AcpiExOutPointer ("Pointer", ObjDesc->Buffer.Pointer); break; case ACPI_TYPE_PACKAGE: - AcpiOsPrintf ("%20s : %s\n", "Type", "Package"); - AcpiOsPrintf ("%20s : %X\n", "Flags", ObjDesc->Package.Flags); - AcpiOsPrintf ("%20s : %X\n", "Count", ObjDesc->Package.Count); - AcpiOsPrintf ("%20s : %p\n", "Elements", ObjDesc->Package.Elements); - AcpiOsPrintf ("%20s : %p\n", "NextElement", ObjDesc->Package.NextElement); - break; - + AcpiExOutInteger ("Flags", ObjDesc->Package.Flags); + AcpiExOutInteger ("Count", ObjDesc->Package.Count); + AcpiExOutPointer ("Elements", ObjDesc->Package.Elements); + AcpiExOutPointer ("NextElement", ObjDesc->Package.NextElement); - case ACPI_TYPE_BUFFER_FIELD: + /* Dump the package contents */ - AcpiOsPrintf ("%20s : %s\n", "Type", "BufferField"); - AcpiOsPrintf ("%20s : %X\n", "BitLength", ObjDesc->BufferField.BitLength); - AcpiOsPrintf ("%20s : %X\n", "BitOffset", ObjDesc->BufferField.StartFieldBitOffset); - AcpiOsPrintf ("%20s : %X\n", "BaseByteOffset",ObjDesc->BufferField.BaseByteOffset); - AcpiOsPrintf ("%20s : %p\n", "BufferObj", ObjDesc->BufferField.BufferObj); + if (ObjDesc->Package.Count > 0) + { + AcpiOsPrintf ("\nPackage Contents:\n"); + for (i = 0; i < ObjDesc->Package.Count; i++) + { + AcpiOsPrintf ("[%.3d] %p", i, ObjDesc->Package.Elements[i]); + if (ObjDesc->Package.Elements[i]) + { + AcpiOsPrintf (" %s", AcpiUtGetTypeName ((ObjDesc->Package.Elements[i])->Common.Type)); + } + AcpiOsPrintf ("\n"); + } + } break; case ACPI_TYPE_DEVICE: - AcpiOsPrintf ("%20s : %s\n", "Type", "Device"); - AcpiOsPrintf ("%20s : %p\n", "AddrHandler", ObjDesc->Device.AddrHandler); - AcpiOsPrintf ("%20s : %p\n", "SysHandler", ObjDesc->Device.SysHandler); - AcpiOsPrintf ("%20s : %p\n", "DrvHandler", ObjDesc->Device.DrvHandler); + AcpiExOutPointer ("AddrHandler", ObjDesc->Device.AddrHandler); + AcpiExOutPointer ("SysHandler", ObjDesc->Device.SysHandler); + AcpiExOutPointer ("DrvHandler", ObjDesc->Device.DrvHandler); break; + case ACPI_TYPE_EVENT: - AcpiOsPrintf ("%20s : %s\n", "Type", "Event"); - AcpiOsPrintf ("%20s : %X\n", "Semaphore", ObjDesc->Event.Semaphore); + AcpiExOutPointer ("Semaphore", ObjDesc->Event.Semaphore); break; case ACPI_TYPE_METHOD: - AcpiOsPrintf ("%20s : %s\n", "Type", "Method"); - AcpiOsPrintf ("%20s : %X\n", "ParamCount", ObjDesc->Method.ParamCount); - AcpiOsPrintf ("%20s : %X\n", "Concurrency", ObjDesc->Method.Concurrency); - AcpiOsPrintf ("%20s : %p\n", "Semaphore", ObjDesc->Method.Semaphore); - AcpiOsPrintf ("%20s : %X\n", "AmlLength", ObjDesc->Method.AmlLength); - AcpiOsPrintf ("%20s : %X\n", "AmlStart", ObjDesc->Method.AmlStart); + AcpiExOutInteger ("ParamCount", ObjDesc->Method.ParamCount); + AcpiExOutInteger ("Concurrency", ObjDesc->Method.Concurrency); + AcpiExOutPointer ("Semaphore", ObjDesc->Method.Semaphore); + AcpiExOutInteger ("AmlLength", ObjDesc->Method.AmlLength); + AcpiExOutPointer ("AmlStart", ObjDesc->Method.AmlStart); break; case ACPI_TYPE_MUTEX: - AcpiOsPrintf ("%20s : %s\n", "Type", "Mutex"); - AcpiOsPrintf ("%20s : %X\n", "SyncLevel", ObjDesc->Mutex.SyncLevel); - AcpiOsPrintf ("%20s : %p\n", "Owner", ObjDesc->Mutex.Owner); - AcpiOsPrintf ("%20s : %X\n", "AcquisitionDepth", ObjDesc->Mutex.AcquisitionDepth); - AcpiOsPrintf ("%20s : %p\n", "Semaphore", ObjDesc->Mutex.Semaphore); + AcpiExOutInteger ("SyncLevel", ObjDesc->Mutex.SyncLevel); + AcpiExOutPointer ("OwnerThread", ObjDesc->Mutex.OwnerThread); + AcpiExOutInteger ("AcquisitionDepth",ObjDesc->Mutex.AcquisitionDepth); + AcpiExOutPointer ("Semaphore", ObjDesc->Mutex.Semaphore); break; case ACPI_TYPE_REGION: - AcpiOsPrintf ("%20s : %s\n", "Type", "Region"); - AcpiOsPrintf ("%20s : %X\n", "SpaceId", ObjDesc->Region.SpaceId); - AcpiOsPrintf ("%20s : %X\n", "Flags", ObjDesc->Region.Flags); - AcpiOsPrintf ("%20s : %X\n", "Address", ObjDesc->Region.Address); - AcpiOsPrintf ("%20s : %X\n", "Length", ObjDesc->Region.Length); - AcpiOsPrintf ("%20s : %p\n", "AddrHandler", ObjDesc->Region.AddrHandler); - AcpiOsPrintf ("%20s : %p\n", "Next", ObjDesc->Region.Next); + AcpiExOutInteger ("SpaceId", ObjDesc->Region.SpaceId); + AcpiExOutInteger ("Flags", ObjDesc->Region.Flags); + AcpiExOutAddress ("Address", ObjDesc->Region.Address); + AcpiExOutInteger ("Length", ObjDesc->Region.Length); + AcpiExOutPointer ("AddrHandler", ObjDesc->Region.AddrHandler); + AcpiExOutPointer ("Next", ObjDesc->Region.Next); break; case ACPI_TYPE_POWER: - AcpiOsPrintf ("%20s : %s\n", "Type", "PowerResource"); - AcpiOsPrintf ("%20s : %X\n", "SystemLevel", ObjDesc->PowerResource.SystemLevel); - AcpiOsPrintf ("%20s : %X\n", "ResourceOrder", ObjDesc->PowerResource.ResourceOrder); - AcpiOsPrintf ("%20s : %p\n", "SysHandler", ObjDesc->PowerResource.SysHandler); - AcpiOsPrintf ("%20s : %p\n", "DrvHandler", ObjDesc->PowerResource.DrvHandler); + AcpiExOutInteger ("SystemLevel", ObjDesc->PowerResource.SystemLevel); + AcpiExOutInteger ("ResourceOrder", ObjDesc->PowerResource.ResourceOrder); + AcpiExOutPointer ("SysHandler", ObjDesc->PowerResource.SysHandler); + AcpiExOutPointer ("DrvHandler", ObjDesc->PowerResource.DrvHandler); break; case ACPI_TYPE_PROCESSOR: - AcpiOsPrintf ("%20s : %s\n", "Type", "Processor"); - AcpiOsPrintf ("%20s : %X\n", "Processor ID", ObjDesc->Processor.ProcId); - AcpiOsPrintf ("%20s : %X\n", "Length", ObjDesc->Processor.Length); - AcpiOsPrintf ("%20s : %X\n", "Address", ObjDesc->Processor.Address); - AcpiOsPrintf ("%20s : %p\n", "SysHandler", ObjDesc->Processor.SysHandler); - AcpiOsPrintf ("%20s : %p\n", "DrvHandler", ObjDesc->Processor.DrvHandler); - AcpiOsPrintf ("%20s : %p\n", "AddrHandler", ObjDesc->Processor.AddrHandler); + AcpiExOutInteger ("Processor ID", ObjDesc->Processor.ProcId); + AcpiExOutInteger ("Length", ObjDesc->Processor.Length); + AcpiExOutInteger ("Address", ObjDesc->Processor.Address); + AcpiExOutPointer ("SysHandler", ObjDesc->Processor.SysHandler); + AcpiExOutPointer ("DrvHandler", ObjDesc->Processor.DrvHandler); + AcpiExOutPointer ("AddrHandler", ObjDesc->Processor.AddrHandler); break; case ACPI_TYPE_THERMAL: - AcpiOsPrintf ("%20s : %s\n", "Type", "ThermalZone"); - AcpiOsPrintf ("%20s : %p\n", "SysHandler", ObjDesc->ThermalZone.SysHandler); - AcpiOsPrintf ("%20s : %p\n", "DrvHandler", ObjDesc->ThermalZone.DrvHandler); - AcpiOsPrintf ("%20s : %p\n", "AddrHandler", ObjDesc->ThermalZone.AddrHandler); + AcpiExOutPointer ("SysHandler", ObjDesc->ThermalZone.SysHandler); + AcpiExOutPointer ("DrvHandler", ObjDesc->ThermalZone.DrvHandler); + AcpiExOutPointer ("AddrHandler", ObjDesc->ThermalZone.AddrHandler); break; + case ACPI_TYPE_BUFFER_FIELD: case INTERNAL_TYPE_REGION_FIELD: - - AcpiOsPrintf ("%20s : %p\n", "AccessBitWidth", ObjDesc->Field.AccessBitWidth); - AcpiOsPrintf ("%20s : %p\n", "BitLength", ObjDesc->Field.BitLength); - AcpiOsPrintf ("%20s : %p\n", "BaseByteOffset",ObjDesc->Field.BaseByteOffset); - AcpiOsPrintf ("%20s : %p\n", "BitOffset", ObjDesc->Field.StartFieldBitOffset); - AcpiOsPrintf ("%20s : %p\n", "RegionObj", ObjDesc->Field.RegionObj); - break; - - case INTERNAL_TYPE_BANK_FIELD: + case INTERNAL_TYPE_INDEX_FIELD: - AcpiOsPrintf ("%20s : %s\n", "Type", "BankField"); - AcpiOsPrintf ("%20s : %X\n", "AccessBitWidth", ObjDesc->BankField.AccessBitWidth); - AcpiOsPrintf ("%20s : %X\n", "LockRule", ObjDesc->BankField.LockRule); - AcpiOsPrintf ("%20s : %X\n", "UpdateRule", ObjDesc->BankField.UpdateRule); - AcpiOsPrintf ("%20s : %X\n", "BitLength", ObjDesc->BankField.BitLength); - AcpiOsPrintf ("%20s : %X\n", "BitOffset", ObjDesc->BankField.StartFieldBitOffset); - AcpiOsPrintf ("%20s : %X\n", "BaseByteOffset", ObjDesc->BankField.BaseByteOffset); - AcpiOsPrintf ("%20s : %X\n", "Value", ObjDesc->BankField.Value); - AcpiOsPrintf ("%20s : %p\n", "RegionObj", ObjDesc->BankField.RegionObj); - AcpiOsPrintf ("%20s : %X\n", "BankRegisterObj", ObjDesc->BankField.BankRegisterObj); - break; + AcpiExOutInteger ("FieldFlags", ObjDesc->CommonField.FieldFlags); + AcpiExOutInteger ("AccessBitWidth", ObjDesc->CommonField.AccessBitWidth); + AcpiExOutInteger ("AccessByteWidth", ObjDesc->CommonField.AccessByteWidth); + AcpiExOutInteger ("BitLength", ObjDesc->CommonField.BitLength); + AcpiExOutInteger ("FldBitOffset", ObjDesc->CommonField.StartFieldBitOffset); + AcpiExOutInteger ("BaseByteOffset", ObjDesc->CommonField.BaseByteOffset); + AcpiExOutInteger ("DatumValidBits", ObjDesc->CommonField.DatumValidBits); + AcpiExOutInteger ("EndFldValidBits", ObjDesc->CommonField.EndFieldValidBits); + AcpiExOutInteger ("EndBufValidBits", ObjDesc->CommonField.EndBufferValidBits); + AcpiExOutPointer ("ParentNode", ObjDesc->CommonField.Node); + + switch (ObjDesc->Common.Type) + { + case ACPI_TYPE_BUFFER_FIELD: + AcpiExOutPointer ("BufferObj", ObjDesc->BufferField.BufferObj); + break; + case INTERNAL_TYPE_REGION_FIELD: + AcpiExOutPointer ("RegionObj", ObjDesc->Field.RegionObj); + break; - case INTERNAL_TYPE_INDEX_FIELD: + case INTERNAL_TYPE_BANK_FIELD: + AcpiExOutInteger ("Value", ObjDesc->BankField.Value); + AcpiExOutPointer ("RegionObj", ObjDesc->BankField.RegionObj); + AcpiExOutPointer ("BankObj", ObjDesc->BankField.BankObj); + break; - AcpiOsPrintf ("%20s : %s\n", "Type", "IndexField"); - AcpiOsPrintf ("%20s : %X\n", "AccessBitWidth", ObjDesc->IndexField.AccessBitWidth); - AcpiOsPrintf ("%20s : %X\n", "LockRule", ObjDesc->IndexField.LockRule); - AcpiOsPrintf ("%20s : %X\n", "UpdateRule", ObjDesc->IndexField.UpdateRule); - AcpiOsPrintf ("%20s : %X\n", "BitLength", ObjDesc->IndexField.BitLength); - AcpiOsPrintf ("%20s : %X\n", "BitOffset", ObjDesc->IndexField.StartFieldBitOffset); - AcpiOsPrintf ("%20s : %X\n", "Value", ObjDesc->IndexField.Value); - AcpiOsPrintf ("%20s : %X\n", "Index", ObjDesc->IndexField.IndexObj); - AcpiOsPrintf ("%20s : %X\n", "Data", ObjDesc->IndexField.DataObj); + case INTERNAL_TYPE_INDEX_FIELD: + AcpiExOutInteger ("Value", ObjDesc->IndexField.Value); + AcpiExOutPointer ("Index", ObjDesc->IndexField.IndexObj); + AcpiExOutPointer ("Data", ObjDesc->IndexField.DataObj); + break; + } break; case INTERNAL_TYPE_REFERENCE: - OpInfo = AcpiPsGetOpcodeInfo (ObjDesc->Reference.Opcode); - - AcpiOsPrintf ("%20s : %s\n", "Type", "Reference"); - AcpiOsPrintf ("%20s : %X\n", "TargetType", ObjDesc->Reference.TargetType); - AcpiOsPrintf ("%20s : %s\n", "Opcode", OpInfo->Name); - AcpiOsPrintf ("%20s : %X\n", "Offset", ObjDesc->Reference.Offset); - AcpiOsPrintf ("%20s : %p\n", "ObjDesc", ObjDesc->Reference.Object); - AcpiOsPrintf ("%20s : %p\n", "Node", ObjDesc->Reference.Node); - AcpiOsPrintf ("%20s : %p\n", "Where", ObjDesc->Reference.Where); + AcpiExOutInteger ("TargetType", ObjDesc->Reference.TargetType); + AcpiExOutString ("Opcode", (AcpiPsGetOpcodeInfo (ObjDesc->Reference.Opcode))->Name); + AcpiExOutInteger ("Offset", ObjDesc->Reference.Offset); + AcpiExOutPointer ("ObjDesc", ObjDesc->Reference.Object); + AcpiExOutPointer ("Node", ObjDesc->Reference.Node); + AcpiExOutPointer ("Where", ObjDesc->Reference.Where); break; case INTERNAL_TYPE_ADDRESS_HANDLER: - AcpiOsPrintf ("%20s : %s\n", "Type", "Address Handler"); - AcpiOsPrintf ("%20s : %X\n", "SpaceId", ObjDesc->AddrHandler.SpaceId); - AcpiOsPrintf ("%20s : %p\n", "Next", ObjDesc->AddrHandler.Next); - AcpiOsPrintf ("%20s : %p\n", "RegionList", ObjDesc->AddrHandler.RegionList); - AcpiOsPrintf ("%20s : %p\n", "Node", ObjDesc->AddrHandler.Node); - AcpiOsPrintf ("%20s : %p\n", "Handler", ObjDesc->AddrHandler.Handler); - AcpiOsPrintf ("%20s : %p\n", "Context", ObjDesc->AddrHandler.Context); + AcpiExOutInteger ("SpaceId", ObjDesc->AddrHandler.SpaceId); + AcpiExOutPointer ("Next", ObjDesc->AddrHandler.Next); + AcpiExOutPointer ("RegionList", ObjDesc->AddrHandler.RegionList); + AcpiExOutPointer ("Node", ObjDesc->AddrHandler.Node); + AcpiExOutPointer ("Context", ObjDesc->AddrHandler.Context); break; case INTERNAL_TYPE_NOTIFY: - AcpiOsPrintf ("%20s : %s\n", "Type", "Notify Handler"); - AcpiOsPrintf ("%20s : %p\n", "Node", ObjDesc->NotifyHandler.Node); - AcpiOsPrintf ("%20s : %p\n", "Handler", ObjDesc->NotifyHandler.Handler); - AcpiOsPrintf ("%20s : %p\n", "Context", ObjDesc->NotifyHandler.Context); + AcpiExOutPointer ("Node", ObjDesc->NotifyHandler.Node); + AcpiExOutPointer ("Context", ObjDesc->NotifyHandler.Context); break; @@ -982,15 +1021,17 @@ AcpiExDumpObjectDescriptor ( case INTERNAL_TYPE_WHILE: case INTERNAL_TYPE_SCOPE: case INTERNAL_TYPE_DEF_ANY: + case INTERNAL_TYPE_EXTRA: + case INTERNAL_TYPE_DATA: - AcpiOsPrintf ("*** Structure display not implemented for type %X! ***\n", + AcpiOsPrintf ("ExDumpObjectDescriptor: Display not implemented for object type %X\n", ObjDesc->Common.Type); break; default: - AcpiOsPrintf ("*** Cannot display unknown type %X! ***\n", ObjDesc->Common.Type); + AcpiOsPrintf ("ExDumpObjectDescriptor: Unknown object type %X\n", ObjDesc->Common.Type); break; } diff --git a/sys/contrib/dev/acpica/exfield.c b/sys/contrib/dev/acpica/exfield.c index 49f3062..d6a75a5 100644 --- a/sys/contrib/dev/acpica/exfield.c +++ b/sys/contrib/dev/acpica/exfield.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exfield - ACPI AML (p-code) execution - field manipulation - * $Revision: 95 $ + * $Revision: 101 $ * *****************************************************************************/ @@ -134,14 +134,13 @@ * * FUNCTION: AcpiExReadDataFromField * - * PARAMETERS: Mode - ACPI_READ or ACPI_WRITE - * *FieldNode - Parent node for field to be accessed - * *Buffer - Value(s) to be read or written - * BufferLength - Number of bytes to transfer + * PARAMETERS: ObjDesc - The named field + * RetBufferDesc - Where the return data object is stored * - * RETURN: Status3 + * RETURN: Status * - * DESCRIPTION: Read or write a named field + * DESCRIPTION: Read from a named field. Returns either an Integer or a + * Buffer, depending on the size of the field. * ******************************************************************************/ @@ -154,6 +153,7 @@ AcpiExReadDataFromField ( ACPI_OPERAND_OBJECT *BufferDesc; UINT32 Length; void *Buffer; + BOOLEAN Locked; FUNCTION_TRACE_PTR ("ExReadDataFromField", ObjDesc); @@ -166,6 +166,22 @@ AcpiExReadDataFromField ( return_ACPI_STATUS (AE_AML_NO_OPERAND); } + if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD) + { + /* + * If the BufferField arguments have not been previously evaluated, + * evaluate them now and save the results. + */ + if (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)) + { + Status = AcpiDsGetBufferFieldArguments (ObjDesc); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } + } + /* * Allocate a buffer for the contents of the field. * @@ -200,7 +216,6 @@ AcpiExReadDataFromField ( BufferDesc->Buffer.Length = Length; Buffer = BufferDesc->Buffer.Pointer; } - else { /* Field will fit within an Integer (normal case) */ @@ -215,37 +230,30 @@ AcpiExReadDataFromField ( Buffer = &BufferDesc->Integer.Value; } + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "Obj=%p Type=%X Buf=%p Len=%X\n", + ObjDesc, ObjDesc->Common.Type, Buffer, Length)); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "FieldWrite: BitLen=%X BitOff=%X ByteOff=%X\n", + ObjDesc->CommonField.BitLength, + ObjDesc->CommonField.StartFieldBitOffset, + ObjDesc->CommonField.BaseByteOffset)); - /* Read from the appropriate field */ - - switch (ObjDesc->Common.Type) - { - case ACPI_TYPE_BUFFER_FIELD: - Status = AcpiExAccessBufferField (ACPI_READ, ObjDesc, Buffer, Length); - break; - - case INTERNAL_TYPE_REGION_FIELD: - Status = AcpiExAccessRegionField (ACPI_READ, ObjDesc, Buffer, Length); - break; - - case INTERNAL_TYPE_BANK_FIELD: - Status = AcpiExAccessBankField (ACPI_READ, ObjDesc, Buffer, Length); - break; + Locked = AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); - case INTERNAL_TYPE_INDEX_FIELD: - Status = AcpiExAccessIndexField (ACPI_READ, ObjDesc, Buffer, Length); - break; + /* Read from the field */ - default: - Status = AE_AML_INTERNAL; - } + Status = AcpiExExtractFromField (ObjDesc, Buffer, Length); + /* + * Release global lock if we acquired it earlier + */ + AcpiExReleaseGlobalLock (Locked); if (ACPI_FAILURE (Status)) { AcpiUtRemoveReference (BufferDesc); } - else if (RetBufferDesc) { *RetBufferDesc = BufferDesc; @@ -259,18 +267,15 @@ AcpiExReadDataFromField ( * * FUNCTION: AcpiExWriteDataToField * - * PARAMETERS: Mode - ACPI_READ or ACPI_WRITE - * *FieldNode - Parent node for field to be accessed - * *Buffer - Value(s) to be read or written - * BufferLength - Number of bytes to transfer + * PARAMETERS: SourceDesc - Contains data to write + * ObjDesc - The named field * * RETURN: Status * - * DESCRIPTION: Read or write a named field + * DESCRIPTION: Write to a named field * ******************************************************************************/ - ACPI_STATUS AcpiExWriteDataToField ( ACPI_OPERAND_OBJECT *SourceDesc, @@ -278,7 +283,10 @@ AcpiExWriteDataToField ( { ACPI_STATUS Status; UINT32 Length; + UINT32 RequiredLength; void *Buffer; + void *NewBuffer; + BOOLEAN Locked; FUNCTION_TRACE_PTR ("ExWriteDataToField", ObjDesc); @@ -291,6 +299,21 @@ AcpiExWriteDataToField ( return_ACPI_STATUS (AE_AML_NO_OPERAND); } + if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD) + { + /* + * If the BufferField arguments have not been previously evaluated, + * evaluate them now and save the results. + */ + if (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)) + { + Status = AcpiDsGetBufferFieldArguments (ObjDesc); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } + } /* * Get a pointer to the data to be written @@ -314,323 +337,67 @@ AcpiExWriteDataToField ( default: return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - - /* - * Decode the type of field to be written - */ - switch (ObjDesc->Common.Type) - { - case ACPI_TYPE_BUFFER_FIELD: - Status = AcpiExAccessBufferField (ACPI_WRITE, ObjDesc, Buffer, Length); - break; - - case INTERNAL_TYPE_REGION_FIELD: - Status = AcpiExAccessRegionField (ACPI_WRITE, ObjDesc, Buffer, Length); - break; - - case INTERNAL_TYPE_BANK_FIELD: - Status = AcpiExAccessBankField (ACPI_WRITE, ObjDesc, Buffer, Length); break; - - case INTERNAL_TYPE_INDEX_FIELD: - Status = AcpiExAccessIndexField (ACPI_WRITE, ObjDesc, Buffer, Length); - break; - - default: - return_ACPI_STATUS (AE_AML_INTERNAL); } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExAccessBufferField - * - * PARAMETERS: Mode - ACPI_READ or ACPI_WRITE - * *FieldNode - Parent node for field to be accessed - * *Buffer - Value(s) to be read or written - * BufferLength - Number of bytes to transfer - * - * RETURN: Status - * - * DESCRIPTION: Read or write a named field - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExAccessBufferField ( - UINT32 Mode, - ACPI_OPERAND_OBJECT *ObjDesc, - void *Buffer, - UINT32 BufferLength) -{ - ACPI_STATUS Status; - - - FUNCTION_TRACE_PTR ("ExAccessBufferField", ObjDesc); - - /* - * If the BufferField arguments have not been previously evaluated, - * evaluate them now and save the results. + * We must have a buffer that is at least as long as the field + * we are writing to. This is because individual fields are + * indivisible and partial writes are not supported -- as per + * the ACPI specification. */ - if (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)) + NewBuffer = NULL; + RequiredLength = ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength); + + if (Length < RequiredLength) { - Status = AcpiDsGetBufferFieldArguments (ObjDesc); - if (ACPI_FAILURE (Status)) + /* We need to create a new buffer */ + + NewBuffer = ACPI_MEM_CALLOCATE (RequiredLength); + if (!NewBuffer) { - return_ACPI_STATUS (Status); + return_ACPI_STATUS (AE_NO_MEMORY); } - } - - Status = AcpiExCommonAccessField (Mode, ObjDesc, Buffer, BufferLength); - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExAccessRegionField - * - * PARAMETERS: Mode - ACPI_READ or ACPI_WRITE - * *FieldNode - Parent node for field to be accessed - * *Buffer - Value(s) to be read or written - * BufferLength - Number of bytes to transfer - * - * RETURN: Status - * - * DESCRIPTION: Read or write a named field - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExAccessRegionField ( - UINT32 Mode, - ACPI_OPERAND_OBJECT *ObjDesc, - void *Buffer, - UINT32 BufferLength) -{ - ACPI_STATUS Status; - BOOLEAN Locked; - - - FUNCTION_TRACE_PTR ("ExAccessRegionField", ObjDesc); - - - /* - * Get the global lock if needed - */ - Locked = AcpiExAcquireGlobalLock (ObjDesc->Field.LockRule); - - Status = AcpiExCommonAccessField (Mode, ObjDesc, Buffer, BufferLength); - - - /* - * Release global lock if we acquired it earlier - */ - AcpiExReleaseGlobalLock (Locked); - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExAccessBankField - * - * PARAMETERS: Mode - ACPI_READ or ACPI_WRITE - * *FieldNode - Parent node for field to be accessed - * *Buffer - Value(s) to be read or written - * BufferLength - Number of bytes to transfer - * - * RETURN: Status - * - * DESCRIPTION: Read or write a Bank Field - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExAccessBankField ( - UINT32 Mode, - ACPI_OPERAND_OBJECT *ObjDesc, - void *Buffer, - UINT32 BufferLength) -{ - ACPI_STATUS Status; - BOOLEAN Locked; - - - FUNCTION_TRACE_PTR ("ExAccessBankField", ObjDesc); - - - /* - * Get the global lock if needed - */ - Locked = AcpiExAcquireGlobalLock (ObjDesc->BankField.LockRule); - - - /* - * Write the BankValue to the BankRegister to select the bank. - * The BankValue for this BankField is specified in the - * BankField ASL declaration. The BankRegister is always a Field in - * an operation region. - */ - Status = AcpiExCommonAccessField (ACPI_WRITE, - ObjDesc->BankField.BankRegisterObj, - &ObjDesc->BankField.Value, - sizeof (ObjDesc->BankField.Value)); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; + /* + * Copy the original data to the new buffer, starting + * at Byte zero. All unused (upper) bytes of the + * buffer will be 0. + */ + MEMCPY ((char *) NewBuffer, (char *) Buffer, Length); + Buffer = NewBuffer; + Length = RequiredLength; } - /* - * The bank was successfully selected, now read or write the actual - * data. - */ - Status = AcpiExCommonAccessField (Mode, ObjDesc, Buffer, BufferLength); - - -Cleanup: - /* - * Release global lock if we acquired it earlier - */ - AcpiExReleaseGlobalLock (Locked); - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExAccessIndexField - * - * PARAMETERS: Mode - ACPI_READ or ACPI_WRITE - * *FieldNode - Parent node for field to be accessed - * *Buffer - Value(s) to be read or written - * BufferLength - Number of bytes to transfer - * - * RETURN: Status - * - * DESCRIPTION: Read or write a Index Field - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExAccessIndexField ( - UINT32 Mode, - ACPI_OPERAND_OBJECT *ObjDesc, - void *Buffer, - UINT32 BufferLength) -{ - ACPI_STATUS Status; - BOOLEAN Locked; - - - FUNCTION_TRACE_PTR ("ExAccessIndexField", ObjDesc); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "Obj=%p Type=%X Buf=%p Len=%X\n", + ObjDesc, ObjDesc->Common.Type, Buffer, Length)); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "FieldRead: BitLen=%X BitOff=%X ByteOff=%X\n", + ObjDesc->CommonField.BitLength, + ObjDesc->CommonField.StartFieldBitOffset, + ObjDesc->CommonField.BaseByteOffset)); + Locked = AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); /* - * Get the global lock if needed + * Write to the field */ - Locked = AcpiExAcquireGlobalLock (ObjDesc->IndexField.LockRule); - + Status = AcpiExInsertIntoField (ObjDesc, Buffer, Length); /* - * Set Index value to select proper Data register - */ - Status = AcpiExCommonAccessField (ACPI_WRITE, - ObjDesc->IndexField.IndexObj, - &ObjDesc->IndexField.Value, - sizeof (ObjDesc->IndexField.Value)); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - /* Now read/write the data register */ - - Status = AcpiExCommonAccessField (Mode, ObjDesc->IndexField.DataObj, - Buffer, BufferLength); - -Cleanup: - /* * Release global lock if we acquired it earlier */ AcpiExReleaseGlobalLock (Locked); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExCommonAccessField - * - * PARAMETERS: Mode - ACPI_READ or ACPI_WRITE - * *FieldNode - Parent node for field to be accessed - * *Buffer - Value(s) to be read or written - * BufferLength - Size of buffer, in bytes. Must be large - * enough for all bits of the field. - * - * RETURN: Status - * - * DESCRIPTION: Read or write a named field - * - ******************************************************************************/ + /* Free temporary buffer if we used one */ -ACPI_STATUS -AcpiExCommonAccessField ( - UINT32 Mode, - ACPI_OPERAND_OBJECT *ObjDesc, - void *Buffer, - UINT32 BufferLength) -{ - ACPI_STATUS Status; - - - FUNCTION_TRACE_PTR ("ExCommonAccessField", ObjDesc); - - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Obj=%p Type=%X Buf=%p Len=%X\n", - ObjDesc, ObjDesc->Common.Type, Buffer, BufferLength)); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode=%d BitLen=%X BitOff=%X ByteOff=%X\n", - Mode, ObjDesc->CommonField.BitLength, - ObjDesc->CommonField.StartFieldBitOffset, - ObjDesc->CommonField.BaseByteOffset)); - - - /* Perform the actual read or write of the field */ - - switch (Mode) + if (NewBuffer) { - case ACPI_READ: - - Status = AcpiExExtractFromField (ObjDesc, Buffer, BufferLength); - break; - - - case ACPI_WRITE: - - Status = AcpiExInsertIntoField (ObjDesc, Buffer, BufferLength); - break; - - - default: - - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown I/O Mode: %X\n", Mode)); - Status = AE_BAD_PARAMETER; - break; + ACPI_MEM_FREE (NewBuffer); } - return_ACPI_STATUS (Status); } + diff --git a/sys/contrib/dev/acpica/exmisc.c b/sys/contrib/dev/acpica/exmisc.c index bb79e81..ac9b819 100644 --- a/sys/contrib/dev/acpica/exmisc.c +++ b/sys/contrib/dev/acpica/exmisc.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes - * $Revision: 92 $ + * $Revision: 94 $ * *****************************************************************************/ @@ -129,7 +129,6 @@ MODULE_NAME ("exmisc") - /******************************************************************************* * * FUNCTION: AcpiExGetObjectReference @@ -174,8 +173,9 @@ AcpiExGetObjectReference ( case AML_LOCAL_OP: case AML_ARG_OP: - *ReturnDesc = (void *) AcpiDsMethodDataGetNode (ObjDesc->Reference.Opcode, - ObjDesc->Reference.Offset, WalkState); + Status = AcpiDsMethodDataGetNode (ObjDesc->Reference.Opcode, + ObjDesc->Reference.Offset, WalkState, + (ACPI_NAMESPACE_NODE **) ReturnDesc); break; default: @@ -473,7 +473,6 @@ AcpiExDoMathOp ( } - /******************************************************************************* * * FUNCTION: AcpiExDoLogicalOp @@ -555,5 +554,3 @@ AcpiExDoLogicalOp ( } - - diff --git a/sys/contrib/dev/acpica/exmutex.c b/sys/contrib/dev/acpica/exmutex.c index f8129a2..a9f2d72 100644 --- a/sys/contrib/dev/acpica/exmutex.c +++ b/sys/contrib/dev/acpica/exmutex.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exmutex - ASL Mutex Acquire/Release functions - * $Revision: 7 $ + * $Revision: 8 $ * *****************************************************************************/ @@ -143,15 +143,27 @@ void AcpiExUnlinkMutex ( ACPI_OPERAND_OBJECT *ObjDesc) { + ACPI_THREAD_STATE *Thread = ObjDesc->Mutex.OwnerThread; + + + if (!Thread) + { + return; + } if (ObjDesc->Mutex.Next) { (ObjDesc->Mutex.Next)->Mutex.Prev = ObjDesc->Mutex.Prev; } + if (ObjDesc->Mutex.Prev) { (ObjDesc->Mutex.Prev)->Mutex.Next = ObjDesc->Mutex.Next; } + else + { + Thread->AcquiredMutexList = ObjDesc->Mutex.Next; + } } @@ -171,24 +183,28 @@ AcpiExUnlinkMutex ( void AcpiExLinkMutex ( ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT *ListHead) + ACPI_THREAD_STATE *Thread) { + ACPI_OPERAND_OBJECT *ListHead; + + + ListHead = Thread->AcquiredMutexList; /* This object will be the first object in the list */ - ObjDesc->Mutex.Prev = ListHead; - ObjDesc->Mutex.Next = ListHead->Mutex.Next; + ObjDesc->Mutex.Prev = NULL; + ObjDesc->Mutex.Next = ListHead; /* Update old first object to point back to this object */ - if (ListHead->Mutex.Next) + if (ListHead) { - (ListHead->Mutex.Next)->Mutex.Prev = ObjDesc; + ListHead->Mutex.Prev = ObjDesc; } /* Update list head */ - ListHead->Mutex.Next = ObjDesc; + Thread->AcquiredMutexList = ObjDesc; } @@ -225,17 +241,20 @@ AcpiExAcquireMutex ( * Current Sync must be less than or equal to the sync level of the * mutex. This mechanism provides some deadlock prevention */ - if (WalkState->CurrentSyncLevel > ObjDesc->Mutex.SyncLevel) + if (WalkState->Thread->CurrentSyncLevel > ObjDesc->Mutex.SyncLevel) { return_ACPI_STATUS (AE_AML_MUTEX_ORDER); } /* - * If the mutex is already owned by this thread, - * just increment the acquisition depth + * Support for multiple acquires by the owning thread */ - if (ObjDesc->Mutex.Owner == WalkState) + if (ObjDesc->Mutex.OwnerThread == WalkState->Thread) { + /* + * The mutex is already owned by this thread, + * just increment the acquisition depth + */ ObjDesc->Mutex.AcquisitionDepth++; return_ACPI_STATUS (AE_OK); } @@ -252,14 +271,14 @@ AcpiExAcquireMutex ( /* Have the mutex, update mutex and walk info */ - ObjDesc->Mutex.Owner = WalkState; + ObjDesc->Mutex.OwnerThread = WalkState->Thread; ObjDesc->Mutex.AcquisitionDepth = 1; - WalkState->CurrentSyncLevel = ObjDesc->Mutex.SyncLevel; - /* Link the mutex to the walk state for force-unlock at method exit */ + WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.SyncLevel; + + /* Link the mutex to the current thread for force-unlock at method exit */ - AcpiExLinkMutex (ObjDesc, (ACPI_OPERAND_OBJECT *) - &(WalkState->WalkList->AcquiredMutexList)); + AcpiExLinkMutex (ObjDesc, WalkState->Thread); return_ACPI_STATUS (AE_OK); } @@ -295,14 +314,14 @@ AcpiExReleaseMutex ( /* The mutex must have been previously acquired in order to release it */ - if (!ObjDesc->Mutex.Owner) + if (!ObjDesc->Mutex.OwnerThread) { return_ACPI_STATUS (AE_AML_MUTEX_NOT_ACQUIRED); } /* The Mutex is owned, but this thread must be the owner */ - if (ObjDesc->Mutex.Owner != WalkState) + if (ObjDesc->Mutex.OwnerThread != WalkState->Thread) { return_ACPI_STATUS (AE_AML_NOT_OWNER); } @@ -311,7 +330,7 @@ AcpiExReleaseMutex ( * The sync level of the mutex must be less than or * equal to the current sync level */ - if (ObjDesc->Mutex.SyncLevel > WalkState->CurrentSyncLevel) + if (ObjDesc->Mutex.SyncLevel > WalkState->Thread->CurrentSyncLevel) { return_ACPI_STATUS (AE_AML_MUTEX_ORDER); } @@ -327,6 +346,9 @@ AcpiExReleaseMutex ( return_ACPI_STATUS (AE_OK); } + /* Unlink the mutex from the owner's list */ + + AcpiExUnlinkMutex (ObjDesc); /* Release the mutex */ @@ -334,12 +356,8 @@ AcpiExReleaseMutex ( /* Update the mutex and walk state */ - ObjDesc->Mutex.Owner = NULL; - WalkState->CurrentSyncLevel = ObjDesc->Mutex.SyncLevel; - - /* Unlink the mutex from the owner's list */ - - AcpiExUnlinkMutex (ObjDesc); + ObjDesc->Mutex.OwnerThread = NULL; + WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.SyncLevel; return_ACPI_STATUS (Status); } @@ -359,9 +377,9 @@ AcpiExReleaseMutex ( ACPI_STATUS AcpiExReleaseAllMutexes ( - ACPI_OPERAND_OBJECT *ListHead) + ACPI_THREAD_STATE *Thread) { - ACPI_OPERAND_OBJECT *Next = ListHead->Mutex.Next; + ACPI_OPERAND_OBJECT *Next = Thread->AcquiredMutexList; ACPI_OPERAND_OBJECT *This; @@ -376,16 +394,17 @@ AcpiExReleaseAllMutexes ( This = Next; Next = This->Mutex.Next; - /* Mark mutex un-owned */ - - This->Mutex.Owner = NULL; - This->Mutex.Prev = NULL; - This->Mutex.Next = NULL; - This->Mutex.AcquisitionDepth = 0; + This->Mutex.AcquisitionDepth = 1; + This->Mutex.Prev = NULL; + This->Mutex.Next = NULL; /* Release the mutex */ AcpiExSystemReleaseMutex (This); + + /* Mark mutex unowned */ + + This->Mutex.OwnerThread = NULL; } return (AE_OK); diff --git a/sys/contrib/dev/acpica/exoparg1.c b/sys/contrib/dev/acpica/exoparg1.c index 123c6d3..baa2534 100644 --- a/sys/contrib/dev/acpica/exoparg1.c +++ b/sys/contrib/dev/acpica/exoparg1.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exoparg1 - AML execution - opcodes with 1 argument - * $Revision: 120 $ + * $Revision: 124 $ * *****************************************************************************/ @@ -138,21 +138,20 @@ * * AcpiExOpcode_xA_yT_zR * - * Where: + * Where: * - * xA - ARGUMENTS: The number of arguments (input operands) that are + * xA - ARGUMENTS: The number of arguments (input operands) that are * required for this opcode type (1 through 6 args). - * yT - TARGETS: The number of targets (output operands) that are required + * yT - TARGETS: The number of targets (output operands) that are required * for this opcode type (0, 1, or 2 targets). - * zR - RETURN VALUE: Indicates whether this opcode type returns a value + * zR - RETURN VALUE: Indicates whether this opcode type returns a value * as the function return (0 or 1). * - * The AcpiExOpcode* functions are called via the Dispatcher component with + * The AcpiExOpcode* functions are called via the Dispatcher component with * fully resolved operands. !*/ - /******************************************************************************* * * FUNCTION: AcpiExOpcode_1A_0T_0R @@ -177,9 +176,9 @@ AcpiExOpcode_1A_0T_0R ( FUNCTION_TRACE_STR ("ExOpcode_1A_0T_0R", AcpiPsGetOpcodeName (WalkState->Opcode)); - /* Examine the opcode */ + /* Examine the AML opcode */ - switch (WalkState->Opcode) + switch (WalkState->Opcode) { case AML_RELEASE_OP: /* Release (MutexObject) */ @@ -253,9 +252,10 @@ AcpiExOpcode_1A_1T_0R ( FUNCTION_TRACE_STR ("ExOpcode_1A_1T_0R", AcpiPsGetOpcodeName (WalkState->Opcode)); + /* Examine the AML opcode */ + switch (WalkState->Opcode) { - case AML_LOAD_OP: Status = AcpiExLoadOp (Operand[0], Operand[1]); @@ -327,6 +327,7 @@ AcpiExOpcode_1A_1T_1R ( break; } + /* Examine the AML opcode */ switch (WalkState->Opcode) { @@ -339,7 +340,6 @@ AcpiExOpcode_1A_1T_1R ( case AML_FIND_SET_LEFT_BIT_OP: /* FindSetLeftBit (Operand, Result) */ - ReturnDesc->Integer.Value = Operand[0]->Integer.Value; /* @@ -357,7 +357,6 @@ AcpiExOpcode_1A_1T_1R ( case AML_FIND_SET_RIGHT_BIT_OP: /* FindSetRightBit (Operand, Result) */ - ReturnDesc->Integer.Value = Operand[0]->Integer.Value; /* @@ -543,13 +542,12 @@ AcpiExOpcode_1A_1T_1R ( break; - /* - * These are two obsolete opcodes - */ case AML_SHIFT_LEFT_BIT_OP: /* ShiftLeftBit (Source, BitNum) */ case AML_SHIFT_RIGHT_BIT_OP: /* ShiftRightBit (Source, BitNum) */ - + /* + * These are two obsolete opcodes + */ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s is obsolete and not implemented\n", AcpiPsGetOpcodeName (WalkState->Opcode))); Status = AE_SUPPORT; @@ -565,9 +563,8 @@ AcpiExOpcode_1A_1T_1R ( goto Cleanup; } - /* - * Store the return value computed above into the target object + * Store the return value computed above into the target object */ Status = AcpiExStore (ReturnDesc, Operand[1], WalkState); @@ -614,12 +611,10 @@ AcpiExOpcode_1A_0T_1R ( FUNCTION_TRACE_STR ("ExOpcode_1A_0T_0R", AcpiPsGetOpcodeName (WalkState->Opcode)); - - /* Get the operand and decode the opcode */ + /* Examine the AML opcode */ switch (WalkState->Opcode) { - case AML_LNOT_OP: /* LNot (Operand) */ ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); @@ -661,9 +656,9 @@ AcpiExOpcode_1A_0T_1R ( goto Cleanup; } - /* + /* * ReturnDesc is now guaranteed to be an Integer object - * Do the actual increment or decrement + * Do the actual increment or decrement */ if (AML_INCREMENT_OP == WalkState->Opcode) { @@ -703,7 +698,7 @@ AcpiExOpcode_1A_0T_1R ( case AML_DEBUG_OP: - /* Per 1.0b spec, Debug object is of type "DebugObject" */ + /* The Debug Object is of type "DebugObject" */ Type = ACPI_TYPE_DEBUG_OBJECT; break; @@ -723,7 +718,6 @@ AcpiExOpcode_1A_0T_1R ( */ Type = (*(Operand[0]->Reference.Where))->Common.Type; } - break; @@ -743,7 +737,6 @@ AcpiExOpcode_1A_0T_1R ( goto Cleanup; } } - else { /* @@ -789,9 +782,13 @@ AcpiExOpcode_1A_0T_1R ( { Value = 0; } - else { + /* + * Type is guaranteed to be a buffer, string, or package at this + * point (even if the original operand was an object reference, it + * will be resolved and typechecked during operand resolution.) + */ switch (TempDesc->Common.Type) { case ACPI_TYPE_BUFFER: @@ -806,16 +803,9 @@ AcpiExOpcode_1A_0T_1R ( Value = TempDesc->Package.Count; break; - case INTERNAL_TYPE_REFERENCE: - - /* TBD: this must be a reference to a buf/str/pkg?? */ - - Value = 4; - break; - default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Not Buf/Str/Pkg - found type %X\n", - TempDesc->Common.Type)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "SizeOf, Not Buf/Str/Pkg - found type %s\n", + AcpiUtGetTypeName (TempDesc->Common.Type))); Status = AE_AML_OPERAND_TYPE; goto Cleanup; } @@ -857,11 +847,11 @@ AcpiExOpcode_1A_0T_1R ( */ switch (Operand[0]->Reference.Opcode) { - /* Set Operand[0] to the value of the local/arg */ - case AML_LOCAL_OP: case AML_ARG_OP: + /* Set Operand[0] to the value of the local/arg */ + AcpiDsMethodDataGetValue (Operand[0]->Reference.Opcode, Operand[0]->Reference.Offset, WalkState, &TempDesc); @@ -875,53 +865,40 @@ AcpiExOpcode_1A_0T_1R ( default: - /* Index op - handled below */ + /* Must be an Index op - handled below */ break; } } - /* Operand[0] may have changed from the code above */ if (VALID_DESCRIPTOR_TYPE (Operand[0], ACPI_DESC_TYPE_NAMED)) { /* Get the actual object from the Node (This is the dereference) */ - ReturnDesc = ((ACPI_NAMESPACE_NODE *) Operand[0])->Object; + ReturnDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) Operand[0]); /* Returning a pointer to the object, add another reference! */ AcpiUtAddReference (ReturnDesc); } - else { /* - * This must be a reference object produced by the Index - * ASL operation -- check internal opcode + * This must be a reference produced by either the Index() or + * RefOf() operator */ - if ((Operand[0]->Reference.Opcode != AML_INDEX_OP) && - (Operand[0]->Reference.Opcode != AML_REF_OF_OP)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode in ref(%p) - %X\n", - Operand[0], Operand[0]->Reference.Opcode)); - - Status = AE_TYPE; - goto Cleanup; - } - - switch (Operand[0]->Reference.Opcode) { case AML_INDEX_OP: /* - * Supported target types for the Index operator are - * 1) A Buffer - * 2) A Package + * The target type for the Index operator must be + * either a Buffer or a Package */ - if (Operand[0]->Reference.TargetType == ACPI_TYPE_BUFFER_FIELD) + switch (Operand[0]->Reference.TargetType) { + case ACPI_TYPE_BUFFER_FIELD: /* * The target is a buffer, we must create a new object that * contains one element of the buffer, the element pointed @@ -938,17 +915,19 @@ AcpiExOpcode_1A_0T_1R ( goto Cleanup; } + /* + * Since we are returning the value of the buffer at the + * indexed location, we don't need to add an additional + * reference to the buffer itself. + */ TempDesc = Operand[0]->Reference.Object; ReturnDesc->Integer.Value = TempDesc->Buffer.Pointer[Operand[0]->Reference.Offset]; + break; + - /* TBD: [Investigate] (see below) Don't add an additional - * ref! - */ - } + case ACPI_TYPE_PACKAGE: - else if (Operand[0]->Reference.TargetType == ACPI_TYPE_PACKAGE) - { /* * The target is a package, we want to return the referenced * element of the package. We must add another reference to @@ -962,7 +941,6 @@ AcpiExOpcode_1A_0T_1R ( * an uninitialized package element and is thus a * severe error. */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "NULL package element obj %p\n", Operand[0])); Status = AE_AML_UNINITIALIZED_ELEMENT; @@ -970,16 +948,16 @@ AcpiExOpcode_1A_0T_1R ( } AcpiUtAddReference (ReturnDesc); - } + break; - else - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown TargetType %X in obj %p\n", + + default: + + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Index TargetType %X in obj %p\n", Operand[0]->Reference.TargetType, Operand[0])); Status = AE_AML_OPERAND_TYPE; goto Cleanup; } - break; @@ -991,9 +969,17 @@ AcpiExOpcode_1A_0T_1R ( AcpiUtAddReference (ReturnDesc); break; + + + default: + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode in ref(%p) - %X\n", + Operand[0], Operand[0]->Reference.Opcode)); + + Status = AE_TYPE; + goto Cleanup; + break; } } - break; diff --git a/sys/contrib/dev/acpica/exoparg2.c b/sys/contrib/dev/acpica/exoparg2.c index 32c7968..719116d 100644 --- a/sys/contrib/dev/acpica/exoparg2.c +++ b/sys/contrib/dev/acpica/exoparg2.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exoparg2 - AML execution - opcodes with 2 arguments - * $Revision: 97 $ + * $Revision: 98 $ * *****************************************************************************/ @@ -139,21 +139,20 @@ * * AcpiExOpcode_xA_yT_zR * - * Where: + * Where: * - * xA - ARGUMENTS: The number of arguments (input operands) that are + * xA - ARGUMENTS: The number of arguments (input operands) that are * required for this opcode type (1 through 6 args). - * yT - TARGETS: The number of targets (output operands) that are required + * yT - TARGETS: The number of targets (output operands) that are required * for this opcode type (0, 1, or 2 targets). - * zR - RETURN VALUE: Indicates whether this opcode type returns a value + * zR - RETURN VALUE: Indicates whether this opcode type returns a value * as the function return (0 or 1). * - * The AcpiExOpcode* functions are called via the Dispatcher component with + * The AcpiExOpcode* functions are called via the Dispatcher component with * fully resolved operands. !*/ - /******************************************************************************* * * FUNCTION: AcpiExOpcode_2A_0T_0R @@ -378,8 +377,8 @@ AcpiExOpcode_2A_1T_1R ( goto Cleanup; } - ReturnDesc->Integer.Value = AcpiExDoMathOp (WalkState->Opcode, - Operand[0]->Integer.Value, + ReturnDesc->Integer.Value = AcpiExDoMathOp (WalkState->Opcode, + Operand[0]->Integer.Value, Operand[1]->Integer.Value); goto StoreResultToTarget; } @@ -623,7 +622,7 @@ AcpiExOpcode_2A_0T_1R ( */ if (WalkState->OpInfo->Flags & AML_LOGICAL) /* LogicalOp (Operand0, Operand1) */ { - LogicalResult = AcpiExDoLogicalOp (WalkState->Opcode, + LogicalResult = AcpiExDoLogicalOp (WalkState->Opcode, Operand[0]->Integer.Value, Operand[1]->Integer.Value); goto StoreLogicalResult; @@ -664,9 +663,9 @@ AcpiExOpcode_2A_0T_1R ( StoreLogicalResult: - /* + /* * Set return value to according to LogicalResult. logical TRUE (all ones) - * Default is FALSE (zero) + * Default is FALSE (zero) */ if (LogicalResult) { diff --git a/sys/contrib/dev/acpica/exoparg3.c b/sys/contrib/dev/acpica/exoparg3.c index 43c5db4..5251202 100644 --- a/sys/contrib/dev/acpica/exoparg3.c +++ b/sys/contrib/dev/acpica/exoparg3.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exoparg3 - AML execution - opcodes with 3 arguments - * $Revision: 3 $ + * $Revision: 5 $ * *****************************************************************************/ @@ -137,21 +137,20 @@ * * AcpiExOpcode_xA_yT_zR * - * Where: + * Where: * - * xA - ARGUMENTS: The number of arguments (input operands) that are + * xA - ARGUMENTS: The number of arguments (input operands) that are * required for this opcode type (1 through 6 args). - * yT - TARGETS: The number of targets (output operands) that are required + * yT - TARGETS: The number of targets (output operands) that are required * for this opcode type (0, 1, or 2 targets). - * zR - RETURN VALUE: Indicates whether this opcode type returns a value + * zR - RETURN VALUE: Indicates whether this opcode type returns a value * as the function return (0 or 1). * - * The AcpiExOpcode* functions are called via the Dispatcher component with + * The AcpiExOpcode* functions are called via the Dispatcher component with * fully resolved operands. !*/ - /******************************************************************************* * * FUNCTION: AcpiExOpcode_3A_0T_0R @@ -216,7 +215,6 @@ AcpiExOpcode_3A_0T_0R ( } - Cleanup: return_ACPI_STATUS (Status); @@ -250,12 +248,11 @@ AcpiExOpcode_3A_1T_1R ( FUNCTION_TRACE_STR ("ExOpcode_3A_1T_1R", AcpiPsGetOpcodeName (WalkState->Opcode)); - switch (WalkState->Opcode) { case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */ - /* + /* * Create the return object. The Source operand is guaranteed to be * either a String or a Buffer, so just use its type. */ @@ -291,7 +288,8 @@ AcpiExOpcode_3A_1T_1R ( Buffer = ACPI_MEM_CALLOCATE (Length + 1); if (!Buffer) { - return (AE_NO_MEMORY); + Status = AE_NO_MEMORY; + goto Cleanup; } /* Copy the portion requested */ @@ -304,7 +302,7 @@ AcpiExOpcode_3A_1T_1R ( ReturnDesc->String.Pointer = Buffer; ReturnDesc->String.Length = Length; } - + break; @@ -337,5 +335,3 @@ Cleanup: } - - diff --git a/sys/contrib/dev/acpica/exoparg6.c b/sys/contrib/dev/acpica/exoparg6.c index ad36e13..15baa18 100644 --- a/sys/contrib/dev/acpica/exoparg6.c +++ b/sys/contrib/dev/acpica/exoparg6.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exoparg6 - AML execution - opcodes with 6 arguments - * $Revision: 4 $ + * $Revision: 6 $ * *****************************************************************************/ @@ -128,7 +128,6 @@ MODULE_NAME ("exoparg6") - /*! * Naming convention for AML interpreter execution routines. * @@ -138,21 +137,20 @@ * * AcpiExOpcode_xA_yT_zR * - * Where: + * Where: * - * xA - ARGUMENTS: The number of arguments (input operands) that are + * xA - ARGUMENTS: The number of arguments (input operands) that are * required for this opcode type (1 through 6 args). - * yT - TARGETS: The number of targets (output operands) that are required + * yT - TARGETS: The number of targets (output operands) that are required * for this opcode type (0, 1, or 2 targets). - * zR - RETURN VALUE: Indicates whether this opcode type returns a value + * zR - RETURN VALUE: Indicates whether this opcode type returns a value * as the function return (0 or 1). * - * The AcpiExOpcode* functions are called via the Dispatcher component with + * The AcpiExOpcode* functions are called via the Dispatcher component with * fully resolved operands. !*/ - /******************************************************************************* * * FUNCTION: AcpiExDoMatch @@ -264,9 +262,9 @@ AcpiExOpcode_6A_0T_1R ( switch (WalkState->Opcode) { - case AML_MATCH_OP: - /* - * Match (SearchPackage[0], MatchOp1[1], MatchObject1[2], + case AML_MATCH_OP: + /* + * Match (SearchPackage[0], MatchOp1[1], MatchObject1[2], * MatchOp2[3], MatchObject2[4], StartIndex[5]) */ @@ -304,6 +302,7 @@ AcpiExOpcode_6A_0T_1R ( * Examine each element until a match is found. Within the loop, * "continue" signifies that the current element does not match * and the next should be examined. + * * Upon finding a match, the loop will terminate via "break" at * the bottom. If it terminates "normally", MatchValue will be -1 * (its initial value) indicating that no match was found. When @@ -315,8 +314,6 @@ AcpiExOpcode_6A_0T_1R ( /* * Treat any NULL or non-numeric elements as non-matching. - * TBD [Unhandled] - if an element is a Name, - * should we examine its value? */ if (!ThisElement || ThisElement->Common.Type != ACPI_TYPE_INTEGER) @@ -324,21 +321,17 @@ AcpiExOpcode_6A_0T_1R ( continue; } - /* - * Within these switch statements: - * "break" (exit from the switch) signifies a match; - * "continue" (proceed to next iteration of enclosing - * "for" loop) signifies a non-match. + * "continue" (proceed to next iteration of enclosing + * "for" loop) signifies a non-match. */ - if (!AcpiExDoMatch ((UINT32) Operand[1]->Integer.Value, + if (!AcpiExDoMatch ((UINT32) Operand[1]->Integer.Value, ThisElement->Integer.Value, Operand[2]->Integer.Value)) { continue; } - - if (!AcpiExDoMatch ((UINT32) Operand[3]->Integer.Value, + if (!AcpiExDoMatch ((UINT32) Operand[3]->Integer.Value, ThisElement->Integer.Value, Operand[4]->Integer.Value)) { continue; diff --git a/sys/contrib/dev/acpica/exprep.c b/sys/contrib/dev/acpica/exprep.c index 1089492..98660e1 100644 --- a/sys/contrib/dev/acpica/exprep.c +++ b/sys/contrib/dev/acpica/exprep.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exprep - ACPI AML (p-code) execution - field prep utilities - * $Revision: 99 $ + * $Revision: 109 $ * *****************************************************************************/ @@ -130,74 +130,91 @@ /******************************************************************************* * - * FUNCTION: AcpiExDecodeFieldAccessType + * FUNCTION: AcpiExDecodeFieldAccess * * PARAMETERS: Access - Encoded field access bits * Length - Field length. * - * RETURN: Field granularity (8, 16, 32 or 64) + * RETURN: Field granularity (8, 16, 32 or 64) and + * ByteAlignment (1, 2, 3, or 4) * * DESCRIPTION: Decode the AccessType bits of a field definition. * ******************************************************************************/ static UINT32 -AcpiExDecodeFieldAccessType ( - UINT32 Access, - UINT16 Length, - UINT32 *Alignment) +AcpiExDecodeFieldAccess ( + ACPI_OPERAND_OBJECT *ObjDesc, + UINT8 FieldFlags, + UINT32 *ReturnByteAlignment) { - PROC_NAME ("ExDecodeFieldAccessType"); + UINT32 Access; + UINT16 Length; + UINT8 ByteAlignment; + UINT8 BitLength; + + + PROC_NAME ("ExDecodeFieldAccess"); + + Access = (FieldFlags & AML_FIELD_ACCESS_TYPE_MASK); + Length = ObjDesc->CommonField.BitLength; switch (Access) { - case ACCESS_ANY_ACC: + case AML_FIELD_ACCESS_ANY: - *Alignment = 8; + ByteAlignment = 1; /* Use the length to set the access type */ if (Length <= 8) { - return (8); + BitLength = 8; } else if (Length <= 16) { - return (16); + BitLength = 16; } else if (Length <= 32) { - return (32); + BitLength = 32; } else if (Length <= 64) { - return (64); + BitLength = 64; } + else + { + /* Larger than Qword - just use byte-size chunks */ - /* Default is 8 (byte) */ + BitLength = 8; + } + break; - return (8); + case AML_FIELD_ACCESS_BYTE: + ByteAlignment = 1; + BitLength = 8; break; - case ACCESS_BYTE_ACC: - *Alignment = 8; - return (8); + case AML_FIELD_ACCESS_WORD: + ByteAlignment = 2; + BitLength = 16; break; - case ACCESS_WORD_ACC: - *Alignment = 16; - return (16); + case AML_FIELD_ACCESS_DWORD: + ByteAlignment = 4; + BitLength = 32; break; - case ACCESS_DWORD_ACC: - *Alignment = 32; - return (32); + case AML_FIELD_ACCESS_QWORD: /* ACPI 2.0 */ + ByteAlignment = 8; + BitLength = 64; break; - case ACCESS_QWORD_ACC: /* ACPI 2.0 */ - *Alignment = 64; - return (64); + case AML_FIELD_ACCESS_BUFFER: /* ACPI 2.0 */ + ByteAlignment = 8; + BitLength = 8; break; default: @@ -208,6 +225,19 @@ AcpiExDecodeFieldAccessType ( Access)); return (0); } + + if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD) + { + /* + * BufferField access can be on any byte boundary, so the + * ByteAlignment is always 1 byte -- regardless of any ByteAlignment + * implied by the field access type. + */ + ByteAlignment = 1; + } + + *ReturnByteAlignment = ByteAlignment; + return (BitLength); } @@ -225,7 +255,9 @@ AcpiExDecodeFieldAccessType ( * RETURN: Status * * DESCRIPTION: Initialize the areas of the field object that are common - * to the various types of fields. + * to the various types of fields. Note: This is very "sensitive" + * code because we are solving the general case for field + * alignment. * ******************************************************************************/ @@ -233,45 +265,48 @@ ACPI_STATUS AcpiExPrepCommonFieldObject ( ACPI_OPERAND_OBJECT *ObjDesc, UINT8 FieldFlags, + UINT8 FieldAttribute, UINT32 FieldBitPosition, UINT32 FieldBitLength) { UINT32 AccessBitWidth; - UINT32 Alignment; + UINT32 ByteAlignment; UINT32 NearestByteAddress; FUNCTION_TRACE ("ExPrepCommonFieldObject"); + if (FieldBitLength > ACPI_UINT16_MAX) + { + REPORT_ERROR (("Field size too long (> 0xFFFF), not supported\n")); + return_ACPI_STATUS (AE_SUPPORT); + } + /* * Note: the structure being initialized is the - * ACPI_COMMON_FIELD_INFO; No structure fields outside of the common area - * are initialized by this procedure. + * ACPI_COMMON_FIELD_INFO; No structure fields outside of the common + * area are initialized by this procedure. */ - - /* Demultiplex the FieldFlags byte */ - - ObjDesc->CommonField.LockRule = (UINT8) ((FieldFlags & LOCK_RULE_MASK) - >> LOCK_RULE_SHIFT); - ObjDesc->CommonField.UpdateRule = (UINT8) ((FieldFlags & UPDATE_RULE_MASK) - >> UPDATE_RULE_SHIFT); - /* Other misc fields */ - + ObjDesc->CommonField.FieldFlags = FieldFlags; + ObjDesc->CommonField.Attribute = FieldAttribute; ObjDesc->CommonField.BitLength = (UINT16) FieldBitLength; /* * Decode the access type so we can compute offsets. The access type gives * two pieces of information - the width of each field access and the - * necessary alignment of the access. For AnyAcc, the width used is the - * largest necessary/possible in an attempt to access the whole field in one - * I/O operation. However, for AnyAcc, the alignment is 8. For all other - * access types (Byte, Word, Dword, Qword), the width is the same as the - * alignment. + * necessary ByteAlignment (address granularity) of the access. + * + * For AnyAcc, the AccessBitWidth is the largest width that is both necessary + * and possible in an attempt to access the whole field in one + * I/O operation. However, for AnyAcc, the ByteAlignment is always one byte. + * + * For all Buffer Fields, the ByteAlignment is always one byte. + * + * For all other access types (Byte, Word, Dword, Qword), the Bitwidth is the + * same (equivalent) as the ByteAlignment. */ - AccessBitWidth = AcpiExDecodeFieldAccessType ( - ((FieldFlags & ACCESS_TYPE_MASK) >> ACCESS_TYPE_SHIFT), - ObjDesc->Field.BitLength, &Alignment); + AccessBitWidth = AcpiExDecodeFieldAccess (ObjDesc, FieldFlags, &ByteAlignment); if (!AccessBitWidth) { return_ACPI_STATUS (AE_AML_OPERAND_VALUE); @@ -279,64 +314,50 @@ AcpiExPrepCommonFieldObject ( /* Setup width (access granularity) fields */ - ObjDesc->CommonField.AccessBitWidth = (UINT8) AccessBitWidth; /* 8, 16, 32, 64 */ - ObjDesc->CommonField.AccessByteWidth = (UINT8) DIV_8 (AccessBitWidth); /* 1, 2, 4, 8 */ - - if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD) - { - /* - * BufferField access can be on any byte boundary, so the - * alignment is always 8 (regardless of any alignment implied by the - * field access type.) - */ - Alignment = 8; - } - + ObjDesc->CommonField.AccessBitWidth = (UINT8) AccessBitWidth; /* 8, 16, 32, 64 */ + ObjDesc->CommonField.AccessByteWidth = (UINT8) DIV_8 (AccessBitWidth); /* 1, 2, 4, 8 */ /* * BaseByteOffset is the address of the start of the field within the region. It is * the byte address of the first *datum* (field-width data unit) of the field. * (i.e., the first datum that contains at least the first *bit* of the field.) + * Note: ByteAlignment is always either equal to the AccessBitWidth or 8 (Byte access), + * and it defines the addressing granularity of the parent region or buffer. */ - NearestByteAddress = ROUND_BITS_DOWN_TO_BYTES (FieldBitPosition); - ObjDesc->CommonField.BaseByteOffset = ROUND_DOWN (NearestByteAddress, - DIV_8 (Alignment)); + NearestByteAddress = ROUND_BITS_DOWN_TO_BYTES (FieldBitPosition); + ObjDesc->CommonField.BaseByteOffset = ROUND_DOWN (NearestByteAddress, ByteAlignment); /* * StartFieldBitOffset is the offset of the first bit of the field within a field datum. - * This is calculated as the number of bits from the BaseByteOffset. In other words, - * the start of the field is relative to a byte address, regardless of the access type - * of the field. - */ - ObjDesc->CommonField.StartFieldBitOffset = (UINT8) (MOD_8 (FieldBitPosition)); - - /* - * DatumValidBits is the number of valid field bits in the first field datum. */ - ObjDesc->CommonField.DatumValidBits = (UINT8) (AccessBitWidth - - ObjDesc->CommonField.StartFieldBitOffset); + ObjDesc->CommonField.StartFieldBitOffset = (UINT8) (FieldBitPosition - + MUL_8 (ObjDesc->CommonField.BaseByteOffset)); /* * Valid bits -- the number of bits that compose a partial datum, * 1) At the end of the field within the region (arbitrary starting bit offset) * 2) At the end of a buffer used to contain the field (starting offset always zero) */ - ObjDesc->CommonField.EndFieldValidBits = (UINT8) ((ObjDesc->CommonField.StartFieldBitOffset + - FieldBitLength) % AccessBitWidth); - ObjDesc->CommonField.EndBufferValidBits = (UINT8) (FieldBitLength % AccessBitWidth); /* StartBufferBitOffset always = 0 */ + ObjDesc->CommonField.EndFieldValidBits = (UINT8) ((ObjDesc->CommonField.StartFieldBitOffset + FieldBitLength) % + AccessBitWidth); + ObjDesc->CommonField.EndBufferValidBits = (UINT8) (FieldBitLength % AccessBitWidth); /* StartBufferBitOffset always = 0 */ + /* + * DatumValidBits is the number of valid field bits in the first field datum. + */ + ObjDesc->CommonField.DatumValidBits = (UINT8) (AccessBitWidth - + ObjDesc->CommonField.StartFieldBitOffset); /* - * Does the entire field fit within a single field access element - * (datum)? (without crossing a datum boundary) + * Does the entire field fit within a single field access element? (datum) + * (i.e., without crossing a datum boundary) */ - if ((ObjDesc->CommonField.StartFieldBitOffset + ObjDesc->CommonField.BitLength) <= - (UINT16) ObjDesc->CommonField.AccessBitWidth) + if ((ObjDesc->CommonField.StartFieldBitOffset + FieldBitLength) <= + (UINT16) AccessBitWidth) { - ObjDesc->CommonField.AccessFlags |= AFIELD_SINGLE_DATUM; + ObjDesc->Common.Flags |= AOPOBJ_SINGLE_DATUM; } - return_ACPI_STATUS (AE_OK); } @@ -383,14 +404,15 @@ AcpiExPrepFieldValue ( Type = AcpiNsGetType (Info->RegionNode); if (Type != ACPI_TYPE_REGION) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Needed Region, found type %X %s\n", + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Needed Region, found type %X %s\n", Type, AcpiUtGetTypeName (Type))); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } } - /* Allocate a new region object */ + /* Allocate a new field object */ ObjDesc = AcpiUtCreateInternalObject (Info->FieldType); if (!ObjDesc) @@ -400,8 +422,9 @@ AcpiExPrepFieldValue ( /* Initialize areas of the object that are common to all fields */ - Status = AcpiExPrepCommonFieldObject (ObjDesc, Info->FieldFlags, - Info->FieldBitPosition, Info->FieldBitLength); + ObjDesc->CommonField.Node = Info->FieldNode; + Status = AcpiExPrepCommonFieldObject (ObjDesc, Info->FieldFlags, + Info->Attribute, Info->FieldBitPosition, Info->FieldBitLength); if (ACPI_FAILURE (Status)) { AcpiUtDeleteObjectDesc (ObjDesc); @@ -414,13 +437,14 @@ AcpiExPrepFieldValue ( { case INTERNAL_TYPE_REGION_FIELD: - ObjDesc->Field.RegionObj = AcpiNsGetAttachedObject (Info->RegionNode); + ObjDesc->Field.RegionObj = AcpiNsGetAttachedObject (Info->RegionNode); /* An additional reference for the container */ AcpiUtAddReference (ObjDesc->Field.RegionObj); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "RegionField: Bitoff=%X Off=%X Gran=%X Region %p\n", + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "RegionField: Bitoff=%X Off=%X Gran=%X Region %p\n", ObjDesc->Field.StartFieldBitOffset, ObjDesc->Field.BaseByteOffset, ObjDesc->Field.AccessBitWidth, ObjDesc->Field.RegionObj)); break; @@ -428,19 +452,19 @@ AcpiExPrepFieldValue ( case INTERNAL_TYPE_BANK_FIELD: - ObjDesc->BankField.Value = Info->BankValue; - ObjDesc->BankField.RegionObj = AcpiNsGetAttachedObject (Info->RegionNode); - ObjDesc->BankField.BankRegisterObj = AcpiNsGetAttachedObject (Info->RegisterNode); + ObjDesc->BankField.Value = Info->BankValue; + ObjDesc->BankField.RegionObj = AcpiNsGetAttachedObject (Info->RegionNode); + ObjDesc->BankField.BankObj = AcpiNsGetAttachedObject (Info->RegisterNode); /* An additional reference for the attached objects */ AcpiUtAddReference (ObjDesc->BankField.RegionObj); - AcpiUtAddReference (ObjDesc->BankField.BankRegisterObj); + AcpiUtAddReference (ObjDesc->BankField.BankObj); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Bank Field: BitOff=%X Off=%X Gran=%X Region %p BankReg %p\n", ObjDesc->BankField.StartFieldBitOffset, ObjDesc->BankField.BaseByteOffset, ObjDesc->Field.AccessBitWidth, ObjDesc->BankField.RegionObj, - ObjDesc->BankField.BankRegisterObj)); + ObjDesc->BankField.BankObj)); break; @@ -473,11 +497,11 @@ AcpiExPrepFieldValue ( * Store the constructed descriptor (ObjDesc) into the parent Node, * preserving the current type of that NamedObj. */ - Status = AcpiNsAttachObject (Info->FieldNode, ObjDesc, + Status = AcpiNsAttachObject (Info->FieldNode, ObjDesc, (UINT8) AcpiNsGetType (Info->FieldNode)); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "set NamedObj %p (%4.4s) val = %p\n", - Info->FieldNode, (char*)&(Info->FieldNode->Name), ObjDesc)); + Info->FieldNode, (char*)&(Info->FieldNode->Name), ObjDesc)); /* Remove local reference to the object */ diff --git a/sys/contrib/dev/acpica/exregion.c b/sys/contrib/dev/acpica/exregion.c index 2f3a769..ac53967 100644 --- a/sys/contrib/dev/acpica/exregion.c +++ b/sys/contrib/dev/acpica/exregion.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exregion - ACPI default OpRegion (address space) handlers - * $Revision: 61 $ + * $Revision: 64 $ * *****************************************************************************/ @@ -153,7 +153,7 @@ AcpiExSystemMemorySpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - UINT32 *Value, + ACPI_INTEGER *Value, void *HandlerContext, void *RegionContext) { @@ -182,6 +182,10 @@ AcpiExSystemMemorySpaceHandler ( Length = 4; break; + case 64: + Length = 8; + break; + default: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid SystemMemory width %d\n", BitWidth)); @@ -233,9 +237,6 @@ AcpiExSystemMemorySpaceHandler ( * Generate a logical pointer corresponding to the address we want to * access */ - - /* TBD: should these pointers go to 64-bit in all cases ? */ - LogicalAddrPtr = MemInfo->MappedLogicalAddress + ((ACPI_INTEGER) Address - (ACPI_INTEGER) MemInfo->MappedPhysicalAddress); @@ -247,8 +248,7 @@ AcpiExSystemMemorySpaceHandler ( switch (Function) { - - case ACPI_READ_ADR_SPACE: + case ACPI_READ: switch (BitWidth) { @@ -263,12 +263,14 @@ AcpiExSystemMemorySpaceHandler ( case 32: MOVE_UNALIGNED32_TO_32 (Value, LogicalAddrPtr); break; - } + case 64: + MOVE_UNALIGNED64_TO_64 (Value, LogicalAddrPtr); + break; + } break; - - case ACPI_WRITE_ADR_SPACE: + case ACPI_WRITE: switch (BitWidth) { @@ -283,11 +285,13 @@ AcpiExSystemMemorySpaceHandler ( case 32: MOVE_UNALIGNED32_TO_32 (LogicalAddrPtr, Value); break; - } + case 64: + MOVE_UNALIGNED64_TO_64 (LogicalAddrPtr, Value); + break; + } break; - default: Status = AE_BAD_PARAMETER; break; @@ -320,7 +324,7 @@ AcpiExSystemIoSpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - UINT32 *Value, + ACPI_INTEGER *Value, void *HandlerContext, void *RegionContext) { @@ -338,20 +342,17 @@ AcpiExSystemIoSpaceHandler ( switch (Function) { - - case ACPI_READ_ADR_SPACE: + case ACPI_READ: *Value = 0; Status = AcpiOsReadPort ((ACPI_IO_ADDRESS) Address, Value, BitWidth); break; - - case ACPI_WRITE_ADR_SPACE: + case ACPI_WRITE: Status = AcpiOsWritePort ((ACPI_IO_ADDRESS) Address, *Value, BitWidth); break; - default: Status = AE_BAD_PARAMETER; break; @@ -384,7 +385,7 @@ AcpiExPciConfigSpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - UINT32 *Value, + ACPI_INTEGER *Value, void *HandlerContext, void *RegionContext) { @@ -397,7 +398,7 @@ AcpiExPciConfigSpaceHandler ( /* - * The arguments to AcpiOs(Read|Write)PciCfg(Byte|Word|Dword) are: + * The arguments to AcpiOs(Read|Write)PciConfiguration are: * * PciSegment is the PCI bus segment range 0-31 * PciBus is the PCI bus number range 0-255 @@ -418,20 +419,17 @@ AcpiExPciConfigSpaceHandler ( switch (Function) { - - case ACPI_READ_ADR_SPACE: + case ACPI_READ: *Value = 0; Status = AcpiOsReadPciConfiguration (PciId, PciRegister, Value, BitWidth); break; - - case ACPI_WRITE_ADR_SPACE: + case ACPI_WRITE: Status = AcpiOsWritePciConfiguration (PciId, PciRegister, *Value, BitWidth); break; - default: Status = AE_BAD_PARAMETER; @@ -465,7 +463,7 @@ AcpiExCmosSpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - UINT32 *Value, + ACPI_INTEGER *Value, void *HandlerContext, void *RegionContext) { @@ -502,7 +500,7 @@ AcpiExPciBarSpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - UINT32 *Value, + ACPI_INTEGER *Value, void *HandlerContext, void *RegionContext) { diff --git a/sys/contrib/dev/acpica/exresnte.c b/sys/contrib/dev/acpica/exresnte.c index df8122c..71b56ef 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: 43 $ + * $Revision: 45 $ * *****************************************************************************/ @@ -178,14 +178,13 @@ AcpiExResolveNodeToValue ( * The stack pointer points to a ACPI_NAMESPACE_NODE (Node). Get the * object that is attached to the Node. */ - Node = *ObjectPtr; - SourceDesc = AcpiNsGetAttachedObject (Node); - EntryType = AcpiNsGetType ((ACPI_HANDLE) Node); + Node = *ObjectPtr; + SourceDesc = AcpiNsGetAttachedObject (Node); + EntryType = AcpiNsGetType ((ACPI_HANDLE) Node); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Entry=%p SourceDesc=%p Type=%X\n", Node, SourceDesc, EntryType)); - /* * Several object types require no further processing: * 1) Devices rarely have an attached object, return the Node @@ -210,7 +209,6 @@ AcpiExResolveNodeToValue ( */ switch (EntryType) { - case ACPI_TYPE_PACKAGE: if (ACPI_TYPE_PACKAGE != SourceDesc->Common.Type) @@ -286,7 +284,6 @@ AcpiExResolveNodeToValue ( Status = AcpiExReadDataFromField (SourceDesc, &ObjDesc); break; - /* * For these objects, just return the object attached to the Node */ @@ -363,7 +360,7 @@ AcpiExResolveNodeToValue ( ObjDesc->Integer.Value = TempVal; - /* + /* * Truncate value if we are executing from a 32-bit ACPI table * AND actually executing AML code. If we are resolving * an object in the namespace via an external call to the diff --git a/sys/contrib/dev/acpica/exresolv.c b/sys/contrib/dev/acpica/exresolv.c index 48b753e..e2cb52c5 100644 --- a/sys/contrib/dev/acpica/exresolv.c +++ b/sys/contrib/dev/acpica/exresolv.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exresolv - AML Interpreter object resolution - * $Revision: 101 $ + * $Revision: 103 $ * *****************************************************************************/ @@ -131,118 +131,6 @@ MODULE_NAME ("exresolv") -/******************************************************************************* - * - * FUNCTION: AcpiExGetBufferFieldValue - * - * PARAMETERS: *ObjDesc - Pointer to a BufferField - * *ResultDesc - Pointer to an empty descriptor which will - * become an Integer with the field's value - * - * RETURN: Status - * - * DESCRIPTION: Retrieve the value from a BufferField - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExGetBufferFieldValue ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT *ResultDesc) -{ - ACPI_STATUS Status; - UINT32 Mask; - UINT8 *Location; - - - FUNCTION_TRACE ("ExGetBufferFieldValue"); - - - /* - * Parameter validation - */ - if (!ObjDesc) - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null field pointer\n")); - return_ACPI_STATUS (AE_AML_NO_OPERAND); - } - - if (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)) - { - Status = AcpiDsGetBufferFieldArguments (ObjDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - if (!ObjDesc->BufferField.BufferObj) - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null container pointer\n")); - return_ACPI_STATUS (AE_AML_INTERNAL); - } - - if (ACPI_TYPE_BUFFER != ObjDesc->BufferField.BufferObj->Common.Type) - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - container is not a Buffer\n")); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - if (!ResultDesc) - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null result pointer\n")); - return_ACPI_STATUS (AE_AML_INTERNAL); - } - - - /* Field location is (base of buffer) + (byte offset) */ - - Location = ObjDesc->BufferField.BufferObj->Buffer.Pointer - + ObjDesc->BufferField.BaseByteOffset; - - /* - * Construct Mask with as many 1 bits as the field width - * - * NOTE: Only the bottom 5 bits are valid for a shift operation, so - * special care must be taken for any shift greater than 31 bits. - * - * TBD: [Unhandled] Fields greater than 32 bits will not work. - */ - if (ObjDesc->BufferField.BitLength < 32) - { - Mask = ((UINT32) 1 << ObjDesc->BufferField.BitLength) - (UINT32) 1; - } - else - { - Mask = ACPI_UINT32_MAX; - } - - ResultDesc->Integer.Type = (UINT8) ACPI_TYPE_INTEGER; - - /* Get the 32 bit value at the location */ - - MOVE_UNALIGNED32_TO_32 (&ResultDesc->Integer.Value, Location); - - /* - * Shift the 32-bit word containing the field, and mask off the - * resulting value - */ - ResultDesc->Integer.Value = - (ResultDesc->Integer.Value >> ObjDesc->BufferField.StartFieldBitOffset) & Mask; - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "** Read from buffer %p byte %d bit %d width %d addr %p mask %08X val %8.8X%8.8X\n", - ObjDesc->BufferField.BufferObj->Buffer.Pointer, - ObjDesc->BufferField.BaseByteOffset, - ObjDesc->BufferField.StartFieldBitOffset, - ObjDesc->BufferField.BitLength, - Location, Mask, - HIDWORD(ResultDesc->Integer.Value), - LODWORD(ResultDesc->Integer.Value))); - - return_ACPI_STATUS (AE_OK); -} - /******************************************************************************* * @@ -276,7 +164,6 @@ AcpiExResolveToValue ( return_ACPI_STATUS (AE_AML_NO_OPERAND); } - /* * The entity pointed to by the StackPtr can be either * 1) A valid ACPI_OPERAND_OBJECT, or @@ -305,7 +192,6 @@ AcpiExResolveToValue ( } } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Resolved object %p\n", *StackPtr)); return_ACPI_STATUS (AE_OK); } @@ -347,14 +233,12 @@ AcpiExResolveObjectToValue ( switch (StackDesc->Common.Type) { - case INTERNAL_TYPE_REFERENCE: Opcode = StackDesc->Reference.Opcode; switch (Opcode) { - case AML_NAME_OP: /* @@ -398,7 +282,6 @@ AcpiExResolveObjectToValue ( StackDesc->Reference.Offset, ObjDesc)); break; - /* * For constants, we must change the reference/constant object * to a real integer object @@ -439,7 +322,7 @@ AcpiExResolveObjectToValue ( break; } - /* + /* * Remove a reference from the original reference object * and put the new object in its place */ @@ -471,7 +354,6 @@ AcpiExResolveObjectToValue ( AcpiUtAddReference (ObjDesc); *StackPtr = ObjDesc; } - else { /* @@ -494,7 +376,6 @@ AcpiExResolveObjectToValue ( Status = AE_AML_INTERNAL; break; } - break; @@ -515,55 +396,24 @@ AcpiExResolveObjectToValue ( break; /* case INTERNAL_TYPE_REFERENCE */ - + /* + * These cases may never happen here, but just in case.. + */ case ACPI_TYPE_BUFFER_FIELD: - - ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_ANY); - if (!ObjDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - Status = AcpiExGetBufferFieldValue (StackDesc, ObjDesc); - if (ACPI_FAILURE (Status)) - { - AcpiUtRemoveReference (ObjDesc); - ObjDesc = NULL; - } - - *StackPtr = (void *) ObjDesc; - break; - - + case INTERNAL_TYPE_REGION_FIELD: case INTERNAL_TYPE_BANK_FIELD: + case INTERNAL_TYPE_INDEX_FIELD: - ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_ANY); - if (!ObjDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* TBD: WRONG! */ - - Status = AcpiExGetBufferFieldValue (StackDesc, ObjDesc); - if (ACPI_FAILURE (Status)) - { - AcpiUtRemoveReference (ObjDesc); - ObjDesc = NULL; - } + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "FieldRead SourceDesc=%p Type=%X\n", + StackDesc, StackDesc->Common.Type)); + Status = AcpiExReadDataFromField (StackDesc, &ObjDesc); *StackPtr = (void *) ObjDesc; break; - - /* TBD: [Future] - may need to handle IndexField, and DefField someday */ - default: - break; - - } /* switch (StackDesc->Common.Type) */ - + } return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/exstore.c b/sys/contrib/dev/acpica/exstore.c index 4392b7a..a49e29c 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: 150 $ + * $Revision: 154 $ * *****************************************************************************/ @@ -137,14 +137,16 @@ * PARAMETERS: *SourceDesc - Value to be stored * *DestDesc - Where to store it. Must be an NS node * or an ACPI_OPERAND_OBJECT of type - * Reference; + * Reference; + * WalkState - Current walk state * * RETURN: Status * * DESCRIPTION: Store the value described by SourceDesc into the location * described by DestDesc. Called by various interpreter * functions to store the result of an operation into - * the destination operand. + * the destination operand -- not just simply the actual STORE + * ASL operator. * ******************************************************************************/ @@ -185,7 +187,6 @@ AcpiExStore ( return_ACPI_STATUS (Status); } - /* Destination object must be an object of type Reference */ if (DestDesc->Common.Type != INTERNAL_TYPE_REFERENCE) @@ -203,7 +204,6 @@ AcpiExStore ( return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } - /* * Examine the Reference opcode. These cases are handled: * @@ -215,7 +215,6 @@ AcpiExStore ( */ switch (RefDesc->Reference.Opcode) { - case AML_NAME_OP: /* Storing an object into a Name "container" */ @@ -299,27 +298,23 @@ AcpiExStore ( case AML_REVISION_OP: /* - * Storing to a constant is a no-op -- see ACPI Specification - * Delete the reference descriptor, however + * Storing to a constant is a no-op according to the ACPI + * Specification. (Delete the reference descriptor, however.) */ break; default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - Unknown Reference subtype %02x\n", + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Reference subtype %02x\n", RefDesc->Reference.Opcode)); - - /* TBD: [Restructure] use object dump routine !! */ - - DUMP_BUFFER (RefDesc, sizeof (ACPI_OPERAND_OBJECT)); + DUMP_ENTRY (RefDesc, ACPI_LV_ERROR); Status = AE_AML_INTERNAL; break; } /* switch (RefDesc->Reference.Opcode) */ - return_ACPI_STATUS (Status); } @@ -328,12 +323,13 @@ AcpiExStore ( * * FUNCTION: AcpiExStoreObjectToIndex * - * PARAMETERS: *SourceDesc - Value to be stored - * *Node - Named object to receive the value + * PARAMETERS: *SourceDesc - Value to be stored + * *DestDesc - Named object to receive the value + * WalkState - Current walk state * * RETURN: Status * - * DESCRIPTION: Store the object to the named object. + * DESCRIPTION: Store the object to indexed Buffer or Package element * ******************************************************************************/ @@ -345,8 +341,6 @@ AcpiExStoreObjectToIndex ( { ACPI_STATUS Status = AE_OK; ACPI_OPERAND_OBJECT *ObjDesc; - UINT32 Length; - UINT32 i; UINT8 Value = 0; @@ -395,10 +389,11 @@ AcpiExStoreObjectToIndex ( if (!ObjDesc) { /* - * If the ObjDesc is NULL, it means that an uninitialized package - * element has been used as a destination (this is OK), therefore, - * we must create the destination element to match the type of the - * source element NOTE: SourceDesccan be of any type. + * If the ObjDesc is NULL, it means that an uninitialized + * package element has been used as a destination (this is OK), + * therefore, we must create the destination element to match + * the type of the source element NOTE: SourceDesc can be of + * any type. */ ObjDesc = AcpiUtCreateInternalObject (SourceDesc->Common.Type); if (!ObjDesc) @@ -411,7 +406,8 @@ AcpiExStoreObjectToIndex ( */ if (ACPI_TYPE_PACKAGE == ObjDesc->Common.Type) { - Status = AcpiUtCopyIpackageToIpackage (SourceDesc, ObjDesc, WalkState); + Status = AcpiUtCopyIpackageToIpackage (SourceDesc, ObjDesc, + WalkState); if (ACPI_FAILURE (Status)) { AcpiUtRemoveReference (ObjDesc); @@ -450,18 +446,17 @@ AcpiExStoreObjectToIndex ( case ACPI_TYPE_BUFFER_FIELD: - - /* TBD: can probably call the generic Buffer/Field routines */ - /* - * Storing into a buffer at a location defined by an Index. + * Store into a Buffer (not actually a real BufferField) at a + * location defined by an Index. * - * Each 8-bit element of the source object is written to the - * 8-bit Buffer Field of the Index destination object. + * The first 8-bit element of the source object is written to the + * 8-bit Buffer location defined by the Index destination object, + * according to the ACPI 2.0 specification. */ /* - * Set the ObjDesc to the destination object and type check. + * Make sure the target is a Buffer */ ObjDesc = DestDesc->Reference.Object; if (ObjDesc->Common.Type != ACPI_TYPE_BUFFER) @@ -476,68 +471,46 @@ AcpiExStoreObjectToIndex ( switch (SourceDesc->Common.Type) { case ACPI_TYPE_INTEGER: - /* - * Type is Integer, assign bytewise - * This loop to assign each of the elements is somewhat - * backward because of the Big Endian-ness of IA-64 - */ - Length = sizeof (ACPI_INTEGER); - for (i = Length; i != 0; i--) - { - Value = (UINT8)(SourceDesc->Integer.Value >> (MUL_8 (i - 1))); - ObjDesc->Buffer.Pointer[DestDesc->Reference.Offset] = Value; - } - break; + /* Use the least-significant byte of the integer */ - case ACPI_TYPE_BUFFER: - /* - * Type is Buffer, the Length is in the structure. - * Just loop through the elements and assign each one in turn. - */ - Length = SourceDesc->Buffer.Length; - for (i = 0; i < Length; i++) - { - Value = SourceDesc->Buffer.Pointer[i]; - ObjDesc->Buffer.Pointer[DestDesc->Reference.Offset] = Value; - } + Value = (UINT8) (SourceDesc->Integer.Value); break; + case ACPI_TYPE_BUFFER: - case ACPI_TYPE_STRING: - /* - * Type is String, the Length is in the structure. - * Just loop through the elements and assign each one in turn. - */ - Length = SourceDesc->String.Length; - for (i = 0; i < Length; i++) - { - Value = SourceDesc->String.Pointer[i]; - ObjDesc->Buffer.Pointer[DestDesc->Reference.Offset] = Value; - } + Value = SourceDesc->Buffer.Pointer[0]; break; + case ACPI_TYPE_STRING: + + Value = SourceDesc->String.Pointer[0]; + break; default: - /* Other types are invalid */ + /* All other types are invalid */ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Source must be Number/Buffer/String type, not %X\n", - SourceDesc->Common.Type)); - Status = AE_AML_OPERAND_TYPE; + "Source must be Integer/Buffer/String type, not %s\n", + AcpiUtGetTypeName (SourceDesc->Common.Type))); + return_ACPI_STATUS (AE_AML_OPERAND_TYPE); break; } + + /* Store the source value into the target buffer byte */ + + ObjDesc->Buffer.Pointer[DestDesc->Reference.Offset] = Value; break; default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Target is not a Package or BufferField\n")); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Target is not a Package or BufferField\n")); Status = AE_AML_OPERAND_TYPE; break; } - return_ACPI_STATUS (Status); } @@ -546,15 +519,16 @@ AcpiExStoreObjectToIndex ( * * FUNCTION: AcpiExStoreObjectToNode * - * PARAMETERS: *SourceDesc - Value to be stored - * *Node - Named object to receive the value + * PARAMETERS: SourceDesc - Value to be stored + * Node - Named object to receive the value + * WalkState - Current walk state * * RETURN: Status * * DESCRIPTION: Store the object to the named object. * * The Assignment of an object to a named object is handled here - * The val passed in will replace the current value (if any) + * The value passed in will replace the current value (if any) * with the input value. * * When storing into an object the data is converted to the @@ -562,10 +536,7 @@ AcpiExStoreObjectToIndex ( * that the target object type (for an initialized target) will * not be changed by a store operation. * - * NOTE: the global lock is acquired early. This will result - * in the global lock being held a bit longer. Also, if the - * function fails during set up we may get the lock when we - * don't really need it. I don't think we care. + * Assumes parameters are already validated. * ******************************************************************************/ @@ -584,10 +555,6 @@ AcpiExStoreObjectToNode ( /* - * Assuming the parameters were already validated - */ - - /* * Get current type of the node, and object attached to Node */ TargetType = AcpiNsGetType (Node); @@ -597,7 +564,6 @@ AcpiExStoreObjectToNode ( Node, AcpiUtGetTypeName (SourceDesc->Common.Type), SourceDesc, AcpiUtGetTypeName (TargetType))); - /* * Resolve the source object to an actual value * (If it is a reference object) @@ -608,7 +574,6 @@ AcpiExStoreObjectToNode ( return_ACPI_STATUS (Status); } - /* * Do the actual store operation */ @@ -636,7 +601,8 @@ AcpiExStoreObjectToNode ( * * Copy and/or convert the source object to a new target object */ - Status = AcpiExStoreObject (SourceDesc, TargetType, &TargetDesc, WalkState); + Status = AcpiExStoreObject (SourceDesc, TargetType, &TargetDesc, + WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -668,7 +634,6 @@ AcpiExStoreObjectToNode ( break; } - return_ACPI_STATUS (Status); } @@ -677,8 +642,9 @@ AcpiExStoreObjectToNode ( * * FUNCTION: AcpiExStoreObjectToObject * - * PARAMETERS: *SourceDesc - Value to be stored - * *DestDesc - Object to receive the value + * PARAMETERS: SourceDesc - Value to be stored + * DestDesc - Object to receive the value + * WalkState - Current walk state * * RETURN: Status * @@ -697,6 +663,8 @@ AcpiExStoreObjectToNode ( * This module allows destination types of Number, String, * and Buffer. * + * Assumes parameters are already validated. + * ******************************************************************************/ ACPI_STATUS @@ -711,10 +679,6 @@ AcpiExStoreObjectToObject ( FUNCTION_TRACE ("ExStoreObjectToObject"); - - /* - * Assuming the parameters are valid! - */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Storing %p(%s) to %p(%s)\n", SourceDesc, AcpiUtGetTypeName (SourceDesc->Common.Type), DestDesc, AcpiUtGetTypeName (DestDesc->Common.Type))); @@ -737,7 +701,6 @@ AcpiExStoreObjectToObject ( return_ACPI_STATUS (AE_NOT_IMPLEMENTED); } - /* * Resolve the source object to an actual value * (If it is a reference object) @@ -748,13 +711,11 @@ AcpiExStoreObjectToObject ( return_ACPI_STATUS (Status); } - /* * Copy and/or convert the source object to the destination object */ - Status = AcpiExStoreObject (SourceDesc, DestinationType, &DestDesc, WalkState); - - + Status = AcpiExStoreObject (SourceDesc, DestinationType, &DestDesc, + WalkState); return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/exstoren.c b/sys/contrib/dev/acpica/exstoren.c index 0cd24c1..e82934a 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: 40 $ + * $Revision: 41 $ * *****************************************************************************/ @@ -160,30 +160,28 @@ AcpiExResolveObject ( /* - * Ensure we have a Source that can be stored in the target + * Ensure we have a Target that can be stored to */ switch (TargetType) { - - /* This case handles the "interchangeable" types Integer, String, and Buffer. */ - - /* - * These cases all require only Integers or values that - * can be converted to Integers (Strings or Buffers) - */ case ACPI_TYPE_BUFFER_FIELD: case INTERNAL_TYPE_REGION_FIELD: case INTERNAL_TYPE_BANK_FIELD: case INTERNAL_TYPE_INDEX_FIELD: + /* + * These cases all require only Integers or values that + * can be converted to Integers (Strings or Buffers) + */ - /* - * Stores into a Field/Region or into a Buffer/String - * are all essentially the same. - */ case ACPI_TYPE_INTEGER: case ACPI_TYPE_STRING: case ACPI_TYPE_BUFFER: + /* + * Stores into a Field/Region or into a Integer/Buffer/String + * are all essentially the same. This case handles the + * "interchangeable" types Integer, String, and Buffer. + */ /* TBD: FIX - check for source==REF, resolve, then check type */ diff --git a/sys/contrib/dev/acpica/exutils.c b/sys/contrib/dev/acpica/exutils.c index 407894d..0bf2ff2 100644 --- a/sys/contrib/dev/acpica/exutils.c +++ b/sys/contrib/dev/acpica/exutils.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exutils - interpreter/scanner utilities - * $Revision: 85 $ + * $Revision: 88 $ * *****************************************************************************/ @@ -152,7 +152,6 @@ * PARAMETERS: None * * DESCRIPTION: Enter the interpreter execution region - * TBD: should be a macro * ******************************************************************************/ @@ -187,8 +186,6 @@ AcpiExEnterInterpreter (void) * already executing * 7) About to invoke a user-installed opregion handler * - * TBD: should be a macro - * ******************************************************************************/ void @@ -281,7 +278,8 @@ AcpiExTruncateFor32bitTable ( * * FUNCTION: AcpiExAcquireGlobalLock * - * PARAMETERS: Rule - Lock rule: AlwaysLock, NeverLock + * PARAMETERS: FieldFlags - Flags with Lock rule: + * AlwaysLock or NeverLock * * RETURN: TRUE/FALSE indicating whether the lock was actually acquired * @@ -293,7 +291,7 @@ AcpiExTruncateFor32bitTable ( BOOLEAN AcpiExAcquireGlobalLock ( - UINT32 Rule) + UINT32 FieldFlags) { BOOLEAN Locked = FALSE; ACPI_STATUS Status; @@ -302,9 +300,9 @@ AcpiExAcquireGlobalLock ( FUNCTION_TRACE ("ExAcquireGlobalLock"); - /* Only attempt lock if the Rule says so */ + /* Only attempt lock if the AlwaysLock bit is set */ - if (Rule == (UINT32) GLOCK_ALWAYS_LOCK) + if (FieldFlags & AML_FIELD_LOCK_RULE_MASK) { /* We should attempt to get the lock */ @@ -392,8 +390,8 @@ AcpiExDigitsNeeded ( /* * ACPI_INTEGER is unsigned, which is why we don't worry about a '-' */ - for (NumDigits = 1; - (AcpiUtShortDivide (&Value, Base, &Value, NULL)); + for (NumDigits = 1; + (AcpiUtShortDivide (&Value, Base, &Value, NULL)); ++NumDigits) { ; } } diff --git a/sys/contrib/dev/acpica/hwacpi.c b/sys/contrib/dev/acpica/hwacpi.c index 6f8e0b9..8139430 100644 --- a/sys/contrib/dev/acpica/hwacpi.c +++ b/sys/contrib/dev/acpica/hwacpi.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface - * $Revision: 46 $ + * $Revision: 47 $ * *****************************************************************************/ @@ -158,124 +158,76 @@ AcpiHwInitialize ( return_ACPI_STATUS (AE_NO_ACPI_TABLES); } - - /* Identify current ACPI/legacy mode */ - - switch (AcpiGbl_SystemFlags & SYS_MODES_MASK) + + /* + * Save the initial state of the ACPI event enable registers, so + * we can restore them when we exit. We probably won't exit, though. + * + * The location of the PM1aEvtBlk enable registers is defined as the + * base of PM1aEvtBlk + DIV_2(PM1aEvtBlkLength). Since the spec further + * fully defines the PM1aEvtBlk to be a total of 4 bytes, the offset + * for the enable registers is always 2 from the base. It is hard + * coded here. If this changes in the spec, this code will need to + * be modified. The PM1bEvtBlk behaves as expected. + */ + AcpiGbl_Pm1EnableRegisterSave = (UINT16) AcpiHwRegisterRead ( + ACPI_MTX_LOCK, PM1_EN); + + + /* + * The GPEs behave similarly, except that the length of the register + * block is not fixed, so the buffer must be allocated with malloc + */ + if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address) && + AcpiGbl_FADT->Gpe0BlkLen) { - case (SYS_MODE_ACPI): - - AcpiGbl_OriginalMode = SYS_MODE_ACPI; - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "System supports ACPI mode only.\n")); - break; - - - case (SYS_MODE_LEGACY): - - AcpiGbl_OriginalMode = SYS_MODE_LEGACY; - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Tables loaded from buffer, hardware assumed to support LEGACY mode only.\n")); - break; - + /* GPE0 specified in FADT */ - case (SYS_MODE_ACPI | SYS_MODE_LEGACY): - - if (AcpiHwGetMode () == SYS_MODE_ACPI) - { - AcpiGbl_OriginalMode = SYS_MODE_ACPI; - } - else + AcpiGbl_Gpe0EnableRegisterSave = ACPI_MEM_ALLOCATE ( + DIV_2 (AcpiGbl_FADT->Gpe0BlkLen)); + if (!AcpiGbl_Gpe0EnableRegisterSave) { - AcpiGbl_OriginalMode = SYS_MODE_LEGACY; + return_ACPI_STATUS (AE_NO_MEMORY); } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "System supports both ACPI and LEGACY modes.\n")); + /* Save state of GPE0 enable bits */ - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "System is currently in %s mode.\n", - (AcpiGbl_OriginalMode == SYS_MODE_ACPI) ? "ACPI" : "LEGACY")); - break; + for (Index = 0; Index < DIV_2 (AcpiGbl_FADT->Gpe0BlkLen); Index++) + { + AcpiGbl_Gpe0EnableRegisterSave[Index] = + (UINT8) AcpiHwRegisterRead (ACPI_MTX_LOCK, GPE0_EN_BLOCK | Index); + } } - - if (AcpiGbl_SystemFlags & SYS_MODE_ACPI) + else { - /* Target system supports ACPI mode */ - - /* - * The purpose of this code is to save the initial state - * of the ACPI event enable registers. An exit function will be - * registered which will restore this state when the application - * exits. The exit function will also clear all of the ACPI event - * status bits prior to restoring the original mode. - * - * The location of the PM1aEvtBlk enable registers is defined as the - * base of PM1aEvtBlk + DIV_2(PM1aEvtBlkLength). Since the spec further - * fully defines the PM1aEvtBlk to be a total of 4 bytes, the offset - * for the enable registers is always 2 from the base. It is hard - * coded here. If this changes in the spec, this code will need to - * be modified. The PM1bEvtBlk behaves as expected. - */ - AcpiGbl_Pm1EnableRegisterSave = (UINT16) AcpiHwRegisterRead ( - ACPI_MTX_LOCK, PM1_EN); + AcpiGbl_Gpe0EnableRegisterSave = NULL; + } + if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address) && + AcpiGbl_FADT->Gpe1BlkLen) + { + /* GPE1 defined */ - /* - * The GPEs behave similarly, except that the length of the register - * block is not fixed, so the buffer must be allocated with malloc - */ - if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address) && - AcpiGbl_FADT->Gpe0BlkLen) + AcpiGbl_Gpe1EnableRegisterSave = ACPI_MEM_ALLOCATE ( + DIV_2 (AcpiGbl_FADT->Gpe1BlkLen)); + if (!AcpiGbl_Gpe1EnableRegisterSave) { - /* GPE0 specified in FADT */ - - AcpiGbl_Gpe0EnableRegisterSave = ACPI_MEM_ALLOCATE ( - DIV_2 (AcpiGbl_FADT->Gpe0BlkLen)); - if (!AcpiGbl_Gpe0EnableRegisterSave) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Save state of GPE0 enable bits */ - - for (Index = 0; Index < DIV_2 (AcpiGbl_FADT->Gpe0BlkLen); Index++) - { - AcpiGbl_Gpe0EnableRegisterSave[Index] = - (UINT8) AcpiHwRegisterRead (ACPI_MTX_LOCK, GPE0_EN_BLOCK | Index); - } + return_ACPI_STATUS (AE_NO_MEMORY); } - else - { - AcpiGbl_Gpe0EnableRegisterSave = NULL; - } + /* save state of GPE1 enable bits */ - if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address) && - AcpiGbl_FADT->Gpe1BlkLen) + for (Index = 0; Index < DIV_2 (AcpiGbl_FADT->Gpe1BlkLen); Index++) { - /* GPE1 defined */ - - AcpiGbl_Gpe1EnableRegisterSave = ACPI_MEM_ALLOCATE ( - DIV_2 (AcpiGbl_FADT->Gpe1BlkLen)); - if (!AcpiGbl_Gpe1EnableRegisterSave) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* save state of GPE1 enable bits */ - - for (Index = 0; Index < DIV_2 (AcpiGbl_FADT->Gpe1BlkLen); Index++) - { - AcpiGbl_Gpe1EnableRegisterSave[Index] = - (UINT8) AcpiHwRegisterRead (ACPI_MTX_LOCK, GPE1_EN_BLOCK | Index); - } + AcpiGbl_Gpe1EnableRegisterSave[Index] = + (UINT8) AcpiHwRegisterRead (ACPI_MTX_LOCK, GPE1_EN_BLOCK | Index); } + } - else - { - AcpiGbl_Gpe1EnableRegisterSave = NULL; - } + else + { + AcpiGbl_Gpe1EnableRegisterSave = NULL; } return_ACPI_STATUS (Status); @@ -368,68 +320,3 @@ AcpiHwGetMode (void) return_VALUE (SYS_MODE_LEGACY); } } - - -/****************************************************************************** - * - * FUNCTION: AcpiHwGetModeCapabilities - * - * PARAMETERS: none - * - * RETURN: logical OR of SYS_MODE_ACPI and SYS_MODE_LEGACY determined at initial - * system state. - * - * DESCRIPTION: Returns capablities of system - * - ******************************************************************************/ - -UINT32 -AcpiHwGetModeCapabilities (void) -{ - - FUNCTION_TRACE ("HwGetModeCapabilities"); - - - if (!(AcpiGbl_SystemFlags & SYS_MODES_MASK)) - { - if (AcpiHwGetMode () == SYS_MODE_LEGACY) - { - /* - * Assume that if this call is being made, AcpiInit has been called - * and ACPI support has been established by the presence of the - * tables. Therefore since we're in SYS_MODE_LEGACY, the system - * must support both modes - */ - AcpiGbl_SystemFlags |= (SYS_MODE_ACPI | SYS_MODE_LEGACY); - } - - else - { - /* TBD: [Investigate] !!! this may be unsafe... */ - /* - * system is is ACPI mode, so try to switch back to LEGACY to see if - * it is supported - */ - AcpiHwSetMode (SYS_MODE_LEGACY); - - if (AcpiHwGetMode () == SYS_MODE_LEGACY) - { - /* Now in SYS_MODE_LEGACY, so both are supported */ - - AcpiGbl_SystemFlags |= (SYS_MODE_ACPI | SYS_MODE_LEGACY); - AcpiHwSetMode (SYS_MODE_ACPI); - } - - else - { - /* Still in SYS_MODE_ACPI so this must be an ACPI only system */ - - AcpiGbl_SystemFlags |= SYS_MODE_ACPI; - } - } - } - - return_VALUE (AcpiGbl_SystemFlags & SYS_MODES_MASK); -} - - diff --git a/sys/contrib/dev/acpica/nsaccess.c b/sys/contrib/dev/acpica/nsaccess.c index 4afb4b7..c52a62a 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: 135 $ + * $Revision: 141 $ * ******************************************************************************/ @@ -165,14 +165,12 @@ AcpiNsRootInitialize (void) goto UnlockAndExit; } - /* * Tell the rest of the subsystem that the root is initialized * (This is OK because the namespace is locked) */ AcpiGbl_RootNode = &AcpiGbl_RootNodeStruct; - /* Enter the pre-defined names in the name table */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Entering predefined entries into namespace\n")); @@ -213,10 +211,8 @@ AcpiNsRootInitialize (void) * internal representation. Only types actually * used for initial values are implemented here. */ - switch (InitVal->Type) { - case ACPI_TYPE_INTEGER: ObjDesc->Integer.Value = @@ -248,7 +244,6 @@ AcpiNsRootInitialize (void) */ Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, 1, &ObjDesc->Mutex.Semaphore); - if (ACPI_FAILURE (Status)) { goto UnlockAndExit; @@ -260,14 +255,12 @@ AcpiNsRootInitialize (void) */ AcpiGbl_GlobalLockSemaphore = ObjDesc->Mutex.Semaphore; } - else { /* Create a mutex */ Status = AcpiOsCreateSemaphore (1, 1, &ObjDesc->Mutex.Semaphore); - if (ACPI_FAILURE (Status)) { goto UnlockAndExit; @@ -337,7 +330,6 @@ AcpiNsLookup ( ACPI_STATUS Status; ACPI_NAMESPACE_NODE *PrefixNode; ACPI_NAMESPACE_NODE *CurrentNode = NULL; - ACPI_NAMESPACE_NODE *ScopeToPush = NULL; ACPI_NAMESPACE_NODE *ThisNode = NULL; UINT32 NumSegments; ACPI_NAME SimpleName; @@ -346,8 +338,6 @@ AcpiNsLookup ( ACPI_OBJECT_TYPE8 ThisSearchType; UINT32 LocalFlags = Flags & ~NS_ERROR_IF_FOUND; - DEBUG_EXEC (UINT32 i;) - FUNCTION_TRACE ("NsLookup"); @@ -357,15 +347,12 @@ AcpiNsLookup ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - AcpiGbl_NsLookupCount++; - *ReturnNode = ENTRY_NOT_FOUND; - if (!AcpiGbl_RootNode) { - return (AE_NO_NAMESPACE); + return_ACPI_STATUS (AE_NO_NAMESPACE); } /* @@ -375,7 +362,8 @@ AcpiNsLookup ( if ((!ScopeInfo) || (!ScopeInfo->Scope.Node)) { - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Null scope prefix, using root node (%p)\n", + ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, + "Null scope prefix, using root node (%p)\n", AcpiGbl_RootNode)); PrefixNode = AcpiGbl_RootNode; @@ -385,7 +373,6 @@ AcpiNsLookup ( PrefixNode = ScopeInfo->Scope.Node; } - /* * This check is explicitly split to relax the TypeToCheckFor * conditions for BankFieldDefn. Originally, both BankFieldDefn and @@ -399,34 +386,30 @@ AcpiNsLookup ( TypeToCheckFor = ACPI_TYPE_REGION; } - else if (INTERNAL_TYPE_BANK_FIELD_DEFN == Type) { /* BankFieldDefn defines data fields in a Field Object */ TypeToCheckFor = ACPI_TYPE_ANY; } - else { TypeToCheckFor = Type; } - /* TBD: [Restructure] - Move the pathname stuff into a new procedure */ - - /* Examine the name pointer */ + /* Examine the pathname */ if (!Pathname) { - /* 8-12-98 ASL Grammar Update supports null NamePath */ + /* Null NamePath -- is allowed */ NullNamePath = TRUE; - NumSegments = 0; - ThisNode = AcpiGbl_RootNode; + NumSegments = 0; + ThisNode = AcpiGbl_RootNode; ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Null Pathname (Zero segments), Flags=%x\n", Flags)); + "Null Pathname (Zero segments), Flags=%x\n", Flags)); } else @@ -451,38 +434,37 @@ AcpiNsLookup ( */ if (*Pathname == AML_ROOT_PREFIX) { - /* Pathname is fully qualified, look in root name table */ + /* Pathname is fully qualified, start from the root */ CurrentNode = AcpiGbl_RootNode; - /* point to segment part */ + /* Point to segment part */ Pathname++; ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching from root [%p]\n", CurrentNode)); - /* Direct reference to root, "\" */ - if (!(*Pathname)) { + /* Direct reference to root, "\" */ + ThisNode = AcpiGbl_RootNode; goto CheckForNewScopeAndExit; } } - else { /* Pathname is relative to current scope, start there */ CurrentNode = PrefixNode; - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching relative to pfx scope [%p]\n", + ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, + "Searching relative to pfx scope [%p]\n", PrefixNode)); /* - * Handle up-prefix (carat). More than one prefix - * is supported + * Handle up-prefix (carat). More than one prefix is supported */ while (*Pathname == AML_PARENT_PREFIX) { @@ -490,7 +472,7 @@ AcpiNsLookup ( Pathname++; - /* Backup to the parent's scope */ + /* Backup to the parent's scope */ ThisNode = AcpiNsGetParentObject (CurrentNode); if (!ThisNode) @@ -506,41 +488,36 @@ AcpiNsLookup ( } } - /* - * Examine the name prefix opcode, if any, - * to determine the number of segments + * Examine the name prefix opcode, if any, to determine the number of + * segments */ if (*Pathname == AML_DUAL_NAME_PREFIX) { - NumSegments = 2; - - /* point to first segment */ + /* Two segments, point to first segment */ + NumSegments = 2; Pathname++; ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Dual Pathname (2 segments, Flags=%X)\n", Flags)); } - else if (*Pathname == AML_MULTI_NAME_PREFIX_OP) { - NumSegments = (UINT32)* (UINT8 *) ++Pathname; - - /* point to first segment */ + /* Extract segment count, point to first segment */ + NumSegments = (UINT32)* (UINT8 *) ++Pathname; Pathname++; ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Multi Pathname (%d Segments, Flags=%X) \n", NumSegments, Flags)); } - else { /* - * No Dual or Multi prefix, hence there is only one - * segment and Pathname is already pointing to it. + * No Dual or Multi prefix, hence there is only one segment and + * Pathname is already pointing to it. */ NumSegments = 1; @@ -548,26 +525,12 @@ AcpiNsLookup ( "Simple Pathname (1 segment, Flags=%X)\n", Flags)); } -#ifdef ACPI_DEBUG - - /* TBD: [Restructure] Make this a procedure */ - - /* Debug only: print the entire name that we are about to lookup */ - - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[")); - - for (i = 0; i < NumSegments; i++) - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_NAMES, "%4.4s/", (char*)&Pathname[i * 4])); - } - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_NAMES, "]\n")); -#endif + DEBUG_EXEC (AcpiNsPrintPathname (NumSegments, Pathname)); } - /* - * Search namespace for each segment of the name. - * Loop through and verify/add each name segment. + * Search namespace for each segment of the name. Loop through and + * verify/add each name segment. */ while (NumSegments-- && CurrentNode) { @@ -594,7 +557,6 @@ AcpiNsLookup ( CurrentNode, InterpreterMode, ThisSearchType, LocalFlags, &ThisNode); - if (ACPI_FAILURE (Status)) { if (Status == AE_NOT_FOUND) @@ -609,7 +571,6 @@ AcpiNsLookup ( return_ACPI_STATUS (Status); } - /* * If 1) This is the last segment (NumSegments == 0) * 2) and looking for a specific type @@ -636,7 +597,7 @@ AcpiNsLookup ( REPORT_WARNING ( ("NsLookup: %4.4s, type %X, checking for type %X\n", - (char*)&SimpleName, ThisNode->Type, TypeToCheckFor)); + (char *) &SimpleName, ThisNode->Type, TypeToCheckFor)); } /* @@ -676,32 +637,19 @@ CheckForNewScopeAndExit: if (!(Flags & NS_DONT_OPEN_SCOPE) && (WalkState)) { /* - * If entry is a type which opens a scope, - * push the new scope on the scope stack. + * If entry is a type which opens a scope, push the new scope on the + * scope stack. */ if (AcpiNsOpensScope (TypeToCheckFor)) { - /* 8-12-98 ASL Grammar Update supports null NamePath */ - - if (NullNamePath) - { - /* TBD: [Investigate] - is this the correct thing to do? */ - - ScopeToPush = NULL; - } - else - { - ScopeToPush = ThisNode; - } - - Status = AcpiDsScopeStackPush (ScopeToPush, Type, - WalkState); + Status = AcpiDsScopeStackPush (ThisNode, Type, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Set global scope to %p\n", ScopeToPush)); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "Set global scope to %p\n", ThisNode)); } } diff --git a/sys/contrib/dev/acpica/nsalloc.c b/sys/contrib/dev/acpica/nsalloc.c index 0958bcc..52afd73 100644 --- a/sys/contrib/dev/acpica/nsalloc.c +++ b/sys/contrib/dev/acpica/nsalloc.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: nsalloc - Namespace allocation and deletion utilities - * $Revision: 60 $ + * $Revision: 62 $ * ******************************************************************************/ @@ -216,13 +216,9 @@ AcpiNsDeleteNode ( ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].TotalFreed++); /* - * Detach an object if there is one + * Detach an object if there is one then delete the node */ - if (Node->Object) - { - AcpiNsDetachObject (Node); - } - + AcpiNsDetachObject (Node); ACPI_MEM_FREE (Node); return_VOID; } @@ -239,7 +235,11 @@ AcpiNsDeleteNode ( * * RETURN: None * - * DESCRIPTION: Initialize a new entry within a namespace table. + * DESCRIPTION: Initialize a new namespace node and install it amongst + * its peers. + * + * Note: Current namespace lookup is linear search, so the nodes + * are not linked in any particular order. * ******************************************************************************/ @@ -267,17 +267,13 @@ AcpiNsInstallNode ( OwnerId = WalkState->OwnerId; } - - /* link the new entry into the parent and existing children */ - - /* TBD: Could be first, last, or alphabetic */ + /* Link the new entry into the parent and existing children */ ChildNode = ParentNode->Child; if (!ChildNode) { ParentNode->Child = Node; } - else { while (!(ChildNode->Flags & ANOBJ_END_OF_PEER_LIST)) @@ -498,7 +494,6 @@ AcpiNsDeleteNamespaceSubtree ( ChildNode = 0; } } - else { /* @@ -641,13 +636,11 @@ AcpiNsDeleteNamespaceByOwner ( ParentNode = ChildNode; ChildNode = 0; } - else if (ChildNode->OwnerId == OwnerId) { AcpiNsRemoveReference (ChildNode); } } - else { /* diff --git a/sys/contrib/dev/acpica/nsdump.c b/sys/contrib/dev/acpica/nsdump.c index f8888c4..f2b0b35 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: 105 $ + * $Revision: 116 $ * *****************************************************************************/ @@ -127,9 +127,48 @@ #define _COMPONENT ACPI_NAMESPACE MODULE_NAME ("nsdump") - #if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER) + +/******************************************************************************* + * + * FUNCTION: AcpiNsPrintPathname + * + * PARAMETERS: NumSegment - Number of ACPI name segments + * Pathname - The compressed (internal) path + * + * DESCRIPTION: Print an object's full namespace pathname + * + ******************************************************************************/ + +void +AcpiNsPrintPathname ( + UINT32 NumSegments, + char *Pathname) +{ + UINT32 i; + + PROC_NAME ("AcpiNsPrintPathname"); + + + if (!(AcpiDbgLevel & ACPI_LV_NAMES) || !(AcpiDbgLayer & ACPI_NAMESPACE)) + { + return; + } + + /* Print the entire name */ + + ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[")); + + for (i = 0; i < NumSegments; i++) + { + AcpiOsPrintf ("%4.4s.", (char *) &Pathname[i * 4]); + } + + AcpiOsPrintf ("]\n"); +} + + /******************************************************************************* * * FUNCTION: AcpiNsDumpPathname @@ -176,7 +215,7 @@ AcpiNsDumpPathname ( Length = PATHNAME_MAX; if (ACPI_SUCCESS (AcpiNsHandleToPathname (Handle, &Length, Buffer))) { - AcpiOsPrintf ("%s %s (%p)\n", Msg, Buffer, Handle); + AcpiOsPrintf ("%s %s (Node %p)\n", Msg, Buffer, Handle); } ACPI_MEM_FREE (Buffer); @@ -232,6 +271,11 @@ AcpiNsDumpOneObject ( return (AE_OK); } + if (!((ACPI_LV_TABLES & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer))) + { + return (AE_OK); + } + if (!ObjHandle) { ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n")); @@ -246,66 +290,58 @@ AcpiNsDumpOneObject ( return (AE_OK); } - /* Indent the object according to the level */ while (LevelTmp--) { - /* Print appropriate characters to form tree structure */ if (LevelTmp) { if (DownstreamSiblingMask & WhichBit) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "|")); + AcpiOsPrintf ("|"); } - else { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " ")); + AcpiOsPrintf (" "); } WhichBit <<= 1; } - else { if (AcpiNsExistDownstreamSibling (ThisNode + 1)) { DownstreamSiblingMask |= (1 << (Level - 1)); - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "+")); + AcpiOsPrintf ("+"); } - else { DownstreamSiblingMask &= ACPI_UINT32_MAX ^ (1 << (Level - 1)); - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "+")); + AcpiOsPrintf ("+"); } if (ThisNode->Child == NULL) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "-")); + AcpiOsPrintf ("-"); } - else if (AcpiNsExistDownstreamSibling (ThisNode->Child)) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "+")); + AcpiOsPrintf ("+"); } - else { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "-")); + AcpiOsPrintf ("-"); } } } - /* Check the integrity of our data */ if (Type > INTERNAL_TYPE_MAX) { - Type = INTERNAL_TYPE_DEF_ANY; /* prints as *ERROR* */ + Type = INTERNAL_TYPE_DEF_ANY; /* prints as *ERROR* */ } if (!AcpiUtValidAcpiName (ThisNode->Name)) @@ -316,10 +352,10 @@ AcpiNsDumpOneObject ( /* * Now we can print out the pertinent information */ - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " %4.4s %-12s %p", - (char*)&ThisNode->Name, AcpiUtGetTypeName (Type), ThisNode)); + AcpiOsPrintf (" %4.4s %-12s %p", + (char *) &ThisNode->Name, AcpiUtGetTypeName (Type), ThisNode); - ObjDesc = ThisNode->Object; + ObjDesc = AcpiNsGetAttachedObject (ThisNode); switch (Info->DisplayType) { @@ -329,116 +365,116 @@ AcpiNsDumpOneObject ( { /* No attached object, we are done */ - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n")); + AcpiOsPrintf ("\n"); return (AE_OK); } - switch (Type) { case ACPI_TYPE_PROCESSOR: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " ID %d Addr %.4X Len %.4X\n", + AcpiOsPrintf (" ID %d Addr %.4X Len %.4X\n", ObjDesc->Processor.ProcId, ObjDesc->Processor.Address, - ObjDesc->Processor.Length)); + ObjDesc->Processor.Length); break; case ACPI_TYPE_DEVICE: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Notification object: %p", ObjDesc)); + AcpiOsPrintf (" Notification object: %p", ObjDesc); break; case ACPI_TYPE_METHOD: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Args %d Len %.4X Aml %p \n", + AcpiOsPrintf (" Args %d Len %.4X Aml %p \n", ObjDesc->Method.ParamCount, ObjDesc->Method.AmlLength, - ObjDesc->Method.AmlStart)); + ObjDesc->Method.AmlStart); break; case ACPI_TYPE_INTEGER: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " = %8.8X%8.8X\n", + AcpiOsPrintf (" = %8.8X%8.8X\n", HIDWORD (ObjDesc->Integer.Value), - LODWORD (ObjDesc->Integer.Value))); + LODWORD (ObjDesc->Integer.Value)); break; case ACPI_TYPE_PACKAGE: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Elements %.2X\n", - ObjDesc->Package.Count)); + AcpiOsPrintf (" Elements %.2X\n", + ObjDesc->Package.Count); break; case ACPI_TYPE_BUFFER: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Len %.2X", - ObjDesc->Buffer.Length)); + AcpiOsPrintf (" Len %.2X", + ObjDesc->Buffer.Length); /* Dump some of the buffer */ if (ObjDesc->Buffer.Length > 0) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " =")); + AcpiOsPrintf (" ="); for (i = 0; (i < ObjDesc->Buffer.Length && i < 12); i++) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " %.2X", - ObjDesc->Buffer.Pointer[i])); + AcpiOsPrintf (" %.2X", ObjDesc->Buffer.Pointer[i]); } } - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n")); + AcpiOsPrintf ("\n"); break; case ACPI_TYPE_STRING: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Len %.2X", - ObjDesc->String.Length)); - + AcpiOsPrintf (" Len %.2X", ObjDesc->String.Length); + if (ObjDesc->String.Length > 0) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " = \"%.32s\"...", - ObjDesc->String.Pointer)); + AcpiOsPrintf (" = \"%.32s\"...", ObjDesc->String.Pointer); } - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n")); + AcpiOsPrintf ("\n"); break; case ACPI_TYPE_REGION: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " [%s]", - AcpiUtGetRegionName (ObjDesc->Region.SpaceId))); + AcpiOsPrintf (" [%s]", AcpiUtGetRegionName (ObjDesc->Region.SpaceId)); if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Addr %8.8X%8.8X Len %.4X\n", + AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n", HIDWORD(ObjDesc->Region.Address), LODWORD(ObjDesc->Region.Address), - ObjDesc->Region.Length)); + ObjDesc->Region.Length); } else { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " [Address/Length not evaluated]\n")); + AcpiOsPrintf (" [Address/Length not evaluated]\n"); } break; case INTERNAL_TYPE_REFERENCE: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " [%s]\n", - AcpiPsGetOpcodeName (ObjDesc->Reference.Opcode))); + AcpiOsPrintf (" [%s]\n", + AcpiPsGetOpcodeName (ObjDesc->Reference.Opcode)); break; case ACPI_TYPE_BUFFER_FIELD: - - /* TBD: print Buffer name when we can easily get it */ + if (ObjDesc->BufferField.BufferObj && + ObjDesc->BufferField.BufferObj->Buffer.Node) + { + AcpiOsPrintf (" Buf [%4.4s]", + (char *) &ObjDesc->BufferField.BufferObj->Buffer.Node->Name); + } break; case INTERNAL_TYPE_REGION_FIELD: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Rgn [%4.4s]", - (char *) &ObjDesc->CommonField.RegionObj->Region.Node->Name)); + AcpiOsPrintf (" Rgn [%4.4s]", + (char *) &ObjDesc->CommonField.RegionObj->Region.Node->Name); break; case INTERNAL_TYPE_BANK_FIELD: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Rgn [%4.4s]", - (char *) &ObjDesc->CommonField.RegionObj->Region.Node->Name)); + AcpiOsPrintf (" Rgn [%4.4s] Bnk [%4.4s]", + (char *) &ObjDesc->CommonField.RegionObj->Region.Node->Name, + (char *) &ObjDesc->BankField.BankObj->CommonField.Node->Name); break; case INTERNAL_TYPE_INDEX_FIELD: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Rgn [%4.4s]", - (char *) &ObjDesc->IndexField.IndexObj->CommonField.RegionObj->Region.Node->Name)); + AcpiOsPrintf (" Idx [%4.4s] Dat [%4.4s]", + (char *) &ObjDesc->IndexField.IndexObj->CommonField.Node->Name, + (char *) &ObjDesc->IndexField.DataObj->CommonField.Node->Name); break; default: - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Object %p\n", ObjDesc)); + AcpiOsPrintf (" Object %p\n", ObjDesc); break; } @@ -450,10 +486,11 @@ AcpiNsDumpOneObject ( case INTERNAL_TYPE_REGION_FIELD: case INTERNAL_TYPE_BANK_FIELD: case INTERNAL_TYPE_INDEX_FIELD: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Off %.2X Len %.2X Acc %.2d\n", - (ObjDesc->CommonField.BaseByteOffset * 8) + ObjDesc->CommonField.StartFieldBitOffset, - ObjDesc->CommonField.BitLength, - ObjDesc->CommonField.AccessBitWidth)); + AcpiOsPrintf (" Off %.2X Len %.2X Acc %.2d\n", + (ObjDesc->CommonField.BaseByteOffset * 8) + + ObjDesc->CommonField.StartFieldBitOffset, + ObjDesc->CommonField.BitLength, + ObjDesc->CommonField.AccessBitWidth); break; } @@ -462,64 +499,59 @@ AcpiNsDumpOneObject ( case ACPI_DISPLAY_OBJECTS: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "%p O:%p", - ThisNode, ObjDesc)); + AcpiOsPrintf ("%p O:%p", + ThisNode, ObjDesc); if (!ObjDesc) { /* No attached object, we are done */ - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n")); + AcpiOsPrintf ("\n"); return (AE_OK); } - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(R%d)", - ObjDesc->Common.ReferenceCount)); + AcpiOsPrintf ("(R%d)", + ObjDesc->Common.ReferenceCount); switch (Type) { - case ACPI_TYPE_METHOD: /* Name is a Method and its AML offset/length are set */ - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " M:%p-%X\n", - ObjDesc->Method.AmlStart, - ObjDesc->Method.AmlLength)); - + AcpiOsPrintf (" M:%p-%X\n", ObjDesc->Method.AmlStart, + ObjDesc->Method.AmlLength); break; - case ACPI_TYPE_INTEGER: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " N:%X%X\n", - HIDWORD(ObjDesc->Integer.Value), - LODWORD(ObjDesc->Integer.Value))); + AcpiOsPrintf (" N:%X%X\n", HIDWORD(ObjDesc->Integer.Value), + LODWORD(ObjDesc->Integer.Value)); break; - case ACPI_TYPE_STRING: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " S:%p-%X\n", - ObjDesc->String.Pointer, - ObjDesc->String.Length)); + AcpiOsPrintf (" S:%p-%X\n", ObjDesc->String.Pointer, + ObjDesc->String.Length); break; - case ACPI_TYPE_BUFFER: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " B:%p-%X\n", - ObjDesc->Buffer.Pointer, - ObjDesc->Buffer.Length)); + AcpiOsPrintf (" B:%p-%X\n", ObjDesc->Buffer.Pointer, + ObjDesc->Buffer.Length); break; - default: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n")); + AcpiOsPrintf ("\n"); break; } break; + + + default: + AcpiOsPrintf ("\n"); + break; } /* If debug turned off, done */ @@ -532,7 +564,7 @@ AcpiNsDumpOneObject ( /* If there is an attached object, display it */ - ObjDesc = ThisNode->Object; + ObjDesc = AcpiNsGetAttachedObject (ThisNode); /* Dump attached objects */ @@ -542,36 +574,33 @@ AcpiNsDumpOneObject ( /* Decode the type of attached object and dump the contents */ - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " Attached Object %p: ", ObjDesc)); + AcpiOsPrintf (" Attached Object %p: ", ObjDesc); if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED)) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(Ptr to Node)\n")); + AcpiOsPrintf ("(Ptr to Node)\n"); BytesToDump = sizeof (ACPI_NAMESPACE_NODE); } - else if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_INTERNAL)) { ObjType = ObjDesc->Common.Type; if (ObjType > INTERNAL_TYPE_MAX) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(Ptr to ACPI Object type %X [UNKNOWN])\n", ObjType)); + AcpiOsPrintf ("(Ptr to ACPI Object type %X [UNKNOWN])\n", ObjType); BytesToDump = 32; } - else { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(Ptr to ACPI Object type %2.2X [%s])\n", - ObjType, AcpiUtGetTypeName (ObjType))); + AcpiOsPrintf ("(Ptr to ACPI Object type %2.2X [%s])\n", + ObjType, AcpiUtGetTypeName (ObjType)); BytesToDump = sizeof (ACPI_OPERAND_OBJECT); } } - else { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "(String or Buffer - not descriptor)\n")); + AcpiOsPrintf ("(String or Buffer - not descriptor)\n"); BytesToDump = 16; } @@ -625,11 +654,11 @@ AcpiNsDumpOneObject ( goto Cleanup; } - ObjType = INTERNAL_TYPE_INVALID; /* Terminate loop after next pass */ + ObjType = INTERNAL_TYPE_INVALID; /* Terminate loop after next pass */ } Cleanup: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "\n")); + AcpiOsPrintf ("\n"); return (AE_OK); } @@ -799,7 +828,7 @@ AcpiNsDumpTables ( } - AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth, + AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth, ACPI_UINT32_MAX, SearchHandle); return_VOID; } @@ -829,6 +858,7 @@ AcpiNsDumpEntry ( Info.DebugLevel = DebugLevel; Info.OwnerId = ACPI_UINT32_MAX; + Info.DisplayType = ACPI_DISPLAY_SUMMARY; AcpiNsDumpOneObject (Handle, 1, &Info, NULL); } diff --git a/sys/contrib/dev/acpica/nseval.c b/sys/contrib/dev/acpica/nseval.c index 2cf9149..d863fac 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: 102 $ + * $Revision: 104 $ * ******************************************************************************/ @@ -217,7 +217,7 @@ AcpiNsEvaluateRelative ( * to evaluate it. */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s [%p] Value %p\n", - Pathname, Node, Node->Object)); + Pathname, Node, AcpiNsGetAttachedObject (Node))); Status = AcpiNsEvaluateByHandle (Node, Params, ReturnObject); @@ -295,7 +295,7 @@ AcpiNsEvaluateByName ( * to evaluate it. */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s [%p] Value %p\n", - Pathname, Node, Node->Object)); + Pathname, Node, AcpiNsGetAttachedObject (Node))); Status = AcpiNsEvaluateByHandle (Node, Params, ReturnObject); @@ -498,7 +498,7 @@ AcpiNsExecuteControlMethod ( DUMP_PATHNAME (MethodNode, "NsExecuteControlMethod: Executing", ACPI_LV_NAMES, _COMPONENT); - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "At offset %p\n", + ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "At offset %p\n", ObjDesc->Method.AmlStart + 1)); diff --git a/sys/contrib/dev/acpica/nsinit.c b/sys/contrib/dev/acpica/nsinit.c index 2456efc..9e6765b 100644 --- a/sys/contrib/dev/acpica/nsinit.c +++ b/sys/contrib/dev/acpica/nsinit.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nsinit - namespace initialization - * $Revision: 33 $ + * $Revision: 35 $ * *****************************************************************************/ @@ -279,7 +279,7 @@ AcpiNsInitOneObject ( /* And even then, we are only interested in a few object types */ Type = AcpiNsGetType (ObjHandle); - ObjDesc = Node->Object; + ObjDesc = AcpiNsGetAttachedObject (Node); if (!ObjDesc) { return (AE_OK); @@ -412,7 +412,7 @@ AcpiNsInitOneDevice ( if (!Node) { AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return (AE_BAD_PARAMETER); + return_ACPI_STATUS (AE_BAD_PARAMETER); } AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); diff --git a/sys/contrib/dev/acpica/nsload.c b/sys/contrib/dev/acpica/nsload.c index cef3b64..f3de362 100644 --- a/sys/contrib/dev/acpica/nsload.c +++ b/sys/contrib/dev/acpica/nsload.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nsload - namespace loading/expanding/contracting procedures - * $Revision: 47 $ + * $Revision: 48 $ * *****************************************************************************/ @@ -232,7 +232,7 @@ AcpiNsOneCompleteParse ( return_ACPI_STATUS (AE_NO_MEMORY); } - Status = AcpiDsInitAmlWalk (WalkState, ParseRoot, NULL, TableDesc->AmlStart, + Status = AcpiDsInitAmlWalk (WalkState, ParseRoot, NULL, TableDesc->AmlStart, TableDesc->AmlLength, NULL, NULL, PassNumber); if (ACPI_FAILURE (Status)) { @@ -315,7 +315,7 @@ AcpiNsParseTable ( * FUNCTION: AcpiNsLoadTable * * PARAMETERS: TableDesc - Descriptor for table to be loaded - * Node - Owning NS node + * Node - Owning NS node * * RETURN: Status * diff --git a/sys/contrib/dev/acpica/nsnames.c b/sys/contrib/dev/acpica/nsnames.c index 44731d2..644141c 100644 --- a/sys/contrib/dev/acpica/nsnames.c +++ b/sys/contrib/dev/acpica/nsnames.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: nsnames - Name manipulation and search - * $Revision: 64 $ + * $Revision: 65 $ * ******************************************************************************/ @@ -250,13 +250,6 @@ AcpiNsGetPathnameLength ( Size += PATH_SEGMENT_LENGTH; } - /* Special case for size still 0 - no parent for "special" nodes */ - - if (!Size) - { - Size = PATH_SEGMENT_LENGTH; - } - return (Size + 1); } @@ -327,6 +320,13 @@ AcpiNsHandleToPathname ( goto Exit; } + if (Size < ACPI_NAME_SIZE) + { + UserBuffer[0] = '\\'; + UserBuffer[1] = 0; + goto Exit; + } + /* Store null terminator */ UserBuffer[Size] = 0; diff --git a/sys/contrib/dev/acpica/nsobject.c b/sys/contrib/dev/acpica/nsobject.c index 05bfd79..a6166c5 100644 --- a/sys/contrib/dev/acpica/nsobject.c +++ b/sys/contrib/dev/acpica/nsobject.c @@ -2,7 +2,7 @@ * * Module Name: nsobject - Utilities for objects attached to namespace * table entries - * $Revision: 67 $ + * $Revision: 73 $ * ******************************************************************************/ @@ -141,6 +141,8 @@ * DESCRIPTION: Record the given object as the value associated with the * name whose ACPI_HANDLE is passed. If Object is NULL * and Type is ACPI_TYPE_ANY, set the name as having no value. + * Note: Future may require that the Node->Flags field be passed + * as a parameter. * * MUTEX: Assumes namespace is locked * @@ -153,9 +155,8 @@ AcpiNsAttachObject ( ACPI_OBJECT_TYPE8 Type) { ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OPERAND_OBJECT *PreviousObjDesc; - ACPI_OBJECT_TYPE8 ObjType = ACPI_TYPE_ANY; - UINT8 Flags; + ACPI_OPERAND_OBJECT *LastObjDesc; + ACPI_OBJECT_TYPE8 ObjectType = ACPI_TYPE_ANY; FUNCTION_TRACE ("NsAttachObject"); @@ -164,14 +165,6 @@ AcpiNsAttachObject ( /* * Parameter validation */ - if (!AcpiGbl_RootNode) - { - /* Name space not initialized */ - - REPORT_ERROR (("NsAttachObject: Namespace not initialized\n")); - return_ACPI_STATUS (AE_NO_NAMESPACE); - } - if (!Node) { /* Invalid handle */ @@ -206,19 +199,12 @@ AcpiNsAttachObject ( return_ACPI_STATUS (AE_OK); } - - /* Get the current flags field of the Node */ - - Flags = Node->Flags; - Flags &= ~ANOBJ_AML_ATTACHMENT; - - /* If null object, we will just install it */ if (!Object) { - ObjDesc = NULL; - ObjType = ACPI_TYPE_ANY; + ObjDesc = NULL; + ObjectType = ACPI_TYPE_ANY; } /* @@ -232,19 +218,10 @@ AcpiNsAttachObject ( * Value passed is a name handle and that name has a * non-null value. Use that name's value and type. */ - ObjDesc = ((ACPI_NAMESPACE_NODE *) Object)->Object; - ObjType = ((ACPI_NAMESPACE_NODE *) Object)->Type; - - /* - * Copy appropriate flags - */ - if (((ACPI_NAMESPACE_NODE *) Object)->Flags & ANOBJ_AML_ATTACHMENT) - { - Flags |= ANOBJ_AML_ATTACHMENT; - } + ObjDesc = ((ACPI_NAMESPACE_NODE *) Object)->Object; + ObjectType = ((ACPI_NAMESPACE_NODE *) Object)->Type; } - /* * Otherwise, we will use the parameter object, but we must type * it first @@ -257,41 +234,16 @@ AcpiNsAttachObject ( if (ACPI_TYPE_ANY != Type) { - ObjType = Type; + ObjectType = Type; } - else { - /* - * Cannot figure out the type -- set to DefAny which - * will print as an error in the name table dump - */ - if (AcpiDbgLevel > 0) - { - DUMP_PATHNAME (Node, - "NsAttachObject confused: setting bogus type for ", - ACPI_LV_INFO, _COMPONENT); - - if (VALID_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_NAMED)) - { - DUMP_PATHNAME (Object, "name ", ACPI_LV_INFO, _COMPONENT); - } - - else - { - DUMP_PATHNAME (Object, "object ", ACPI_LV_INFO, _COMPONENT); - DUMP_STACK_ENTRY (Object); - } - } - - ObjType = INTERNAL_TYPE_DEF_ANY; + ObjectType = INTERNAL_TYPE_DEF_ANY; } } - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Installing %p into Node %p [%4.4s]\n", - ObjDesc, Node, (char*)&Node->Name)); - + ObjDesc, Node, (char *) &Node->Name)); /* * Must increment the new value's reference count @@ -299,30 +251,30 @@ AcpiNsAttachObject ( */ AcpiUtAddReference (ObjDesc); - /* Save the existing object (if any) for deletion later */ + /* Detach an existing attached object if present */ - PreviousObjDesc = Node->Object; - - /* Install the object and set the type, flags */ - - Node->Object = ObjDesc; - Node->Type = (UINT8) ObjType; - Node->Flags |= Flags; + if (Node->Object) + { + AcpiNsDetachObject (Node); + } - /* - * Delete an existing attached object. + /* + * Handle objects with multiple descriptors - walk + * to the end of the descriptor list */ - if (PreviousObjDesc) + LastObjDesc = ObjDesc; + while (LastObjDesc->Common.NextObject) { - /* One for the attach to the Node */ + LastObjDesc = LastObjDesc->Common.NextObject; + } - AcpiUtRemoveReference (PreviousObjDesc); + /* Install the object at the front of the object list */ - /* Now delete */ + LastObjDesc->Common.NextObject = Node->Object; - AcpiUtRemoveReference (PreviousObjDesc); - } + Node->Type = (UINT8) ObjectType; + Node->Object = ObjDesc; return_ACPI_STATUS (AE_OK); } @@ -353,7 +305,8 @@ AcpiNsDetachObject ( ObjDesc = Node->Object; - if (!ObjDesc) + if (!ObjDesc || + (ObjDesc->Common.Type == INTERNAL_TYPE_DATA)) { return_VOID; } @@ -361,9 +314,22 @@ AcpiNsDetachObject ( /* Clear the entry in all cases */ Node->Object = NULL; + if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_INTERNAL)) + { + Node->Object = ObjDesc->Common.NextObject; + if (Node->Object && + (Node->Object->Common.Type != INTERNAL_TYPE_DATA)) + { + Node->Object = Node->Object->Common.NextObject; + } + } + + /* Reset the node type to untyped */ + + Node->Type = ACPI_TYPE_ANY; ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Object=%p Value=%p Name %4.4s\n", - Node, ObjDesc, (char*)&Node->Name)); + Node, ObjDesc, (char *) &Node->Name)); /* Remove one reference on the object (and all subobjects) */ @@ -383,7 +349,7 @@ AcpiNsDetachObject ( * ******************************************************************************/ -void * +ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject ( ACPI_NAMESPACE_NODE *Node) { @@ -392,13 +358,205 @@ AcpiNsGetAttachedObject ( if (!Node) { - /* handle invalid */ - ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Null Node ptr\n")); return_PTR (NULL); } + if (!Node->Object || + ((!(VALID_DESCRIPTOR_TYPE (Node->Object, ACPI_DESC_TYPE_INTERNAL))) && + (!(VALID_DESCRIPTOR_TYPE (Node->Object, ACPI_DESC_TYPE_NAMED)))) || + (Node->Object->Common.Type == INTERNAL_TYPE_DATA)) + { + return_PTR (NULL); + } + return_PTR (Node->Object); } +/******************************************************************************* + * + * FUNCTION: AcpiNsGetSecondaryObject + * + * PARAMETERS: Node - Parent Node to be examined + * + * RETURN: Current value of the object field from the Node whose + * handle is passed + * + ******************************************************************************/ + +ACPI_OPERAND_OBJECT * +AcpiNsGetSecondaryObject ( + ACPI_OPERAND_OBJECT *ObjDesc) +{ + FUNCTION_TRACE_PTR ("AcpiNsGetSecondaryObject", ObjDesc); + + + if ((!ObjDesc) || + (ObjDesc->Common.Type == INTERNAL_TYPE_DATA) || + (!ObjDesc->Common.NextObject) || + (ObjDesc->Common.NextObject->Common.Type == INTERNAL_TYPE_DATA)) + { + return_PTR (NULL); + } + + return_PTR (ObjDesc->Common.NextObject); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiNsAttachData + * + * PARAMETERS: + * + * RETURN: Status + * + * DESCRIPTION: + * + ******************************************************************************/ + +ACPI_STATUS +AcpiNsAttachData ( + ACPI_NAMESPACE_NODE *Node, + ACPI_OBJECT_HANDLER Handler, + void *Data) +{ + ACPI_OPERAND_OBJECT *PrevObjDesc; + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_OPERAND_OBJECT *DataDesc; + + + + /* */ + PrevObjDesc = NULL; + ObjDesc = Node->Object; + while (ObjDesc) + { + if ((ObjDesc->Common.Type == INTERNAL_TYPE_DATA) && + (ObjDesc->Data.Handler == Handler)) + { + return (AE_ALREADY_EXISTS); + } + + PrevObjDesc = ObjDesc; + ObjDesc = ObjDesc->Common.NextObject; + } + + + /* Create an internal object for the data */ + + DataDesc = AcpiUtCreateInternalObject (INTERNAL_TYPE_DATA); + if (!DataDesc) + { + return (AE_NO_MEMORY); + } + + DataDesc->Data.Handler = Handler; + DataDesc->Data.Pointer = Data; + + + /* Install the data object */ + + if (PrevObjDesc) + { + PrevObjDesc->Common.NextObject = DataDesc; + } + else + { + Node->Object = DataDesc; + } + + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiNsDetachData + * + * PARAMETERS: + * + * RETURN: Status + * + * DESCRIPTION: + * + ******************************************************************************/ + +ACPI_STATUS +AcpiNsDetachData ( + ACPI_NAMESPACE_NODE *Node, + ACPI_OBJECT_HANDLER Handler) +{ + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_OPERAND_OBJECT *PrevObjDesc; + + + PrevObjDesc = NULL; + ObjDesc = Node->Object; + while (ObjDesc) + { + if ((ObjDesc->Common.Type == INTERNAL_TYPE_DATA) && + (ObjDesc->Data.Handler == Handler)) + { + if (PrevObjDesc) + { + PrevObjDesc->Common.NextObject = ObjDesc->Common.NextObject; + } + else + { + Node->Object = ObjDesc->Common.NextObject; + } + + AcpiUtRemoveReference (ObjDesc); + return (AE_OK); + } + + PrevObjDesc = ObjDesc; + ObjDesc = ObjDesc->Common.NextObject; + } + + return (AE_NOT_FOUND); +} + + + +/******************************************************************************* + * + * FUNCTION: AcpiNsGetAttachedData + * + * PARAMETERS: + * + * RETURN: Status + * + * DESCRIPTION: + * + ******************************************************************************/ + +ACPI_STATUS +AcpiNsGetAttachedData ( + ACPI_NAMESPACE_NODE *Node, + ACPI_OBJECT_HANDLER Handler, + void **Data) +{ + ACPI_OPERAND_OBJECT *ObjDesc; + + + ObjDesc = Node->Object; + while (ObjDesc) + { + if ((ObjDesc->Common.Type == INTERNAL_TYPE_DATA) && + (ObjDesc->Data.Handler == Handler)) + { + *Data = ObjDesc->Data.Pointer; + return (AE_OK); + } + + ObjDesc = ObjDesc->Common.NextObject; + } + + return (AE_NOT_FOUND); +} + + + diff --git a/sys/contrib/dev/acpica/nssearch.c b/sys/contrib/dev/acpica/nssearch.c index 2992f86..0ca44cc 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: 75 $ + * $Revision: 77 $ * ******************************************************************************/ @@ -174,14 +174,13 @@ AcpiNsSearchNode ( if (ScopeName) { ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching %s [%p] For %4.4s (type %X)\n", - ScopeName, Node, (char*)&TargetName, Type)); + ScopeName, Node, (char *) &TargetName, Type)); ACPI_MEM_FREE (ScopeName); } } #endif - /* * Search for name in this table, which is to say that we must search * for the name among the children of this object @@ -222,13 +221,12 @@ AcpiNsSearchNode ( ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Name %4.4s (actual type %X) found at %p\n", - (char*)&TargetName, NextNode->Type, NextNode)); + (char *) &TargetName, NextNode->Type, NextNode)); *ReturnNode = NextNode; return_ACPI_STATUS (AE_OK); } - /* * The last entry in the list points back to the parent, * so a flag is used to indicate the end-of-list @@ -245,11 +243,10 @@ AcpiNsSearchNode ( NextNode = NextNode->Peer; } - /* Searched entire table, not found */ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Name %4.4s (type %X) not found at %p\n", - (char*)&TargetName, Type, NextNode)); + (char *) &TargetName, Type, NextNode)); return_ACPI_STATUS (AE_NOT_FOUND); } @@ -306,22 +303,21 @@ AcpiNsSearchParentTree ( if (!ParentNode) { ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] has no parent\n", - (char*)&TargetName)); + (char *) &TargetName)); } if (AcpiNsLocal (Type)) { ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] type %X is local(no search)\n", - (char*)&TargetName, Type)); + (char *) &TargetName, Type)); } return_ACPI_STATUS (AE_NOT_FOUND); } - /* Search the parent tree */ - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching parent for %4.4s\n", (char*)&TargetName)); + ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Searching parent for %4.4s\n", (char *) &TargetName)); /* * Search parents until found the target or we have backed up to @@ -329,12 +325,13 @@ AcpiNsSearchParentTree ( */ while (ParentNode) { - /* Search parent scope */ - /* TBD: [Investigate] Why ACPI_TYPE_ANY? */ - + /* + * Search parent scope. Use TYPE_ANY because we don't care about the + * object type at this point, we only care about the existence of + * the actual name we are searching for. Typechecking comes later. + */ Status = AcpiNsSearchNode (TargetName, ParentNode, ACPI_TYPE_ANY, ReturnNode); - if (ACPI_SUCCESS (Status)) { return_ACPI_STATUS (Status); @@ -347,7 +344,6 @@ AcpiNsSearchParentTree ( ParentNode = AcpiNsGetParentObject (ParentNode); } - /* Not found in parent tree */ return_ACPI_STATUS (AE_NOT_FOUND); @@ -407,7 +403,6 @@ AcpiNsSearchAndEnter ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* Name must consist of printable characters */ if (!AcpiUtValidAcpiName (TargetName)) @@ -419,7 +414,6 @@ AcpiNsSearchAndEnter ( return_ACPI_STATUS (AE_BAD_CHARACTER); } - /* Try to find the name in the table specified by the caller */ *ReturnNode = ENTRY_NOT_FOUND; @@ -433,7 +427,7 @@ AcpiNsSearchAndEnter ( if ((Status == AE_OK) && (Flags & NS_ERROR_IF_FOUND)) { - Status = AE_EXIST; + Status = AE_ALREADY_EXISTS; } /* @@ -443,9 +437,8 @@ AcpiNsSearchAndEnter ( return_ACPI_STATUS (Status); } - /* - * Not found in the table. If we are NOT performing the + * The name was not found. If we are NOT performing the * first pass (name entry) of loading the namespace, search * the parent tree (all the way to the root if necessary.) * We don't want to perform the parent search when the @@ -468,19 +461,17 @@ AcpiNsSearchAndEnter ( } } - /* * In execute mode, just search, never add names. Exit now. */ if (InterpreterMode == IMODE_EXECUTE) { ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%4.4s Not found in %p [Not adding]\n", - (char*)&TargetName, Node)); + (char *) &TargetName, Node)); return_ACPI_STATUS (AE_NOT_FOUND); } - /* Create the new named object */ NewNode = AcpiNsCreateNode (TargetName); diff --git a/sys/contrib/dev/acpica/nsutils.c b/sys/contrib/dev/acpica/nsutils.c index 1a8363e..c3d7cc1 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: 92 $ + * $Revision: 93 $ * *****************************************************************************/ @@ -690,6 +690,9 @@ AcpiNsExternalizeName ( * * DESCRIPTION: Convert a namespace handle to a real Node * + * Note: Real integer handles allow for more verification + * and keep all pointers within this subsystem. + * ******************************************************************************/ ACPI_NAMESPACE_NODE * @@ -701,9 +704,7 @@ AcpiNsMapHandleToNode ( /* - * Simple implementation for now; - * TBD: [Future] Real integer handles allow for more verification - * and keep all pointers within this subsystem! + * Simple implementation. */ if (!Handle) { @@ -715,7 +716,6 @@ AcpiNsMapHandleToNode ( return (AcpiGbl_RootNode); } - /* We can at least attempt to verify the handle */ if (!VALID_DESCRIPTOR_TYPE (Handle, ACPI_DESC_TYPE_NAMED)) @@ -747,8 +747,6 @@ AcpiNsConvertEntryToHandle ( /* * Simple implementation for now; - * TBD: [Future] Real integer handles allow for more verification - * and keep all pointers within this subsystem! */ return ((ACPI_HANDLE) Node); diff --git a/sys/contrib/dev/acpica/nsxfobj.c b/sys/contrib/dev/acpica/nsxfobj.c index 6012593..fc0ee50 100644 --- a/sys/contrib/dev/acpica/nsxfobj.c +++ b/sys/contrib/dev/acpica/nsxfobj.c @@ -2,7 +2,7 @@ * * Module Name: nsxfobj - Public interfaces to the ACPI subsystem * ACPI Object oriented interfaces - * $Revision: 95 $ + * $Revision: 98 $ * ******************************************************************************/ @@ -134,7 +134,7 @@ * * PARAMETERS: Handle - Object handle (optional) * *Pathname - Object pathname (optional) - * **ExternalParams - List of parameters to pass to method, + * **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 @@ -641,8 +641,8 @@ AcpiWalkNamespace ( * must be allowed to make Acpi calls itself. */ AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - Status = AcpiNsWalkNamespace ((ACPI_OBJECT_TYPE8) Type, StartObject, - MaxDepth, NS_WALK_UNLOCK, UserFunction, Context, + Status = AcpiNsWalkNamespace ((ACPI_OBJECT_TYPE8) Type, StartObject, + MaxDepth, NS_WALK_UNLOCK, UserFunction, Context, ReturnValue); AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); @@ -675,7 +675,8 @@ AcpiNsGetDeviceCallback ( ACPI_STATUS Status; ACPI_NAMESPACE_NODE *Node; UINT32 Flags; - ACPI_DEVICE_ID DeviceId; + ACPI_DEVICE_ID Hid; + ACPI_DEVICE_ID Cid; ACPI_GET_DEVICES_INFO *Info; @@ -701,16 +702,16 @@ AcpiNsGetDeviceCallback ( if (!(Flags & 0x01)) { - /* don't return at the device or children of the device if not there */ + /* Don't return at the device or children of the device if not there */ return (AE_CTRL_DEPTH); } /* - * Filter based on device HID + * Filter based on device HID & CID */ if (Info->Hid != NULL) { - Status = AcpiUtExecute_HID (Node, &DeviceId); + Status = AcpiUtExecute_HID (Node, &Hid); if (Status == AE_NOT_FOUND) { return (AE_OK); @@ -721,9 +722,25 @@ AcpiNsGetDeviceCallback ( return (AE_CTRL_DEPTH); } - if (STRNCMP (DeviceId.Buffer, Info->Hid, sizeof (DeviceId.Buffer)) != 0) + if (STRNCMP (Hid.Buffer, Info->Hid, sizeof (Hid.Buffer)) != 0) { - return (AE_OK); + Status = AcpiUtExecute_CID (Node, &Cid); + if (Status == AE_NOT_FOUND) + { + return (AE_OK); + } + + else if (ACPI_FAILURE (Status)) + { + return (AE_CTRL_DEPTH); + } + + /* TBD: Handle CID packages */ + + if (STRNCMP (Cid.Buffer, Info->Hid, sizeof (Cid.Buffer)) != 0) + { + return (AE_OK); + } } } @@ -803,3 +820,158 @@ AcpiGetDevices ( return_ACPI_STATUS (Status); } + + +/******************************************************************************* + * + * FUNCTION: AcpiAttachData + * + * PARAMETERS: + * + * RETURN: Status + * + * DESCRIPTION: + * + ******************************************************************************/ + +ACPI_STATUS +AcpiAttachData ( + ACPI_HANDLE ObjHandle, + ACPI_OBJECT_HANDLER Handler, + void *Data) +{ + ACPI_NAMESPACE_NODE *Node; + ACPI_STATUS Status; + + + /* Parameter validation */ + + if (!ObjHandle || + !Handler || + !Data) + { + return (AE_BAD_PARAMETER); + } + + + AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + + /* Convert and validate the handle */ + + Node = AcpiNsMapHandleToNode (ObjHandle); + if (!Node) + { + Status = AE_BAD_PARAMETER; + goto UnlockAndExit; + } + + Status = AcpiNsAttachData (Node, Handler, Data); + +UnlockAndExit: + + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + return (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDetachData + * + * PARAMETERS: + * + * RETURN: Status + * + * DESCRIPTION: + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDetachData ( + ACPI_HANDLE ObjHandle, + ACPI_OBJECT_HANDLER Handler) +{ + ACPI_NAMESPACE_NODE *Node; + ACPI_STATUS Status; + + + /* Parameter validation */ + + if (!ObjHandle || + !Handler) + { + return (AE_BAD_PARAMETER); + } + + AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + + /* Convert and validate the handle */ + + Node = AcpiNsMapHandleToNode (ObjHandle); + if (!Node) + { + Status = AE_BAD_PARAMETER; + goto UnlockAndExit; + } + + Status = AcpiNsDetachData (Node, Handler); + +UnlockAndExit: + + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + return (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiGetData + * + * PARAMETERS: + * + * RETURN: Status + * + * DESCRIPTION: + * + ******************************************************************************/ + +ACPI_STATUS +AcpiGetData ( + ACPI_HANDLE ObjHandle, + ACPI_OBJECT_HANDLER Handler, + void **Data) +{ + ACPI_NAMESPACE_NODE *Node; + ACPI_STATUS Status; + + + /* Parameter validation */ + + if (!ObjHandle || + !Handler || + !Data) + { + return (AE_BAD_PARAMETER); + } + + AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + + /* Convert and validate the handle */ + + Node = AcpiNsMapHandleToNode (ObjHandle); + if (!Node) + { + Status = AE_BAD_PARAMETER; + goto UnlockAndExit; + } + + Status = AcpiNsGetAttachedData (Node, Handler, Data); + +UnlockAndExit: + + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + return (Status); +} + + + diff --git a/sys/contrib/dev/acpica/psargs.c b/sys/contrib/dev/acpica/psargs.c index 44b1848..3597c6b 100644 --- a/sys/contrib/dev/acpica/psargs.c +++ b/sys/contrib/dev/acpica/psargs.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psargs - Parse AML opcode arguments - * $Revision: 52 $ + * $Revision: 54 $ * *****************************************************************************/ @@ -500,12 +500,12 @@ AcpiPsGetNextNamepath ( NameOp->Node = MethodNode; AcpiPsAppendArg (Arg, NameOp); - if (!MethodNode->Object) + if (!AcpiNsGetAttachedObject (MethodNode)) { return_VOID; } - *ArgCount = (MethodNode->Object)->Method.ParamCount; + *ArgCount = (AcpiNsGetAttachedObject (MethodNode))->Method.ParamCount; } return_VOID; @@ -713,11 +713,14 @@ AcpiPsGetNextField ( case AML_INT_ACCESSFIELD_OP: - /* Get AccessType and AccessAtrib and merge into the field Op */ - - Field->Value.Integer = ((GET8 (ParserState->Aml) << 8) | - GET8 (ParserState->Aml)); - ParserState->Aml += 2; + /* + * Get AccessType and AccessAttrib and merge into the field Op + * AccessType is first operand, AccessAttribute is second + */ + Field->Value.Integer32 = (GET8 (ParserState->Aml) << 8); + ParserState->Aml++; + Field->Value.Integer32 |= GET8 (ParserState->Aml); + ParserState->Aml++; break; } } diff --git a/sys/contrib/dev/acpica/psfind.c b/sys/contrib/dev/acpica/psfind.c index 6c2ff13..a65f9aa 100644 --- a/sys/contrib/dev/acpica/psfind.c +++ b/sys/contrib/dev/acpica/psfind.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: psfind - Parse tree search routine - * $Revision: 30 $ + * $Revision: 32 $ * *****************************************************************************/ @@ -138,7 +138,7 @@ * ******************************************************************************/ -static ACPI_PARSE_OBJECT* +ACPI_PARSE_OBJECT* AcpiPsGetParent ( ACPI_PARSE_OBJECT *Op) { @@ -183,7 +183,7 @@ AcpiPsGetParent ( * ******************************************************************************/ -static ACPI_PARSE_OBJECT * +ACPI_PARSE_OBJECT * AcpiPsFindName ( ACPI_PARSE_OBJECT *Scope, UINT32 Name, @@ -220,14 +220,12 @@ AcpiPsFindName ( Field = Field->Next; } } - else if (OpInfo->Flags & AML_CREATE) { if (Op->Opcode == AML_CREATE_FIELD_OP) { Field = AcpiPsGetArg (Op, 3); } - else { /* CreateXXXField, check name */ @@ -242,7 +240,6 @@ AcpiPsFindName ( return (Op); } } - else if ((OpInfo->Flags & AML_NAMED) && (AcpiPsGetName (Op) == Name) && (!Opcode || Op->Opcode == Opcode || Opcode == AML_SCOPE_OP)) @@ -296,17 +293,14 @@ AcpiPsFind ( return_PTR (NULL); } - AcpiGbl_PsFindCount++; - /* Handle all prefixes in the name path */ while (AcpiPsIsPrefixChar (GET8 (Path))) { switch (GET8 (Path)) { - case '\\': /* Could just use a global for "root scope" here */ @@ -315,12 +309,6 @@ AcpiPsFind ( { Scope = Scope->Parent; } - - /* get first object within the scope */ - /* TBD: [Investigate] OR - set next in root scope to point to the same value as arg */ - - /* Scope = Scope->Value.Arg; */ - break; @@ -440,14 +428,12 @@ AcpiPsFind ( { ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "[%4.4s] Found in parent tree! Op=%p Opcode=%4.4X\n", (char*)&Name, Op, Op->Opcode)); } - else { ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "[%4.4s] Not found in parent=%p\n", (char*)&Name, Scope)); } } } - else { ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Segment [%4.4s] Not Found in scope %p!\n", (char*)&Name, Scope)); diff --git a/sys/contrib/dev/acpica/psopcode.c b/sys/contrib/dev/acpica/psopcode.c index a9fc46a..f439f9b 100644 --- a/sys/contrib/dev/acpica/psopcode.c +++ b/sys/contrib/dev/acpica/psopcode.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psopcode - Parser/Interpreter opcode information table - * $Revision: 49 $ + * $Revision: 54 $ * *****************************************************************************/ @@ -275,7 +275,7 @@ #define ARGP_TO_STRING_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) #define ARGP_TYPE_OP ARGP_LIST1 (ARGP_SUPERNAME) #define ARGP_UNLOAD_OP ARGP_LIST1 (ARGP_SUPERNAME) -#define ARGP_VAR_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_BYTEDATA, ARGP_DATAOBJLIST) +#define ARGP_VAR_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_DATAOBJLIST) #define ARGP_WAIT_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG) #define ARGP_WHILE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST) #define ARGP_WORD_OP ARGP_LIST1 (ARGP_WORDDATA) @@ -419,7 +419,7 @@ /****************************************************************************** - Opcodes that have associated namespace objects + Opcodes that have associated namespace objects (AML_NSOBJECT flag) AML_SCOPE_OP AML_DEVICE_OP @@ -445,7 +445,7 @@ AML_INT_METHODCALL_OP AML_INT_NAMEPATH_OP - Opcodes that are "namespace" opcodes + Opcodes that are "namespace" opcodes (AML_NSOPCODE flag) AML_SCOPE_OP AML_DEVICE_OP @@ -463,7 +463,7 @@ AML_REGION_OP AML_INT_NAMEDFIELD_OP - Opcodes that have an associated namespace node + Opcodes that have an associated namespace node (AML_NSNODE flag) AML_SCOPE_OP AML_DEVICE_OP @@ -486,7 +486,7 @@ AML_INT_METHODCALL_OP AML_INT_NAMEPATH_OP - Opcodes that define named ACPI objects + Opcodes that define named ACPI objects (AML_NAMED flag) AML_SCOPE_OP AML_DEVICE_OP @@ -501,8 +501,8 @@ AML_REGION_OP AML_INT_NAMEDFIELD_OP - Opcodes that contain executable AML as part of the definition that - must be deferred until needed + Opcodes that contain executable AML as part of the definition that + must be deferred until needed AML_METHOD_OP AML_VAR_PACKAGE_OP @@ -538,145 +538,145 @@ */ -static const ACPI_OPCODE_INFO AmlOpInfo[] = +static const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[] = { /* Index Name Parser Args Interpreter Args Class Type Flags */ -/* 00 */ ACPI_OP ("Zero", ARGP_ZERO_OP, ARGI_ZERO_OP, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0), -/* 01 */ ACPI_OP ("One", ARGP_ONE_OP, ARGI_ONE_OP, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0), -/* 02 */ ACPI_OP ("Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), -/* 03 */ ACPI_OP ("Name", ARGP_NAME_OP, ARGI_NAME_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), -/* 04 */ ACPI_OP ("ByteConst", ARGP_BYTE_OP, ARGI_BYTE_OP, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0), -/* 05 */ ACPI_OP ("WordConst", ARGP_WORD_OP, ARGI_WORD_OP, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0), -/* 06 */ ACPI_OP ("DwordConst", ARGP_DWORD_OP, ARGI_DWORD_OP, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0), -/* 07 */ ACPI_OP ("String", ARGP_STRING_OP, ARGI_STRING_OP, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0), -/* 08 */ ACPI_OP ("Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), -/* 09 */ ACPI_OP ("Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP, AML_CLASS_ARGUMENT, AML_TYPE_DATA_TERM, AML_HAS_ARGS), -/* 0A */ ACPI_OP ("Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP, AML_CLASS_ARGUMENT, AML_TYPE_DATA_TERM, AML_HAS_ARGS), -/* 0B */ ACPI_OP ("Method", ARGP_METHOD_OP, ARGI_METHOD_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER), -/* 0C */ ACPI_OP ("Local0", ARGP_LOCAL0, ARGI_LOCAL0, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), -/* 0D */ ACPI_OP ("Local1", ARGP_LOCAL1, ARGI_LOCAL1, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), -/* 0E */ ACPI_OP ("Local2", ARGP_LOCAL2, ARGI_LOCAL2, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), -/* 0F */ ACPI_OP ("Local3", ARGP_LOCAL3, ARGI_LOCAL3, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), -/* 10 */ ACPI_OP ("Local4", ARGP_LOCAL4, ARGI_LOCAL4, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), -/* 11 */ ACPI_OP ("Local5", ARGP_LOCAL5, ARGI_LOCAL5, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), -/* 12 */ ACPI_OP ("Local6", ARGP_LOCAL6, ARGI_LOCAL6, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), -/* 13 */ ACPI_OP ("Local7", ARGP_LOCAL7, ARGI_LOCAL7, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), -/* 14 */ ACPI_OP ("Arg0", ARGP_ARG0, ARGI_ARG0, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0), -/* 15 */ ACPI_OP ("Arg1", ARGP_ARG1, ARGI_ARG1, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0), -/* 16 */ ACPI_OP ("Arg2", ARGP_ARG2, ARGI_ARG2, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0), -/* 17 */ ACPI_OP ("Arg3", ARGP_ARG3, ARGI_ARG3, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0), -/* 18 */ ACPI_OP ("Arg4", ARGP_ARG4, ARGI_ARG4, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0), -/* 19 */ ACPI_OP ("Arg5", ARGP_ARG5, ARGI_ARG5, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0), -/* 1A */ ACPI_OP ("Arg6", ARGP_ARG6, ARGI_ARG6, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0), -/* 1B */ ACPI_OP ("Store", ARGP_STORE_OP, ARGI_STORE_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), -/* 1C */ ACPI_OP ("RefOf", ARGP_REF_OF_OP, ARGI_REF_OF_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), -/* 1D */ ACPI_OP ("Add", ARGP_ADD_OP, ARGI_ADD_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH), -/* 1E */ ACPI_OP ("Concatenate", ARGP_CONCAT_OP, ARGI_CONCAT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R), -/* 1F */ ACPI_OP ("Subtract", ARGP_SUBTRACT_OP, ARGI_SUBTRACT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH), -/* 20 */ ACPI_OP ("Increment", ARGP_INCREMENT_OP, ARGI_INCREMENT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), -/* 21 */ ACPI_OP ("Decrement", ARGP_DECREMENT_OP, ARGI_DECREMENT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), -/* 22 */ ACPI_OP ("Multiply", ARGP_MULTIPLY_OP, ARGI_MULTIPLY_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH), -/* 23 */ ACPI_OP ("Divide", ARGP_DIVIDE_OP, ARGI_DIVIDE_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_2T_1R, AML_FLAGS_EXEC_2A_2T_1R), -/* 24 */ ACPI_OP ("ShiftLeft", ARGP_SHIFT_LEFT_OP, ARGI_SHIFT_LEFT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH), -/* 25 */ ACPI_OP ("ShiftRight", ARGP_SHIFT_RIGHT_OP, ARGI_SHIFT_RIGHT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH), -/* 26 */ ACPI_OP ("And", ARGP_BIT_AND_OP, ARGI_BIT_AND_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH), -/* 27 */ ACPI_OP ("NAnd", ARGP_BIT_NAND_OP, ARGI_BIT_NAND_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH), -/* 28 */ ACPI_OP ("Or", ARGP_BIT_OR_OP, ARGI_BIT_OR_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH), -/* 29 */ ACPI_OP ("NOr", ARGP_BIT_NOR_OP, ARGI_BIT_NOR_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH), -/* 2A */ ACPI_OP ("XOr", ARGP_BIT_XOR_OP, ARGI_BIT_XOR_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH), -/* 2B */ ACPI_OP ("Not", ARGP_BIT_NOT_OP, ARGI_BIT_NOT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), -/* 2C */ ACPI_OP ("FindSetLeftBit", ARGP_FIND_SET_LEFT_BIT_OP, ARGI_FIND_SET_LEFT_BIT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), -/* 2D */ ACPI_OP ("FindSetRightBit", ARGP_FIND_SET_RIGHT_BIT_OP,ARGI_FIND_SET_RIGHT_BIT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), -/* 2E */ ACPI_OP ("DerefOf", ARGP_DEREF_OF_OP, ARGI_DEREF_OF_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), -/* 2F */ ACPI_OP ("Notify", ARGP_NOTIFY_OP, ARGI_NOTIFY_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_0R, AML_FLAGS_EXEC_2A_0T_0R), -/* 30 */ ACPI_OP ("SizeOf", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), -/* 31 */ ACPI_OP ("Index", ARGP_INDEX_OP, ARGI_INDEX_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R), -/* 32 */ ACPI_OP ("Match", ARGP_MATCH_OP, ARGI_MATCH_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R), -/* 33 */ ACPI_OP ("CreateDWordField", ARGP_CREATE_DWORD_FIELD_OP,ARGI_CREATE_DWORD_FIELD_OP, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), -/* 34 */ ACPI_OP ("CreateWordField", ARGP_CREATE_WORD_FIELD_OP, ARGI_CREATE_WORD_FIELD_OP, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), -/* 35 */ ACPI_OP ("CreateByteField", ARGP_CREATE_BYTE_FIELD_OP, ARGI_CREATE_BYTE_FIELD_OP, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), -/* 36 */ ACPI_OP ("CreateBitField", ARGP_CREATE_BIT_FIELD_OP, ARGI_CREATE_BIT_FIELD_OP, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), -/* 37 */ ACPI_OP ("ObjectType", ARGP_TYPE_OP, ARGI_TYPE_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), -/* 38 */ ACPI_OP ("LAnd", ARGP_LAND_OP, ARGI_LAND_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL), -/* 39 */ ACPI_OP ("LOr", ARGP_LOR_OP, ARGI_LOR_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL), -/* 3A */ ACPI_OP ("LNot", ARGP_LNOT_OP, ARGI_LNOT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), -/* 3B */ ACPI_OP ("LEqual", ARGP_LEQUAL_OP, ARGI_LEQUAL_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL), -/* 3C */ ACPI_OP ("LGreater", ARGP_LGREATER_OP, ARGI_LGREATER_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL), -/* 3D */ ACPI_OP ("LLess", ARGP_LLESS_OP, ARGI_LLESS_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL), -/* 3E */ ACPI_OP ("If", ARGP_IF_OP, ARGI_IF_OP, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), -/* 3F */ ACPI_OP ("Else", ARGP_ELSE_OP, ARGI_ELSE_OP, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), -/* 40 */ ACPI_OP ("While", ARGP_WHILE_OP, ARGI_WHILE_OP, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), -/* 41 */ ACPI_OP ("Noop", ARGP_NOOP_OP, ARGI_NOOP_OP, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), -/* 42 */ ACPI_OP ("Return", ARGP_RETURN_OP, ARGI_RETURN_OP, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), -/* 43 */ ACPI_OP ("Break", ARGP_BREAK_OP, ARGI_BREAK_OP, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), -/* 44 */ ACPI_OP ("BreakPoint", ARGP_BREAK_POINT_OP, ARGI_BREAK_POINT_OP, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), -/* 45 */ ACPI_OP ("Ones", ARGP_ONES_OP, ARGI_ONES_OP, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0), +/* 00 */ ACPI_OP ("Zero", ARGP_ZERO_OP, ARGI_ZERO_OP, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0), +/* 01 */ ACPI_OP ("One", ARGP_ONE_OP, ARGI_ONE_OP, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0), +/* 02 */ ACPI_OP ("Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP, INTERNAL_TYPE_ALIAS, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), +/* 03 */ ACPI_OP ("Name", ARGP_NAME_OP, ARGI_NAME_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), +/* 04 */ ACPI_OP ("ByteConst", ARGP_BYTE_OP, ARGI_BYTE_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0), +/* 05 */ ACPI_OP ("WordConst", ARGP_WORD_OP, ARGI_WORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0), +/* 06 */ ACPI_OP ("DwordConst", ARGP_DWORD_OP, ARGI_DWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0), +/* 07 */ ACPI_OP ("String", ARGP_STRING_OP, ARGI_STRING_OP, ACPI_TYPE_STRING, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0), +/* 08 */ ACPI_OP ("Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP, INTERNAL_TYPE_SCOPE, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), +/* 09 */ ACPI_OP ("Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP, ACPI_TYPE_BUFFER, AML_CLASS_ARGUMENT, AML_TYPE_DATA_TERM, AML_HAS_ARGS), +/* 0A */ ACPI_OP ("Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_ARGUMENT, AML_TYPE_DATA_TERM, AML_HAS_ARGS), +/* 0B */ ACPI_OP ("Method", ARGP_METHOD_OP, ARGI_METHOD_OP, ACPI_TYPE_METHOD, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER), +/* 0C */ ACPI_OP ("Local0", ARGP_LOCAL0, ARGI_LOCAL0, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), +/* 0D */ ACPI_OP ("Local1", ARGP_LOCAL1, ARGI_LOCAL1, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), +/* 0E */ ACPI_OP ("Local2", ARGP_LOCAL2, ARGI_LOCAL2, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), +/* 0F */ ACPI_OP ("Local3", ARGP_LOCAL3, ARGI_LOCAL3, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), +/* 10 */ ACPI_OP ("Local4", ARGP_LOCAL4, ARGI_LOCAL4, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), +/* 11 */ ACPI_OP ("Local5", ARGP_LOCAL5, ARGI_LOCAL5, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), +/* 12 */ ACPI_OP ("Local6", ARGP_LOCAL6, ARGI_LOCAL6, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), +/* 13 */ ACPI_OP ("Local7", ARGP_LOCAL7, ARGI_LOCAL7, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), +/* 14 */ ACPI_OP ("Arg0", ARGP_ARG0, ARGI_ARG0, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0), +/* 15 */ ACPI_OP ("Arg1", ARGP_ARG1, ARGI_ARG1, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0), +/* 16 */ ACPI_OP ("Arg2", ARGP_ARG2, ARGI_ARG2, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0), +/* 17 */ ACPI_OP ("Arg3", ARGP_ARG3, ARGI_ARG3, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0), +/* 18 */ ACPI_OP ("Arg4", ARGP_ARG4, ARGI_ARG4, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0), +/* 19 */ ACPI_OP ("Arg5", ARGP_ARG5, ARGI_ARG5, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0), +/* 1A */ ACPI_OP ("Arg6", ARGP_ARG6, ARGI_ARG6, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0), +/* 1B */ ACPI_OP ("Store", ARGP_STORE_OP, ARGI_STORE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), +/* 1C */ ACPI_OP ("RefOf", ARGP_REF_OF_OP, ARGI_REF_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), +/* 1D */ ACPI_OP ("Add", ARGP_ADD_OP, ARGI_ADD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH), +/* 1E */ ACPI_OP ("Concatenate", ARGP_CONCAT_OP, ARGI_CONCAT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R), +/* 1F */ ACPI_OP ("Subtract", ARGP_SUBTRACT_OP, ARGI_SUBTRACT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH), +/* 20 */ ACPI_OP ("Increment", ARGP_INCREMENT_OP, ARGI_INCREMENT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), +/* 21 */ ACPI_OP ("Decrement", ARGP_DECREMENT_OP, ARGI_DECREMENT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), +/* 22 */ ACPI_OP ("Multiply", ARGP_MULTIPLY_OP, ARGI_MULTIPLY_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH), +/* 23 */ ACPI_OP ("Divide", ARGP_DIVIDE_OP, ARGI_DIVIDE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_2T_1R, AML_FLAGS_EXEC_2A_2T_1R), +/* 24 */ ACPI_OP ("ShiftLeft", ARGP_SHIFT_LEFT_OP, ARGI_SHIFT_LEFT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH), +/* 25 */ ACPI_OP ("ShiftRight", ARGP_SHIFT_RIGHT_OP, ARGI_SHIFT_RIGHT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH), +/* 26 */ ACPI_OP ("And", ARGP_BIT_AND_OP, ARGI_BIT_AND_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH), +/* 27 */ ACPI_OP ("NAnd", ARGP_BIT_NAND_OP, ARGI_BIT_NAND_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH), +/* 28 */ ACPI_OP ("Or", ARGP_BIT_OR_OP, ARGI_BIT_OR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH), +/* 29 */ ACPI_OP ("NOr", ARGP_BIT_NOR_OP, ARGI_BIT_NOR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH), +/* 2A */ ACPI_OP ("XOr", ARGP_BIT_XOR_OP, ARGI_BIT_XOR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH), +/* 2B */ ACPI_OP ("Not", ARGP_BIT_NOT_OP, ARGI_BIT_NOT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), +/* 2C */ ACPI_OP ("FindSetLeftBit", ARGP_FIND_SET_LEFT_BIT_OP, ARGI_FIND_SET_LEFT_BIT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), +/* 2D */ ACPI_OP ("FindSetRightBit", ARGP_FIND_SET_RIGHT_BIT_OP,ARGI_FIND_SET_RIGHT_BIT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), +/* 2E */ ACPI_OP ("DerefOf", ARGP_DEREF_OF_OP, ARGI_DEREF_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), +/* 2F */ ACPI_OP ("Notify", ARGP_NOTIFY_OP, ARGI_NOTIFY_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_0R, AML_FLAGS_EXEC_2A_0T_0R), +/* 30 */ ACPI_OP ("SizeOf", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), +/* 31 */ ACPI_OP ("Index", ARGP_INDEX_OP, ARGI_INDEX_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R), +/* 32 */ ACPI_OP ("Match", ARGP_MATCH_OP, ARGI_MATCH_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R), +/* 33 */ ACPI_OP ("CreateDWordField", ARGP_CREATE_DWORD_FIELD_OP,ARGI_CREATE_DWORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), +/* 34 */ ACPI_OP ("CreateWordField", ARGP_CREATE_WORD_FIELD_OP, ARGI_CREATE_WORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), +/* 35 */ ACPI_OP ("CreateByteField", ARGP_CREATE_BYTE_FIELD_OP, ARGI_CREATE_BYTE_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), +/* 36 */ ACPI_OP ("CreateBitField", ARGP_CREATE_BIT_FIELD_OP, ARGI_CREATE_BIT_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), +/* 37 */ ACPI_OP ("ObjectType", ARGP_TYPE_OP, ARGI_TYPE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), +/* 38 */ ACPI_OP ("LAnd", ARGP_LAND_OP, ARGI_LAND_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL), +/* 39 */ ACPI_OP ("LOr", ARGP_LOR_OP, ARGI_LOR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL), +/* 3A */ ACPI_OP ("LNot", ARGP_LNOT_OP, ARGI_LNOT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), +/* 3B */ ACPI_OP ("LEqual", ARGP_LEQUAL_OP, ARGI_LEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL), +/* 3C */ ACPI_OP ("LGreater", ARGP_LGREATER_OP, ARGI_LGREATER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL), +/* 3D */ ACPI_OP ("LLess", ARGP_LLESS_OP, ARGI_LLESS_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL), +/* 3E */ ACPI_OP ("If", ARGP_IF_OP, ARGI_IF_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), +/* 3F */ ACPI_OP ("Else", ARGP_ELSE_OP, ARGI_ELSE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), +/* 40 */ ACPI_OP ("While", ARGP_WHILE_OP, ARGI_WHILE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), +/* 41 */ ACPI_OP ("Noop", ARGP_NOOP_OP, ARGI_NOOP_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), +/* 42 */ ACPI_OP ("Return", ARGP_RETURN_OP, ARGI_RETURN_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), +/* 43 */ ACPI_OP ("Break", ARGP_BREAK_OP, ARGI_BREAK_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), +/* 44 */ ACPI_OP ("BreakPoint", ARGP_BREAK_POINT_OP, ARGI_BREAK_POINT_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), +/* 45 */ ACPI_OP ("Ones", ARGP_ONES_OP, ARGI_ONES_OP, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0), /* Prefixed opcodes (Two-byte opcodes with a prefix op) */ -/* 46 */ ACPI_OP ("Mutex", ARGP_MUTEX_OP, ARGI_MUTEX_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), -/* 47 */ ACPI_OP ("Event", ARGP_EVENT_OP, ARGI_EVENT_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED ), -/* 48 */ ACPI_OP ("CondRefOf", ARGP_COND_REF_OF_OP, ARGI_COND_REF_OF_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), -/* 49 */ ACPI_OP ("CreateField", ARGP_CREATE_FIELD_OP, ARGI_CREATE_FIELD_OP, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_FIELD | AML_CREATE), -/* 4A */ ACPI_OP ("Load", ARGP_LOAD_OP, ARGI_LOAD_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_0R, AML_FLAGS_EXEC_1A_1T_0R), -/* 4B */ ACPI_OP ("Stall", ARGP_STALL_OP, ARGI_STALL_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), -/* 4C */ ACPI_OP ("Sleep", ARGP_SLEEP_OP, ARGI_SLEEP_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), -/* 4D */ ACPI_OP ("Acquire", ARGP_ACQUIRE_OP, ARGI_ACQUIRE_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R), -/* 4E */ ACPI_OP ("Signal", ARGP_SIGNAL_OP, ARGI_SIGNAL_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), -/* 4F */ ACPI_OP ("Wait", ARGP_WAIT_OP, ARGI_WAIT_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R), -/* 50 */ ACPI_OP ("Reset", ARGP_RESET_OP, ARGI_RESET_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), -/* 51 */ ACPI_OP ("Release", ARGP_RELEASE_OP, ARGI_RELEASE_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), -/* 52 */ ACPI_OP ("FromBCD", ARGP_FROM_BCD_OP, ARGI_FROM_BCD_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), -/* 53 */ ACPI_OP ("ToBCD", ARGP_TO_BCD_OP, ARGI_TO_BCD_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), -/* 54 */ ACPI_OP ("Unload", ARGP_UNLOAD_OP, ARGI_UNLOAD_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), -/* 55 */ ACPI_OP ("Revision", ARGP_REVISION_OP, ARGI_REVISION_OP, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0), -/* 56 */ ACPI_OP ("Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0), -/* 57 */ ACPI_OP ("Fatal", ARGP_FATAL_OP, ARGI_FATAL_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_0T_0R, AML_FLAGS_EXEC_3A_0T_0R), -/* 58 */ ACPI_OP ("OpRegion", ARGP_REGION_OP, ARGI_REGION_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER), -/* 59 */ ACPI_OP ("Field", ARGP_FIELD_OP, ARGI_FIELD_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD), -/* 5A */ ACPI_OP ("Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), -/* 5B */ ACPI_OP ("Processor", ARGP_PROCESSOR_OP, ARGI_PROCESSOR_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), -/* 5C */ ACPI_OP ("PowerResource", ARGP_POWER_RES_OP, ARGI_POWER_RES_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), -/* 5D */ ACPI_OP ("ThermalZone", ARGP_THERMAL_ZONE_OP, ARGI_THERMAL_ZONE_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), -/* 5E */ ACPI_OP ("IndexField", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD), -/* 5F */ ACPI_OP ("BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD), +/* 46 */ ACPI_OP ("Mutex", ARGP_MUTEX_OP, ARGI_MUTEX_OP, ACPI_TYPE_MUTEX, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), +/* 47 */ ACPI_OP ("Event", ARGP_EVENT_OP, ARGI_EVENT_OP, ACPI_TYPE_EVENT, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED ), +/* 48 */ ACPI_OP ("CondRefOf", ARGP_COND_REF_OF_OP, ARGI_COND_REF_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), +/* 49 */ ACPI_OP ("CreateField", ARGP_CREATE_FIELD_OP, ARGI_CREATE_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_FIELD | AML_CREATE), +/* 4A */ ACPI_OP ("Load", ARGP_LOAD_OP, ARGI_LOAD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_0R, AML_FLAGS_EXEC_1A_1T_0R), +/* 4B */ ACPI_OP ("Stall", ARGP_STALL_OP, ARGI_STALL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), +/* 4C */ ACPI_OP ("Sleep", ARGP_SLEEP_OP, ARGI_SLEEP_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), +/* 4D */ ACPI_OP ("Acquire", ARGP_ACQUIRE_OP, ARGI_ACQUIRE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R), +/* 4E */ ACPI_OP ("Signal", ARGP_SIGNAL_OP, ARGI_SIGNAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), +/* 4F */ ACPI_OP ("Wait", ARGP_WAIT_OP, ARGI_WAIT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R), +/* 50 */ ACPI_OP ("Reset", ARGP_RESET_OP, ARGI_RESET_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), +/* 51 */ ACPI_OP ("Release", ARGP_RELEASE_OP, ARGI_RELEASE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), +/* 52 */ ACPI_OP ("FromBCD", ARGP_FROM_BCD_OP, ARGI_FROM_BCD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), +/* 53 */ ACPI_OP ("ToBCD", ARGP_TO_BCD_OP, ARGI_TO_BCD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), +/* 54 */ ACPI_OP ("Unload", ARGP_UNLOAD_OP, ARGI_UNLOAD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), +/* 55 */ ACPI_OP ("Revision", ARGP_REVISION_OP, ARGI_REVISION_OP, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0), +/* 56 */ ACPI_OP ("Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0), +/* 57 */ ACPI_OP ("Fatal", ARGP_FATAL_OP, ARGI_FATAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_0T_0R, AML_FLAGS_EXEC_3A_0T_0R), +/* 58 */ ACPI_OP ("OperationRegion", ARGP_REGION_OP, ARGI_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER), +/* 59 */ ACPI_OP ("Field", ARGP_FIELD_OP, ARGI_FIELD_OP, INTERNAL_TYPE_FIELD_DEFN,AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD), +/* 5A */ ACPI_OP ("Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP, ACPI_TYPE_DEVICE, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), +/* 5B */ ACPI_OP ("Processor", ARGP_PROCESSOR_OP, ARGI_PROCESSOR_OP, ACPI_TYPE_PROCESSOR, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), +/* 5C */ ACPI_OP ("PowerResource", ARGP_POWER_RES_OP, ARGI_POWER_RES_OP, ACPI_TYPE_POWER, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), +/* 5D */ ACPI_OP ("ThermalZone", ARGP_THERMAL_ZONE_OP, ARGI_THERMAL_ZONE_OP, ACPI_TYPE_THERMAL, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), +/* 5E */ ACPI_OP ("IndexField", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP, INTERNAL_TYPE_INDEX_FIELD_DEFN,AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD), +/* 5F */ ACPI_OP ("BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP, INTERNAL_TYPE_BANK_FIELD_DEFN,AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD), /* Internal opcodes that map to invalid AML opcodes */ -/* 60 */ ACPI_OP ("LNotEqual", ARGP_LNOTEQUAL_OP, ARGI_LNOTEQUAL_OP, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS), -/* 61 */ ACPI_OP ("LLessEqual", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS), -/* 62 */ ACPI_OP ("LGreaterEqual", ARGP_LGREATEREQUAL_OP, ARGI_LGREATEREQUAL_OP, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS), -/* 63 */ ACPI_OP ("[NamePath]", ARGP_NAMEPATH_OP, ARGI_NAMEPATH_OP, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_NSOBJECT | AML_NSNODE ), -/* 64 */ ACPI_OP ("[MethodCall]", ARGP_METHODCALL_OP, ARGI_METHODCALL_OP, AML_CLASS_METHOD_CALL, AML_TYPE_METHOD_CALL, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE), -/* 65 */ ACPI_OP ("[ByteList]", ARGP_BYTELIST_OP, ARGI_BYTELIST_OP, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0), -/* 66 */ ACPI_OP ("[ReservedField]", ARGP_RESERVEDFIELD_OP, ARGI_RESERVEDFIELD_OP, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0), -/* 67 */ ACPI_OP ("[NamedField]", ARGP_NAMEDFIELD_OP, ARGI_NAMEDFIELD_OP, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED ), -/* 68 */ ACPI_OP ("[AccessField]", ARGP_ACCESSFIELD_OP, ARGI_ACCESSFIELD_OP, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0), -/* 69 */ ACPI_OP ("[StaticString", ARGP_STATICSTRING_OP, ARGI_STATICSTRING_OP, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0), -/* 6A */ ACPI_OP ("[Return Value]", ARG_NONE, ARG_NONE, AML_CLASS_RETURN_VALUE, AML_TYPE_RETURN, AML_HAS_ARGS | AML_HAS_RETVAL), -/* 6B */ ACPI_OP ("UNKNOWN_OP!", ARG_NONE, ARG_NONE, AML_CLASS_UNKNOWN, AML_TYPE_BOGUS, AML_HAS_ARGS), -/* 6C */ ACPI_OP ("ASCII_ONLY!", ARG_NONE, ARG_NONE, AML_CLASS_ASCII, AML_TYPE_BOGUS, AML_HAS_ARGS), -/* 6D */ ACPI_OP ("PREFIX_ONLY!", ARG_NONE, ARG_NONE, AML_CLASS_PREFIX, AML_TYPE_BOGUS, AML_HAS_ARGS), +/* 60 */ ACPI_OP ("LNotEqual", ARGP_LNOTEQUAL_OP, ARGI_LNOTEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS), +/* 61 */ ACPI_OP ("LLessEqual", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS), +/* 62 */ ACPI_OP ("LGreaterEqual", ARGP_LGREATEREQUAL_OP, ARGI_LGREATEREQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS), +/* 63 */ ACPI_OP ("[NamePath]", ARGP_NAMEPATH_OP, ARGI_NAMEPATH_OP, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_NSOBJECT | AML_NSNODE ), +/* 64 */ ACPI_OP ("[MethodCall]", ARGP_METHODCALL_OP, ARGI_METHODCALL_OP, ACPI_TYPE_METHOD, AML_CLASS_METHOD_CALL, AML_TYPE_METHOD_CALL, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE), +/* 65 */ ACPI_OP ("[ByteList]", ARGP_BYTELIST_OP, ARGI_BYTELIST_OP, ACPI_TYPE_ANY, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0), +/* 66 */ ACPI_OP ("[ReservedField]", ARGP_RESERVEDFIELD_OP, ARGI_RESERVEDFIELD_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0), +/* 67 */ ACPI_OP ("[NamedField]", ARGP_NAMEDFIELD_OP, ARGI_NAMEDFIELD_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED ), +/* 68 */ ACPI_OP ("[AccessField]", ARGP_ACCESSFIELD_OP, ARGI_ACCESSFIELD_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0), +/* 69 */ ACPI_OP ("[StaticString", ARGP_STATICSTRING_OP, ARGI_STATICSTRING_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0), +/* 6A */ ACPI_OP ("[Return Value]", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, AML_CLASS_RETURN_VALUE, AML_TYPE_RETURN, AML_HAS_ARGS | AML_HAS_RETVAL), +/* 6B */ ACPI_OP ("UNKNOWN_OP!", ARG_NONE, ARG_NONE, INTERNAL_TYPE_INVALID, AML_CLASS_UNKNOWN, AML_TYPE_BOGUS, AML_HAS_ARGS), +/* 6C */ ACPI_OP ("ASCII_ONLY!", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, AML_CLASS_ASCII, AML_TYPE_BOGUS, AML_HAS_ARGS), +/* 6D */ ACPI_OP ("PREFIX_ONLY!", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, AML_CLASS_PREFIX, AML_TYPE_BOGUS, AML_HAS_ARGS), /* ACPI 2.0 opcodes */ -/* 6E */ ACPI_OP ("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0), -/* 6F */ ACPI_OP ("VarPackage", ARGP_VAR_PACKAGE_OP, ARGI_VAR_PACKAGE_OP, AML_CLASS_ARGUMENT, AML_TYPE_DATA_TERM, AML_HAS_ARGS | AML_DEFER), -/* 70 */ ACPI_OP ("ConcatRes", ARGP_CONCAT_RES_OP, ARGI_CONCAT_RES_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R), -/* 71 */ ACPI_OP ("Mod", ARGP_MOD_OP, ARGI_MOD_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R), -/* 72 */ ACPI_OP ("CreateQWordField", ARGP_CREATE_QWORD_FIELD_OP,ARGI_CREATE_QWORD_FIELD_OP, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), -/* 73 */ ACPI_OP ("ToBuffer", ARGP_TO_BUFFER_OP, ARGI_TO_BUFFER_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), -/* 74 */ ACPI_OP ("ToDecimalString", ARGP_TO_DEC_STR_OP, ARGI_TO_DEC_STR_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), -/* 75 */ ACPI_OP ("ToHexString", ARGP_TO_HEX_STR_OP, ARGI_TO_HEX_STR_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), -/* 76 */ ACPI_OP ("ToInteger", ARGP_TO_INTEGER_OP, ARGI_TO_INTEGER_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), -/* 77 */ ACPI_OP ("ToString", ARGP_TO_STRING_OP, ARGI_TO_STRING_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R), -/* 78 */ ACPI_OP ("CopyObject", ARGP_COPY_OP, ARGI_COPY_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), -/* 79 */ ACPI_OP ("Mid", ARGP_MID_OP, ARGI_MID_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_1T_1R, AML_FLAGS_EXEC_3A_1T_1R), -/* 7A */ ACPI_OP ("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), -/* 7B */ ACPI_OP ("LoadTable", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R), -/* 7C */ ACPI_OP ("DataOpRegion", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), +/* 6E */ ACPI_OP ("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0), +/* 6F */ ACPI_OP ("Package /*Var*/", ARGP_VAR_PACKAGE_OP, ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_ARGUMENT, AML_TYPE_DATA_TERM, AML_HAS_ARGS | AML_DEFER), +/* 70 */ ACPI_OP ("ConcatenateResTemplate", ARGP_CONCAT_RES_OP, ARGI_CONCAT_RES_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R), +/* 71 */ ACPI_OP ("Mod", ARGP_MOD_OP, ARGI_MOD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R), +/* 72 */ ACPI_OP ("CreateQWordField", ARGP_CREATE_QWORD_FIELD_OP,ARGI_CREATE_QWORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), +/* 73 */ ACPI_OP ("ToBuffer", ARGP_TO_BUFFER_OP, ARGI_TO_BUFFER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), +/* 74 */ ACPI_OP ("ToDecimalString", ARGP_TO_DEC_STR_OP, ARGI_TO_DEC_STR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), +/* 75 */ ACPI_OP ("ToHexString", ARGP_TO_HEX_STR_OP, ARGI_TO_HEX_STR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), +/* 76 */ ACPI_OP ("ToInteger", ARGP_TO_INTEGER_OP, ARGI_TO_INTEGER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), +/* 77 */ ACPI_OP ("ToString", ARGP_TO_STRING_OP, ARGI_TO_STRING_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R), +/* 78 */ ACPI_OP ("CopyObject", ARGP_COPY_OP, ARGI_COPY_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), +/* 79 */ ACPI_OP ("Mid", ARGP_MID_OP, ARGI_MID_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_1T_1R, AML_FLAGS_EXEC_3A_1T_1R), +/* 7A */ ACPI_OP ("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), +/* 7B */ ACPI_OP ("LoadTable", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R), +/* 7C */ ACPI_OP ("DataTableRegion", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), }; @@ -685,7 +685,7 @@ static const ACPI_OPCODE_INFO AmlOpInfo[] = * index into the table above */ -static const UINT8 AmlShortOpInfoIndex[256] = +static const UINT8 AcpiGbl_ShortOpIndex[256] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ @@ -724,7 +724,7 @@ static const UINT8 AmlShortOpInfoIndex[256] = }; -static const UINT8 AmlLongOpInfoIndex[NUM_EXTENDED_OPCODE] = +static const UINT8 AcpiGbl_LongOpIndex[NUM_EXTENDED_OPCODE] = { /* 0 1 2 3 4 5 6 7 */ /* 8 9 A B C D E F */ @@ -767,35 +767,19 @@ const ACPI_OPCODE_INFO * AcpiPsGetOpcodeInfo ( UINT16 Opcode) { - const ACPI_OPCODE_INFO *OpInfo; - UINT8 UpperOpcode; - UINT8 LowerOpcode; - - PROC_NAME ("PsGetOpcodeInfo"); - /* Split the 16-bit opcode into separate bytes */ - - UpperOpcode = (UINT8) (Opcode >> 8); - LowerOpcode = (UINT8) Opcode; - - /* Default is "unknown opcode" */ - - OpInfo = &AmlOpInfo [_UNK]; - - /* * Detect normal 8-bit opcode or extended 16-bit opcode */ - - switch (UpperOpcode) + switch ((UINT8) (Opcode >> 8)) { case 0: /* Simple (8-bit) opcode: 0-255, can't index beyond table */ - OpInfo = &AmlOpInfo [AmlShortOpInfoIndex [LowerOpcode]]; + return (&AcpiGbl_AmlOpInfo [AcpiGbl_ShortOpIndex [(UINT8) Opcode]]); break; @@ -803,23 +787,22 @@ AcpiPsGetOpcodeInfo ( /* Extended (16-bit, prefix+opcode) opcode */ - if (LowerOpcode <= MAX_EXTENDED_OPCODE) + if (((UINT8) Opcode) <= MAX_EXTENDED_OPCODE) { - OpInfo = &AmlOpInfo [AmlLongOpInfoIndex [LowerOpcode]]; + return (&AcpiGbl_AmlOpInfo [AcpiGbl_LongOpIndex [(UINT8) Opcode]]); + break; } - break; - default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown extended opcode=%X\n", Opcode)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown extended opcode [%X]\n", Opcode)); break; } - /* Get the Op info pointer for this opcode */ + /* Default is "unknown opcode" */ - return (OpInfo); + return (&AcpiGbl_AmlOpInfo [_UNK]); } diff --git a/sys/contrib/dev/acpica/psscope.c b/sys/contrib/dev/acpica/psscope.c index 35eed1f..f3f868d 100644 --- a/sys/contrib/dev/acpica/psscope.c +++ b/sys/contrib/dev/acpica/psscope.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psscope - Parser scope stack management routines - * $Revision: 30 $ + * $Revision: 31 $ * *****************************************************************************/ @@ -239,7 +239,7 @@ AcpiPsPushScope ( Scope = AcpiUtCreateGenericState (); if (!Scope) { - return (AE_NO_MEMORY); + return_ACPI_STATUS (AE_NO_MEMORY); } diff --git a/sys/contrib/dev/acpica/pswalk.c b/sys/contrib/dev/acpica/pswalk.c index 3061ce2..8975561 100644 --- a/sys/contrib/dev/acpica/pswalk.c +++ b/sys/contrib/dev/acpica/pswalk.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: pswalk - Parser routines to walk parsed op tree(s) - * $Revision: 58 $ + * $Revision: 61 $ * *****************************************************************************/ @@ -173,7 +173,6 @@ AcpiPsGetNextWalkOp ( return_ACPI_STATUS (AE_OK); } - /* * No more children, this Op is complete. Save Next and Parent * in case the Op object gets deleted by the callback routine @@ -222,7 +221,6 @@ AcpiPsGetNextWalkOp ( * the tree */ } - else { /* @@ -232,7 +230,6 @@ AcpiPsGetNextWalkOp ( Parent = Op; } - /* * Look for a sibling of the current Op's parent * Continue moving up the tree until we find a node that has not been @@ -287,9 +284,10 @@ AcpiPsGetNextWalkOp ( } - /* Got all the way to the top of the tree, we must be done! */ - /* However, the code should have terminated in the loop above */ - + /* + * Got all the way to the top of the tree, we must be done! + * However, the code should have terminated in the loop above + */ WalkState->NextOp = NULL; return_ACPI_STATUS (AE_OK); @@ -311,7 +309,7 @@ AcpiPsGetNextWalkOp ( * ******************************************************************************/ -static ACPI_STATUS +ACPI_STATUS AcpiPsDeleteCompletedOp ( ACPI_WALK_STATE *WalkState) { @@ -338,7 +336,7 @@ AcpiPsDeleteParseTree ( ACPI_PARSE_OBJECT *SubtreeRoot) { ACPI_WALK_STATE *WalkState; - ACPI_WALK_LIST WalkList; + ACPI_THREAD_STATE *Thread; FUNCTION_TRACE_PTR ("PsDeleteParseTree", SubtreeRoot); @@ -351,11 +349,14 @@ AcpiPsDeleteParseTree ( /* Create and initialize a new walk list */ - WalkList.WalkState = NULL; - WalkList.AcquiredMutexList.Prev = NULL; - WalkList.AcquiredMutexList.Next = NULL; + Thread = AcpiUtCreateThreadState (); + if (!Thread) + { + return_VOID; + } - WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, NULL, NULL, &WalkList); + + WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, NULL, NULL, Thread); if (!WalkState) { return_VOID; @@ -365,11 +366,9 @@ AcpiPsDeleteParseTree ( WalkState->DescendingCallback = NULL; WalkState->AscendingCallback = NULL; - WalkState->Origin = SubtreeRoot; WalkState->NextOp = SubtreeRoot; - /* Head downward in the tree */ WalkState->NextOpInfo = NEXT_OP_DOWNWARD; @@ -384,7 +383,7 @@ AcpiPsDeleteParseTree ( /* We are done with this walk */ - AcpiExReleaseAllMutexes ((ACPI_OPERAND_OBJECT *) &WalkList.AcquiredMutexList); + AcpiUtDeleteGenericState ((ACPI_GENERIC_STATE *) Thread); AcpiDsDeleteWalkState (WalkState); return_VOID; diff --git a/sys/contrib/dev/acpica/psxface.c b/sys/contrib/dev/acpica/psxface.c index 08b4178..7ee0a8e 100644 --- a/sys/contrib/dev/acpica/psxface.c +++ b/sys/contrib/dev/acpica/psxface.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psxface - Parser external interfaces - * $Revision: 52 $ + * $Revision: 56 $ * *****************************************************************************/ @@ -220,11 +220,11 @@ AcpiPsxExecute ( return_ACPI_STATUS (AE_NO_MEMORY); } - Status = AcpiDsInitAmlWalk (WalkState, Op, MethodNode, ObjDesc->Method.AmlStart, + Status = AcpiDsInitAmlWalk (WalkState, Op, MethodNode, ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength, NULL, NULL, 1); if (ACPI_FAILURE (Status)) { - /* TBD: delete walk state */ + AcpiDsDeleteWalkState (WalkState); return_ACPI_STATUS (Status); } @@ -263,11 +263,11 @@ AcpiPsxExecute ( return_ACPI_STATUS (AE_NO_MEMORY); } - Status = AcpiDsInitAmlWalk (WalkState, Op, MethodNode, ObjDesc->Method.AmlStart, + Status = AcpiDsInitAmlWalk (WalkState, Op, MethodNode, ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength, Params, ReturnObjDesc, 3); if (ACPI_FAILURE (Status)) { - /* TBD: delete walk state */ + AcpiDsDeleteWalkState (WalkState); return_ACPI_STATUS (Status); } @@ -287,14 +287,15 @@ AcpiPsxExecute ( } } + /* Now check status from the method execution */ if (ACPI_FAILURE (Status)) { - DUMP_PATHNAME (MethodNode, "PsExecute: method failed -", + REPORT_ERROR (("Method execution failed, %s\n", AcpiFormatException (Status))); + DUMP_PATHNAME (MethodNode, "Method pathname: ", ACPI_LV_ERROR, _COMPONENT); } - /* * If the method has returned an object, signal this to the caller with * a control exception code @@ -308,7 +309,6 @@ AcpiPsxExecute ( Status = AE_CTRL_RETURN_VALUE; } - return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/rsaddr.c b/sys/contrib/dev/acpica/rsaddr.c index fb32d65..7231098 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: 19 $ + * $Revision: 20 $ * ******************************************************************************/ @@ -179,6 +179,7 @@ AcpiRsAddress16Resource ( Temp8 = *Buffer; /* Values 0-2 are valid */ + if (Temp8 > 2) { return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); @@ -192,24 +193,20 @@ AcpiRsAddress16Resource ( Buffer += 1; Temp8 = *Buffer; - /* - * Producer / Consumer - */ + /* Producer / Consumer */ + OutputStruct->Data.Address16.ProducerConsumer = Temp8 & 0x01; - /* - * Decode - */ + /* Decode */ + OutputStruct->Data.Address16.Decode = (Temp8 >> 1) & 0x01; - /* - * Min Address Fixed - */ + /* Min Address Fixed */ + OutputStruct->Data.Address16.MinAddressFixed = (Temp8 >> 2) & 0x01; - /* - * Max Address Fixed - */ + /* Max Address Fixed */ + OutputStruct->Data.Address16.MaxAddressFixed = (Temp8 >> 3) & 0x01; /* @@ -225,7 +222,6 @@ AcpiRsAddress16Resource ( OutputStruct->Data.Address16.Attribute.Memory.CacheAttribute = (UINT16) ((Temp8 >> 1) & 0x0F); } - else { if (IO_RANGE == OutputStruct->Data.Address16.ResourceType) @@ -233,7 +229,6 @@ AcpiRsAddress16Resource ( OutputStruct->Data.Address16.Attribute.Io.RangeAttribute = (UINT16) (Temp8 & 0x03); } - else { /* BUS_NUMBER_RANGE == Address16.Data->ResourceType */ @@ -334,7 +329,6 @@ AcpiRsAddress16Resource ( Temp8 = (UINT8) (Index + 1); StructSize += ROUND_UP_TO_32BITS (Temp8); } - else { OutputStruct->Data.Address16.ResourceSource.Index = 0x00; @@ -434,7 +428,6 @@ AcpiRsAddress16Stream ( (LinkedList->Data.Address16.Attribute.Memory.CacheAttribute & 0x0F) << 1; } - else if (IO_RANGE == LinkedList->Data.Address16.ResourceType) { Temp8 = (UINT8) @@ -632,7 +625,6 @@ AcpiRsAddress32Resource ( OutputStruct->Data.Address32.Attribute.Memory.CacheAttribute = (UINT16) ((Temp8 >> 1) & 0x0F); } - else { if (IO_RANGE == OutputStruct->Data.Address32.ResourceType) @@ -640,7 +632,6 @@ AcpiRsAddress32Resource ( OutputStruct->Data.Address32.Attribute.Io.RangeAttribute = (UINT16) (Temp8 & 0x03); } - else { /* BUS_NUMBER_RANGE == OutputStruct->Data.Address32.ResourceType */ @@ -715,7 +706,6 @@ AcpiRsAddress32Resource ( /* Copy the string into the buffer */ Index = 0; - while (0x00 != *Buffer) { *TempPtr = *Buffer; @@ -739,7 +729,6 @@ AcpiRsAddress32Resource ( Temp8 = (UINT8) (Index + 1); StructSize += ROUND_UP_TO_32BITS (Temp8); } - else { OutputStruct->Data.Address32.ResourceSource.Index = 0x00; @@ -803,7 +792,6 @@ AcpiRsAddress32Stream ( /* * Set a pointer to the Length field - to be filled in later */ - LengthField = (UINT16 *) Buffer; Buffer += 2; @@ -841,7 +829,6 @@ AcpiRsAddress32Stream ( (LinkedList->Data.Address32.Attribute.Memory.CacheAttribute & 0x0F) << 1; } - else if (IO_RANGE == LinkedList->Data.Address32.ResourceType) { Temp8 = (UINT8) @@ -988,6 +975,7 @@ AcpiRsAddress64Resource ( Temp8 = *Buffer; /* Values 0-2 are valid */ + if(Temp8 > 2) { return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); @@ -1035,7 +1023,6 @@ AcpiRsAddress64Resource ( OutputStruct->Data.Address64.Attribute.Memory.CacheAttribute = (UINT16) ((Temp8 >> 1) & 0x0F); } - else { if (IO_RANGE == OutputStruct->Data.Address64.ResourceType) @@ -1043,7 +1030,6 @@ AcpiRsAddress64Resource ( OutputStruct->Data.Address64.Attribute.Io.RangeAttribute = (UINT16) (Temp8 & 0x03); } - else { /* BUS_NUMBER_RANGE == OutputStruct->Data.Address64.ResourceType */ @@ -1120,7 +1106,6 @@ AcpiRsAddress64Resource ( /* Copy the string into the buffer */ Index = 0; - while (0x00 != *Buffer) { *TempPtr = *Buffer; @@ -1145,7 +1130,6 @@ AcpiRsAddress64Resource ( Temp8 = (UINT8) (Index + 1); StructSize += ROUND_UP_TO_32BITS (Temp8); } - else { OutputStruct->Data.Address64.ResourceSource.Index = 0x00; @@ -1247,7 +1231,6 @@ AcpiRsAddress64Stream ( (LinkedList->Data.Address64.Attribute.Memory.CacheAttribute & 0x0F) << 1; } - else if (IO_RANGE == LinkedList->Data.Address64.ResourceType) { Temp8 = (UINT8) diff --git a/sys/contrib/dev/acpica/rscalc.c b/sys/contrib/dev/acpica/rscalc.c index 9239d6e..de3b7aa 100644 --- a/sys/contrib/dev/acpica/rscalc.c +++ b/sys/contrib/dev/acpica/rscalc.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rscalc - Calculate stream and list lengths - * $Revision: 32 $ + * $Revision: 33 $ * ******************************************************************************/ @@ -627,7 +627,6 @@ AcpiRsCalculateListLength ( { Temp8 = (UINT8) (Temp16 - (9 + AdditionalBytes)); } - else { Temp8 = 0; @@ -656,7 +655,6 @@ AcpiRsCalculateListLength ( { BytesConsumed = 4; } - else { BytesConsumed = 3; @@ -805,7 +803,6 @@ AcpiRsCalculateListLength ( break; } - /* * Update the return value and counter */ @@ -818,7 +815,6 @@ AcpiRsCalculateListLength ( ByteStreamBuffer += BytesConsumed; } - /* * This is the data the caller needs */ @@ -902,7 +898,6 @@ AcpiRsCalculatePciRoutingTableLength ( { NameFound = TRUE; } - else { /* @@ -927,14 +922,12 @@ AcpiRsCalculatePciRoutingTableLength ( */ TempSizeNeeded += (*SubObjectList)->String.Length; } - else { TempSizeNeeded += AcpiNsGetPathnameLength ( (*SubObjectList)->Reference.Node); } } - else { /* @@ -954,7 +947,6 @@ AcpiRsCalculatePciRoutingTableLength ( TopObjectList++; } - /* * Adding an extra element to the end of the list, essentially a NULL terminator */ diff --git a/sys/contrib/dev/acpica/rscreate.c b/sys/contrib/dev/acpica/rscreate.c index 1081232..14aaf5d 100644 --- a/sys/contrib/dev/acpica/rscreate.c +++ b/sys/contrib/dev/acpica/rscreate.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rscreate - Create resource lists/tables - * $Revision: 36 $ + * $Revision: 38 $ * ******************************************************************************/ @@ -178,46 +178,33 @@ AcpiRsCreateResourceList ( ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Status=%X ListSizeNeeded=%X\n", Status, ListSizeNeeded)); - - /* - * Exit with the error passed back - */ if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* - * If the linked list will fit into the available buffer - * call to fill in the list + * Is caller buffer large enough? */ - if (ListSizeNeeded <= *OutputBufferLength) + if (ListSizeNeeded > *OutputBufferLength) { - /* - * Zero out the return buffer before proceeding - */ - MEMSET (OutputBuffer, 0x00, *OutputBufferLength); - - Status = AcpiRsByteStreamToList (ByteStreamStart, ByteStreamBufferLength, - &OutputBuffer); - - /* - * Exit with the error passed back - */ - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer = %p\n", OutputBuffer)); + *OutputBufferLength = ListSizeNeeded; + return_ACPI_STATUS (AE_BUFFER_OVERFLOW); } - else + /* + * Zero out the return buffer before proceeding + */ + MEMSET (OutputBuffer, 0x00, *OutputBufferLength); + + Status = AcpiRsByteStreamToList (ByteStreamStart, ByteStreamBufferLength, + &OutputBuffer); + if (ACPI_FAILURE (Status)) { - *OutputBufferLength = ListSizeNeeded; - return_ACPI_STATUS (AE_BUFFER_OVERFLOW); + return_ACPI_STATUS (Status); } + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer = %p\n", OutputBuffer)); *OutputBufferLength = ListSizeNeeded; return_ACPI_STATUS (AE_OK); } @@ -268,7 +255,6 @@ AcpiRsCreatePciRoutingTable ( */ Status = AcpiRsCalculatePciRoutingTableLength (PackageObject, &BufferSizeNeeded); - if (!ACPI_SUCCESS(Status)) { return_ACPI_STATUS (Status); @@ -276,195 +262,186 @@ AcpiRsCreatePciRoutingTable ( ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "BufferSizeNeeded = %X\n", BufferSizeNeeded)); + /* Is caller buffer large enough? */ + + if (BufferSizeNeeded > *OutputBufferLength) + { + return_ACPI_STATUS (AE_BUFFER_OVERFLOW); + } + *OutputBufferLength = BufferSizeNeeded; + + /* + * Zero out the return buffer before proceeding + */ + MEMSET (OutputBuffer, 0x00, *OutputBufferLength); + /* - * If the data will fit into the available buffer - * call to fill in the list + * Loop through the ACPI_INTERNAL_OBJECTS - Each object should + * contain a UINT32 Address, a UINT8 Pin, a Name and a UINT8 + * SourceIndex. */ - if (BufferSizeNeeded <= *OutputBufferLength) + TopObjectList = PackageObject->Package.Elements; + NumberOfElements = PackageObject->Package.Count; + UserPrt = (PCI_ROUTING_TABLE *) Buffer; + + + Buffer = ROUND_PTR_UP_TO_8 (Buffer, UINT8); + + for (Index = 0; Index < NumberOfElements; Index++) { /* - * Zero out the return buffer before proceeding + * Point UserPrt past this current structure + * + * NOTE: On the first iteration, UserPrt->Length will + * be zero because we cleared the return buffer earlier */ - MEMSET (OutputBuffer, 0x00, *OutputBufferLength); + Buffer += UserPrt->Length; + UserPrt = (PCI_ROUTING_TABLE *) Buffer; /* - * Loop through the ACPI_INTERNAL_OBJECTS - Each object should - * contain a UINT32 Address, a UINT8 Pin, a Name and a UINT8 - * SourceIndex. + * Fill in the Length field with the information we + * have at this point. + * The minus four is to subtract the size of the + * UINT8 Source[4] member because it is added below. */ - TopObjectList = PackageObject->Package.Elements; - NumberOfElements = PackageObject->Package.Count; - UserPrt = (PCI_ROUTING_TABLE *) Buffer; + UserPrt->Length = (sizeof (PCI_ROUTING_TABLE) -4); + /* + * Dereference the sub-package + */ + PackageElement = *TopObjectList; - Buffer = ROUND_PTR_UP_TO_8 (Buffer, UINT8); + /* + * The SubObjectList will now point to an array of + * the four IRQ elements: Address, Pin, Source and + * SourceIndex + */ + SubObjectList = PackageElement->Package.Elements; - for (Index = 0; Index < NumberOfElements; Index++) + /* + * 1) First subobject: Dereference the Address + */ + if (ACPI_TYPE_INTEGER == (*SubObjectList)->Common.Type) { - /* - * Point UserPrt past this current structure - * - * NOTE: On the first iteration, UserPrt->Length will - * be zero because we cleared the return buffer earlier - */ - Buffer += UserPrt->Length; - UserPrt = (PCI_ROUTING_TABLE *) Buffer; - - - /* - * Fill in the Length field with the information we - * have at this point. - * The minus four is to subtract the size of the - * UINT8 Source[4] member because it is added below. - */ - UserPrt->Length = (sizeof (PCI_ROUTING_TABLE) -4); - - /* - * Dereference the sub-package - */ - PackageElement = *TopObjectList; - - /* - * The SubObjectList will now point to an array of - * the four IRQ elements: Address, Pin, Source and - * SourceIndex - */ - SubObjectList = PackageElement->Package.Elements; + UserPrt->Address = (*SubObjectList)->Integer.Value; + } + else + { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n", + AcpiUtGetTypeName ((*SubObjectList)->Common.Type))); + return_ACPI_STATUS (AE_BAD_DATA); + } - /* - * 1) First subobject: Dereference the Address - */ - if (ACPI_TYPE_INTEGER == (*SubObjectList)->Common.Type) - { - UserPrt->Address = (*SubObjectList)->Integer.Value; - } + /* + * 2) Second subobject: Dereference the Pin + */ + SubObjectList++; - else - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n", - AcpiUtGetTypeName ((*SubObjectList)->Common.Type))); - return_ACPI_STATUS (AE_BAD_DATA); - } + if (ACPI_TYPE_INTEGER == (*SubObjectList)->Common.Type) + { + UserPrt->Pin = (UINT32) (*SubObjectList)->Integer.Value; + } + else + { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n", + AcpiUtGetTypeName ((*SubObjectList)->Common.Type))); + return_ACPI_STATUS (AE_BAD_DATA); + } - /* - * 2) Second subobject: Dereference the Pin - */ - SubObjectList++; + /* + * 3) Third subobject: Dereference the Source Name + */ + SubObjectList++; - if (ACPI_TYPE_INTEGER == (*SubObjectList)->Common.Type) - { - UserPrt->Pin = (UINT32) (*SubObjectList)->Integer.Value; - } + switch ((*SubObjectList)->Common.Type) + { + case INTERNAL_TYPE_REFERENCE: - else + if ((*SubObjectList)->Reference.Opcode != AML_INT_NAMEPATH_OP) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n", - AcpiUtGetTypeName ((*SubObjectList)->Common.Type))); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need name, found reference op %X\n", + (*SubObjectList)->Reference.Opcode)); return_ACPI_STATUS (AE_BAD_DATA); } - /* - * 3) Third subobject: Dereference the Source Name - */ - SubObjectList++; - - switch ((*SubObjectList)->Common.Type) - { - case INTERNAL_TYPE_REFERENCE: - - if ((*SubObjectList)->Reference.Opcode != AML_INT_NAMEPATH_OP) - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need name, found reference op %X\n", - (*SubObjectList)->Reference.Opcode)); - return_ACPI_STATUS (AE_BAD_DATA); - } - - Node = (*SubObjectList)->Reference.Node; - - /* TBD: use *remaining* length of the buffer! */ - - Status = AcpiNsHandleToPathname ((ACPI_HANDLE *) Node, - OutputBufferLength, UserPrt->Source); - - UserPrt->Length += STRLEN (UserPrt->Source) + 1; /* include null terminator */ - break; + Node = (*SubObjectList)->Reference.Node; + /* Use *remaining* length of the buffer as max for pathname */ - case ACPI_TYPE_STRING: + BufferSizeNeeded = *OutputBufferLength - + (UINT32) ((UINT8 *) UserPrt->Source - OutputBuffer); - STRCPY (UserPrt->Source, - (*SubObjectList)->String.Pointer); + Status = AcpiNsHandleToPathname ((ACPI_HANDLE *) Node, + &BufferSizeNeeded, UserPrt->Source); - /* - * Add to the Length field the length of the string - */ - UserPrt->Length += (*SubObjectList)->String.Length; - break; + UserPrt->Length += STRLEN (UserPrt->Source) + 1; /* include null terminator */ + break; - case ACPI_TYPE_INTEGER: - /* - * If this is a number, then the Source Name - * is NULL, since the entire buffer was zeroed - * out, we can leave this alone. - */ - /* - * Add to the Length field the length of - * the UINT32 NULL - */ - UserPrt->Length += sizeof (UINT32); - break; + case ACPI_TYPE_STRING: + STRCPY (UserPrt->Source, + (*SubObjectList)->String.Pointer); - default: - - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n", - AcpiUtGetTypeName ((*SubObjectList)->Common.Type))); - return_ACPI_STATUS (AE_BAD_DATA); - break; - } - - /* Now align the current length */ + /* + * Add to the Length field the length of the string + */ + UserPrt->Length += (*SubObjectList)->String.Length; + break; - UserPrt->Length = ROUND_UP_TO_64BITS (UserPrt->Length); + case ACPI_TYPE_INTEGER: + /* + * If this is a number, then the Source Name + * is NULL, since the entire buffer was zeroed + * out, we can leave this alone. + */ /* - * 4) Fourth subobject: Dereference the Source Index + * Add to the Length field the length of + * the UINT32 NULL */ - SubObjectList++; + UserPrt->Length += sizeof (UINT32); + break; - if (ACPI_TYPE_INTEGER == (*SubObjectList)->Common.Type) - { - UserPrt->SourceIndex = (UINT32) (*SubObjectList)->Integer.Value; - } - else - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n", - AcpiUtGetTypeName ((*SubObjectList)->Common.Type))); - return_ACPI_STATUS (AE_BAD_DATA); - } + default: - /* - * Point to the next ACPI_OPERAND_OBJECT - */ - TopObjectList++; + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n", + AcpiUtGetTypeName ((*SubObjectList)->Common.Type))); + return_ACPI_STATUS (AE_BAD_DATA); + break; } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer = %p\n", OutputBuffer)); - } + /* Now align the current length */ - else - { - *OutputBufferLength = BufferSizeNeeded; + UserPrt->Length = ROUND_UP_TO_64BITS (UserPrt->Length); - return_ACPI_STATUS (AE_BUFFER_OVERFLOW); + /* + * 4) Fourth subobject: Dereference the Source Index + */ + SubObjectList++; + + if (ACPI_TYPE_INTEGER == (*SubObjectList)->Common.Type) + { + UserPrt->SourceIndex = (UINT32) (*SubObjectList)->Integer.Value; + } + else + { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n", + AcpiUtGetTypeName ((*SubObjectList)->Common.Type))); + return_ACPI_STATUS (AE_BAD_DATA); + } + + /* + * Point to the next ACPI_OPERAND_OBJECT + */ + TopObjectList++; } /* * Report the amount of buffer used */ - *OutputBufferLength = BufferSizeNeeded; + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer = %p\n", OutputBuffer)); return_ACPI_STATUS (AE_OK); } @@ -506,7 +483,7 @@ AcpiRsCreateByteStream ( /* * Params already validated, so we don't re-validate here * - * Pass the LinkedListBuffer into a module that can calculate + * Pass the LinkedListBuffer into a module that calculates * the buffer size needed for the byte stream. */ Status = AcpiRsCalculateByteStreamLength (LinkedListBuffer, @@ -514,46 +491,33 @@ AcpiRsCreateByteStream ( ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ByteStreamSizeNeeded=%X, %s\n", ByteStreamSizeNeeded, AcpiFormatException (Status))); - - /* - * Exit with the error passed back - */ if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* - * If the linked list will fit into the available buffer - * call to fill in the list + * Is caller buffer large enough? */ - if (ByteStreamSizeNeeded <= *OutputBufferLength) + if (ByteStreamSizeNeeded > *OutputBufferLength) { - /* - * Zero out the return buffer before proceeding - */ - MEMSET (OutputBuffer, 0x00, *OutputBufferLength); - - Status = AcpiRsListToByteStream (LinkedListBuffer, ByteStreamSizeNeeded, - &OutputBuffer); - - /* - * Exit with the error passed back - */ - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer = %p\n", OutputBuffer)); + *OutputBufferLength = ByteStreamSizeNeeded; + return_ACPI_STATUS (AE_BUFFER_OVERFLOW); } - else + /* + * Zero out the return buffer before proceeding + */ + MEMSET (OutputBuffer, 0x00, *OutputBufferLength); + + Status = AcpiRsListToByteStream (LinkedListBuffer, ByteStreamSizeNeeded, + &OutputBuffer); + if (ACPI_FAILURE (Status)) { - *OutputBufferLength = ByteStreamSizeNeeded; - return_ACPI_STATUS (AE_BUFFER_OVERFLOW); + return_ACPI_STATUS (Status); } + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer = %p\n", OutputBuffer)); return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/rsirq.c b/sys/contrib/dev/acpica/rsirq.c index 6aa1cf5..7944046 100644 --- a/sys/contrib/dev/acpica/rsirq.c +++ b/sys/contrib/dev/acpica/rsirq.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsirq - IRQ resource descriptors - * $Revision: 18 $ + * $Revision: 19 $ * ******************************************************************************/ @@ -213,7 +213,6 @@ AcpiRsIrqResource ( OutputStruct->Data.Irq.EdgeLevel = EDGE_SENSITIVE; OutputStruct->Data.Irq.ActiveHighLow = ACTIVE_HIGH; } - else { if (Temp8 & 0x8) @@ -221,7 +220,6 @@ AcpiRsIrqResource ( OutputStruct->Data.Irq.EdgeLevel = LEVEL_SENSITIVE; OutputStruct->Data.Irq.ActiveHighLow = ACTIVE_LOW; } - else { /* @@ -238,7 +236,6 @@ AcpiRsIrqResource ( */ OutputStruct->Data.Irq.SharedExclusive = (Temp8 >> 3) & 0x01; } - else { /* @@ -307,7 +304,6 @@ AcpiRsIrqStream ( *Buffer = 0x22; IRQInfoByteNeeded = FALSE; } - else { *Buffer = 0x23; @@ -345,7 +341,6 @@ AcpiRsIrqStream ( { Temp8 |= 0x08; } - else { Temp8 |= 0x01; @@ -429,7 +424,6 @@ AcpiRsExtendedIrqResource ( OutputStruct->Data.ExtendedIrq.EdgeLevel = EDGE_SENSITIVE; OutputStruct->Data.ExtendedIrq.ActiveHighLow = ACTIVE_HIGH; } - else { if(Temp8 & 0x4) @@ -437,7 +431,6 @@ AcpiRsExtendedIrqResource ( OutputStruct->Data.ExtendedIrq.EdgeLevel = LEVEL_SENSITIVE; OutputStruct->Data.ExtendedIrq.ActiveHighLow = ACTIVE_LOW; } - else { /* @@ -516,7 +509,6 @@ AcpiRsExtendedIrqResource ( /* Copy the string into the buffer */ Index = 0; - while (0x00 != *Buffer) { *TempPtr = *Buffer; @@ -540,7 +532,6 @@ AcpiRsExtendedIrqResource ( Temp8 = (UINT8) (Index + 1); StructSize += ROUND_UP_TO_32BITS (Temp8); } - else { OutputStruct->Data.ExtendedIrq.ResourceSource.Index = 0x00; diff --git a/sys/contrib/dev/acpica/rsmisc.c b/sys/contrib/dev/acpica/rsmisc.c index 830991d..ee1732f 100644 --- a/sys/contrib/dev/acpica/rsmisc.c +++ b/sys/contrib/dev/acpica/rsmisc.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsmisc - Miscellaneous resource descriptors - * $Revision: 16 $ + * $Revision: 17 $ * ******************************************************************************/ @@ -283,8 +283,7 @@ AcpiRsVendorResource ( if (Temp8 & 0x80) { /* - * Large Item - * Point to the length field + * Large Item, point to the length field */ Buffer += 1; @@ -300,12 +299,10 @@ AcpiRsVendorResource ( Buffer += 2; } - else { /* - * Small Item - * Dereference the size + * Small Item, dereference the size */ Temp16 = (UINT8)(*Buffer & 0x07); @@ -385,8 +382,7 @@ AcpiRsVendorStream ( if(LinkedList->Data.VendorSpecific.Length > 7) { /* - * Large Item - * Set the descriptor field and length bytes + * Large Item, Set the descriptor field and length bytes */ *Buffer = 0x84; Buffer += 1; @@ -396,12 +392,10 @@ AcpiRsVendorStream ( MOVE_UNALIGNED16_TO_16 (Buffer, &Temp16); Buffer += 2; } - else { /* - * Small Item - * Set the descriptor field + * Small Item, Set the descriptor field */ Temp8 = 0x70; Temp8 |= LinkedList->Data.VendorSpecific.Length; @@ -504,7 +498,6 @@ AcpiRsStartDependentFunctionsResource ( return_ACPI_STATUS (AE_AML_ERROR); } } - else { OutputStruct->Data.StartDpf.CompatibilityPriority = diff --git a/sys/contrib/dev/acpica/tbinstal.c b/sys/contrib/dev/acpica/tbinstal.c index 8e7ffdb..a7c889c 100644 --- a/sys/contrib/dev/acpica/tbinstal.c +++ b/sys/contrib/dev/acpica/tbinstal.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbinstal - ACPI table installation and removal - * $Revision: 45 $ + * $Revision: 47 $ * *****************************************************************************/ @@ -321,7 +321,7 @@ AcpiTbInitTableDescriptor ( */ if (ListHead->Pointer) { - return_ACPI_STATUS (AE_EXIST); + return_ACPI_STATUS (AE_ALREADY_EXISTS); } TableDesc->Count = 1; @@ -659,7 +659,6 @@ AcpiTbUninstallTable ( } - return_PTR (NextDesc); } diff --git a/sys/contrib/dev/acpica/tbutils.c b/sys/contrib/dev/acpica/tbutils.c index 4e47623..8b7dfa0 100644 --- a/sys/contrib/dev/acpica/tbutils.c +++ b/sys/contrib/dev/acpica/tbutils.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbutils - Table manipulation utilities - * $Revision: 42 $ + * $Revision: 43 $ * *****************************************************************************/ @@ -174,87 +174,6 @@ AcpiTbHandleToObject ( /******************************************************************************* * - * FUNCTION: AcpiTbSystemTablePointer - * - * PARAMETERS: *Where - Pointer to be examined - * - * RETURN: TRUE if Where is within the AML stream (in one of the ACPI - * system tables such as the DSDT or an SSDT.) - * FALSE otherwise - * - ******************************************************************************/ - -BOOLEAN -AcpiTbSystemTablePointer ( - void *Where) -{ - UINT32 i; - ACPI_TABLE_DESC *TableDesc; - ACPI_TABLE_HEADER *Table; - - - /* No function trace, called too often! */ - - - /* Ignore null pointer */ - - if (!Where) - { - return (FALSE); - } - - - /* Check for a pointer within the DSDT */ - - if ((AcpiGbl_DSDT) && - (IS_IN_ACPI_TABLE (Where, AcpiGbl_DSDT))) - { - return (TRUE); - } - - - /* Check each of the loaded SSDTs (if any)*/ - - TableDesc = &AcpiGbl_AcpiTables[ACPI_TABLE_SSDT]; - - for (i = 0; i < AcpiGbl_AcpiTables[ACPI_TABLE_SSDT].Count; i++) - { - Table = TableDesc->Pointer; - - if (IS_IN_ACPI_TABLE (Where, Table)) - { - return (TRUE); - } - - TableDesc = TableDesc->Next; - } - - - /* Check each of the loaded PSDTs (if any)*/ - - TableDesc = &AcpiGbl_AcpiTables[ACPI_TABLE_PSDT]; - - for (i = 0; i < AcpiGbl_AcpiTables[ACPI_TABLE_PSDT].Count; i++) - { - Table = TableDesc->Pointer; - - if (IS_IN_ACPI_TABLE (Where, Table)) - { - return (TRUE); - } - - TableDesc = TableDesc->Next; - } - - - /* Pointer does not point into any system table */ - - return (FALSE); -} - - -/******************************************************************************* - * * FUNCTION: AcpiTbValidateTableHeader * * PARAMETERS: TableHeader - Logical pointer to the table diff --git a/sys/contrib/dev/acpica/utalloc.c b/sys/contrib/dev/acpica/utalloc.c index 7b1bc43..e2f3d29 100644 --- a/sys/contrib/dev/acpica/utalloc.c +++ b/sys/contrib/dev/acpica/utalloc.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utalloc - local cache and memory allocation routines - * $Revision: 106 $ + * $Revision: 109 $ * *****************************************************************************/ @@ -590,40 +590,30 @@ AcpiUtDumpAllocations ( NATIVE_CHAR *Module) { ACPI_DEBUG_MEM_BLOCK *Element; - UINT32 i; + UINT32 NumOutstanding = 0; FUNCTION_TRACE ("UtDumpAllocations"); - Element = AcpiGbl_MemoryLists[0].ListHead; - if (Element == NULL) - { - ACPI_DEBUG_PRINT ((ACPI_DB_OK, - "No outstanding allocations.\n")); - return_VOID; - } - - /* * Walk the allocation list. */ AcpiUtAcquireMutex (ACPI_MTX_MEMORY); - ACPI_DEBUG_PRINT ((ACPI_DB_OK, - "Outstanding allocations:\n")); - - for (i = 1; ; i++) /* Just a counter */ + Element = AcpiGbl_MemoryLists[0].ListHead; + while (Element) { if ((Element->Component & Component) && ((Module == NULL) || (0 == STRCMP (Module, Element->Module)))) { + /* Ignore allocated objects that are in a cache */ + if (((ACPI_OPERAND_OBJECT *)(&Element->UserSpace))->Common.Type != ACPI_CACHED_OBJECT) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, - "%p Len %04X %9.9s-%d", + AcpiOsPrintf ("%p Len %04X %9.9s-%d ", &Element->UserSpace, Element->Size, Element->Module, - Element->Line)); + Element->Line); /* Most of the elements will be internal objects. */ @@ -631,90 +621,86 @@ AcpiUtDumpAllocations ( (&Element->UserSpace))->Common.DataType) { case ACPI_DESC_TYPE_INTERNAL: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, - " ObjType %12.12s R%d", + AcpiOsPrintf ("ObjType %12.12s R%d", AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *)(&Element->UserSpace))->Common.Type), - ((ACPI_OPERAND_OBJECT *)(&Element->UserSpace))->Common.ReferenceCount)); + ((ACPI_OPERAND_OBJECT *)(&Element->UserSpace))->Common.ReferenceCount); break; case ACPI_DESC_TYPE_PARSER: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, - " ParseObj Opcode %04X", - ((ACPI_PARSE_OBJECT *)(&Element->UserSpace))->Opcode)); + AcpiOsPrintf ("ParseObj Opcode %04X", + ((ACPI_PARSE_OBJECT *)(&Element->UserSpace))->Opcode); break; case ACPI_DESC_TYPE_NAMED: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, - " Node %4.4s", - (char*)&((ACPI_NAMESPACE_NODE *)(&Element->UserSpace))->Name)); + AcpiOsPrintf ("Node %4.4s", + (char *) &((ACPI_NAMESPACE_NODE *)(&Element->UserSpace))->Name); break; case ACPI_DESC_TYPE_STATE: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, - " Untyped StateObj")); + AcpiOsPrintf ("Untyped StateObj"); break; case ACPI_DESC_TYPE_STATE_UPDATE: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, - " UPDATE StateObj")); + AcpiOsPrintf ("UPDATE StateObj"); break; case ACPI_DESC_TYPE_STATE_PACKAGE: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, - " PACKAGE StateObj")); + AcpiOsPrintf ("PACKAGE StateObj"); break; case ACPI_DESC_TYPE_STATE_CONTROL: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, - " CONTROL StateObj")); + AcpiOsPrintf ("CONTROL StateObj"); break; case ACPI_DESC_TYPE_STATE_RPSCOPE: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, - " ROOT-PARSE-SCOPE StateObj")); + AcpiOsPrintf ("ROOT-PARSE-SCOPE StateObj"); break; case ACPI_DESC_TYPE_STATE_PSCOPE: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, - " PARSE-SCOPE StateObj")); + AcpiOsPrintf ("PARSE-SCOPE StateObj"); break; case ACPI_DESC_TYPE_STATE_WSCOPE: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, - " WALK-SCOPE StateObj")); + AcpiOsPrintf ("WALK-SCOPE StateObj"); break; case ACPI_DESC_TYPE_STATE_RESULT: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, - " RESULT StateObj")); + AcpiOsPrintf ("RESULT StateObj"); break; case ACPI_DESC_TYPE_STATE_NOTIFY: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, - " NOTIFY StateObj")); + AcpiOsPrintf ("NOTIFY StateObj"); + break; + + case ACPI_DESC_TYPE_STATE_THREAD: + AcpiOsPrintf ("THREAD StateObj"); break; } - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "\n")); + AcpiOsPrintf ( "\n"); + NumOutstanding++; } } - - if (Element->Next == NULL) - { - break; - } - Element = Element->Next; } AcpiUtReleaseMutex (ACPI_MTX_MEMORY); - ACPI_DEBUG_PRINT ((ACPI_DB_OK, - "Total number of unfreed allocations = %d(%X)\n", i,i)); + /* Print summary */ + if (!NumOutstanding) + { + ACPI_DEBUG_PRINT ((ACPI_DB_OK, + "No outstanding allocations.\n")); + } + else + { + ACPI_DEBUG_PRINT ((ACPI_DB_OK, + "%d(%X) Outstanding allocations\n", + NumOutstanding, NumOutstanding)); + } return_VOID; - } diff --git a/sys/contrib/dev/acpica/utcopy.c b/sys/contrib/dev/acpica/utcopy.c index 821f0ab..58202a7 100644 --- a/sys/contrib/dev/acpica/utcopy.c +++ b/sys/contrib/dev/acpica/utcopy.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utcopy - Internal to external object translation utilities - * $Revision: 83 $ + * $Revision: 86 $ * *****************************************************************************/ @@ -332,7 +332,7 @@ AcpiUtCopyIelementToEelement ( case ACPI_COPY_TYPE_SIMPLE: /* - * This is a simple or null object -- get the size + * This is a simple or null object */ Status = AcpiUtCopyIsimpleToEsimple (SourceObject, TargetObject, Info->FreeSpace, &ObjectSpace); @@ -340,9 +340,9 @@ AcpiUtCopyIelementToEelement ( { return (Status); } - break; + case ACPI_COPY_TYPE_PACKAGE: /* @@ -365,14 +365,14 @@ AcpiUtCopyIelementToEelement ( TargetObject->Package.Count * sizeof (ACPI_OBJECT)); break; + default: return (AE_BAD_PARAMETER); + break; } - Info->FreeSpace += ObjectSpace; Info->Length += ObjectSpace; - return (Status); } @@ -423,12 +423,10 @@ AcpiUtCopyIpackageToEpackage ( Info.NumPackages = 1; Info.FreeSpace = Buffer + ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)); - ExternalObject->Type = InternalObject->Common.Type; ExternalObject->Package.Count = InternalObject->Package.Count; ExternalObject->Package.Elements = (ACPI_OBJECT *) Info.FreeSpace; - /* * Build an array of ACPI_OBJECTS in the buffer * and move the free space past it @@ -436,16 +434,14 @@ AcpiUtCopyIpackageToEpackage ( Info.FreeSpace += ExternalObject->Package.Count * ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)); - Status = AcpiUtWalkPackageTree (InternalObject, ExternalObject, AcpiUtCopyIelementToEelement, &Info); *SpaceUsed = Info.Length; - return_ACPI_STATUS (Status); - } + /******************************************************************************* * * FUNCTION: AcpiUtCopyIobjectToEobject @@ -480,7 +476,6 @@ AcpiUtCopyIobjectToEobject ( Status = AcpiUtCopyIpackageToEpackage (InternalObject, RetBuffer->Pointer, &RetBuffer->Length); } - else { /* @@ -529,7 +524,6 @@ AcpiUtCopyEsimpleToIsimple ( FUNCTION_TRACE ("UtCopyEsimpleToIsimple"); - /* * Simple types supported are: String, Buffer, Integer */ @@ -568,8 +562,8 @@ AcpiUtCopyEsimpleToIsimple ( return_ACPI_STATUS (AE_NO_MEMORY); } - MEMCPY (InternalObject->String.Pointer, - ExternalObject->String.Pointer, + MEMCPY (InternalObject->String.Pointer, + ExternalObject->String.Pointer, ExternalObject->String.Length); InternalObject->String.Length = ExternalObject->String.Length; @@ -584,8 +578,8 @@ AcpiUtCopyEsimpleToIsimple ( return_ACPI_STATUS (AE_NO_MEMORY); } - MEMCPY (InternalObject->Buffer.Pointer, - ExternalObject->Buffer.Pointer, + MEMCPY (InternalObject->Buffer.Pointer, + ExternalObject->Buffer.Pointer, ExternalObject->Buffer.Length); InternalObject->Buffer.Length = ExternalObject->Buffer.Length; @@ -598,7 +592,6 @@ AcpiUtCopyEsimpleToIsimple ( break; } - *RetInternalObject = InternalObject; return_ACPI_STATUS (AE_OK); } @@ -702,18 +695,8 @@ AcpiUtCopyEobjectToIobject ( if (ExternalObject->Type == ACPI_TYPE_PACKAGE) { /* - * Package objects contain other objects (which can be objects) - * buildpackage does it all - * - * TBD: Package conversion must be completed and tested - * NOTE: this code converts packages as input parameters to - * control methods only. This is a very, very rare case. + * Packages as external input to control methods are not supported, */ -/* - Status = AcpiUtCopyEpackageToIpackage(InternalObject, - RetBuffer->Pointer, - &RetBuffer->Length); -*/ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Packages as parameters not implemented!\n")); @@ -789,6 +772,7 @@ AcpiUtCopyIelementToIelement ( case 1: + /* * This object is a package - go down another nesting level * Create and build the package object @@ -796,8 +780,6 @@ AcpiUtCopyIelementToIelement ( TargetObject = AcpiUtCreateInternalObject (ACPI_TYPE_PACKAGE); if (!TargetObject) { - /* TBD: must delete package created up to this point */ - return (AE_NO_MEMORY); } @@ -814,11 +796,12 @@ AcpiUtCopyIelementToIelement ( *ThisTargetPtr = TargetObject; break; + default: return (AE_BAD_PARAMETER); + break; } - return (Status); } @@ -858,8 +841,6 @@ AcpiUtCopyIpackageToIpackage ( */ DestObj->Package.Elements = ACPI_MEM_CALLOCATE ((SourceObj->Package.Count + 1) * sizeof (void *)); - DestObj->Package.NextElement = DestObj->Package.Elements; - if (!DestObj->Package.Elements) { REPORT_ERROR ( @@ -867,9 +848,22 @@ AcpiUtCopyIpackageToIpackage ( return_ACPI_STATUS (AE_NO_MEMORY); } + /* Init */ + DestObj->Package.NextElement = DestObj->Package.Elements; + + /* + * Copy the package element-by-element by walking the package "tree". + * This handles nested packages of arbitrary depth. + */ Status = AcpiUtWalkPackageTree (SourceObj, DestObj, AcpiUtCopyIelementToIelement, WalkState); + if (ACPI_FAILURE (Status)) + { + /* On failure, delete the destination package object */ + + AcpiUtRemoveReference (DestObj); + } return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/utdebug.c b/sys/contrib/dev/acpica/utdebug.c index b6193a0..bc46c68 100644 --- a/sys/contrib/dev/acpica/utdebug.c +++ b/sys/contrib/dev/acpica/utdebug.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utdebug - Debug print routines - * $Revision: 90 $ + * $Revision: 91 $ * *****************************************************************************/ @@ -127,7 +127,6 @@ char *AcpiGbl_FnEntryStr = "----Entry"; char *AcpiGbl_FnExitStr = "----Exit-"; - #ifdef ACPI_DEBUG @@ -573,8 +572,6 @@ AcpiUtPtrExit ( #endif - - /***************************************************************************** * * FUNCTION: AcpiUtDumpBuffer diff --git a/sys/contrib/dev/acpica/utdelete.c b/sys/contrib/dev/acpica/utdelete.c index 0c741d8..ccbe0da 100644 --- a/sys/contrib/dev/acpica/utdelete.c +++ b/sys/contrib/dev/acpica/utdelete.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: utdelete - object deletion and reference count utilities - * $Revision: 81 $ + * $Revision: 83 $ * ******************************************************************************/ @@ -145,6 +145,7 @@ AcpiUtDeleteInternalObj ( { void *ObjPointer = NULL; ACPI_OPERAND_OBJECT *HandlerDesc; + ACPI_OPERAND_OBJECT *SecondDesc; FUNCTION_TRACE_PTR ("UtDeleteInternalObj", Object); @@ -234,7 +235,6 @@ AcpiUtDeleteInternalObj ( AcpiOsDeleteSemaphore (Object->Method.Semaphore); Object->Method.Semaphore = NULL; } - break; @@ -242,7 +242,8 @@ AcpiUtDeleteInternalObj ( ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "***** Region %p\n", Object)); - if (Object->Region.Extra) + SecondDesc = AcpiNsGetSecondaryObject (Object); + if (SecondDesc) { /* * Free the RegionContext if and only if the handler is one of the @@ -253,12 +254,12 @@ AcpiUtDeleteInternalObj ( if ((HandlerDesc) && (HandlerDesc->AddrHandler.Hflags == ADDR_HANDLER_DEFAULT_INSTALLED)) { - ObjPointer = Object->Region.Extra->Extra.RegionContext; + ObjPointer = SecondDesc->Extra.RegionContext; } /* Now we can free the Extra object */ - AcpiUtDeleteObjectDesc (Object->Region.Extra); + AcpiUtDeleteObjectDesc (SecondDesc); } break; @@ -267,12 +268,14 @@ AcpiUtDeleteInternalObj ( ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "***** Buffer Field %p\n", Object)); - if (Object->BufferField.Extra) + SecondDesc = AcpiNsGetSecondaryObject (Object); + if (SecondDesc) { - AcpiUtDeleteObjectDesc (Object->BufferField.Extra); + AcpiUtDeleteObjectDesc (SecondDesc); } break; + default: break; } @@ -610,7 +613,7 @@ AcpiUtUpdateObjectReference ( case INTERNAL_TYPE_BANK_FIELD: Status = AcpiUtCreateUpdateStateAndPush ( - Object->BankField.BankRegisterObj, Action, &StateList); + Object->BankField.BankObj, Action, &StateList); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); diff --git a/sys/contrib/dev/acpica/uteval.c b/sys/contrib/dev/acpica/uteval.c index 463c4f7..d2dd7c5 100644 --- a/sys/contrib/dev/acpica/uteval.c +++ b/sys/contrib/dev/acpica/uteval.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: uteval - Object evaluation - * $Revision: 31 $ + * $Revision: 34 $ * *****************************************************************************/ @@ -250,7 +250,6 @@ AcpiUtExecute_HID ( ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "_HID on %4.4s was not found\n", (char*)&DeviceNode->Name)); } - else { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_HID on %4.4s failed %s\n", @@ -280,7 +279,6 @@ AcpiUtExecute_HID ( "Type returned from _HID not a number or string: %s(%X) \n", AcpiUtGetTypeName (ObjDesc->Common.Type), ObjDesc->Common.Type)); } - else { if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) @@ -289,7 +287,6 @@ AcpiUtExecute_HID ( AcpiExEisaIdToString ((UINT32) ObjDesc->Integer.Value, Hid->Buffer); } - else { /* Copy the String HID from the returned object */ @@ -298,6 +295,103 @@ AcpiUtExecute_HID ( } } + /* On exit, we must delete the return object */ + + AcpiUtRemoveReference (ObjDesc); + + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtExecute_CID + * + * PARAMETERS: DeviceNode - Node for the device + * *Cid - Where the CID is returned + * + * RETURN: Status + * + * DESCRIPTION: Executes the _CID control method that returns one or more + * compatible hardware IDs for the device. + * + * NOTE: Internal function, no parameter validation + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUtExecute_CID ( + ACPI_NAMESPACE_NODE *DeviceNode, + ACPI_DEVICE_ID *Cid) +{ + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_STATUS Status; + + + FUNCTION_TRACE ("UtExecute_CID"); + + /* Execute the method */ + + Status = AcpiNsEvaluateRelative (DeviceNode, + METHOD_NAME__CID, NULL, &ObjDesc); + if (ACPI_FAILURE (Status)) + { + if (Status == AE_NOT_FOUND) + { + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "_CID on %4.4s was not found\n", + (char *)&DeviceNode->Name)); + } + else + { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_CID on %4.4s failed %s\n", + (char *)&DeviceNode->Name, AcpiFormatException (Status))); + } + + return_ACPI_STATUS (Status); + } + + /* Did we get a return object? */ + + if (!ObjDesc) + { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _CID\n")); + return_ACPI_STATUS (AE_TYPE); + } + + /* + * A _CID can return either a single compatible ID or a package of compatible + * IDs. Each compatible ID can be a Number (32 bit compressed EISA ID) or + * string (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss"). + */ + switch (ObjDesc->Common.Type) + { + case ACPI_TYPE_INTEGER: + + /* Convert the Numeric CID to string */ + + AcpiExEisaIdToString ((UINT32) ObjDesc->Integer.Value, Cid->Buffer); + break; + + case ACPI_TYPE_STRING: + + /* Copy the String CID from the returned object */ + + STRNCPY(Cid->Buffer, ObjDesc->String.Pointer, sizeof(Cid->Buffer)); + break; + + case ACPI_TYPE_PACKAGE: + + /* TBD: Parse package elements; need different return struct, etc. */ + break; + + default: + + Status = AE_TYPE; + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Type returned from _CID not a number, string, or package: %s(%X) \n", + AcpiUtGetTypeName (ObjDesc->Common.Type), ObjDesc->Common.Type)); + break; + } /* On exit, we must delete the return object */ @@ -346,7 +440,6 @@ AcpiUtExecute_UID ( ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "_UID on %4.4s was not found\n", (char*)&DeviceNode->Name)); } - else { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, @@ -377,7 +470,6 @@ AcpiUtExecute_UID ( "Type returned from _UID was not a number or string: %X \n", ObjDesc->Common.Type)); } - else { if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) @@ -386,7 +478,6 @@ AcpiUtExecute_UID ( AcpiExUnsignedIntegerToString (ObjDesc->Integer.Value, Uid->Buffer); } - else { /* Copy the String UID from the returned object */ @@ -472,7 +563,6 @@ AcpiUtExecute_STA ( "Type returned from _STA was not a number: %X \n", ObjDesc->Common.Type)); } - else { /* Extract the status flags */ diff --git a/sys/contrib/dev/acpica/utglobal.c b/sys/contrib/dev/acpica/utglobal.c index bb71d87..453cd02 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: 133 $ + * $Revision: 136 $ * *****************************************************************************/ @@ -234,10 +234,9 @@ BOOLEAN AcpiGbl_MethodExecuting = FALSE; /* System flags */ -UINT32 AcpiGbl_SystemFlags = 0; UINT32 AcpiGbl_StartupFlags = 0; -/* System starts unitialized! */ +/* System starts uninitialized */ BOOLEAN AcpiGbl_Shutdown = TRUE; @@ -324,7 +323,8 @@ const UINT8 AcpiGbl_NsProperties[] = NSP_NEWSCOPE, /* 32 Scope */ NSP_LOCAL, /* 33 DefAny */ NSP_NORMAL, /* 34 Extra */ - NSP_NORMAL /* 35 Invalid */ + NSP_NORMAL, /* 35 Data */ + NSP_NORMAL /* 36 Invalid */ }; @@ -469,7 +469,8 @@ static const NATIVE_CHAR *AcpiGbl_NsTypeNames[] = /* printable names of AC /* 32 */ "Scope", /* 33 */ "DefAny", /* 34 */ "Extra", - /* 35 */ "Invalid" + /* 35 */ "Data", + /* 36 */ "Invalid" }; @@ -501,7 +502,7 @@ AcpiUtGetTypeName ( /* Region type decoding */ -const NATIVE_CHAR *AcpiGbl_RegionTypes[NUM_REGION_TYPES] = +const NATIVE_CHAR *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] = { "SystemMemory", "SystemIO", @@ -530,12 +531,12 @@ AcpiUtGetRegionName ( UINT8 SpaceId) { - if (SpaceId >= USER_REGION_BEGIN) + if (SpaceId >= ACPI_USER_REGION_BEGIN) { return ("UserDefinedRegion"); } - else if (SpaceId >= NUM_REGION_TYPES) + else if (SpaceId >= ACPI_NUM_PREDEFINED_REGIONS) { return ("InvalidSpaceID"); } @@ -573,9 +574,8 @@ const NATIVE_CHAR *AcpiGbl_AccessTypes[NUM_ACCESS_TYPES] = "ByteAcc", "WordAcc", "DWordAcc", - "BlockAcc", - "SMBSendRecvAcc", - "SMBQuickAcc" + "QWordAcc", + "BufferAcc", }; @@ -739,15 +739,6 @@ AcpiUtInitGlobals ( AcpiGbl_AcpiTables[i].Count = 0; } - - /* Address Space handler array */ - - for (i = 0; i < ACPI_NUM_ADDRESS_SPACES; i++) - { - AcpiGbl_AddressSpaces[i].Handler = NULL; - AcpiGbl_AddressSpaces[i].Context = NULL; - } - /* Mutex locked flags */ for (i = 0; i < NUM_MTX; i++) @@ -777,8 +768,6 @@ AcpiUtInitGlobals ( /* Miscellaneous variables */ - AcpiGbl_SystemFlags = 0; - AcpiGbl_StartupFlags = 0; AcpiGbl_RsdpOriginalLocation = 0; AcpiGbl_CmSingleStep = FALSE; AcpiGbl_DbTerminateThreads = FALSE; diff --git a/sys/contrib/dev/acpica/utinit.c b/sys/contrib/dev/acpica/utinit.c index 35c9b4f..40a4294 100644 --- a/sys/contrib/dev/acpica/utinit.c +++ b/sys/contrib/dev/acpica/utinit.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utinit - Common ACPI subsystem initialization - * $Revision: 102 $ + * $Revision: 103 $ * *****************************************************************************/ @@ -121,8 +121,6 @@ #include "achware.h" #include "acnamesp.h" #include "acevents.h" -#include "acparser.h" -#include "acdispat.h" #define _COMPONENT ACPI_UTILITIES MODULE_NAME ("utinit") @@ -322,7 +320,6 @@ AcpiUtSubsystemShutdown (void) AcpiGbl_Shutdown = TRUE; ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Shutting down ACPI Subsystem...\n")); - /* Close the Namespace */ AcpiNsTerminate (); @@ -335,17 +332,9 @@ AcpiUtSubsystemShutdown (void) AcpiUtTerminate (); - /* Flush the local cache(s) */ - - AcpiUtDeleteGenericStateCache (); - AcpiUtDeleteObjectCache (); - AcpiDsDeleteWalkStateCache (); - - /* Close the Parser */ - - /* TBD: [Restructure] AcpiPsTerminate () */ + /* Purge the local caches */ - AcpiPsDeleteParseCache (); + AcpiPurgeCachedObjects (); /* Debug only - display leftover memory allocation, if any */ diff --git a/sys/contrib/dev/acpica/utmath.c b/sys/contrib/dev/acpica/utmath.c index f7bf84e..1ac8cf4 100644 --- a/sys/contrib/dev/acpica/utmath.c +++ b/sys/contrib/dev/acpica/utmath.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: utmath - Integer math support routines - * $Revision: 7 $ + * $Revision: 8 $ * ******************************************************************************/ @@ -129,7 +129,7 @@ * library is not available. */ -#ifndef ACPI_USE_NATIVE_DIVIDE +#ifndef ACPI_USE_NATIVE_DIVIDE /******************************************************************************* * * FUNCTION: AcpiUtShortDivide @@ -175,9 +175,9 @@ AcpiUtShortDivide ( * The quotient is 64 bits, the remainder is always 32 bits, * and is generated by the second divide. */ - ACPI_DIV_64_BY_32 (0, Dividend.Part.Hi, Divisor, + ACPI_DIV_64_BY_32 (0, Dividend.Part.Hi, Divisor, Quotient.Part.Hi, Remainder32); - ACPI_DIV_64_BY_32 (Remainder32, Dividend.Part.Lo, Divisor, + ACPI_DIV_64_BY_32 (Remainder32, Dividend.Part.Lo, Divisor, Quotient.Part.Lo, Remainder32); /* Return only what was requested */ @@ -253,9 +253,9 @@ AcpiUtDivide ( * The quotient is 64 bits, the remainder is always 32 bits, * and is generated by the second divide. */ - ACPI_DIV_64_BY_32 (0, Dividend.Part.Hi, Divisor.Part.Lo, + ACPI_DIV_64_BY_32 (0, Dividend.Part.Hi, Divisor.Part.Lo, Quotient.Part.Hi, Partial1); - ACPI_DIV_64_BY_32 (Partial1, Dividend.Part.Lo, Divisor.Part.Lo, + ACPI_DIV_64_BY_32 (Partial1, Dividend.Part.Lo, Divisor.Part.Lo, Quotient.Part.Lo, Remainder.Part.Lo); } @@ -273,18 +273,18 @@ AcpiUtDivide ( do { - ACPI_SHIFT_RIGHT_64 (NormalizedDivisor.Part.Hi, + ACPI_SHIFT_RIGHT_64 (NormalizedDivisor.Part.Hi, NormalizedDivisor.Part.Lo); - ACPI_SHIFT_RIGHT_64 (NormalizedDividend.Part.Hi, + ACPI_SHIFT_RIGHT_64 (NormalizedDividend.Part.Hi, NormalizedDividend.Part.Lo); } while (NormalizedDivisor.Part.Hi != 0); /* Partial divide */ - ACPI_DIV_64_BY_32 (NormalizedDividend.Part.Hi, - NormalizedDividend.Part.Lo, - NormalizedDivisor.Part.Lo, + ACPI_DIV_64_BY_32 (NormalizedDividend.Part.Hi, + NormalizedDividend.Part.Lo, + NormalizedDivisor.Part.Lo, Quotient.Part.Lo, Partial1); /* @@ -351,8 +351,8 @@ AcpiUtDivide ( * DESCRIPTION: Native versions of the UtDivide functions. Use these if either * 1) The target is a 64-bit platform and therefore 64-bit * integer math is supported directly by the machine. - * 2) The target is a 32-bit or 16-bit platform, and the - * double-precision integer math library is available to + * 2) The target is a 32-bit or 16-bit platform, and the + * double-precision integer math library is available to * perform the divide. * ******************************************************************************/ diff --git a/sys/contrib/dev/acpica/utmisc.c b/sys/contrib/dev/acpica/utmisc.c index c4c99f2..e0e1fa1 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: 52 $ + * $Revision: 56 $ * ******************************************************************************/ @@ -130,7 +130,6 @@ MODULE_NAME ("utmisc") - /******************************************************************************* * * FUNCTION: AcpiUtValidAcpiName @@ -749,6 +748,46 @@ AcpiUtCreateGenericState (void) /******************************************************************************* * + * FUNCTION: AcpiUtCreateThreadState + * + * PARAMETERS: None + * + * RETURN: Thread State + * + * DESCRIPTION: Create a "Thread State" - a flavor of the generic state used + * to track per-thread info during method execution + * + ******************************************************************************/ + +ACPI_THREAD_STATE * +AcpiUtCreateThreadState ( + void) +{ + ACPI_GENERIC_STATE *State; + + + FUNCTION_TRACE ("UtCreateThreadState"); + + + /* Create the generic state object */ + + State = AcpiUtCreateGenericState (); + if (!State) + { + return_PTR (NULL); + } + + /* Init fields specific to the update struct */ + + State->Common.DataType = ACPI_DESC_TYPE_STATE_THREAD; + State->Thread.ThreadId = AcpiOsGetThreadId (); + + return_PTR ((ACPI_THREAD_STATE *) State); +} + + +/******************************************************************************* + * * FUNCTION: AcpiUtCreateUpdateState * * PARAMETERS: Object - Initial Object to be installed in the @@ -779,7 +818,7 @@ AcpiUtCreateUpdateState ( State = AcpiUtCreateGenericState (); if (!State) { - return (NULL); + return_PTR (NULL); } /* Init fields specific to the update struct */ @@ -823,7 +862,7 @@ AcpiUtCreatePkgState ( State = AcpiUtCreateGenericState (); if (!State) { - return (NULL); + return_PTR (NULL); } /* Init fields specific to the update struct */ @@ -866,7 +905,7 @@ AcpiUtCreateControlState ( State = AcpiUtCreateGenericState (); if (!State) { - return (NULL); + return_PTR (NULL); } @@ -1077,7 +1116,7 @@ AcpiUtWalkPackageTree ( State->Pkg.SourceObject->Package.Elements[ThisIndex]; /* - * Check for + * Check for: * 1) An uninitialized package element. It is completely * legal to declare a package and leave it uninitialized * 2) Not an internal object - can be a namespace node instead @@ -1095,8 +1134,6 @@ AcpiUtWalkPackageTree ( State, Context); if (ACPI_FAILURE (Status)) { - /* TBD: must delete package created up to this point */ - return_ACPI_STATUS (Status); } @@ -1113,7 +1150,6 @@ AcpiUtWalkPackageTree ( AcpiUtDeleteGenericState (State); State = AcpiUtPopGenericState (&StateList); - /* Finished when there are no more states */ if (!State) @@ -1133,35 +1169,26 @@ AcpiUtWalkPackageTree ( State->Pkg.Index++; } } - else { - /* This is a sub-object of type package */ + /* This is a subobject of type package */ Status = WalkCallback (ACPI_COPY_TYPE_PACKAGE, ThisSourceObj, State, Context); if (ACPI_FAILURE (Status)) { - /* TBD: must delete package created up to this point */ - return_ACPI_STATUS (Status); } - - /* - * The callback above returned a new target package object. - */ - /* * Push the current state and create a new one + * The callback above returned a new target package object. */ AcpiUtPushGenericState (&StateList, State); State = AcpiUtCreatePkgState (ThisSourceObj, State->Pkg.ThisTargetObj, 0); if (!State) { - /* TBD: must delete package created up to this point */ - return_ACPI_STATUS (AE_NO_MEMORY); } } @@ -1169,7 +1196,7 @@ AcpiUtWalkPackageTree ( /* We should never get here */ - return (AE_AML_INTERNAL); + return_ACPI_STATUS (AE_AML_INTERNAL); } diff --git a/sys/contrib/dev/acpica/utobject.c b/sys/contrib/dev/acpica/utobject.c index 52979a3..b8fa4ab 100644 --- a/sys/contrib/dev/acpica/utobject.c +++ b/sys/contrib/dev/acpica/utobject.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utobject - ACPI object create/delete/size/cache routines - * $Revision: 57 $ + * $Revision: 61 $ * *****************************************************************************/ @@ -157,6 +157,7 @@ AcpiUtCreateInternalObjectDbg ( ACPI_OBJECT_TYPE8 Type) { ACPI_OPERAND_OBJECT *Object; + ACPI_OPERAND_OBJECT *SecondObject; FUNCTION_TRACE_STR ("UtCreateInternalObjectDbg", AcpiUtGetTypeName (Type)); @@ -167,11 +168,32 @@ AcpiUtCreateInternalObjectDbg ( Object = AcpiUtAllocateObjectDescDbg (ModuleName, LineNumber, ComponentId); if (!Object) { - /* Allocation failure */ - return_PTR (NULL); } + switch (Type) + { + case ACPI_TYPE_REGION: + case ACPI_TYPE_BUFFER_FIELD: + + /* These types require a secondary object */ + + SecondObject = AcpiUtAllocateObjectDescDbg (ModuleName, LineNumber, ComponentId); + if (!SecondObject) + { + AcpiUtDeleteObjectDesc (Object); + return_PTR (NULL); + } + + SecondObject->Common.Type = INTERNAL_TYPE_EXTRA; + SecondObject->Common.ReferenceCount = 1; + + /* Link the second object to the first */ + + Object->Common.NextObject = SecondObject; + break; + } + /* Save the object type in the object descriptor */ Object->Common.Type = Type; @@ -355,7 +377,6 @@ AcpiUtDeleteObjectCache ( } - /******************************************************************************* * * FUNCTION: AcpiUtGetSimpleObjectSize @@ -578,6 +599,10 @@ AcpiUtGetPackageObjectSize ( Status = AcpiUtWalkPackageTree (InternalObject, NULL, AcpiUtGetElementLength, &Info); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } /* * We have handled all of the objects in all levels of the package. diff --git a/sys/contrib/dev/acpica/utxface.c b/sys/contrib/dev/acpica/utxface.c index 67b18bf..5400026 100644 --- a/sys/contrib/dev/acpica/utxface.c +++ b/sys/contrib/dev/acpica/utxface.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utxface - External interfaces for "global" ACPI functions - * $Revision: 82 $ + * $Revision: 85 $ * *****************************************************************************/ @@ -125,6 +125,8 @@ #include "amlcode.h" #include "acdebug.h" #include "acexcep.h" +#include "acparser.h" +#include "acdispat.h" #define _COMPONENT ACPI_UTILITIES @@ -295,7 +297,6 @@ AcpiEnableSubsystem ( } } - /* * Initialize all device objects in the namespace * This runs the _STA and _INI methods. @@ -311,7 +312,6 @@ AcpiEnableSubsystem ( } } - /* * Initialize the objects that remain uninitialized. This * runs the executable AML that is part of the declaration of OpRegions @@ -328,8 +328,14 @@ AcpiEnableSubsystem ( } } - AcpiGbl_StartupFlags |= ACPI_INITIALIZED_OK; + /* + * Empty the caches (delete the cached objects) on the assumption that + * the table load filled them up more than they will be at runtime -- + * thus wasting non-paged memory. + */ + Status = AcpiPurgeCachedObjects (); + AcpiGbl_StartupFlags |= ACPI_INITIALIZED_OK; return_ACPI_STATUS (Status); } @@ -356,10 +362,6 @@ AcpiTerminate (void) DEBUGGER_EXEC(AcpiGbl_DbTerminateThreads = TRUE); - /* TBD: [Investigate] This is no longer needed?*/ -/* AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_READY); */ - - /* Shutdown and free all resources */ AcpiUtSubsystemShutdown (); @@ -474,7 +476,7 @@ AcpiGetSystemInfo ( /* System flags (ACPI capabilities) */ - InfoPtr->Flags = AcpiGbl_SystemFlags; + InfoPtr->Flags = SYS_MODE_ACPI; /* Timer resolution - 24 or 32 bits */ if (!AcpiGbl_FADT) @@ -512,3 +514,28 @@ AcpiGetSystemInfo ( } +/***************************************************************************** + * + * FUNCTION: AcpiPurgeCachedObjects + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Empty all caches (delete the cached objects) + * + ****************************************************************************/ + +ACPI_STATUS +AcpiPurgeCachedObjects (void) +{ + FUNCTION_TRACE ("AcpiPurgeCachedObjects"); + + + AcpiUtDeleteGenericStateCache (); + AcpiUtDeleteObjectCache (); + AcpiDsDeleteWalkStateCache (); + AcpiPsDeleteParseCache (); + + return_ACPI_STATUS (AE_OK); +} |