ReactOS 0.4.15-dev-8109-gd7be748
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{
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
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}
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define ACPI_DB_PARSE
Definition: acoutput.h:162
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
void AcpiPsSetName(ACPI_PARSE_OBJECT *op, UINT32 name)
Definition: psutils.c:281
void AcpiPsDeleteParseTree(ACPI_PARSE_OBJECT *root)
Definition: pswalk.c:67
void AcpiPsFreeOp(ACPI_PARSE_OBJECT *Op)
Definition: psutils.c:212
ACPI_STATUS AcpiPsParseAml(ACPI_WALK_STATE *WalkState)
Definition: psparse.c:453
ACPI_PARSE_OBJECT * AcpiPsAllocOp(UINT16 Opcode, UINT8 *Aml)
Definition: psutils.c:130
UINT32 ACPI_STATUS
Definition: actypes.h:460
const char * AcpiUtGetNodeName(void *Object)
Definition: utdecode.c:306
#define AML_METHOD_OP
Definition: amlcode.h:64
#define NULL
Definition: types.h:112
union node Node
Definition: types.h:1255
static ACPI_STATUS AcpiDsDetectNamedOpcodes(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT **OutOp)
Definition: dsmethod.c:166
ACPI_WALK_STATE * AcpiDsCreateWalkState(ACPI_OWNER_ID OwnerId, ACPI_PARSE_OBJECT *Origin, ACPI_OPERAND_OBJECT *MethodDesc, ACPI_THREAD_STATE *Thread)
Definition: dswstate.c:600
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
Status
Definition: gdiplustypes.h:25
UINT8 * AmlStart
Definition: acobject.h:221
ACPI_PARSE_DOWNWARDS DescendingCallback
Definition: acstruct.h:128
ACPI_OBJECT_METHOD Method
Definition: acobject.h:525
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
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 */
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 {
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 {
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 {
470 ObjDesc->Method.Mutex->Mutex.SyncLevel;
471
472 ObjDesc->Method.Mutex->Mutex.ThreadId =
474 }
475 }
476
477 /* Always increase acquisition depth */
478
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
505Cleanup:
506 /* On error, must release the method mutex (if present) */
507
508 if (ObjDesc->Method.Mutex)
509 {
511 }
513}
#define AE_NULL_ENTRY
Definition: acexcep.h:118
#define AE_AML_MUTEX_ORDER
Definition: acexcep.h:200
#define AE_AML_METHOD_LIMIT
Definition: acexcep.h:198
#define AE_OK
Definition: acexcep.h:97
#define ACPI_METHOD_IGNORE_SYNC_LEVEL
Definition: acobject.h:240
#define ACPI_METHOD_SERIALIZED
Definition: acobject.h:238
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AE_INFO
Definition: acoutput.h:230
ACPI_THREAD_ID AcpiOsGetThreadId(void)
Definition: osl.c:217
#define AcpiOsReleaseMutex(Handle)
Definition: actypes.h:277
#define ACPI_WAIT_FOREVER
Definition: actypes.h:501
#define ACPI_UINT8_MAX
Definition: actypes.h:64
ACPI_STATUS AcpiUtAllocateOwnerId(ACPI_OWNER_ID *OwnerId)
Definition: utownerid.c:68
static const WCHAR Cleanup[]
Definition: register.c:80
static ACPI_STATUS AcpiDsCreateMethodMutex(ACPI_OPERAND_OBJECT *MethodDesc)
Definition: dsmethod.c:301
ACPI_STATUS AcpiExSystemWaitMutex(ACPI_MUTEX Mutex, UINT16 Timeout)
Definition: exsystem.c:120
void AcpiExStartTraceMethod(ACPI_NAMESPACE_NODE *MethodNode, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_WALK_STATE *WalkState)
Definition: extrace.c:224
ACPI_OWNER_ID OwnerId
Definition: acobject.h:229
ACPI_OBJECT_COMMON_HEADER UINT8 InfoFlags
Definition: acobject.h:216
union acpi_operand_object * Mutex
Definition: acobject.h:219
ACPI_OBJECT_COMMON_HEADER UINT8 SyncLevel
Definition: acobject.h:186
UINT16 AcquisitionDepth
Definition: acobject.h:187
ACPI_THREAD_ID ThreadId
Definition: acobject.h:189
ACPI_MUTEX OsMutex
Definition: acobject.h:188
UINT8 OriginalSyncLevel
Definition: acobject.h:194
ACPI_STATE_COMMON UINT8 CurrentSyncLevel
Definition: aclocal.h:764
ACPI_THREAD_ID ThreadId
Definition: aclocal.h:767
ACPI_THREAD_STATE * Thread
Definition: acstruct.h:127
ACPI_OBJECT_MUTEX Mutex
Definition: acobject.h:526

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{
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}
unsigned int UINT32
#define AE_TYPE
Definition: acexcep.h:116
#define AOPOBJ_DATA_VALID
Definition: acobject.h:96
#define ACPI_DB_EXEC
Definition: acoutput.h:165
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_TYPE_BUFFER
Definition: actypes.h:690
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
#define ACPI_ALLOCATE_ZEROED(a)
Definition: actypes.h:385
#define AcpiUtCreateInternalObject(t)
Definition: acutils.h:681
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:790
void AcpiUtDeleteObjectDesc(ACPI_OPERAND_OBJECT *Object)
Definition: utobject.c:473
#define AML_INT_BYTELIST_OP
Definition: amlcode.h:209
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
ACPI_OBJECT_BUFFER Buffer
Definition: acobject.h:522
ACPI_PARSE_OBJ_NAMED Named
Definition: aclocal.h:1079
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3771

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 {
118 Op->Common.Value.String, Status);
120 }
121 }
122 }
123 }
124
125CreateNewObject:
126
127 /* Create and init a new internal ACPI object */
128
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}
@ ACPI_IMODE_EXECUTE
Definition: aclocal.h:169
#define ACPI_ERROR_NAMESPACE(s, p, e)
Definition: acmacros.h:462
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:328
#define ACPI_NS_DONT_OPEN_SCOPE
Definition: acnamesp.h:64
#define ACPI_NS_SEARCH_PARENT
Definition: acnamesp.h:63
const ACPI_OPCODE_INFO * AcpiPsGetOpcodeInfo(UINT16 Opcode)
Definition: psopinfo.c:72
#define ACPI_CAST_INDIRECT_PTR(t, p)
Definition: actypes.h:545
#define ACPI_TYPE_ANY
Definition: actypes.h:687
#define AML_VARIABLE_PACKAGE_OP
Definition: amlcode.h:63
#define AML_PACKAGE_OP
Definition: amlcode.h:62
#define AML_INT_NAMEPATH_OP
Definition: amlcode.h:205
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
ACPI_STATUS AcpiDsInitObjectFromOp(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, UINT16 Opcode, ACPI_OPERAND_OBJECT **RetObjDesc)
Definition: dsobject.c:373
ACPI_NAMESPACE_NODE * Node
Definition: acobject.h:447
ACPI_STATE_COMMON ACPI_NAMESPACE_NODE * Node
Definition: aclocal.h:740
ACPI_GENERIC_STATE * ScopeInfo
Definition: acstruct.h:124
ACPI_SCOPE_STATE Scope
Definition: aclocal.h:825
ACPI_OBJECT_REFERENCE Reference
Definition: acobject.h:540

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{
102 ACPI_OPERAND_OBJECT *ObjDesc = NULL;
104 BOOLEAN ModuleLevelCode = FALSE;
105 UINT16 ReferenceCount;
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
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}
unsigned short UINT16
unsigned char BOOLEAN
#define AE_SUPPORT
Definition: acexcep.h:123
#define AE_NOT_FOUND
Definition: acexcep.h:113
#define ACPI_GET_FUNCTION_NAME
Definition: acgcc.h:67
#define ACPI_EXCEPTION(plist)
Definition: acoutput.h:239
#define ACPI_INFO(plist)
Definition: acoutput.h:237
#define ACPI_DEBUG_PRINT_RAW(pl)
Definition: acoutput.h:476
#define ACPI_DB_INFO
Definition: acoutput.h:153
#define ACPI_PARSE_MODULE_LEVEL
Definition: acparser.h:67
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx 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:732
#define ACPI_TYPE_PACKAGE
Definition: actypes.h:691
#define ACPI_TYPE_METHOD
Definition: actypes.h:695
void AcpiUtAddReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:752
#define AML_INT_RETURN_VALUE_OP
Definition: amlcode.h:211
ACPI_STATUS AcpiDsBuildInternalObject(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, ACPI_OPERAND_OBJECT **ObjDescPtr)
Definition: dsobject.c:72
ACPI_STATUS AcpiDsInitPackageElement(UINT8 ObjectType, ACPI_OPERAND_OBJECT *SourceObject, ACPI_GENERIC_STATE *State, void *Context)
Definition: dspkginit.c:369
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
ACPI_OBJECT_COMMON_HEADER ACPI_NAMESPACE_NODE * Node
Definition: acobject.h:160
union acpi_operand_object ** Elements
Definition: acobject.h:161
ACPI_STATE_COMMON union acpi_operand_object * ObjDesc[ACPI_RESULTS_FRAME_OBJ_NUM]
Definition: aclocal.h:779
UINT8 * Aml
Definition: acstruct.h:91
ACPI_GENERIC_STATE * Results
Definition: acstruct.h:122
UINT32 ParseFlags
Definition: acstruct.h:95
ACPI_RESULT_VALUES Results
Definition: aclocal.h:829
ACPI_OBJECT_PACKAGE Package
Definition: acobject.h:523
_In_ WDFCOLLECTION _In_ ULONG Index

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
659Cleanup:
660
661 /* On error, we must terminate the method properly */
662
663 AcpiDsTerminateControlMethod (ObjDesc, NextWalkState);
664 AcpiDsDeleteWalkState (NextWalkState);
665
667}
#define AE_CTRL_TERMINATE
Definition: acexcep.h:226
#define AE_NULL_OBJECT
Definition: acexcep.h:117
char * AcpiNsGetNormalizedPathname(ACPI_NAMESPACE_NODE *Node, BOOLEAN NoTrailing)
Definition: nsnames.c:367
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
#define ACPI_METHOD_INTERNAL_ONLY
Definition: acobject.h:237
#define ACPI_DB_DISPATCH
Definition: acoutput.h:163
#define ACPI_DB_EVALUATION
Definition: acoutput.h:181
#define ACPI_FREE(a)
Definition: actypes.h:386
void AcpiDsTerminateControlMethod(ACPI_OPERAND_OBJECT *MethodDesc, ACPI_WALK_STATE *WalkState)
Definition: dsmethod.c:779
ACPI_STATUS AcpiDsBeginMethodExecution(ACPI_NAMESPACE_NODE *MethodNode, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_WALK_STATE *WalkState)
Definition: dsmethod.c:352
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
ACPI_NAME_UNION Name
Definition: aclocal.h:191
ACPI_INTERNAL_METHOD Implementation
Definition: acobject.h:224
union acpi_object_method::@614 Dispatch
UINT16 MethodNestingDepth
Definition: acstruct.h:100
char Ascii[4]
Definition: actbl.h:394
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690

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}
#define ACPI_FUNCTION_NAME(a)
Definition: acoutput.h:479
union acpi_operand_object * ImplicitReturnObj
Definition: acstruct.h:112

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;
476}
#define return_VOID
Definition: acoutput.h:495
union acpi_operand_object * Operands[ACPI_OBJ_NUM_OPERANDS+1]
Definition: acstruct.h:105
UINT8 NumOperands
Definition: acstruct.h:80

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{
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 {
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 {
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
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}
unsigned char UINT8
#define ACPI_TYPE_LOCAL_BANK_FIELD
Definition: actypes.h:717
#define ACPI_TYPE_REGION
Definition: actypes.h:697
static ACPI_STATUS AcpiDsGetFieldNames(ACPI_CREATE_FIELD_INFO *Info, ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Arg)
Definition: dsfield.c:324

Referenced by AcpiDsLoad2EndOp().

◆ AcpiDsCreateBufferField()

ACPI_STATUS AcpiDsCreateBufferField ( ACPI_PARSE_OBJECT Op,
ACPI_WALK_STATE WalkState 
)

Definition at line 165 of file dsfield.c.

168{
172 ACPI_OPERAND_OBJECT *ObjDesc;
173 ACPI_OPERAND_OBJECT *SecondDesc = NULL;
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 {
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
299Cleanup:
300
301 /* Remove local reference to the object */
302
303 AcpiUtRemoveReference (ObjDesc);
305}
#define AE_AML_NO_OPERAND
Definition: acexcep.h:181
#define AE_AML_INTERNAL
Definition: acexcep.h:194
#define AE_ALREADY_EXISTS
Definition: acexcep.h:115
@ ACPI_IMODE_LOAD_PASS1
Definition: aclocal.h:167
#define ACPI_NS_TEMPORARY
Definition: acnamesp.h:69
#define ACPI_NS_NO_UPSEARCH
Definition: acnamesp.h:62
#define ACPI_NS_ERROR_IF_FOUND
Definition: acnamesp.h:66
ACPI_STATUS AcpiNsAttachObject(ACPI_NAMESPACE_NODE *Node, ACPI_OPERAND_OBJECT *Object, ACPI_OBJECT_TYPE Type)
Definition: nsobject.c:76
#define ACPI_PARSE_EXECUTE
Definition: acparser.h:61
ACPI_PARSE_OBJECT * AcpiPsGetArg(ACPI_PARSE_OBJECT *op, UINT32 argn)
Definition: pstree.c:76
#define ACPI_PARSE_DISASSEMBLE
Definition: acparser.h:65
#define ACPI_TYPE_BUFFER_FIELD
Definition: actypes.h:701
#define AML_CREATE_FIELD_OP
Definition: amlcode.h:163
UINT32 AmlLength
Definition: acobject.h:485
UINT8 * AmlStart
Definition: acobject.h:484
struct acpi_namespace_node * MethodNode
Definition: acstruct.h:116
struct acpi_namespace_node * DeferredNode
Definition: acstruct.h:111
ACPI_OBJECT_BUFFER_FIELD BufferField
Definition: acobject.h:535
ACPI_OBJECT_EXTRA Extra
Definition: acobject.h:541
ACPI_OBJECT_COMMON Common
Definition: acobject.h:519
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

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{
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 {
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_ADR_SPACE_PLATFORM_COMM
Definition: actypes.h:871
#define ACPI_TYPE_LOCAL_REGION_FIELD
Definition: actypes.h:716
#define memset(x, y, z)
Definition: compat.h:39
union acpi_operand_object * Object
Definition: aclocal.h:187
ACPI_OBJECT_REGION_FIELD Field
Definition: acobject.h:534

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{
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 {
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 {
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
889 Info.RegionNode = RegionNode;
890
891 Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next);
893}
#define ACPI_TYPE_LOCAL_INDEX_FIELD
Definition: actypes.h:718

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}

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;
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 (
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 {
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 AE_NOT_IMPLEMENTED
Definition: acexcep.h:122
#define AE_AML_NAME_NOT_FOUND
Definition: acexcep.h:193
#define AE_AML_BAD_OPCODE
Definition: acexcep.h:180
#define ACPI_PARSEOP_IN_STACK
Definition: aclocal.h:1121
ACPI_INTERPRETER_MODE
Definition: aclocal.h:166
@ ACPI_IMODE_LOAD_PASS2
Definition: aclocal.h:168
#define ACPI_TYPE_INVALID
Definition: actypes.h:742
#define AML_REGION_OP
Definition: amlcode.h:180
#define AML_NSNODE
Definition: amlcode.h:324
#define AML_HAS_RETVAL
Definition: amlcode.h:327
#define AML_EXTERNAL_OP
Definition: amlcode.h:65
#define AML_INT_METHODCALL_OP
Definition: amlcode.h:210
#define AML_CONDITIONAL_REF_OF_OP
Definition: amlcode.h:162
#define AML_ZERO_OP
Definition: amlcode.h:51
ACPI_STATUS AcpiDsResultPop(ACPI_OPERAND_OBJECT **Object, ACPI_WALK_STATE *WalkState)
Definition: dswstate.c:78
ACPI_STATUS AcpiDsObjStackPush(void *Object, ACPI_WALK_STATE *WalkState)
Definition: dswstate.c:342
ACPI_STATUS AcpiExGetNameString(ACPI_OBJECT_TYPE DataType, UINT8 *InAmlAddress, char **OutNameString, UINT32 *OutNameLength)
Definition: exnames.c:278
_In_ PVOID _In_ ULONG Opcode
Definition: hubbusif.h:331
UINT16 Flags
Definition: aclocal.h:873
UINT8 ObjectType
Definition: aclocal.h:874
UINT16 Opcode
Definition: acstruct.h:78

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{
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
815Cleanup:
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 AE_BAD_DATA
Definition: acexcep.h:154
#define ACPI_OBJ_NUM_OPERANDS
Definition: acconfig.h:172
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
UINT8 OperandIndex
Definition: acstruct.h:81

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 {
616 }
617
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}
#define ACPI_DESC_TYPE_WALK
Definition: acobject.h:574
#define return_PTR(s)
Definition: acoutput.h:497
void AcpiDsMethodDataInit(ACPI_WALK_STATE *WalkState)
Definition: dsmthdat.c:100
void AcpiDsPushWalkState(ACPI_WALK_STATE *WalkState, ACPI_THREAD_STATE *Thread)
Definition: dswstate.c:526
_Must_inspect_result_ _In_opt_ PVOID OwnerId
Definition: fsrtlfuncs.h:907
union acpi_parse_object * StartOp
Definition: aclocal.h:1106
union acpi_operand_object * MethodDesc
Definition: acstruct.h:115
ACPI_PARSE_OBJECT * Origin
Definition: acstruct.h:120
UINT8 DescriptorType
Definition: acstruct.h:76
ACPI_OWNER_ID OwnerId
Definition: acstruct.h:82
ACPI_PARSE_STATE ParserState
Definition: acstruct.h:97

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"));
375 }
376
377 if (!ResultObj)
378 {
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
394}
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
BOOLEAN AcpiDsIsResultUsed(ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState)
Definition: dsutils.c:187

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 {
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));
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);
842}
void AcpiPsCleanupScope(ACPI_PARSE_STATE *state)
Definition: psscope.c:277
void AcpiUtDeleteGenericState(ACPI_GENERIC_STATE *State)
Definition: utstate.c:340
union acpi_generic_state * Scope
Definition: aclocal.h:1108
ACPI_GENERIC_STATE * ControlState
Definition: acstruct.h:110

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 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 755 of file dsopcode.c.

758{
760 ACPI_OPERAND_OBJECT *ObjDesc;
761 ACPI_OPERAND_OBJECT *OperandDesc;
763 ACPI_PARSE_OBJECT *NextOp;
765
766
767 ACPI_FUNCTION_TRACE_PTR (DsEvalBankFieldOperands, Op);
768
769
770 /*
771 * This is where we evaluate the BankValue field of the
772 * BankField declaration
773 */
774
775 /* NextOp points to the op that holds the Region */
776
777 NextOp = Op->Common.Value.Arg;
778
779 /* NextOp points to the op that holds the Bank Register */
780
781 NextOp = NextOp->Common.Next;
782
783 /* NextOp points to the op that holds the Bank Value */
784
785 NextOp = NextOp->Common.Next;
786
787 /*
788 * Set proper index into operand stack for AcpiDsObjStackPush
789 * invoked inside AcpiDsCreateOperand.
790 *
791 * We use WalkState->Operands[0] to store the evaluated BankValue
792 */
793 WalkState->OperandIndex = 0;
794
795 Status = AcpiDsCreateOperand (WalkState, NextOp, 0);
796 if (ACPI_FAILURE (Status))
797 {
799 }
800
801 Status = AcpiExResolveToValue (&WalkState->Operands[0], WalkState);
802 if (ACPI_FAILURE (Status))
803 {
805 }
806
808 AcpiPsGetOpcodeName (Op->Common.AmlOpcode), 1);
809 /*
810 * Get the BankValue operand and save it
811 * (at Top of stack)
812 */
813 OperandDesc = WalkState->Operands[0];
814
815 /* Arg points to the start Bank Field */
816
817 Arg = AcpiPsGetArg (Op, 4);
818 while (Arg)
819 {
820 /* Ignore OFFSET and ACCESSAS terms here */
821
822 if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)
823 {
824 Node = Arg->Common.Node;
825
826 ObjDesc = AcpiNsGetAttachedObject (Node);
827 if (!ObjDesc)
828 {
830 }
831
832 ObjDesc->BankField.Value = (UINT32) OperandDesc->Integer.Value;
833 }
834
835 /* Move to next field in the list */
836
837 Arg = Arg->Common.Next;
838 }
839
840 AcpiUtRemoveReference (OperandDesc);
842}
#define AE_NOT_EXIST
Definition: acexcep.h:114
#define ACPI_WALK_OPERANDS
Definition: acinterp.h:48
#define ACPI_DUMP_OPERANDS(a, b, c)
Definition: acoutput.h:486
const char * AcpiPsGetOpcodeName(UINT16 Opcode)
Definition: psopinfo.c:169
#define AML_INT_NAMEDFIELD_OP
Definition: amlcode.h:206
ACPI_STATUS AcpiExResolveToValue(ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState)
Definition: exresolv.c:79
ACPI_OBJECT_BANK_FIELD BankField
Definition: acobject.h:536
ACPI_OBJECT_INTEGER Integer
Definition: acobject.h:520

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}
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_STATUS AcpiDsCreateOperands(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *FirstArg)
Definition: dsutils.c:753
ACPI_STATUS AcpiExResolveOperands(UINT16 Opcode, ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState)
Definition: exresop.c:145

Referenced by AcpiDsExecEndOp().

◆ AcpiDsEvalDataObjectOperands()

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

Definition at line 637 of file dsopcode.c.

641{
643 ACPI_OPERAND_OBJECT *ArgDesc;
645
646
647 ACPI_FUNCTION_TRACE (DsEvalDataObjectOperands);
648
649
650 /* The first operand (for all of these data objects) is the length */
651
652 /*
653 * Set proper index into operand stack for AcpiDsObjStackPush
654 * invoked inside AcpiDsCreateOperand.
655 */
656 WalkState->OperandIndex = WalkState->NumOperands;
657
658 /* Ignore if child is not valid */
659
660 if (!Op->Common.Value.Arg)
661 {
663 "Missing child while evaluating opcode %4.4X, Op %p",
664 Op->Common.AmlOpcode, Op));
666 }
667
668 Status = AcpiDsCreateOperand (WalkState, Op->Common.Value.Arg, 1);
669 if (ACPI_FAILURE (Status))
670 {
672 }
673
674 Status = AcpiExResolveOperands (WalkState->Opcode,
675 &(WalkState->Operands [WalkState->NumOperands -1]),
676 WalkState);
677 if (ACPI_FAILURE (Status))
678 {
680 }
681
682 /* Extract length operand */
683
684 ArgDesc = WalkState->Operands [WalkState->NumOperands - 1];
685 Length = (UINT32) ArgDesc->Integer.Value;
686
687 /* Cleanup for length operand */
688
689 Status = AcpiDsObjStackPop (1, WalkState);
690 if (ACPI_FAILURE (Status))
691 {
693 }
694
695 AcpiUtRemoveReference (ArgDesc);
696
697 /*
698 * Create the actual data object
699 */
700 switch (Op->Common.AmlOpcode)
701 {
702 case AML_BUFFER_OP:
703
705 WalkState, Op, Length, &ObjDesc);
706 break;
707
708 case AML_PACKAGE_OP:
710
712 WalkState, Op, Length, &ObjDesc);
713 break;
714
715 default:
716
718 }
719
720 if (ACPI_SUCCESS (Status))
721 {
722 /*
723 * Return the object in the WalkState, unless the parent is a package -
724 * in this case, the return object will be stored in the parse tree
725 * for the package.
726 */
727 if ((!Op->Common.Parent) ||
728 ((Op->Common.Parent->Common.AmlOpcode != AML_PACKAGE_OP) &&
729 (Op->Common.Parent->Common.AmlOpcode != AML_VARIABLE_PACKAGE_OP) &&
730 (Op->Common.Parent->Common.AmlOpcode != AML_NAME_OP)))
731 {
732 WalkState->ResultObj = ObjDesc;
733 }
734 }
735
737}
#define AML_NAME_OP
Definition: amlcode.h:54
#define AML_BUFFER_OP
Definition: amlcode.h:61
ACPI_STATUS AcpiDsBuildInternalBufferObj(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, UINT32 BufferLength, ACPI_OPERAND_OBJECT **ObjDescPtr)
Definition: dsobject.c:188
ACPI_STATUS AcpiDsBuildInternalPackageObj(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, UINT32 ElementCount, ACPI_OPERAND_OBJECT **ObjDescPtr)
Definition: dspkginit.c:94
ACPI_STATUS AcpiDsObjStackPop(UINT32 PopCount, ACPI_WALK_STATE *WalkState)
Definition: dswstate.c:391
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
union acpi_operand_object * ResultObj
Definition: acstruct.h:121

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
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}
#define ACPI_FORMAT_UINT64(i)
Definition: acmacros.h:71
#define ACPI_WARNING(plist)
Definition: acoutput.h:238
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx 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:832
UINT8 ACPI_ADR_SPACE_TYPE
Definition: actypes.h:859
#define ACPI_NUM_PREDEFINED_REGIONS
Definition: actypes.h:874
ACPI_STATUS AcpiUtAddAddressRange(ACPI_ADR_SPACE_TYPE SpaceId, ACPI_PHYSICAL_ADDRESS Address, UINT32 Length, ACPI_NAMESPACE_NODE *RegionNode)
Definition: utaddress.c:78
ACPI_OBJECT_COMMON_HEADER UINT8 SpaceId
Definition: acobject.h:202
ACPI_PHYSICAL_ADDRESS Address
Definition: acobject.h:206
ACPI_OBJECT_REGION Region
Definition: acobject.h:527

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 ObjDesc->Region.Pointer = Table;
603
604 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
605 ObjDesc, ACPI_FORMAT_UINT64 (ObjDesc->Region.Address),
606 ObjDesc->Region.Length));
607
608 /* Now the address and length are valid for this opregion */
609
610 ObjDesc->Region.Flags |= AOPOBJ_DATA_VALID;
611
612Cleanup:
613 AcpiUtRemoveReference (Operand[0]);
614 AcpiUtRemoveReference (Operand[1]);
615 AcpiUtRemoveReference (Operand[2]);
616
618}
ACPI_STATUS AcpiTbFindTable(char *Signature, char *OemId, char *OemTableId, UINT32 *TableIndex)
Definition: tbfind.c:70
#define ACPI_PTR_TO_PHYSADDR(i)
Definition: actypes.h:559
ASMGENDATA Table[]
Definition: genincdata.c:61
ACPI_STATUS AcpiGetTableByIndex(UINT32 TableIndex, ACPI_TABLE_HEADER **OutTable)
Definition: tbxface.c:491
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433

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
925PushResult:
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
937Exit:
938
940}
Type
Definition: Type.h:7
#define ACPI_PARSEOP_TARGET
Definition: aclocal.h:1122
#define ACPI_TYPE_INTEGER
Definition: actypes.h:688
ACPI_STATUS AcpiUtCopyIobjectToIobject(ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT **DestDesc, ACPI_WALK_STATE *WalkState)
Definition: utcopy.c:1037
#define AML_REF_OF_OP
Definition: amlcode.h:89
ACPI_STATUS AcpiDsResultPush(ACPI_OPERAND_OBJECT *Object, ACPI_WALK_STATE *WalkState)
Definition: dswstate.c:160
static void Exit(void)
Definition: sock.c:1330
ACPI_PARSE_OBJECT * Op
Definition: acstruct.h:118

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
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}
unsigned long long UINT64
#define AE_CTRL_TRUE
Definition: acexcep.h:227
#define ACPI_CONTROL_CONDITIONAL_EXECUTING
Definition: aclocal.h:670
UINT64 AcpiOsGetTimer(void)
Definition: osl.c:884
#define ACPI_100NSEC_PER_SEC
Definition: actypes.h:475
#define ACPI_FALLTHROUGH
Definition: actypes.h:1466
ACPI_GENERIC_STATE * AcpiUtCreateControlState(void)
Definition: utstate.c:300
void AcpiUtPushGenericState(ACPI_GENERIC_STATE **ListHead, ACPI_GENERIC_STATE *State)
Definition: utstate.c:65
#define AML_RETURN_OP
Definition: amlcode.h:138
#define AML_IF_OP
Definition: amlcode.h:134
#define AML_ELSE_OP
Definition: amlcode.h:135
#define AML_WHILE_OP
Definition: amlcode.h:136
UINT64 LoopTimeout
Definition: aclocal.h:729
UINT8 * AmlPredicateStart
Definition: aclocal.h:727
UINT8 * PackageEnd
Definition: aclocal.h:728
ACPI_STATE_COMMON UINT16 Opcode
Definition: aclocal.h:725
UINT8 * PkgEnd
Definition: aclocal.h:1105
BOOLEAN LastPredicate
Definition: acstruct.h:83
ACPI_COMMON_STATE Common
Definition: aclocal.h:822
ACPI_CONTROL_STATE Control
Definition: aclocal.h:823

