XHCI: define the SuperSpeedPlus ID for 10Gbps connection speed

can be found on USB 3.1 xhci controllers in the PORTSC register

Change-Id: I11df7e22ca1ab71b42325f8c3db1e4745287feeb
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7923
Haiku-Format: Haiku-format Bot <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Jérôme Duval
2024-08-01 04:24:54 +00:00
committed by waddlesplash
parent 0f73d13bda
commit 6aab5c47c2
6 changed files with 19 additions and 8 deletions
@@ -536,7 +536,7 @@ Device::InitEndpoints(int32 interfaceIndex)
Pipe* pipe = NULL; Pipe* pipe = NULL;
usb_endpoint_ss_companion_descriptor* comp_descr = NULL; usb_endpoint_ss_companion_descriptor* comp_descr = NULL;
if (fSpeed == USB_SPEED_SUPERSPEED) { if (fSpeed >= USB_SPEED_SUPERSPEED) {
// We should have a companion descriptor for this device. // We should have a companion descriptor for this device.
// Let's find it: it'll be the "i"th one. // Let's find it: it'll be the "i"th one.
size_t k = 0; size_t k = 0;
+1 -1
View File
@@ -287,7 +287,7 @@ Hub::Explore(change_item **changeList)
// transaction translator for the device. // transaction translator for the device.
int8 hubAddress = HubAddress(); int8 hubAddress = HubAddress();
uint8 hubPort = HubPort(); uint8 hubPort = HubPort();
if (Speed() == USB_SPEED_HIGHSPEED || Speed() == USB_SPEED_SUPERSPEED) { if (Speed() == USB_SPEED_HIGHSPEED || Speed() >= USB_SPEED_SUPERSPEED) {
hubAddress = DeviceAddress(); hubAddress = DeviceAddress();
hubPort = i + 1; hubPort = i + 1;
} }
@@ -192,6 +192,7 @@ BulkPipe::InitCommon(int8 deviceAddress, uint8 endpointAddress,
maxPacketSize = 512; maxPacketSize = 512;
break; break;
case USB_SPEED_SUPERSPEED: case USB_SPEED_SUPERSPEED:
case USB_SPEED_SUPERSPEEDPLUS:
maxPacketSize = 1024; maxPacketSize = 1024;
break; break;
@@ -400,6 +401,7 @@ ControlPipe::InitCommon(int8 deviceAddress, uint8 endpointAddress,
maxPacketSize = 64; maxPacketSize = 64;
break; break;
case USB_SPEED_SUPERSPEED: case USB_SPEED_SUPERSPEED:
case USB_SPEED_SUPERSPEEDPLUS:
maxPacketSize = 512; maxPacketSize = 512;
break; break;
@@ -303,6 +303,7 @@ Transfer::_CalculateBandwidth()
} }
case USB_SPEED_SUPERSPEED: case USB_SPEED_SUPERSPEED:
case USB_SPEED_SUPERSPEEDPLUS:
{ {
// TODO it should only be useful for isochronous type // TODO it should only be useful for isochronous type
bandwidthNS = 0; bandwidthNS = 0;
@@ -101,7 +101,8 @@ typedef enum {
USB_SPEED_FULLSPEED, USB_SPEED_FULLSPEED,
USB_SPEED_HIGHSPEED, USB_SPEED_HIGHSPEED,
USB_SPEED_SUPERSPEED, USB_SPEED_SUPERSPEED,
USB_SPEED_MAX = USB_SPEED_SUPERSPEED USB_SPEED_SUPERSPEEDPLUS,
USB_SPEED_MAX = USB_SPEED_SUPERSPEEDPLUS
} usb_speed; } usb_speed;
+12 -5
View File
@@ -1596,6 +1596,9 @@ XHCI::AllocateDevice(Hub *parent, int8 hubAddress, uint8 hubPort,
case USB_SPEED_SUPERSPEED: case USB_SPEED_SUPERSPEED:
dwslot0 |= SLOT_0_SPEED(4); dwslot0 |= SLOT_0_SPEED(4);
break; break;
case USB_SPEED_SUPERSPEEDPLUS:
dwslot0 |= SLOT_0_SPEED(5);
break;
default: default:
TRACE_ERROR("unknown usb speed\n"); TRACE_ERROR("unknown usb speed\n");
break; break;
@@ -2198,6 +2201,7 @@ XHCI::ConfigureEndpoint(xhci_endpoint* ep, uint8 slot, uint8 number, uint8 type,
case USB_SPEED_HIGHSPEED: case USB_SPEED_HIGHSPEED:
case USB_SPEED_SUPERSPEED: case USB_SPEED_SUPERSPEED:
case USB_SPEED_SUPERSPEEDPLUS:
default: default:
// Convert 1-16 into 0-15. // Convert 1-16 into 0-15.
calcInterval = min_c(max_c(interval, 1), 16) - 1; calcInterval = min_c(max_c(interval, 1), 16) - 1;
@@ -2216,7 +2220,7 @@ XHCI::ConfigureEndpoint(xhci_endpoint* ep, uint8 slot, uint8 number, uint8 type,
if (speed == USB_SPEED_HIGHSPEED && (type & (USB_OBJECT_INTERRUPT_PIPE if (speed == USB_SPEED_HIGHSPEED && (type & (USB_OBJECT_INTERRUPT_PIPE
| USB_OBJECT_ISO_PIPE)) != 0) { | USB_OBJECT_ISO_PIPE)) != 0) {
maxBurst = (maxPacketSize & 0x1800) >> 11; maxBurst = (maxPacketSize & 0x1800) >> 11;
} else if (speed != USB_SPEED_SUPERSPEED) { } else if (speed < USB_SPEED_SUPERSPEED) {
maxBurst = 0; maxBurst = 0;
} }
dwendpoint1 |= ENDPOINT_1_MAXBURST(maxBurst); dwendpoint1 |= ENDPOINT_1_MAXBURST(maxBurst);
@@ -2255,7 +2259,7 @@ XHCI::ConfigureEndpoint(xhci_endpoint* ep, uint8 slot, uint8 number, uint8 type,
// for isochronous endpoints that specifies the maximum ESIT payload. // for isochronous endpoints that specifies the maximum ESIT payload.
// We don't fetch this yet, so just fall back to the USB2 computation // We don't fetch this yet, so just fall back to the USB2 computation
// method if bytesPerInterval is 0. // method if bytesPerInterval is 0.
if (speed == USB_SPEED_SUPERSPEED && bytesPerInterval != 0) if (speed >= USB_SPEED_SUPERSPEED && bytesPerInterval != 0)
dwendpoint4 |= ENDPOINT_4_MAXESITPAYLOAD(bytesPerInterval); dwendpoint4 |= ENDPOINT_4_MAXESITPAYLOAD(bytesPerInterval);
else if (speed >= USB_SPEED_HIGHSPEED) else if (speed >= USB_SPEED_HIGHSPEED)
dwendpoint4 |= ENDPOINT_4_MAXESITPAYLOAD((maxBurst + 1) * maxPacketSize); dwendpoint4 |= ENDPOINT_4_MAXESITPAYLOAD((maxBurst + 1) * maxPacketSize);
@@ -2302,6 +2306,9 @@ XHCI::GetPortSpeed(uint8 index, usb_speed* speed)
case 4: case 4:
*speed = USB_SPEED_SUPERSPEED; *speed = USB_SPEED_SUPERSPEED;
break; break;
case 5:
*speed = USB_SPEED_SUPERSPEEDPLUS;
break;
default: default:
TRACE_ALWAYS("nonstandard port speed %" B_PRId32 ", assuming SuperSpeed\n", TRACE_ALWAYS("nonstandard port speed %" B_PRId32 ", assuming SuperSpeed\n",
PS_SPEED_GET(portStatus)); PS_SPEED_GET(portStatus));
@@ -2344,12 +2351,12 @@ XHCI::GetPortStatus(uint8 index, usb_port_status* status)
if (portStatus & PS_PR) if (portStatus & PS_PR)
status->status |= PORT_STATUS_RESET; status->status |= PORT_STATUS_RESET;
if (portStatus & PS_PP) { if (portStatus & PS_PP) {
if (fPortSpeeds[index] == USB_SPEED_SUPERSPEED) if (fPortSpeeds[index] >= USB_SPEED_SUPERSPEED)
status->status |= PORT_STATUS_SS_POWER; status->status |= PORT_STATUS_SS_POWER;
else else
status->status |= PORT_STATUS_POWER; status->status |= PORT_STATUS_POWER;
} }
if (fPortSpeeds[index] == USB_SPEED_SUPERSPEED) if (fPortSpeeds[index] >= USB_SPEED_SUPERSPEED)
status->status |= portStatus & PS_PLS_MASK; status->status |= portStatus & PS_PLS_MASK;
// build the change // build the change
@@ -2362,7 +2369,7 @@ XHCI::GetPortStatus(uint8 index, usb_port_status* status)
if (portStatus & PS_PRC) if (portStatus & PS_PRC)
status->change |= PORT_STATUS_RESET; status->change |= PORT_STATUS_RESET;
if (fPortSpeeds[index] == USB_SPEED_SUPERSPEED) { if (fPortSpeeds[index] >= USB_SPEED_SUPERSPEED) {
if (portStatus & PS_PLC) if (portStatus & PS_PLC)
status->change |= PORT_CHANGE_LINK_STATE; status->change |= PORT_CHANGE_LINK_STATE;
if (portStatus & PS_WRC) if (portStatus & PS_WRC)