Author: cgutman
Date: Sat Feb 25 06:23:12 2012
New Revision: 55853
URL:
http://svn.reactos.org/svn/reactos?rev=55853&view=rev
Log:
[USBEHCI]
- Create a macro for properly checking for low speed devices
- Check again for a low speed device after the EHCI reset completes
- Don't ignore status changes on ports that we have released (revert part of r55851)
Modified:
trunk/reactos/drivers/usb/usbehci/hardware.cpp
trunk/reactos/drivers/usb/usbehci/hardware.h
Modified: trunk/reactos/drivers/usb/usbehci/hardware.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/hardwa…
==============================================================================
--- trunk/reactos/drivers/usb/usbehci/hardware.cpp [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbehci/hardware.cpp [iso-8859-1] Sat Feb 25 06:23:12 2012
@@ -958,7 +958,7 @@
PortStatus = EHCI_READ_REGISTER_ULONG(EHCI_PORTSC + (4 * PortIndex));
- ASSERT(!(PortStatus & EHCI_PRT_SLOWSPEEDLINE));
+ ASSERT(!EHCI_IS_LOW_SPEED(PortStatus));
ASSERT(PortStatus & EHCI_PRT_CONNECTED);
//
@@ -1112,7 +1112,7 @@
KeDelayExecutionThread(KernelMode, FALSE, &Timeout);
//
- // check the enabled bit after reset
+ // check the port status after reset
//
Value = EHCI_READ_REGISTER_ULONG(EHCI_PORTSC + (4 * PortId));
if (!(Value & EHCI_PRT_CONNECTED))
@@ -1120,9 +1120,14 @@
DPRINT1("No device is here after reset. Bad
controller/device?\n");
return STATUS_UNSUCCESSFUL;
}
+ else if (EHCI_IS_LOW_SPEED(Value))
+ {
+ DPRINT1("Low speed device connected. Releasing ownership\n");
+ EHCI_WRITE_REGISTER_ULONG(EHCI_PORTSC + (4 * PortId), Value |
EHCI_PRT_RELEASEOWNERSHIP);
+ return STATUS_DEVICE_NOT_CONNECTED;
+ }
else if (!(Value & EHCI_PRT_ENABLED))
{
- // release ownership
DPRINT1("Full speed device connected. Releasing ownership\n");
EHCI_WRITE_REGISTER_ULONG(EHCI_PORTSC + (4 * PortId), Value |
EHCI_PRT_RELEASEOWNERSHIP);
return STATUS_DEVICE_NOT_CONNECTED;
@@ -1447,14 +1452,6 @@
{
PortStatus = This->EHCI_READ_REGISTER_ULONG(EHCI_PORTSC + (4 * i));
- // Check if we actually own the port
- if (PortStatus & EHCI_PRT_RELEASEOWNERSHIP)
- {
- //Discard anything on this port but ack any status changes
- This->EHCI_WRITE_REGISTER_ULONG(EHCI_PORTSC + (4 * i), PortStatus);
- continue;
- }
-
//
// Device connected or removed
//
@@ -1471,7 +1468,7 @@
DPRINT1("Misbeaving controller. Port should be disabled
at this point\n");
}
- if (PortStatus & EHCI_PRT_SLOWSPEEDLINE)
+ if (EHCI_IS_LOW_SPEED(PortStatus))
{
DPRINT1("Low speed device connected. Releasing
ownership\n");
This->EHCI_WRITE_REGISTER_ULONG(EHCI_PORTSC + (4 * i),
PortStatus | EHCI_PRT_RELEASEOWNERSHIP);
Modified: trunk/reactos/drivers/usb/usbehci/hardware.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/hardwa…
==============================================================================
--- trunk/reactos/drivers/usb/usbehci/hardware.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbehci/hardware.h [iso-8859-1] Sat Feb 25 06:23:12 2012
@@ -76,11 +76,14 @@
#define EHCI_PRT_FORCERESUME 0x40
#define EHCI_PRT_SUSPEND 0x80
#define EHCI_PRT_RESET 0x100
-#define EHCI_PRT_SLOWSPEEDLINE 0x400
+#define EHCI_PRT_LINESTATUSA 0x400
+#define EHCI_PRT_LINESTATUSB 0x800
#define EHCI_PRT_POWER 0x1000
#define EHCI_PRT_RELEASEOWNERSHIP 0x2000
#define EHCI_PORTSC_DATAMASK 0xffffffd1
+
+#define EHCI_IS_LOW_SPEED(x) (((x) & EHCI_PRT_LINESTATUSA) && !((x) &
EHCI_PRT_LINESTATUSB))
//
// Terminate Pointer used for QueueHeads and Element Transfer Descriptors to mark
Pointers as the end
//