|
|
9ae3a8 |
From ccf8ee841c1d72d74bc4b6b54247089eb847087b Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
9ae3a8 |
Date: Fri, 11 Jul 2014 14:20:34 +0200
|
|
|
9ae3a8 |
Subject: [PATCH 01/43] usb/hcd-xhci: QOM Upcast Sweep
|
|
|
9ae3a8 |
MIME-Version: 1.0
|
|
|
9ae3a8 |
Content-Type: text/plain; charset=UTF-8
|
|
|
9ae3a8 |
Content-Transfer-Encoding: 8bit
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Message-id: <1405088470-24115-2-git-send-email-kraxel@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 59835
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.1 qemu-kvm PATCH 01/37] usb/hcd-xhci: QOM Upcast Sweep
|
|
|
9ae3a8 |
Bugzilla: 980747
|
|
|
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: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Define and use standard QOM cast macro. Remove usages of DO_UPCAST()
|
|
|
9ae3a8 |
and direct -> style upcasting.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
|
|
|
9ae3a8 |
[AF: Dropped usb_xhci_init() DeviceState argument and renamed variable]
|
|
|
9ae3a8 |
Signed-off-by: Andreas Färber <afaerber@suse.de>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
(cherry picked from commit 37034575d23a06447e4f44ab365afec6b198c53f)
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/usb/hcd-xhci.c | 21 ++++++++++++++-------
|
|
|
9ae3a8 |
1 file changed, 14 insertions(+), 7 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/usb/hcd-xhci.c | 21 ++++++++++++++-------
|
|
|
9ae3a8 |
1 file changed, 14 insertions(+), 7 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
|
|
|
9ae3a8 |
index 2c9e36a..8fa1c6e 100644
|
|
|
9ae3a8 |
--- a/hw/usb/hcd-xhci.c
|
|
|
9ae3a8 |
+++ b/hw/usb/hcd-xhci.c
|
|
|
9ae3a8 |
@@ -485,6 +485,11 @@ struct XHCIState {
|
|
|
9ae3a8 |
XHCIRing cmd_ring;
|
|
|
9ae3a8 |
};
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+#define TYPE_XHCI "nec-usb-xhci"
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+#define XHCI(obj) \
|
|
|
9ae3a8 |
+ OBJECT_CHECK(XHCIState, (obj), TYPE_XHCI)
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
typedef struct XHCIEvRingSeg {
|
|
|
9ae3a8 |
uint32_t addr_low;
|
|
|
9ae3a8 |
uint32_t addr_high;
|
|
|
9ae3a8 |
@@ -2719,7 +2724,7 @@ static void xhci_port_reset(XHCIPort *port, bool warm_reset)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
static void xhci_reset(DeviceState *dev)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
- XHCIState *xhci = DO_UPCAST(XHCIState, pci_dev.qdev, dev);
|
|
|
9ae3a8 |
+ XHCIState *xhci = XHCI(dev);
|
|
|
9ae3a8 |
int i;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
trace_usb_xhci_reset();
|
|
|
9ae3a8 |
@@ -2968,6 +2973,7 @@ static void xhci_oper_write(void *ptr, hwaddr reg,
|
|
|
9ae3a8 |
uint64_t val, unsigned size)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
XHCIState *xhci = ptr;
|
|
|
9ae3a8 |
+ DeviceState *d = DEVICE(ptr);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
trace_usb_xhci_oper_write(reg, val);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
@@ -2989,7 +2995,7 @@ static void xhci_oper_write(void *ptr, hwaddr reg,
|
|
|
9ae3a8 |
xhci->usbcmd = val & 0xc0f;
|
|
|
9ae3a8 |
xhci_mfwrap_update(xhci);
|
|
|
9ae3a8 |
if (val & USBCMD_HCRST) {
|
|
|
9ae3a8 |
- xhci_reset(&xhci->pci_dev.qdev);
|
|
|
9ae3a8 |
+ xhci_reset(d);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
xhci_intx_update(xhci);
|
|
|
9ae3a8 |
break;
|
|
|
9ae3a8 |
@@ -3315,8 +3321,9 @@ static USBBusOps xhci_bus_ops = {
|
|
|
9ae3a8 |
.wakeup_endpoint = xhci_wakeup_endpoint,
|
|
|
9ae3a8 |
};
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static void usb_xhci_init(XHCIState *xhci, DeviceState *dev)
|
|
|
9ae3a8 |
+static void usb_xhci_init(XHCIState *xhci)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
+ DeviceState *dev = DEVICE(xhci);
|
|
|
9ae3a8 |
XHCIPort *port;
|
|
|
9ae3a8 |
int i, usbports, speedmask;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
@@ -3331,7 +3338,7 @@ static void usb_xhci_init(XHCIState *xhci, DeviceState *dev)
|
|
|
9ae3a8 |
usbports = MAX(xhci->numports_2, xhci->numports_3);
|
|
|
9ae3a8 |
xhci->numports = xhci->numports_2 + xhci->numports_3;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- usb_bus_new(&xhci->bus, &xhci_bus_ops, &xhci->pci_dev.qdev);
|
|
|
9ae3a8 |
+ usb_bus_new(&xhci->bus, &xhci_bus_ops, dev);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
for (i = 0; i < usbports; i++) {
|
|
|
9ae3a8 |
speedmask = 0;
|
|
|
9ae3a8 |
@@ -3363,14 +3370,14 @@ static int usb_xhci_initfn(struct PCIDevice *dev)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
int i, ret;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- XHCIState *xhci = DO_UPCAST(XHCIState, pci_dev, dev);
|
|
|
9ae3a8 |
+ XHCIState *xhci = XHCI(dev);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
xhci->pci_dev.config[PCI_CLASS_PROG] = 0x30; /* xHCI */
|
|
|
9ae3a8 |
xhci->pci_dev.config[PCI_INTERRUPT_PIN] = 0x01; /* interrupt pin 1 */
|
|
|
9ae3a8 |
xhci->pci_dev.config[PCI_CACHE_LINE_SIZE] = 0x10;
|
|
|
9ae3a8 |
xhci->pci_dev.config[0x60] = 0x30; /* release number */
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- usb_xhci_init(xhci, &dev->qdev);
|
|
|
9ae3a8 |
+ usb_xhci_init(xhci);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (xhci->numintrs > MAXINTRS) {
|
|
|
9ae3a8 |
xhci->numintrs = MAXINTRS;
|
|
|
9ae3a8 |
@@ -3644,7 +3651,7 @@ static void xhci_class_init(ObjectClass *klass, void *data)
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
static const TypeInfo xhci_info = {
|
|
|
9ae3a8 |
- .name = "nec-usb-xhci",
|
|
|
9ae3a8 |
+ .name = TYPE_XHCI,
|
|
|
9ae3a8 |
.parent = TYPE_PCI_DEVICE,
|
|
|
9ae3a8 |
.instance_size = sizeof(XHCIState),
|
|
|
9ae3a8 |
.class_init = xhci_class_init,
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|