diff --git a/sys/contrib/dev/acpica/acdebug.h b/sys/contrib/dev/acpica/acdebug.h index 5f89e28128b1..0d5e69b72846 100644 --- a/sys/contrib/dev/acpica/acdebug.h +++ b/sys/contrib/dev/acpica/acdebug.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acdebug.h - ACPI/AML debugger - * $Revision: 47 $ + * $Revision: 49 $ * *****************************************************************************/ @@ -126,7 +126,7 @@ extern int optind; extern NATIVE_CHAR *optarg; -extern UINT8 *AmlPtr; +extern UINT8 *AmlStart; extern UINT32 AmlLength; extern BOOLEAN AcpiGbl_DbOpt_tables; @@ -148,6 +148,7 @@ extern NATIVE_CHAR *AcpiGbl_DbDisasmIndent; extern UINT8 AcpiGbl_DbOutputFlags; extern UINT32 AcpiGbl_DbDebugLevel; extern UINT32 AcpiGbl_DbConsoleDebugLevel; +extern ACPI_TABLE_HEADER *AcpiGbl_DbTablePtr; /* * Statistic globals @@ -210,6 +211,10 @@ int AcpiDbInitialize ( void); +void +AcpiDbTerminate ( + void); + ACPI_STATUS AcpiDbSingleStep ( ACPI_WALK_STATE *WalkState, diff --git a/sys/contrib/dev/acpica/acdispat.h b/sys/contrib/dev/acpica/acdispat.h index 32b0d2e20af9..6e09b0804dbe 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: 40 $ + * $Revision: 44 $ * *****************************************************************************/ @@ -177,20 +177,16 @@ AcpiDsExecEndControlOp ( ACPI_STATUS AcpiDsGetPredicateValue ( ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op, UINT32 HasResultObj); ACPI_STATUS AcpiDsExecBeginOp ( - UINT16 Opcode, - ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT **OutOp); ACPI_STATUS AcpiDsExecEndOp ( - ACPI_WALK_STATE *State, - ACPI_PARSE_OBJECT *Op); + ACPI_WALK_STATE *State); /* dsfield - Parser/Interpreter interface for AML fields */ @@ -219,39 +215,26 @@ AcpiDsCreateIndexField ( ACPI_STATUS AcpiDsLoad1BeginOp ( - UINT16 Opcode, - ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT **OutOp); ACPI_STATUS AcpiDsLoad1EndOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op); + ACPI_WALK_STATE *WalkState); ACPI_STATUS AcpiDsLoad2BeginOp ( - UINT16 Opcode, - ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT **OutOp); ACPI_STATUS AcpiDsLoad2EndOp ( - ACPI_WALK_STATE *State, - ACPI_PARSE_OBJECT *Op); + ACPI_WALK_STATE *WalkState); ACPI_STATUS -AcpiDsLoad3BeginOp ( - UINT16 Opcode, - ACPI_PARSE_OBJECT *Op, +AcpiDsInitCallbacks ( ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT **OutOp); - -ACPI_STATUS -AcpiDsLoad3EndOp ( - ACPI_WALK_STATE *State, - ACPI_PARSE_OBJECT *Op); + UINT32 PassNumber); /* dsmthdat - method data (locals/args) */ @@ -465,7 +448,7 @@ AcpiDsScopeStackClear ( ACPI_WALK_STATE *WalkState); -/* AcpiDswstate - parser WALK_STATE management routines */ +/* dswstate - parser WALK_STATE management routines */ ACPI_WALK_STATE * AcpiDsCreateWalkState ( @@ -474,6 +457,17 @@ AcpiDsCreateWalkState ( ACPI_OPERAND_OBJECT *MthDesc, ACPI_WALK_LIST *WalkList); +ACPI_STATUS +AcpiDsInitAmlWalk ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op, + ACPI_NAMESPACE_NODE *MethodNode, + UINT8 *AmlStart, + UINT32 AmlLength, + ACPI_OPERAND_OBJECT **Params, + ACPI_OPERAND_OBJECT **ReturnObjDesc, + UINT32 PassNumber); + ACPI_STATUS AcpiDsObjStackDeleteAll ( ACPI_WALK_STATE *WalkState); @@ -491,6 +485,11 @@ ACPI_WALK_STATE * AcpiDsPopWalkState ( ACPI_WALK_LIST *WalkList); +void +AcpiDsPushWalkState ( + ACPI_WALK_STATE *WalkState, + ACPI_WALK_LIST *WalkList); + ACPI_STATUS AcpiDsResultStackPop ( ACPI_WALK_STATE *WalkState); diff --git a/sys/contrib/dev/acpica/acevents.h b/sys/contrib/dev/acpica/acevents.h index e350ebe5c725..9ef26b79a139 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: 65 $ + * $Revision: 66 $ * *****************************************************************************/ @@ -253,6 +253,20 @@ AcpiEvPciConfigRegionSetup ( void *HandlerContext, void **RegionContext); +ACPI_STATUS +AcpiEvCmosRegionSetup ( + ACPI_HANDLE Handle, + UINT32 Function, + void *HandlerContext, + void **RegionContext); + +ACPI_STATUS +AcpiEvPciBarRegionSetup ( + ACPI_HANDLE Handle, + UINT32 Function, + void *HandlerContext, + void **RegionContext); + ACPI_STATUS AcpiEvDefaultRegionSetup ( ACPI_HANDLE Handle, diff --git a/sys/contrib/dev/acpica/achware.h b/sys/contrib/dev/acpica/achware.h index 9b2f90bde00b..341bc4e9bf19 100644 --- a/sys/contrib/dev/acpica/achware.h +++ b/sys/contrib/dev/acpica/achware.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: achware.h -- hardware specific interfaces - * $Revision: 55 $ + * $Revision: 56 $ * *****************************************************************************/ @@ -196,21 +196,38 @@ AcpiHwGetBitShift ( void AcpiHwEnableGpe ( - UINT32 GpeIndex); + UINT32 GpeNumber); + +void +AcpiHwEnableGpeForWakeup ( + UINT32 GpeNumber); void AcpiHwDisableGpe ( - UINT32 GpeIndex); + UINT32 GpeNumber); + +void +AcpiHwDisableGpeForWakeup ( + UINT32 GpeNumber); void AcpiHwClearGpe ( - UINT32 GpeIndex); + UINT32 GpeNumber); void AcpiHwGetGpeStatus ( UINT32 GpeNumber, ACPI_EVENT_STATUS *EventStatus); +void +AcpiHwDisableNonWakeupGpes ( + void); + +void +AcpiHwEnableNonWakeupGpes ( + void); + + /* Sleep Prototypes */ ACPI_STATUS diff --git a/sys/contrib/dev/acpica/acinterp.h b/sys/contrib/dev/acpica/acinterp.h index a3429ce6d17a..295bf80b74fc 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: 106 $ + * $Revision: 110 $ * *****************************************************************************/ @@ -271,26 +271,21 @@ AcpiExWriteDataToField ( ACPI_STATUS AcpiExTriadic ( - UINT16 Opcode, - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT **ReturnDesc); + ACPI_WALK_STATE *WalkState); ACPI_STATUS AcpiExHexadic ( - UINT16 Opcode, - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT **ReturnDesc); + ACPI_WALK_STATE *WalkState); ACPI_STATUS AcpiExCreateBufferField ( - UINT8 *AmlPtr, + UINT8 *AmlStart, UINT32 AmlLength, ACPI_NAMESPACE_NODE *Node, ACPI_WALK_STATE *WalkState); ACPI_STATUS AcpiExReconfiguration ( - UINT16 Opcode, ACPI_WALK_STATE *WalkState); ACPI_STATUS @@ -309,11 +304,15 @@ AcpiExCreatePowerResource ( ACPI_STATUS AcpiExCreateRegion ( - UINT8 *AmlPtr, + UINT8 *AmlStart, UINT32 AmlLength, UINT8 RegionSpace, ACPI_WALK_STATE *WalkState); +ACPI_STATUS +AcpiExCreateTableRegion ( + ACPI_WALK_STATE *WalkState); + ACPI_STATUS AcpiExCreateEvent ( ACPI_WALK_STATE *WalkState); @@ -324,7 +323,7 @@ AcpiExCreateAlias ( ACPI_STATUS AcpiExCreateMethod ( - UINT8 *AmlPtr, + UINT8 *AmlStart, UINT32 AmlLength, UINT32 MethodFlags, ACPI_NAMESPACE_NODE *Method); @@ -444,20 +443,15 @@ AcpiExSystemWaitSemaphore ( ACPI_STATUS AcpiExMonadic1 ( - UINT16 Opcode, ACPI_WALK_STATE *WalkState); ACPI_STATUS AcpiExMonadic2 ( - UINT16 Opcode, - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT **ReturnDesc); + ACPI_WALK_STATE *WalkState); ACPI_STATUS AcpiExMonadic2R ( - UINT16 Opcode, - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT **ReturnDesc); + ACPI_WALK_STATE *WalkState); /* @@ -466,26 +460,19 @@ AcpiExMonadic2R ( ACPI_STATUS AcpiExDyadic1 ( - UINT16 Opcode, ACPI_WALK_STATE *WalkState); ACPI_STATUS AcpiExDyadic2 ( - UINT16 Opcode, - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT **ReturnDesc); + ACPI_WALK_STATE *WalkState); ACPI_STATUS AcpiExDyadic2R ( - UINT16 Opcode, - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT **ReturnDesc); + ACPI_WALK_STATE *WalkState); ACPI_STATUS AcpiExDyadic2S ( - UINT16 Opcode, - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT **ReturnDesc); + ACPI_WALK_STATE *WalkState); /* @@ -520,7 +507,7 @@ AcpiExGetBufferFieldValue ( void AcpiExShowHexValue ( UINT32 ByteCount, - UINT8 *AmlPtr, + UINT8 *AmlStart, UINT32 LeadSpace); @@ -738,6 +725,24 @@ AcpiExPciConfigSpaceHandler ( void *HandlerContext, void *RegionContext); +ACPI_STATUS +AcpiExCmosSpaceHandler ( + UINT32 Function, + ACPI_PHYSICAL_ADDRESS Address, + UINT32 BitWidth, + UINT32 *Value, + void *HandlerContext, + void *RegionContext); + +ACPI_STATUS +AcpiExPciBarSpaceHandler ( + UINT32 Function, + ACPI_PHYSICAL_ADDRESS Address, + UINT32 BitWidth, + UINT32 *Value, + void *HandlerContext, + void *RegionContext); + ACPI_STATUS AcpiExEmbeddedControllerSpaceHandler ( UINT32 Function, diff --git a/sys/contrib/dev/acpica/aclocal.h b/sys/contrib/dev/acpica/aclocal.h index 135da9f7cdcc..5088c171ab81 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: 130 $ + * $Revision: 134 $ * *****************************************************************************/ @@ -131,7 +131,15 @@ typedef UINT32 ACPI_MUTEX_HANDLE; /* Object descriptor types */ #define ACPI_CACHED_OBJECT 0x11 /* ORed in when object is cached */ -#define ACPI_DESC_TYPE_STATE 0x22 +#define ACPI_DESC_TYPE_STATE 0x20 +#define ACPI_DESC_TYPE_STATE_UPDATE 0x21 +#define ACPI_DESC_TYPE_STATE_PACKAGE 0x22 +#define ACPI_DESC_TYPE_STATE_CONTROL 0x23 +#define ACPI_DESC_TYPE_STATE_RPSCOPE 0x24 +#define ACPI_DESC_TYPE_STATE_PSCOPE 0x25 +#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_WALK 0x44 #define ACPI_DESC_TYPE_PARSER 0x66 #define ACPI_DESC_TYPE_INTERNAL 0x88 @@ -307,7 +315,7 @@ typedef struct AcpiTableDesc struct AcpiTableDesc *InstalledDesc; ACPI_TABLE_HEADER *Pointer; void *BasePointer; - UINT8 *AmlPointer; + UINT8 *AmlStart; UINT64 PhysicalAddress; UINT32 AmlLength; UINT32 Length; @@ -409,10 +417,11 @@ typedef struct typedef struct { - UINT8 Status; /* Current value of status reg */ - UINT8 Enable; /* Current value of enable reg */ UINT16 StatusAddr; /* Address of status reg */ UINT16 EnableAddr; /* Address of enable reg */ + UINT8 Status; /* Current value of status reg */ + UINT8 Enable; /* Current value of enable reg */ + UINT8 WakeEnable; /* Mask of bits to keep enabled when sleeping */ UINT8 GpeBase; /* Base GPE number */ } ACPI_GPE_REGISTERS; @@ -568,6 +577,16 @@ typedef struct acpi_result_values } ACPI_RESULT_VALUES; +typedef +ACPI_STATUS (*ACPI_PARSE_DOWNWARDS) ( + struct acpi_walk_state *WalkState, + struct acpi_parse_obj **OutOp); + +typedef +ACPI_STATUS (*ACPI_PARSE_UPWARDS) ( + struct acpi_walk_state *WalkState); + + /* * Notify info - used to pass info to the deferred notify * handler/dispatcher. @@ -597,19 +616,6 @@ typedef union acpi_gen_state } ACPI_GENERIC_STATE; -typedef -ACPI_STATUS (*ACPI_PARSE_DOWNWARDS) ( - UINT16 Opcode, - struct acpi_parse_obj *Op, - struct acpi_walk_state *WalkState, - struct acpi_parse_obj **OutOp); - -typedef -ACPI_STATUS (*ACPI_PARSE_UPWARDS) ( - struct acpi_walk_state *WalkState, - struct acpi_parse_obj *Op); - - /***************************************************************************** * * Parser typedefs and structs @@ -718,18 +724,24 @@ typedef struct acpi_parse2_obj * Parse state - one state per parser invocation and each control * method. */ - typedef struct acpi_parse_state { + UINT32 AmlSize; UINT8 *AmlStart; /* first AML byte */ UINT8 *Aml; /* next AML byte */ UINT8 *AmlEnd; /* (last + 1) AML byte */ UINT8 *PkgStart; /* current package begin */ UINT8 *PkgEnd; /* current package end */ - ACPI_PARSE_OBJECT *StartOp; /* root of parse tree */ + + struct acpi_parse_obj *StartOp; /* root of parse tree */ struct acpi_node *StartNode; - ACPI_GENERIC_STATE *Scope; /* current scope */ - struct acpi_parse_state *Next; + union acpi_gen_state *Scope; /* current scope */ + + + struct acpi_parse_obj *StartScope; + + + } ACPI_PARSE_STATE; diff --git a/sys/contrib/dev/acpica/acmacros.h b/sys/contrib/dev/acpica/acmacros.h index 755bdb0a0865..d798656af2c0 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: 94 $ + * $Revision: 96 $ * *****************************************************************************/ @@ -288,11 +288,6 @@ #define MUL_16(a) _MUL(a,4) #define MOD_16(a) _MOD(a,16) -/* - * Divide and Modulo - */ -#define ACPI_DIVIDE(n,d) ((n) / (d)) -#define ACPI_MODULO(n,d) ((n) % (d)) /* * Rounding macros (Power of two boundaries only) @@ -370,10 +365,6 @@ #define IS_SINGLE_TABLE(x) (((x) & 0x01) == ACPI_TABLE_SINGLE ? 1 : 0) -/* Check if ACPI has been initialized properly */ - -#define ACPI_IS_INITIALIZATION_COMPLETE(s) {if (AcpiGbl_RootNode) s = AE_OK; else s=AE_NO_NAMESPACE;} - /* * Macro to check if a pointer is within an ACPI table. * Parameter (a) is the pointer to check. Parameter (b) must be defined diff --git a/sys/contrib/dev/acpica/acnamesp.h b/sys/contrib/dev/acpica/acnamesp.h index 5554a81887d3..5de866e12c37 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: 106 $ + * $Revision: 107 $ * *****************************************************************************/ @@ -255,7 +255,7 @@ AcpiNsLookup ( ACPI_NAMESPACE_NODE * AcpiNsCreateNode ( - UINT32 AcpiName); + UINT32 Name); void AcpiNsDeleteNode ( diff --git a/sys/contrib/dev/acpica/acobject.h b/sys/contrib/dev/acpica/acobject.h index 14dc7a606d78..ce86fa2102e0 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: 90 $ + * $Revision: 92 $ * *****************************************************************************/ @@ -189,6 +189,15 @@ #define AFIELD_SINGLE_DATUM 0x1 +/* + * Fields common to both Strings and Buffers + */ +#define ACPI_COMMON_BUFFER_INFO \ + UINT32 Length; \ + NATIVE_CHAR *Pointer; /* String value in AML stream or in allocated space */ + + + /****************************************************************************** * * Individual Object Descriptors @@ -223,9 +232,7 @@ typedef struct /* NUMBER - has value */ typedef struct /* STRING - has length and pointer - Null terminated, ASCII characters only */ { ACPI_OBJECT_COMMON_HEADER - - UINT32 Length; - NATIVE_CHAR *Pointer; /* String value in AML stream or in allocated space */ + ACPI_COMMON_BUFFER_INFO } ACPI_OBJECT_STRING; @@ -233,9 +240,7 @@ typedef struct /* STRING - has length and pointer - Null terminated, ASCII chara typedef struct /* BUFFER - has length and pointer - not null terminated */ { ACPI_OBJECT_COMMON_HEADER - - UINT32 Length; - UINT8 *Pointer; /* points to the buffer in allocated space */ + ACPI_COMMON_BUFFER_INFO } ACPI_OBJECT_BUFFER; @@ -245,7 +250,6 @@ typedef struct /* PACKAGE - has count, elements, next element */ ACPI_OBJECT_COMMON_HEADER UINT32 Count; /* # of elements in package */ - union acpi_operand_obj **Elements; /* Array of pointers to AcpiObjects */ union acpi_operand_obj **NextElement; /* used only while initializing */ @@ -279,10 +283,10 @@ typedef struct /* METHOD */ UINT8 MethodFlags; UINT8 ParamCount; - UINT32 PcodeLength; + UINT32 AmlLength; void *Semaphore; - UINT8 *Pcode; + UINT8 *AmlStart; UINT8 Concurrency; UINT8 ThreadCount; @@ -493,8 +497,8 @@ typedef struct /* EXTRA */ ACPI_OBJECT_COMMON_HEADER UINT8 ByteFill1; UINT16 WordFill1; - UINT32 PcodeLength; - UINT8 *Pcode; + UINT32 AmlLength; + UINT8 *AmlStart; ACPI_NAMESPACE_NODE *Method_REG; /* _REG method for this region (if any) */ void *RegionContext; /* Region-specific data */ diff --git a/sys/contrib/dev/acpica/acparser.h b/sys/contrib/dev/acpica/acparser.h index 48f6fddb91b2..396cdb24df5e 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: 51 $ + * $Revision: 54 $ * *****************************************************************************/ @@ -212,8 +212,6 @@ AcpiPsGetOpcodeName ( ACPI_STATUS AcpiPsFindObject ( - UINT16 Opcode, - ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT **OutOp); @@ -227,15 +225,7 @@ AcpiPsParseLoop ( ACPI_STATUS AcpiPsParseAml ( - ACPI_PARSE_OBJECT *StartScope, - UINT8 *Aml, - UINT32 AmlSize, - UINT32 ParseFlags, - ACPI_NAMESPACE_NODE *MethodNode, - ACPI_OPERAND_OBJECT **Params, - ACPI_OPERAND_OBJECT **CallerReturnDesc, - ACPI_PARSE_DOWNWARDS DescendingCallback, - ACPI_PARSE_UPWARDS AscendingCallback); + ACPI_WALK_STATE *WalkState); ACPI_STATUS AcpiPsParseTable ( @@ -337,12 +327,6 @@ AcpiPsGetNextWalkOp ( /* psutils - parser utilities */ - -ACPI_PARSE_STATE * -AcpiPsCreateState ( - UINT8 *Aml, - UINT32 AmlSize); - void AcpiPsInitOp ( ACPI_PARSE_OBJECT *op, diff --git a/sys/contrib/dev/acpica/acstruct.h b/sys/contrib/dev/acpica/acstruct.h index d76bc2a1f197..f380465b1508 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: 5 $ + * $Revision: 8 $ * *****************************************************************************/ @@ -142,46 +142,51 @@ typedef struct acpi_walk_state UINT8 DataType; /* To differentiate various internal objs MUST BE FIRST!*/\ ACPI_OWNER_ID OwnerId; /* Owner of objects created during the walk */ BOOLEAN LastPredicate; /* Result of last predicate */ + UINT8 CurrentResult; /* */ UINT8 NextOpInfo; /* Info about NextOp */ UINT8 NumOperands; /* Stack pointer for Operands[] array */ - UINT8 CurrentResult; /* */ + 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; + UINT32 ArgTypes; + UINT32 MethodBreakpoint; /* For single stepping */ + UINT32 ParseFlags; + UINT32 PrevArgTypes; - struct acpi_walk_state *Next; /* Next WalkState in list */ + + UINT8 *AmlLastWhile; + struct acpi_node Arguments[MTH_NUM_ARGS]; /* Control method arguments */ + union acpi_operand_obj **CallerReturnDesc; + ACPI_GENERIC_STATE *ControlState; /* List of control states (nested IFs) */ + struct acpi_node LocalVariables[MTH_NUM_LOCALS]; /* Control method locals */ + struct acpi_node *MethodCallNode; /* Called method Node*/ + ACPI_PARSE_OBJECT *MethodCallOp; /* MethodCall Op if running a method */ + union acpi_operand_obj *MethodDesc; /* Method descriptor if running a method */ + struct acpi_node *MethodNode; /* Method Node if running a method */ + ACPI_PARSE_OBJECT *Op; /* Current parser op */ + union acpi_operand_obj *Operands[OBJ_NUM_OPERANDS+1]; /* Operands passed to the interpreter (+1 for NULL terminator) */ + const ACPI_OPCODE_INFO *OpInfo; /* Info on current opcode */ ACPI_PARSE_OBJECT *Origin; /* Start of walk [Obsolete] */ + union acpi_operand_obj **Params; + ACPI_PARSE_STATE ParserState; /* Current state of parser */ + union acpi_operand_obj *ResultObj; + ACPI_GENERIC_STATE *Results; /* Stack of accumulated results */ + union acpi_operand_obj *ReturnDesc; /* Return object, if any */ + ACPI_GENERIC_STATE *ScopeInfo; /* Stack of nested scopes */ /* TBD: Obsolete with removal of WALK procedure ? */ ACPI_PARSE_OBJECT *PrevOp; /* Last op that was processed */ ACPI_PARSE_OBJECT *NextOp; /* next op to be processed */ - ACPI_GENERIC_STATE *Results; /* Stack of accumulated results */ - ACPI_GENERIC_STATE *ControlState; /* List of control states (nested IFs) */ - ACPI_GENERIC_STATE *ScopeInfo; /* Stack of nested scopes */ - ACPI_PARSE_STATE *ParserState; /* Current state of parser */ - UINT8 *AmlLastWhile; - const ACPI_OPCODE_INFO *OpInfo; /* Info on current opcode */ ACPI_PARSE_DOWNWARDS DescendingCallback; ACPI_PARSE_UPWARDS AscendingCallback; - - union acpi_operand_obj *ReturnDesc; /* Return object, if any */ - union acpi_operand_obj *MethodDesc; /* Method descriptor if running a method */ - struct acpi_node *MethodNode; /* Method Node if running a method */ - ACPI_PARSE_OBJECT *MethodCallOp; /* MethodCall Op if running a method */ - struct acpi_node *MethodCallNode; /* Called method Node*/ - union acpi_operand_obj *Operands[OBJ_NUM_OPERANDS]; /* Operands passed to the interpreter */ - struct acpi_node Arguments[MTH_NUM_ARGS]; /* Control method arguments */ - struct acpi_node LocalVariables[MTH_NUM_LOCALS]; /* Control method locals */ struct acpi_walk_list *WalkList; - UINT32 ParseFlags; - UINT8 WalkType; - UINT8 ReturnUsed; - UINT16 Opcode; /* Current AML opcode */ - UINT32 PrevArgTypes; - UINT16 CurrentSyncLevel; /* Mutex Sync (nested acquire) level */ + struct acpi_walk_state *Next; /* Next WalkState in list */ - /* Debug support */ - - UINT32 MethodBreakpoint; } ACPI_WALK_STATE; diff --git a/sys/contrib/dev/acpica/actypes.h b/sys/contrib/dev/acpica/actypes.h index 2375901fb38a..a97464c3394b 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: 187 $ + * $Revision: 192 $ * *****************************************************************************/ @@ -159,9 +159,8 @@ typedef NATIVE_UINT ACPI_TBLPTR; typedef UINT64 ACPI_IO_ADDRESS; typedef UINT64 ACPI_PHYSICAL_ADDRESS; -#define ALIGNED_ADDRESS_BOUNDARY 0x00000008 - -/* (No hardware alignment support in IA64) */ +#define ALIGNED_ADDRESS_BOUNDARY 0x00000008 /* No hardware alignment support in IA64 */ +#define ACPI_USE_NATIVE_DIVIDE /* Native 64-bit integer support */ #elif _IA16 @@ -192,6 +191,7 @@ typedef char *ACPI_PHYSICAL_ADDRESS; #define ALIGNED_ADDRESS_BOUNDARY 0x00000002 #define _HW_ALIGNMENT_SUPPORT +#define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ /* * (16-bit only) internal integers must be 32-bits, so @@ -287,11 +287,18 @@ typedef void* ACPI_HANDLE; /* Actually a ptr to an typedef struct { - UINT32 Lo; - UINT32 Hi; + UINT32 Lo; + UINT32 Hi; } UINT64_STRUCT; +typedef union +{ + UINT64 Full; + UINT64_STRUCT Part; + +} UINT64_OVERLAY; + /* * Acpi integer width. In ACPI version 1, integers are @@ -311,6 +318,9 @@ typedef UINT32 ACPI_INTEGER; #define ACPI_MAX_BCD_DIGITS 8 #define ACPI_MAX_DECIMAL_DIGITS 10 +#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 32-bit divide */ + + #else /* 64-bit integers */ @@ -322,6 +332,9 @@ typedef UINT64 ACPI_INTEGER; #define ACPI_MAX_BCD_DIGITS 16 #define ACPI_MAX_DECIMAL_DIGITS 19 +#ifdef _IA64 +#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 64-bit divide */ +#endif #endif @@ -380,7 +393,7 @@ typedef UINT64 ACPI_INTEGER; #define ACPI_NOTIFY_DEVICE_CHECK_LIGHT (UINT8) 4 #define ACPI_NOTIFY_FREQUENCY_MISMATCH (UINT8) 5 #define ACPI_NOTIFY_BUS_MODE_MISMATCH (UINT8) 6 -#define ACPI_NOTIFY_POWER_FAULT (UINT8) 7 +#define ACPI_NOTIFY_POWER_FAULT (UINT8) 7 /* @@ -543,25 +556,37 @@ typedef UINT32 ACPI_EVENT_TYPE; #define ACPI_EVENT_LEVEL_TRIGGERED (ACPI_EVENT_TYPE) 1 #define ACPI_EVENT_EDGE_TRIGGERED (ACPI_EVENT_TYPE) 2 +/* + * GPEs + */ +#define ACPI_EVENT_ENABLE 0x1 +#define ACPI_EVENT_WAKE_ENABLE 0x2 + +#define ACPI_EVENT_DISABLE 0x1 +#define ACPI_EVENT_WAKE_DISABLE 0x2 + + /* * AcpiEvent Status: * ------------- * The encoding of ACPI_EVENT_STATUS is illustrated below. * Note that a set bit (1) indicates the property is TRUE * (e.g. if bit 0 is set then the event is enabled). - * +---------------+-+-+ - * | Bits 31:2 |1|0| - * +---------------+-+-+ - * | | | - * | | +- Enabled? - * | +--- Set? + * +-------------+-+-+-+ + * | Bits 31:3 |2|1|0| + * +-------------+-+-+-+ + * | | | | + * | | | +- Enabled? + * | | +--- Enabled for wake? + * | +----- Set? * +----------- */ typedef UINT32 ACPI_EVENT_STATUS; #define ACPI_EVENT_FLAG_DISABLED (ACPI_EVENT_STATUS) 0x00 #define ACPI_EVENT_FLAG_ENABLED (ACPI_EVENT_STATUS) 0x01 -#define ACPI_EVENT_FLAG_SET (ACPI_EVENT_STATUS) 0x02 +#define ACPI_EVENT_FLAG_WAKE_ENABLED (ACPI_EVENT_STATUS) 0x02 +#define ACPI_EVENT_FLAG_SET (ACPI_EVENT_STATUS) 0x04 /* Notify types */ diff --git a/sys/contrib/dev/acpica/acutils.h b/sys/contrib/dev/acpica/acutils.h index 4e9add60f093..71844e2aedd4 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: 112 $ + * $Revision: 115 $ * *****************************************************************************/ @@ -317,12 +317,12 @@ AcpiUtCopyIobjectToEobject ( ACPI_STATUS AcpiUtCopyEsimpleToIsimple( ACPI_OBJECT *UserObj, - ACPI_OPERAND_OBJECT *Obj); + ACPI_OPERAND_OBJECT **ReturnObj); ACPI_STATUS AcpiUtCopyEobjectToIobject ( ACPI_OBJECT *Obj, - ACPI_OPERAND_OBJECT *InternalObj); + ACPI_OPERAND_OBJECT **InternalObj); ACPI_STATUS AcpiUtCopyISimpleToIsimple ( @@ -653,9 +653,23 @@ AcpiUtDeleteObjectCache ( void); /* - * Ututils + * utmisc */ +ACPI_STATUS +AcpiUtDivide ( + ACPI_INTEGER *InDividend, + ACPI_INTEGER *InDivisor, + ACPI_INTEGER *OutQuotient, + ACPI_INTEGER *OutRemainder); + +ACPI_STATUS +AcpiUtShortDivide ( + ACPI_INTEGER *InDividend, + UINT32 Divisor, + ACPI_INTEGER *OutQuotient, + UINT32 *OutRemainder); + BOOLEAN AcpiUtValidAcpiName ( UINT32 Name); @@ -723,18 +737,13 @@ AcpiUtFree ( NATIVE_CHAR *Module, UINT32 Line); -void -AcpiUtInitStaticObject ( - ACPI_OPERAND_OBJECT *ObjDesc); - - #ifdef ACPI_DBG_TRACK_ALLOCATIONS void AcpiUtDumpAllocationInfo ( void); void -AcpiUtDumpCurrentAllocations ( +AcpiUtDumpAllocations ( UINT32 Component, NATIVE_CHAR *Module); #endif diff --git a/sys/contrib/dev/acpica/dbdisply.c b/sys/contrib/dev/acpica/dbdisply.c index f6da7838bc30..1d6d3bab71a0 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: 50 $ + * $Revision: 52 $ * ******************************************************************************/ @@ -500,7 +500,6 @@ AcpiDbDisplayInternalObject ( else if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_INTERNAL)) { - AcpiOsPrintf (" "); Type = ObjDesc->Common.Type; if (Type > INTERNAL_TYPE_MAX) { @@ -516,31 +515,37 @@ AcpiDbDisplayInternalObject ( switch (ObjDesc->Reference.Opcode) { case AML_ZERO_OP: - AcpiOsPrintf ("[Const] Zero (0) [Null Target]", 0); + AcpiOsPrintf ("[Const] Zero (0) [Null Target]", 0); break; case AML_ONES_OP: - AcpiOsPrintf ("[Const] Ones (0xFFFFFFFFFFFFFFFF) [No Limit]"); + AcpiOsPrintf ("[Const] Ones (0xFFFFFFFFFFFFFFFF) [No Limit]"); break; case AML_ONE_OP: - AcpiOsPrintf ("[Const] One (1)"); + AcpiOsPrintf ("[Const] One (1)"); + break; + + case AML_REVISION_OP: + AcpiOsPrintf ("[Const] Revision (%X)", ACPI_CA_VERSION); break; case AML_LOCAL_OP: - AcpiOsPrintf ("[Local%d] ", ObjDesc->Reference.Offset); + AcpiOsPrintf ("[Local%d]", ObjDesc->Reference.Offset); if (WalkState) { ObjDesc = WalkState->LocalVariables[ObjDesc->Reference.Offset].Object; + AcpiOsPrintf (" %p", ObjDesc); AcpiDbDecodeInternalObject (ObjDesc); } break; case AML_ARG_OP: - AcpiOsPrintf ("[Arg%d] ", ObjDesc->Reference.Offset); + AcpiOsPrintf ("[Arg%d] ", ObjDesc->Reference.Offset); if (WalkState) { ObjDesc = WalkState->Arguments[ObjDesc->Reference.Offset].Object; + AcpiOsPrintf (" %p", ObjDesc); AcpiDbDecodeInternalObject (ObjDesc); } break; @@ -561,6 +566,7 @@ AcpiDbDisplayInternalObject ( break; default: + AcpiOsPrintf (" "); AcpiOsPrintf (" "); AcpiDbDecodeInternalObject (ObjDesc); break; diff --git a/sys/contrib/dev/acpica/dbfileio.c b/sys/contrib/dev/acpica/dbfileio.c index 79e97c10b7bb..80fb487346b0 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: 47 $ + * $Revision: 52 $ * ******************************************************************************/ @@ -129,16 +129,18 @@ MODULE_NAME ("dbfileio") +/* + * NOTE: this is here for lack of a better place. It is used in all + * flavors of the debugger, need LCD file + */ #ifdef ACPI_APPLICATION #include FILE *AcpiGbl_DebugFile = NULL; #endif -/* - * NOTE: this is here for lack of a better place. It is used in all - * flavors of the debugger, need LCD file - */ +ACPI_TABLE_HEADER *AcpiGbl_DbTablePtr = NULL; + /******************************************************************************* * @@ -269,7 +271,7 @@ AcpiDbLoadTable( UINT32 *TableLength) { ACPI_TABLE_HEADER TableHeader; - UINT8 *AmlPtr; + UINT8 *AmlStart; UINT32 AmlLength; UINT32 Actual; ACPI_STATUS Status; @@ -309,7 +311,7 @@ AcpiDbLoadTable( /* Allocate a buffer for the table */ *TableLength = TableHeader.Length; - *TablePtr = ACPI_MEM_ALLOCATE ((size_t) *TableLength); + *TablePtr = AcpiOsAllocate ((size_t) *TableLength); if (!*TablePtr) { AcpiOsPrintf ("Could not allocate memory for ACPI table %4.4s (size=%X)\n", @@ -318,8 +320,8 @@ AcpiDbLoadTable( } - AmlPtr = (UINT8 *) *TablePtr + sizeof (TableHeader); - AmlLength = *TableLength - sizeof (TableHeader); + AmlStart = (UINT8 *) *TablePtr + sizeof (TableHeader); + AmlLength = *TableLength - sizeof (TableHeader); /* Copy the header to the buffer */ @@ -327,7 +329,7 @@ AcpiDbLoadTable( /* Get the rest of the table */ - Actual = fread (AmlPtr, 1, (size_t) AmlLength, fp); + Actual = fread (AmlStart, 1, (size_t) AmlLength, fp); if (Actual == AmlLength) { return (AE_OK); @@ -336,12 +338,12 @@ AcpiDbLoadTable( if (Actual > 0) { AcpiOsPrintf ("Warning - reading table, asked for %X got %X\n", AmlLength, Actual); - return (AE_OK); + return (AE_OK); } AcpiOsPrintf ("Error - could not read the table file\n"); - ACPI_MEM_FREE (*TablePtr); + AcpiOsFree (*TablePtr); *TablePtr = NULL; *TableLength = 0; @@ -403,7 +405,7 @@ AeLocalLoadTable ( { /* Uninstall table and free the buffer */ - AcpiTbUninstallTable (TableInfo.InstalledDesc); + AcpiTbDeleteAcpiTable (ACPI_TABLE_DSDT); return_ACPI_STATUS (Status); } #endif @@ -431,7 +433,6 @@ AcpiDbLoadAcpiTable ( #ifdef ACPI_APPLICATION FILE *fp; ACPI_STATUS Status; - ACPI_TABLE_HEADER *TablePtr; UINT32 TableLength; @@ -448,7 +449,7 @@ AcpiDbLoadAcpiTable ( /* Get the entire file */ AcpiOsPrintf ("Loading Acpi table from file %s\n", Filename); - Status = AcpiDbLoadTable (fp, &TablePtr, &TableLength); + Status = AcpiDbLoadTable (fp, &AcpiGbl_DbTablePtr, &TableLength); fclose(fp); if (ACPI_FAILURE (Status)) @@ -457,30 +458,28 @@ AcpiDbLoadAcpiTable ( return (Status); } - /* Attempt to recognize and install the table */ - Status = AeLocalLoadTable (TablePtr); + Status = AeLocalLoadTable (AcpiGbl_DbTablePtr); if (ACPI_FAILURE (Status)) { if (Status == AE_EXIST) { AcpiOsPrintf ("Table %4.4s is already installed\n", - &TablePtr->Signature); + &AcpiGbl_DbTablePtr->Signature); } - else { AcpiOsPrintf ("Could not install table, %s\n", AcpiFormatException (Status)); } - ACPI_MEM_FREE (TablePtr); + ACPI_MEM_FREE (AcpiGbl_DbTablePtr); return (Status); } AcpiOsPrintf ("%4.4s at %p successfully installed and loaded\n", - &TablePtr->Signature, TablePtr); + &AcpiGbl_DbTablePtr->Signature, AcpiGbl_DbTablePtr); AcpiGbl_AcpiHardwarePresent = FALSE; diff --git a/sys/contrib/dev/acpica/dbinput.c b/sys/contrib/dev/acpica/dbinput.c index 76b0f40b0b91..5e85c981d28d 100644 --- a/sys/contrib/dev/acpica/dbinput.c +++ b/sys/contrib/dev/acpica/dbinput.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbinput - user front-end to the AML debugger - * $Revision: 68 $ + * $Revision: 72 $ * ******************************************************************************/ @@ -138,11 +138,10 @@ NATIVE_CHAR AcpiGbl_DbParsedBuf[80]; NATIVE_CHAR AcpiGbl_DbScopeBuf[40]; NATIVE_CHAR AcpiGbl_DbDebugFilename[40]; NATIVE_CHAR *AcpiGbl_DbArgs[DB_MAX_ARGS]; -NATIVE_CHAR *AcpiGbl_DbBuffer; +NATIVE_CHAR *AcpiGbl_DbBuffer = NULL; NATIVE_CHAR *AcpiGbl_DbFilename = NULL; BOOLEAN AcpiGbl_DbOutputToFile = FALSE; - UINT32 AcpiGbl_DbDebugLevel = ACPI_LV_VERBOSITY2; UINT32 AcpiGbl_DbConsoleDebugLevel = NORMAL_DEFAULT | ACPI_LV_TABLES; UINT8 AcpiGbl_DbOutputFlags = DB_CONSOLE_OUTPUT; @@ -617,7 +616,7 @@ AcpiDbCommandDispatch ( case CMD_ALLOCATIONS: #ifdef ACPI_DBG_TRACK_ALLOCATIONS - AcpiUtDumpCurrentAllocations ((UINT32) -1, NULL); + AcpiUtDumpAllocations ((UINT32) -1, NULL); #endif break; @@ -1009,7 +1008,6 @@ AcpiDbUserCommands ( * because all the semaphores are deleted during termination */ AcpiTerminate (); - return (Status); } diff --git a/sys/contrib/dev/acpica/dbutils.c b/sys/contrib/dev/acpica/dbutils.c index c3ada92397e1..eced01b823f1 100644 --- a/sys/contrib/dev/acpica/dbutils.c +++ b/sys/contrib/dev/acpica/dbutils.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbutils - AML debugger utilities - * $Revision: 43 $ + * $Revision: 44 $ * ******************************************************************************/ @@ -369,17 +369,40 @@ AcpiDbSecondPassParse ( ACPI_PARSE_OBJECT *StartOp; ACPI_STATUS Status = AE_OK; UINT32 BaseAmlOffset; + ACPI_WALK_STATE *WalkState; + + + FUNCTION_ENTRY (); AcpiOsPrintf ("Pass two parse ....\n"); + while (Op) { if (Op->Opcode == AML_METHOD_OP) { Method = (ACPI_PARSE2_OBJECT *) Op; - Status = AcpiPsParseAml (Op, Method->Data, Method->Length, 0, - NULL, NULL, NULL, AcpiDsLoad1BeginOp, AcpiDsLoad1EndOp); + + WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, + NULL, NULL, NULL); + if (!WalkState) + { + return (AE_NO_MEMORY); + } + + + WalkState->ParserState.Aml = + WalkState->ParserState.AmlStart = Method->Data; + WalkState->ParserState.AmlEnd = + WalkState->ParserState.PkgEnd = Method->Data + Method->Length; + WalkState->ParserState.StartScope = Op; + + WalkState->DescendingCallback = AcpiDsLoad1BeginOp; + WalkState->AscendingCallback = AcpiDsLoad1EndOp; + + + Status = AcpiPsParseAml (WalkState); BaseAmlOffset = (Method->Value.Arg)->AmlOffset + 1; @@ -406,7 +429,7 @@ AcpiDbSecondPassParse ( if (ACPI_FAILURE (Status)) { - return (Status); + break; } Op = AcpiPsGetDepthNext (Root, Op); diff --git a/sys/contrib/dev/acpica/dbxface.c b/sys/contrib/dev/acpica/dbxface.c index e54b420a78b1..b94a89d67a7e 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: 41 $ + * $Revision: 43 $ * ******************************************************************************/ @@ -383,7 +383,7 @@ AcpiDbInitialize (void) /* Init globals */ - AcpiGbl_DbBuffer = AcpiOsAllocate (ACPI_DEBUG_BUFFER_SIZE); + AcpiGbl_DbBuffer = AcpiOsCallocate (ACPI_DEBUG_BUFFER_SIZE); /* Initial scope is the root */ @@ -419,4 +419,32 @@ AcpiDbInitialize (void) } +/******************************************************************************* + * + * FUNCTION: AcpiDbTerminate + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Stop debugger + * + ******************************************************************************/ + +void +AcpiDbTerminate (void) +{ + + if (AcpiGbl_DbTablePtr) + { + AcpiOsFree (AcpiGbl_DbTablePtr); + } + if (AcpiGbl_DbBuffer) + { + AcpiOsFree (AcpiGbl_DbBuffer); + } +} + + + #endif /* ENABLE_DEBUGGER */ diff --git a/sys/contrib/dev/acpica/dsmethod.c b/sys/contrib/dev/acpica/dsmethod.c index 5ac3dd2fb869..fc5e065c14e1 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: 65 $ + * $Revision: 68 $ * *****************************************************************************/ @@ -157,6 +157,7 @@ AcpiDsParseMethod ( ACPI_PARSE_OBJECT *Op; ACPI_NAMESPACE_NODE *Node; ACPI_OWNER_ID OwnerId; + ACPI_WALK_STATE *WalkState; FUNCTION_TRACE_PTR ("DsParseMethod", ObjHandle); @@ -182,7 +183,7 @@ AcpiDsParseMethod ( return_ACPI_STATUS (AE_NULL_OBJECT); } - /* Create a mutex for the method if there is a concurrency limit */ + /* Create a mutex for the method if there is a concurrency limit */ if ((ObjDesc->Method.Concurrency != INFINITE_CONCURRENCY) && (!ObjDesc->Method.Semaphore)) @@ -211,6 +212,22 @@ AcpiDsParseMethod ( AcpiPsSetName (Op, Node->Name); Op->Node = Node; + /* Create and initialize a new walk state */ + + WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, + NULL, NULL, NULL); + if (!WalkState) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + Status = AcpiDsInitAmlWalk (WalkState, Op, Node, ObjDesc->Method.AmlStart, + ObjDesc->Method.AmlLength, NULL, NULL, 1); + if (ACPI_FAILURE (Status)) + { + /* TBD: delete walk state */ + return_ACPI_STATUS (Status); + } /* * Parse the method, first pass @@ -222,12 +239,7 @@ AcpiDsParseMethod ( * method so that operands to the named objects can * take on dynamic run-time values. */ - Status = AcpiPsParseAml (Op, ObjDesc->Method.Pcode, - ObjDesc->Method.PcodeLength, - ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE, - Node, NULL, NULL, - AcpiDsLoad1BeginOp, AcpiDsLoad1EndOp); - + Status = AcpiPsParseAml (WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -241,9 +253,6 @@ AcpiDsParseMethod ( ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** [%4.4s] Parsed **** NamedObj=%p Op=%p\n", &((ACPI_NAMESPACE_NODE *)ObjHandle)->Name, ObjHandle, Op)); - /* Install the parsed tree in the method object */ - /* TBD: [Restructure] Obsolete field? */ - AcpiPsDeleteParseTree (Op); return_ACPI_STATUS (Status); @@ -344,13 +353,12 @@ ACPI_STATUS AcpiDsCallControlMethod ( ACPI_WALK_LIST *WalkList, ACPI_WALK_STATE *ThisWalkState, - ACPI_PARSE_OBJECT *Op) + ACPI_PARSE_OBJECT *Op) /* TBD: This operand is obsolete */ { ACPI_STATUS Status; ACPI_NAMESPACE_NODE *MethodNode; ACPI_OPERAND_OBJECT *ObjDesc; ACPI_WALK_STATE *NextWalkState; - ACPI_PARSE_STATE *ParserState; UINT32 i; @@ -374,7 +382,6 @@ AcpiDsCallControlMethod ( return_ACPI_STATUS (AE_NULL_OBJECT); } - /* Init for new method, wait on concurrency semaphore */ Status = AcpiDsBeginMethodExecution (MethodNode, ObjDesc, @@ -384,83 +391,67 @@ AcpiDsCallControlMethod ( return_ACPI_STATUS (Status); } - /* Create and initialize a new parser state */ - ParserState = AcpiPsCreateState (ObjDesc->Method.Pcode, - ObjDesc->Method.PcodeLength); - if (!ParserState) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - AcpiPsInitScope (ParserState, NULL); - ParserState->StartNode = MethodNode; - - - /* Create a new state for the preempting walk */ + /* 1) Parse: Create a new walk state for the preempting walk */ NextWalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwningId, - NULL, ObjDesc, WalkList); + Op, ObjDesc, NULL); if (!NextWalkState) { - /* TBD: delete parser state */ - return_ACPI_STATUS (AE_NO_MEMORY); - } - - NextWalkState->WalkType = WALK_METHOD; - NextWalkState->MethodNode = MethodNode; - NextWalkState->ParserState = ParserState; - NextWalkState->ParseFlags = ThisWalkState->ParseFlags; - NextWalkState->DescendingCallback = ThisWalkState->DescendingCallback; - NextWalkState->AscendingCallback = ThisWalkState->AscendingCallback; - - /* The NextOp of the NextWalk will be the beginning of the method */ - /* TBD: [Restructure] -- obsolete? */ - - NextWalkState->NextOp = NULL; - - /* Open a new scope */ - - Status = AcpiDsScopeStackPush (MethodNode, - ACPI_TYPE_METHOD, NextWalkState); - if (ACPI_FAILURE (Status)) - { goto Cleanup; } - - /* - * Initialize the arguments for the method. 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. - */ - Status = AcpiDsMethodDataInitArgs (&ThisWalkState->Operands[0], - ThisWalkState->NumOperands, - NextWalkState); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - /* Create and init a Root Node */ Op = AcpiPsAllocOp (AML_SCOPE_OP); if (!Op) { - return_ACPI_STATUS (AE_NO_MEMORY); + Status = AE_NO_MEMORY; + goto Cleanup; } - Status = AcpiPsParseAml (Op, ObjDesc->Method.Pcode, - ObjDesc->Method.PcodeLength, - ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE, - MethodNode, NULL, NULL, - AcpiDsLoad1BeginOp, AcpiDsLoad1EndOp); + Status = AcpiDsInitAmlWalk (NextWalkState, Op, MethodNode, + ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength, + NULL, NULL, 1); + if (ACPI_FAILURE (Status)) + { + /* TBD: delete walk state */ + goto Cleanup; + } + + /* Begin AML parse */ + + Status = AcpiPsParseAml (NextWalkState); AcpiPsDeleteParseTree (Op); + /* 2) Execute: Create a new state for the preempting walk */ + + NextWalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwningId, + NULL, ObjDesc, WalkList); + if (!NextWalkState) + { + Status = AE_NO_MEMORY; + goto Cleanup; + } + + /* + * 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 + */ + ThisWalkState->Operands [ThisWalkState->NumOperands] = NULL; + + Status = AcpiDsInitAmlWalk (NextWalkState, NULL, MethodNode, + ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength, + &ThisWalkState->Operands[0], NULL, 3); + if (ACPI_FAILURE (Status)) + { + goto Cleanup; + } + /* * Delete the operands on the previous walkstate operand stack * (they were copied to new objects) @@ -475,7 +466,6 @@ AcpiDsCallControlMethod ( ThisWalkState->NumOperands = 0; - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Starting nested execution, newstate=%p\n", NextWalkState)); diff --git a/sys/contrib/dev/acpica/dsobject.c b/sys/contrib/dev/acpica/dsobject.c index 2857ec02641f..558154c645e1 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: 74 $ + * $Revision: 76 $ * *****************************************************************************/ @@ -214,16 +214,15 @@ AcpiDsInitOneObject ( * Always parse methods to detect errors, we may delete * the parse tree below */ - Status = AcpiDsParseMethod (ObjHandle); - - /* TBD: [Errors] what do we do with an error? */ - if (ACPI_FAILURE (Status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Method %p [%4.4s] parse failed! %s\n", + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Method %p [%4.4s] - parse failure, %s\n", ObjHandle, &((ACPI_NAMESPACE_NODE *)ObjHandle)->Name, AcpiFormatException (Status))); + + /* This parse failed, but we will continue parsing more methods */ + break; } @@ -448,6 +447,12 @@ AcpiDsInitObjectFromOp ( case ACPI_TYPE_STRING: 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; break; @@ -477,60 +482,6 @@ AcpiDsInitObjectFromOp ( break; -#ifdef INTEGER_CONST__ - case OPTYPE_CONSTANT: - - /* TBD: Why is the DEBUG object a CONSTANT? */ - - if (Op->Opcode == AML_DEBUG_OP) - { - break; - } - - /* Reference object no longer needed */ - - AcpiUtRemoveReference (ObjDesc); - - /* Create/Init a new Integer object */ - - ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); - if (!ObjDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* - * Decode constants here. Turn them into real integer objects - * that are initialized to the value of the constant. - */ - switch (Op->Opcode) - { - case AML_ONE_OP: - ObjDesc->Integer.Value = 1; - break; - - case AML_ONES_OP: - ObjDesc->Integer.Value = ACPI_INTEGER_MAX; - break; - - case AML_REVISION_OP: - ObjDesc->Integer.Value = ACPI_CA_VERSION; - break; - - case AML_ZERO_OP: - ObjDesc->Integer.Flags |= AOPOBJ_ZERO_CONST; - ObjDesc->Integer.Value = 0; - break; - - default: - ObjDesc->Integer.Value = 0; - break; - } - - *RetObjDesc = ObjDesc; - break; -#endif - default: /* Constants, Literals, etc.. */ if (Op->Opcode == AML_INT_NAMEPATH_OP) diff --git a/sys/contrib/dev/acpica/dsopcode.c b/sys/contrib/dev/acpica/dsopcode.c index b903e117dace..623c456ba0cc 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: 51 $ + * $Revision: 55 $ * *****************************************************************************/ @@ -153,6 +153,7 @@ AcpiDsGetBufferFieldArguments ( ACPI_PARSE_OBJECT *FieldOp; ACPI_STATUS Status; ACPI_TABLE_DESC *TableDesc; + ACPI_WALK_STATE *WalkState; FUNCTION_TRACE_PTR ("DsGetBufferFieldArguments", ObjDesc); @@ -196,18 +197,37 @@ AcpiDsGetBufferFieldArguments ( return_ACPI_STATUS (Status); } + /* Create and initialize a new parser state */ + + WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, + NULL, 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)) + { + /* TBD: delete walk state */ + return_ACPI_STATUS (Status); + } + + /* TBD: No Walk flags?? */ + + WalkState->ParseFlags = 0; + /* Pass1: Parse the entire BufferField declaration */ - Status = AcpiPsParseAml (Op, ExtraDesc->Extra.Pcode, - ExtraDesc->Extra.PcodeLength, 0, - NULL, NULL, NULL, AcpiDsLoad1BeginOp, AcpiDsLoad1EndOp); + Status = AcpiPsParseAml (WalkState); if (ACPI_FAILURE (Status)) { AcpiPsDeleteParseTree (Op); return_ACPI_STATUS (Status); } - /* Get and init the actual FielUnitOp created above */ + /* Get and init the actual FieldUnit Op created above */ FieldOp = Op->Value.Arg; Op->Node = Node; @@ -217,7 +237,7 @@ AcpiDsGetBufferFieldArguments ( FieldOp->Node = Node; AcpiPsDeleteParseTree (Op); - /* AcpiEvaluate the address and length arguments for the OpRegion */ + /* Evaluate the address and length arguments for the OpRegion */ Op = AcpiPsAllocOp (AML_SCOPE_OP); if (!Op) @@ -227,16 +247,26 @@ AcpiDsGetBufferFieldArguments ( Op->Node = AcpiNsGetParentObject (Node); - Status = AcpiPsParseAml (Op, ExtraDesc->Extra.Pcode, - ExtraDesc->Extra.PcodeLength, - ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE, - NULL /*MethodDesc*/, NULL, NULL, - AcpiDsExecBeginOp, AcpiDsExecEndOp); - /* All done with the parse tree, delete it */ + /* Create and initialize a new parser state */ + WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, + NULL, NULL, NULL); + if (!WalkState) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + 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); - /* * The pseudo-method object is no longer needed since the region is * now initialized @@ -271,6 +301,7 @@ AcpiDsGetRegionArguments ( ACPI_PARSE_OBJECT *RegionOp; ACPI_STATUS Status; ACPI_TABLE_DESC *TableDesc; + ACPI_WALK_STATE *WalkState; FUNCTION_TRACE_PTR ("DsGetRegionArguments", ObjDesc); @@ -290,8 +321,8 @@ AcpiDsGetRegionArguments ( DEBUG_EXEC(AcpiUtDisplayInitPathname (Node, " [Operation Region]")); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] OpRegion Init at AML %p[%x]\n", - &Node->Name, ExtraDesc->Extra.Pcode, - *(UINT32*) ExtraDesc->Extra.Pcode)); + &Node->Name, ExtraDesc->Extra.AmlStart, + *(UINT32*) ExtraDesc->Extra.AmlStart)); /* * Allocate a new parser op to be the root of the parsed @@ -315,11 +346,30 @@ AcpiDsGetRegionArguments ( return_ACPI_STATUS (Status); } + /* Create and initialize a new parser state */ + + 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)) + { + /* TBD: delete walk state */ + return_ACPI_STATUS (Status); + } + + /* TBD: No Walk flags?? */ + + WalkState->ParseFlags = 0; + /* Parse the entire OpRegion declaration, creating a parse tree */ - Status = AcpiPsParseAml (Op, ExtraDesc->Extra.Pcode, - ExtraDesc->Extra.PcodeLength, 0, - NULL, NULL, NULL, AcpiDsLoad1BeginOp, AcpiDsLoad1EndOp); + Status = AcpiPsParseAml (WalkState); if (ACPI_FAILURE (Status)) { AcpiPsDeleteParseTree (Op); @@ -346,14 +396,24 @@ AcpiDsGetRegionArguments ( Op->Node = AcpiNsGetParentObject (Node); - Status = AcpiPsParseAml (Op, ExtraDesc->Extra.Pcode, - ExtraDesc->Extra.PcodeLength, - ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE, - NULL /*MethodDesc*/, NULL, NULL, - AcpiDsExecBeginOp, AcpiDsExecEndOp); + /* Create and initialize a new parser state */ - /* All done with the parse tree, delete it */ + 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, 3); + if (ACPI_FAILURE (Status)) + { + /* TBD: delete walk state */ + return_ACPI_STATUS (Status); + } + + Status = AcpiPsParseAml (WalkState); AcpiPsDeleteParseTree (Op); return_ACPI_STATUS (Status); @@ -431,13 +491,10 @@ AcpiDsEvalBufferFieldOperands ( UINT32 BitOffset; UINT32 BitCount; UINT8 FieldFlags; - - ACPI_OPERAND_OBJECT *ResDesc = NULL; ACPI_OPERAND_OBJECT *CntDesc = NULL; ACPI_OPERAND_OBJECT *OffDesc = NULL; ACPI_OPERAND_OBJECT *SrcDesc = NULL; - UINT32 NumOperands = 3; FUNCTION_TRACE_PTR ("DsEvalBufferFieldOperands", Op); @@ -447,7 +504,6 @@ AcpiDsEvalBufferFieldOperands ( * This is where we evaluate the address and length fields of the * CreateXxxField declaration */ - Node = Op->Node; /* NextOp points to the op that holds the Buffer */ @@ -473,31 +529,32 @@ AcpiDsEvalBufferFieldOperands ( Status = AcpiExResolveOperands (Op->Opcode, WALK_OPERANDS, WalkState); DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (Op->Opcode), - NumOperands, "after AcpiExResolveOperands"); - - - /* Get the operands */ - - Status |= AcpiDsObjStackPopObject (&ResDesc, WalkState); - if (AML_CREATE_FIELD_OP == Op->Opcode) - { - NumOperands = 4; - Status |= AcpiDsObjStackPopObject (&CntDesc, WalkState); - } - - Status |= AcpiDsObjStackPopObject (&OffDesc, WalkState); - Status |= AcpiDsObjStackPopObject (&SrcDesc, WalkState); + WalkState->NumOperands, "after AcpiExResolveOperands"); if (ACPI_FAILURE (Status)) { - /* Invalid parameters on object stack */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) bad operand(s) (%X)\n", AcpiPsGetOpcodeName (Op->Opcode), Status)); goto Cleanup; } + /* Get the operands */ + + if (AML_CREATE_FIELD_OP == Op->Opcode) + { + ResDesc = WalkState->Operands[3]; + CntDesc = WalkState->Operands[2]; + } + else + { + ResDesc = WalkState->Operands[2]; + } + + OffDesc = WalkState->Operands[1]; + SrcDesc = WalkState->Operands[0]; + + Offset = (UINT32) OffDesc->Integer.Value; @@ -858,7 +915,7 @@ AcpiDsExecBeginControlOp ( * of a loop */ WalkState->ControlState->Control.AmlPredicateStart = - WalkState->ParserState->Aml - 1; + WalkState->ParserState.Aml - 1; /* TBD: can this be removed? */ /*AcpiPsPkgLengthEncodingSize (GET8 (WalkState->ParserState->Aml));*/ break; diff --git a/sys/contrib/dev/acpica/dsutils.c b/sys/contrib/dev/acpica/dsutils.c index f9fab91e0c23..55b666369a60 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: 72 $ + * $Revision: 73 $ * ******************************************************************************/ @@ -916,6 +916,7 @@ AcpiDsMapNamedOpcodeToDataType ( DataType = ACPI_TYPE_EVENT; break; + case AML_DATA_REGION_OP: case AML_REGION_OP: DataType = ACPI_TYPE_REGION; break; diff --git a/sys/contrib/dev/acpica/dswexec.c b/sys/contrib/dev/acpica/dswexec.c index f9bfe8edb116..356008715780 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: 70 $ + * $Revision: 71 $ * *****************************************************************************/ @@ -145,7 +145,6 @@ ACPI_STATUS AcpiDsGetPredicateValue ( ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op, UINT32 HasResultObj) { ACPI_STATUS Status = AE_OK; @@ -172,7 +171,7 @@ AcpiDsGetPredicateValue ( else { - Status = AcpiDsCreateOperand (WalkState, Op, 0); + Status = AcpiDsCreateOperand (WalkState, WalkState->Op, 0); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -238,7 +237,7 @@ AcpiDsGetPredicateValue ( Cleanup: ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%X\n", - WalkState->ControlState->Common.Value, Op)); + WalkState->ControlState->Common.Value, WalkState->Op)); /* Break to debugger to display result */ @@ -260,8 +259,7 @@ AcpiDsGetPredicateValue ( * FUNCTION: AcpiDsExecBeginOp * * PARAMETERS: WalkState - Current state of the parse tree walk - * Op - Op that has been just been reached in the - * walk; Arguments have not been evaluated yet. + * OutOp - Return op if a new one is created * * RETURN: Status * @@ -273,28 +271,30 @@ AcpiDsGetPredicateValue ( ACPI_STATUS AcpiDsExecBeginOp ( - UINT16 Opcode, - ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT **OutOp) { - const ACPI_OPCODE_INFO *OpInfo; + ACPI_PARSE_OBJECT *Op; ACPI_STATUS Status = AE_OK; UINT8 OpcodeClass; - FUNCTION_TRACE_PTR ("DsExecBeginOp", Op); + FUNCTION_TRACE_PTR ("DsExecBeginOp", WalkState); + Op = WalkState->Op; if (!Op) { - Status = AcpiDsLoad2BeginOp (Opcode, NULL, WalkState, OutOp); + Status = AcpiDsLoad2BeginOp (WalkState, OutOp); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } Op = *OutOp; + WalkState->Op = Op; + WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode); + WalkState->Opcode = Op->Opcode; } if (Op == WalkState->Origin) @@ -327,8 +327,7 @@ AcpiDsExecBeginOp ( } - OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode); - OpcodeClass = (UINT8) ACPI_GET_OP_CLASS (OpInfo); + OpcodeClass = (UINT8) ACPI_GET_OP_CLASS (WalkState->OpInfo); /* We want to send namepaths to the load code */ @@ -365,7 +364,7 @@ AcpiDsExecBeginOp ( * will be deleted upon completion of the execution * of this method. */ - Status = AcpiDsLoad2BeginOp (Op->Opcode, Op, WalkState, NULL); + Status = AcpiDsLoad2BeginOp (WalkState, NULL); } @@ -426,41 +425,36 @@ AcpiDsExecBeginOp ( ACPI_STATUS AcpiDsExecEndOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op) + ACPI_WALK_STATE *WalkState) { + ACPI_PARSE_OBJECT *Op; ACPI_STATUS Status = AE_OK; - UINT16 Opcode; UINT8 Optype; ACPI_PARSE_OBJECT *NextOp; ACPI_PARSE_OBJECT *FirstArg; - ACPI_OPERAND_OBJECT *ResultObj = NULL; - const ACPI_OPCODE_INFO *OpInfo; UINT32 i; - FUNCTION_TRACE_PTR ("DsExecEndOp", Op); + FUNCTION_TRACE_PTR ("DsExecEndOp", WalkState); - Opcode = (UINT16) Op->Opcode; + Op = WalkState->Op; - OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode); - if (ACPI_GET_OP_TYPE (OpInfo) != ACPI_OP_TYPE_OPCODE) + if (ACPI_GET_OP_TYPE (WalkState->OpInfo) != ACPI_OP_TYPE_OPCODE) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode %X\n", Op->Opcode)); return_ACPI_STATUS (AE_NOT_IMPLEMENTED); } - Optype = (UINT8) ACPI_GET_OP_CLASS (OpInfo); + Optype = (UINT8) ACPI_GET_OP_CLASS (WalkState->OpInfo); FirstArg = Op->Value.Arg; /* Init the walk state */ WalkState->NumOperands = 0; WalkState->ReturnDesc = NULL; - WalkState->OpInfo = OpInfo; - WalkState->Opcode = Opcode; + WalkState->ResultObj = NULL; /* Call debugger for single step support (DEBUG build only) */ @@ -482,7 +476,7 @@ AcpiDsExecEndOp ( case OPTYPE_BOGUS: ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Internal opcode=%X type Op=%X\n", - Opcode, Op)); + WalkState->Opcode, Op)); break; case OPTYPE_CONSTANT: /* argument type only */ @@ -526,7 +520,7 @@ AcpiDsExecEndOp ( /* Resolve all operands */ - Status = AcpiExResolveOperands (Opcode, + Status = AcpiExResolveOperands (WalkState->Opcode, &(WalkState->Operands [WalkState->NumOperands -1]), WalkState); if (ACPI_FAILURE (Status)) @@ -534,7 +528,7 @@ AcpiDsExecEndOp ( /* TBD: must pop and delete operands */ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "[%s]: Could not resolve operands, %s\n", - AcpiPsGetOpcodeName (Opcode), AcpiFormatException (Status))); + AcpiPsGetOpcodeName (WalkState->Opcode), AcpiFormatException (Status))); /* * On error, we must delete all the operands and clear the @@ -547,11 +541,10 @@ AcpiDsExecEndOp ( } WalkState->NumOperands = 0; - goto Cleanup; } - DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (Opcode), + DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (WalkState->Opcode), WalkState->NumOperands, "after ExResolveOperands"); switch (Optype) @@ -560,7 +553,7 @@ AcpiDsExecEndOp ( /* 1 Operand, 0 ExternalResult, 0 InternalResult */ - Status = AcpiExMonadic1 (Opcode, WalkState); + Status = AcpiExMonadic1 (WalkState); break; @@ -568,7 +561,7 @@ AcpiDsExecEndOp ( /* 1 Operand, 0 ExternalResult, 1 InternalResult */ - Status = AcpiExMonadic2 (Opcode, WalkState, &ResultObj); + Status = AcpiExMonadic2 (WalkState); break; @@ -576,7 +569,7 @@ AcpiDsExecEndOp ( /* 1 Operand, 1 ExternalResult, 1 InternalResult */ - Status = AcpiExMonadic2R (Opcode, WalkState, &ResultObj); + Status = AcpiExMonadic2R (WalkState); break; @@ -584,7 +577,7 @@ AcpiDsExecEndOp ( /* 2 Operands, 0 ExternalResult, 0 InternalResult */ - Status = AcpiExDyadic1 (Opcode, WalkState); + Status = AcpiExDyadic1 (WalkState); break; @@ -592,7 +585,7 @@ AcpiDsExecEndOp ( /* 2 Operands, 0 ExternalResult, 1 InternalResult */ - Status = AcpiExDyadic2 (Opcode, WalkState, &ResultObj); + Status = AcpiExDyadic2 (WalkState); break; @@ -600,7 +593,7 @@ AcpiDsExecEndOp ( /* 2 Operands, 1 or 2 ExternalResults, 1 InternalResult */ - Status = AcpiExDyadic2R (Opcode, WalkState, &ResultObj); + Status = AcpiExDyadic2R (WalkState); break; @@ -608,15 +601,15 @@ AcpiDsExecEndOp ( /* 2 Operands, 0 ExternalResult, 1 InternalResult */ - Status = AcpiExDyadic2S (Opcode, WalkState, &ResultObj); + Status = AcpiExDyadic2S (WalkState); break; - case OPTYPE_TRIADIC: /* Opcode with 3 operands */ + case OPTYPE_TRIADIC: /* WalkState->Opcode with 3 operands */ /* 3 Operands, 1 ExternalResult, 1 InternalResult */ - Status = AcpiExTriadic (Opcode, WalkState, &ResultObj); + Status = AcpiExTriadic (WalkState); break; @@ -628,7 +621,7 @@ AcpiDsExecEndOp ( /* 6 Operands, 0 ExternalResult, 1 InternalResult */ - Status = AcpiExHexadic (Opcode, WalkState, &ResultObj); + Status = AcpiExHexadic (WalkState); break; @@ -636,7 +629,7 @@ AcpiDsExecEndOp ( /* 1 or 2 operands, 0 Internal Result */ - Status = AcpiExReconfiguration (Opcode, WalkState); + Status = AcpiExReconfiguration (WalkState); break; } @@ -653,9 +646,9 @@ AcpiDsExecEndOp ( * current result stack */ if (ACPI_SUCCESS (Status) && - ResultObj) + WalkState->ResultObj) { - Status = AcpiDsResultPush (ResultObj, WalkState); + Status = AcpiDsResultPush (WalkState->ResultObj, WalkState); } break; @@ -727,7 +720,7 @@ AcpiDsExecEndOp ( ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Executing CreateField Buffer/Index Op=%X\n", Op)); - Status = AcpiDsLoad2EndOp (WalkState, Op); + Status = AcpiDsLoad2EndOp (WalkState); if (ACPI_FAILURE (Status)) { break; @@ -739,7 +732,7 @@ AcpiDsExecEndOp ( case OPTYPE_NAMED_OBJECT: - Status = AcpiDsLoad2EndOp (WalkState, Op); + Status = AcpiDsLoad2EndOp (WalkState); if (ACPI_FAILURE (Status)) { break; @@ -797,7 +790,7 @@ AcpiDsExecEndOp ( * ACPI 2.0 support for 64-bit integers: * Truncate numeric result value if we are executing from a 32-bit ACPI table */ - AcpiExTruncateFor32bitTable (ResultObj, WalkState); + AcpiExTruncateFor32bitTable (WalkState->ResultObj, WalkState); /* * Check if we just completed the evaluation of a @@ -809,24 +802,24 @@ AcpiDsExecEndOp ( CONTROL_PREDICATE_EXECUTING) && (WalkState->ControlState->Control.PredicateOp == Op)) { - Status = AcpiDsGetPredicateValue (WalkState, Op, (UINT32) ResultObj); - ResultObj = NULL; + Status = AcpiDsGetPredicateValue (WalkState, (UINT32) WalkState->ResultObj); + WalkState->ResultObj = NULL; } Cleanup: - if (ResultObj) + if (WalkState->ResultObj) { /* Break to debugger to display result */ - DEBUGGER_EXEC (AcpiDbDisplayResultObject (ResultObj, WalkState)); + DEBUGGER_EXEC (AcpiDbDisplayResultObject (WalkState->ResultObj, WalkState)); /* * Delete the result op if and only if: * Parent will not use the result -- such as any * non-nested type2 op in a method (parent will be method) */ - AcpiDsDeleteResultIfNotUsed (Op, ResultObj, WalkState); + AcpiDsDeleteResultIfNotUsed (Op, WalkState->ResultObj, WalkState); } /* Always clear the object stack */ diff --git a/sys/contrib/dev/acpica/dswload.c b/sys/contrib/dev/acpica/dswload.c index bf3de7c118bb..e4434e935592 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: 44 $ + * $Revision: 48 $ * *****************************************************************************/ @@ -129,6 +129,42 @@ MODULE_NAME ("dswload") +ACPI_STATUS +AcpiDsInitCallbacks ( + ACPI_WALK_STATE *WalkState, + UINT32 PassNumber) +{ + + switch (PassNumber) + { + case 1: + WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE; + WalkState->DescendingCallback = AcpiDsLoad1BeginOp; + WalkState->AscendingCallback = AcpiDsLoad1EndOp; + break; + + case 2: + WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE; + WalkState->DescendingCallback = AcpiDsLoad2BeginOp; + WalkState->AscendingCallback = AcpiDsLoad2EndOp; + break; + + case 3: + WalkState->ParseFlags |= ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE; + WalkState->DescendingCallback = AcpiDsExecBeginOp; + WalkState->AscendingCallback = AcpiDsExecEndOp; + break; + + default: + return (AE_BAD_PARAMETER); + break; + } + + return (AE_OK); +} + + + /******************************************************************************* * * FUNCTION: AcpiDsLoad1BeginOp @@ -145,51 +181,53 @@ ACPI_STATUS AcpiDsLoad1BeginOp ( - UINT16 Opcode, - ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT **OutOp) { + ACPI_PARSE_OBJECT *Op; ACPI_NAMESPACE_NODE *Node; ACPI_STATUS Status; ACPI_OBJECT_TYPE8 DataType; NATIVE_CHAR *Path; - const ACPI_OPCODE_INFO *OpInfo; PROC_NAME ("DsLoad1BeginOp"); + + Op = WalkState->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 */ - OpInfo = AcpiPsGetOpcodeInfo (Opcode); - if (!(OpInfo->Flags & AML_NAMED)) + if (WalkState->Op) { - *OutOp = Op; - return (AE_OK); + if (!(WalkState->OpInfo->Flags & AML_NAMED)) + { + *OutOp = Op; + return (AE_OK); + } + + /* Check if this object has already been installed in the namespace */ + + if (Op->Node) + { + *OutOp = Op; + return (AE_OK); + } } - /* Check if this object has already been installed in the namespace */ - - if (Op && Op->Node) - { - *OutOp = Op; - return (AE_OK); - } - - Path = AcpiPsGetNextNamestring (WalkState->ParserState); + Path = AcpiPsGetNextNamestring (&WalkState->ParserState); /* Map the raw opcode into an internal object type */ - DataType = AcpiDsMapNamedOpcodeToDataType (Opcode); + DataType = AcpiDsMapNamedOpcodeToDataType (WalkState->Opcode); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "State=%p Op=%p Type=%x\n", WalkState, Op, DataType)); - if (Opcode == AML_SCOPE_OP) + if (WalkState->Opcode == AML_SCOPE_OP) { ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "State=%p Op=%p Type=%x\n", WalkState, Op, DataType)); @@ -212,7 +250,7 @@ AcpiDsLoad1BeginOp ( { /* Create a new op */ - Op = AcpiPsAllocOp (Opcode); + Op = AcpiPsAllocOp (WalkState->Opcode); if (!Op) { return (AE_NO_MEMORY); @@ -228,7 +266,7 @@ AcpiDsLoad1BeginOp ( * can get it again quickly when this scope is closed */ Op->Node = Node; - AcpiPsAppendArg (AcpiPsGetParentScope (WalkState->ParserState), Op); + AcpiPsAppendArg (AcpiPsGetParentScope (&WalkState->ParserState), Op); *OutOp = Op; return (Status); @@ -252,21 +290,21 @@ AcpiDsLoad1BeginOp ( ACPI_STATUS AcpiDsLoad1EndOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op) + ACPI_WALK_STATE *WalkState) { + ACPI_PARSE_OBJECT *Op; ACPI_OBJECT_TYPE8 DataType; - const ACPI_OPCODE_INFO *OpInfo; PROC_NAME ("DsLoad1EndOp"); + + Op = WalkState->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 */ - OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode); - if (!(OpInfo->Flags & AML_NAMED)) + if (!(WalkState->OpInfo->Flags & AML_NAMED)) { return (AE_OK); } @@ -318,45 +356,44 @@ AcpiDsLoad1EndOp ( ACPI_STATUS AcpiDsLoad2BeginOp ( - UINT16 Opcode, - ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT **OutOp) { + ACPI_PARSE_OBJECT *Op; ACPI_NAMESPACE_NODE *Node; ACPI_STATUS Status; ACPI_OBJECT_TYPE8 DataType; NATIVE_CHAR *BufferPtr; void *Original = NULL; - const ACPI_OPCODE_INFO *OpInfo; PROC_NAME ("DsLoad2BeginOp"); + + Op = WalkState->Op; ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState)); - /* We only care about Namespace opcodes here */ - - OpInfo = AcpiPsGetOpcodeInfo (Opcode); - if (!(OpInfo->Flags & AML_NSOPCODE) && - Opcode != AML_INT_NAMEPATH_OP) - { - return (AE_OK); - } - - /* TBD: [Restructure] Temp! same code as in psparse */ - - if (!(OpInfo->Flags & AML_NAMED)) - { - return (AE_OK); - } - if (Op) { + /* We only care about Namespace opcodes here */ + + if (!(WalkState->OpInfo->Flags & AML_NSOPCODE) && + WalkState->Opcode != AML_INT_NAMEPATH_OP) + { + return (AE_OK); + } + + /* TBD: [Restructure] Temp! same code as in psparse */ + + if (!(WalkState->OpInfo->Flags & AML_NAMED)) + { + return (AE_OK); + } + /* * Get the name we are going to enter or lookup in the namespace */ - if (Opcode == AML_INT_NAMEPATH_OP) + if (WalkState->Opcode == AML_INT_NAMEPATH_OP) { /* For Namepath op, get the path string */ @@ -379,27 +416,27 @@ AcpiDsLoad2BeginOp ( else { - BufferPtr = AcpiPsGetNextNamestring (WalkState->ParserState); + BufferPtr = AcpiPsGetNextNamestring (&WalkState->ParserState); } /* Map the raw opcode into an internal object type */ - DataType = AcpiDsMapNamedOpcodeToDataType (Opcode); + DataType = AcpiDsMapNamedOpcodeToDataType (WalkState->Opcode); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "State=%p Op=%p Type=%x\n", WalkState, Op, DataType)); - if (Opcode == AML_FIELD_OP || - Opcode == AML_BANK_FIELD_OP || - Opcode == AML_INDEX_FIELD_OP) + if (WalkState->Opcode == AML_FIELD_OP || + WalkState->Opcode == AML_BANK_FIELD_OP || + WalkState->Opcode == AML_INDEX_FIELD_OP) { Node = NULL; Status = AE_OK; } - else if (Opcode == AML_INT_NAMEPATH_OP) + else if (WalkState->Opcode == AML_INT_NAMEPATH_OP) { /* * The NamePath is an object reference to an existing object. Don't enter the @@ -443,7 +480,7 @@ AcpiDsLoad2BeginOp ( { /* Create a new op */ - Op = AcpiPsAllocOp (Opcode); + Op = AcpiPsAllocOp (WalkState->Opcode); if (!Op) { return (AE_NO_MEMORY); @@ -494,25 +531,25 @@ AcpiDsLoad2BeginOp ( ACPI_STATUS AcpiDsLoad2EndOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op) + ACPI_WALK_STATE *WalkState) { + ACPI_PARSE_OBJECT *Op; ACPI_STATUS Status = AE_OK; ACPI_OBJECT_TYPE8 DataType; ACPI_NAMESPACE_NODE *Node; ACPI_PARSE_OBJECT *Arg; ACPI_NAMESPACE_NODE *NewNode; - const ACPI_OPCODE_INFO *OpInfo; PROC_NAME ("DsLoad2EndOp"); + + Op = WalkState->Op; ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState)); /* Only interested in opcodes that have namespace objects */ - OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode); - if (!(OpInfo->Flags & AML_NSOBJECT)) + if (!(WalkState->OpInfo->Flags & AML_NSOBJECT)) { return (AE_OK); } @@ -559,28 +596,29 @@ AcpiDsLoad2EndOp ( /* * Named operations are as follows: * - * AML_SCOPE - * AML_DEVICE - * AML_THERMALZONE - * AML_METHOD - * AML_POWERRES - * AML_PROCESSOR - * AML_FIELD - * AML_INDEXFIELD - * AML_BANKFIELD - * AML_NAMEDFIELD - * AML_NAME * AML_ALIAS - * AML_MUTEX - * AML_EVENT - * AML_OPREGION - * AML_CREATEFIELD + * AML_BANKFIELD * AML_CREATEBITFIELD * AML_CREATEBYTEFIELD - * AML_CREATEWORDFIELD * AML_CREATEDWORDFIELD + * AML_CREATEFIELD * AML_CREATEQWORDFIELD + * AML_CREATEWORDFIELD + * AML_DATA_REGION + * AML_DEVICE + * AML_EVENT + * AML_FIELD + * AML_INDEXFIELD + * AML_METHOD * AML_METHODCALL + * AML_MUTEX + * AML_NAME + * AML_NAMEDFIELD + * AML_OPREGION + * AML_POWERRES + * AML_PROCESSOR + * AML_SCOPE + * AML_THERMALZONE */ @@ -834,7 +872,7 @@ AcpiDsLoad2EndOp ( } ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "LOADING-Opregion: Op=%p State=%p NamedObj=%p\n", + "LOADING-OpRegion: Op=%p State=%p NamedObj=%p\n", Op, WalkState, Node)); /* @@ -851,6 +889,22 @@ AcpiDsLoad2EndOp ( break; + case AML_DATA_REGION_OP: + + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "LOADING-DataRegion: Op=%p State=%p NamedObj=%p\n", + Op, WalkState, Node)); + + Status = AcpiDsCreateOperands (WalkState, Arg); + if (ACPI_FAILURE (Status)) + { + goto Cleanup; + } + + Status = AcpiExCreateTableRegion (WalkState); + break; + + /* Namespace Modifier Opcodes */ case AML_ALIAS_OP: diff --git a/sys/contrib/dev/acpica/dswscope.c b/sys/contrib/dev/acpica/dswscope.c index f14c06d3211d..57571e89136b 100644 --- a/sys/contrib/dev/acpica/dswscope.c +++ b/sys/contrib/dev/acpica/dswscope.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dswscope - Scope stack manipulation - * $Revision: 48 $ + * $Revision: 49 $ * *****************************************************************************/ @@ -212,8 +212,9 @@ AcpiDsScopeStackPush ( /* Init new scope object */ - ScopeInfo->Scope.Node = Node; - ScopeInfo->Common.Value = (UINT16) Type; + ScopeInfo->Common.DataType = ACPI_DESC_TYPE_STATE_WSCOPE; + ScopeInfo->Scope.Node = Node; + ScopeInfo->Common.Value = (UINT16) Type; /* Push new scope object onto stack */ diff --git a/sys/contrib/dev/acpica/dswstate.c b/sys/contrib/dev/acpica/dswstate.c index cbb265b325eb..321e2bb29b21 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: 50 $ + * $Revision: 54 $ * *****************************************************************************/ @@ -479,6 +479,7 @@ AcpiDsResultStackPush ( return (AE_NO_MEMORY); } + State->Common.DataType = ACPI_DESC_TYPE_STATE_RESULT; AcpiUtPushGenericState (&WalkState->Results, State); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Results=%p State=%p\n", @@ -613,6 +614,7 @@ AcpiDsObjStackPush ( } +#if 0 /******************************************************************************* * * FUNCTION: AcpiDsObjStackPopObject @@ -672,7 +674,7 @@ AcpiDsObjStackPopObject ( return (AE_OK); } - +#endif /******************************************************************************* * @@ -868,7 +870,7 @@ AcpiDsGetCurrentWalkState ( * ******************************************************************************/ -static void +void AcpiDsPushWalkState ( ACPI_WALK_STATE *WalkState, ACPI_WALK_LIST *WalkList) @@ -982,12 +984,111 @@ AcpiDsCreateWalkState ( /* Put the new state at the head of the walk list */ - AcpiDsPushWalkState (WalkState, WalkList); + if (WalkList) + { + AcpiDsPushWalkState (WalkState, WalkList); + } return_PTR (WalkState); } +#ifndef _ACPI_ASL_COMPILER +/******************************************************************************* + * + * FUNCTION: AcpiDsInitAmlWalk + * + * PARAMETERS: WalkState - New state to be initialized + * + * RETURN: None + * + * DESCRIPTION: Initialize a walk state for a pass 1 or 2 parse tree walk + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsInitAmlWalk ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op, + ACPI_NAMESPACE_NODE *MethodNode, + UINT8 *AmlStart, + UINT32 AmlLength, + ACPI_OPERAND_OBJECT **Params, + ACPI_OPERAND_OBJECT **ReturnObjDesc, + UINT32 PassNumber) +{ + ACPI_STATUS Status; + ACPI_PARSE_STATE *ParserState = &WalkState->ParserState; + + + FUNCTION_TRACE ("DsInitAmlWalk"); + + + WalkState->ParserState.Aml = + WalkState->ParserState.AmlStart = AmlStart; + WalkState->ParserState.AmlEnd = + 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; + WalkState->CallerReturnDesc = ReturnObjDesc; + + Status = AcpiPsInitScope (&WalkState->ParserState, Op); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + if (MethodNode) + { + WalkState->ParserState.StartNode = MethodNode; + WalkState->WalkType = WALK_METHOD; + WalkState->MethodNode = MethodNode; + WalkState->MethodDesc = AcpiNsGetAttachedObject (MethodNode); + + + /* Push start scope on scope stack and make it current */ + + Status = AcpiDsScopeStackPush (MethodNode, ACPI_TYPE_METHOD, WalkState); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Init the method arguments */ + + AcpiDsMethodDataInitArgs (Params, MTH_NUM_ARGS, WalkState); + } + + else + { + /* Setup the current scope */ + + ParserState->StartNode = ParserState->StartOp->Node; + if (ParserState->StartNode) + { + /* Push start scope on scope stack and make it current */ + + Status = AcpiDsScopeStackPush (ParserState->StartNode, + ParserState->StartNode->Type, WalkState); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } + } + + AcpiDsInitCallbacks (WalkState, PassNumber); + + return_ACPI_STATUS (AE_OK); +} +#endif + + + /******************************************************************************* * * FUNCTION: AcpiDsDeleteWalkState @@ -1022,7 +1123,12 @@ AcpiDsDeleteWalkState ( } - /* Always must free any linked control states */ + if (WalkState->ParserState.Scope) + { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n", WalkState)); + } + + /* Always must free any linked control states */ while (WalkState->ControlState) { diff --git a/sys/contrib/dev/acpica/evmisc.c b/sys/contrib/dev/acpica/evmisc.c index 8f5d157bd96f..2db9a9459c33 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: 33 $ + * $Revision: 34 $ * *****************************************************************************/ @@ -234,6 +234,7 @@ AcpiEvQueueNotifyRequest ( return (AE_NO_MEMORY); } + NotifyInfo->Common.DataType = ACPI_DESC_TYPE_STATE_NOTIFY; NotifyInfo->Notify.Node = Node; NotifyInfo->Notify.Value = (UINT16) NotifyValue; NotifyInfo->Notify.HandlerObj = HandlerObj; diff --git a/sys/contrib/dev/acpica/evregion.c b/sys/contrib/dev/acpica/evregion.c index b708a977ce86..882af340b75e 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: 109 $ + * $Revision: 110 $ * *****************************************************************************/ @@ -217,8 +217,6 @@ AcpiEvExecuteRegMethod ( UINT32 Function) { ACPI_OPERAND_OBJECT *Params[3]; - ACPI_OPERAND_OBJECT SpaceIdDesc; - ACPI_OPERAND_OBJECT FunctionDesc; ACPI_STATUS Status; @@ -239,30 +237,37 @@ AcpiEvExecuteRegMethod ( * 0 for disconnecting the handler * Passed as a parameter */ - AcpiUtInitStaticObject (&SpaceIdDesc); - AcpiUtInitStaticObject (&FunctionDesc); + Params[0] = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); + if (!Params[0]) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } - /* - * Method requires two parameters. - */ - Params [0] = &SpaceIdDesc; - Params [1] = &FunctionDesc; - Params [2] = NULL; + Params[1] = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); + if (!Params[1]) + { + AcpiUtRemoveReference (Params[0]); + return_ACPI_STATUS (AE_NO_MEMORY); + } + + Params[2] = NULL; /* * Set up the parameter objects */ - SpaceIdDesc.Common.Type = ACPI_TYPE_INTEGER; - SpaceIdDesc.Integer.Value = RegionObj->Region.SpaceId; - - FunctionDesc.Common.Type = ACPI_TYPE_INTEGER; - FunctionDesc.Integer.Value = Function; + Params[0]->Integer.Value = RegionObj->Region.SpaceId; + Params[1]->Integer.Value = Function; /* * 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); + + + AcpiUtRemoveReference (Params[0]); + AcpiUtRemoveReference (Params[1]); + return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/evrgnini.c b/sys/contrib/dev/acpica/evrgnini.c index 280fa3a58c16..5df0cb032adc 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: 46 $ + * $Revision: 47 $ * *****************************************************************************/ @@ -371,6 +371,71 @@ AcpiEvPciConfigRegionSetup ( } + +/******************************************************************************* + * + * FUNCTION: AcpiEvPciBarRegionSetup + * + * PARAMETERS: RegionObj - region we are interested in + * Function - start or stop + * HandlerContext - Address space handler context + * RegionContext - Region specific context + * + * RETURN: Status + * + * DESCRIPTION: Do any prep work for region handling + * + * MUTEX: Assumes namespace is not locked + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEvPciBarRegionSetup ( + ACPI_HANDLE Handle, + UINT32 Function, + void *HandlerContext, + void **RegionContext) +{ + + FUNCTION_TRACE ("EvPciBarRegionSetup"); + + + return_ACPI_STATUS (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiEvCmosRegionSetup + * + * PARAMETERS: RegionObj - region we are interested in + * Function - start or stop + * HandlerContext - Address space handler context + * RegionContext - Region specific context + * + * RETURN: Status + * + * DESCRIPTION: Do any prep work for region handling + * + * MUTEX: Assumes namespace is not locked + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEvCmosRegionSetup ( + ACPI_HANDLE Handle, + UINT32 Function, + void *HandlerContext, + void **RegionContext) +{ + + FUNCTION_TRACE ("EvCmosRegionSetup"); + + + return_ACPI_STATUS (AE_OK); +} + + /******************************************************************************* * * FUNCTION: AcpiEvDefaultRegionSetup diff --git a/sys/contrib/dev/acpica/evxface.c b/sys/contrib/dev/acpica/evxface.c index 3aa29b596133..085bbdc3cf57 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: 112 $ + * $Revision: 114 $ * *****************************************************************************/ @@ -156,14 +156,6 @@ AcpiInstallFixedEventHandler ( FUNCTION_TRACE ("AcpiInstallFixedEventHandler"); - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* Parameter validation */ if (Event > ACPI_EVENT_MAX) @@ -187,7 +179,7 @@ AcpiInstallFixedEventHandler ( AcpiGbl_FixedEventHandlers[Event].Handler = Handler; AcpiGbl_FixedEventHandlers[Event].Context = Context; - Status = AcpiEnableEvent (Event, ACPI_EVENT_FIXED); + Status = AcpiEnableEvent (Event, ACPI_EVENT_FIXED, 0); if (!ACPI_SUCCESS (Status)) { ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Could not enable fixed event.\n")); @@ -235,14 +227,6 @@ AcpiRemoveFixedEventHandler ( FUNCTION_TRACE ("AcpiRemoveFixedEventHandler"); - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* Parameter validation */ if (Event > ACPI_EVENT_MAX) @@ -254,7 +238,7 @@ AcpiRemoveFixedEventHandler ( /* Disable the event before removing the handler - just in case... */ - Status = AcpiDisableEvent(Event, ACPI_EVENT_FIXED); + Status = AcpiDisableEvent(Event, ACPI_EVENT_FIXED, 0); /* Always Remove the handler */ @@ -311,14 +295,6 @@ AcpiInstallNotifyHandler ( FUNCTION_TRACE ("AcpiInstallNotifyHandler"); - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* Parameter validation */ if ((!Handler) || @@ -492,14 +468,6 @@ AcpiRemoveNotifyHandler ( FUNCTION_TRACE ("AcpiRemoveNotifyHandler"); - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* Parameter validation */ if ((!Handler) || @@ -643,14 +611,6 @@ AcpiInstallGpeHandler ( FUNCTION_TRACE ("AcpiInstallGpeHandler"); - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* Parameter validation */ if (!Handler || (GpeNumber > ACPI_GPE_MAX)) @@ -716,14 +676,6 @@ AcpiRemoveGpeHandler ( FUNCTION_TRACE ("AcpiRemoveGpeHandler"); - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* Parameter validation */ if (!Handler || (GpeNumber > ACPI_GPE_MAX)) @@ -783,14 +735,6 @@ AcpiAcquireGlobalLock ( ACPI_STATUS Status; - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - Status = AcpiExEnterInterpreter (); if (ACPI_FAILURE (Status)) { @@ -824,17 +768,6 @@ ACPI_STATUS AcpiReleaseGlobalLock ( void) { - ACPI_STATUS Status; - - - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - AcpiEvReleaseGlobalLock (); return (AE_OK); } diff --git a/sys/contrib/dev/acpica/evxfevnt.c b/sys/contrib/dev/acpica/evxfevnt.c index 68adc2db0fe5..9abf4eb54509 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: 36 $ + * $Revision: 38 $ * *****************************************************************************/ @@ -202,14 +202,6 @@ AcpiDisable (void) FUNCTION_TRACE ("AcpiDisable"); - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* Restore original mode */ Status = AcpiHwSetMode (AcpiGbl_OriginalMode); @@ -234,6 +226,7 @@ AcpiDisable (void) * * PARAMETERS: Event - The fixed event or GPE to be enabled * Type - The type of event + * Flags - Just enable, or also wake enable? * * RETURN: Status * @@ -244,7 +237,8 @@ AcpiDisable (void) ACPI_STATUS AcpiEnableEvent ( UINT32 Event, - UINT32 Type) + UINT32 Type, + UINT32 Flags) { ACPI_STATUS Status = AE_OK; UINT32 RegisterId; @@ -253,14 +247,6 @@ AcpiEnableEvent ( FUNCTION_TRACE ("AcpiEnableEvent"); - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* The Type must be either Fixed AcpiEvent or GPE */ switch (Type) @@ -326,7 +312,15 @@ AcpiEnableEvent ( /* Enable the requested GPE number */ - AcpiHwEnableGpe (Event); + if (Flags & ACPI_EVENT_ENABLE) + { + AcpiHwEnableGpe (Event); + } + if (Flags & ACPI_EVENT_WAKE_ENABLE) + { + AcpiHwEnableGpeForWakeup (Event); + } + break; @@ -345,7 +339,8 @@ AcpiEnableEvent ( * FUNCTION: AcpiDisableEvent * * PARAMETERS: Event - The fixed event or GPE to be enabled - * Type - The type of event + * Type - The type of event, fixed or general purpose + * Flags - Wake disable vs. non-wake disable * * RETURN: Status * @@ -356,7 +351,8 @@ AcpiEnableEvent ( ACPI_STATUS AcpiDisableEvent ( UINT32 Event, - UINT32 Type) + UINT32 Type, + UINT32 Flags) { ACPI_STATUS Status = AE_OK; UINT32 RegisterId; @@ -365,14 +361,6 @@ AcpiDisableEvent ( FUNCTION_TRACE ("AcpiDisableEvent"); - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* The Type must be either Fixed AcpiEvent or GPE */ switch (Type) @@ -437,7 +425,15 @@ AcpiDisableEvent ( /* Disable the requested GPE number */ - AcpiHwDisableGpe (Event); + if (Flags & ACPI_EVENT_DISABLE) + { + AcpiHwDisableGpe (Event); + } + if (Flags & ACPI_EVENT_WAKE_DISABLE) + { + AcpiHwDisableGpeForWakeup (Event); + } + break; @@ -474,14 +470,6 @@ AcpiClearEvent ( FUNCTION_TRACE ("AcpiClearEvent"); - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* The Type must be either Fixed AcpiEvent or GPE */ switch (Type) @@ -579,14 +567,6 @@ AcpiGetEventStatus ( FUNCTION_TRACE ("AcpiGetEventStatus"); - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - if (!EventStatus) { return_ACPI_STATUS (AE_BAD_PARAMETER); diff --git a/sys/contrib/dev/acpica/evxfregn.c b/sys/contrib/dev/acpica/evxfregn.c index cab8a43be9aa..0286c78f85b0 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: 36 $ + * $Revision: 38 $ * *****************************************************************************/ @@ -163,14 +163,6 @@ AcpiInstallAddressSpaceHandler ( FUNCTION_TRACE ("AcpiInstallAddressSpaceHandler"); - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* Parameter validation */ if ((!Device) || @@ -213,17 +205,27 @@ AcpiInstallAddressSpaceHandler ( { case ACPI_ADR_SPACE_SYSTEM_MEMORY: Handler = AcpiExSystemMemorySpaceHandler; - Setup = AcpiEvSystemMemoryRegionSetup; + Setup = AcpiEvSystemMemoryRegionSetup; break; case ACPI_ADR_SPACE_SYSTEM_IO: Handler = AcpiExSystemIoSpaceHandler; - Setup = AcpiEvIoSpaceRegionSetup; + Setup = AcpiEvIoSpaceRegionSetup; break; case ACPI_ADR_SPACE_PCI_CONFIG: Handler = AcpiExPciConfigSpaceHandler; - Setup = AcpiEvPciConfigRegionSetup; + Setup = AcpiEvPciConfigRegionSetup; + break; + + case ACPI_ADR_SPACE_CMOS: + Handler = AcpiExCmosSpaceHandler; + Setup = AcpiEvCmosRegionSetup; + break; + + case ACPI_ADR_SPACE_PCI_BAR_TARGET: + Handler = AcpiExPciBarSpaceHandler; + Setup = AcpiEvPciBarRegionSetup; break; default: @@ -401,14 +403,6 @@ AcpiRemoveAddressSpaceHandler ( FUNCTION_TRACE ("AcpiRemoveAddressSpaceHandler"); - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* Parameter validation */ if ((!Device) || diff --git a/sys/contrib/dev/acpica/exconfig.c b/sys/contrib/dev/acpica/exconfig.c index 9bdad16feb2d..1cbf7f76d8f6 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: 41 $ + * $Revision: 42 $ * *****************************************************************************/ @@ -348,8 +348,7 @@ AcpiExUnloadTable ( * * FUNCTION: AcpiExReconfiguration * - * PARAMETERS: Opcode - The opcode to be executed - * WalkState - Current state of the parse tree walk + * PARAMETERS: WalkState - Current state of the parse tree walk * * RETURN: Status * @@ -359,7 +358,6 @@ AcpiExUnloadTable ( ACPI_STATUS AcpiExReconfiguration ( - UINT16 Opcode, ACPI_WALK_STATE *WalkState) { ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; @@ -373,7 +371,7 @@ AcpiExReconfiguration ( - switch (Opcode) + switch (WalkState->Opcode) { case AML_LOAD_OP: @@ -390,7 +388,7 @@ AcpiExReconfiguration ( default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "bad opcode=%X\n", Opcode)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "bad opcode=%X\n", WalkState->Opcode)); Status = AE_AML_BAD_OPCODE; break; } diff --git a/sys/contrib/dev/acpica/exconvrt.c b/sys/contrib/dev/acpica/exconvrt.c index 4c607ab5f782..d3e66e2933ec 100644 --- a/sys/contrib/dev/acpica/exconvrt.c +++ b/sys/contrib/dev/acpica/exconvrt.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exconvrt - Object conversion routines - * $Revision: 22 $ + * $Revision: 23 $ * *****************************************************************************/ @@ -404,8 +404,9 @@ AcpiExConvertToAscii ( UINT32 k = 0; UINT8 HexDigit; ACPI_INTEGER Digit; - BOOLEAN LeadingZero = TRUE; + UINT32 Remainder; UINT32 Length = sizeof (ACPI_INTEGER); + BOOLEAN LeadingZero = TRUE; FUNCTION_ENTRY (); @@ -415,6 +416,7 @@ AcpiExConvertToAscii ( { case 10: + Remainder = 0; for (i = ACPI_MAX_DECIMAL_DIGITS; i > 0 ; i--) { /* Divide by nth factor of 10 */ @@ -422,7 +424,7 @@ AcpiExConvertToAscii ( Digit = Integer; for (j = 1; j < i; j++) { - Digit = ACPI_DIVIDE (Digit, 10); + AcpiUtShortDivide (&Digit, 10, &Digit, &Remainder); } /* Create the decimal digit */ @@ -434,7 +436,7 @@ AcpiExConvertToAscii ( if (!LeadingZero) { - String[k] = (UINT8) (ASCII_ZERO + ACPI_MODULO (Digit, 10)); + String[k] = (UINT8) (ASCII_ZERO + Remainder); k++; } } diff --git a/sys/contrib/dev/acpica/excreate.c b/sys/contrib/dev/acpica/excreate.c index f4b7439dc651..04918881bac1 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: 65 $ + * $Revision: 68 $ * *****************************************************************************/ @@ -136,6 +136,7 @@ * * PARAMETERS: Opcode - The opcode to be executed * Operands - List of operands for the opcode + * WalkState - Current state * * RETURN: Status * @@ -161,7 +162,7 @@ ACPI_STATUS AcpiExCreateBufferField ( - UINT8 *AmlPtr, + UINT8 *AmlStart, UINT32 AmlLength, ACPI_NAMESPACE_NODE *Node, ACPI_WALK_STATE *WalkState) @@ -200,8 +201,8 @@ AcpiExCreateBufferField ( * opcode and operands -- since the buffer and index * operands must be evaluated. */ - ObjDesc->BufferField.Extra->Extra.Pcode = AmlPtr; - ObjDesc->BufferField.Extra->Extra.PcodeLength = AmlLength; + ObjDesc->BufferField.Extra->Extra.AmlStart = AmlStart; + ObjDesc->BufferField.Extra->Extra.AmlLength = AmlLength; ObjDesc->BufferField.Node = Node; @@ -257,7 +258,6 @@ AcpiExCreateBufferField ( break; } - /* Store constructed field descriptor in result location */ Status = AcpiExStore (ObjDesc, (ACPI_OPERAND_OBJECT *) Node, @@ -272,7 +272,6 @@ AcpiExCreateBufferField ( AcpiUtRemoveReference (ObjDesc); } - return_ACPI_STATUS (AE_OK); @@ -319,12 +318,8 @@ AcpiExCreateAlias ( /* Get the source/alias operands (both namespace nodes) */ - Status = AcpiDsObjStackPopObject ((ACPI_OPERAND_OBJECT **) &SourceNode, - WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } + SourceNode = (ACPI_NAMESPACE_NODE *) WalkState->Operands[WalkState->NumOperands -1]; + WalkState->NumOperands--; /* * Don't pop it, it gets removed in the calling routine @@ -359,7 +354,7 @@ AcpiExCreateAlias ( * * FUNCTION: AcpiExCreateEvent * - * PARAMETERS: None + * PARAMETERS: WalkState - Current state * * RETURN: Status * @@ -419,8 +414,7 @@ AcpiExCreateEvent ( * * FUNCTION: AcpiExCreateMutex * - * PARAMETERS: InterpreterMode - Current running mode (load1/Load2/Exec) - * Operands - List of operands for the opcode + * PARAMETERS: WalkState - Current state * * RETURN: Status * @@ -442,11 +436,8 @@ AcpiExCreateMutex ( /* Get the operand */ - Status = AcpiDsObjStackPopObject (&SyncDesc, WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } + SyncDesc = WalkState->Operands[WalkState->NumOperands -1]; + WalkState->NumOperands--; /* Attempt to allocate a new object */ @@ -494,10 +485,10 @@ AcpiExCreateMutex ( * * FUNCTION: AcpiExCreateRegion * - * PARAMETERS: AmlPtr - Pointer to the region declaration AML + * PARAMETERS: AmlStart - Pointer to the region declaration AML * AmlLength - Max length of the declaration AML * Operands - List of operands for the opcode - * InterpreterMode - Load1/Load2/Execute + * WalkState - Current state * * RETURN: Status * @@ -507,7 +498,7 @@ AcpiExCreateMutex ( ACPI_STATUS AcpiExCreateRegion ( - UINT8 *AmlPtr, + UINT8 *AmlStart, UINT32 AmlLength, UINT8 RegionSpace, ACPI_WALK_STATE *WalkState) @@ -563,8 +554,8 @@ AcpiExCreateRegion ( * Remember location in AML stream of address & length * operands since they need to be evaluated at run time. */ - ObjDesc->Region.Extra->Extra.Pcode = AmlPtr; - ObjDesc->Region.Extra->Extra.PcodeLength = AmlLength; + ObjDesc->Region.Extra->Extra.AmlStart = AmlStart; + ObjDesc->Region.Extra->Extra.AmlLength = AmlLength; /* Init the region from the operands */ @@ -623,6 +614,44 @@ AcpiExCreateRegion ( } +/***************************************************************************** + * + * FUNCTION: AcpiExCreateTableRegion + * + * PARAMETERS: WalkState - Current state + * + * RETURN: Status + * + * DESCRIPTION: Create a new DataTableRegion object + * + ****************************************************************************/ + +ACPI_STATUS +AcpiExCreateTableRegion ( + ACPI_WALK_STATE *WalkState) +{ + ACPI_STATUS Status = AE_OK; + + + FUNCTION_TRACE ("ExCreateTableRegion"); + +/* + ACPI_OPERAND_OBJECT *ObjDesc; + ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_REGION); + if (!ObjDesc) + { + Status = AE_NO_MEMORY; + goto Cleanup; + } + + +Cleanup: +*/ + + return_ACPI_STATUS (Status); +} + + /***************************************************************************** * * FUNCTION: AcpiExCreateProcessor @@ -780,7 +809,7 @@ AcpiExCreatePowerResource ( * * FUNCTION: AcpiExCreateMethod * - * PARAMETERS: AmlPtr - First byte of the method's AML + * PARAMETERS: AmlStart - First byte of the method's AML * AmlLength - AML byte count for this method * MethodFlags - AML method flag byte * Method - Method Node @@ -793,7 +822,7 @@ AcpiExCreatePowerResource ( ACPI_STATUS AcpiExCreateMethod ( - UINT8 *AmlPtr, + UINT8 *AmlStart, UINT32 AmlLength, UINT32 MethodFlags, ACPI_NAMESPACE_NODE *Method) @@ -815,8 +844,8 @@ AcpiExCreateMethod ( /* Get the method's AML pointer/length from the Op */ - ObjDesc->Method.Pcode = AmlPtr; - ObjDesc->Method.PcodeLength = AmlLength; + ObjDesc->Method.AmlStart = AmlStart; + ObjDesc->Method.AmlLength = AmlLength; /* * First argument is the Method Flags (contains parameter count for the diff --git a/sys/contrib/dev/acpica/exdump.c b/sys/contrib/dev/acpica/exdump.c index 96e3fca86d92..507922b8c217 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: 122 $ + * $Revision: 124 $ * *****************************************************************************/ @@ -138,12 +138,12 @@ * FUNCTION: AcpiExShowHexValue * * PARAMETERS: ByteCount - Number of bytes to print (1, 2, or 4) - * *AmlPtr - Address in AML stream of bytes to print + * *AmlStart - Address in AML stream of bytes to print * InterpreterMode - Current running mode (load1/Load2/Exec) * LeadSpace - # of spaces to print ahead of value * 0 => none ahead but one behind * - * DESCRIPTION: Print ByteCount byte(s) starting at AmlPtr as a single + * DESCRIPTION: Print ByteCount byte(s) starting at AmlStart as a single * value, in hex. If ByteCount > 1 or the value printed is > 9, also * print in decimal. * @@ -152,7 +152,7 @@ void AcpiExShowHexValue ( UINT32 ByteCount, - UINT8 *AmlPtr, + UINT8 *AmlStart, UINT32 LeadSpace) { UINT32 Value; /* Value retrieved from AML stream */ @@ -164,7 +164,7 @@ AcpiExShowHexValue ( FUNCTION_TRACE ("ExShowHexValue"); - if (!AmlPtr) + if (!AmlStart) { REPORT_ERROR (("ExShowHexValue: null pointer\n")); } @@ -173,9 +173,9 @@ AcpiExShowHexValue ( * AML numbers are always stored little-endian, * even if the processor is big-endian. */ - for (CurrentAmlPtr = AmlPtr + ByteCount, + for (CurrentAmlPtr = AmlStart + ByteCount, Value = 0; - CurrentAmlPtr > AmlPtr; ) + CurrentAmlPtr > AmlStart; ) { Value = (Value << 8) + (UINT32)* --CurrentAmlPtr; } @@ -201,7 +201,7 @@ AcpiExShowHexValue ( while (ByteCount--) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, "%02x", *AmlPtr++)); + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_LOAD, "%02x", *AmlStart++)); if (ByteCount) { @@ -308,6 +308,12 @@ AcpiExDumpOperand ( break; + case AML_REVISION_OP: + + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Revision\n")); + break; + + case AML_DEBUG_OP: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Reference: Debug\n")); @@ -562,7 +568,7 @@ AcpiExDumpOperand ( ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "Method(%X) @ %p:%lX\n", EntryDesc->Method.ParamCount, - EntryDesc->Method.Pcode, EntryDesc->Method.PcodeLength)); + EntryDesc->Method.AmlStart, EntryDesc->Method.AmlLength)); break; @@ -841,8 +847,8 @@ AcpiExDumpObjectDescriptor ( 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", "PcodeLength", ObjDesc->Method.PcodeLength); - AcpiOsPrintf ("%20s : %X\n", "Pcode", ObjDesc->Method.Pcode); + AcpiOsPrintf ("%20s : %X\n", "AmlLength", ObjDesc->Method.AmlLength); + AcpiOsPrintf ("%20s : %X\n", "AmlStart", ObjDesc->Method.AmlStart); break; diff --git a/sys/contrib/dev/acpica/exdyadic.c b/sys/contrib/dev/acpica/exdyadic.c index 546438328c8e..ef434a298388 100644 --- a/sys/contrib/dev/acpica/exdyadic.c +++ b/sys/contrib/dev/acpica/exdyadic.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exdyadic - ACPI AML execution for dyadic (2-operand) operators - * $Revision: 88 $ + * $Revision: 91 $ * *****************************************************************************/ @@ -314,8 +314,7 @@ AcpiExDoConcatenate ( * * FUNCTION: AcpiExDyadic1 * - * PARAMETERS: Opcode - The opcode to be executed - * WalkState - Current walk state + * PARAMETERS: WalkState - Current walk state * * RETURN: Status * @@ -328,7 +327,6 @@ AcpiExDoConcatenate ( ACPI_STATUS AcpiExDyadic1 ( - UINT16 Opcode, ACPI_WALK_STATE *WalkState) { ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; @@ -342,19 +340,17 @@ AcpiExDyadic1 ( /* Examine the opcode */ - switch (Opcode) + switch (WalkState->Opcode) { - /* DefNotify := NotifyOp (0)NotifyObject (1)NotifyValue */ + case AML_NOTIFY_OP: /* Notify (NotifyObject, NotifyValue) */ - case AML_NOTIFY_OP: - - /* The ObjDesc is actually an Node */ + /* The first operand is a namespace node */ Node = (ACPI_NAMESPACE_NODE *) Operand[0]; Operand[0] = NULL; - /* Object must be a device or thermal zone */ + /* The node must refer to a device or thermal zone */ if (Node && Operand[1]) { @@ -376,7 +372,7 @@ AcpiExDyadic1 ( default: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unexpected notify object type %X\n", - Operand[0]->Common.Type)); + Node->Type)); Status = AE_AML_OPERAND_TYPE; break; @@ -386,12 +382,11 @@ AcpiExDyadic1 ( default: - REPORT_ERROR (("AcpiExDyadic1: Unknown dyadic opcode %X\n", Opcode)); + REPORT_ERROR (("AcpiExDyadic1: Unknown dyadic opcode %X\n", WalkState->Opcode)); Status = AE_AML_BAD_OPCODE; } - /* Always delete both operands */ AcpiUtRemoveReference (Operand[1]); @@ -406,9 +401,7 @@ AcpiExDyadic1 ( * * FUNCTION: AcpiExDyadic2R * - * PARAMETERS: Opcode - The opcode to be executed - * WalkState - Current walk state - * ReturnDesc - Where to store the return object + * PARAMETERS: WalkState - Current walk state * * RETURN: Status * @@ -421,9 +414,7 @@ AcpiExDyadic1 ( ACPI_STATUS AcpiExDyadic2R ( - UINT16 Opcode, - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT **ReturnDesc) + ACPI_WALK_STATE *WalkState) { ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; ACPI_OPERAND_OBJECT *RetDesc = NULL; @@ -431,12 +422,12 @@ AcpiExDyadic2R ( ACPI_STATUS Status = AE_OK; - FUNCTION_TRACE_U32 ("ExDyadic2R", Opcode); + FUNCTION_TRACE_U32 ("ExDyadic2R", WalkState->Opcode); /* Create an internal return object if necessary */ - switch (Opcode) + switch (WalkState->Opcode) { case AML_ADD_OP: case AML_BIT_AND_OP: @@ -465,71 +456,56 @@ AcpiExDyadic2R ( /* * Execute the opcode */ - switch (Opcode) + switch (WalkState->Opcode) { - /* DefAdd := AddOp Operand1 Operand2 Result */ - - case AML_ADD_OP: + case AML_ADD_OP: /* Add (Operand1, Operand2, Result) */ RetDesc->Integer.Value = Operand[0]->Integer.Value + Operand[1]->Integer.Value; break; - /* DefAnd := AndOp Operand1 Operand2 Result */ - - case AML_BIT_AND_OP: + case AML_BIT_AND_OP: /* And (Operand1, Operand2, Result) */ RetDesc->Integer.Value = Operand[0]->Integer.Value & Operand[1]->Integer.Value; break; - /* DefNAnd := NAndOp Operand1 Operand2 Result */ - - case AML_BIT_NAND_OP: + case AML_BIT_NAND_OP: /* NAnd (Operand1, Operand2, Result) */ RetDesc->Integer.Value = ~(Operand[0]->Integer.Value & Operand[1]->Integer.Value); break; - /* DefOr := OrOp Operand1 Operand2 Result */ - - case AML_BIT_OR_OP: + case AML_BIT_OR_OP: /* Or (Operand1, Operand2, Result) */ RetDesc->Integer.Value = Operand[0]->Integer.Value | Operand[1]->Integer.Value; break; - /* DefNOr := NOrOp Operand1 Operand2 Result */ - - case AML_BIT_NOR_OP: + case AML_BIT_NOR_OP: /* NOr (Operand1, Operand2, Result) */ RetDesc->Integer.Value = ~(Operand[0]->Integer.Value | Operand[1]->Integer.Value); break; - /* DefXOr := XOrOp Operand1 Operand2 Result */ - - case AML_BIT_XOR_OP: + case AML_BIT_XOR_OP: /* XOr (Operand1, Operand2, Result) */ RetDesc->Integer.Value = Operand[0]->Integer.Value ^ Operand[1]->Integer.Value; break; - /* DefDivide := DivideOp Dividend Divisor Remainder Quotient */ - - case AML_DIVIDE_OP: + case AML_DIVIDE_OP: /* Divide (Dividend, Divisor, RemainderResult QuotientRsult) */ if (!Operand[1]->Integer.Value) { - REPORT_ERROR - (("DivideOp: Divide by zero\n")); + REPORT_ERROR (("DivideOp: Divide by zero\n")); Status = AE_AML_DIVIDE_BY_ZERO; goto Cleanup; @@ -542,77 +518,63 @@ AcpiExDyadic2R ( goto Cleanup; } - /* Remainder (modulo) */ + /* + * RetDesc2 will contain the quotient, + * RetDesc will contain the remainder + */ + Status = AcpiUtDivide (&Operand[0]->Integer.Value, &Operand[1]->Integer.Value, + &RetDesc2->Integer.Value, &RetDesc->Integer.Value); - RetDesc->Integer.Value = ACPI_MODULO (Operand[0]->Integer.Value, - Operand[1]->Integer.Value); - - /* Result (what we used to call the quotient) */ - - RetDesc2->Integer.Value = ACPI_DIVIDE (Operand[0]->Integer.Value, - Operand[1]->Integer.Value); break; - /* DefMod := ModOp Dividend Divisor Remainder */ - - case AML_MOD_OP: /* ACPI 2.0 */ + case AML_MOD_OP: /* Mod (Dividend, Divisor, RemainderResult (ACPI 2.0) */ if (!Operand[1]->Integer.Value) { - REPORT_ERROR - (("ModOp: Divide by zero\n")); + REPORT_ERROR (("ModOp: Divide by zero\n")); Status = AE_AML_DIVIDE_BY_ZERO; goto Cleanup; } - /* Remainder (modulo) */ + /* RetDesc will contain the remainder */ + + Status = AcpiUtDivide (&Operand[0]->Integer.Value, &Operand[1]->Integer.Value, + NULL, &RetDesc->Integer.Value); - RetDesc->Integer.Value = ACPI_MODULO (Operand[0]->Integer.Value, - Operand[1]->Integer.Value); break; - /* DefMultiply := MultiplyOp Operand1 Operand2 Result */ - - case AML_MULTIPLY_OP: + case AML_MULTIPLY_OP: /* Multiply (Operand1, Operand2, Result) */ RetDesc->Integer.Value = Operand[0]->Integer.Value * Operand[1]->Integer.Value; break; - /* DefShiftLeft := ShiftLeftOp Operand ShiftCount Result */ - - case AML_SHIFT_LEFT_OP: + case AML_SHIFT_LEFT_OP: /* ShiftLeft (Operand, ShiftCount, Result) */ RetDesc->Integer.Value = Operand[0]->Integer.Value << Operand[1]->Integer.Value; break; - /* DefShiftRight := ShiftRightOp Operand ShiftCount Result */ - - case AML_SHIFT_RIGHT_OP: + case AML_SHIFT_RIGHT_OP: /* ShiftRight (Operand, ShiftCount, Result) */ RetDesc->Integer.Value = Operand[0]->Integer.Value >> Operand[1]->Integer.Value; break; - /* DefSubtract := SubtractOp Operand1 Operand2 Result */ - - case AML_SUBTRACT_OP: + case AML_SUBTRACT_OP: /* Subtract (Operand1, Operand2, Result) */ RetDesc->Integer.Value = Operand[0]->Integer.Value - Operand[1]->Integer.Value; break; - /* DefConcat := ConcatOp Data1 Data2 Result */ - - case AML_CONCAT_OP: + case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */ /* * Convert the second operand if necessary. The first operand @@ -644,7 +606,6 @@ AcpiExDyadic2R ( goto Cleanup; } - /* * Both operands are now known to be the same object type * (Both are Integer, String, or Buffer), and we can now perform the @@ -658,18 +619,14 @@ AcpiExDyadic2R ( break; - /* DefToString := Buffer, Length, Result */ - - case AML_TO_STRING_OP: /* ACPI 2.0 */ + case AML_TO_STRING_OP: /* ToString (Buffer, Length, Result) (ACPI 2.0) */ Status = AcpiExConvertToString (Operand[0], &RetDesc, 16, (UINT32) Operand[1]->Integer.Value, WalkState); break; - /* DefConcatRes := Buffer, Buffer, Result */ - - case AML_CONCAT_RES_OP: /* ACPI 2.0 */ + case AML_CONCAT_RES_OP: /* ConcatenateResTemplate (Buffer, Buffer, Result) (ACPI 2.0) */ Status = AE_NOT_IMPLEMENTED; goto Cleanup; @@ -679,7 +636,7 @@ AcpiExDyadic2R ( default: REPORT_ERROR (("AcpiExDyadic2R: Unknown dyadic opcode %X\n", - Opcode)); + WalkState->Opcode)); Status = AE_AML_BAD_OPCODE; goto Cleanup; } @@ -696,7 +653,7 @@ AcpiExDyadic2R ( goto Cleanup; } - if (AML_DIVIDE_OP == Opcode) + if (AML_DIVIDE_OP == WalkState->Opcode) { Status = AcpiExStore (RetDesc2, Operand[3], WalkState); @@ -705,12 +662,12 @@ AcpiExDyadic2R ( * the object we created earlier */ AcpiUtRemoveReference (RetDesc); - *ReturnDesc = RetDesc2; + WalkState->ResultObj = RetDesc2; } else { - *ReturnDesc = RetDesc; + WalkState->ResultObj = RetDesc; } @@ -750,9 +707,7 @@ AcpiExDyadic2R ( * * FUNCTION: AcpiExDyadic2S * - * PARAMETERS: Opcode - The opcode to be executed - * WalkState - Current walk state - * ReturnDesc - Where to store the return object + * PARAMETERS: WalkState - Current walk state * * RETURN: Status * @@ -764,9 +719,7 @@ AcpiExDyadic2R ( ACPI_STATUS AcpiExDyadic2S ( - UINT16 Opcode, - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT **ReturnDesc) + ACPI_WALK_STATE *WalkState) { ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; ACPI_OPERAND_OBJECT *RetDesc = NULL; @@ -793,20 +746,16 @@ AcpiExDyadic2S ( /* Examine the opcode */ - switch (Opcode) + switch (WalkState->Opcode) { - /* DefAcquire := AcquireOp MutexObject Timeout */ - - case AML_ACQUIRE_OP: + case AML_ACQUIRE_OP: /* Acquire (MutexObject, Timeout) */ Status = AcpiExAcquireMutex (Operand[1], Operand[0], WalkState); break; - /* DefWait := WaitOp AcpiEventObject Timeout */ - - case AML_WAIT_OP: + case AML_WAIT_OP: /* Wait (EventObject, Timeout) */ Status = AcpiExSystemWaitEvent (Operand[1], Operand[0]); break; @@ -814,7 +763,7 @@ AcpiExDyadic2S ( default: - REPORT_ERROR (("AcpiExDyadic2S: Unknown dyadic synchronization opcode %X\n", Opcode)); + REPORT_ERROR (("AcpiExDyadic2S: Unknown dyadic synchronization opcode %X\n", WalkState->Opcode)); Status = AE_AML_BAD_OPCODE; goto Cleanup; } @@ -850,7 +799,7 @@ AcpiExDyadic2S ( /* Set the return object and exit */ - *ReturnDesc = RetDesc; + WalkState->ResultObj = RetDesc; return_ACPI_STATUS (Status); } @@ -859,9 +808,7 @@ AcpiExDyadic2S ( * * FUNCTION: AcpiExDyadic2 * - * PARAMETERS: Opcode - The opcode to be executed - * WalkState - Current walk state - * ReturnDesc - Where to store the return object + * PARAMETERS: WalkState - Current walk state * * RETURN: Status * @@ -875,9 +822,7 @@ AcpiExDyadic2S ( ACPI_STATUS AcpiExDyadic2 ( - UINT16 Opcode, - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT **ReturnDesc) + ACPI_WALK_STATE *WalkState) { ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; ACPI_OPERAND_OBJECT *RetDesc = NULL; @@ -898,60 +843,48 @@ AcpiExDyadic2 ( } /* - * Execute the Opcode + * Execute the WalkState->Opcode */ Lboolean = FALSE; - switch (Opcode) + switch (WalkState->Opcode) { - /* DefLAnd := LAndOp Operand1 Operand2 */ - - case AML_LAND_OP: + case AML_LAND_OP: /* LAnd (Operand1, Operand2) */ Lboolean = (BOOLEAN) (Operand[0]->Integer.Value && Operand[1]->Integer.Value); break; - /* DefLEqual := LEqualOp Operand1 Operand2 */ - - case AML_LEQUAL_OP: + case AML_LEQUAL_OP: /* LEqual (Operand1, Operand2) */ Lboolean = (BOOLEAN) (Operand[0]->Integer.Value == Operand[1]->Integer.Value); break; - /* DefLGreater := LGreaterOp Operand1 Operand2 */ - - case AML_LGREATER_OP: + case AML_LGREATER_OP: /* LGreater (Operand1, Operand2) */ Lboolean = (BOOLEAN) (Operand[0]->Integer.Value > Operand[1]->Integer.Value); break; - /* DefLLess := LLessOp Operand1 Operand2 */ - - case AML_LLESS_OP: + case AML_LLESS_OP: /* LLess (Operand1, Operand2) */ Lboolean = (BOOLEAN) (Operand[0]->Integer.Value < Operand[1]->Integer.Value); break; - /* DefLOr := LOrOp Operand1 Operand2 */ - - case AML_LOR_OP: + case AML_LOR_OP: /* LOr (Operand1, Operand2) */ Lboolean = (BOOLEAN) (Operand[0]->Integer.Value || Operand[1]->Integer.Value); break; - /* DefCopy := Source, Destination */ - - case AML_COPY_OP: /* ACPI 2.0 */ + case AML_COPY_OP: /* Copy (Source, Target) (ACPI 2.0) */ Status = AE_NOT_IMPLEMENTED; goto Cleanup; @@ -960,7 +893,7 @@ AcpiExDyadic2 ( default: - REPORT_ERROR (("AcpiExDyadic2: Unknown dyadic opcode %X\n", Opcode)); + REPORT_ERROR (("AcpiExDyadic2: Unknown dyadic opcode %X\n", WalkState->Opcode)); Status = AE_AML_BAD_OPCODE; goto Cleanup; break; @@ -999,7 +932,7 @@ AcpiExDyadic2 ( /* Set the return object and exit */ - *ReturnDesc = RetDesc; + WalkState->ResultObj = RetDesc; return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/exmisc.c b/sys/contrib/dev/acpica/exmisc.c index 173a0bcc09a9..e2d84a144589 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: 83 $ + * $Revision: 87 $ * *****************************************************************************/ @@ -134,9 +134,7 @@ * * FUNCTION: AcpiExTriadic * - * PARAMETERS: Opcode - The opcode to be executed - * WalkState - Current walk state - * ReturnDesc - Where to store the return object + * PARAMETERS: WalkState - Current walk state * * RETURN: Status * @@ -148,14 +146,13 @@ ACPI_STATUS AcpiExTriadic ( - UINT16 Opcode, - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT **ReturnDesc) + ACPI_WALK_STATE *WalkState) { ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; ACPI_OPERAND_OBJECT *RetDesc = NULL; ACPI_OPERAND_OBJECT *TmpDesc; ACPI_SIGNAL_FATAL_INFO *Fatal; + UINT32 Temp; ACPI_STATUS Status = AE_OK; @@ -167,7 +164,7 @@ AcpiExTriadic ( #define ResDesc Operand[2] - switch (Opcode) + switch (WalkState->Opcode) { case AML_FATAL_OP: @@ -183,8 +180,8 @@ AcpiExTriadic ( Fatal = ACPI_MEM_ALLOCATE (sizeof (ACPI_SIGNAL_FATAL_INFO)); if (Fatal) { - Fatal->Type = (UINT32) ObjDesc1->Integer.Value; - Fatal->Code = (UINT32) ObjDesc2->Integer.Value; + Fatal->Type = (UINT32) ObjDesc1->Integer.Value; + Fatal->Code = (UINT32) ObjDesc2->Integer.Value; Fatal->Argument = (UINT32) ResDesc->Integer.Value; } @@ -196,15 +193,65 @@ AcpiExTriadic ( /* Might return while OS is shutting down */ ACPI_MEM_FREE (Fatal); + AcpiUtRemoveReference (Operand[2]); break; case AML_MID_OP: - /* DefMid := MidOp Source Index Length Result */ + /* DefMid := MidOp (0)Source (1)Index (2)Length (3)Result */ - /* Create the internal return object (string or buffer) */ + /* + * Create the return object. The Source operand is guaranteed to be + * either a String or a Buffer, so just use its type. + */ + RetDesc = AcpiUtCreateInternalObject (ObjDesc1->Common.Type); + if (!RetDesc) + { + Status = AE_NO_MEMORY; + goto Cleanup; + } + /* + * If the index is beyond the length of the String/Buffer, or if the + * requested length is zero, return a zero-length String/Buffer + */ + if ((Operand[1]->Integer.Value < ObjDesc1->String.Length) && + (Operand[2]->Integer.Value > 0)) + { + /* Truncate request if larger than the actual String/Buffer */ + + if (((UINT32) Operand[1]->Integer.Value + (UINT32) Operand[2]->Integer.Value) > + ObjDesc1->String.Length) + { + Temp = ObjDesc1->String.Length - (UINT32) Operand[1]->Integer.Value; + } + else + { + Temp = (UINT32) Operand[2]->Integer.Value; + } + + /* Allocate a new buffer for the String/Buffer */ + + RetDesc->String.Pointer = ACPI_MEM_CALLOCATE (Temp + 1); + if (!RetDesc->String.Pointer) + { + Status = AE_NO_MEMORY; + goto Cleanup; + } + + /* Copy the portion requested */ + + MEMCPY (RetDesc->String.Pointer, + ObjDesc1->String.Pointer + (UINT32) Operand[1]->Integer.Value, + Temp); + + /* Set the length of the new String/Buffer */ + + RetDesc->String.Length = Temp; + } + + Status = AcpiExStore (RetDesc, Operand[3], WalkState); break; @@ -314,7 +361,7 @@ AcpiExTriadic ( /* Set the return object and exit */ - *ReturnDesc = RetDesc; + WalkState->ResultObj = RetDesc; return_ACPI_STATUS (Status); } @@ -323,9 +370,7 @@ AcpiExTriadic ( * * FUNCTION: AcpiExHexadic * - * PARAMETERS: Opcode - The opcode to be executed - * WalkState - Current walk state - * ReturnDesc - Where to store the return object + * PARAMETERS: WalkState - Current walk state * * RETURN: Status * @@ -335,9 +380,7 @@ AcpiExTriadic ( ACPI_STATUS AcpiExHexadic ( - UINT16 Opcode, - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT **ReturnDesc) + ACPI_WALK_STATE *WalkState) { ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; ACPI_OPERAND_OBJECT *RetDesc = NULL; @@ -357,7 +400,7 @@ AcpiExHexadic ( - switch (Opcode) + switch (WalkState->Opcode) { case AML_MATCH_OP: @@ -416,9 +459,8 @@ AcpiExHexadic ( * "continue" (proceed to next iteration of enclosing * "for" loop) signifies a non-match. */ - switch (Op1Desc->Integer.Value) + switch ((NATIVE_UINT) Op1Desc->Integer.Value) { - case MATCH_MTR: /* always true */ break; @@ -480,9 +522,8 @@ AcpiExHexadic ( } - switch(Op2Desc->Integer.Value) + switch ((NATIVE_UINT) Op2Desc->Integer.Value) { - case MATCH_MTR: break; @@ -581,6 +622,6 @@ AcpiExHexadic ( /* Set the return object and exit */ - *ReturnDesc = RetDesc; + WalkState->ResultObj = RetDesc; return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/exmonad.c b/sys/contrib/dev/acpica/exmonad.c index 07ad15d5fb5f..3e6a969da510 100644 --- a/sys/contrib/dev/acpica/exmonad.c +++ b/sys/contrib/dev/acpica/exmonad.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exmonad - ACPI AML execution for monadic (1 operand) operators - * $Revision: 110 $ + * $Revision: 113 $ * *****************************************************************************/ @@ -216,7 +216,7 @@ AcpiExGetObjectReference ( * * FUNCTION: AcpiExMonadic1 * - * PARAMETERS: Opcode - The opcode to be executed + * PARAMETERS: WalkState - Current state (contains AML opcode) * * RETURN: Status * @@ -227,7 +227,6 @@ AcpiExGetObjectReference ( ACPI_STATUS AcpiExMonadic1 ( - UINT16 Opcode, ACPI_WALK_STATE *WalkState) { ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; @@ -239,60 +238,45 @@ AcpiExMonadic1 ( /* Examine the opcode */ - switch (Opcode) + switch (WalkState->Opcode) { - - /* DefRelease := ReleaseOp MutexObject */ - - case AML_RELEASE_OP: + case AML_RELEASE_OP: /* Release (MutexObject) */ Status = AcpiExReleaseMutex (ObjDesc, WalkState); break; - /* DefReset := ResetOp AcpiEventObject */ - - case AML_RESET_OP: + case AML_RESET_OP: /* Reset (EventObject) */ Status = AcpiExSystemResetEvent (ObjDesc); break; - /* DefSignal := SignalOp AcpiEventObject */ - - case AML_SIGNAL_OP: + case AML_SIGNAL_OP: /* Signal (EventObject) */ Status = AcpiExSystemSignalEvent (ObjDesc); break; - /* DefSleep := SleepOp MsecTime */ - - case AML_SLEEP_OP: + case AML_SLEEP_OP: /* Sleep (MsecTime) */ AcpiExSystemDoSuspend ((UINT32) ObjDesc->Integer.Value); break; - /* DefStall := StallOp UsecTime */ - - case AML_STALL_OP: + case AML_STALL_OP: /* Stall (UsecTime) */ AcpiExSystemDoStall ((UINT32) ObjDesc->Integer.Value); break; - /* Unknown opcode */ - - default: + default: /* Unknown opcode */ REPORT_ERROR (("AcpiExMonadic1: Unknown monadic opcode %X\n", - Opcode)); + WalkState->Opcode)); Status = AE_AML_BAD_OPCODE; break; - - } /* switch */ - + } /* Always delete the operand */ @@ -307,7 +291,7 @@ AcpiExMonadic1 ( * * FUNCTION: AcpiExMonadic2R * - * PARAMETERS: Opcode - The opcode to be executed + * PARAMETERS: WalkState - Current state (contains AML opcode) * * RETURN: Status * @@ -318,15 +302,13 @@ AcpiExMonadic1 ( ACPI_STATUS AcpiExMonadic2R ( - UINT16 Opcode, - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT **ReturnDesc) + ACPI_WALK_STATE *WalkState) { + ACPI_STATUS Status = AE_OK; ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; ACPI_OPERAND_OBJECT *RetDesc = NULL; ACPI_OPERAND_OBJECT *RetDesc2 = NULL; - UINT32 ResVal; - ACPI_STATUS Status = AE_OK; + UINT32 Temp32; UINT32 i; UINT32 j; ACPI_INTEGER Digit; @@ -339,7 +321,7 @@ AcpiExMonadic2R ( /* Create a return object of type NUMBER for most opcodes */ - switch (Opcode) + switch (WalkState->Opcode) { case AML_BIT_NOT_OP: case AML_FIND_SET_LEFT_BIT_OP: @@ -359,19 +341,17 @@ AcpiExMonadic2R ( } - switch (Opcode) + switch (WalkState->Opcode) { - /* DefNot := NotOp Operand Result */ - case AML_BIT_NOT_OP: + case AML_BIT_NOT_OP: /* Not (Operand, Result) */ RetDesc->Integer.Value = ~ObjDesc->Integer.Value; break; - /* DefFindSetLeftBit := FindSetLeftBitOp Operand Result */ + case AML_FIND_SET_LEFT_BIT_OP: /* FindSetLeftBit (Operand, Result) */ - case AML_FIND_SET_LEFT_BIT_OP: RetDesc->Integer.Value = ObjDesc->Integer.Value; @@ -379,39 +359,36 @@ AcpiExMonadic2R ( * Acpi specification describes Integer type as a little * endian unsigned value, so this boundary condition is valid. */ - for (ResVal = 0; RetDesc->Integer.Value && ResVal < ACPI_INTEGER_BIT_SIZE; ++ResVal) + for (Temp32 = 0; RetDesc->Integer.Value && Temp32 < ACPI_INTEGER_BIT_SIZE; ++Temp32) { RetDesc->Integer.Value >>= 1; } - RetDesc->Integer.Value = ResVal; + RetDesc->Integer.Value = Temp32; break; - /* DefFindSetRightBit := FindSetRightBitOp Operand Result */ + case AML_FIND_SET_RIGHT_BIT_OP: /* FindSetRightBit (Operand, Result) */ - case AML_FIND_SET_RIGHT_BIT_OP: RetDesc->Integer.Value = ObjDesc->Integer.Value; /* - * Acpi specification describes Integer type as a little + * The Acpi specification describes Integer type as a little * endian unsigned value, so this boundary condition is valid. */ - for (ResVal = 0; RetDesc->Integer.Value && ResVal < ACPI_INTEGER_BIT_SIZE; ++ResVal) + for (Temp32 = 0; RetDesc->Integer.Value && Temp32 < ACPI_INTEGER_BIT_SIZE; ++Temp32) { RetDesc->Integer.Value <<= 1; } /* Since returns must be 1-based, subtract from 33 (65) */ - RetDesc->Integer.Value = ResVal == 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - ResVal; + RetDesc->Integer.Value = Temp32 == 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - Temp32; break; - /* DefFromBDC := FromBCDOp BCDValue Result */ - - case AML_FROM_BCD_OP: + case AML_FROM_BCD_OP: /* FromBcd (BCDValue, Result) */ /* * The 64-bit ACPI integer can hold 16 4-bit BCD integers @@ -448,10 +425,7 @@ AcpiExMonadic2R ( break; - /* DefToBDC := ToBCDOp Operand Result */ - - case AML_TO_BCD_OP: - + case AML_TO_BCD_OP: /* ToBcd (Operand, Result) */ if (ObjDesc->Integer.Value > ACPI_MAX_BCD_VALUE) { @@ -466,25 +440,24 @@ AcpiExMonadic2R ( { /* Divide by nth factor of 10 */ + Temp32 = 0; Digit = ObjDesc->Integer.Value; for (j = 0; j < i; j++) { - Digit = ACPI_DIVIDE (Digit, 10); + AcpiUtShortDivide (&Digit, 10, &Digit, &Temp32); } - /* Create the BCD digit */ + /* Create the BCD digit from the remainder above */ if (Digit > 0) { - RetDesc->Integer.Value += (ACPI_MODULO (Digit, 10) << (i * 4)); + RetDesc->Integer.Value += (Temp32 << (i * 4)); } } break; - /* DefCondRefOf := CondRefOfOp SourceObject Result */ - - case AML_COND_REF_OF_OP: + case AML_COND_REF_OF_OP: /* CondRefOf (SourceObject, Result) */ /* * This op is a little strange because the internal return value is @@ -524,17 +497,14 @@ AcpiExMonadic2R ( break; - case AML_STORE_OP: + case AML_STORE_OP: /* Store (Source, Target) */ /* * A store operand is typically a number, string, buffer or lvalue - * TBD: [Unhandled] What about a store to a package? - */ - - /* - * Do the store, and be careful about deleting the source object, + * Be careful about deleting the source object, * since the object itself may have been stored. */ + Temp32 = ObjDesc->Common.ReferenceCount; Status = AcpiExStore (ObjDesc, ResDesc, WalkState); if (ACPI_FAILURE (Status)) { @@ -544,73 +514,78 @@ AcpiExMonadic2R ( return_ACPI_STATUS (Status); } +#if 0 + if ((ObjDesc->Common.ReferenceCount > Temp32) && + (!AcpiDsIsResultUsed (WalkState->Op, WalkState))) + { + ObjDesc->Common.ReferenceCount++; + } +#endif + /* * Normally, we would remove a reference on the ObjDesc parameter; * But since it is being used as the internal return object * (meaning we would normally increment it), the two cancel out, * and we simply don't do anything. */ - *ReturnDesc = ObjDesc; + WalkState->ResultObj = ObjDesc; return_ACPI_STATUS (Status); break; - case AML_DEBUG_OP: - - /* Reference, returning an Reference */ - - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "DebugOp should never get here!\n")); - return_ACPI_STATUS (AE_OK); - break; - - /* * ACPI 2.0 Opcodes */ - case AML_TO_DECSTRING_OP: + case AML_TO_DECSTRING_OP: /* ToDecimalString (Data, Result) */ + Status = AcpiExConvertToString (ObjDesc, &RetDesc, 10, ACPI_UINT32_MAX, WalkState); break; - case AML_TO_HEXSTRING_OP: + case AML_TO_HEXSTRING_OP: /* ToHexString (Data, Result) */ + Status = AcpiExConvertToString (ObjDesc, &RetDesc, 16, ACPI_UINT32_MAX, WalkState); break; - case AML_TO_BUFFER_OP: + + case AML_TO_BUFFER_OP: /* ToBuffer (Data, Result) */ + Status = AcpiExConvertToBuffer (ObjDesc, &RetDesc, WalkState); break; - case AML_TO_INTEGER_OP: + + case AML_TO_INTEGER_OP: /* ToInteger (Data, Result) */ + Status = AcpiExConvertToInteger (ObjDesc, &RetDesc, WalkState); break; /* - * These are obsolete opcodes + * These are two obsolete opcodes */ + case AML_SHIFT_LEFT_BIT_OP: /* ShiftLeftBit (Source, BitNum) */ + case AML_SHIFT_RIGHT_BIT_OP: /* ShiftRightBit (Source, BitNum) */ - /* DefShiftLeftBit := ShiftLeftBitOp Source BitNum */ - /* DefShiftRightBit := ShiftRightBitOp Source BitNum */ - - case AML_SHIFT_LEFT_BIT_OP: - case AML_SHIFT_RIGHT_BIT_OP: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s is unimplemented\n", - AcpiPsGetOpcodeName (Opcode))); + AcpiPsGetOpcodeName (WalkState->Opcode))); Status = AE_SUPPORT; goto Cleanup; break; - default: + default: /* Unknown opcode */ REPORT_ERROR (("AcpiExMonadic2R: Unknown monadic opcode %X\n", - Opcode)); + WalkState->Opcode)); Status = AE_AML_BAD_OPCODE; goto Cleanup; } + /* + * Store the return value computed above into the result object + */ Status = AcpiExStore (RetDesc, ResDesc, WalkState); @@ -633,7 +608,7 @@ AcpiExMonadic2R ( /* Set the return object and exit */ - *ReturnDesc = RetDesc; + WalkState->ResultObj = RetDesc; return_ACPI_STATUS (Status); } @@ -642,7 +617,7 @@ AcpiExMonadic2R ( * * FUNCTION: AcpiExMonadic2 * - * PARAMETERS: Opcode - The opcode to be executed + * PARAMETERS: WalkState - Current state (contains AML opcode) * * RETURN: Status * @@ -654,9 +629,7 @@ AcpiExMonadic2R ( ACPI_STATUS AcpiExMonadic2 ( - UINT16 Opcode, - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT **ReturnDesc) + ACPI_WALK_STATE *WalkState) { ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; ACPI_OPERAND_OBJECT *TmpDesc; @@ -673,12 +646,10 @@ AcpiExMonadic2 ( /* Get the operand and decode the opcode */ - switch (Opcode) + switch (WalkState->Opcode) { - /* DefLNot := LNotOp Operand */ - - case AML_LNOT_OP: + case AML_LNOT_OP: /* LNot (Operand) */ RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); if (!RetDesc) @@ -691,11 +662,8 @@ AcpiExMonadic2 ( break; - /* DefDecrement := DecrementOp Target */ - /* DefIncrement := IncrementOp Target */ - - case AML_DECREMENT_OP: - case AML_INCREMENT_OP: + case AML_DECREMENT_OP: /* Decrement (Operand) */ + case AML_INCREMENT_OP: /* Increment (Operand) */ /* * Since we are expecting an Reference on the top of the stack, it @@ -730,20 +698,20 @@ AcpiExMonadic2 ( /* * Convert the RetDesc Reference to a Number - * (This deletes the original RetDesc) + * (This deletes the original RetDesc object) */ Status = AcpiExResolveOperands (AML_LNOT_OP, &RetDesc, WalkState); if (ACPI_FAILURE (Status)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s: bad operand(s) %s\n", - AcpiPsGetOpcodeName (Opcode), AcpiFormatException(Status))); + AcpiPsGetOpcodeName (WalkState->Opcode), AcpiFormatException(Status))); goto Cleanup; } /* Do the actual increment or decrement */ - if (AML_INCREMENT_OP == Opcode) + if (AML_INCREMENT_OP == WalkState->Opcode) { RetDesc->Integer.Value++; } @@ -763,9 +731,7 @@ AcpiExMonadic2 ( break; - /* DefObjectType := ObjectTypeOp SourceObject */ - - case AML_TYPE_OP: + case AML_TYPE_OP: /* ObjectType (SourceObject) */ if (INTERNAL_TYPE_REFERENCE == ObjDesc->Common.Type) { @@ -778,6 +744,7 @@ AcpiExMonadic2 ( case AML_ZERO_OP: case AML_ONE_OP: case AML_ONES_OP: + case AML_REVISION_OP: /* Constants are of type Number */ @@ -787,7 +754,7 @@ AcpiExMonadic2 ( case AML_DEBUG_OP: - /* Per 1.0b spec, Debug object is of type DebugObject */ + /* Per 1.0b spec, Debug object is of type "DebugObject" */ Type = ACPI_TYPE_DEBUG_OBJECT; break; @@ -861,9 +828,7 @@ AcpiExMonadic2 ( break; - /* DefSizeOf := SizeOfOp SourceObject */ - - case AML_SIZE_OF_OP: + case AML_SIZE_OF_OP: /* SizeOf (SourceObject) */ if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED)) { @@ -926,9 +891,7 @@ AcpiExMonadic2 ( break; - /* DefRefOf := RefOfOp SourceObject */ - - case AML_REF_OF_OP: + case AML_REF_OF_OP: /* RefOf (SourceObject) */ Status = AcpiExGetObjectReference (ObjDesc, &RetDesc, WalkState); if (ACPI_FAILURE (Status)) @@ -938,10 +901,7 @@ AcpiExMonadic2 ( break; - /* DefDerefOf := DerefOfOp ObjReference */ - - case AML_DEREF_OF_OP: - + case AML_DEREF_OF_OP: /* DerefOf (ObjReference) */ /* Check for a method local or argument */ @@ -1095,7 +1055,7 @@ AcpiExMonadic2 ( default: REPORT_ERROR (("AcpiExMonadic2: Unknown monadic opcode %X\n", - Opcode)); + WalkState->Opcode)); Status = AE_AML_BAD_OPCODE; goto Cleanup; } @@ -1117,7 +1077,7 @@ AcpiExMonadic2 ( RetDesc = NULL; } - *ReturnDesc = RetDesc; + WalkState->ResultObj = RetDesc; return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/exnames.c b/sys/contrib/dev/acpica/exnames.c index 77ac397dea01..7df30007f9a7 100644 --- a/sys/contrib/dev/acpica/exnames.c +++ b/sys/contrib/dev/acpica/exnames.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exnames - interpreter/scanner name load/execute - * $Revision: 82 $ + * $Revision: 83 $ * *****************************************************************************/ @@ -185,7 +185,7 @@ AcpiExAllocateNameString ( NameString = ACPI_MEM_ALLOCATE (SizeNeeded); if (!NameString) { - REPORT_ERROR (("ExAllocateNameString: name allocation failure\n")); + REPORT_ERROR (("ExAllocateNameString: Could not allocate size %d\n", SizeNeeded)); return_PTR (NULL); } diff --git a/sys/contrib/dev/acpica/exregion.c b/sys/contrib/dev/acpica/exregion.c index 8bf9ec149e48..fe4ee06b8b95 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: 57 $ + * $Revision: 59 $ * *****************************************************************************/ @@ -140,7 +140,7 @@ * Value - Pointer to in or out value * HandlerContext - Pointer to Handler's context * RegionContext - Pointer to context specific to the - * accessed region + * accessed region * * RETURN: Status * @@ -222,7 +222,7 @@ AcpiExSystemMemorySpaceHandler ( return_ACPI_STATUS (Status); } - /* TBD: should these pointers go to 64-bit in all cases ? */ + /* Save the physical address and mapping size */ MemInfo->MappedPhysicalAddress = Address; MemInfo->MappedLength = SYSMEM_REGION_WINDOW_SIZE; @@ -307,7 +307,7 @@ AcpiExSystemMemorySpaceHandler ( * Value - Pointer to in or out value * HandlerContext - Pointer to Handler's context * RegionContext - Pointer to context specific to the - * accessed region + * accessed region * * RETURN: Status * @@ -371,7 +371,7 @@ AcpiExSystemIoSpaceHandler ( * Value - Pointer to in or out value * HandlerContext - Pointer to Handler's context * RegionContext - Pointer to context specific to the - * accessed region + * accessed region * * RETURN: Status * @@ -441,3 +441,77 @@ AcpiExPciConfigSpaceHandler ( return_ACPI_STATUS (Status); } + +/******************************************************************************* + * + * FUNCTION: AcpiExCmosSpaceHandler + * + * PARAMETERS: Function - Read or Write operation + * Address - Where in the space to read or write + * BitWidth - Field width in bits (8, 16, or 32) + * Value - Pointer to in or out value + * HandlerContext - Pointer to Handler's context + * RegionContext - Pointer to context specific to the + * accessed region + * + * RETURN: Status + * + * DESCRIPTION: Handler for the CMOS address space (Op Region) + * + ******************************************************************************/ + +ACPI_STATUS +AcpiExCmosSpaceHandler ( + UINT32 Function, + ACPI_PHYSICAL_ADDRESS Address, + UINT32 BitWidth, + UINT32 *Value, + void *HandlerContext, + void *RegionContext) +{ + ACPI_STATUS Status = AE_OK; + + + FUNCTION_TRACE ("ExCmosSpaceHandler"); + + + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiExPciBarSpaceHandler + * + * PARAMETERS: Function - Read or Write operation + * Address - Where in the space to read or write + * BitWidth - Field width in bits (8, 16, or 32) + * Value - Pointer to in or out value + * HandlerContext - Pointer to Handler's context + * RegionContext - Pointer to context specific to the + * accessed region + * + * RETURN: Status + * + * DESCRIPTION: Handler for the PCI BarTarget address space (Op Region) + * + ******************************************************************************/ + +ACPI_STATUS +AcpiExPciBarSpaceHandler ( + UINT32 Function, + ACPI_PHYSICAL_ADDRESS Address, + UINT32 BitWidth, + UINT32 *Value, + void *HandlerContext, + void *RegionContext) +{ + ACPI_STATUS Status = AE_OK; + + + FUNCTION_TRACE ("ExPciBarSpaceHandler"); + + + return_ACPI_STATUS (Status); +} + diff --git a/sys/contrib/dev/acpica/exresnte.c b/sys/contrib/dev/acpica/exresnte.c index 981a7e65fdf2..39d7871ee344 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: 39 $ + * $Revision: 41 $ * *****************************************************************************/ @@ -214,8 +214,8 @@ AcpiExResolveNodeToValue ( if (ACPI_TYPE_PACKAGE != ValDesc->Common.Type) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a package, type %X\n", - ValDesc->Common.Type)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Package, type %s\n", + AcpiUtGetTypeName (ValDesc->Common.Type))); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -230,8 +230,8 @@ AcpiExResolveNodeToValue ( if (ACPI_TYPE_BUFFER != ValDesc->Common.Type) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a buffer, type %X\n", - ValDesc->Common.Type)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Buffer, type %s\n", + AcpiUtGetTypeName (ValDesc->Common.Type))); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -246,8 +246,8 @@ AcpiExResolveNodeToValue ( if (ACPI_TYPE_STRING != ValDesc->Common.Type) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a string, type %X\n", - ValDesc->Common.Type)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a String, type %s\n", + AcpiUtGetTypeName (ValDesc->Common.Type))); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -262,8 +262,8 @@ AcpiExResolveNodeToValue ( if (ACPI_TYPE_INTEGER != ValDesc->Common.Type) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Number, type %X\n", - ValDesc->Common.Type)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Integer, type %s\n", + AcpiUtGetTypeName (ValDesc->Common.Type))); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -339,6 +339,11 @@ AcpiExResolveNodeToValue ( TempVal = ACPI_INTEGER_MAX; break; + case AML_REVISION_OP: + + TempVal = ACPI_CA_VERSION; + break; + default: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported reference opcode %X\n", diff --git a/sys/contrib/dev/acpica/exresolv.c b/sys/contrib/dev/acpica/exresolv.c index dd72ba6de50e..f22c0c970e59 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: 97 $ + * $Revision: 99 $ * *****************************************************************************/ @@ -398,31 +398,51 @@ AcpiExResolveObjectToValue ( /* - * TBD: [Restructure] These next three opcodes change the type of - * the object, which is actually a no-no. + * For constants, we must change the reference/constant object + * to a real integer object */ case AML_ZERO_OP: - - StackDesc->Common.Type = (UINT8) ACPI_TYPE_INTEGER; - StackDesc->Integer.Value = 0; - break; - - case AML_ONE_OP: - - StackDesc->Common.Type = (UINT8) ACPI_TYPE_INTEGER; - StackDesc->Integer.Value = 1; - break; - - case AML_ONES_OP: + case AML_REVISION_OP: - StackDesc->Common.Type = (UINT8) ACPI_TYPE_INTEGER; - StackDesc->Integer.Value = ACPI_INTEGER_MAX; + /* Create a new integer object */ - /* Truncate value if we are executing from a 32-bit ACPI table */ + ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); + if (!ObjDesc) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } - AcpiExTruncateFor32bitTable (StackDesc, WalkState); + switch (Opcode) + { + case AML_ZERO_OP: + ObjDesc->Integer.Value = 0; + break; + + case AML_ONE_OP: + ObjDesc->Integer.Value = 1; + break; + + case AML_ONES_OP: + ObjDesc->Integer.Value = ACPI_INTEGER_MAX; + + /* Truncate value if we are executing from a 32-bit ACPI table */ + + AcpiExTruncateFor32bitTable (ObjDesc, WalkState); + break; + + case AML_REVISION_OP: + ObjDesc->Integer.Value = ACPI_CA_VERSION; + break; + } + + /* + * Remove a reference from the original reference object + * and put the new object in its place + */ + AcpiUtRemoveReference (StackDesc); + *StackPtr = ObjDesc; break; diff --git a/sys/contrib/dev/acpica/exresop.c b/sys/contrib/dev/acpica/exresop.c index a383503919cb..ccaf6efe917d 100644 --- a/sys/contrib/dev/acpica/exresop.c +++ b/sys/contrib/dev/acpica/exresop.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exresop - AML Interpreter operand/object resolution - * $Revision: 37 $ + * $Revision: 38 $ * *****************************************************************************/ @@ -301,6 +301,7 @@ AcpiExResolveOperands ( case AML_INDEX_OP: case AML_ARG_OP: case AML_LOCAL_OP: + case AML_REVISION_OP: DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Reference Opcode: %s\n", OpInfo->Name))); diff --git a/sys/contrib/dev/acpica/exstore.c b/sys/contrib/dev/acpica/exstore.c index 815f32ba4688..728aa6a9b185 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: 147 $ + * $Revision: 148 $ * *****************************************************************************/ @@ -673,14 +673,14 @@ AcpiExStoreObjectToNode ( default: + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "Storing %s (%p) directly into node (%p), no implicit conversion\n", + AcpiUtGetTypeName (SourceDesc->Common.Type), SourceDesc, Node)); + /* No conversions for all other types. Just attach the source object */ Status = AcpiNsAttachObject (Node, SourceDesc, SourceDesc->Common.Type); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Store %s into %s via Attach only\n", - AcpiUtGetTypeName (SourceDesc->Common.Type), - AcpiUtGetTypeName (SourceDesc->Common.Type))); break; } diff --git a/sys/contrib/dev/acpica/exutils.c b/sys/contrib/dev/acpica/exutils.c index 8c3efab5e4e1..407894dde1cd 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: 84 $ + * $Revision: 85 $ * *****************************************************************************/ @@ -364,17 +364,17 @@ AcpiExReleaseGlobalLock ( * * FUNCTION: AcpiExDigitsNeeded * - * PARAMETERS: val - Value to be represented - * base - Base of representation + * PARAMETERS: Value - Value to be represented + * Base - Base of representation * - * RETURN: the number of digits needed to represent val in base + * RETURN: the number of digits needed to represent Value in Base * ******************************************************************************/ UINT32 AcpiExDigitsNeeded ( - ACPI_INTEGER val, - UINT32 base) + ACPI_INTEGER Value, + UINT32 Base) { UINT32 NumDigits = 0; @@ -382,7 +382,7 @@ AcpiExDigitsNeeded ( FUNCTION_TRACE ("ExDigitsNeeded"); - if (base < 1) + if (Base < 1) { REPORT_ERROR (("ExDigitsNeeded: Internal error - Invalid base\n")); } @@ -390,9 +390,11 @@ AcpiExDigitsNeeded ( else { /* - * ACPI_INTEGER is unsigned, which is why we don't worry about the '-' + * ACPI_INTEGER is unsigned, which is why we don't worry about a '-' */ - for (NumDigits = 1; (val = ACPI_DIVIDE (val,base)); ++NumDigits) + for (NumDigits = 1; + (AcpiUtShortDivide (&Value, Base, &Value, NULL)); + ++NumDigits) { ; } } @@ -498,18 +500,19 @@ AcpiExUnsignedIntegerToString ( { UINT32 Count; UINT32 DigitsNeeded; + UINT32 Remainder; FUNCTION_ENTRY (); DigitsNeeded = AcpiExDigitsNeeded (Value, 10); - OutString[DigitsNeeded] = '\0'; + OutString[DigitsNeeded] = 0; for (Count = DigitsNeeded; Count > 0; Count--) { - OutString[Count-1] = (NATIVE_CHAR) ('0' + (ACPI_MODULO (Value, 10))); - Value = ACPI_DIVIDE (Value, 10); + AcpiUtShortDivide (&Value, 10, &Value, &Remainder); + OutString[Count-1] = (NATIVE_CHAR) ('0' + Remainder); } return (AE_OK); diff --git a/sys/contrib/dev/acpica/hwgpe.c b/sys/contrib/dev/acpica/hwgpe.c index 761cd93f6e72..27e343adc5bb 100644 --- a/sys/contrib/dev/acpica/hwgpe.c +++ b/sys/contrib/dev/acpica/hwgpe.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: hwgpe - Low level GPE enable/disable/clear functions - * $Revision: 32 $ + * $Revision: 34 $ * *****************************************************************************/ @@ -168,6 +168,45 @@ AcpiHwEnableGpe ( (InByte | BitMask), 8); } +/****************************************************************************** + * + * FUNCTION: AcpiHwEnableGpeForWakeup + * + * PARAMETERS: GpeNumber - The GPE + * + * RETURN: None + * + * DESCRIPTION: Keep track of which GPEs the OS has requested not be + * disabled when going to sleep. + * + ******************************************************************************/ + +void +AcpiHwEnableGpeForWakeup ( + UINT32 GpeNumber) +{ + UINT32 RegisterIndex; + UINT32 BitMask; + + + FUNCTION_ENTRY (); + + + /* + * Translate GPE number to index into global registers array. + */ + RegisterIndex = AcpiGbl_GpeValid[GpeNumber]; + + /* + * Figure out the bit offset for this GPE within the target register. + */ + BitMask = AcpiGbl_DecodeTo8bit [MOD_8 (GpeNumber)]; + + /* + * Set the bit so we will not disable this when sleeping + */ + AcpiGbl_GpeRegisters[RegisterIndex].WakeEnable |= BitMask; +} /****************************************************************************** * @@ -211,8 +250,49 @@ AcpiHwDisableGpe ( AcpiOsReadPort (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr, &InByte, 8); AcpiOsWritePort (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr, (InByte & ~BitMask), 8); + + AcpiHwDisableGpeForWakeup(GpeNumber); } +/****************************************************************************** + * + * FUNCTION: AcpiHwDisableGpeForWakeup + * + * PARAMETERS: GpeNumber - The GPE + * + * RETURN: None + * + * DESCRIPTION: Keep track of which GPEs the OS has requested not be + * disabled when going to sleep. + * + ******************************************************************************/ + +void +AcpiHwDisableGpeForWakeup ( + UINT32 GpeNumber) +{ + UINT32 RegisterIndex; + UINT32 BitMask; + + + FUNCTION_ENTRY (); + + + /* + * Translate GPE number to index into global registers array. + */ + RegisterIndex = AcpiGbl_GpeValid[GpeNumber]; + + /* + * Figure out the bit offset for this GPE within the target register. + */ + BitMask = AcpiGbl_DecodeTo8bit [MOD_8 (GpeNumber)]; + + /* + * Clear the bit so we will disable this when sleeping + */ + AcpiGbl_GpeRegisters[RegisterIndex].WakeEnable &= ~BitMask; +} /****************************************************************************** * @@ -307,6 +387,14 @@ AcpiHwGetGpeStatus ( (*EventStatus) |= ACPI_EVENT_FLAG_ENABLED; } + /* + * Enabled for wake?: + */ + if (BitMask & AcpiGbl_GpeRegisters[RegisterIndex].WakeEnable) + { + (*EventStatus) |= ACPI_EVENT_FLAG_WAKE_ENABLED; + } + /* * Set? */ @@ -317,3 +405,75 @@ AcpiHwGetGpeStatus ( (*EventStatus) |= ACPI_EVENT_FLAG_SET; } } + +/****************************************************************************** + * + * FUNCTION: AcpiHwDisableNonWakeupGpes + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Disable all non-wakeup GPEs + * Call with interrupts disabled. The interrupt handler also + * modifies AcpiGbl_GpeRegisters[i].Enable, so it should not be + * given the chance to run until after non-wake GPEs are + * re-enabled. + * + ******************************************************************************/ + +void +AcpiHwDisableNonWakeupGpes ( + void) +{ + UINT32 i; + + FUNCTION_ENTRY (); + + for (i = 0; i < AcpiGbl_GpeRegisterCount; i++) + { + /* + * Read the enabled status of all GPEs. We + * will be using it to restore all the GPEs later. + */ + AcpiOsReadPort (AcpiGbl_GpeRegisters[i].EnableAddr, + &AcpiGbl_GpeRegisters[i].Enable, 8); + + /* + * Disable all GPEs but wakeup GPEs. + */ + AcpiOsWritePort(AcpiGbl_GpeRegisters[i].EnableAddr, + AcpiGbl_GpeRegisters[i].WakeEnable, 8); + } +} + +/****************************************************************************** + * + * FUNCTION: AcpiHwEnableNonWakeupGpes + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Enable all non-wakeup GPEs we previously enabled. + * + ******************************************************************************/ + +void +AcpiHwEnableNonWakeupGpes ( + void) +{ + UINT32 i; + + FUNCTION_ENTRY (); + + for (i = 0; i < AcpiGbl_GpeRegisterCount; i++) + { + /* + * We previously stored the enabled status of all GPEs. + * Blast them back in. + */ + AcpiOsWritePort(AcpiGbl_GpeRegisters[i].EnableAddr, + AcpiGbl_GpeRegisters[i].Enable, 8); + } +} diff --git a/sys/contrib/dev/acpica/hwsleep.c b/sys/contrib/dev/acpica/hwsleep.c index d0d4ed864875..7cbb6c877a3d 100644 --- a/sys/contrib/dev/acpica/hwsleep.c +++ b/sys/contrib/dev/acpica/hwsleep.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface - * $Revision: 21 $ + * $Revision: 22 $ * *****************************************************************************/ @@ -270,7 +270,7 @@ AcpiEnterSleepState ( disable (); - /* TODO: disable all non-wake GPEs here */ + AcpiHwDisableNonWakeupGpes(); PM1AControl = (UINT16) AcpiHwRegisterRead (ACPI_MTX_LOCK, PM1_CONTROL); @@ -324,6 +324,8 @@ AcpiEnterSleepState ( } while (!AcpiHwRegisterBitAccess (ACPI_READ, ACPI_MTX_LOCK, WAK_STS)); + AcpiHwEnableNonWakeupGpes(); + enable (); return_ACPI_STATUS (AE_OK); @@ -365,7 +367,7 @@ AcpiLeaveSleepState ( /* _WAK returns stuff - do we want to look at it? */ - /* Re-enable GPEs */ + AcpiHwEnableNonWakeupGpes(); return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/hwtimer.c b/sys/contrib/dev/acpica/hwtimer.c index 22e484b2fe49..4a031176e6ee 100644 --- a/sys/contrib/dev/acpica/hwtimer.c +++ b/sys/contrib/dev/acpica/hwtimer.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Name: hwtimer.c - ACPI Power Management Timer Interface - * $Revision: 12 $ + * $Revision: 14 $ * *****************************************************************************/ @@ -138,20 +138,9 @@ ACPI_STATUS AcpiGetTimerResolution ( UINT32 *Resolution) { - ACPI_STATUS Status; - - FUNCTION_TRACE ("AcpiGetTimerResolution"); - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - if (!Resolution) { return_ACPI_STATUS (AE_BAD_PARAMETER); @@ -187,20 +176,9 @@ ACPI_STATUS AcpiGetTimer ( UINT32 *Ticks) { - ACPI_STATUS Status; - - FUNCTION_TRACE ("AcpiGetTimer"); - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - if (!Ticks) { return_ACPI_STATUS (AE_BAD_PARAMETER); diff --git a/sys/contrib/dev/acpica/nsalloc.c b/sys/contrib/dev/acpica/nsalloc.c index d4e712aa11c1..d58eca7dfd4a 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: 55 $ + * $Revision: 57 $ * ******************************************************************************/ @@ -140,7 +140,7 @@ ACPI_NAMESPACE_NODE * AcpiNsCreateNode ( - UINT32 AcpiName) + UINT32 Name) { ACPI_NAMESPACE_NODE *Node; @@ -157,7 +157,7 @@ AcpiNsCreateNode ( ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].TotalAllocated++); Node->DataType = ACPI_DESC_TYPE_NAMED; - Node->Name = AcpiName; + Node->Name = Name; Node->ReferenceCount = 1; return_PTR (Node); @@ -461,9 +461,9 @@ ACPI_STATUS AcpiNsDeleteNamespaceSubtree ( ACPI_NAMESPACE_NODE *ParentNode) { - ACPI_NAMESPACE_NODE *ChildNode; ACPI_OPERAND_OBJECT *ObjDesc; - UINT32 Level; + ACPI_NAMESPACE_NODE *ChildNode = NULL; + UINT32 Level = 1; FUNCTION_TRACE ("NsDeleteNamespaceSubtree"); @@ -474,10 +474,6 @@ AcpiNsDeleteNamespaceSubtree ( return_ACPI_STATUS (AE_OK); } - - ChildNode = 0; - Level = 1; - /* * Traverse the tree of objects until we bubble back up * to where we started. @@ -493,8 +489,8 @@ AcpiNsDeleteNamespaceSubtree ( if (ChildNode) { /* - * Found an object - delete the object within - * the Value field + * Found an object - detach and delete any attached + * object. */ ObjDesc = AcpiNsGetAttachedObject (ChildNode); if (ObjDesc) diff --git a/sys/contrib/dev/acpica/nsdump.c b/sys/contrib/dev/acpica/nsdump.c index 6e237f4952cb..1ce771059c30 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: 99 $ + * $Revision: 100 $ * *****************************************************************************/ @@ -335,8 +335,8 @@ AcpiNsDumpOneObject ( /* Name is a Method and its AML offset/length are set */ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " M:%p-%X\n", - ((ACPI_OPERAND_OBJECT *) ThisNode->Object)->Method.Pcode, - ((ACPI_OPERAND_OBJECT *) ThisNode->Object)->Method.PcodeLength)); + ((ACPI_OPERAND_OBJECT *) ThisNode->Object)->Method.AmlStart, + ((ACPI_OPERAND_OBJECT *) ThisNode->Object)->Method.AmlLength)); break; @@ -462,7 +462,7 @@ AcpiNsDumpOneObject ( break; case ACPI_TYPE_METHOD: - Value = (UINT8 *) ObjDesc->Method.Pcode; + Value = (UINT8 *) ObjDesc->Method.AmlStart; break; case INTERNAL_TYPE_REGION_FIELD: diff --git a/sys/contrib/dev/acpica/nseval.c b/sys/contrib/dev/acpica/nseval.c index 72ef9dcea042..263ef971e52a 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: 97 $ + * $Revision: 99 $ * ******************************************************************************/ @@ -488,17 +488,18 @@ AcpiNsExecuteControlMethod ( ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No attached method object\n")); AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - return_ACPI_STATUS (AE_ERROR); + return_ACPI_STATUS (AE_NULL_OBJECT); } ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Control method at Offset %x Length %lx]\n", - ObjDesc->Method.Pcode + 1, ObjDesc->Method.PcodeLength - 1)); + ObjDesc->Method.AmlStart + 1, ObjDesc->Method.AmlLength - 1)); DUMP_PATHNAME (MethodNode, "NsExecuteControlMethod: Executing", ACPI_LV_NAMES, _COMPONENT); - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "At offset %8XH\n", ObjDesc->Method.Pcode + 1)); + ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "At offset %8XH\n", + ObjDesc->Method.AmlStart + 1)); /* diff --git a/sys/contrib/dev/acpica/nsload.c b/sys/contrib/dev/acpica/nsload.c index 88f0fb6f6b0d..cef3b6434c2d 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: 43 $ + * $Revision: 47 $ * *****************************************************************************/ @@ -203,36 +203,14 @@ AcpiNsOneCompleteParse ( UINT32 PassNumber, ACPI_TABLE_DESC *TableDesc) { - ACPI_PARSE_DOWNWARDS DescendingCallback; - ACPI_PARSE_UPWARDS AscendingCallback; ACPI_PARSE_OBJECT *ParseRoot; ACPI_STATUS Status; + ACPI_WALK_STATE *WalkState; FUNCTION_TRACE ("NsOneCompleteParse"); - switch (PassNumber) - { - case 1: - DescendingCallback = AcpiDsLoad1BeginOp; - AscendingCallback = AcpiDsLoad1EndOp; - break; - - case 2: - DescendingCallback = AcpiDsLoad2BeginOp; - AscendingCallback = AcpiDsLoad2EndOp; - break; - - case 3: - DescendingCallback = AcpiDsExecBeginOp; - AscendingCallback = AcpiDsExecEndOp; - break; - - default: - return (AE_BAD_PARAMETER); - } - /* Create and init a Root Node */ ParseRoot = AcpiPsAllocOp (AML_SCOPE_OP); @@ -244,15 +222,28 @@ AcpiNsOneCompleteParse ( ((ACPI_PARSE2_OBJECT *) ParseRoot)->Name = ACPI_ROOT_NAME; - /* Pass 1: Parse everything except control method bodies */ + /* Create and initialize a new walk state */ + + WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, + NULL, NULL, NULL); + if (!WalkState) + { + AcpiPsFreeOp (ParseRoot); + return_ACPI_STATUS (AE_NO_MEMORY); + } + + Status = AcpiDsInitAmlWalk (WalkState, ParseRoot, NULL, TableDesc->AmlStart, + TableDesc->AmlLength, NULL, NULL, PassNumber); + if (ACPI_FAILURE (Status)) + { + AcpiDsDeleteWalkState (WalkState); + return_ACPI_STATUS (Status); + } + + /* Parse the AML */ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %d parse\n", PassNumber)); - - Status = AcpiPsParseAml (ParseRoot, TableDesc->AmlPointer, - TableDesc->AmlLength, - ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE, - NULL, NULL, NULL, DescendingCallback, - AscendingCallback); + Status = AcpiPsParseAml (WalkState); AcpiPsDeleteParseTree (ParseRoot); return_ACPI_STATUS (Status); @@ -323,8 +314,8 @@ AcpiNsParseTable ( * * FUNCTION: AcpiNsLoadTable * - * PARAMETERS: *PcodeAddr - Address of pcode block - * PcodeLength - Length of pcode block + * PARAMETERS: TableDesc - Descriptor for table to be loaded + * Node - Owning NS node * * RETURN: Status * @@ -343,13 +334,13 @@ AcpiNsLoadTable ( FUNCTION_TRACE ("NsLoadTable"); - if (!TableDesc->AmlPointer) + if (!TableDesc->AmlStart) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null AML pointer\n")); return_ACPI_STATUS (AE_BAD_PARAMETER); } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AML block at %p\n", TableDesc->AmlPointer)); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AML block at %p\n", TableDesc->AmlStart)); if (!TableDesc->AmlLength) diff --git a/sys/contrib/dev/acpica/nsobject.c b/sys/contrib/dev/acpica/nsobject.c index ca27e8b6e48d..38de511b14bb 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: 63 $ + * $Revision: 65 $ * ******************************************************************************/ @@ -223,7 +223,7 @@ AcpiNsAttachObject ( } /* - * If the object is an Node with an attached object, + * If the source object is a namespace Node with an attached object, * we will use that (attached) object */ else if (VALID_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_NAMED) && @@ -296,7 +296,7 @@ AcpiNsAttachObject ( break; } - /* Otherwise, fall through and set the type to Integer */ + /* case AML_REVISION_OP: fall through and set the type to Integer */ case AML_ZERO_OP: case AML_ONES_OP: diff --git a/sys/contrib/dev/acpica/nsxfname.c b/sys/contrib/dev/acpica/nsxfname.c index 2a80ca2b98cf..0c0f1ef9ec3e 100644 --- a/sys/contrib/dev/acpica/nsxfname.c +++ b/sys/contrib/dev/acpica/nsxfname.c @@ -2,7 +2,7 @@ * * Module Name: nsxfname - Public interfaces to the ACPI subsystem * ACPI Namespace oriented interfaces - * $Revision: 80 $ + * $Revision: 81 $ * *****************************************************************************/ @@ -162,14 +162,6 @@ AcpiGetHandle ( FUNCTION_ENTRY (); - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - /* Parameter Validation */ if (!RetHandle || !Pathname) @@ -242,14 +234,6 @@ AcpiGetName ( ACPI_NAMESPACE_NODE *Node; - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - /* Buffer pointer must be valid always */ if (!RetPathPtr || (NameType > ACPI_NAME_TYPE_MAX)) @@ -338,14 +322,6 @@ AcpiGetObjectInfo ( ACPI_NAMESPACE_NODE *Node; - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - /* Parameter validation */ if (!Handle || !Info) diff --git a/sys/contrib/dev/acpica/nsxfobj.c b/sys/contrib/dev/acpica/nsxfobj.c index 8885ed2e3cef..efb18d772673 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: 89 $ + * $Revision: 93 $ * ******************************************************************************/ @@ -134,12 +134,10 @@ * * PARAMETERS: Handle - Object handle (optional) * *Pathname - Object pathname (optional) - * **Params - List of parameters to pass to - * method, terminated by NULL. - * Params itself may be NULL - * if no parameters are being - * passed. - * *ReturnObject - Where to put method's return value (if + * **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 * any). If NULL, no value is returned. * * RETURN: Status @@ -154,83 +152,54 @@ ACPI_STATUS AcpiEvaluateObject ( ACPI_HANDLE Handle, ACPI_STRING Pathname, - ACPI_OBJECT_LIST *ParamObjects, + ACPI_OBJECT_LIST *ExternalParams, ACPI_BUFFER *ReturnBuffer) { ACPI_STATUS Status; - ACPI_OPERAND_OBJECT **ParamPtr = NULL; - ACPI_OPERAND_OBJECT *ReturnObj = NULL; - ACPI_OPERAND_OBJECT *ObjectPtr = NULL; + ACPI_OPERAND_OBJECT **InternalParams = NULL; + ACPI_OPERAND_OBJECT *InternalReturnObj = NULL; UINT32 BufferSpaceNeeded; UINT32 UserBufferLength; - UINT32 Count; UINT32 i; - UINT32 ParamLength; - UINT32 ObjectLength; FUNCTION_TRACE ("AcpiEvaluateObject"); - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* * If there are parameters to be passed to the object * (which must be a control method), the external objects * must be converted to internal objects */ - if (ParamObjects && ParamObjects->Count) + if (ExternalParams && ExternalParams->Count) { /* * Allocate a new parameter block for the internal objects * Add 1 to count to allow for null terminated internal list */ - Count = ParamObjects->Count; - ParamLength = (Count + 1) * sizeof (void *); - ObjectLength = Count * sizeof (ACPI_OPERAND_OBJECT); - - ParamPtr = ACPI_MEM_CALLOCATE (ParamLength + /* Parameter List part */ - ObjectLength); /* Actual objects */ - if (!ParamPtr) + InternalParams = ACPI_MEM_CALLOCATE ((ExternalParams->Count + 1) * sizeof (void *)); + if (!InternalParams) { return_ACPI_STATUS (AE_NO_MEMORY); } - ObjectPtr = (ACPI_OPERAND_OBJECT *) ((UINT8 *) ParamPtr + - ParamLength); - - /* - * Init the param array of pointers and NULL terminate - * the list - */ - for (i = 0; i < Count; i++) - { - ParamPtr[i] = &ObjectPtr[i]; - AcpiUtInitStaticObject (&ObjectPtr[i]); - } - ParamPtr[Count] = NULL; /* * Convert each external object in the list to an * internal object */ - for (i = 0; i < Count; i++) + for (i = 0; i < ExternalParams->Count; i++) { - Status = AcpiUtCopyEobjectToIobject (&ParamObjects->Pointer[i], - ParamPtr[i]); + Status = AcpiUtCopyEobjectToIobject (&ExternalParams->Pointer[i], + &InternalParams[i]); if (ACPI_FAILURE (Status)) { - AcpiUtDeleteInternalObjectList (ParamPtr); + AcpiUtDeleteInternalObjectList (InternalParams); return_ACPI_STATUS (Status); } } + InternalParams[ExternalParams->Count] = NULL; } @@ -246,7 +215,7 @@ AcpiEvaluateObject ( /* * The path is fully qualified, just evaluate by name */ - Status = AcpiNsEvaluateByName (Pathname, ParamPtr, &ReturnObj); + Status = AcpiNsEvaluateByName (Pathname, InternalParams, &InternalReturnObj); } else if (!Handle) @@ -282,7 +251,7 @@ AcpiEvaluateObject ( * The null pathname case means the handle is for * the actual object to be evaluated */ - Status = AcpiNsEvaluateByHandle (Handle, ParamPtr, &ReturnObj); + Status = AcpiNsEvaluateByHandle (Handle, InternalParams, &InternalReturnObj); } else @@ -290,8 +259,8 @@ AcpiEvaluateObject ( /* * Both a Handle and a relative Pathname */ - Status = AcpiNsEvaluateRelative (Handle, Pathname, ParamPtr, - &ReturnObj); + Status = AcpiNsEvaluateRelative (Handle, Pathname, InternalParams, + &InternalReturnObj); } } @@ -306,9 +275,9 @@ AcpiEvaluateObject ( UserBufferLength = ReturnBuffer->Length; ReturnBuffer->Length = 0; - if (ReturnObj) + if (InternalReturnObj) { - if (VALID_DESCRIPTOR_TYPE (ReturnObj, ACPI_DESC_TYPE_NAMED)) + if (VALID_DESCRIPTOR_TYPE (InternalReturnObj, ACPI_DESC_TYPE_NAMED)) { /* * If we got an Node as a return object, @@ -322,7 +291,7 @@ AcpiEvaluateObject ( * types at a later date if necessary. */ Status = AE_TYPE; - ReturnObj = NULL; /* No need to delete an Node */ + InternalReturnObj = NULL; /* No need to delete an Node */ } if (ACPI_SUCCESS (Status)) @@ -331,7 +300,7 @@ AcpiEvaluateObject ( * Find out how large a buffer is needed * to contain the returned object */ - Status = AcpiUtGetObjectSize (ReturnObj, + Status = AcpiUtGetObjectSize (InternalReturnObj, &BufferSpaceNeeded); if (ACPI_SUCCESS (Status)) { @@ -359,7 +328,7 @@ AcpiEvaluateObject ( /* * We have enough space for the object, build it */ - Status = AcpiUtCopyIobjectToEobject (ReturnObj, + Status = AcpiUtCopyIobjectToEobject (InternalReturnObj, ReturnBuffer); ReturnBuffer->Length = BufferSpaceNeeded; } @@ -371,23 +340,23 @@ AcpiEvaluateObject ( /* Delete the return and parameter objects */ - if (ReturnObj) + if (InternalReturnObj) { /* * Delete the internal return object. (Or at least * decrement the reference count by one) */ - AcpiUtRemoveReference (ReturnObj); + AcpiUtRemoveReference (InternalReturnObj); } /* * Free the input parameter list (if we created one), */ - if (ParamPtr) + if (InternalParams) { /* Free the allocated parameter block */ - AcpiUtDeleteInternalObjectList (ParamPtr); + AcpiUtDeleteInternalObjectList (InternalParams); } return_ACPI_STATUS (Status); @@ -425,14 +394,6 @@ AcpiGetNextObject ( ACPI_NAMESPACE_NODE *ChildNode = NULL; - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - /* Parameter validation */ if (Type > ACPI_TYPE_MAX) @@ -513,17 +474,8 @@ AcpiGetType ( ACPI_OBJECT_TYPE *RetType) { ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - /* Parameter Validation */ if (!RetType) @@ -583,14 +535,6 @@ AcpiGetParent ( ACPI_STATUS Status = AE_OK; - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - if (!RetHandle) { return (AE_BAD_PARAMETER); @@ -681,14 +625,6 @@ AcpiWalkNamespace ( FUNCTION_TRACE ("AcpiWalkNamespace"); - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* Parameter validation */ if ((Type > ACPI_TYPE_MAX) || @@ -705,11 +641,9 @@ 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, - ReturnValue); + Status = AcpiNsWalkNamespace ((ACPI_OBJECT_TYPE8) Type, StartObject, + MaxDepth, NS_WALK_UNLOCK, UserFunction, Context, + ReturnValue); AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); @@ -837,14 +771,6 @@ AcpiGetDevices ( FUNCTION_TRACE ("AcpiGetDevices"); - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* Parameter validation */ if (!UserFunction) diff --git a/sys/contrib/dev/acpica/psfind.c b/sys/contrib/dev/acpica/psfind.c index ce4baef713f6..6a135fc08bbe 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: 28 $ + * $Revision: 29 $ * *****************************************************************************/ @@ -197,11 +197,10 @@ AcpiPsFindName ( /* search scope level for matching name segment */ Op = AcpiPsGetChild (Scope); - OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode); while (Op) { - + OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode); if (OpInfo->Flags & AML_FIELD) { /* Field, search named fields */ diff --git a/sys/contrib/dev/acpica/psopcode.c b/sys/contrib/dev/acpica/psopcode.c index adc455d98a4e..4177f121088f 100644 --- a/sys/contrib/dev/acpica/psopcode.c +++ b/sys/contrib/dev/acpica/psopcode.c @@ -1,7 +1,7 @@ /****************************************************************************** * - * Module Name: psopcode - Parser opcode information table - * $Revision: 40 $ + * Module Name: psopcode - Parser/Interpreter opcode information table + * $Revision: 43 $ * *****************************************************************************/ @@ -158,20 +158,69 @@ * into a 32-bit number and stored in the master opcode table at the end of this file. */ -#define ARGP_ZERO_OP ARG_NONE -#define ARGP_ONE_OP ARG_NONE + +#define ARGP_ACCESSFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING) +#define ARGP_ACQUIRE_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_WORDDATA) +#define ARGP_ADD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) #define ARGP_ALIAS_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_NAME) -#define ARGP_NAME_OP ARGP_LIST2 (ARGP_NAME, ARGP_DATAOBJ) -#define ARGP_BYTE_OP ARGP_LIST1 (ARGP_BYTEDATA) -#define ARGP_WORD_OP ARGP_LIST1 (ARGP_WORDDATA) -#define ARGP_DWORD_OP ARGP_LIST1 (ARGP_DWORDDATA) -#define ARGP_STRING_OP ARGP_LIST1 (ARGP_CHARLIST) -#define ARGP_QWORD_OP ARGP_LIST1 (ARGP_QWORDDATA) -#define ARGP_SCOPE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_TERMLIST) +#define ARGP_ARG0 ARG_NONE +#define ARGP_ARG1 ARG_NONE +#define ARGP_ARG2 ARG_NONE +#define ARGP_ARG3 ARG_NONE +#define ARGP_ARG4 ARG_NONE +#define ARGP_ARG5 ARG_NONE +#define ARGP_ARG6 ARG_NONE +#define ARGP_BANK_FIELD_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_TERMARG, ARGP_BYTEDATA, ARGP_FIELDLIST) +#define ARGP_BIT_AND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) +#define ARGP_BIT_NAND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) +#define ARGP_BIT_NOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) +#define ARGP_BIT_NOT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) +#define ARGP_BIT_OR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) +#define ARGP_BIT_XOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) +#define ARGP_BREAK_OP ARG_NONE +#define ARGP_BREAK_POINT_OP ARG_NONE #define ARGP_BUFFER_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_BYTELIST) -#define ARGP_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_BYTEDATA, ARGP_DATAOBJLIST) -#define ARGP_VAR_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_BYTEDATA, ARGP_DATAOBJLIST) -#define ARGP_METHOD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMLIST) +#define ARGP_BYTE_OP ARGP_LIST1 (ARGP_BYTEDATA) +#define ARGP_BYTELIST_OP ARGP_LIST1 (ARGP_NAMESTRING) +#define ARGP_CONCAT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) +#define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) +#define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME) +#define ARGP_CONTINUE_OP ARG_NONE +#define ARGP_COPY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SIMPLENAME) +#define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) +#define ARGP_CREATE_BYTE_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) +#define ARGP_CREATE_DWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) +#define ARGP_CREATE_FIELD_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) +#define ARGP_CREATE_QWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) +#define ARGP_CREATE_WORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) +#define ARGP_DATA_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG) +#define ARGP_DEBUG_OP ARG_NONE +#define ARGP_DECREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME) +#define ARGP_DEREF_OF_OP ARGP_LIST1 (ARGP_TERMARG) +#define ARGP_DEVICE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST) +#define ARGP_DIVIDE_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET, ARGP_TARGET) +#define ARGP_DWORD_OP ARGP_LIST1 (ARGP_DWORDDATA) +#define ARGP_ELSE_OP ARGP_LIST2 (ARGP_PKGLENGTH, ARGP_TERMLIST) +#define ARGP_EVENT_OP ARGP_LIST1 (ARGP_NAME) +#define ARGP_FATAL_OP ARGP_LIST3 (ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_TERMARG) +#define ARGP_FIELD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_BYTEDATA, ARGP_FIELDLIST) +#define ARGP_FIND_SET_LEFT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) +#define ARGP_FIND_SET_RIGHT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) +#define ARGP_FROM_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) +#define ARGP_IF_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST) +#define ARGP_INCREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME) +#define ARGP_INDEX_FIELD_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_BYTEDATA, ARGP_FIELDLIST) +#define ARGP_INDEX_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) +#define ARGP_LAND_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) +#define ARGP_LEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) +#define ARGP_LGREATER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) +#define ARGP_LGREATEREQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) +#define ARGP_LLESS_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) +#define ARGP_LLESSEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) +#define ARGP_LNOT_OP ARGP_LIST1 (ARGP_TERMARG) +#define ARGP_LNOTEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) +#define ARGP_LOAD_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_SUPERNAME) +#define ARGP_LOAD_TABLE_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG) #define ARGP_LOCAL0 ARG_NONE #define ARGP_LOCAL1 ARG_NONE #define ARGP_LOCAL2 ARG_NONE @@ -180,105 +229,57 @@ #define ARGP_LOCAL5 ARG_NONE #define ARGP_LOCAL6 ARG_NONE #define ARGP_LOCAL7 ARG_NONE -#define ARGP_ARG0 ARG_NONE -#define ARGP_ARG1 ARG_NONE -#define ARGP_ARG2 ARG_NONE -#define ARGP_ARG3 ARG_NONE -#define ARGP_ARG4 ARG_NONE -#define ARGP_ARG5 ARG_NONE -#define ARGP_ARG6 ARG_NONE -#define ARGP_STORE_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SUPERNAME) -#define ARGP_REF_OF_OP ARGP_LIST1 (ARGP_SUPERNAME) -#define ARGP_ADD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_CONCAT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_SUBTRACT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_INCREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME) -#define ARGP_DECREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME) +#define ARGP_LOR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) +#define ARGP_MATCH_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG) +#define ARGP_METHOD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMLIST) +#define ARGP_METHODCALL_OP ARGP_LIST1 (ARGP_NAMESTRING) +#define ARGP_MID_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) +#define ARGP_MOD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) #define ARGP_MULTIPLY_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_DIVIDE_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET, ARGP_TARGET) +#define ARGP_MUTEX_OP ARGP_LIST2 (ARGP_NAME, ARGP_BYTEDATA) +#define ARGP_NAME_OP ARGP_LIST2 (ARGP_NAME, ARGP_DATAOBJ) +#define ARGP_NAMEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING) +#define ARGP_NAMEPATH_OP ARGP_LIST1 (ARGP_NAMESTRING) +#define ARGP_NOOP_OP ARG_NONE +#define ARGP_NOTIFY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG) +#define ARGP_ONE_OP ARG_NONE +#define ARGP_ONES_OP ARG_NONE +#define ARGP_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_BYTEDATA, ARGP_DATAOBJLIST) +#define ARGP_POWER_RES_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_WORDDATA, ARGP_OBJLIST) +#define ARGP_PROCESSOR_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_BYTEDATA, ARGP_OBJLIST) +#define ARGP_QWORD_OP ARGP_LIST1 (ARGP_QWORDDATA) +#define ARGP_REF_OF_OP ARGP_LIST1 (ARGP_SUPERNAME) +#define ARGP_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG) +#define ARGP_RELEASE_OP ARGP_LIST1 (ARGP_SUPERNAME) +#define ARGP_RESERVEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING) +#define ARGP_RESET_OP ARGP_LIST1 (ARGP_SUPERNAME) +#define ARGP_RETURN_OP ARGP_LIST1 (ARGP_TERMARG) +#define ARGP_REVISION_OP ARG_NONE +#define ARGP_SCOPE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_TERMLIST) #define ARGP_SHIFT_LEFT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) #define ARGP_SHIFT_RIGHT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_BIT_AND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_BIT_NAND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_BIT_OR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_BIT_NOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_BIT_XOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_BIT_NOT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) -#define ARGP_FIND_SET_LEFT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) -#define ARGP_FIND_SET_RIGHT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) -#define ARGP_DEREF_OF_OP ARGP_LIST1 (ARGP_TERMARG) -#define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_MOD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_NOTIFY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG) +#define ARGP_SIGNAL_OP ARGP_LIST1 (ARGP_SUPERNAME) #define ARGP_SIZE_OF_OP ARGP_LIST1 (ARGP_SUPERNAME) -#define ARGP_INDEX_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_MATCH_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG) -#define ARGP_CREATE_DWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) -#define ARGP_CREATE_WORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) -#define ARGP_CREATE_BYTE_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) -#define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) -#define ARGP_TYPE_OP ARGP_LIST1 (ARGP_SUPERNAME) -#define ARGP_CREATE_QWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) -#define ARGP_LAND_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) -#define ARGP_LOR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) -#define ARGP_LNOT_OP ARGP_LIST1 (ARGP_TERMARG) -#define ARGP_LEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) -#define ARGP_LGREATER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) -#define ARGP_LLESS_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) +#define ARGP_SLEEP_OP ARGP_LIST1 (ARGP_TERMARG) +#define ARGP_STALL_OP ARGP_LIST1 (ARGP_TERMARG) +#define ARGP_STATICSTRING_OP ARGP_LIST1 (ARGP_NAMESTRING) +#define ARGP_STORE_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SUPERNAME) +#define ARGP_STRING_OP ARGP_LIST1 (ARGP_CHARLIST) +#define ARGP_SUBTRACT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) +#define ARGP_THERMAL_ZONE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST) +#define ARGP_TO_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) #define ARGP_TO_BUFFER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) #define ARGP_TO_DEC_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) #define ARGP_TO_HEX_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) #define ARGP_TO_INTEGER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) #define ARGP_TO_STRING_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_COPY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SIMPLENAME) -#define ARGP_MID_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_CONTINUE_OP ARG_NONE -#define ARGP_IF_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST) -#define ARGP_ELSE_OP ARGP_LIST2 (ARGP_PKGLENGTH, ARGP_TERMLIST) -#define ARGP_WHILE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST) -#define ARGP_NOOP_OP ARG_NONE -#define ARGP_RETURN_OP ARGP_LIST1 (ARGP_TERMARG) -#define ARGP_BREAK_OP ARG_NONE -#define ARGP_BREAK_POINT_OP ARG_NONE -#define ARGP_ONES_OP ARG_NONE -#define ARGP_MUTEX_OP ARGP_LIST2 (ARGP_NAME, ARGP_BYTEDATA) -#define ARGP_EVENT_OP ARGP_LIST1 (ARGP_NAME) -#define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME) -#define ARGP_CREATE_FIELD_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) -#define ARGP_LOAD_TABLE_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG) -#define ARGP_LOAD_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_SUPERNAME) -#define ARGP_STALL_OP ARGP_LIST1 (ARGP_TERMARG) -#define ARGP_SLEEP_OP ARGP_LIST1 (ARGP_TERMARG) -#define ARGP_ACQUIRE_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_WORDDATA) -#define ARGP_SIGNAL_OP ARGP_LIST1 (ARGP_SUPERNAME) -#define ARGP_WAIT_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG) -#define ARGP_RESET_OP ARGP_LIST1 (ARGP_SUPERNAME) -#define ARGP_RELEASE_OP ARGP_LIST1 (ARGP_SUPERNAME) -#define ARGP_FROM_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) -#define ARGP_TO_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) +#define ARGP_TYPE_OP ARGP_LIST1 (ARGP_SUPERNAME) #define ARGP_UNLOAD_OP ARGP_LIST1 (ARGP_SUPERNAME) -#define ARGP_REVISION_OP ARG_NONE -#define ARGP_DEBUG_OP ARG_NONE -#define ARGP_FATAL_OP ARGP_LIST3 (ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_TERMARG) -#define ARGP_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG) -#define ARGP_FIELD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_BYTEDATA, ARGP_FIELDLIST) -#define ARGP_DEVICE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST) -#define ARGP_PROCESSOR_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_BYTEDATA, ARGP_OBJLIST) -#define ARGP_POWER_RES_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_WORDDATA, ARGP_OBJLIST) -#define ARGP_THERMAL_ZONE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST) -#define ARGP_INDEX_FIELD_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_BYTEDATA, ARGP_FIELDLIST) -#define ARGP_BANK_FIELD_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_TERMARG, ARGP_BYTEDATA, ARGP_FIELDLIST) -#define ARGP_DATA_REGION_OP ARGP_LIST4 (ARGP_NAMESTRING, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG) -#define ARGP_LNOTEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) -#define ARGP_LLESSEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) -#define ARGP_LGREATEREQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) -#define ARGP_NAMEPATH_OP ARGP_LIST1 (ARGP_NAMESTRING) -#define ARGP_METHODCALL_OP ARGP_LIST1 (ARGP_NAMESTRING) -#define ARGP_BYTELIST_OP ARGP_LIST1 (ARGP_NAMESTRING) -#define ARGP_RESERVEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING) -#define ARGP_NAMEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING) -#define ARGP_ACCESSFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING) -#define ARGP_STATICSTRING_OP ARGP_LIST1 (ARGP_NAMESTRING) +#define ARGP_VAR_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_BYTEDATA, 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) +#define ARGP_ZERO_OP ARG_NONE /* @@ -288,20 +289,69 @@ * (Used by PrepOperands procedure and the ASL Compiler) */ -#define ARGI_ZERO_OP ARG_NONE -#define ARGI_ONE_OP ARG_NONE + +#define ARGI_ACCESSFIELD_OP ARGI_INVALID_OPCODE +#define ARGI_ACQUIRE_OP ARGI_LIST2 (ARGI_MUTEX, ARGI_INTEGER) +#define ARGI_ADD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) #define ARGI_ALIAS_OP ARGI_INVALID_OPCODE -#define ARGI_NAME_OP ARGI_INVALID_OPCODE -#define ARGI_BYTE_OP ARGI_INVALID_OPCODE -#define ARGI_WORD_OP ARGI_INVALID_OPCODE -#define ARGI_DWORD_OP ARGI_INVALID_OPCODE -#define ARGI_STRING_OP ARGI_INVALID_OPCODE -#define ARGI_QWORD_OP ARGI_INVALID_OPCODE -#define ARGI_SCOPE_OP ARGI_INVALID_OPCODE +#define ARGI_ARG0 ARG_NONE +#define ARGI_ARG1 ARG_NONE +#define ARGI_ARG2 ARG_NONE +#define ARGI_ARG3 ARG_NONE +#define ARGI_ARG4 ARG_NONE +#define ARGI_ARG5 ARG_NONE +#define ARGI_ARG6 ARG_NONE +#define ARGI_BANK_FIELD_OP ARGI_INVALID_OPCODE +#define ARGI_BIT_AND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) +#define ARGI_BIT_NAND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) +#define ARGI_BIT_NOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) +#define ARGI_BIT_NOT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) +#define ARGI_BIT_OR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) +#define ARGI_BIT_XOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) +#define ARGI_BREAK_OP ARG_NONE +#define ARGI_BREAK_POINT_OP ARG_NONE #define ARGI_BUFFER_OP ARGI_INVALID_OPCODE -#define ARGI_PACKAGE_OP ARGI_INVALID_OPCODE -#define ARGI_VAR_PACKAGE_OP ARGI_INVALID_OPCODE -#define ARGI_METHOD_OP ARGI_INVALID_OPCODE +#define ARGI_BYTE_OP ARGI_INVALID_OPCODE +#define ARGI_BYTELIST_OP ARGI_INVALID_OPCODE +#define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA, ARGI_TARGETREF) +#define ARGI_CONCAT_RES_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_BUFFER, ARGI_TARGETREF) +#define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF) +#define ARGI_CONTINUE_OP ARGI_INVALID_OPCODE +#define ARGI_COPY_OP ARGI_LIST2 (ARGI_ANYTYPE, ARGI_SIMPLE_TARGET) +#define ARGI_CREATE_BIT_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) +#define ARGI_CREATE_BYTE_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) +#define ARGI_CREATE_DWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) +#define ARGI_CREATE_FIELD_OP ARGI_LIST4 (ARGI_BUFFER, ARGI_INTEGER, ARGI_INTEGER, ARGI_REFERENCE) +#define ARGI_CREATE_QWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) +#define ARGI_CREATE_WORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) +#define ARGI_DATA_REGION_OP ARGI_LIST3 (ARGI_STRING, ARGI_STRING, ARGI_STRING) +#define ARGI_DEBUG_OP ARG_NONE +#define ARGI_DECREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF) +#define ARGI_DEREF_OF_OP ARGI_LIST1 (ARGI_REFERENCE) +#define ARGI_DEVICE_OP ARGI_INVALID_OPCODE +#define ARGI_DIVIDE_OP ARGI_LIST4 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF, ARGI_TARGETREF) +#define ARGI_DWORD_OP ARGI_INVALID_OPCODE +#define ARGI_ELSE_OP ARGI_INVALID_OPCODE +#define ARGI_EVENT_OP ARGI_INVALID_OPCODE +#define ARGI_FATAL_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER) +#define ARGI_FIELD_OP ARGI_INVALID_OPCODE +#define ARGI_FIND_SET_LEFT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) +#define ARGI_FIND_SET_RIGHT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) +#define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) +#define ARGI_IF_OP ARGI_INVALID_OPCODE +#define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF) +#define ARGI_INDEX_FIELD_OP ARGI_INVALID_OPCODE +#define ARGI_INDEX_OP ARGI_LIST3 (ARGI_COMPLEXOBJ, ARGI_INTEGER, ARGI_TARGETREF) +#define ARGI_LAND_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) +#define ARGI_LEQUAL_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) +#define ARGI_LGREATER_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) +#define ARGI_LGREATEREQUAL_OP ARGI_INVALID_OPCODE +#define ARGI_LLESS_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) +#define ARGI_LLESSEQUAL_OP ARGI_INVALID_OPCODE +#define ARGI_LNOT_OP ARGI_LIST1 (ARGI_INTEGER) +#define ARGI_LNOTEQUAL_OP ARGI_INVALID_OPCODE +#define ARGI_LOAD_OP ARGI_LIST2 (ARGI_REGION, ARGI_TARGETREF) +#define ARGI_LOAD_TABLE_OP ARGI_LIST6 (ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_TARGETREF) #define ARGI_LOCAL0 ARG_NONE #define ARGI_LOCAL1 ARG_NONE #define ARGI_LOCAL2 ARG_NONE @@ -310,105 +360,57 @@ #define ARGI_LOCAL5 ARG_NONE #define ARGI_LOCAL6 ARG_NONE #define ARGI_LOCAL7 ARG_NONE -#define ARGI_ARG0 ARG_NONE -#define ARGI_ARG1 ARG_NONE -#define ARGI_ARG2 ARG_NONE -#define ARGI_ARG3 ARG_NONE -#define ARGI_ARG4 ARG_NONE -#define ARGI_ARG5 ARG_NONE -#define ARGI_ARG6 ARG_NONE -#define ARGI_STORE_OP ARGI_LIST2 (ARGI_ANYTYPE, ARGI_TARGETREF) -#define ARGI_REF_OF_OP ARGI_LIST1 (ARGI_OBJECT_REF) -#define ARGI_ADD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA, ARGI_TARGETREF) -#define ARGI_SUBTRACT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF) -#define ARGI_DECREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF) +#define ARGI_LOR_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) +#define ARGI_MATCH_OP ARGI_LIST6 (ARGI_PACKAGE, ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER) +#define ARGI_METHOD_OP ARGI_INVALID_OPCODE +#define ARGI_METHODCALL_OP ARGI_INVALID_OPCODE +#define ARGI_MID_OP ARGI_LIST4 (ARGI_BUFFERSTRING,ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) +#define ARGI_MOD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) #define ARGI_MULTIPLY_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_DIVIDE_OP ARGI_LIST4 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF, ARGI_TARGETREF) +#define ARGI_MUTEX_OP ARGI_INVALID_OPCODE +#define ARGI_NAME_OP ARGI_INVALID_OPCODE +#define ARGI_NAMEDFIELD_OP ARGI_INVALID_OPCODE +#define ARGI_NAMEPATH_OP ARGI_INVALID_OPCODE +#define ARGI_NOOP_OP ARG_NONE +#define ARGI_NOTIFY_OP ARGI_LIST2 (ARGI_DEVICE_REF, ARGI_INTEGER) +#define ARGI_ONE_OP ARG_NONE +#define ARGI_ONES_OP ARG_NONE +#define ARGI_PACKAGE_OP ARGI_INVALID_OPCODE +#define ARGI_POWER_RES_OP ARGI_INVALID_OPCODE +#define ARGI_PROCESSOR_OP ARGI_INVALID_OPCODE +#define ARGI_QWORD_OP ARGI_INVALID_OPCODE +#define ARGI_REF_OF_OP ARGI_LIST1 (ARGI_OBJECT_REF) +#define ARGI_REGION_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) +#define ARGI_RELEASE_OP ARGI_LIST1 (ARGI_MUTEX) +#define ARGI_RESERVEDFIELD_OP ARGI_INVALID_OPCODE +#define ARGI_RESET_OP ARGI_LIST1 (ARGI_EVENT) +#define ARGI_RETURN_OP ARGI_INVALID_OPCODE +#define ARGI_REVISION_OP ARG_NONE +#define ARGI_SCOPE_OP ARGI_INVALID_OPCODE #define ARGI_SHIFT_LEFT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) #define ARGI_SHIFT_RIGHT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_BIT_AND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_BIT_NAND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_BIT_OR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_BIT_NOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_BIT_XOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_BIT_NOT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_FIND_SET_LEFT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_FIND_SET_RIGHT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_DEREF_OF_OP ARGI_LIST1 (ARGI_REFERENCE) -#define ARGI_CONCAT_RES_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_BUFFER, ARGI_TARGETREF) -#define ARGI_MOD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_NOTIFY_OP ARGI_LIST2 (ARGI_DEVICE_REF, ARGI_INTEGER) +#define ARGI_SIGNAL_OP ARGI_LIST1 (ARGI_EVENT) #define ARGI_SIZE_OF_OP ARGI_LIST1 (ARGI_DATAOBJECT) -#define ARGI_INDEX_OP ARGI_LIST3 (ARGI_COMPLEXOBJ, ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_MATCH_OP ARGI_LIST6 (ARGI_PACKAGE, ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER) -#define ARGI_CREATE_DWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) -#define ARGI_CREATE_WORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) -#define ARGI_CREATE_BYTE_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) -#define ARGI_CREATE_BIT_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) -#define ARGI_TYPE_OP ARGI_LIST1 (ARGI_ANYTYPE) -#define ARGI_CREATE_QWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) -#define ARGI_LAND_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) -#define ARGI_LOR_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) -#define ARGI_LNOT_OP ARGI_LIST1 (ARGI_INTEGER) -#define ARGI_LEQUAL_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) -#define ARGI_LGREATER_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) -#define ARGI_LLESS_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) +#define ARGI_SLEEP_OP ARGI_LIST1 (ARGI_INTEGER) +#define ARGI_STALL_OP ARGI_LIST1 (ARGI_INTEGER) +#define ARGI_STATICSTRING_OP ARGI_INVALID_OPCODE +#define ARGI_STORE_OP ARGI_LIST2 (ARGI_ANYTYPE, ARGI_TARGETREF) +#define ARGI_STRING_OP ARGI_INVALID_OPCODE +#define ARGI_SUBTRACT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) +#define ARGI_THERMAL_ZONE_OP ARGI_INVALID_OPCODE +#define ARGI_TO_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET) #define ARGI_TO_BUFFER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) #define ARGI_TO_DEC_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) #define ARGI_TO_HEX_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) #define ARGI_TO_INTEGER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) #define ARGI_TO_STRING_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_FIXED_TARGET) -#define ARGI_COPY_OP ARGI_LIST2 (ARGI_ANYTYPE, ARGI_SIMPLE_TARGET) -#define ARGI_MID_OP ARGI_LIST4 (ARGI_BUFFERSTRING,ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_CONTINUE_OP ARGI_INVALID_OPCODE -#define ARGI_IF_OP ARGI_INVALID_OPCODE -#define ARGI_ELSE_OP ARGI_INVALID_OPCODE -#define ARGI_WHILE_OP ARGI_INVALID_OPCODE -#define ARGI_NOOP_OP ARG_NONE -#define ARGI_RETURN_OP ARGI_INVALID_OPCODE -#define ARGI_BREAK_OP ARG_NONE -#define ARGI_BREAK_POINT_OP ARG_NONE -#define ARGI_ONES_OP ARG_NONE -#define ARGI_MUTEX_OP ARGI_INVALID_OPCODE -#define ARGI_EVENT_OP ARGI_INVALID_OPCODE -#define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF) -#define ARGI_CREATE_FIELD_OP ARGI_LIST4 (ARGI_BUFFER, ARGI_INTEGER, ARGI_INTEGER, ARGI_REFERENCE) -#define ARGI_LOAD_TABLE_OP ARGI_LIST6 (ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_TARGETREF) -#define ARGI_LOAD_OP ARGI_LIST2 (ARGI_REGION, ARGI_TARGETREF) -#define ARGI_STALL_OP ARGI_LIST1 (ARGI_INTEGER) -#define ARGI_SLEEP_OP ARGI_LIST1 (ARGI_INTEGER) -#define ARGI_ACQUIRE_OP ARGI_LIST2 (ARGI_MUTEX, ARGI_INTEGER) -#define ARGI_SIGNAL_OP ARGI_LIST1 (ARGI_EVENT) -#define ARGI_WAIT_OP ARGI_LIST2 (ARGI_EVENT, ARGI_INTEGER) -#define ARGI_RESET_OP ARGI_LIST1 (ARGI_EVENT) -#define ARGI_RELEASE_OP ARGI_LIST1 (ARGI_MUTEX) -#define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) -#define ARGI_TO_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET) +#define ARGI_TYPE_OP ARGI_LIST1 (ARGI_ANYTYPE) #define ARGI_UNLOAD_OP ARGI_LIST1 (ARGI_DDBHANDLE) -#define ARGI_REVISION_OP ARG_NONE -#define ARGI_DEBUG_OP ARG_NONE -#define ARGI_FATAL_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER) -#define ARGI_REGION_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) -#define ARGI_FIELD_OP ARGI_INVALID_OPCODE -#define ARGI_DEVICE_OP ARGI_INVALID_OPCODE -#define ARGI_PROCESSOR_OP ARGI_INVALID_OPCODE -#define ARGI_POWER_RES_OP ARGI_INVALID_OPCODE -#define ARGI_THERMAL_ZONE_OP ARGI_INVALID_OPCODE -#define ARGI_INDEX_FIELD_OP ARGI_INVALID_OPCODE -#define ARGI_BANK_FIELD_OP ARGI_INVALID_OPCODE -#define ARGI_DATA_REGION_OP ARGI_LIST3 (ARGI_STRING, ARGI_STRING, ARGI_STRING) -#define ARGI_LNOTEQUAL_OP ARGI_INVALID_OPCODE -#define ARGI_LLESSEQUAL_OP ARGI_INVALID_OPCODE -#define ARGI_LGREATEREQUAL_OP ARGI_INVALID_OPCODE -#define ARGI_NAMEPATH_OP ARGI_INVALID_OPCODE -#define ARGI_METHODCALL_OP ARGI_INVALID_OPCODE -#define ARGI_BYTELIST_OP ARGI_INVALID_OPCODE -#define ARGI_RESERVEDFIELD_OP ARGI_INVALID_OPCODE -#define ARGI_NAMEDFIELD_OP ARGI_INVALID_OPCODE -#define ARGI_ACCESSFIELD_OP ARGI_INVALID_OPCODE -#define ARGI_STATICSTRING_OP ARGI_INVALID_OPCODE +#define ARGI_VAR_PACKAGE_OP ARGI_INVALID_OPCODE +#define ARGI_WAIT_OP ARGI_LIST2 (ARGI_EVENT, ARGI_INTEGER) +#define ARGI_WHILE_OP ARGI_INVALID_OPCODE +#define ARGI_WORD_OP ARGI_INVALID_OPCODE +#define ARGI_ZERO_OP ARG_NONE /* @@ -674,7 +676,7 @@ static const ACPI_OPCODE_INFO AmlOpInfo[] = /* 79 */ ACPI_OP ("Mid", ARGP_MID_OP, ARGI_MID_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS), /* 7A */ ACPI_OP ("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_NO_ARGS ), /* 7B */ ACPI_OP ("LoadTable", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS), -/* 7C */ ACPI_OP ("DataOpRegion", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS), +/* 7C */ ACPI_OP ("DataOpRegion", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP, ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS|AML_NSOBJECT|AML_NSOPCODE|AML_NSNODE|AML_NAMED), }; @@ -808,15 +810,6 @@ AcpiPsGetOpcodeInfo ( break; - case AML_LNOT_OP: - - /* This case is for the bogus opcodes LNOTEQUAL, LLESSEQUAL, LGREATEREQUAL */ - /* TBD: [Investigate] remove this case? */ - - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad multi-byte opcode=%X\n", Opcode)); - break; - - default: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown extended opcode=%X\n", Opcode)); diff --git a/sys/contrib/dev/acpica/psscope.c b/sys/contrib/dev/acpica/psscope.c index 6509f4a03bf8..35eed1f745a6 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: 29 $ + * $Revision: 30 $ * *****************************************************************************/ @@ -195,6 +195,7 @@ AcpiPsInitScope ( return_ACPI_STATUS (AE_NO_MEMORY); } + Scope->Common.DataType = ACPI_DESC_TYPE_STATE_RPSCOPE; Scope->ParseScope.Op = RootOp; Scope->ParseScope.ArgCount = ACPI_VAR_ARGS; Scope->ParseScope.ArgEnd = ParserState->AmlEnd; @@ -242,6 +243,7 @@ AcpiPsPushScope ( } + Scope->Common.DataType = ACPI_DESC_TYPE_STATE_PSCOPE; Scope->ParseScope.Op = Op; Scope->ParseScope.ArgList = RemainingArgs; Scope->ParseScope.ArgCount = ArgCount; diff --git a/sys/contrib/dev/acpica/pstree.c b/sys/contrib/dev/acpica/pstree.c index 9798b8c08b5b..a0e8c28fcc21 100644 --- a/sys/contrib/dev/acpica/pstree.c +++ b/sys/contrib/dev/acpica/pstree.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: pstree - Parser op tree manipulation/traversal/search - * $Revision: 32 $ + * $Revision: 33 $ * *****************************************************************************/ @@ -219,6 +219,7 @@ AcpiPsAppendArg ( { /* Invalid opcode */ + REPORT_ERROR (("PsAppendArg: Invalid AML Opcode: 0x%2.2X\n", Op->Opcode)); return; } diff --git a/sys/contrib/dev/acpica/psutils.c b/sys/contrib/dev/acpica/psutils.c index bbdafa737d32..15d5ac1a806c 100644 --- a/sys/contrib/dev/acpica/psutils.c +++ b/sys/contrib/dev/acpica/psutils.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psutils - Parser miscellaneous utilities (Parser only) - * $Revision: 43 $ + * $Revision: 44 $ * *****************************************************************************/ @@ -125,8 +125,8 @@ #define PARSEOP_GENERIC 0x01 #define PARSEOP_NAMED 0x02 -#define PARSEOP_DEFERRED 0x03 -#define PARSEOP_BYTELIST 0x04 +#define PARSEOP_DEFERRED 0x04 +#define PARSEOP_BYTELIST 0x08 #define PARSEOP_IN_CACHE 0x80 diff --git a/sys/contrib/dev/acpica/pswalk.c b/sys/contrib/dev/acpica/pswalk.c index 784cbbec650c..3061ce2176f8 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: 56 $ + * $Revision: 58 $ * *****************************************************************************/ @@ -181,7 +181,11 @@ AcpiPsGetNextWalkOp ( Next = Op->Next; Parent = Op->Parent; - Status = AscendingCallback (WalkState, Op); + WalkState->Op = Op; + WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode); + WalkState->Opcode = Op->Opcode; + + Status = AscendingCallback (WalkState); /* * If we are back to the starting point, the walk is complete. @@ -241,7 +245,11 @@ AcpiPsGetNextWalkOp ( GrandParent = Parent->Parent; Next = Parent->Next; - Status = AscendingCallback (WalkState, Parent); + WalkState->Op = Parent; + WalkState->OpInfo = AcpiPsGetOpcodeInfo (Parent->Opcode); + WalkState->Opcode = Parent->Opcode; + + Status = AscendingCallback (WalkState); /* * If we are back to the starting point, the walk is complete. @@ -305,11 +313,10 @@ AcpiPsGetNextWalkOp ( static ACPI_STATUS AcpiPsDeleteCompletedOp ( - ACPI_WALK_STATE *State, - ACPI_PARSE_OBJECT *Op) + ACPI_WALK_STATE *WalkState) { - AcpiPsFreeOp (Op); + AcpiPsFreeOp (WalkState->Op); return (AE_OK); } @@ -354,7 +361,6 @@ AcpiPsDeleteParseTree ( return_VOID; } - WalkState->ParserState = NULL; WalkState->ParseFlags = 0; WalkState->DescendingCallback = NULL; WalkState->AscendingCallback = NULL; diff --git a/sys/contrib/dev/acpica/psxface.c b/sys/contrib/dev/acpica/psxface.c index 29cc24070461..e91f0c76adde 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: 47 $ + * $Revision: 51 $ * *****************************************************************************/ @@ -156,6 +156,7 @@ AcpiPsxExecute ( ACPI_OPERAND_OBJECT *ObjDesc; UINT32 i; ACPI_PARSE_OBJECT *Op; + ACPI_WALK_STATE *WalkState; FUNCTION_TRACE ("PsxExecute"); @@ -195,9 +196,47 @@ AcpiPsxExecute ( } /* - * Perform the first pass parse of the method to enter any + * 1) Perform the first pass parse of the method to enter any * named objects that it creates into the namespace */ + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "**** Begin Method Parse **** Entry=%p obj=%p\n", + MethodNode, ObjDesc)); + + /* Create and init a Root Node */ + + Op = AcpiPsAllocOp (AML_SCOPE_OP); + if (!Op) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + /* Create and initialize a new walk state */ + + WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, + NULL, NULL, NULL); + if (!WalkState) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + Status = AcpiDsInitAmlWalk (WalkState, Op, MethodNode, ObjDesc->Method.AmlStart, + ObjDesc->Method.AmlLength, NULL, NULL, 1); + if (ACPI_FAILURE (Status)) + { + /* TBD: delete walk state */ + return_ACPI_STATUS (Status); + } + + /* Parse the AML */ + + Status = AcpiPsParseAml (WalkState); + AcpiPsDeleteParseTree (Op); + + + /* + * 2) Execute the method. Performs second pass parse simultaneously + */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Begin Method Execution **** Entry=%p obj=%p\n", MethodNode, ObjDesc)); @@ -210,35 +249,32 @@ AcpiPsxExecute ( return_ACPI_STATUS (AE_NO_MEMORY); } - Status = AcpiPsParseAml (Op, ObjDesc->Method.Pcode, - ObjDesc->Method.PcodeLength, - ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE, - MethodNode, Params, ReturnObjDesc, - AcpiDsLoad1BeginOp, AcpiDsLoad1EndOp); - AcpiPsDeleteParseTree (Op); - - /* Create and init a Root Node */ - - Op = AcpiPsAllocOp (AML_SCOPE_OP); - if (!Op) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Init new op with the method name and pointer back to the NS node */ AcpiPsSetName (Op, MethodNode->Name); Op->Node = MethodNode; + /* Create and initialize a new walk state */ + + WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, + NULL, NULL, NULL); + if (!WalkState) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + Status = AcpiDsInitAmlWalk (WalkState, Op, MethodNode, ObjDesc->Method.AmlStart, + ObjDesc->Method.AmlLength, Params, ReturnObjDesc, 3); + if (ACPI_FAILURE (Status)) + { + /* TBD: delete walk state */ + return_ACPI_STATUS (Status); + } + /* * The walk of the parse tree is where we actually execute the method */ - Status = AcpiPsParseAml (Op, ObjDesc->Method.Pcode, - ObjDesc->Method.PcodeLength, - ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE, - MethodNode, Params, ReturnObjDesc, - AcpiDsExecBeginOp, AcpiDsExecEndOp); + Status = AcpiPsParseAml (WalkState); AcpiPsDeleteParseTree (Op); if (Params) @@ -252,6 +288,13 @@ AcpiPsxExecute ( } + if (ACPI_FAILURE (Status)) + { + DUMP_PATHNAME (MethodNode, "PsExecute: method failed -", + ACPI_LV_ERROR, _COMPONENT); + } + + /* * If the method has returned an object, signal this to the caller with * a control exception code diff --git a/sys/contrib/dev/acpica/rsutils.c b/sys/contrib/dev/acpica/rsutils.c index 85ccd221c131..ffd6a596259e 100644 --- a/sys/contrib/dev/acpica/rsutils.c +++ b/sys/contrib/dev/acpica/rsutils.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsutils - Utilities for the resource manager - * $Revision: 21 $ + * $Revision: 22 $ * ******************************************************************************/ @@ -412,7 +412,6 @@ AcpiRsSetSrsMethodData ( ACPI_BUFFER *InBuffer) { ACPI_OPERAND_OBJECT *Params[2]; - ACPI_OPERAND_OBJECT ParamObj; ACPI_STATUS Status; UINT8 *ByteStream = NULL; UINT32 BufferSizeNeeded = 0; @@ -466,25 +465,25 @@ AcpiRsSetSrsMethodData ( /* * Init the param object */ - AcpiUtInitStaticObject (&ParamObj); - - /* - * Method requires one parameter. Set it up - */ - Params [0] = &ParamObj; + Params[0] = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER); + if (!Params[0]) + { + Status = AE_NO_MEMORY; + goto Cleanup; + } Params [1] = NULL; /* * Set up the parameter object */ - ParamObj.Common.Type = ACPI_TYPE_BUFFER; - ParamObj.Buffer.Length = BufferSizeNeeded; - ParamObj.Buffer.Pointer = ByteStream; + Params[0]->Buffer.Length = BufferSizeNeeded; + Params[0]->Buffer.Pointer = ByteStream; /* * Execute the method, no return value */ Status = AcpiNsEvaluateRelative (Handle, "_SRS", Params, NULL); + AcpiUtRemoveReference (Params[0]); /* * Clean up and return the status from AcpiNsEvaluateRelative diff --git a/sys/contrib/dev/acpica/rsxface.c b/sys/contrib/dev/acpica/rsxface.c index 0d5265f9352c..81c0968754c6 100644 --- a/sys/contrib/dev/acpica/rsxface.c +++ b/sys/contrib/dev/acpica/rsxface.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsxface - Public interfaces to the resource manager - * $Revision: 14 $ + * $Revision: 15 $ * ******************************************************************************/ @@ -160,14 +160,6 @@ AcpiGetIrqRoutingTable ( FUNCTION_TRACE ("AcpiGetIrqRoutingTable "); - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* * Must have a valid handle and buffer, So we have to have a handle * and a return buffer structure, and if there is a non-zero buffer length @@ -221,14 +213,6 @@ AcpiGetCurrentResources ( FUNCTION_TRACE ("AcpiGetCurrentResources"); - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* * Must have a valid handle and buffer, So we have to have a handle * and a return buffer structure, and if there is a non-zero buffer length @@ -279,14 +263,6 @@ AcpiGetPossibleResources ( FUNCTION_TRACE ("AcpiGetPossibleResources"); - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* * Must have a valid handle and buffer, So we have to have a handle * and a return buffer structure, and if there is a non-zero buffer length @@ -334,14 +310,6 @@ AcpiSetCurrentResources ( FUNCTION_TRACE ("AcpiSetCurrentResources"); - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* * Must have a valid handle and buffer */ diff --git a/sys/contrib/dev/acpica/tbinstal.c b/sys/contrib/dev/acpica/tbinstal.c index 338c265d9771..a83464c7494b 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: 42 $ + * $Revision: 44 $ * *****************************************************************************/ @@ -371,7 +371,7 @@ AcpiTbInitTableDescriptor ( TableDesc->BasePointer = TableInfo->BasePointer; TableDesc->Length = TableInfo->Length; TableDesc->Allocation = TableInfo->Allocation; - TableDesc->AmlPointer = (UINT8 *) (TableDesc->Pointer + 1), + TableDesc->AmlStart = (UINT8 *) (TableDesc->Pointer + 1), TableDesc->AmlLength = (UINT32) (TableDesc->Length - (UINT32) sizeof (ACPI_TABLE_HEADER)); TableDesc->TableId = AcpiUtAllocateOwnerId (OWNER_TYPE_TABLE); @@ -659,6 +659,7 @@ AcpiTbUninstallTable ( } + return_PTR (NextDesc); } diff --git a/sys/contrib/dev/acpica/tbxface.c b/sys/contrib/dev/acpica/tbxface.c index 6478264e86fb..457c63433d26 100644 --- a/sys/contrib/dev/acpica/tbxface.c +++ b/sys/contrib/dev/acpica/tbxface.c @@ -2,7 +2,7 @@ * * Module Name: tbxface - Public interfaces to the ACPI subsystem * ACPI table oriented interfaces - * $Revision: 43 $ + * $Revision: 45 $ * *****************************************************************************/ @@ -151,15 +151,6 @@ AcpiLoadTables (void) FUNCTION_TRACE ("AcpiLoadTables"); - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Get the RSDP */ Status = AcpiOsGetRootPointer (ACPI_LOGICAL_ADDRESSING, @@ -252,14 +243,6 @@ AcpiLoadTable ( FUNCTION_TRACE ("AcpiLoadTable"); - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - if (!TablePtr) { return_ACPI_STATUS (AE_BAD_PARAMETER); @@ -316,20 +299,11 @@ AcpiUnloadTable ( ACPI_TABLE_TYPE TableType) { ACPI_TABLE_DESC *ListHead; - ACPI_STATUS Status; FUNCTION_TRACE ("AcpiUnloadTable"); - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* Parameter validation */ if (TableType > ACPI_TABLE_MAX) @@ -395,14 +369,6 @@ AcpiGetTableHeader ( FUNCTION_TRACE ("AcpiGetTableHeader"); - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - if ((Instance == 0) || (TableType == ACPI_TABLE_RSDP) || (!OutTableHeader)) @@ -483,14 +449,6 @@ AcpiGetTable ( FUNCTION_TRACE ("AcpiGetTable"); - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* * If we have a buffer, we must have a length too */ diff --git a/sys/contrib/dev/acpica/tbxfroot.c b/sys/contrib/dev/acpica/tbxfroot.c index 229a099a8775..228d3a7631b1 100644 --- a/sys/contrib/dev/acpica/tbxfroot.c +++ b/sys/contrib/dev/acpica/tbxfroot.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbxfroot - Find the root ACPI table (RSDT) - * $Revision: 49 $ + * $Revision: 51 $ * *****************************************************************************/ @@ -380,10 +380,10 @@ AcpiGetFirmwareTable ( ACPI_TABLE_HEADER **TablePointer) { ACPI_PHYSICAL_ADDRESS PhysicalAddress; - ACPI_TABLE_HEADER *RsdtPtr; + ACPI_TABLE_HEADER *RsdtPtr = NULL; ACPI_TABLE_HEADER *TablePtr; ACPI_STATUS Status; - UINT32 RsdtSize; + UINT32 RsdtSize = 0; UINT32 TableSize; UINT32 TableCount; UINT32 i; @@ -408,16 +408,53 @@ AcpiGetFirmwareTable ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* Get the RSDP */ - - Status = AcpiOsGetRootPointer (Flags, &PhysicalAddress); - if (ACPI_FAILURE (Status)) + if (!AcpiGbl_RSDP) { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "RSDP not found\n")); - return_ACPI_STATUS (AE_NO_ACPI_TABLES); + /* Get the RSDP */ + + Status = AcpiOsGetRootPointer (Flags, &PhysicalAddress); + if (ACPI_FAILURE (Status)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "RSDP not found\n")); + return_ACPI_STATUS (AE_NO_ACPI_TABLES); + } + + /* Map and validate the RSDP */ + + if ((Flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) + { + Status = AcpiOsMapMemory (PhysicalAddress, sizeof (RSDP_DESCRIPTOR), + (void **) &AcpiGbl_RSDP); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } + else + { + AcpiGbl_RSDP = (void *) (NATIVE_UINT) PhysicalAddress; + } + + /* + * The signature and checksum must both be correct + */ + if (STRNCMP ((NATIVE_CHAR *) AcpiGbl_RSDP, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) + { + /* Nope, BAD Signature */ + + Status = AE_BAD_SIGNATURE; + goto Cleanup; + } + + if (AcpiTbChecksum (AcpiGbl_RSDP, RSDP_CHECKSUM_LENGTH) != 0) + { + /* Nope, BAD Checksum */ + + Status = AE_BAD_CHECKSUM; + goto Cleanup; + } } - AcpiGbl_RSDP = (RSDP_DESCRIPTOR *) (ACPI_TBLPTR) PhysicalAddress; ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "RSDP located at %p, RSDT physical=%8.8lX%8.8lX \n", @@ -490,7 +527,8 @@ AcpiGetFirmwareTable ( /* Delete table mapping if using virtual addressing */ - if (TableSize) + if ((TableSize) && + ((Flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING)) { AcpiOsUnmapMemory (TablePtr, TableSize); } diff --git a/sys/contrib/dev/acpica/utalloc.c b/sys/contrib/dev/acpica/utalloc.c index c03de8507b26..0af4296e64b5 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: 100 $ + * $Revision: 103 $ * *****************************************************************************/ @@ -169,6 +169,7 @@ AcpiUtReleaseToCache ( /* Mark the object as cached */ MEMSET (Object, 0xCA, CacheInfo->ObjectSize); + ((ACPI_OPERAND_OBJECT *) Object)->Common.DataType = ACPI_CACHED_OBJECT; /* Put the object at the head of the cache list */ @@ -297,14 +298,14 @@ AcpiUtDeleteGenericCache ( * Each memory allocation is tracked via a doubly linked list. Each * element contains the caller's component, module name, function name, and * line number. AcpiUtAllocate and AcpiUtCallocate call - * AcpiUtAddElementToAllocList to add an element to the list; deletion + * AcpiUtTrackAllocation to add an element to the list; deletion * occurs in the body of AcpiUtFree. */ /******************************************************************************* * - * FUNCTION: AcpiUtSearchAllocList + * FUNCTION: AcpiUtFindAllocation * * PARAMETERS: Address - Address of allocated memory * @@ -315,7 +316,7 @@ AcpiUtDeleteGenericCache ( ******************************************************************************/ ACPI_DEBUG_MEM_BLOCK * -AcpiUtSearchAllocList ( +AcpiUtFindAllocation ( UINT32 ListId, void *Address) { @@ -350,7 +351,7 @@ AcpiUtSearchAllocList ( /******************************************************************************* * - * FUNCTION: AcpiUtAddElementToAllocList + * FUNCTION: AcpiUtTrackAllocation * * PARAMETERS: Address - Address of allocated memory * Size - Size of the allocation @@ -366,7 +367,7 @@ AcpiUtSearchAllocList ( ******************************************************************************/ ACPI_STATUS -AcpiUtAddElementToAllocList ( +AcpiUtTrackAllocation ( UINT32 ListId, ACPI_DEBUG_MEM_BLOCK *Address, UINT32 Size, @@ -380,7 +381,7 @@ AcpiUtAddElementToAllocList ( ACPI_STATUS Status = AE_OK; - FUNCTION_TRACE_PTR ("UtAddElementToAllocList", Address); + FUNCTION_TRACE_PTR ("UtTrackAllocation", Address); if (ListId > ACPI_MEM_LIST_MAX) @@ -396,10 +397,10 @@ AcpiUtAddElementToAllocList ( * This will catch several kinds of problems. */ - Element = AcpiUtSearchAllocList (ListId, Address); + Element = AcpiUtFindAllocation (ListId, Address); if (Element) { - REPORT_ERROR (("UtAddElementToAllocList: Address already present in list! (%p)\n", + REPORT_ERROR (("UtTrackAllocation: Address already present in list! (%p)\n", Address)); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Element %p Address %p\n", Element, Address)); @@ -437,7 +438,7 @@ AcpiUtAddElementToAllocList ( /******************************************************************************* * - * FUNCTION: AcpiUtDeleteElementFromAllocList + * FUNCTION: AcpiUtRemoveAllocation * * PARAMETERS: Address - Address of allocated memory * Component - Component type of caller @@ -451,7 +452,7 @@ AcpiUtAddElementToAllocList ( ******************************************************************************/ ACPI_STATUS -AcpiUtDeleteElementFromAllocList ( +AcpiUtRemoveAllocation ( UINT32 ListId, ACPI_DEBUG_MEM_BLOCK *Address, UINT32 Component, @@ -461,7 +462,7 @@ AcpiUtDeleteElementFromAllocList ( ACPI_MEMORY_LIST *MemList; - FUNCTION_TRACE ("UtDeleteElementFromAllocList"); + FUNCTION_TRACE ("UtRemoveAllocation"); if (ListId > ACPI_MEM_LIST_MAX) @@ -475,7 +476,7 @@ AcpiUtDeleteElementFromAllocList ( /* No allocations! */ _REPORT_ERROR (Module, Line, Component, - ("UtDeleteElementFromAllocList: Empty allocation list, nothing to free!\n")); + ("UtRemoveAllocation: Empty allocation list, nothing to free!\n")); return_ACPI_STATUS (AE_OK); } @@ -572,7 +573,7 @@ AcpiUtDumpAllocationInfo ( /******************************************************************************* * - * FUNCTION: AcpiUtDumpCurrentAllocations + * FUNCTION: AcpiUtDumpAllocations * * PARAMETERS: Component - Component(s) to dump info for. * Module - Module to dump info for. NULL means all. @@ -584,7 +585,7 @@ AcpiUtDumpAllocationInfo ( ******************************************************************************/ void -AcpiUtDumpCurrentAllocations ( +AcpiUtDumpAllocations ( UINT32 Component, NATIVE_CHAR *Module) { @@ -592,13 +593,13 @@ AcpiUtDumpCurrentAllocations ( UINT32 i; - FUNCTION_TRACE ("UtDumpCurrentAllocations"); + FUNCTION_TRACE ("UtDumpAllocations"); Element = AcpiGbl_MemoryLists[0].ListHead; if (Element == NULL) { - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, + ACPI_DEBUG_PRINT ((ACPI_DB_OK, "No outstanding allocations.\n")); return_VOID; } @@ -609,7 +610,7 @@ AcpiUtDumpCurrentAllocations ( */ AcpiUtAcquireMutex (ACPI_MTX_MEMORY); - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, + ACPI_DEBUG_PRINT ((ACPI_DB_OK, "Outstanding allocations:\n")); for (i = 1; ; i++) /* Just a counter */ @@ -617,41 +618,84 @@ AcpiUtDumpCurrentAllocations ( if ((Element->Component & Component) && ((Module == NULL) || (0 == STRCMP (Module, Element->Module)))) { - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, - "%p Len %04lX %9.9s-%ld", - &Element->UserSpace, Element->Size, Element->Module, - Element->Line)); - - /* Most of the elements will be internal objects. */ - - switch (((ACPI_OPERAND_OBJECT *) - (&Element->UserSpace))->Common.DataType) + if (((ACPI_OPERAND_OBJECT *)(&Element->UserSpace))->Common.Type != ACPI_CACHED_OBJECT) { - case ACPI_DESC_TYPE_INTERNAL: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ALLOCATIONS, - " ObjType %s", - AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *)(&Element->UserSpace))->Common.Type))); - break; + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, + "%p Len %04lX %9.9s-%ld", + &Element->UserSpace, Element->Size, Element->Module, + Element->Line)); - case ACPI_DESC_TYPE_PARSER: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ALLOCATIONS, - " ParseObj Opcode %04X", - ((ACPI_PARSE_OBJECT *)(&Element->UserSpace))->Opcode)); - break; + /* Most of the elements will be internal objects. */ - case ACPI_DESC_TYPE_NAMED: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ALLOCATIONS, - " Node %4.4s", - &((ACPI_NAMESPACE_NODE *)(&Element->UserSpace))->Name)); - break; + switch (((ACPI_OPERAND_OBJECT *) + (&Element->UserSpace))->Common.DataType) + { + case ACPI_DESC_TYPE_INTERNAL: + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, + " ObjType %s", + AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *)(&Element->UserSpace))->Common.Type))); + break; - case ACPI_DESC_TYPE_STATE: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ALLOCATIONS, - " StateObj")); - break; + case ACPI_DESC_TYPE_PARSER: + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, + " 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", + &((ACPI_NAMESPACE_NODE *)(&Element->UserSpace))->Name)); + break; + + case ACPI_DESC_TYPE_STATE: + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, + " Untyped StateObj")); + break; + + case ACPI_DESC_TYPE_STATE_UPDATE: + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, + " UPDATE StateObj")); + break; + + case ACPI_DESC_TYPE_STATE_PACKAGE: + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, + " PACKAGE StateObj")); + break; + + case ACPI_DESC_TYPE_STATE_CONTROL: + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, + " CONTROL StateObj")); + break; + + case ACPI_DESC_TYPE_STATE_RPSCOPE: + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, + " ROOT-PARSE-SCOPE StateObj")); + break; + + case ACPI_DESC_TYPE_STATE_PSCOPE: + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, + " PARSE-SCOPE StateObj")); + break; + + case ACPI_DESC_TYPE_STATE_WSCOPE: + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, + " WALK-SCOPE StateObj")); + break; + + case ACPI_DESC_TYPE_STATE_RESULT: + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, + " RESULT StateObj")); + break; + + case ACPI_DESC_TYPE_STATE_NOTIFY: + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, + " NOTIFY StateObj")); + break; + } + + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "\n")); } - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ALLOCATIONS, "\n")); } if (Element->Next == NULL) @@ -664,7 +708,7 @@ AcpiUtDumpCurrentAllocations ( AcpiUtReleaseMutex (ACPI_MTX_MEMORY); - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, + ACPI_DEBUG_PRINT ((ACPI_DB_OK, "Total number of unfreed allocations = %d(%X)\n", i,i)); @@ -722,7 +766,7 @@ AcpiUtAllocate ( return_PTR (NULL); } - Status = AcpiUtAddElementToAllocList (ACPI_MEM_LIST_GLOBAL, Address, Size, + Status = AcpiUtTrackAllocation (ACPI_MEM_LIST_GLOBAL, Address, Size, MEM_MALLOC, Component, Module, Line); if (ACPI_FAILURE (Status)) { @@ -788,7 +832,7 @@ AcpiUtCallocate ( return_PTR (NULL); } - Status = AcpiUtAddElementToAllocList (ACPI_MEM_LIST_GLOBAL, Address, Size, + Status = AcpiUtTrackAllocation (ACPI_MEM_LIST_GLOBAL, Address, Size, MEM_CALLOC, Component, Module, Line); if (ACPI_FAILURE (Status)) { @@ -846,7 +890,7 @@ AcpiUtFree ( AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].TotalFreed++; AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].CurrentTotalSize -= DebugBlock->Size; - AcpiUtDeleteElementFromAllocList (ACPI_MEM_LIST_GLOBAL, DebugBlock, + AcpiUtRemoveAllocation (ACPI_MEM_LIST_GLOBAL, DebugBlock, Component, Module, Line); AcpiOsFree (DebugBlock); diff --git a/sys/contrib/dev/acpica/utcopy.c b/sys/contrib/dev/acpica/utcopy.c index 8f6777519408..129e2b7d9e3f 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: 79 $ + * $Revision: 82 $ * *****************************************************************************/ @@ -228,6 +228,11 @@ AcpiUtCopyIsimpleToEsimple ( ExternalObject->Integer.Value = ACPI_INTEGER_MAX; break; + case AML_REVISION_OP: + ExternalObject->Type = ACPI_TYPE_INTEGER; + ExternalObject->Integer.Value = ACPI_CA_VERSION; + break; + case AML_INT_NAMEPATH_OP: /* * This is a named reference, get the string. We already know that @@ -516,37 +521,29 @@ AcpiUtCopyIobjectToEobject ( ACPI_STATUS AcpiUtCopyEsimpleToIsimple ( ACPI_OBJECT *ExternalObject, - ACPI_OPERAND_OBJECT *InternalObject) + ACPI_OPERAND_OBJECT **RetInternalObject) { + ACPI_OPERAND_OBJECT *InternalObject; + FUNCTION_TRACE ("UtCopyEsimpleToIsimple"); - InternalObject->Common.Type = (UINT8) ExternalObject->Type; /* * Simple types supported are: String, Buffer, Integer */ switch (ExternalObject->Type) { - case ACPI_TYPE_STRING: - - InternalObject->String.Length = ExternalObject->String.Length; - InternalObject->String.Pointer = ExternalObject->String.Pointer; - break; - - case ACPI_TYPE_BUFFER: - - InternalObject->Buffer.Length = ExternalObject->Buffer.Length; - InternalObject->Buffer.Pointer = ExternalObject->Buffer.Pointer; - break; - - case ACPI_TYPE_INTEGER: - InternalObject->Integer.Value = ExternalObject->Integer.Value; + InternalObject = AcpiUtCreateInternalObject ((UINT8) ExternalObject->Type); + if (!InternalObject) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } break; default: @@ -558,6 +555,51 @@ AcpiUtCopyEsimpleToIsimple ( } + switch (ExternalObject->Type) + { + + /* Must COPY string and buffer contents */ + + case ACPI_TYPE_STRING: + + InternalObject->String.Pointer = ACPI_MEM_CALLOCATE (ExternalObject->String.Length + 1); + if (!InternalObject->String.Pointer) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + MEMCPY (InternalObject->String.Pointer, + ExternalObject->String.Pointer, + ExternalObject->String.Length); + + InternalObject->String.Length = ExternalObject->String.Length; + break; + + + case ACPI_TYPE_BUFFER: + + InternalObject->Buffer.Pointer = ACPI_MEM_CALLOCATE (ExternalObject->Buffer.Length); + if (!InternalObject->Buffer.Pointer) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + MEMCPY (InternalObject->Buffer.Pointer, + ExternalObject->Buffer.Pointer, + ExternalObject->Buffer.Length); + + InternalObject->Buffer.Length = ExternalObject->Buffer.Length; + break; + + + case ACPI_TYPE_INTEGER: + + InternalObject->Integer.Value = ExternalObject->Integer.Value; + break; + } + + + *RetInternalObject = InternalObject; return_ACPI_STATUS (AE_OK); } @@ -649,7 +691,7 @@ AcpiUtCopyEpackageToIpackage ( ACPI_STATUS AcpiUtCopyEobjectToIobject ( ACPI_OBJECT *ExternalObject, - ACPI_OPERAND_OBJECT *InternalObject) + ACPI_OPERAND_OBJECT **InternalObject) { ACPI_STATUS Status; @@ -684,10 +726,6 @@ AcpiUtCopyEobjectToIobject ( * Build a simple object (no nested objects) */ Status = AcpiUtCopyEsimpleToIsimple (ExternalObject, InternalObject); - /* - * build simple does not include the object size in the length - * so we add it in here - */ } return_ACPI_STATUS (Status); diff --git a/sys/contrib/dev/acpica/utdebug.c b/sys/contrib/dev/acpica/utdebug.c index 9da1f9f6dbdb..2b7e562b79ad 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: 87 $ + * $Revision: 89 $ * *****************************************************************************/ @@ -182,11 +182,6 @@ AcpiUtTrackStackPtr ( if (AcpiGbl_NestingLevel > AcpiGbl_DeepestNesting) { AcpiGbl_DeepestNesting = AcpiGbl_NestingLevel; - - if (AcpiGbl_DeepestNesting == 34) - { - AcpiOsPrintf ("hit deepest nesting\n"); - } } } diff --git a/sys/contrib/dev/acpica/utdelete.c b/sys/contrib/dev/acpica/utdelete.c index b4c91043a4cc..3dcb20c9a9e6 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: 75 $ + * $Revision: 78 $ * ******************************************************************************/ @@ -339,22 +339,7 @@ AcpiUtDeleteInternalObjectList ( for (InternalObj = ObjList; *InternalObj; InternalObj++) { - /* - * Check for a package - * Simple objects are simply stored in the array and do not - * need to be deleted separately. - */ - if (IS_THIS_OBJECT_TYPE ((*InternalObj), ACPI_TYPE_PACKAGE)) - { - /* Delete the package */ - - /* - * TBD: [Investigate] This might not be the right thing to do, - * depending on how the internal package object was allocated!!! - */ - AcpiUtDeleteInternalObj (*InternalObj); - } - + AcpiUtRemoveReference (*InternalObj); } /* Free the combined parameter pointer list and object array */ @@ -472,8 +457,8 @@ AcpiUtUpdateRefCount ( if (Count > MAX_REFERENCE_COUNT) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "**** AE_ERROR **** Invalid Reference Count (%X) in object %p\n\n", + ACPI_DEBUG_PRINT ((ACPI_DB_WARN, + "**** Warning **** Large Reference Count (%X) in object %p\n\n", Count, Object)); } @@ -538,7 +523,9 @@ AcpiUtUpdateObjectReference ( if (AcpiTbSystemTablePointer (Object)) { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Object %p is Pcode Ptr\n", Object)); + ACPI_DEBUG_PRINT ( + (ACPI_DB_INFO, "**** Object %p points into an ACPI table\n", + Object)); return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/utinit.c b/sys/contrib/dev/acpica/utinit.c index bf1511f35960..35c9b4fce021 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: 101 $ + * $Revision: 102 $ * *****************************************************************************/ @@ -350,7 +350,7 @@ AcpiUtSubsystemShutdown (void) /* Debug only - display leftover memory allocation, if any */ #ifdef ACPI_DBG_TRACK_ALLOCATIONS - AcpiUtDumpCurrentAllocations (ACPI_UINT32_MAX, NULL); + AcpiUtDumpAllocations (ACPI_UINT32_MAX, NULL); #endif return_ACPI_STATUS (AE_OK); diff --git a/sys/contrib/dev/acpica/utmisc.c b/sys/contrib/dev/acpica/utmisc.c index a9e9e45064dd..c4c99f24ff62 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: 50 $ + * $Revision: 52 $ * ******************************************************************************/ @@ -130,6 +130,7 @@ MODULE_NAME ("utmisc") + /******************************************************************************* * * FUNCTION: AcpiUtValidAcpiName @@ -783,6 +784,7 @@ AcpiUtCreateUpdateState ( /* Init fields specific to the update struct */ + State->Common.DataType = ACPI_DESC_TYPE_STATE_UPDATE; State->Update.Object = Object; State->Update.Value = Action; @@ -800,9 +802,7 @@ AcpiUtCreateUpdateState ( * * RETURN: Status * - * DESCRIPTION: Create an "Update State" - a flavor of the generic state used - * to update reference counts and delete complex objects such - * as packages. + * DESCRIPTION: Create a "Package State" * ******************************************************************************/ @@ -828,6 +828,7 @@ AcpiUtCreatePkgState ( /* Init fields specific to the update struct */ + State->Common.DataType = ACPI_DESC_TYPE_STATE_PACKAGE; State->Pkg.SourceObject = (ACPI_OPERAND_OBJECT *) InternalObject; State->Pkg.DestObject = ExternalObject; State->Pkg.Index = Index; @@ -871,7 +872,8 @@ AcpiUtCreateControlState ( /* Init fields specific to the control struct */ - State->Common.State = CONTROL_CONDITIONAL_EXECUTING; + State->Common.DataType = ACPI_DESC_TYPE_STATE_CONTROL; + State->Common.State = CONTROL_CONDITIONAL_EXECUTING; return_PTR (State); } diff --git a/sys/contrib/dev/acpica/utobject.c b/sys/contrib/dev/acpica/utobject.c index fcd214f2317c..19f0e6ace255 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: 54 $ + * $Revision: 56 $ * *****************************************************************************/ @@ -217,7 +217,9 @@ AcpiUtValidInternalObject ( if (AcpiTbSystemTablePointer (Object)) { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Object %p is a Pcode Ptr\n", Object)); + ACPI_DEBUG_PRINT ( + (ACPI_DB_INFO, "**** Object %p points into an ACPI table\n", + Object)); return (FALSE); } @@ -363,56 +365,6 @@ AcpiUtDeleteObjectCache ( } -/******************************************************************************* - * - * FUNCTION: AcpiUtInitStaticObject - * - * PARAMETERS: ObjDesc - Pointer to a "static" object - on stack - * or in the data segment. - * - * RETURN: None. - * - * DESCRIPTION: Initialize a static object. Sets flags to disallow dynamic - * deletion of the object. - * - ******************************************************************************/ - -void -AcpiUtInitStaticObject ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - - FUNCTION_TRACE_PTR ("UtInitStaticObject", ObjDesc); - - - if (!ObjDesc) - { - return_VOID; - } - - - /* - * Clear the entire descriptor - */ - MEMSET ((void *) ObjDesc, 0, sizeof (ACPI_OPERAND_OBJECT)); - - - /* - * Initialize the header fields - * 1) This is an ACPI_OPERAND_OBJECT descriptor - * 2) The size is the full object (worst case) - * 3) The flags field indicates static allocation - * 4) Reference count starts at one (not really necessary since the - * object can't be deleted, but keeps everything sane) - */ - - ObjDesc->Common.DataType = ACPI_DESC_TYPE_INTERNAL; - ObjDesc->Common.Flags = AOPOBJ_STATIC_ALLOCATION; - ObjDesc->Common.ReferenceCount = 1; - - return_VOID; -} - /******************************************************************************* * diff --git a/sys/contrib/dev/acpica/utxface.c b/sys/contrib/dev/acpica/utxface.c index f74678ca662c..67b18bfad30b 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: 80 $ + * $Revision: 82 $ * *****************************************************************************/ @@ -349,20 +349,9 @@ AcpiEnableSubsystem ( ACPI_STATUS AcpiTerminate (void) { - ACPI_STATUS Status; - - FUNCTION_TRACE ("AcpiTerminate"); - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* Terminate the AML Debugger if present */ DEBUGGER_EXEC(AcpiGbl_DbTerminateThreads = TRUE); @@ -381,10 +370,18 @@ AcpiTerminate (void) AcpiUtMutexTerminate (); +#ifdef ENABLE_DEBUGGER + + /* Shut down the debugger */ + + AcpiDbTerminate (); +#endif + /* Now we can shutdown the OS-dependent layer */ AcpiOsTerminate (); + return_ACPI_STATUS (AE_OK); } @@ -442,20 +439,11 @@ AcpiGetSystemInfo ( { ACPI_SYSTEM_INFO *InfoPtr; UINT32 i; - ACPI_STATUS Status; FUNCTION_TRACE ("AcpiGetSystemInfo"); - /* Ensure that ACPI has been initialized */ - - ACPI_IS_INITIALIZATION_COMPLETE (Status); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* * Must have a valid buffer */