|
Hans de Goede |
c8dfc6 |
From 3ed11ea2c3b6d5db29246b4da105902aa0346d65 Mon Sep 17 00:00:00 2001
|
|
Hans de Goede |
c8dfc6 |
From: Gerd Hoffmann <kraxel@redhat.com>
|
|
Hans de Goede |
c8dfc6 |
Date: Thu, 30 Aug 2012 10:57:12 +0200
|
|
Hans de Goede |
c8dfc6 |
Subject: [PATCH 345/366] xhci: fix & cleanup msi.
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
Drop custom write_config function which isn't needed any more.
|
|
Hans de Goede |
c8dfc6 |
Make the msi property a bit property so it accepts 'on' & 'off'.
|
|
Hans de Goede |
c8dfc6 |
Enable MSI by default.
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
TODO: add compat property to disable on old machine types.
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
Hans de Goede |
c8dfc6 |
---
|
|
Hans de Goede |
c8dfc6 |
hw/usb/hcd-xhci.c | 27 +++++++++------------------
|
|
Hans de Goede |
c8dfc6 |
1 file changed, 9 insertions(+), 18 deletions(-)
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
|
|
Hans de Goede |
c8dfc6 |
index e08312e..e1d5d2a 100644
|
|
Hans de Goede |
c8dfc6 |
--- a/hw/usb/hcd-xhci.c
|
|
Hans de Goede |
c8dfc6 |
+++ b/hw/usb/hcd-xhci.c
|
|
Hans de Goede |
c8dfc6 |
@@ -386,7 +386,7 @@ struct XHCIState {
|
|
Hans de Goede |
c8dfc6 |
/* properties */
|
|
Hans de Goede |
c8dfc6 |
uint32_t numports_2;
|
|
Hans de Goede |
c8dfc6 |
uint32_t numports_3;
|
|
Hans de Goede |
c8dfc6 |
- uint32_t msi;
|
|
Hans de Goede |
c8dfc6 |
+ uint32_t flags;
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
/* Operational Registers */
|
|
Hans de Goede |
c8dfc6 |
uint32_t usbcmd;
|
|
Hans de Goede |
c8dfc6 |
@@ -435,6 +435,10 @@ typedef struct XHCIEvRingSeg {
|
|
Hans de Goede |
c8dfc6 |
uint32_t rsvd;
|
|
Hans de Goede |
c8dfc6 |
} XHCIEvRingSeg;
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
+enum xhci_flags {
|
|
Hans de Goede |
c8dfc6 |
+ XHCI_FLAG_USE_MSI = 1,
|
|
Hans de Goede |
c8dfc6 |
+};
|
|
Hans de Goede |
c8dfc6 |
+
|
|
Hans de Goede |
c8dfc6 |
static void xhci_kick_ep(XHCIState *xhci, unsigned int slotid,
|
|
Hans de Goede |
c8dfc6 |
unsigned int epid);
|
|
Hans de Goede |
c8dfc6 |
static void xhci_event(XHCIState *xhci, XHCIEvent *event);
|
|
Hans de Goede |
c8dfc6 |
@@ -617,7 +621,7 @@ static void xhci_irq_update(XHCIState *xhci)
|
|
Hans de Goede |
c8dfc6 |
level = 1;
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
- if (xhci->msi && msi_enabled(&xhci->pci_dev)) {
|
|
Hans de Goede |
c8dfc6 |
+ if (msi_enabled(&xhci->pci_dev)) {
|
|
Hans de Goede |
c8dfc6 |
if (level) {
|
|
Hans de Goede |
c8dfc6 |
trace_usb_xhci_irq_msi(0);
|
|
Hans de Goede |
c8dfc6 |
msi_notify(&xhci->pci_dev, 0);
|
|
Hans de Goede |
c8dfc6 |
@@ -2859,32 +2863,20 @@ static int usb_xhci_initfn(struct PCIDevice *dev)
|
|
Hans de Goede |
c8dfc6 |
ret = pcie_cap_init(&xhci->pci_dev, 0xa0, PCI_EXP_TYPE_ENDPOINT, 0);
|
|
Hans de Goede |
c8dfc6 |
assert(ret >= 0);
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
- if (xhci->msi) {
|
|
Hans de Goede |
c8dfc6 |
- ret = msi_init(&xhci->pci_dev, 0x70, 1, true, false);
|
|
Hans de Goede |
c8dfc6 |
- assert(ret >= 0);
|
|
Hans de Goede |
c8dfc6 |
+ if (xhci->flags & (1 << XHCI_FLAG_USE_MSI)) {
|
|
Hans de Goede |
c8dfc6 |
+ msi_init(&xhci->pci_dev, 0x70, MAXINTRS, true, false);
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
return 0;
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
-static void xhci_write_config(PCIDevice *dev, uint32_t addr, uint32_t val,
|
|
Hans de Goede |
c8dfc6 |
- int len)
|
|
Hans de Goede |
c8dfc6 |
-{
|
|
Hans de Goede |
c8dfc6 |
- XHCIState *xhci = DO_UPCAST(XHCIState, pci_dev, dev);
|
|
Hans de Goede |
c8dfc6 |
-
|
|
Hans de Goede |
c8dfc6 |
- pci_default_write_config(dev, addr, val, len);
|
|
Hans de Goede |
c8dfc6 |
- if (xhci->msi) {
|
|
Hans de Goede |
c8dfc6 |
- msi_write_config(dev, addr, val, len);
|
|
Hans de Goede |
c8dfc6 |
- }
|
|
Hans de Goede |
c8dfc6 |
-}
|
|
Hans de Goede |
c8dfc6 |
-
|
|
Hans de Goede |
c8dfc6 |
static const VMStateDescription vmstate_xhci = {
|
|
Hans de Goede |
c8dfc6 |
.name = "xhci",
|
|
Hans de Goede |
c8dfc6 |
.unmigratable = 1,
|
|
Hans de Goede |
c8dfc6 |
};
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
static Property xhci_properties[] = {
|
|
Hans de Goede |
c8dfc6 |
- DEFINE_PROP_UINT32("msi", XHCIState, msi, 0),
|
|
Hans de Goede |
c8dfc6 |
+ DEFINE_PROP_BIT("msi", XHCIState, flags, XHCI_FLAG_USE_MSI, true),
|
|
Hans de Goede |
c8dfc6 |
DEFINE_PROP_UINT32("p2", XHCIState, numports_2, 4),
|
|
Hans de Goede |
c8dfc6 |
DEFINE_PROP_UINT32("p3", XHCIState, numports_3, 4),
|
|
Hans de Goede |
c8dfc6 |
DEFINE_PROP_END_OF_LIST(),
|
|
Hans de Goede |
c8dfc6 |
@@ -2904,7 +2896,6 @@ static void xhci_class_init(ObjectClass *klass, void *data)
|
|
Hans de Goede |
c8dfc6 |
k->class_id = PCI_CLASS_SERIAL_USB;
|
|
Hans de Goede |
c8dfc6 |
k->revision = 0x03;
|
|
Hans de Goede |
c8dfc6 |
k->is_express = 1;
|
|
Hans de Goede |
c8dfc6 |
- k->config_write = xhci_write_config;
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
static TypeInfo xhci_info = {
|
|
Hans de Goede |
c8dfc6 |
--
|
|
Hans de Goede |
c8dfc6 |
1.7.12
|
|
Hans de Goede |
c8dfc6 |
|