mirror of
https://github.com/reactos/reactos.git
synced 2024-10-04 00:13:57 +00:00
[USBEHCI_NEW]
- Move error checking if controller reported an error inside the door bell ring check block - Extend interface of IUSBRequest to include DeviceAddress, which is needed to retrieve configuration descriptor of newly set address - Allocate CtrlSetup from nonpaged pool - Release setup packet on cleanup - Devices now receive an device address - Currently asserts while retrieving configuration descriptor as this code path is not yet existant *** Assertion failed: Urb->UrbHeader.UsbdDeviceHandle == NULL *** Source File: d:\usb-bringup\drivers\usb\usbehci_new\hub_controller.cpp, line 1118 svn path=/branches/usb-bringup/; revision=51477
This commit is contained in:
parent
ede1d48da4
commit
a3f701378c
|
@ -1003,20 +1003,20 @@ EhciDefferedRoutine(
|
|||
//
|
||||
if (CStatus & (EHCI_STS_RECL| EHCI_STS_INT | EHCI_ERROR_INT))
|
||||
{
|
||||
if (CStatus & EHCI_ERROR_INT)
|
||||
{
|
||||
//
|
||||
// controller reported error
|
||||
//
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
PC_ASSERT(FALSE);
|
||||
}
|
||||
|
||||
//
|
||||
// check if there is a door bell ring in progress
|
||||
//
|
||||
if (This->m_DoorBellRingInProgress == FALSE)
|
||||
{
|
||||
if (CStatus & EHCI_ERROR_INT)
|
||||
{
|
||||
//
|
||||
// controller reported error
|
||||
//
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
PC_ASSERT(FALSE);
|
||||
}
|
||||
|
||||
//
|
||||
// inform IUSBQueue of a completed queue head
|
||||
//
|
||||
|
|
|
@ -385,6 +385,7 @@ DECLARE_INTERFACE_(IUSBRequest, IUnknown)
|
|||
|
||||
virtual NTSTATUS InitializeWithSetupPacket(IN PDMAMEMORYMANAGER DmaManager,
|
||||
IN PUSB_DEFAULT_PIPE_SETUP_PACKET SetupPacket,
|
||||
IN UCHAR DeviceAddress,
|
||||
IN OUT ULONG TransferBufferLength,
|
||||
IN OUT PMDL TransferBuffer) = 0;
|
||||
|
||||
|
|
|
@ -310,26 +310,37 @@ NTSTATUS
|
|||
CUSBDevice::SetDeviceAddress(
|
||||
UCHAR DeviceAddress)
|
||||
{
|
||||
USB_DEFAULT_PIPE_SETUP_PACKET CtrlSetup;
|
||||
PUSB_DEFAULT_PIPE_SETUP_PACKET CtrlSetup;
|
||||
NTSTATUS Status;
|
||||
UCHAR OldAddress;
|
||||
ULONG Index;
|
||||
|
||||
DPRINT1("CUSBDevice::SetDeviceAddress Address %d\n", DeviceAddress);
|
||||
|
||||
CtrlSetup = (PUSB_DEFAULT_PIPE_SETUP_PACKET)ExAllocatePoolWithTag(NonPagedPool, sizeof(USB_DEFAULT_PIPE_SETUP_PACKET), TAG_USBEHCI);
|
||||
if (!CtrlSetup)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
//
|
||||
// zero request
|
||||
//
|
||||
RtlZeroMemory(&CtrlSetup, sizeof(USB_DEFAULT_PIPE_SETUP_PACKET));
|
||||
RtlZeroMemory(CtrlSetup, sizeof(USB_DEFAULT_PIPE_SETUP_PACKET));
|
||||
|
||||
//
|
||||
// initialize request
|
||||
//
|
||||
CtrlSetup.bRequest = USB_REQUEST_SET_ADDRESS;
|
||||
CtrlSetup.wValue.W = (USHORT)DeviceAddress;
|
||||
CtrlSetup->bRequest = USB_REQUEST_SET_ADDRESS;
|
||||
CtrlSetup->wValue.W = (USHORT)DeviceAddress;
|
||||
|
||||
//
|
||||
// set device address
|
||||
//
|
||||
Status = CommitSetupPacket(&CtrlSetup, 0, 0);
|
||||
Status = CommitSetupPacket(CtrlSetup, 0, 0);
|
||||
|
||||
//
|
||||
// free setup packet
|
||||
//
|
||||
ExFreePoolWithTag(CtrlSetup, TAG_USBEHCI);
|
||||
|
||||
//
|
||||
// check for success
|
||||
|
@ -367,7 +378,7 @@ CUSBDevice::SetDeviceAddress(
|
|||
//
|
||||
// failed to retrieve device descriptor
|
||||
//
|
||||
DPRINT1("CUSBbDevice::SetDeviceAddress> failed to set new device address %d, falling back to %d Error %x\n", DeviceAddress, OldAddress, Status);
|
||||
DPRINT1("CUSBbDevice::SetDeviceAddress> failed to retrieve device descriptor with device address set Error %x\n", Status);
|
||||
m_DeviceAddress = OldAddress;
|
||||
|
||||
//
|
||||
|
@ -376,8 +387,6 @@ CUSBDevice::SetDeviceAddress(
|
|||
return Status;
|
||||
}
|
||||
|
||||
PC_ASSERT(FALSE);
|
||||
|
||||
//
|
||||
// sanity checks
|
||||
//
|
||||
|
@ -547,7 +556,7 @@ CUSBDevice::CommitSetupPacket(
|
|||
//
|
||||
// initialize request
|
||||
//
|
||||
Status = Request->InitializeWithSetupPacket(m_DmaManager, Packet, BufferLength, Mdl);
|
||||
Status = Request->InitializeWithSetupPacket(m_DmaManager, Packet, m_DeviceAddress, BufferLength, Mdl);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
//
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
}
|
||||
|
||||
// IUSBRequest interface functions
|
||||
virtual NTSTATUS InitializeWithSetupPacket(IN PDMAMEMORYMANAGER DmaManager, IN PUSB_DEFAULT_PIPE_SETUP_PACKET SetupPacket, IN OUT ULONG TransferBufferLength, IN OUT PMDL TransferBuffer);
|
||||
virtual NTSTATUS InitializeWithSetupPacket(IN PDMAMEMORYMANAGER DmaManager, IN PUSB_DEFAULT_PIPE_SETUP_PACKET SetupPacket, IN UCHAR DeviceAddress, IN OUT ULONG TransferBufferLength, IN OUT PMDL TransferBuffer);
|
||||
virtual NTSTATUS InitializeWithIrp(IN PDMAMEMORYMANAGER DmaManager, IN OUT PIRP Irp);
|
||||
virtual VOID CompletionCallback(IN NTSTATUS NtStatusCode, IN ULONG UrbStatusCode, IN struct _QUEUE_HEAD *QueueHead);
|
||||
virtual VOID CancelCallback(IN NTSTATUS NtStatusCode, IN struct _QUEUE_HEAD *QueueHead);
|
||||
|
@ -57,7 +57,7 @@ public:
|
|||
NTSTATUS BuildBulkTransferQueueHead(PQUEUE_HEAD * OutHead);
|
||||
NTSTATUS CreateDescriptor(PQUEUE_TRANSFER_DESCRIPTOR *OutDescriptor);
|
||||
NTSTATUS CreateQueueHead(PQUEUE_HEAD *OutQueueHead);
|
||||
ULONG GetDeviceAddress();
|
||||
UCHAR GetDeviceAddress();
|
||||
NTSTATUS BuildSetupPacket();
|
||||
NTSTATUS BuildSetupPacketFromURB();
|
||||
|
||||
|
@ -98,6 +98,11 @@ protected:
|
|||
//
|
||||
PKEVENT m_CompletionEvent;
|
||||
|
||||
//
|
||||
// device address for callers who initialized it with device address
|
||||
//
|
||||
UCHAR m_DeviceAddress;
|
||||
|
||||
//
|
||||
// DMA queue head
|
||||
//
|
||||
|
@ -137,6 +142,7 @@ NTSTATUS
|
|||
CUSBRequest::InitializeWithSetupPacket(
|
||||
IN PDMAMEMORYMANAGER DmaManager,
|
||||
IN PUSB_DEFAULT_PIPE_SETUP_PACKET SetupPacket,
|
||||
IN UCHAR DeviceAddress,
|
||||
IN OUT ULONG TransferBufferLength,
|
||||
IN OUT PMDL TransferBuffer)
|
||||
{
|
||||
|
@ -153,6 +159,7 @@ CUSBRequest::InitializeWithSetupPacket(
|
|||
m_SetupPacket = SetupPacket;
|
||||
m_TransferBufferLength = TransferBufferLength;
|
||||
m_TransferBufferMDL = TransferBuffer;
|
||||
m_DeviceAddress = DeviceAddress;
|
||||
|
||||
//
|
||||
// allocate completion event
|
||||
|
@ -796,7 +803,7 @@ CUSBRequest::CreateQueueHead(
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
ULONG
|
||||
UCHAR
|
||||
CUSBRequest::GetDeviceAddress()
|
||||
{
|
||||
PIO_STACK_LOCATION IoStack;
|
||||
|
@ -809,9 +816,9 @@ CUSBRequest::GetDeviceAddress()
|
|||
if (!m_Irp)
|
||||
{
|
||||
//
|
||||
// no irp is provided
|
||||
// assume it is for device address 0
|
||||
return 0;
|
||||
// used provided address
|
||||
//
|
||||
return m_DeviceAddress;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1158,6 +1165,14 @@ CUSBRequest::FreeQueueHead(
|
|||
m_DmaManager->Release(m_TransferDescriptors[2], sizeof(QUEUE_TRANSFER_DESCRIPTOR));
|
||||
m_TransferDescriptors[2] = 0;
|
||||
}
|
||||
|
||||
if (m_DescriptorPacket)
|
||||
{
|
||||
//
|
||||
// release packet descriptor
|
||||
//
|
||||
m_DmaManager->Release(m_DescriptorPacket, sizeof(USB_DEFAULT_PIPE_SETUP_PACKET));
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue