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/usbehci.cpp
5 * PURPOSE: USB EHCI device driver.
7 * Michael Martin (michael.martin@reactos.org)
8 * Johannes Anderwald (johannes.anderwald@reactos.org)
16 DRIVER_ADD_DEVICE EHCI_AddDevice
;
21 PDRIVER_OBJECT DriverObject
,
22 PDEVICE_OBJECT PhysicalDeviceObject
)
25 PHCDCONTROLLER HcdController
;
27 DPRINT1("EHCI_AddDevice\n");
29 /* first create the controller object */
30 Status
= CreateHCDController(&HcdController
);
31 if (!NT_SUCCESS(Status
))
33 /* failed to create hcd */
34 DPRINT1("AddDevice: Failed to create hcd with %x\n", Status
);
38 /* initialize the hcd */
39 Status
= HcdController
->Initialize(NULL
, // FIXME
41 PhysicalDeviceObject
);
43 /* check for success */
44 if (!NT_SUCCESS(Status
))
46 /* failed to initialize device */
47 DPRINT1("AddDevice: failed to initialize\n");
50 HcdController
->Release();
60 PDEVICE_OBJECT DeviceObject
,
63 PCOMMON_DEVICE_EXTENSION DeviceExtension
;
64 PIO_STACK_LOCATION IoStack
;
68 // get common device extension
70 DeviceExtension
= (PCOMMON_DEVICE_EXTENSION
)DeviceObject
->DeviceExtension
;
73 // get current stack location
75 IoStack
= IoGetCurrentIrpStackLocation(Irp
);
80 PC_ASSERT(DeviceExtension
->Dispatcher
);
82 switch(IoStack
->MajorFunction
)
89 return DeviceExtension
->Dispatcher
->HandlePnp(DeviceObject
, Irp
);
97 return DeviceExtension
->Dispatcher
->HandlePower(DeviceObject
, Irp
);
99 case IRP_MJ_INTERNAL_DEVICE_CONTROL
:
100 case IRP_MJ_DEVICE_CONTROL
:
105 return DeviceExtension
->Dispatcher
->HandleDeviceControl(DeviceObject
, Irp
);
109 DPRINT1("EHCI_Dispatch> Major %lu Minor %lu unhandeled\n", IoStack
->MajorFunction
, IoStack
->MinorFunction
);
110 Status
= STATUS_SUCCESS
;
117 Irp
->IoStatus
.Information
= 0;
118 Irp
->IoStatus
.Status
= Status
;
119 IoCompleteRequest(Irp
, IO_NO_INCREMENT
);
129 PDRIVER_OBJECT DriverObject
,
130 PUNICODE_STRING RegistryPath
)
133 /* initialize driver object*/
134 DriverObject
->DriverExtension
->AddDevice
= EHCI_AddDevice
;
136 DriverObject
->MajorFunction
[IRP_MJ_CREATE
] = EHCI_Dispatch
;
137 DriverObject
->MajorFunction
[IRP_MJ_CLOSE
] = EHCI_Dispatch
;
138 DriverObject
->MajorFunction
[IRP_MJ_CLEANUP
] = EHCI_Dispatch
;
139 DriverObject
->MajorFunction
[IRP_MJ_DEVICE_CONTROL
] = EHCI_Dispatch
;
140 DriverObject
->MajorFunction
[IRP_MJ_INTERNAL_DEVICE_CONTROL
] = EHCI_Dispatch
;
141 DriverObject
->MajorFunction
[IRP_MJ_PNP
] = EHCI_Dispatch
;
143 return STATUS_SUCCESS
;