Referenced by AcpiDsExecBeginOp().

◆ AcpiDsExecBeginOp()

ACPI_STATUS AcpiDsExecBeginOp ( ACPI_WALK_STATE WalkState,
ACPI_PARSE_OBJECT **  OutOp 
)

Definition at line 234 of file dswexec.c.

237{
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 {
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
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
372 Status = AcpiDsMethodError (Status, WalkState);
374}
#define ACPI_CONTROL_PREDICATE_EXECUTING
Definition: aclocal.h:671
UINT32 AcpiNsOpensScope(ACPI_OBJECT_TYPE Type)
Definition: nsutils.c:736
#define ACPI_WALK_METHOD
Definition: acstruct.h:69
const char * AcpiUtGetTypeName(ACPI_OBJECT_TYPE Type)
Definition: utdecode.c:250
#define AML_CLASS_NAMED_OBJECT
Definition: amlcode.h:403
#define AML_CLASS_EXECUTE
Definition: amlcode.h:400
#define AML_CLASS_CREATE
Definition: amlcode.h:401
#define AML_CLASS_CONTROL
Definition: amlcode.h:404
#define AML_SCOPE_OP
Definition: amlcode.h:60
ACPI_STATUS AcpiDsExecBeginControlOp(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
Definition: dscontrol.c:71
ACPI_STATUS AcpiDsMethodError(ACPI_STATUS Status, ACPI_WALK_STATE *WalkState)
Definition: dsmethod.c:223
ACPI_STATUS AcpiDsLoad2BeginOp(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT **OutOp)
Definition: dswload2.c:74
ACPI_STATUS AcpiDsScopeStackPush(ACPI_NAMESPACE_NODE *Node, ACPI_OBJECT_TYPE Type, ACPI_WALK_STATE *WalkState)
Definition: dswscope.c:107
ACPI_STATUS AcpiDsScopeStackPop(ACPI_WALK_STATE *WalkState)
Definition: dswscope.c:192
union acpi_parse_object * PredicateOp
Definition: aclocal.h:726
const ACPI_OPCODE_INFO * OpInfo
Definition: acstruct.h:119
UINT8 WalkType
Definition: acstruct.h:77
static VOID ErrorExit(LPTSTR lpszMessage)
Definition: telnetd.c:647

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
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}
#define AE_CTRL_CONTINUE
Definition: acexcep.h:233
#define AE_AML_LOOP_TIMEOUT
Definition: acexcep.h:212
#define AE_CTRL_PENDING
Definition: acexcep.h:225
#define AE_CTRL_BREAK
Definition: acexcep.h:232
#define AE_AML_NO_WHILE
Definition: acexcep.h:205
#define ACPI_GET_DESCRIPTOR_TYPE(d)
Definition: acmacros.h:414
#define ACPI_DESC_TYPE_OPERAND
Definition: acobject.h:576
@ ACPI_REFCLASS_INDEX
Definition: acobject.h:462
#define ACPI_SIGNAL_BREAKPOINT
Definition: acpiosxf.h:74
ACPI_STATUS AcpiOsSignal(UINT32 Function, void *Info)
Definition: osl.c:904
#define ACPI_TYPE_LOCAL_REFERENCE
Definition: actypes.h:719
#define ACPI_TIME_AFTER(a, b)
Definition: actypes.h:481
ACPI_GENERIC_STATE * AcpiUtPopGenericState(ACPI_GENERIC_STATE **ListHead)
Definition: utstate.c:93
#define AML_BREAK_OP
Definition: amlcode.h:139
#define AML_BREAKPOINT_OP
Definition: amlcode.h:141
#define AML_NOOP_OP
Definition: amlcode.h:137
#define AML_CONTINUE_OP
Definition: amlcode.h:133
#define BOOLEAN
Definition: pedump.c:73
union acpi_operand_object * ReturnDesc
Definition: acstruct.h:123
UINT8 * AmlLastWhile
Definition: acstruct.h:108
UINT8 ResultCount
Definition: acstruct.h:90

Referenced by AcpiDsExecEndOp().

◆ AcpiDsExecEndOp()

ACPI_STATUS AcpiDsExecEndOp ( ACPI_WALK_STATE State)

Definition at line 392 of file dswexec.c.

394{
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
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
668
670
671 Status = AcpiDsEvalDataObjectOperands (WalkState, Op,
672 AcpiNsGetAttachedObject (Op->Common.Parent->Common.Node));
673 break;
674
675 default:
676
677 Status = AcpiDsEvalDataObjectOperands (WalkState, Op, NULL);
678 break;
679 }
680
681 /*
682 * If a result object was returned from above, push it on the
683 * current result stack
684 */
685 if (WalkState->ResultObj)
686 {
687 Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);
688 }
689 break;
690
695
696 Status = AcpiDsLoad2EndOp (WalkState);
697 if (ACPI_FAILURE (Status))
698 {
699 break;
700 }
701
702 if (Op->Common.AmlOpcode == AML_REGION_OP)
703 {
705 "Executing OpRegion Address/Length Op=%p\n", Op));
706
707 Status = AcpiDsEvalRegionOperands (WalkState, Op);
708 if (ACPI_FAILURE (Status))
709 {
710 break;
711 }
712 }
713 else if (Op->Common.AmlOpcode == AML_DATA_REGION_OP)
714 {
716 "Executing DataTableRegion Strings Op=%p\n", Op));
717
718 Status = AcpiDsEvalTableRegionOperands (WalkState, Op);
719 if (ACPI_FAILURE (Status))
720 {
721 break;
722 }
723 }
724 else if (Op->Common.AmlOpcode == AML_BANK_FIELD_OP)
725 {
727 "Executing BankField Op=%p\n", Op));
728
729 Status = AcpiDsEvalBankFieldOperands (WalkState, Op);
730 if (ACPI_FAILURE (Status))
731 {
732 break;
733 }
734 }
735 break;
736
738
740 "Undefined opcode type Op=%p", Op));
742
743 case AML_TYPE_BOGUS:
744
746 "Internal opcode=%X type Op=%p\n",
747 WalkState->Opcode, Op));
748 break;
749
750 default:
751
753 "Unimplemented opcode, class=0x%X "
754 "type=0x%X Opcode=0x%X Op=%p",
755 OpClass, OpType, Op->Common.AmlOpcode, Op));
756
758 break;
759 }
760 }
761
762 /*
763 * ACPI 2.0 support for 64-bit integers: Truncate numeric
764 * result value if we are executing from a 32-bit ACPI table
765 */
766 (void) AcpiExTruncateFor32bitTable (WalkState->ResultObj);
767
768 /*
769 * Check if we just completed the evaluation of a
770 * conditional predicate
771 */
772 if ((ACPI_SUCCESS (Status)) &&
773 (WalkState->ControlState) &&
774 (WalkState->ControlState->Common.State ==
776 (WalkState->ControlState->Control.PredicateOp == Op))
777 {
778 Status = AcpiDsGetPredicateValue (WalkState, WalkState->ResultObj);
779 WalkState->ResultObj = NULL;
780 }
781
782
783Cleanup:
784
785 if (WalkState->ResultObj)
786 {
787 /* Break to debugger to display result */
788
789 AcpiDbDisplayResultObject (WalkState->ResultObj,WalkState);
790
791 /*
792 * Delete the result op if and only if:
793 * Parent will not use the result -- such as any
794 * non-nested type2 op in a method (parent will be method)
795 */
796 AcpiDsDeleteResultIfNotUsed (Op, WalkState->ResultObj, WalkState);
797 }
798
799#ifdef _UNDER_DEVELOPMENT
800
801 if (WalkState->ParserState.Aml == WalkState->ParserState.AmlEnd)
802 {
803 AcpiDbMethodEnd (WalkState);
804 }
805#endif
806
807 /* Invoke exception handler on error */
808
809 if (ACPI_FAILURE (Status))
810 {
811 Status = AcpiDsMethodError (Status, WalkState);
812 }
813
814 /* Always clear the object stack */
815
816 WalkState->NumOperands = 0;
818}
#define AE_CTRL_TRANSFER
Definition: acexcep.h:231
#define AE_AML_UNINITIALIZED_LOCAL
Definition: acexcep.h:184
char * AcpiNsGetExternalPathname(ACPI_NAMESPACE_NODE *Node)
Definition: nsnames.c:70
#define AML_CLASS_ARGUMENT
Definition: amlcode.h:402
#define AML_TYPE_NAMED_NO_OBJ
Definition: amlcode.h:382
#define AML_TYPE_UNDEFINED
Definition: amlcode.h:387
#define AML_TYPE_CREATE_FIELD
Definition: amlcode.h:379
#define AML_BANK_FIELD_OP
Definition: amlcode.h:187
#define AML_INT_EVAL_SUBTREE_OP
Definition: amlcode.h:212
#define AML_TYPE_NAMED_SIMPLE
Definition: amlcode.h:384
#define AML_STORE_OP
Definition: amlcode.h:88
#define AML_TYPE_METHOD_CALL
Definition: amlcode.h:375
#define AML_DATA_REGION_OP
Definition: amlcode.h:188
#define AML_TYPE_NAMED_FIELD
Definition: amlcode.h:383
#define AML_TYPE_BOGUS
Definition: amlcode.h:388
#define AML_TYPE_CREATE_OBJECT
Definition: amlcode.h:380
#define AML_TYPE_CONTROL
Definition: amlcode.h:381
#define AML_NO_OPERAND_RESOLVE
Definition: amlcode.h:331
#define AML_CLASS_UNKNOWN
Definition: amlcode.h:410
#define AML_TYPE_NAMED_COMPLEX
Definition: amlcode.h:385
ACPI_STATUS AcpiDsExecEndControlOp(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
Definition: dscontrol.c:177
ACPI_STATUS AcpiDsCreateNode(ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE *Node, ACPI_PARSE_OBJECT *Op)
Definition: dsobject.c:302
ACPI_STATUS AcpiDsEvalTableRegionOperands(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
Definition: dsopcode.c:519
ACPI_STATUS AcpiDsEvalBufferFieldOperands(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
Definition: dsopcode.c:321
ACPI_STATUS AcpiDsEvalBankFieldOperands(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
Definition: dsopcode.c:755
ACPI_STATUS AcpiDsEvalRegionOperands(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
Definition: dsopcode.c:408
ACPI_STATUS AcpiDsEvalDataObjectOperands(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, ACPI_OPERAND_OBJECT *ObjDesc)
Definition: dsopcode.c:637
void AcpiDsDeleteResultIfNotUsed(ACPI_PARSE_OBJECT *Op, ACPI_OPERAND_OBJECT *ResultObj, ACPI_WALK_STATE *WalkState)
Definition: dsutils.c:359
void AcpiDsClearOperands(ACPI_WALK_STATE *WalkState)
Definition: dsutils.c:453
ACPI_STATUS AcpiDsResolveOperands(ACPI_WALK_STATE *WalkState)
Definition: dsutils.c:412
ACPI_STATUS AcpiDsEvaluateNamePath(ACPI_WALK_STATE *WalkState)
Definition: dsutils.c:845
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 AcpiDsLoad2EndOp(ACPI_WALK_STATE *WalkState)
Definition: dswload2.c:418
ACPI_STATUS AcpiExWriteDataToField(ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc)
Definition: exfield.c:317
BOOLEAN AcpiExTruncateFor32bitTable(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: exutils.c:177
OpClass
Definition: simd.h:241
OpType
Definition: simd.h:223
ACPI_PARSE_OBJ_ASL Asl
Definition: aclocal.h:1080

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}
ACPI_OPERAND_OBJECT * AcpiNsGetSecondaryObject(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: nsobject.c:346
#define ACPI_DEBUG_EXEC(a)
Definition: acoutput.h:477
static ACPI_STATUS AcpiDsExecuteArguments(ACPI_NAMESPACE_NODE *Node, ACPI_NAMESPACE_NODE *ScopeNode, UINT32 AmlLength, UINT8 *AmlStart)
Definition: dsargs.c:81

Referenced by AcpiNsInitOneObject().

◆ AcpiDsGetBufferArguments()

ACPI_STATUS AcpiDsGetBufferArguments ( ACPI_OPERAND_OBJECT ObjDesc)

Definition at line 294 of file dsargs.c.

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

Referenced by AcpiExOpcode_1A_0T_1R(), AcpiExPrepFieldValue(), AcpiExResolveNodeToValue(), and AcpiExResolveObjectToValue().

◆ AcpiDsGetBufferFieldArguments()

ACPI_STATUS AcpiDsGetBufferFieldArguments ( ACPI_OPERAND_OBJECT ObjDesc)

Definition at line 196 of file dsargs.c.

198{
199 ACPI_OPERAND_OBJECT *ExtraDesc;
202
203
204 ACPI_FUNCTION_TRACE_PTR (DsGetBufferFieldArguments, ObjDesc);
205
206
207 if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
208 {
210 }
211
212 /* Get the AML pointer (method object) and BufferField node */
213
214 ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
215 Node = ObjDesc->BufferField.Node;
216
217 ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (
219
220 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BufferField Arg Init\n",
222
223 /* Execute the AML code for the TermArg arguments */
224
226 ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
228}

Referenced by AcpiExFieldDatumIo(), AcpiExReadDataFromField(), and AcpiExWriteDataToField().

◆ AcpiDsGetCurrentWalkState()

ACPI_WALK_STATE * AcpiDsGetCurrentWalkState ( ACPI_THREAD_STATE Thread)

Definition at line 494 of file dswstate.c.

496{
497 ACPI_FUNCTION_NAME (DsGetCurrentWalkState);
498
499
500 if (!Thread)
501 {
502 return (NULL);
503 }
504
505 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Current WalkState %p\n",
506 Thread->WalkStateList));
507
508 return (Thread->WalkStateList);
509}

Referenced by AcpiPsParseAml().

◆ AcpiDsGetPackageArguments()

ACPI_STATUS AcpiDsGetPackageArguments ( ACPI_OPERAND_OBJECT ObjDesc)

Definition at line 344 of file dsargs.c.

346{
349
350
351 ACPI_FUNCTION_TRACE_PTR (DsGetPackageArguments, ObjDesc);
352
353
354 if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
355 {
357 }
358
359 /* Get the Package node */
360
361 Node = ObjDesc->Package.Node;
362 if (!Node)
363 {
365 "No pointer back to namespace node in package %p", ObjDesc));
367 }
368
369 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Package Argument Init, AML Ptr: %p\n",
370 ObjDesc->Package.AmlStart));
371
372 /* Execute the AML code for the TermArg arguments */
373
375 ObjDesc->Package.AmlLength, ObjDesc->Package.AmlStart);
376
378}

