mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 05:32:55 +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
4 changed files with 49 additions and 24 deletions
|
@ -1002,6 +1002,11 @@ EhciDefferedRoutine(
|
||||||
// check for completion of async schedule
|
// check for completion of async schedule
|
||||||
//
|
//
|
||||||
if (CStatus & (EHCI_STS_RECL| EHCI_STS_INT | EHCI_ERROR_INT))
|
if (CStatus & (EHCI_STS_RECL| EHCI_STS_INT | EHCI_ERROR_INT))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// check if there is a door bell ring in progress
|
||||||
|
//
|
||||||
|
if (This->m_DoorBellRingInProgress == FALSE)
|
||||||
{
|
{
|
||||||
if (CStatus & EHCI_ERROR_INT)
|
if (CStatus & EHCI_ERROR_INT)
|
||||||
{
|
{
|
||||||
|
@ -1012,11 +1017,6 @@ EhciDefferedRoutine(
|
||||||
PC_ASSERT(FALSE);
|
PC_ASSERT(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// check if there is a door bell ring in progress
|
|
||||||
//
|
|
||||||
if (This->m_DoorBellRingInProgress == FALSE)
|
|
||||||
{
|
|
||||||
//
|
//
|
||||||
// inform IUSBQueue of a completed queue head
|
// inform IUSBQueue of a completed queue head
|
||||||
//
|
//
|
||||||
|
|
|
@ -385,6 +385,7 @@ DECLARE_INTERFACE_(IUSBRequest, IUnknown)
|
||||||
|
|
||||||
virtual NTSTATUS InitializeWithSetupPacket(IN PDMAMEMORYMANAGER DmaManager,
|
virtual NTSTATUS InitializeWithSetupPacket(IN PDMAMEMORYMANAGER DmaManager,
|
||||||
IN PUSB_DEFAULT_PIPE_SETUP_PACKET SetupPacket,
|
IN PUSB_DEFAULT_PIPE_SETUP_PACKET SetupPacket,
|
||||||
|
IN UCHAR DeviceAddress,
|
||||||
IN OUT ULONG TransferBufferLength,
|
IN OUT ULONG TransferBufferLength,
|
||||||
IN OUT PMDL TransferBuffer) = 0;
|
IN OUT PMDL TransferBuffer) = 0;
|
||||||
|
|
||||||
|
|
|
@ -310,26 +310,37 @@ NTSTATUS
|
||||||
CUSBDevice::SetDeviceAddress(
|
CUSBDevice::SetDeviceAddress(
|
||||||
UCHAR DeviceAddress)
|
UCHAR DeviceAddress)
|
||||||
{
|
{
|
||||||
USB_DEFAULT_PIPE_SETUP_PACKET CtrlSetup;
|
PUSB_DEFAULT_PIPE_SETUP_PACKET CtrlSetup;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
UCHAR OldAddress;
|
UCHAR OldAddress;
|
||||||
ULONG Index;
|
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
|
// zero request
|
||||||
//
|
//
|
||||||
RtlZeroMemory(&CtrlSetup, sizeof(USB_DEFAULT_PIPE_SETUP_PACKET));
|
RtlZeroMemory(CtrlSetup, sizeof(USB_DEFAULT_PIPE_SETUP_PACKET));
|
||||||
|
|
||||||
//
|
//
|
||||||
// initialize request
|
// initialize request
|
||||||
//
|
//
|
||||||
CtrlSetup.bRequest = USB_REQUEST_SET_ADDRESS;
|
CtrlSetup->bRequest = USB_REQUEST_SET_ADDRESS;
|
||||||
CtrlSetup.wValue.W = (USHORT)DeviceAddress;
|
CtrlSetup->wValue.W = (USHORT)DeviceAddress;
|
||||||
|
|
||||||
//
|
//
|
||||||
// set device address
|
// set device address
|
||||||
//
|
//
|
||||||
Status = CommitSetupPacket(&CtrlSetup, 0, 0);
|
Status = CommitSetupPacket(CtrlSetup, 0, 0);
|
||||||
|
|
||||||
|
//
|
||||||
|
// free setup packet
|
||||||
|
//
|
||||||
|
ExFreePoolWithTag(CtrlSetup, TAG_USBEHCI);
|
||||||
|
|
||||||
//
|
//
|
||||||
// check for success
|
// check for success
|
||||||
|
@ -367,7 +378,7 @@ CUSBDevice::SetDeviceAddress(
|
||||||
//
|
//
|
||||||
// failed to retrieve device descriptor
|
// 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;
|
m_DeviceAddress = OldAddress;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -376,8 +387,6 @@ CUSBDevice::SetDeviceAddress(
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
PC_ASSERT(FALSE);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// sanity checks
|
// sanity checks
|
||||||
//
|
//
|
||||||
|
@ -547,7 +556,7 @@ CUSBDevice::CommitSetupPacket(
|
||||||
//
|
//
|
||||||
// initialize request
|
// initialize request
|
||||||
//
|
//
|
||||||
Status = Request->InitializeWithSetupPacket(m_DmaManager, Packet, BufferLength, Mdl);
|
Status = Request->InitializeWithSetupPacket(m_DmaManager, Packet, m_DeviceAddress, BufferLength, Mdl);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
|
|
@ -36,7 +36,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// IUSBRequest interface functions
|
// 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 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 CompletionCallback(IN NTSTATUS NtStatusCode, IN ULONG UrbStatusCode, IN struct _QUEUE_HEAD *QueueHead);
|
||||||
virtual VOID CancelCallback(IN NTSTATUS NtStatusCode, 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 BuildBulkTransferQueueHead(PQUEUE_HEAD * OutHead);
|
||||||
NTSTATUS CreateDescriptor(PQUEUE_TRANSFER_DESCRIPTOR *OutDescriptor);
|
NTSTATUS CreateDescriptor(PQUEUE_TRANSFER_DESCRIPTOR *OutDescriptor);
|
||||||
NTSTATUS CreateQueueHead(PQUEUE_HEAD *OutQueueHead);
|
NTSTATUS CreateQueueHead(PQUEUE_HEAD *OutQueueHead);
|
||||||
ULONG GetDeviceAddress();
|
UCHAR GetDeviceAddress();
|
||||||
NTSTATUS BuildSetupPacket();
|
NTSTATUS BuildSetupPacket();
|
||||||
NTSTATUS BuildSetupPacketFromURB();
|
NTSTATUS BuildSetupPacketFromURB();
|
||||||
|
|
||||||
|
@ -98,6 +98,11 @@ protected:
|
||||||
//
|
//
|
||||||
PKEVENT m_CompletionEvent;
|
PKEVENT m_CompletionEvent;
|
||||||
|
|
||||||
|
//
|
||||||
|
// device address for callers who initialized it with device address
|
||||||
|
//
|
||||||
|
UCHAR m_DeviceAddress;
|
||||||
|
|
||||||
//
|
//
|
||||||
// DMA queue head
|
// DMA queue head
|
||||||
//
|
//
|
||||||
|
@ -137,6 +142,7 @@ NTSTATUS
|
||||||
CUSBRequest::InitializeWithSetupPacket(
|
CUSBRequest::InitializeWithSetupPacket(
|
||||||
IN PDMAMEMORYMANAGER DmaManager,
|
IN PDMAMEMORYMANAGER DmaManager,
|
||||||
IN PUSB_DEFAULT_PIPE_SETUP_PACKET SetupPacket,
|
IN PUSB_DEFAULT_PIPE_SETUP_PACKET SetupPacket,
|
||||||
|
IN UCHAR DeviceAddress,
|
||||||
IN OUT ULONG TransferBufferLength,
|
IN OUT ULONG TransferBufferLength,
|
||||||
IN OUT PMDL TransferBuffer)
|
IN OUT PMDL TransferBuffer)
|
||||||
{
|
{
|
||||||
|
@ -153,6 +159,7 @@ CUSBRequest::InitializeWithSetupPacket(
|
||||||
m_SetupPacket = SetupPacket;
|
m_SetupPacket = SetupPacket;
|
||||||
m_TransferBufferLength = TransferBufferLength;
|
m_TransferBufferLength = TransferBufferLength;
|
||||||
m_TransferBufferMDL = TransferBuffer;
|
m_TransferBufferMDL = TransferBuffer;
|
||||||
|
m_DeviceAddress = DeviceAddress;
|
||||||
|
|
||||||
//
|
//
|
||||||
// allocate completion event
|
// allocate completion event
|
||||||
|
@ -796,7 +803,7 @@ CUSBRequest::CreateQueueHead(
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
ULONG
|
UCHAR
|
||||||
CUSBRequest::GetDeviceAddress()
|
CUSBRequest::GetDeviceAddress()
|
||||||
{
|
{
|
||||||
PIO_STACK_LOCATION IoStack;
|
PIO_STACK_LOCATION IoStack;
|
||||||
|
@ -809,9 +816,9 @@ CUSBRequest::GetDeviceAddress()
|
||||||
if (!m_Irp)
|
if (!m_Irp)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// no irp is provided
|
// used provided address
|
||||||
// assume it is for device address 0
|
//
|
||||||
return 0;
|
return m_DeviceAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1158,6 +1165,14 @@ CUSBRequest::FreeQueueHead(
|
||||||
m_DmaManager->Release(m_TransferDescriptors[2], sizeof(QUEUE_TRANSFER_DESCRIPTOR));
|
m_DmaManager->Release(m_TransferDescriptors[2], sizeof(QUEUE_TRANSFER_DESCRIPTOR));
|
||||||
m_TransferDescriptors[2] = 0;
|
m_TransferDescriptors[2] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_DescriptorPacket)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// release packet descriptor
|
||||||
|
//
|
||||||
|
m_DmaManager->Release(m_DescriptorPacket, sizeof(USB_DEFAULT_PIPE_SETUP_PACKET));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue