1 From 9a6fd10bf6a85c4df63a7ba1cf7d6203220d722e Mon Sep 17 00:00:00 2001
2 From: Gerd Hoffmann <kraxel@redhat.com>
3 Date: Tue, 28 Aug 2012 17:29:15 +0200
4 Subject: [PATCH] usb-storage: usb3 support
6 Add usb3 descriptors to usb-storage, so it shows up as superspeed
7 device when connected to xhci.
9 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 hw/usb/dev-storage.c | 46 +++++++++++++++++++++++++++++++++++++++++++---
12 1 file changed, 43 insertions(+), 3 deletions(-)
14 diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c
15 index ff48d91..e732191 100644
16 --- a/hw/usb/dev-storage.c
17 +++ b/hw/usb/dev-storage.c
18 @@ -78,6 +78,7 @@ enum {
25 static const USBDescStrings desc_strings = {
26 @@ -86,6 +87,7 @@ static const USBDescStrings desc_strings = {
27 [STR_SERIALNUMBER] = "1",
28 [STR_CONFIG_FULL] = "Full speed config (usb 1.1)",
29 [STR_CONFIG_HIGH] = "High speed config (usb 2.0)",
30 + [STR_CONFIG_SUPER] = "Super speed config (usb 3.0)",
33 static const USBDescIface desc_iface_full = {
34 @@ -158,6 +160,43 @@ static const USBDescDevice desc_device_high = {
38 +static const USBDescIface desc_iface_super = {
39 + .bInterfaceNumber = 0,
41 + .bInterfaceClass = USB_CLASS_MASS_STORAGE,
42 + .bInterfaceSubClass = 0x06, /* SCSI */
43 + .bInterfaceProtocol = 0x50, /* Bulk */
44 + .eps = (USBDescEndpoint[]) {
46 + .bEndpointAddress = USB_DIR_IN | 0x01,
47 + .bmAttributes = USB_ENDPOINT_XFER_BULK,
48 + .wMaxPacketSize = 1024,
51 + .bEndpointAddress = USB_DIR_OUT | 0x02,
52 + .bmAttributes = USB_ENDPOINT_XFER_BULK,
53 + .wMaxPacketSize = 1024,
59 +static const USBDescDevice desc_device_super = {
61 + .bMaxPacketSize0 = 9,
62 + .bNumConfigurations = 1,
63 + .confs = (USBDescConfig[]) {
65 + .bNumInterfaces = 1,
66 + .bConfigurationValue = 1,
67 + .iConfiguration = STR_CONFIG_SUPER,
68 + .bmAttributes = 0xc0,
70 + .ifs = &desc_iface_super,
75 static const USBDesc desc = {
77 .idVendor = 0x46f4, /* CRC16() of "QEMU" */
78 @@ -167,9 +206,10 @@ static const USBDesc desc = {
79 .iProduct = STR_PRODUCT,
80 .iSerialNumber = STR_SERIALNUMBER,
82 - .full = &desc_device_full,
83 - .high = &desc_device_high,
84 - .str = desc_strings,
85 + .full = &desc_device_full,
86 + .high = &desc_device_high,
87 + .super = &desc_device_super,
88 + .str = desc_strings,
91 static void usb_msd_copy_data(MSDState *s, USBPacket *p)