ReactOS  0.4.13-dev-455-g28ed234
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 USBCCGP_SyncForwardIrp(FDODeviceExtension->NextDeviceObject, Irp);
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 
163  /* Request completed successfully */
164  return STATUS_SUCCESS;
165 }
166 
167 NTSTATUS
170 {
172  PDEVICE_OBJECT PDODeviceObject;
173  PPDO_DEVICE_EXTENSION PDODeviceExtension;
174  PFDO_DEVICE_EXTENSION FDODeviceExtension;
175  ULONG Index;
176 
177  /* Get device extension */
178  FDODeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
179  ASSERT(FDODeviceExtension->Common.IsFDO);
180 
181  /* Lets create array for the child PDO */
182  FDODeviceExtension->ChildPDO = AllocateItem(NonPagedPool,
183  sizeof(PDEVICE_OBJECT) * FDODeviceExtension->FunctionDescriptorCount);
184  if (!FDODeviceExtension->ChildPDO)
185  {
186  /* No memory */
188  }
189 
190  /* Create pdo for each function */
191  for(Index = 0; Index < FDODeviceExtension->FunctionDescriptorCount; Index++)
192  {
193  /* Create the PDO */
194  Status = IoCreateDevice(FDODeviceExtension->DriverObject,
195  sizeof(PDO_DEVICE_EXTENSION),
196  NULL,
199  FALSE,
200  &PDODeviceObject);
201  if (!NT_SUCCESS(Status))
202  {
203  /* Failed to create device object */
204  DPRINT1("IoCreateDevice failed with %x\n", Status);
205  return Status;
206  }
207 
208  /* Store in array */
209  FDODeviceExtension->ChildPDO[Index] = PDODeviceObject;
210 
211  /* Get device extension */
212  PDODeviceExtension = (PPDO_DEVICE_EXTENSION)PDODeviceObject->DeviceExtension;
213  RtlZeroMemory(PDODeviceExtension, sizeof(PDO_DEVICE_EXTENSION));
214 
215  /* Init device extension */
216  PDODeviceExtension->Common.IsFDO = FALSE;
217  PDODeviceExtension->FunctionDescriptor = &FDODeviceExtension->FunctionDescriptor[Index];
218  PDODeviceExtension->NextDeviceObject = DeviceObject;
219  PDODeviceExtension->FunctionIndex = Index;
220  PDODeviceExtension->FDODeviceExtension = FDODeviceExtension;
221  PDODeviceExtension->InterfaceList = FDODeviceExtension->InterfaceList;
222  PDODeviceExtension->InterfaceListCount = FDODeviceExtension->InterfaceListCount;
223  PDODeviceExtension->ConfigurationHandle = FDODeviceExtension->ConfigurationHandle;
224  PDODeviceExtension->ConfigurationDescriptor = FDODeviceExtension->ConfigurationDescriptor;
225  RtlCopyMemory(&PDODeviceExtension->Capabilities, &FDODeviceExtension->Capabilities, sizeof(DEVICE_CAPABILITIES));
226  RtlCopyMemory(&PDODeviceExtension->DeviceDescriptor, FDODeviceExtension->DeviceDescriptor, sizeof(USB_DEVICE_DESCRIPTOR));
227 
228  /* Patch the stack size */
229  PDODeviceObject->StackSize = DeviceObject->StackSize + 1;
230 
231  /* Set device flags */
232  PDODeviceObject->Flags |= DO_DIRECT_IO | DO_MAP_IO_BUFFER;
233 
234  /* Device is initialized */
235  PDODeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
236  }
237 
238  /* Done */
239  return STATUS_SUCCESS;
240 }
241 
242 NTSTATUS
245  PIRP Irp)
246 {
248  PFDO_DEVICE_EXTENSION FDODeviceExtension;
249 
250  /* Get device extension */
251  FDODeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
252  ASSERT(FDODeviceExtension->Common.IsFDO);
253 
254  /* First start lower device */
255  Status = USBCCGP_SyncForwardIrp(FDODeviceExtension->NextDeviceObject, Irp);
256 
257  if (!NT_SUCCESS(Status))
258  {
259  /* Failed to start lower device */
260  DPRINT1("FDO_StartDevice lower device failed to start with %x\n", Status);
261  return Status;
262  }
263 
264  /* Get descriptors */
266  if (!NT_SUCCESS(Status))
267  {
268  /* Failed to start lower device */
269  DPRINT1("FDO_StartDevice failed to get descriptors with %x\n", Status);
270  return Status;
271  }
272 
273  /* Get capabilities */
275  &FDODeviceExtension->Capabilities);
276  if (!NT_SUCCESS(Status))
277  {
278  /* Failed to start lower device */
279  DPRINT1("FDO_StartDevice failed to get capabilities with %x\n", Status);
280  return Status;
281  }
282 
283  /* Now select the configuration */
284  Status = USBCCGP_SelectConfiguration(DeviceObject, FDODeviceExtension);
285  if (!NT_SUCCESS(Status))
286  {
287  /* Failed to select interface */
288  DPRINT1("FDO_StartDevice failed to get capabilities with %x\n", Status);
289  return Status;
290  }
291 
292  /* Query bus interface */
293  USBCCGP_QueryInterface(FDODeviceExtension->NextDeviceObject,
294  &FDODeviceExtension->BusInterface);
295 
296  /* Now enumerate the functions */
298  if (!NT_SUCCESS(Status))
299  {
300  /* Failed to enumerate functions */
301  DPRINT1("Failed to enumerate functions with %x\n", Status);
302  return Status;
303  }
304 
305  /* Sanity checks */
306  ASSERT(FDODeviceExtension->FunctionDescriptorCount);
307  ASSERT(FDODeviceExtension->FunctionDescriptor);
308  DumpFunctionDescriptor(FDODeviceExtension->FunctionDescriptor,
309  FDODeviceExtension->FunctionDescriptorCount);
310 
311  /* Now create the pdo */
313  if (!NT_SUCCESS(Status))
314  {
315  /* Failed */
316  DPRINT1("FDO_CreateChildPdo failed with %x\n", Status);
317  return Status;
318  }
319 
320  /* Inform pnp manager of new device objects */
321  IoInvalidateDeviceRelations(FDODeviceExtension->PhysicalDeviceObject,
322  BusRelations);
323 
324  /* Done */
325  DPRINT("[USBCCGP] FDO initialized successfully\n");
326  return Status;
327 }
328 
329 NTSTATUS
332 {
334  PURB Urb;
335  PFDO_DEVICE_EXTENSION FDODeviceExtension;
336 
337  /* Get device extension */
338  FDODeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
339  ASSERT(FDODeviceExtension->Common.IsFDO);
340 
341  /* Nothing to do if we're not configured */
342  if (FDODeviceExtension->ConfigurationDescriptor == NULL ||
343  FDODeviceExtension->InterfaceList == NULL)
344  {
345  return STATUS_SUCCESS;
346  }
347 
348  /* Now allocate the urb */
349  Urb = USBD_CreateConfigurationRequestEx(FDODeviceExtension->ConfigurationDescriptor,
350  FDODeviceExtension->InterfaceList);
351  if (!Urb)
352  {
353  /* No memory */
355  }
356 
357  /* Clear configuration descriptor to make it an unconfigure request */
358  Urb->UrbSelectConfiguration.ConfigurationDescriptor = NULL;
359 
360  /* Submit urb */
361  Status = USBCCGP_SyncUrbRequest(FDODeviceExtension->NextDeviceObject, Urb);
362  if (!NT_SUCCESS(Status))
363  {
364  /* Failed to set configuration */
365  DPRINT1("USBCCGP_SyncUrbRequest failed to unconfigure device\n", Status);
366  }
367 
368  ExFreePool(Urb);
369  return Status;
370 }
371 
372 
373 NTSTATUS
376  PIRP Irp)
377 {
378  PIO_STACK_LOCATION IoStack;
380  PFDO_DEVICE_EXTENSION FDODeviceExtension;
381 
382  /* Get device extension */
383  FDODeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
384  ASSERT(FDODeviceExtension->Common.IsFDO);
385 
386 
387  /* Get stack location */
389  DPRINT("[USBCCGP] PnP Minor %x\n", IoStack->MinorFunction);
390  switch(IoStack->MinorFunction)
391  {
393  {
394  // Unconfigure device */
395  DPRINT1("[USBCCGP] FDO IRP_MN_REMOVE\n");
397 
398  /* Send the IRP down the stack */
399  Status = USBCCGP_SyncForwardIrp(FDODeviceExtension->NextDeviceObject,
400  Irp);
401  if (NT_SUCCESS(Status))
402  {
403  /* Detach from the device stack */
404  IoDetachDevice(FDODeviceExtension->NextDeviceObject);
405 
406  /* Delete the device object */
408  }
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  break;
424  }
426  {
427  /* Copy capabilities */
428  RtlCopyMemory(IoStack->Parameters.DeviceCapabilities.Capabilities,
429  &FDODeviceExtension->Capabilities,
430  sizeof(DEVICE_CAPABILITIES));
431  Status = USBCCGP_SyncForwardIrp(FDODeviceExtension->NextDeviceObject, Irp);
432  if (NT_SUCCESS(Status))
433  {
434  /* Surprise removal ok */
435  IoStack->Parameters.DeviceCapabilities.Capabilities->SurpriseRemovalOK = TRUE;
436  }
437  break;
438  }
441  {
442  /* Sure */
443  Irp->IoStatus.Status = STATUS_SUCCESS;
444 
445  /* Forward irp to next device object */
447  return IoCallDriver(FDODeviceExtension->NextDeviceObject, Irp);
448  }
449  default:
450  {
451  /* Forward irp to next device object */
453  return IoCallDriver(FDODeviceExtension->NextDeviceObject, Irp);
454  }
455 
456  }
457 
458  /* Complete request */
459  Irp->IoStatus.Status = Status;
461  return Status;
462 }
463 
464 NTSTATUS
467  PIRP Irp)
468 {
469  PIO_STACK_LOCATION IoStack;
471  PFDO_DEVICE_EXTENSION FDODeviceExtension;
472  PLIST_ENTRY ListHead, Entry;
473  LIST_ENTRY TempList;
474  PUCHAR ResetActive;
475  PIRP ListIrp;
476  KIRQL OldLevel;
477 
478  /* Get device extension */
479  FDODeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
480  ASSERT(FDODeviceExtension->Common.IsFDO);
481 
482  /* Get stack location */
484  DPRINT("FDO_HandleResetCyclePort IOCTL %x\n", IoStack->Parameters.DeviceIoControl.IoControlCode);
485 
486  if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_INTERNAL_USB_RESET_PORT)
487  {
488  /* Use reset port list */
489  ListHead = &FDODeviceExtension->ResetPortListHead;
490  ResetActive = &FDODeviceExtension->ResetPortActive;
491  }
492  else
493  {
494  /* Use cycle port list */
495  ListHead = &FDODeviceExtension->CyclePortListHead;
496  ResetActive = &FDODeviceExtension->CyclePortActive;
497  }
498 
499  /* Acquire lock */
500  KeAcquireSpinLock(&FDODeviceExtension->Lock, &OldLevel);
501 
502  if (*ResetActive)
503  {
504  /* Insert into pending list */
505  InsertTailList(ListHead, &Irp->Tail.Overlay.ListEntry);
506 
507  /* Mark irp pending */
510 
511  /* Release lock */
512  KeReleaseSpinLock(&FDODeviceExtension->Lock, OldLevel);
513  }
514  else
515  {
516  /* Mark reset active */
517  *ResetActive = TRUE;
518 
519  /* Release lock */
520  KeReleaseSpinLock(&FDODeviceExtension->Lock, OldLevel);
521 
522  /* Forward request synchronized */
523  USBCCGP_SyncForwardIrp(FDODeviceExtension->NextDeviceObject, Irp);
524 
525  /* Reacquire lock */
526  KeAcquireSpinLock(&FDODeviceExtension->Lock, &OldLevel);
527 
528  /* Mark reset as completed */
529  *ResetActive = FALSE;
530 
531  /* Move all requests into temporary list */
532  InitializeListHead(&TempList);
533  while(!IsListEmpty(ListHead))
534  {
535  Entry = RemoveHeadList(ListHead);
536  InsertTailList(&TempList, Entry);
537  }
538 
539  /* Release lock */
540  KeReleaseSpinLock(&FDODeviceExtension->Lock, OldLevel);
541 
542  /* Complete pending irps */
543  while(!IsListEmpty(&TempList))
544  {
545  Entry = RemoveHeadList(&TempList);
546  ListIrp = (PIRP)CONTAINING_RECORD(Entry, IRP, Tail.Overlay.ListEntry);
547 
548  /* Complete request with status success */
549  ListIrp->IoStatus.Status = STATUS_SUCCESS;
551  }
552 
553  /* Status success */
555  }
556 
557  return Status;
558 }
559 
560 
561 
562 NTSTATUS
565  PIRP Irp)
566 {
567  PIO_STACK_LOCATION IoStack;
569  PFDO_DEVICE_EXTENSION FDODeviceExtension;
570 
571  /* Get device extension */
572  FDODeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
573  ASSERT(FDODeviceExtension->Common.IsFDO);
574 
575  /* Get stack location */
577 
578  if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_INTERNAL_USB_RESET_PORT ||
579  IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_INTERNAL_USB_CYCLE_PORT)
580  {
581  /* Handle reset / cycle ports */
583  DPRINT("FDO_HandleResetCyclePort Status %x\n", Status);
584  if (Status != STATUS_PENDING)
585  {
586  /* Complete request */
587  Irp->IoStatus.Status = Status;
589  }
590  return Status;
591  }
592 
593  /* Forward and forget request */
595  return IoCallDriver(FDODeviceExtension->NextDeviceObject, Irp);
596 }
597 
598 NTSTATUS
601  PIRP Irp)
602 {
603  PFDO_DEVICE_EXTENSION FDODeviceExtension;
604 
605  /* Get device extension */
606  FDODeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
607  ASSERT(FDODeviceExtension->Common.IsFDO);
608 
609  /* Forward and forget request */
611  return IoCallDriver(FDODeviceExtension->NextDeviceObject, Irp);
612 }
613 
614 NTSTATUS
617  PIRP Irp)
618 {
619  PIO_STACK_LOCATION IoStack;
621  PFDO_DEVICE_EXTENSION FDODeviceExtension;
622 
623  /* Get device extension */
624  FDODeviceExtension = DeviceObject->DeviceExtension;
625  ASSERT(FDODeviceExtension->Common.IsFDO);
626 
627  /* Get stack location */
629 
630  switch(IoStack->MajorFunction)
631  {
632  case IRP_MJ_PNP:
633  return FDO_HandlePnp(DeviceObject, Irp);
636  case IRP_MJ_POWER:
639  return PoCallDriver(FDODeviceExtension->NextDeviceObject, Irp);
642  default:
643  DPRINT1("FDO_Dispatch Function %x not implemented\n", IoStack->MajorFunction);
644  ASSERT(FALSE);
645  Status = Irp->IoStatus.Status;
647  return Status;
648  }
649 
650 }
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
#define IN
Definition: typedefs.h:38
#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:330
struct _Entry Entry
Definition: kefuncs.h:640
#define STATUS_MORE_PROCESSING_REQUIRED
Definition: shellext.h:63
NTSTATUS NTAPI PoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN OUT PIRP Irp)
Definition: power.c:485
_In_ PIRP Irp
Definition: csq.h:116
PDEVICE_OBJECT Objects[1]
Definition: iotypes.h:2054
unsigned char * PUCHAR
Definition: retypes.h:3
NTSTATUS FDO_HandleInternalDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: fdo.c:563
#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:1295
DEVICE_CAPABILITIES
Definition: iotypes.h:927
IRP
Definition: iotypes.h:2462
#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:515
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:434
struct _DEVICE_RELATIONS * PDEVICE_RELATIONS
NTSTATUS FDO_CreateChildPdo(IN PDEVICE_OBJECT DeviceObject)
Definition: fdo.c:168
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:55
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:615
#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
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define IRP_MJ_POWER
NTSTATUS FDO_HandleResetCyclePort(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: fdo.c:465
Definition: typedefs.h:117
__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:80
#define IRP_MJ_SYSTEM_CONTROL
* PDEVICE_CAPABILITIES
Definition: iotypes.h:927
Status
Definition: gdiplustypes.h:24
#define MAXULONG
Definition: typedefs.h:250
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1250
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:5090
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:626
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:243
#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:374
#define OUT
Definition: typedefs.h:39
#define ObReferenceObject
Definition: obfuncs.h:204
VOID NTAPI IoFreeIrp(IN PIRP Irp)
Definition: irp.c:1666
PVOID PIRP
Definition: usb.h:38
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:565
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:2771
PURB NTAPI USBD_CreateConfigurationRequestEx(PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, PUSBD_INTERFACE_LIST_ENTRY InterfaceList)
Definition: usbd.c:329
return STATUS_SUCCESS
Definition: btrfs.c:2777
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:599
#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