Author: tfaber
Date: Sat Jul 1 06:22:27 2017
New Revision: 75255
URL:
http://svn.reactos.org/svn/reactos?rev=75255&view=rev
Log:
[USBPORT][USBHUB_NEW]
- Make use of the newly defined structures and constants and remove locally defined
versions. Patch by Vadim Galyant.
Modified:
trunk/reactos/drivers/usb/usbhub_new/ioctl.c
trunk/reactos/drivers/usb/usbhub_new/pnp.c
trunk/reactos/drivers/usb/usbhub_new/usbhub.c
trunk/reactos/drivers/usb/usbhub_new/usbhub.h
trunk/reactos/drivers/usb/usbport/iface.c
trunk/reactos/drivers/usb/usbport/roothub.c
trunk/reactos/sdk/include/reactos/drivers/usbport/usbmport.h
Modified: trunk/reactos/drivers/usb/usbhub_new/ioctl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbhub_new/ioc…
==============================================================================
--- trunk/reactos/drivers/usb/usbhub_new/ioctl.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbhub_new/ioctl.c [iso-8859-1] Sat Jul 1 06:22:27 2017
@@ -250,7 +250,7 @@
Status = USBH_SyncGetPortStatus(HubExtension,
PortExtension->PortNumber,
&PortData->PortStatus,
- sizeof(USBHUB_PORT_STATUS));
+ sizeof(USB_PORT_STATUS_AND_CHANGE));
IoStack = IoGetCurrentIrpStackLocation(Irp);
PortStatus = IoStack->Parameters.Others.Argument1;
@@ -259,12 +259,12 @@
if (PortExtension->Common.SelfDevice == PortData->DeviceObject)
{
- if (PortData->PortStatus.UsbPortStatus.Usb20PortStatus.PortEnabledDisabled)
+ if (PortData->PortStatus.PortStatus.Usb20PortStatus.PortEnabledDisabled)
{
*PortStatus |= USBD_PORT_ENABLED;
}
- if (PortData->PortStatus.UsbPortStatus.Usb20PortStatus.CurrentConnectStatus)
+ if (PortData->PortStatus.PortStatus.Usb20PortStatus.CurrentConnectStatus)
{
*PortStatus |= USBD_PORT_CONNECTED;
}
Modified: trunk/reactos/drivers/usb/usbhub_new/pnp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbhub_new/pnp…
==============================================================================
--- trunk/reactos/drivers/usb/usbhub_new/pnp.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbhub_new/pnp.c [iso-8859-1] Sat Jul 1 06:22:27 2017
@@ -1131,7 +1131,7 @@
DPRINT_ENUM("USBH_FdoQueryBusRelations: Port - %x, ConnectStatus -
%x\n",
Port,
-
PortData->PortStatus.UsbPortStatus.Usb20PortStatus.CurrentConnectStatus);
+
PortData->PortStatus.PortStatus.Usb20PortStatus.CurrentConnectStatus);
if (HubExtension->HubFlags & USBHUB_FDO_FLAG_DEVICE_FAILED)
{
@@ -1141,7 +1141,7 @@
Status = USBH_SyncGetPortStatus(HubExtension,
Port,
&PortData->PortStatus,
- sizeof(USBHUB_PORT_STATUS));
+ sizeof(USB_PORT_STATUS_AND_CHANGE));
if (!NT_SUCCESS(Status))
{
@@ -1158,7 +1158,7 @@
if (PdoExtension->PortPdoFlags & USBHUB_PDO_FLAG_OVERCURRENT_PORT)
{
-
PortData->PortStatus.UsbPortStatus.Usb20PortStatus.CurrentConnectStatus = 1;
+ PortData->PortStatus.PortStatus.Usb20PortStatus.CurrentConnectStatus =
1;
}
}
@@ -1168,7 +1168,7 @@
DbgBreakPoint();
}
- if (!PortData->PortStatus.UsbPortStatus.Usb20PortStatus.CurrentConnectStatus)
+ if (!PortData->PortStatus.PortStatus.Usb20PortStatus.CurrentConnectStatus)
{
if (PdoDevice)
{
@@ -1233,9 +1233,9 @@
NtStatus = USBH_SyncGetPortStatus(HubExtension,
Port,
&PortData->PortStatus,
- sizeof(USBHUB_PORT_STATUS));
-
- UsbPortStatus = PortData->PortStatus.UsbPortStatus;
+ sizeof(USB_PORT_STATUS_AND_CHANGE));
+
+ UsbPortStatus = PortData->PortStatus.PortStatus;
if (NT_SUCCESS(NtStatus))
{
@@ -1472,7 +1472,7 @@
if (PortDevice)
{
- PortData->PortStatus.AsULONG = 0;
+ PortData->PortStatus.AsUlong32 = 0;
PortData->DeviceObject = NULL;
PortExtension = PortDevice->DeviceExtension;
@@ -2064,7 +2064,7 @@
Status = USBH_SyncGetPortStatus(HubExtension,
PortExtension->PortNumber,
&PortData->PortStatus,
- sizeof(USBHUB_PORT_STATUS));
+ sizeof(USB_PORT_STATUS_AND_CHANGE));
if (NT_SUCCESS(Status))
{
Modified: trunk/reactos/drivers/usb/usbhub_new/usbhub.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbhub_new/usb…
==============================================================================
--- trunk/reactos/drivers/usb/usbhub_new/usbhub.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbhub_new/usbhub.c [iso-8859-1] Sat Jul 1 06:22:27 2017
@@ -464,7 +464,7 @@
USBH_SyncResetPort(IN PUSBHUB_FDO_EXTENSION HubExtension,
IN USHORT Port)
{
- USBHUB_PORT_STATUS PortStatus;
+ USB_PORT_STATUS_AND_CHANGE PortStatus;
KEVENT Event;
LARGE_INTEGER Timeout;
ULONG ResetRetry = 0;
@@ -483,10 +483,10 @@
Status = USBH_SyncGetPortStatus(HubExtension,
Port,
&PortStatus,
- sizeof(USBHUB_PORT_STATUS));
+ sizeof(USB_PORT_STATUS_AND_CHANGE));
if (NT_SUCCESS(Status) &&
- (PortStatus.UsbPortStatus.Usb20PortStatus.CurrentConnectStatus == 0))
+ (PortStatus.PortStatus.Usb20PortStatus.CurrentConnectStatus == 0))
{
Status = STATUS_UNSUCCESSFUL;
goto Exit;
@@ -545,10 +545,10 @@
Status = USBH_SyncGetPortStatus(HubExtension,
Port,
&PortStatus,
- sizeof(USBHUB_PORT_STATUS));
+ sizeof(USB_PORT_STATUS_AND_CHANGE));
if (!NT_SUCCESS(Status) ||
- (PortStatus.UsbPortStatus.Usb20PortStatus.CurrentConnectStatus == 0) ||
+ (PortStatus.PortStatus.Usb20PortStatus.CurrentConnectStatus == 0) ||
ResetRetry >= USBHUB_RESET_PORT_MAX_RETRY)
{
InterlockedExchangePointer((PVOID)&HubExtension->pResetPortEvent,
@@ -567,9 +567,9 @@
Status = USBH_SyncGetPortStatus(HubExtension,
Port,
&PortStatus,
- sizeof(USBHUB_PORT_STATUS));
-
- if ((PortStatus.UsbPortStatus.Usb20PortStatus.CurrentConnectStatus == 0) &&
+ sizeof(USB_PORT_STATUS_AND_CHANGE));
+
+ if ((PortStatus.PortStatus.Usb20PortStatus.CurrentConnectStatus == 0) &&
NT_SUCCESS(Status) &&
HubExtension->HubFlags & USBHUB_FDO_FLAG_USB20_HUB)
{
@@ -1156,7 +1156,7 @@
for (ix = 0; ix < NumberPorts; ix++)
{
- PortData[ix].PortStatus.AsULONG = 0;
+ PortData[ix].PortStatus.AsUlong32 = 0;
if (ExtendedHubInfo)
{
@@ -1355,7 +1355,7 @@
NTAPI
USBH_SyncGetPortStatus(IN PUSBHUB_FDO_EXTENSION HubExtension,
IN USHORT Port,
- IN PUSBHUB_PORT_STATUS PortStatus,
+ IN PUSB_PORT_STATUS_AND_CHANGE PortStatus,
IN ULONG Length)
{
BM_REQUEST_TYPE RequestType;
@@ -1417,7 +1417,7 @@
PUSB_HUB_DESCRIPTOR HubDescriptor;
NTSTATUS Status = STATUS_SUCCESS;
BM_REQUEST_TYPE RequestType;
- PUSBHUB_PORT_STATUS PortStatus;
+ PUSB_PORT_STATUS_AND_CHANGE PortStatus;
DPRINT("USBH_SyncPowerOnPort: Port - %x, IsWait - %x\n", Port, IsWait);
@@ -1425,7 +1425,7 @@
PortData = &HubExtension->PortData[Port - 1];
PortStatus = &PortData->PortStatus;
- if (PortStatus->UsbPortStatus.Usb20PortStatus.CurrentConnectStatus == 1)
+ if (PortStatus->PortStatus.Usb20PortStatus.CurrentConnectStatus == 1)
{
return Status;
}
@@ -1453,7 +1453,7 @@
USBH_Wait(2 * HubDescriptor->bPowerOnToPowerGood);
}
- PortStatus->UsbPortStatus.Usb20PortStatus.CurrentConnectStatus = 1;
+ PortStatus->PortStatus.Usb20PortStatus.CurrentConnectStatus = 1;
}
return Status;
@@ -1520,7 +1520,7 @@
if (NT_SUCCESS(Status))
{
- PortData->PortStatus.UsbPortStatus.Usb20PortStatus.PortEnabledDisabled = 0;
+ PortData->PortStatus.PortStatus.Usb20PortStatus.PortEnabledDisabled = 0;
}
return Status;
@@ -1660,12 +1660,12 @@
HubExtension = Context;
DPRINT_SCE("USBH_ChangeIndicationProcessChange: PortStatus - %lX\n",
- HubExtension->PortStatus.AsULONG);
+ HubExtension->PortStatus.AsUlong32);
if ((NT_SUCCESS(Irp->IoStatus.Status) ||
USBD_SUCCESS(HubExtension->SCEWorkerUrb.Hdr.Status)) &&
- (HubExtension->PortStatus.UsbPortStatusChange.ResetChange ||
- HubExtension->PortStatus.UsbPortStatusChange.PortEnableDisableChange))
+ (HubExtension->PortStatus.PortChange.Usb20PortChange.ResetChange ||
+
HubExtension->PortStatus.PortChange.Usb20PortChange.PortEnableDisableChange))
{
if (!InterlockedDecrement(&HubExtension->PendingRequestCount))
{
@@ -1678,7 +1678,7 @@
HubExtension->WorkItemToQueue = NULL;
- if (HubExtension->PortStatus.UsbPortStatusChange.ResetChange)
+ if (HubExtension->PortStatus.PortChange.Usb20PortChange.ResetChange)
{
RequestValue = USBHUB_FEATURE_C_PORT_RESET;
}
@@ -1782,10 +1782,10 @@
NTAPI
USBH_ProcessPortStateChange(IN PUSBHUB_FDO_EXTENSION HubExtension,
IN USHORT Port,
- IN PUSBHUB_PORT_STATUS PortStatus)
+ IN PUSB_PORT_STATUS_AND_CHANGE PortStatus)
{
PUSBHUB_PORT_DATA PortData;
- USB_PORT_STATUS_CHANGE PortStatusChange;
+ USB_20_PORT_CHANGE PortStatusChange;
PDEVICE_OBJECT PortDevice;
PUSBHUB_PORT_PDO_EXTENSION PortExtension;
PVOID SerialNumber;
@@ -1798,11 +1798,11 @@
ASSERT(Port > 0);
PortData = &HubExtension->PortData[Port - 1];
- PortStatusChange = PortStatus->UsbPortStatusChange;
+ PortStatusChange = PortStatus->PortChange.Usb20PortChange;
if (PortStatusChange.ConnectStatusChange)
{
- PortData->PortStatus.AsULONG = *(PULONG)PortStatus;
+ PortData->PortStatus = *PortStatus;
USBH_SyncClearPortStatus(HubExtension,
Port,
@@ -2062,7 +2062,7 @@
PUSBHUB_FDO_EXTENSION LowerHubExtension;
PUSBHUB_PORT_PDO_EXTENSION LowerPortExtension;
PUSBHUB_STATUS_CHANGE_CONTEXT WorkItem;
- USBHUB_PORT_STATUS PortStatus;
+ USB_PORT_STATUS_AND_CHANGE PortStatus;
NTSTATUS Status;
USHORT Port = 0;
@@ -2115,10 +2115,10 @@
Status = USBH_SyncGetPortStatus(LowerHubExtension,
LowerPortExtension->PortNumber,
&PortStatus,
- sizeof(USBHUB_PORT_STATUS));
+ sizeof(USB_PORT_STATUS_AND_CHANGE));
if (!NT_SUCCESS(Status) ||
- !PortStatus.UsbPortStatus.Usb20PortStatus.CurrentConnectStatus)
+ !PortStatus.PortStatus.Usb20PortStatus.CurrentConnectStatus)
{
HubExtension->HubFlags |= USBHUB_FDO_FLAG_DEVICE_REMOVED;
@@ -2162,7 +2162,7 @@
Status = USBH_SyncGetPortStatus(HubExtension,
Port,
&PortStatus,
- sizeof(USBHUB_PORT_STATUS));
+ sizeof(USB_PORT_STATUS_AND_CHANGE));
}
else
{
@@ -4537,7 +4537,7 @@
PVOID Handle;
PVOID OldDeviceHandle;
PUSB_DEVICE_HANDLE * DeviceHandle;
- USBHUB_PORT_STATUS PortStatus;
+ USB_PORT_STATUS_AND_CHANGE PortStatus;
DPRINT("USBH_ResetDevice: HubExtension - %p, Port - %x, IsKeepDeviceData - %x,
IsWait - %x\n",
HubExtension,
@@ -4548,10 +4548,10 @@
Status = USBH_SyncGetPortStatus(HubExtension,
Port,
&PortStatus,
- sizeof(USBHUB_PORT_STATUS));
+ sizeof(USB_PORT_STATUS_AND_CHANGE));
if (!NT_SUCCESS(Status) ||
- !(PortStatus.UsbPortStatus.Usb20PortStatus.CurrentConnectStatus))
+ !(PortStatus.PortStatus.Usb20PortStatus.CurrentConnectStatus))
{
return STATUS_UNSUCCESSFUL;
}
@@ -4625,7 +4625,7 @@
Status = USBH_SyncGetPortStatus(HubExtension,
Port,
&PortStatus,
- sizeof(USBHUB_PORT_STATUS));
+ sizeof(USB_PORT_STATUS_AND_CHANGE));
if (!NT_SUCCESS(Status))
{
@@ -4634,7 +4634,7 @@
Status = USBD_CreateDeviceEx(HubExtension,
DeviceHandle,
- PortStatus.UsbPortStatus,
+ PortStatus.PortStatus,
Port);
if (!NT_SUCCESS(Status))
Modified: trunk/reactos/drivers/usb/usbhub_new/usbhub.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbhub_new/usb…
==============================================================================
--- trunk/reactos/drivers/usb/usbhub_new/usbhub.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbhub_new/usbhub.h [iso-8859-1] Sat Jul 1 06:22:27 2017
@@ -108,7 +108,7 @@
extern PWSTR GenericUSBDeviceString;
typedef struct _USBHUB_PORT_DATA {
- USBHUB_PORT_STATUS PortStatus;
+ USB_PORT_STATUS_AND_CHANGE PortStatus;
PDEVICE_OBJECT DeviceObject;
USB_CONNECTION_STATUS ConnectionStatus;
ULONG PortAttributes;
@@ -189,7 +189,7 @@
KSEMAPHORE HubSemaphore;
PUSBHUB_IO_WORK_ITEM WorkItemToQueue;
USB_IDLE_CALLBACK_INFO IdleCallbackInfo;
- USBHUB_PORT_STATUS PortStatus;
+ USB_PORT_STATUS_AND_CHANGE PortStatus;
PIRP PowerIrp;
} USBHUB_FDO_EXTENSION, *PUSBHUB_FDO_EXTENSION;
@@ -480,7 +480,7 @@
USBH_SyncGetPortStatus(
IN PUSBHUB_FDO_EXTENSION HubExtension,
IN USHORT Port,
- IN PUSBHUB_PORT_STATUS PortStatus,
+ IN PUSB_PORT_STATUS_AND_CHANGE PortStatus,
IN ULONG Length);
NTSTATUS
Modified: trunk/reactos/drivers/usb/usbport/iface.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbport/iface.…
==============================================================================
--- trunk/reactos/drivers/usb/usbport/iface.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbport/iface.c [iso-8859-1] Sat Jul 1 06:22:27 2017
@@ -421,7 +421,7 @@
ULONG NumPorts;
ULONG ix;
PUSB_EXTHUB_INFORMATION_0 HubInfoBuffer;
- USBHUB_PORT_STATUS PortStatus;
+ USB_PORT_STATUS_AND_CHANGE PortStatus;
ULONG PortAttrX;
DPRINT("USBHI_GetExtendedHubInformation: ... \n");
@@ -433,7 +433,7 @@
Packet = &FdoExtension->MiniPortInterface->Packet;
HubInfoBuffer = HubInformationBuffer;
- PortStatus.AsULONG = 0;
+ PortStatus.AsUlong32 = 0;
if (HubPhysicalDeviceObject != PdoDevice)
{
@@ -472,7 +472,7 @@
ix,
&PortStatus);
- if (PortStatus.UsbPortStatus.Usb20PortStatus.AsUshort16 & 0x8000)
+ if (PortStatus.PortStatus.Usb20PortStatus.AsUshort16 & 0x8000)
{
HubInfoBuffer->Port[ix].PortAttributes |= USB_PORTATTR_OWNED_BY_CC;
}
Modified: trunk/reactos/drivers/usb/usbport/roothub.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbport/roothu…
==============================================================================
--- trunk/reactos/drivers/usb/usbport/roothub.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbport/roothub.c [iso-8859-1] Sat Jul 1 06:22:27 2017
@@ -534,7 +534,7 @@
PUSBPORT_RHDEVICE_EXTENSION PdoExtension;
PUSBPORT_REGISTRATION_PACKET Packet;
ULONG TransferLength;
- USBHUB_PORT_STATUS PortStatus;
+ USB_PORT_STATUS_AND_CHANGE PortStatus;
USB_HUB_STATUS_AND_CHANGE HubStatus;
PVOID Buffer;
PULONG AddressBitMap;
@@ -555,7 +555,7 @@
HubDescriptor = &PdoExtension->RootHubDescriptors->Descriptor;
NumberOfPorts = HubDescriptor->bNumberOfPorts;
- PortStatus.AsULONG = 0;
+ PortStatus.AsUlong32 = 0;
HubStatus.AsUlong32 = 0;
Urb = Transfer->Urb;
@@ -608,11 +608,11 @@
return RH_STATUS_UNSUCCESSFUL;
}
- if (PortStatus.UsbPortStatusChange.ConnectStatusChange ||
- PortStatus.UsbPortStatusChange.PortEnableDisableChange ||
- PortStatus.UsbPortStatusChange.SuspendChange ||
- PortStatus.UsbPortStatusChange.OverCurrentIndicatorChange ||
- PortStatus.UsbPortStatusChange.ResetChange)
+ if (PortStatus.PortChange.Usb20PortChange.ConnectStatusChange ||
+ PortStatus.PortChange.Usb20PortChange.PortEnableDisableChange ||
+ PortStatus.PortChange.Usb20PortChange.SuspendChange ||
+ PortStatus.PortChange.Usb20PortChange.OverCurrentIndicatorChange ||
+ PortStatus.PortChange.Usb20PortChange.ResetChange)
{
/* At the port status there is a change */
AddressBitMap[Port >> 5] |= 1 << (Port & 0x1F);
@@ -858,11 +858,11 @@
Packet->MiniPortVersion == USB_MINIPORT_VERSION_UHCI ||
Packet->MiniPortVersion == USB_MINIPORT_VERSION_EHCI)
{
- RH_HubDescriptor->bDescriptorType = 0x29; // #define
USB_20_HUB_DESCRIPTOR_TYPE 0x29 - need add in .h file
+ RH_HubDescriptor->bDescriptorType = USB_20_HUB_DESCRIPTOR_TYPE;
}
else if (Packet->MiniPortVersion == USB_MINIPORT_VERSION_XHCI)
{
- RH_HubDescriptor->bDescriptorType = 0x2A; // #define
USB_30_HUB_DESCRIPTOR_TYPE 0x2A - need add in .h file
+ RH_HubDescriptor->bDescriptorType = USB_30_HUB_DESCRIPTOR_TYPE;
}
else
{
@@ -923,9 +923,9 @@
FdoDevice = FdoExtension->CommonExtension.SelfDevice;
if (FdoExtension->Flags & USBPORT_FLAG_HC_SUSPEND &&
- FdoExtension->Flags & USBPORT_FLAG_HC_WAKE_SUPPORT &&
- FdoExtension->MiniPortFlags & USBPORT_MPFLAG_SUSPENDED &&
- FdoExtension->TimerFlags & USBPORT_TMFLAG_WAKE)
+ FdoExtension->Flags & USBPORT_FLAG_HC_WAKE_SUPPORT &&
+ FdoExtension->MiniPortFlags & USBPORT_MPFLAG_SUSPENDED &&
+ FdoExtension->TimerFlags & USBPORT_TMFLAG_WAKE)
{
USBPORT_HcQueueWakeDpc(FdoDevice);
return 0;
Modified: trunk/reactos/sdk/include/reactos/drivers/usbport/usbmport.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/reactos/driver…
==============================================================================
--- trunk/reactos/sdk/include/reactos/drivers/usbport/usbmport.h [iso-8859-1] (original)
+++ trunk/reactos/sdk/include/reactos/drivers/usbport/usbmport.h [iso-8859-1] Sat Jul 1
06:22:27 2017
@@ -66,19 +66,7 @@
#define RH_STATUS_NO_CHANGES 1
#define RH_STATUS_UNSUCCESSFUL 2
-typedef USB_20_PORT_CHANGE USB_PORT_STATUS_CHANGE;
-
-typedef union _USBHUB_PORT_STATUS {
-struct {
- USB_PORT_STATUS UsbPortStatus;
- USB_PORT_STATUS_CHANGE UsbPortStatusChange;
- };
- ULONG AsULONG;
-} USBHUB_PORT_STATUS, *PUSBHUB_PORT_STATUS;
-
/* Additional USB Class Codes from
USB.org */
-#define USBC_DEVICE_CLASS_AUDIO_VIDEO 0x10
-#define USBC_DEVICE_CLASS_BILLBOARD 0x11
#define USBC_DEVICE_CLASS_TYPE_C_BRIDGE 0x12
/* Miniport functions */
@@ -222,7 +210,7 @@
(NTAPI *PHCI_RH_GET_PORT_STATUS)(
PVOID,
USHORT,
- PUSBHUB_PORT_STATUS);
+ PUSB_PORT_STATUS_AND_CHANGE);
typedef MPSTATUS
(NTAPI *PHCI_RH_GET_HUB_STATUS)(