ReactOS  0.4.14-dev-315-gbb6fece
acdispat.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define NAMEOF_LOCAL_NTE   "__L0"
 
#define NAMEOF_ARG_NTE   "__A0"
 

Functions

ACPI_STATUS AcpiDsGetBufferFieldArguments (ACPI_OPERAND_OBJECT *ObjDesc)
 
ACPI_STATUS AcpiDsGetBankFieldArguments (ACPI_OPERAND_OBJECT *ObjDesc)
 
ACPI_STATUS AcpiDsGetRegionArguments (ACPI_OPERAND_OBJECT *RgnDesc)
 
ACPI_STATUS AcpiDsGetBufferArguments (ACPI_OPERAND_OBJECT *ObjDesc)
 
ACPI_STATUS AcpiDsGetPackageArguments (ACPI_OPERAND_OBJECT *ObjDesc)
 
ACPI_STATUS AcpiDsExecBeginControlOp (ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
 
ACPI_STATUS AcpiDsExecEndControlOp (ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
 
ACPI_STATUS AcpiDsEvalBufferFieldOperands (ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
 
ACPI_STATUS AcpiDsEvalRegionOperands (ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
 
ACPI_STATUS AcpiDsEvalTableRegionOperands (ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
 
ACPI_STATUS AcpiDsEvalDataObjectOperands (ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, ACPI_OPERAND_OBJECT *ObjDesc)
 
ACPI_STATUS AcpiDsEvalBankFieldOperands (ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
 
ACPI_STATUS AcpiDsInitializeRegion (ACPI_HANDLE ObjHandle)
 
ACPI_STATUS AcpiDsGetPredicateValue (ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT *ResultObj)
 
ACPI_STATUS AcpiDsExecBeginOp (ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT **OutOp)
 
ACPI_STATUS AcpiDsExecEndOp (ACPI_WALK_STATE *State)
 
ACPI_STATUS AcpiDsCreateField (ACPI_PARSE_OBJECT *Op, ACPI_NAMESPACE_NODE *RegionNode, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiDsCreateBankField (ACPI_PARSE_OBJECT *Op, ACPI_NAMESPACE_NODE *RegionNode, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiDsCreateIndexField (ACPI_PARSE_OBJECT *Op, ACPI_NAMESPACE_NODE *RegionNode, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiDsCreateBufferField (ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiDsInitFieldObjects (ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiDsInitCallbacks (ACPI_WALK_STATE *WalkState, UINT32 PassNumber)
 
ACPI_STATUS AcpiDsLoad1BeginOp (ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT **OutOp)
 
ACPI_STATUS AcpiDsLoad1EndOp (ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiDsLoad2BeginOp (ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT **OutOp)
 
ACPI_STATUS AcpiDsLoad2EndOp (ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiDsStoreObjectToLocal (UINT8 Type, UINT32 Index, ACPI_OPERAND_OBJECT *SrcDesc, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiDsMethodDataGetEntry (UINT16 Opcode, UINT32 Index, ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT ***Node)
 
void AcpiDsMethodDataDeleteAll (ACPI_WALK_STATE *WalkState)
 
BOOLEAN AcpiDsIsMethodValue (ACPI_OPERAND_OBJECT *ObjDesc)
 
ACPI_STATUS AcpiDsMethodDataGetValue (UINT8 Type, UINT32 Index, ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT **DestDesc)
 
ACPI_STATUS AcpiDsMethodDataInitArgs (ACPI_OPERAND_OBJECT **Params, UINT32 MaxParamCount, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiDsMethodDataGetNode (UINT8 Type, UINT32 Index, ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE **Node)
 
void AcpiDsMethodDataInit (ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiDsAutoSerializeMethod (ACPI_NAMESPACE_NODE *Node, ACPI_OPERAND_OBJECT *ObjDesc)
 
ACPI_STATUS AcpiDsCallControlMethod (ACPI_THREAD_STATE *Thread, ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
 
ACPI_STATUS AcpiDsRestartControlMethod (ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT *ReturnDesc)
 
void AcpiDsTerminateControlMethod (ACPI_OPERAND_OBJECT *MethodDesc, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiDsBeginMethodExecution (ACPI_NAMESPACE_NODE *MethodNode, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiDsMethodError (ACPI_STATUS Status, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiDsInitializeObjects (UINT32 TableIndex, ACPI_NAMESPACE_NODE *StartNode)
 
ACPI_STATUS AcpiDsBuildInternalObject (ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, ACPI_OPERAND_OBJECT **ObjDescPtr)
 
ACPI_STATUS AcpiDsBuildInternalBufferObj (ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, UINT32 BufferLength, ACPI_OPERAND_OBJECT **ObjDescPtr)
 
ACPI_STATUS AcpiDsBuildInternalPackageObj (ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *op, UINT32 PackageLength, ACPI_OPERAND_OBJECT **ObjDesc)
 
ACPI_STATUS AcpiDsInitObjectFromOp (ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, UINT16 Opcode, ACPI_OPERAND_OBJECT **ObjDesc)
 
ACPI_STATUS AcpiDsCreateNode (ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE *Node, ACPI_PARSE_OBJECT *Op)
 
ACPI_STATUS AcpiDsInitPackageElement (UINT8 ObjectType, ACPI_OPERAND_OBJECT *SourceObject, ACPI_GENERIC_STATE *State, void *Context)
 
void AcpiDsClearImplicitReturn (ACPI_WALK_STATE *WalkState)
 
BOOLEAN AcpiDsDoImplicitReturn (ACPI_OPERAND_OBJECT *ReturnDesc, ACPI_WALK_STATE *WalkState, BOOLEAN AddReference)
 
BOOLEAN AcpiDsIsResultUsed (ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState)
 
void AcpiDsDeleteResultIfNotUsed (ACPI_PARSE_OBJECT *Op, ACPI_OPERAND_OBJECT *ResultObj, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiDsCreateOperand (ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Arg, UINT32 ArgsRemaining)
 
ACPI_STATUS AcpiDsCreateOperands (ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *FirstArg)
 
ACPI_STATUS AcpiDsResolveOperands (ACPI_WALK_STATE *WalkState)
 
void AcpiDsClearOperands (ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiDsEvaluateNamePath (ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiDsScopeStackPush (ACPI_NAMESPACE_NODE *Node, ACPI_OBJECT_TYPE Type, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiDsScopeStackPop (ACPI_WALK_STATE *WalkState)
 
void AcpiDsScopeStackClear (ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiDsObjStackPush (void *Object, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiDsObjStackPop (UINT32 PopCount, ACPI_WALK_STATE *WalkState)
 
ACPI_WALK_STATEAcpiDsCreateWalkState (ACPI_OWNER_ID OwnerId, ACPI_PARSE_OBJECT *Origin, ACPI_OPERAND_OBJECT *MthDesc, ACPI_THREAD_STATE *Thread)
 
ACPI_STATUS AcpiDsInitAmlWalk (ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, ACPI_NAMESPACE_NODE *MethodNode, UINT8 *AmlStart, UINT32 AmlLength, ACPI_EVALUATE_INFO *Info, UINT8 PassNumber)
 
void AcpiDsObjStackPopAndDelete (UINT32 PopCount, ACPI_WALK_STATE *WalkState)
 
void AcpiDsDeleteWalkState (ACPI_WALK_STATE *WalkState)
 
ACPI_WALK_STATEAcpiDsPopWalkState (ACPI_THREAD_STATE *Thread)
 
void AcpiDsPushWalkState (ACPI_WALK_STATE *WalkState, ACPI_THREAD_STATE *Thread)
 
ACPI_STATUS AcpiDsResultStackClear (ACPI_WALK_STATE *WalkState)
 
ACPI_WALK_STATEAcpiDsGetCurrentWalkState (ACPI_THREAD_STATE *Thread)
 
ACPI_STATUS AcpiDsResultPop (ACPI_OPERAND_OBJECT **Object, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiDsResultPush (ACPI_OPERAND_OBJECT *Object, ACPI_WALK_STATE *WalkState)
 
void AcpiDsDumpMethodStack (ACPI_STATUS Status, ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
 

Macro Definition Documentation

◆ NAMEOF_ARG_NTE

#define NAMEOF_ARG_NTE   "__A0"

Definition at line 49 of file acdispat.h.

◆ NAMEOF_LOCAL_NTE

#define NAMEOF_LOCAL_NTE   "__L0"

Definition at line 48 of file acdispat.h.

Function Documentation

◆ AcpiDsAutoSerializeMethod()

ACPI_STATUS AcpiDsAutoSerializeMethod ( ACPI_NAMESPACE_NODE Node,
ACPI_OPERAND_OBJECT ObjDesc 
)

Definition at line 94 of file dsmethod.c.

97 {
99  ACPI_PARSE_OBJECT *Op = NULL;
100  ACPI_WALK_STATE *WalkState;
101 
102 
103  ACPI_FUNCTION_TRACE_PTR (DsAutoSerializeMethod, Node);
104 
105 
107  "Method auto-serialization parse [%4.4s] %p\n",
109 
110  /* Create/Init a root op for the method parse tree */
111 
112  Op = AcpiPsAllocOp (AML_METHOD_OP, ObjDesc->Method.AmlStart);
113  if (!Op)
114  {
116  }
117 
118  AcpiPsSetName (Op, Node->Name.Integer);
119  Op->Common.Node = Node;
120 
121  /* Create and initialize a new walk state */
122 
123  WalkState = AcpiDsCreateWalkState (Node->OwnerId, NULL, NULL, NULL);
124  if (!WalkState)
125  {
126  AcpiPsFreeOp (Op);
128  }
129 
130  Status = AcpiDsInitAmlWalk (WalkState, Op, Node,
131  ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength, NULL, 0);
132  if (ACPI_FAILURE (Status))
133  {
134  AcpiDsDeleteWalkState (WalkState);
135  AcpiPsFreeOp (Op);
137  }
138 
140 
141  /* Parse the method, scan for creation of named objects */
142 
143  Status = AcpiPsParseAml (WalkState);
144 
147 }
UINT8 * AmlStart
Definition: acobject.h:220
void AcpiPsDeleteParseTree(ACPI_PARSE_OBJECT *root)
Definition: pswalk.c:67
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
ACPI_STATUS AcpiDsInitAmlWalk(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, ACPI_NAMESPACE_NODE *MethodNode, UINT8 *AmlStart, UINT32 AmlLength, ACPI_EVALUATE_INFO *Info, UINT8 PassNumber)
Definition: dswstate.c:662
void AcpiDsDeleteWalkState(ACPI_WALK_STATE *WalkState)
Definition: dswstate.c:780
ACPI_WALK_STATE * AcpiDsCreateWalkState(ACPI_OWNER_ID OwnerId, ACPI_PARSE_OBJECT *Origin, ACPI_OPERAND_OBJECT *MethodDesc, ACPI_THREAD_STATE *Thread)
Definition: dswstate.c:600
#define AE_NO_MEMORY
Definition: acexcep.h:112
ACPI_PARSE_OBJECT * AcpiPsAllocOp(UINT16 Opcode, UINT8 *Aml)
Definition: psutils.c:130
#define ACPI_DB_PARSE
Definition: acoutput.h:162
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
union node Node
Definition: types.h:1255
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
static ACPI_STATUS AcpiDsDetectNamedOpcodes(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT **OutOp)
Definition: dsmethod.c:166
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
void AcpiPsSetName(ACPI_PARSE_OBJECT *op, UINT32 name)
Definition: psutils.c:281
#define AML_METHOD_OP
Definition: amlcode.h:64
Status
Definition: gdiplustypes.h:24
ACPI_OBJECT_METHOD Method
Definition: acobject.h:522
ACPI_PARSE_DOWNWARDS DescendingCallback
Definition: acstruct.h:128
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
ACPI_STATUS AcpiPsParseAml(ACPI_WALK_STATE *WalkState)
Definition: psparse.c:453
void AcpiPsFreeOp(ACPI_PARSE_OBJECT *Op)
Definition: psutils.c:212
const char * AcpiUtGetNodeName(void *Object)
Definition: utdecode.c:305
Definition: dlist.c:348

Referenced by AcpiDsInitOneObject().

◆ AcpiDsBeginMethodExecution()

ACPI_STATUS AcpiDsBeginMethodExecution ( ACPI_NAMESPACE_NODE MethodNode,
ACPI_OPERAND_OBJECT ObjDesc,
ACPI_WALK_STATE WalkState 
)

Definition at line 352 of file dsmethod.c.

356 {
358 
359 
360  ACPI_FUNCTION_TRACE_PTR (DsBeginMethodExecution, MethodNode);
361 
362 
363  if (!MethodNode)
364  {
366  }
367 
368  AcpiExStartTraceMethod (MethodNode, ObjDesc, WalkState);
369 
370  /* Prevent wraparound of thread count */
371 
372  if (ObjDesc->Method.ThreadCount == ACPI_UINT8_MAX)
373  {
375  "Method reached maximum reentrancy limit (255)"));
377  }
378 
379  /*
380  * If this method is serialized, we need to acquire the method mutex.
381  */
382  if (ObjDesc->Method.InfoFlags & ACPI_METHOD_SERIALIZED)
383  {
384  /*
385  * Create a mutex for the method if it is defined to be Serialized
386  * and a mutex has not already been created. We defer the mutex creation
387  * until a method is actually executed, to minimize the object count
388  */
389  if (!ObjDesc->Method.Mutex)
390  {
391  Status = AcpiDsCreateMethodMutex (ObjDesc);
392  if (ACPI_FAILURE (Status))
393  {
395  }
396  }
397 
398  /*
399  * The CurrentSyncLevel (per-thread) must be less than or equal to
400  * the sync level of the method. This mechanism provides some
401  * deadlock prevention.
402  *
403  * If the method was auto-serialized, we just ignore the sync level
404  * mechanism, because auto-serialization of methods can interfere
405  * with ASL code that actually uses sync levels.
406  *
407  * Top-level method invocation has no walk state at this point
408  */
409  if (WalkState &&
411  (WalkState->Thread->CurrentSyncLevel >
412  ObjDesc->Method.Mutex->Mutex.SyncLevel))
413  {
415  "Cannot acquire Mutex for method [%4.4s]"
416  ", current SyncLevel is too large (%u)",
417  AcpiUtGetNodeName (MethodNode),
418  WalkState->Thread->CurrentSyncLevel));
419 
421  }
422 
423  /*
424  * Obtain the method mutex if necessary. Do not acquire mutex for a
425  * recursive call.
426  */
427  if (!WalkState ||
428  !ObjDesc->Method.Mutex->Mutex.ThreadId ||
429  (WalkState->Thread->ThreadId !=
430  ObjDesc->Method.Mutex->Mutex.ThreadId))
431  {
432  /*
433  * Acquire the method mutex. This releases the interpreter if we
434  * block (and reacquires it before it returns)
435  */
438  if (ACPI_FAILURE (Status))
439  {
441  }
442 
443  /* Update the mutex and walk info and save the original SyncLevel */
444 
445  if (WalkState)
446  {
447  ObjDesc->Method.Mutex->Mutex.OriginalSyncLevel =
448  WalkState->Thread->CurrentSyncLevel;
449 
450  ObjDesc->Method.Mutex->Mutex.ThreadId =
451  WalkState->Thread->ThreadId;
452 
453  /*
454  * Update the current SyncLevel only if this is not an auto-
455  * serialized method. In the auto case, we have to ignore
456  * the sync level for the method mutex (created for the
457  * auto-serialization) because we have no idea of what the
458  * sync level should be. Therefore, just ignore it.
459  */
460  if (!(ObjDesc->Method.InfoFlags &
462  {
463  WalkState->Thread->CurrentSyncLevel =
464  ObjDesc->Method.SyncLevel;
465  }
466  }
467  else
468  {
469  ObjDesc->Method.Mutex->Mutex.OriginalSyncLevel =
470  ObjDesc->Method.Mutex->Mutex.SyncLevel;
471 
472  ObjDesc->Method.Mutex->Mutex.ThreadId =
474  }
475  }
476 
477  /* Always increase acquisition depth */
478 
479  ObjDesc->Method.Mutex->Mutex.AcquisitionDepth++;
480  }
481 
482  /*
483  * Allocate an Owner ID for this method, only if this is the first thread
484  * to begin concurrent execution. We only need one OwnerId, even if the
485  * method is invoked recursively.
486  */
487  if (!ObjDesc->Method.OwnerId)
488  {
490  if (ACPI_FAILURE (Status))
491  {
492  goto Cleanup;
493  }
494  }
495 
496  /*
497  * Increment the method parse tree thread count since it has been
498  * reentered one more time (even if it is the same thread)
499  */
500  ObjDesc->Method.ThreadCount++;
501  AcpiMethodCount++;
503 
504 
505 Cleanup:
506  /* On error, must release the method mutex (if present) */
507 
508  if (ObjDesc->Method.Mutex)
509  {
511  }
513 }
ACPI_THREAD_STATE * Thread
Definition: acstruct.h:127
#define ACPI_METHOD_IGNORE_SYNC_LEVEL
Definition: acobject.h:239
ACPI_THREAD_ID AcpiOsGetThreadId(void)
Definition: osl.c:217
ACPI_MUTEX OsMutex
Definition: acobject.h:188
#define ACPI_METHOD_SERIALIZED
Definition: acobject.h:237
ACPI_OBJECT_COMMON_HEADER UINT8 InfoFlags
Definition: acobject.h:215
ACPI_OBJECT_MUTEX Mutex
Definition: acobject.h:523
#define AE_AML_METHOD_LIMIT
Definition: acexcep.h:198
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_OBJECT_COMMON_HEADER UINT8 SyncLevel
Definition: acobject.h:186
UINT8 OriginalSyncLevel
Definition: acobject.h:194
UINT16 AcquisitionDepth
Definition: acobject.h:187
#define AE_AML_MUTEX_ORDER
Definition: acexcep.h:200
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_STATUS AcpiExSystemWaitMutex(ACPI_MUTEX Mutex, UINT16 Timeout)
Definition: exsystem.c:120
#define ACPI_UINT8_MAX
Definition: actypes.h:64
#define AE_INFO
Definition: acoutput.h:230
void AcpiExStartTraceMethod(ACPI_NAMESPACE_NODE *MethodNode, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_WALK_STATE *WalkState)
Definition: extrace.c:224
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
ACPI_STATE_COMMON UINT8 CurrentSyncLevel
Definition: aclocal.h:764
#define ACPI_WAIT_FOREVER
Definition: actypes.h:501
static ACPI_STATUS AcpiDsCreateMethodMutex(ACPI_OPERAND_OBJECT *MethodDesc)
Definition: dsmethod.c:301
ACPI_THREAD_ID ThreadId
Definition: acobject.h:189
union acpi_operand_object * Mutex
Definition: acobject.h:218
static const WCHAR Cleanup[]
Definition: register.c:80
Status
Definition: gdiplustypes.h:24
ACPI_OBJECT_METHOD Method
Definition: acobject.h:522
ACPI_STATUS AcpiUtAllocateOwnerId(ACPI_OWNER_ID *OwnerId)
Definition: utownerid.c:68
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define AE_NULL_ENTRY
Definition: acexcep.h:118
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
const char * AcpiUtGetNodeName(void *Object)
Definition: utdecode.c:305
void AcpiOsReleaseMutex(ACPI_MUTEX Handle)
Definition: osl.c:333
ACPI_THREAD_ID ThreadId
Definition: aclocal.h:767
ACPI_OWNER_ID OwnerId
Definition: acobject.h:228
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiDsCallControlMethod(), and AcpiPsExecuteMethod().

◆ AcpiDsBuildInternalBufferObj()

ACPI_STATUS AcpiDsBuildInternalBufferObj ( ACPI_WALK_STATE WalkState,
ACPI_PARSE_OBJECT Op,
UINT32  BufferLength,
ACPI_OPERAND_OBJECT **  ObjDescPtr 
)

Definition at line 188 of file dsobject.c.

193 {
194  ACPI_PARSE_OBJECT *Arg;
195  ACPI_OPERAND_OBJECT *ObjDesc;
196  ACPI_PARSE_OBJECT *ByteList;
197  UINT32 ByteListLength = 0;
198 
199 
200  ACPI_FUNCTION_TRACE (DsBuildInternalBufferObj);
201 
202 
203  /*
204  * If we are evaluating a Named buffer object "Name (xxxx, Buffer)".
205  * The buffer object already exists (from the NS node), otherwise it must
206  * be created.
207  */
208  ObjDesc = *ObjDescPtr;
209  if (!ObjDesc)
210  {
211  /* Create a new buffer object */
212 
214  *ObjDescPtr = ObjDesc;
215  if (!ObjDesc)
216  {
218  }
219  }
220 
221  /*
222  * Second arg is the buffer data (optional) ByteList can be either
223  * individual bytes or a string initializer. In either case, a
224  * ByteList appears in the AML.
225  */
226  Arg = Op->Common.Value.Arg; /* skip first arg */
227 
228  ByteList = Arg->Named.Next;
229  if (ByteList)
230  {
231  if (ByteList->Common.AmlOpcode != AML_INT_BYTELIST_OP)
232  {
234  "Expecting bytelist, found AML opcode 0x%X in op %p",
235  ByteList->Common.AmlOpcode, ByteList));
236 
237  AcpiUtRemoveReference (ObjDesc);
238  return (AE_TYPE);
239  }
240 
241  ByteListLength = (UINT32) ByteList->Common.Value.Integer;
242  }
243 
244  /*
245  * The buffer length (number of bytes) will be the larger of:
246  * 1) The specified buffer length and
247  * 2) The length of the initializer byte list
248  */
249  ObjDesc->Buffer.Length = BufferLength;
250  if (ByteListLength > BufferLength)
251  {
252  ObjDesc->Buffer.Length = ByteListLength;
253  }
254 
255  /* Allocate the buffer */
256 
257  if (ObjDesc->Buffer.Length == 0)
258  {
259  ObjDesc->Buffer.Pointer = NULL;
261  "Buffer defined with zero length in AML, creating\n"));
262  }
263  else
264  {
265  ObjDesc->Buffer.Pointer =
266  ACPI_ALLOCATE_ZEROED (ObjDesc->Buffer.Length);
267  if (!ObjDesc->Buffer.Pointer)
268  {
269  AcpiUtDeleteObjectDesc (ObjDesc);
271  }
272 
273  /* Initialize buffer from the ByteList (if present) */
274 
275  if (ByteList)
276  {
277  memcpy (ObjDesc->Buffer.Pointer, ByteList->Named.Data,
278  ByteListLength);
279  }
280  }
281 
282  ObjDesc->Buffer.Flags |= AOPOBJ_DATA_VALID;
283  Op->Common.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjDesc);
285 }
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
#define ACPI_ALLOCATE_ZEROED(a)
Definition: actypes.h:385
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define ACPI_TYPE_BUFFER
Definition: actypes.h:681
void AcpiUtDeleteObjectDesc(ACPI_OPERAND_OBJECT *Object)
Definition: utobject.c:473
unsigned int UINT32
_In_ ULONG BufferLength
Definition: usbdlib.h:225
smooth NULL
Definition: ftsmooth.c:416
#define AE_INFO
Definition: acoutput.h:230
ACPI_PARSE_OBJ_NAMED Named
Definition: aclocal.h:1079
ACPI_OBJECT_BUFFER Buffer
Definition: acobject.h:519
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define AE_TYPE
Definition: acexcep.h:116
#define ACPI_DB_EXEC
Definition: acoutput.h:165
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AOPOBJ_DATA_VALID
Definition: acobject.h:96
#define AML_INT_BYTELIST_OP
Definition: amlcode.h:209
#define AcpiUtCreateInternalObject(t)
Definition: acutils.h:654
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiDsEvalDataObjectOperands().

◆ AcpiDsBuildInternalObject()

ACPI_STATUS AcpiDsBuildInternalObject ( ACPI_WALK_STATE WalkState,
ACPI_PARSE_OBJECT Op,
ACPI_OPERAND_OBJECT **  ObjDescPtr 
)

Definition at line 72 of file dsobject.c.

76 {
77  ACPI_OPERAND_OBJECT *ObjDesc;
79 
80 
81  ACPI_FUNCTION_TRACE (DsBuildInternalObject);
82 
83 
84  *ObjDescPtr = NULL;
85  if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
86  {
87  /*
88  * This is a named object reference. If this name was
89  * previously looked up in the namespace, it was stored in
90  * this op. Otherwise, go ahead and look it up now
91  */
92  if (!Op->Common.Node)
93  {
94  /* Check if we are resolving a named reference within a package */
95 
96  if ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
97  (Op->Common.Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP))
98  {
99  /*
100  * We won't resolve package elements here, we will do this
101  * after all ACPI tables are loaded into the namespace. This
102  * behavior supports both forward references to named objects
103  * and external references to objects in other tables.
104  */
105  goto CreateNewObject;
106  }
107  else
108  {
109  Status = AcpiNsLookup (WalkState->ScopeInfo,
110  Op->Common.Value.String,
114  ACPI_NAMESPACE_NODE, &(Op->Common.Node)));
115  if (ACPI_FAILURE (Status))
116  {
117  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
118  Op->Common.Value.String, Status);
120  }
121  }
122  }
123  }
124 
125 CreateNewObject:
126 
127  /* Create and init a new internal ACPI object */
128 
129  ObjDesc = AcpiUtCreateInternalObject (
130  (AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode))->ObjectType);
131  if (!ObjDesc)
132  {
134  }
135 
137  WalkState, Op, Op->Common.AmlOpcode, &ObjDesc);
138  if (ACPI_FAILURE (Status))
139  {
140  AcpiUtRemoveReference (ObjDesc);
142  }
143 
144  /*
145  * Handling for unresolved package reference elements.
146  * These are elements that are namepaths.
147  */
148  if ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
149  (Op->Common.Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP))
150  {
151  ObjDesc->Reference.Resolved = TRUE;
152 
153  if ((Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&
154  !ObjDesc->Reference.Node)
155  {
156  /*
157  * Name was unresolved above.
158  * Get the prefix node for later lookup
159  */
160  ObjDesc->Reference.Node = WalkState->ScopeInfo->Scope.Node;
161  ObjDesc->Reference.Aml = Op->Common.Aml;
162  ObjDesc->Reference.Resolved = FALSE;
163  }
164  }
165 
166  *ObjDescPtr = ObjDesc;
168 }
#define ACPI_NS_SEARCH_PARENT
Definition: acnamesp.h:63
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
#define TRUE
Definition: types.h:120
ACPI_STATUS AcpiNsLookup(ACPI_GENERIC_STATE *ScopeInfo, char *Name, ACPI_OBJECT_TYPE Type, ACPI_INTERPRETER_MODE InterpreterMode, UINT32 Flags, ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE **RetNode)
Definition: nsaccess.c:329
#define AE_NO_MEMORY
Definition: acexcep.h:112
const ACPI_OPCODE_INFO * AcpiPsGetOpcodeInfo(UINT16 Opcode)
Definition: psopinfo.c:72
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define AML_VARIABLE_PACKAGE_OP
Definition: amlcode.h:63
#define AML_INT_NAMEPATH_OP
Definition: amlcode.h:205
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define ACPI_NS_DONT_OPEN_SCOPE
Definition: acnamesp.h:64
smooth NULL
Definition: ftsmooth.c:416
ACPI_OBJECT_REFERENCE Reference
Definition: acobject.h:537
ACPI_GENERIC_STATE * ScopeInfo
Definition: acstruct.h:124
#define ACPI_TYPE_ANY
Definition: actypes.h:678
Status
Definition: gdiplustypes.h:24
ACPI_STATUS AcpiDsInitObjectFromOp(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, UINT16 Opcode, ACPI_OPERAND_OBJECT **RetObjDesc)
Definition: dsobject.c:373
#define ACPI_CAST_INDIRECT_PTR(t, p)
Definition: actypes.h:545
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
ACPI_STATE_COMMON ACPI_NAMESPACE_NODE * Node
Definition: aclocal.h:740
ACPI_NAMESPACE_NODE * Node
Definition: acobject.h:444
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
#define AcpiUtCreateInternalObject(t)
Definition: acutils.h:654
#define ACPI_ERROR_NAMESPACE(s, p, e)
Definition: acmacros.h:462
#define AML_PACKAGE_OP
Definition: amlcode.h:62
ACPI_SCOPE_STATE Scope
Definition: aclocal.h:825

Referenced by AcpiDsBuildInternalPackageObj(), and AcpiDsCreateNode().

◆ AcpiDsBuildInternalPackageObj()

ACPI_STATUS AcpiDsBuildInternalPackageObj ( ACPI_WALK_STATE WalkState,
ACPI_PARSE_OBJECT op,
UINT32  PackageLength,
ACPI_OPERAND_OBJECT **  ObjDesc 
)

Definition at line 94 of file dspkginit.c.

99 {
100  ACPI_PARSE_OBJECT *Arg;
102  ACPI_OPERAND_OBJECT *ObjDesc = NULL;
104  BOOLEAN ModuleLevelCode = FALSE;
105  UINT16 ReferenceCount;
106  UINT32 Index;
107  UINT32 i;
108 
109 
110  ACPI_FUNCTION_TRACE (DsBuildInternalPackageObj);
111 
112 
113  /* Check if we are executing module level code */
114 
115  if (WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL)
116  {
117  ModuleLevelCode = TRUE;
118  }
119 
120  /* Find the parent of a possibly nested package */
121 
122  Parent = Op->Common.Parent;
123  while ((Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
124  (Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP))
125  {
126  Parent = Parent->Common.Parent;
127  }
128 
129  /*
130  * If we are evaluating a Named package object of the form:
131  * Name (xxxx, Package)
132  * the package object already exists, otherwise it must be created.
133  */
134  ObjDesc = *ObjDescPtr;
135  if (!ObjDesc)
136  {
138  *ObjDescPtr = ObjDesc;
139  if (!ObjDesc)
140  {
142  }
143 
144  ObjDesc->Package.Node = Parent->Common.Node;
145  }
146 
147  if (ObjDesc->Package.Flags & AOPOBJ_DATA_VALID) /* Just in case */
148  {
150  }
151 
152  /*
153  * Allocate the element array (array of pointers to the individual
154  * objects) if necessary. the count is based on the NumElements
155  * parameter. Add an extra pointer slot so that the list is always
156  * null terminated.
157  */
158  if (!ObjDesc->Package.Elements)
159  {
161  ((ACPI_SIZE) ElementCount + 1) * sizeof (void *));
162 
163  if (!ObjDesc->Package.Elements)
164  {
165  AcpiUtDeleteObjectDesc (ObjDesc);
167  }
168 
169  ObjDesc->Package.Count = ElementCount;
170  }
171 
172  /* First arg is element count. Second arg begins the initializer list */
173 
174  Arg = Op->Common.Value.Arg;
175  Arg = Arg->Common.Next;
176 
177  /*
178  * If we are executing module-level code, we will defer the
179  * full resolution of the package elements in order to support
180  * forward references from the elements. This provides
181  * compatibility with other ACPI implementations.
182  */
183  if (ModuleLevelCode)
184  {
185  ObjDesc->Package.AmlStart = WalkState->Aml;
186  ObjDesc->Package.AmlLength = 0;
187 
189  "%s: Deferring resolution of Package elements\n",
191  }
192 
193  /*
194  * Initialize the elements of the package, up to the NumElements count.
195  * Package is automatically padded with uninitialized (NULL) elements
196  * if NumElements is greater than the package list length. Likewise,
197  * Package is truncated if NumElements is less than the list length.
198  */
199  for (i = 0; Arg && (i < ElementCount); i++)
200  {
201  if (Arg->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP)
202  {
203  if (!Arg->Common.Node)
204  {
205  /*
206  * This is the case where an expression has returned a value.
207  * The use of expressions (TermArgs) within individual
208  * package elements is not supported by the AML interpreter,
209  * even though the ASL grammar supports it. Example:
210  *
211  * Name (INT1, 0x1234)
212  *
213  * Name (PKG3, Package () {
214  * Add (INT1, 0xAAAA0000)
215  * })
216  *
217  * 1) No known AML interpreter supports this type of construct
218  * 2) This fixes a fault if the construct is encountered
219  */
221  "Expressions within package elements are not supported"));
222 
223  /* Cleanup the return object, it is not needed */
224 
225  AcpiUtRemoveReference (WalkState->Results->Results.ObjDesc[0]);
227  }
228 
229  if (Arg->Common.Node->Type == ACPI_TYPE_METHOD)
230  {
231  /*
232  * A method reference "looks" to the parser to be a method
233  * invocation, so we special case it here
234  */
235  Arg->Common.AmlOpcode = AML_INT_NAMEPATH_OP;
237  WalkState, Arg, &ObjDesc->Package.Elements[i]);
238  }
239  else
240  {
241  /* This package element is already built, just get it */
242 
243  ObjDesc->Package.Elements[i] =
245  }
246  }
247  else
248  {
250  WalkState, Arg, &ObjDesc->Package.Elements[i]);
251  if (Status == AE_NOT_FOUND)
252  {
253  ACPI_ERROR ((AE_INFO, "%-48s", "****DS namepath not found"));
254  }
255 
256  if (!ModuleLevelCode)
257  {
258  /*
259  * Initialize this package element. This function handles the
260  * resolution of named references within the package.
261  * Forward references from module-level code are deferred
262  * until all ACPI tables are loaded.
263  */
265  NULL, &ObjDesc->Package.Elements[i]);
266  }
267  }
268 
269  if (*ObjDescPtr)
270  {
271  /* Existing package, get existing reference count */
272 
273  ReferenceCount = (*ObjDescPtr)->Common.ReferenceCount;
274  if (ReferenceCount > 1)
275  {
276  /* Make new element ref count match original ref count */
277  /* TBD: Probably need an AcpiUtAddReferences function */
278 
279  for (Index = 0; Index < ((UINT32) ReferenceCount - 1); Index++)
280  {
281  AcpiUtAddReference ((ObjDesc->Package.Elements[i]));
282  }
283  }
284  }
285 
286  Arg = Arg->Common.Next;
287  }
288 
289  /* Check for match between NumElements and actual length of PackageList */
290 
291  if (Arg)
292  {
293  /*
294  * NumElements was exhausted, but there are remaining elements in
295  * the PackageList. Truncate the package to NumElements.
296  *
297  * Note: technically, this is an error, from ACPI spec: "It is an
298  * error for NumElements to be less than the number of elements in
299  * the PackageList". However, we just print a message and no
300  * exception is returned. This provides compatibility with other
301  * ACPI implementations. Some firmware implementations will alter
302  * the NumElements on the fly, possibly creating this type of
303  * ill-formed package object.
304  */
305  while (Arg)
306  {
307  /*
308  * We must delete any package elements that were created earlier
309  * and are not going to be used because of the package truncation.
310  */
311  if (Arg->Common.Node)
312  {
315  Arg->Common.Node = NULL;
316  }
317 
318  /* Find out how many elements there really are */
319 
320  i++;
321  Arg = Arg->Common.Next;
322  }
323 
324  ACPI_INFO ((
325  "Actual Package length (%u) is larger than "
326  "NumElements field (%u), truncated",
327  i, ElementCount));
328  }
329  else if (i < ElementCount)
330  {
331  /*
332  * Arg list (elements) was exhausted, but we did not reach
333  * NumElements count.
334  *
335  * Note: this is not an error, the package is padded out
336  * with NULLs as per the ACPI specification.
337  */
339  "%s: Package List length (%u) smaller than NumElements "
340  "count (%u), padded with null elements\n",
341  ACPI_GET_FUNCTION_NAME, i, ElementCount));
342  }
343 
344  /* Module-level packages will be resolved later */
345 
346  if (!ModuleLevelCode)
347  {
348  ObjDesc->Package.Flags |= AOPOBJ_DATA_VALID;
349  }
350 
351  Op->Common.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjDesc);
353 }
#define ACPI_EXCEPTION(plist)
Definition: acoutput.h:239
#define ACPI_DEBUG_PRINT_RAW(pl)
Definition: acoutput.h:476
void AcpiUtAddReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:746
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
#define ACPI_ALLOCATE_ZEROED(a)
Definition: actypes.h:385
#define TRUE
Definition: types.h:120
ACPI_GENERIC_STATE * Results
Definition: acstruct.h:122
ACPI_OBJECT_COMMON_HEADER ACPI_NAMESPACE_NODE * Node
Definition: acobject.h:160
#define AE_NO_MEMORY
Definition: acexcep.h:112
ACPI_OBJECT_PACKAGE Package
Definition: acobject.h:520
ACPI_STATE_COMMON union acpi_operand_object * ObjDesc[ACPI_RESULTS_FRAME_OBJ_NUM]
Definition: aclocal.h:779
void AcpiUtDeleteObjectDesc(ACPI_OPERAND_OBJECT *Object)
Definition: utobject.c:473
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:722
#define ACPI_DB_PARSE
Definition: acoutput.h:162
UINT32 ParseFlags
Definition: acstruct.h:95
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define AML_VARIABLE_PACKAGE_OP
Definition: amlcode.h:63
#define AML_INT_NAMEPATH_OP
Definition: amlcode.h:205
#define ACPI_TYPE_PACKAGE
Definition: actypes.h:682
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT32
unsigned char BOOLEAN
#define AE_INFO
Definition: acoutput.h:230
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_TYPE_METHOD
Definition: actypes.h:686
static const UCHAR Index[8]
Definition: usbohci.c:18
#define AML_INT_RETURN_VALUE_OP
Definition: amlcode.h:211
#define AE_SUPPORT
Definition: acexcep.h:123
#define AE_NOT_FOUND
Definition: acexcep.h:113
#define ACPI_INFO(plist)
Definition: acoutput.h:237
#define ACPI_GET_FUNCTION_NAME
Definition: acgcc.h:67
Status
Definition: gdiplustypes.h:24
#define ACPI_DB_INFO
Definition: acoutput.h:153
ACPI_STATUS AcpiDsInitPackageElement(UINT8 ObjectType, ACPI_OPERAND_OBJECT *SourceObject, ACPI_GENERIC_STATE *State, void *Context)
Definition: dspkginit.c:369
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_PARSE_MODULE_LEVEL
Definition: acparser.h:67
ACPI_RESULT_VALUES Results
Definition: aclocal.h:829
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
unsigned short UINT16
ACPI_STATUS AcpiDsBuildInternalObject(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, ACPI_OPERAND_OBJECT **ObjDescPtr)
Definition: dsobject.c:72
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AOPOBJ_DATA_VALID
Definition: acobject.h:96
#define AcpiUtCreateInternalObject(t)
Definition: acutils.h:654
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
#define AE_OK
Definition: acexcep.h:97
#define AML_PACKAGE_OP
Definition: amlcode.h:62
union acpi_operand_object ** Elements
Definition: acobject.h:161
UINT8 * Aml
Definition: acstruct.h:91

Referenced by AcpiDsEvalDataObjectOperands().

◆ AcpiDsCallControlMethod()

ACPI_STATUS AcpiDsCallControlMethod ( ACPI_THREAD_STATE Thread,
ACPI_WALK_STATE WalkState,
ACPI_PARSE_OBJECT Op 
)

Definition at line 531 of file dsmethod.c.

535 {
537  ACPI_NAMESPACE_NODE *MethodNode;
538  ACPI_WALK_STATE *NextWalkState = NULL;
539  ACPI_OPERAND_OBJECT *ObjDesc;
541  UINT32 i;
542 
543 
544  ACPI_FUNCTION_TRACE_PTR (DsCallControlMethod, ThisWalkState);
545 
547  "Calling method %p, currentstate=%p\n",
548  ThisWalkState->PrevOp, ThisWalkState));
549 
550  /*
551  * Get the namespace entry for the control method we are about to call
552  */
553  MethodNode = ThisWalkState->MethodCallNode;
554  if (!MethodNode)
555  {
557  }
558 
559  ObjDesc = AcpiNsGetAttachedObject (MethodNode);
560  if (!ObjDesc)
561  {
563  }
564 
565  /* Init for new method, possibly wait on method mutex */
566 
568  MethodNode, ObjDesc, ThisWalkState);
569  if (ACPI_FAILURE (Status))
570  {
572  }
573 
574  /* Begin method parse/execution. Create a new walk state */
575 
576  NextWalkState = AcpiDsCreateWalkState (
577  ObjDesc->Method.OwnerId, NULL, ObjDesc, Thread);
578  if (!NextWalkState)
579  {
581  goto Cleanup;
582  }
583 
584  /*
585  * The resolved arguments were put on the previous walk state's operand
586  * stack. Operands on the previous walk state stack always
587  * start at index 0. Also, null terminate the list of arguments
588  */
589  ThisWalkState->Operands [ThisWalkState->NumOperands] = NULL;
590 
591  /*
592  * Allocate and initialize the evaluation information block
593  * TBD: this is somewhat inefficient, should change interface to
594  * DsInitAmlWalk. For now, keeps this struct off the CPU stack
595  */
597  if (!Info)
598  {
600  goto Cleanup;
601  }
602 
603  Info->Parameters = &ThisWalkState->Operands[0];
604 
605  Status = AcpiDsInitAmlWalk (NextWalkState, NULL, MethodNode,
606  ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength,
608 
609  ACPI_FREE (Info);
610  if (ACPI_FAILURE (Status))
611  {
612  goto Cleanup;
613  }
614 
615  NextWalkState->MethodNestingDepth = ThisWalkState->MethodNestingDepth + 1;
616 
617  /*
618  * Delete the operands on the previous walkstate operand stack
619  * (they were copied to new objects)
620  */
621  for (i = 0; i < ObjDesc->Method.ParamCount; i++)
622  {
623  AcpiUtRemoveReference (ThisWalkState->Operands [i]);
624  ThisWalkState->Operands [i] = NULL;
625  }
626 
627  /* Clear the operand stack */
628 
629  ThisWalkState->NumOperands = 0;
630 
632  "**** Begin nested execution of [%4.4s] **** WalkState=%p\n",
633  MethodNode->Name.Ascii, NextWalkState));
634 
635  ThisWalkState->MethodPathname = AcpiNsGetNormalizedPathname (MethodNode, TRUE);
636  ThisWalkState->MethodIsNested = TRUE;
637 
638  /* Optional object evaluation log */
639 
641  "%-26s: %*s%s\n", " Nested method call",
642  NextWalkState->MethodNestingDepth * 3, " ",
643  &ThisWalkState->MethodPathname[1]));
644 
645  /* Invoke an internal method if necessary */
646 
648  {
649  Status = ObjDesc->Method.Dispatch.Implementation (NextWalkState);
650  if (Status == AE_OK)
651  {
653  }
654  }
655 
657 
658 
659 Cleanup:
660 
661  /* On error, we must terminate the method properly */
662 
663  AcpiDsTerminateControlMethod (ObjDesc, NextWalkState);
664  AcpiDsDeleteWalkState (NextWalkState);
665 
667 }
#define ACPI_DEBUG_PRINT_RAW(pl)
Definition: acoutput.h:476
#define AE_NULL_OBJECT
Definition: acexcep.h:117
#define ACPI_FREE(a)
Definition: actypes.h:386
UINT8 * AmlStart
Definition: acobject.h:220
#define ACPI_ALLOCATE_ZEROED(a)
Definition: actypes.h:385
#define TRUE
Definition: types.h:120
ACPI_STATUS AcpiDsInitAmlWalk(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, ACPI_NAMESPACE_NODE *MethodNode, UINT8 *AmlStart, UINT32 AmlLength, ACPI_EVALUATE_INFO *Info, UINT8 PassNumber)
Definition: dswstate.c:662
void AcpiDsDeleteWalkState(ACPI_WALK_STATE *WalkState)
Definition: dswstate.c:780
ACPI_WALK_STATE * AcpiDsCreateWalkState(ACPI_OWNER_ID OwnerId, ACPI_PARSE_OBJECT *Origin, ACPI_OPERAND_OBJECT *MethodDesc, ACPI_THREAD_STATE *Thread)
Definition: dswstate.c:600
#define AE_NO_MEMORY
Definition: acexcep.h:112
union acpi_object_method::@596 Dispatch
ACPI_OBJECT_COMMON_HEADER UINT8 InfoFlags
Definition: acobject.h:215
char Ascii[4]
Definition: actbl.h:394
UINT32 ACPI_STATUS
Definition: actypes.h:460
struct TraceInfo Info
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define AE_CTRL_TERMINATE
Definition: acexcep.h:226
unsigned int UINT32
smooth NULL
Definition: ftsmooth.c:416
ACPI_NAME_UNION Name
Definition: aclocal.h:191
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
#define ACPI_DB_DISPATCH
Definition: acoutput.h:163
#define ACPI_METHOD_INTERNAL_ONLY
Definition: acobject.h:236
ACPI_STATUS AcpiDsBeginMethodExecution(ACPI_NAMESPACE_NODE *MethodNode, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_WALK_STATE *WalkState)
Definition: dsmethod.c:352
UINT16 MethodNestingDepth
Definition: acstruct.h:100
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
ACPI_INTERNAL_METHOD Implementation
Definition: acobject.h:223
static const WCHAR Cleanup[]
Definition: register.c:80
Status
Definition: gdiplustypes.h:24
ACPI_OBJECT_METHOD Method
Definition: acobject.h:522
char * AcpiNsGetNormalizedPathname(ACPI_NAMESPACE_NODE *Node, BOOLEAN NoTrailing)
Definition: nsnames.c:373
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
#define AE_NULL_ENTRY
Definition: acexcep.h:118
#define ACPI_DB_EVALUATION
Definition: acoutput.h:181
ACPI_OWNER_ID OwnerId
Definition: acobject.h:228
#define AE_OK
Definition: acexcep.h:97
void AcpiDsTerminateControlMethod(ACPI_OPERAND_OBJECT *MethodDesc, ACPI_WALK_STATE *WalkState)
Definition: dsmethod.c:779

Referenced by AcpiPsParseAml().

◆ AcpiDsClearImplicitReturn()

void AcpiDsClearImplicitReturn ( ACPI_WALK_STATE WalkState)

Definition at line 73 of file dsutils.c.

75 {
76  ACPI_FUNCTION_NAME (DsClearImplicitReturn);
77 
78 
79  /*
80  * Slack must be enabled for this feature
81  */
82  if (!AcpiGbl_EnableInterpreterSlack)
83  {
84  return;
85  }
86 
87  if (WalkState->ImplicitReturnObj)
88  {
89  /*
90  * Delete any "stale" implicit return. However, in
91  * complex statements, the implicit return value can be
92  * bubbled up several levels.
93  */
95  "Removing reference on stale implicit return obj %p\n",
96  WalkState->ImplicitReturnObj));
97 
99  WalkState->ImplicitReturnObj = NULL;
100  }
101 }
union acpi_operand_object * ImplicitReturnObj
Definition: acstruct.h:112
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_DB_DISPATCH
Definition: acoutput.h:163
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
#define ACPI_FUNCTION_NAME(a)
Definition: acoutput.h:479

