ReactOS 0.4.15-dev-7918-g2a2556c
dswexec.c File Reference
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "amlcode.h"
#include "acdispat.h"
#include "acinterp.h"
#include "acnamesp.h"
#include "acdebug.h"
Include dependency graph for dswexec.c:

Go to the source code of this file.

Macros

#define _COMPONENT   ACPI_DISPATCHER
 

Functions

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 *WalkState)
 

Variables

static ACPI_EXECUTE_OP AcpiGbl_OpTypeDispatch []
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_DISPATCHER

Definition at line 57 of file dswexec.c.

Function Documentation

◆ 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}
unsigned int UINT32
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define AE_OK
Definition: acexcep.h:97
#define ACPI_CONTROL_PREDICATE_EXECUTING
Definition: aclocal.h:671
#define ACPI_CONTROL_CONDITIONAL_EXECUTING
Definition: aclocal.h:670
UINT32 AcpiNsOpensScope(ACPI_OBJECT_TYPE Type)
Definition: nsutils.c:736
#define ACPI_DB_DISPATCH
Definition: acoutput.h:163
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define ACPI_DB_EXEC
Definition: acoutput.h:165
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
const ACPI_OPCODE_INFO * AcpiPsGetOpcodeInfo(UINT16 Opcode)
Definition: psopinfo.c:72
#define ACPI_WALK_METHOD
Definition: acstruct.h:69
UINT32 ACPI_STATUS
Definition: actypes.h:460
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
#define AML_INT_NAMEPATH_OP
Definition: amlcode.h:205
#define NULL
Definition: types.h:112
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
Status
Definition: gdiplustypes.h:25
union acpi_parse_object * PredicateOp
Definition: aclocal.h:726
UINT8 ObjectType
Definition: aclocal.h:874
ACPI_PARSE_OBJECT * Origin
Definition: acstruct.h:120
ACPI_PARSE_OBJECT * Op
Definition: acstruct.h:118
UINT16 Opcode
Definition: acstruct.h:78
const ACPI_OPCODE_INFO * OpInfo
Definition: acstruct.h:119
ACPI_GENERIC_STATE * ControlState
Definition: acstruct.h:110
UINT8 WalkType
Definition: acstruct.h:77
static VOID ErrorExit(LPTSTR lpszMessage)
Definition: telnetd.c:647
ACPI_COMMON_STATE Common
Definition: aclocal.h:822
ACPI_CONTROL_STATE Control
Definition: aclocal.h:823
ACPI_PARSE_OBJ_NAMED Named
Definition: aclocal.h:1079
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078

Referenced by AcpiDsInitCallbacks(), and AcpiDsLoad2BeginOp().

◆ AcpiDsExecEndOp()

