ReactOS  0.4.14-dev-384-g5b37caa
psxface.c File Reference
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "acdispat.h"
#include "acinterp.h"
#include "actables.h"
#include "acnamesp.h"
Include dependency graph for psxface.c:

Go to the source code of this file.

Macros

#define _COMPONENT   ACPI_PARSER
 

Functions

static void AcpiPsUpdateParameterList (ACPI_EVALUATE_INFO *Info, UINT16 Action)
 
ACPI_STATUS AcpiDebugTrace (const char *Name, UINT32 DebugLevel, UINT32 DebugLayer, UINT32 Flags)
 
ACPI_STATUS AcpiPsExecuteMethod (ACPI_EVALUATE_INFO *Info)
 
ACPI_STATUS AcpiPsExecuteTable (ACPI_EVALUATE_INFO *Info)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_PARSER

Definition at line 53 of file psxface.c.

Function Documentation

◆ AcpiDebugTrace()

ACPI_STATUS AcpiDebugTrace ( const char Name,
UINT32  DebugLevel,
UINT32  DebugLayer,
UINT32  Flags 
)

Definition at line 81 of file psxface.c.

86 {
88 
89 
91  if (ACPI_FAILURE (Status))
92  {
93  return (Status);
94  }
95 
96  AcpiGbl_TraceMethodName = Name;
97  AcpiGbl_TraceFlags = Flags;
98  AcpiGbl_TraceDbgLevel = DebugLevel;
99  AcpiGbl_TraceDbgLayer = DebugLayer;
100  Status = AE_OK;
101 
103  return (Status);
104 }
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
UINT32 ACPI_STATUS
Definition: actypes.h:460
ULONG DebugLevel
Definition: fbtusb.c:26
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
ACPI_STATUS AcpiUtReleaseMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:348
ACPI_STATUS AcpiUtAcquireMutex(ACPI_MUTEX_HANDLE MutexId)
Definition: utmutex.c:256
struct NameRec_ * Name
Definition: cdprocs.h:464
Status
Definition: gdiplustypes.h:24
#define ACPI_MTX_NAMESPACE
Definition: aclocal.h:85
#define AE_OK
Definition: acexcep.h:97

◆ AcpiPsExecuteMethod()

ACPI_STATUS AcpiPsExecuteMethod ( ACPI_EVALUATE_INFO Info)

Definition at line 131 of file psxface.c.

