ReactOS 0.4.15-dev-8145-ga541a46
Bus_PDO_EvalMethod.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS API Tests
3 * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
4 * PURPOSE: Unit Tests for acpi!Bus_PDO_EvalMethod (IOCTL_ACPI_EVAL_METHOD handler)
5 * COPYRIGHT: Copyright 2024 Dmitry Borisov (di.sean@protonmail.com)
6 */
7
8/* INCLUDES *******************************************************************/
9
10#include <apitest.h>
11
12#define WIN32_NO_STATUS
13#include <ndk/rtlfuncs.h>
14
15#define UNIT_TEST
16#include <acpi.h>
17
18#include <acpiioct.h>
19#include <ntintsafe.h>
20#include <initguid.h>
21
22/* TEST DEFINITIONS ***********************************************************/
23
24#define ok_eq_str_ex(entry, value, expected) \
25 ok(!strcmp(value, expected), \
26 "Line %lu: " #value " = \"%s\", expected \"%s\"\n", (entry)->Line, value, expected)
27
28#define ok_eq_print_ex(entry, value, expected, spec) \
29 ok((value) == (expected), \
30 "Line %lu: " #value " = " spec ", expected " spec "\n", (entry)->Line, value, expected)
31
32#define ok_not_print_ex(entry, value, expected, spec) \
33 ok((value) != (expected), \
34 "Line %lu: " #value " = " spec ", expected " spec "\n", (entry)->Line, value, expected)
35
36#define ok_eq_hex_ex(entry, value, expected) ok_eq_print_ex(entry, value, expected, "0x%08lx")
37#define ok_eq_pointer_ex(entry, value, expected) ok_eq_print_ex(entry, value, expected, "%p")
38#define ok_eq_int_ex(entry, value, expected) ok_eq_print_ex(entry, value, expected, "%d")
39#define ok_eq_uint_ex(entry, value, expected) ok_eq_print_ex(entry, value, expected, "%u")
40#define ok_eq_ulong_ex(entry, value, expected) ok_eq_print_ex(entry, value, expected, "%lu")
41#define ok_eq_ulonglong_ex(entry, value, expected) ok_eq_print_ex(entry, value, expected, "%I64u")
42
43#define ok_not_pointer_ex(entry, value, expected) ok_not_print_ex(entry, value, expected, "%p")
44
45typedef struct _EVAL_TEST_ENTRY
46{
48
50#define STM_TEST_FLAG_INVALID_ARG_3_1 (1 << 0 )
51#define STM_TEST_FLAG_INVALID_ARG_3_2 (1 << 1 )
52#define STM_TEST_FLAG_INVALID_ARG_3_4 (1 << 2 )
53#define STM_TEST_FLAG_INVALID_ARG_3_5 (1 << 3 )
54#define STM_TEST_FLAG_INVALID_SIZE_1 (1 << 4 )
55#define STM_TEST_FLAG_LARGE_ARG_BUFFER (1 << 5 )
56#define STM_TEST_FLAG_CHANGE_ARG_COUNT (1 << 6 )
57#define STM_TEST_FLAG_SUB_IN_BUFFER (1 << 7 )
58#define STM_TEST_FLAG_SUB_IRP_BUFFER (1 << 8 )
59#define STM_TEST_FLAG_SET_IN_BUFFER (1 << 9 )
60#define STM_TEST_FLAG_SET_IRP_BUFFER (1 << 10)
61#define STM_TEST_FLAG_BAD_ARG_TYPE (1 << 11)
62
63#define GTM_TEST_FLAG_BAD_SIGNARUTE (1 << 0)
64#define GTM_TEST_FLAG_BUFFER_HAS_SIGNARUTE (1 << 1)
65#define GTM_TEST_FLAG_BUFFER_HAS_COUNT (1 << 2)
66#define GTM_TEST_FLAG_BUFFER_HAS_LENGTH (1 << 3)
67#define GTM_TEST_FLAG_ARG_HAS_BUFFER_TYPE (1 << 4)
68#define GTM_TEST_FLAG_ARG_HAS_DATA_LENGTH (1 << 5)
69#define GTM_TEST_FLAG_INC_OUT_BUFFER (1 << 6)
70#define GTM_TEST_FLAG_DEC_OUT_BUFFER (1 << 7)
71#define GTM_TEST_FLAG_SET_OUT_BUFFER (1 << 8)
72
73#define GTM_TEST_FLAG_METHOD_SUCCESS \
74 (GTM_TEST_FLAG_BUFFER_HAS_SIGNARUTE | \
75 GTM_TEST_FLAG_BUFFER_HAS_COUNT | GTM_TEST_FLAG_BUFFER_HAS_LENGTH | \
76 GTM_TEST_FLAG_ARG_HAS_BUFFER_TYPE | GTM_TEST_FLAG_ARG_HAS_DATA_LENGTH)
77
78#define DSM_TEST_FLAG_EMPTY_PACKAGE (1 << 0)
79#define DSM_TEST_FLAG_LARGE_SUB_PACKAGE_BUFFER (1 << 1)
80
84
85/* KERNEL DEFINITIONS (MOCK) **************************************************/
86
87#define PAGED_CODE()
88#define CODE_SEG(...)
89#define DPRINT(...) do { if (0) DbgPrint(__VA_ARGS__); } while (0)
90#define DPRINT1(...) do { if (0) DbgPrint(__VA_ARGS__); } while (0)
91
92typedef struct _IO_STACK_LOCATION
93{
94 union
95 {
96 struct
97 {
103
104typedef struct _IRP
105{
106 union
107 {
111
115
117
118#define ExAllocatePoolUninitialized ExAllocatePoolWithTag
119#define NonPagedPool 1
120static
121PVOID
123{
124 PULONG_PTR Mem;
125
126 Mem = HeapAlloc(GetProcessHeap(), 0, NumberOfBytes + 2 * sizeof(PVOID));
127 Mem[0] = NumberOfBytes;
128 Mem[1] = Tag;
129
131
132 return (PVOID)(Mem + 2);
133}
134
135static
136VOID
138{
139 PULONG_PTR Mem = MemPtr;
140
141 Mem -= 2;
142 ok(Mem[1] == Tag, "Tag is %lx, expected %lx\n", Tag, Mem[1]);
143 HeapFree(GetProcessHeap(), 0, Mem);
144
146}
147
148static
151{
152 return &Irp->MyStack;
153}
154
155/* ACPI DEFINITIONS ***********************************************************/
156
157#include <pshpack1.h>
159{
160 struct
161 {
164 } Drive[2];
165
168#include <poppack.h>
169
170#define STM_ID_BLOCK_SIZE 512
171
172/* ACPI DEFINITIONS (MOCK) ****************************************************/
173
174#define FAKE_SB_NAMESPACE_ACPI_HANDLE 0xFF0F0001
175#define FAKE_INTB_ACPI_HANDLE 0xFF0F0002
176#define FAKE_INTC_ACPI_HANDLE 0xFF0F0003
177
178typedef struct _PDO_DEVICE_DATA
179{
182
183typedef struct _GTM_OBJECT_BUFFER
184{
188
189typedef struct _BIF_OBJECT_BUFFER
190{
193 CHAR Buffer1[1 + 1];
194 CHAR Buffer2[1 + 1];
195 CHAR Buffer3[4 + 1];
196 CHAR Buffer4[7 + 1];
198
199typedef struct _PCL_OBJECT_BUFFER
200{
203
204typedef struct _PRT_OBJECT_BUFFER
205{
211
212DEFINE_GUID(MY_DSM_GUID,
213 0xB76E0B40, 0x3EC6, 0x4DBD, 0x8A, 0xCB, 0x8B, 0xCA, 0x65, 0xB8, 0xBC, 0x70);
214
216{
217 0, 50000, 50000, 1, 10000, 100, 50, 1, 1
218};
219
221{
222 0xAAAAAAAA, 0xBBBBBBBB, 0xDDDDDDDD
223};
224
226
227void *
229 ACPI_SIZE Size)
230{
231 return ExAllocatePoolWithTag(NonPagedPool, Size, 'FFUB');
232}
233
234void
236 void * Memory)
237{
238 ExFreePoolWithTag(Memory, 'FFUB');
239}
240
246{
247 /* We don't support anything else */
248 ok(NameType == ACPI_SINGLE_NAME, "Unexpected call to %s\n", __FUNCTION__);
249
250 /* Return a NULL-terminated string */
251 if (Buffer->Length < (4 + 1))
252 return AE_BUFFER_OVERFLOW;
253
254 switch ((ULONG_PTR)Handle)
255 {
257 RtlCopyMemory(Buffer->Pointer, "_SB_", sizeof("_SB_"));
258 break;
259
261 RtlCopyMemory(Buffer->Pointer, "LNKB", sizeof("LNKB"));
262 break;
263
265 RtlCopyMemory(Buffer->Pointer, "LNKC", sizeof("LNKC"));
266 break;
267
268 default:
269 return AE_BAD_PARAMETER;
270 }
271
272 return AE_OK;
273}
274
280 ACPI_BUFFER *ReturnObjectBuffer)
281{
283
284 /* We don't support anything else */
285 ok(ReturnObjectBuffer->Length == ACPI_ALLOCATE_BUFFER,
286 "Unexpected call to %s\n", __FUNCTION__);
287
288 if (strcmp(Pathname, "_STM") == 0)
289 {
290 ACPI_OBJECT* Arg;
292
293 if (ParameterObjects->Count > 3)
295
296 if (ParameterObjects->Count != 3)
297 return AE_OK;
298
299 /* Argument 1 */
300 {
301 Arg = ParameterObjects->Pointer;
302
304 ok_eq_uint_ex(DrvpEvalTestEntry, Arg->Buffer.Length, sizeof(*TimingMode));
305
306 TimingMode = (PIDE_ACPI_TIMING_MODE_BLOCK)Arg->Buffer.Pointer;
307
308 ok_eq_ulong_ex(DrvpEvalTestEntry, TimingMode->Drive[0].PioSpeed, 508LU);
309 ok_eq_ulong_ex(DrvpEvalTestEntry, TimingMode->Drive[0].DmaSpeed, 120LU);
310 ok_eq_ulong_ex(DrvpEvalTestEntry, TimingMode->Drive[1].PioSpeed, 240LU);
311 ok_eq_ulong_ex(DrvpEvalTestEntry, TimingMode->Drive[1].DmaSpeed, 180LU);
312 ok_eq_hex_ex(DrvpEvalTestEntry, TimingMode->ModeFlags, 0x10LU);
313 }
314 /* Argument 2 */
315 {
316 ++Arg;
317
320 }
321 /* Argument 3 */
322 {
323 ++Arg;
324
327 }
328
329 return AE_OK;
330 }
331 else if (strcmp(Pathname, "_GTM") == 0)
332 {
333 PGTM_OBJECT_BUFFER ReturnObject;
335
336 ReturnObject = AcpiOsAllocate(sizeof(*ReturnObject));
337 if (!ReturnObject)
338 return AE_NO_MEMORY;
339
340 /*
341 * VPC 2007 output
342 * AcpiGetHandle(NULL, "\\_SB.PCI0.IDE0.CHN1", &ObjHandle);
343 * AcpiEvaluateObject(ObjHandle, "_GTM", NULL, &ReturnObj);
344 */
345 TimingMode = &ReturnObject->TimingMode;
346 TimingMode->Drive[0].PioSpeed = 900;
347 TimingMode->Drive[0].DmaSpeed = 900;
348 TimingMode->Drive[1].PioSpeed = 120;
349 TimingMode->Drive[1].DmaSpeed = 120;
350 TimingMode->ModeFlags = 0x12;
351
352 ReturnObject->Obj.Type = ACPI_TYPE_BUFFER;
353 ReturnObject->Obj.Buffer.Length = sizeof(*TimingMode);
354 ReturnObject->Obj.Buffer.Pointer = (PUCHAR)TimingMode;
355
356 ReturnObjectBuffer->Pointer = ReturnObject;
357 ReturnObjectBuffer->Length = sizeof(*ReturnObject);
358 return AE_OK;
359 }
360 else if (strcmp(Pathname, "_BIF") == 0)
361 {
362 PBIF_OBJECT_BUFFER ReturnObject;
364 ULONG i;
365
366 ReturnObject = AcpiOsAllocate(sizeof(*ReturnObject));
367 if (!ReturnObject)
368 return AE_NO_MEMORY;
369
370 /*
371 * Vbox 7.0 output
372 * AcpiGetHandle(NULL, "\\_SB.PCI0.BAT0", &ObjHandle);
373 * AcpiEvaluateObject(ObjHandle, "_BIF", NULL, &ReturnObj);
374 */
375 BatteryInformation = &ReturnObject->BatteryInformation[0];
376 for (i = 0; i < RTL_NUMBER_OF(DrvpBifIntegerFields); ++i)
377 {
378 BatteryInformation[i].Integer.Type = ACPI_TYPE_INTEGER;
379 BatteryInformation[i].Integer.Value = DrvpBifIntegerFields[i];
380 }
382 BatteryInformation[i].String.Length = 1; /* Excluding the trailing null */
383 BatteryInformation[i].String.Pointer = &ReturnObject->Buffer1[0];
384 RtlCopyMemory(BatteryInformation[i].String.Pointer, "1", sizeof("1"));
385 ++i;
387 BatteryInformation[i].String.Length = 1;
388 BatteryInformation[i].String.Pointer = &ReturnObject->Buffer2[0];
389 RtlCopyMemory(BatteryInformation[i].String.Pointer, "0", sizeof("0"));
390 ++i;
392 BatteryInformation[i].String.Length = 4;
393 BatteryInformation[i].String.Pointer = &ReturnObject->Buffer3[0];
394 RtlCopyMemory(BatteryInformation[i].String.Pointer, "VBOX", sizeof("VBOX"));
395 ++i;
397 BatteryInformation[i].String.Length = 7;
398 BatteryInformation[i].String.Pointer = &ReturnObject->Buffer4[0];
399 RtlCopyMemory(BatteryInformation[i].String.Pointer, "innotek", sizeof("innotek"));
400
401 ReturnObject->Obj.Type = ACPI_TYPE_PACKAGE;
402 ReturnObject->Obj.Package.Count = 13;
403 ReturnObject->Obj.Package.Elements = BatteryInformation;
404
405 ReturnObjectBuffer->Pointer = ReturnObject;
406 ReturnObjectBuffer->Length = sizeof(*ReturnObject);
407 return AE_OK;
408 }
409 else if (strcmp(Pathname, "_PCL") == 0)
410 {
411 PPCL_OBJECT_BUFFER ReturnObject;
412
413 ReturnObject = AcpiOsAllocate(sizeof(*ReturnObject));
414 if (!ReturnObject)
415 return AE_NO_MEMORY;
416
417 /*
418 * Vbox 7.0 output
419 * AcpiGetHandle(NULL, "\\_SB.PCI0.AC", &ObjHandle);
420 * AcpiEvaluateObject(ObjHandle, "_PCL", NULL, &ReturnObj);
421 */
422 ReturnObject->Obj.Reference.Type = ACPI_TYPE_LOCAL_REFERENCE;
423 ReturnObject->Obj.Reference.ActualType = ACPI_TYPE_DEVICE;
425
426 ReturnObjectBuffer->Pointer = ReturnObject;
427 ReturnObjectBuffer->Length = sizeof(*ReturnObject);
428 return AE_OK;
429 }
430 else if (strcmp(Pathname, "_PRT") == 0)
431 {
432 PPRT_OBJECT_BUFFER ReturnObject;
433 ULONG i;
434
435 ReturnObject = AcpiOsAllocate(sizeof(*ReturnObject));
436 if (!ReturnObject)
437 return AE_NO_MEMORY;
438
439 /*
440 * Vbox 7.0 output
441 * AcpiGetHandle(NULL, "\\_SB.PCI0", &ObjHandle);
442 * AcpiEvaluateObject(ObjHandle, "_PRT", NULL, &ReturnObj);
443 *
444 * NOTE: To avoid similar copies of code executed and tested over and over again
445 * we return 2 packages. The original method returns 120 packages.
446 */
447 ReturnObject->Obj.Type = ACPI_TYPE_PACKAGE;
448 ReturnObject->Obj.Package.Count = 2;
449 ReturnObject->Obj.Package.Elements = &ReturnObject->PackageContainer[0];
450
451 i = 0;
452 ReturnObject->PackageContainer[i].Type = ACPI_TYPE_PACKAGE;
453 ReturnObject->PackageContainer[i].Package.Count = 4;
454 ReturnObject->PackageContainer[i].Package.Elements = &ReturnObject->Package1[0];
455 ++i;
456 ReturnObject->PackageContainer[i].Type = ACPI_TYPE_PACKAGE;
457 ReturnObject->PackageContainer[i].Package.Count = 4;
458 ReturnObject->PackageContainer[i].Package.Elements = &ReturnObject->Package2[0];
459
460 /* Package 1 */
461 i = 0;
462 ReturnObject->Package1[i].Integer.Type = ACPI_TYPE_INTEGER;
463 ReturnObject->Package1[i].Integer.Value = 0x0002FFFF;
464 ++i;
465 ReturnObject->Package1[i].Integer.Type = ACPI_TYPE_INTEGER;
466 ReturnObject->Package1[i].Integer.Value = 0x00000000;
467 ++i;
468 ReturnObject->Package1[i].Reference.Type = ACPI_TYPE_LOCAL_REFERENCE;
469 ReturnObject->Package1[i].Reference.ActualType = ACPI_TYPE_DEVICE;
471 ++i;
472 ReturnObject->Package1[i].Integer.Type = ACPI_TYPE_INTEGER;
473 ReturnObject->Package1[i].Integer.Value = 0x00000000;
474
475 /* Package 2 */
476 i = 0;
477 ReturnObject->Package2[i].Integer.Type = ACPI_TYPE_INTEGER;
478 ReturnObject->Package2[i].Integer.Value = 0x0002FFFF;
479 ++i;
480 ReturnObject->Package2[i].Integer.Type = ACPI_TYPE_INTEGER;
481 ReturnObject->Package2[i].Integer.Value = 0x00000001;
482 ++i;
483 ReturnObject->Package2[i].Reference.Type = ACPI_TYPE_LOCAL_REFERENCE;
484 ReturnObject->Package2[i].Reference.ActualType = ACPI_TYPE_DEVICE;
486 ++i;
487 ReturnObject->Package2[i].Integer.Type = ACPI_TYPE_INTEGER;
488 ReturnObject->Package2[i].Integer.Value = 0x00000000;
489
490 ReturnObjectBuffer->Pointer = ReturnObject;
491 ReturnObjectBuffer->Length = sizeof(*ReturnObject);
492 return AE_OK;
493 }
494 else if (strcmp(Pathname, "_DSM") == 0)
495 {
496 ACPI_OBJECT* Arg;
497
498 /* Assumed object count per the spec */
499 ok_eq_uint(ParameterObjects->Count, 4);
500
501 if (ParameterObjects->Count != 4)
503
504 /* Argument 1 */
505 {
506 Arg = ParameterObjects->Pointer;
507
509 ok_eq_uint_ex(DrvpEvalTestEntry, Arg->Buffer.Length, sizeof(GUID));
510 }
511
512 /* NOTE: This UUID doesn't exist, for testing purposes only */
513 if (IsEqualGUID(Arg->Buffer.Pointer, &MY_DSM_GUID))
514 {
515 /* Argument 2 */
516 {
517 ++Arg;
518
521 }
522 /* Argument 3 */
523 {
524 ++Arg;
525
528 }
529 /* Argument 4 */
530 {
531 ++Arg;
532
534
536 {
539 }
540 else
541 {
542 ACPI_OBJECT* PackageArg;
543 ACPI_OBJECT* PackageArg2;
544 ULONG i;
545
548
549 if (!Arg->Package.Elements)
551
552 /* Package 1 Arguments 1-2 */
553 PackageArg = Arg->Package.Elements;
554 for (i = 0; i < RTL_NUMBER_OF(DrvpMyDsmIntegerFields) - 1; i++)
555 {
558 PackageArg->Integer.Value,
560
561 ++PackageArg;
562 }
563
564 /* Package 1 Argument 3 */
565 {
566 Arg = PackageArg;
567
570
571 /* Package 2 Argument 1 */
572 PackageArg2 = Arg->Package.Elements;
573
575
576 /* Excluding the trailing null */
578 PackageArg2->String.Length,
579 (sizeof("1_TESTDATATESTDATA_2") - 1));
581 memcmp(PackageArg2->String.Pointer,
582 "1_TESTDATATESTDATA_2",
583 sizeof("1_TESTDATATESTDATA_2") - 1),
584 0);
585 }
586 /* Package 1 Argument 4 */
587 {
588 ++PackageArg;
589
592 PackageArg->Integer.Value,
594 }
595 }
596 }
597
598 return AE_OK;
599 }
600 }
601
602 return AE_NOT_FOUND;
603}
604
605#include "../../../../drivers/bus/acpi/eval.c"
606
607/* GLOBALS ********************************************************************/
608
609/* 2 ID blocks + timings + room for the test data */
610#define STM_MAX_BUFFER_SIZE \
611 (FIELD_OFFSET(ACPI_EVAL_INPUT_BUFFER_COMPLEX, Argument) + \
612 2 * STM_ID_BLOCK_SIZE + sizeof(IDE_ACPI_TIMING_MODE_BLOCK) + 0x100)
613
614#define GTM_MAX_BUFFER_SIZE \
615 (FIELD_OFFSET(ACPI_EVAL_OUTPUT_BUFFER, Argument) + \
616 ACPI_METHOD_ARGUMENT_LENGTH(sizeof(IDE_ACPI_TIMING_MODE_BLOCK)) + 0x50)
617
619{
620 { __LINE__, 0, STATUS_SUCCESS },
636 sizeof(ACPI_EVAL_INPUT_BUFFER) - 2 },
638 sizeof(ACPI_EVAL_INPUT_BUFFER) - 1 },
640 sizeof(ACPI_EVAL_INPUT_BUFFER) },
642 sizeof(ACPI_EVAL_INPUT_BUFFER) + 1 },
644 sizeof(ACPI_EVAL_INPUT_BUFFER) + 2 },
647
648#if 0
649 /*
650 * The return status depends on AML interpreter implementation
651 * and testing it is not practical, keeping this for reference only.
652 */
659#endif
660};
661
663{
665 { __LINE__, GTM_TEST_FLAG_METHOD_SUCCESS |
667 { __LINE__, GTM_TEST_FLAG_METHOD_SUCCESS |
672 FIELD_OFFSET(ACPI_EVAL_OUTPUT_BUFFER, Argument) - 1 },
676 FIELD_OFFSET(ACPI_EVAL_OUTPUT_BUFFER, Argument) + 1 },
678 sizeof(ACPI_EVAL_OUTPUT_BUFFER) - 1 },
684 sizeof(ACPI_EVAL_OUTPUT_BUFFER) },
690 sizeof(ACPI_EVAL_OUTPUT_BUFFER) + 1 },
691
692 /* Pass an invalid signature */
698 sizeof(ACPI_EVAL_OUTPUT_BUFFER) - 1 },
701 sizeof(ACPI_EVAL_OUTPUT_BUFFER) },
702};
703
705{
706 { __LINE__, 0, STATUS_SUCCESS },
707};
708
710{
711 { __LINE__, 0, STATUS_SUCCESS },
712};
713
715{
716 { __LINE__, 0, STATUS_SUCCESS },
717};
718
720{
721 { __LINE__, 0, STATUS_SUCCESS },
724};
725
726/* FUNCTIONS ******************************************************************/
727
728static
735{
737 IRP Irp;
738
739 DeviceData.AcpiHandle = NULL;
740
741 Irp.AssociatedIrp.SystemBuffer = InputBuffer;
742 Irp.OutputBuffer = OutputBuffer;
743
744 Irp.MyStack.Parameters.DeviceIoControl.InputBufferLength = InputBufferLength;
745 Irp.MyStack.Parameters.DeviceIoControl.OutputBufferLength = OutputBufferLength;
746
748}
749
750static
751VOID
755 _In_ PUCHAR IdBlock,
757{
758 PACPI_METHOD_ARGUMENT Argument, Argument2, Argument3;
760 ULONG InputBufferSize, IrpBufferSize;
761
762 InputBufferSize = FIELD_OFFSET(ACPI_EVAL_INPUT_BUFFER_COMPLEX, Argument) +
763 ACPI_METHOD_ARGUMENT_LENGTH(sizeof(*TimingMode)) +
766
768 {
771 }
772
773 InputBuffer->MethodNameAsUlong = 'MTS_'; // _STM
776 {
777 InputBuffer->Size = InputBufferSize - TestEntry->Value;
778 }
779 else if (TestEntry->Flags & STM_TEST_FLAG_SET_IN_BUFFER)
780 {
781 InputBuffer->Size = TestEntry->Value;
782 }
783 else
784 {
785 InputBuffer->Size = InputBufferSize;
786 }
787
789 {
790 InputBuffer->ArgumentCount = TestEntry->Value;
791 }
792 else
793 {
794 InputBuffer->ArgumentCount = 3;
795 }
796
797 /* Argument 1: The channel timing information block */
798 Argument = InputBuffer->Argument;
799 ACPI_METHOD_SET_ARGUMENT_BUFFER(Argument, TimingMode, sizeof(*TimingMode));
800
801 /* Argument 2: The ATA drive ID block */
804
805 /* Argument 3: The ATA drive ID block */
808
810 {
811 Argument3->Type = 0xFFFF;
812 }
813
815 {
816 Argument2->DataLength = STM_ID_BLOCK_SIZE * 2;
817 Argument3->DataLength = STM_ID_BLOCK_SIZE * 2;
818 }
819
821 {
822 ACPI_METHOD_SET_ARGUMENT_STRING(Argument3, IdBlock);
823 }
825 {
826 ACPI_METHOD_SET_ARGUMENT_INTEGER(Argument3, 0xDEADBEEF);
827 }
829 {
830 Argument3->DataLength += 5;
831 }
833 {
834 Argument3->DataLength -= 5;
835 }
836
838 {
839 IrpBufferSize = InputBufferSize - TestEntry->Value;
840 }
841 else if (TestEntry->Flags & STM_TEST_FLAG_SET_IRP_BUFFER)
842 {
843 IrpBufferSize = TestEntry->Value;
844 }
845 else
846 {
847 IrpBufferSize = InputBufferSize;
848 }
849
850 /* Evaluate the _STM method */
852 Status = DrvCallAcpiDriver(InputBuffer, IrpBufferSize, NULL, 0);
853
855}
856
857static
858VOID
860{
862 UCHAR IdBlock[STM_ID_BLOCK_SIZE];
863 ULONG i;
866
867 /* Initialize method arguments */
868 RtlZeroMemory(IdBlock, sizeof(IdBlock));
869 TimingMode.Drive[0].PioSpeed = 508;
870 TimingMode.Drive[0].DmaSpeed = 120;
871 TimingMode.Drive[1].PioSpeed = 240;
872 TimingMode.Drive[1].DmaSpeed = 180;
873 TimingMode.ModeFlags = 0x10;
874
875 for (i = 0; i < RTL_NUMBER_OF(DrvpSmtTests); ++i)
876 {
877 DrvEvaluateStmObject(&DrvpSmtTests[i], &TimingMode, IdBlock, InputBuffer);
878 }
879}
880
881static
882VOID
886{
888 ULONG OutputBufferSize;
890 PACPI_METHOD_ARGUMENT Argument;
894
895 InputBuffer.MethodNameAsUlong = 'MTG_'; // _GTM
897 InputBuffer.Signature = 'BAD0';
898 else
900
901 OutputBufferSize = FIELD_OFFSET(ACPI_EVAL_OUTPUT_BUFFER, Argument) +
902 ACPI_METHOD_ARGUMENT_LENGTH(sizeof(*TimingMode));
903
905 {
906 OutputBufferSize += TestEntry->Value;
907 }
908 else if (TestEntry->Flags & GTM_TEST_FLAG_DEC_OUT_BUFFER)
909 {
910 OutputBufferSize -= TestEntry->Value;
911 }
912 else if (TestEntry->Flags & GTM_TEST_FLAG_SET_OUT_BUFFER)
913 {
914 OutputBufferSize = TestEntry->Value;
915 }
916
917 /* Evaluate the _GTM method */
918 Status = DrvCallAcpiDriver(&InputBuffer, sizeof(InputBuffer), OutputBuffer, OutputBufferSize);
919
921
924 else
925 Signature = 0;
927
929 Count = 1;
930 else
931 Count = 0;
933
935 {
937 ACPI_METHOD_ARGUMENT_LENGTH(sizeof(*TimingMode));
938 }
939 else
940 {
941 Length = 0;
942 }
944
945 Argument = OutputBuffer->Argument;
948 else
950 ok_eq_uint_ex(TestEntry, Argument->Type, Type);
951
954 else
955 DataLength = 0;
956 ok_eq_uint_ex(TestEntry, Argument->DataLength, DataLength);
957
959 {
960 TimingMode = (PIDE_ACPI_TIMING_MODE_BLOCK)Argument->Data;
961
962 ok_eq_ulong_ex(TestEntry, TimingMode->Drive[0].PioSpeed, 900LU);
963 ok_eq_ulong_ex(TestEntry, TimingMode->Drive[0].DmaSpeed, 900LU);
964 ok_eq_ulong_ex(TestEntry, TimingMode->Drive[1].PioSpeed, 120LU);
965 ok_eq_ulong_ex(TestEntry, TimingMode->Drive[1].DmaSpeed, 120LU);
966 ok_eq_hex_ex(TestEntry, TimingMode->ModeFlags, 0x12LU);
967 }
968}
969
970static
971VOID
973{
975 ULONG i;
977
978 for (i = 0; i < RTL_NUMBER_OF(DrvpGtmTests); ++i)
979 {
980 RtlZeroMemory(Buffer, sizeof(Buffer));
981
983 }
984}
985
986static
987VOID
991{
993 ULONG i, OutputBufferSize;
995 PACPI_METHOD_ARGUMENT Argument;
996
997 InputBuffer.MethodNameAsUlong = 'FIB_'; // _BIF
999
1000 OutputBufferSize = FIELD_OFFSET(ACPI_EVAL_OUTPUT_BUFFER, Argument) +
1001 ACPI_METHOD_ARGUMENT_LENGTH(sizeof(ULONG)) * 9 +
1002 ACPI_METHOD_ARGUMENT_LENGTH(sizeof("1")) +
1003 ACPI_METHOD_ARGUMENT_LENGTH(sizeof("0")) +
1004 ACPI_METHOD_ARGUMENT_LENGTH(sizeof("VBOX")) +
1005 ACPI_METHOD_ARGUMENT_LENGTH(sizeof("innotek"));
1006
1007 /* Evaluate the _BIF method */
1008 Status = DrvCallAcpiDriver(&InputBuffer, sizeof(InputBuffer), OutputBuffer, OutputBufferSize);
1009
1013 ok_eq_ulong_ex(TestEntry, OutputBuffer->Length, OutputBufferSize);
1014
1015 /* Arguments 1-9 */
1016 Argument = OutputBuffer->Argument;
1017 for (i = 0; i < RTL_NUMBER_OF(DrvpBifIntegerFields); ++i)
1018 {
1020 ok_eq_uint_ex(TestEntry, Argument->DataLength, sizeof(ULONG));
1021 ok_eq_ulong_ex(TestEntry, Argument->Argument, DrvpBifIntegerFields[i]);
1022
1023 Argument = ACPI_METHOD_NEXT_ARGUMENT(Argument);
1024 }
1025 /* Argument 10 */
1026 {
1028 ok_eq_uint_ex(TestEntry, Argument->DataLength, sizeof("1")); // Including the trailing null
1029 ok_eq_str_ex(TestEntry, (PCSTR)Argument->Data, "1");
1030 }
1031 /* Argument 11 */
1032 {
1033 Argument = ACPI_METHOD_NEXT_ARGUMENT(Argument);
1034
1036 ok_eq_uint_ex(TestEntry, Argument->DataLength, sizeof("0"));
1037 ok_eq_str_ex(TestEntry, (PCSTR)Argument->Data, "0");
1038 }
1039 /* Argument 12 */
1040 {
1041 Argument = ACPI_METHOD_NEXT_ARGUMENT(Argument);
1042
1044 ok_eq_uint_ex(TestEntry, Argument->DataLength, sizeof("VBOX"));
1045 ok_eq_str_ex(TestEntry, (PCSTR)Argument->Data, "VBOX");
1046 }
1047 /* Argument 13 */
1048 {
1049 Argument = ACPI_METHOD_NEXT_ARGUMENT(Argument);
1050
1052 ok_eq_uint_ex(TestEntry, Argument->DataLength, sizeof("innotek"));
1053 ok_eq_str_ex(TestEntry, (PCSTR)Argument->Data, "innotek");
1054 }
1055}
1056
1057static
1058VOID
1060{
1061 UCHAR Buffer[0x100];
1062 ULONG i;
1064
1065 for (i = 0; i < RTL_NUMBER_OF(DrvpBifTests); ++i)
1066 {
1067 RtlZeroMemory(Buffer, sizeof(Buffer));
1068
1070 }
1071}
1072
1073static
1074VOID
1078{
1080 ULONG OutputBufferSize;
1082 PACPI_METHOD_ARGUMENT Argument;
1083
1084 InputBuffer.MethodNameAsUlong = 'LCP_'; // _PCL
1086
1087 OutputBufferSize = FIELD_OFFSET(ACPI_EVAL_OUTPUT_BUFFER, Argument) +
1088 ACPI_METHOD_ARGUMENT_LENGTH(sizeof("ABCD")); // ACPI name for the object
1089
1090 /* Evaluate the _PCL method */
1091 Status = DrvCallAcpiDriver(&InputBuffer, sizeof(InputBuffer), OutputBuffer, OutputBufferSize);
1092
1096 ok_eq_ulong_ex(TestEntry, OutputBuffer->Length, OutputBufferSize);
1097
1098 Argument = OutputBuffer->Argument;
1099
1101 ok_eq_uint_ex(TestEntry, Argument->DataLength, sizeof("ABCD"));
1102 ok_eq_str_ex(TestEntry, (PCSTR)Argument->Data, "_SB_");
1103}
1104
1105static
1106VOID
1108{
1109 UCHAR Buffer[0x100];
1110 ULONG i;
1112
1113 for (i = 0; i < RTL_NUMBER_OF(DrvpPclTests); ++i)
1114 {
1115 RtlZeroMemory(Buffer, sizeof(Buffer));
1116
1118 }
1119}
1120
1121static
1122VOID
1126{
1128 ULONG PackageNum, ArgNum, OutputBufferSize;
1130 PACPI_METHOD_ARGUMENT Argument, PackageArgument;
1131
1132 InputBuffer.MethodNameAsUlong = 'TRP_'; // _PRT
1134
1135#define PRT_PACKAGE_ENTRY_SIZE \
1136 (ACPI_METHOD_ARGUMENT_LENGTH(sizeof(ULONG)) * 3 + \
1137 ACPI_METHOD_ARGUMENT_LENGTH(sizeof("LNKB")))
1138
1139 OutputBufferSize = FIELD_OFFSET(ACPI_EVAL_OUTPUT_BUFFER, Argument) +
1141
1142 /* Evaluate the _PRT method */
1143 Status = DrvCallAcpiDriver(&InputBuffer, sizeof(InputBuffer), OutputBuffer, OutputBufferSize);
1144
1148 ok_eq_ulong_ex(TestEntry, OutputBuffer->Length, OutputBufferSize);
1149
1150 Argument = OutputBuffer->Argument;
1151 for (PackageNum = 0; PackageNum < 2; PackageNum++)
1152 {
1154 ok_eq_uint_ex(TestEntry, Argument->DataLength, (USHORT)PRT_PACKAGE_ENTRY_SIZE);
1155
1156 PackageArgument = (PACPI_METHOD_ARGUMENT)Argument->Data;
1157 for (ArgNum = 0; ArgNum < 4; ArgNum++)
1158 {
1159 if (ArgNum != 2)
1160 {
1161 ULONG ExpectedValue;
1162
1163 ok_eq_uint_ex(TestEntry, PackageArgument->Type, ACPI_METHOD_ARGUMENT_INTEGER);
1164 ok_eq_uint_ex(TestEntry, PackageArgument->DataLength, sizeof(ULONG));
1165
1166 if (ArgNum == 0)
1167 {
1168 ExpectedValue = 0x0002FFFF;
1169 }
1170 else
1171 {
1172 if ((PackageNum == 1) && (ArgNum == 1))
1173 ExpectedValue = 0x00000001;
1174 else
1175 ExpectedValue = 0x00000000;
1176 }
1177 ok_eq_ulong_ex(TestEntry, PackageArgument->Argument, ExpectedValue);
1178 }
1179 else
1180 {
1181 ok_eq_uint_ex(TestEntry, PackageArgument->Type, ACPI_METHOD_ARGUMENT_STRING);
1182 ok_eq_uint_ex(TestEntry, PackageArgument->DataLength, sizeof("ABCD"));
1183 ok_eq_str_ex(TestEntry, (PCSTR)PackageArgument->Data,
1184 (PackageNum == 0) ? "LNKB" : "LNKC");
1185 }
1186
1187 PackageArgument = ACPI_METHOD_NEXT_ARGUMENT(PackageArgument);
1188 }
1189
1190 Argument = ACPI_METHOD_NEXT_ARGUMENT(Argument);
1191 }
1192}
1193
1194static
1195VOID
1197{
1198 UCHAR Buffer[0x100];
1199 ULONG i;
1201
1202 for (i = 0; i < RTL_NUMBER_OF(DrvpPclTests); ++i)
1203 {
1204 RtlZeroMemory(Buffer, sizeof(Buffer));
1205
1207 }
1208}
1209
1210static
1211VOID
1214{
1215#define MY_DSM_SUB_PACKAGE_ENTRY_SIZE \
1216 (ACPI_METHOD_ARGUMENT_LENGTH(sizeof("1_TESTDATATESTDATA_2")))
1217
1218#define MY_DSM_PACKAGE_ENTRY_SIZE \
1219 (ACPI_METHOD_ARGUMENT_LENGTH(sizeof(ULONG)) * 3 + \
1220 ACPI_METHOD_ARGUMENT_LENGTH(MY_DSM_SUB_PACKAGE_ENTRY_SIZE))
1221
1222#define MY_DSM_BUFFER_SIZE \
1223 (FIELD_OFFSET(ACPI_EVAL_INPUT_BUFFER_COMPLEX, Argument) + \
1224 ACPI_METHOD_ARGUMENT_LENGTH(sizeof(GUID)) + \
1225 ACPI_METHOD_ARGUMENT_LENGTH(sizeof(ULONG)) + \
1226 ACPI_METHOD_ARGUMENT_LENGTH(sizeof(ULONG)) + \
1227 ACPI_METHOD_ARGUMENT_LENGTH(MY_DSM_PACKAGE_ENTRY_SIZE))
1228
1230 ULONG InputSize;
1232 PACPI_METHOD_ARGUMENT Argument, PackageArgument, PackageArgument2;
1234
1235 RtlZeroMemory(Buffer, sizeof(Buffer));
1236
1237 InputSize = MY_DSM_BUFFER_SIZE;
1239 {
1242 }
1243
1244 InputBuffer->MethodNameAsUlong = 'MSD_'; // _DSM
1246 InputBuffer->ArgumentCount = 4;
1247 InputBuffer->Size = InputSize;
1248
1249 /* Argument 1: The UUID */
1250 Argument = InputBuffer->Argument;
1251 ACPI_METHOD_SET_ARGUMENT_BUFFER(Argument, &MY_DSM_GUID, sizeof(GUID));
1252
1253 /* Argument 2: The Revision ID */
1254 Argument = ACPI_METHOD_NEXT_ARGUMENT(Argument);
1256
1257 /* Argument 3: The Function Index */
1258 Argument = ACPI_METHOD_NEXT_ARGUMENT(Argument);
1260
1261 /* Argument 4: The device-specific package */
1262 Argument = ACPI_METHOD_NEXT_ARGUMENT(Argument);
1263 Argument->Type = ACPI_METHOD_ARGUMENT_PACKAGE;
1265 {
1266 /* Empty package */
1267 Argument->DataLength = ACPI_METHOD_ARGUMENT_LENGTH(0);
1268 Argument->Argument = 0;
1269 }
1270 else
1271 {
1272 Argument->DataLength = MY_DSM_PACKAGE_ENTRY_SIZE;
1273
1274 /* Package 1 Argument 1: Some test data */
1275 PackageArgument = (PACPI_METHOD_ARGUMENT)Argument->Data;
1277
1278 /* Package 1 Argument 2: Some test data */
1279 PackageArgument = ACPI_METHOD_NEXT_ARGUMENT(PackageArgument);
1281
1282 /* Package 1 Argument 3: Start a new subpackage */
1283 PackageArgument = ACPI_METHOD_NEXT_ARGUMENT(PackageArgument);
1284 PackageArgument->Type = ACPI_METHOD_ARGUMENT_PACKAGE;
1285 PackageArgument->DataLength = MY_DSM_SUB_PACKAGE_ENTRY_SIZE;
1286
1287 /* Package 2 Argument 1: Some test data */
1288 PackageArgument2 = (PACPI_METHOD_ARGUMENT)PackageArgument->Data;
1289 ACPI_METHOD_SET_ARGUMENT_STRING(PackageArgument2, "1_TESTDATATESTDATA_2");
1290
1292 {
1293 PackageArgument2->DataLength = 32768;
1294 }
1295 else
1296 {
1297 /* Package 1 Argument 4: Some test data */
1298 PackageArgument = ACPI_METHOD_NEXT_ARGUMENT(PackageArgument);
1300 }
1301 }
1302
1303 /* Evaluate the _DSM method */
1305 Status = DrvCallAcpiDriver(InputBuffer, InputSize, NULL, 0);
1306
1308}
1309
1310static
1311VOID
1313{
1314 ULONG i;
1315
1316 for (i = 0; i < RTL_NUMBER_OF(DrvpDsmTests); ++i)
1317 {
1319 }
1320}
1321
1322static
1323VOID
1325{
1328
1329 InputBuffer.MethodNameAsUlong = 'FFF_'; // _FFF
1331
1332 /* Try to evaluate some unsupported control method */
1334
1336}
1337
1339{
1347
1348 ok(DrvpBlocksAllocated == 0, "Leaking memory %ld blocks\n", DrvpBlocksAllocated);
1349}
#define DSM_TEST_FLAG_LARGE_SUB_PACKAGE_BUFFER
#define FAKE_INTB_ACPI_HANDLE
#define STM_TEST_FLAG_SET_IRP_BUFFER
#define GTM_TEST_FLAG_BUFFER_HAS_LENGTH
#define GTM_TEST_FLAG_BAD_SIGNARUTE
#define GTM_TEST_FLAG_BUFFER_HAS_SIGNARUTE
struct _GTM_OBJECT_BUFFER * PGTM_OBJECT_BUFFER
static VOID DrvEvaluatePrtObject(_In_ const EVAL_TEST_ENTRY *TestEntry, _In_ PACPI_EVAL_OUTPUT_BUFFER OutputBuffer)
#define GTM_TEST_FLAG_ARG_HAS_BUFFER_TYPE
#define ok_eq_uint_ex(entry, value, expected)
#define FAKE_INTC_ACPI_HANDLE
struct _IO_STACK_LOCATION * PIO_STACK_LOCATION
static VOID DrvEvaluateGtmObject(_In_ const EVAL_TEST_ENTRY *TestEntry, _In_ PACPI_EVAL_OUTPUT_BUFFER OutputBuffer)
#define STM_MAX_BUFFER_SIZE
#define STM_TEST_FLAG_CHANGE_ARG_COUNT
#define ok_eq_str_ex(entry, value, expected)
static VOID DrvTestPackageReturnValueAndStringData(VOID)
struct _PRT_OBJECT_BUFFER PRT_OBJECT_BUFFER
struct _PRT_OBJECT_BUFFER * PPRT_OBJECT_BUFFER
#define STM_TEST_FLAG_LARGE_ARG_BUFFER
struct _PCL_OBJECT_BUFFER PCL_OBJECT_BUFFER
static const EVAL_TEST_ENTRY DrvpPrtTests[]
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
struct _IDE_ACPI_TIMING_MODE_BLOCK * PIDE_ACPI_TIMING_MODE_BLOCK
#define ok_eq_ulong_ex(entry, value, expected)
#define GTM_TEST_FLAG_SET_OUT_BUFFER
void * AcpiOsAllocate(ACPI_SIZE Size)
#define ok_eq_int_ex(entry, value, expected)
struct _IRP * PIRP
static const EVAL_TEST_ENTRY DrvpPclTests[]
#define ok_eq_ulonglong_ex(entry, value, expected)
static VOID DrvTestNestedPackageReturnValue(VOID)
static const EVAL_TEST_ENTRY DrvpGtmTests[]
ACPI_STATUS AcpiEvaluateObject(ACPI_HANDLE Object, ACPI_STRING Pathname, ACPI_OBJECT_LIST *ParameterObjects, ACPI_BUFFER *ReturnObjectBuffer)
#define GTM_TEST_FLAG_ARG_HAS_DATA_LENGTH
#define DSM_TEST_FLAG_EMPTY_PACKAGE
static VOID DrvTestInputBuffer(VOID)
#define STM_TEST_FLAG_BAD_ARG_TYPE
#define MY_DSM_BUFFER_SIZE
struct _BIF_OBJECT_BUFFER * PBIF_OBJECT_BUFFER
static const ULONG DrvpMyDsmIntegerFields[3]
ACPI_STATUS AcpiGetName(ACPI_HANDLE Handle, UINT32 NameType, ACPI_BUFFER *Buffer)
#define STM_TEST_FLAG_SUB_IRP_BUFFER
#define STM_TEST_FLAG_SET_IN_BUFFER
#define STM_TEST_FLAG_SUB_IN_BUFFER
#define ok_eq_pointer_ex(entry, value, expected)
struct _IDE_ACPI_TIMING_MODE_BLOCK IDE_ACPI_TIMING_MODE_BLOCK
static const EVAL_TEST_ENTRY DrvpDsmTests[]
#define STM_TEST_FLAG_INVALID_ARG_3_5
#define MY_DSM_PACKAGE_ENTRY_SIZE
static const EVAL_TEST_ENTRY * DrvpEvalTestEntry
static VOID DrvEvaluateDsmObject(_In_ const EVAL_TEST_ENTRY *TestEntry)
struct _BIF_OBJECT_BUFFER BIF_OBJECT_BUFFER
static VOID DrvEvaluatePclObject(_In_ const EVAL_TEST_ENTRY *TestEntry, _In_ PACPI_EVAL_OUTPUT_BUFFER OutputBuffer)
static NTSTATUS DrvCallAcpiDriver(_In_ PVOID InputBuffer, _In_ ULONG InputBufferLength, _Out_opt_ PACPI_EVAL_OUTPUT_BUFFER OutputBuffer, _In_ ULONG OutputBufferLength)
struct _GTM_OBJECT_BUFFER GTM_OBJECT_BUFFER
struct _IO_STACK_LOCATION IO_STACK_LOCATION
void AcpiOsFree(void *Memory)
#define ok_eq_hex_ex(entry, value, expected)
struct _PCL_OBJECT_BUFFER * PPCL_OBJECT_BUFFER
#define STM_TEST_FLAG_INVALID_ARG_3_1
static VOID DrvEvaluateStmObject(_In_ const EVAL_TEST_ENTRY *TestEntry, _In_ PIDE_ACPI_TIMING_MODE_BLOCK TimingMode, _In_ PUCHAR IdBlock, _In_ PACPI_EVAL_INPUT_BUFFER_COMPLEX InputBuffer)
#define FAKE_SB_NAMESPACE_ACPI_HANDLE
#define PRT_PACKAGE_ENTRY_SIZE
static const EVAL_TEST_ENTRY DrvpSmtTests[]
static VOID DrvTestComplexBuffer(VOID)
struct _PDO_DEVICE_DATA PDO_DEVICE_DATA
#define NonPagedPool
static VOID DrvTestPackageInputValue(VOID)
#define STM_TEST_FLAG_INVALID_ARG_3_4
static VOID DrvTestUnknownMethod(VOID)
#define MY_DSM_SUB_PACKAGE_ENTRY_SIZE
struct _IRP IRP
static LONG DrvpBlocksAllocated
#define GTM_TEST_FLAG_BUFFER_HAS_COUNT
struct _EVAL_TEST_ENTRY EVAL_TEST_ENTRY
#define GTM_TEST_FLAG_METHOD_SUCCESS
#define GTM_MAX_BUFFER_SIZE
#define GTM_TEST_FLAG_DEC_OUT_BUFFER
#define STM_TEST_FLAG_INVALID_ARG_3_2
#define ok_not_pointer_ex(entry, value, expected)
#define GTM_TEST_FLAG_INC_OUT_BUFFER
#define STM_ID_BLOCK_SIZE
#define STM_TEST_FLAG_INVALID_SIZE_1
static const EVAL_TEST_ENTRY DrvpBifTests[]
static VOID DrvTestReferenceReturnValue(VOID)
static const ULONG DrvpBifIntegerFields[9]
struct _PDO_DEVICE_DATA * PPDO_DEVICE_DATA
static VOID DrvEvaluateBifObject(_In_ const EVAL_TEST_ENTRY *TestEntry, _In_ PACPI_EVAL_OUTPUT_BUFFER OutputBuffer)
static void TestEntry(const ENTRY *pEntry)
unsigned int UINT32
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
Type
Definition: Type.h:7
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define AE_BAD_PARAMETER
Definition: acexcep.h:151
#define AE_BUFFER_OVERFLOW
Definition: acexcep.h:119
#define AE_NOT_FOUND
Definition: acexcep.h:113
#define AE_AML_UNINITIALIZED_ARG
Definition: acexcep.h:185
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define AE_OK
Definition: acexcep.h:97
struct _ACPI_EVAL_INPUT_BUFFER_COMPLEX * PACPI_EVAL_INPUT_BUFFER_COMPLEX
struct _ACPI_EVAL_INPUT_BUFFER ACPI_EVAL_INPUT_BUFFER
#define ACPI_EVAL_INPUT_BUFFER_COMPLEX_SIGNATURE
Definition: acpiioct.h:10
ACPI_METHOD_ARGUMENT UNALIGNED * PACPI_METHOD_ARGUMENT
Definition: acpiioct.h:71
struct _ACPI_EVAL_OUTPUT_BUFFER ACPI_EVAL_OUTPUT_BUFFER
#define ACPI_METHOD_NEXT_ARGUMENT(Argument)
Definition: acpiioct.h:150
#define ACPI_METHOD_ARGUMENT_STRING
Definition: acpiioct.h:22
#define ACPI_METHOD_ARGUMENT_INTEGER
Definition: acpiioct.h:21
#define ACPI_METHOD_ARGUMENT_LENGTH(DataLength)
Definition: acpiioct.h:144
#define ACPI_EVAL_INPUT_BUFFER_SIGNATURE
Definition: acpiioct.h:7
#define ACPI_METHOD_SET_ARGUMENT_INTEGER(MethodArgument, IntData)
Definition: acpiioct.h:155
#define ACPI_METHOD_SET_ARGUMENT_STRING(Argument, StrData)
Definition: acpiioct.h:160
#define ACPI_METHOD_ARGUMENT_BUFFER
Definition: acpiioct.h:23
#define ACPI_EVAL_OUTPUT_BUFFER_SIGNATURE
Definition: acpiioct.h:11
#define ACPI_METHOD_SET_ARGUMENT_BUFFER(Argument, BuffData, BuffLength)
Definition: acpiioct.h:165
#define ACPI_METHOD_ARGUMENT_PACKAGE
Definition: acpiioct.h:24
ACPI_EVAL_OUTPUT_BUFFER UNALIGNED * PACPI_EVAL_OUTPUT_BUFFER
Definition: acpiioct.h:90
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST * ParameterObjects
Definition: acpixf.h:705
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 NameType
Definition: acpixf.h:658
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING Pathname
Definition: acpixf.h:704
#define ACPI_TYPE_LOCAL_REFERENCE
Definition: actypes.h:719
#define ACPI_SINGLE_NAME
Definition: actypes.h:1063
#define ACPI_TYPE_STRING
Definition: actypes.h:689
#define ACPI_ALLOCATE_BUFFER
Definition: actypes.h:1046
#define ACPI_TYPE_BUFFER
Definition: actypes.h:690
char * ACPI_STRING
Definition: actypes.h:462
#define ACPI_TYPE_INTEGER
Definition: actypes.h:688
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_TYPE_DEVICE
Definition: actypes.h:693
void * ACPI_HANDLE
Definition: actypes.h:463
#define ACPI_TYPE_PACKAGE
Definition: actypes.h:691
#define ok_eq_hex(value, expected)
Definition: apitest.h:77
#define ok_eq_uint(value, expected)
Definition: apitest.h:61
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
LONG NTSTATUS
Definition: precomp.h:26
#define U(x)
Definition: wordpad.c:45
@ BatteryInformation
Definition: batclass.h:97
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_t * DataLength
Definition: cdrom.h:1444
Definition: bufpool.h:45
_In_ PVOID Argument2
Definition: classpnp.h:721
_In_ PIRP Irp
Definition: csq.h:116
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
static const WCHAR Signature[]
Definition: parser.c:141
NTSTATUS NTAPI Bus_PDO_EvalMethod(_In_ PPDO_DEVICE_DATA DeviceData, _Inout_ PIRP Irp)
Definition: eval.c:796
#define __FUNCTION__
Definition: types.h:116
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
ULONG Handle
Definition: gdb_input.c:15
Status
Definition: gdiplustypes.h:25
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
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
#define for
Definition: utility.h:88
unsigned __int64 ULONG64
Definition: imports.h:198
#define _Out_opt_
Definition: ms_sal.h:346
#define _In_
Definition: ms_sal.h:308
int Count
Definition: noreturn.cpp:7
#define RTL_SIZEOF_THROUGH_FIELD(type, field)
Definition: ntbasedef.h:672
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define STATUS_ACPI_INVALID_ARGTYPE
Definition: ntstatus.h:1299
#define STATUS_ACPI_INCORRECT_ARGUMENT_COUNT
Definition: ntstatus.h:1302
#define STATUS_INVALID_PARAMETER_1
Definition: ntstatus.h:475
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
Definition: guiddef.h:68
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
ACPI_OBJECT BatteryInformation[13]
ULONG Line
ULONG Flags
NTSTATUS Status
ULONG Value
IDE_ACPI_TIMING_MODE_BLOCK TimingMode
struct _IDE_ACPI_TIMING_MODE_BLOCK::@1572 Drive[2]
union _IO_STACK_LOCATION::@1569 Parameters
struct _IO_STACK_LOCATION::@1569::@1570 DeviceIoControl
PVOID SystemBuffer
PVOID OutputBuffer
union _IRP::@1571 AssociatedIrp
IO_STATUS_BLOCK IoStatus
IO_STACK_LOCATION MyStack
ACPI_OBJECT Package1[4]
ACPI_OBJECT PackageContainer[2]
ACPI_OBJECT Package2[4]
void * Pointer
Definition: actypes.h:1054
ACPI_SIZE Length
Definition: actypes.h:1053
uint32_t * PULONG_PTR
Definition: typedefs.h:65
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
ULONG_PTR SIZE_T
Definition: typedefs.h:80
const char * PCSTR
Definition: typedefs.h:52
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
struct acpi_object::@622 Package
struct acpi_object::@621 Buffer
struct acpi_object::@619 Integer
ACPI_OBJECT_TYPE Type
Definition: actypes.h:970
struct acpi_object::@623 Reference
struct acpi_object::@620 String
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4065
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3815
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433
_In_ WDFREQUEST _In_ size_t OutputBufferLength
Definition: wdfio.h:320
_In_ WDFREQUEST _In_ size_t _In_ size_t InputBufferLength
Definition: wdfio.h:322
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
Definition: wdfiotarget.h:863
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
Definition: wdfiotarget.h:953
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG _In_ _Out_ WDFMEMORY * Memory
Definition: wdfmemory.h:169
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:1036
unsigned char UCHAR
Definition: xmlstorage.h:181
char CHAR
Definition: xmlstorage.h:175