From: Alexander Graf <agraf@suse.de>
To: "qemu-ppc@nongnu.org List" <qemu-ppc@nongnu.org>
Cc: Bharat Bhushan <bharat.bhushan@freescale.com>,
qemu-devel qemu-devel <qemu-devel@nongnu.org>,
Bharat Bhushan <r65777@freescale.com>
Subject: [Qemu-devel] [PATCH 09/40] e500: Adding CCSR memory region
Date: Fri, 14 Dec 2012 13:13:25 +0100 [thread overview]
Message-ID: <1355487236-27451-10-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1355487236-27451-1-git-send-email-agraf@suse.de>
From: Bharat Bhushan <r65777@freescale.com>
All devices are also placed under CCSR memory region.
The CCSR memory region is exported to pci device. The MSI interrupt
generation is the main reason to export the CCSR region to PCI device.
This put the requirement to move mpic under CCSR region, but logically
all devices should be under CCSR. So this patch places all emulated
devices under ccsr region.
Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
hw/ppc/e500.c | 63 ++++++++++++++++++++++++++++++++++++--------------------
1 files changed, 40 insertions(+), 23 deletions(-)
diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index 6749fff..8538933 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -46,13 +46,15 @@
/* TODO: parameterize */
#define MPC8544_CCSRBAR_BASE 0xE0000000ULL
#define MPC8544_CCSRBAR_SIZE 0x00100000ULL
-#define MPC8544_MPIC_REGS_BASE (MPC8544_CCSRBAR_BASE + 0x40000ULL)
-#define MPC8544_SERIAL0_REGS_BASE (MPC8544_CCSRBAR_BASE + 0x4500ULL)
-#define MPC8544_SERIAL1_REGS_BASE (MPC8544_CCSRBAR_BASE + 0x4600ULL)
-#define MPC8544_PCI_REGS_BASE (MPC8544_CCSRBAR_BASE + 0x8000ULL)
+#define MPC8544_MPIC_REGS_OFFSET 0x40000ULL
+#define MPC8544_SERIAL0_REGS_OFFSET 0x4500ULL
+#define MPC8544_SERIAL1_REGS_OFFSET 0x4600ULL
+#define MPC8544_PCI_REGS_OFFSET 0x8000ULL
+#define MPC8544_PCI_REGS_BASE (MPC8544_CCSRBAR_BASE + \
+ MPC8544_PCI_REGS_OFFSET)
#define MPC8544_PCI_REGS_SIZE 0x1000ULL
#define MPC8544_PCI_IO 0xE1000000ULL
-#define MPC8544_UTIL_BASE (MPC8544_CCSRBAR_BASE + 0xe0000ULL)
+#define MPC8544_UTIL_OFFSET 0xe0000ULL
#define MPC8544_SPIN_BASE 0xEF000000ULL
struct boot_info
@@ -267,13 +269,12 @@ static int ppce500_load_device_tree(CPUPPCState *env,
/* XXX should contain a reasonable value */
qemu_devtree_setprop_cell(fdt, soc, "bus-frequency", 0);
- snprintf(mpic, sizeof(mpic), "%s/pic@%llx", soc,
- MPC8544_MPIC_REGS_BASE - MPC8544_CCSRBAR_BASE);
+ snprintf(mpic, sizeof(mpic), "%s/pic@%llx", soc, MPC8544_MPIC_REGS_OFFSET);
qemu_devtree_add_subnode(fdt, mpic);
qemu_devtree_setprop_string(fdt, mpic, "device_type", "open-pic");
qemu_devtree_setprop_string(fdt, mpic, "compatible", "chrp,open-pic");
- qemu_devtree_setprop_cells(fdt, mpic, "reg", MPC8544_MPIC_REGS_BASE -
- MPC8544_CCSRBAR_BASE, 0x40000);
+ qemu_devtree_setprop_cells(fdt, mpic, "reg", MPC8544_MPIC_REGS_OFFSET,
+ 0x40000);
qemu_devtree_setprop_cell(fdt, mpic, "#address-cells", 0);
qemu_devtree_setprop_cell(fdt, mpic, "#interrupt-cells", 2);
mpic_ph = qemu_devtree_alloc_phandle(fdt);
@@ -286,17 +287,16 @@ static int ppce500_load_device_tree(CPUPPCState *env,
* device it finds in the dt as serial output device. And we generate
* devices in reverse order to the dt.
*/
- dt_serial_create(fdt, MPC8544_SERIAL1_REGS_BASE - MPC8544_CCSRBAR_BASE,
+ dt_serial_create(fdt, MPC8544_SERIAL1_REGS_OFFSET,
soc, mpic, "serial1", 1, false);
- dt_serial_create(fdt, MPC8544_SERIAL0_REGS_BASE - MPC8544_CCSRBAR_BASE,
+ dt_serial_create(fdt, MPC8544_SERIAL0_REGS_OFFSET,
soc, mpic, "serial0", 0, true);
snprintf(gutil, sizeof(gutil), "%s/global-utilities@%llx", soc,
- MPC8544_UTIL_BASE - MPC8544_CCSRBAR_BASE);
+ MPC8544_UTIL_OFFSET);
qemu_devtree_add_subnode(fdt, gutil);
qemu_devtree_setprop_string(fdt, gutil, "compatible", "fsl,mpc8544-guts");
- qemu_devtree_setprop_cells(fdt, gutil, "reg", MPC8544_UTIL_BASE -
- MPC8544_CCSRBAR_BASE, 0x1000);
+ qemu_devtree_setprop_cells(fdt, gutil, "reg", MPC8544_UTIL_OFFSET, 0x1000);
qemu_devtree_setprop(fdt, gutil, "fsl,has-rstcr", NULL, 0);
snprintf(pci, sizeof(pci), "/pci@%llx", MPC8544_PCI_REGS_BASE);
@@ -422,6 +422,8 @@ void ppce500_init(PPCE500Params *params)
qemu_irq **irqs, *mpic;
DeviceState *dev;
CPUPPCState *firstenv = NULL;
+ MemoryRegion *ccsr;
+ SysBusDevice *s;
/* Setup CPUs */
if (params->cpu_model == NULL) {
@@ -450,7 +452,8 @@ void ppce500_init(PPCE500Params *params)
irqs[i][OPENPIC_OUTPUT_INT] = input[PPCE500_INPUT_INT];
irqs[i][OPENPIC_OUTPUT_CINT] = input[PPCE500_INPUT_CINT];
env->spr[SPR_BOOKE_PIR] = env->cpu_index = i;
- env->mpic_cpu_base = MPC8544_MPIC_REGS_BASE + 0x20000;
+ env->mpic_cpu_base = MPC8544_CCSRBAR_BASE +
+ MPC8544_MPIC_REGS_OFFSET + 0x20000;
ppc_booke_timers_init(env, 400000000, PPC_TIMER_E500);
@@ -477,8 +480,12 @@ void ppce500_init(PPCE500Params *params)
vmstate_register_ram_global(ram);
memory_region_add_subregion(address_space_mem, 0, ram);
+ ccsr = g_malloc0(sizeof(MemoryRegion));
+ memory_region_init(ccsr, "e500-ccsr", MPC8544_CCSRBAR_SIZE);
+ memory_region_add_subregion(address_space_mem, MPC8544_CCSRBAR_BASE, ccsr);
+
/* MPIC */
- mpic = mpic_init(address_space_mem, MPC8544_MPIC_REGS_BASE,
+ mpic = mpic_init(ccsr, MPC8544_MPIC_REGS_OFFSET,
smp_cpus, irqs, NULL);
if (!mpic) {
@@ -487,25 +494,35 @@ void ppce500_init(PPCE500Params *params)
/* Serial */
if (serial_hds[0]) {
- serial_mm_init(address_space_mem, MPC8544_SERIAL0_REGS_BASE,
+ serial_mm_init(ccsr, MPC8544_SERIAL0_REGS_OFFSET,
0, mpic[12+26], 399193,
serial_hds[0], DEVICE_BIG_ENDIAN);
}
if (serial_hds[1]) {
- serial_mm_init(address_space_mem, MPC8544_SERIAL1_REGS_BASE,
+ serial_mm_init(ccsr, MPC8544_SERIAL1_REGS_OFFSET,
0, mpic[12+26], 399193,
serial_hds[1], DEVICE_BIG_ENDIAN);
}
/* General Utility device */
- sysbus_create_simple("mpc8544-guts", MPC8544_UTIL_BASE, NULL);
+ dev = qdev_create(NULL, "mpc8544-guts");
+ qdev_init_nofail(dev);
+ s = SYS_BUS_DEVICE(dev);
+ memory_region_add_subregion(ccsr, MPC8544_UTIL_OFFSET,
+ sysbus_mmio_get_region(s, 0));
/* PCI */
- dev = sysbus_create_varargs("e500-pcihost", MPC8544_PCI_REGS_BASE,
- mpic[pci_irq_nrs[0]], mpic[pci_irq_nrs[1]],
- mpic[pci_irq_nrs[2]], mpic[pci_irq_nrs[3]],
- NULL);
+ dev = qdev_create(NULL, "e500-pcihost");
+ qdev_init_nofail(dev);
+ s = SYS_BUS_DEVICE(dev);
+ sysbus_connect_irq(s, 0, mpic[pci_irq_nrs[0]]);
+ sysbus_connect_irq(s, 1, mpic[pci_irq_nrs[1]]);
+ sysbus_connect_irq(s, 2, mpic[pci_irq_nrs[2]]);
+ sysbus_connect_irq(s, 3, mpic[pci_irq_nrs[3]]);
+ memory_region_add_subregion(ccsr, MPC8544_PCI_REGS_OFFSET,
+ sysbus_mmio_get_region(s, 0));
+
pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci.0");
if (!pci_bus)
printf("couldn't create PCI controller!\n");
--
1.6.0.2
next prev parent reply other threads:[~2012-12-14 12:15 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-14 12:13 [Qemu-devel] [PULL 00/40] ppc patch queue 2012-12-14 Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 01/40] pseries: Fix incorrect initialization of interrupt controller Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 02/40] pseries: Use #define for XICS base irq number Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 03/40] pseries: Return the token when we register an RTAS call Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 04/40] pseries: Allow RTAS tokens without a qemu handler Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 05/40] pseries: Add tracepoints to the XICS interrupt controller Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 06/40] pseries: Split xics irq configuration from state information Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 07/40] pseries: Implement PAPR NVRAM Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 08/40] pseries: Update SLOF for NVRAM support Alexander Graf
2012-12-14 12:13 ` Alexander Graf [this message]
2012-12-14 13:47 ` [Qemu-devel] [PATCH 09/40] e500: Adding CCSR memory region Andreas Färber
2012-12-14 12:13 ` [Qemu-devel] [PATCH 10/40] Adding BAR0 for e500 PCI controller Alexander Graf
2012-12-14 13:49 ` Andreas Färber
2012-12-14 12:13 ` [Qemu-devel] [PATCH 11/40] pseries: Don't allow TCE (iommu) tables to be registered with duplicate LIOBNs Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 12/40] openpic: Remove unused code Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 13/40] mpic: Unify numbering scheme Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 14/40] openpic: update to proper memory api Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 15/40] openpic: combine mpic and openpic src handlers Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 16/40] openpic: Convert subregions to memory api Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 17/40] openpic: combine mpic and openpic irq raise functions Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 18/40] openpic: merge mpic and openpic timer handling Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 19/40] openpic: combine openpic and mpic reset functions Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 20/40] openpic: unify memory api subregions Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 21/40] openpic: remove unused type variable Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 22/40] openpic: convert simple reg operations to builtin bitops Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 23/40] openpic: rename openpic_t to OpenPICState Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 24/40] openpic: remove irq_out Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 25/40] openpic: convert to qdev Alexander Graf
2012-12-14 20:32 ` Blue Swirl
2012-12-14 20:42 ` Alexander Graf
2012-12-14 20:50 ` Blue Swirl
2012-12-14 12:13 ` [Qemu-devel] [PATCH 26/40] openpic: make brr1 model specific Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 27/40] openpic: add Shared MSI support Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 28/40] PPC: e500: Add " Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 29/40] PPC: e500: Declare pci bridge as bridge Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 30/40] MSI-X: Fix endianness Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 31/40] openpic: fix minor coding style issues Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 32/40] openpic: Accelerate pending irq search Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 33/40] PPC: E500: PCI: Make first slot qdev settable Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 34/40] PPC: E500: PCI: Make IRQ calculation more generic Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 35/40] PPC: E500: Generate dt pci irq map dynamically Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 36/40] PPC: E500: Move PCI slot information into params Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 37/40] PPC: E500plat: Make a lot of PCI slots available Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 38/40] PPC: e500: pci: Export slot2irq calculation Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 39/40] target-ppc: Don't use hwaddr to represent hardware state Alexander Graf
2012-12-14 12:13 ` [Qemu-devel] [PATCH 40/40] pseries: Increase default NVRAM size Alexander Graf
2012-12-15 10:09 ` [Qemu-devel] [PULL 00/40] ppc patch queue 2012-12-14 Blue Swirl
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=1355487236-27451-10-git-send-email-agraf@suse.de \
--to=agraf@suse.de \
--cc=bharat.bhushan@freescale.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=r65777@freescale.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).