ReactOS  0.4.15-dev-2996-gf777e6b
fdo.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS PCI bus driver
3  * FILE: fdo.c
4  * PURPOSE: PCI device object dispatch routines
5  * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
6  * UPDATE HISTORY:
7  * 10-09-2001 CSH Created
8  */
9 
10 #include "pci.h"
11 
12 #define NDEBUG
13 #include <debug.h>
14 
15 /*** PRIVATE *****************************************************************/
16 
17 static IO_COMPLETION_ROUTINE ForwardIrpAndWaitCompletion;
18 
19 static NTSTATUS NTAPI
22  IN PIRP Irp,
24 {
26  if (Irp->PendingReturned)
29 }
30 
34  IN PIRP Irp)
35 {
36  KEVENT Event;
38  PDEVICE_OBJECT LowerDevice = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Ldo;
39  ASSERT(LowerDevice);
40 
43 
45 
46  Status = IoCallDriver(LowerDevice, Irp);
47  if (Status == STATUS_PENDING)
48  {
50  if (NT_SUCCESS(Status))
51  Status = Irp->IoStatus.Status;
52  }
53 
54  return Status;
55 }
56 
57 static NTSTATUS
60  PFDO_DEVICE_EXTENSION DeviceExtension,
62  PPCI_COMMON_CONFIG PciConfig)
63 {
64  PLIST_ENTRY CurrentEntry;
65  PPCI_DEVICE CurrentDevice;
66 
67  DPRINT("Called\n");
68 
69  CurrentEntry = DeviceExtension->DeviceListHead.Flink;
70  while (CurrentEntry != &DeviceExtension->DeviceListHead)
71  {
72  CurrentDevice = CONTAINING_RECORD(CurrentEntry, PCI_DEVICE, ListEntry);
73 
74  /* If both vendor ID and device ID match, it is the same device */
75  if ((PciConfig->VendorID == CurrentDevice->PciConfig.VendorID) &&
76  (PciConfig->DeviceID == CurrentDevice->PciConfig.DeviceID) &&
77  (SlotNumber.u.AsULONG == CurrentDevice->SlotNumber.u.AsULONG))
78  {
79  *Device = CurrentDevice;
80  DPRINT("Done\n");
81  return STATUS_SUCCESS;
82  }
83 
84  CurrentEntry = CurrentEntry->Flink;
85  }
86 
87  *Device = NULL;
88  DPRINT("Done\n");
89  return STATUS_UNSUCCESSFUL;
90 }
91 
92 
93 static NTSTATUS
96 {
97  PFDO_DEVICE_EXTENSION DeviceExtension;
98  PCI_COMMON_CONFIG PciConfig;
102  ULONG FunctionNumber;
103  ULONG Size;
105 
106  DPRINT("Called\n");
107 
108  DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
109 
110  DeviceExtension->DeviceListCount = 0;
111 
112  /* Enumerate devices on the PCI bus */
113  SlotNumber.u.AsULONG = 0;
115  {
116  SlotNumber.u.bits.DeviceNumber = DeviceNumber;
117  for (FunctionNumber = 0; FunctionNumber < PCI_MAX_FUNCTION; FunctionNumber++)
118  {
119  SlotNumber.u.bits.FunctionNumber = FunctionNumber;
120 
121  DPRINT("Bus %1lu Device %2lu Func %1lu\n",
122  DeviceExtension->BusNumber,
123  DeviceNumber,
124  FunctionNumber);
125 
126  RtlZeroMemory(&PciConfig,
127  sizeof(PCI_COMMON_CONFIG));
128 
130  DeviceExtension->BusNumber,
131  SlotNumber.u.AsULONG,
132  &PciConfig,
134  DPRINT("Size %lu\n", Size);
136  {
137  if (FunctionNumber == 0)
138  {
139  break;
140  }
141  else
142  {
143  continue;
144  }
145  }
146 
147  DPRINT("Bus %1lu Device %2lu Func %1lu VenID 0x%04hx DevID 0x%04hx\n",
148  DeviceExtension->BusNumber,
149  DeviceNumber,
150  FunctionNumber,
151  PciConfig.VendorID,
152  PciConfig.DeviceID);
153 
154  if (PciConfig.VendorID == 0 && PciConfig.DeviceID == 0)
155  {
156  DPRINT("Filter out devices with null vendor and device ID\n");
157  continue;
158  }
159 
160  Status = FdoLocateChildDevice(&Device, DeviceExtension, SlotNumber, &PciConfig);
161  if (!NT_SUCCESS(Status))
162  {
164  if (!Device)
165  {
166  /* FIXME: Cleanup resources for already discovered devices */
168  }
169 
171  sizeof(PCI_DEVICE));
172 
173  Device->BusNumber = DeviceExtension->BusNumber;
174 
175  RtlCopyMemory(&Device->SlotNumber,
176  &SlotNumber,
177  sizeof(PCI_SLOT_NUMBER));
178 
179  RtlCopyMemory(&Device->PciConfig,
180  &PciConfig,
181  sizeof(PCI_COMMON_CONFIG));
182 
184  &DeviceExtension->DeviceListHead,
185  &Device->ListEntry,
186  &DeviceExtension->DeviceListLock);
187  }
188 
189  DeviceExtension->DeviceListCount++;
190 
191  /* Skip to next device if the current one is not a multifunction device */
192  if ((FunctionNumber == 0) &&
193  ((PciConfig.HeaderType & 0x80) == 0))
194  {
195  break;
196  }
197  }
198  }
199 
200  DPRINT("Done\n");
201 
202  return STATUS_SUCCESS;
203 }
204 
205 
206 static NTSTATUS
209  IN PIRP Irp,
211 {
212  PPDO_DEVICE_EXTENSION PdoDeviceExtension = NULL;
213  PFDO_DEVICE_EXTENSION DeviceExtension;
214  PDEVICE_RELATIONS Relations;
215  PLIST_ENTRY CurrentEntry;
218  BOOLEAN ErrorOccurred;
219  NTSTATUS ErrorStatus;
220  ULONG Size;
221  ULONG i;
222 
224 
225  DPRINT("Called\n");
226 
227  ErrorStatus = STATUS_INSUFFICIENT_RESOURCES;
228 
230 
231  ErrorOccurred = FALSE;
232 
234 
235  DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
236 
237  if (Irp->IoStatus.Information)
238  {
239  /* FIXME: Another bus driver has already created a DEVICE_RELATIONS
240  structure so we must merge this structure with our own */
241  DPRINT1("FIXME: leaking old bus relations\n");
242  }
243 
244  Size = sizeof(DEVICE_RELATIONS) +
245  sizeof(Relations->Objects) * (DeviceExtension->DeviceListCount - 1);
247  if (!Relations)
249 
250  Relations->Count = DeviceExtension->DeviceListCount;
251 
252  i = 0;
253  CurrentEntry = DeviceExtension->DeviceListHead.Flink;
254  while (CurrentEntry != &DeviceExtension->DeviceListHead)
255  {
256  Device = CONTAINING_RECORD(CurrentEntry, PCI_DEVICE, ListEntry);
257 
258  PdoDeviceExtension = NULL;
259 
260  if (!Device->Pdo)
261  {
262  /* Create a physical device object for the
263  device as it does not already have one */
264  Status = IoCreateDevice(DeviceObject->DriverObject,
265  sizeof(PDO_DEVICE_EXTENSION),
266  NULL,
269  FALSE,
270  &Device->Pdo);
271  if (!NT_SUCCESS(Status))
272  {
273  DPRINT("IoCreateDevice() failed with status 0x%X\n", Status);
274  ErrorStatus = Status;
275  ErrorOccurred = TRUE;
276  break;
277  }
278 
279  Device->Pdo->Flags &= ~DO_DEVICE_INITIALIZING;
280 
281  //Device->Pdo->Flags |= DO_POWER_PAGABLE;
282 
283  PdoDeviceExtension = (PPDO_DEVICE_EXTENSION)Device->Pdo->DeviceExtension;
284 
285  RtlZeroMemory(PdoDeviceExtension, sizeof(PDO_DEVICE_EXTENSION));
286 
287  PdoDeviceExtension->Common.IsFDO = FALSE;
288 
289  PdoDeviceExtension->Common.DeviceObject = Device->Pdo;
290 
291  PdoDeviceExtension->Common.DevicePowerState = PowerDeviceD0;
292 
293  PdoDeviceExtension->Fdo = DeviceObject;
294 
295  PdoDeviceExtension->PciDevice = Device;
296 
297  /* Add Device ID string */
298  Status = PciCreateDeviceIDString(&PdoDeviceExtension->DeviceID, Device);
299  if (!NT_SUCCESS(Status))
300  {
301  ErrorStatus = Status;
302  ErrorOccurred = TRUE;
303  break;
304  }
305 
306  DPRINT("DeviceID: %S\n", PdoDeviceExtension->DeviceID.Buffer);
307 
308  /* Add Instance ID string */
309  Status = PciCreateInstanceIDString(&PdoDeviceExtension->InstanceID, Device);
310  if (!NT_SUCCESS(Status))
311  {
312  ErrorStatus = Status;
313  ErrorOccurred = TRUE;
314  break;
315  }
316 
317  /* Add Hardware IDs string */
318  Status = PciCreateHardwareIDsString(&PdoDeviceExtension->HardwareIDs, Device);
319  if (!NT_SUCCESS(Status))
320  {
321  ErrorStatus = Status;
322  ErrorOccurred = TRUE;
323  break;
324  }
325 
326  /* Add Compatible IDs string */
327  Status = PciCreateCompatibleIDsString(&PdoDeviceExtension->CompatibleIDs, Device);
328  if (!NT_SUCCESS(Status))
329  {
330  ErrorStatus = Status;
331  ErrorOccurred = TRUE;
332  break;
333  }
334 
335  /* Add device description string */
337  if (!NT_SUCCESS(Status))
338  {
339  ErrorStatus = Status;
340  ErrorOccurred = TRUE;
341  break;
342  }
343 
344  /* Add device location string */
346  if (!NT_SUCCESS(Status))
347  {
348  ErrorStatus = Status;
349  ErrorOccurred = TRUE;
350  break;
351  }
352  }
353 
354  /* Reference the physical device object. The PnP manager
355  will dereference it again when it is no longer needed */
357 
358  Relations->Objects[i] = Device->Pdo;
359 
360  i++;
361 
362  CurrentEntry = CurrentEntry->Flink;
363  }
364 
365  if (ErrorOccurred)
366  {
367  /* FIXME: Cleanup all new PDOs created in this call. Please give me SEH!!! ;-) */
368  /* FIXME: Should IoAttachDeviceToDeviceStack() be undone? */
369  if (PdoDeviceExtension)
370  {
371  RtlFreeUnicodeString(&PdoDeviceExtension->DeviceID);
372  RtlFreeUnicodeString(&PdoDeviceExtension->InstanceID);
373  RtlFreeUnicodeString(&PdoDeviceExtension->HardwareIDs);
374  RtlFreeUnicodeString(&PdoDeviceExtension->CompatibleIDs);
375  RtlFreeUnicodeString(&PdoDeviceExtension->DeviceDescription);
376  RtlFreeUnicodeString(&PdoDeviceExtension->DeviceLocation);
377  }
378 
379  ExFreePoolWithTag(Relations, TAG_PCI);
380  return ErrorStatus;
381  }
382 
383  Irp->IoStatus.Information = (ULONG_PTR)Relations;
384 
385  DPRINT("Done\n");
386 
387  return Status;
388 }
389 
390 
391 static NTSTATUS
394  IN PIRP Irp)
395 {
396  PFDO_DEVICE_EXTENSION DeviceExtension;
398  PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptor;
399  ULONG FoundBusNumber = FALSE;
400  ULONG i;
401 
402  DPRINT("Called\n");
403 
404  DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
405 
406  AllocatedResources = IoGetCurrentIrpStackLocation(Irp)->Parameters.StartDevice.AllocatedResources;
407  if (!AllocatedResources)
408  {
409  DPRINT("No allocated resources sent to driver\n");
411  }
412 
413  if (AllocatedResources->Count < 1)
414  {
415  DPRINT("Not enough allocated resources sent to driver\n");
417  }
418 
419  if (AllocatedResources->List[0].PartialResourceList.Version != 1 ||
420  AllocatedResources->List[0].PartialResourceList.Revision != 1)
422 
423  ASSERT(DeviceExtension->State == dsStopped);
424 
425  /* By default, use the bus number in the resource list header */
426  DeviceExtension->BusNumber = AllocatedResources->List[0].BusNumber;
427 
428  for (i = 0; i < AllocatedResources->List[0].PartialResourceList.Count; i++)
429  {
430  ResourceDescriptor = &AllocatedResources->List[0].PartialResourceList.PartialDescriptors[i];
431  switch (ResourceDescriptor->Type)
432  {
434  if (FoundBusNumber || ResourceDescriptor->u.BusNumber.Length < 1)
436 
437  /* Use this one instead */
438  ASSERT(AllocatedResources->List[0].BusNumber == ResourceDescriptor->u.BusNumber.Start);
439  DeviceExtension->BusNumber = ResourceDescriptor->u.BusNumber.Start;
440  DPRINT("Found bus number resource: %lu\n", DeviceExtension->BusNumber);
441  FoundBusNumber = TRUE;
442  break;
443 
444  default:
445  DPRINT("Unknown resource descriptor type 0x%x\n", ResourceDescriptor->Type);
446  }
447  }
448 
449  InitializeListHead(&DeviceExtension->DeviceListHead);
450  KeInitializeSpinLock(&DeviceExtension->DeviceListLock);
451  DeviceExtension->DeviceListCount = 0;
452  DeviceExtension->State = dsStarted;
453 
456  &DeviceExtension->ListEntry,
458 
459  Irp->IoStatus.Information = 0;
460 
461  return STATUS_SUCCESS;
462 }
463 
464 
465 /*** PUBLIC ******************************************************************/
466 
467 NTSTATUS
470  PIRP Irp)
471 /*
472  * FUNCTION: Handle Plug and Play IRPs for the PCI device object
473  * ARGUMENTS:
474  * DeviceObject = Pointer to functional device object of the PCI driver
475  * Irp = Pointer to IRP that should be handled
476  * RETURNS:
477  * Status
478  */
479 {
480  PFDO_DEVICE_EXTENSION DeviceExtension;
482  NTSTATUS Status = Irp->IoStatus.Status;
483 
484  DPRINT("Called\n");
485 
486  DeviceExtension = DeviceObject->DeviceExtension;
487 
489  switch (IrpSp->MinorFunction)
490  {
491 #if 0
494  break;
495 
498  break;
499 
502  break;
503 
506  break;
507 #endif
509  if (IrpSp->Parameters.QueryDeviceRelations.Type != BusRelations)
510  break;
511 
513  Irp->IoStatus.Status = Status;
515  return Status;
516 #if 0
519  break;
520 
523  break;
524 #endif
525  case IRP_MN_START_DEVICE:
526  DPRINT("IRP_MN_START_DEVICE received\n");
528  if (NT_SUCCESS(Status))
530 
531  Irp->IoStatus.Status = Status;
533  return Status;
534 
536  /* We don't support stopping yet */
538  Irp->IoStatus.Status = Status;
540  return Status;
541 
542  case IRP_MN_STOP_DEVICE:
543  /* We can't fail this one so we fail the QUERY_STOP request that precedes it */
544  break;
545 #if 0
548  break;
549 #endif
550 
552  break;
553 
555  /* Detach the device object from the device stack */
556  IoDetachDevice(DeviceExtension->Ldo);
557 
558  /* Delete the device object */
560 
561  /* Return success */
563  break;
564 
567  /* Don't print the warning, too much noise */
568  break;
569 
570  default:
571  DPRINT1("Unknown PNP minor function 0x%x\n", IrpSp->MinorFunction);
572  break;
573  }
574 
575  Irp->IoStatus.Status = Status;
577  Status = IoCallDriver(DeviceExtension->Ldo, Irp);
578 
579  DPRINT("Leaving. Status 0x%lx\n", Status);
580 
581  return Status;
582 }
583 
584 
585 NTSTATUS
588  PIRP Irp)
589 /*
590  * FUNCTION: Handle power management IRPs for the PCI device object
591  * ARGUMENTS:
592  * DeviceObject = Pointer to functional device object of the PCI driver
593  * Irp = Pointer to IRP that should be handled
594  * RETURNS:
595  * Status
596  */
597 {
598  PFDO_DEVICE_EXTENSION DeviceExtension;
600 
601  DPRINT("Called\n");
602 
603  DeviceExtension = DeviceObject->DeviceExtension;
604 
607  Status = PoCallDriver(DeviceExtension->Ldo, Irp);
608 
609  DPRINT("Leaving. Status 0x%X\n", Status);
610 
611  return Status;
612 }
613 
614 /* EOF */
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
_In_ WDFIORESREQLIST _In_ ULONG SlotNumber
Definition: wdfresource.h:65
#define STATUS_REVISION_MISMATCH
Definition: ntstatus.h:325
#define IRP_MN_CANCEL_REMOVE_DEVICE
#define IN
Definition: typedefs.h:39
ULONG DeviceListCount
Definition: pci.h:91
#define IRP_MN_REMOVE_DEVICE
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
static NTSTATUS FdoStartDevice(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fdo.c:392
NTSTATUS NTAPI ForwardIrpAndWait(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fdo.c:32
#define STATUS_MORE_PROCESSING_REQUIRED
Definition: shellext.h:68
_Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PCM_RESOURCE_LIST * AllocatedResources
Definition: ndis.h:4640
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS
PDEVICE_OBJECT Objects[1]
Definition: iotypes.h:2163
PLIST_ENTRY NTAPI ExInterlockedInsertTailList(IN OUT PLIST_ENTRY ListHead, IN OUT PLIST_ENTRY ListEntry, IN OUT PKSPIN_LOCK Lock)
Definition: interlocked.c:140
LIST_ENTRY ListEntry
Definition: pci.h:83
LONG NTSTATUS
Definition: precomp.h:26
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@377::@385 BusNumber
struct _PDO_DEVICE_EXTENSION * PPDO_DEVICE_EXTENSION
PDEVICE_OBJECT Fdo
Definition: pci.h:58
NTSTATUS PciCreateDeviceLocationString(PUNICODE_STRING DeviceLocation, PPCI_DEVICE Device)
Definition: pci.c:646
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1296
PPCI_DEVICE PciDevice
Definition: pci.h:60
static NTSTATUS PciCreateCompatibleIDsString(PUNICODE_STRING CompatibleIDs)
Definition: fdo.c:291
Definition: pci.h:9
if(dx==0 &&dy==0)
Definition: linetemp.h:174
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
PDEVICE_OBJECT Ldo
Definition: pci.h:95
KSPIN_LOCK DeviceListLock
Definition: pci.h:93
struct _FDO_DEVICE_EXTENSION * PFDO_DEVICE_EXTENSION
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
Definition: irp.cpp:498
union _PCI_SLOT_NUMBER::@3785 u
FORCEINLINE VOID IoCopyCurrentIrpStackLocationToNext(_Inout_ PIRP Irp)
Definition: iofuncs.h:2868
PDEVICE_OBJECT DeviceObject
Definition: kstypes.h:153
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
return STATUS_NOT_IMPLEMENTED
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define FILE_DEVICE_CONTROLLER
Definition: winioctl.h:110
#define FALSE
Definition: types.h:117
_In_ PIRP Irp
Definition: csq.h:116
#define IRP_MN_QUERY_REMOVE_DEVICE
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:467
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:238
unsigned char BOOLEAN
#define IoCompleteRequest
Definition: irp.c:1240
COMMON_DEVICE_EXTENSION Common
Definition: pci.h:56
#define FILE_AUTOGENERATED_DEVICE_NAME
Definition: iotypes.h:138
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define IRP_MN_QUERY_STOP_DEVICE
Status
Definition: gdiplustypes.h:24
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@377 u
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
UNICODE_STRING DeviceLocation
Definition: pci.h:72
#define IRP_MN_STOP_DEVICE
#define ASSERT(a)
Definition: mode.c:44
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
UNICODE_STRING HardwareIDs
Definition: pci.h:66
#define IRP_MN_START_DEVICE
NTSTATUS PciCreateDeviceDescriptionString(PUNICODE_STRING DeviceDescription, PPCI_DEVICE Device)
Definition: pci.c:378
KSPIN_LOCK BusListLock
Definition: pci.h:105
#define PCI_MAX_DEVICES
Definition: iotypes.h:3598
static NTSTATUS FdoQueryBusRelations(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, PIO_STACK_LOCATION IrpSp)
Definition: fdo.c:207
PCI_DEVICE_STATE State
Definition: pci.h:87
#define for
Definition: utility.h:88
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
UNICODE_STRING DeviceDescription
Definition: pci.h:70
ULONG BusNumber
Definition: pci.h:85
static NTSTATUS FdoEnumerateDevices(PDEVICE_OBJECT DeviceObject)
Definition: fdo.c:94
LIST_ENTRY BusListHead
Definition: pci.h:103
#define TAG_PCI
Definition: pci.h:7
Definition: typedefs.h:119
static IO_COMPLETION_ROUTINE ForwardIrpAndWaitCompletion
Definition: fdo.c:17
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:31
LIST_ENTRY DeviceListHead
Definition: pci.h:89
NTSTATUS FdoPowerControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: fdo.c:586
#define PCI_MAX_FUNCTION
Definition: iotypes.h:3599
NTSTATUS PciCreateDeviceIDString(PUNICODE_STRING DeviceID, PPCI_DEVICE Device)
Definition: pci.c:232
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
struct _DEVICE_RELATIONS DEVICE_RELATIONS
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
PCI_SLOT_NUMBER SlotNumber
Definition: pci.h:18
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:746
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
static NTSTATUS PciCreateHardwareIDsString(PUNICODE_STRING HardwareIDs)
Definition: fdo.c:269
static NTSTATUS PciCreateInstanceIDString(PUNICODE_STRING InstanceID, ULONG PeripheralNumber)
Definition: fdo.c:313
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
UNICODE_STRING InstanceID
Definition: pci.h:64
#define NULL
Definition: types.h:112
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
#define IRP_MN_QUERY_DEVICE_RELATIONS
NTSTATUS FdoPnpControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: fdo.c:468
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define DPRINT1
Definition: precomp.h:8
#define ObReferenceObject
Definition: obfuncs.h:204
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:598
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1031
NTHALAPI ULONG NTAPI HalGetBusData(BUS_DATA_TYPE, ULONG, ULONG, PVOID, ULONG)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define ULONG_PTR
Definition: config.h:101
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define CmResourceTypeBusNumber
Definition: hwresource.cpp:128
UNICODE_STRING DeviceID
Definition: pci.h:62
#define IRP_MN_CANCEL_STOP_DEVICE
#define STATUS_SUCCESS
Definition: shellext.h:65
#define IRP_MN_DEVICE_USAGE_NOTIFICATION
static NTSTATUS FdoLocateChildDevice(PPCI_DEVICE *Device, PFDO_DEVICE_EXTENSION DeviceExtension, PCI_SLOT_NUMBER SlotNumber, PPCI_COMMON_CONFIG PciConfig)
Definition: fdo.c:58
_In_ PCHAR _In_ ULONG DeviceNumber
Definition: classpnp.h:1229
#define DPRINT
Definition: sndvol32.h:71
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3128
UNICODE_STRING CompatibleIDs
Definition: pci.h:68
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define IRP_MN_QUERY_PNP_DEVICE_STATE
PCI_COMMON_CONFIG PciConfig
Definition: pci.h:20
#define IRP_MN_QUERY_CAPABILITIES
#define PCI_COMMON_HDR_LENGTH
Definition: iotypes.h:3594