Author: mjmartin
Date: Sun Sep 5 18:43:17 2010
New Revision: 48704
URL:
http://svn.reactos.org/svn/reactos?rev=48704&view=rev
Log:
[usb/usbehci]
- Fix flags settings for PortStatus and PortChange so that the correct flags are set when
hub driver sets/requests them.
- Use FastMutex to protect access to async queue and frame list.
- For USB CONFIG DESC, Check the output buffer size before attempting to write all
configuration descriptors.
- Fix a bug that caused bmRequestType to be incorret value when requesting configuration
and string descriptors.
- Modify some debugging to make it easier to see debug messages from usbhub driver.
Modified:
trunk/reactos/drivers/usb/usbehci/fdo.c
trunk/reactos/drivers/usb/usbehci/irp.c
trunk/reactos/drivers/usb/usbehci/pdo.c
trunk/reactos/drivers/usb/usbehci/urbreq.c
trunk/reactos/drivers/usb/usbehci/usbehci.h
trunk/reactos/drivers/usb/usbehci/usbiffn.c
Modified: trunk/reactos/drivers/usb/usbehci/fdo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/fdo.c?…
==============================================================================
--- trunk/reactos/drivers/usb/usbehci/fdo.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbehci/fdo.c [iso-8859-1] Sun Sep 5 18:43:17 2010
@@ -19,6 +19,13 @@
ULONG CStatus;
FdoDeviceExtension = (PFDO_DEVICE_EXTENSION) DeferredContext;
+
+ if (!FdoDeviceExtension->Pdo)
+ {
+ DPRINT1("PDO not set yet!\n");
+ return;
+ }
+
PdoDeviceExtension = (PPDO_DEVICE_EXTENSION)
FdoDeviceExtension->Pdo->DeviceExtension;
CStatus = (ULONG) SystemArgument2;
@@ -80,7 +87,8 @@
tmp = READ_REGISTER_ULONG((PULONG)((Base + EHCI_PORTSC) + (4 * i)));
PdoDeviceExtension->ChildDeviceCount++;
- PdoDeviceExtension->Ports[i].PortStatus |=
USB_PORT_STATUS_HIGH_SPEED | USB_PORT_STATUS_CONNECT;
+ PdoDeviceExtension->Ports[i].PortStatus &= ~0x8000;
+ PdoDeviceExtension->Ports[i].PortStatus |=
USB_PORT_STATUS_CONNECT;
PdoDeviceExtension->Ports[i].PortChange |=
USB_PORT_STATUS_CONNECT;
PdoDeviceExtension->HaltQueue = FALSE;
@@ -194,7 +202,7 @@
LONG tmp2;
ULONG base;
- DPRINT1("Starting Ehci controller\n");
+ DPRINT("Starting Ehci controller\n");
FdoDeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
base = (ULONG)FdoDeviceExtension->ResourceMemory;
@@ -408,6 +416,8 @@
/* Zeroize it */
RtlZeroMemory(FdoDeviceExtension->PeriodicFramList, sizeof(ULONG) * 1024);
+ ExInitializeFastMutex(&FdoDeviceExtension->FrameListMutex);
+
/* Allocate Common Buffer for Async List Head Queue */
FdoDeviceExtension->AsyncListQueueHeadPtr =
FdoDeviceExtension->pDmaAdapter->DmaOperations->AllocateCommonBuffer(FdoDeviceExtension->pDmaAdapter,
@@ -426,6 +436,8 @@
RtlZeroMemory(FdoDeviceExtension->AsyncListQueueHeadPtr,
/* FIXME: Same as FIXME above */
20800);
+
+ ExInitializeFastMutex(&FdoDeviceExtension->AsyncListMutex);
Status = IoGetDeviceProperty(FdoDeviceExtension->LowerDevice,
DevicePropertyAddress,
@@ -540,6 +552,8 @@
DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+ DPRINT1("Ehci: QueryBusRelations\n");
+
/* Create the PDO with the next available number */
while (TRUE)
{
@@ -623,7 +637,7 @@
{
case IRP_MN_START_DEVICE:
{
- DPRINT1("START_DEVICE\n");
+ DPRINT1("Ehci: START_DEVICE\n");
Irp->IoStatus.Status = STATUS_SUCCESS;
Status = ForwardAndWait(DeviceObject, Irp);
@@ -634,20 +648,20 @@
}
case IRP_MN_QUERY_DEVICE_RELATIONS:
{
- DPRINT1("IRP_MN_QUERY_DEVICE_RELATIONS\n");
+ DPRINT1("Ehci: IRP_MN_QUERY_DEVICE_RELATIONS\n");
switch(Stack->Parameters.QueryDeviceRelations.Type)
{
case BusRelations:
{
PDEVICE_RELATIONS DeviceRelations = NULL;
- DPRINT("BusRelations\n");
+ DPRINT1("Ehci: BusRelations\n");
Status = FdoQueryBusRelations(DeviceObject, &DeviceRelations);
Information = (ULONG_PTR)DeviceRelations;
break;
}
default:
{
- DPRINT("Unknown query device relations type\n");
+ DPRINT1("Ehci: Unknown query device relations type\n");
Status = STATUS_NOT_IMPLEMENTED;
break;
}
@@ -656,16 +670,17 @@
}
case IRP_MN_FILTER_RESOURCE_REQUIREMENTS:
{
- DPRINT("IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n");
+ DPRINT1("Ehci: IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n");
return ForwardIrpAndForget(DeviceObject, Irp);
break;
}
case IRP_MN_QUERY_RESOURCE_REQUIREMENTS:
{
- DPRINT("IRP_MN_QUERY_RESOURCE_REQUIREMENTS\n");
+ DPRINT1("Ehci: IRP_MN_QUERY_RESOURCE_REQUIREMENTS\n");
}
case IRP_MN_QUERY_INTERFACE:
{
+ DPRINT1("Ehci: IRP_MN_QUERY_INTERFACE\n");
Status = STATUS_SUCCESS;
Information = 0;
Status = ForwardIrpAndForget(DeviceObject, Irp);
@@ -674,7 +689,7 @@
}
default:
{
- DPRINT1("IRP_MJ_PNP / Unhandled minor function 0x%lx\n",
Stack->MinorFunction);
+ DPRINT1("Ehci: IRP_MJ_PNP / Unhandled minor function 0x%lx\n",
Stack->MinorFunction);
return ForwardIrpAndForget(DeviceObject, Irp);
}
}
@@ -701,7 +716,7 @@
PFDO_DEVICE_EXTENSION FdoDeviceExtension;
- DPRINT("Ehci AddDevice\n");
+ DPRINT1("Ehci: AddDevice\n");
/* Create the FDO with next available number */
while (TRUE)
@@ -818,14 +833,14 @@
if (!NT_SUCCESS(Status))
{
DPRINT1("Unable to register device interface!\n");
- ASSERT(FALSE);
+ return Status;
}
else
{
Status = IoSetDeviceInterfaceState(&InterfaceSymLinkName, TRUE);
DPRINT1("SetInterfaceState %x\n", Status);
if (!NT_SUCCESS(Status))
- ASSERT(FALSE);
+ return Status;
}
Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
@@ -836,6 +851,7 @@
FdoDispatchInternalDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
{
PFDO_DEVICE_EXTENSION FdoDeviceExtension;
+ PPDO_DEVICE_EXTENSION PdoDeviceExtension;
PIO_STACK_LOCATION Stack = NULL;
NTSTATUS Status = STATUS_UNSUCCESSFUL;
ULONG_PTR Information = 0;
@@ -843,6 +859,7 @@
URB *Urb;
FdoDeviceExtension = (PFDO_DEVICE_EXTENSION) DeviceObject->DeviceExtension;
+ PdoDeviceExtension = (PPDO_DEVICE_EXTENSION)
FdoDeviceExtension->Pdo->DeviceExtension;
ASSERT(FdoDeviceExtension->Common.IsFdo == TRUE);
@@ -851,25 +868,31 @@
ASSERT(Stack->Parameters.DeviceIoControl.IoControlCode ==
IOCTL_INTERNAL_USB_SUBMIT_URB);
Urb = (PURB) Stack->Parameters.Others.Argument1;
- DPRINT("Header Length %d\n", Urb->UrbHeader.Length);
- DPRINT("Header Function %d\n", Urb->UrbHeader.Function);
-
- UsbDevice = Urb->UrbHeader.UsbdDeviceHandle;
-
+ DPRINT1("Header Length %d\n", Urb->UrbHeader.Length);
+ DPRINT1("Header Function %d\n", Urb->UrbHeader.Function);
+
+ UsbDevice = DeviceHandleToUsbDevice(PdoDeviceExtension,
Urb->UrbHeader.UsbdDeviceHandle);
+
+ if (!UsbDevice)
+ {
+ DPRINT1("Invalid DeviceHandle or device not connected\n");
+ return STATUS_DEVICE_NOT_CONNECTED;
+ }
switch (Urb->UrbHeader.Function)
{
case URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
{
- DPRINT1("URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:\n");
+ DPRINT1("Ehci: URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:\n");
break;
}
case URB_FUNCTION_GET_STATUS_FROM_DEVICE:
{
- DPRINT1("URB_FUNCTION_GET_STATUS_FROM_DEVICE\n");
+ DPRINT1("Ehci: URB_FUNCTION_GET_STATUS_FROM_DEVICE\n");
break;
}
case URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE:
{
+ DPRINT1("Ehci: URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE\n");
switch(Urb->UrbControlDescriptorRequest.DescriptorType)
{
case USB_DEVICE_DESCRIPTOR_TYPE:
@@ -880,30 +903,63 @@
}
case USB_CONFIGURATION_DESCRIPTOR_TYPE:
DPRINT1("USB CONFIG DESC\n");
+ //break;
case USB_STRING_DESCRIPTOR_TYPE:
DPRINT1("Usb String Descriptor\n");
{
USB_DEFAULT_PIPE_SETUP_PACKET CtrlSetup;
+ PUSB_STRING_DESCRIPTOR UsbString;
BOOLEAN ResultOk;
CtrlSetup.bmRequestType._BM.Recipient = BMREQUEST_TO_DEVICE;
CtrlSetup.bmRequestType._BM.Type = BMREQUEST_STANDARD;
+ CtrlSetup.bmRequestType._BM.Reserved = 0;
CtrlSetup.bmRequestType._BM.Dir = BMREQUEST_DEVICE_TO_HOST;
CtrlSetup.bRequest = USB_REQUEST_GET_DESCRIPTOR;
CtrlSetup.wValue.LowByte =
Urb->UrbControlDescriptorRequest.Index;
CtrlSetup.wValue.HiByte =
Urb->UrbControlDescriptorRequest.DescriptorType;
+
if (Urb->UrbControlDescriptorRequest.DescriptorType ==
USB_STRING_DESCRIPTOR_TYPE)
+ {
+ if ((Urb->UrbControlDescriptorRequest.Index !=
UsbDevice->DeviceDescriptor.iManufacturer) &&
+ (UsbDevice->DeviceDescriptor.iManufacturer) &&
+ (UsbDevice->DeviceDescriptor.iSerialNumber))
+ {
+ DPRINT1("Invalid Index\n");
+ Urb->UrbHeader.Status = USBD_STATUS_INVALID_PARAMETER;
+ Status = STATUS_SUCCESS;
+ Information = 0;
+ break;
+ }
+
CtrlSetup.wIndex.W =
Urb->UrbControlDescriptorRequest.LanguageId;
+ RtlZeroMemory(Urb->UrbControlDescriptorRequest.TransferBuffer,
Urb->UrbControlDescriptorRequest.TransferBufferLength-1);
+ }
else
CtrlSetup.wIndex.W = 0;
+
CtrlSetup.wLength =
Urb->UrbControlDescriptorRequest.TransferBufferLength;
ResultOk = ExecuteControlRequest(FdoDeviceExtension, &CtrlSetup,
UsbDevice->Address, UsbDevice->Port,
Urb->UrbControlDescriptorRequest.TransferBuffer,
Urb->UrbControlDescriptorRequest.TransferBufferLength);
+ if (Urb->UrbControlDescriptorRequest.DescriptorType ==
USB_STRING_DESCRIPTOR_TYPE)
+ {
+ UsbString = Urb->UrbControlDescriptorRequest.TransferBuffer;
+ DPRINT1("Index %x\n",
Urb->UrbControlDescriptorRequest.Index);
+ DPRINT1("BufferLength %x\n",
Urb->UrbControlDescriptorRequest.TransferBufferLength);
+ DPRINT1("Length %x\n", UsbString->bLength);
+ if (Urb->UrbControlDescriptorRequest.Index == 0)
+ {
+ DPRINT1("%x\n",
(ULONG)Urb->UrbControlDescriptorRequest.TransferBuffer);
+ }
+ else
+ DPRINT1("String %S\n",
&UsbString->bString);
+ }
+ UsbString = Urb->UrbControlDescriptorRequest.TransferBuffer;
Urb->UrbHeader.Status = USBD_STATUS_SUCCESS;
Status = STATUS_SUCCESS;
-
+ Information = UsbString->bLength;
break;
}
default:
@@ -915,12 +971,13 @@
}
case URB_FUNCTION_SELECT_CONFIGURATION:
{
- DPRINT1("Selecting Configuration\n");
+ DPRINT1("Ehci: URB_FUNCTION_SELECT_CONFIGURATION\n");
DPRINT1("Urb->UrbSelectConfiguration.ConfigurationHandle
%x\n",Urb->UrbSelectConfiguration.ConfigurationHandle);
break;
}
case URB_FUNCTION_CLASS_DEVICE:
{
+ DPRINT1("Ehci: URB_FUNCTION_CLASS_DEVICE
%x\n",Urb->UrbControlVendorClassRequest.Request);
switch (Urb->UrbControlVendorClassRequest.Request)
{
case USB_REQUEST_GET_DESCRIPTOR:
@@ -999,6 +1056,7 @@
}
case URB_FUNCTION_CLASS_OTHER:
{
+ DPRINT1("Ehci: URB_FUNCTION_CLASS_OTHER\n");
switch (Urb->UrbControlVendorClassRequest.Request)
{
case USB_REQUEST_GET_STATUS:
@@ -1099,7 +1157,7 @@
}
default:
{
- DPRINT1("Unhandled URB %x\n", Urb->UrbHeader.Function);
+ DPRINT1("Ehci: Unhandled URB %x\n", Urb->UrbHeader.Function);
//Urb->UrbHeader.Status = USBD_STATUS_INVALID_URB_FUNCTION;
}
}
Modified: trunk/reactos/drivers/usb/usbehci/irp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/irp.c?…
==============================================================================
--- trunk/reactos/drivers/usb/usbehci/irp.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbehci/irp.c [iso-8859-1] Sun Sep 5 18:43:17 2010
@@ -37,6 +37,7 @@
if (Irp->Cancel && IoSetCancelRoutine(Irp, NULL))
{
+ DPRINT1("Cancelled!!!!???\n");
KeReleaseSpinLock(&DeviceExtension->IrpQueueLock, OldIrql);
Irp->IoStatus.Status = STATUS_CANCELLED;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
@@ -175,15 +176,18 @@
LONG i, j;
DPRINT1("USB CONFIG DESC\n");
-
if (Urb->UrbControlDescriptorRequest.TransferBufferLength
>= UsbDevice->ActiveConfig->ConfigurationDescriptor.wTotalLength)
{
Urb->UrbControlDescriptorRequest.TransferBufferLength =
UsbDevice->ActiveConfig->ConfigurationDescriptor.wTotalLength;
}
else
{
- DPRINT1("Buffer to small!!!\n");
- //ASSERT(FALSE);
+ DPRINT1("TransferBufferLenth %x is too small!!!\n",
Urb->UrbControlDescriptorRequest.TransferBufferLength);
+ if (Urb->UrbControlDescriptorRequest.TransferBufferLength
< sizeof(USB_CONFIGURATION_DESCRIPTOR))
+ {
+ DPRINT1("Bail!\n");
+ break;
+ }
}
ASSERT(Urb->UrbControlDescriptorRequest.TransferBuffer);
@@ -191,6 +195,14 @@
/* Copy the Configuration Descriptor */
RtlCopyMemory(BufPtr,
&UsbDevice->ActiveConfig->ConfigurationDescriptor,
sizeof(USB_CONFIGURATION_DESCRIPTOR));
+
+ /* If there is no room for all the configs then bail */
+ if (!(Urb->UrbControlDescriptorRequest.TransferBufferLength
> sizeof(USB_CONFIGURATION_DESCRIPTOR)))
+ {
+ DPRINT1("Bail!\n");
+ break;
+ }
+
BufPtr += sizeof(USB_CONFIGURATION_DESCRIPTOR);
for (i = 0; i <
UsbDevice->ActiveConfig->ConfigurationDescriptor.bNumInterfaces; i++)
{
@@ -348,6 +360,8 @@
{
PUSB_HUB_DESCRIPTOR UsbHubDescr =
Urb->UrbControlVendorClassRequest.TransferBuffer;
+
+ DPRINT1("Length %x\n",
Urb->UrbControlVendorClassRequest.TransferBufferLength);
ASSERT(Urb->UrbControlVendorClassRequest.TransferBuffer != 0);
/* FIXME: Handle more than root hub? */
if(Urb->UrbControlVendorClassRequest.TransferBufferLength >=
sizeof(USB_HUB_DESCRIPTOR))
@@ -383,7 +397,6 @@
case USB_REQUEST_GET_STATUS:
{
DPRINT1("DEVICE: USB_REQUEST_GET_STATUS for port %d\n",
Urb->UrbControlVendorClassRequest.Index);
-
if (Urb->UrbControlVendorClassRequest.Index == 1)
{
ASSERT(Urb->UrbControlVendorClassRequest.TransferBuffer !=
0);
@@ -401,12 +414,17 @@
}
case URB_FUNCTION_CLASS_OTHER:
{
+
+ /* FIXME: Each one of these needs to make sure that the index value is a
valid for a port (1-8) and return STATUS_UNSUCCESSFUL is not */
+
switch (Urb->UrbControlVendorClassRequest.Request)
{
case USB_REQUEST_GET_STATUS:
{
DPRINT1("OTHER: USB_REQUEST_GET_STATUS for port %d\n",
Urb->UrbControlVendorClassRequest.Index);
ASSERT(Urb->UrbControlVendorClassRequest.TransferBuffer !=
0);
+ DPRINT1("PortStatus %x\n",
DeviceExtension->Ports[Urb->UrbControlVendorClassRequest.Index-1].PortStatus);
+ DPRINT1("PortChange %x\n",
DeviceExtension->Ports[Urb->UrbControlVendorClassRequest.Index-1].PortChange);
((PUSHORT)Urb->UrbControlVendorClassRequest.TransferBuffer)[0]
= DeviceExtension->Ports[Urb->UrbControlVendorClassRequest.Index-1].PortStatus;
((PUSHORT)Urb->UrbControlVendorClassRequest.TransferBuffer)[1]
= DeviceExtension->Ports[Urb->UrbControlVendorClassRequest.Index-1].PortChange;
break;
@@ -443,7 +461,12 @@
}
case PORT_ENABLE:
{
- DPRINT1("Unhandled Set Feature\n");
+ DPRINT1("PORT_ENABLE not implemented\n");
+ break;
+ }
+ case PORT_POWER:
+ {
+ DPRINT1("PORT_POWER not implemented\n");
break;
}
default:
Modified: trunk/reactos/drivers/usb/usbehci/pdo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/pdo.c?…
==============================================================================
--- trunk/reactos/drivers/usb/usbehci/pdo.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbehci/pdo.c [iso-8859-1] Sun Sep 5 18:43:17 2010
@@ -128,8 +128,12 @@
URB *Urb;
Urb = (PURB) Stack->Parameters.Others.Argument1;
- DPRINT("Header Length %d\n", Urb->UrbHeader.Length);
- DPRINT("Header Function %d\n", Urb->UrbHeader.Function);
+
+ if ((Urb->UrbHeader.Function == URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER)
&&
+ (Urb->UrbHeader.UsbdDeviceHandle ==
PdoDeviceExtension->UsbDevices[0]))
+ {
+ PdoDeviceExtension->HaltQueue = TRUE;
+ }
/* Queue all request for now, kernel thread will complete them */
QueueURBRequest(PdoDeviceExtension, Irp);
Information = 0;
@@ -166,11 +170,11 @@
}
case IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE:
{
- DPRINT1("IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE %x\n",
IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE);
+ DPRINT("Ehci: IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE %x\n",
Stack->Parameters.Others.Argument2);
if (Stack->Parameters.Others.Argument1)
{
/* Return the root hubs devicehandle */
- DPRINT1("Returning RootHub Handle %x\n",
PdoDeviceExtension->UsbDevices[0]);
+ DPRINT("Returning RootHub Handle %x\n",
PdoDeviceExtension->UsbDevices[0]);
*(PVOID *)Stack->Parameters.Others.Argument1 =
(PVOID)PdoDeviceExtension->UsbDevices[0];
Status = STATUS_SUCCESS;
}
@@ -182,13 +186,13 @@
}
case IOCTL_INTERNAL_USB_GET_HUB_COUNT:
{
- DPRINT1("IOCTL_INTERNAL_USB_GET_HUB_COUNT %x\n",
IOCTL_INTERNAL_USB_GET_HUB_COUNT);
+ DPRINT("Ehci: IOCTL_INTERNAL_USB_GET_HUB_COUNT %x\n",
IOCTL_INTERNAL_USB_GET_HUB_COUNT);
ASSERT(Stack->Parameters.Others.Argument1 != NULL);
if (Stack->Parameters.Others.Argument1)
{
/* FIXME: Determine the number of hubs between the usb device and root
hub */
DPRINT1("RootHubCount %x\n",
*(PULONG)Stack->Parameters.Others.Argument1);
- *(PULONG)Stack->Parameters.Others.Argument1 = 0;
+ *(PULONG)Stack->Parameters.Others.Argument1 = 1;
}
Status = STATUS_SUCCESS;
break;
@@ -215,8 +219,7 @@
}
case IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO:
{
- DPRINT1("IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO\n");
-
+ DPRINT("Ehci: IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO Arg1 %x, Arg2
%x\n", Stack->Parameters.Others.Argument1,
Stack->Parameters.Others.Argument2);
if (Stack->Parameters.Others.Argument1)
*(PVOID *)Stack->Parameters.Others.Argument1 =
FdoDeviceExtension->Pdo;
if (Stack->Parameters.Others.Argument2)
@@ -229,7 +232,7 @@
case IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION:
{
PUSB_IDLE_CALLBACK_INFO CallBackInfo;
- DPRINT1("IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION\n");
+ DPRINT1("Ehci: IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION\n");
/* FIXME: Set Callback for safe power down */
CallBackInfo = Stack->Parameters.DeviceIoControl.Type3InputBuffer;
DPRINT1("IdleCallback %x\n", CallBackInfo->IdleCallback);
@@ -368,6 +371,7 @@
UNICODE_STRING InterfaceSymLinkName;
LONG i;
+ DPRINT1("Ehci: PDO StartDevice\n");
PdoDeviceExtension =
(PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
FdoDeviceExtension =
(PFDO_DEVICE_EXTENSION)PdoDeviceExtension->ControllerFdo->DeviceExtension;
@@ -376,8 +380,11 @@
for (i = 0; i < 8; i++)
{
- PdoDeviceExtension->Ports[i].PortStatus = USB_PORT_STATUS_ENABLE;
+ PdoDeviceExtension->Ports[i].PortStatus = USB_PORT_STATUS_HIGH_SPEED |
0x8000;
PdoDeviceExtension->Ports[i].PortChange = 0;
+
+ if (!FdoDeviceExtension->ECHICaps.HCSParams.PortPowerControl)
+ PdoDeviceExtension->Ports[i].PortStatus |= USB_PORT_STATUS_POWER;
}
RtlCopyMemory(&RootHubDevice->DeviceDescriptor,
@@ -441,13 +448,13 @@
if (!NT_SUCCESS(Status))
{
DPRINT1("Failed to register interface\n");
- ASSERT(FALSE);
+ return Status;
}
else
{
Status = IoSetDeviceInterfaceState(&InterfaceSymLinkName, TRUE);
if (!NT_SUCCESS(Status))
- ASSERT(FALSE);
+ return Status;
}
Status = STATUS_SUCCESS;
@@ -455,6 +462,7 @@
}
case IRP_MN_QUERY_DEVICE_RELATIONS:
{
+ DPRINT1("Ehci: PDO QueryDeviceRelations\n");
switch (Stack->Parameters.QueryDeviceRelations.Type)
{
case TargetDeviceRelation:
@@ -499,6 +507,7 @@
}
case IRP_MN_QUERY_CAPABILITIES:
{
+ DPRINT("Ehci: PDO Query Capabilities\n");
PDEVICE_CAPABILITIES DeviceCapabilities;
ULONG i;
@@ -538,6 +547,7 @@
case IRP_MN_QUERY_ID:
{
+ DPRINT("Ehci: PDO Query ID\n");
Status = PdoQueryId(DeviceObject, Irp, &Information);
break;
}
@@ -549,6 +559,8 @@
PPDO_DEVICE_EXTENSION PdoDeviceExtension;
PFDO_DEVICE_EXTENSION FdoDeviceExtension;
+ DPRINT("Ehci: PDO Query Interface\n");
+
PdoDeviceExtension =
(PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
FdoDeviceExtension =
(PFDO_DEVICE_EXTENSION)PdoDeviceExtension->ControllerFdo->DeviceExtension;
@@ -557,10 +569,6 @@
{
DPRINT1("Failed to create string from GUID!\n");
}
-
- DPRINT("Interface GUID requested %wZ\n", &GuidString);
- DPRINT("QueryInterface.Size %x\n",
Stack->Parameters.QueryInterface.Size);
- DPRINT("QueryInterface.Version %x\n",
Stack->Parameters.QueryInterface.Version);
/* Assume success */
Status = STATUS_SUCCESS;
Modified: trunk/reactos/drivers/usb/usbehci/urbreq.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/urbreq…
==============================================================================
--- trunk/reactos/drivers/usb/usbehci/urbreq.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbehci/urbreq.c [iso-8859-1] Sun Sep 5 18:43:17 2010
@@ -125,6 +125,8 @@
DPRINT1("ExecuteControlRequest: Buffer %x, Length %x\n", Buffer,
BufferLength);
+ ExAcquireFastMutex(&DeviceExtension->AsyncListMutex);
+
Base = (ULONG) DeviceExtension->ResourceMemory;
/* Set up the QUEUE HEAD in memory */
@@ -141,6 +143,7 @@
QueueHead->EndPointCapabilities2.PortNumber = Port;
QueueHead->EndPointCapabilities1.DeviceAddress = Address;
+
CtrlSetup->bmRequestType._BM.Recipient =
SetupPacket->bmRequestType._BM.Recipient;
CtrlSetup->bmRequestType._BM.Type = SetupPacket->bmRequestType._BM.Type;
@@ -208,5 +211,8 @@
DPRINT1("Unable to copy data to buffer\n");
}
+
+ ExReleaseFastMutex(&DeviceExtension->AsyncListMutex);
+
return TRUE;
}
Modified: trunk/reactos/drivers/usb/usbehci/usbehci.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/usbehc…
==============================================================================
--- trunk/reactos/drivers/usb/usbehci/usbehci.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbehci/usbehci.h [iso-8859-1] Sun Sep 5 18:43:17 2010
@@ -389,6 +389,9 @@
PULONG AsyncListQueueHeadPtr;
PHYSICAL_ADDRESS PeriodicFramListPhysAddr;
PHYSICAL_ADDRESS AsyncListQueueHeadPtrPhysAddr;
+
+ FAST_MUTEX AsyncListMutex;
+ FAST_MUTEX FrameListMutex;
BOOLEAN AsyncComplete;
Modified: trunk/reactos/drivers/usb/usbehci/usbiffn.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/usbiff…
==============================================================================
--- trunk/reactos/drivers/usb/usbehci/usbiffn.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbehci/usbiffn.c [iso-8859-1] Sun Sep 5 18:43:17 2010
@@ -14,6 +14,7 @@
PVOID InternalCreateUsbDevice(UCHAR DeviceNumber, ULONG Port, PUSB_DEVICE Parent, BOOLEAN
Hub)
{
PUSB_DEVICE UsbDevicePointer = NULL;
+
UsbDevicePointer = ExAllocatePoolWithTag(NonPagedPool, sizeof(USB_DEVICE),
USB_POOL_TAG);
if (!UsbDevicePointer)
@@ -42,14 +43,14 @@
USB_BUSIFFN
InterfaceReference(PVOID BusContext)
{
- DPRINT1("InterfaceReference called\n");
+ DPRINT1("Ehci: InterfaceReference called\n");
}
VOID
USB_BUSIFFN
InterfaceDereference(PVOID BusContext)
{
- DPRINT1("InterfaceDereference called\n");
+ DPRINT1("Ehci: InterfaceDereference called\n");
}
/* Bus Interface Hub V5 Functions */
@@ -65,7 +66,7 @@
PUSB_DEVICE UsbDevice;
LONG i = 0;
PdoDeviceExtension =
(PPDO_DEVICE_EXTENSION)((PDEVICE_OBJECT)BusContext)->DeviceExtension;
- DPRINT("CreateUsbDevice: HubDeviceHandle %x, PortStatus %x, PortNumber
%x\n", HubDeviceHandle, PortStatus, PortNumber);
+ DPRINT1("Ehci: CreateUsbDevice: HubDeviceHandle %x, PortStatus %x, PortNumber
%x\n", HubDeviceHandle, PortStatus, PortNumber);
if (PdoDeviceExtension->UsbDevices[0] != HubDeviceHandle)
{
@@ -116,7 +117,7 @@
PUCHAR Ptr;
LONG i, j, k;
- DPRINT1("InitializeUsbDevice called, device %x\n", DeviceHandle);
+ DPRINT1("Ehci: InitializeUsbDevice called, device %x\n", DeviceHandle);
PdoDeviceExtension =
(PPDO_DEVICE_EXTENSION)((PDEVICE_OBJECT)BusContext)->DeviceExtension;
FdoDeviceExtension =
(PFDO_DEVICE_EXTENSION)PdoDeviceExtension->ControllerFdo->DeviceExtension;
@@ -141,6 +142,7 @@
/* Set the device address */
CtrlSetup.bmRequestType._BM.Recipient = BMREQUEST_TO_DEVICE;
CtrlSetup.bmRequestType._BM.Type = BMREQUEST_STANDARD;
+ CtrlSetup.bmRequestType._BM.Reserved = 0;
CtrlSetup.bmRequestType._BM.Dir = BMREQUEST_HOST_TO_DEVICE;
CtrlSetup.bRequest = USB_REQUEST_SET_ADDRESS;
CtrlSetup.wValue.W = UsbDevice->Address;
@@ -209,6 +211,7 @@
sizeof(USB_CONFIGURATION) +
sizeof(PVOID) * ConfigDesc->bNumInterfaces,
USB_POOL_TAG);
UsbDevice->Configs[i]->Device = UsbDevice;
+
RtlCopyMemory(&UsbDevice->Configs[0]->ConfigurationDescriptor,
ConfigDesc, sizeof(USB_CONFIGURATION_DESCRIPTOR));
Ptr += ConfigDesc->bLength;
@@ -252,7 +255,7 @@
PULONG ConfigDescriptorBufferLength)
{
PUSB_DEVICE UsbDevice;
- DPRINT1("GetUsbDescriptor %x, %x, %x, %x\n", DeviceDescriptorBuffer,
*DeviceDescriptorBufferLength, ConfigDescriptorBuffer, *ConfigDescriptorBufferLength);
+ DPRINT1("Ehci: GetUsbDescriptor %x, %x, %x, %x\n", DeviceDescriptorBuffer,
*DeviceDescriptorBufferLength, ConfigDescriptorBuffer, *ConfigDescriptorBufferLength);
UsbDevice = DeviceHandleToUsbDevice(BusContext, DeviceHandle);
@@ -267,6 +270,7 @@
RtlCopyMemory(DeviceDescriptorBuffer, &UsbDevice->DeviceDescriptor,
sizeof(USB_DEVICE_DESCRIPTOR));
*DeviceDescriptorBufferLength = sizeof(USB_DEVICE_DESCRIPTOR);
}
+
if ((ConfigDescriptorBuffer) && (ConfigDescriptorBufferLength))
{
RtlCopyMemory(ConfigDescriptorBuffer,
&UsbDevice->ActiveConfig->ConfigurationDescriptor,
sizeof(USB_CONFIGURATION_DESCRIPTOR));
@@ -340,7 +344,7 @@
USB_BUSIFFN
RestoreUsbDevice(PVOID BusContext, PUSB_DEVICE_HANDLE OldDeviceHandle, PUSB_DEVICE_HANDLE
NewDeviceHandle)
{
- DPRINT1("RestoreUsbDevice called\n");
+ DPRINT1("Ehci: RestoreUsbDevice called\n");
return STATUS_NOT_SUPPORTED;
}
@@ -348,7 +352,7 @@
USB_BUSIFFN
GetPortHackFlags(PVOID BusContext, PULONG Flags)
{
- DPRINT1("GetPortHackFlags called\n");
+ DPRINT1("Ehci: GetPortHackFlags called\n");
return STATUS_NOT_SUPPORTED;
}
@@ -365,7 +369,7 @@
ULONG SizeNeeded;
LONG i;
- DPRINT1("QueryDeviceInformation (%x, %x, %x, %d, %x\n", BusContext,
DeviceHandle, DeviceInformationBuffer, DeviceInformationBufferLength, LengthReturned);
+ DPRINT1("Ehci: QueryDeviceInformation (%x, %x, %x, %d, %x\n", BusContext,
DeviceHandle, DeviceInformationBuffer, DeviceInformationBufferLength, LengthReturned);
UsbDevice = DeviceHandleToUsbDevice(BusContext, DeviceHandle);
@@ -418,7 +422,7 @@
{
PUSB_CONTROLLER_INFORMATION_0 ControllerInfo;
- DPRINT1("GetControllerInformation called\n");
+ DPRINT1("Ehci: GetControllerInformation called\n");
ControllerInfo = ControllerInformationBuffer;
@@ -447,7 +451,7 @@
USB_BUSIFFN
ControllerSelectiveSuspend(PVOID BusContext, BOOLEAN Enable)
{
- DPRINT1("ControllerSelectiveSuspend called\n");
+ DPRINT1("Ehci: ControllerSelectiveSuspend called\n");
return STATUS_NOT_SUPPORTED;
}
@@ -464,13 +468,16 @@
PPDO_DEVICE_EXTENSION PdoDeviceExtension =
(PPDO_DEVICE_EXTENSION)((PDEVICE_OBJECT)BusContext)->DeviceExtension;
PFDO_DEVICE_EXTENSION FdoDeviceExntension =
(PFDO_DEVICE_EXTENSION)PdoDeviceExtension->ControllerFdo->DeviceExtension;
LONG i;
- DPRINT1("GetExtendedHubInformation\n");
+ DPRINT1("Ehci: GetExtendedHubInformation BusContext %x, PDO %x\n",
BusContext, HubPhysicalDeviceObject);
/* Set the default return value */
*LengthReturned = 0;
- /* Caller must have set InformationLevel to 0 */
+
+ DPRINT1("InformationLevel %x\n", UsbExtHubInfo->InformationLevel);
+
+ /* Caller is suppose to have set InformationLevel to 0. However usbehci from MS seems
to ignore this */
if (UsbExtHubInfo->InformationLevel != 0)
{
- return STATUS_NOT_SUPPORTED;
+ DPRINT1("InformationLevel should really be set to 0. Ignoring\n");
}
UsbExtHubInfo->NumberOfPorts = 8;
@@ -496,7 +503,7 @@
ULONG HubSymNameBufferLength,
PULONG HubSymNameActualLength)
{
- DPRINT1("GetRootHubSymbolicName called\n");
+ DPRINT1("Ehci: GetRootHubSymbolicName called\n");
if (HubSymNameBufferLength < 16)
return STATUS_UNSUCCESSFUL;
@@ -512,7 +519,7 @@
{
PUSB_DEVICE UsbDevice;
- DPRINT1("GetDeviceBusContext called\n");
+ DPRINT1("Ehci: GetDeviceBusContext called\n");
UsbDevice = DeviceHandleToUsbDevice(HubBusContext, DeviceHandle);
if (!UsbDevice)
@@ -528,7 +535,7 @@
USB_BUSIFFN
Initialize20Hub(PVOID BusContext, PUSB_DEVICE_HANDLE HubDeviceHandle, ULONG TtCount)
{
- DPRINT1("Initialize20Hub called, HubDeviceHandle: %x\n", HubDeviceHandle);
+ DPRINT1("Ehci: Initialize20Hub called, HubDeviceHandle: %x\n",
HubDeviceHandle);
/* FIXME: */
/* Create the Irp Queue for SCE */
@@ -541,7 +548,7 @@
RootHubInitNotification(PVOID BusContext, PVOID CallbackContext, PRH_INIT_CALLBACK
CallbackRoutine)
{
PPDO_DEVICE_EXTENSION PdoDeviceExtension;
- DPRINT1("RootHubInitNotification %x, %x, %x\n", BusContext,
CallbackContext, CallbackRoutine);
+ DPRINT1("Ehci: RootHubInitNotification %x, %x, %x\n", BusContext,
CallbackContext, CallbackRoutine);
PdoDeviceExtension =
(PPDO_DEVICE_EXTENSION)((PDEVICE_OBJECT)BusContext)->DeviceExtension;
PdoDeviceExtension->CallbackContext = CallbackContext;
@@ -579,7 +586,7 @@
USB_BUSIFFN
SetDeviceHandleData(PVOID BusContext, PVOID DeviceHandle, PDEVICE_OBJECT UsbDevicePdo)
{
- DPRINT1("SetDeviceHandleData called\n");
+ DPRINT1("Ehci: SetDeviceHandleData called\n");
}
@@ -589,7 +596,7 @@
USB_BUSIFFN
GetUSBDIVersion(PVOID BusContext, PUSBD_VERSION_INFORMATION VersionInformation, PULONG
HcdCapabilites)
{
- DPRINT1("GetUSBDIVersion called\n");
+ DPRINT1("Ehci: GetUSBDIVersion called\n");
return;
}
@@ -597,7 +604,7 @@
USB_BUSIFFN
QueryBusTime(PVOID BusContext, PULONG CurrentFrame)
{
- DPRINT1("QueryBusTime called\n");
+ DPRINT1("Ehci: QueryBusTime called\n");
return STATUS_NOT_SUPPORTED;
}
@@ -605,7 +612,7 @@
USB_BUSIFFN
SubmitIsoOutUrb(PVOID BusContext, PURB Urb)
{
- DPRINT1("SubmitIsoOutUrb called\n");
+ DPRINT1("Ehci: SubmitIsoOutUrb called\n");
return STATUS_NOT_SUPPORTED;
}
@@ -617,7 +624,7 @@
PULONG BusInformationBufferLength,
PULONG BusInformationActualLength)
{
- DPRINT1("QueryBusInformation called\n");
+ DPRINT1("Ehci: QueryBusInformation called\n");
return STATUS_NOT_SUPPORTED;
}
@@ -625,7 +632,7 @@
USB_BUSIFFN
IsDeviceHighSpeed(PVOID BusContext)
{
- DPRINT1("IsDeviceHighSpeed called\n");
+ DPRINT1("Ehci: IsDeviceHighSpeed called\n");
return TRUE;
}
@@ -633,6 +640,6 @@
USB_BUSIFFN
EnumLogEntry(PVOID BusContext, ULONG DriverTag, ULONG EnumTag, ULONG P1, ULONG P2)
{
- DPRINT1("EnumLogEntry called\n");
- return STATUS_SUCCESS;
-}
+ DPRINT1("Ehci: EnumLogEntry called\n");
+ return STATUS_SUCCESS;
+}