Blame 0341-usb3-superspeed-descriptors.patch

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