ReactOS  0.4.15-dev-994-ga9f6032
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
Status
Definition: gdiplustypes.h:24
#define AML_METHOD_OP
Definition: amlcode.h:64
ACPI_OBJECT_METHOD Method
Definition: acobject.h:523
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:306
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:524
#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
Status
Definition: gdiplustypes.h:24
union acpi_operand_object * Mutex
Definition: acobject.h:218
static const WCHAR Cleanup[]
Definition: register.c:80
ACPI_OBJECT_METHOD Method
Definition: acobject.h:523
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:306
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:682
void AcpiUtDeleteObjectDesc(ACPI_OPERAND_OBJECT *Object)
Definition: utobject.c:473
unsigned int UINT32
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:520
_In_ UCHAR BufferLength
Definition: scsi.h:4066
#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:785
#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:655
#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
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 TRUE
Definition: types.h:120
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 FALSE
Definition: types.h:117
#define ACPI_NS_DONT_OPEN_SCOPE
Definition: acnamesp.h:64
smooth NULL
Definition: ftsmooth.c:416
ACPI_OBJECT_REFERENCE Reference
Definition: acobject.h:538
ACPI_GENERIC_STATE * ScopeInfo
Definition: acstruct.h:124
Status
Definition: gdiplustypes.h:24
#define ACPI_TYPE_ANY
Definition: actypes.h:679
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:445
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:785
#define AcpiUtCreateInternalObject(t)
Definition: acutils.h:655
#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:747
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
#define ACPI_ALLOCATE_ZEROED(a)
Definition: actypes.h:385
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:521
#define TRUE
Definition: types.h:120
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:728
#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:683
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 FALSE
Definition: types.h:117
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:687
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
Status
Definition: gdiplustypes.h:24
#define ACPI_INFO(plist)
Definition: acoutput.h:237
#define ACPI_GET_FUNCTION_NAME
Definition: acgcc.h:67
#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:785
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:655
#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
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_OBJECT_COMMON_HEADER UINT8 InfoFlags
Definition: acobject.h:215
#define TRUE
Definition: types.h:120
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
union acpi_object_method::@601 Dispatch
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
Status
Definition: gdiplustypes.h:24
static const WCHAR Cleanup[]
Definition: register.c:80
ACPI_OBJECT_METHOD Method
Definition: acobject.h:523
char * AcpiNsGetNormalizedPathname(ACPI_NAMESPACE_NODE *Node, BOOLEAN NoTrailing)
Definition: nsnames.c:367
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:785
#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:785
#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:785

Referenced by AcpiDsExecEndOp().

◆ AcpiDsCreateBankField()

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

Definition at line 748 of file dsfield.c.

