qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 23/24] usb storage: high speed support
Date: Thu,  9 Dec 2010 13:30:26 +0100	[thread overview]
Message-ID: <1291897827-11424-24-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1291897827-11424-1-git-send-email-kraxel@redhat.com>

Add high speed support to the usb mass storage device.  With this patch
applied the linux kernel recognises the usb storage device as highspeed
capable device and suggests to connect it to a highspeed port instead of
the uhci.  Tested with both uhci and (not-yet submitted) ehci.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb-msd.c |   51 ++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 46 insertions(+), 5 deletions(-)

diff --git a/hw/usb-msd.c b/hw/usb-msd.c
index 74e657e..7b8189f 100644
--- a/hw/usb-msd.c
+++ b/hw/usb-msd.c
@@ -77,15 +77,19 @@ enum {
     STR_MANUFACTURER = 1,
     STR_PRODUCT,
     STR_SERIALNUMBER,
+    STR_CONFIG_FULL,
+    STR_CONFIG_HIGH,
 };
 
 static const USBDescStrings desc_strings = {
     [STR_MANUFACTURER] = "QEMU " QEMU_VERSION,
     [STR_PRODUCT]      = "QEMU USB HARDDRIVE",
     [STR_SERIALNUMBER] = "1",
+    [STR_CONFIG_FULL]  = "Full speed config (usb 1.1)",
+    [STR_CONFIG_HIGH]  = "High speed config (usb 2.0)",
 };
 
