Initial commit with version 1.2.0-24
[packages/centos6/qemu.git] / 0615-usb-storage-usb3-support.patch
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
5
6 Add usb3 descriptors to usb-storage, so it shows up as superspeed
7 device when connected to xhci.
8
9 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 ---
11  hw/usb/dev-storage.c | 46 +++++++++++++++++++++++++++++++++++++++++++---
12  1 file changed, 43 insertions(+), 3 deletions(-)
13
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 {
19      STR_SERIALNUMBER,
20      STR_CONFIG_FULL,
21      STR_CONFIG_HIGH,
22 +    STR_CONFIG_SUPER,
23  };
24  
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)",
31  };
32  
33  static const USBDescIface desc_iface_full = {
34 @@ -158,6 +160,43 @@ static const USBDescDevice desc_device_high = {
35      },
36  };
37  
38 +static const USBDescIface desc_iface_super = {
39 +    .bInterfaceNumber              = 0,
40 +    .bNumEndpoints                 = 2,
41 +    .bInterfaceClass               = USB_CLASS_MASS_STORAGE,
42 +    .bInterfaceSubClass            = 0x06, /* SCSI */
43 +    .bInterfaceProtocol            = 0x50, /* Bulk */
44 +    .eps = (USBDescEndpoint[]) {
45 +        {
46 +            .bEndpointAddress      = USB_DIR_IN | 0x01,
47 +            .bmAttributes          = USB_ENDPOINT_XFER_BULK,
48 +            .wMaxPacketSize        = 1024,
49 +            .bMaxBurst             = 15,
50 +        },{
51 +            .bEndpointAddress      = USB_DIR_OUT | 0x02,
52 +            .bmAttributes          = USB_ENDPOINT_XFER_BULK,
53 +            .wMaxPacketSize        = 1024,
54 +            .bMaxBurst             = 15,
55 +        },
56 +    }
57 +};
58 +
59 +static const USBDescDevice desc_device_super = {
60 +    .bcdUSB                        = 0x0300,
61 +    .bMaxPacketSize0               = 9,
62 +    .bNumConfigurations            = 1,
63 +    .confs = (USBDescConfig[]) {
64 +        {
65 +            .bNumInterfaces        = 1,
66 +            .bConfigurationValue   = 1,
67 +            .iConfiguration        = STR_CONFIG_SUPER,
68 +            .bmAttributes          = 0xc0,
69 +            .nif = 1,
70 +            .ifs = &desc_iface_super,
71 +        },
72 +    },
73 +};
74 +
75  static const USBDesc desc = {
76      .id = {
77          .idVendor          = 0x46f4, /* CRC16() of "QEMU" */
78 @@ -167,9 +206,10 @@ static const USBDesc desc = {
79          .iProduct          = STR_PRODUCT,
80          .iSerialNumber     = STR_SERIALNUMBER,
81      },
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,
89  };
90  
91  static void usb_msd_copy_data(MSDState *s, USBPacket *p)
92 -- 
93 1.7.12.1
94