752 {
754  ACPI_PARSE_OBJECT *Arg;
756 
757 
758  ACPI_FUNCTION_TRACE_PTR (DsCreateBankField, Op);
759 
760 
761  /* First arg is the name of the parent OpRegion (must already exist) */
762 
763  Arg = Op->Common.Value.Arg;
764  if (!RegionNode)
765  {
766  Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name,
768  ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode);
769 #ifdef ACPI_ASL_COMPILER
770  Status = AcpiDsCreateExternalRegion (Status, Arg,
771  Arg->Common.Value.Name, WalkState, &RegionNode);
772 #endif
773  if (ACPI_FAILURE (Status))
774  {
775  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
776  Arg->Common.Value.Name, Status);
778  }
779  }
780 
781  /* Second arg is the Bank Register (Field) (must already exist) */
782 
783  Arg = Arg->Common.Next;
784  Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
786  ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode);
787  if (ACPI_FAILURE (Status))
788  {
789  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
790  Arg->Common.Value.String, Status);
792  }
793 
794  /*
795  * Third arg is the BankValue
796  * This arg is a TermArg, not a constant
797  * It will be evaluated later, by AcpiDsEvalBankFieldOperands
798  */
799  Arg = Arg->Common.Next;
800 
801  /* Fourth arg is the field flags */
802 
803  Arg = Arg->Common.Next;
804  Info.FieldFlags = (UINT8) Arg->Common.Value.Integer;
805 
806  /* Each remaining arg is a Named Field */
807 
808  Info.FieldType = ACPI_TYPE_LOCAL_BANK_FIELD;
809  Info.RegionNode = RegionNode;
810 
811  /*
812  * Use Info.DataRegisterNode to store BankField Op
813  * It's safe because DataRegisterNode will never be used when create
814  * bank field \we store AmlStart and AmlLength in the BankField Op for
815  * late evaluation. Used in AcpiExPrepFieldValue(Info)
816  *
817  * TBD: Or, should we add a field in ACPI_CREATE_FIELD_INFO, like
818  * "void *ParentOp"?
819  */
820  Info.DataRegisterNode = (ACPI_NAMESPACE_NODE*) Op;
821 
822  Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next);
824 }
#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:324
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
ACPI_GENERIC_STATE * ScopeInfo
Definition: acstruct.h:124
Status
Definition: gdiplustypes.h:24
#define ACPI_TYPE_ANY
Definition: actypes.h:679
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_TYPE_REGION
Definition: actypes.h:689
#define ACPI_TYPE_LOCAL_BANK_FIELD
Definition: actypes.h:709
#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  }
205  else
206  {
207  /* Execute flag should always be set when this function is entered */
208 
209  if (!(WalkState->ParseFlags & ACPI_PARSE_EXECUTE))
210  {
212  "Parse execute mode is not set"));
214  }
215 
216  /* Creating new namespace node, should not already exist */
217 
220 
221  /*
222  * Mark node temporary if we are executing a normal control
223  * method. (Don't mark if this is a module-level code method)
224  */
225  if (WalkState->MethodNode &&
226  !(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL))
227  {
229  }
230 
231  /* Enter the NameString into the namespace */
232 
233  Status = AcpiNsLookup (WalkState->ScopeInfo,
234  Arg->Common.Value.String, ACPI_TYPE_ANY,
235  ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node);
236  if ((WalkState->ParseFlags & ACPI_PARSE_DISASSEMBLE) &&
238  {
239  Status = AE_OK;
240  }
241  else if (ACPI_FAILURE (Status))
242  {
243  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
244  Arg->Common.Value.String, Status);
246  }
247  }
248 
249  /*
250  * We could put the returned object (Node) on the object stack for later,
251  * but for now, we will put it in the "op" object that the parser uses,
252  * so we can get it again at the end of this scope.
253  */
254  Op->Common.Node = Node;
255 
256  /*
257  * If there is no object attached to the node, this node was just created
258  * and we need to create the field object. Otherwise, this was a lookup
259  * of an existing node and we don't want to create the field object again.
260  */
261  ObjDesc = AcpiNsGetAttachedObject (Node);
262  if (ObjDesc)
263  {
265  }
266 
267  /*
268  * The Field definition is not fully parsed at this time.
269  * (We must save the address of the AML for the buffer and index operands)
270  */
271 
272  /* Create the buffer field object */
273 
275  if (!ObjDesc)
276  {
278  goto Cleanup;
279  }
280 
281  /*
282  * Remember location in AML stream of the field unit opcode and operands
283  * -- since the buffer and index operands must be evaluated.
284  */
285  SecondDesc = ObjDesc->Common.NextObject;
286  SecondDesc->Extra.AmlStart = Op->Named.Data;
287  SecondDesc->Extra.AmlLength = Op->Named.Length;
288  ObjDesc->BufferField.Node = Node;
289 
290  /* Attach constructed field descriptors to parent node */
291 
293  if (ACPI_FAILURE (Status))
294  {
295  goto Cleanup;
296  }
297 
298 
299 Cleanup:
300 
301  /* Remove local reference to the object */
302 
303  AcpiUtRemoveReference (ObjDesc);
305 }
#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:482
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:539
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
#define AE_ALREADY_EXISTS
Definition: acexcep.h:115
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
ACPI_GENERIC_STATE * ScopeInfo
Definition: acstruct.h:124
Status
Definition: gdiplustypes.h:24
#define ACPI_TYPE_ANY
Definition: actypes.h:679
static const WCHAR Cleanup[]
Definition: register.c:80
struct acpi_namespace_node * MethodNode
Definition: acstruct.h:116
#define ACPI_PARSE_DISASSEMBLE
Definition: acparser.h:65
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:693
ACPI_OBJECT_COMMON Common
Definition: acobject.h:517
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:785
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:655
ACPI_OBJECT_BUFFER_FIELD BufferField
Definition: acobject.h:533
#define ACPI_ERROR_NAMESPACE(s, p, e)
Definition: acmacros.h:462
#define AE_OK
Definition: acexcep.h:97
UINT32 AmlLength
Definition: acobject.h:483
Definition: dlist.c:348

Referenced by AcpiDsLoad1EndOp(), and AcpiDsLoad2EndOp().

◆ AcpiDsCreateField()

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

Definition at line 534 of file dsfield.c.

538 {
540  ACPI_PARSE_OBJECT *Arg;
542 
543 
544  ACPI_FUNCTION_TRACE_PTR (DsCreateField, Op);
545 
546 
547  /* First arg is the name of the parent OpRegion (must already exist) */
548 
549  Arg = Op->Common.Value.Arg;
550 
551  if (!RegionNode)
552  {
553  Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name,
555  ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode);
556 #ifdef ACPI_ASL_COMPILER
557  Status = AcpiDsCreateExternalRegion (Status, Arg,
558  Arg->Common.Value.Name, WalkState, &RegionNode);
559 #endif
560  if (ACPI_FAILURE (Status))
561  {
562  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
563  Arg->Common.Value.Name, Status);
565  }
566  }
567 
568  memset (&Info, 0, sizeof (ACPI_CREATE_FIELD_INFO));
569 
570  /* Second arg is the field flags */
571 
572  Arg = Arg->Common.Next;
573  Info.FieldFlags = (UINT8) Arg->Common.Value.Integer;
574  Info.Attribute = 0;
575 
576  /* Each remaining arg is a Named Field */
577 
579  Info.RegionNode = RegionNode;
580 
581  Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next);
582  if (ACPI_FAILURE (Status))
583  {
585  }
586 
587  if (Info.RegionNode->Object->Region.SpaceId == ACPI_ADR_SPACE_PLATFORM_COMM)
588  {
589  RegionNode->Object->Field.InternalPccBuffer =
590  ACPI_ALLOCATE_ZEROED(Info.RegionNode->Object->Region.Length);
591  if (!RegionNode->Object->Field.InternalPccBuffer)
592  {
594  }
595  }
596 
598 }
#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:862
static ACPI_STATUS AcpiDsGetFieldNames(ACPI_CREATE_FIELD_INFO *Info, ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Arg)
Definition: dsfield.c:324
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
#define ACPI_TYPE_LOCAL_REGION_FIELD
Definition: actypes.h:708
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:532
#define ACPI_TYPE_REGION
Definition: actypes.h:689
#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 842 of file dsfield.c.

