Author: cgutman
Date: Thu Jan 26 01:46:06 2012
New Revision: 55189
URL:
http://svn.reactos.org/svn/reactos?rev=55189&view=rev
Log:
[USBOHCI]
- Properly dismiss the enable status changed interrupt to avoid an interrupt storm after a
device is disconnected
Modified:
branches/usb-bringup-trunk/drivers/usb/usbohci/hardware.cpp
Modified: branches/usb-bringup-trunk/drivers/usb/usbohci/hardware.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
==============================================================================
--- branches/usb-bringup-trunk/drivers/usb/usbohci/hardware.cpp [iso-8859-1] (original)
+++ branches/usb-bringup-trunk/drivers/usb/usbohci/hardware.cpp [iso-8859-1] Thu Jan 26
01:46:06 2012
@@ -1125,9 +1125,9 @@
if (Value & OHCI_RH_PORTSTATUS_PES)
*PortStatus |= USB_PORT_STATUS_ENABLE;
- // port enabled
+ // port disconnect or hardware error
if (Value & OHCI_RH_PORTSTATUS_PESC)
- *PortChange |= USB_PORT_STATUS_ENABLE;
+ *PortChange |= USB_PORT_STATUS_CONNECT;
// port suspend
if (Value & OHCI_RH_PORTSTATUS_PSS)
@@ -1211,7 +1211,6 @@
//
// sanity checks
//
- ASSERT((Value & OHCI_RH_PORTSTATUS_PRS) == 0);
ASSERT((Value & OHCI_RH_PORTSTATUS_PRSC));
//
@@ -1219,27 +1218,24 @@
//
WRITE_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + OHCI_RH_PORT_STATUS(PortId)),
OHCI_RH_PORTSTATUS_PRSC);
-
//
// sanity check
//
ASSERT((Value & OHCI_RH_PORTSTATUS_PES));
-
- //
- // re-enable root hub change
- //
- Value = READ_REGISTER_ULONG((PULONG)((PUCHAR)m_Base +
OHCI_INTERRUPT_ENABLE_OFFSET));
- WRITE_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + OHCI_INTERRUPT_ENABLE_OFFSET),
Value | OHCI_ROOT_HUB_STATUS_CHANGE);
-
- }
-
- if (Status == C_PORT_CONNECTION)
- {
- //
- // clear bit
- //
- WRITE_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + OHCI_RH_PORT_STATUS(PortId)),
OHCI_RH_PORTSTATUS_CSC);
- }
+ }
+
+ if (Status == C_PORT_CONNECTION || Status == C_PORT_ENABLE)
+ {
+ //
+ // clear bits
+ //
+ WRITE_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + OHCI_RH_PORT_STATUS(PortId)),
OHCI_RH_PORTSTATUS_CSC | OHCI_RH_PORTSTATUS_PESC);
+ }
+
+ //
+ // re-enable root hub change
+ //
+ WRITE_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + OHCI_INTERRUPT_ENABLE_OFFSET),
OHCI_ROOT_HUB_STATUS_CHANGE);
return STATUS_SUCCESS;
}
@@ -1475,10 +1471,6 @@
if (Status & OHCI_ROOT_HUB_STATUS_CHANGE)
{
//
- // new device has arrived
- //
-
- //
// disable interrupt as it will fire untill the port has been reset
//
WRITE_REGISTER_ULONG((PULONG)((PUCHAR)This->m_Base +
OHCI_INTERRUPT_DISABLE_OFFSET), OHCI_ROOT_HUB_STATUS_CHANGE);