From: Wanpeng Li <liwp@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: Wanpeng Li <liwp@linux.vnet.ibm.com>,
Anthony Liguori <aliguori@us.ibm.com>,
Avi Kivity <avi@redhat.com>,
Gavin Shan <shangw@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH 3/6] convert pci-host to QOM
Date: Mon, 26 Mar 2012 17:05:49 +0800 [thread overview]
Message-ID: <1332752749-4843-1-git-send-email-liwp@linux.vnet.ibm.com> (raw)
From: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Wanpeng Li <liwp@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 44c6c20..44d7e55 100644
--- a/hw/pci_host.c
+++ b/hw/pci_host.c
@@ -162,4 +162,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 = {
+ .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);
+}
+
+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 reply other threads:[~2012-03-26 9:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-26 9:05 Wanpeng Li [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-03-26 8:34 [Qemu-devel] [PATCH 3/6] convert pci-host to QOM y
2012-03-26 2:06 [Qemu-devel] [PATCH 0/6] refactor PC machine, i440fx and piix3 to take advantage of QOM Wanpeng Li
2012-03-26 2:06 ` [Qemu-devel] [PATCH 3/6] convert pci-host to QOM Wanpeng Li
2012-03-26 7:32 ` Stefan Hajnoczi
2012-03-26 9:22 ` Wanpeng Li
2012-03-26 14:25 ` Andreas Färber
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=1332752749-4843-1-git-send-email-liwp@linux.vnet.ibm.com \
--to=liwp@linux.vnet.ibm.com \
--cc=aliguori@us.ibm.com \
--cc=avi@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=shangw@linux.vnet.ibm.com \
/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).