846 {
848  ACPI_PARSE_OBJECT *Arg;
850 
851 
852  ACPI_FUNCTION_TRACE_PTR (DsCreateIndexField, Op);
853 
854 
855  /* First arg is the name of the Index register (must already exist) */
856 
857  Arg = Op->Common.Value.Arg;
858  Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
860  ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode);
861  if (ACPI_FAILURE (Status))
862  {
863  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
864  Arg->Common.Value.String, Status);
866  }
867 
868  /* Second arg is the data register (must already exist) */
869 
870  Arg = Arg->Common.Next;
871  Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
873  ACPI_NS_SEARCH_PARENT, WalkState, &Info.DataRegisterNode);
874  if (ACPI_FAILURE (Status))
875  {
876  ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
877  Arg->Common.Value.String, Status);
879  }
880 
881  /* Next arg is the field flags */
882 
883  Arg = Arg->Common.Next;
884  Info.FieldFlags = (UINT8) Arg->Common.Value.Integer;
885 
886  /* Each remaining arg is a Named Field */
887 
888  Info.FieldType = ACPI_TYPE_LOCAL_INDEX_FIELD;
889  Info.RegionNode = RegionNode;
890 
891  Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next);
893 }
#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:710
#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:324
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
ACPI_GENERIC_STATE * ScopeInfo
Definition: acstruct.h:124
Status
Definition: gdiplustypes.h:24
#define ACPI_TYPE_ANY
Definition: actypes.h:679
#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:517
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:785
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:734
#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
Status
Definition: gdiplustypes.h:24
#define ACPI_TYPE_ANY
Definition: actypes.h:679
#define AML_CONDITIONAL_REF_OF_OP
Definition: amlcode.h:162
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:693
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:655
#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
Status
Definition: gdiplustypes.h:24
static const WCHAR Cleanup[]
Definition: register.c:80
#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:572
_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:785
#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:572
#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:747
union acpi_operand_object * ImplicitReturnObj
Definition: acstruct.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#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 754 of file dsopcode.c.

757 {
759  ACPI_OPERAND_OBJECT *ObjDesc;
760  ACPI_OPERAND_OBJECT *OperandDesc;
762  ACPI_PARSE_OBJECT *NextOp;
763  ACPI_PARSE_OBJECT *Arg;
764 
765 
766  ACPI_FUNCTION_TRACE_PTR (DsEvalBankFieldOperands, Op);
767 
768 
769  /*
770  * This is where we evaluate the BankValue field of the
771  * BankField declaration
772  */
773 
774  /* NextOp points to the op that holds the Region */
775 
776  NextOp = Op->Common.Value.Arg;
777 
778  /* NextOp points to the op that holds the Bank Register */
779 
780  NextOp = NextOp->Common.Next;
781 
782  /* NextOp points to the op that holds the Bank Value */
783 
784  NextOp = NextOp->Common.Next;
785 
786  /*
787  * Set proper index into operand stack for AcpiDsObjStackPush
788  * invoked inside AcpiDsCreateOperand.
789  *
790  * We use WalkState->Operands[0] to store the evaluated BankValue
791  */
792  WalkState->OperandIndex = 0;
793 
794  Status = AcpiDsCreateOperand (WalkState, NextOp, 0);
795  if (ACPI_FAILURE (Status))
796  {
798  }
799 
800  Status = AcpiExResolveToValue (&WalkState->Operands[0], WalkState);
801  if (ACPI_FAILURE (Status))
802  {
804  }
805 
807  AcpiPsGetOpcodeName (Op->Common.AmlOpcode), 1);
808  /*
809  * Get the BankValue operand and save it
810  * (at Top of stack)
811  */
812  OperandDesc = WalkState->Operands[0];
813 
814  /* Arg points to the start Bank Field */
815 
816  Arg = AcpiPsGetArg (Op, 4);
817  while (Arg)
818  {
819  /* Ignore OFFSET and ACCESSAS terms here */
820 
821  if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)
822  {
823  Node = Arg->Common.Node;
824 
825  ObjDesc = AcpiNsGetAttachedObject (Node);
826  if (!ObjDesc)
827  {
829  }
830 
831  ObjDesc->BankField.Value = (UINT32) OperandDesc->Integer.Value;
832  }
833 
834  /* Move to next field in the list */
835 
836  Arg = Arg->Common.Next;
837  }
838 
839  AcpiUtRemoveReference (OperandDesc);
841 }
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:534
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
Status
Definition: gdiplustypes.h:24
#define AE_NOT_EXIST
Definition: acexcep.h:114
ACPI_OBJECT_INTEGER Integer
Definition: acobject.h:518
ACPI_STATUS AcpiExResolveToValue(ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState)
Definition: exresolv.c:79
#define AML_INT_NAMEDFIELD_OP
Definition: amlcode.h:206
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:785
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 321 of file dsopcode.c.

324 {
326  ACPI_OPERAND_OBJECT *ObjDesc;
328  ACPI_PARSE_OBJECT *NextOp;
329 
330 
331  ACPI_FUNCTION_TRACE_PTR (DsEvalBufferFieldOperands, Op);
332 
333 
334  /*
335  * This is where we evaluate the address and length fields of the
336  * CreateXxxField declaration
337  */
338  Node = Op->Common.Node;
339 
340  /* NextOp points to the op that holds the Buffer */
341 
342  NextOp = Op->Common.Value.Arg;
343 
344  /* Evaluate/create the address and length operands */
345 
346  Status = AcpiDsCreateOperands (WalkState, NextOp);
347  if (ACPI_FAILURE (Status))
348  {
350  }
351 
352  ObjDesc = AcpiNsGetAttachedObject (Node);
353  if (!ObjDesc)
354  {
356  }
357 
358  /* Resolve the operands */
359 
361  Op->Common.AmlOpcode, ACPI_WALK_OPERANDS, WalkState);
362  if (ACPI_FAILURE (Status))
363  {
364  ACPI_ERROR ((AE_INFO, "(%s) bad operand(s), status 0x%X",
365  AcpiPsGetOpcodeName (Op->Common.AmlOpcode), Status));
366 
368  }
369 
370  /* Initialize the Buffer Field */
371 
372  if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP)
373  {
374  /* NOTE: Slightly different operands for this opcode */
375 
376  Status = AcpiDsInitBufferField (Op->Common.AmlOpcode, ObjDesc,
377  WalkState->Operands[0], WalkState->Operands[1],
378  WalkState->Operands[2], WalkState->Operands[3]);
379  }
380  else
381  {
382  /* All other, CreateXxxField opcodes */
383 
384  Status = AcpiDsInitBufferField (Op->Common.AmlOpcode, ObjDesc,
385  WalkState->Operands[0], WalkState->Operands[1],
386  NULL, WalkState->Operands[2]);
387  }
388 
390 }
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
Status
Definition: gdiplustypes.h:24
#define AE_NOT_EXIST
Definition: acexcep.h:114
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 636 of file dsopcode.c.

