ReactOS 0.4.15-dev-6057-gd708c79
dswstate.c File Reference
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "acdispat.h"
#include "acnamesp.h"
Include dependency graph for dswstate.c:

Go to the source code of this file.

Macros

#define _COMPONENT   ACPI_DISPATCHER
 

Functions

static ACPI_STATUS AcpiDsResultStackPush (ACPI_WALK_STATE *WalkState)
 
static ACPI_STATUS AcpiDsResultStackPop (ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiDsResultPop (ACPI_OPERAND_OBJECT **Object, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiDsResultPush (ACPI_OPERAND_OBJECT *Object, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiDsObjStackPush (void *Object, ACPI_WALK_STATE *WalkState)
 
ACPI_STATUS AcpiDsObjStackPop (UINT32 PopCount, ACPI_WALK_STATE *WalkState)
 
void AcpiDsObjStackPopAndDelete (UINT32 PopCount, ACPI_WALK_STATE *WalkState)
 
ACPI_WALK_STATEAcpiDsGetCurrentWalkState (ACPI_THREAD_STATE *Thread)
 
void AcpiDsPushWalkState (ACPI_WALK_STATE *WalkState, ACPI_THREAD_STATE *Thread)
 
ACPI_WALK_STATEAcpiDsPopWalkState (ACPI_THREAD_STATE *Thread)
 
ACPI_WALK_STATEAcpiDsCreateWalkState (ACPI_OWNER_ID OwnerId, ACPI_PARSE_OBJECT *Origin, ACPI_OPERAND_OBJECT *MethodDesc, 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 AcpiDsDeleteWalkState (ACPI_WALK_STATE *WalkState)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_DISPATCHER

Definition at line 50 of file dswstate.c.

Function Documentation

◆ AcpiDsCreateWalkState()

ACPI_WALK_STATE * AcpiDsCreateWalkState ( ACPI_OWNER_ID  OwnerId,
ACPI_PARSE_OBJECT Origin,
ACPI_OPERAND_OBJECT MethodDesc,
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
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_ALLOCATE_ZEROED(a)
Definition: actypes.h:385
#define NULL
Definition: types.h:112
void AcpiDsMethodDataInit(ACPI_WALK_STATE *WalkState)
Definition: dsmthdat.c:100
void AcpiDsPushWalkState(ACPI_WALK_STATE *WalkState, ACPI_THREAD_STATE *Thread)
Definition: dswstate.c:526
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
_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_THREAD_STATE * Thread
Definition: acstruct.h:127
ACPI_PARSE_STATE ParserState
Definition: acstruct.h:97

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

◆ 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}
#define ACPI_FUNCTION_TRACE_PTR(a, b)
Definition: acoutput.h:481
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AE_INFO
Definition: acoutput.h:230
#define return_VOID
Definition: acoutput.h:495
void AcpiPsCleanupScope(ACPI_PARSE_STATE *state)
Definition: psscope.c:277
#define ACPI_FREE(a)
Definition: actypes.h:386
void AcpiUtDeleteGenericState(ACPI_GENERIC_STATE *State)
Definition: utstate.c:340
union acpi_generic_state * Scope
Definition: aclocal.h:1108
ACPI_GENERIC_STATE * Results
Definition: acstruct.h:122
ACPI_GENERIC_STATE * ScopeInfo
Definition: acstruct.h:124
ACPI_GENERIC_STATE * ControlState
Definition: acstruct.h:110

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

◆ 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}
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define ACPI_DB_PARSE
Definition: acoutput.h:162
#define ACPI_FUNCTION_NAME(a)
Definition: acoutput.h:479

Referenced by AcpiPsParseAml().

◆ 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}
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_OPERAND_OBJECT * AcpiNsGetAttachedObject(ACPI_NAMESPACE_NODE *Node)
Definition: nsobject.c:308
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
ACPI_STATUS AcpiPsInitScope(ACPI_PARSE_STATE *ParserState, ACPI_PARSE_OBJECT *Root)
Definition: psscope.c:112
#define ACPI_WALK_METHOD
Definition: acstruct.h:69
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_TYPE_METHOD
Definition: actypes.h:695
#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
ACPI_STATUS AcpiDsScopeStackPush(ACPI_NAMESPACE_NODE *Node, ACPI_OBJECT_TYPE Type, ACPI_WALK_STATE *WalkState)
Definition: dswscope.c:107
Status
Definition: gdiplustypes.h:25
UINT8 * PkgEnd
Definition: aclocal.h:1105
UINT8 * AmlEnd
Definition: aclocal.h:1103
struct acpi_namespace_node * StartNode
Definition: aclocal.h:1107
UINT8 * AmlStart
Definition: aclocal.h:1101
struct acpi_namespace_node * MethodNode
Definition: acstruct.h:116
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
UINT8 WalkType
Definition: acstruct.h:77
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078
_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 AcpiDsAutoSerializeMethod(), AcpiDsCallControlMethod(), AcpiDsExecuteArguments(), AcpiNsOneCompleteParse(), AcpiPsExecuteMethod(), and AcpiPsExecuteTable().

◆ AcpiDsObjStackPop()

ACPI_STATUS AcpiDsObjStackPop ( UINT32  PopCount,
ACPI_WALK_STATE WalkState 
)

Definition at line 391 of file dswstate.c.

394{
395 UINT32 i;
396
397
398 ACPI_FUNCTION_NAME (DsObjStackPop);
399
400
401 for (i = 0; i < PopCount; i++)
402 {
403 /* Check for stack underflow */
404
405 if (WalkState->NumOperands == 0)
406 {
408 "Object stack underflow! Count=%X State=%p #Ops=%u",
409 PopCount, WalkState, WalkState->NumOperands));
410 return (AE_STACK_UNDERFLOW);
411 }
412
413 /* Just set the stack entry to null */
414
415 WalkState->NumOperands--;
416 WalkState->Operands [WalkState->NumOperands] = NULL;
417 }
418
419 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%u\n",
420 PopCount, WalkState, WalkState->NumOperands));
421
422 return (AE_OK);
423}
unsigned int UINT32
#define AE_STACK_UNDERFLOW
Definition: acexcep.h:121
#define AE_OK
Definition: acexcep.h:97
#define ACPI_DB_EXEC
Definition: acoutput.h:165
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
union acpi_operand_object * Operands[ACPI_OBJ_NUM_OPERANDS+1]
Definition: acstruct.h:105
UINT8 NumOperands
Definition: acstruct.h:80

