ReactOS 0.4.16-dev-306-g647d351
uteval.c File Reference
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
Include dependency graph for uteval.c:

Go to the source code of this file.

Macros

#define _COMPONENT   ACPI_UTILITIES
 

Functions

ACPI_STATUS AcpiUtEvaluateObject (ACPI_NAMESPACE_NODE *PrefixNode, const char *Path, UINT32 ExpectedReturnBtypes, ACPI_OPERAND_OBJECT **ReturnDesc)
 
ACPI_STATUS AcpiUtEvaluateNumericObject (const char *ObjectName, ACPI_NAMESPACE_NODE *DeviceNode, UINT64 *Value)
 
ACPI_STATUS AcpiUtExecute_STA (ACPI_NAMESPACE_NODE *DeviceNode, UINT32 *Flags)
 
ACPI_STATUS AcpiUtExecutePowerMethods (ACPI_NAMESPACE_NODE *DeviceNode, const char **MethodNames, UINT8 MethodCount, UINT8 *OutValues)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_UTILITIES

Definition at line 49 of file uteval.c.

Function Documentation

◆ AcpiUtEvaluateNumericObject()

ACPI_STATUS AcpiUtEvaluateNumericObject ( const char ObjectName,
ACPI_NAMESPACE_NODE DeviceNode,
UINT64 Value 
)

Definition at line 221 of file uteval.c.

225{
226 ACPI_OPERAND_OBJECT *ObjDesc;
228
229
230 ACPI_FUNCTION_TRACE (UtEvaluateNumericObject);
231
232
234 ACPI_BTYPE_INTEGER, &ObjDesc);
235 if (ACPI_FAILURE (Status))
236 {
238 }
239
240 /* Get the returned Integer */
241
242 *Value = ObjDesc->Integer.Value;
243
244 /* On exit, we must delete the return object */
245
246 AcpiUtRemoveReference (ObjDesc);
248}
@ DeviceNode
Definition: Node.h:9
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define ACPI_BTYPE_INTEGER
Definition: aclocal.h:332
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
UINT32 ACPI_STATUS
Definition: actypes.h:460
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:790
Status
Definition: gdiplustypes.h:25
ACPI_OBJECT_INTEGER Integer
Definition: acobject.h:520
ACPI_STATUS AcpiUtEvaluateObject(ACPI_NAMESPACE_NODE *PrefixNode, const char *Path, UINT32 ExpectedReturnBtypes, ACPI_OPERAND_OBJECT **ReturnDesc)
Definition: uteval.c:73
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
_In_ PVOID _Out_opt_ PULONG_PTR _Outptr_opt_ PCUNICODE_STRING * ObjectName
Definition: cmfuncs.h:64

Referenced by AcpiEvPciConfigRegionSetup(), AcpiGetObjectInfo(), and AcpiHwGetPciDeviceInfo().

◆ AcpiUtEvaluateObject()

ACPI_STATUS AcpiUtEvaluateObject ( ACPI_NAMESPACE_NODE PrefixNode,
const char Path,
UINT32  ExpectedReturnBtypes,
ACPI_OPERAND_OBJECT **  ReturnDesc 
)

Definition at line 73 of file uteval.c.

