Author: janderwald
Date: Wed Jan 25 03:39:57 2012
New Revision: 55167
URL:
http://svn.reactos.org/svn/reactos?rev=55167&view=rev
Log:
[USBSTOR]
- Add debug trace
[USBOHCI]
- Implement proper GetPortStatus
[USBHUB]
- Reset all connected ports before sending first SCE
- USB Devices present before booting are now detected with OHCI controller. EHCI code is
present but not yet activated
Modified:
branches/usb-bringup-trunk/drivers/usb/usbhub_new/fdo.c
branches/usb-bringup-trunk/drivers/usb/usbohci/hardware.cpp
branches/usb-bringup-trunk/drivers/usb/usbstor/scsi.c
Modified: branches/usb-bringup-trunk/drivers/usb/usbhub_new/fdo.c
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
==============================================================================
--- branches/usb-bringup-trunk/drivers/usb/usbhub_new/fdo.c [iso-8859-1] (original)
+++ branches/usb-bringup-trunk/drivers/usb/usbhub_new/fdo.c [iso-8859-1] Wed Jan 25
03:39:57 2012
@@ -1443,8 +1443,37 @@
PVOID Context)
{
PDEVICE_OBJECT DeviceObject = (PDEVICE_OBJECT)Context;
-
- DPRINT1("Sending the initial SCE Request %x\n", DeviceObject);
+ NTSTATUS Status;
+ ULONG PortId;
+ PHUB_DEVICE_EXTENSION HubDeviceExtension;
+ PORT_STATUS_CHANGE StatusChange;
+
+ HubDeviceExtension = (PHUB_DEVICE_EXTENSION) DeviceObject->DeviceExtension;
+
+ DPRINT1("RootHubInitCallbackFunction Sending the initial SCE Request %x\n",
DeviceObject);
+
+ for (PortId = 1; PortId <= HubDeviceExtension->HubDescriptor.bNumberOfPorts;
PortId++)
+ {
+ //
+ // get port status
+ //
+ Status =
GetPortStatusAndChange(HubDeviceExtension->RootHubPhysicalDeviceObject, PortId,
&StatusChange);
+ if (NT_SUCCESS(Status))
+ {
+ //
+ // is there a device connected
+ //
+ if (StatusChange.Status & USB_PORT_STATUS_CONNECT)
+ {
+ //
+ // reset port
+ //
+ Status =
SetPortFeature(HubDeviceExtension->RootHubPhysicalDeviceObject, PortId, PORT_RESET);
+ if (!NT_SUCCESS(Status))
+ DPRINT1("Failed to reset on port %d\n", PortId);
+ }
+ }
+ }
//
// Send the first SCE Request
@@ -1463,6 +1492,7 @@
PHUB_DEVICE_EXTENSION HubDeviceExtension;
PDEVICE_OBJECT RootHubDeviceObject;
PVOID HubInterfaceBusContext , UsbDInterfaceBusContext;
+ PORT_STATUS_CHANGE StatusChange;
HubDeviceExtension = (PHUB_DEVICE_EXTENSION) DeviceObject->DeviceExtension;
@@ -1800,6 +1830,32 @@
else
{
//
+ // reset ports
+ //
+ for (PortId = 1; PortId <=
HubDeviceExtension->HubDescriptor.bNumberOfPorts; PortId++)
+ {
+ //
+ // get port status
+ //
+ Status =
GetPortStatusAndChange(HubDeviceExtension->RootHubPhysicalDeviceObject, PortId,
&StatusChange);
+ if (NT_SUCCESS(Status))
+ {
+ //
+ // is there a device connected
+ //
+ if (StatusChange.Status & USB_PORT_STATUS_CONNECT)
+ {
+ //
+ // reset port
+ //
+ Status =
SetPortFeature(HubDeviceExtension->RootHubPhysicalDeviceObject, PortId, PORT_RESET);
+ if (!NT_SUCCESS(Status))
+ DPRINT1("Failed to reset on port %d\n",
PortId);
+ }
+ }
+ }
+
+ //
// Send the first SCE Request
//
QueryStatusChangeEndpoint(DeviceObject);
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] Wed Jan 25
03:39:57 2012
@@ -1036,11 +1036,54 @@
OUT USHORT *PortStatus,
OUT USHORT *PortChange)
{
- //
- // FIXME: should read status from hardware
- //
- *PortStatus = m_PortStatus[PortId].PortStatus;
- *PortChange = m_PortStatus[PortId].PortChange;
+ ULONG Value;
+
+ if (PortId > m_NumberOfPorts)
+ return STATUS_UNSUCCESSFUL;
+
+ // init result variables
+ *PortStatus = 0;
+ *PortChange = 0;
+
+ //
+ // read port status
+ //
+ Value = READ_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + OHCI_RH_PORT_STATUS(PortId)));
+ DPRINT("GetPortStatus PortId %x Value %x\n", PortId, Value);
+
+
+ // connected
+ if (Value & OHCI_RH_PORTSTATUS_CCS)
+ *PortStatus |= USB_PORT_STATUS_CONNECT;
+
+ // did a device connect?
+ if (Value & OHCI_RH_PORTSTATUS_CSC)
+ *PortChange |= USB_PORT_STATUS_CONNECT;
+
+ // port enabled
+ if (Value & OHCI_RH_PORTSTATUS_PES)
+ *PortStatus |= USB_PORT_STATUS_ENABLE;
+
+ // port enabled
+ if (Value & OHCI_RH_PORTSTATUS_PESC)
+ *PortChange |= USB_PORT_STATUS_ENABLE;
+
+ // port suspend
+ if (Value & OHCI_RH_PORTSTATUS_PSS)
+ *PortStatus |= USB_PORT_STATUS_SUSPEND;
+
+ // port suspend
+ if (Value & OHCI_RH_PORTSTATUS_PSSC)
+ *PortChange |= USB_PORT_STATUS_ENABLE;
+
+ // port reset
+ if (Value & OHCI_RH_PORTSTATUS_PSS)
+ *PortStatus |= USB_PORT_STATUS_RESET;
+
+ // port reset
+ if (Value & OHCI_RH_PORTSTATUS_PRSC)
+ *PortChange |= USB_PORT_STATUS_RESET;
+
return STATUS_SUCCESS;
}
Modified: branches/usb-bringup-trunk/drivers/usb/usbstor/scsi.c
URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
==============================================================================
--- branches/usb-bringup-trunk/drivers/usb/usbstor/scsi.c [iso-8859-1] (original)
+++ branches/usb-bringup-trunk/drivers/usb/usbstor/scsi.c [iso-8859-1] Wed Jan 25 03:39:57
2012
@@ -1221,7 +1221,7 @@
}
else
{
- UNIMPLEMENTED;
+ DPRINT1("UNIMPLEMENTED Operation Code %x\n", pCDB->AsByte[0]);
Request->SrbStatus = SRB_STATUS_ERROR;
Status = STATUS_NOT_SUPPORTED;
DbgBreakPoint();