[CMAKE]
[reactos.git] / drivers / usb / usbehci / usbiffn.c
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/usbehci/usbiffn.c
5 * PURPOSE: Direct Call Interface Functions.
6 * PROGRAMMERS:
7 * Michael Martin (mjmartin@reactos.org)
8 */
9
10 #include "usbehci.h"
11 #include <hubbusif.h>
12 #include <usbbusif.h>
13
14 PVOID InternalCreateUsbDevice(UCHAR DeviceNumber, ULONG Port, PUSB_DEVICE Parent, BOOLEAN Hub)
15 {
16 PUSB_DEVICE UsbDevicePointer = NULL;
17 UsbDevicePointer = ExAllocatePoolWithTag(NonPagedPool, sizeof(USB_DEVICE), USB_POOL_TAG);
18
19 if (!UsbDevicePointer)
20 {
21 DPRINT1("Out of memory\n");
22 return NULL;
23 }
24
25 RtlZeroMemory(UsbDevicePointer, sizeof(USB_DEVICE));
26
27 if ((Hub) && (!Parent))
28 {
29 DPRINT1("This is the root hub\n");
30 }
31
32 UsbDevicePointer->Address = DeviceNumber;
33 UsbDevicePointer->Port = Port;
34 UsbDevicePointer->ParentDevice = Parent;
35
36 UsbDevicePointer->IsHub = Hub;
37
38 return UsbDevicePointer;
39 }
40
41 VOID
42 USB_BUSIFFN
43 InterfaceReference(PVOID BusContext)
44 {
45 DPRINT1("InterfaceReference called\n");
46 }
47
48 VOID
49 USB_BUSIFFN
50 InterfaceDereference(PVOID BusContext)
51 {
52 DPRINT1("InterfaceDereference called\n");
53 }
54
55 /* Bus Interface Hub V5 Functions */
56
57 NTSTATUS
58 USB_BUSIFFN
59 CreateUsbDevice(PVOID BusContext,
60 PUSB_DEVICE_HANDLE *NewDevice,
61 PUSB_DEVICE_HANDLE HubDeviceHandle,
62 USHORT PortStatus, USHORT PortNumber)
63 {
64 PPDO_DEVICE_EXTENSION PdoDeviceExtension;
65 PUSB_DEVICE UsbDevice;
66 LONG i = 0;
67 PdoDeviceExtension = (PPDO_DEVICE_EXTENSION)((PDEVICE_OBJECT)BusContext)->DeviceExtension;
68 DPRINT("CreateUsbDevice: HubDeviceHandle %x, PortStatus %x, PortNumber %x\n", HubDeviceHandle, PortStatus, PortNumber);
69
70 if (PdoDeviceExtension->UsbDevices[0] != HubDeviceHandle)
71 {
72 DPRINT1("Not a valid HubDeviceHandle\n");
73 return STATUS_DEVICE_NOT_CONNECTED;
74 }
75
76 UsbDevice = InternalCreateUsbDevice(PdoDeviceExtension->ChildDeviceCount, PortNumber, HubDeviceHandle, FALSE);
77
78 if (!UsbDevice)
79 return STATUS_INSUFFICIENT_RESOURCES;
80
81 /* Add it to the list */
82 while (TRUE)
83 {
84 if (PdoDeviceExtension->UsbDevices[i] == NULL)
85 {
86 PdoDeviceExtension->UsbDevices[i] = (PUSB_DEVICE)UsbDevice;
87 PdoDeviceExtension->UsbDevices[i]->Address = i + 1;
88 PdoDeviceExtension->UsbDevices[i]->Port = PortNumber;
89 break;
90 }
91 i++;
92 }
93
94 PdoDeviceExtension->Ports[PortNumber - 1].PortStatus = PortStatus;
95
96 /* Return it */
97 *NewDevice = UsbDevice;
98 return STATUS_SUCCESS;
99 }
100
101 /* Called when SCE reports a change */
102 /* FIXME: Do something better for memory */
103 NTSTATUS
104 USB_BUSIFFN
105 InitializeUsbDevice(PVOID BusContext, PUSB_DEVICE_HANDLE DeviceHandle)
106 {
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;
114 BOOLEAN ResultOk;
115 PVOID Buffer;
116 PUCHAR Ptr;
117 LONG i, j, k;
118
119 DPRINT1("InitializeUsbDevice called, device %x\n", DeviceHandle);
120 PdoDeviceExtension = (PPDO_DEVICE_EXTENSION)((PDEVICE_OBJECT)BusContext)->DeviceExtension;
121 FdoDeviceExtension = (PFDO_DEVICE_EXTENSION)PdoDeviceExtension->ControllerFdo->DeviceExtension;
122
123 UsbDevice = DeviceHandleToUsbDevice(BusContext, DeviceHandle);
124
125 if (!UsbDevice)
126 {
127 DPRINT1("Invalid DeviceHandle or device not connected\n");
128 return STATUS_DEVICE_NOT_CONNECTED;
129 }
130
131 Buffer = ExAllocatePoolWithTag(NonPagedPool, PAGE_SIZE, USB_POOL_TAG);
132
133 if (!Buffer)
134 {
135 DPRINT1("Out of memory\n");
136 return STATUS_NO_MEMORY;
137 }
138
139 Ptr = Buffer;
140
141 /* Set the device address */
142 CtrlSetup.bmRequestType._BM.Recipient = BMREQUEST_TO_DEVICE;
143 CtrlSetup.bmRequestType._BM.Type = BMREQUEST_STANDARD;
144 CtrlSetup.bmRequestType._BM.Dir = BMREQUEST_HOST_TO_DEVICE;
145 CtrlSetup.bRequest = USB_REQUEST_SET_ADDRESS;
146 CtrlSetup.wValue.W = UsbDevice->Address;
147 CtrlSetup.wIndex.W = 0;
148 CtrlSetup.wLength = 0;
149
150 DPRINT1("Setting Address to %x\n", UsbDevice->Address);
151 ResultOk = ExecuteControlRequest(FdoDeviceExtension, &CtrlSetup, 0, UsbDevice->Port, NULL, 0);
152
153 /* Get the Device Descriptor */
154 CtrlSetup.bmRequestType._BM.Recipient = BMREQUEST_TO_DEVICE;
155 CtrlSetup.bmRequestType._BM.Type = BMREQUEST_STANDARD;
156 CtrlSetup.bmRequestType._BM.Dir = BMREQUEST_DEVICE_TO_HOST;
157 CtrlSetup.bRequest = USB_REQUEST_GET_DESCRIPTOR;
158 CtrlSetup.wValue.LowByte = 0;
159 CtrlSetup.wValue.HiByte = USB_DEVICE_DESCRIPTOR_TYPE;
160 CtrlSetup.wIndex.W = 0;
161 CtrlSetup.wLength = sizeof(USB_DEVICE_DESCRIPTOR);
162
163 DPRINT1("Requesting Descriptor\n");
164 ResultOk = ExecuteControlRequest(FdoDeviceExtension, &CtrlSetup, UsbDevice->Address, UsbDevice->Port,
165 &UsbDevice->DeviceDescriptor, sizeof(USB_DEVICE_DESCRIPTOR));
166
167
168 DPRINT1("bLength %x\n", UsbDevice->DeviceDescriptor.bLength);
169 DPRINT1("bDescriptorType %x\n", UsbDevice->DeviceDescriptor.bDescriptorType);
170 DPRINT1("idVendor %x\n", UsbDevice->DeviceDescriptor.idVendor);
171 DPRINT1("idProduct %x\n", UsbDevice->DeviceDescriptor.idProduct);
172 DPRINT1("bNumDescriptors %x\n", UsbDevice->DeviceDescriptor.bNumConfigurations);
173
174 if (UsbDevice->DeviceDescriptor.bNumConfigurations == 0)
175 {
176 DPRINT1("No Configurations. That cant be good!\n");
177 return STATUS_DEVICE_DATA_ERROR;
178 }
179
180 UsbDevice->Configs = ExAllocatePoolWithTag(NonPagedPool,
181 sizeof(PVOID) * UsbDevice->DeviceDescriptor.bNumConfigurations,
182 USB_POOL_TAG);
183
184 if (!UsbDevice->Configs)
185 {
186 DPRINT1("Out of memory\n");
187 return STATUS_NO_MEMORY;
188 }
189
190 for (i = 0; i < UsbDevice->DeviceDescriptor.bNumConfigurations; i++)
191 {
192 /* Get the Device Configuration Descriptor */
193 CtrlSetup.bmRequestType._BM.Recipient = BMREQUEST_TO_DEVICE;
194 CtrlSetup.bmRequestType._BM.Type = BMREQUEST_STANDARD;
195 CtrlSetup.bmRequestType._BM.Dir = BMREQUEST_DEVICE_TO_HOST;
196 CtrlSetup.bRequest = USB_REQUEST_GET_DESCRIPTOR;
197 CtrlSetup.wValue.LowByte = 0;
198 CtrlSetup.wValue.HiByte = USB_CONFIGURATION_DESCRIPTOR_TYPE;
199 CtrlSetup.wIndex.W = 0;
200 CtrlSetup.wLength = PAGE_SIZE;
201
202 ResultOk = ExecuteControlRequest(FdoDeviceExtension, &CtrlSetup, UsbDevice->Address, UsbDevice->Port, Buffer, PAGE_SIZE);
203
204 ConfigDesc = (PUSB_CONFIGURATION_DESCRIPTOR)Ptr;
205
206 ASSERT(ConfigDesc->wTotalLength <= PAGE_SIZE);
207
208 UsbDevice->Configs[i] = ExAllocatePoolWithTag(NonPagedPool,
209 sizeof(USB_CONFIGURATION) + sizeof(PVOID) * ConfigDesc->bNumInterfaces,
210 USB_POOL_TAG);
211 UsbDevice->Configs[i]->Device = UsbDevice;
212 RtlCopyMemory(&UsbDevice->Configs[0]->ConfigurationDescriptor,
213 ConfigDesc, sizeof(USB_CONFIGURATION_DESCRIPTOR));
214 Ptr += ConfigDesc->bLength;
215
216 for (j = 0; j < ConfigDesc->bNumInterfaces; j++)
217 {
218 InterfaceDesc = (PUSB_INTERFACE_DESCRIPTOR) Ptr;
219 UsbDevice->Configs[i]->Interfaces[j] = ExAllocatePoolWithTag(NonPagedPool,
220 sizeof(USB_INTERFACE) + sizeof(PVOID) * InterfaceDesc->bNumEndpoints,
221 USB_POOL_TAG);
222 RtlCopyMemory(&UsbDevice->Configs[i]->Interfaces[j]->InterfaceDescriptor,
223 InterfaceDesc,
224 sizeof(USB_INTERFACE_DESCRIPTOR));
225
226 Ptr += InterfaceDesc->bLength;
227
228 for (k = 0; k < InterfaceDesc->bNumEndpoints; k++)
229 {
230 EndpointDesc = (PUSB_ENDPOINT_DESCRIPTOR)Ptr;
231 UsbDevice->Configs[i]->Interfaces[j]->EndPoints[k] = ExAllocatePoolWithTag(NonPagedPool, sizeof(USB_ENDPOINT), USB_POOL_TAG);
232 RtlCopyMemory(&UsbDevice->Configs[i]->Interfaces[j]->EndPoints[k]->EndPointDescriptor,
233 EndpointDesc, sizeof(USB_ENDPOINT_DESCRIPTOR));
234 }
235
236 }
237 }
238
239 UsbDevice->ActiveConfig = UsbDevice->Configs[0];
240 UsbDevice->ActiveInterface = UsbDevice->Configs[0]->Interfaces[0];
241
242 return STATUS_SUCCESS;
243 }
244
245 NTSTATUS
246 USB_BUSIFFN
247 GetUsbDescriptors(PVOID BusContext,
248 PUSB_DEVICE_HANDLE DeviceHandle,
249 PUCHAR DeviceDescriptorBuffer,
250 PULONG DeviceDescriptorBufferLength,
251 PUCHAR ConfigDescriptorBuffer,
252 PULONG ConfigDescriptorBufferLength)
253 {
254 PUSB_DEVICE UsbDevice;
255 DPRINT1("GetUsbDescriptor %x, %x, %x, %x\n", DeviceDescriptorBuffer, *DeviceDescriptorBufferLength, ConfigDescriptorBuffer, *ConfigDescriptorBufferLength);
256
257 UsbDevice = DeviceHandleToUsbDevice(BusContext, DeviceHandle);
258
259 if (!UsbDevice)
260 {
261 DPRINT1("Invalid DeviceHandle or device not connected\n");
262 return STATUS_DEVICE_NOT_CONNECTED;
263 }
264
265 if ((DeviceDescriptorBuffer) && (DeviceDescriptorBufferLength))
266 {
267 RtlCopyMemory(DeviceDescriptorBuffer, &UsbDevice->DeviceDescriptor, sizeof(USB_DEVICE_DESCRIPTOR));
268 *DeviceDescriptorBufferLength = sizeof(USB_DEVICE_DESCRIPTOR);
269 }
270 if ((ConfigDescriptorBuffer) && (ConfigDescriptorBufferLength))
271 {
272 RtlCopyMemory(ConfigDescriptorBuffer, &UsbDevice->ActiveConfig->ConfigurationDescriptor, sizeof(USB_CONFIGURATION_DESCRIPTOR));
273 *ConfigDescriptorBufferLength = sizeof(USB_CONFIGURATION_DESCRIPTOR);
274 }
275
276 return STATUS_SUCCESS;
277 }
278
279 NTSTATUS
280 USB_BUSIFFN
281 RemoveUsbDevice(PVOID BusContext, PUSB_DEVICE_HANDLE DeviceHandle, ULONG Flags)
282 {
283 PPDO_DEVICE_EXTENSION PdoDeviceExtension;
284 PUSB_DEVICE UsbDevice;
285 LONG i, j, k;
286
287 DPRINT1("RemoveUsbDevice called, DeviceHandle %x, Flags %x\n", DeviceHandle, Flags);
288
289 PdoDeviceExtension = (PPDO_DEVICE_EXTENSION)((PDEVICE_OBJECT)BusContext)->DeviceExtension;
290
291 UsbDevice = DeviceHandleToUsbDevice(BusContext, DeviceHandle);
292
293 if (!UsbDevice)
294 {
295 DPRINT1("Invalid DeviceHandle or device not connected\n");
296 return STATUS_DEVICE_NOT_CONNECTED;
297 }
298
299 switch (Flags)
300 {
301 case 0:
302 DPRINT1("Number of Configurations %d\n", UsbDevice->DeviceDescriptor.bNumConfigurations);
303 for (i = 0; i < UsbDevice->DeviceDescriptor.bNumConfigurations; i++)
304 {
305 for (j = 0; j < UsbDevice->Configs[i]->ConfigurationDescriptor.bNumInterfaces; j++)
306 {
307 for (k = 0; k < UsbDevice->Configs[i]->Interfaces[j]->InterfaceDescriptor.bNumEndpoints; k++)
308 {
309 ExFreePool(UsbDevice->Configs[i]->Interfaces[j]->EndPoints[k]);
310 }
311 ExFreePool(UsbDevice->Configs[i]->Interfaces[j]);
312 }
313 ExFreePool(UsbDevice->Configs[i]);
314 }
315
316 for (i = 0; i < 127; i++)
317 {
318 if (PdoDeviceExtension->UsbDevices[i] == UsbDevice)
319 PdoDeviceExtension->UsbDevices[i] = NULL;
320 }
321
322 ExFreePool(UsbDevice);
323
324 /* DeConfig Device */
325 break;
326 case USBD_KEEP_DEVICE_DATA:
327 DPRINT1("USBD_KEEP_DEVICE_DATA Not implemented!\n");
328 break;
329
330 case USBD_MARK_DEVICE_BUSY:
331 DPRINT1("USBD_MARK_DEVICE_BUSY Not implemented!\n");
332 break;
333 default:
334 DPRINT1("Unknown Remove Flags %x\n", Flags);
335 }
336 return STATUS_SUCCESS;
337 }
338
339 NTSTATUS
340 USB_BUSIFFN
341 RestoreUsbDevice(PVOID BusContext, PUSB_DEVICE_HANDLE OldDeviceHandle, PUSB_DEVICE_HANDLE NewDeviceHandle)
342 {
343 DPRINT1("RestoreUsbDevice called\n");
344 return STATUS_NOT_SUPPORTED;
345 }
346
347 NTSTATUS
348 USB_BUSIFFN
349 GetPortHackFlags(PVOID BusContext, PULONG Flags)
350 {
351 DPRINT1("GetPortHackFlags called\n");
352 return STATUS_NOT_SUPPORTED;
353 }
354
355 NTSTATUS
356 USB_BUSIFFN
357 QueryDeviceInformation(PVOID BusContext,
358 PUSB_DEVICE_HANDLE DeviceHandle,
359 PVOID DeviceInformationBuffer,
360 ULONG DeviceInformationBufferLength,
361 PULONG LengthReturned)
362 {
363 PUSB_DEVICE_INFORMATION_0 DeviceInfo = DeviceInformationBuffer;
364 PUSB_DEVICE UsbDevice;
365 ULONG SizeNeeded;
366 LONG i;
367
368 DPRINT1("QueryDeviceInformation (%x, %x, %x, %d, %x\n", BusContext, DeviceHandle, DeviceInformationBuffer, DeviceInformationBufferLength, LengthReturned);
369
370 UsbDevice = DeviceHandleToUsbDevice(BusContext, DeviceHandle);
371
372 if (!UsbDevice)
373 {
374 DPRINT1("Invalid DeviceHandle or device not connected\n");
375 return STATUS_DEVICE_NOT_CONNECTED;
376 }
377
378 SizeNeeded = FIELD_OFFSET(USB_DEVICE_INFORMATION_0, PipeList[UsbDevice->ActiveInterface->InterfaceDescriptor.bNumEndpoints]);
379 *LengthReturned = SizeNeeded;
380
381 DeviceInfo->ActualLength = SizeNeeded;
382
383 if (DeviceInformationBufferLength < SizeNeeded)
384 {
385 DPRINT1("Buffer to small\n");
386 return STATUS_BUFFER_TOO_SMALL;
387 }
388
389 if (DeviceInfo->InformationLevel != 0)
390 {
391 DPRINT1("Invalid Param\n");
392 return STATUS_INVALID_PARAMETER;
393 }
394
395 DeviceInfo->PortNumber = UsbDevice->Port;
396 DeviceInfo->HubAddress = 1;
397 DeviceInfo->DeviceAddress = UsbDevice->Address;
398 DeviceInfo->DeviceSpeed = UsbDevice->DeviceSpeed;
399 DeviceInfo->DeviceType = UsbDevice->DeviceType;
400 DeviceInfo->CurrentConfigurationValue = UsbDevice->ActiveConfig->ConfigurationDescriptor.bConfigurationValue;
401 DeviceInfo->NumberOfOpenPipes = UsbDevice->ActiveInterface->InterfaceDescriptor.bNumEndpoints;
402
403 RtlCopyMemory(&DeviceInfo->DeviceDescriptor, &UsbDevice->DeviceDescriptor, sizeof(USB_DEVICE_DESCRIPTOR));
404
405 for (i = 0; i < UsbDevice->ActiveInterface->InterfaceDescriptor.bNumEndpoints; i++)
406 {
407 RtlCopyMemory(&DeviceInfo->PipeList[i].EndpointDescriptor, &UsbDevice->ActiveInterface->EndPoints[i]->EndPointDescriptor, sizeof(USB_ENDPOINT_DESCRIPTOR));
408 }
409 return STATUS_SUCCESS;
410 }
411
412 NTSTATUS
413 USB_BUSIFFN
414 GetControllerInformation(PVOID BusContext,
415 PVOID ControllerInformationBuffer,
416 ULONG ControllerInformationBufferLength,
417 PULONG LengthReturned)
418 {
419 PUSB_CONTROLLER_INFORMATION_0 ControllerInfo;
420
421 DPRINT1("GetControllerInformation called\n");
422
423 ControllerInfo = ControllerInformationBuffer;
424
425 if (ControllerInformationBufferLength < sizeof(USB_CONTROLLER_INFORMATION_0))
426 {
427 DPRINT1("Buffer to small\n");
428 return STATUS_BUFFER_TOO_SMALL;
429 }
430
431 if (ControllerInfo->InformationLevel != 0)
432 {
433 DPRINT1("InformationLevel other than 0 not supported\n");
434 return STATUS_NOT_SUPPORTED;
435 }
436
437 ControllerInfo->ActualLength = sizeof(USB_CONTROLLER_INFORMATION_0);
438 ControllerInfo->SelectiveSuspendEnabled = FALSE;
439 ControllerInfo->IsHighSpeedController = TRUE;
440
441 *LengthReturned = ControllerInfo->ActualLength;
442
443 return STATUS_SUCCESS;
444 }
445
446 NTSTATUS
447 USB_BUSIFFN
448 ControllerSelectiveSuspend(PVOID BusContext, BOOLEAN Enable)
449 {
450 DPRINT1("ControllerSelectiveSuspend called\n");
451 return STATUS_NOT_SUPPORTED;
452 }
453
454 NTSTATUS
455 USB_BUSIFFN
456 GetExtendedHubInformation(PVOID BusContext,
457 PDEVICE_OBJECT HubPhysicalDeviceObject,
458 PVOID HubInformationBuffer,
459 ULONG HubInformationBufferLength,
460 PULONG LengthReturned)
461 {
462
463 PUSB_EXTHUB_INFORMATION_0 UsbExtHubInfo = HubInformationBuffer;
464 PPDO_DEVICE_EXTENSION PdoDeviceExtension = (PPDO_DEVICE_EXTENSION)((PDEVICE_OBJECT)BusContext)->DeviceExtension;
465 PFDO_DEVICE_EXTENSION FdoDeviceExntension = (PFDO_DEVICE_EXTENSION)PdoDeviceExtension->ControllerFdo->DeviceExtension;
466 LONG i;
467 DPRINT1("GetExtendedHubInformation\n");
468 /* Set the default return value */
469 *LengthReturned = 0;
470 /* Caller must have set InformationLevel to 0 */
471 if (UsbExtHubInfo->InformationLevel != 0)
472 {
473 return STATUS_NOT_SUPPORTED;
474 }
475
476 UsbExtHubInfo->NumberOfPorts = 8;
477
478 for (i=0; i < UsbExtHubInfo->NumberOfPorts; i++)
479 {
480 UsbExtHubInfo->Port[i].PhysicalPortNumber = i + 1;
481 UsbExtHubInfo->Port[i].PortLabelNumber = FdoDeviceExntension->ECHICaps.HCSParams.PortCount;
482 UsbExtHubInfo->Port[i].VidOverride = 0;
483 UsbExtHubInfo->Port[i].PidOverride = 0;
484 UsbExtHubInfo->Port[i].PortAttributes = USB_PORTATTR_SHARED_USB2;
485 }
486
487 *LengthReturned = FIELD_OFFSET(USB_EXTHUB_INFORMATION_0, Port[8]);
488
489 return STATUS_SUCCESS;
490 }
491
492 NTSTATUS
493 USB_BUSIFFN
494 GetRootHubSymbolicName(PVOID BusContext,
495 PVOID HubSymNameBuffer,
496 ULONG HubSymNameBufferLength,
497 PULONG HubSymNameActualLength)
498 {
499 DPRINT1("GetRootHubSymbolicName called\n");
500
501 if (HubSymNameBufferLength < 16)
502 return STATUS_UNSUCCESSFUL;
503 RtlCopyMemory(HubSymNameBuffer, L"ROOT_HUB", HubSymNameBufferLength);
504 *HubSymNameActualLength = 16;
505
506 return STATUS_SUCCESS;
507 }
508
509 PVOID
510 USB_BUSIFFN
511 GetDeviceBusContext(PVOID HubBusContext, PVOID DeviceHandle)
512 {
513 PUSB_DEVICE UsbDevice;
514
515 DPRINT1("GetDeviceBusContext called\n");
516 UsbDevice = DeviceHandleToUsbDevice(HubBusContext, DeviceHandle);
517
518 if (!UsbDevice)
519 {
520 DPRINT1("Invalid DeviceHandle or device not connected\n");
521 return NULL;
522 }
523
524 return NULL;
525 }
526
527 NTSTATUS
528 USB_BUSIFFN
529 Initialize20Hub(PVOID BusContext, PUSB_DEVICE_HANDLE HubDeviceHandle, ULONG TtCount)
530 {
531 DPRINT1("Initialize20Hub called, HubDeviceHandle: %x\n", HubDeviceHandle);
532
533 /* FIXME: */
534 /* Create the Irp Queue for SCE */
535 /* Should queue be created for each device or each enpoint??? */
536 return STATUS_SUCCESS;
537 }
538
539 NTSTATUS
540 USB_BUSIFFN
541 RootHubInitNotification(PVOID BusContext, PVOID CallbackContext, PRH_INIT_CALLBACK CallbackRoutine)
542 {
543 PPDO_DEVICE_EXTENSION PdoDeviceExtension;
544 DPRINT1("RootHubInitNotification %x, %x, %x\n", BusContext, CallbackContext, CallbackRoutine);
545
546 PdoDeviceExtension = (PPDO_DEVICE_EXTENSION)((PDEVICE_OBJECT)BusContext)->DeviceExtension;
547 PdoDeviceExtension->CallbackContext = CallbackContext;
548 PdoDeviceExtension->CallbackRoutine = CallbackRoutine;
549 if (PdoDeviceExtension->CallbackRoutine)
550 {
551 DPRINT1("Called Callbackrountine\n");
552 PdoDeviceExtension->CallbackRoutine(PdoDeviceExtension->CallbackContext);
553 DPRINT1("Done Callbackrountine\n");
554 }
555 else
556 {
557 DPRINT1("PdoDeviceExtension->CallbackRoutine is NULL!\n");
558 }
559
560 return STATUS_SUCCESS;
561 }
562
563 VOID
564 USB_BUSIFFN
565 FlushTransfers(PVOID BusContext, PVOID DeviceHandle)
566 {
567 PUSB_DEVICE UsbDevice;
568 UsbDevice = DeviceHandleToUsbDevice(BusContext, DeviceHandle);
569
570 if (!UsbDevice)
571 {
572 DPRINT1("Invalid DeviceHandle or device not connected\n");
573 }
574
575 DPRINT1("FlushTransfers\n");
576 }
577
578 VOID
579 USB_BUSIFFN
580 SetDeviceHandleData(PVOID BusContext, PVOID DeviceHandle, PDEVICE_OBJECT UsbDevicePdo)
581 {
582 DPRINT1("SetDeviceHandleData called\n");
583 }
584
585
586 /* USB_BUS_INTERFACE_USBDI_V2 Functions */
587
588 VOID
589 USB_BUSIFFN
590 GetUSBDIVersion(PVOID BusContext, PUSBD_VERSION_INFORMATION VersionInformation, PULONG HcdCapabilites)
591 {
592 DPRINT1("GetUSBDIVersion called\n");
593 return;
594 }
595
596 NTSTATUS
597 USB_BUSIFFN
598 QueryBusTime(PVOID BusContext, PULONG CurrentFrame)
599 {
600 DPRINT1("QueryBusTime called\n");
601 return STATUS_NOT_SUPPORTED;
602 }
603
604 NTSTATUS
605 USB_BUSIFFN
606 SubmitIsoOutUrb(PVOID BusContext, PURB Urb)
607 {
608 DPRINT1("SubmitIsoOutUrb called\n");
609 return STATUS_NOT_SUPPORTED;
610 }
611
612 NTSTATUS
613 USB_BUSIFFN
614 QueryBusInformation(PVOID BusContext,
615 ULONG Level,
616 PVOID BusInformationBuffer,
617 PULONG BusInformationBufferLength,
618 PULONG BusInformationActualLength)
619 {
620 DPRINT1("QueryBusInformation called\n");
621 return STATUS_NOT_SUPPORTED;
622 }
623
624 BOOLEAN
625 USB_BUSIFFN
626 IsDeviceHighSpeed(PVOID BusContext)
627 {
628 DPRINT1("IsDeviceHighSpeed called\n");
629 return TRUE;
630 }
631
632 NTSTATUS
633 USB_BUSIFFN
634 EnumLogEntry(PVOID BusContext, ULONG DriverTag, ULONG EnumTag, ULONG P1, ULONG P2)
635 {
636 DPRINT1("EnumLogEntry called\n");
637 return STATUS_SUCCESS;
638 }