Referenced by AcpiDsDoImplicitReturn(), AcpiDsExecEndControlOp(), AcpiDsMethodError(), and AcpiPsParseAml().

◆ AcpiDsClearOperands()

void AcpiDsClearOperands ( ACPI_WALK_STATE WalkState)

Definition at line 453 of file dsutils.c.

455 {
456  UINT32 i;
457 
458 
459  ACPI_FUNCTION_TRACE_PTR (DsClearOperands, WalkState);
460 
461 
462  /* Remove a reference on each operand on the stack */
463 
464  for (i = 0; i < WalkState->NumOperands; i++)
465  {
466  /*
467  * Remove a reference to all operands, including both
468  * "Arguments" and "Targets".
469  */
470  AcpiUtRemoveReference (WalkState->Operands[i]);
471  WalkState->Operands[i] = NULL;
472  }
473 
474  WalkState->NumOperands = 0;
475  return_VOID;
476 }
UINT8 NumOperands
Definition: acstruct.h:80
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT32
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
#define return_VOID
Definition: acoutput.h:495
union acpi_operand_object * Operands[ACPI_OBJ_NUM_OPERANDS+1]
Definition: acstruct.h:105
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784

Referenced by AcpiDsExecEndOp().

◆ AcpiDsCreateBankField()

ACPI_STATUS AcpiDsCreateBankField ( ACPI_PARSE_OBJECT Op,
ACPI_NAMESPACE_NODE RegionNode,
ACPI_WALK_STATE WalkState 
)

Definition at line 739 of file dsfield.c.

743 {
745  ACPI_PARSE_OBJECT *Arg;
747 
748 
749  ACPI_FUNCTION_TRACE_PTR (DsCreateBankField, Op);
750 
751 
752  /* First arg is the name of the parent OpRegion (must already exist) */
753 
754  Arg = Op->Common.Value.Arg;
755  if (!RegionNode)
756  {
757  Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name,
759  ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode);
760 #ifdef ACPI_ASL_COMPILER
761  Status = AcpiDsCreateExternalRegion (Status, Arg,
762  Arg->Common.Value.Name, WalkState, &RegionNode);
763 #endif
764  if (ACPI_FAILURE (Status))
765  {
766  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
767  Arg->Common.Value.Name, Status);
769  }
770  }
771 
772  /* Second arg is the Bank Register (Field) (must already exist) */
773 
774  Arg = Arg->Common.Next;
775  Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
777  ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode);
778  if (ACPI_FAILURE (Status))
779  {
780  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
781  Arg->Common.Value.String, Status);
783  }
784 
785  /*
786  * Third arg is the BankValue
787  * This arg is a TermArg, not a constant
788  * It will be evaluated later, by AcpiDsEvalBankFieldOperands
789  */
790  Arg = Arg->Common.Next;
791 
792  /* Fourth arg is the field flags */
793 
794  Arg = Arg->Common.Next;
795  Info.FieldFlags = (UINT8) Arg->Common.Value.Integer;
796 
797  /* Each remaining arg is a Named Field */
798 
799  Info.FieldType = ACPI_TYPE_LOCAL_BANK_FIELD;
800  Info.RegionNode = RegionNode;
801 
802  /*
803  * Use Info.DataRegisterNode to store BankField Op
804  * It's safe because DataRegisterNode will never be used when create
805  * bank field \we store AmlStart and AmlLength in the BankField Op for
806  * late evaluation. Used in AcpiExPrepFieldValue(Info)
807  *
808  * TBD: Or, should we add a field in ACPI_CREATE_FIELD_INFO, like
809  * "void *ParentOp"?
810  */
811  Info.DataRegisterNode = (ACPI_NAMESPACE_NODE*) Op;
812 
813  Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next);
815 }
#define ACPI_NS_SEARCH_PARENT
Definition: acnamesp.h:63
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
ACPI_STATUS AcpiNsLookup(ACPI_GENERIC_STATE *ScopeInfo, char *Name, ACPI_OBJECT_TYPE Type, ACPI_INTERPRETER_MODE InterpreterMode, UINT32 Flags, ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE **RetNode)
Definition: nsaccess.c:329
UINT32 ACPI_STATUS
Definition: actypes.h:460
struct TraceInfo Info
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
static ACPI_STATUS AcpiDsGetFieldNames(ACPI_CREATE_FIELD_INFO *Info, ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Arg)
Definition: dsfield.c:320
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
ACPI_GENERIC_STATE * ScopeInfo
Definition: acstruct.h:124
#define ACPI_TYPE_ANY
Definition: actypes.h:678
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_TYPE_REGION
Definition: actypes.h:688
#define ACPI_TYPE_LOCAL_BANK_FIELD
Definition: actypes.h:708
#define ACPI_ERROR_NAMESPACE(s, p, e)
Definition: acmacros.h:462
unsigned char UINT8

Referenced by AcpiDsLoad2EndOp().

◆ AcpiDsCreateBufferField()

ACPI_STATUS AcpiDsCreateBufferField ( ACPI_PARSE_OBJECT Op,
ACPI_WALK_STATE WalkState 
)

Definition at line 165 of file dsfield.c.

168 {
169  ACPI_PARSE_OBJECT *Arg;
172  ACPI_OPERAND_OBJECT *ObjDesc;
173  ACPI_OPERAND_OBJECT *SecondDesc = NULL;
174  UINT32 Flags;
175 
176 
177  ACPI_FUNCTION_TRACE (DsCreateBufferField);
178 
179 
180  /*
181  * Get the NameString argument (name of the new BufferField)
182  */
183  if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP)
184  {
185  /* For CreateField, name is the 4th argument */
186 
187  Arg = AcpiPsGetArg (Op, 3);
188  }
189  else
190  {
191  /* For all other CreateXXXField operators, name is the 3rd argument */
192 
193  Arg = AcpiPsGetArg (Op, 2);
194  }
195 
196  if (!Arg)
197  {
199  }
200 
201  if (WalkState->DeferredNode)
202  {
203  Node = WalkState->DeferredNode;
204  Status = AE_OK;
205  }
206  else
207  {
208  /* Execute flag should always be set when this function is entered */
209 
210  if (!(WalkState->ParseFlags & ACPI_PARSE_EXECUTE))
211  {
213  "Parse execute mode is not set"));
215  }
216 
217  /* Creating new namespace node, should not already exist */
218 
221 
222  /*
223  * Mark node temporary if we are executing a normal control
224  * method. (Don't mark if this is a module-level code method)
225  */
226  if (WalkState->MethodNode &&
227  !(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL))
228  {
230  }
231 
232  /* Enter the NameString into the namespace */
233 
234  Status = AcpiNsLookup (WalkState->ScopeInfo,
235  Arg->Common.Value.String, ACPI_TYPE_ANY,
236  ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node);
237  if (ACPI_FAILURE (Status))
238  {
239  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
240  Arg->Common.Value.String, Status);
242  }
243  }
244 
245  /*
246  * We could put the returned object (Node) on the object stack for later,
247  * but for now, we will put it in the "op" object that the parser uses,
248  * so we can get it again at the end of this scope.
249  */
250  Op->Common.Node = Node;
251 
252  /*
253  * If there is no object attached to the node, this node was just created
254  * and we need to create the field object. Otherwise, this was a lookup
255  * of an existing node and we don't want to create the field object again.
256  */
257  ObjDesc = AcpiNsGetAttachedObject (Node);
258  if (ObjDesc)
259  {
261  }
262 
263  /*
264  * The Field definition is not fully parsed at this time.
265  * (We must save the address of the AML for the buffer and index operands)
266  */
267 
268  /* Create the buffer field object */
269 
271  if (!ObjDesc)
272  {
274  goto Cleanup;
275  }
276 
277  /*
278  * Remember location in AML stream of the field unit opcode and operands
279  * -- since the buffer and index operands must be evaluated.
280  */
281  SecondDesc = ObjDesc->Common.NextObject;
282  SecondDesc->Extra.AmlStart = Op->Named.Data;
283  SecondDesc->Extra.AmlLength = Op->Named.Length;
284  ObjDesc->BufferField.Node = Node;
285 
286  /* Attach constructed field descriptors to parent node */
287 
289  if (ACPI_FAILURE (Status))
290  {
291  goto Cleanup;
292  }
293 
294 
295 Cleanup:
296 
297  /* Remove local reference to the object */
298 
299  AcpiUtRemoveReference (ObjDesc);
301 }
#define ACPI_NS_TEMPORARY
Definition: acnamesp.h:69
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
ACPI_STATUS AcpiNsLookup(ACPI_GENERIC_STATE *ScopeInfo, char *Name, ACPI_OBJECT_TYPE Type, ACPI_INTERPRETER_MODE InterpreterMode, UINT32 Flags, ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE **RetNode)
Definition: nsaccess.c:329
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define AE_AML_INTERNAL
Definition: acexcep.h:194
#define AE_AML_NO_OPERAND
Definition: acexcep.h:181
struct acpi_namespace_node * DeferredNode
Definition: acstruct.h:111
#define ACPI_NS_ERROR_IF_FOUND
Definition: acnamesp.h:66
UINT8 * AmlStart
Definition: acobject.h:481
UINT32 ParseFlags
Definition: acstruct.h:95
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_PARSE_EXECUTE
Definition: acparser.h:61
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_OBJECT_EXTRA Extra
Definition: acobject.h:538
unsigned int UINT32
union node Node
Definition: types.h:1255
#define ACPI_NS_DONT_OPEN_SCOPE
Definition: acnamesp.h:64
#define AML_CREATE_FIELD_OP
Definition: amlcode.h:163
#define AE_INFO
Definition: acoutput.h:230
smooth NULL
Definition: ftsmooth.c:416
ACPI_PARSE_OBJ_NAMED Named
Definition: aclocal.h:1079
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
ACPI_GENERIC_STATE * ScopeInfo
Definition: acstruct.h:124
#define ACPI_TYPE_ANY
Definition: actypes.h:678
static const WCHAR Cleanup[]
Definition: register.c:80
struct acpi_namespace_node * MethodNode
Definition: acstruct.h:116
Status
Definition: gdiplustypes.h:24
ACPI_STATUS AcpiNsAttachObject(ACPI_NAMESPACE_NODE *Node, ACPI_OPERAND_OBJECT *Object, ACPI_OBJECT_TYPE Type)
Definition: nsobject.c:76
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_NS_NO_UPSEARCH
Definition: acnamesp.h:62
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_PARSE_MODULE_LEVEL
Definition: acparser.h:67
#define ACPI_TYPE_BUFFER_FIELD
Definition: actypes.h:692
ACPI_OBJECT_COMMON Common
Definition: acobject.h:516
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
ACPI_PARSE_OBJECT * AcpiPsGetArg(ACPI_PARSE_OBJECT *op, UINT32 argn)
Definition: pstree.c:76
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AcpiUtCreateInternalObject(t)
Definition: acutils.h:654
ACPI_OBJECT_BUFFER_FIELD BufferField
Definition: acobject.h:532
#define ACPI_ERROR_NAMESPACE(s, p, e)
Definition: acmacros.h:462
#define AE_OK
Definition: acexcep.h:97
UINT32 AmlLength
Definition: acobject.h:482
Definition: dlist.c:348

Referenced by AcpiDsLoad2EndOp().

◆ AcpiDsCreateField()

ACPI_STATUS AcpiDsCreateField ( ACPI_PARSE_OBJECT Op,
ACPI_NAMESPACE_NODE RegionNode,
ACPI_WALK_STATE WalkState 
)

Definition at line 532 of file dsfield.c.