Referenced by AcpiExOpcode_1A_0T_1R(), AcpiExResolveNodeToValue(), AcpiExResolveObjectToValue(), and AcpiNsInitOnePackage().

◆ AcpiDsGetPredicateValue()

ACPI_STATUS AcpiDsGetPredicateValue ( ACPI_WALK_STATE WalkState,
ACPI_OPERAND_OBJECT ResultObj 
)

Definition at line 94 of file dswexec.c.

97{
99 ACPI_OPERAND_OBJECT *ObjDesc;
100 ACPI_OPERAND_OBJECT *LocalObjDesc = NULL;
101
102
103 ACPI_FUNCTION_TRACE_PTR (DsGetPredicateValue, WalkState);
104
105
106 WalkState->ControlState->Common.State = 0;
107
108 if (ResultObj)
109 {
110 Status = AcpiDsResultPop (&ObjDesc, WalkState);
111 if (ACPI_FAILURE (Status))
112 {
114 "Could not get result from predicate evaluation"));
115
117 }
118 }
119 else
120 {
121 Status = AcpiDsCreateOperand (WalkState, WalkState->Op, 0);
122 if (ACPI_FAILURE (Status))
123 {
125 }
126
127 Status = AcpiExResolveToValue (&WalkState->Operands [0], WalkState);
128 if (ACPI_FAILURE (Status))
129 {
131 }
132
133 ObjDesc = WalkState->Operands [0];
134 }
135
136 if (!ObjDesc)
137 {
139 "No predicate ObjDesc=%p State=%p",
140 ObjDesc, WalkState));
141
143 }
144
145 /*
146 * Result of predicate evaluation must be an Integer
147 * object. Implicitly convert the argument if necessary.
148 */
149 Status = AcpiExConvertToInteger (ObjDesc, &LocalObjDesc,
151 if (ACPI_FAILURE (Status))
152 {
153 goto Cleanup;
154 }
155
156 if (LocalObjDesc->Common.Type != ACPI_TYPE_INTEGER)
157 {
159 "Bad predicate (not an integer) ObjDesc=%p State=%p Type=0x%X",
160 ObjDesc, WalkState, ObjDesc->Common.Type));
161
163 goto Cleanup;
164 }
165
166 /* Truncate the predicate to 32-bits if necessary */
167
168 (void) AcpiExTruncateFor32bitTable (LocalObjDesc);
169
170 /*
171 * Save the result of the predicate evaluation on
172 * the control stack
173 */
174 if (LocalObjDesc->Integer.Value)
175 {
176 WalkState->ControlState->Common.Value = TRUE;
177 }
178 else
179 {
180 /*
181 * Predicate is FALSE, we will just toss the
182 * rest of the package
183 */
184 WalkState->ControlState->Common.Value = FALSE;
186 }
187
188 /* Predicate can be used for an implicit return value */
189
190 (void) AcpiDsDoImplicitReturn (LocalObjDesc, WalkState, TRUE);
191
192
193Cleanup:
194
196 "Completed a predicate eval=%X Op=%p\n",
197 WalkState->ControlState->Common.Value, WalkState->Op));
198
199 /* Break to debugger to display result */
200
201 AcpiDbDisplayResultObject (LocalObjDesc, WalkState);
202
203 /*
204 * Delete the predicate result object (we know that
205 * we don't need it anymore)
206 */
207 if (LocalObjDesc != ObjDesc)
208 {
209 AcpiUtRemoveReference (LocalObjDesc);
210 }
211 AcpiUtRemoveReference (ObjDesc);
212
213 WalkState->ControlState->Common.State = ACPI_CONTROL_NORMAL;
215}
#define AE_CTRL_FALSE
Definition: acexcep.h:228
#define AE_AML_OPERAND_TYPE
Definition: acexcep.h:182
#define ACPI_CONTROL_NORMAL
Definition: aclocal.h:669
#define ACPI_IMPLICIT_CONVERSION
Definition: acutils.h:145
BOOLEAN AcpiDsDoImplicitReturn(ACPI_OPERAND_OBJECT *ReturnDesc, ACPI_WALK_STATE *WalkState, BOOLEAN AddReference)
Definition: dsutils.c:123
ACPI_STATUS AcpiExConvertToInteger(ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc, UINT32 ImplicitConversion)
Definition: exconvrt.c:79

