From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Marcel Apfelbaum <marcel@redhat.com>
Subject: [Qemu-devel] [PULL 06/11] xhci: add qemu xhci controller
Date: Tue, 21 Feb 2017 08:16:20 +0100 [thread overview]
Message-ID: <1487661385-7720-7-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1487661385-7720-1-git-send-email-kraxel@redhat.com>
Turn existing TYPE_XHCI into an abstract base class.
Create two child classes, TYPE_NEC_XHCI (same name as old xhci
controller) and TYPE_QEMU_XHCI (using an ID from our namespace).
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Message-id: 1486382139-30630-3-git-send-email-kraxel@redhat.com
---
docs/specs/pci-ids.txt | 1 +
hw/usb/hcd-xhci.c | 40 ++++++++++++++++++++++++++++++++++++----
include/hw/pci/pci.h | 1 +
3 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/docs/specs/pci-ids.txt b/docs/specs/pci-ids.txt
index 16fdb0c..95adee0 100644
--- a/docs/specs/pci-ids.txt
+++ b/docs/specs/pci-ids.txt
@@ -61,6 +61,7 @@ PCI devices (other than virtio):
1b36:0009 PCI Expander Bridge (-device pxb)
1b36:000a PCI-PCI bridge (multiseat)
1b36:000b PCIe Expander Bridge (-device pxb-pcie)
+1b36:000d PCI xhci usb host adapter
All these devices are documented in docs/specs.
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index cfb5f74..c534b43 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -489,7 +489,9 @@ struct XHCIState {
XHCIRing cmd_ring;
};
-#define TYPE_XHCI "nec-usb-xhci"
+#define TYPE_XHCI "base-xhci"
+#define TYPE_NEC_XHCI "nec-usb-xhci"
+#define TYPE_QEMU_XHCI "qemu-xhci"
#define XHCI(obj) \
OBJECT_CHECK(XHCIState, (obj), TYPE_XHCI)
@@ -3881,10 +3883,7 @@ static void xhci_class_init(ObjectClass *klass, void *data)
set_bit(DEVICE_CATEGORY_USB, dc->categories);
k->realize = usb_xhci_realize;
k->exit = usb_xhci_exit;
- k->vendor_id = PCI_VENDOR_ID_NEC;
- k->device_id = PCI_DEVICE_ID_NEC_UPD720200;
k->class_id = PCI_CLASS_SERIAL_USB;
- k->revision = 0x03;
k->is_express = 1;
}
@@ -3893,11 +3892,44 @@ static const TypeInfo xhci_info = {
.parent = TYPE_PCI_DEVICE,
.instance_size = sizeof(XHCIState),
.class_init = xhci_class_init,
+ .abstract = true,
+};
+
+static void nec_xhci_class_init(ObjectClass *klass, void *data)
+{
+ PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+
+ k->vendor_id = PCI_VENDOR_ID_NEC;
+ k->device_id = PCI_DEVICE_ID_NEC_UPD720200;
+ k->revision = 0x03;
+}
+
+static const TypeInfo nec_xhci_info = {
+ .name = TYPE_NEC_XHCI,
+ .parent = TYPE_XHCI,
+ .class_init = nec_xhci_class_init,
+};
+
+static void qemu_xhci_class_init(ObjectClass *klass, void *data)
+{
+ PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+
+ k->vendor_id = PCI_VENDOR_ID_REDHAT;
+ k->device_id = PCI_DEVICE_ID_REDHAT_XHCI;
+ k->revision = 0x01;
+}
+
+static const TypeInfo qemu_xhci_info = {
+ .name = TYPE_QEMU_XHCI,
+ .parent = TYPE_XHCI,
+ .class_init = qemu_xhci_class_init,
};
static void xhci_register_types(void)
{
type_register_static(&xhci_info);
+ type_register_static(&nec_xhci_info);
+ type_register_static(&qemu_xhci_info);
}
type_init(xhci_register_types)
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index cbc1fdf..05ef14b 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -97,6 +97,7 @@
#define PCI_DEVICE_ID_REDHAT_BRIDGE_SEAT 0x000a
#define PCI_DEVICE_ID_REDHAT_PXB_PCIE 0x000b
#define PCI_DEVICE_ID_REDHAT_PCIE_RP 0x000c
+#define PCI_DEVICE_ID_REDHAT_XHCI 0x000d
#define PCI_DEVICE_ID_REDHAT_QXL 0x0100
#define FMT_PCIBUS PRIx64
--
1.8.3.1
next prev parent reply other threads:[~2017-02-21 7:16 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-21 7:16 [Qemu-devel] [PULL 00/11] usb patch queue Gerd Hoffmann
2017-02-21 7:16 ` [Qemu-devel] [PULL 01/11] usb: ehci: fix memory leak in ehci Gerd Hoffmann
2017-02-21 7:16 ` [Qemu-devel] [PULL 02/11] usb: ohci: fix error return code in servicing iso td Gerd Hoffmann
2017-02-21 7:16 ` [Qemu-devel] [PULL 03/11] usb: ohci: limit the number of link eds Gerd Hoffmann
2017-02-21 7:16 ` [Qemu-devel] [PULL 04/11] xhci: apply limits to loops Gerd Hoffmann
2017-02-21 7:16 ` [Qemu-devel] [PULL 05/11] xhci: drop ER_FULL_HACK workaround Gerd Hoffmann
2017-02-21 7:16 ` Gerd Hoffmann [this message]
2017-02-21 7:16 ` [Qemu-devel] [PULL 07/11] xhci: fix nec vendor quirk handling Gerd Hoffmann
2017-02-21 7:16 ` [Qemu-devel] [PULL 08/11] xhci: drop via vendor command handling Gerd Hoffmann
2017-02-21 7:16 ` [Qemu-devel] [PULL 09/11] usb-ccid: better bulk_out error handling Gerd Hoffmann
2017-02-21 7:16 ` [Qemu-devel] [PULL 10/11] usb-ccid: move header size check Gerd Hoffmann
2017-02-21 7:16 ` [Qemu-devel] [PULL 11/11] usb-ccid: add check message size checks Gerd Hoffmann
2017-02-21 10:29 ` [Qemu-devel] [PULL 00/11] usb patch queue Peter Maydell
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=1487661385-7720-7-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=marcel@redhat.com \
--cc=mst@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).