536 {
538  ACPI_PARSE_OBJECT *Arg;
540 
541 
542  ACPI_FUNCTION_TRACE_PTR (DsCreateField, Op);
543 
544 
545  /* First arg is the name of the parent OpRegion (must already exist) */
546 
547  Arg = Op->Common.Value.Arg;
548 
549  if (!RegionNode)
550  {
551  Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name,
553  ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode);
554 #ifdef ACPI_ASL_COMPILER
555  Status = AcpiDsCreateExternalRegion (Status, Arg,
556  Arg->Common.Value.Name, WalkState, &RegionNode);
557 #endif
558  if (ACPI_FAILURE (Status))
559  {
560  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
561  Arg->Common.Value.Name, Status);
563  }
564  }
565 
566  memset (&Info, 0, sizeof (ACPI_CREATE_FIELD_INFO));
567 
568  /* Second arg is the field flags */
569 
570  Arg = Arg->Common.Next;
571  Info.FieldFlags = (UINT8) Arg->Common.Value.Integer;
572  Info.Attribute = 0;
573 
574  /* Each remaining arg is a Named Field */
575 
577  Info.RegionNode = RegionNode;
578 
579  Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next);
580  if (Info.RegionNode->Object->Region.SpaceId == ACPI_ADR_SPACE_PLATFORM_COMM &&
581  !(RegionNode->Object->Field.InternalPccBuffer
582  = ACPI_ALLOCATE_ZEROED(Info.RegionNode->Object->Region.Length)))
583  {
585  }
587 }
#define ACPI_NS_SEARCH_PARENT
Definition: acnamesp.h:63
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
union acpi_operand_object * Object
Definition: aclocal.h:187
#define ACPI_ALLOCATE_ZEROED(a)
Definition: actypes.h:385
ACPI_STATUS AcpiNsLookup(ACPI_GENERIC_STATE *ScopeInfo, char *Name, ACPI_OBJECT_TYPE Type, ACPI_INTERPRETER_MODE InterpreterMode, UINT32 Flags, ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE **RetNode)
Definition: nsaccess.c:329
#define AE_NO_MEMORY
Definition: acexcep.h:112
UINT32 ACPI_STATUS
Definition: actypes.h:460
struct TraceInfo Info
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define ACPI_ADR_SPACE_PLATFORM_COMM
Definition: actypes.h:861
static ACPI_STATUS AcpiDsGetFieldNames(ACPI_CREATE_FIELD_INFO *Info, ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Arg)
Definition: dsfield.c:320
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
#define ACPI_TYPE_LOCAL_REGION_FIELD
Definition: actypes.h:707
ACPI_GENERIC_STATE * ScopeInfo
Definition: acstruct.h:124
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
ACPI_OBJECT_REGION_FIELD Field
Definition: acobject.h:531
#define ACPI_TYPE_REGION
Definition: actypes.h:688
#define ACPI_ERROR_NAMESPACE(s, p, e)
Definition: acmacros.h:462
unsigned char UINT8
#define memset(x, y, z)
Definition: compat.h:39

Referenced by AcpiDsLoad2EndOp().

◆ AcpiDsCreateIndexField()

ACPI_STATUS AcpiDsCreateIndexField ( ACPI_PARSE_OBJECT Op,
ACPI_NAMESPACE_NODE RegionNode,
ACPI_WALK_STATE WalkState 
)

Definition at line 833 of file dsfield.c.

837 {
839  ACPI_PARSE_OBJECT *Arg;
841 
842 
843  ACPI_FUNCTION_TRACE_PTR (DsCreateIndexField, Op);
844 
845 
846  /* First arg is the name of the Index register (must already exist) */
847 
848  Arg = Op->Common.Value.Arg;
849  Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
851  ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode);
852  if (ACPI_FAILURE (Status))
853  {
854  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
855  Arg->Common.Value.String, Status);
857  }
858 
859  /* Second arg is the data register (must already exist) */
860 
861  Arg = Arg->Common.Next;
862  Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
864  ACPI_NS_SEARCH_PARENT, WalkState, &Info.DataRegisterNode);
865  if (ACPI_FAILURE (Status))
866  {
867  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
868  Arg->Common.Value.String, Status);
870  }
871 
872  /* Next arg is the field flags */
873 
874  Arg = Arg->Common.Next;
875  Info.FieldFlags = (UINT8) Arg->Common.Value.Integer;
876 
877  /* Each remaining arg is a Named Field */
878 
879  Info.FieldType = ACPI_TYPE_LOCAL_INDEX_FIELD;
880  Info.RegionNode = RegionNode;
881 
882  Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next);
884 }
#define ACPI_NS_SEARCH_PARENT
Definition: acnamesp.h:63
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
ACPI_STATUS AcpiNsLookup(ACPI_GENERIC_STATE *ScopeInfo, char *Name, ACPI_OBJECT_TYPE Type, ACPI_INTERPRETER_MODE InterpreterMode, UINT32 Flags, ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE **RetNode)
Definition: nsaccess.c:329
UINT32 ACPI_STATUS
Definition: actypes.h:460
struct TraceInfo Info
#define ACPI_TYPE_LOCAL_INDEX_FIELD
Definition: actypes.h:709
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
static ACPI_STATUS AcpiDsGetFieldNames(ACPI_CREATE_FIELD_INFO *Info, ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Arg)
Definition: dsfield.c:320
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
ACPI_GENERIC_STATE * ScopeInfo
Definition: acstruct.h:124
#define ACPI_TYPE_ANY
Definition: actypes.h:678
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_ERROR_NAMESPACE(s, p, e)
Definition: acmacros.h:462
unsigned char UINT8

Referenced by AcpiDsLoad2EndOp().

◆ AcpiDsCreateNode()

ACPI_STATUS AcpiDsCreateNode ( ACPI_WALK_STATE WalkState,
ACPI_NAMESPACE_NODE Node,
ACPI_PARSE_OBJECT Op 
)

Definition at line 302 of file dsobject.c.

306 {
308  ACPI_OPERAND_OBJECT *ObjDesc;
309 
310 
311  ACPI_FUNCTION_TRACE_PTR (DsCreateNode, Op);
312 
313 
314  /*
315  * Because of the execution pass through the non-control-method
316  * parts of the table, we can arrive here twice. Only init
317  * the named object node the first time through
318  */
320  {
322  }
323 
324  if (!Op->Common.Value.Arg)
325  {
326  /* No arguments, there is nothing to do */
327 
329  }
330 
331  /* Build an internal object for the argument(s) */
332 
334  WalkState, Op->Common.Value.Arg, &ObjDesc);
335  if (ACPI_FAILURE (Status))
336  {
338  }
339 
340  /* Re-type the object according to its argument */
341 
342  Node->Type = ObjDesc->Common.Type;
343 
344  /* Attach obj to node */
345 
346  Status = AcpiNsAttachObject (Node, ObjDesc, Node->Type);
347 
348  /* Remove local reference to the object */
349 
350  AcpiUtRemoveReference (ObjDesc);
352 }
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
Status
Definition: gdiplustypes.h:24
ACPI_STATUS AcpiNsAttachObject(ACPI_NAMESPACE_NODE *Node, ACPI_OPERAND_OBJECT *Object, ACPI_OBJECT_TYPE Type)
Definition: nsobject.c:76
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
ACPI_OBJECT_COMMON Common
Definition: acobject.h:516
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
ACPI_STATUS AcpiDsBuildInternalObject(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, ACPI_OPERAND_OBJECT **ObjDescPtr)
Definition: dsobject.c:72
#define AE_OK
Definition: acexcep.h:97
Definition: dlist.c:348

Referenced by AcpiDsExecEndOp(), and AcpiDsLoad2EndOp().

◆ AcpiDsCreateOperand()

ACPI_STATUS AcpiDsCreateOperand ( ACPI_WALK_STATE WalkState,
ACPI_PARSE_OBJECT Arg,
UINT32  ArgsRemaining 
)

Definition at line 497 of file dsutils.c.

501 {
503  char *NameString;
504  UINT32 NameLength;
505  ACPI_OPERAND_OBJECT *ObjDesc;
506  ACPI_PARSE_OBJECT *ParentOp;
507  UINT16 Opcode;
508  ACPI_INTERPRETER_MODE InterpreterMode;
509  const ACPI_OPCODE_INFO *OpInfo;
510 
511 
512  ACPI_FUNCTION_TRACE_PTR (DsCreateOperand, Arg);
513 
514 
515  /* A valid name must be looked up in the namespace */
516 
517  if ((Arg->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&
518  (Arg->Common.Value.String) &&
519  !(Arg->Common.Flags & ACPI_PARSEOP_IN_STACK))
520  {
521  ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Getting a name: Arg=%p\n", Arg));
522 
523  /* Get the entire name string from the AML stream */
524 
526  Arg->Common.Value.Buffer, &NameString, &NameLength);
527 
528  if (ACPI_FAILURE (Status))
529  {
531  }
532 
533  /* All prefixes have been handled, and the name is in NameString */
534 
535  /*
536  * Special handling for BufferField declarations. This is a deferred
537  * opcode that unfortunately defines the field name as the last
538  * parameter instead of the first. We get here when we are performing
539  * the deferred execution, so the actual name of the field is already
540  * in the namespace. We don't want to attempt to look it up again
541  * because we may be executing in a different scope than where the
542  * actual opcode exists.
543  */
544  if ((WalkState->DeferredNode) &&
545  (WalkState->DeferredNode->Type == ACPI_TYPE_BUFFER_FIELD) &&
546  (ArgIndex == (UINT32)
547  ((WalkState->Opcode == AML_CREATE_FIELD_OP) ? 3 : 2)))
548  {
549  ObjDesc = ACPI_CAST_PTR (
550  ACPI_OPERAND_OBJECT, WalkState->DeferredNode);
551  Status = AE_OK;
552  }
553  else /* All other opcodes */
554  {
555  /*
556  * Differentiate between a namespace "create" operation
557  * versus a "lookup" operation (IMODE_LOAD_PASS2 vs.
558  * IMODE_EXECUTE) in order to support the creation of
559  * namespace objects during the execution of control methods.
560  */
561  ParentOp = Arg->Common.Parent;
562  OpInfo = AcpiPsGetOpcodeInfo (ParentOp->Common.AmlOpcode);
563 
564  if ((OpInfo->Flags & AML_NSNODE) &&
565  (ParentOp->Common.AmlOpcode != AML_INT_METHODCALL_OP) &&
566  (ParentOp->Common.AmlOpcode != AML_REGION_OP) &&
567  (ParentOp->Common.AmlOpcode != AML_INT_NAMEPATH_OP))
568  {
569  /* Enter name into namespace if not found */
570 
571  InterpreterMode = ACPI_IMODE_LOAD_PASS2;
572  }
573  else
574  {
575  /* Return a failure if name not found */
576 
577  InterpreterMode = ACPI_IMODE_EXECUTE;
578  }
579 
580  Status = AcpiNsLookup (WalkState->ScopeInfo, NameString,
581  ACPI_TYPE_ANY, InterpreterMode,
584  /*
585  * The only case where we pass through (ignore) a NOT_FOUND
586  * error is for the CondRefOf opcode.
587  */
588  if (Status == AE_NOT_FOUND)
589  {
590  if (ParentOp->Common.AmlOpcode == AML_CONDITIONAL_REF_OF_OP)
591  {
592  /*
593  * For the Conditional Reference op, it's OK if
594  * the name is not found; We just need a way to
595  * indicate this to the interpreter, set the
596  * object to the root
597  */
598  ObjDesc = ACPI_CAST_PTR (
599  ACPI_OPERAND_OBJECT, AcpiGbl_RootNode);
600  Status = AE_OK;
601  }
602  else if (ParentOp->Common.AmlOpcode == AML_EXTERNAL_OP)
603  {
604  /*
605  * This opcode should never appear here. It is used only
606  * by AML disassemblers and is surrounded by an If(0)
607  * by the ASL compiler.
608  *
609  * Therefore, if we see it here, it is a serious error.
610  */
612  }
613  else
614  {
615  /*
616  * We just plain didn't find it -- which is a
617  * very serious error at this point
618  */
620  }
621  }
622 
623  if (ACPI_FAILURE (Status))
624  {
625  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
626  NameString, Status);
627  }
628  }
629 
630  /* Free the namestring created above */
631 
632  ACPI_FREE (NameString);
633 
634  /* Check status from the lookup */
635 
636  if (ACPI_FAILURE (Status))
637  {
639  }
640 
641  /* Put the resulting object onto the current object stack */
642 
643  Status = AcpiDsObjStackPush (ObjDesc, WalkState);
644  if (ACPI_FAILURE (Status))
645  {
647  }
648 
649  AcpiDbDisplayArgumentObject (ObjDesc, WalkState);
650  }
651  else
652  {
653  /* Check for null name case */
654 
655  if ((Arg->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&
656  !(Arg->Common.Flags & ACPI_PARSEOP_IN_STACK))
657  {
658  /*
659  * If the name is null, this means that this is an
660  * optional result parameter that was not specified
661  * in the original ASL. Create a Zero Constant for a
662  * placeholder. (Store to a constant is a Noop.)
663  */
664  Opcode = AML_ZERO_OP; /* Has no arguments! */
665 
667  "Null namepath: Arg=%p\n", Arg));
668  }
669  else
670  {
671  Opcode = Arg->Common.AmlOpcode;
672  }
673 
674  /* Get the object type of the argument */
675 
676  OpInfo = AcpiPsGetOpcodeInfo (Opcode);
677  if (OpInfo->ObjectType == ACPI_TYPE_INVALID)
678  {
680  }
681 
682  if ((OpInfo->Flags & AML_HAS_RETVAL) ||
683  (Arg->Common.Flags & ACPI_PARSEOP_IN_STACK))
684  {
685  /*
686  * Use value that was already previously returned
687  * by the evaluation of this argument
688  */
689  Status = AcpiDsResultPop (&ObjDesc, WalkState);
690  if (ACPI_FAILURE (Status))
691  {
692  /*
693  * Only error is underflow, and this indicates
694  * a missing or null operand!
695  */
697  "Missing or null operand"));
699  }
700  }
701  else
702  {
703  /* Create an ACPI_INTERNAL_OBJECT for the argument */
704 
705  ObjDesc = AcpiUtCreateInternalObject (OpInfo->ObjectType);
706  if (!ObjDesc)
707  {
709  }
710 
711  /* Initialize the new object */
712 
714  WalkState, Arg, Opcode, &ObjDesc);
715  if (ACPI_FAILURE (Status))
716  {
717  AcpiUtDeleteObjectDesc (ObjDesc);
719  }
720  }
721 
722  /* Put the operand object on the object stack */
723 
724  Status = AcpiDsObjStackPush (ObjDesc, WalkState);
725  if (ACPI_FAILURE (Status))
726  {
728  }
729 
730  AcpiDbDisplayArgumentObject (ObjDesc, WalkState);
731  }
732 
734 }
#define ACPI_EXCEPTION(plist)
Definition: acoutput.h:239
#define ACPI_NS_SEARCH_PARENT
Definition: acnamesp.h:63
#define ACPI_FREE(a)
Definition: actypes.h:386
ACPI_INTERPRETER_MODE
Definition: aclocal.h:165
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
_In_ PVOID _In_ ULONG Opcode
Definition: hubbusif.h:330
ACPI_STATUS AcpiNsLookup(ACPI_GENERIC_STATE *ScopeInfo, char *Name, ACPI_OBJECT_TYPE Type, ACPI_INTERPRETER_MODE InterpreterMode, UINT32 Flags, ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE **RetNode)
Definition: nsaccess.c:329
#define AE_NO_MEMORY
Definition: acexcep.h:112
ACPI_STATUS AcpiDsObjStackPush(void *Object, ACPI_WALK_STATE *WalkState)
Definition: dswstate.c:342
#define AML_INT_METHODCALL_OP
Definition: amlcode.h:210
UINT8 ObjectType
Definition: aclocal.h:874
ACPI_STATUS AcpiExGetNameString(ACPI_OBJECT_TYPE DataType, UINT8 *InAmlAddress, char **OutNameString, UINT32 *OutNameLength)
Definition: exnames.c:278
struct acpi_namespace_node * DeferredNode
Definition: acstruct.h:111
void AcpiUtDeleteObjectDesc(ACPI_OPERAND_OBJECT *Object)
Definition: utobject.c:473
const ACPI_OPCODE_INFO * AcpiPsGetOpcodeInfo(UINT16 Opcode)
Definition: psopinfo.c:72
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define AML_EXTERNAL_OP
Definition: amlcode.h:65
#define AML_REGION_OP
Definition: amlcode.h:180
#define AE_NOT_IMPLEMENTED
Definition: acexcep.h:122
#define AML_INT_NAMEPATH_OP
Definition: amlcode.h:205
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define AML_HAS_RETVAL
Definition: amlcode.h:327
unsigned int UINT32
#define ACPI_NS_DONT_OPEN_SCOPE
Definition: acnamesp.h:64
#define AML_NSNODE
Definition: amlcode.h:324
#define AML_CREATE_FIELD_OP
Definition: amlcode.h:163
#define AE_INFO
Definition: acoutput.h:230
#define AE_AML_BAD_OPCODE
Definition: acexcep.h:180
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
#define ACPI_DB_DISPATCH
Definition: acoutput.h:163
#define ACPI_PARSEOP_IN_STACK
Definition: aclocal.h:1121
#define ACPI_TYPE_INVALID
Definition: actypes.h:733
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define AE_AML_NAME_NOT_FOUND
Definition: acexcep.h:193
#define AE_NOT_FOUND
Definition: acexcep.h:113
ACPI_GENERIC_STATE * ScopeInfo
Definition: acstruct.h:124
#define ACPI_TYPE_ANY
Definition: actypes.h:678
#define AML_CONDITIONAL_REF_OF_OP
Definition: amlcode.h:162
Status
Definition: gdiplustypes.h:24
ACPI_STATUS AcpiDsInitObjectFromOp(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, UINT16 Opcode, ACPI_OPERAND_OBJECT **RetObjDesc)
Definition: dsobject.c:373
#define ACPI_CAST_INDIRECT_PTR(t, p)
Definition: actypes.h:545
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_TYPE_BUFFER_FIELD
Definition: actypes.h:692
unsigned short UINT16
ACPI_STATUS AcpiDsResultPop(ACPI_OPERAND_OBJECT **Object, ACPI_WALK_STATE *WalkState)
Definition: dswstate.c:78
UINT16 Opcode
Definition: acstruct.h:78
#define AcpiUtCreateInternalObject(t)
Definition: acutils.h:654
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
#define ACPI_ERROR_NAMESPACE(s, p, e)
Definition: acmacros.h:462
#define AE_OK
Definition: acexcep.h:97
UINT16 Flags
Definition: aclocal.h:873
#define AML_ZERO_OP
Definition: amlcode.h:51

Referenced by AcpiDsCreateOperands(), AcpiDsEvalBankFieldOperands(), AcpiDsEvalDataObjectOperands(), AcpiDsEvaluateNamePath(), and AcpiDsGetPredicateValue().

◆ AcpiDsCreateOperands()

ACPI_STATUS AcpiDsCreateOperands ( ACPI_WALK_STATE WalkState,
ACPI_PARSE_OBJECT FirstArg 
)

Definition at line 753 of file dsutils.c.