Referenced by AcpiDsExecEndOp(), and AcpiPsParseLoop().

◆ AcpiDsGetRegionArguments()

ACPI_STATUS AcpiDsGetRegionArguments ( ACPI_OPERAND_OBJECT RgnDesc)

Definition at line 395 of file dsargs.c.

397{
400 ACPI_OPERAND_OBJECT *ExtraDesc;
401
402
403 ACPI_FUNCTION_TRACE_PTR (DsGetRegionArguments, ObjDesc);
404
405
406 if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
407 {
409 }
410
411 ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
412 if (!ExtraDesc)
413 {
415 }
416
417 /* Get the Region node */
418
419 Node = ObjDesc->Region.Node;
420
421 ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (
423
425 "[%4.4s] OpRegion Arg Init at AML %p\n",
426 AcpiUtGetNodeName (Node), ExtraDesc->Extra.AmlStart));
427
428 /* Execute the argument AML */
429
431 ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
432 if (ACPI_FAILURE (Status))
433 {
435 }
436
437 Status = AcpiUtAddAddressRange (ObjDesc->Region.SpaceId,
438 ObjDesc->Region.Address, ObjDesc->Region.Length, Node);
440}
ACPI_NAMESPACE_NODE * ScopeNode
Definition: acobject.h:482

Referenced by AcpiExLoadOp(), and AcpiExSetupRegion().

◆ AcpiDsInitAmlWalk()

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 at line 662 of file dswstate.c.