ACPI_STATUS AcpiDsExecEndOp ( ACPI_WALK_STATE WalkState)

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 */
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_NOT_IMPLEMENTED
Definition: acexcep.h:122
#define AE_CTRL_TRANSFER
Definition: acexcep.h:231
#define AE_AML_UNINITIALIZED_LOCAL
Definition: acexcep.h:184
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
char * AcpiNsGetExternalPathname(ACPI_NAMESPACE_NODE *Node)
Definition: nsnames.c:70
#define ACPI_EXCEPTION(plist)
Definition: acoutput.h:239
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AE_INFO
Definition: acoutput.h:230
const char * AcpiPsGetOpcodeName(UINT16 Opcode)
Definition: psopinfo.c:169
#define ACPI_TYPE_LOCAL_REFERENCE
Definition: actypes.h:719
#define ACPI_FREE(a)
Definition: actypes.h:386
#define ACPI_FALLTHROUGH
Definition: actypes.h:1466
void AcpiUtAddReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:752
#define AML_CLASS_ARGUMENT
Definition: amlcode.h:402
#define AML_VARIABLE_PACKAGE_OP
Definition: amlcode.h:63
#define AML_REGION_OP
Definition: amlcode.h:180
#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_NAME_OP
Definition: amlcode.h:54
#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_PACKAGE_OP
Definition: amlcode.h:62
#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
static const WCHAR Cleanup[]
Definition: register.c:80
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 AcpiDsCreateOperands(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *FirstArg)
Definition: dsutils.c:753
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 AcpiDsResultPush(ACPI_OPERAND_OBJECT *Object, ACPI_WALK_STATE *WalkState)
Definition: dswstate.c:160
ACPI_STATUS AcpiExWriteDataToField(ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc)
Definition: exfield.c:317
ACPI_STATUS AcpiExResolveOperands(UINT16 Opcode, ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState)
Definition: exresop.c:145
BOOLEAN AcpiExTruncateFor32bitTable(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: exutils.c:177
OpClass
Definition: simd.h:241
OpType
Definition: simd.h:223
ACPI_OBJECT_COMMON_HEADER UINT8 Class
Definition: acobject.h:443
UINT16 Flags
Definition: aclocal.h:873
UINT8 * AmlEnd
Definition: aclocal.h:1103
union acpi_operand_object * Operands[ACPI_OBJ_NUM_OPERANDS+1]
Definition: acstruct.h:105
union acpi_operand_object * ReturnDesc
Definition: acstruct.h:123
UINT8 OperandIndex
Definition: acstruct.h:81
union acpi_operand_object * ResultObj
Definition: acstruct.h:121
UINT8 NumOperands
Definition: acstruct.h:80
ACPI_PARSE_STATE ParserState
Definition: acstruct.h:97
ACPI_OBJECT_REFERENCE Reference
Definition: acobject.h:540
ACPI_OBJECT_COMMON Common
Definition: acobject.h:519
ACPI_PARSE_OBJ_ASL Asl
Definition: aclocal.h:1080

Referenced by AcpiDsInitCallbacks().

◆ 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_AML_NO_OPERAND
Definition: acexcep.h:181
#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_TYPE_INTEGER
Definition: actypes.h:688
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:790
#define ACPI_IMPLICIT_CONVERSION
Definition: acutils.h:145
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
ACPI_STATUS AcpiDsCreateOperand(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Arg, UINT32 ArgIndex)
Definition: dsutils.c:497
BOOLEAN AcpiDsDoImplicitReturn(ACPI_OPERAND_OBJECT *ReturnDesc, ACPI_WALK_STATE *WalkState, BOOLEAN AddReference)
Definition: dsutils.c:123
ACPI_STATUS AcpiDsResultPop(ACPI_OPERAND_OBJECT **Object, ACPI_WALK_STATE *WalkState)
Definition: dswstate.c:78
ACPI_STATUS AcpiExConvertToInteger(ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc, UINT32 ImplicitConversion)
Definition: exconvrt.c:79
ACPI_STATUS AcpiExResolveToValue(ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState)
Definition: exresolv.c:79
ACPI_OBJECT_INTEGER Integer
Definition: acobject.h:520

Referenced by AcpiDsExecEndOp(), and AcpiPsParseLoop().

Variable Documentation

◆ AcpiGbl_OpTypeDispatch

ACPI_EXECUTE_OP AcpiGbl_OpTypeDispatch[]
static
Initial value:
=
{
NULL,
}
ACPI_STATUS AcpiExOpcode_1A_1T_1R(ACPI_WALK_STATE *WalkState)
Definition: exoparg1.c:286
ACPI_STATUS AcpiExOpcode_1A_0T_0R(ACPI_WALK_STATE *WalkState)
Definition: exoparg1.c:161
ACPI_STATUS AcpiExOpcode_0A_0T_1R(ACPI_WALK_STATE *WalkState)
Definition: exoparg1.c:92
ACPI_STATUS AcpiExOpcode_1A_0T_1R(ACPI_WALK_STATE *WalkState)
Definition: exoparg1.c:642
ACPI_STATUS AcpiExOpcode_2A_2T_1R(ACPI_WALK_STATE *WalkState)
Definition: exoparg2.c:169
ACPI_STATUS AcpiExOpcode_2A_0T_1R(ACPI_WALK_STATE *WalkState)
Definition: exoparg2.c:540
ACPI_STATUS AcpiExOpcode_2A_0T_0R(ACPI_WALK_STATE *WalkState)
Definition: exoparg2.c:95
ACPI_STATUS AcpiExOpcode_2A_1T_1R(ACPI_WALK_STATE *WalkState)
Definition: exoparg2.c:279
ACPI_STATUS AcpiExOpcode_3A_1T_1R(ACPI_WALK_STATE *WalkState)
Definition: exoparg3.c:173
ACPI_STATUS AcpiExOpcode_3A_0T_0R(ACPI_WALK_STATE *WalkState)
Definition: exoparg3.c:91
ACPI_STATUS AcpiExOpcode_6A_0T_1R(ACPI_WALK_STATE *WalkState)
Definition: exoparg6.c:221

Definition at line 63 of file dswexec.c.

Referenced by AcpiDsExecEndOp().