756 {
758  ACPI_PARSE_OBJECT *Arg;
760  UINT32 ArgCount = 0;
761  UINT32 Index = WalkState->NumOperands;
762  UINT32 i;
763 
764 
765  ACPI_FUNCTION_TRACE_PTR (DsCreateOperands, FirstArg);
766 
767 
768  /* Get all arguments in the list */
769 
770  Arg = FirstArg;
771  while (Arg)
772  {
774  {
776  }
777 
778  Arguments[Index] = Arg;
779  WalkState->Operands [Index] = NULL;
780 
781  /* Move on to next argument, if any */
782 
783  Arg = Arg->Common.Next;
784  ArgCount++;
785  Index++;
786  }
787 
789  "NumOperands %d, ArgCount %d, Index %d\n",
790  WalkState->NumOperands, ArgCount, Index));
791 
792  /* Create the interpreter arguments, in reverse order */
793 
794  Index--;
795  for (i = 0; i < ArgCount; i++)
796  {
797  Arg = Arguments[Index];
798  WalkState->OperandIndex = (UINT8) Index;
799 
800  Status = AcpiDsCreateOperand (WalkState, Arg, Index);
801  if (ACPI_FAILURE (Status))
802  {
803  goto Cleanup;
804  }
805 
807  "Created Arg #%u (%p) %u args total\n",
808  Index, Arg, ArgCount));
809  Index--;
810  }
811 
813 
814 
815 Cleanup:
816  /*
817  * We must undo everything done above; meaning that we must
818  * pop everything off of the operand stack and delete those
819  * objects
820  */
821  AcpiDsObjStackPopAndDelete (ArgCount, WalkState);
822 
823  ACPI_EXCEPTION ((AE_INFO, Status, "While creating Arg %u", Index));
825 }
#define ACPI_EXCEPTION(plist)
Definition: acoutput.h:239
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
UINT8 OperandIndex
Definition: acstruct.h:81
UINT8 NumOperands
Definition: acstruct.h:80
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_STATUS AcpiDsCreateOperand(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Arg, UINT32 ArgIndex)
Definition: dsutils.c:497
void AcpiDsObjStackPopAndDelete(UINT32 PopCount, ACPI_WALK_STATE *WalkState)
Definition: dswstate.c:441
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ACPI_OBJ_NUM_OPERANDS
Definition: acconfig.h:172
unsigned int UINT32
#define AE_INFO
Definition: acoutput.h:230
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
#define ACPI_DB_DISPATCH
Definition: acoutput.h:163
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
static const UCHAR Index[8]
Definition: usbohci.c:18
static const WCHAR Cleanup[]
Definition: register.c:80
Status
Definition: gdiplustypes.h:24
#define AE_BAD_DATA
Definition: acexcep.h:154
union acpi_operand_object * Operands[ACPI_OBJ_NUM_OPERANDS+1]
Definition: acstruct.h:105
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
unsigned char UINT8
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiDsEvalBufferFieldOperands(), AcpiDsEvalRegionOperands(), AcpiDsEvalTableRegionOperands(), AcpiDsExecEndControlOp(), AcpiDsExecEndOp(), AcpiDsLoad1EndOp(), and AcpiDsLoad2EndOp().

◆ AcpiDsCreateWalkState()

ACPI_WALK_STATE* AcpiDsCreateWalkState ( ACPI_OWNER_ID  OwnerId,
ACPI_PARSE_OBJECT Origin,
ACPI_OPERAND_OBJECT MthDesc,
ACPI_THREAD_STATE Thread 
)

Definition at line 600 of file dswstate.c.

605 {
606  ACPI_WALK_STATE *WalkState;
607 
608 
609  ACPI_FUNCTION_TRACE (DsCreateWalkState);
610 
611 
612  WalkState = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_WALK_STATE));
613  if (!WalkState)
614  {
615  return_PTR (NULL);
616  }
617 
618  WalkState->DescriptorType = ACPI_DESC_TYPE_WALK;
619  WalkState->MethodDesc = MethodDesc;
620  WalkState->OwnerId = OwnerId;
621  WalkState->Origin = Origin;
622  WalkState->Thread = Thread;
623 
624  WalkState->ParserState.StartOp = Origin;
625 
626  /* Init the method args/local */
627 
628 #ifndef ACPI_CONSTANT_EVAL_ONLY
629  AcpiDsMethodDataInit (WalkState);
630 #endif
631 
632  /* Put the new state at the head of the walk list */
633 
634  if (Thread)
635  {
636  AcpiDsPushWalkState (WalkState, Thread);
637  }
638 
639  return_PTR (WalkState);
640 }
ACPI_THREAD_STATE * Thread
Definition: acstruct.h:127
void AcpiDsPushWalkState(ACPI_WALK_STATE *WalkState, ACPI_THREAD_STATE *Thread)
Definition: dswstate.c:526
#define ACPI_ALLOCATE_ZEROED(a)
Definition: actypes.h:385
#define return_PTR(s)
Definition: acoutput.h:497
ACPI_OWNER_ID OwnerId
Definition: acstruct.h:82
UINT8 DescriptorType
Definition: acstruct.h:76
smooth NULL
Definition: ftsmooth.c:416
union acpi_operand_object * MethodDesc
Definition: acstruct.h:115
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
void AcpiDsMethodDataInit(ACPI_WALK_STATE *WalkState)
Definition: dsmthdat.c:100
ACPI_PARSE_STATE ParserState
Definition: acstruct.h:97
union acpi_parse_object * StartOp
Definition: aclocal.h:1106
ACPI_PARSE_OBJECT * Origin
Definition: acstruct.h:120
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_DESC_TYPE_WALK
Definition: acobject.h:571
_Must_inspect_result_ _In_opt_ PVOID OwnerId
Definition: fsrtlfuncs.h:907

Referenced by AcpiDsAutoSerializeMethod(), AcpiDsCallControlMethod(), AcpiDsExecuteArguments(), AcpiNsOneCompleteParse(), AcpiPsExecuteMethod(), and AcpiPsExecuteTable().

◆ AcpiDsDeleteResultIfNotUsed()

void AcpiDsDeleteResultIfNotUsed ( ACPI_PARSE_OBJECT Op,
ACPI_OPERAND_OBJECT ResultObj,
ACPI_WALK_STATE WalkState 
)

Definition at line 359 of file dsutils.c.

363 {
364  ACPI_OPERAND_OBJECT *ObjDesc;
366 
367 
368  ACPI_FUNCTION_TRACE_PTR (DsDeleteResultIfNotUsed, ResultObj);
369 
370 
371  if (!Op)
372  {
373  ACPI_ERROR ((AE_INFO, "Null Op"));
374  return_VOID;
375  }
376 
377  if (!ResultObj)
378  {
379  return_VOID;
380  }
381 
382  if (!AcpiDsIsResultUsed (Op, WalkState))
383  {
384  /* Must pop the result stack (ObjDesc should be equal to ResultObj) */
385 
386  Status = AcpiDsResultPop (&ObjDesc, WalkState);
387  if (ACPI_SUCCESS (Status))
388  {
389  AcpiUtRemoveReference (ResultObj);
390  }
391  }
392 
393  return_VOID;
394 }
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
BOOLEAN AcpiDsIsResultUsed(ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState)
Definition: dsutils.c:187
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define AE_INFO
Definition: acoutput.h:230
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
#define return_VOID
Definition: acoutput.h:495
Status
Definition: gdiplustypes.h:24
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
ACPI_STATUS AcpiDsResultPop(ACPI_OPERAND_OBJECT **Object, ACPI_WALK_STATE *WalkState)
Definition: dswstate.c:78

Referenced by AcpiDsExecEndOp().

◆ AcpiDsDeleteWalkState()

void AcpiDsDeleteWalkState ( ACPI_WALK_STATE WalkState)

Definition at line 780 of file dswstate.c.

782 {
784 
785 
786  ACPI_FUNCTION_TRACE_PTR (DsDeleteWalkState, WalkState);
787 
788 
789  if (!WalkState)
790  {
791  return_VOID;
792  }
793 
794  if (WalkState->DescriptorType != ACPI_DESC_TYPE_WALK)
795  {
796  ACPI_ERROR ((AE_INFO, "%p is not a valid walk state",
797  WalkState));
798  return_VOID;
799  }
800 
801  /* There should not be any open scopes */
802 
803  if (WalkState->ParserState.Scope)
804  {
805  ACPI_ERROR ((AE_INFO, "%p walk still has a scope list",
806  WalkState));
807  AcpiPsCleanupScope (&WalkState->ParserState);
808  }
809 
810  /* Always must free any linked control states */
811 
812  while (WalkState->ControlState)
813  {
814  State = WalkState->ControlState;
815  WalkState->ControlState = State->Common.Next;
816 
818  }
819 
820  /* Always must free any linked parse states */
821 
822  while (WalkState->ScopeInfo)
823  {
824  State = WalkState->ScopeInfo;
825  WalkState->ScopeInfo = State->Common.Next;
826 
828  }
829 
830  /* Always must free any stacked result states */
831 
832  while (WalkState->Results)
833  {
834  State = WalkState->Results;
835  WalkState->Results = State->Common.Next;
836 
838  }
839 
840  ACPI_FREE (WalkState);
841  return_VOID;
842 }
#define ACPI_FREE(a)
Definition: actypes.h:386
void AcpiUtDeleteGenericState(ACPI_GENERIC_STATE *State)
Definition: utstate.c:340
ACPI_GENERIC_STATE * Results
Definition: acstruct.h:122
void AcpiPsCleanupScope(ACPI_PARSE_STATE *state)
Definition: psscope.c:277
ACPI_GENERIC_STATE * ControlState
Definition: acstruct.h:110
UINT8 DescriptorType
Definition: acstruct.h:76
#define AE_INFO
Definition: acoutput.h:230
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
#define return_VOID
Definition: acoutput.h:495
ACPI_GENERIC_STATE * ScopeInfo
Definition: acstruct.h:124
ACPI_PARSE_STATE ParserState
Definition: acstruct.h:97
enum State_ State
Definition: pofuncs.h:54
#define ACPI_DESC_TYPE_WALK
Definition: acobject.h:571
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
union acpi_generic_state * Scope
Definition: aclocal.h:1108

Referenced by AcpiDsAutoSerializeMethod(), AcpiDsCallControlMethod(), AcpiDsExecuteArguments(), AcpiNsOneCompleteParse(), AcpiPsExecuteMethod(), AcpiPsExecuteTable(), and AcpiPsParseAml().

◆ AcpiDsDoImplicitReturn()

BOOLEAN AcpiDsDoImplicitReturn ( ACPI_OPERAND_OBJECT ReturnDesc,
ACPI_WALK_STATE WalkState,
BOOLEAN  AddReference 
)

Definition at line 123 of file dsutils.c.

127 {
128  ACPI_FUNCTION_NAME (DsDoImplicitReturn);
129 
130 
131  /*
132  * Slack must be enabled for this feature, and we must
133  * have a valid return object
134  */
135  if ((!AcpiGbl_EnableInterpreterSlack) ||
136  (!ReturnDesc))
137  {
138  return (FALSE);
139  }
140 
142  "Result %p will be implicitly returned; Prev=%p\n",
143  ReturnDesc,
144  WalkState->ImplicitReturnObj));
145 
146  /*
147  * Delete any "stale" implicit return value first. However, in
148  * complex statements, the implicit return value can be
149  * bubbled up several levels, so we don't clear the value if it
150  * is the same as the ReturnDesc.
151  */
152  if (WalkState->ImplicitReturnObj)
153  {
154  if (WalkState->ImplicitReturnObj == ReturnDesc)
155  {
156  return (TRUE);
157  }
158  AcpiDsClearImplicitReturn (WalkState);
159  }
160 
161  /* Save the implicit return value, add a reference if requested */
162 
163  WalkState->ImplicitReturnObj = ReturnDesc;
164  if (AddReference)
165  {
166  AcpiUtAddReference (ReturnDesc);
167  }
168 
169  return (TRUE);
170 }
void AcpiUtAddReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:746
#define TRUE
Definition: types.h:120
union acpi_operand_object * ImplicitReturnObj
Definition: acstruct.h:112
#define ACPI_DB_DISPATCH
Definition: acoutput.h:163
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define ACPI_FUNCTION_NAME(a)
Definition: acoutput.h:479
void AcpiDsClearImplicitReturn(ACPI_WALK_STATE *WalkState)
Definition: dsutils.c:73

Referenced by AcpiDsGetPredicateValue(), AcpiDsIsResultUsed(), and AcpiDsRestartControlMethod().

◆ AcpiDsDumpMethodStack()

void AcpiDsDumpMethodStack ( ACPI_STATUS  Status,
ACPI_WALK_STATE WalkState,
ACPI_PARSE_OBJECT Op 
)

Definition at line 249 of file dsdebug.c.

253 {
254  return;
255 }

Referenced by AcpiDsMethodError().

◆ AcpiDsEvalBankFieldOperands()

ACPI_STATUS AcpiDsEvalBankFieldOperands ( ACPI_WALK_STATE WalkState,
ACPI_PARSE_OBJECT Op 
)

Definition at line 753 of file dsopcode.c.

756 {
758  ACPI_OPERAND_OBJECT *ObjDesc;
759  ACPI_OPERAND_OBJECT *OperandDesc;
761  ACPI_PARSE_OBJECT *NextOp;
762  ACPI_PARSE_OBJECT *Arg;
763 
764 
765  ACPI_FUNCTION_TRACE_PTR (DsEvalBankFieldOperands, Op);
766 
767 
768  /*
769  * This is where we evaluate the BankValue field of the
770  * BankField declaration
771  */
772 
773  /* NextOp points to the op that holds the Region */
774 
775  NextOp = Op->Common.Value.Arg;
776 
777  /* NextOp points to the op that holds the Bank Register */
778 
779  NextOp = NextOp->Common.Next;
780 
781  /* NextOp points to the op that holds the Bank Value */
782 
783  NextOp = NextOp->Common.Next;
784 
785  /*
786  * Set proper index into operand stack for AcpiDsObjStackPush
787  * invoked inside AcpiDsCreateOperand.
788  *
789  * We use WalkState->Operands[0] to store the evaluated BankValue
790  */
791  WalkState->OperandIndex = 0;
792 
793  Status = AcpiDsCreateOperand (WalkState, NextOp, 0);
794  if (ACPI_FAILURE (Status))
795  {
797  }
798 
799  Status = AcpiExResolveToValue (&WalkState->Operands[0], WalkState);
800  if (ACPI_FAILURE (Status))
801  {
803  }
804 
806  AcpiPsGetOpcodeName (Op->Common.AmlOpcode), 1);
807  /*
808  * Get the BankValue operand and save it
809  * (at Top of stack)
810  */
811  OperandDesc = WalkState->Operands[0];
812 
813  /* Arg points to the start Bank Field */
814 
815  Arg = AcpiPsGetArg (Op, 4);
816  while (Arg)
817  {
818  /* Ignore OFFSET and ACCESSAS terms here */
819 
820  if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)
821  {
822  Node = Arg->Common.Node;
823 
824  ObjDesc = AcpiNsGetAttachedObject (Node);
825  if (!ObjDesc)
826  {
828  }
829 
830  ObjDesc->BankField.Value = (UINT32) OperandDesc->Integer.Value;
831  }
832 
833  /* Move to next field in the list */
834 
835  Arg = Arg->Common.Next;
836  }
837 
838  AcpiUtRemoveReference (OperandDesc);
840 }
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
const char * AcpiPsGetOpcodeName(UINT16 Opcode)
Definition: psopinfo.c:169
UINT8 OperandIndex
Definition: acstruct.h:81
#define ACPI_DUMP_OPERANDS(a, b, c)
Definition: acoutput.h:486
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_STATUS AcpiDsCreateOperand(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Arg, UINT32 ArgIndex)
Definition: dsutils.c:497
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_OBJECT_BANK_FIELD BankField
Definition: acobject.h:533
unsigned int UINT32
union node Node
Definition: types.h:1255
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
#define AE_NOT_EXIST
Definition: acexcep.h:114
ACPI_OBJECT_INTEGER Integer
Definition: acobject.h:517
ACPI_STATUS AcpiExResolveToValue(ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState)
Definition: exresolv.c:79
#define AML_INT_NAMEDFIELD_OP
Definition: amlcode.h:206
Status
Definition: gdiplustypes.h:24
union acpi_operand_object * Operands[ACPI_OBJ_NUM_OPERANDS+1]
Definition: acstruct.h:105
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
ACPI_PARSE_OBJECT * AcpiPsGetArg(ACPI_PARSE_OBJECT *op, UINT32 argn)
Definition: pstree.c:76
#define ACPI_WALK_OPERANDS
Definition: acinterp.h:48
Definition: dlist.c:348

Referenced by AcpiDsExecEndOp().

◆ AcpiDsEvalBufferFieldOperands()

ACPI_STATUS AcpiDsEvalBufferFieldOperands ( ACPI_WALK_STATE WalkState,
ACPI_PARSE_OBJECT Op 
)

Definition at line 320 of file dsopcode.c.

323 {
325  ACPI_OPERAND_OBJECT *ObjDesc;
327  ACPI_PARSE_OBJECT *NextOp;
328 
329 
330  ACPI_FUNCTION_TRACE_PTR (DsEvalBufferFieldOperands, Op);
331 
332 
333  /*
334  * This is where we evaluate the address and length fields of the
335  * CreateXxxField declaration
336  */
337  Node = Op->Common.Node;
338 
339  /* NextOp points to the op that holds the Buffer */
340 
341  NextOp = Op->Common.Value.Arg;
342 
343  /* Evaluate/create the address and length operands */
344 
345  Status = AcpiDsCreateOperands (WalkState, NextOp);
346  if (ACPI_FAILURE (Status))
347  {
349  }
350 
351  ObjDesc = AcpiNsGetAttachedObject (Node);
352  if (!ObjDesc)
353  {
355  }
356 
357  /* Resolve the operands */
358 
360  Op->Common.AmlOpcode, ACPI_WALK_OPERANDS, WalkState);
361  if (ACPI_FAILURE (Status))
362  {
363  ACPI_ERROR ((AE_INFO, "(%s) bad operand(s), status 0x%X",
364  AcpiPsGetOpcodeName (Op->Common.AmlOpcode), Status));
365 
367  }
368 
369  /* Initialize the Buffer Field */
370 
371  if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP)
372  {
373  /* NOTE: Slightly different operands for this opcode */
374 
375  Status = AcpiDsInitBufferField (Op->Common.AmlOpcode, ObjDesc,
376  WalkState->Operands[0], WalkState->Operands[1],
377  WalkState->Operands[2], WalkState->Operands[3]);
378  }
379  else
380  {
381  /* All other, CreateXxxField opcodes */
382 
383  Status = AcpiDsInitBufferField (Op->Common.AmlOpcode, ObjDesc,
384  WalkState->Operands[0], WalkState->Operands[1],
385  NULL, WalkState->Operands[2]);
386  }
387 
389 }
ACPI_STATUS AcpiDsCreateOperands(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *FirstArg)
Definition: dsutils.c:753
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
const char * AcpiPsGetOpcodeName(UINT16 Opcode)
Definition: psopinfo.c:169
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
union node Node
Definition: types.h:1255
#define AML_CREATE_FIELD_OP
Definition: amlcode.h:163
smooth NULL
Definition: ftsmooth.c:416
#define AE_INFO
Definition: acoutput.h:230
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
static ACPI_STATUS AcpiDsInitBufferField(UINT16 AmlOpcode, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT *BufferDesc, ACPI_OPERAND_OBJECT *OffsetDesc, ACPI_OPERAND_OBJECT *LengthDesc, ACPI_OPERAND_OBJECT *ResultDesc)
Definition: dsopcode.c:116
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
#define AE_NOT_EXIST
Definition: acexcep.h:114
Status
Definition: gdiplustypes.h:24
union acpi_operand_object * Operands[ACPI_OBJ_NUM_OPERANDS+1]
Definition: acstruct.h:105
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
ACPI_STATUS AcpiExResolveOperands(UINT16 Opcode, ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState)
Definition: exresop.c:145
#define ACPI_WALK_OPERANDS
Definition: acinterp.h:48
Definition: dlist.c:348

Referenced by AcpiDsExecEndOp().

◆ AcpiDsEvalDataObjectOperands()

ACPI_STATUS AcpiDsEvalDataObjectOperands ( ACPI_WALK_STATE WalkState,
ACPI_PARSE_OBJECT Op,
ACPI_OPERAND_OBJECT ObjDesc 
)

Definition at line 635 of file dsopcode.c.