640 {
642  ACPI_OPERAND_OBJECT *ArgDesc;
643  UINT32 Length;
644 
645 
646  ACPI_FUNCTION_TRACE (DsEvalDataObjectOperands);
647 
648 
649  /* The first operand (for all of these data objects) is the length */
650 
651  /*
652  * Set proper index into operand stack for AcpiDsObjStackPush
653  * invoked inside AcpiDsCreateOperand.
654  */
655  WalkState->OperandIndex = WalkState->NumOperands;
656 
657  /* Ignore if child is not valid */
658 
659  if (!Op->Common.Value.Arg)
660  {
662  "Missing child while evaluating opcode %4.4X, Op %p",
663  Op->Common.AmlOpcode, Op));
665  }
666 
667  Status = AcpiDsCreateOperand (WalkState, Op->Common.Value.Arg, 1);
668  if (ACPI_FAILURE (Status))
669  {
671  }
672 
673  Status = AcpiExResolveOperands (WalkState->Opcode,
674  &(WalkState->Operands [WalkState->NumOperands -1]),
675  WalkState);
676  if (ACPI_FAILURE (Status))
677  {
679  }
680 
681  /* Extract length operand */
682 
683  ArgDesc = WalkState->Operands [WalkState->NumOperands - 1];
684  Length = (UINT32) ArgDesc->Integer.Value;
685 
686  /* Cleanup for length operand */
687 
688  Status = AcpiDsObjStackPop (1, WalkState);
689  if (ACPI_FAILURE (Status))
690  {
692  }
693 
694  AcpiUtRemoveReference (ArgDesc);
695 
696  /*
697  * Create the actual data object
698  */
699  switch (Op->Common.AmlOpcode)
700  {
701  case AML_BUFFER_OP:
702 
704  WalkState, Op, Length, &ObjDesc);
705  break;
706 
707  case AML_PACKAGE_OP:
709 
711  WalkState, Op, Length, &ObjDesc);
712  break;
713 
714  default:
715 
717  }
718 
719  if (ACPI_SUCCESS (Status))
720  {
721  /*
722  * Return the object in the WalkState, unless the parent is a package -
723  * in this case, the return object will be stored in the parse tree
724  * for the package.
725  */
726  if ((!Op->Common.Parent) ||
727  ((Op->Common.Parent->Common.AmlOpcode != AML_PACKAGE_OP) &&
728  (Op->Common.Parent->Common.AmlOpcode != AML_VARIABLE_PACKAGE_OP) &&
729  (Op->Common.Parent->Common.AmlOpcode != AML_NAME_OP)))
730  {
731  WalkState->ResultObj = ObjDesc;
732  }
733  }
734 
736 }
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
Status
Definition: gdiplustypes.h:24
ACPI_OBJECT_INTEGER Integer
Definition: acobject.h:518
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:785
#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 408 of file dsopcode.c.

411 {
413  ACPI_OPERAND_OBJECT *ObjDesc;
414  ACPI_OPERAND_OBJECT *OperandDesc;
416  ACPI_PARSE_OBJECT *NextOp;
418 
419 
420  ACPI_FUNCTION_TRACE_PTR (DsEvalRegionOperands, Op);
421 
422 
423  /*
424  * This is where we evaluate the address and length fields of the
425  * OpRegion declaration
426  */
427  Node = Op->Common.Node;
428 
429  /* NextOp points to the op that holds the SpaceID */
430 
431  NextOp = Op->Common.Value.Arg;
432  SpaceId = (ACPI_ADR_SPACE_TYPE) NextOp->Common.Value.Integer;
433 
434  /* NextOp points to address op */
435 
436  NextOp = NextOp->Common.Next;
437 
438  /* Evaluate/create the address and length operands */
439 
440  Status = AcpiDsCreateOperands (WalkState, NextOp);
441  if (ACPI_FAILURE (Status))
442  {
444  }
445 
446  /* Resolve the length and address operands to numbers */
447 
449  Op->Common.AmlOpcode, ACPI_WALK_OPERANDS, WalkState);
450  if (ACPI_FAILURE (Status))
451  {
453  }
454 
455  ObjDesc = AcpiNsGetAttachedObject (Node);
456  if (!ObjDesc)
457  {
459  }
460 
461  /*
462  * Get the length operand and save it
463  * (at Top of stack)
464  */
465  OperandDesc = WalkState->Operands[WalkState->NumOperands - 1];
466 
467  ObjDesc->Region.Length = (UINT32) OperandDesc->Integer.Value;
468  AcpiUtRemoveReference (OperandDesc);
469 
470  /* A zero-length operation region is unusable. Just warn */
471 
472  if (!ObjDesc->Region.Length && (SpaceId < ACPI_NUM_PREDEFINED_REGIONS))
473  {
475  "Operation Region [%4.4s] has zero length (SpaceId %X)",
476  Node->Name.Ascii, SpaceId));
477  }
478 
479  /*
480  * Get the address and save it
481  * (at top of stack - 1)
482  */
483  OperandDesc = WalkState->Operands[WalkState->NumOperands - 2];
484 
485  ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS)
486  OperandDesc->Integer.Value;
487  AcpiUtRemoveReference (OperandDesc);
488 
489  ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
490  ObjDesc, ACPI_FORMAT_UINT64 (ObjDesc->Region.Address),
491  ObjDesc->Region.Length));
492 
494  ObjDesc->Region.Address, ObjDesc->Region.Length, Node);
495 
496  /* Now the address and length are valid for this opregion */
497 
498  ObjDesc->Region.Flags |= AOPOBJ_DATA_VALID;
500 }
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:850
#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:828
unsigned int UINT32
union node Node
Definition: types.h:1255
#define AE_INFO
Definition: acoutput.h:230
ACPI_OBJECT_REGION Region
Definition: acobject.h:525
#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
Status
Definition: gdiplustypes.h:24
#define AE_NOT_EXIST
Definition: acexcep.h:114
ACPI_OBJECT_INTEGER Integer
Definition: acobject.h:518
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:785
#define AOPOBJ_DATA_VALID
Definition: acobject.h:96
ACPI_PHYSICAL_ADDRESS Address
Definition: acobject.h:206
#define ACPI_NUM_PREDEFINED_REGIONS
Definition: actypes.h:865
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 519 of file dsopcode.c.

