[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v1 4/7] sysbus/sysbus_mmio_map: parameterise mapped
From: |
Peter Crosthwaite |
Subject: |
[Qemu-devel] [PATCH v1 4/7] sysbus/sysbus_mmio_map: parameterise mapped region |
Date: |
Fri, 19 Oct 2012 16:40:28 +1000 |
Add a variant to sysbus_mmio_map that allow specifying a target memory region.
The requested device memory region is mapped within the argument target memory
region rather than the default (get_system_memory()). Behaviour of original
sysbus_mmio_map remains unchanged.
The will probably go away or morph into something else with Anthony sysbus purge
so its intended to be a bridging patch until those refactorings go live.
Signed-off-by: Peter Crosthwaite <address@hidden>
---
hw/sysbus.c | 11 ++++++++---
hw/sysbus.h | 2 ++
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/hw/sysbus.c b/hw/sysbus.c
index c173840..bd45183 100644
--- a/hw/sysbus.c
+++ b/hw/sysbus.c
@@ -48,7 +48,8 @@ void sysbus_connect_irq(SysBusDevice *dev, int n, qemu_irq
irq)
}
}
-void sysbus_mmio_map(SysBusDevice *dev, int n, target_phys_addr_t addr)
+void sysbus_mmio_map_to_region(SysBusDevice *dev, int n,
+ target_phys_addr_t addr, MemoryRegion *region)
{
assert(n >= 0 && n < dev->num_mmio);
@@ -58,14 +59,18 @@ void sysbus_mmio_map(SysBusDevice *dev, int n,
target_phys_addr_t addr)
}
if (dev->mmio[n].addr != (target_phys_addr_t)-1) {
/* Unregister previous mapping. */
- memory_region_del_subregion(get_system_memory(), dev->mmio[n].memory);
+ memory_region_del_subregion(region, dev->mmio[n].memory);
}
dev->mmio[n].addr = addr;
- memory_region_add_subregion(get_system_memory(),
+ memory_region_add_subregion(region,
addr,
dev->mmio[n].memory);
}
+void sysbus_mmio_map(SysBusDevice *dev, int n, target_phys_addr_t addr)
+{
+ sysbus_mmio_map_to_region(dev, n, addr, get_system_memory());
+}
/* Request an IRQ source. The actual IRQ object may be populated later. */
void sysbus_init_irq(SysBusDevice *dev, qemu_irq *p)
diff --git a/hw/sysbus.h b/hw/sysbus.h
index acfbcfb..9cdb2b4 100644
--- a/hw/sysbus.h
+++ b/hw/sysbus.h
@@ -56,6 +56,8 @@ void sysbus_init_ioports(SysBusDevice *dev, pio_addr_t
ioport, pio_addr_t size);
void sysbus_connect_irq(SysBusDevice *dev, int n, qemu_irq irq);
+void sysbus_mmio_map_to_region(SysBusDevice *dev, int n,
+ target_phys_addr_t addr, MemoryRegion *region);
void sysbus_mmio_map(SysBusDevice *dev, int n, target_phys_addr_t addr);
void sysbus_add_memory(SysBusDevice *dev, target_phys_addr_t addr,
MemoryRegion *mem);
--
1.7.0.4
- [Qemu-devel] [PATCH v1 0/7] QOMify pflash_cfi0x + PL353 for Xilinx Zynq, Peter Crosthwaite, 2012/10/19
- [Qemu-devel] [PATCH v1 1/7] pflash_cfi0x: remove unused base field, Peter Crosthwaite, 2012/10/19
- [Qemu-devel] [PATCH v1 2/7] pflash_cfi01: remove unused total_len field, Peter Crosthwaite, 2012/10/19
- [Qemu-devel] [PATCH v1 3/7] pflash_cfi0x: QOMified, Peter Crosthwaite, 2012/10/19
- [Qemu-devel] [PATCH v1 4/7] sysbus/sysbus_mmio_map: parameterise mapped region,
Peter Crosthwaite <=
- [Qemu-devel] [PATCH v1 5/7] hw: Model of Primecell pl35x mem controller, Peter Crosthwaite, 2012/10/19
- [Qemu-devel] [PATCH v1 6/7] xilinx_zynq: add pl353, Peter Crosthwaite, 2012/10/19
- [Qemu-devel] [PATCH v1 7/7] nand: Reset addressing after READSTATUS., Peter Crosthwaite, 2012/10/19