Referenced by AcpiDsEvalDataObjectOperands(), and AcpiDsEvaluateNamePath().

◆ AcpiDsObjStackPopAndDelete()

void AcpiDsObjStackPopAndDelete ( UINT32  PopCount,
ACPI_WALK_STATE WalkState 
)

Definition at line 441 of file dswstate.c.

444{
445 INT32 i;
446 ACPI_OPERAND_OBJECT *ObjDesc;
447
448
449 ACPI_FUNCTION_NAME (DsObjStackPopAndDelete);
450
451
452 if (PopCount == 0)
453 {
454 return;
455 }
456
457 for (i = (INT32) PopCount - 1; i >= 0; i--)
458 {
459 if (WalkState->NumOperands == 0)
460 {
461 return;
462 }
463
464 /* Pop the stack and delete an object if present in this stack entry */
465
466 WalkState->NumOperands--;
467 ObjDesc = WalkState->Operands [i];
468 if (ObjDesc)
469 {
470 AcpiUtRemoveReference (WalkState->Operands [i]);
471 WalkState->Operands [i] = NULL;
472 }
473 }
474
475 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n",
476 PopCount, WalkState, WalkState->NumOperands));
477}
signed int INT32
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:790

Referenced by AcpiDsCreateOperands().

◆ AcpiDsObjStackPush()

ACPI_STATUS AcpiDsObjStackPush ( void Object,
ACPI_WALK_STATE WalkState 
)

Definition at line 342 of file dswstate.c.