522 {
524  ACPI_OPERAND_OBJECT *ObjDesc;
525  ACPI_OPERAND_OBJECT **Operand;
527  ACPI_PARSE_OBJECT *NextOp;
529  UINT32 TableIndex;
530 
531 
532  ACPI_FUNCTION_TRACE_PTR (DsEvalTableRegionOperands, Op);
533 
534 
535  /*
536  * This is where we evaluate the Signature string, OemId string,
537  * and OemTableId string of the Data Table Region declaration
538  */
539  Node = Op->Common.Node;
540 
541  /* NextOp points to Signature string op */
542 
543  NextOp = Op->Common.Value.Arg;
544 
545  /*
546  * Evaluate/create the Signature string, OemId string,
547  * and OemTableId string operands
548  */
549  Status = AcpiDsCreateOperands (WalkState, NextOp);
550  if (ACPI_FAILURE (Status))
551  {
553  }
554 
555  Operand = &WalkState->Operands[0];
556 
557  /*
558  * Resolve the Signature string, OemId string,
559  * and OemTableId string operands
560  */
562  Op->Common.AmlOpcode, ACPI_WALK_OPERANDS, WalkState);
563  if (ACPI_FAILURE (Status))
564  {
565  goto Cleanup;
566  }
567 
568  /* Find the ACPI table */
569 
571  Operand[0]->String.Pointer,
572  Operand[1]->String.Pointer,
573  Operand[2]->String.Pointer, &TableIndex);
574  if (ACPI_FAILURE (Status))
575  {
576  if (Status == AE_NOT_FOUND)
577  {
579  "ACPI Table [%4.4s] OEM:(%s, %s) not found in RSDT/XSDT",
580  Operand[0]->String.Pointer,
581  Operand[1]->String.Pointer,
582  Operand[2]->String.Pointer));
583  }
584  goto Cleanup;
585  }
586 
587  Status = AcpiGetTableByIndex (TableIndex, &Table);
588  if (ACPI_FAILURE (Status))
589  {
590  goto Cleanup;
591  }
592 
593  ObjDesc = AcpiNsGetAttachedObject (Node);
594  if (!ObjDesc)
595  {
597  goto Cleanup;
598  }
599 
601  ObjDesc->Region.Length = Table->Length;
602 
603  ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
604  ObjDesc, ACPI_FORMAT_UINT64 (ObjDesc->Region.Address),
605  ObjDesc->Region.Length));
606 
607  /* Now the address and length are valid for this opregion */
608 
609  ObjDesc->Region.Flags |= AOPOBJ_DATA_VALID;
610 
611 Cleanup:
612  AcpiUtRemoveReference (Operand[0]);
613  AcpiUtRemoveReference (Operand[1]);
614  AcpiUtRemoveReference (Operand[2]);
615 
617 }
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:525
#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
Status
Definition: gdiplustypes.h:24
#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
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:785
#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:680
#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
Status
Definition: gdiplustypes.h:24
ACPI_STATUS AcpiExResolveToValue(ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState)
Definition: exresolv.c:79
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:517
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:785
#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
Status
Definition: gdiplustypes.h:24
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
#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 234 of file dswexec.c.

