Re: [RFC] xHCI/USB: Make xHCI driver have a BOS descriptor.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 5 Oct 2011, Sarah Sharp wrote:

> To add USB 3.0 link power management (LPM), we need to know what the U1
> and U2 exit latencies are for the xHCI host controller.  External USB 3.0
> hubs report these values through the SuperSpeed Capabilities descriptor in
> the BOS descriptor.  Make the USB 3.0 roothub for the xHCI host behave
> like an external hub and return the BOS descriptors.
> 
> The U1 and U2 exit latencies will vary across each host controller, so we
> need to dynamically fill those values in by reading the exit latencies out
> of the xHC registers.
> 
> I wasn't quite sure how to pass back the length copied to the userspace
> buffer by the xHCI driver, so I made xHCI's hub_control function return the
> length.  I think traditionally it's always returned 0 or a negative error
> value, so this might not be the best way to share the copied length.  I'm
> open to opinions as to how it "should be" done. :)

It's okay to set the return value equal to the length.  But you 
shouldn't add a separate call to the hub_control method; just jump to 
the existing call in the switch statement's default case.  Don't bother 
to check the speed -- but do update the code following the method call 
so that it understands that positive values are the actual length.

Also, you'll have to update the size of tbuf.  It will need to be big 
enough to hold the entire BOS descriptor set -- which means the code in 
xhci-hub doesn't have to check the size.

> I'm also not sure if the U2 Device Exit Latency conversion is endian safe.
> Can someone check the HCS_U2_LATENCY lines?

> +		if (len == sizeof(usb_bos_descriptor)) {
> +			buf[13] = HCS_U2_LATENCY(temp) & 0xff;
> +			buf[14] = HCS_U2_LATENCY(temp) >> 8;
> +		}

These?  Just use put_unaligned_le16().

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux