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/usbehci/usbiffn.c
5 * PURPOSE: Direct Call Interface Functions.
7 * Michael Martin (michael.martin@reactos.org)
15 PVOID
InternalCreateUsbDevice(UCHAR DeviceNumber
, ULONG Port
, PUSB_DEVICE Parent
, BOOLEAN Hub
)
17 PUSB_DEVICE UsbDevicePointer
= NULL
;
19 UsbDevicePointer
= ExAllocatePoolWithTag(NonPagedPool
, sizeof(USB_DEVICE
), USB_POOL_TAG
);
21 if (!UsbDevicePointer
)
23 DPRINT1("Out of memory\n");
27 RtlZeroMemory(UsbDevicePointer
, sizeof(USB_DEVICE
));
29 if ((Hub
) && (!Parent
))
31 DPRINT1("This is the root hub\n");
34 UsbDevicePointer
->Address
= 0;//DeviceNumber;
35 UsbDevicePointer
->Port
= Port
- 1;
36 UsbDevicePointer
->ParentDevice
= Parent
;
38 UsbDevicePointer
->IsHub
= Hub
;
40 return UsbDevicePointer
;
45 InterfaceReference(PVOID BusContext
)
47 DPRINT1("Ehci: InterfaceReference called\n");
52 InterfaceDereference(PVOID BusContext
)
54 DPRINT1("Ehci: InterfaceDereference called\n");
57 /* Bus Interface Hub V5 Functions */
62 CreateUsbDevice(PVOID BusContext
,
63 PUSB_DEVICE_HANDLE
*NewDevice
,
64 PUSB_DEVICE_HANDLE HubDeviceHandle
,
65 USHORT PortStatus
, USHORT PortNumber
)
67 PPDO_DEVICE_EXTENSION PdoDeviceExtension
;
68 PUSB_DEVICE UsbDevice
;
71 PdoDeviceExtension
= (PPDO_DEVICE_EXTENSION
)((PDEVICE_OBJECT
)BusContext
)->DeviceExtension
;
72 DPRINT1("Ehci: CreateUsbDevice: HubDeviceHandle %x, PortStatus %x, PortNumber %x\n", HubDeviceHandle
, PortStatus
, PortNumber
);
74 if (PdoDeviceExtension
->UsbDevices
[0] != HubDeviceHandle
)
76 DPRINT1("Not a valid HubDeviceHandle\n");
77 return STATUS_DEVICE_NOT_CONNECTED
;
80 UsbDevice
= InternalCreateUsbDevice(PdoDeviceExtension
->ChildDeviceCount
, PortNumber
, HubDeviceHandle
, FALSE
);
83 return STATUS_INSUFFICIENT_RESOURCES
;
85 /* Add it to the list */
88 if (PdoDeviceExtension
->UsbDevices
[i
] == NULL
)
90 PdoDeviceExtension
->UsbDevices
[i
] = (PUSB_DEVICE
)UsbDevice
;
96 PdoDeviceExtension
->Ports
[PortNumber
- 1].PortStatus
= PortStatus
;
99 *NewDevice
= UsbDevice
;
100 return STATUS_SUCCESS
;
105 InitializeUsbDevice(PVOID BusContext
, PUSB_DEVICE_HANDLE DeviceHandle
)
107 PPDO_DEVICE_EXTENSION PdoDeviceExtension
;
108 PFDO_DEVICE_EXTENSION FdoDeviceExtension
;
109 USB_DEFAULT_PIPE_SETUP_PACKET CtrlSetup
;
110 PUSB_CONFIGURATION_DESCRIPTOR ConfigDesc
;
111 PUSB_INTERFACE_DESCRIPTOR InterfaceDesc
;
112 PUSB_ENDPOINT_DESCRIPTOR EndpointDesc
;
113 PUSB_DEVICE UsbDevice
;
118 PdoDeviceExtension
= (PPDO_DEVICE_EXTENSION
)((PDEVICE_OBJECT
)BusContext
)->DeviceExtension
;
119 FdoDeviceExtension
= (PFDO_DEVICE_EXTENSION
)PdoDeviceExtension
->ControllerFdo
->DeviceExtension
;
121 UsbDevice
= DeviceHandleToUsbDevice(BusContext
, DeviceHandle
);
125 DPRINT1("Invalid DeviceHandle or device not connected\n");
126 return STATUS_DEVICE_NOT_CONNECTED
;
129 CtrlSetup
.bRequest
= USB_REQUEST_GET_DESCRIPTOR
;
130 CtrlSetup
.wValue
.LowByte
= 0;
131 CtrlSetup
.wValue
.HiByte
= USB_DEVICE_DESCRIPTOR_TYPE
;
132 CtrlSetup
.wIndex
.W
= 0;
133 CtrlSetup
.wLength
= sizeof(USB_DEVICE_DESCRIPTOR
);
134 CtrlSetup
.bmRequestType
.B
= 0x80;
136 SubmitControlTransfer(&FdoDeviceExtension
->hcd
,
138 &UsbDevice
->DeviceDescriptor
,
139 sizeof(USB_DEVICE_DESCRIPTOR
),
142 //DumpDeviceDescriptor(&UsbDevice->DeviceDescriptor);
144 if (UsbDevice
->DeviceDescriptor
.bLength
!= 0x12)
146 DPRINT1("Failed to get Device Descriptor from device connected on port %d\n", UsbDevice
->Port
);
147 return STATUS_DEVICE_DATA_ERROR
;
150 if (UsbDevice
->DeviceDescriptor
.bNumConfigurations
== 0)
152 DPRINT1("Device on port %d has no configurations!\n", UsbDevice
->Port
);
153 return STATUS_DEVICE_DATA_ERROR
;
155 UsbDevice
->Configs
= ExAllocatePoolWithTag(NonPagedPool
,
156 sizeof(PVOID
) * UsbDevice
->DeviceDescriptor
.bNumConfigurations
,
159 if (!UsbDevice
->Configs
)
161 DPRINT1("Out of memory\n");
162 return STATUS_NO_MEMORY
;
165 Buffer
= ExAllocatePoolWithTag(NonPagedPool
, PAGE_SIZE
, USB_POOL_TAG
);
169 DPRINT1("Out of memory\n");
170 return STATUS_NO_MEMORY
;
175 for (i
= 0; i
< UsbDevice
->DeviceDescriptor
.bNumConfigurations
; i
++)
177 /* Get the Device Configuration Descriptor */
178 CtrlSetup
.bmRequestType
._BM
.Recipient
= BMREQUEST_TO_DEVICE
;
179 CtrlSetup
.bmRequestType
._BM
.Type
= BMREQUEST_STANDARD
;
180 CtrlSetup
.bmRequestType
._BM
.Reserved
= 0;
181 CtrlSetup
.bmRequestType
._BM
.Dir
= BMREQUEST_DEVICE_TO_HOST
;
182 CtrlSetup
.bRequest
= USB_REQUEST_GET_DESCRIPTOR
;
183 CtrlSetup
.wValue
.LowByte
= 0;
184 CtrlSetup
.wValue
.HiByte
= USB_CONFIGURATION_DESCRIPTOR_TYPE
;
185 CtrlSetup
.wIndex
.W
= 0;
186 CtrlSetup
.wLength
= PAGE_SIZE
;
188 SubmitControlTransfer(&FdoDeviceExtension
->hcd
,
194 ConfigDesc
= (PUSB_CONFIGURATION_DESCRIPTOR
)Ptr
;
196 //DumpFullConfigurationDescriptor(ConfigDesc);
197 ASSERT(ConfigDesc
->wTotalLength
<= PAGE_SIZE
);
199 UsbDevice
->Configs
[i
] = ExAllocatePoolWithTag(NonPagedPool
,
200 sizeof(USB_CONFIGURATION
) + sizeof(PVOID
) * ConfigDesc
->bNumInterfaces
,
202 UsbDevice
->Configs
[i
]->Device
= UsbDevice
;
204 RtlCopyMemory(&UsbDevice
->Configs
[0]->ConfigurationDescriptor
,
205 ConfigDesc
, sizeof(USB_CONFIGURATION_DESCRIPTOR
));
206 Ptr
+= ConfigDesc
->bLength
;
208 for (j
= 0; j
< ConfigDesc
->bNumInterfaces
; j
++)
210 InterfaceDesc
= (PUSB_INTERFACE_DESCRIPTOR
) Ptr
;
211 UsbDevice
->Configs
[i
]->Interfaces
[j
] = ExAllocatePoolWithTag(NonPagedPool
,
212 sizeof(USB_INTERFACE
) + sizeof(PVOID
) * InterfaceDesc
->bNumEndpoints
,
214 RtlCopyMemory(&UsbDevice
->Configs
[i
]->Interfaces
[j
]->InterfaceDescriptor
,
216 sizeof(USB_INTERFACE_DESCRIPTOR
));
218 Ptr
+= InterfaceDesc
->bLength
;
220 for (k
= 0; k
< InterfaceDesc
->bNumEndpoints
; k
++)
222 EndpointDesc
= (PUSB_ENDPOINT_DESCRIPTOR
)Ptr
;
223 UsbDevice
->Configs
[i
]->Interfaces
[j
]->EndPoints
[k
] = ExAllocatePoolWithTag(NonPagedPool
, sizeof(USB_ENDPOINT
), USB_POOL_TAG
);
224 RtlCopyMemory(&UsbDevice
->Configs
[i
]->Interfaces
[j
]->EndPoints
[k
]->EndPointDescriptor
,
225 EndpointDesc
, sizeof(USB_ENDPOINT_DESCRIPTOR
));
226 Ptr
+= sizeof(USB_ENDPOINT_DESCRIPTOR
);
231 UsbDevice
->ActiveConfig
= UsbDevice
->Configs
[0];
232 UsbDevice
->ActiveInterface
= UsbDevice
->Configs
[0]->Interfaces
[0];
233 return STATUS_SUCCESS
;
235 /* Set the device address */
236 CtrlSetup
.bmRequestType
._BM
.Recipient
= BMREQUEST_TO_DEVICE
;
237 CtrlSetup
.bmRequestType
._BM
.Type
= BMREQUEST_STANDARD
;
238 CtrlSetup
.bmRequestType
._BM
.Reserved
= 0;
239 CtrlSetup
.bmRequestType
._BM
.Dir
= BMREQUEST_HOST_TO_DEVICE
;
240 CtrlSetup
.bRequest
= USB_REQUEST_SET_ADDRESS
;
241 CtrlSetup
.wValue
.W
= UsbDevice
->Address
;
242 CtrlSetup
.wIndex
.W
= 0;
243 CtrlSetup
.wLength
= 0;
245 DPRINT1("Setting Address to %x\n", UsbDevice
->Address
);
247 SubmitControlTransfer(&FdoDeviceExtension
->hcd
,
253 PdoDeviceExtension
->UsbDevices
[i
]->DeviceState
= DEVICEINTIALIZED
;
254 return STATUS_SUCCESS
;
259 GetUsbDescriptors(PVOID BusContext
,
260 PUSB_DEVICE_HANDLE DeviceHandle
,
261 PUCHAR DeviceDescriptorBuffer
,
262 PULONG DeviceDescriptorBufferLength
,
263 PUCHAR ConfigDescriptorBuffer
,
264 PULONG ConfigDescriptorBufferLength
)
266 PUSB_DEVICE UsbDevice
;
267 DPRINT1("Ehci: GetUsbDescriptor %x, %x, %x, %x\n", DeviceDescriptorBuffer
, *DeviceDescriptorBufferLength
,
268 ConfigDescriptorBuffer
, *ConfigDescriptorBufferLength
);
270 UsbDevice
= DeviceHandleToUsbDevice(BusContext
, DeviceHandle
);
274 DPRINT1("Invalid DeviceHandle or device not connected\n");
275 return STATUS_DEVICE_NOT_CONNECTED
;
278 if ((DeviceDescriptorBuffer
) && (DeviceDescriptorBufferLength
))
280 RtlCopyMemory(DeviceDescriptorBuffer
, &UsbDevice
->DeviceDescriptor
, sizeof(USB_DEVICE_DESCRIPTOR
));
281 *DeviceDescriptorBufferLength
= sizeof(USB_DEVICE_DESCRIPTOR
);
284 if ((ConfigDescriptorBuffer
) && (ConfigDescriptorBufferLength
))
286 RtlCopyMemory(ConfigDescriptorBuffer
, &UsbDevice
->ActiveConfig
->ConfigurationDescriptor
, sizeof(USB_CONFIGURATION_DESCRIPTOR
));
287 *ConfigDescriptorBufferLength
= sizeof(USB_CONFIGURATION_DESCRIPTOR
);
290 return STATUS_SUCCESS
;
295 RemoveUsbDevice(PVOID BusContext
, PUSB_DEVICE_HANDLE DeviceHandle
, ULONG Flags
)
297 PPDO_DEVICE_EXTENSION PdoDeviceExtension
;
298 PUSB_DEVICE UsbDevice
;
301 DPRINT1("RemoveUsbDevice called, DeviceHandle %x, Flags %x\n", DeviceHandle
, Flags
);
303 PdoDeviceExtension
= (PPDO_DEVICE_EXTENSION
)((PDEVICE_OBJECT
)BusContext
)->DeviceExtension
;
305 UsbDevice
= DeviceHandleToUsbDevice(BusContext
, DeviceHandle
);
309 DPRINT1("Invalid DeviceHandle or device not connected\n");
310 return STATUS_DEVICE_NOT_CONNECTED
;
316 DPRINT1("Number of Configurations %d\n", UsbDevice
->DeviceDescriptor
.bNumConfigurations
);
317 for (i
= 0; i
< UsbDevice
->DeviceDescriptor
.bNumConfigurations
; i
++)
319 for (j
= 0; j
< UsbDevice
->Configs
[i
]->ConfigurationDescriptor
.bNumInterfaces
; j
++)
321 for (k
= 0; k
< UsbDevice
->Configs
[i
]->Interfaces
[j
]->InterfaceDescriptor
.bNumEndpoints
; k
++)
323 ExFreePool(UsbDevice
->Configs
[i
]->Interfaces
[j
]->EndPoints
[k
]);
325 ExFreePool(UsbDevice
->Configs
[i
]->Interfaces
[j
]);
327 ExFreePool(UsbDevice
->Configs
[i
]);
330 for (i
= 0; i
< 127; i
++)
332 if (PdoDeviceExtension
->UsbDevices
[i
] == UsbDevice
)
333 PdoDeviceExtension
->UsbDevices
[i
] = NULL
;
336 ExFreePool(UsbDevice
);
338 case USBD_MARK_DEVICE_BUSY
:
339 UsbDevice
->DeviceState
|= DEVICEBUSY
;
341 case USBD_KEEP_DEVICE_DATA
:
342 UsbDevice
->DeviceState
|= DEVICEREMOVED
;
345 DPRINT1("Unknown Remove Flags %x\n", Flags
);
347 return STATUS_SUCCESS
;
352 RestoreUsbDevice(PVOID BusContext
, PUSB_DEVICE_HANDLE OldDeviceHandle
, PUSB_DEVICE_HANDLE NewDeviceHandle
)
354 PUSB_DEVICE OldUsbDevice
;
355 PUSB_DEVICE NewUsbDevice
;
357 DPRINT1("Ehci: RestoreUsbDevice %x, %x, %x\n", BusContext
, OldDeviceHandle
, NewDeviceHandle
);
359 OldUsbDevice
= DeviceHandleToUsbDevice(BusContext
, OldDeviceHandle
);
360 NewUsbDevice
= DeviceHandleToUsbDevice(BusContext
, NewDeviceHandle
);
364 DPRINT1("OldDeviceHandle is invalid\n");
365 return STATUS_DEVICE_NOT_CONNECTED
;
368 if (!(OldUsbDevice
->DeviceState
& DEVICEREMOVED
))
370 DPRINT1("UsbDevice is not marked as Removed!\n");
371 return STATUS_UNSUCCESSFUL
;
376 DPRINT1("NewDeviceHandle is invalid\n");
377 return STATUS_DEVICE_NOT_CONNECTED
;
380 if ((OldUsbDevice
->DeviceDescriptor
.idVendor
== NewUsbDevice
->DeviceDescriptor
.idVendor
) &&
381 (OldUsbDevice
->DeviceDescriptor
.idProduct
== NewUsbDevice
->DeviceDescriptor
.idProduct
))
383 PUSB_CONFIGURATION ConfigToDelete
;
386 NewUsbDevice
->DeviceState
&= ~DEVICEBUSY
;
387 NewUsbDevice
->DeviceState
&= ~DEVICEREMOVED
;
389 NewUsbDevice
->ActiveConfig
= OldUsbDevice
->ActiveConfig
;
390 NewUsbDevice
->ActiveInterface
= OldUsbDevice
->ActiveInterface
;
392 for (i
= 0; i
< NewUsbDevice
->DeviceDescriptor
.bNumConfigurations
; i
++)
394 ConfigToDelete
= NewUsbDevice
->Configs
[i
];
395 ASSERT(OldUsbDevice
->Configs
[i
]);
396 NewUsbDevice
->Configs
[i
] = OldUsbDevice
->Configs
[i
];
397 OldUsbDevice
->Configs
[i
] = ConfigToDelete
;
400 RemoveUsbDevice(BusContext
, OldDeviceHandle
, 0);
401 return STATUS_SUCCESS
;
405 DPRINT1("VendorId or ProductId did not match!\n");
406 return STATUS_DEVICE_NOT_CONNECTED
;
412 GetPortHackFlags(PVOID BusContext
, PULONG Flags
)
414 DPRINT1("Ehci: GetPortHackFlags not implemented. %x, %x\n", BusContext
, Flags
);
415 return STATUS_NOT_SUPPORTED
;
420 QueryDeviceInformation(PVOID BusContext
,
421 PUSB_DEVICE_HANDLE DeviceHandle
,
422 PVOID DeviceInformationBuffer
,
423 ULONG DeviceInformationBufferLength
,
424 PULONG LengthReturned
)
426 PUSB_DEVICE_INFORMATION_0 DeviceInfo
= DeviceInformationBuffer
;
427 PUSB_DEVICE UsbDevice
;
431 DPRINT1("Ehci: QueryDeviceInformation (%x, %x, %x, %d, %x\n", BusContext
, DeviceHandle
, DeviceInformationBuffer
,
432 DeviceInformationBufferLength
, LengthReturned
);
434 UsbDevice
= DeviceHandleToUsbDevice(BusContext
, DeviceHandle
);
438 DPRINT1("Invalid DeviceHandle or device not connected\n");
439 return STATUS_DEVICE_NOT_CONNECTED
;
442 SizeNeeded
= FIELD_OFFSET(USB_DEVICE_INFORMATION_0
, PipeList
[UsbDevice
->ActiveInterface
->InterfaceDescriptor
.bNumEndpoints
]);
443 *LengthReturned
= SizeNeeded
;
445 DeviceInfo
->ActualLength
= SizeNeeded
;
447 if (DeviceInformationBufferLength
< SizeNeeded
)
449 DPRINT1("Buffer to small\n");
450 return STATUS_BUFFER_TOO_SMALL
;
453 if (DeviceInfo
->InformationLevel
!= 0)
455 DPRINT1("Invalid Param\n");
456 return STATUS_INVALID_PARAMETER
;
459 DeviceInfo
->HubAddress
= 0;
460 DeviceInfo
->DeviceAddress
= UsbDevice
->Address
;
461 DeviceInfo
->DeviceSpeed
= UsbDevice
->DeviceSpeed
;
462 DeviceInfo
->DeviceType
= UsbDevice
->DeviceType
;
464 if (!UsbDevice
->DeviceState
)
466 DeviceInfo
->CurrentConfigurationValue
= 0;
467 DeviceInfo
->NumberOfOpenPipes
= 0;
468 DeviceInfo
->PortNumber
= 0;
472 DeviceInfo
->CurrentConfigurationValue
= UsbDevice
->ActiveConfig
->ConfigurationDescriptor
.bConfigurationValue
;
473 /* FIXME: Use correct number of open pipes instead of all available */
474 DeviceInfo
->NumberOfOpenPipes
= UsbDevice
->ActiveInterface
->InterfaceDescriptor
.bNumEndpoints
;
475 DeviceInfo
->PortNumber
= UsbDevice
->Port
;
478 RtlCopyMemory(&DeviceInfo
->DeviceDescriptor
, &UsbDevice
->DeviceDescriptor
, sizeof(USB_DEVICE_DESCRIPTOR
));
480 for (i
= 0; i
< UsbDevice
->ActiveInterface
->InterfaceDescriptor
.bNumEndpoints
; i
++)
482 RtlCopyMemory(&DeviceInfo
->PipeList
[i
].EndpointDescriptor
,
483 &UsbDevice
->ActiveInterface
->EndPoints
[i
]->EndPointDescriptor
,
484 sizeof(USB_ENDPOINT_DESCRIPTOR
));
486 return STATUS_SUCCESS
;
491 GetControllerInformation(PVOID BusContext
,
492 PVOID ControllerInformationBuffer
,
493 ULONG ControllerInformationBufferLength
,
494 PULONG LengthReturned
)
496 PUSB_CONTROLLER_INFORMATION_0 ControllerInfo
;
498 DPRINT1("Ehci: GetControllerInformation called\n");
500 ControllerInfo
= ControllerInformationBuffer
;
502 if (ControllerInformationBufferLength
< sizeof(USB_CONTROLLER_INFORMATION_0
))
504 DPRINT1("Buffer to small\n");
505 return STATUS_BUFFER_TOO_SMALL
;
508 if (ControllerInfo
->InformationLevel
!= 0)
510 DPRINT1("InformationLevel other than 0 not supported\n");
511 return STATUS_NOT_SUPPORTED
;
514 ControllerInfo
->ActualLength
= sizeof(USB_CONTROLLER_INFORMATION_0
);
515 ControllerInfo
->SelectiveSuspendEnabled
= FALSE
;
516 ControllerInfo
->IsHighSpeedController
= TRUE
;
518 *LengthReturned
= ControllerInfo
->ActualLength
;
520 return STATUS_SUCCESS
;
525 ControllerSelectiveSuspend(PVOID BusContext
, BOOLEAN Enable
)
527 DPRINT1("Ehci: ControllerSelectiveSuspend not implemented\n");
528 return STATUS_NOT_SUPPORTED
;
533 GetExtendedHubInformation(PVOID BusContext
,
534 PDEVICE_OBJECT HubPhysicalDeviceObject
,
535 PVOID HubInformationBuffer
,
536 ULONG HubInformationBufferLength
,
537 PULONG LengthReturned
)
540 PUSB_EXTHUB_INFORMATION_0 UsbExtHubInfo
= HubInformationBuffer
;
541 PPDO_DEVICE_EXTENSION PdoDeviceExtension
= (PPDO_DEVICE_EXTENSION
)((PDEVICE_OBJECT
)BusContext
)->DeviceExtension
;
542 PFDO_DEVICE_EXTENSION FdoDeviceExntension
= (PFDO_DEVICE_EXTENSION
)PdoDeviceExtension
->ControllerFdo
->DeviceExtension
;
544 DPRINT1("Ehci: GetExtendedHubInformation BusContext %x, PDO %x, InformationBuffer %x\n",
545 BusContext
, HubPhysicalDeviceObject
, HubInformationBuffer
);
547 /* Set the default return value */
550 DPRINT("InformationLevel %x\n", UsbExtHubInfo
->InformationLevel
);
552 /* Caller is suppose to have set InformationLevel to 0. However usbehci from MS seems to ignore this */
553 if (UsbExtHubInfo
->InformationLevel
!= 0)
555 DPRINT1("InformationLevel should really be set to 0. Ignoring\n");
558 UsbExtHubInfo
->NumberOfPorts
= FdoDeviceExntension
->hcd
.ECHICaps
.HCSParams
.PortCount
;
560 for (i
=0; i
< UsbExtHubInfo
->NumberOfPorts
; i
++)
562 UsbExtHubInfo
->Port
[i
].PhysicalPortNumber
= i
+ 1;
563 UsbExtHubInfo
->Port
[i
].PortLabelNumber
= i
+ 1;
564 UsbExtHubInfo
->Port
[i
].VidOverride
= 0;
565 UsbExtHubInfo
->Port
[i
].PidOverride
= 0;
566 UsbExtHubInfo
->Port
[i
].PortAttributes
= USB_PORTATTR_SHARED_USB2
;// | USB_PORTATTR_OWNED_BY_CC;
569 *LengthReturned
= FIELD_OFFSET(USB_EXTHUB_INFORMATION_0
, Port
[8]);
571 return STATUS_SUCCESS
;
576 GetRootHubSymbolicName(PVOID BusContext
,
577 PVOID HubSymNameBuffer
,
578 ULONG HubSymNameBufferLength
,
579 PULONG HubSymNameActualLength
)
581 DPRINT1("Ehci: GetRootHubSymbolicName called\n");
583 if (HubSymNameBufferLength
< 16)
584 return STATUS_UNSUCCESSFUL
;
585 RtlCopyMemory(HubSymNameBuffer
, L
"ROOT_HUB", HubSymNameBufferLength
);
586 *HubSymNameActualLength
= 16;
588 return STATUS_SUCCESS
;
593 GetDeviceBusContext(PVOID HubBusContext
, PVOID DeviceHandle
)
595 PUSB_DEVICE UsbDevice
;
597 DPRINT1("Ehci: GetDeviceBusContext called\n");
598 UsbDevice
= DeviceHandleToUsbDevice(HubBusContext
, DeviceHandle
);
602 DPRINT1("Invalid DeviceHandle or device not connected\n");
611 Initialize20Hub(PVOID BusContext
, PUSB_DEVICE_HANDLE HubDeviceHandle
, ULONG TtCount
)
613 DPRINT1("Ehci: Initialize20Hub called, HubDeviceHandle: %x, TtCount %x\n", HubDeviceHandle
, TtCount
);
615 /* Create the Irp Queue for SCE */
616 /* Should queue be created for each device or each enpoint??? */
617 return STATUS_SUCCESS
;
622 RootHubInitNotification(PVOID BusContext
, PVOID CallbackContext
, PRH_INIT_CALLBACK CallbackRoutine
)
624 PPDO_DEVICE_EXTENSION PdoDeviceExtension
;
625 DPRINT1("Ehci: RootHubInitNotification %x, %x, %x\n", BusContext
, CallbackContext
, CallbackRoutine
);
627 PdoDeviceExtension
= (PPDO_DEVICE_EXTENSION
)((PDEVICE_OBJECT
)BusContext
)->DeviceExtension
;
628 PdoDeviceExtension
->CallbackContext
= CallbackContext
;
629 PdoDeviceExtension
->CallbackRoutine
= CallbackRoutine
;
630 if (PdoDeviceExtension
->CallbackRoutine
)
632 DPRINT1("Called Callbackrountine\n");
633 PdoDeviceExtension
->CallbackRoutine(PdoDeviceExtension
->CallbackContext
);
634 DPRINT1("Done Callbackrountine\n");
638 DPRINT1("PdoDeviceExtension->CallbackRoutine is NULL!\n");
641 return STATUS_SUCCESS
;
646 FlushTransfers(PVOID BusContext
, PVOID DeviceHandle
)
648 PUSB_DEVICE UsbDevice
;
649 UsbDevice
= DeviceHandleToUsbDevice(BusContext
, DeviceHandle
);
653 DPRINT1("Invalid DeviceHandle or device not connected\n");
656 DPRINT1("FlushTransfers\n");
661 SetDeviceHandleData(PVOID BusContext
, PVOID DeviceHandle
, PDEVICE_OBJECT UsbDevicePdo
)
663 PUSB_DEVICE UsbDevice
;
665 DPRINT1("Ehci: SetDeviceHandleData %x, %x, %x\n", BusContext
, DeviceHandle
, UsbDevicePdo
);
666 UsbDevice
= DeviceHandleToUsbDevice(BusContext
, DeviceHandle
);
669 DPRINT1("Invalid DeviceHandle or device not connected\n");
673 UsbDevice
->UsbDevicePdo
= UsbDevicePdo
;
677 /* USB_BUS_INTERFACE_USBDI_V2 Functions */
681 GetUSBDIVersion(PVOID BusContext
, PUSBD_VERSION_INFORMATION VersionInformation
, PULONG HcdCapabilites
)
683 DPRINT1("Ehci: GetUSBDIVersion called\n");
689 QueryBusTime(PVOID BusContext
, PULONG CurrentFrame
)
691 DPRINT1("Ehci: QueryBusTime called\n");
692 return STATUS_NOT_SUPPORTED
;
697 SubmitIsoOutUrb(PVOID BusContext
, PURB Urb
)
699 DPRINT1("Ehci: SubmitIsoOutUrb called\n");
700 return STATUS_NOT_SUPPORTED
;
705 QueryBusInformation(PVOID BusContext
,
707 PVOID BusInformationBuffer
,
708 PULONG BusInformationBufferLength
,
709 PULONG BusInformationActualLength
)
711 DPRINT1("Ehci: QueryBusInformation called\n");
712 return STATUS_NOT_SUPPORTED
;
717 IsDeviceHighSpeed(PVOID BusContext
)
719 DPRINT1("Ehci: IsDeviceHighSpeed called\n");
725 EnumLogEntry(PVOID BusContext
, ULONG DriverTag
, ULONG EnumTag
, ULONG P1
, ULONG P2
)
727 DPRINT1("Ehci: EnumLogEntry called %x, %x, %x, %x\n", DriverTag
, EnumTag
, P1
, P2
);
728 return STATUS_SUCCESS
;