ReactOS  0.4.15-dev-506-ga3ec01c
fdo.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Universal Serial Bus Bulk Enhanced Host Controller Interface
3  * LICENSE: GPL - See COPYING in the top level directory
4  * FILE: drivers/usb/usbccgp/fdo.c
5  * PURPOSE: USB device driver.
6  * PROGRAMMERS:
7  * Michael Martin (michael.martin@reactos.org)
8  * Johannes Anderwald (johannes.anderwald@reactos.org)
9  * Cameron Gutman
10  */
11 
12 #include "usbccgp.h"
13 
14 #define NDEBUG
15 #include <debug.h>
16 
18 NTAPI
21  IN PIRP Irp,
23 {
24  /* Set event */
26 
27  /* Completion is done in the HidClassFDO_QueryCapabilities routine */
29 }
30 
35 {
36  PIRP Irp;
37  KEVENT Event;
39  PIO_STACK_LOCATION IoStack;
40  PFDO_DEVICE_EXTENSION FDODeviceExtension;
41 
42  /* Get device extension */
43  FDODeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
44  ASSERT(FDODeviceExtension->Common.IsFDO);
45 
46  /* Init event */
48 
49  /* Now allocate the irp */
51  if (!Irp)
52  {
53  /* No memory */
55  }
56 
57  /* Get next stack location */
58  IoStack = IoGetNextIrpStackLocation(Irp);
59 
60  /* Init stack location */
61  IoStack->MajorFunction = IRP_MJ_PNP;
63  IoStack->Parameters.DeviceCapabilities.Capabilities = Capabilities;
64 
65  /* Set completion routine */
68  (PVOID)&Event,
69  TRUE,
70  TRUE,
71  TRUE);
72 
73  /* Init capabilities */
75  Capabilities->Size = sizeof(DEVICE_CAPABILITIES);
76  Capabilities->Version = 1; // FIXME hardcoded constant
77  Capabilities->Address = MAXULONG;
78  Capabilities->UINumber = MAXULONG;
79 
80  /* Pnp irps have default completion code */
81  Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
82 
83  /* Call lower device */
84  Status = IoCallDriver(FDODeviceExtension->NextDeviceObject, Irp);
85  if (Status == STATUS_PENDING)
86  {
87  /* Wait for completion */
89  }
90 
91  /* Get status */
92  Status = Irp->IoStatus.Status;
93 
94  /* Complete request */
95  IoFreeIrp(Irp);
96 
97  /* Done */
98  return Status;
99 }
100 
101 NTSTATUS
104  PIRP Irp)
105 {
106  ULONG DeviceCount = 0;
107  ULONG Index;
108  PDEVICE_RELATIONS DeviceRelations;
109  PIO_STACK_LOCATION IoStack;
110  PFDO_DEVICE_EXTENSION FDODeviceExtension;
111 
112  /* Get device extension */
113  FDODeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
114 
115  /* Get current irp stack location */
117 
118  /* Check if relation type is BusRelations */
119  if (IoStack->Parameters.QueryDeviceRelations.Type != BusRelations)
120  {
121  /* FDO always only handles bus relations */
122  return STATUS_SUCCESS;
123  }
124 
125  /* Go through array and count device objects */
126  for(Index = 0; Index < FDODeviceExtension->FunctionDescriptorCount; Index++)
127  {
128  if (FDODeviceExtension->ChildPDO[Index])
129  {
130  /* Child pdo */
131  DeviceCount++;
132  }
133  }
134 
135  /* Allocate device relations */
136  DeviceRelations = (PDEVICE_RELATIONS)AllocateItem(PagedPool,
137  sizeof(DEVICE_RELATIONS) + (DeviceCount > 1 ? (DeviceCount-1) * sizeof(PDEVICE_OBJECT) : 0));
138  if (!DeviceRelations)
139  {
140  /* No memory */
142  }
143 
144  /* Add device objects */
145  for(Index = 0; Index < FDODeviceExtension->FunctionDescriptorCount; Index++)
146  {
147  if (FDODeviceExtension->ChildPDO[Index])
148  {
149  /* Store child pdo */
150  DeviceRelations->Objects[DeviceRelations->Count] = FDODeviceExtension->ChildPDO[Index];
151 
152  /* Add reference */
153  ObReferenceObject(FDODeviceExtension->ChildPDO[Index]);
154 
155  /* Increment count */
156  DeviceRelations->Count++;
157  }
158  }
159 
160  /* Store result */
161  Irp->IoStatus.Information = (ULONG_PTR)DeviceRelations;
162  Irp->IoStatus.Status = STATUS_SUCCESS;
163 
164  /* Request completed successfully */
165  return STATUS_SUCCESS;
166 }
167 
168 NTSTATUS
171 {
173  PDEVICE_OBJECT PDODeviceObject;
174  PPDO_DEVICE_EXTENSION PDODeviceExtension;
175  PFDO_DEVICE_EXTENSION FDODeviceExtension;
176  ULONG Index;
177 
178  /* Get device extension */
179  FDODeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
180  ASSERT(FDODeviceExtension->Common.IsFDO);
181 
182  /* Lets create array for the child PDO */
183  FDODeviceExtension->ChildPDO = AllocateItem(NonPagedPool,
184  sizeof(PDEVICE_OBJECT) * FDODeviceExtension->FunctionDescriptorCount);
185  if (!FDODeviceExtension->ChildPDO)
186  {
187  /* No memory */
189  }
190 
191  /* Create pdo for each function */
192  for(Index = 0; Index < FDODeviceExtension->FunctionDescriptorCount; Index++)
193  {
194  /* Create the PDO */
195  Status = IoCreateDevice(FDODeviceExtension->DriverObject,
196  sizeof(PDO_DEVICE_EXTENSION),
197  NULL,
200  FALSE,
201  &PDODeviceObject);
202  if (!NT_SUCCESS(Status))
203  {
204  /* Failed to create device object */
205  DPRINT1("IoCreateDevice failed with %x\n", Status);
206  return Status;
207  }
208 
209  /* Store in array */
210  FDODeviceExtension->ChildPDO[Index] = PDODeviceObject;
211 
212  /* Get device extension */
213  PDODeviceExtension = (PPDO_DEVICE_EXTENSION)PDODeviceObject->DeviceExtension;
214  RtlZeroMemory(PDODeviceExtension, sizeof(PDO_DEVICE_EXTENSION));
215 
216  /* Init device extension */
217  PDODeviceExtension->Common.IsFDO = FALSE;
218  PDODeviceExtension->FunctionDescriptor = &FDODeviceExtension->FunctionDescriptor[Index];
219  PDODeviceExtension->NextDeviceObject = DeviceObject;
220  PDODeviceExtension->FunctionIndex = Index;
221  PDODeviceExtension->FDODeviceExtension = FDODeviceExtension;
222  PDODeviceExtension->InterfaceList = FDODeviceExtension->InterfaceList;
223  PDODeviceExtension->InterfaceListCount = FDODeviceExtension->InterfaceListCount;
224  PDODeviceExtension->ConfigurationHandle = FDODeviceExtension->ConfigurationHandle;
225  PDODeviceExtension->ConfigurationDescriptor = FDODeviceExtension->ConfigurationDescriptor;
226  RtlCopyMemory(&PDODeviceExtension->Capabilities, &FDODeviceExtension->Capabilities, sizeof(DEVICE_CAPABILITIES));
227  RtlCopyMemory(&PDODeviceExtension->DeviceDescriptor, FDODeviceExtension->DeviceDescriptor, sizeof(USB_DEVICE_DESCRIPTOR));
228 
229  /* Patch the stack size */
230  PDODeviceObject->StackSize = DeviceObject->StackSize + 1;
231 
232  /* Set device flags */
233  PDODeviceObject->Flags |= DO_DIRECT_IO | DO_MAP_IO_BUFFER;
234 
235  /* Device is initialized */
236  PDODeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
237  }
238 
239  /* Done */
240  return STATUS_SUCCESS;
241 }
242 
243 NTSTATUS
246  PIRP Irp)
247 {
249  PFDO_DEVICE_EXTENSION FDODeviceExtension;
250 
251  /* Get device extension */
252  FDODeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
253  ASSERT(FDODeviceExtension->Common.IsFDO);
254 
255  /* First start lower device */
256  Status = USBCCGP_SyncForwardIrp(FDODeviceExtension->NextDeviceObject, Irp);
257 
258  if (!NT_SUCCESS(Status))
259  {
260  /* Failed to start lower device */
261  DPRINT1("FDO_StartDevice lower device failed to start with %x\n", Status);
262  return Status;
263  }
264 
265  /* Get descriptors */
267  if (!NT_SUCCESS(Status))
268  {
269  /* Failed to start lower device */
270  DPRINT1("FDO_StartDevice failed to get descriptors with %x\n", Status);
271  return Status;
272  }
273 
274  /* Get capabilities */
276  &FDODeviceExtension->Capabilities);
277  if (!NT_SUCCESS(Status))
278  {
279  /* Failed to start lower device */
280  DPRINT1("FDO_StartDevice failed to get capabilities with %x\n", Status);
281  return Status;
282  }
283 
284  /* Now select the configuration */
285  Status = USBCCGP_SelectConfiguration(DeviceObject, FDODeviceExtension);
286  if (!NT_SUCCESS(Status))
287  {
288  /* Failed to select interface */
289  DPRINT1("FDO_StartDevice failed to get capabilities with %x\n", Status);
290  return Status;
291  }
292 
293  /* Query bus interface */
294  USBCCGP_QueryInterface(FDODeviceExtension->NextDeviceObject,
295  &FDODeviceExtension->BusInterface);
296 
297  /* Now enumerate the functions */
299  if (!NT_SUCCESS(Status))
300  {
301  /* Failed to enumerate functions */
302  DPRINT1("Failed to enumerate functions with %x\n", Status);
303  return Status;
304  }
305 
306  /* Sanity checks */
307  ASSERT(FDODeviceExtension->FunctionDescriptorCount);
308  ASSERT(FDODeviceExtension->FunctionDescriptor);
309  DumpFunctionDescriptor(FDODeviceExtension->FunctionDescriptor,
310  FDODeviceExtension->FunctionDescriptorCount);
311 
312  /* Now create the pdo */
314  if (!NT_SUCCESS(Status))
315  {
316  /* Failed */
317  DPRINT1("FDO_CreateChildPdo failed with %x\n", Status);
318  return Status;
319  }
320 
321  /* Inform pnp manager of new device objects */
322  IoInvalidateDeviceRelations(FDODeviceExtension->PhysicalDeviceObject,
323  BusRelations);
324 
325  /* Done */
326  DPRINT("[USBCCGP] FDO initialized successfully\n");
327  return Status;
328 }
329 
330 NTSTATUS
333 {
335  PURB Urb;
336  PFDO_DEVICE_EXTENSION FDODeviceExtension;
337 
338  /* Get device extension */
339  FDODeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
340  ASSERT(FDODeviceExtension->Common.IsFDO);
341 
342  /* Nothing to do if we're not configured */
343  if (FDODeviceExtension->ConfigurationDescriptor == NULL ||
344  FDODeviceExtension->InterfaceList == NULL)
345  {
346  return STATUS_SUCCESS;
347  }
348 
349  /* Now allocate the urb */
350  Urb = USBD_CreateConfigurationRequestEx(FDODeviceExtension->ConfigurationDescriptor,
351  FDODeviceExtension->InterfaceList);
352  if (!Urb)
353  {
354  /* No memory */
356  }
357 
358  /* Clear configuration descriptor to make it an unconfigure request */
359  Urb->UrbSelectConfiguration.ConfigurationDescriptor = NULL;
360 
361  /* Submit urb */
362  Status = USBCCGP_SyncUrbRequest(FDODeviceExtension->NextDeviceObject, Urb);
363  if (!NT_SUCCESS(Status))
364  {
365  /* Failed to set configuration */
366  DPRINT1("USBCCGP_SyncUrbRequest failed to unconfigure device\n", Status);
367  }
368 
369  ExFreePool(Urb);
370  return Status;
371 }
372 
373 
374 NTSTATUS
377  PIRP Irp)
378 {
379  PIO_STACK_LOCATION IoStack;
381  PFDO_DEVICE_EXTENSION FDODeviceExtension;
382 
383  /* Get device extension */
384  FDODeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
385  ASSERT(FDODeviceExtension->Common.IsFDO);
386 
387 
388  /* Get stack location */
390  DPRINT("[USBCCGP] PnP Minor %x\n", IoStack->MinorFunction);
391  switch(IoStack->MinorFunction)
392  {
394  {
395  // Unconfigure device */
396  DPRINT1("[USBCCGP] FDO IRP_MN_REMOVE\n");
398 
399  /* Send the IRP down the stack */
400  Irp->IoStatus.Status = STATUS_SUCCESS;
402  Status = IoCallDriver(FDODeviceExtension->NextDeviceObject, Irp);
403 
404  /* Detach from the device stack */
405  IoDetachDevice(FDODeviceExtension->NextDeviceObject);
406 
407  /* Delete the device object */
409 
410  /* Request completed */
411  break;
412  }
413  case IRP_MN_START_DEVICE:
414  {
415  /* Start the device */
417  break;
418  }
420  {
421  /* Handle device relations */
423  if (!NT_SUCCESS(Status))
424  {
425  break;
426  }
427 
428  /* Forward irp to next device object */
430  return IoCallDriver(FDODeviceExtension->NextDeviceObject, Irp);
431  }
433  {
434  /* Copy capabilities */
435  RtlCopyMemory(IoStack->Parameters.DeviceCapabilities.Capabilities,
436  &FDODeviceExtension->Capabilities,
437  sizeof(DEVICE_CAPABILITIES));
438  Status = USBCCGP_SyncForwardIrp(FDODeviceExtension->NextDeviceObject, Irp);
439  if (NT_SUCCESS(Status))
440  {
441  /* Surprise removal ok */
442  IoStack->Parameters.DeviceCapabilities.Capabilities->SurpriseRemovalOK = TRUE;
443  }
444  break;
445  }
448  {
449  /* Sure */
450  Irp->IoStatus.Status = STATUS_SUCCESS;
451 
452  /* Forward irp to next device object */
454  return IoCallDriver(FDODeviceExtension->NextDeviceObject, Irp);
455  }
456  default:
457  {
458  /* Forward irp to next device object */
460  return IoCallDriver(FDODeviceExtension->NextDeviceObject, Irp);
461  }
462 
463  }
464 
465  /* Complete request */
466  Irp->IoStatus.Status = Status;
468  return Status;
469 }
470 
471 NTSTATUS
474  PIRP Irp)
475 {
476  PIO_STACK_LOCATION IoStack;
478  PFDO_DEVICE_EXTENSION FDODeviceExtension;
479  PLIST_ENTRY ListHead, Entry;
480  LIST_ENTRY TempList;
481  PUCHAR ResetActive;
482  PIRP ListIrp;
483  KIRQL OldLevel;
484 
485  /* Get device extension */
486  FDODeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
487  ASSERT(FDODeviceExtension->Common.IsFDO);
488 
489  /* Get stack location */
491  DPRINT("FDO_HandleResetCyclePort IOCTL %x\n", IoStack->Parameters.DeviceIoControl.IoControlCode);
492 
493  if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_INTERNAL_USB_RESET_PORT)
494  {
495  /* Use reset port list */
496  ListHead = &FDODeviceExtension->ResetPortListHead;
497  ResetActive = &FDODeviceExtension->ResetPortActive;
498  }
499  else
500  {
501  /* Use cycle port list */
502  ListHead = &FDODeviceExtension->CyclePortListHead;
503  ResetActive = &FDODeviceExtension->CyclePortActive;
504  }
505 
506  /* Acquire lock */
507  KeAcquireSpinLock(&FDODeviceExtension->Lock, &OldLevel);
508 
509  if (*ResetActive)
510  {
511  /* Insert into pending list */
512  InsertTailList(ListHead, &Irp->Tail.Overlay.ListEntry);
513 
514  /* Mark irp pending */
517 
518  /* Release lock */
519  KeReleaseSpinLock(&FDODeviceExtension->Lock, OldLevel);
520  }
521  else
522  {
523  /* Mark reset active */
524  *ResetActive = TRUE;
525 
526  /* Release lock */
527  KeReleaseSpinLock(&FDODeviceExtension->Lock, OldLevel);
528 
529  /* Forward request synchronized */
530  USBCCGP_SyncForwardIrp(FDODeviceExtension->NextDeviceObject, Irp);
531 
532  /* Reacquire lock */
533  KeAcquireSpinLock(&FDODeviceExtension->Lock, &OldLevel);
534 
535  /* Mark reset as completed */
536  *ResetActive = FALSE;
537 
538  /* Move all requests into temporary list */
539  InitializeListHead(&TempList);
540  while(!IsListEmpty(ListHead))
541  {
542  Entry = RemoveHeadList(ListHead);
543  InsertTailList(&TempList, Entry);
544  }
545 
546  /* Release lock */
547  KeReleaseSpinLock(&FDODeviceExtension->Lock, OldLevel);
548 
549  /* Complete pending irps */
550  while(!IsListEmpty(&TempList))
551  {
552  Entry = RemoveHeadList(&TempList);
553  ListIrp = (PIRP)CONTAINING_RECORD(Entry, IRP, Tail.Overlay.ListEntry);
554 
555  /* Complete request with status success */
556  ListIrp->IoStatus.Status = STATUS_SUCCESS;
558  }
559 
560  /* Status success */
562  }
563 
564  return Status;
565 }
566 
567 
568 
569 NTSTATUS
572  PIRP Irp)
573 {
574  PIO_STACK_LOCATION IoStack;
576  PFDO_DEVICE_EXTENSION FDODeviceExtension;
577 
578  /* Get device extension */
579  FDODeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
580  ASSERT(FDODeviceExtension->Common.IsFDO);
581 
582  /* Get stack location */
584 
585  if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_INTERNAL_USB_RESET_PORT ||
586  IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_INTERNAL_USB_CYCLE_PORT)
587  {
588  /* Handle reset / cycle ports */
590  DPRINT("FDO_HandleResetCyclePort Status %x\n", Status);
591  if (Status != STATUS_PENDING)
592  {
593  /* Complete request */
594  Irp->IoStatus.Status = Status;
596  }
597  return Status;
598  }
599 
600  /* Forward and forget request */
602  return IoCallDriver(FDODeviceExtension->NextDeviceObject, Irp);
603 }
604 
605 NTSTATUS
608  PIRP Irp)
609 {
610  PFDO_DEVICE_EXTENSION FDODeviceExtension;
611 
612  /* Get device extension */
613  FDODeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
614  ASSERT(FDODeviceExtension->Common.IsFDO);
615 
616  /* Forward and forget request */
618  return IoCallDriver(FDODeviceExtension->NextDeviceObject, Irp);
619 }
620 
621 NTSTATUS
624  PIRP Irp)
625 {
626  PIO_STACK_LOCATION IoStack;
628  PFDO_DEVICE_EXTENSION FDODeviceExtension;
629 
630  /* Get device extension */
631  FDODeviceExtension = DeviceObject->DeviceExtension;
632  ASSERT(FDODeviceExtension->Common.IsFDO);
633 
634  /* Get stack location */
636 
637  switch(IoStack->MajorFunction)
638  {
639  case IRP_MJ_PNP:
640  return FDO_HandlePnp(DeviceObject, Irp);
643  case IRP_MJ_POWER:
646  return PoCallDriver(FDODeviceExtension->NextDeviceObject, Irp);
649  default:
650  DPRINT1("FDO_Dispatch Function %x not implemented\n", IoStack->MajorFunction);
651  ASSERT(FALSE);
652  Status = Irp->IoStatus.Status;
654  return Status;
655  }
656 
657 }
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
#define IN
Definition: typedefs.h:39
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
NTSTATUS USBCCGP_EnumerateFunctions(IN PDEVICE_OBJECT DeviceObject)
Definition: function.c:829
#define IRP_MN_REMOVE_DEVICE
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
PBUS_INTERFACE_STANDARD BusInterface
Definition: pciidex.h:23
NTSTATUS FDO_CloseConfiguration(IN PDEVICE_OBJECT DeviceObject)
Definition: fdo.c:331
struct _Entry Entry
Definition: kefuncs.h:627
#define STATUS_MORE_PROCESSING_REQUIRED
Definition: shellext.h:68
_In_ PIRP Irp
Definition: csq.h:116
PDEVICE_OBJECT Objects[1]
Definition: iotypes.h:2057
unsigned char * PUCHAR
Definition: retypes.h:3
NTSTATUS FDO_HandleInternalDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: fdo.c:570
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:30
#define FILE_DEVICE_USB
Definition: usbiodef.h:71
LONG NTSTATUS
Definition: precomp.h:26
struct _PDO_DEVICE_EXTENSION * PPDO_DEVICE_EXTENSION
NTSTATUS USBCCGP_SelectConfiguration(IN PDEVICE_OBJECT DeviceObject, IN PFDO_DEVICE_EXTENSION DeviceExtension)
Definition: descriptor.c:467
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1296
DEVICE_CAPABILITIES
Definition: iotypes.h:930
IO_STATUS_BLOCK IoStatus
#define InsertTailList(ListHead, Entry)
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
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
struct _FDO_DEVICE_EXTENSION * PFDO_DEVICE_EXTENSION
#define DO_DIRECT_IO
Definition: env_spec_w32.h:396
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
Definition: irp.cpp:498
UCHAR KIRQL
Definition: env_spec_w32.h:591
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define IRP_MN_QUERY_REMOVE_DEVICE
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
Definition: hidclass.h:103
NTSTATUS NTAPI FDO_QueryCapabilitiesCompletionRoutine(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
Definition: fdo.c:19
ULONG DeviceCount
Definition: mpu401.c:26
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:437
struct _DEVICE_RELATIONS * PDEVICE_RELATIONS
NTSTATUS FDO_CreateChildPdo(IN PDEVICE_OBJECT DeviceObject)
Definition: fdo.c:169
PVOID DeviceExtension
Definition: env_spec_w32.h:418
smooth NULL
Definition: ftsmooth.c:416
#define IoCompleteRequest
Definition: irp.c:1240
FORCEINLINE PLIST_ENTRY RemoveHeadList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:128
COMMON_DEVICE_EXTENSION Common
Definition: pci.h:56
void DPRINT(...)
Definition: polytest.cpp:61
#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 IOCTL_INTERNAL_USB_CYCLE_PORT
Definition: usbioctl.h:53
#define IRP_MN_QUERY_STOP_DEVICE
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
NTSTATUS FDO_Dispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: fdo.c:622
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
#define IRP_MN_START_DEVICE
static const UCHAR Index[8]
Definition: usbohci.c:18
#define IRP_MJ_INTERNAL_DEVICE_CONTROL
NTSTATUS FDO_DeviceRelations(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: fdo.c:102
struct _IRP * PIRP
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define IRP_MJ_POWER
NTSTATUS FDO_HandleResetCyclePort(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: fdo.c:472
Definition: typedefs.h:118
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2647
NTSTATUS USBCCGP_GetDescriptors(IN PDEVICE_OBJECT DeviceObject)
Definition: descriptor.c:160
VOID DumpFunctionDescriptor(IN PUSBC_FUNCTION_DESCRIPTOR FunctionDescriptor, IN ULONG FunctionDescriptorCount)
Definition: misc.c:160
COMMON_DEVICE_EXTENSION Common
Definition: pci.h:81
#define IRP_MJ_SYSTEM_CONTROL
* PDEVICE_CAPABILITIES
Definition: iotypes.h:930
Status
Definition: gdiplustypes.h:24
#define MAXULONG
Definition: typedefs.h:250
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1569
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
NTSTATUS USBCCGP_QueryInterface(IN PDEVICE_OBJECT DeviceObject, OUT PUSBC_DEVICE_CONFIGURATION_INTERFACE_V1 BusInterface)
Definition: function.c:18
VOID NTAPI IoInvalidateDeviceRelations(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_RELATION_TYPE Type)
Definition: pnpmgr.c:2473
struct _URB_SELECT_CONFIGURATION UrbSelectConfiguration
Definition: usb.h:533
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:737
Definition: usb.h:529
NTSTATUS USBCCGP_SyncUrbRequest(IN PDEVICE_OBJECT DeviceObject, OUT PURB UrbRequest)
Definition: misc.c:75
NTSTATUS FDO_StartDevice(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: fdo.c:244
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define IOCTL_INTERNAL_USB_RESET_PORT
Definition: usbioctl.h:35
#define DPRINT1
Definition: precomp.h:8
NTSTATUS FDO_HandlePnp(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: fdo.c:375
#define OUT
Definition: typedefs.h:40
#define ObReferenceObject
Definition: obfuncs.h:204
VOID NTAPI IoFreeIrp(IN PIRP Irp)
Definition: irp.c:1666
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:568
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
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define ULONG_PTR
Definition: config.h:101
PIRP NTAPI IoAllocateIrp(IN CCHAR StackSize, IN BOOLEAN ChargeQuota)
Definition: irp.c:615
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2774
PURB NTAPI USBD_CreateConfigurationRequestEx(PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, PUSBD_INTERFACE_LIST_ENTRY InterfaceList)
Definition: usbd.c:329
return STATUS_SUCCESS
Definition: btrfs.c:3014
IoMarkIrpPending(Irp)
#define DO_MAP_IO_BUFFER
Definition: env_spec_w32.h:397
base of all file and directory entries
Definition: entries.h:82
NTSTATUS FDO_HandleSystemControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: fdo.c:606
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
NTSTATUS NTAPI USBCCGP_SyncForwardIrp(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: misc.c:36
NTSTATUS FDO_QueryCapabilities(IN PDEVICE_OBJECT DeviceObject, IN OUT PDEVICE_CAPABILITIES Capabilities)
Definition: fdo.c:32
#define IRP_MN_QUERY_CAPABILITIES