670{
672 ACPI_PARSE_STATE *ParserState = &WalkState->ParserState;
673 ACPI_PARSE_OBJECT *ExtraOp;
674
675
676 ACPI_FUNCTION_TRACE (DsInitAmlWalk);
677
678
679 WalkState->ParserState.Aml =
680 WalkState->ParserState.AmlStart = AmlStart;
681 WalkState->ParserState.AmlEnd =
682 WalkState->ParserState.PkgEnd = AmlStart + AmlLength;
683
684 /* The NextOp of the NextWalk will be the beginning of the method */
685
686 WalkState->NextOp = NULL;
687 WalkState->PassNumber = PassNumber;
688
689 if (Info)
690 {
691 WalkState->Params = Info->Parameters;
692 WalkState->CallerReturnDesc = &Info->ReturnObject;
693 }
694
695 Status = AcpiPsInitScope (&WalkState->ParserState, Op);
696 if (ACPI_FAILURE (Status))
697 {
699 }
700
701 if (MethodNode)
702 {
703 WalkState->ParserState.StartNode = MethodNode;
704 WalkState->WalkType = ACPI_WALK_METHOD;
705 WalkState->MethodNode = MethodNode;
706 WalkState->MethodDesc = AcpiNsGetAttachedObject (MethodNode);
707
708 /* Push start scope on scope stack and make it current */
709
711 MethodNode, ACPI_TYPE_METHOD, WalkState);
712 if (ACPI_FAILURE (Status))
713 {
715 }
716
717 /* Init the method arguments */
718
720 ACPI_METHOD_NUM_ARGS, WalkState);
721 if (ACPI_FAILURE (Status))
722 {
724 }
725 }
726 else
727 {
728 /*
729 * Setup the current scope.
730 * Find a Named Op that has a namespace node associated with it.
731 * search upwards from this Op. Current scope is the first
732 * Op with a namespace node.
733 */
734 ExtraOp = ParserState->StartOp;
735 while (ExtraOp && !ExtraOp->Common.Node)
736 {
737 ExtraOp = ExtraOp->Common.Parent;
738 }
739
740 if (!ExtraOp)
741 {
742 ParserState->StartNode = NULL;
743 }
744 else
745 {
746 ParserState->StartNode = ExtraOp->Common.Node;
747 }
748
749 if (ParserState->StartNode)
750 {
751 /* Push start scope on scope stack and make it current */
752
753 Status = AcpiDsScopeStackPush (ParserState->StartNode,
754 ParserState->StartNode->Type, WalkState);
755 if (ACPI_FAILURE (Status))
756 {
758 }
759 }
760 }
761
762 Status = AcpiDsInitCallbacks (WalkState, PassNumber);
764}
ACPI_STATUS AcpiPsInitScope(ACPI_PARSE_STATE *ParserState, ACPI_PARSE_OBJECT *Root)
Definition: psscope.c:112
#define ACPI_METHOD_NUM_ARGS
Definition: acconfig.h:166
ACPI_STATUS AcpiDsMethodDataInitArgs(ACPI_OPERAND_OBJECT **Params, UINT32 MaxParamCount, ACPI_WALK_STATE *WalkState)
Definition: dsmthdat.c:213
ACPI_STATUS AcpiDsInitCallbacks(ACPI_WALK_STATE *WalkState, UINT32 PassNumber)
Definition: dswload.c:73
UINT8 * AmlEnd
Definition: aclocal.h:1103
struct acpi_namespace_node * StartNode
Definition: aclocal.h:1107
UINT8 * AmlStart
Definition: aclocal.h:1101
ACPI_PARSE_OBJECT * NextOp
Definition: acstruct.h:126
union acpi_operand_object ** Params
Definition: acstruct.h:106
UINT8 PassNumber
Definition: acstruct.h:87
union acpi_operand_object ** CallerReturnDesc
Definition: acstruct.h:109

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

◆ AcpiDsInitCallbacks()

ACPI_STATUS AcpiDsInitCallbacks ( ACPI_WALK_STATE WalkState,
UINT32  PassNumber 
)

Definition at line 73 of file dswload.c.

76{
77
78 switch (PassNumber)
79 {
80 case 0:
81
82 /* Parse only - caller will setup callbacks */
83
87 WalkState->DescendingCallback = NULL;
88 WalkState->AscendingCallback = NULL;
89 break;
90
91 case 1:
92
93 /* Load pass 1 */
94
99 break;
100
101 case 2:
102
103 /* Load pass 2 */
104
105 WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 |
109 break;
110
111 case 3:
112
113 /* Execution pass */
114
115 WalkState->ParseFlags |= ACPI_PARSE_EXECUTE |
119 break;
120
121 default:
122
123 return (AE_BAD_PARAMETER);
124 }
125
126 return (AE_OK);
127}
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
#define ACPI_PARSE_LOAD_PASS1
Definition: acparser.h:59
#define ACPI_PARSE_DELETE_TREE
Definition: acparser.h:55
ACPI_STATUS AcpiDsExecEndOp(ACPI_WALK_STATE *WalkState)
Definition: dswexec.c:392
ACPI_STATUS AcpiDsExecBeginOp(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT **OutOp)
Definition: dswexec.c:234
ACPI_STATUS AcpiDsLoad1EndOp(ACPI_WALK_STATE *WalkState)
Definition: dswload.c:443
ACPI_STATUS AcpiDsLoad1BeginOp(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT **OutOp)
Definition: dswload.c:144
ACPI_PARSE_UPWARDS AscendingCallback
Definition: acstruct.h:129

Referenced by AcpiDsInitAmlWalk().

◆ AcpiDsInitFieldObjects()

ACPI_STATUS AcpiDsInitFieldObjects ( ACPI_PARSE_OBJECT Op,
ACPI_WALK_STATE WalkState 
)

Definition at line 617 of file dsfield.c.

620{
622 ACPI_PARSE_OBJECT *Arg = NULL;
624 UINT8 Type = 0;
626
627
628 ACPI_FUNCTION_TRACE_PTR (DsInitFieldObjects, Op);
629
630
631 /* Execute flag should always be set when this function is entered */
632
633 if (!(WalkState->ParseFlags & ACPI_PARSE_EXECUTE))
634 {
635 if (WalkState->ParseFlags & ACPI_PARSE_DEFERRED_OP)
636 {
637 /* BankField Op is deferred, just return OK */
638
640 }
641
643 "Parse deferred mode is not set"));
645 }
646
647 /*
648 * Get the FieldList argument for this opcode. This is the start of the
649 * list of field elements.
650 */
651 switch (WalkState->Opcode)
652 {
653 case AML_FIELD_OP:
654
655 Arg = AcpiPsGetArg (Op, 2);
657 break;
658
660
661 Arg = AcpiPsGetArg (Op, 4);
663 break;
664
666
667 Arg = AcpiPsGetArg (Op, 3);
669 break;
670
671 default:
672
674 }
675
676 /* Creating new namespace node(s), should not already exist */
677
680
681 /*
682 * Mark node(s) temporary if we are executing a normal control
683 * method. (Don't mark if this is a module-level code method)
684 */
685 if (WalkState->MethodNode &&
686 !(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL))
687 {
689 }
690
691#ifdef ACPI_EXEC_APP
693#endif
694 /*
695 * Walk the list of entries in the FieldList
696 * Note: FieldList can be of zero length. In this case, Arg will be NULL.
697 */
698 while (Arg)
699 {
700 /*
701 * Ignore OFFSET/ACCESSAS/CONNECTION terms here; we are only interested
702 * in the field names in order to enter them into the namespace.
703 */
704 if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)
705 {
706 Status = AcpiNsLookup (WalkState->ScopeInfo,
707 (char *) &Arg->Named.Name, Type, ACPI_IMODE_LOAD_PASS1,
708 Flags, WalkState, &Node);
709 if (ACPI_FAILURE (Status))
710 {
712 (char *) &Arg->Named.Name, Status);
714 {
716 }
717
718 /* Name already exists, just ignore this error */
719 }
720
721 Arg->Common.Node = Node;
722 }
723
724 /* Get the next field element in the list */
725
726 Arg = Arg->Common.Next;
727 }
728
730}
#define ACPI_NS_OVERRIDE_IF_FOUND
Definition: acnamesp.h:70
#define ACPI_PARSE_DEFERRED_OP
Definition: acparser.h:64
#define AML_INDEX_FIELD_OP
Definition: amlcode.h:186
#define AML_FIELD_OP
Definition: amlcode.h:181

Referenced by AcpiDsLoad1EndOp(), and AcpiDsLoad2EndOp().

◆ AcpiDsInitializeObjects()

ACPI_STATUS AcpiDsInitializeObjects ( UINT32  TableIndex,
ACPI_NAMESPACE_NODE StartNode 
)

Definition at line 204 of file dsinit.c.

207{
212
213
214 ACPI_FUNCTION_TRACE (DsInitializeObjects);
215
216
217 Status = AcpiTbGetOwnerId (TableIndex, &OwnerId);
218 if (ACPI_FAILURE (Status))
219 {
221 }
222
224 "**** Starting initialization of namespace objects ****\n"));
225
226 /* Set all init info to zero */
227
228 memset (&Info, 0, sizeof (ACPI_INIT_WALK_INFO));
229
230 Info.OwnerId = OwnerId;
231 Info.TableIndex = TableIndex;
232
233 /* Walk entire namespace from the supplied root */
234
235 /*
236 * We don't use AcpiWalkNamespace since we do not want to acquire
237 * the namespace reader lock.
238 */
241 if (ACPI_FAILURE (Status))
242 {
243 ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace"));
244 }
245
246 Status = AcpiGetTableByIndex (TableIndex, &Table);
247 if (ACPI_FAILURE (Status))
248 {
250 }
251
252 /* DSDT is always the first AML table */
253
254 if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_DSDT))
255 {
257 "\nACPI table initialization:\n"));
258 }
259
260 /* Summary of objects initialized */
261
263 "Table [%4.4s: %-8.8s] (id %.2X) - %4u Objects with %3u Devices, "
264 "%3u Regions, %4u Methods (%u/%u/%u Serial/Non/Cvt)\n",
265 Table->Signature, Table->OemTableId, OwnerId, Info.ObjectCount,
266 Info.DeviceCount,Info.OpRegionCount, Info.MethodCount,
267 Info.SerialMethodCount, Info.NonSerialMethodCount,
268 Info.SerializedMethodCount));
269
270 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "%u Methods, %u Regions\n",
271 Info.MethodCount, Info.OpRegionCount));
272
274}
#define ACPI_NS_WALK_NO_UNLOCK
Definition: acnamesp.h:76
ACPI_STATUS AcpiNsWalkNamespace(ACPI_OBJECT_TYPE Type, ACPI_HANDLE StartObject, UINT32 MaxDepth, UINT32 Flags, ACPI_WALK_CALLBACK DescendingCallback, ACPI_WALK_CALLBACK AscendingCallback, void *Context, void **ReturnValue)
Definition: nswalk.c:190
#define ACPI_DB_INIT
Definition: acoutput.h:151
ACPI_STATUS AcpiTbGetOwnerId(UINT32 TableIndex, ACPI_OWNER_ID *OwnerId)
Definition: tbdata.c:993
#define ACPI_SIG_DSDT
Definition: actbl.h:67
#define ACPI_COMPARE_NAMESEG(a, b)
Definition: actypes.h:564
#define ACPI_UINT32_MAX
Definition: actypes.h:66
UINT16 ACPI_OWNER_ID
Definition: actypes.h:486
static ACPI_STATUS AcpiDsInitOneObject(ACPI_HANDLE ObjHandle, UINT32 Level, void *Context, void **ReturnValue)
Definition: dsinit.c:86