237 {
238  ACPI_PARSE_OBJECT *Op;
240  UINT32 OpcodeClass;
241 
242 
243  ACPI_FUNCTION_TRACE_PTR (DsExecBeginOp, WalkState);
244 
245 
246  Op = WalkState->Op;
247  if (!Op)
248  {
249  Status = AcpiDsLoad2BeginOp (WalkState, OutOp);
250  if (ACPI_FAILURE (Status))
251  {
252  goto ErrorExit;
253  }
254 
255  Op = *OutOp;
256  WalkState->Op = Op;
257  WalkState->Opcode = Op->Common.AmlOpcode;
258  WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
259 
260  if (AcpiNsOpensScope (WalkState->OpInfo->ObjectType))
261  {
263  "(%s) Popping scope for Op %p\n",
264  AcpiUtGetTypeName (WalkState->OpInfo->ObjectType), Op));
265 
266  Status = AcpiDsScopeStackPop (WalkState);
267  if (ACPI_FAILURE (Status))
268  {
269  goto ErrorExit;
270  }
271  }
272  }
273 
274  if (Op == WalkState->Origin)
275  {
276  if (OutOp)
277  {
278  *OutOp = Op;
279  }
280 
282  }
283 
284  /*
285  * If the previous opcode was a conditional, this opcode
286  * must be the beginning of the associated predicate.
287  * Save this knowledge in the current scope descriptor
288  */
289  if ((WalkState->ControlState) &&
290  (WalkState->ControlState->Common.State ==
292  {
294  "Exec predicate Op=%p State=%p\n",
295  Op, WalkState));
296 
297  WalkState->ControlState->Common.State =
299 
300  /* Save start of predicate */
301 
302  WalkState->ControlState->Control.PredicateOp = Op;
303  }
304 
305 
306  OpcodeClass = WalkState->OpInfo->Class;
307 
308  /* We want to send namepaths to the load code */
309 
310  if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
311  {
312  OpcodeClass = AML_CLASS_NAMED_OBJECT;
313  }
314 
315  /*
316  * Handle the opcode based upon the opcode type
317  */
318  switch (OpcodeClass)
319  {
320  case AML_CLASS_CONTROL:
321 
322  Status = AcpiDsExecBeginControlOp (WalkState, Op);
323  break;
324 
326 
327  if (WalkState->WalkType & ACPI_WALK_METHOD)
328  {
329  /*
330  * Found a named object declaration during method execution;
331  * we must enter this object into the namespace. The created
332  * object is temporary and will be deleted upon completion of
333  * the execution of this method.
334  *
335  * Note 10/2010: Except for the Scope() op. This opcode does
336  * not actually create a new object, it refers to an existing
337  * object. However, for Scope(), we want to indeed open a
338  * new scope.
339  */
340  if (Op->Common.AmlOpcode != AML_SCOPE_OP)
341  {
342  Status = AcpiDsLoad2BeginOp (WalkState, NULL);
343  }
344  else
345  {
347  Op->Named.Node, Op->Named.Node->Type, WalkState);
348  if (ACPI_FAILURE (Status))
349  {
351  }
352  }
353  }
354  break;
355 
356  case AML_CLASS_EXECUTE:
357  case AML_CLASS_CREATE:
358 
359  break;
360 
361  default:
362 
363  break;
364  }
365 
366  /* Nothing to do here during method execution */
367 
369 
370 
371 ErrorExit:
372  Status = AcpiDsMethodError (Status, WalkState);
374 }
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:74
#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
Status
Definition: gdiplustypes.h:24
ACPI_STATUS AcpiDsExecBeginControlOp(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
Definition: dscontrol.c:71
ACPI_COMMON_STATE Common
Definition: aclocal.h:822
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:250
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:711
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:574
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
Status
Definition: gdiplustypes.h:24
#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
#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:785
#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 392 of file dswexec.c.

394 {
395  ACPI_PARSE_OBJECT *Op;
397  UINT32 OpType;
398  UINT32 OpClass;
399  ACPI_PARSE_OBJECT *NextOp;
400  ACPI_PARSE_OBJECT *FirstArg;
401 #ifdef ACPI_EXEC_APP
402  char *Namepath;
403  ACPI_OPERAND_OBJECT *ObjDesc;
404 #endif
405 
406  ACPI_FUNCTION_TRACE_PTR (DsExecEndOp, WalkState);
407 
408 
409  Op = WalkState->Op;
410  OpType = WalkState->OpInfo->Type;
411  OpClass = WalkState->OpInfo->Class;
412 
413  if (OpClass == AML_CLASS_UNKNOWN)
414  {
415  ACPI_ERROR ((AE_INFO, "Unknown opcode 0x%X", Op->Common.AmlOpcode));
417  }
418 
419  FirstArg = Op->Common.Value.Arg;
420 
421  /* Init the walk state */
422 
423  WalkState->NumOperands = 0;
424  WalkState->OperandIndex = 0;
425  WalkState->ReturnDesc = NULL;
426  WalkState->ResultObj = NULL;
427 
428  /* Call debugger for single step support (DEBUG build only) */
429 
430  Status = AcpiDbSingleStep (WalkState, Op, OpClass);
431  if (ACPI_FAILURE (Status))
432  {
434  }
435 
436  /* Decode the Opcode Class */
437 
438  switch (OpClass)
439  {
440  case AML_CLASS_ARGUMENT: /* Constants, literals, etc. */
441 
442  if (WalkState->Opcode == AML_INT_NAMEPATH_OP)
443  {
444  Status = AcpiDsEvaluateNamePath (WalkState);
445  if (ACPI_FAILURE (Status))
446  {
447  goto Cleanup;
448  }
449  }
450  break;
451 
452  case AML_CLASS_EXECUTE: /* Most operators with arguments */
453 
454  /* Build resolved operand stack */
455 
456  Status = AcpiDsCreateOperands (WalkState, FirstArg);
457  if (ACPI_FAILURE (Status))
458  {
459  goto Cleanup;
460  }
461 
462  /*
463  * All opcodes require operand resolution, with the only exceptions
464  * being the ObjectType and SizeOf operators.
465  */
466  if (!(WalkState->OpInfo->Flags & AML_NO_OPERAND_RESOLVE))
467  {
468  /* Resolve all operands */
469 
470  Status = AcpiExResolveOperands (WalkState->Opcode,
471  &(WalkState->Operands [WalkState->NumOperands -1]),
472  WalkState);
473  }
474 
475  if (ACPI_SUCCESS (Status))
476  {
477  /*
478  * Dispatch the request to the appropriate interpreter handler
479  * routine. There is one routine per opcode "type" based upon the
480  * number of opcode arguments and return type.
481  */
482  Status = AcpiGbl_OpTypeDispatch[OpType] (WalkState);
483  }
484  else
485  {
486  /*
487  * Treat constructs of the form "Store(LocalX,LocalX)" as noops when the
488  * Local is uninitialized.
489  */
491  (WalkState->Opcode == AML_STORE_OP) &&
492  (WalkState->Operands[0]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
493  (WalkState->Operands[1]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
494  (WalkState->Operands[0]->Reference.Class ==
495  WalkState->Operands[1]->Reference.Class) &&
496  (WalkState->Operands[0]->Reference.Value ==
497  WalkState->Operands[1]->Reference.Value))
498  {
499  Status = AE_OK;
500  }
501  else
502  {
504  "While resolving operands for [%s]",
505  AcpiPsGetOpcodeName (WalkState->Opcode)));
506  }
507  }
508 
509  /* Always delete the argument objects and clear the operand stack */
510 
511  AcpiDsClearOperands (WalkState);
512 
513  /*
514  * If a result object was returned from above, push it on the
515  * current result stack
516  */
517  if (ACPI_SUCCESS (Status) &&
518  WalkState->ResultObj)
519  {
520  Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);
521  }
522  break;
523 
524  default:
525 
526  switch (OpType)
527  {
528  case AML_TYPE_CONTROL: /* Type 1 opcode, IF/ELSE/WHILE/NOOP */
529 
530  /* 1 Operand, 0 ExternalResult, 0 InternalResult */
531 
532  Status = AcpiDsExecEndControlOp (WalkState, Op);
533 
534  break;
535 
537  /*
538  * If the method is referenced from within a package
539  * declaration, it is not a invocation of the method, just
540  * a reference to it.
541  */
542  if ((Op->Asl.Parent) &&
543  ((Op->Asl.Parent->Asl.AmlOpcode == AML_PACKAGE_OP) ||
544  (Op->Asl.Parent->Asl.AmlOpcode == AML_VARIABLE_PACKAGE_OP)))
545  {
547  "Method Reference in a Package, Op=%p\n", Op));
548 
549  Op->Common.Node = (ACPI_NAMESPACE_NODE *)
550  Op->Asl.Value.Arg->Asl.Node;
551  AcpiUtAddReference (Op->Asl.Value.Arg->Asl.Node->Object);
553  }
554 
556  "Method invocation, Op=%p\n", Op));
557 
558  /*
559  * (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains
560  * the method Node pointer
561  */
562  /* NextOp points to the op that holds the method name */
563 
564  NextOp = FirstArg;
565 
566  /* NextOp points to first argument op */
567 
568  NextOp = NextOp->Common.Next;
569 
570  /*
571  * Get the method's arguments and put them on the operand stack
572  */
573  Status = AcpiDsCreateOperands (WalkState, NextOp);
574  if (ACPI_FAILURE (Status))
575  {
576  break;
577  }
578 
579  /*
580  * Since the operands will be passed to another control method,
581  * we must resolve all local references here (Local variables,
582  * arguments to *this* method, etc.)
583  */
584  Status = AcpiDsResolveOperands (WalkState);
585  if (ACPI_FAILURE (Status))
586  {
587  /* On error, clear all resolved operands */
588 
589  AcpiDsClearOperands (WalkState);
590  break;
591  }
592 
593  /*
594  * Tell the walk loop to preempt this running method and
595  * execute the new method
596  */
598 
599  /*
600  * Return now; we don't want to disturb anything,
601  * especially the operand count!
602  */
604 
606 
608  "Executing CreateField Buffer/Index Op=%p\n", Op));
609 
610  Status = AcpiDsLoad2EndOp (WalkState);
611  if (ACPI_FAILURE (Status))
612  {
613  break;
614  }
615 
616  Status = AcpiDsEvalBufferFieldOperands (WalkState, Op);
617  if (ACPI_FAILURE (Status))
618  {
619  break;
620  }
621 
622 #ifdef ACPI_EXEC_APP
623  /*
624  * AcpiExec support for namespace initialization file (initialize
625  * BufferFields in this code.)
626  */
627  Namepath = AcpiNsGetExternalPathname (Op->Common.Node);
628  Status = AeLookupInitFileEntry (Namepath, &ObjDesc);
629  if (ACPI_SUCCESS (Status))
630  {
631  Status = AcpiExWriteDataToField (ObjDesc, Op->Common.Node->Object, NULL);
632  if ACPI_FAILURE (Status)
633  {
634  ACPI_EXCEPTION ((AE_INFO, Status, "While writing to buffer field"));
635  }
636  }
637  ACPI_FREE (Namepath);
638  Status = AE_OK;
639 #endif
640  break;
641 
642 
644 
646  "Executing CreateObject (Buffer/Package) Op=%p Child=%p ParentOpcode=%4.4X\n",
647  Op, Op->Named.Value.Arg, Op->Common.Parent->Common.AmlOpcode));
648 
649  switch (Op->Common.Parent->Common.AmlOpcode)
650  {
651  case AML_NAME_OP:
652  /*
653  * Put the Node on the object stack (Contains the ACPI Name
654  * of this object)
655  */
656  WalkState->Operands[0] = (void *)
657  Op->Common.Parent->Common.Node;
658  WalkState->NumOperands = 1;
659 
660  Status = AcpiDsCreateNode (WalkState,
661  Op->Common.Parent->Common.Node, Op->Common.Parent);
662  if (ACPI_FAILURE (Status))
663  {
664  break;
665  }
666 
667  /* Fall through */
668  /*lint -fallthrough */
669 
671 
672  Status = AcpiDsEvalDataObjectOperands (WalkState, Op,
673  AcpiNsGetAttachedObject (Op->Common.Parent->Common.Node));
674  break;
675 
676  default:
677 
678  Status = AcpiDsEvalDataObjectOperands (WalkState, Op, NULL);
679  break;
680  }
681 
682  /*
683  * If a result object was returned from above, push it on the
684  * current result stack
685  */
686  if (WalkState->ResultObj)
687  {
688  Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);
689  }
690  break;
691 
696 
697  Status = AcpiDsLoad2EndOp (WalkState);
698  if (ACPI_FAILURE (Status))
699  {
700  break;
701  }
702 
703  if (Op->Common.AmlOpcode == AML_REGION_OP)
704  {
706  "Executing OpRegion Address/Length Op=%p\n", Op));
707 
708  Status = AcpiDsEvalRegionOperands (WalkState, Op);
709  if (ACPI_FAILURE (Status))
710  {
711  break;
712  }
713  }
714  else if (Op->Common.AmlOpcode == AML_DATA_REGION_OP)
715  {
717  "Executing DataTableRegion Strings Op=%p\n", Op));
718 
719  Status = AcpiDsEvalTableRegionOperands (WalkState, Op);
720  if (ACPI_FAILURE (Status))
721  {
722  break;
723  }
724  }
725  else if (Op->Common.AmlOpcode == AML_BANK_FIELD_OP)
726  {
728  "Executing BankField Op=%p\n", Op));
729 
730  Status = AcpiDsEvalBankFieldOperands (WalkState, Op);
731  if (ACPI_FAILURE (Status))
732  {
733  break;
734  }
735  }
736  break;
737 
738  case AML_TYPE_UNDEFINED:
739 
741  "Undefined opcode type Op=%p", Op));
743 
744  case AML_TYPE_BOGUS:
745 
747  "Internal opcode=%X type Op=%p\n",
748  WalkState->Opcode, Op));
749  break;
750 
751  default:
752 
754  "Unimplemented opcode, class=0x%X "
755  "type=0x%X Opcode=0x%X Op=%p",
756  OpClass, OpType, Op->Common.AmlOpcode, Op));
757 
759  break;
760  }
761  }
762 
763  /*
764  * ACPI 2.0 support for 64-bit integers: Truncate numeric
765  * result value if we are executing from a 32-bit ACPI table
766  */
767  (void) AcpiExTruncateFor32bitTable (WalkState->ResultObj);
768 
769  /*
770  * Check if we just completed the evaluation of a
771  * conditional predicate
772  */
773  if ((ACPI_SUCCESS (Status)) &&
774  (WalkState->ControlState) &&
775  (WalkState->ControlState->Common.State ==
777  (WalkState->ControlState->Control.PredicateOp == Op))
778  {
779  Status = AcpiDsGetPredicateValue (WalkState, WalkState->ResultObj);
780  WalkState->ResultObj = NULL;
781  }
782 
783 
784 Cleanup:
785 
786  if (WalkState->ResultObj)
787  {
788  /* Break to debugger to display result */
789 
790  AcpiDbDisplayResultObject (WalkState->ResultObj,WalkState);
791 
792  /*
793  * Delete the result op if and only if:
794  * Parent will not use the result -- such as any
795  * non-nested type2 op in a method (parent will be method)
796  */
797  AcpiDsDeleteResultIfNotUsed (Op, WalkState->ResultObj, WalkState);
798  }
799 
800 #ifdef _UNDER_DEVELOPMENT
801 
802  if (WalkState->ParserState.Aml == WalkState->ParserState.AmlEnd)
803  {
804  AcpiDbMethodEnd (WalkState);
805  }
806 #endif
807 
808  /* Invoke exception handler on error */
809 
810  if (ACPI_FAILURE (Status))
811  {
812  Status = AcpiDsMethodError (Status, WalkState);
813  }
814 
815  /* Always clear the object stack */
816 
817  WalkState->NumOperands = 0;
819 }
#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:408
void AcpiDsDeleteResultIfNotUsed(ACPI_PARSE_OBJECT *Op, ACPI_OPERAND_OBJECT *ResultObj, ACPI_WALK_STATE *WalkState)
Definition: dsutils.c:359
#define ACPI_FREE(a)
Definition: actypes.h:386
ACPI_STATUS AcpiDsMethodError(ACPI_STATUS Status, ACPI_WALK_STATE *WalkState)
Definition: dsmethod.c:223
void AcpiUtAddReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:747
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:711
#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:321
ACPI_STATUS AcpiExWriteDataToField(ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc)
Definition: exfield.c:315
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:754
#define AML_BANK_FIELD_OP
Definition: amlcode.h:187
char * AcpiNsGetExternalPathname(ACPI_NAMESPACE_NODE *Node)
Definition: nsnames.c:70
ACPI_STATUS AcpiDsLoad2EndOp(ACPI_WALK_STATE *WalkState)
Definition: dswload2.c:418
#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:636
Status
Definition: gdiplustypes.h:24
ACPI_STATUS AcpiDsEvalTableRegionOperands(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
Definition: dsopcode.c:519
#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
#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:94
static ACPI_EXECUTE_OP AcpiGbl_OpTypeDispatch[]
Definition: dswexec.c:63
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:482
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_DEBUG_EXEC(a)
Definition: acoutput.h:477
ACPI_OBJECT_BANK_FIELD BankField
Definition: acobject.h:534
ACPI_OBJECT_EXTRA Extra
Definition: acobject.h:539
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:517
const char * AcpiUtGetNodeName(void *Object)
Definition: utdecode.c:306
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