[usb] Record USB device speed separately from current port speed

Record the speed of a USB device based on the port's speed at the time
that the device was enabled.  This allows us to remember the device's
speed even after the device has been disconnected (and so the port's
current speed has changed).

In particular, this allows us to correctly identify the transaction
translator for a low-speed or full-speed device after the device has
been disconnected.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2015-12-06 23:41:26 +00:00
parent 15ce7ce355
commit eb1fc1e957
5 changed files with 15 additions and 14 deletions
+2 -2
View File
@@ -970,10 +970,10 @@ static uint32_t ehci_endpoint_characteristics ( struct usb_endpoint *ep ) {
chr |= EHCI_CHR_TOGGLE;
/* Determine endpoint speed */
if ( usb->port->speed == USB_SPEED_HIGH ) {
if ( usb->speed == USB_SPEED_HIGH ) {
chr |= EHCI_CHR_EPS_HIGH;
} else {
if ( usb->port->speed == USB_SPEED_FULL ) {
if ( usb->speed == USB_SPEED_FULL ) {
chr |= EHCI_CHR_EPS_FULL;
} else {
chr |= EHCI_CHR_EPS_LOW;
+1 -1
View File
@@ -697,7 +697,7 @@ static int uhci_endpoint_open ( struct usb_endpoint *ep ) {
goto err_ring_alloc;
endpoint->ring.mtu = ep->mtu;
endpoint->ring.flags = UHCI_FL_CERR_MAX;
if ( usb->port->speed < USB_SPEED_FULL )
if ( usb->speed < USB_SPEED_FULL )
endpoint->ring.flags |= UHCI_FL_LS;
endpoint->ring.control = ( UHCI_CONTROL_DEVICE ( usb->address ) |
UHCI_CONTROL_ENDPOINT ( ep->address ) );
+1 -2
View File
@@ -2753,7 +2753,6 @@ static void xhci_device_close ( struct usb_device *usb ) {
static int xhci_device_address ( struct usb_device *usb ) {
struct xhci_slot *slot = usb_get_hostdata ( usb );
struct xhci_device *xhci = slot->xhci;
struct usb_port *port = usb->port;
struct usb_port *root_port;
int psiv;
int rc;
@@ -2766,7 +2765,7 @@ static int xhci_device_address ( struct usb_device *usb ) {
slot->port = root_port->address;
/* Calculate protocol speed ID */
psiv = xhci_port_psiv ( xhci, slot->port, port->speed );
psiv = xhci_port_psiv ( xhci, slot->port, usb->speed );
if ( psiv < 0 ) {
rc = psiv;
return rc;