2 ReactOS specific functions for UHCI module
3 by Aleksey Bragin (aleksey@reactos.com)
4 and Hervé Poussineau (hpoussin@reactos.org)
5 Some parts of code are inspired (or even just copied) from ReactOS Videoport driver
10 extern struct pci_driver uhci_pci_driver
;
11 extern struct pci_device_id uhci_pci_ids
[];
12 struct pci_device_id
* pci_ids
= &uhci_pci_ids
[0];
15 InitLinuxWrapper(PDEVICE_OBJECT DeviceObject
)
18 PUSBMP_DEVICE_EXTENSION DeviceExtension
= (PUSBMP_DEVICE_EXTENSION
)DeviceObject
->DeviceExtension
;
20 /* Create generic linux structure */
22 dev
= ExAllocatePoolWithTag(PagedPool
, sizeof(struct pci_dev
), USB_UHCI_TAG
);
23 DeviceExtension
->pdev
= dev
;
25 /* Initialize generic linux structure */
26 dev
->irq
= DeviceExtension
->InterruptVector
;
27 dev
->dev_ext
= (PVOID
)DeviceExtension
;
28 dev
->dev
.dev_ext
= DeviceObject
;
29 dev
->slot_name
= ExAllocatePoolWithTag(NonPagedPool
, 128, USB_UHCI_TAG
); // 128 max len for slot name
34 strcpy(dev
->dev
.name
, "UnivHCI PCI-USB Controller");
35 strcpy(dev
->slot_name
, "UHCD PCI Slot");
37 /* Init the HCD. Probe will be called automatically, but will fail because id=NULL */
38 Status
= uhci_hcd_init();
39 if (!NT_SUCCESS(Status
))
41 DPRINT("UHCI: uhci_hcd_init() failed with status 0x%08lx\n", Status
);
42 /* FIXME: deinitialize linux wrapper */
43 ExFreePoolWithTag(dev
, USB_UHCI_TAG
);
50 /* Probe device with real id now */
51 uhci_pci_driver
.probe(dev
, uhci_pci_ids
);
53 return STATUS_SUCCESS
;
57 DriverUnload(PDRIVER_OBJECT DriverObject
)
59 PUSBMP_DEVICE_EXTENSION DeviceExtension
;
60 PDEVICE_OBJECT DeviceObject
;
63 DeviceObject
= DriverObject
->DeviceObject
;
64 DeviceExtension
= (PUSBMP_DEVICE_EXTENSION
)DeviceObject
->DeviceExtension
;
66 dev
= DeviceExtension
->pdev
;
68 DPRINT1("UHCI: DriverUnload()\n");
73 // Remove device (uhci_pci_driver.remove)
74 uhci_pci_driver
.remove(dev
);
76 ExFreePool(dev
->slot_name
);
79 // Perform some cleanup