mirror of
https://github.com/reactos/reactos.git
synced 2025-01-01 12:04:51 +00:00
[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 svn path=/branches/usb-bringup-trunk/; revision=55552
This commit is contained in:
parent
2a06585e89
commit
68c1c7661e
4 changed files with 61 additions and 21 deletions
|
@ -878,7 +878,7 @@ ClassPnp(
|
||||||
}
|
}
|
||||||
|
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status) || Status == STATUS_NOT_SUPPORTED)
|
||||||
{
|
{
|
||||||
IoSkipCurrentIrpStackLocation(Irp);
|
IoSkipCurrentIrpStackLocation(Irp);
|
||||||
return IoCallDriver(DeviceExtension->LowerDevice, Irp);
|
return IoCallDriver(DeviceExtension->LowerDevice, Irp);
|
||||||
|
|
|
@ -737,8 +737,19 @@ CUSBHardwareDevice::StartController(void)
|
||||||
UsbCmd.IntThreshold = 0x8; //1ms
|
UsbCmd.IntThreshold = 0x8; //1ms
|
||||||
UsbCmd.Run = TRUE;
|
UsbCmd.Run = TRUE;
|
||||||
UsbCmd.FrameListSize = 0x0; //1024
|
UsbCmd.FrameListSize = 0x0; //1024
|
||||||
|
|
||||||
|
if (m_Capabilities.HCCParams.ParkMode)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// enable async park mode
|
||||||
|
//
|
||||||
|
UsbCmd.AsyncParkEnable = TRUE;
|
||||||
|
UsbCmd.AsyncParkCount = 3;
|
||||||
|
}
|
||||||
|
|
||||||
SetCommandRegister(&UsbCmd);
|
SetCommandRegister(&UsbCmd);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Wait for execution to start
|
// Wait for execution to start
|
||||||
//
|
//
|
||||||
|
|
|
@ -827,7 +827,7 @@ CHubController::HandleBulkOrInterruptTransfer(
|
||||||
PURB Urb)
|
PURB Urb)
|
||||||
{
|
{
|
||||||
PUSBDEVICE UsbDevice;
|
PUSBDEVICE UsbDevice;
|
||||||
PUSB_ENDPOINT_DESCRIPTOR EndPointDesc = NULL;
|
PUSB_ENDPOINT EndPointDesc = NULL;
|
||||||
//
|
//
|
||||||
// First check if the request is for the Status Change Endpoint
|
// First check if the request is for the Status Change Endpoint
|
||||||
//
|
//
|
||||||
|
@ -856,13 +856,13 @@ CHubController::HandleBulkOrInterruptTransfer(
|
||||||
//
|
//
|
||||||
// Check PipeHandle to determine if this is a Bulk or Interrupt Transfer Request
|
// 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
|
// sanity checks
|
||||||
//
|
//
|
||||||
ASSERT(EndPointDesc);
|
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
|
// check if this is a valid usb device handle
|
||||||
|
@ -881,7 +881,6 @@ CHubController::HandleBulkOrInterruptTransfer(
|
||||||
// get device
|
// get device
|
||||||
//
|
//
|
||||||
UsbDevice = PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle);
|
UsbDevice = PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle);
|
||||||
|
|
||||||
return UsbDevice->SubmitIrp(Irp);
|
return UsbDevice->SubmitIrp(Irp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1171,7 +1170,6 @@ CHubController::HandleGetStatusFromDevice(
|
||||||
//
|
//
|
||||||
// sanity checks
|
// sanity checks
|
||||||
//
|
//
|
||||||
PC_ASSERT(Urb->UrbControlGetStatusRequest.Index == 0);
|
|
||||||
PC_ASSERT(Urb->UrbControlGetStatusRequest.TransferBufferLength >= sizeof(USHORT));
|
PC_ASSERT(Urb->UrbControlGetStatusRequest.TransferBufferLength >= sizeof(USHORT));
|
||||||
PC_ASSERT(Urb->UrbControlGetStatusRequest.TransferBuffer);
|
PC_ASSERT(Urb->UrbControlGetStatusRequest.TransferBuffer);
|
||||||
|
|
||||||
|
@ -1219,6 +1217,22 @@ CHubController::HandleGetStatusFromDevice(
|
||||||
CtrlSetup.wLength = (USHORT)Urb->UrbControlGetStatusRequest.TransferBufferLength;
|
CtrlSetup.wLength = (USHORT)Urb->UrbControlGetStatusRequest.TransferBufferLength;
|
||||||
CtrlSetup.bmRequestType.B = 0x80;
|
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
|
// submit setup packet
|
||||||
//
|
//
|
||||||
|
@ -2030,6 +2044,8 @@ CHubController::HandleDeviceControl(
|
||||||
Status = HandleClassDevice(Irp, Urb);
|
Status = HandleClassDevice(Irp, Urb);
|
||||||
break;
|
break;
|
||||||
case URB_FUNCTION_GET_STATUS_FROM_DEVICE:
|
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);
|
Status = HandleGetStatusFromDevice(Irp, Urb);
|
||||||
break;
|
break;
|
||||||
case URB_FUNCTION_SELECT_CONFIGURATION:
|
case URB_FUNCTION_SELECT_CONFIGURATION:
|
||||||
|
@ -2523,7 +2539,7 @@ USBHI_CreateUsbDevice(
|
||||||
//
|
//
|
||||||
// now initialize device
|
// 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
|
// check for success
|
||||||
|
|
|
@ -1038,27 +1038,40 @@ CUSBDevice::SubmitSetupPacket(
|
||||||
OUT PVOID Buffer)
|
OUT PVOID Buffer)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PMDL Mdl;
|
PMDL Mdl = NULL;
|
||||||
|
|
||||||
|
if (BufferLength)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// allocate mdl
|
// allocate mdl
|
||||||
//
|
//
|
||||||
Mdl = IoAllocateMdl(Buffer, BufferLength, FALSE, FALSE, 0);
|
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
|
// HACK HACK HACK: assume the buffer is build from non paged pool
|
||||||
//
|
//
|
||||||
MmBuildMdlForNonPagedPool(Mdl);
|
MmBuildMdlForNonPagedPool(Mdl);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// commit setup packet
|
// commit setup packet
|
||||||
//
|
//
|
||||||
Status = CommitSetupPacket(SetupPacket, 0, BufferLength, Mdl);
|
Status = CommitSetupPacket(SetupPacket, 0, BufferLength, Mdl);
|
||||||
|
|
||||||
|
if (Mdl != NULL)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// free mdl
|
// free mdl
|
||||||
//
|
//
|
||||||
IoFreeMdl(Mdl);
|
IoFreeMdl(Mdl);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// done
|
// done
|
||||||
|
|
Loading…
Reference in a new issue