ReactOS 0.4.15-dev-8348-gc1b9bb5
Bus_PDO_QueryResourceRequirements.c File Reference
#include <apitest.h>
#include <ndk/rtlfuncs.h>
#include <acpi.h>
#include "../../../../drivers/bus/acpi/buspdo.c"
Include dependency graph for Bus_PDO_QueryResourceRequirements.c:

Go to the source code of this file.

Classes

struct  _IRP
 
struct  _PDO_DEVICE_DATA
 

Macros

#define WIN32_NO_STATUS
 
#define UNIT_TEST
 
#define PAGED_CODE()
 
#define DPRINT1(...)   do { if (0) DbgPrint(__VA_ARGS__); } while (0)
 
#define PagedPool   1
 
#define MAKE_IRQ(Resource, _DescriptorLength, _Triggering, _Polarity, _Shareable, _WakeCapable)
 
#define expect_irq(Desc, ExpectedOption, ExpectedShare, ExpectedMin, ExpectedMax)
 
#define expect_port(Desc, ExpectedOption, ExpectedShare, ExpectedLength, ExpectedAlign, ExpectedMin, ExpectedMax)
 

Typedefs

typedef struct _IRP IRP
 
typedef struct _IRPPIRP
 
typedef struct _PDO_DEVICE_DATA PDO_DEVICE_DATA
 
typedef struct _PDO_DEVICE_DATAPPDO_DEVICE_DATA
 

Functions

static PVOID ExAllocatePoolWithTag (ULONG PoolType, SIZE_T NumberOfBytes, ULONG Tag)
 
static VOID ExFreePoolWithTag (PVOID MemPtr, ULONG Tag)
 
static SIZE_T GetPoolAllocSize (PVOID MemPtr)
 
ACPI_STATUS AcpiGetCurrentResources (ACPI_HANDLE Device, ACPI_BUFFER *RetBuffer)
 
ACPI_STATUS AcpiGetPossibleResources (ACPI_HANDLE Device, ACPI_BUFFER *RetBuffer)
 
 START_TEST (Bus_PDO_QueryResourceRequirements)
 

Variables

static BOOLEAN AcpiCallExpected
 
static ACPI_HANDLE CorrectHandle = &CorrectHandle
 
static ACPI_BUFFER CurrentBuffer
 
static ACPI_BUFFER PossibleBuffer
 

Macro Definition Documentation

◆ DPRINT1

#define DPRINT1 (   ...)    do { if (0) DbgPrint(__VA_ARGS__); } while (0)

Definition at line 17 of file Bus_PDO_QueryResourceRequirements.c.

◆ expect_irq

#define expect_irq (   Desc,
  ExpectedOption,
  ExpectedShare,
  ExpectedMin,
  ExpectedMax 
)
Value:
do { \
ok((Desc)->Option == ExpectedOption, "Desc->Option = %u\n", (Desc)->Option); \
ok((Desc)->Type == CmResourceTypeInterrupt, "Desc->Type = %u\n", (Desc)->Type); \
ok((Desc)->ShareDisposition == ExpectedShare, "Desc->ShareDisposition = %u\n", (Desc)->ShareDisposition); \
ok((Desc)->u.Interrupt.MinimumVector == ExpectedMin, "Desc->u.Interrupt.MinimumVector = %lu\n", (Desc)->u.Interrupt.MinimumVector); \
ok((Desc)->u.Interrupt.MaximumVector == ExpectedMax, "Desc->u.Interrupt.MaximumVector = %lu\n", (Desc)->u.Interrupt.MaximumVector); \
} while (0)
Type
Definition: Type.h:7
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 * u
Definition: glfuncs.h:240
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124

Definition at line 118 of file Bus_PDO_QueryResourceRequirements.c.

◆ expect_port

