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
;
67 DPRINT1("EHCI_Dispatch\n");
70 // get common device extension
72 DeviceExtension
= (PCOMMON_DEVICE_EXTENSION
)DeviceObject
->DeviceExtension
;
75 // get current stack location
77 IoStack
= IoGetCurrentIrpStackLocation(Irp
);
82 PC_ASSERT(DeviceExtension
->Dispatcher
);
84 switch(IoStack
->MajorFunction
)
91 return DeviceExtension
->Dispatcher
->HandlePnp(DeviceObject
, Irp
);
99 return DeviceExtension
->Dispatcher
->HandlePower(DeviceObject
, Irp
);
101 case IRP_MJ_SYSTEM_CONTROL
:
102 case IRP_MJ_DEVICE_CONTROL
:
107 return DeviceExtension
->Dispatcher
->HandleDeviceControl(DeviceObject
, Irp
);
112 // dispatch create request
114 Status
= STATUS_SUCCESS
;
120 DPRINT1("EHCI_Dispatch> Major %lu Minor %lu not supported\n", IoStack
->MajorFunction
, IoStack
->MinorFunction
);
121 Status
= STATUS_NOT_SUPPORTED
;
128 Irp
->IoStatus
.Information
= 0;
129 Irp
->IoStatus
.Status
= Status
;
130 IoCompleteRequest(Irp
, IO_NO_INCREMENT
);
140 PDRIVER_OBJECT DriverObject
,
141 PUNICODE_STRING RegistryPath
)
144 /* initialize driver object*/
145 DriverObject
->DriverExtension
->AddDevice
= EHCI_AddDevice
;
147 DriverObject
->MajorFunction
[IRP_MJ_CREATE
] = EHCI_Dispatch
;
148 DriverObject
->MajorFunction
[IRP_MJ_CLOSE
] = EHCI_Dispatch
;
149 DriverObject
->MajorFunction
[IRP_MJ_CLEANUP
] = EHCI_Dispatch
;
150 DriverObject
->MajorFunction
[IRP_MJ_DEVICE_CONTROL
] = EHCI_Dispatch
;
151 DriverObject
->MajorFunction
[IRP_MJ_INTERNAL_DEVICE_CONTROL
] = EHCI_Dispatch
;
152 DriverObject
->MajorFunction
[IRP_MJ_PNP
] = EHCI_Dispatch
;
154 return STATUS_SUCCESS
;