Author: janderwald
Date: Sun Feb 12 00:49:18 2012
New Revision: 55552
URL:
http://svn.reactos.org/svn/reactos?rev=55552&view=rev
Log:
[USBEHCI]
- Enable async park mode when available
- Use correct type for the pipe handle
- Implement URB_FUNCTION_GET_STATUS_FROM_INTERFACE,
URB_FUNCTION_GET_STATUS_FROM_ENDPOINT
- Verify that there is buffer provided in SubmitSetupPacket
[KBDCLASS]
- Forward requests to lower device
Modified:
branches/usb-bringup-trunk/drivers/input/kbdclass/kbdclass.c
branches/usb-bringup-trunk/drivers/usb/usbehci/hardware.cpp
branches/usb-bringup-trunk/drivers/usb/usbehci/hub_controller.cpp
branches/usb-bringup-trunk/drivers/usb/usbehci/usb_device.cpp
Modified: branches/usb-bringup-trunk/drivers/input/kbdclass/kbdclass.c
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/input…
==============================================================================
--- branches/usb-bringup-trunk/drivers/input/kbdclass/kbdclass.c [iso-8859-1] (original)
+++ branches/usb-bringup-trunk/drivers/input/kbdclass/kbdclass.c [iso-8859-1] Sun Feb 12
00:49:18 2012
@@ -878,7 +878,7 @@
}
Irp->IoStatus.Status = Status;
- if (NT_SUCCESS(Status))
+ if (NT_SUCCESS(Status) || Status == STATUS_NOT_SUPPORTED)
{
IoSkipCurrentIrpStackLocation(Irp);
return IoCallDriver(DeviceExtension->LowerDevice, Irp);
Modified: branches/usb-bringup-trunk/drivers/usb/usbehci/hardware.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
==============================================================================
--- branches/usb-bringup-trunk/drivers/usb/usbehci/hardware.cpp [iso-8859-1] (original)
+++ branches/usb-bringup-trunk/drivers/usb/usbehci/hardware.cpp [iso-8859-1] Sun Feb 12
00:49:18 2012
@@ -737,7 +737,18 @@
UsbCmd.IntThreshold = 0x8; //1ms
UsbCmd.Run = TRUE;
UsbCmd.FrameListSize = 0x0; //1024
+
+ if (m_Capabilities.HCCParams.ParkMode)
+ {
+ //
+ // enable async park mode
+ //
+ UsbCmd.AsyncParkEnable = TRUE;
+ UsbCmd.AsyncParkCount = 3;
+ }
+
SetCommandRegister(&UsbCmd);
+
//
// Wait for execution to start
Modified: branches/usb-bringup-trunk/drivers/usb/usbehci/hub_controller.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
==============================================================================
--- branches/usb-bringup-trunk/drivers/usb/usbehci/hub_controller.cpp [iso-8859-1]
(original)
+++ branches/usb-bringup-trunk/drivers/usb/usbehci/hub_controller.cpp [iso-8859-1] Sun Feb
12 00:49:18 2012
@@ -827,7 +827,7 @@
PURB Urb)
{
PUSBDEVICE UsbDevice;
- PUSB_ENDPOINT_DESCRIPTOR EndPointDesc = NULL;
+ PUSB_ENDPOINT EndPointDesc = NULL;
//
// First check if the request is for the Status Change Endpoint
//
@@ -856,13 +856,13 @@
//
// Check PipeHandle to determine if this is a Bulk or Interrupt Transfer Request
//
- EndPointDesc =
(PUSB_ENDPOINT_DESCRIPTOR)Urb->UrbBulkOrInterruptTransfer.PipeHandle;
+ EndPointDesc = (PUSB_ENDPOINT)Urb->UrbBulkOrInterruptTransfer.PipeHandle;
//
// sanity checks
//
ASSERT(EndPointDesc);
- ASSERT((EndPointDesc->bmAttributes & USB_ENDPOINT_TYPE_MASK) ==
USB_ENDPOINT_TYPE_BULK || (EndPointDesc->bmAttributes & USB_ENDPOINT_TYPE_MASK) ==
USB_ENDPOINT_TYPE_INTERRUPT);
+ ASSERT((EndPointDesc->EndPointDescriptor.bmAttributes &
USB_ENDPOINT_TYPE_MASK) == USB_ENDPOINT_TYPE_BULK ||
(EndPointDesc->EndPointDescriptor.bmAttributes & USB_ENDPOINT_TYPE_MASK) ==
USB_ENDPOINT_TYPE_INTERRUPT);
//
// check if this is a valid usb device handle
@@ -881,7 +881,6 @@
// get device
//
UsbDevice = PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle);
-
return UsbDevice->SubmitIrp(Irp);
}
@@ -1171,7 +1170,6 @@
//
// sanity checks
//
- PC_ASSERT(Urb->UrbControlGetStatusRequest.Index == 0);
PC_ASSERT(Urb->UrbControlGetStatusRequest.TransferBufferLength >=
sizeof(USHORT));
PC_ASSERT(Urb->UrbControlGetStatusRequest.TransferBuffer);
@@ -1215,9 +1213,25 @@
CtrlSetup.bRequest = USB_REQUEST_GET_STATUS;
CtrlSetup.wValue.LowByte = 0;
CtrlSetup.wValue.HiByte = 0;
- CtrlSetup.wIndex.W = Urb->UrbControlGetStatusRequest.Index;
+ CtrlSetup.wIndex.W = Urb->UrbControlGetStatusRequest.Index;
CtrlSetup.wLength =
(USHORT)Urb->UrbControlGetStatusRequest.TransferBufferLength;
CtrlSetup.bmRequestType.B = 0x80;
+
+
+ if (Urb->UrbHeader.Function == URB_FUNCTION_GET_STATUS_FROM_INTERFACE)
+ {
+ //
+ // add interface type
+ //
+ CtrlSetup.bmRequestType.B |= 0x01;
+ }
+ else if (Urb->UrbHeader.Function == URB_FUNCTION_GET_STATUS_FROM_ENDPOINT)
+ {
+ //
+ // add interface type
+ //
+ CtrlSetup.bmRequestType.B |= 0x02;
+ }
//
// submit setup packet
@@ -2030,6 +2044,8 @@
Status = HandleClassDevice(Irp, Urb);
break;
case URB_FUNCTION_GET_STATUS_FROM_DEVICE:
+ case URB_FUNCTION_GET_STATUS_FROM_INTERFACE:
+ case URB_FUNCTION_GET_STATUS_FROM_ENDPOINT:
Status = HandleGetStatusFromDevice(Irp, Urb);
break;
case URB_FUNCTION_SELECT_CONFIGURATION:
@@ -2523,7 +2539,7 @@
//
// now initialize device
//
- Status = NewUsbDevice->Initialize(PHUBCONTROLLER(Controller),
Controller->GetUsbHardware(),PVOID(Controller), PortNumber, PortStatus);
+ Status = NewUsbDevice->Initialize(PHUBCONTROLLER(Controller),
Controller->GetUsbHardware(), HubDeviceHandle, PortNumber, PortStatus);
//
// check for success
Modified: branches/usb-bringup-trunk/drivers/usb/usbehci/usb_device.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
==============================================================================
--- branches/usb-bringup-trunk/drivers/usb/usbehci/usb_device.cpp [iso-8859-1] (original)
+++ branches/usb-bringup-trunk/drivers/usb/usbehci/usb_device.cpp [iso-8859-1] Sun Feb 12
00:49:18 2012
@@ -1038,27 +1038,40 @@
OUT PVOID Buffer)
{
NTSTATUS Status;
- PMDL Mdl;
-
- //
- // allocate mdl
- //
- Mdl = IoAllocateMdl(Buffer, BufferLength, FALSE, FALSE, 0);
-
- //
- // HACK HACK HACK: assume the buffer is build from non paged pool
- //
- MmBuildMdlForNonPagedPool(Mdl);
+ PMDL Mdl = NULL;
+
+ if (BufferLength)
+ {
+ //
+ // allocate mdl
+ //
+ Mdl = IoAllocateMdl(Buffer, BufferLength, FALSE, FALSE, 0);
+ if (!Mdl)
+ {
+ //
+ // no memory
+ //
+ return STATUS_INSUFFICIENT_RESOURCES;
+ }
+
+ //
+ // HACK HACK HACK: assume the buffer is build from non paged pool
+ //
+ MmBuildMdlForNonPagedPool(Mdl);
+ }
//
// commit setup packet
//
Status = CommitSetupPacket(SetupPacket, 0, BufferLength, Mdl);
- //
- // free mdl
- //
- IoFreeMdl(Mdl);
+ if (Mdl != NULL)
+ {
+ //
+ // free mdl
+ //
+ IoFreeMdl(Mdl);
+ }
//
// done