639 {
641  ACPI_OPERAND_OBJECT *ArgDesc;
642  UINT32 Length;
643 
644 
645  ACPI_FUNCTION_TRACE (DsEvalDataObjectOperands);
646 
647 
648  /* The first operand (for all of these data objects) is the length */
649 
650  /*
651  * Set proper index into operand stack for AcpiDsObjStackPush
652  * invoked inside AcpiDsCreateOperand.
653  */
654  WalkState->OperandIndex = WalkState->NumOperands;
655 
656  /* Ignore if child is not valid */
657 
658  if (!Op->Common.Value.Arg)
659  {
661  "Missing child while evaluating opcode %4.4X, Op %p",
662  Op->Common.AmlOpcode, Op));
664  }
665 
666  Status = AcpiDsCreateOperand (WalkState, Op->Common.Value.Arg, 1);
667  if (ACPI_FAILURE (Status))
668  {
670  }
671 
672  Status = AcpiExResolveOperands (WalkState->Opcode,
673  &(WalkState->Operands [WalkState->NumOperands -1]),
674  WalkState);
675  if (ACPI_FAILURE (Status))
676  {
678  }
679 
680  /* Extract length operand */
681 
682  ArgDesc = WalkState->Operands [WalkState->NumOperands - 1];
683  Length = (UINT32) ArgDesc->Integer.Value;
684 
685  /* Cleanup for length operand */
686 
687  Status = AcpiDsObjStackPop (1, WalkState);
688  if (ACPI_FAILURE (Status))
689  {
691  }
692 
693  AcpiUtRemoveReference (ArgDesc);
694 
695  /*
696  * Create the actual data object
697  */
698  switch (Op->Common.AmlOpcode)
699  {
700  case AML_BUFFER_OP:
701 
703  WalkState, Op, Length, &ObjDesc);
704  break;
705 
706  case AML_PACKAGE_OP:
708 
710  WalkState, Op, Length, &ObjDesc);
711  break;
712 
713  default:
714 
716  }
717 
718  if (ACPI_SUCCESS (Status))
719  {
720  /*
721  * Return the object in the WalkState, unless the parent is a package -
722  * in this case, the return object will be stored in the parse tree
723  * for the package.
724  */
725  if ((!Op->Common.Parent) ||
726  ((Op->Common.Parent->Common.AmlOpcode != AML_PACKAGE_OP) &&
727  (Op->Common.Parent->Common.AmlOpcode != AML_VARIABLE_PACKAGE_OP) &&
728  (Op->Common.Parent->Common.AmlOpcode != AML_NAME_OP)))
729  {
730  WalkState->ResultObj = ObjDesc;
731  }
732  }
733 
735 }
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
UINT8 OperandIndex
Definition: acstruct.h:81
UINT8 NumOperands
Definition: acstruct.h:80
ACPI_STATUS AcpiDsBuildInternalPackageObj(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, UINT32 ElementCount, ACPI_OPERAND_OBJECT **ObjDescPtr)
Definition: dspkginit.c:94
ACPI_STATUS AcpiDsBuildInternalBufferObj(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, UINT32 BufferLength, ACPI_OPERAND_OBJECT **ObjDescPtr)
Definition: dsobject.c:188
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_STATUS AcpiDsCreateOperand(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Arg, UINT32 ArgIndex)
Definition: dsutils.c:497
ACPI_STATUS AcpiDsObjStackPop(UINT32 PopCount, ACPI_WALK_STATE *WalkState)
Definition: dswstate.c:391
#define AML_VARIABLE_PACKAGE_OP
Definition: amlcode.h:63
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define AML_NAME_OP
Definition: amlcode.h:54
unsigned int UINT32
#define AE_INFO
Definition: acoutput.h:230
#define AE_AML_BAD_OPCODE
Definition: acexcep.h:180
union acpi_operand_object * ResultObj
Definition: acstruct.h:121
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
ACPI_OBJECT_INTEGER Integer
Definition: acobject.h:517
Status
Definition: gdiplustypes.h:24
union acpi_operand_object * Operands[ACPI_OBJ_NUM_OPERANDS+1]
Definition: acstruct.h:105
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AML_BUFFER_OP
Definition: amlcode.h:61
UINT16 Opcode
Definition: acstruct.h:78
ACPI_STATUS AcpiExResolveOperands(UINT16 Opcode, ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState)
Definition: exresop.c:145
#define AE_OK
Definition: acexcep.h:97
#define AML_PACKAGE_OP
Definition: amlcode.h:62

Referenced by AcpiDsExecEndOp().

◆ AcpiDsEvalRegionOperands()

ACPI_STATUS AcpiDsEvalRegionOperands ( ACPI_WALK_STATE WalkState,
ACPI_PARSE_OBJECT Op 
)

Definition at line 407 of file dsopcode.c.

410 {
412  ACPI_OPERAND_OBJECT *ObjDesc;
413  ACPI_OPERAND_OBJECT *OperandDesc;
415  ACPI_PARSE_OBJECT *NextOp;
417 
418 
419  ACPI_FUNCTION_TRACE_PTR (DsEvalRegionOperands, Op);
420 
421 
422  /*
423  * This is where we evaluate the address and length fields of the
424  * OpRegion declaration
425  */
426  Node = Op->Common.Node;
427 
428  /* NextOp points to the op that holds the SpaceID */
429 
430  NextOp = Op->Common.Value.Arg;
431  SpaceId = (ACPI_ADR_SPACE_TYPE) NextOp->Common.Value.Integer;
432 
433  /* NextOp points to address op */
434 
435  NextOp = NextOp->Common.Next;
436 
437  /* Evaluate/create the address and length operands */
438 
439  Status = AcpiDsCreateOperands (WalkState, NextOp);
440  if (ACPI_FAILURE (Status))
441  {
443  }
444 
445  /* Resolve the length and address operands to numbers */
446 
448  Op->Common.AmlOpcode, ACPI_WALK_OPERANDS, WalkState);
449  if (ACPI_FAILURE (Status))
450  {
452  }
453 
454  ObjDesc = AcpiNsGetAttachedObject (Node);
455  if (!ObjDesc)
456  {
458  }
459 
460  /*
461  * Get the length operand and save it
462  * (at Top of stack)
463  */
464  OperandDesc = WalkState->Operands[WalkState->NumOperands - 1];
465 
466  ObjDesc->Region.Length = (UINT32) OperandDesc->Integer.Value;
467  AcpiUtRemoveReference (OperandDesc);
468 
469  /* A zero-length operation region is unusable. Just warn */
470 
471  if (!ObjDesc->Region.Length && (SpaceId < ACPI_NUM_PREDEFINED_REGIONS))
472  {
474  "Operation Region [%4.4s] has zero length (SpaceId %X)",
475  Node->Name.Ascii, SpaceId));
476  }
477 
478  /*
479  * Get the address and save it
480  * (at top of stack - 1)
481  */
482  OperandDesc = WalkState->Operands[WalkState->NumOperands - 2];
483 
484  ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS)
485  OperandDesc->Integer.Value;
486  AcpiUtRemoveReference (OperandDesc);
487 
488  ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
489  ObjDesc, ACPI_FORMAT_UINT64 (ObjDesc->Region.Address),
490  ObjDesc->Region.Length));
491 
493  ObjDesc->Region.Address, ObjDesc->Region.Length, Node);
494 
495  /* Now the address and length are valid for this opregion */
496 
497  ObjDesc->Region.Flags |= AOPOBJ_DATA_VALID;
499 }
ACPI_STATUS AcpiDsCreateOperands(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *FirstArg)
Definition: dsutils.c:753
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
UINT8 ACPI_ADR_SPACE_TYPE
Definition: actypes.h:849
#define ACPI_WARNING(plist)
Definition: acoutput.h:238
UINT8 NumOperands
Definition: acstruct.h:80
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_OBJECT_COMMON_HEADER UINT8 SpaceId
Definition: acobject.h:202
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE ACPI_HANDLE ACPI_HANDLE *OutHandle ACPI_HANDLE *OutHandle void *Context void *Context ACPI_EVENT_HANDLER Handler UINT32 UINT32 ACPI_GPE_HANDLER void *Context UINT32 ACPI_NOTIFY_HANDLER void *Context ACPI_ADR_SPACE_TYPE SpaceId
Definition: acpixf.h:822
unsigned int UINT32
union node Node
Definition: types.h:1255
#define AE_INFO
Definition: acoutput.h:230
ACPI_OBJECT_REGION Region
Definition: acobject.h:524
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
ACPI_STATUS AcpiUtAddAddressRange(ACPI_ADR_SPACE_TYPE SpaceId, ACPI_PHYSICAL_ADDRESS Address, UINT32 Length, ACPI_NAMESPACE_NODE *RegionNode)
Definition: utaddress.c:78
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
#define AE_NOT_EXIST
Definition: acexcep.h:114
ACPI_OBJECT_INTEGER Integer
Definition: acobject.h:517
Status
Definition: gdiplustypes.h:24
union acpi_operand_object * Operands[ACPI_OBJ_NUM_OPERANDS+1]
Definition: acstruct.h:105
#define ACPI_DB_EXEC
Definition: acoutput.h:165
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FORMAT_UINT64(i)
Definition: acmacros.h:71
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
#define AOPOBJ_DATA_VALID
Definition: acobject.h:96
ACPI_PHYSICAL_ADDRESS Address
Definition: acobject.h:206
#define ACPI_NUM_PREDEFINED_REGIONS
Definition: actypes.h:863
ACPI_STATUS AcpiExResolveOperands(UINT16 Opcode, ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState)
Definition: exresop.c:145
#define ACPI_WALK_OPERANDS
Definition: acinterp.h:48
Definition: dlist.c:348

Referenced by AcpiDsExecEndOp().

◆ AcpiDsEvalTableRegionOperands()

ACPI_STATUS AcpiDsEvalTableRegionOperands ( ACPI_WALK_STATE WalkState,
ACPI_PARSE_OBJECT Op 
)

Definition at line 518 of file dsopcode.c.

521 {
523  ACPI_OPERAND_OBJECT *ObjDesc;
524  ACPI_OPERAND_OBJECT **Operand;
526  ACPI_PARSE_OBJECT *NextOp;
528  UINT32 TableIndex;
529 
530 
531  ACPI_FUNCTION_TRACE_PTR (DsEvalTableRegionOperands, Op);
532 
533 
534  /*
535  * This is where we evaluate the Signature string, OemId string,
536  * and OemTableId string of the Data Table Region declaration
537  */
538  Node = Op->Common.Node;
539 
540  /* NextOp points to Signature string op */
541 
542  NextOp = Op->Common.Value.Arg;
543 
544  /*
545  * Evaluate/create the Signature string, OemId string,
546  * and OemTableId string operands
547  */
548  Status = AcpiDsCreateOperands (WalkState, NextOp);
549  if (ACPI_FAILURE (Status))
550  {
552  }
553 
554  Operand = &WalkState->Operands[0];
555 
556  /*
557  * Resolve the Signature string, OemId string,
558  * and OemTableId string operands
559  */
561  Op->Common.AmlOpcode, ACPI_WALK_OPERANDS, WalkState);
562  if (ACPI_FAILURE (Status))
563  {
564  goto Cleanup;
565  }
566 
567  /* Find the ACPI table */
568 
570  Operand[0]->String.Pointer,
571  Operand[1]->String.Pointer,
572  Operand[2]->String.Pointer, &TableIndex);
573  if (ACPI_FAILURE (Status))
574  {
575  if (Status == AE_NOT_FOUND)
576  {
578  "ACPI Table [%4.4s] OEM:(%s, %s) not found in RSDT/XSDT",
579  Operand[0]->String.Pointer,
580  Operand[1]->String.Pointer,
581  Operand[2]->String.Pointer));
582  }
583  goto Cleanup;
584  }
585 
586  Status = AcpiGetTableByIndex (TableIndex, &Table);
587  if (ACPI_FAILURE (Status))
588  {
589  goto Cleanup;
590  }
591 
592  ObjDesc = AcpiNsGetAttachedObject (Node);
593  if (!ObjDesc)
594  {
596  goto Cleanup;
597  }
598 
600  ObjDesc->Region.Length = Table->Length;
601 
602  ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
603  ObjDesc, ACPI_FORMAT_UINT64 (ObjDesc->Region.Address),
604  ObjDesc->Region.Length));
605 
606  /* Now the address and length are valid for this opregion */
607 
608  ObjDesc->Region.Flags |= AOPOBJ_DATA_VALID;
609 
610 Cleanup:
611  AcpiUtRemoveReference (Operand[0]);
612  AcpiUtRemoveReference (Operand[1]);
613  AcpiUtRemoveReference (Operand[2]);
614 
616 }
ACPI_STATUS AcpiDsCreateOperands(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *FirstArg)
Definition: dsutils.c:753
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
ASMGENDATA Table[]
Definition: genincdata.c:61
static WCHAR String[]
Definition: stringtable.c:55
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_STATUS AcpiGetTableByIndex(UINT32 TableIndex, ACPI_TABLE_HEADER **OutTable)
Definition: tbxface.c:491
unsigned int UINT32
union node Node
Definition: types.h:1255
#define AE_INFO
Definition: acoutput.h:230
ACPI_OBJECT_REGION Region
Definition: acobject.h:524
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
#define AE_NOT_FOUND
Definition: acexcep.h:113
#define AE_NOT_EXIST
Definition: acexcep.h:114
#define ACPI_PTR_TO_PHYSADDR(i)
Definition: actypes.h:556
static const WCHAR Cleanup[]
Definition: register.c:80
Status
Definition: gdiplustypes.h:24
union acpi_operand_object * Operands[ACPI_OBJ_NUM_OPERANDS+1]
Definition: acstruct.h:105
#define ACPI_DB_EXEC
Definition: acoutput.h:165
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FORMAT_UINT64(i)
Definition: acmacros.h:71
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AOPOBJ_DATA_VALID
Definition: acobject.h:96
ACPI_PHYSICAL_ADDRESS Address
Definition: acobject.h:206
ACPI_STATUS AcpiExResolveOperands(UINT16 Opcode, ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState)
Definition: exresop.c:145
#define ACPI_WALK_OPERANDS
Definition: acinterp.h:48
ACPI_STATUS AcpiTbFindTable(char *Signature, char *OemId, char *OemTableId, UINT32 *TableIndex)
Definition: tbfind.c:70
Definition: dlist.c:348

Referenced by AcpiDsExecEndOp().

◆ AcpiDsEvaluateNamePath()

ACPI_STATUS AcpiDsEvaluateNamePath ( ACPI_WALK_STATE WalkState)

Definition at line 845 of file dsutils.c.

847 {
849  ACPI_PARSE_OBJECT *Op = WalkState->Op;
850  ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
851  ACPI_OPERAND_OBJECT *NewObjDesc;
852  UINT8 Type;
853 
854 
855  ACPI_FUNCTION_TRACE_PTR (DsEvaluateNamePath, WalkState);
856 
857 
858  if (!Op->Common.Parent)
859  {
860  /* This happens after certain exception processing */
861 
862  goto Exit;
863  }
864 
865  if ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
866  (Op->Common.Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP) ||
867  (Op->Common.Parent->Common.AmlOpcode == AML_REF_OF_OP))
868  {
869  /* TBD: Should we specify this feature as a bit of OpInfo->Flags of these opcodes? */
870 
871  goto Exit;
872  }
873 
874  Status = AcpiDsCreateOperand (WalkState, Op, 0);
875  if (ACPI_FAILURE (Status))
876  {
877  goto Exit;
878  }
879 
880  if (Op->Common.Flags & ACPI_PARSEOP_TARGET)
881  {
882  NewObjDesc = *Operand;
883  goto PushResult;
884  }
885 
886  Type = (*Operand)->Common.Type;
887 
888  Status = AcpiExResolveToValue (Operand, WalkState);
889  if (ACPI_FAILURE (Status))
890  {
891  goto Exit;
892  }
893 
894  if (Type == ACPI_TYPE_INTEGER)
895  {
896  /* It was incremented by AcpiExResolveToValue */
897 
898  AcpiUtRemoveReference (*Operand);
899 
901  *Operand, &NewObjDesc, WalkState);
902  if (ACPI_FAILURE (Status))
903  {
904  goto Exit;
905  }
906  }
907  else
908  {
909  /*
910  * The object either was anew created or is
911  * a Namespace node - don't decrement it.
912  */
913  NewObjDesc = *Operand;
914  }
915 
916  /* Cleanup for name-path operand */
917 
918  Status = AcpiDsObjStackPop (1, WalkState);
919  if (ACPI_FAILURE (Status))
920  {
921  WalkState->ResultObj = NewObjDesc;
922  goto Exit;
923  }
924 
925 PushResult:
926 
927  WalkState->ResultObj = NewObjDesc;
928 
929  Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);
930  if (ACPI_SUCCESS (Status))
931  {
932  /* Force to take it from stack */
933 
934  Op->Common.Flags |= ACPI_PARSEOP_IN_STACK;
935  }
936 
937 Exit:
938 
940 }
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
Type
Definition: Type.h:6
#define ACPI_TYPE_INTEGER
Definition: actypes.h:679
#define ACPI_PARSEOP_TARGET
Definition: aclocal.h:1122
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_STATUS AcpiDsCreateOperand(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Arg, UINT32 ArgIndex)
Definition: dsutils.c:497
ACPI_STATUS AcpiDsObjStackPop(UINT32 PopCount, ACPI_WALK_STATE *WalkState)
Definition: dswstate.c:391
#define AML_VARIABLE_PACKAGE_OP
Definition: amlcode.h:63
ACPI_STATUS AcpiDsResultPush(ACPI_OPERAND_OBJECT *Object, ACPI_WALK_STATE *WalkState)
Definition: dswstate.c:160
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
#define ACPI_PARSEOP_IN_STACK
Definition: aclocal.h:1121
union acpi_operand_object * ResultObj
Definition: acstruct.h:121
static void Exit(void)
Definition: sock.c:1331
ACPI_PARSE_OBJECT * Op
Definition: acstruct.h:118
ACPI_STATUS AcpiExResolveToValue(ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState)
Definition: exresolv.c:79
Status
Definition: gdiplustypes.h:24
union acpi_operand_object * Operands[ACPI_OBJ_NUM_OPERANDS+1]
Definition: acstruct.h:105
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
ACPI_OBJECT_COMMON Common
Definition: acobject.h:516
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
#define AML_REF_OF_OP
Definition: amlcode.h:89
ACPI_STATUS AcpiUtCopyIobjectToIobject(ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT **DestDesc, ACPI_WALK_STATE *WalkState)
Definition: utcopy.c:1037
unsigned char UINT8
#define AE_OK
Definition: acexcep.h:97
#define AML_PACKAGE_OP
Definition: amlcode.h:62

Referenced by AcpiDsExecEndOp().

◆ AcpiDsExecBeginControlOp()

ACPI_STATUS AcpiDsExecBeginControlOp ( ACPI_WALK_STATE WalkState,
ACPI_PARSE_OBJECT Op 
)

Definition at line 71 of file dscontrol.c.

74 {
76  ACPI_GENERIC_STATE *ControlState;
77 
78 
79  ACPI_FUNCTION_NAME (DsExecBeginControlOp);
80 
81 
82  ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n",
83  Op, Op->Common.AmlOpcode, WalkState));
84 
85  switch (Op->Common.AmlOpcode)
86  {
87  case AML_WHILE_OP:
88  /*
89  * If this is an additional iteration of a while loop, continue.
90  * There is no need to allocate a new control state.
91  */
92  if (WalkState->ControlState)
93  {
94  if (WalkState->ControlState->Control.AmlPredicateStart ==
95  (WalkState->ParserState.Aml - 1))
96  {
97  /* Reset the state to start-of-loop */
98 
99  WalkState->ControlState->Common.State =
101  break;
102  }
103  }
104 
105  /*lint -fallthrough */
106 
107  case AML_IF_OP:
108  /*
109  * IF/WHILE: Create a new control state to manage these
110  * constructs. We need to manage these as a stack, in order
111  * to handle nesting.
112  */
113  ControlState = AcpiUtCreateControlState ();
114  if (!ControlState)
115  {
117  break;
118  }
119  /*
120  * Save a pointer to the predicate for multiple executions
121  * of a loop
122  */
123  ControlState->Control.AmlPredicateStart =
124  WalkState->ParserState.Aml - 1;
125  ControlState->Control.PackageEnd =
126  WalkState->ParserState.PkgEnd;
127  ControlState->Control.Opcode =
128  Op->Common.AmlOpcode;
129  ControlState->Control.LoopTimeout = AcpiOsGetTimer () +
130  (UINT64) (AcpiGbl_MaxLoopIterations * ACPI_100NSEC_PER_SEC);
131 
132  /* Push the control state on this walk's control stack */
133 
134  AcpiUtPushGenericState (&WalkState->ControlState, ControlState);
135  break;
136 
137  case AML_ELSE_OP:
138 
139  /* Predicate is in the state object */
140  /* If predicate is true, the IF was executed, ignore ELSE part */
141 
142  if (WalkState->LastPredicate)
143  {
145  }
146 
147  break;
148 
149  case AML_RETURN_OP:
150 
151  break;
152 
153  default:
154 
155  break;
156  }
157 
158  return (Status);
159 }
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
#define AML_ELSE_OP
Definition: amlcode.h:135
ACPI_STATE_COMMON UINT16 Opcode
Definition: aclocal.h:725
UINT8 * PkgEnd
Definition: aclocal.h:1105
UINT64 AcpiOsGetTimer(void)
Definition: osl.c:884
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define AML_IF_OP
Definition: amlcode.h:134
#define AML_WHILE_OP
Definition: amlcode.h:136
void AcpiUtPushGenericState(ACPI_GENERIC_STATE **ListHead, ACPI_GENERIC_STATE *State)
Definition: utstate.c:65
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_GENERIC_STATE * ControlState
Definition: acstruct.h:110
UINT8 * PackageEnd
Definition: aclocal.h:728
UINT8 * AmlPredicateStart
Definition: aclocal.h:727
#define ACPI_100NSEC_PER_SEC
Definition: actypes.h:475
BOOLEAN LastPredicate
Definition: acstruct.h:83
#define AE_CTRL_TRUE
Definition: acexcep.h:227
UINT64 LoopTimeout
Definition: aclocal.h:729
#define ACPI_DB_DISPATCH
Definition: acoutput.h:163
ACPI_CONTROL_STATE Control
Definition: aclocal.h:823
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define AML_RETURN_OP
Definition: amlcode.h:138
ACPI_PARSE_STATE ParserState
Definition: acstruct.h:97
ACPI_GENERIC_STATE * AcpiUtCreateControlState(void)
Definition: utstate.c:300
ACPI_COMMON_STATE Common
Definition: aclocal.h:822
Status
Definition: gdiplustypes.h:24
#define ACPI_FUNCTION_NAME(a)
Definition: acoutput.h:479
unsigned long long UINT64
#define ACPI_CONTROL_CONDITIONAL_EXECUTING
Definition: aclocal.h:670
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiDsExecBeginOp().

◆ AcpiDsExecBeginOp()

ACPI_STATUS AcpiDsExecBeginOp ( ACPI_WALK_STATE WalkState,
ACPI_PARSE_OBJECT **  OutOp 
)

Definition at line 232 of file dswexec.c.

235 {
236  ACPI_PARSE_OBJECT *Op;
238  UINT32 OpcodeClass;
239 
240 
241  ACPI_FUNCTION_TRACE_PTR (DsExecBeginOp, WalkState);
242 
243 
244  Op = WalkState->Op;
245  if (!Op)
246  {
247  Status = AcpiDsLoad2BeginOp (WalkState, OutOp);
248  if (ACPI_FAILURE (Status))
249  {
250  goto ErrorExit;
251  }
252 
253  Op = *OutOp;
254  WalkState->Op = Op;
255  WalkState->Opcode = Op->Common.AmlOpcode;
256  WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
257 
258  if (AcpiNsOpensScope (WalkState->OpInfo->ObjectType))
259  {
261  "(%s) Popping scope for Op %p\n",
262  AcpiUtGetTypeName (WalkState->OpInfo->ObjectType), Op));
263 
264  Status = AcpiDsScopeStackPop (WalkState);
265  if (ACPI_FAILURE (Status))
266  {
267  goto ErrorExit;
268  }
269  }
270  }
271 
272  if (Op == WalkState->Origin)
273  {
274  if (OutOp)
275  {
276  *OutOp = Op;
277  }
278 
280  }
281 
282  /*
283  * If the previous opcode was a conditional, this opcode
284  * must be the beginning of the associated predicate.
285  * Save this knowledge in the current scope descriptor
286  */
287  if ((WalkState->ControlState) &&
288  (WalkState->ControlState->Common.State ==
290  {
292  "Exec predicate Op=%p State=%p\n",
293  Op, WalkState));
294 
295  WalkState->ControlState->Common.State =
297 
298  /* Save start of predicate */
299 
300  WalkState->ControlState->Control.PredicateOp = Op;
301  }
302 
303 
304  OpcodeClass = WalkState->OpInfo->Class;
305 
306  /* We want to send namepaths to the load code */
307 
308  if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
309  {
310  OpcodeClass = AML_CLASS_NAMED_OBJECT;
311  }
312 
313  /*
314  * Handle the opcode based upon the opcode type
315  */
316  switch (OpcodeClass)
317  {
318  case AML_CLASS_CONTROL:
319 
320  Status = AcpiDsExecBeginControlOp (WalkState, Op);
321  break;
322 
324 
325  if (WalkState->WalkType & ACPI_WALK_METHOD)
326  {
327  /*
328  * Found a named object declaration during method execution;
329  * we must enter this object into the namespace. The created
330  * object is temporary and will be deleted upon completion of
331  * the execution of this method.
332  *
333  * Note 10/2010: Except for the Scope() op. This opcode does
334  * not actually create a new object, it refers to an existing
335  * object. However, for Scope(), we want to indeed open a
336  * new scope.
337  */
338  if (Op->Common.AmlOpcode != AML_SCOPE_OP)
339  {
340  Status = AcpiDsLoad2BeginOp (WalkState, NULL);
341  }
342  else
343  {
345  Op->Named.Node, Op->Named.Node->Type, WalkState);
346  if (ACPI_FAILURE (Status))
347  {
349  }
350  }
351  }
352  break;
353 
354  case AML_CLASS_EXECUTE:
355  case AML_CLASS_CREATE:
356 
357  break;
358 
359  default:
360 
361  break;
362  }
363 
364  /* Nothing to do here during method execution */
365 
367 
368 
369 ErrorExit:
370  Status = AcpiDsMethodError (Status, WalkState);
372 }
ACPI_STATUS AcpiDsMethodError(ACPI_STATUS Status, ACPI_WALK_STATE *WalkState)
Definition: dsmethod.c:223
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
ACPI_STATUS AcpiDsScopeStackPop(ACPI_WALK_STATE *WalkState)
Definition: dswscope.c:192
#define AML_CLASS_EXECUTE
Definition: amlcode.h:400
ACPI_STATUS AcpiDsLoad2BeginOp(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT **OutOp)
Definition: dswload2.c:71
#define AML_CLASS_CREATE
Definition: amlcode.h:401
ACPI_STATUS AcpiDsScopeStackPush(ACPI_NAMESPACE_NODE *Node, ACPI_OBJECT_TYPE Type, ACPI_WALK_STATE *WalkState)
Definition: dswscope.c:107
UINT8 ObjectType
Definition: aclocal.h:874
#define AML_CLASS_CONTROL
Definition: amlcode.h:404
const ACPI_OPCODE_INFO * AcpiPsGetOpcodeInfo(UINT16 Opcode)
Definition: psopinfo.c:72
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_GENERIC_STATE * ControlState
Definition: acstruct.h:110
#define AML_INT_NAMEPATH_OP
Definition: amlcode.h:205
#define ACPI_WALK_METHOD
Definition: acstruct.h:69
#define AML_CLASS_NAMED_OBJECT
Definition: amlcode.h:403
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define ACPI_CONTROL_PREDICATE_EXECUTING
Definition: aclocal.h:671
unsigned int UINT32
union acpi_parse_object * PredicateOp
Definition: aclocal.h:726
smooth NULL
Definition: ftsmooth.c:416
UINT8 WalkType
Definition: acstruct.h:77
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
ACPI_PARSE_OBJ_NAMED Named
Definition: aclocal.h:1079
UINT32 AcpiNsOpensScope(ACPI_OBJECT_TYPE Type)
Definition: nsutils.c:736
#define ACPI_DB_DISPATCH
Definition: acoutput.h:163
ACPI_CONTROL_STATE Control
Definition: aclocal.h:823
ACPI_PARSE_OBJECT * Op
Definition: acstruct.h:118
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define AML_SCOPE_OP
Definition: amlcode.h:60
const ACPI_OPCODE_INFO * OpInfo
Definition: acstruct.h:119
ACPI_STATUS AcpiDsExecBeginControlOp(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
Definition: dscontrol.c:71
ACPI_COMMON_STATE Common
Definition: aclocal.h:822
Status
Definition: gdiplustypes.h:24
ACPI_PARSE_OBJECT * Origin
Definition: acstruct.h:120
#define ACPI_DB_EXEC
Definition: acoutput.h:165
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
static VOID ErrorExit(LPTSTR lpszMessage)
Definition: telnetd.c:647
const char * AcpiUtGetTypeName(ACPI_OBJECT_TYPE Type)
Definition: utdecode.c:249
UINT16 Opcode
Definition: acstruct.h:78
#define ACPI_CONTROL_CONDITIONAL_EXECUTING
Definition: aclocal.h:670
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiDsInitCallbacks(), and AcpiDsLoad2BeginOp().

◆ AcpiDsExecEndControlOp()

ACPI_STATUS AcpiDsExecEndControlOp ( ACPI_WALK_STATE WalkState,
ACPI_PARSE_OBJECT Op 
)

Definition at line 177 of file dscontrol.c.

180 {
182  ACPI_GENERIC_STATE *ControlState;
183 
184 
185  ACPI_FUNCTION_NAME (DsExecEndControlOp);
186 
187 
188  switch (Op->Common.AmlOpcode)
189  {
190  case AML_IF_OP:
191 
192  ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[IF_OP] Op=%p\n", Op));
193 
194  /*
195  * Save the result of the predicate in case there is an
196  * ELSE to come
197  */
198  WalkState->LastPredicate =
199  (BOOLEAN) WalkState->ControlState->Common.Value;
200 
201  /*
202  * Pop the control state that was created at the start
203  * of the IF and free it
204  */
205  ControlState = AcpiUtPopGenericState (&WalkState->ControlState);
206  AcpiUtDeleteGenericState (ControlState);
207  break;
208 
209  case AML_ELSE_OP:
210 
211  break;
212 
213  case AML_WHILE_OP:
214 
215  ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", Op));
216 
217  ControlState = WalkState->ControlState;
218  if (ControlState->Common.Value)
219  {
220  /* Predicate was true, the body of the loop was just executed */
221 
222  /*
223  * This infinite loop detection mechanism allows the interpreter
224  * to escape possibly infinite loops. This can occur in poorly
225  * written AML when the hardware does not respond within a while
226  * loop and the loop does not implement a timeout.
227  */
229  ControlState->Control.LoopTimeout))
230  {
232  break;
233  }
234 
235  /*
236  * Go back and evaluate the predicate and maybe execute the loop
237  * another time
238  */
240  WalkState->AmlLastWhile =
241  ControlState->Control.AmlPredicateStart;
242  break;
243  }
244 
245  /* Predicate was false, terminate this while loop */
246 
248  "[WHILE_OP] termination! Op=%p\n",Op));
249 
250  /* Pop this control state and free it */
251 
252  ControlState = AcpiUtPopGenericState (&WalkState->ControlState);
253  AcpiUtDeleteGenericState (ControlState);
254  break;
255 
256  case AML_RETURN_OP:
257 
259  "[RETURN_OP] Op=%p Arg=%p\n",Op, Op->Common.Value.Arg));
260 
261  /*
262  * One optional operand -- the return value
263  * It can be either an immediate operand or a result that
264  * has been bubbled up the tree
265  */
266  if (Op->Common.Value.Arg)
267  {
268  /* Since we have a real Return(), delete any implicit return */
269 
270  AcpiDsClearImplicitReturn (WalkState);
271 
272  /* Return statement has an immediate operand */
273 
274  Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg);
275  if (ACPI_FAILURE (Status))
276  {
277  return (Status);
278  }
279 
280  /*
281  * If value being returned is a Reference (such as
282  * an arg or local), resolve it now because it may
283  * cease to exist at the end of the method.
284  */
286  &WalkState->Operands [0], WalkState);
287  if (ACPI_FAILURE (Status))
288  {
289  return (Status);
290  }
291 
292  /*
293  * Get the return value and save as the last result
294  * value. This is the only place where WalkState->ReturnDesc
295  * is set to anything other than zero!
296  */
297  WalkState->ReturnDesc = WalkState->Operands[0];
298  }
299  else if (WalkState->ResultCount)
300  {
301  /* Since we have a real Return(), delete any implicit return */
302 
303  AcpiDsClearImplicitReturn (WalkState);
304 
305  /*
306  * The return value has come from a previous calculation.
307  *
308  * If value being returned is a Reference (such as
309  * an arg or local), resolve it now because it may
310  * cease to exist at the end of the method.
311  *
312  * Allow references created by the Index operator to return
313  * unchanged.
314  */
315  if ((ACPI_GET_DESCRIPTOR_TYPE (WalkState->Results->Results.ObjDesc[0]) ==
317  ((WalkState->Results->Results.ObjDesc [0])->Common.Type ==
319  ((WalkState->Results->Results.ObjDesc [0])->Reference.Class !=
321  {
323  &WalkState->Results->Results.ObjDesc [0], WalkState);
324  if (ACPI_FAILURE (Status))
325  {
326  return (Status);
327  }
328  }
329 
330  WalkState->ReturnDesc = WalkState->Results->Results.ObjDesc [0];
331  }
332  else
333  {
334  /* No return operand */
335 
336  if (WalkState->NumOperands)
337  {
338  AcpiUtRemoveReference (WalkState->Operands [0]);
339  }
340 
341  WalkState->Operands[0] = NULL;
342  WalkState->NumOperands = 0;
343  WalkState->ReturnDesc = NULL;
344  }
345 
346 
348  "Completed RETURN_OP State=%p, RetVal=%p\n",
349  WalkState, WalkState->ReturnDesc));
350 
351  /* End the control method execution right now */
352 
354  break;
355 
356  case AML_NOOP_OP:
357 
358  /* Just do nothing! */
359 
360  break;
361 
362  case AML_BREAKPOINT_OP:
363 
364  AcpiDbSignalBreakPoint (WalkState);
365 
366  /* Call to the OSL in case OS wants a piece of the action */
367 
369  "Executed AML Breakpoint opcode");
370  break;
371 
372  case AML_BREAK_OP:
373  case AML_CONTINUE_OP: /* ACPI 2.0 */
374 
375  /* Pop and delete control states until we find a while */
376 
377  while (WalkState->ControlState &&
378  (WalkState->ControlState->Control.Opcode != AML_WHILE_OP))
379  {
380  ControlState = AcpiUtPopGenericState (&WalkState->ControlState);
381  AcpiUtDeleteGenericState (ControlState);
382  }
383 
384  /* No while found? */
385 
386  if (!WalkState->ControlState)
387  {
388  return (AE_AML_NO_WHILE);
389  }
390 
391  /* Was: WalkState->AmlLastWhile = WalkState->ControlState->Control.AmlPredicateStart; */
392 
393  WalkState->AmlLastWhile =
394  WalkState->ControlState->Control.PackageEnd;
395 
396  /* Return status depending on opcode */
397 
398  if (Op->Common.AmlOpcode == AML_BREAK_OP)
399  {
401  }
402  else
403  {
405  }
406  break;
407 
408  default:
409 
410  ACPI_ERROR ((AE_INFO, "Unknown control opcode=0x%X Op=%p",
411  Op->Common.AmlOpcode, Op));
412 
414  break;
415  }
416 
417  return (Status);
418 }
ACPI_STATUS AcpiDsCreateOperands(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *FirstArg)
Definition: dsutils.c:753
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
#define AML_ELSE_OP
Definition: amlcode.h:135
ACPI_STATE_COMMON UINT16 Opcode
Definition: aclocal.h:725
void AcpiUtDeleteGenericState(ACPI_GENERIC_STATE *State)
Definition: utstate.c:340
ACPI_GENERIC_STATE * Results
Definition: acstruct.h:122
UINT64 AcpiOsGetTimer(void)
Definition: osl.c:884
#define AE_AML_NO_WHILE
Definition: acexcep.h:205
#define AML_IF_OP
Definition: amlcode.h:134
UINT8 NumOperands
Definition: acstruct.h:80
#define AML_WHILE_OP
Definition: amlcode.h:136
ACPI_STATUS AcpiOsSignal(UINT32 Function, void *Info)
Definition: osl.c:904
ACPI_STATE_COMMON union acpi_operand_object * ObjDesc[ACPI_RESULTS_FRAME_OBJ_NUM]
Definition: aclocal.h:779
#define ACPI_TYPE_LOCAL_REFERENCE
Definition: actypes.h:710
union acpi_operand_object * ReturnDesc
Definition: acstruct.h:123
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_GENERIC_STATE * ControlState
Definition: acstruct.h:110
#define AE_CTRL_PENDING
Definition: acexcep.h:225
ACPI_GENERIC_STATE * AcpiUtPopGenericState(ACPI_GENERIC_STATE **ListHead)
Definition: utstate.c:93
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define AML_BREAK_OP
Definition: amlcode.h:139
#define AE_CTRL_TERMINATE
Definition: acexcep.h:226
UINT8 * PackageEnd
Definition: aclocal.h:728
UINT8 ResultCount
Definition: acstruct.h:90
UINT8 * AmlPredicateStart
Definition: aclocal.h:727
#define AE_INFO
Definition: acoutput.h:230
smooth NULL
Definition: ftsmooth.c:416
#define AE_AML_BAD_OPCODE
Definition: acexcep.h:180
BOOLEAN LastPredicate
Definition: acstruct.h:83
#define AE_CTRL_CONTINUE
Definition: acexcep.h:233
UINT64 LoopTimeout
Definition: aclocal.h:729
#define ACPI_DB_DISPATCH
Definition: acoutput.h:163
#define ACPI_DESC_TYPE_OPERAND
Definition: acobject.h:573
ACPI_CONTROL_STATE Control
Definition: aclocal.h:823
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define AML_RETURN_OP
Definition: amlcode.h:138
#define AML_NOOP_OP
Definition: amlcode.h:137
#define ACPI_SIGNAL_BREAKPOINT
Definition: acpiosxf.h:74
ACPI_STATUS AcpiExResolveToValue(ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState)
Definition: exresolv.c:79
#define AML_CONTINUE_OP
Definition: amlcode.h:133
ACPI_COMMON_STATE Common
Definition: aclocal.h:822
Status
Definition: gdiplustypes.h:24
#define AE_AML_LOOP_TIMEOUT
Definition: acexcep.h:212
union acpi_operand_object * Operands[ACPI_OBJ_NUM_OPERANDS+1]
Definition: acstruct.h:105
#define AE_CTRL_BREAK
Definition: acexcep.h:232
ACPI_RESULT_VALUES Results
Definition: aclocal.h:829
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:784
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AML_BREAKPOINT_OP
Definition: amlcode.h:141
#define BOOLEAN
Definition: pedump.c:73
#define ACPI_FUNCTION_NAME(a)
Definition: acoutput.h:479
#define ACPI_TIME_AFTER(a, b)
Definition: actypes.h:481
UINT8 * AmlLastWhile
Definition: acstruct.h:108
#define AE_OK
Definition: acexcep.h:97
void AcpiDsClearImplicitReturn(ACPI_WALK_STATE *WalkState)
Definition: dsutils.c:73
#define ACPI_GET_DESCRIPTOR_TYPE(d)
Definition: acmacros.h:414

Referenced by AcpiDsExecEndOp().

◆ AcpiDsExecEndOp()

ACPI_STATUS AcpiDsExecEndOp ( ACPI_WALK_STATE State)

Definition at line 390 of file dswexec.c.