345{
346 ACPI_FUNCTION_NAME (DsObjStackPush);
347
348
349 /* Check for stack overflow */
350
351 if (WalkState->NumOperands >= ACPI_OBJ_NUM_OPERANDS)
352 {
354 "Object stack overflow! Obj=%p State=%p #Ops=%u",
355 Object, WalkState, WalkState->NumOperands));
356 return (AE_STACK_OVERFLOW);
357 }
358
359 /* Put the object onto the stack */
360
361 WalkState->Operands [WalkState->OperandIndex] = Object;
362 WalkState->NumOperands++;
363
364 /* For the usual order of filling the operand stack */
365
366 WalkState->OperandIndex++;
367
368 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
370 WalkState, WalkState->NumOperands));
371
372 return (AE_OK);
373}
#define AE_STACK_OVERFLOW
Definition: acexcep.h:120
const char * AcpiUtGetObjectTypeName(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: utdecode.c:264
#define ACPI_OBJ_NUM_OPERANDS
Definition: acconfig.h:172
UINT8 OperandIndex
Definition: acstruct.h:81
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object

Referenced by AcpiDsCreateOperand().

◆ AcpiDsPopWalkState()

ACPI_WALK_STATE * AcpiDsPopWalkState ( ACPI_THREAD_STATE Thread)

Definition at line 555 of file dswstate.c.

557{
558 ACPI_WALK_STATE *WalkState;
559
560
561 ACPI_FUNCTION_TRACE (DsPopWalkState);
562
563
564 WalkState = Thread->WalkStateList;
565
566 if (WalkState)
567 {
568 /* Next walk state becomes the current walk state */
569
570 Thread->WalkStateList = WalkState->Next;
571
572 /*
573 * Don't clear the NEXT field, this serves as an indicator
574 * that there is a parent WALK STATE
575 * Do Not: WalkState->Next = NULL;
576 */
577 }
578
579 return_PTR (WalkState);
580}
struct acpi_walk_state * Next
Definition: acstruct.h:75

Referenced by AcpiPsParseAml().

◆ AcpiDsPushWalkState()

void AcpiDsPushWalkState ( ACPI_WALK_STATE WalkState,
ACPI_THREAD_STATE Thread 
)

Definition at line 526 of file dswstate.c.

529{
530 ACPI_FUNCTION_TRACE (DsPushWalkState);
531
532
533 WalkState->Next = Thread->WalkStateList;
534 Thread->WalkStateList = WalkState;
535
537}

Referenced by AcpiDsCreateWalkState(), and AcpiPsParseAml().

◆ AcpiDsResultPop()

ACPI_STATUS AcpiDsResultPop ( ACPI_OPERAND_OBJECT **  Object,
ACPI_WALK_STATE WalkState 
)

Definition at line 78 of file dswstate.c.

81{
85
86
87 ACPI_FUNCTION_NAME (DsResultPop);
88
89
90 State = WalkState->Results;
91
92 /* Incorrect state of result stack */
93
94 if (State && !WalkState->ResultCount)
95 {
96 ACPI_ERROR ((AE_INFO, "No results on result stack"));
97 return (AE_AML_INTERNAL);
98 }
99
100 if (!State && WalkState->ResultCount)
101 {
102 ACPI_ERROR ((AE_INFO, "No result state for result stack"));
103 return (AE_AML_INTERNAL);
104 }
105
106 /* Empty result stack */
107
108 if (!State)
109 {
110 ACPI_ERROR ((AE_INFO, "Result stack is empty! State=%p", WalkState));
111 return (AE_AML_NO_RETURN_VALUE);
112 }
113
114 /* Return object of the top element and clean that top element result stack */
115
116 WalkState->ResultCount--;
118
119 *Object = State->Results.ObjDesc [Index];
120 if (!*Object)
121 {
122 ACPI_ERROR ((AE_INFO, "No result objects on result stack, State=%p",
123 WalkState));
124 return (AE_AML_NO_RETURN_VALUE);
125 }
126
127 State->Results.ObjDesc [Index] = NULL;
128 if (Index == 0)
129 {
130 Status = AcpiDsResultStackPop (WalkState);
131 if (ACPI_FAILURE (Status))
132 {
133 return (Status);
134 }
135 }
136
138 "Obj=%p [%s] Index=%X State=%p Num=%X\n", *Object,
140 Index, WalkState, WalkState->ResultCount));
141
142 return (AE_OK);
143}
#define AE_AML_INTERNAL
Definition: acexcep.h:194
#define AE_AML_NO_RETURN_VALUE
Definition: acexcep.h:197
#define ACPI_RESULTS_FRAME_OBJ_NUM
Definition: acconfig.h:177
static ACPI_STATUS AcpiDsResultStackPop(ACPI_WALK_STATE *WalkState)
Definition: dswstate.c:289
if(dx< 0)
Definition: linetemp.h:194
UINT8 ResultCount
Definition: acstruct.h:90
_In_ WDFCOLLECTION _In_ ULONG Index

Referenced by AcpiDsCreateOperand(), AcpiDsDeleteResultIfNotUsed(), and AcpiDsGetPredicateValue().

◆ AcpiDsResultPush()

ACPI_STATUS AcpiDsResultPush ( ACPI_OPERAND_OBJECT Object,
ACPI_WALK_STATE WalkState 
)

Definition at line 160 of file dswstate.c.