-static const USBDescIface desc_iface0 = {
+static const USBDescIface desc_iface_full = {
     .bInterfaceNumber              = 0,
     .bNumEndpoints                 = 2,
     .bInterfaceClass               = USB_CLASS_MASS_STORAGE,
@@ -104,16 +108,51 @@ static const USBDescIface desc_iface0 = {
     }
 };
 
-static const USBDescDevice desc_device = {
-    .bcdUSB                        = 0x0100,
+static const USBDescDevice desc_device_full = {
+    .bcdUSB                        = 0x0200,
     .bMaxPacketSize0               = 8,
     .bNumConfigurations            = 1,
     .confs = (USBDescConfig[]) {
         {
             .bNumInterfaces        = 1,
             .bConfigurationValue   = 1,
+            .iConfiguration        = STR_CONFIG_FULL,
             .bmAttributes          = 0xc0,
-            .ifs = &desc_iface0,
+            .ifs = &desc_iface_full,
+        },
+    },
+};
+
+static const USBDescIface desc_iface_high = {
+    .bInterfaceNumber              = 0,
+    .bNumEndpoints                 = 2,
+    .bInterfaceClass               = USB_CLASS_MASS_STORAGE,
+    .bInterfaceSubClass            = 0x06, /* SCSI */
+    .bInterfaceProtocol            = 0x50, /* Bulk */
+    .eps = (USBDescEndpoint[]) {
+        {
+            .bEndpointAddress      = USB_DIR_IN | 0x01,
+            .bmAttributes          = USB_ENDPOINT_XFER_BULK,
+            .wMaxPacketSize        = 512,
+        },{
+            .bEndpointAddress      = USB_DIR_OUT | 0x02,
+            .bmAttributes          = USB_ENDPOINT_XFER_BULK,
+            .wMaxPacketSize        = 512,
+        },
+    }
+};
+
+static const USBDescDevice desc_device_high = {
+    .bcdUSB                        = 0x0200,
+    .bMaxPacketSize0               = 64,
+    .bNumConfigurations            = 1,
+    .confs = (USBDescConfig[]) {
+        {
+            .bNumInterfaces        = 1,
+            .bConfigurationValue   = 1,
+            .iConfiguration        = STR_CONFIG_HIGH,
+            .bmAttributes          = 0xc0,
+            .ifs = &desc_iface_high,
         },
     },
 };
@@ -127,7 +166,8 @@ static const USBDesc desc = {
         .iProduct          = STR_PRODUCT,
         .iSerialNumber     = STR_SERIALNUMBER,
     },
-    .full = &desc_device,
+    .full = &desc_device_full,
+    .high = &desc_device_high,
     .str  = desc_strings,
 };
 
@@ -558,6 +598,7 @@ static struct USBDeviceInfo msd_info = {
     .usb_desc       = &desc,
     .init           = usb_msd_initfn,
     .handle_packet  = usb_generic_handle_packet,
+    .handle_attach  = usb_desc_attach,
     .handle_reset   = usb_msd_handle_reset,
     .handle_control = usb_msd_handle_control,
     .handle_data    = usb_msd_handle_data,
-- 
1.7.1

  parent reply	other threads:[~2010-12-09 12:31 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-09 12:30 [Qemu-devel] [PATCH 00/24] usb descriptor overhaul Gerd Hoffmann
2010-12-09 12:30 ` [Qemu-devel] [PATCH 01/24] usb: data structs and helpers for usb descriptors Gerd Hoffmann
2010-12-09 12:30 ` [Qemu-devel] [PATCH 02/24] usb hid: use new descriptor infrastructure Gerd Hoffmann
2010-12-09 12:30 ` [Qemu-devel] [PATCH 03/24] usb serial: " Gerd Hoffmann
2010-12-09 12:30 ` [Qemu-devel] [PATCH 04/24] usb storage: " Gerd Hoffmann
2010-12-09 12:30 ` [Qemu-devel] [PATCH 05/24] usb wacom: " Gerd Hoffmann
2010-12-09 12:30 ` [Qemu-devel] [PATCH 06/24] usb bluetooth: " Gerd Hoffmann
2010-12-09 12:30 ` [Qemu-devel] [PATCH 07/24] usb hub: " Gerd Hoffmann
2010-12-09 12:30 ` [Qemu-devel] [PATCH 08/24] usb descriptors: add settable strings Gerd Hoffmann
2010-12-09 12:30 ` [Qemu-devel] [PATCH 09/24] usb storage: serial number support Gerd Hoffmann
2010-12-09 12:30 ` [Qemu-devel] [PATCH 10/24] usb network: use new descriptor infrastructure Gerd Hoffmann
2010-12-09 12:30 ` [Qemu-devel] [PATCH 11/24] usb: move USB_REQ_SET_ADDRESS handling to common code Gerd Hoffmann
2010-12-09 12:30 ` [Qemu-devel] [PATCH 12/24] usb: move USB_REQ_{GET, SET}_CONFIGURATION " Gerd Hoffmann
2010-12-09 12:30 ` [Qemu-devel] [PATCH 13/24] usb: move remote wakeup " Gerd Hoffmann
2010-12-09 12:30 ` [Qemu-devel] [PATCH 14/24] usb: create USBPortOps, move attach there Gerd Hoffmann
2010-12-09 12:30 ` [Qemu-devel] [PATCH 15/24] usb: rework attach/detach workflow Gerd Hoffmann
2010-12-09 12:30 ` [Qemu-devel] [PATCH 16/24] usb: add usb_wakeup() + wakeup callback to port ops Gerd Hoffmann
2010-12-09 12:30 ` [Qemu-devel] [PATCH 17/24] usb: uhci: remote wakeup support Gerd Hoffmann
2010-12-09 12:30 ` [Qemu-devel] [PATCH 18/24] usb: hid: " Gerd Hoffmann
2010-12-09 12:30 ` [Qemu-devel] [PATCH 19/24] usb: add speed mask to ports Gerd Hoffmann
2010-12-09 12:30 ` [Qemu-devel] [PATCH 20/24] usb: add attach callback Gerd Hoffmann
2010-12-09 12:30 ` [Qemu-devel] [PATCH 21/24] usb: add usb_desc_attach Gerd Hoffmann
2010-12-09 12:30 ` [Qemu-devel] [PATCH 22/24] usb: add device qualifier support Gerd Hoffmann
2010-12-09 12:30 ` Gerd Hoffmann [this message]
2010-12-09 12:30 ` [Qemu-devel] [PATCH 24/24] usb storage: fix status reporting Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1291897827-11424-24-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).