#define expect_port (   Desc,
  ExpectedOption,
  ExpectedShare,
  ExpectedLength,
  ExpectedAlign,
  ExpectedMin,
  ExpectedMax 
)
Value:
do { \
ok((Desc)->Option == ExpectedOption, "Desc->Option = %u\n", (Desc)->Option); \
ok((Desc)->Type == CmResourceTypePort, "Desc->Type = %u\n", (Desc)->Type); \
ok((Desc)->ShareDisposition == ExpectedShare, "Desc->ShareDisposition = %u\n", (Desc)->ShareDisposition); \
ok((Desc)->u.Port.Length == ExpectedLength, "Desc->u.Port.Length = %lu\n", (Desc)->u.Port.Length); \
ok((Desc)->u.Port.Alignment == ExpectedAlign, "Desc->u.Port.Alignment = %lu\n", (Desc)->u.Port.Alignment); \
ok((Desc)->u.Port.MinimumAddress.QuadPart == ExpectedMin, "Desc->u.Port.MinimumAddress = 0x%I64x\n", (Desc)->u.Port.MinimumAddress.QuadPart); \
ok((Desc)->u.Port.MaximumAddress.QuadPart == ExpectedMax, "Desc->u.Port.MaximumAddress = 0x%I64x\n", (Desc)->u.Port.MaximumAddress.QuadPart); \
} while (0)
#define CmResourceTypePort
Definition: hwresource.cpp:123

Definition at line 127 of file Bus_PDO_QueryResourceRequirements.c.

◆ MAKE_IRQ

#define MAKE_IRQ (   Resource,
  _DescriptorLength,
  _Triggering,
  _Polarity,
  _Shareable,
  _WakeCapable 
)
Value:
do { \
Resource->Data.Irq.DescriptorLength = _DescriptorLength; \
Resource->Data.Irq.Triggering = _Triggering; \
Resource->Data.Irq.Polarity = _Polarity; \
Resource->Data.Irq.Shareable = _Shareable; \
Resource->Data.Irq.WakeCapable = _WakeCapable; \
} while (0)
_Acquires_exclusive_lock_ Resource _Acquires_shared_lock_ Resource _Inout_ PERESOURCE Resource
Definition: cdprocs.h:843

Definition at line 108 of file Bus_PDO_QueryResourceRequirements.c.

◆ PAGED_CODE

#define PAGED_CODE ( )

Definition at line 16 of file Bus_PDO_QueryResourceRequirements.c.

◆ PagedPool

#define PagedPool   1

Definition at line 24 of file Bus_PDO_QueryResourceRequirements.c.

◆ UNIT_TEST

#define UNIT_TEST

Definition at line 12 of file Bus_PDO_QueryResourceRequirements.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 10 of file Bus_PDO_QueryResourceRequirements.c.

Typedef Documentation

◆ IRP

typedef struct _IRP IRP

◆ PDO_DEVICE_DATA

◆ PIRP

typedef struct _IRP * PIRP

◆ PPDO_DEVICE_DATA

Function Documentation

◆ AcpiGetCurrentResources()

ACPI_STATUS AcpiGetCurrentResources ( ACPI_HANDLE  Device,
ACPI_BUFFER RetBuffer 
)

Definition at line 72 of file Bus_PDO_QueryResourceRequirements.c.

75{
76 ok(AcpiCallExpected, "Unexpected call to AcpiGetCurrentResources\n");
77 ok(Device == CorrectHandle, "Device = %p, expected %p\n", Device, CorrectHandle);
78 if (RetBuffer->Length < CurrentBuffer.Length)
79 {
80 RetBuffer->Length = CurrentBuffer.Length;
81 return AE_BUFFER_OVERFLOW;
82 }
83 RetBuffer->Length = CurrentBuffer.Length;
85 return AE_OK;
86}
static ACPI_BUFFER CurrentBuffer
static BOOLEAN AcpiCallExpected
static ACPI_HANDLE CorrectHandle
#define AE_BUFFER_OVERFLOW
Definition: acexcep.h:119
#define AE_OK
Definition: acexcep.h:97
#define ok(value,...)
Definition: atltest.h:57
void * Pointer
Definition: actypes.h:1054
ACPI_SIZE Length
Definition: actypes.h:1053
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
#define CopyMemory
Definition: winbase.h:1710

