Blame 0341-usb3-superspeed-descriptors.patch

c8dfc6
From f25f31e864756f27f6a94ab7e66b20061291ffa5 Mon Sep 17 00:00:00 2001
c8dfc6
From: Gerd Hoffmann <kraxel@redhat.com>
c8dfc6
Date: Tue, 28 Aug 2012 17:28:50 +0200
c8dfc6
Subject: [PATCH 341/366] usb3: superspeed descriptors
c8dfc6
c8dfc6
Add superspeed descriptor entry to USBDesc,
c8dfc6
advertise superspeed support when present.
c8dfc6
c8dfc6
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
c8dfc6
---
c8dfc6
 hw/usb/desc.c | 10 +++++++++-
c8dfc6
 hw/usb/desc.h |  1 +
c8dfc6
 2 files changed, 10 insertions(+), 1 deletion(-)
c8dfc6
c8dfc6
diff --git a/hw/usb/desc.c b/hw/usb/desc.c
c8dfc6
index 0a9d3c9..3e8c6cb 100644
c8dfc6
--- a/hw/usb/desc.c
c8dfc6
+++ b/hw/usb/desc.c
c8dfc6
@@ -359,6 +359,9 @@ static void usb_desc_setdefaults(USBDevice *dev)
c8dfc6
     case USB_SPEED_HIGH:
c8dfc6
         dev->device = desc->high;
c8dfc6
         break;
c8dfc6
+    case USB_SPEED_SUPER:
c8dfc6
+        dev->device = desc->super;
c8dfc6
+        break;
c8dfc6
     }
c8dfc6
     usb_desc_set_config(dev, 0);
c8dfc6
 }
c8dfc6
@@ -376,6 +379,9 @@ void usb_desc_init(USBDevice *dev)
c8dfc6
     if (desc->high) {
c8dfc6
         dev->speedmask |= USB_SPEED_MASK_HIGH;
c8dfc6
     }
c8dfc6
+    if (desc->super) {
c8dfc6
+        dev->speedmask |= USB_SPEED_MASK_SUPER;
c8dfc6
+    }
c8dfc6
     usb_desc_setdefaults(dev);
c8dfc6
 }
c8dfc6
 
c8dfc6
@@ -384,7 +390,9 @@ void usb_desc_attach(USBDevice *dev)
c8dfc6
     const USBDesc *desc = usb_device_get_usb_desc(dev);
c8dfc6
 
c8dfc6
     assert(desc != NULL);
c8dfc6
-    if (desc->high && (dev->port->speedmask & USB_SPEED_MASK_HIGH)) {
c8dfc6
+    if (desc->super && (dev->port->speedmask & USB_SPEED_MASK_SUPER)) {
c8dfc6
+        dev->speed = USB_SPEED_SUPER;
c8dfc6
+    } else if (desc->high && (dev->port->speedmask & USB_SPEED_MASK_HIGH)) {
c8dfc6
         dev->speed = USB_SPEED_HIGH;
c8dfc6
     } else if (desc->full && (dev->port->speedmask & USB_SPEED_MASK_FULL)) {
c8dfc6
         dev->speed = USB_SPEED_FULL;
c8dfc6
diff --git a/hw/usb/desc.h b/hw/usb/desc.h
c8dfc6
index 7cf5442..d89fa41 100644
c8dfc6
--- a/hw/usb/desc.h
c8dfc6
+++ b/hw/usb/desc.h
c8dfc6
@@ -152,6 +152,7 @@ struct USBDesc {
c8dfc6
     USBDescID                 id;
c8dfc6
     const USBDescDevice       *full;
c8dfc6
     const USBDescDevice       *high;
c8dfc6
+    const USBDescDevice       *super;
c8dfc6
     const char* const         *str;
c8dfc6
 };
c8dfc6
 
c8dfc6
-- 
c8dfc6
1.7.12
c8dfc6