usb bugfixes for 2.2

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJUY3AdAAoJEEy22O7T6HE4ZHIQAMy0NmId0u+498vEw8Wk2aYB
 WjUKqCaqJL52IaZuOhgact0bkAovTQ8DadfNhOrK2+3ChVgHvgLwAJ4qhKT5IE9S
 gFtMA7xogh6kRw9nKOQw4qSInv4IBk5fz+AOnpcRAmGhV5eJtV6PC6u1VTx/f+Y3
 TAlfR56FoUBqRCFTQ34K+GDVQtdjCIpqkCPytUgwc8evM9cr3xAZt0hvUhKWtdh2
 Yf5EZmm3xTBMCgg2aLuCVT8INjrTFR4oGE2sx9iU+qKOMxu2S8YSz0an6NIXp6Rg
 r8xc+X6qE2w8LTBpbTKQECBO/saFrq56aPwygRAys/GnpEt3JS1wTg4mAdfDDivE
 U9MXe61Sb8YZG71AvmbMDFsLDmXGDM5dqaGnOPjCkzxTy4a64LpwYT6fjc0WZDXa
 CX9ic4IwCWMZUhbBWcnv84hnUPTO8G2kWv77qtl4cR0tTn9dboqW4XF3uNyoPzIp
 jzNZ2cqeRHkSn0BmsOy4nvku5+LVVwwryjdVmqO+oC1Fmqr65ZlkiDG9+q+0t5Q3
 yR1gdAc4NlezJENsA9R5pY/wIoj/o+c6E/EtOftS0EYGf71MU6CJ93Eq0ceDk7HW
 b/DHPhrC9YnZb7PW4ykaSnxx5LJtes+2WEF/rXzSqvIgqrPvey3/EikYS3AYaUB+
 aixlkF588ui30bNIKIHO
 =woLg
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/pull-usb-20141112-1' into staging

usb bugfixes for 2.2

# gpg: Signature made Wed 12 Nov 2014 14:35:09 GMT using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-usb-20141112-1:
  usb-host: fix usb_host_speed_compat tyops
  xhci: add sanity checks to xhci_lookup_uport
  Provide the missing LIBUSB_LOG_LEVEL_* for older libusb or FreeBSD. Providing just the needed value as a defined.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2014-11-13 10:54:05 +00:00
commit 410bd787bf
2 changed files with 18 additions and 3 deletions

View File

@ -2262,6 +2262,9 @@ static USBPort *xhci_lookup_uport(XHCIState *xhci, uint32_t *slot_ctx)
int i, pos, port;
port = (slot_ctx[1]>>16) & 0xFF;
if (port < 1 || port > xhci->numports) {
return NULL;
}
port = xhci->ports[port-1].uport->index+1;
pos = snprintf(path, sizeof(path), "%d", port);
for (i = 0; i < 5; i++) {
@ -3706,6 +3709,12 @@ static int usb_xhci_post_load(void *opaque, int version_id)
xhci_mask64(ldq_le_pci_dma(pci_dev, dcbaap + 8 * slotid));
xhci_dma_read_u32s(xhci, slot->ctx, slot_ctx, sizeof(slot_ctx));
slot->uport = xhci_lookup_uport(xhci, slot_ctx);
if (!slot->uport) {
/* should not happen, but may trigger on guest bugs */
slot->enabled = 0;
slot->addressed = 0;
continue;
}
assert(slot->uport && slot->uport->dev);
for (epid = 1; epid <= 31; epid++) {

View File

@ -143,6 +143,12 @@ static void usb_host_attach_kernel(USBHostDevice *s);
/* ------------------------------------------------------------------------ */
#ifndef LIBUSB_LOG_LEVEL_WARNING /* older libusb didn't define these */
#define LIBUSB_LOG_LEVEL_WARNING 2
#endif
/* ------------------------------------------------------------------------ */
#define CONTROL_TIMEOUT 10000 /* 10 sec */
#define BULK_TIMEOUT 0 /* unlimited */
#define INTR_TIMEOUT 0 /* unlimited */
@ -743,13 +749,13 @@ static void usb_host_speed_compat(USBHostDevice *s)
udev->speedmask = (1 << udev->speed);
if (udev->speed == USB_SPEED_SUPER && compat_high) {
udev->speedmask |= USB_SPEED_HIGH;
udev->speedmask |= USB_SPEED_MASK_HIGH;
}
if (udev->speed == USB_SPEED_SUPER && compat_full) {
udev->speedmask |= USB_SPEED_FULL;
udev->speedmask |= USB_SPEED_MASK_FULL;
}
if (udev->speed == USB_SPEED_HIGH && compat_full) {
udev->speedmask |= USB_SPEED_FULL;
udev->speedmask |= USB_SPEED_MASK_FULL;
}
}