From: "Benoît Canet" <benoit.canet@gmail.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, "Benoît Canet" <benoit.canet@gmail.com>,
agraf@suse.de
Subject: [Qemu-devel] [PATCH v2 2/3] ppce500_pci: remove sysbus_init_mmio_cb2 usage
Date: Wed, 14 Dec 2011 15:32:08 +0100 [thread overview]
Message-ID: <1323873129-29742-3-git-send-email-benoit.canet@gmail.com> (raw)
In-Reply-To: <1323873129-29742-1-git-send-email-benoit.canet@gmail.com>
Expose only one container MemoryRegion to sysbus.
(Peter Maydell's idea)
Signed-off-by: Benoît Canet <benoit.canet@gmail.com>
---
hw/ppce500_mpc8544ds.c | 1 +
hw/ppce500_pci.c | 27 ++++++---------------------
2 files changed, 7 insertions(+), 21 deletions(-)
diff --git a/hw/ppce500_mpc8544ds.c b/hw/ppce500_mpc8544ds.c
index 51b6abd..dcb2b4d 100644
--- a/hw/ppce500_mpc8544ds.c
+++ b/hw/ppce500_mpc8544ds.c
@@ -244,6 +244,7 @@ static void mpc8544ds_init(ram_addr_t ram_size,
unsigned int pci_irq_nrs[4] = {1, 2, 3, 4};
qemu_irq **irqs, *mpic;
DeviceState *dev;
+ SysBusDevice *busdev;
CPUState *firstenv = NULL;
/* Setup CPUs */
diff --git a/hw/ppce500_pci.c b/hw/ppce500_pci.c
index 6232af1..b606206 100644
--- a/hw/ppce500_pci.c
+++ b/hw/ppce500_pci.c
@@ -79,6 +79,7 @@ struct PPCE500PCIState {
uint32_t gasket_time;
qemu_irq irq[4];
/* mmio maps */
+ MemoryRegion container;
MemoryRegion iomem;
};
@@ -298,26 +299,6 @@ static const VMStateDescription vmstate_ppce500_pci = {
}
};
-static void e500_pci_map(SysBusDevice *dev, target_phys_addr_t base)
-{
- PCIHostState *h = FROM_SYSBUS(PCIHostState, sysbus_from_qdev(dev));
- PPCE500PCIState *s = DO_UPCAST(PPCE500PCIState, pci_state, h);
-
- sysbus_add_memory(dev, base + PCIE500_CFGADDR, &h->conf_mem);
- sysbus_add_memory(dev, base + PCIE500_CFGDATA, &h->data_mem);
- sysbus_add_memory(dev, base + PCIE500_REG_BASE, &s->iomem);
-}
-
-static void e500_pci_unmap(SysBusDevice *dev, target_phys_addr_t base)
-{
- PCIHostState *h = FROM_SYSBUS(PCIHostState, sysbus_from_qdev(dev));
- PPCE500PCIState *s = DO_UPCAST(PPCE500PCIState, pci_state, h);
-
- sysbus_del_memory(dev, &h->conf_mem);
- sysbus_del_memory(dev, &h->data_mem);
- sysbus_del_memory(dev, &s->iomem);
-}
-
#include "exec-memory.h"
static int e500_pcihost_initfn(SysBusDevice *dev)
@@ -343,13 +324,17 @@ static int e500_pcihost_initfn(SysBusDevice *dev)
pci_create_simple(b, 0, "e500-host-bridge");
+ memory_region_init(&s->container, "pci-container", PCIE500_ALL_SIZE);
memory_region_init_io(&h->conf_mem, &pci_host_conf_be_ops, h,
"pci-conf-idx", 4);
memory_region_init_io(&h->data_mem, &pci_host_data_le_ops, h,
"pci-conf-data", 4);
memory_region_init_io(&s->iomem, &e500_pci_reg_ops, s,
"pci.reg", PCIE500_REG_SIZE);
- sysbus_init_mmio_cb2(dev, e500_pci_map, e500_pci_unmap);
+ memory_region_add_subregion(&s->container, PCIE500_CFGADDR, &h->conf_mem);
+ memory_region_add_subregion(&s->container, PCIE500_CFGDATA, &h->data_mem);
+ memory_region_add_subregion(&s->container, PCIE500_REG_BASE, &s->iomem);
+ sysbus_init_mmio(dev, &s->container);
return 0;
}
--
1.7.7.4
next prev parent reply other threads:[~2011-12-14 14:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-14 14:32 [Qemu-devel] [PATCH v2 0/3] remove sysbus_init_mmio_cb2 usage Benoît Canet
2011-12-14 14:32 ` [Qemu-devel] [PATCH v2 1/3] sh_pci: " Benoît Canet
2011-12-14 14:32 ` Benoît Canet [this message]
2011-12-14 14:32 ` [Qemu-devel] [PATCH v2 3/3] sysbus: remove sysbus_init_mmio_cb2 Benoît Canet
2011-12-15 16:22 ` [Qemu-devel] [PATCH v2 0/3] remove sysbus_init_mmio_cb2 usage 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=1323873129-29742-3-git-send-email-benoit.canet@gmail.com \
--to=benoit.canet@gmail.com \
--cc=agraf@suse.de \
--cc=peter.maydell@linaro.org \
--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).