133 {
135  ACPI_PARSE_OBJECT *Op;
136  ACPI_WALK_STATE *WalkState;
137 
138 
139  ACPI_FUNCTION_TRACE (PsExecuteMethod);
140 
141 
142  /* Quick validation of DSDT header */
143 
145 
146  /* Validate the Info and method Node */
147 
148  if (!Info || !Info->Node)
149  {
151  }
152 
153  /* Init for new method, wait on concurrency semaphore */
154 
155  Status = AcpiDsBeginMethodExecution (Info->Node, Info->ObjDesc, NULL);
156  if (ACPI_FAILURE (Status))
157  {
159  }
160 
161  /*
162  * The caller "owns" the parameters, so give each one an extra reference
163  */
165 
166  /*
167  * Execute the method. Performs parse simultaneously
168  */
170  "**** Begin Method Parse/Execute [%4.4s] **** Node=%p Obj=%p\n",
171  Info->Node->Name.Ascii, Info->Node, Info->ObjDesc));
172 
173  /* Create and init a Root Node */
174 
175  Op = AcpiPsCreateScopeOp (Info->ObjDesc->Method.AmlStart);
176  if (!Op)
177  {
179  goto Cleanup;
180  }
181 
182  /* Create and initialize a new walk state */
183 
184  Info->PassNumber = ACPI_IMODE_EXECUTE;
185  WalkState = AcpiDsCreateWalkState (
186  Info->ObjDesc->Method.OwnerId, NULL, NULL, NULL);
187  if (!WalkState)
188  {
190  goto Cleanup;
191  }
192 
193  Status = AcpiDsInitAmlWalk (WalkState, Op, Info->Node,
194  Info->ObjDesc->Method.AmlStart,
195  Info->ObjDesc->Method.AmlLength, Info, Info->PassNumber);
196  if (ACPI_FAILURE (Status))
197  {
198  AcpiDsDeleteWalkState (WalkState);
199  goto Cleanup;
200  }
201 
202  WalkState->MethodPathname = Info->FullPathname;
203  WalkState->MethodIsNested = FALSE;
204 
205  if (Info->ObjDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL)
206  {
207  WalkState->ParseFlags |= ACPI_PARSE_MODULE_LEVEL;
208  }
209 
210  /* Invoke an internal method if necessary */
211 
212  if (Info->ObjDesc->Method.InfoFlags & ACPI_METHOD_INTERNAL_ONLY)
213  {
214  Status = Info->ObjDesc->Method.Dispatch.Implementation (WalkState);
215  Info->ReturnObject = WalkState->ReturnDesc;
216 
217  /* Cleanup states */
218 
219  AcpiDsScopeStackClear (WalkState);
220  AcpiPsCleanupScope (&WalkState->ParserState);
221  AcpiDsTerminateControlMethod (WalkState->MethodDesc, WalkState);
222  AcpiDsDeleteWalkState (WalkState);
223  goto Cleanup;
224  }
225 
226  /*
227  * Start method evaluation with an implicit return of zero.
228  * This is done for Windows compatibility.
229  */
230  if (AcpiGbl_EnableInterpreterSlack)
231  {
232  WalkState->ImplicitReturnObj =
234  if (!WalkState->ImplicitReturnObj)
235  {
237  AcpiDsDeleteWalkState (WalkState);
238  goto Cleanup;
239  }
240  }
241 
242  /* Parse the AML */
243 
244  Status = AcpiPsParseAml (WalkState);
245 
246  /* WalkState was deleted by ParseAml */
247 
248 Cleanup:
250 
251  /* Take away the extra reference that we gave the parameters above */
252 
254 
255  /* Exit now if error above */
256 
257  if (ACPI_FAILURE (Status))
258  {
260  }
261 
262  /*
263  * If the method has returned an object, signal this to the caller with
264  * a control exception code
265  */
266  if (Info->ReturnObject)
267  {
268  ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Method returned ObjDesc=%p\n",
269  Info->ReturnObject));
270  ACPI_DUMP_STACK_ENTRY (Info->ReturnObject);
271 
273  }
274 
276 }
char * MethodPathname
Definition: acstruct.h:117
void AcpiPsDeleteParseTree(ACPI_PARSE_OBJECT *root)
Definition: pswalk.c:67
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
union acpi_operand_object * ImplicitReturnObj
Definition: acstruct.h:112
void AcpiDsDeleteWalkState(ACPI_WALK_STATE *WalkState)
Definition: dswstate.c:780
ACPI_WALK_STATE * AcpiDsCreateWalkState(ACPI_OWNER_ID OwnerId, ACPI_PARSE_OBJECT *Origin, ACPI_OPERAND_OBJECT *MethodDesc, ACPI_THREAD_STATE *Thread)
Definition: dswstate.c:600
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define AE_CTRL_RETURN_VALUE
Definition: acexcep.h:224
union acpi_operand_object * ReturnDesc
Definition: acstruct.h:123
#define ACPI_DB_PARSE
Definition: acoutput.h:162
UINT32 ParseFlags
Definition: acstruct.h:95
UINT32 ACPI_STATUS
Definition: actypes.h:460
void AcpiPsCleanupScope(ACPI_PARSE_STATE *state)
Definition: psscope.c:277
struct TraceInfo Info
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_METHOD_INTERNAL_ONLY
Definition: acobject.h:236
ACPI_STATUS AcpiDsBeginMethodExecution(ACPI_NAMESPACE_NODE *MethodNode, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_WALK_STATE *WalkState)
Definition: dsmethod.c:352
ACPI_PARSE_OBJECT * AcpiPsCreateScopeOp(UINT8 *Aml)
Definition: psutils.c:67
union acpi_operand_object * MethodDesc
Definition: acstruct.h:115
ACPI_OPERAND_OBJECT * AcpiUtCreateIntegerObject(UINT64 Value)
Definition: utobject.c:223
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define ACPI_DUMP_STACK_ENTRY(a)
Definition: acoutput.h:485
static void AcpiPsUpdateParameterList(ACPI_EVALUATE_INFO *Info, UINT16 Action)
Definition: psxface.c:391
void AcpiDsScopeStackClear(ACPI_WALK_STATE *WalkState)
Definition: dswscope.c:67
ACPI_PARSE_STATE ParserState
Definition: acstruct.h:97
void AcpiTbCheckDsdtHeader(void)
Definition: tbutils.c:124
#define ACPI_METHOD_MODULE_LEVEL
Definition: acobject.h:235
static const WCHAR Cleanup[]
Definition: register.c:80
Status
Definition: gdiplustypes.h:24
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_PARSE_MODULE_LEVEL
Definition: acparser.h:67
#define AE_NULL_ENTRY
Definition: acexcep.h:118
ACPI_STATUS AcpiPsParseAml(ACPI_WALK_STATE *WalkState)
Definition: psparse.c:453
#define REF_DECREMENT
Definition: acutils.h:181
unsigned long long UINT64
UINT8 MethodIsNested
Definition: acstruct.h:101
void AcpiDsTerminateControlMethod(ACPI_OPERAND_OBJECT *MethodDesc, ACPI_WALK_STATE *WalkState)
Definition: dsmethod.c:779
#define REF_INCREMENT
Definition: acutils.h:180

Referenced by AcpiNsEvaluate().

◆ AcpiPsExecuteTable()

ACPI_STATUS AcpiPsExecuteTable ( ACPI_EVALUATE_INFO Info)

Definition at line 297 of file psxface.c.