Referenced by AcpiNsLoadTable().

◆ AcpiDsInitializeRegion()

ACPI_STATUS AcpiDsInitializeRegion ( ACPI_HANDLE  ObjHandle)

Definition at line 82 of file dsopcode.c.

84{
85 ACPI_OPERAND_OBJECT *ObjDesc;
87
88
89 ObjDesc = AcpiNsGetAttachedObject (ObjHandle);
90
91 /* Namespace is NOT locked */
92
94 return (Status);
95}
ACPI_STATUS AcpiEvInitializeRegion(ACPI_OPERAND_OBJECT *RegionObj)
Definition: evrgnini.c:629

Referenced by AcpiDsInitOneObject().

◆ AcpiDsInitObjectFromOp()

ACPI_STATUS AcpiDsInitObjectFromOp ( ACPI_WALK_STATE WalkState,
ACPI_PARSE_OBJECT Op,
UINT16  Opcode,
ACPI_OPERAND_OBJECT **  ObjDesc 
)

Definition at line 373 of file dsobject.c.

378{
379 const ACPI_OPCODE_INFO *OpInfo;
380 ACPI_OPERAND_OBJECT *ObjDesc;
382
383
384 ACPI_FUNCTION_TRACE (DsInitObjectFromOp);
385
386
387 ObjDesc = *RetObjDesc;
388 OpInfo = AcpiPsGetOpcodeInfo (Opcode);
389 if (OpInfo->Class == AML_CLASS_UNKNOWN)
390 {
391 /* Unknown opcode */
392
394 }
395
396 /* Perform per-object initialization */
397
398 switch (ObjDesc->Common.Type)
399 {
400 case ACPI_TYPE_BUFFER:
401 /*
402 * Defer evaluation of Buffer TermArg operand
403 */
404 ObjDesc->Buffer.Node = ACPI_CAST_PTR (
405 ACPI_NAMESPACE_NODE, WalkState->Operands[0]);
406 ObjDesc->Buffer.AmlStart = Op->Named.Data;
407 ObjDesc->Buffer.AmlLength = Op->Named.Length;
408 break;
409
411 /*
412 * Defer evaluation of Package TermArg operand and all
413 * package elements. (01/2017): We defer the element
414 * resolution to allow forward references from the package
415 * in order to provide compatibility with other ACPI
416 * implementations.
417 */
418 ObjDesc->Package.Node = ACPI_CAST_PTR (
419 ACPI_NAMESPACE_NODE, WalkState->Operands[0]);
420
421 if (!Op->Named.Data)
422 {
424 }
425
426 ObjDesc->Package.AmlStart = Op->Named.Data;
427 ObjDesc->Package.AmlLength = Op->Named.Length;
428 break;
429
431
432 switch (OpInfo->Type)
433 {
435 /*
436 * Resolve AML Constants here - AND ONLY HERE!
437 * All constants are integers.
438 * We mark the integer with a flag that indicates that it started
439 * life as a constant -- so that stores to constants will perform
440 * as expected (noop). ZeroOp is used as a placeholder for optional
441 * target operands.
442 */
443 ObjDesc->Common.Flags = AOPOBJ_AML_CONSTANT;
444
445 switch (Opcode)
446 {
447 case AML_ZERO_OP:
448
449 ObjDesc->Integer.Value = 0;
450 break;
451
452 case AML_ONE_OP:
453
454 ObjDesc->Integer.Value = 1;
455 break;
456
457 case AML_ONES_OP:
458
459 ObjDesc->Integer.Value = ACPI_UINT64_MAX;
460
461 /* Truncate value if we are executing from a 32-bit ACPI table */
462
464 break;
465
466 case AML_REVISION_OP:
467
468 ObjDesc->Integer.Value = ACPI_CA_VERSION;
469 break;
470
471 default:
472
474 "Unknown constant opcode 0x%X", Opcode));
476 break;
477 }
478 break;
479
480 case AML_TYPE_LITERAL:
481
482 ObjDesc->Integer.Value = Op->Common.Value.Integer;
483
484 if (AcpiExTruncateFor32bitTable (ObjDesc))
485 {
486 /* Warn if we found a 64-bit constant in a 32-bit table */
487
489 "Truncated 64-bit constant found in 32-bit table: %8.8X%8.8X => %8.8X",
490 ACPI_FORMAT_UINT64 (Op->Common.Value.Integer),
491 (UINT32) ObjDesc->Integer.Value));
492 }
493 break;
494
495 default:
496
497 ACPI_ERROR ((AE_INFO, "Unknown Integer type 0x%X",
498 OpInfo->Type));
500 break;
501 }
502 break;
503
504 case ACPI_TYPE_STRING:
505
506 ObjDesc->String.Pointer = Op->Common.Value.String;
507 ObjDesc->String.Length = (UINT32) strlen (Op->Common.Value.String);
508
509 /*
510 * The string is contained in the ACPI table, don't ever try
511 * to delete it
512 */
513 ObjDesc->Common.Flags |= AOPOBJ_STATIC_POINTER;
514 break;
515
516 case ACPI_TYPE_METHOD:
517 break;
518
520
521 switch (OpInfo->Type)
522 {
524
525 /* Local ID (0-7) is (AML opcode - base AML_FIRST_LOCAL_OP) */
526
529
531 ObjDesc->Reference.Value, WalkState,
533 &ObjDesc->Reference.Object));
534 break;
535
537
538 /* Arg ID (0-6) is (AML opcode - base AML_FIRST_ARG_OP) */
539
542
544 ObjDesc->Reference.Value, WalkState,
546 &ObjDesc->Reference.Object));
547 break;
548
549 default: /* Object name or Debug object */
550
551 switch (Op->Common.AmlOpcode)
552 {
554
555 /* Node was saved in Op */
556
557 ObjDesc->Reference.Node = Op->Common.Node;
559 if (Op->Common.Node)
560 {
561 ObjDesc->Reference.Object = Op->Common.Node->Object;
562 }
563 break;
564
565 case AML_DEBUG_OP:
566
568 break;
569
570 default:
571
573 "Unimplemented reference type for AML opcode: 0x%4.4X", Opcode));
575 }
576 break;
577 }
578 break;
579
580 default:
581
582 ACPI_ERROR ((AE_INFO, "Unimplemented data type: 0x%X",
583 ObjDesc->Common.Type));
584
586 break;
587 }
588
590}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
@ ACPI_REFCLASS_NAME
Definition: acobject.h:464
@ ACPI_REFCLASS_ARG
Definition: acobject.h:460
@ ACPI_REFCLASS_LOCAL
Definition: acobject.h:459
@ ACPI_REFCLASS_DEBUG
Definition: acobject.h:465
#define AOPOBJ_STATIC_POINTER
Definition: acobject.h:95
#define AOPOBJ_AML_CONSTANT
Definition: acobject.h:94
#define ACPI_CA_VERSION
Definition: acpixf.h:49
#define ACPI_UINT64_MAX
Definition: actypes.h:67
#define ACPI_TYPE_STRING
Definition: actypes.h:689
#define AML_FIRST_ARG_OP
Definition: amlcode.h:80
#define AML_ONES_OP
Definition: amlcode.h:142
#define AML_FIRST_LOCAL_OP
Definition: amlcode.h:71
#define AML_TYPE_METHOD_ARGUMENT
Definition: amlcode.h:369
#define AML_DEBUG_OP
Definition: amlcode.h:177
#define AML_TYPE_LITERAL
Definition: amlcode.h:367
#define AML_ONE_OP
Definition: amlcode.h:52
#define AML_TYPE_LOCAL_VARIABLE
Definition: amlcode.h:370
#define AML_TYPE_CONSTANT
Definition: amlcode.h:368
#define AML_REVISION_OP
Definition: amlcode.h:176
ACPI_STATUS AcpiDsMethodDataGetNode(UINT8 Type, UINT32 Index, ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE **Node)
Definition: dsmthdat.c:275
ACPI_OBJECT_COMMON_HEADER UINT8 Class
Definition: acobject.h:443
ACPI_OBJECT_STRING String
Definition: acobject.h:521

Referenced by AcpiDsBuildInternalObject(), and AcpiDsCreateOperand().

◆ AcpiDsInitPackageElement()

ACPI_STATUS AcpiDsInitPackageElement ( UINT8  ObjectType,
ACPI_OPERAND_OBJECT SourceObject,
ACPI_GENERIC_STATE State,
void Context 
)

Definition at line 369 of file dspkginit.c.

