8#define AcpiVerifyInBuffer(Stack, Length) \
9 ((Stack)->Parameters.DeviceIoControl.InputBufferLength >= Length)
11#define AcpiVerifyOutBuffer(Stack, Length) \
12 ((Stack)->Parameters.DeviceIoControl.OutputBufferLength >= Length)
14#define TAG_ACPI_PARAMETERS_LIST 'OpcA'
15#define TAG_ACPI_PACKAGE_LIST 'PpcA'
21#define ACPI_OBJECT_NAME_LENGTH (4 + 1)
27#define ACPI_MAX_PACKAGE_DEPTH 5
50 OutName.
Pointer = &Argument->Data[0];
55 DPRINT1(
"AcpiGetName() failed on %p with status 0x%04lx\n",
56 Reference->Reference.Handle,
115 ULONG i, TotalPackageLength;
118 TotalPackageLength = 0;
119 for (
i = 0;
i <
Obj->Package.Count;
i++)
130 TotalPackageLength += ElementSize;
140 TotalCount =
Obj->Package.Count;
153 DPRINT1(
"Unsupported element type %lu\n",
Obj->Type);
216 ULONG TotalPackageLength;
219 TotalPackageLength = 0;
220 for (
i = 0;
i <
Obj->Package.Count;
i++)
231 TotalPackageLength += ElementSize;
236 Argument->DataLength = TotalPackageLength;
241 for (
i = 0;
i <
Obj->Package.Count;
i++)
262 DPRINT1(
"Unsupported element type %lu\n",
Obj->Type);
290 Ptr = PackageArgument;
330 DPRINT1(
"Argument buffer outside of argument bounds\n");
335 switch (Argument->Type)
340 Arg->Integer.Value = (
ULONG64)Argument->Argument;
351 if (Argument->DataLength <
sizeof(
UCHAR))
357 Arg->String.Pointer = (
PCHAR)&Argument->Data[0];
358 Arg->String.Length = Argument->DataLength -
sizeof(
UCHAR);
365 Arg->Buffer.Pointer = &Argument->Data[0];
366 Arg->Buffer.Length = Argument->DataLength;
380 Argument->DataLength);
382 if (Arg->Package.Count == 0)
384 Arg->Package.Elements =
NULL;
388 Status = RtlULongMult(Arg->Package.Count,
sizeof(*Arg), &PackageSize);
391 DPRINT1(
"Invalid package count 0x%lx\n", Arg->Package.Count);
398 if (!Arg->Package.Elements)
402 for (
i = 0;
i < Arg->Package.Count;
i++)
422 DPRINT1(
"Unknown argument type %u\n", Argument->Type);
452 switch (EvalInputBuffer->Signature)
462 ParamList->Count = 0;
480 ParamList->Count = 1;
481 ParamList->Pointer = Arg;
483 SimpleInt =
Irp->AssociatedIrp.SystemBuffer;
504 ParamList->Count = 1;
505 ParamList->Pointer = Arg;
507 SimpleStr =
Irp->AssociatedIrp.SystemBuffer;
528 ComplexBuffer =
Irp->AssociatedIrp.SystemBuffer;
531 if (ParamList->Count == 0)
537 Status = RtlULongMult(ParamList->Count,
sizeof(*Arg), &ArgumentsSize);
540 DPRINT1(
"Invalid argument count 0x%lx\n", ParamList->Count);
550 ParamList->Pointer = Arg;
555 for (
i = 0;
i < ParamList->Count;
i++)
562 DPRINT1(
"Argument buffer outside of argument bounds\n");
584 DPRINT1(
"Unsupported input buffer signature: 0x%lx\n", EvalInputBuffer->Signature);
614 for (
i = 0;
i < Arg->Package.Count;
i++)
620 if (Arg->Package.Elements)
640 for (
i = 0;
i < ParamList->Count;
i++)
736 ULONG ExtraParamLength, OutputBufSize;
744 if (!ReturnBuffer->Pointer || ReturnBuffer->Length == 0)
748 if (IoStack->Parameters.DeviceIoControl.OutputBufferLength == 0)
758 Obj = ReturnBuffer->Pointer;
777 DPRINT(
"Buffer too small (%lu/%lu)\n",
778 IoStack->Parameters.DeviceIoControl.OutputBufferLength,
781 Irp->IoStatus.Information = OutputBufSize;
789 Irp->IoStatus.Information = OutputBufSize;
810 EvalInputBuffer =
Irp->AssociatedIrp.SystemBuffer;
818 if (ParamList.
Count != 0)
823 DPRINT(
"Query method '%.4s' failed on %p with status 0x%04lx\n",
#define ExAllocatePoolUninitialized
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define AE_STACK_OVERFLOW
#define ACPI_AML_EXCEPTION(Status)
#define ACPI_ENV_EXCEPTION(Status)
#define AE_AML_UNINITIALIZED_ARG
#define AE_NO_HARDWARE_RESPONSE
#define ACPI_EVAL_INPUT_BUFFER_COMPLEX_SIGNATURE
ACPI_METHOD_ARGUMENT UNALIGNED * PACPI_METHOD_ARGUMENT
#define ACPI_METHOD_NEXT_ARGUMENT(Argument)
#define ACPI_METHOD_ARGUMENT_STRING
#define ACPI_METHOD_ARGUMENT_INTEGER
#define ACPI_METHOD_ARGUMENT_LENGTH(DataLength)
#define ACPI_METHOD_ARGUMENT_LENGTH_FROM_ARGUMENT(Argument)
#define ACPI_EVAL_INPUT_BUFFER_SIMPLE_INTEGER_SIGNATURE
#define ACPI_EVAL_INPUT_BUFFER_SIGNATURE
#define ACPI_METHOD_SET_ARGUMENT_INTEGER(MethodArgument, IntData)
#define ACPI_METHOD_SET_ARGUMENT_STRING(Argument, StrData)
#define ACPI_METHOD_ARGUMENT_BUFFER
#define ACPI_EVAL_INPUT_BUFFER_SIMPLE_STRING_SIGNATURE
#define ACPI_EVAL_OUTPUT_BUFFER_SIGNATURE
#define ACPI_METHOD_SET_ARGUMENT_BUFFER(Argument, BuffData, BuffLength)
#define ACPI_METHOD_ARGUMENT_PACKAGE
ACPI_EVAL_OUTPUT_BUFFER UNALIGNED * PACPI_EVAL_OUTPUT_BUFFER
void AcpiOsFree(void *Memory)
WORKER_THREAD_ROUTINE Bus_PDO_EvalMethodWorker
#define ACPI_TYPE_LOCAL_REFERENCE
#define ACPI_ALLOCATE_BUFFER
#define ACPI_TYPE_INTEGER
#define ACPI_TYPE_PACKAGE
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_t * DataLength
#define STATUS_NOT_IMPLEMENTED
#define NT_SUCCESS(StatCode)
static const WCHAR Signature[]
static NTSTATUS EvalConvertParameterObjects(_Out_ ACPI_OBJECT *Arg, _In_ ULONG Depth, _In_ PACPI_METHOD_ARGUMENT Argument, _In_ PIO_STACK_LOCATION IoStack, _In_ ULONG Offset)
Performs translation from the supplied method argument into an ACPI_OBJECT structure.
static NTSTATUS EvalCreateOutputArguments(_In_ PIRP Irp, _In_ PIO_STACK_LOCATION IoStack, _In_ ACPI_BUFFER *ReturnBuffer)
Writes the results from the evaluation into the output IRP buffer.
static VOID EvalFreeParameterArgument(_In_ ACPI_OBJECT *Arg, _In_ ULONG Depth)
Deallocates the memory for all sub-objects (elements) in a package.
#define TAG_ACPI_PACKAGE_LIST
NTSTATUS NTAPI Bus_PDO_EvalMethod(_In_ PPDO_DEVICE_DATA DeviceData, _Inout_ PIRP Irp)
#define TAG_ACPI_PARAMETERS_LIST
static ULONG EvalGetPackageCount(_In_ PACPI_METHOD_ARGUMENT Package, _In_ PACPI_METHOD_ARGUMENT PackageArgument, _In_ ULONG DataLength)
Returns the number of sub-objects (elements) in a package.
static NTSTATUS EvalCreateParametersList(_In_ PIRP Irp, _In_ PIO_STACK_LOCATION IoStack, _In_ PACPI_EVAL_INPUT_BUFFER EvalInputBuffer, _Out_ ACPI_OBJECT_LIST *ParamList)
Creates a counted array of ACPI_OBJECTs from the given input buffer.
static NTSTATUS EvalConvertObjectReference(_Out_ PACPI_METHOD_ARGUMENT Argument, _In_ ACPI_OBJECT *Reference)
Performs translation from the supplied object reference into a string method argument.
#define AcpiVerifyInBuffer(Stack, Length)
#define ACPI_OBJECT_NAME_LENGTH
static ACPI_STATUS EvalEvaluateObject(_In_ PPDO_DEVICE_DATA DeviceData, _In_ PACPI_EVAL_INPUT_BUFFER EvalInputBuffer, _In_ ACPI_OBJECT_LIST *ParamList, _In_ ACPI_BUFFER *ReturnBuffer)
Evaluates an ACPI namespace object.
static NTSTATUS EvalConvertEvaluationResults(_Out_ ACPI_METHOD_ARGUMENT *Argument, _In_ ULONG Depth, _In_ ACPI_OBJECT *Obj)
Performs translation from the supplied ACPI_OBJECT structure into a method argument.
static NTSTATUS EvalGetElementSize(_In_ ACPI_OBJECT *Obj, _In_ ULONG Depth, _Out_opt_ PULONG Count, _Out_ PULONG Size)
Calculates the number of bytes needed for returned method argument based on the type of an ACPI_OBJEC...
#define AcpiVerifyOutBuffer(Stack, Length)
#define ACPI_MAX_PACKAGE_DEPTH
static VOID EvalFreeParametersList(_In_ ACPI_OBJECT_LIST *ParamList)
Deallocates the given array of ACPI_OBJECTs.
static NTSTATUS EvalAcpiStatusToNtStatus(_In_ ACPI_STATUS AcpiStatus)
Converts the provided value of ACPI_STATUS to NTSTATUS return value.
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
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
#define ExFreePoolWithTag(_P, _T)
ACPI_STATUS AcpiEvaluateObject(ACPI_HANDLE Handle, ACPI_STRING Pathname, ACPI_OBJECT_LIST *ExternalParams, ACPI_BUFFER *ReturnBuffer)
ACPI_STATUS AcpiGetName(ACPI_HANDLE Handle, UINT32 NameType, ACPI_BUFFER *Buffer)
#define RTL_SIZEOF_THROUGH_FIELD(type, field)
_In_ ULONG _In_ ULONG Offset
_In_ ULONG _In_ ULONG _In_ ULONG Length
#define IoCompleteRequest
#define STATUS_ACPI_INVALID_ARGTYPE
#define STATUS_ACPI_STACK_OVERFLOW
#define STATUS_ACPI_INCORRECT_ARGUMENT_COUNT
#define STATUS_INVALID_PARAMETER_1
#define STATUS_BUFFER_TOO_SMALL
#define STATUS_BUFFER_OVERFLOW
PPDO_DEVICE_DATA DeviceData
#define FIELD_OFFSET(t, f)
#define RtlCopyMemory(Destination, Source, Length)
#define STATUS_IO_DEVICE_ERROR
#define STATUS_IO_TIMEOUT
#define STATUS_UNSUCCESSFUL
#define STATUS_INFO_LENGTH_MISMATCH
#define STATUS_INSUFFICIENT_RESOURCES
#define STATUS_OBJECT_NAME_NOT_FOUND
struct acpi_object::@623 String
struct acpi_object::@622 Integer
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION _In_ ULONG _In_ SIZE_T _In_ ULONG _In_ USHORT Depth
_Inout_opt_ PVOID Parameter