392 {
393  ACPI_PARSE_OBJECT *Op;
395  UINT32 OpType;
396  UINT32 OpClass;
397  ACPI_PARSE_OBJECT *NextOp;
398  ACPI_PARSE_OBJECT *FirstArg;
399 
400 
401  ACPI_FUNCTION_TRACE_PTR (DsExecEndOp, WalkState);
402 
403 
404  Op = WalkState->Op;
405  OpType = WalkState->OpInfo->Type;
406  OpClass = WalkState->OpInfo->Class;
407 
408  if (OpClass == AML_CLASS_UNKNOWN)
409  {
410  ACPI_ERROR ((AE_INFO, "Unknown opcode 0x%X", Op->Common.AmlOpcode));
412  }
413 
414  FirstArg = Op->Common.Value.Arg;
415 
416  /* Init the walk state */
417 
418  WalkState->NumOperands = 0;
419  WalkState->OperandIndex = 0;
420  WalkState->ReturnDesc = NULL;
421  WalkState->ResultObj = NULL;
422 
423  /* Call debugger for single step support (DEBUG build only) */
424 
425  Status = AcpiDbSingleStep (WalkState, Op, OpClass);
426  if (ACPI_FAILURE (Status))
427  {
429  }
430 
431  /* Decode the Opcode Class */
432 
433  switch (OpClass)
434  {
435  case AML_CLASS_ARGUMENT: /* Constants, literals, etc. */
436 
437  if (WalkState->Opcode == AML_INT_NAMEPATH_OP)
438  {
439  Status = AcpiDsEvaluateNamePath (WalkState);
440  if (ACPI_FAILURE (Status))
441  {
442  goto Cleanup;
443  }
444  }
445  break;
446 
447  case AML_CLASS_EXECUTE: /* Most operators with arguments */
448 
449  /* Build resolved operand stack */
450 
451  Status = AcpiDsCreateOperands (WalkState, FirstArg);
452  if (ACPI_FAILURE (Status))
453  {
454  goto Cleanup;
455  }
456 
457  /*
458  * All opcodes require operand resolution, with the only exceptions
459  * being the ObjectType and SizeOf operators.
460  */
461  if (!(WalkState->OpInfo->Flags & AML_NO_OPERAND_RESOLVE))
462  {
463  /* Resolve all operands */
464 
465  Status = AcpiExResolveOperands (WalkState->Opcode,
466  &(WalkState->Operands [WalkState->NumOperands -1]),
467  WalkState);
468  }
469 
470  if (ACPI_SUCCESS (Status))
471  {
472  /*
473  * Dispatch the request to the appropriate interpreter handler
474  * routine. There is one routine per opcode "type" based upon the
475  * number of opcode arguments and return type.
476  */
477  Status = AcpiGbl_OpTypeDispatch[OpType] (WalkState);
478  }
479  else
480  {
481  /*
482  * Treat constructs of the form "Store(LocalX,LocalX)" as noops when the
483  * Local is uninitialized.
484  */
486  (WalkState->Opcode == AML_STORE_OP) &&
487  (WalkState->Operands[0]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
488  (WalkState->Operands[1]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
489  (WalkState->Operands[0]->Reference.Class ==
490  WalkState->Operands[1]->Reference.Class) &&
491  (WalkState->Operands[0]->Reference.Value ==
492  WalkState->Operands[1]->Reference.Value))
493  {
494  Status = AE_OK;
495  }
496  else
497  {
499  "While resolving operands for [%s]",
500  AcpiPsGetOpcodeName (WalkState->Opcode)));
501  }
502  }
503 
504  /* Always delete the argument objects and clear the operand stack */
505 
506  AcpiDsClearOperands (WalkState);
507 
508  /*
509  * If a result object was returned from above, push it on the
510  * current result stack
511  */
512  if (ACPI_SUCCESS (Status) &&
513  WalkState->ResultObj)
514  {
515  Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);
516  }
517  break;
518 
519  default:
520 
521  switch (OpType)
522  {
523  case AML_TYPE_CONTROL: /* Type 1 opcode, IF/ELSE/WHILE/NOOP */
524 
525  /* 1 Operand, 0 ExternalResult, 0 InternalResult */
526 
527  Status = AcpiDsExecEndControlOp (WalkState, Op);
528 
529  break;
530 
532  /*
533  * If the method is referenced from within a package
534  * declaration, it is not a invocation of the method, just
535  * a reference to it.
536  */
537  if ((Op->Asl.Parent) &&
538  ((Op->Asl.Parent->Asl.AmlOpcode == AML_PACKAGE_OP) ||
539  (Op->Asl.Parent->Asl.AmlOpcode == AML_VARIABLE_PACKAGE_OP)))
540  {
542  "Method Reference in a Package, Op=%p\n", Op));
543 
544  Op->Common.Node = (ACPI_NAMESPACE_NODE *)
545  Op->Asl.Value.Arg->Asl.Node;
546  AcpiUtAddReference (Op->Asl.Value.Arg->Asl.Node->Object);
548  }
549 
551  "Method invocation, Op=%p\n", Op));
552 
553  /*
554  * (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains
555  * the method Node pointer
556  */
557  /* NextOp points to the op that holds the method name */
558 
559  NextOp = FirstArg;
560 
561  /* NextOp points to first argument op */
562 
563  NextOp = NextOp->Common.Next;
564 
565  /*
566  * Get the method's arguments and put them on the operand stack
567  */
568  Status = AcpiDsCreateOperands (WalkState, NextOp);
569  if (ACPI_FAILURE (Status))
570  {
571  break;
572  }
573 
574  /*
575  * Since the operands will be passed to another control method,
576  * we must resolve all local references here (Local variables,
577  * arguments to *this* method, etc.)
578  */
579  Status = AcpiDsResolveOperands (WalkState);
580  if (ACPI_FAILURE (Status))
581  {
582  /* On error, clear all resolved operands */
583 
584  AcpiDsClearOperands (WalkState);
585  break;
586  }
587 
588  /*
589  * Tell the walk loop to preempt this running method and
590  * execute the new method
591  */
593 
594  /*
595  * Return now; we don't want to disturb anything,
596  * especially the operand count!
597  */
599 
601 
603  "Executing CreateField Buffer/Index Op=%p\n", Op));
604 
605  Status = AcpiDsLoad2EndOp (WalkState);
606  if (ACPI_FAILURE (Status))
607  {
608  break;
609  }
610 
611  Status = AcpiDsEvalBufferFieldOperands (WalkState, Op);
612  break;
613 
614 
616 
618  "Executing CreateObject (Buffer/Package) Op=%p Child=%p ParentOpcode=%4.4X\n",
619  Op, Op->Named.Value.Arg, Op->Common.Parent->Common.AmlOpcode));
620 
621  switch (Op->Common.Parent->Common.AmlOpcode)
622  {
623  case AML_NAME_OP:
624  /*
625  * Put the Node on the object stack (Contains the ACPI Name
626  * of this object)
627  */
628  WalkState->Operands[0] = (void *)
629  Op->Common.Parent->Common.Node;
630  WalkState->NumOperands = 1;
631 
632  Status = AcpiDsCreateNode (WalkState,
633  Op->Common.Parent->Common.Node, Op->Common.Parent);
634  if (ACPI_FAILURE (Status))
635  {
636  break;
637  }
638 
639  /* Fall through */
640  /*lint -fallthrough */
641 
643 
644  Status = AcpiDsEvalDataObjectOperands (WalkState, Op,
645  AcpiNsGetAttachedObject (Op->Common.Parent->Common.Node));
646  break;
647 
648  default:
649 
650  Status = AcpiDsEvalDataObjectOperands (WalkState, Op, NULL);
651  break;
652  }
653 
654  /*
655  * If a result object was returned from above, push it on the
656  * current result stack
657  */
658  if (WalkState->ResultObj)
659  {
660  Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);
661  }
662  break;
663 
668 
669  Status = AcpiDsLoad2EndOp (WalkState);
670  if (ACPI_FAILURE (Status))
671  {
672  break;
673  }
674 
675  if (Op->Common.AmlOpcode == AML_REGION_OP)
676  {
678  "Executing OpRegion Address/Length Op=%p\n", Op));
679 
680  Status = AcpiDsEvalRegionOperands (WalkState, Op);
681  if (ACPI_FAILURE (Status))
682  {
683  break;
684  }
685  }
686  else if (Op->Common.AmlOpcode == AML_DATA_REGION_OP)
687  {
689  "Executing DataTableRegion Strings Op=%p\n", Op));
690 
691  Status = AcpiDsEvalTableRegionOperands (WalkState, Op);
692  if (ACPI_FAILURE (Status))
693  {
694  break;
695  }
696  }
697  else if (Op->Common.AmlOpcode == AML_BANK_FIELD_OP)
698  {
700  "Executing BankField Op=%p\n", Op));
701 
702  Status = AcpiDsEvalBankFieldOperands (WalkState, Op);
703  if (ACPI_FAILURE (Status))
704  {
705  break;
706  }
707  }
708  break;
709 
710  case AML_TYPE_UNDEFINED:
711 
713  "Undefined opcode type Op=%p", Op));
715 
716  case AML_TYPE_BOGUS:
717 
719  "Internal opcode=%X type Op=%p\n",
720  WalkState->Opcode, Op));
721  break;
722 
723  default:
724 
726  "Unimplemented opcode, class=0x%X "
727  "type=0x%X Opcode=0x%X Op=%p",
728  OpClass, OpType, Op->Common.AmlOpcode, Op));
729 
731  break;
732  }
733  }
734 
735  /*
736  * ACPI 2.0 support for 64-bit integers: Truncate numeric
737  * result value if we are executing from a 32-bit ACPI table
738  */
739  (void) AcpiExTruncateFor32bitTable (WalkState->ResultObj);
740 
741  /*
742  * Check if we just completed the evaluation of a
743  * conditional predicate
744  */
745  if ((ACPI_SUCCESS (Status)) &&
746  (WalkState->ControlState) &&
747  (WalkState->ControlState->Common.State ==
749  (WalkState->ControlState->Control.PredicateOp == Op))
750  {
751  Status = AcpiDsGetPredicateValue (WalkState, WalkState->ResultObj);
752  WalkState->ResultObj = NULL;
753  }
754 
755 
756 Cleanup:
757 
758  if (WalkState->ResultObj)
759  {
760  /* Break to debugger to display result */
761 
762  AcpiDbDisplayResultObject (WalkState->ResultObj,WalkState);
763 
764  /*
765  * Delete the result op if and only if:
766  * Parent will not use the result -- such as any
767  * non-nested type2 op in a method (parent will be method)
768  */
769  AcpiDsDeleteResultIfNotUsed (Op, WalkState->ResultObj, WalkState);
770  }
771 
772 #ifdef _UNDER_DEVELOPMENT
773 
774  if (WalkState->ParserState.Aml == WalkState->ParserState.AmlEnd)
775  {
776  AcpiDbMethodEnd (WalkState);
777  }
778 #endif
779 
780  /* Invoke exception handler on error */
781 
782  if (ACPI_FAILURE (Status))
783  {
784  Status = AcpiDsMethodError (Status, WalkState);
785  }
786 
787  /* Always clear the object stack */
788 
789  WalkState->NumOperands = 0;
791 }
#define ACPI_EXCEPTION(plist)
Definition: acoutput.h:239
ACPI_STATUS AcpiDsCreateOperands(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *FirstArg)
Definition: dsutils.c:753
ACPI_STATUS AcpiDsEvalRegionOperands(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
Definition: dsopcode.c:407
void AcpiDsDeleteResultIfNotUsed(ACPI_PARSE_OBJECT *Op, ACPI_OPERAND_OBJECT *ResultObj, ACPI_WALK_STATE *WalkState)
Definition: dsutils.c:359
ACPI_STATUS AcpiDsMethodError(ACPI_STATUS Status, ACPI_WALK_STATE *WalkState)
Definition: dsmethod.c:223
void AcpiUtAddReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:746
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
const char * AcpiPsGetOpcodeName(UINT16 Opcode)
Definition: psopinfo.c:169
#define AML_INT_EVAL_SUBTREE_OP
Definition: amlcode.h:212
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define AML_CLASS_UNKNOWN
Definition: amlcode.h:410
#define AML_TYPE_METHOD_CALL
Definition: amlcode.h:375
#define AML_CLASS_EXECUTE
Definition: amlcode.h:400
ACPI_STATUS AcpiDsEvaluateNamePath(ACPI_WALK_STATE *WalkState)
Definition: dsutils.c:845
#define ACPI_TYPE_LOCAL_REFERENCE
Definition: actypes.h:710
#define AE_CTRL_TRANSFER
Definition: acexcep.h:231
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define AML_VARIABLE_PACKAGE_OP
Definition: amlcode.h:63
#define AML_REGION_OP
Definition: amlcode.h:180
#define AE_NOT_IMPLEMENTED
Definition: acexcep.h:122
ACPI_STATUS AcpiDsResultPush(ACPI_OPERAND_OBJECT *Object, ACPI_WALK_STATE *WalkState)
Definition: dswstate.c:160
#define AML_INT_NAMEPATH_OP
Definition: amlcode.h:205
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define AML_NAME_OP
Definition: amlcode.h:54
#define ACPI_CONTROL_PREDICATE_EXECUTING
Definition: aclocal.h:671
#define AML_TYPE_NAMED_SIMPLE
Definition: amlcode.h:384
unsigned int UINT32
#define AE_AML_UNINITIALIZED_LOCAL
Definition: acexcep.h:184
ACPI_STATUS AcpiDsEvalBufferFieldOperands(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
Definition: dsopcode.c:320
ACPI_STATUS AcpiDsResolveOperands(ACPI_WALK_STATE *WalkState)
Definition: dsutils.c:412
ACPI_STATUS AcpiDsExecEndControlOp(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
Definition: dscontrol.c:177
smooth NULL
Definition: ftsmooth.c:416
#define AE_INFO
Definition: acoutput.h:230
ACPI_PARSE_OBJ_ASL Asl
Definition: aclocal.h:1080
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
#define AML_STORE_OP
Definition: amlcode.h:88
ACPI_PARSE_OBJ_NAMED Named
Definition: aclocal.h:1079
#define ACPI_DB_DISPATCH
Definition: acoutput.h:163
ACPI_STATUS AcpiDsEvalBankFieldOperands(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
Definition: dsopcode.c:753
#define AML_BANK_FIELD_OP
Definition: amlcode.h:187
ACPI_STATUS AcpiDsLoad2EndOp(ACPI_WALK_STATE *WalkState)
Definition: dswload2.c:415
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
ACPI_STATUS AcpiDsCreateNode(ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE *Node, ACPI_PARSE_OBJECT *Op)
Definition: dsobject.c:302
#define AML_CLASS_ARGUMENT
Definition: amlcode.h:402
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
ACPI_STATUS AcpiDsEvalDataObjectOperands(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, ACPI_OPERAND_OBJECT *ObjDesc)
Definition: dsopcode.c:635
ACPI_STATUS AcpiDsEvalTableRegionOperands(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
Definition: dsopcode.c:518
#define AML_TYPE_CREATE_OBJECT
Definition: amlcode.h:380
static const WCHAR Cleanup[]
Definition: register.c:80
#define AML_TYPE_NAMED_NO_OBJ
Definition: amlcode.h:382
Status
Definition: gdiplustypes.h:24
#define ACPI_DB_EXEC
Definition: acoutput.h:165
BOOLEAN AcpiExTruncateFor32bitTable(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: exutils.c:177
void AcpiDsClearOperands(ACPI_WALK_STATE *WalkState)
Definition: dsutils.c:453
#define AML_TYPE_BOGUS
Definition: amlcode.h:388
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define AML_TYPE_UNDEFINED
Definition: amlcode.h:387
#define AML_NO_OPERAND_RESOLVE
Definition: amlcode.h:331
#define AML_TYPE_NAMED_COMPLEX
Definition: amlcode.h:385
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AML_TYPE_NAMED_FIELD
Definition: amlcode.h:383
#define AML_TYPE_CREATE_FIELD
Definition: amlcode.h:379
ACPI_STATUS AcpiDsGetPredicateValue(ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT *ResultObj)
Definition: dswexec.c:92
static ACPI_EXECUTE_OP AcpiGbl_OpTypeDispatch[]
Definition: dswexec.c:61
ACPI_STATUS AcpiExResolveOperands(UINT16 Opcode, ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState)
Definition: exresop.c:145
#define AML_TYPE_CONTROL
Definition: amlcode.h:381
#define AML_DATA_REGION_OP
Definition: amlcode.h:188
#define AE_OK
Definition: acexcep.h:97
#define AML_PACKAGE_OP
Definition: amlcode.h:62

Referenced by AcpiDsInitCallbacks().

◆ AcpiDsGetBankFieldArguments()

ACPI_STATUS AcpiDsGetBankFieldArguments ( ACPI_OPERAND_OBJECT ObjDesc)

Definition at line 245 of file dsargs.c.

247 {
248  ACPI_OPERAND_OBJECT *ExtraDesc;
251 
252 
253  ACPI_FUNCTION_TRACE_PTR (DsGetBankFieldArguments, ObjDesc);
254 
255 
256  if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
257  {
259  }
260 
261  /* Get the AML pointer (method object) and BankField node */
262 
263  ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
264  Node = ObjDesc->BankField.Node;
265 
266  ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (
268 
269  ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BankField Arg Init\n",
271 
272  /* Execute the AML code for the TermArg arguments */
273 
275  ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
277 }
UINT8 * AmlStart
Definition: acobject.h:481
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_DEBUG_EXEC(a)
Definition: acoutput.h:477
ACPI_OBJECT_BANK_FIELD BankField
Definition: acobject.h:533
ACPI_OBJECT_EXTRA Extra
Definition: acobject.h:538
union node Node
Definition: types.h:1255
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
Status
Definition: gdiplustypes.h:24
#define ACPI_DB_EXEC
Definition: acoutput.h:165
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
ACPI_OBJECT_COMMON Common
Definition: acobject.h:516
const char * AcpiUtGetNodeName(void *Object)
Definition: utdecode.c:305
static ACPI_STATUS AcpiDsExecuteArguments(ACPI_NAMESPACE_NODE *Node, ACPI_NAMESPACE_NODE *ScopeNode, UINT32 AmlLength, UINT8 *AmlStart)
Definition: dsargs.c:81
#define AOPOBJ_DATA_VALID
Definition: acobject.h:96
#define ACPI_TYPE_LOCAL_BANK_FIELD
Definition: actypes.h:708
#define AE_OK
Definition: acexcep.h:97
ACPI_OPERAND_OBJECT * AcpiNsGetSecondaryObject(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: nsobject.c:346
UINT32 AmlLength
Definition: acobject.h:482
Definition: dlist.c:348

Referenced by AcpiNsInitOneObject().

◆ AcpiDsGetBufferArguments()

ACPI_STATUS AcpiDsGetBufferArguments ( ACPI_OPERAND_OBJECT ObjDesc)

Definition at line 294 of file dsargs.c.

296 {
299 
300 
301  ACPI_FUNCTION_TRACE_PTR (DsGetBufferArguments, ObjDesc);
302 
303 
304  if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
305  {
307  }
308 
309  /* Get the Buffer node */
310 
311  Node = ObjDesc->Buffer.Node;
312  if (!Node)
313  {
315  "No pointer back to namespace node in buffer object %p",
316  ObjDesc));
318  }
319 
320  ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Buffer Arg Init\n"));
321 
322  /* Execute the AML code for the TermArg arguments */
323 
325  ObjDesc->Buffer.AmlLength, ObjDesc->Buffer.AmlStart);
327 }
ACPI_NAMESPACE_NODE * Node
Definition: acobject.h:152
#define AE_AML_INTERNAL
Definition: acexcep.h:194
UINT32 ACPI_STATUS
Definition: actypes.h:460
union node Node
Definition: types.h:1255
#define AE_INFO
Definition: acoutput.h:2