Author: janderwald
Date: Thu Apr 28 12:41:16 2011
New Revision: 51473
URL:
http://svn.reactos.org/svn/reactos?rev=51473&view=rev
Log:
[USBEHCI_NEW]
- Cache port status & port change settings because it appears that some ehci
controllers do not store the status reset register bit correctly
- This commit is a temporary solutions, needs to be reworked
- Return correct status from HandleClassOther
- Handle IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION to return status success
Modified:
branches/usb-bringup/drivers/usb/usbehci_new/hardware.cpp
branches/usb-bringup/drivers/usb/usbehci_new/hardware.h
branches/usb-bringup/drivers/usb/usbehci_new/hub_controller.cpp
Modified: branches/usb-bringup/drivers/usb/usbehci_new/hardware.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/usbehci…
==============================================================================
--- branches/usb-bringup/drivers/usb/usbehci_new/hardware.cpp [iso-8859-1] (original)
+++ branches/usb-bringup/drivers/usb/usbehci_new/hardware.cpp [iso-8859-1] Thu Apr 28
12:41:16 2011
@@ -109,6 +109,7 @@
HD_INIT_CALLBACK* m_SCECallBack; //
status change callback routine
PVOID m_SCEContext; //
status change callback routine context
BOOLEAN m_DoorBellRingInProgress; //
door bell ring in progress
+ EHCI_PORT_STATUS m_PortStatus[16]; //
port status
// set command
VOID SetCommandRegister(PEHCI_USBCMD_CONTENT UsbCmd);
@@ -681,6 +682,7 @@
DPRINT1("Port did not reset\n");
return STATUS_RETRY;
}
+
return STATUS_SUCCESS;
}
@@ -690,10 +692,9 @@
OUT USHORT *PortStatus,
OUT USHORT *PortChange)
{
+#if 0
ULONG Value;
USHORT Status = 0, Change = 0;
-
- DPRINT1("CUSBHardwareDevice::GetPortStatus\n");
if (PortId > m_Capabilities.HCSParams.PortCount)
return STATUS_UNSUCCESSFUL;
@@ -755,11 +756,10 @@
*PortStatus = Status;
*PortChange = Change;
-
- //HACK: Maybe
- if (Status == (USB_PORT_STATUS_HIGH_SPEED | USB_PORT_STATUS_CONNECT |
USB_PORT_STATUS_POWER))
- *PortChange = USB_PORT_STATUS_CONNECT;
-
+#else
+ *PortStatus = m_PortStatus[PortId].PortStatus;
+ *PortChange = m_PortStatus[PortId].PortChange;
+#endif
return STATUS_SUCCESS;
}
@@ -784,6 +784,12 @@
Value &= ~EHCI_PRT_RESET;
EHCI_WRITE_REGISTER_ULONG(EHCI_PORTSC + (4 * PortId), Value);
KeStallExecutionProcessor(100);
+
+ //
+ // update port status
+ //
+ m_PortStatus[PortId].PortChange &= ~USB_PORT_STATUS_RESET;
+ m_PortStatus[PortId].PortStatus |= USB_PORT_STATUS_ENABLE;
}
}
@@ -793,6 +799,8 @@
Value |= EHCI_PRT_CONNECTSTATUSCHANGE;
Value |= EHCI_PRT_ENABLEDSTATUSCHANGE;
EHCI_WRITE_REGISTER_ULONG(EHCI_PORTSC + (4 * PortId), Value);
+
+ m_PortStatus[PortId].PortChange &= ~USB_PORT_STATUS_CONNECT;
}
return STATUS_SUCCESS;
@@ -827,14 +835,25 @@
{
DPRINT1("Non HighSpeed device. Releasing Ownership\n");
}
- //
- // Reset and clean enable
- //
- Value |= EHCI_PRT_RESET;
- Value &= ~EHCI_PRT_ENABLED;
- EHCI_WRITE_REGISTER_ULONG(EHCI_PORTSC + (4 * PortId), Value);
-
- KeStallExecutionProcessor(100);
+
+ ResetPort(PortId);
+
+ //
+ // update cached settings
+ //
+ m_PortStatus[PortId].PortChange |= USB_PORT_STATUS_RESET;
+ m_PortStatus[PortId].PortStatus &= ~USB_PORT_STATUS_ENABLE;
+
+ //
+ // is there a status change callback
+ //
+ if (m_SCECallBack != NULL)
+ {
+ //
+ // issue callback
+ //
+ m_SCECallBack(m_SCEContext);
+ }
}
if (Feature == PORT_POWER)
@@ -1069,16 +1088,29 @@
if (PortStatus & EHCI_PRT_SLOWSPEEDLINE)
{
- DPRINT1("Non HighSeped device connected. Release
ownership\n");
+ DPRINT1("Non HighSpeed device connected. Release
ownership\n");
This->EHCI_WRITE_REGISTER_ULONG(EHCI_PORTSC + (4 * i),
EHCI_PRT_RELEASEOWNERSHIP);
continue;
}
-
+ }
+
+ //
+ // update port status flags
+ //
+ This->m_PortStatus[i].PortStatus |= USB_PORT_STATUS_HIGH_SPEED;
+ This->m_PortStatus[i].PortStatus |= USB_PORT_STATUS_CONNECT;
+ This->m_PortStatus[i].PortChange |= USB_PORT_STATUS_CONNECT;
+
+ //
+ // is there a status change callback
+ //
+ if (This->m_SCECallBack != NULL)
+ {
//
- // FIXME: Is a port reset needed, or does hub driver request
this?
+ // issue callback
//
+ This->m_SCECallBack(This->m_SCEContext);
}
- This->m_SCECallBack(This->m_SCEContext);
}
else
{
Modified: branches/usb-bringup/drivers/usb/usbehci_new/hardware.h
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/usbehci…
==============================================================================
--- branches/usb-bringup/drivers/usb/usbehci_new/hardware.h [iso-8859-1] (original)
+++ branches/usb-bringup/drivers/usb/usbehci_new/hardware.h [iso-8859-1] Thu Apr 28
12:41:16 2011
@@ -58,6 +58,7 @@
#define EHCI_PRT_POWER 0x1000
#define EHCI_PRT_RELEASEOWNERSHIP 0x2000
+#define EHCI_PORTSC_DATAMASK 0xffffffd1
//
// Terminate Pointer used for QueueHeads and Element Transfer Descriptors to mark
Pointers as the end
//
@@ -280,3 +281,10 @@
KSPIN_LOCK Lock;
LPDMA_MEMORY_ALLOCATOR DmaMemAllocator;
} EHCI_HOST_CONTROLLER, *PEHCI_HOST_CONTROLLER;
+
+typedef struct
+{
+ ULONG PortStatus;
+ ULONG PortChange;
+}EHCI_PORT_STATUS;
+
Modified: branches/usb-bringup/drivers/usb/usbehci_new/hub_controller.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/usbehci…
==============================================================================
--- branches/usb-bringup/drivers/usb/usbehci_new/hub_controller.cpp [iso-8859-1]
(original)
+++ branches/usb-bringup/drivers/usb/usbehci_new/hub_controller.cpp [iso-8859-1] Thu Apr
28 12:41:16 2011
@@ -913,7 +913,7 @@
//
// reset port feature
//
- Status = m_Hardware->ResetPort(PortId);
+ Status = m_Hardware->SetPortFeature(PortId, PORT_RESET);
PC_ASSERT(Status == STATUS_SUCCESS);
break;
}
@@ -928,9 +928,7 @@
PC_ASSERT(0);
Status = STATUS_INVALID_DEVICE_REQUEST;
}
-
-
- return STATUS_SUCCESS;
+ return Status;
}
//-----------------------------------------------------------------------------------------
@@ -1313,6 +1311,12 @@
Irp->IoStatus.Information = sizeof(ULONG);
break;
}
+ case IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION:
+ {
+ DPRINT1("IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION
UNIMPLEMENTED\n");
+ Status = STATUS_SUCCESS;
+ break;
+ }
default:
{
DPRINT1("HandleDeviceControl>Type: IoCtl %x InputBufferLength %lu
OutputBufferLength %lu NOT IMPLEMENTED\n",