78{
81 UINT32 ReturnBtype;
82
83
84 ACPI_FUNCTION_TRACE (UtEvaluateObject);
85
86
87 /* Allocate the evaluation information block */
88
90 if (!Info)
91 {
93 }
94
95 Info->PrefixNode = PrefixNode;
96 Info->RelativePathname = Path;
97
98 /* Evaluate the object/method */
99
101 if (ACPI_FAILURE (Status))
102 {
103 if (Status == AE_NOT_FOUND)
104 {
105 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s.%s] was not found\n",
106 AcpiUtGetNodeName (PrefixNode), Path));
107 }
108 else
109 {
110 ACPI_ERROR_METHOD ("Method execution failed",
111 PrefixNode, Path, Status);
112 }
113
114 goto Cleanup;
115 }
116
117 /* Did we get a return object? */
118
119 if (!Info->ReturnObject)
120 {
121 if (ExpectedReturnBtypes)
122 {
123 ACPI_ERROR_METHOD ("No object was returned from",
124 PrefixNode, Path, AE_NOT_EXIST);
125
127 }
128
129 goto Cleanup;
130 }
131
132 /* Map the return object type to the bitmapped type */
133
134 switch ((Info->ReturnObject)->Common.Type)
135 {
137
138 ReturnBtype = ACPI_BTYPE_INTEGER;
139 break;
140
141 case ACPI_TYPE_BUFFER:
142
143 ReturnBtype = ACPI_BTYPE_BUFFER;
144 break;
145
146 case ACPI_TYPE_STRING:
147
148 ReturnBtype = ACPI_BTYPE_STRING;
149 break;
150
152
153 ReturnBtype = ACPI_BTYPE_PACKAGE;
154 break;
155
156 default:
157
158 ReturnBtype = 0;
159 break;
160 }
161
162 if ((AcpiGbl_EnableInterpreterSlack) &&
163 (!ExpectedReturnBtypes))
164 {
165 /*
166 * We received a return object, but one was not expected. This can
167 * happen frequently if the "implicit return" feature is enabled.
168 * Just delete the return object and return AE_OK.
169 */
170 AcpiUtRemoveReference (Info->ReturnObject);
171 goto Cleanup;
172 }
173
174 /* Is the return object one of the expected types? */
175
176 if (!(ExpectedReturnBtypes & ReturnBtype))
177 {
178 ACPI_ERROR_METHOD ("Return object type is incorrect",
179 PrefixNode, Path, AE_TYPE);
180
182 "Type returned from %s was incorrect: %s, expected Btypes: 0x%X",
183 Path, AcpiUtGetObjectTypeName (Info->ReturnObject),
184 ExpectedReturnBtypes));
185
186 /* On error exit, we must delete the return object */
187
188 AcpiUtRemoveReference (Info->ReturnObject);
189 Status = AE_TYPE;
190 goto Cleanup;
191 }
192
193 /* Object type is OK, return it */
194
195 *ReturnDesc = Info->ReturnObject;
196
197Cleanup:
198 ACPI_FREE (Info);
200}
unsigned int UINT32
PRTL_UNICODE_STRING_BUFFER Path
#define AE_NOT_FOUND
Definition: acexcep.h:113
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define AE_NOT_EXIST
Definition: acexcep.h:114
#define AE_TYPE
Definition: acexcep.h:116
#define ACPI_BTYPE_PACKAGE
Definition: aclocal.h:335
#define ACPI_BTYPE_STRING
Definition: aclocal.h:333
#define ACPI_BTYPE_BUFFER
Definition: aclocal.h:334
#define ACPI_ERROR_METHOD(s, n, p, e)
Definition: acmacros.h:463
ACPI_STATUS AcpiNsEvaluate(ACPI_EVALUATE_INFO *Info)
Definition: nseval.c:82
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
#define ACPI_DB_EXEC
Definition: acoutput.h:165
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AE_INFO
Definition: acoutput.h:230
#define ACPI_TYPE_STRING
Definition: actypes.h:689
#define ACPI_TYPE_BUFFER
Definition: actypes.h:690
#define ACPI_FREE(a)
Definition: actypes.h:386
#define ACPI_TYPE_INTEGER
Definition: actypes.h:688
#define ACPI_ALLOCATE_ZEROED(a)
Definition: actypes.h:385
#define ACPI_TYPE_PACKAGE
Definition: actypes.h:691
const char * AcpiUtGetNodeName(void *Object)
Definition: utdecode.c:306
const char * AcpiUtGetObjectTypeName(ACPI_OPERAND_OBJECT *ObjDesc)
Definition: utdecode.c:264
static const WCHAR Cleanup[]
Definition: register.c:80
_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 AcpiRsGetAeiMethodData(), AcpiRsGetCrsMethodData(), AcpiRsGetMethodData(), AcpiRsGetPrsMethodData(), AcpiRsGetPrtMethodData(), AcpiUtEvaluateNumericObject(), AcpiUtExecute_CID(), AcpiUtExecute_CLS(), AcpiUtExecute_HID(), AcpiUtExecute_STA(), AcpiUtExecute_UID(), and AcpiUtExecutePowerMethods().

◆ AcpiUtExecute_STA()

ACPI_STATUS AcpiUtExecute_STA ( ACPI_NAMESPACE_NODE DeviceNode,
UINT32 Flags 
)

Definition at line 269 of file uteval.c.

272{
273 ACPI_OPERAND_OBJECT *ObjDesc;
275
276
277 ACPI_FUNCTION_TRACE (UtExecute_STA);
278
279
281 ACPI_BTYPE_INTEGER, &ObjDesc);
282 if (ACPI_FAILURE (Status))
283 {
284 if (AE_NOT_FOUND == Status)
285 {
286 /*
287 * if _STA does not exist, then (as per the ACPI specification),
288 * the returned flags will indicate that the device is present,
289 * functional, and enabled.
290 */
292 "_STA on %4.4s was not found, assuming device is present\n",
294
296 Status = AE_OK;
297 }
298
300 }
301
302 /* Extract the status flags */
303
304 *Flags = (UINT32) ObjDesc->Integer.Value;
305
306 /* On exit, we must delete the return object */
307
308 AcpiUtRemoveReference (ObjDesc);
310}
#define AE_OK
Definition: acexcep.h:97
#define METHOD_NAME__STA
Definition: acnames.h:74
#define ACPI_UINT32_MAX
Definition: actypes.h:66
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by AcpiNsGetDeviceCallback(), and AcpiNsInitOneDevice().

◆ AcpiUtExecutePowerMethods()

ACPI_STATUS AcpiUtExecutePowerMethods ( ACPI_NAMESPACE_NODE DeviceNode,
const char **  MethodNames,
UINT8  MethodCount,
UINT8 OutValues 
)

Definition at line 332 of file uteval.c.

337{
338 ACPI_OPERAND_OBJECT *ObjDesc;
340 ACPI_STATUS FinalStatus = AE_NOT_FOUND;
341 UINT32 i;
342
343
344 ACPI_FUNCTION_TRACE (UtExecutePowerMethods);
345
346
347 for (i = 0; i < MethodCount; i++)
348 {
349 /*
350 * Execute the power method (_SxD or _SxW). The only allowable
351 * return type is an Integer.
352 */
354 ACPI_CAST_PTR (char, MethodNames[i]),
355 ACPI_BTYPE_INTEGER, &ObjDesc);
356 if (ACPI_SUCCESS (Status))
357 {
358 OutValues[i] = (UINT8) ObjDesc->Integer.Value;
359
360 /* Delete the return object */
361
362 AcpiUtRemoveReference (ObjDesc);
363 FinalStatus = AE_OK; /* At least one value is valid */
364 continue;
365 }
366
367 OutValues[i] = ACPI_UINT8_MAX;
368 if (Status == AE_NOT_FOUND)
369 {
370 continue; /* Ignore if not found */
371 }
372
373 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Failed %s on Device %4.4s, %s\n",
374 ACPI_CAST_PTR (char, MethodNames[i]),
376 }
377
378 return_ACPI_STATUS (FinalStatus);
379}
unsigned char UINT8
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
#define ACPI_UINT8_MAX
Definition: actypes.h:64
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
const char * AcpiFormatException(ACPI_STATUS Status)
Definition: utexcep.c:70

Referenced by AcpiGetObjectInfo().