ReactOS  0.4.14-dev-358-gbef841c
roothub.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS USB Port Driver
3  * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * PURPOSE: USBPort root hub implementation
5  * COPYRIGHT: Copyright 2017 Vadim Galyant <vgal@rambler.ru>
6  */
7 
8 #include "usbport.h"
9 
10 #define NDEBUG
11 #include <debug.h>
12 
13 #define NDEBUG_USBPORT_CORE
14 #include "usbdebug.h"
15 
17 NTAPI
19 {
20  RHSTATUS RHStatus = RH_STATUS_SUCCESS;
21 
22  //DPRINT("USBPORT_MPStatusToRHStatus: MPStatus - %x\n", MPStatus);
23 
24  if (MPStatus)
25  {
26  RHStatus = (MPStatus != MP_STATUS_FAILURE);
27  ++RHStatus;
28  }
29 
30  return RHStatus;
31 }
32 
34 NTAPI
36  IN USHORT Port)
37 {
40  PDEVICE_RELATIONS CompanionControllersList;
41  PUSBPORT_REGISTRATION_PACKET CompanionPacket;
42  PDEVICE_OBJECT CompanionFdoDevice;
43  PUSBPORT_DEVICE_EXTENSION CompanionFdoExtension;
45  USHORT ix;
47  ULONG NumController = 0;
48 
49  DPRINT("USBPORT_RootHub_PowerUsb2Port: FdoDevice - %p, Port - %p\n",
50  FdoDevice,
51  Port);
52 
53  FdoExtension = FdoDevice->DeviceExtension;
54  Packet = &FdoExtension->MiniPortInterface->Packet;
55 
56  CompanionControllersList = USBPORT_FindCompanionControllers(FdoDevice,
57  FALSE,
58  TRUE);
59 
60  if (!CompanionControllersList)
61  {
62  Packet->RH_SetFeaturePortPower(FdoExtension->MiniPortExt, Port);
63  return MP_STATUS_SUCCESS;
64  }
65 
66  Entry = &CompanionControllersList->Objects[0];
67 
68  while (NumController < CompanionControllersList->Count)
69  {
70  CompanionFdoDevice = *Entry;
71 
72  CompanionFdoExtension = CompanionFdoDevice->DeviceExtension;
73  CompanionPacket = &CompanionFdoExtension->MiniPortInterface->Packet;
74 
75  PdoExtension = CompanionFdoExtension->RootHubPdo->DeviceExtension;
76 
77  for (ix = 0;
78  (PdoExtension->CommonExtension.PnpStateFlags & USBPORT_PNP_STATE_STARTED) &&
79  ix < PdoExtension->RootHubDescriptors->Descriptor.bNumberOfPorts;
80  ++ix)
81  {
82  CompanionPacket->RH_SetFeaturePortPower(CompanionFdoExtension->MiniPortExt,
83  ix + 1);
84  }
85 
86  ++NumController;
87  ++Entry;
88  }
89 
90  Packet->RH_SetFeaturePortPower(FdoExtension->MiniPortExt, Port);
91 
92  if (CompanionControllersList)
93  {
94  ExFreePoolWithTag(CompanionControllersList, USB_PORT_TAG);
95  }
96 
97  return MP_STATUS_SUCCESS;
98 }
99 
100 RHSTATUS
101 NTAPI
104  IN PVOID Buffer,
106 {
110  USHORT Port;
111  USHORT Feature;
112  MPSTATUS MPStatus;
113  RHSTATUS RHStatus = RH_STATUS_UNSUCCESSFUL;
114  KIRQL OldIrql;
115 
116  DPRINT("USBPORT_RootHubClassCommand: USB command - %x, *BufferLength - %x\n",
117  SetupPacket->bRequest,
118  *BufferLength);
119 
120  FdoExtension = FdoDevice->DeviceExtension;
121  PdoExtension = FdoExtension->RootHubPdo->DeviceExtension;
122  Packet = &FdoExtension->MiniPortInterface->Packet;
123 
124  Port = SetupPacket->wIndex.W;
125 
126  switch (SetupPacket->bRequest)
127  {
129  {
130  if (!Buffer)
131  {
132  return RHStatus;
133  }
134 
135  *(PULONG)Buffer = 0;
136 
137  if (SetupPacket->bmRequestType.Recipient == BMREQUEST_TO_OTHER)
138  {
139  ASSERT(*BufferLength >= 4);
140 
141  if (Port > PdoExtension->RootHubDescriptors->Descriptor.bNumberOfPorts ||
142  Port <= 0 ||
143  SetupPacket->wLength < 4)
144  {
145  return RHStatus;
146  }
147 
148  KeAcquireSpinLock(&FdoExtension->MiniportSpinLock, &OldIrql);
149 
150  MPStatus = Packet->RH_GetPortStatus(FdoExtension->MiniPortExt,
151  SetupPacket->wIndex.W,
152  Buffer);
153 
154  KeReleaseSpinLock(&FdoExtension->MiniportSpinLock, OldIrql);
155  }
156  else
157  {
158  KeAcquireSpinLock(&FdoExtension->MiniportSpinLock, &OldIrql);
159 
160  MPStatus = Packet->RH_GetHubStatus(FdoExtension->MiniPortExt,
161  Buffer);
162 
163  KeReleaseSpinLock(&FdoExtension->MiniportSpinLock, OldIrql);
164  }
165 
166  RHStatus = USBPORT_MPStatusToRHStatus(MPStatus);
167  break;
168  }
169 
171  Feature = SetupPacket->wValue.W;
172 
173  if ((SetupPacket->bmRequestType.Recipient) != USBPORT_RECIPIENT_PORT)
174  {
175  if (Feature == FEATURE_C_HUB_LOCAL_POWER)
176  {
177  RHStatus = RH_STATUS_SUCCESS;
178  return RHStatus;
179  }
180 
181  if (Feature == FEATURE_C_HUB_OVER_CURRENT)
182  {
183  MPStatus = Packet->RH_ClearFeaturePortOvercurrentChange(FdoExtension->MiniPortExt,
184  0);
185  RHStatus = USBPORT_MPStatusToRHStatus(MPStatus);
186  return RHStatus;
187  }
188 
189  DbgBreakPoint();
190  return RHStatus;
191  }
192 
193  switch (Feature)
194  {
195  case FEATURE_PORT_ENABLE:
196  MPStatus = Packet->RH_ClearFeaturePortEnable(FdoExtension->MiniPortExt,
197  Port);
198  break;
199 
201  MPStatus = Packet->RH_ClearFeaturePortSuspend(FdoExtension->MiniPortExt,
202  Port);
203  break;
204 
205  case FEATURE_PORT_POWER:
206  MPStatus = Packet->RH_ClearFeaturePortPower(FdoExtension->MiniPortExt,
207  Port);
208  break;
209 
211  MPStatus = Packet->RH_ClearFeaturePortConnectChange(FdoExtension->MiniPortExt,
212  Port);
213  break;
214 
216  MPStatus = Packet->RH_ClearFeaturePortEnableChange(FdoExtension->MiniPortExt,
217  Port);
218  break;
219 
221  MPStatus = Packet->RH_ClearFeaturePortSuspendChange(FdoExtension->MiniPortExt,
222  Port);
223  break;
224 
226  MPStatus = Packet->RH_ClearFeaturePortOvercurrentChange(FdoExtension->MiniPortExt,
227  Port);
228  break;
229 
231  MPStatus = Packet->RH_ClearFeaturePortResetChange(FdoExtension->MiniPortExt,
232  Port);
233  break;
234 
235  default:
236  DPRINT1("USBPORT_RootHubClassCommand: Not supported feature - %x\n",
237  Feature);
238  return RHStatus;
239  }
240 
241  RHStatus = USBPORT_MPStatusToRHStatus(MPStatus);
242  break;
243 
245  if (SetupPacket->bmRequestType.Recipient != USBPORT_RECIPIENT_PORT)
246  {
247  return RHStatus;
248  }
249 
250  Feature = SetupPacket->wValue.W;
251 
252  switch (Feature)
253  {
254  case FEATURE_PORT_ENABLE:
255  MPStatus = Packet->RH_SetFeaturePortEnable(FdoExtension->MiniPortExt,
256  Port);
257  break;
258 
260  MPStatus = Packet->RH_SetFeaturePortSuspend(FdoExtension->MiniPortExt,
261  Port);
262  break;
263 
264  case FEATURE_PORT_RESET:
265  MPStatus = Packet->RH_SetFeaturePortReset(FdoExtension->MiniPortExt,
266  Port);
267  break;
268 
269  case FEATURE_PORT_POWER:
270  if (Packet->MiniPortFlags & USB_MINIPORT_FLAGS_USB2)
271  {
272  MPStatus = USBPORT_RH_SetFeatureUSB2PortPower(FdoDevice, Port);
273  }
274  else
275  {
276  MPStatus = Packet->RH_SetFeaturePortPower(FdoExtension->MiniPortExt,
277  Port);
278  }
279 
280  break;
281 
282  default:
283  DPRINT1("USBPORT_RootHubClassCommand: Not supported feature - %x\n",
284  Feature);
285  return RHStatus;
286  }
287 
288  RHStatus = USBPORT_MPStatusToRHStatus(MPStatus);
289  break;
290 
292  if (Buffer &&
293  SetupPacket->wValue.W == 0 &&
294  SetupPacket->bmRequestType.Dir == BMREQUEST_DEVICE_TO_HOST)
295  {
296  SIZE_T DescriptorLength;
297 
298  DescriptorLength = PdoExtension->RootHubDescriptors->Descriptor.bDescriptorLength;
299 
300  if (*BufferLength < DescriptorLength)
301  DescriptorLength = *BufferLength;
302 
304  &PdoExtension->RootHubDescriptors->Descriptor,
305  DescriptorLength);
306 
307  *BufferLength = DescriptorLength;
308  RHStatus = RH_STATUS_SUCCESS;
309  }
310 
311  break;
312 
313  default:
314  DPRINT1("USBPORT_RootHubClassCommand: Not supported USB request - %x\n",
315  SetupPacket->bRequest);
316  //USB_REQUEST_SET_ADDRESS 0x05
317  //USB_REQUEST_SET_DESCRIPTOR 0x07
318  //USB_REQUEST_GET_CONFIGURATION 0x08
319  //USB_REQUEST_SET_CONFIGURATION 0x09
320  //USB_REQUEST_GET_INTERFACE 0x0A
321  //USB_REQUEST_SET_INTERFACE 0x0B
322  //USB_REQUEST_SYNC_FRAME 0x0C
323  break;
324  }
325 
326  return RHStatus;
327 }
328 
329 RHSTATUS
330 NTAPI
333  IN PVOID Buffer,
334  IN OUT PULONG TransferLength)
335 {
339  SIZE_T Length;
341  SIZE_T DescriptorLength;
342  MPSTATUS MPStatus;
343  RHSTATUS RHStatus = RH_STATUS_UNSUCCESSFUL;
344  KIRQL OldIrql;
345 
346  DPRINT("USBPORT_RootHubStandardCommand: USB command - %x, TransferLength - %p\n",
347  SetupPacket->bRequest,
348  TransferLength);
349 
350  FdoExtension = FdoDevice->DeviceExtension;
351  PdoExtension = FdoExtension->RootHubPdo->DeviceExtension;
352  Packet = &FdoExtension->MiniPortInterface->Packet;
353 
354  switch (SetupPacket->bRequest)
355  {
357  if (SetupPacket->wValue.LowByte ||
358  !(SetupPacket->bmRequestType.Dir))
359  {
360  return RHStatus;
361  }
362 
363  switch (SetupPacket->wValue.HiByte)
364  {
366  Descriptor = &PdoExtension->RootHubDescriptors->DeviceDescriptor;
367  DescriptorLength = sizeof(USB_DEVICE_DESCRIPTOR);
368  break;
369 
371  Descriptor = &PdoExtension->RootHubDescriptors->ConfigDescriptor;
372  DescriptorLength = sizeof(USB_CONFIGURATION_DESCRIPTOR) +
373  sizeof(USB_INTERFACE_DESCRIPTOR) +
374  sizeof(USB_ENDPOINT_DESCRIPTOR);
375  break;
376 
377  default:
378  DPRINT1("USBPORT_RootHubStandardCommand: Not supported Descriptor Type - %x\n",
379  SetupPacket->wValue.HiByte);
380  return RHStatus;
381  }
382 
383  if (!Descriptor)
384  {
385  return RHStatus;
386  }
387 
388  if (*TransferLength >= DescriptorLength)
389  Length = DescriptorLength;
390  else
391  Length = *TransferLength;
392 
394  *TransferLength = Length;
395 
396  RHStatus = RH_STATUS_SUCCESS;
397  break;
398 
400  if (!SetupPacket->wValue.W &&
401  SetupPacket->wLength == sizeof(USHORT) &&
402  !SetupPacket->wIndex.W &&
403  SetupPacket->bmRequestType.Dir == BMREQUEST_DEVICE_TO_HOST)
404  {
405  KeAcquireSpinLock(&FdoExtension->MiniportSpinLock, &OldIrql);
406 
407  MPStatus = Packet->RH_GetStatus(FdoExtension->MiniPortExt,
408  Buffer);
409 
410  KeReleaseSpinLock(&FdoExtension->MiniportSpinLock, OldIrql);
411 
412  *TransferLength = sizeof(USHORT);
413  RHStatus = USBPORT_MPStatusToRHStatus(MPStatus);
414  }
415 
416  break;
417 
419  if (SetupPacket->wValue.W ||
420  SetupPacket->wIndex.W ||
421  SetupPacket->wLength != 1 ||
422  SetupPacket->bmRequestType.Dir == BMREQUEST_HOST_TO_DEVICE)
423  {
424  return RHStatus;
425  }
426 
427  Length = 0;
428 
429  if (*TransferLength >= 1)
430  {
431  Length = 1;
432  RtlCopyMemory(Buffer, &PdoExtension->ConfigurationValue, Length);
433  }
434 
435  *TransferLength = Length;
436 
437  RHStatus = RH_STATUS_SUCCESS;
438  break;
439 
441  if (!SetupPacket->wIndex.W &&
442  !SetupPacket->wLength &&
443  !(SetupPacket->bmRequestType.Dir == BMREQUEST_DEVICE_TO_HOST))
444  {
445  if (SetupPacket->wValue.W == 0 ||
446  SetupPacket->wValue.W ==
447  PdoExtension->RootHubDescriptors->ConfigDescriptor.bConfigurationValue)
448  {
449  PdoExtension->ConfigurationValue = SetupPacket->wValue.LowByte;
450  RHStatus = RH_STATUS_SUCCESS;
451  }
452  }
453 
454  break;
455 
457  if (!SetupPacket->wIndex.W &&
458  !SetupPacket->wLength &&
459  !(SetupPacket->bmRequestType.Dir))
460  {
461  PdoExtension->DeviceHandle.DeviceAddress = SetupPacket->wValue.LowByte;
462  RHStatus = RH_STATUS_SUCCESS;
463  break;
464  }
465 
466  break;
467 
468  default:
469  DPRINT1("USBPORT_RootHubStandardCommand: Not supported USB request - %x\n",
470  SetupPacket->bRequest);
471  //USB_REQUEST_CLEAR_FEATURE 0x01
472  //USB_REQUEST_SET_FEATURE 0x03
473  //USB_REQUEST_SET_DESCRIPTOR 0x07
474  //USB_REQUEST_GET_INTERFACE 0x0A
475  //USB_REQUEST_SET_INTERFACE 0x0B
476  //USB_REQUEST_SYNC_FRAME 0x0C
477  break;
478  }
479 
480  return RHStatus;
481 }
482 
483 RHSTATUS
484 NTAPI
486 {
487  PDEVICE_OBJECT FdoDevice;
488  ULONG TransferLength;
489  PVOID Buffer;
490  PURB Urb;
491  PUSB_DEFAULT_PIPE_SETUP_PACKET SetupPacket;
492  UCHAR Type;
493  RHSTATUS RHStatus;
494 
495  DPRINT("USBPORT_RootHubEndpoint0: Transfer - %p\n", Transfer);
496 
497  TransferLength = Transfer->TransferParameters.TransferBufferLength;
498  Urb = Transfer->Urb;
499  FdoDevice = Transfer->Endpoint->FdoDevice;
500 
501  if (TransferLength > 0)
502  Buffer = Urb->UrbControlTransfer.TransferBufferMDL->MappedSystemVa;
503  else
504  Buffer = NULL;
505 
506  SetupPacket = (PUSB_DEFAULT_PIPE_SETUP_PACKET)Urb->UrbControlTransfer.SetupPacket;
507 
508  Type = SetupPacket->bmRequestType.Type;
509 
511  {
512  RHStatus = USBPORT_RootHubStandardCommand(FdoDevice,
513  SetupPacket,
514  Buffer,
515  &TransferLength);
516  }
517  else if (Type == BMREQUEST_CLASS)
518  {
519  RHStatus = USBPORT_RootHubClassCommand(FdoDevice,
520  SetupPacket,
521  Buffer,
522  &TransferLength);
523  }
524  else
525  {
526  return RH_STATUS_UNSUCCESSFUL;
527  }
528 
529  if (RHStatus == RH_STATUS_SUCCESS)
530  Transfer->CompletedTransferLen = TransferLength;
531 
532  return RHStatus;
533 }
534 
535 RHSTATUS
536 NTAPI
538 {
539  PUSBPORT_ENDPOINT Endpoint;
543  ULONG TransferLength;
545  USB_HUB_STATUS_AND_CHANGE HubStatus;
546  PVOID Buffer;
547  PULONG AddressBitMap;
548  ULONG Port;
549  PURB Urb;
550  RHSTATUS RHStatus = RH_STATUS_NO_CHANGES;
551  PUSB_HUB_DESCRIPTOR HubDescriptor;
553 
554  DPRINT("USBPORT_RootHubSCE: Transfer - %p\n", Transfer);
555 
556  Endpoint = Transfer->Endpoint;
557 
559  PdoExtension = FdoExtension->RootHubPdo->DeviceExtension;
560  Packet = &FdoExtension->MiniPortInterface->Packet;
561 
562  HubDescriptor = &PdoExtension->RootHubDescriptors->Descriptor;
563  NumberOfPorts = HubDescriptor->bNumberOfPorts;
564 
565  PortStatus.AsUlong32 = 0;
566  HubStatus.AsUlong32 = 0;
567 
568  Urb = Transfer->Urb;
569  TransferLength = Transfer->TransferParameters.TransferBufferLength;
570 
571  if (TransferLength)
572  {
573  Buffer = Urb->UrbControlTransfer.TransferBufferMDL->MappedSystemVa;
574  }
575  else
576  {
577  Buffer = NULL;
578  }
579 
580  /* Check parameters */
581 
582  if (!Buffer)
583  {
584  /* Not valid parameter */
585  DPRINT1("USBPORT_RootHubSCE: Error! Buffer is NULL\n");
586  return RH_STATUS_UNSUCCESSFUL;
587  }
588 
589  if ((TransferLength < (NumberOfPorts / 8 + 1)))
590  {
591  /* Not valid parameters */
592  DPRINT1("USBPORT_RootHubSCE: Error! TransferLength - %x, NumberOfPorts - %x\n",
593  TransferLength,
594  NumberOfPorts);
595 
596  return RH_STATUS_UNSUCCESSFUL;
597  }
598 
599  RtlZeroMemory(Buffer, TransferLength);
600 
601  AddressBitMap = Buffer;
602 
603  /* Scan all the ports for changes */
604  for (Port = 1; Port <= NumberOfPorts; Port++)
605  {
606  DPRINT_CORE("USBPORT_RootHubSCE: Port - %p\n", Port);
607 
608  /* Request the port status from miniport */
609  if (Packet->RH_GetPortStatus(FdoExtension->MiniPortExt,
610  Port,
611  &PortStatus))
612  {
613  /* Miniport returned an error */
614  DPRINT1("USBPORT_RootHubSCE: RH_GetPortStatus failed\n");
615  return RH_STATUS_UNSUCCESSFUL;
616  }
617 
618  if (PortStatus.PortChange.Usb20PortChange.ConnectStatusChange ||
619  PortStatus.PortChange.Usb20PortChange.PortEnableDisableChange ||
620  PortStatus.PortChange.Usb20PortChange.SuspendChange ||
621  PortStatus.PortChange.Usb20PortChange.OverCurrentIndicatorChange ||
622  PortStatus.PortChange.Usb20PortChange.ResetChange)
623  {
624  /* At the port status there is a change */
625  AddressBitMap[Port >> 5] |= 1 << (Port & 0x1F);
626  RHStatus = RH_STATUS_SUCCESS;
627  }
628  }
629 
630  /* Request the hub status from miniport */
631  if (!Packet->RH_GetHubStatus(FdoExtension->MiniPortExt, &HubStatus))
632  {
633  if (HubStatus.HubChange.LocalPowerChange == 1 ||
634  HubStatus.HubChange.OverCurrentChange == 1)
635  {
636  /* At the hub status there is a change */
637  AddressBitMap[0] |= 1;
638  RHStatus = RH_STATUS_SUCCESS;
639  }
640 
641  if (RHStatus == RH_STATUS_SUCCESS)
642  {
643  /* Done */
644  Urb->UrbControlTransfer.TransferBufferLength = TransferLength;
645  return RH_STATUS_SUCCESS;
646  }
647 
648  if (RHStatus == RH_STATUS_NO_CHANGES)
649  {
650  /* No changes. Enable IRQs for miniport root hub */
651  Packet->RH_EnableIrq(FdoExtension->MiniPortExt);
652  }
653 
654  return RHStatus;
655  }
656 
657  /* Miniport returned an error */
658  DPRINT1("USBPORT_RootHubSCE: RH_GetHubStatus failed\n");
659  return RH_STATUS_UNSUCCESSFUL;
660 }
661 
662 VOID
663 NTAPI
665 {
666  PDEVICE_OBJECT FdoDevice;
669  PUSBPORT_TRANSFER Transfer;
670  RHSTATUS RHStatus;
671  USBD_STATUS USBDStatus;
672  KIRQL OldIrql;
673 
674  DPRINT_CORE("USBPORT_RootHubEndpointWorker: Endpoint - %p\n", Endpoint);
675 
676  FdoDevice = Endpoint->FdoDevice;
677  FdoExtension = FdoDevice->DeviceExtension;
678  Packet = &FdoExtension->MiniPortInterface->Packet;
679 
680  KeAcquireSpinLock(&FdoExtension->MiniportSpinLock, &OldIrql);
681  if (!(FdoExtension->Flags & USBPORT_FLAG_HC_SUSPEND))
682  {
683  Packet->CheckController(FdoExtension->MiniPortExt);
684  }
685  KeReleaseSpinLock(&FdoExtension->MiniportSpinLock, OldIrql);
686 
687  KeAcquireSpinLock(&Endpoint->EndpointSpinLock, &Endpoint->EndpointOldIrql);
688 
689  Transfer = CONTAINING_RECORD(Endpoint->TransferList.Flink,
691  TransferLink);
692 
693  if (IsListEmpty(&Endpoint->TransferList) ||
694  Endpoint->TransferList.Flink == NULL ||
695  !Transfer)
696  {
697  if (Endpoint->StateLast == USBPORT_ENDPOINT_REMOVE)
698  {
699  ExInterlockedInsertTailList(&FdoExtension->EndpointClosedList,
700  &Endpoint->CloseLink,
701  &FdoExtension->EndpointClosedSpinLock);
702  }
703 
704  KeReleaseSpinLock(&Endpoint->EndpointSpinLock, Endpoint->EndpointOldIrql);
705 
706  USBPORT_FlushCancelList(Endpoint);
707  return;
708  }
709 
711  {
712  RemoveEntryList(&Transfer->TransferLink);
713  InsertTailList(&Endpoint->CancelList, &Transfer->TransferLink);
714 
715  KeReleaseSpinLock(&Endpoint->EndpointSpinLock, Endpoint->EndpointOldIrql);
716  USBPORT_FlushCancelList(Endpoint);
717  return;
718  }
719 
720  KeReleaseSpinLock(&Endpoint->EndpointSpinLock, Endpoint->EndpointOldIrql);
721 
722  if (Endpoint->EndpointProperties.TransferType == USBPORT_TRANSFER_TYPE_CONTROL)
723  RHStatus = USBPORT_RootHubEndpoint0(Transfer);
724  else
725  RHStatus = USBPORT_RootHubSCE(Transfer);
726 
727  if (RHStatus != RH_STATUS_NO_CHANGES)
728  {
729  if (RHStatus == RH_STATUS_SUCCESS)
730  USBDStatus = USBD_STATUS_SUCCESS;
731  else
732  USBDStatus = USBD_STATUS_STALL_PID;
733 
734  KeAcquireSpinLock(&Endpoint->EndpointSpinLock, &Endpoint->EndpointOldIrql);
735  USBPORT_QueueDoneTransfer(Transfer, USBDStatus);
736  KeReleaseSpinLock(&Endpoint->EndpointSpinLock, Endpoint->EndpointOldIrql);
737 
738  USBPORT_FlushCancelList(Endpoint);
739  return;
740  }
741 
742  USBPORT_FlushCancelList(Endpoint);
743 }
744 
745 NTSTATUS
746 NTAPI
748  IN PDEVICE_OBJECT PdoDevice)
749 {
754  USBPORT_ROOT_HUB_DATA RootHubData;
755  ULONG NumMaskByte;
756  ULONG DescriptorsLength;
757  PUSBPORT_RH_DESCRIPTORS Descriptors;
758  PUSB_DEVICE_DESCRIPTOR RH_DeviceDescriptor;
759  PUSB_CONFIGURATION_DESCRIPTOR RH_ConfigurationDescriptor;
760  PUSB_INTERFACE_DESCRIPTOR RH_InterfaceDescriptor;
761  PUSB_ENDPOINT_DESCRIPTOR RH_EndPointDescriptor;
762  PUSB_HUB_DESCRIPTOR RH_HubDescriptor;
763  ULONG ix;
764  PUSB_ENDPOINT_DESCRIPTOR EndpointDescriptor;
766 
767  DPRINT("USBPORT_RootHubCreateDevice: FdoDevice - %p, PdoDevice - %p\n",
768  FdoDevice,
769  PdoDevice);
770 
771  FdoExtension = FdoDevice->DeviceExtension;
772  PdoExtension = PdoDevice->DeviceExtension;
773  Packet = &FdoExtension->MiniPortInterface->Packet;
774 
775  DeviceHandle = &PdoExtension->DeviceHandle;
777 
778  InitializeListHead(&DeviceHandle->PipeHandleList);
779 
780  DeviceHandle->IsRootHub = TRUE;
781  DeviceHandle->DeviceSpeed = UsbFullSpeed;
783 
784  RtlZeroMemory(&RootHubData, sizeof(RootHubData));
785 
786  Packet->RH_GetRootHubData(FdoExtension->MiniPortExt, &RootHubData);
787 
788  ASSERT(RootHubData.NumberOfPorts != 0);
789  NumMaskByte = (RootHubData.NumberOfPorts - 1) / 8 + 1;
790 
791  DescriptorsLength = sizeof(USB_DEVICE_DESCRIPTOR) +
793  sizeof(USB_INTERFACE_DESCRIPTOR) +
794  sizeof(USB_ENDPOINT_DESCRIPTOR) +
795  (sizeof(USB_HUB_DESCRIPTOR) + 2 * NumMaskByte);
796 
797  Descriptors = ExAllocatePoolWithTag(NonPagedPool,
798  DescriptorsLength,
799  USB_PORT_TAG);
800 
801  if (Descriptors)
802  {
803  RtlZeroMemory(Descriptors, DescriptorsLength);
804 
805  PdoExtension->RootHubDescriptors = Descriptors;
806 
807  RH_DeviceDescriptor = &PdoExtension->RootHubDescriptors->DeviceDescriptor;
808 
809  RH_DeviceDescriptor->bLength = sizeof(USB_DEVICE_DESCRIPTOR);
810  RH_DeviceDescriptor->bDescriptorType = USB_DEVICE_DESCRIPTOR_TYPE;
811  RH_DeviceDescriptor->bcdUSB = 0x100;
812  RH_DeviceDescriptor->bDeviceClass = USB_DEVICE_CLASS_HUB;
813  RH_DeviceDescriptor->bDeviceSubClass = 0x01;
814  RH_DeviceDescriptor->bDeviceProtocol = 0x00;
815  RH_DeviceDescriptor->bMaxPacketSize0 = 0x08;
816  RH_DeviceDescriptor->idVendor = FdoExtension->VendorID;
817  RH_DeviceDescriptor->idProduct = FdoExtension->DeviceID;
818  RH_DeviceDescriptor->bcdDevice = FdoExtension->RevisionID;
819  RH_DeviceDescriptor->iManufacturer = 0x00;
820  RH_DeviceDescriptor->iProduct = 0x00;
821  RH_DeviceDescriptor->iSerialNumber = 0x00;
822  RH_DeviceDescriptor->bNumConfigurations = 0x01;
823 
824  RH_ConfigurationDescriptor = &PdoExtension->RootHubDescriptors->ConfigDescriptor;
825 
826  RH_ConfigurationDescriptor->bLength = sizeof(USB_CONFIGURATION_DESCRIPTOR);
827  RH_ConfigurationDescriptor->bDescriptorType = USB_CONFIGURATION_DESCRIPTOR_TYPE;
828 
829  RH_ConfigurationDescriptor->wTotalLength = sizeof(USB_CONFIGURATION_DESCRIPTOR) +
830  sizeof(USB_INTERFACE_DESCRIPTOR) +
831  sizeof(USB_ENDPOINT_DESCRIPTOR);
832 
833  RH_ConfigurationDescriptor->bNumInterfaces = 0x01;
834  RH_ConfigurationDescriptor->bConfigurationValue = 0x01;
835  RH_ConfigurationDescriptor->iConfiguration = 0x00;
836  RH_ConfigurationDescriptor->bmAttributes = USB_CONFIG_SELF_POWERED;
837  RH_ConfigurationDescriptor->MaxPower = 0x00;
838 
839  RH_InterfaceDescriptor = &PdoExtension->RootHubDescriptors->InterfaceDescriptor;
840 
841  RH_InterfaceDescriptor->bLength = sizeof(USB_INTERFACE_DESCRIPTOR);
842  RH_InterfaceDescriptor->bDescriptorType = USB_INTERFACE_DESCRIPTOR_TYPE;
843  RH_InterfaceDescriptor->bInterfaceNumber = 0x00;
844  RH_InterfaceDescriptor->bAlternateSetting = 0x00;
845  RH_InterfaceDescriptor->bNumEndpoints = 0x01;
846  RH_InterfaceDescriptor->bInterfaceClass = USB_DEVICE_CLASS_HUB;
847  RH_InterfaceDescriptor->bInterfaceSubClass = 0x01;
848  RH_InterfaceDescriptor->bInterfaceProtocol = 0x00;
849  RH_InterfaceDescriptor->iInterface = 0x00;
850 
851  RH_EndPointDescriptor = &PdoExtension->RootHubDescriptors->EndPointDescriptor;
852 
853  RH_EndPointDescriptor->bLength = sizeof(USB_ENDPOINT_DESCRIPTOR);
854  RH_EndPointDescriptor->bDescriptorType = USB_ENDPOINT_DESCRIPTOR_TYPE;
855  RH_EndPointDescriptor->bEndpointAddress = 0x81;
856  RH_EndPointDescriptor->bmAttributes = USB_ENDPOINT_TYPE_INTERRUPT; // SCE endpoint
857  RH_EndPointDescriptor->wMaxPacketSize = 0x0008;
858  RH_EndPointDescriptor->bInterval = 0x0C; // 12 msec
859 
860  RH_HubDescriptor = &PdoExtension->RootHubDescriptors->Descriptor;
861 
862  RH_HubDescriptor->bDescriptorLength = FIELD_OFFSET(USB_HUB_DESCRIPTOR, bRemoveAndPowerMask) + 2 * NumMaskByte;
863 
864  if (Packet->MiniPortVersion == USB_MINIPORT_VERSION_OHCI ||
865  Packet->MiniPortVersion == USB_MINIPORT_VERSION_UHCI ||
866  Packet->MiniPortVersion == USB_MINIPORT_VERSION_EHCI)
867  {
868  RH_HubDescriptor->bDescriptorType = USB_20_HUB_DESCRIPTOR_TYPE;
869  }
870  else if (Packet->MiniPortVersion == USB_MINIPORT_VERSION_XHCI)
871  {
872  RH_HubDescriptor->bDescriptorType = USB_30_HUB_DESCRIPTOR_TYPE;
873  }
874  else
875  {
876  DPRINT1("USBPORT_RootHubCreateDevice: Unknown MiniPortVersion - %x\n",
877  Packet->MiniPortVersion);
878 
879  DbgBreakPoint();
880  }
881 
882  RH_HubDescriptor->bNumberOfPorts = RootHubData.NumberOfPorts;
883  RH_HubDescriptor->wHubCharacteristics = RootHubData.HubCharacteristics.AsUSHORT;
884  RH_HubDescriptor->bPowerOnToPowerGood = RootHubData.PowerOnToPowerGood;
885  RH_HubDescriptor->bHubControlCurrent = RootHubData.HubControlCurrent;
886 
887  for (ix = 0; ix < NumMaskByte; ix += 2)
888  {
889  RH_HubDescriptor->bRemoveAndPowerMask[ix] = 0;
890  RH_HubDescriptor->bRemoveAndPowerMask[ix + 1] = -1;
891  }
892 
893  EndpointDescriptor = &DeviceHandle->PipeHandle.EndpointDescriptor;
894 
895  EndpointDescriptor->bLength = sizeof(USB_ENDPOINT_DESCRIPTOR);
896  EndpointDescriptor->bDescriptorType = USB_ENDPOINT_DESCRIPTOR_TYPE;
897  EndpointDescriptor->bEndpointAddress = 0x00;
898  EndpointDescriptor->bmAttributes = USB_ENDPOINT_TYPE_CONTROL;
899  EndpointDescriptor->wMaxPacketSize = 0x0040;
900  EndpointDescriptor->bInterval = 0x00;
901 
902  Status = USBPORT_OpenPipe(FdoDevice,
903  DeviceHandle,
904  &DeviceHandle->PipeHandle,
905  NULL);
906  }
907  else
908  {
910  }
911 
912  return Status;
913 }
914 
915 ULONG
916 NTAPI
918 {
920  PDEVICE_OBJECT FdoDevice;
921  PDEVICE_OBJECT PdoDevice;
923  PUSBPORT_ENDPOINT Endpoint = NULL;
924 
925  DPRINT("USBPORT_InvalidateRootHub ... \n");
926 
927  FdoExtension = (PUSBPORT_DEVICE_EXTENSION)((ULONG_PTR)MiniPortExtension -
928  sizeof(USBPORT_DEVICE_EXTENSION));
929 
930  FdoDevice = FdoExtension->CommonExtension.SelfDevice;
931 
932  if (FdoExtension->Flags & USBPORT_FLAG_HC_SUSPEND &&
934  FdoExtension->MiniPortFlags & USBPORT_MPFLAG_SUSPENDED &&
935  FdoExtension->TimerFlags & USBPORT_TMFLAG_WAKE)
936  {
937  USBPORT_HcQueueWakeDpc(FdoDevice);
938  return 0;
939  }
940 
941  FdoExtension->MiniPortInterface->Packet.RH_DisableIrq(FdoExtension->MiniPortExt);
942 
943  PdoDevice = FdoExtension->RootHubPdo;
944 
945  if (PdoDevice)
946  {
947  PdoExtension = PdoDevice->DeviceExtension;
948  Endpoint = PdoExtension->Endpoint;
949 
950  if (Endpoint)
951  {
953  PdoExtension->Endpoint,
955  }
956  }
957 
958  return 0;
959 }
960 
961 VOID
962 NTAPI
964 {
967  USBPORT_ROOT_HUB_DATA RootHubData;
968  ULONG Port;
969  PDEVICE_RELATIONS CompanionControllersList;
970  PUSBPORT_DEVICE_EXTENSION CompanionFdoExtension;
971  PUSBPORT_REGISTRATION_PACKET CompanionPacket;
972  ULONG CompanionPorts;
973  ULONG NumController;
975  ULONG NumPorts;
976 
977  DPRINT("USBPORT_RootHub_PowerAndChirpAllCcPorts: FdoDevice - %p\n",
978  FdoDevice);
979 
980  FdoExtension = FdoDevice->DeviceExtension;
981 
982  Packet = &FdoExtension->MiniPortInterface->Packet;
983 
984  RtlZeroMemory(&RootHubData, sizeof(RootHubData));
985 
986  Packet->RH_GetRootHubData(FdoExtension->MiniPortExt,
987  &RootHubData);
988 
989  NumPorts = RootHubData.NumberOfPorts;
990 
991  for (Port = 1; Port <= NumPorts; ++Port)
992  {
993  Packet->RH_SetFeaturePortPower(FdoExtension->MiniPortExt, Port);
994  }
995 
996  USBPORT_Wait(FdoDevice, 10);
997 
998  CompanionControllersList = USBPORT_FindCompanionControllers(FdoDevice,
999  FALSE,
1000  TRUE);
1001 
1002  if (CompanionControllersList)
1003  {
1004  Entry = &CompanionControllersList->Objects[0];
1005 
1006  for (NumController = 0;
1007  NumController < CompanionControllersList->Count;
1008  NumController++)
1009  {
1010  CompanionPacket = &FdoExtension->MiniPortInterface->Packet;
1011 
1012  CompanionFdoExtension = (*Entry)->DeviceExtension;
1013 
1014  CompanionPacket->RH_GetRootHubData(CompanionFdoExtension->MiniPortExt,
1015  &RootHubData);
1016 
1017  CompanionPorts = RootHubData.NumberOfPorts;
1018 
1019  for (Port = 1; Port <= CompanionPorts; ++Port)
1020  {
1021  CompanionPacket->RH_SetFeaturePortPower(CompanionFdoExtension->MiniPortExt,
1022  Port);
1023  }
1024 
1025  ++Entry;
1026  }
1027 
1028  ExFreePoolWithTag(CompanionControllersList, USB_PORT_TAG);
1029  }
1030 
1031  USBPORT_Wait(FdoDevice, 100);
1032 
1033  for (Port = 1; Port <= NumPorts; ++Port)
1034  {
1035  if (FdoExtension->MiniPortInterface->Version < 200)
1036  {
1037  break;
1038  }
1039 
1040  InterlockedIncrement((PLONG)&FdoExtension->ChirpRootPortLock);
1041  Packet->RH_ChirpRootPort(FdoExtension->MiniPortExt, Port);
1042  InterlockedDecrement((PLONG)&FdoExtension->ChirpRootPortLock);
1043  }
1044 }
#define TRANSFER_FLAG_CANCELED
Definition: usbport.h:129
ULONG MPSTATUS
Definition: usbmport.h:131
#define FEATURE_PORT_RESET
Definition: usbport.h:52
struct _USB_DEVICE_DESCRIPTOR USB_DEVICE_DESCRIPTOR
#define USB_MINIPORT_VERSION_EHCI
Definition: usbmport.h:528
#define DPRINT_CORE(...)
Definition: usbdebug.h:144
CPPORT Port[4]
Definition: headless.c:34
#define IN
Definition: typedefs.h:38
UCHAR bDescriptorLength
Definition: usb100.h:171
RHSTATUS NTAPI USBPORT_RootHubClassCommand(IN PDEVICE_OBJECT FdoDevice, IN PUSB_DEFAULT_PIPE_SETUP_PACKET SetupPacket, IN PVOID Buffer, IN PULONG BufferLength)
Definition: roothub.c:102
VOID NTAPI USBPORT_HcQueueWakeDpc(IN PDEVICE_OBJECT FdoDevice)
Definition: power.c:63
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Inout_ PUSB_DEVICE_HANDLE DeviceHandle
Definition: hubbusif.h:121
#define FEATURE_C_PORT_ENABLE
Definition: usbport.h:56
#define RH_STATUS_SUCCESS
Definition: usbmport.h:144
Type
Definition: Type.h:6
_In_ NDIS_HANDLE _In_ PNDIS_PACKET Packet
Definition: ndis.h:1548
struct _Entry Entry
Definition: kefuncs.h:640
VOID NTAPI USBPORT_RootHubEndpointWorker(IN PUSBPORT_ENDPOINT Endpoint)
Definition: roothub.c:664
#define USB_REQUEST_SET_ADDRESS
Definition: usb100.h:81
#define USBPORT_TMFLAG_WAKE
Definition: usbport.h:97
#define FEATURE_C_PORT_OVER_CURRENT
Definition: usbport.h:58
PHCI_RH_SET_FEATURE_PORT_POWER RH_SetFeaturePortPower
Definition: usbmport.h:590
PDEVICE_OBJECT Objects[1]
Definition: iotypes.h:2055
PLIST_ENTRY NTAPI ExInterlockedInsertTailList(IN OUT PLIST_ENTRY ListHead, IN OUT PLIST_ENTRY ListEntry, IN OUT PKSPIN_LOCK Lock)
Definition: interlocked.c:140
#define USB_CONFIG_SELF_POWERED
Definition: usb100.h:70
NTSTATUS NTAPI USBPORT_RootHubCreateDevice(IN PDEVICE_OBJECT FdoDevice, IN PDEVICE_OBJECT PdoDevice)
Definition: roothub.c:747
LONG NTSTATUS
Definition: precomp.h:26
ULONG RHSTATUS
Definition: usbmport.h:132
USBPORT_REGISTRATION_PACKET Packet
Definition: usbmport.h:644
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
#define BMREQUEST_HOST_TO_DEVICE
Definition: usb100.h:31
#define USB_ENDPOINT_TYPE_CONTROL
Definition: usb100.h:62
#define USBPORT_TRANSFER_TYPE_CONTROL
Definition: usbmport.h:8
RHSTATUS NTAPI USBPORT_RootHubStandardCommand(IN PDEVICE_OBJECT FdoDevice, IN PUSB_DEFAULT_PIPE_SETUP_PACKET SetupPacket, IN PVOID Buffer, IN OUT PULONG TransferLength)
Definition: roothub.c:331
#define FEATURE_PORT_ENABLE
Definition: usbport.h:49
PHCI_RH_GET_ROOT_HUB_DATA RH_GetRootHubData
Definition: usbmport.h:585
#define InsertTailList(ListHead, Entry)
struct _USB_HUB_DESCRIPTOR USB_HUB_DESCRIPTOR
void DbgBreakPoint()
Definition: mach.c:553
#define USB_REQUEST_GET_CONFIGURATION
Definition: usb100.h:84
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
#define USBPORT_FLAG_HC_WAKE_SUPPORT
Definition: usbport.h:75
USHORT LocalPowerChange
Definition: usb200.h:261
USHORT OverCurrentChange
Definition: usb200.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:63
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
#define USB_PORT_TAG
Definition: usbport.h:44
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define USB_20_HUB_DESCRIPTOR_TYPE
Definition: usb200.h:279
USHORT wHubCharacteristics
Definition: usb100.h:174
NTSTATUS NTAPI USBPORT_Wait(IN PVOID MiniPortExtension, IN ULONG Milliseconds)
Definition: usbport.c:543
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define USB_DEVICE_DESCRIPTOR_TYPE
Definition: usb100.h:49
#define FEATURE_C_HUB_OVER_CURRENT
Definition: usbport.h:63
#define USB_MINIPORT_FLAGS_USB2
Definition: usbmport.h:534
PDEVICE_OBJECT FdoDevice
Definition: usbport.h:205
_In_ ULONG BufferLength
Definition: usbdlib.h:225
USBPORT_HUB_CHARACTERISTICS HubCharacteristics
Definition: usbmport.h:697
#define BMREQUEST_DEVICE_TO_HOST
Definition: usb100.h:32
struct _USBPORT_DEVICE_EXTENSION USBPORT_DEVICE_EXTENSION
#define USB_CONFIGURATION_DESCRIPTOR_TYPE
Definition: usb100.h:50
struct _USB_INTERFACE_DESCRIPTOR USB_INTERFACE_DESCRIPTOR
#define USB_MINIPORT_VERSION_UHCI
Definition: usbmport.h:527
PVOID DeviceExtension
Definition: env_spec_w32.h:418
#define USB_INTERFACE_DESCRIPTOR_TYPE
Definition: usb100.h:52
smooth NULL
Definition: ftsmooth.c:416
PUSBPORT_MINIPORT_INTERFACE MiniPortInterface
Definition: usbport.h:306
UCHAR bPowerOnToPowerGood
Definition: usb100.h:175
void DPRINT(...)
Definition: polytest.cpp:61
PDEVICE_OBJECT RootHubPdo
Definition: usbport.h:293
#define BMREQUEST_TO_OTHER
Definition: usb100.h:41
Definition: bufpool.h:45
#define RH_STATUS_UNSUCCESSFUL
Definition: usbmport.h:146
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
RHSTATUS NTAPI USBPORT_RootHubEndpoint0(IN PUSBPORT_TRANSFER Transfer)
Definition: roothub.c:485
VOID NTAPI USBPORT_RootHubPowerAndChirpAllCcPorts(IN PDEVICE_OBJECT FdoDevice)
Definition: roothub.c:963
#define USB_REQUEST_SET_CONFIGURATION
Definition: usb100.h:85
NTSTATUS NTAPI USBPORT_OpenPipe(IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_DEVICE_HANDLE DeviceHandle, IN PUSBPORT_PIPE_HANDLE PipeHandle, IN OUT PUSBD_STATUS UsbdStatus)
Definition: endpoint.c:763
#define MP_STATUS_FAILURE
Definition: usbmport.h:135
LIST_ENTRY TransferLink
Definition: usbport.h:256
_In_ UINT _In_ UINT NumberOfPorts
Definition: ndis.h:5443
ULONG NTAPI USBPORT_InvalidateRootHub(PVOID MiniPortExtension)
Definition: roothub.c:917
UCHAR bNumConfigurations
Definition: usb100.h:124
#define FEATURE_C_HUB_LOCAL_POWER
Definition: usbport.h:62
UCHAR bNumberOfPorts
Definition: usb100.h:173
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define USBPORT_ENDPOINT_REMOVE
Definition: usbmport.h:16
#define USB_REQUEST_CLEAR_FEATURE
Definition: usb100.h:79
VOID NTAPI USBPORT_AddDeviceHandle(IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_DEVICE_HANDLE DeviceHandle)
Definition: device.c:769
UCHAR bRemoveAndPowerMask[64]
Definition: usb100.h:177
struct _URB_CONTROL_TRANSFER UrbControlTransfer
Definition: usb.h:539
#define FEATURE_PORT_SUSPEND
Definition: usbport.h:50
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
struct _USB_ENDPOINT_DESCRIPTOR USB_ENDPOINT_DESCRIPTOR
#define DEVICE_HANDLE_FLAG_ROOTHUB
Definition: usbport.h:105
USB_HUB_CHANGE HubChange
Definition: usb200.h:273
struct _USBPORT_DEVICE_EXTENSION * PUSBPORT_DEVICE_EXTENSION
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define FEATURE_C_PORT_SUSPEND
Definition: usbport.h:57
UCHAR bHubControlCurrent
Definition: usb100.h:176
#define TRANSFER_FLAG_ABORTED
Definition: usbport.h:133
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define USB_REQUEST_GET_DESCRIPTOR
Definition: usb100.h:82
#define USBD_STATUS_SUCCESS
Definition: usb.h:170
unsigned char UCHAR
Definition: xmlstorage.h:181
#define BMREQUEST_CLASS
Definition: usb100.h:35
#define InterlockedDecrement
Definition: armddk.h:52
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
LONG USBD_STATUS
Definition: usb.h:165
#define USB_ENDPOINT_DESCRIPTOR_TYPE
Definition: usb100.h:53
#define USB_30_HUB_DESCRIPTOR_TYPE
Definition: usb200.h:280
_Outptr_ PUSB_DEVICE_HANDLE _In_ PUSB_DEVICE_HANDLE _In_ USHORT PortStatus
Definition: hubbusif.h:40
#define USBD_STATUS_STALL_PID
Definition: usb.h:175
struct _USB_CONFIGURATION_DESCRIPTOR USB_CONFIGURATION_DESCRIPTOR
Status
Definition: gdiplustypes.h:24
#define BMREQUEST_STANDARD
Definition: usb100.h:34
#define USB_MINIPORT_VERSION_XHCI
Definition: usbmport.h:529
PDEVICE_RELATIONS NTAPI USBPORT_FindCompanionControllers(IN PDEVICE_OBJECT USB2FdoDevice, IN BOOLEAN IsObRefer, IN BOOLEAN IsFDOsReturned)
Definition: usbport.c:136
#define USBPORT_FLAG_HC_SUSPEND
Definition: usbport.h:70
ULONG_PTR SIZE_T
Definition: typedefs.h:78
#define USB_REQUEST_GET_STATUS
Definition: usb100.h:78
#define InterlockedIncrement
Definition: armddk.h:53
RHSTATUS NTAPI USBPORT_MPStatusToRHStatus(IN MPSTATUS MPStatus)
Definition: roothub.c:18
Definition: usb.h:529
#define RH_STATUS_NO_CHANGES
Definition: usbmport.h:145
#define FEATURE_C_PORT_CONNECTION
Definition: usbport.h:55
unsigned short USHORT
Definition: pedump.c:61
#define FEATURE_PORT_POWER
Definition: usbport.h:53
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
BOOLEAN NTAPI USBPORT_QueueDoneTransfer(IN PUSBPORT_TRANSFER Transfer, IN USBD_STATUS USBDStatus)
Definition: usbport.c:839
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
#define USB_REQUEST_SET_FEATURE
Definition: usb100.h:80
unsigned int * PULONG
Definition: retypes.h:1
#define MP_STATUS_SUCCESS
Definition: usbmport.h:134
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
struct _USB_DEFAULT_PIPE_SETUP_PACKET * PUSB_DEFAULT_PIPE_SETUP_PACKET
#define USBPORT_RECIPIENT_PORT
Definition: usbport.h:34
#define DPRINT1
Definition: precomp.h:8
#define USB_DEVICE_CLASS_HUB
Definition: usb100.h:99
#define OUT
Definition: typedefs.h:39
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define INVALIDATE_ENDPOINT_WORKER_THREAD
Definition: usbport.h:37
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define USBPORT_MPFLAG_SUSPENDED
Definition: usbport.h:102
#define USB_MINIPORT_VERSION_OHCI
Definition: usbmport.h:526
MPSTATUS NTAPI USBPORT_RH_SetFeatureUSB2PortPower(IN PDEVICE_OBJECT FdoDevice, IN USHORT Port)
Definition: roothub.c:35
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
VOID NTAPI USBPORT_InvalidateEndpointHandler(IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_ENDPOINT Endpoint, IN ULONG Type)
Definition: endpoint.c:1317
BM_REQUEST_TYPE bmRequestType
Definition: usb200.h:72
signed int * PLONG
Definition: retypes.h:5
#define USBPORT_PNP_STATE_STARTED
Definition: usbport.h:87
VOID NTAPI USBPORT_FlushCancelList(IN PUSBPORT_ENDPOINT Endpoint)
Definition: queue.c:714
base of all file and directory entries
Definition: entries.h:82
RHSTATUS NTAPI USBPORT_RootHubSCE(IN PUSBPORT_TRANSFER Transfer)
Definition: roothub.c:537
UCHAR bDescriptorType
Definition: usb100.h:172
#define FEATURE_C_PORT_RESET
Definition: usbport.h:59
#define USB_ENDPOINT_TYPE_INTERRUPT
Definition: usb100.h:65
_In_ PSTORAGE_PROPERTY_ID _Outptr_ PSTORAGE_DESCRIPTOR_HEADER * Descriptor
Definition: classpnp.h:966