◆ AcpiGetPossibleResources()

ACPI_STATUS AcpiGetPossibleResources ( ACPI_HANDLE  Device,
ACPI_BUFFER RetBuffer 
)

Definition at line 89 of file Bus_PDO_QueryResourceRequirements.c.

92{
93 ok(AcpiCallExpected, "Unexpected call to AcpiGetPossibleResources\n");
94 ok(Device == CorrectHandle, "Device = %p, expected %p\n", Device, CorrectHandle);
95 if (RetBuffer->Length < PossibleBuffer.Length)
96 {
97 RetBuffer->Length = PossibleBuffer.Length;
98 return AE_BUFFER_OVERFLOW;
99 }
100 RetBuffer->Length = PossibleBuffer.Length;
102 return AE_OK;
103}
static ACPI_BUFFER PossibleBuffer

◆ ExAllocatePoolWithTag()

static PVOID ExAllocatePoolWithTag ( ULONG  PoolType,
SIZE_T  NumberOfBytes,
ULONG  Tag 
)
static

Definition at line 27 of file Bus_PDO_QueryResourceRequirements.c.

28{
29 PVOID *Mem;
30
31 Mem = HeapAlloc(GetProcessHeap(), 0, NumberOfBytes + 2 * sizeof(PVOID));
32 Mem[0] = (PVOID)NumberOfBytes;
33 Mem[1] = (PVOID)(ULONG_PTR)Tag;
34 return Mem + 2;
35}
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
void * PVOID
Definition: typedefs.h:50
uint32_t ULONG_PTR
Definition: typedefs.h:65
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4065
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:1036

◆ ExFreePoolWithTag()

static VOID ExFreePoolWithTag ( PVOID  MemPtr,
ULONG  Tag 
)
static

Definition at line 39 of file Bus_PDO_QueryResourceRequirements.c.

40{
41 PVOID *Mem = MemPtr;
42
43 Mem -= 2;
44 ok(Mem[1] == (PVOID)(ULONG_PTR)Tag, "Tag is %lx, expected %p\n", Tag, Mem[1]);
45 HeapFree(GetProcessHeap(), 0, Mem);
46}
#define HeapFree(x, y, z)
Definition: compat.h:735

◆ GetPoolAllocSize()

static SIZE_T GetPoolAllocSize ( PVOID  MemPtr)
static

Definition at line 50 of file Bus_PDO_QueryResourceRequirements.c.

51{
52 PVOID *Mem = MemPtr;
53
54 Mem -= 2;
55 return (SIZE_T)Mem[0];
56}
ULONG_PTR SIZE_T
Definition: typedefs.h:80

Referenced by START_TEST().

◆ START_TEST()

Definition at line 138 of file Bus_PDO_QueryResourceRequirements.c.

