From: Marcelo Tosatti <mtosatti@redhat.com>
To: qemu-devel@nongnu.org, kvm <kvm@vger.kernel.org>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>,
Marcelo Tosatti <mtosatti@redhat.com>,
Adam Jackson <ajax@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>,
Glauber de Oliveira Costa <gcosta@redhat.com>
Subject: [Qemu-devel] [patch 1/2] add USBBusOps to USBBus
Date: Thu, 25 Nov 2010 15:04:40 -0200 [thread overview]
Message-ID: <20101125170602.629085075@redhat.com> (raw)
In-Reply-To: 20101125170439.548474575@redhat.com
[-- Attachment #1: usb-bus-ops --]
[-- Type: text/plain, Size: 4017 bytes --]
Needed for remote wakeup notification.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Index: qemu-kvm/hw/usb-bus.c
===================================================================
--- qemu-kvm.orig/hw/usb-bus.c
+++ qemu-kvm/hw/usb-bus.c
@@ -14,11 +14,12 @@ static struct BusInfo usb_bus_info = {
static int next_usb_bus = 0;
static QTAILQ_HEAD(, USBBus) busses = QTAILQ_HEAD_INITIALIZER(busses);
-void usb_bus_new(USBBus *bus, DeviceState *host)
+void usb_bus_new(USBBus *bus, DeviceState *host, USBBusOps *ops)
{
qbus_create_inplace(&bus->qbus, &usb_bus_info, host, NULL);
bus->busnr = next_usb_bus++;
bus->qbus.allow_hotplug = 1; /* Yes, we can */
+ bus->ops = ops;
QTAILQ_INIT(&bus->free);
QTAILQ_INIT(&bus->used);
QTAILQ_INSERT_TAIL(&busses, bus, next);
Index: qemu-kvm/hw/usb.c
===================================================================
--- qemu-kvm.orig/hw/usb.c
+++ qemu-kvm/hw/usb.c
@@ -229,3 +229,12 @@ void usb_send_msg(USBDevice *dev, int ms
/* This _must_ be synchronous */
}
+
+void usb_remote_wakeup(USBDevice *dev)
+{
+ USBBus *bus = usb_bus_from_device(dev);
+
+ if (bus->ops && bus->ops->remote_wakeup_cb) {
+ bus->ops->remote_wakeup_cb(bus, dev);
+ }
+}
Index: qemu-kvm/hw/usb.h
===================================================================
--- qemu-kvm.orig/hw/usb.h
+++ qemu-kvm/hw/usb.h
@@ -123,6 +123,7 @@
#define USB_ENDPOINT_XFER_INT 3
typedef struct USBBus USBBus;
+typedef struct USBBusOps USBBusOps;
typedef struct USBPort USBPort;
typedef struct USBDevice USBDevice;
typedef struct USBDeviceInfo USBDeviceInfo;
@@ -294,8 +295,16 @@ void musb_set_size(MUSBState *s, int epn
/* usb-bus.c */
+struct USBBusOps {
+ /*
+ * Process remote wakeup request.
+ */
+ void (*remote_wakeup_cb)(USBBus *bus, USBDevice *dev);
+};
+
struct USBBus {
BusState qbus;
+ USBBusOps *ops;
int busnr;
int nfree;
int nused;
@@ -304,7 +313,7 @@ struct USBBus {
QTAILQ_ENTRY(USBBus) next;
};
-void usb_bus_new(USBBus *bus, DeviceState *host);
+void usb_bus_new(USBBus *bus, DeviceState *host, USBBusOps *ops);
USBBus *usb_bus_find(int busnr);
void usb_qdev_register(USBDeviceInfo *info);
void usb_qdev_register_many(USBDeviceInfo *info);
@@ -317,6 +326,7 @@ void usb_unregister_port(USBBus *bus, US
int usb_device_attach(USBDevice *dev);
int usb_device_detach(USBDevice *dev);
int usb_device_delete_addr(int busnr, int addr);
+void usb_remote_wakeup(USBDevice *dev);
static inline USBBus *usb_bus_from_device(USBDevice *d)
{
Index: qemu-kvm/hw/usb-musb.c
===================================================================
--- qemu-kvm.orig/hw/usb-musb.c
+++ qemu-kvm/hw/usb-musb.c
@@ -342,7 +342,7 @@ struct MUSBState {
s->ep[i].epnum = i;
}
- usb_bus_new(&s->bus, NULL /* FIXME */);
+ usb_bus_new(&s->bus, NULL /* FIXME */, NULL);
usb_register_port(&s->bus, &s->port, s, 0, musb_attach);
return s;
Index: qemu-kvm/hw/usb-ohci.c
===================================================================
--- qemu-kvm.orig/hw/usb-ohci.c
+++ qemu-kvm/hw/usb-ohci.c
@@ -1702,7 +1702,7 @@ static void usb_ohci_init(OHCIState *ohc
ohci->name = dev->info->name;
- usb_bus_new(&ohci->bus, dev);
+ usb_bus_new(&ohci->bus, dev, NULL);
ohci->num_ports = num_ports;
for (i = 0; i < num_ports; i++) {
usb_register_port(&ohci->bus, &ohci->rhport[i].port, ohci, i, ohci_attach);
Index: qemu-kvm/hw/usb-uhci.c
===================================================================
--- qemu-kvm.orig/hw/usb-uhci.c
+++ qemu-kvm/hw/usb-uhci.c
@@ -1113,7 +1113,7 @@ static int usb_uhci_common_initfn(UHCISt
pci_conf[PCI_INTERRUPT_PIN] = 4; // interrupt pin 3
pci_conf[0x60] = 0x10; // release number
- usb_bus_new(&s->bus, &s->dev.qdev);
+ usb_bus_new(&s->bus, &s->dev.qdev, NULL);
for(i = 0; i < NB_PORTS; i++) {
usb_register_port(&s->bus, &s->ports[i].port, s, i, uhci_attach);
}
next prev parent reply other threads:[~2010-11-25 17:08 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-25 15:34 [Qemu-devel] PATCH: QEMU support for UHCI suspend / remote wake up Marcelo Tosatti
2010-11-25 16:15 ` [Qemu-devel] " Gerd Hoffmann
2010-11-25 17:04 ` [Qemu-devel] [patch 0/2] USB UHCI global suspend / remote wakeup Marcelo Tosatti
2010-11-25 17:04 ` Marcelo Tosatti [this message]
2010-11-25 17:04 ` [Qemu-devel] [patch 2/2] support for UHCI suspend / remote wake up Marcelo Tosatti
2010-12-01 15:12 ` [Qemu-devel] " Gerd Hoffmann
2010-12-01 16:58 ` Marcelo Tosatti
2010-12-01 17:17 ` Gerd Hoffmann
2010-11-26 0:38 ` [Qemu-devel] [patch 0/2] USB UHCI global suspend / remote wakeup Paul Brook
2010-11-26 2:15 ` Marcelo Tosatti
2010-11-26 8:49 ` Gerd Hoffmann
2010-11-26 12:09 ` Paul Brook
2010-12-01 16:47 ` [Qemu-devel] [patch 0/3] QEMU support for UHCI suspend / remote wake up (v3) Marcelo Tosatti
2010-12-01 16:47 ` [Qemu-devel] [patch 1/3] add USBPortOps to USBPort Marcelo Tosatti
2010-12-01 17:10 ` [Qemu-devel] " Gerd Hoffmann
2010-12-01 16:47 ` [Qemu-devel] [patch 2/3] support for UHCI suspend / remote wake up Marcelo Tosatti
2010-12-01 17:12 ` [Qemu-devel] " Gerd Hoffmann
2010-12-01 16:47 ` [Qemu-devel] [patch 3/3] UHCI: Substate section for migration of remote wakeup feature Marcelo Tosatti
2010-12-01 17:16 ` [Qemu-devel] " Gerd Hoffmann
2010-12-01 19:14 ` Juan Quintela
2010-12-01 20:56 ` Marcelo Tosatti
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=20101125170602.629085075@redhat.com \
--to=mtosatti@redhat.com \
--cc=ajax@redhat.com \
--cc=gcosta@redhat.com \
--cc=kraxel@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mjg59@srcf.ucam.org \
--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).