299 {
301  ACPI_PARSE_OBJECT *Op = NULL;
302  ACPI_WALK_STATE *WalkState = NULL;
303 
304 
305  ACPI_FUNCTION_TRACE (PsExecuteTable);
306 
307 
308  /* Create and init a Root Node */
309 
310  Op = AcpiPsCreateScopeOp (Info->ObjDesc->Method.AmlStart);
311  if (!Op)
312  {
314  goto Cleanup;
315  }
316 
317  /* Create and initialize a new walk state */
318 
319  WalkState = AcpiDsCreateWalkState (
320  Info->ObjDesc->Method.OwnerId, NULL, NULL, NULL);
321  if (!WalkState)
322  {
324  goto Cleanup;
325  }
326 
327  Status = AcpiDsInitAmlWalk (WalkState, Op, Info->Node,
328  Info->ObjDesc->Method.AmlStart,
329  Info->ObjDesc->Method.AmlLength, Info, Info->PassNumber);
330  if (ACPI_FAILURE (Status))
331  {
332  goto Cleanup;
333  }
334 
335  WalkState->MethodPathname = Info->FullPathname;
336  WalkState->MethodIsNested = FALSE;
337 
338  if (Info->ObjDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL)
339  {
340  WalkState->ParseFlags |= ACPI_PARSE_MODULE_LEVEL;
341  }
342 
343  /* Info->Node is the default location to load the table */
344 
345  if (Info->Node && Info->Node != AcpiGbl_RootNode)
346  {
348  Info->Node, ACPI_TYPE_METHOD, WalkState);
349  if (ACPI_FAILURE (Status))
350  {
351  goto Cleanup;
352  }
353  }
354 
355  /*
356  * Parse the AML, WalkState will be deleted by ParseAml
357  */
359  Status = AcpiPsParseAml (WalkState);
361  WalkState = NULL;
362 
363 Cleanup:
364  if (WalkState)
365  {
366  AcpiDsDeleteWalkState (WalkState);
367  }
368  if (Op)
369  {
371  }
373 }
char * MethodPathname
Definition: acstruct.h:117
void AcpiPsDeleteParseTree(ACPI_PARSE_OBJECT *root)
Definition: pswalk.c:67
ACPI_STATUS AcpiDsInitAmlWalk(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, ACPI_NAMESPACE_NODE *MethodNode, UINT8 *AmlStart, UINT32 AmlLength, ACPI_EVALUATE_INFO *Info, UINT8 PassNumber)
Definition: dswstate.c:662
void AcpiDsDeleteWalkState(ACPI_WALK_STATE *WalkState)
Definition: dswstate.c:780
ACPI_WALK_STATE * AcpiDsCreateWalkState(ACPI_OWNER_ID OwnerId, ACPI_PARSE_OBJECT *Origin, ACPI_OPERAND_OBJECT *MethodDesc, ACPI_THREAD_STATE *Thread)
Definition: dswstate.c:600
#define AE_NO_MEMORY
Definition: acexcep.h:112
ACPI_STATUS AcpiDsScopeStackPush(ACPI_NAMESPACE_NODE *Node, ACPI_OBJECT_TYPE Type, ACPI_WALK_STATE *WalkState)
Definition: dswscope.c:107
UINT32 ParseFlags
Definition: acstruct.h:95
UINT32 ACPI_STATUS
Definition: actypes.h:460
struct TraceInfo Info
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
smooth NULL
Definition: ftsmooth.c:416
#define ACPI_TYPE_METHOD
Definition: actypes.h:686
ACPI_PARSE_OBJECT * AcpiPsCreateScopeOp(UINT8 *Aml)
Definition: psutils.c:67
#define ACPI_METHOD_MODULE_LEVEL
Definition: acobject.h:235
static const WCHAR Cleanup[]
Definition: register.c:80
Status
Definition: gdiplustypes.h:24
void AcpiExExitInterpreter(void)
Definition: exutils.c:139
void AcpiExEnterInterpreter(void)
Definition: exutils.c:91
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_PARSE_MODULE_LEVEL
Definition: acparser.h:67
ACPI_STATUS AcpiPsParseAml(ACPI_WALK_STATE *WalkState)
Definition: psparse.c:453
UINT8 MethodIsNested
Definition: acstruct.h:101

Referenced by AcpiNsExecuteTable().

◆ AcpiPsUpdateParameterList()

static void AcpiPsUpdateParameterList ( ACPI_EVALUATE_INFO Info,
UINT16  Action 
)
static

Definition at line 391 of file psxface.c.

394 {
395  UINT32 i;
396 
397 
398  if (Info->Parameters)
399  {
400  /* Update reference count for each parameter */
401 
402  for (i = 0; Info->Parameters[i]; i++)
403  {
404  /* Ignore errors, just do them all */
405 
407  Info->Parameters[i], Action);
408  }
409  }
410 }
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
struct TraceInfo Info
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT32
_In_ PLIST_ENTRY _In_ PSTRING _In_ USHORT _In_opt_ PSTRING _In_opt_ PSTRING _In_ ULONG _In_ ULONG Action
Definition: fsrtlfuncs.h:738
ACPI_STATUS AcpiUtUpdateObjectReference(ACPI_OPERAND_OBJECT *Object, UINT16 Action)
Definition: utdelete.c:539

Referenced by AcpiPsExecuteMethod().