374{
375 ACPI_OPERAND_OBJECT **ElementPtr;
376
377
378 ACPI_FUNCTION_TRACE (DsInitPackageElement);
379
380
381 if (!SourceObject)
382 {
384 }
385
386 /*
387 * The following code is a bit of a hack to workaround a (current)
388 * limitation of the ACPI_PKG_CALLBACK interface. We need a pointer
389 * to the location within the element array because a new object
390 * may be created and stored there.
391 */
392 if (Context)
393 {
394 /* A direct call was made to this function */
395
396 ElementPtr = (ACPI_OPERAND_OBJECT **) Context;
397 }
398 else
399 {
400 /* Call came from AcpiUtWalkPackageTree */
401
402 ElementPtr = State->Pkg.ThisTargetObj;
403 }
404
405 /* We are only interested in reference objects/elements */
406
407 if (SourceObject->Common.Type == ACPI_TYPE_LOCAL_REFERENCE)
408 {
409 /* Attempt to resolve the (named) reference to a namespace node */
410
411 AcpiDsResolvePackageElement (ElementPtr);
412 }
413 else if (SourceObject->Common.Type == ACPI_TYPE_PACKAGE)
414 {
415 SourceObject->Package.Flags |= AOPOBJ_DATA_VALID;
416 }
417
419}
static void AcpiDsResolvePackageElement(ACPI_OPERAND_OBJECT **Element)
Definition: dspkginit.c:436

Referenced by AcpiDsBuildInternalPackageObj(), and AcpiNsInitOnePackage().

◆ AcpiDsIsMethodValue()

BOOLEAN AcpiDsIsMethodValue ( ACPI_OPERAND_OBJECT ObjDesc)

◆ AcpiDsIsResultUsed()

BOOLEAN AcpiDsIsResultUsed ( ACPI_PARSE_OBJECT Op,
ACPI_WALK_STATE WalkState 
)

Definition at line 187 of file dsutils.c.

190{
191 const ACPI_OPCODE_INFO *ParentInfo;
192
193 ACPI_FUNCTION_TRACE_PTR (DsIsResultUsed, Op);
194
195
196 /* Must have both an Op and a Result Object */
197
198 if (!Op)
199 {
200 ACPI_ERROR ((AE_INFO, "Null Op"));
202 }
203
204 /*
205 * We know that this operator is not a
206 * Return() operator (would not come here.) The following code is the
207 * optional support for a so-called "implicit return". Some AML code
208 * assumes that the last value of the method is "implicitly" returned
209 * to the caller. Just save the last result as the return value.
210 * NOTE: this is optional because the ASL language does not actually
211 * support this behavior.
212 */
213 (void) AcpiDsDoImplicitReturn (WalkState->ResultObj, WalkState, TRUE);
214
215 /*
216 * Now determine if the parent will use the result
217 *
218 * If there is no parent, or the parent is a ScopeOp, we are executing
219 * at the method level. An executing method typically has no parent,
220 * since each method is parsed separately. A method invoked externally
221 * via ExecuteControlMethod has a ScopeOp as the parent.
222 */
223 if ((!Op->Common.Parent) ||
224 (Op->Common.Parent->Common.AmlOpcode == AML_SCOPE_OP))
225 {
226 /* No parent, the return value cannot possibly be used */
227
229 "At Method level, result of [%s] not used\n",
230 AcpiPsGetOpcodeName (Op->Common.AmlOpcode)));
232 }
233
234 /* Get info on the parent. The RootOp is AML_SCOPE */
235
236 ParentInfo = AcpiPsGetOpcodeInfo (Op->Common.Parent->Common.AmlOpcode);
237 if (ParentInfo->Class == AML_CLASS_UNKNOWN)
238 {
240 "Unknown parent opcode Op=%p", Op));
242 }
243
244 /*
245 * Decide what to do with the result based on the parent. If
246 * the parent opcode will not use the result, delete the object.
247 * Otherwise leave it as is, it will be deleted when it is used
248 * as an operand later.
249 */
250 switch (ParentInfo->Class)
251 {
253
254 switch (Op->Common.Parent->Common.AmlOpcode)
255 {
256 case AML_RETURN_OP:
257
258 /* Never delete the return value associated with a return opcode */
259
260 goto ResultUsed;
261
262 case AML_IF_OP:
263 case AML_WHILE_OP:
264 /*
265 * If we are executing the predicate AND this is the predicate op,
266 * we will use the return value
267 */
268 if ((WalkState->ControlState->Common.State ==
270 (WalkState->ControlState->Control.PredicateOp == Op))
271 {
272 goto ResultUsed;
273 }
274 break;
275
276 default:
277
278 /* Ignore other control opcodes */
279
280 break;
281 }
282
283 /* The general control opcode returns no result */
284
285 goto ResultNotUsed;
286
287 case AML_CLASS_CREATE:
288 /*
289 * These opcodes allow TermArg(s) as operands and therefore
290 * the operands can be method calls. The result is used.
291 */
292 goto ResultUsed;
293
295
296 if ((Op->Common.Parent->Common.AmlOpcode == AML_REGION_OP) ||
297 (Op->Common.Parent->Common.AmlOpcode == AML_DATA_REGION_OP) ||
298 (Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
299 (Op->Common.Parent->Common.AmlOpcode == AML_BUFFER_OP) ||
300 (Op->Common.Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP) ||
301 (Op->Common.Parent->Common.AmlOpcode == AML_INT_EVAL_SUBTREE_OP) ||
302 (Op->Common.Parent->Common.AmlOpcode == AML_BANK_FIELD_OP))
303 {
304 /*
305 * These opcodes allow TermArg(s) as operands and therefore
306 * the operands can be method calls. The result is used.
307 */
308 goto ResultUsed;
309 }
310
311 goto ResultNotUsed;
312
313 default:
314 /*
315 * In all other cases. the parent will actually use the return
316 * object, so keep it.
317 */
318 goto ResultUsed;
319 }
320
321
322ResultUsed:
324 "Result of [%s] used by Parent [%s] Op=%p\n",
325 AcpiPsGetOpcodeName (Op->Common.AmlOpcode),
326 AcpiPsGetOpcodeName (Op->Common.Parent->Common.AmlOpcode), Op));
327
329
330
331ResultNotUsed:
333 "Result of [%s] not used by Parent [%s] Op=%p\n",
334 AcpiPsGetOpcodeName (Op->Common.AmlOpcode),
335 AcpiPsGetOpcodeName (Op->Common.Parent->Common.AmlOpcode), Op));
336
338}
#define return_UINT8(s)
Definition: acoutput.h:500

Referenced by AcpiDsDeleteResultIfNotUsed(), and AcpiPsNextParseState().

◆ AcpiDsLoad1BeginOp()

ACPI_STATUS AcpiDsLoad1BeginOp ( ACPI_WALK_STATE WalkState,
ACPI_PARSE_OBJECT **  OutOp 
)

Definition at line 144 of file dswload.c.

147{
152 char *Path;
154
155
156 ACPI_FUNCTION_TRACE_PTR (DsLoad1BeginOp, WalkState->Op);
157
158
159 Op = WalkState->Op;
160 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState));
161
162 /* We are only interested in opcodes that have an associated name */
163
164 if (Op)
165 {
166 if (!(WalkState->OpInfo->Flags & AML_NAMED))
167 {
168 *OutOp = Op;
170 }
171
172 /* Check if this object has already been installed in the namespace */
173
174 if (Op->Common.Node)
175 {
176 *OutOp = Op;
178 }
179 }
180
182
183 /* Map the raw opcode into an internal object type */
184
185 ObjectType = WalkState->OpInfo->ObjectType;
186
188 "State=%p Op=%p [%s]\n", WalkState, Op,
190
191 switch (WalkState->Opcode)
192 {
193 case AML_SCOPE_OP:
194 /*
195 * The target name of the Scope() operator must exist at this point so
196 * that we can actually open the scope to enter new names underneath it.
197 * Allow search-to-root for single namesegs.
198 */
201#ifdef ACPI_ASL_COMPILER
202 if (Status == AE_NOT_FOUND)
203 {
204 /*
205 * Table disassembly:
206 * Target of Scope() not found. Generate an External for it, and
207 * insert the name into the namespace.
208 */
212 WalkState, &Node);
213 }
214#endif
215 if (ACPI_FAILURE (Status))
216 {
219 }
220
221 /*
222 * Check to make sure that the target is
223 * one of the opcodes that actually opens a scope
224 */
225 switch (Node->Type)
226 {
227 case ACPI_TYPE_ANY:
228 case ACPI_TYPE_LOCAL_SCOPE: /* Scope */
229 case ACPI_TYPE_DEVICE:
230 case ACPI_TYPE_POWER:
233
234 /* These are acceptable types */
235 break;
236
238 case ACPI_TYPE_STRING:
239 case ACPI_TYPE_BUFFER:
240 /*
241 * These types we will allow, but we will change the type.
242 * This enables some existing code of the form:
243 *
244 * Name (DEB, 0)
245 * Scope (DEB) { ... }
246 *
247 * Note: silently change the type here. On the second pass,
248 * we will report a warning
249 */
251 "Type override - [%4.4s] had invalid type (%s) "
252 "for Scope operator, changed to type ANY\n",
254
255 Node->Type = ACPI_TYPE_ANY;
256 WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY;
257 break;
258
259 case ACPI_TYPE_METHOD:
260 /*
261 * Allow scope change to root during execution of module-level
262 * code. Root is typed METHOD during this time.
263 */
264 if ((Node == AcpiGbl_RootNode) &&
265 (WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL))
266 {
267 break;
268 }
269
271
272 default:
273
274 /* All other types are an error */
275
277 "Invalid type (%s) for target of "
278 "Scope operator [%4.4s] (Cannot override)",
280
282 }
283 break;
284
285 default:
286 /*
287 * For all other named opcodes, we will enter the name into
288 * the namespace.
289 *
290 * Setup the search flags.
291 * Since we are entering a name into the namespace, we do not want to
292 * enable the search-to-root upsearch.
293 *
294 * There are only two conditions where it is acceptable that the name
295 * already exists:
296 * 1) the Scope() operator can reopen a scoping object that was
297 * previously defined (Scope, Method, Device, etc.)
298 * 2) Whenever we are parsing a deferred opcode (OpRegion, Buffer,
299 * BufferField, or Package), the name of the object is already
300 * in the namespace.
301 */
302 if (WalkState->DeferredNode)
303 {
304 /* This name is already in the namespace, get the node */
305
306 Node = WalkState->DeferredNode;
307 Status = AE_OK;
308