|
|
9ae3a8 |
From eccc9faa264d2228126d4fccc5a603b70b02cc9c Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
9ae3a8 |
Date: Fri, 11 Jul 2014 14:20:54 +0200
|
|
|
9ae3a8 |
Subject: [PATCH 20/43] usb: Add usb_device_alloc/free_streams
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Message-id: <1405088470-24115-22-git-send-email-kraxel@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 59833
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.1 qemu-kvm PATCH 21/37] usb: Add usb_device_alloc/free_streams
|
|
|
9ae3a8 |
Bugzilla: 1111450
|
|
|
9ae3a8 |
RH-Acked-by: Dr. David Alan Gilbert (git) <dgilbert@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: Hans de Goede <hdegoede@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit 3b444eadf7726d976be4ac89e8e742cb7eb7a5ee)
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/usb/bus.c | 18 ++++++++++++++++++
|
|
|
9ae3a8 |
include/hw/usb.h | 12 ++++++++++++
|
|
|
9ae3a8 |
2 files changed, 30 insertions(+)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/usb/bus.c | 18 ++++++++++++++++++
|
|
|
9ae3a8 |
include/hw/usb.h | 12 ++++++++++++
|
|
|
9ae3a8 |
2 files changed, 30 insertions(+)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/hw/usb/bus.c b/hw/usb/bus.c
|
|
|
9ae3a8 |
index f4eeb5e..12641fe 100644
|
|
|
9ae3a8 |
--- a/hw/usb/bus.c
|
|
|
9ae3a8 |
+++ b/hw/usb/bus.c
|
|
|
9ae3a8 |
@@ -206,6 +206,24 @@ void usb_device_ep_stopped(USBDevice *dev, USBEndpoint *ep)
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+int usb_device_alloc_streams(USBDevice *dev, USBEndpoint **eps, int nr_eps,
|
|
|
9ae3a8 |
+ int streams)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ USBDeviceClass *klass = USB_DEVICE_GET_CLASS(dev);
|
|
|
9ae3a8 |
+ if (klass->alloc_streams) {
|
|
|
9ae3a8 |
+ return klass->alloc_streams(dev, eps, nr_eps, streams);
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+ return 0;
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+void usb_device_free_streams(USBDevice *dev, USBEndpoint **eps, int nr_eps)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ USBDeviceClass *klass = USB_DEVICE_GET_CLASS(dev);
|
|
|
9ae3a8 |
+ if (klass->free_streams) {
|
|
|
9ae3a8 |
+ klass->free_streams(dev, eps, nr_eps);
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
static int usb_qdev_init(DeviceState *qdev)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
USBDevice *dev = USB_DEVICE(qdev);
|
|
|
9ae3a8 |
diff --git a/include/hw/usb.h b/include/hw/usb.h
|
|
|
9ae3a8 |
index 116293e..000001b 100644
|
|
|
9ae3a8 |
--- a/include/hw/usb.h
|
|
|
9ae3a8 |
+++ b/include/hw/usb.h
|
|
|
9ae3a8 |
@@ -327,6 +327,14 @@ typedef struct USBDeviceClass {
|
|
|
9ae3a8 |
*/
|
|
|
9ae3a8 |
void (*ep_stopped)(USBDevice *dev, USBEndpoint *ep);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+ /*
|
|
|
9ae3a8 |
+ * Called by the hcd to alloc / free streams on a bulk endpoint.
|
|
|
9ae3a8 |
+ * Optional may be NULL.
|
|
|
9ae3a8 |
+ */
|
|
|
9ae3a8 |
+ int (*alloc_streams)(USBDevice *dev, USBEndpoint **eps, int nr_eps,
|
|
|
9ae3a8 |
+ int streams);
|
|
|
9ae3a8 |
+ void (*free_streams)(USBDevice *dev, USBEndpoint **eps, int nr_eps);
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
const char *product_desc;
|
|
|
9ae3a8 |
const USBDesc *usb_desc;
|
|
|
9ae3a8 |
} USBDeviceClass;
|
|
|
9ae3a8 |
@@ -564,6 +572,10 @@ void usb_device_flush_ep_queue(USBDevice *dev, USBEndpoint *ep);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
void usb_device_ep_stopped(USBDevice *dev, USBEndpoint *ep);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+int usb_device_alloc_streams(USBDevice *dev, USBEndpoint **eps, int nr_eps,
|
|
|
9ae3a8 |
+ int streams);
|
|
|
9ae3a8 |
+void usb_device_free_streams(USBDevice *dev, USBEndpoint **eps, int nr_eps);
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
const char *usb_device_get_product_desc(USBDevice *dev);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
const USBDesc *usb_device_get_usb_desc(USBDevice *dev);
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|