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
)
17 NTSTATUS Status
= STATUS_SUCCESS
;
19 PUSBMP_DEVICE_EXTENSION DeviceExtension
= (PUSBMP_DEVICE_EXTENSION
)DeviceObject
->DeviceExtension
;
21 /* Create generic linux structure */
23 dev
= ExAllocatePoolWithTag(PagedPool
, sizeof(struct pci_dev
), USB_UHCI_TAG
);
24 DeviceExtension
->pdev
= dev
;
26 /* Initialize generic linux structure */
27 dev
->irq
= DeviceExtension
->InterruptVector
;
28 dev
->dev_ext
= (PVOID
)DeviceExtension
;
29 dev
->slot_name
= ExAllocatePoolWithTag(NonPagedPool
, 128, USB_UHCI_TAG
); // 128 max len for slot name
32 strcpy(dev
->dev
.name
, "UnivHCI PCI-USB Controller");
33 strcpy(dev
->slot_name
, "UHCD PCI Slot");
35 /* Init the HCD. Probe will be called automatically, but will fail because id=NULL */
36 Status
= uhci_hcd_init();
37 if (!NT_SUCCESS(Status
))
39 DPRINT("UHCI: uhci_hcd_init() failed with status 0x%08lx\n", Status
);
40 /* FIXME: deinitialize linux wrapper */
41 ExFreePoolWithTag(dev
, USB_UHCI_TAG
);
48 /* Probe device with real id now */
49 uhci_pci_driver
.probe(dev
, uhci_pci_ids
);
51 // DPRINT1("UHCI :SysIoBusNumA %d\n",DeviceExtension->SystemIoBusNumber);
52 // DeviceExtension->SystemIoBusNumber = dev->bus->number;
53 // DPRINT1("UHCI: SysIoBusNumB %d\n",DeviceExtension->SystemIoBusNumber);
59 DriverUnload(PDRIVER_OBJECT DriverObject
)
61 PUSBMP_DEVICE_EXTENSION DeviceExtension
;
62 PDEVICE_OBJECT DeviceObject
;
65 DeviceObject
= DriverObject
->DeviceObject
;
66 DeviceExtension
= (PUSBMP_DEVICE_EXTENSION
)DeviceObject
->DeviceExtension
;
68 dev
= DeviceExtension
->pdev
;
70 DPRINT1("UHCI: DriverUnload()\n");
75 // Remove device (uhci_pci_driver.remove)
76 uhci_pci_driver
.remove(dev
);
78 ExFreePool(dev
->slot_name
);
81 // Perform some cleanup