6 extern struct pci_driver ohci_pci_driver
;
7 extern struct pci_device_id ohci_pci_ids
[];
8 struct pci_device_id
* pci_ids
= &ohci_pci_ids
[0];
11 InitLinuxWrapper(PDEVICE_OBJECT DeviceObject
)
14 PUSBMP_DEVICE_EXTENSION DeviceExtension
= (PUSBMP_DEVICE_EXTENSION
)DeviceObject
->DeviceExtension
;
16 /* Create generic linux structure */
18 dev
= ExAllocatePoolWithTag(PagedPool
, sizeof(struct pci_dev
), USB_OHCI_TAG
);
19 DeviceExtension
->pdev
= dev
;
21 /* Initialize generic linux structure */
22 dev
->irq
= DeviceExtension
->InterruptVector
;
23 dev
->dev_ext
= (PVOID
)DeviceExtension
;
24 dev
->dev
.dev_ext
= (PVOID
)DeviceObject
;
25 dev
->slot_name
= ExAllocatePoolWithTag(NonPagedPool
, 128, USB_OHCI_TAG
); // 128 max len for slot name
30 strcpy(dev
->dev
.name
, "OpenHCI PCI-USB Controller");
31 strcpy(dev
->slot_name
, "OHCD PCI Slot");
33 // Init the OHCI HCD. Probe will be called automatically, but will fail because id=NULL
34 Status
= ohci_hcd_pci_init();
35 if (!NT_SUCCESS(Status
))
37 DPRINT("OHCI: ohci_hcd_pci_init() failed with status 0x%08lx\n", Status
);
38 /* FIXME: deinitialize linux wrapper */
39 ExFreePoolWithTag(dev
, USB_OHCI_TAG
);
46 // Probe device with real id now
47 ohci_pci_driver
.probe(dev
, ohci_pci_ids
);
49 return STATUS_SUCCESS
;
52 VOID STDCALL
DriverUnload(PDRIVER_OBJECT DriverObject
)
54 PUSBMP_DEVICE_EXTENSION DeviceExtension
;
55 PDEVICE_OBJECT DeviceObject
;
58 DeviceObject
= DriverObject
->DeviceObject
;
59 DeviceExtension
= (PUSBMP_DEVICE_EXTENSION
)DeviceObject
->DeviceExtension
;
61 dev
= DeviceExtension
->pdev
;
63 DPRINT1("DriverUnload()\n");
68 // Remove device (ohci_pci_driver.remove)
69 ohci_pci_driver
.remove(dev
);
71 ExFreePool(dev
->slot_name
);
74 // Perform some cleanup
75 ohci_hcd_pci_cleanup();