163{
167
168
169 ACPI_FUNCTION_NAME (DsResultPush);
170
171
172 if (WalkState->ResultCount > WalkState->ResultSize)
173 {
174 ACPI_ERROR ((AE_INFO, "Result stack is full"));
175 return (AE_AML_INTERNAL);
176 }
177 else if (WalkState->ResultCount == WalkState->ResultSize)
178 {
179 /* Extend the result stack */
180
181 Status = AcpiDsResultStackPush (WalkState);
182 if (ACPI_FAILURE (Status))
183 {
184 ACPI_ERROR ((AE_INFO, "Failed to extend the result stack"));
185 return (Status);
186 }
187 }
188
189 if (!(WalkState->ResultCount < WalkState->ResultSize))
190 {
191 ACPI_ERROR ((AE_INFO, "No free elements in result stack"));
192 return (AE_AML_INTERNAL);
193 }
194
195 State = WalkState->Results;
196 if (!State)
197 {
198 ACPI_ERROR ((AE_INFO, "No result stack frame during push"));
199 return (AE_AML_INTERNAL);
200 }
201
202 if (!Object)
203 {
205 "Null Object! Obj=%p State=%p Num=%u",
206 Object, WalkState, WalkState->ResultCount));
207 return (AE_BAD_PARAMETER);
208 }
209
210 /* Assign the address of object to the top free element of result stack */
211
213 State->Results.ObjDesc [Index] = Object;
214 WalkState->ResultCount++;
215
216 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p Num=%X Cur=%X\n",
218 WalkState, WalkState->ResultCount, WalkState->CurrentResult));
219
220 return (AE_OK);
221}
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
static ACPI_STATUS AcpiDsResultStackPush(ACPI_WALK_STATE *WalkState)
Definition: dswstate.c:237
UINT8 CurrentResult
Definition: acstruct.h:84
UINT8 ResultSize
Definition: acstruct.h:89

Referenced by AcpiDsEvaluateNamePath(), AcpiDsExecEndOp(), and AcpiDsRestartControlMethod().

◆ AcpiDsResultStackPop()

static ACPI_STATUS AcpiDsResultStackPop ( ACPI_WALK_STATE WalkState)
static

Definition at line 289 of file dswstate.c.

291{
293
294
295 ACPI_FUNCTION_NAME (DsResultStackPop);
296
297
298 /* Check for stack underflow */
299
300 if (WalkState->Results == NULL)
301 {
303 "Result stack underflow - State=%p\n", WalkState));
304 return (AE_AML_NO_OPERAND);
305 }
306
307 if (WalkState->ResultSize < ACPI_RESULTS_FRAME_OBJ_NUM)
308 {
309 ACPI_ERROR ((AE_INFO, "Insufficient result stack size"));
310 return (AE_AML_INTERNAL);
311 }
312
313 State = AcpiUtPopGenericState (&WalkState->Results);
315
316 /* Decrease the length of result stack by the length of frame */
317
319
321 "Result=%p RemainingResults=%X State=%p\n",
322 State, WalkState->ResultCount, WalkState));
323
324 return (AE_OK);
325}
#define AE_AML_NO_OPERAND
Definition: acexcep.h:181
ACPI_GENERIC_STATE * AcpiUtPopGenericState(ACPI_GENERIC_STATE **ListHead)
Definition: utstate.c:93

Referenced by AcpiDsResultPop().

◆ AcpiDsResultStackPush()

static ACPI_STATUS AcpiDsResultStackPush ( ACPI_WALK_STATE WalkState)
static

Definition at line 237 of file dswstate.c.

239{
241
242
243 ACPI_FUNCTION_NAME (DsResultStackPush);
244
245
246 /* Check for stack overflow */
247
248 if (((UINT32) WalkState->ResultSize + ACPI_RESULTS_FRAME_OBJ_NUM) >
250 {
251 ACPI_ERROR ((AE_INFO, "Result stack overflow: State=%p Num=%u",
252 WalkState, WalkState->ResultSize));
253 return (AE_STACK_OVERFLOW);
254 }
255
257 if (!State)
258 {
259 return (AE_NO_MEMORY);
260 }
261
262 State->Common.DescriptorType = ACPI_DESC_TYPE_STATE_RESULT;
263 AcpiUtPushGenericState (&WalkState->Results, State);
264
265 /* Increase the length of the result stack by the length of frame */
266
268
269 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Results=%p State=%p\n",
270 State, WalkState));
271
272 return (AE_OK);
273}
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define ACPI_DESC_TYPE_STATE_RESULT
Definition: acobject.h:571
ACPI_GENERIC_STATE * AcpiUtCreateGenericState(void)
Definition: utstate.c:130
void AcpiUtPushGenericState(ACPI_GENERIC_STATE **ListHead, ACPI_GENERIC_STATE *State)
Definition: utstate.c:65
#define ACPI_RESULTS_OBJ_NUM_MAX
Definition: acconfig.h:184

Referenced by AcpiDsResultPush().