mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 21:25:43 +00:00
[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 svn path=/branches/usb-bringup-trunk/; revision=55167
This commit is contained in:
parent
6fab1a7c6a
commit
a0dc4083ad
3 changed files with 104 additions and 5 deletions
|
@ -1443,8 +1443,37 @@ RootHubInitCallbackFunction(
|
||||||
PVOID Context)
|
PVOID Context)
|
||||||
{
|
{
|
||||||
PDEVICE_OBJECT DeviceObject = (PDEVICE_OBJECT)Context;
|
PDEVICE_OBJECT DeviceObject = (PDEVICE_OBJECT)Context;
|
||||||
|
NTSTATUS Status;
|
||||||
|
ULONG PortId;
|
||||||
|
PHUB_DEVICE_EXTENSION HubDeviceExtension;
|
||||||
|
PORT_STATUS_CHANGE StatusChange;
|
||||||
|
|
||||||
DPRINT1("Sending the initial SCE Request %x\n", DeviceObject);
|
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
|
// Send the first SCE Request
|
||||||
|
@ -1463,6 +1492,7 @@ USBHUB_FdoHandlePnp(
|
||||||
PHUB_DEVICE_EXTENSION HubDeviceExtension;
|
PHUB_DEVICE_EXTENSION HubDeviceExtension;
|
||||||
PDEVICE_OBJECT RootHubDeviceObject;
|
PDEVICE_OBJECT RootHubDeviceObject;
|
||||||
PVOID HubInterfaceBusContext , UsbDInterfaceBusContext;
|
PVOID HubInterfaceBusContext , UsbDInterfaceBusContext;
|
||||||
|
PORT_STATUS_CHANGE StatusChange;
|
||||||
|
|
||||||
HubDeviceExtension = (PHUB_DEVICE_EXTENSION) DeviceObject->DeviceExtension;
|
HubDeviceExtension = (PHUB_DEVICE_EXTENSION) DeviceObject->DeviceExtension;
|
||||||
|
|
||||||
|
@ -1799,6 +1829,32 @@ USBHUB_FdoHandlePnp(
|
||||||
}
|
}
|
||||||
else
|
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
|
// Send the first SCE Request
|
||||||
//
|
//
|
||||||
|
|
|
@ -1036,11 +1036,54 @@ CUSBHardwareDevice::GetPortStatus(
|
||||||
OUT USHORT *PortStatus,
|
OUT USHORT *PortStatus,
|
||||||
OUT USHORT *PortChange)
|
OUT USHORT *PortChange)
|
||||||
{
|
{
|
||||||
|
ULONG Value;
|
||||||
|
|
||||||
|
if (PortId > m_NumberOfPorts)
|
||||||
|
return STATUS_UNSUCCESSFUL;
|
||||||
|
|
||||||
|
// init result variables
|
||||||
|
*PortStatus = 0;
|
||||||
|
*PortChange = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
// FIXME: should read status from hardware
|
// read port status
|
||||||
//
|
//
|
||||||
*PortStatus = m_PortStatus[PortId].PortStatus;
|
Value = READ_REGISTER_ULONG((PULONG)((PUCHAR)m_Base + OHCI_RH_PORT_STATUS(PortId)));
|
||||||
*PortChange = m_PortStatus[PortId].PortChange;
|
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;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1221,7 +1221,7 @@ USBSTOR_HandleExecuteSCSI(
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
DPRINT1("UNIMPLEMENTED Operation Code %x\n", pCDB->AsByte[0]);
|
||||||
Request->SrbStatus = SRB_STATUS_ERROR;
|
Request->SrbStatus = SRB_STATUS_ERROR;
|
||||||
Status = STATUS_NOT_SUPPORTED;
|
Status = STATUS_NOT_SUPPORTED;
|
||||||
DbgBreakPoint();
|
DbgBreakPoint();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue