[USBPORT]

Patch by Vadim Galyant:
- Add USBPORT_HUB_CHARACTERISTICS structure
- Indicate the USB3 hub descriptor type when the miniport is an XHCI controller

svn path=/trunk/; revision=75253
This commit is contained in:
Thomas Faber 2017-07-01 06:06:12 +00:00
parent bcea1db7b0
commit 68430f1260
2 changed files with 66 additions and 3 deletions

View file

@ -853,9 +853,27 @@ USBPORT_RootHubCreateDevice(IN PDEVICE_OBJECT FdoDevice,
RH_HubDescriptor = &PdoExtension->RootHubDescriptors->Descriptor;
RH_HubDescriptor->bDescriptorLength = sizeof(USB_HUB_DESCRIPTOR) + 2 * NumMaskByte;
RH_HubDescriptor->bDescriptorType = 0x29; // USB_20_HUB_DESCRIPTOR_TYPE - need add in .h file
if (Packet->MiniPortVersion == USB_MINIPORT_VERSION_OHCI ||
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
}
else if (Packet->MiniPortVersion == USB_MINIPORT_VERSION_XHCI)
{
RH_HubDescriptor->bDescriptorType = 0x2A; // #define USB_30_HUB_DESCRIPTOR_TYPE 0x2A - need add in .h file
}
else
{
DPRINT1("USBPORT_RootHubCreateDevice: Unknown MiniPortVersion - %x\n",
Packet->MiniPortVersion);
DbgBreakPoint();
}
RH_HubDescriptor->bNumberOfPorts = RootHubData.NumberOfPorts;
RH_HubDescriptor->wHubCharacteristics = RootHubData.HubCharacteristics;
RH_HubDescriptor->wHubCharacteristics = RootHubData.HubCharacteristics.AsUSHORT;
RH_HubDescriptor->bPowerOnToPowerGood = RootHubData.PowerOnToPowerGood;
RH_HubDescriptor->bHubControlCurrent = RootHubData.HubControlCurrent;

View file

@ -453,6 +453,7 @@ typedef VOID
#define USB_MINIPORT_VERSION_OHCI 0x01
#define USB_MINIPORT_VERSION_UHCI 0x02
#define USB_MINIPORT_VERSION_EHCI 0x03
#define USB_MINIPORT_VERSION_XHCI 0x04
#define USB_MINIPORT_FLAGS_INTERRUPT 0x0001
#define USB_MINIPORT_FLAGS_PORT_IO 0x0002
@ -625,9 +626,53 @@ typedef struct _USBPORT_TRANSFER_PARAMETERS {
C_ASSERT(sizeof(USBPORT_TRANSFER_PARAMETERS) == 28);
/* For USB1.1 or USB3 Hub Descriptors */
typedef union _USBPORT_HUB_11_CHARACTERISTICS {
struct {
USHORT PowerControlMode :1;
USHORT NoPowerSwitching :1; // Reserved. Used only on 1.0 compliant hubs that implement no power switching.
USHORT PartOfCompoundDevice :1;
USHORT OverCurrentProtectionMode :1;
USHORT NoOverCurrentProtection :1;
USHORT Reserved1 :11;
};
USHORT AsUSHORT;
} USBPORT_HUB_11_CHARACTERISTICS;
C_ASSERT(sizeof(USBPORT_HUB_11_CHARACTERISTICS) == sizeof(USHORT));
/* For USB2.0 Hub Descriptors */
typedef union _USBPORT_HUB_20_CHARACTERISTICS {
struct {
USHORT PowerControlMode :1;
USHORT NoPowerSwitching :1; // Reserved. Used only on 1.0 compliant hubs that implement no power switching.
USHORT PartOfCompoundDevice :1;
USHORT OverCurrentProtectionMode :1;
USHORT NoOverCurrentProtection :1;
USHORT TtThinkTime :2;
USHORT PortIndicatorsSupported :1;
USHORT Reserved1 :8;
};
USHORT AsUSHORT;
} USBPORT_HUB_20_CHARACTERISTICS;
C_ASSERT(sizeof(USBPORT_HUB_20_CHARACTERISTICS) == sizeof(USHORT));
typedef USBPORT_HUB_11_CHARACTERISTICS USBPORT_HUB_30_CHARACTERISTICS;
typedef union _USBPORT_HUB_CHARACTERISTICS {
USHORT AsUSHORT;
USBPORT_HUB_11_CHARACTERISTICS Usb11HubCharacteristics;
USBPORT_HUB_20_CHARACTERISTICS Usb20HubCharacteristics;
USBPORT_HUB_30_CHARACTERISTICS Usb30HubCharacteristics;
} USBPORT_HUB_CHARACTERISTICS;
C_ASSERT(sizeof(USBPORT_HUB_CHARACTERISTICS) == sizeof(USHORT));
typedef struct _USBPORT_ROOT_HUB_DATA {
ULONG NumberOfPorts;
ULONG HubCharacteristics;
USBPORT_HUB_CHARACTERISTICS HubCharacteristics;
USHORT Padded1;
ULONG PowerOnToPowerGood;
ULONG HubControlCurrent;
} USBPORT_ROOT_HUB_DATA, *PUSBPORT_ROOT_HUB_DATA;