From: Wanpeng Li <liwanp@linux.vnet.ibm.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: Ram Pai <pair@us.ibm.com>, Gavin Shan <shangw@linux.vnet.ibm.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Jan Kiszka <jan.kiszka@siemens.com>,
qemu-devel@nongnu.org, Liu Ping Fan <kernelfans@gmail.com>,
Blue Swirl <blauwirbel@gmail.com>,
Stefan Weil <weil@mail.berlios.de>, Avi Kivity <avi@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Wanpeng Li <liwanp@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH v4 3/5] convert pci-host to QOM
Date: Wed, 18 Jul 2012 21:19:03 +0800 [thread overview]
Message-ID: <1342617545-9261-4-git-send-email-liwanp@linux.vnet.ibm.com> (raw)
In-Reply-To: <1342617545-9261-1-git-send-email-liwanp@linux.vnet.ibm.com>
[CCing ML]
From: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
---
hw/pci_host.c | 26 ++++++++++++++++++++++++++
hw/pci_host.h | 5 +++++
2 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/hw/pci_host.c b/hw/pci_host.c
index 8041778..095bfe3 100644
--- a/hw/pci_host.c
+++ b/hw/pci_host.c
@@ -165,4 +165,30 @@ const MemoryRegionOps pci_host_data_be_ops = {
.endianness = DEVICE_BIG_ENDIAN,
};
+void pci_host_set_mmio(PCIHostState *s, MemoryRegion *value)
+{
+ object_property_set_link(OBJECT(s), OBJECT(value), "mmio", NULL);
+}
+
+static void pci_host_initfn(Object *obj)
+{
+ PCIHostState *s = PCI_HOST(obj);
+
+ object_property_add_link(obj, "mmio", TYPE_MEMORY_REGION,
+ (Object **)&s->address_space, NULL);
+}
+
+static TypeInfo pci_host_type_info = {
+ .name = TYPE_PCI_HOST,
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(PCIHostState),
+ .instance_init = pci_host_initfn,
+};
+
+static void register_devices(void)
+{
+ type_register_static(&pci_host_type_info);
+}
+
+type_init(register_devices)
diff --git a/hw/pci_host.h b/hw/pci_host.h
index 359e38f..084e15c 100644
--- a/hw/pci_host.h
+++ b/hw/pci_host.h
@@ -30,6 +30,9 @@
#include "sysbus.h"
+#define TYPE_PCI_HOST "pci-host"
+#define PCI_HOST(obj) OBJECT_CHECK(PCIHostState, (obj), TYPE_PCI_HOST)
+
struct PCIHostState {
SysBusDevice busdev;
MemoryRegion conf_mem;
@@ -49,6 +52,8 @@ uint32_t pci_host_config_read_common(PCIDevice *pci_dev, uint32_t addr,
void pci_data_write(PCIBus *s, uint32_t addr, uint32_t val, int len);
uint32_t pci_data_read(PCIBus *s, uint32_t addr, int len);
+void pci_host_set_mmio(PCIHostState *s, MemoryRegion *value);
+
extern const MemoryRegionOps pci_host_conf_le_ops;
extern const MemoryRegionOps pci_host_conf_be_ops;
extern const MemoryRegionOps pci_host_data_le_ops;
--
1.7.5.4
next prev parent reply other threads:[~2012-07-18 13:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-18 13:19 [Qemu-devel] [PATCH v4 0/5] refactor PC machine, i440fx and piix3 to take advantage of QOM Wanpeng Li
2012-07-18 13:19 ` [Qemu-devel] [PATCH v4 1/5] eliminate piix_pci.c and module i440fx and piix3 Wanpeng Li
2012-07-18 13:19 ` [Qemu-devel] [PATCH v4 2/5] convert MemoryRegion to QOM Wanpeng Li
2012-07-18 13:19 ` Wanpeng Li [this message]
2012-07-18 14:07 ` [Qemu-devel] [PATCH v4 3/5] convert pci-host " Andreas Färber
2012-07-18 13:19 ` [Qemu-devel] [PATCH v4 4/5] prepare to create HPET, RTC and i8254 through composition Wanpeng Li
2012-07-18 14:39 ` Markus Armbruster
2012-07-19 20:24 ` Anthony Liguori
2012-07-20 9:51 ` Markus Armbruster
2012-07-19 20:23 ` Anthony Liguori
2012-07-20 3:42 ` Wanpeng Li
2012-07-18 13:19 ` [Qemu-devel] [PATCH v4 5/5] merge pc_piix.c to pc.c Wanpeng Li
2012-07-18 16:14 ` Michael S. Tsirkin
2012-07-18 17:43 ` [Qemu-devel] [PATCH v4 0/5] refactor PC machine, i440fx and piix3 to take advantage of QOM Paolo Bonzini
2012-07-19 20:27 ` Anthony Liguori
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=1342617545-9261-4-git-send-email-liwanp@linux.vnet.ibm.com \
--to=liwanp@linux.vnet.ibm.com \
--cc=aliguori@us.ibm.com \
--cc=avi@redhat.com \
--cc=blauwirbel@gmail.com \
--cc=jan.kiszka@siemens.com \
--cc=kernelfans@gmail.com \
--cc=mst@redhat.com \
--cc=pair@us.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=shangw@linux.vnet.ibm.com \
--cc=weil@mail.berlios.de \
/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).