139{
142 IRP Irp;
143 ACPI_RESOURCE ResourcesBuffer[20];
146 PIO_RESOURCE_LIST ReqList2;
147
148 /* Invalid AcpiHandle */
150 Irp.IoStatus.Status = STATUS_WAIT_0 + 17;
151 DeviceData.AcpiHandle = NULL;
153 ok(Status == STATUS_WAIT_0 + 17, "Status = 0x%lx\n", Status);
154
155 /* PCI Bus device */
157 Irp.IoStatus.Status = STATUS_WAIT_0 + 17;
158 DeviceData.AcpiHandle = CorrectHandle;
159 DeviceData.HardwareIDs = L"PNP0A03\0";
161 ok(Status == STATUS_WAIT_0 + 17, "Status = 0x%lx\n", Status);
162
163 /* PCI Bus device #2 */
165 Irp.IoStatus.Status = STATUS_WAIT_0 + 17;
166 DeviceData.AcpiHandle = CorrectHandle;
167 DeviceData.HardwareIDs = L"PNP0A08\0";
169 ok(Status == STATUS_WAIT_0 + 17, "Status = 0x%lx\n", Status);
170
171 /* Empty buffer */
173 Irp.IoStatus.Status = STATUS_WAIT_0 + 17;
174 DeviceData.AcpiHandle = CorrectHandle;
175 DeviceData.HardwareIDs = L"PNP0501\0";
177 ok(Status == STATUS_WAIT_0 + 17, "Status = 0x%lx\n", Status);
178
179 /* Simple single-resource list */
181 Irp.IoStatus.Status = STATUS_WAIT_0 + 17;
182 Irp.IoStatus.Information = 0;
183 DeviceData.AcpiHandle = CorrectHandle;
184 DeviceData.HardwareIDs = L"PNP0501\0";
185 Resource = ResourcesBuffer;
187 Resource->Length = sizeof(*Resource);
189 Resource->Data.Irq.InterruptCount = 1;
190 Resource->Data.Irq.Interrupts[0] = 7;
193 Resource->Length = 0;
194 Resource++;
195 PossibleBuffer.Pointer = ResourcesBuffer;
196 PossibleBuffer.Length = (ULONG_PTR)Resource - (ULONG_PTR)ResourcesBuffer;
198 ok(Status == STATUS_SUCCESS, "Status = 0x%lx\n", Status);
199 ok(Irp.IoStatus.Status == STATUS_WAIT_0 + 17, "IoStatus.Status = 0x%lx\n", Irp.IoStatus.Status);
200 ReqList = (PVOID)Irp.IoStatus.Information;
201 ok(ReqList != NULL, "ReqList is NULL\n");
202 if (ReqList == NULL)
203 {
204 skip("No ReqList\n");
205 return;
206 }
207 ok(ReqList->InterfaceType == Internal, "InterfaceType = %u\n", ReqList->InterfaceType);
208 ok(ReqList->BusNumber == 0, "BusNumber = %lu\n", ReqList->BusNumber);
209 ok(ReqList->SlotNumber == 0, "SlotNumber = %lu\n", ReqList->SlotNumber);
210 ok(ReqList->AlternativeLists == 1, "AlternativeLists = %lu\n", ReqList->AlternativeLists);
211 ok(ReqList->List[0].Version == 1, "List[0].Version = %u\n", ReqList->List[0].Version);
212 ok(ReqList->List[0].Revision == 1, "List[0].Revision = %u\n", ReqList->List[0].Revision);
213 ok(ReqList->List[0].Count == 1, "List[0].Count = %lu\n", ReqList->List[0].Count);
215 ok_int(ReqList->ListSize, GetPoolAllocSize(ReqList));
216 ok_int(ReqList->ListSize, (ULONG_PTR)&ReqList->List[0].Descriptors[1] - (ULONG_PTR)ReqList);
217 ExFreePoolWithTag(ReqList, 'RpcA');
218
219 /* Two IRQs */
221 Irp.IoStatus.Status = STATUS_WAIT_0 + 17;
222 Irp.IoStatus.Information = 0;
223 DeviceData.AcpiHandle = CorrectHandle;
224 DeviceData.HardwareIDs = L"PNP0501\0";
225 Resource = ResourcesBuffer;
229 Resource->Data.Irq.InterruptCount = 2;
230 Resource->Data.Irq.Interrupts[0] = 3;
231 Resource->Data.Irq.Interrupts[1] = 7;
234 Resource->Length = 0;
235 Resource++;
236 PossibleBuffer.Pointer = ResourcesBuffer;
237 PossibleBuffer.Length = (ULONG_PTR)Resource - (ULONG_PTR)ResourcesBuffer;
239 ok(Status == STATUS_SUCCESS, "Status = 0x%lx\n", Status);
240 ok(Irp.IoStatus.Status == STATUS_WAIT_0 + 17, "IoStatus.Status = 0x%lx\n", Irp.IoStatus.Status);
241 ReqList = (PVOID)Irp.IoStatus.Information;
242 ok(ReqList != NULL, "ReqList is NULL\n");
243 if (ReqList == NULL)
244 {
245 skip("No ReqList\n");
246 return;
247 }
248 ok(ReqList->InterfaceType == Internal, "InterfaceType = %u\n", ReqList->InterfaceType);
249 ok(ReqList->BusNumber == 0, "BusNumber = %lu\n", ReqList->BusNumber);
250 ok(ReqList->SlotNumber == 0, "SlotNumber = %lu\n", ReqList->SlotNumber);
251 ok(ReqList->AlternativeLists == 1, "AlternativeLists = %lu\n", ReqList->AlternativeLists);
252 ok(ReqList->List[0].Version == 1, "List[0].Version = %u\n", ReqList->List[0].Version);
253 ok(ReqList->List[0].Revision == 1, "List[0].Revision = %u\n", ReqList->List[0].Revision);
254 ok(ReqList->List[0].Count == 2, "List[0].Count = %lu\n", ReqList->List[0].Count);
257 ok_int(ReqList->ListSize, GetPoolAllocSize(ReqList));
258 ok_int(ReqList->ListSize, (ULONG_PTR)&ReqList->List[0].Descriptors[2] - (ULONG_PTR)ReqList);
259 ExFreePoolWithTag(ReqList, 'RpcA');
260
261 /* Port */
263 Irp.IoStatus.Status = STATUS_WAIT_0 + 17;
264 Irp.IoStatus.Information = 0;
265 DeviceData.AcpiHandle = CorrectHandle;
266 DeviceData.HardwareIDs = L"PNP0501\0";
267 Resource = ResourcesBuffer;
269 Resource->Length = sizeof(*Resource);
270 Resource->Data.Io.IoDecode = ACPI_DECODE_16;
271 Resource->Data.Io.Alignment = 8;
272 Resource->Data.Io.AddressLength = 8;
273 Resource->Data.Io.Minimum = 0x3F8;
274 Resource->Data.Io.Maximum = 0x3F8;
277 Resource->Length = 0;
278 Resource++;
279 PossibleBuffer.Pointer = ResourcesBuffer;
280 PossibleBuffer.Length = (ULONG_PTR)Resource - (ULONG_PTR)ResourcesBuffer;
282 ok(Status == STATUS_SUCCESS, "Status = 0x%lx\n", Status);
283 ok(Irp.IoStatus.Status == STATUS_WAIT_0 + 17, "IoStatus.Status = 0x%lx\n", Irp.IoStatus.Status);
284 ReqList = (PVOID)Irp.IoStatus.Information;
285 ok(ReqList != NULL, "ReqList is NULL\n");
286 if (ReqList == NULL)
287 {
288 skip("No ReqList\n");
289 return;
290 }
291 ok(ReqList->InterfaceType == Internal, "InterfaceType = %u\n", ReqList->InterfaceType);
292 ok(ReqList->BusNumber == 0, "BusNumber = %lu\n", ReqList->BusNumber);
293 ok(ReqList->SlotNumber == 0, "SlotNumber = %lu\n", ReqList->SlotNumber);
294 ok(ReqList->AlternativeLists == 1, "AlternativeLists = %lu\n", ReqList->AlternativeLists);
295 ok(ReqList->List[0].Version == 1, "List[0].Version = %u\n", ReqList->List[0].Version);
296 ok(ReqList->List[0].Revision == 1, "List[0].Revision = %u\n", ReqList->List[0].Revision);
297 ok(ReqList->List[0].Count == 1, "List[0].Count = %lu\n", ReqList->List[0].Count);
299 ok_int(ReqList->ListSize, GetPoolAllocSize(ReqList));
300 ok_int(ReqList->ListSize, (ULONG_PTR)&ReqList->List[0].Descriptors[1] - (ULONG_PTR)ReqList);
301 ExFreePoolWithTag(ReqList, 'RpcA');
302
303 /* Port + two IRQs */
305 Irp.IoStatus.Status = STATUS_WAIT_0 + 17;
306 Irp.IoStatus.Information = 0;
307 DeviceData.AcpiHandle = CorrectHandle;
308 DeviceData.HardwareIDs = L"PNP0501\0";
309 Resource = ResourcesBuffer;
311 Resource->Length = sizeof(*Resource);
312 Resource->Data.Io.IoDecode = ACPI_DECODE_16;
313 Resource->Data.Io.Alignment = 8;
314 Resource->Data.Io.AddressLength = 8;
315 Resource->Data.Io.Minimum = 0x3F8;
316 Resource->Data.Io.Maximum = 0x3F8;
321 Resource->Data.Irq.InterruptCount = 2;
322 Resource->Data.Irq.Interrupts[0] = 3;
323 Resource->Data.Irq.Interrupts[1] = 7;
326 Resource->Length = 0;
327 Resource++;
328 PossibleBuffer.Pointer = ResourcesBuffer;
329 PossibleBuffer.Length = (ULONG_PTR)Resource - (ULONG_PTR)ResourcesBuffer;
331 ok(Status == STATUS_SUCCESS, "Status = 0x%lx\n", Status);
332 ok(Irp.IoStatus.Status == STATUS_WAIT_0 + 17, "IoStatus.Status = 0x%lx\n", Irp.IoStatus.Status);
333 ReqList = (PVOID)Irp.IoStatus.Information;
334 ok(ReqList != NULL, "ReqList is NULL\n");
335 if (ReqList == NULL)
336 {
337 skip("No ReqList\n");
338 return;
339 }
340 ok(ReqList->InterfaceType == Internal, "InterfaceType = %u\n", ReqList->InterfaceType);
341 ok(ReqList->BusNumber == 0, "BusNumber = %lu\n", ReqList->BusNumber);
342 ok(ReqList->SlotNumber == 0, "SlotNumber = %lu\n", ReqList->SlotNumber);
343 ok(ReqList->AlternativeLists == 1, "AlternativeLists = %lu\n", ReqList->AlternativeLists);
344 ok(ReqList->List[0].Version == 1, "List[0].Version = %u\n", ReqList->List[0].Version);
345 ok(ReqList->List[0].Revision == 1, "List[0].Revision = %u\n", ReqList->List[0].Revision);
346 ok(ReqList->List[0].Count == 3, "List[0].Count = %lu\n", ReqList->List[0].Count);
350 ok_int(ReqList->ListSize, GetPoolAllocSize(ReqList));
351 ok_int(ReqList->ListSize, (ULONG_PTR)&ReqList->List[0].Descriptors[3] - (ULONG_PTR)ReqList);
352 ExFreePoolWithTag(ReqList, 'RpcA');
353
354 /* Multiple alternatives for ports + IRQs (VMware COM port, simplified) */
356 Irp.IoStatus.Status = STATUS_WAIT_0 + 17;
357 Irp.IoStatus.Information = 0;
358 DeviceData.AcpiHandle = CorrectHandle;
359 DeviceData.HardwareIDs = L"PNP0501\0";
360 Resource = ResourcesBuffer;
362 Resource->Length = sizeof(*Resource);
363
366 Resource->Length = sizeof(*Resource);
367 Resource->Data.Io.IoDecode = ACPI_DECODE_16;
368 Resource->Data.Io.Alignment = 8;
369 Resource->Data.Io.AddressLength = 8;
370 Resource->Data.Io.Minimum = 0x3E8;
371 Resource->Data.Io.Maximum = 0x3E8;
372
377 Resource->Data.Irq.InterruptCount = 5;
378 Resource->Data.Irq.Interrupts[0] = 3;
379 Resource->Data.Irq.Interrupts[1] = 4;
380 Resource->Data.Irq.Interrupts[2] = 5;
381 Resource->Data.Irq.Interrupts[3] = 6;
382 Resource->Data.Irq.Interrupts[4] = 7;
383
386 Resource->Length = sizeof(*Resource);
387
390 Resource->Length = sizeof(*Resource);
391 Resource->Data.Io.IoDecode = ACPI_DECODE_16;
392 Resource->Data.Io.Alignment = 8;
393 Resource->Data.Io.AddressLength = 8;
394 Resource->Data.Io.Minimum = 0x2E8;
395 Resource->Data.Io.Maximum = 0x2E8;
396
401 Resource->Data.Irq.InterruptCount = 5;
402 Resource->Data.Irq.Interrupts[0] = 3;
403 Resource->Data.Irq.Interrupts[1] = 4;
404 Resource->Data.Irq.Interrupts[2] = 5;
405 Resource->Data.Irq.Interrupts[3] = 6;
406 Resource->Data.Irq.Interrupts[4] = 7;
407
410 Resource->Length = sizeof(*Resource);
411
414 Resource->Length = 0;
415 Resource++;
416 PossibleBuffer.Pointer = ResourcesBuffer;
417 PossibleBuffer.Length = (ULONG_PTR)Resource - (ULONG_PTR)ResourcesBuffer;
419 ok(Status == STATUS_SUCCESS, "Status = 0x%lx\n", Status);
420 ok(Irp.IoStatus.Status == STATUS_WAIT_0 + 17, "IoStatus.Status = 0x%lx\n", Irp.IoStatus.Status);
421 ReqList = (PVOID)Irp.IoStatus.Information;
422 ok(ReqList != NULL, "ReqList is NULL\n");
423 if (ReqList == NULL)
424 {
425 skip("No ReqList\n");
426 return;
427 }
428 ok(ReqList->InterfaceType == Internal, "InterfaceType = %u\n", ReqList->InterfaceType);
429 ok(ReqList->BusNumber == 0, "BusNumber = %lu\n", ReqList->BusNumber);
430 ok(ReqList->SlotNumber == 0, "SlotNumber = %lu\n", ReqList->SlotNumber);
431 todo_if(1)
432 ok(ReqList->AlternativeLists == 2, "AlternativeLists = %lu\n", ReqList->AlternativeLists);
433 ok(ReqList->List[0].Version == 1, "List[0].Version = %u\n", ReqList->List[0].Version);
434 ok(ReqList->List[0].Revision == 1, "List[0].Revision = %u\n", ReqList->List[0].Revision);
435 ok(ReqList->List[0].Count == 6, "List[0].Count = %lu\n", ReqList->List[0].Count);
436 expect_port(&ReqList->List[0].Descriptors[0], IO_RESOURCE_PREFERRED, CmResourceShareDriverExclusive, 8, 8, 0x3E8, 0x3EF);
437 expect_irq(&ReqList->List[0].Descriptors[1], IO_RESOURCE_PREFERRED, CmResourceShareDeviceExclusive, 3, 3);
438 expect_irq(&ReqList->List[0].Descriptors[2], IO_RESOURCE_ALTERNATIVE, CmResourceShareDeviceExclusive, 4, 4);
439 expect_irq(&ReqList->List[0].Descriptors[3], IO_RESOURCE_ALTERNATIVE, CmResourceShareDeviceExclusive, 5, 5);
440 expect_irq(&ReqList->List[0].Descriptors[4], IO_RESOURCE_ALTERNATIVE, CmResourceShareDeviceExclusive, 6, 6);
441 expect_irq(&ReqList->List[0].Descriptors[5], IO_RESOURCE_ALTERNATIVE, CmResourceShareDeviceExclusive, 7, 7);
442 ReqList2 = (PVOID)&ReqList->List[0].Descriptors[6];
443 if (ReqList->ListSize > (ULONG_PTR)ReqList2 - (ULONG_PTR)ReqList)
444 {
445 ok(ReqList2->Version == 1, "List[1].Version = %u\n", ReqList->List[0].Version);
446 ok(ReqList2->Revision == 1, "List[1].Revision = %u\n", ReqList->List[0].Revision);
447 ok(ReqList2->Count == 6, "List[1].Count = %lu\n", ReqList->List[0].Count);
454 }
455 ok_int(ReqList->ListSize, GetPoolAllocSize(ReqList));
456 todo_if(1)
457 ok_int(ReqList->ListSize, (ULONG_PTR)&ReqList2->Descriptors[6] - (ULONG_PTR)ReqList);
458 ExFreePoolWithTag(ReqList, 'RpcA');
459}
static SIZE_T GetPoolAllocSize(PVOID MemPtr)
#define expect_irq(Desc, ExpectedOption, ExpectedShare, ExpectedMin, ExpectedMax)
#define expect_port(Desc, ExpectedOption, ExpectedShare, ExpectedLength, ExpectedAlign, ExpectedMin, ExpectedMax)
#define MAKE_IRQ(Resource, _DescriptorLength, _Triggering, _Polarity, _Shareable, _WakeCapable)
#define ACPI_NEXT_RESOURCE(Res)
Definition: acrestyp.h:812
#define ACPI_DECODE_16
Definition: acrestyp.h:85
#define ACPI_ACTIVE_HIGH
Definition: acrestyp.h:98
#define ACPI_RESOURCE_TYPE_IRQ
Definition: acrestyp.h:723
#define ACPI_RESOURCE_TYPE_END_DEPENDENT
Definition: acrestyp.h:726
#define ACPI_RESOURCE_TYPE_END_TAG
Definition: acrestyp.h:730
#define ACPI_NOT_WAKE_CAPABLE
Definition: acrestyp.h:109
#define ACPI_RESOURCE_TYPE_START_DEPENDENT
Definition: acrestyp.h:725
#define ACPI_LEVEL_SENSITIVE
Definition: acrestyp.h:93
#define ACPI_EXCLUSIVE
Definition: acrestyp.h:104
#define ACPI_RESOURCE_TYPE_IO
Definition: acrestyp.h:727
#define skip(...)
Definition: atltest.h:64
#define ok_int(expression, result)
Definition: atltest.h:134
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS Bus_PDO_QueryResourceRequirements(PPDO_DEVICE_DATA DeviceData, PIRP Irp)
Definition: buspdo.c:1309
_In_ PIRP Irp
Definition: csq.h:116
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ULONG_PTR
Definition: config.h:101
Status
Definition: gdiplustypes.h:25
GLdouble n
Definition: glext.h:7729
@ Internal
Definition: hwresource.cpp:137
if(dx< 0)
Definition: linetemp.h:194
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
_In_ ULONG Revision
Definition: rtlfuncs.h:1142
int Count
Definition: noreturn.cpp:7
#define STATUS_WAIT_0
Definition: ntstatus.h:237
#define L(x)
Definition: ntvdm.h:50
#define todo_if(is_todo)
Definition: test.h:166
#define STATUS_SUCCESS
Definition: shellext.h:65
IO_RESOURCE_DESCRIPTOR Descriptors[1]
Definition: iotypes.h:2737
INTERFACE_TYPE InterfaceType
Definition: iotypes.h:2742
IO_RESOURCE_LIST List[1]
Definition: iotypes.h:2747
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE _In_ USHORT _In_ USHORT Version
Definition: wdffdo.h:469
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
@ CmResourceShareDeviceExclusive
Definition: cmtypes.h:241
@ CmResourceShareDriverExclusive
Definition: cmtypes.h:242
#define IO_RESOURCE_ALTERNATIVE
#define IO_RESOURCE_PREFERRED

Variable Documentation

◆ AcpiCallExpected

BOOLEAN AcpiCallExpected
static

◆ CorrectHandle

ACPI_HANDLE CorrectHandle = &CorrectHandle
static

◆ CurrentBuffer

◆ PossibleBuffer

ACPI_BUFFER PossibleBuffer
static

Definition at line 69 of file Bus_PDO_QueryResourceRequirements.c.

Referenced by AcpiGetPossibleResources(), and START_TEST().