[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 3/7] integratorcp: convert control to memory API
From: |
Benoît Canet |
Subject: |
[Qemu-devel] [PATCH 3/7] integratorcp: convert control to memory API |
Date: |
Thu, 13 Oct 2011 21:45:15 +0200 |
---
hw/integratorcp.c | 35 ++++++++++++++++-------------------
1 files changed, 16 insertions(+), 19 deletions(-)
diff --git a/hw/integratorcp.c b/hw/integratorcp.c
index e3a5f24..9bda94e 100644
--- a/hw/integratorcp.c
+++ b/hw/integratorcp.c
@@ -392,7 +392,9 @@ static int icp_pic_init(SysBusDevice *dev)
}
/* CP control registers. */
-static uint32_t icp_control_read(void *opaque, target_phys_addr_t offset)
+
+static uint64_t icp_control_read(void *opaque, target_phys_addr_t offset,
+ unsigned size)
{
switch (offset >> 2) {
case 0: /* CP_IDFIELD */
@@ -410,7 +412,7 @@ static uint32_t icp_control_read(void *opaque,
target_phys_addr_t offset)
}
static void icp_control_write(void *opaque, target_phys_addr_t offset,
- uint32_t value)
+ uint64_t value, unsigned size)
{
switch (offset >> 2) {
case 1: /* CP_FLASHPROG */
@@ -422,26 +424,21 @@ static void icp_control_write(void *opaque,
target_phys_addr_t offset,
hw_error("icp_control_write: Bad offset %x\n", (int)offset);
}
}
-static CPUReadMemoryFunc * const icp_control_readfn[] = {
- icp_control_read,
- icp_control_read,
- icp_control_read
-};
-static CPUWriteMemoryFunc * const icp_control_writefn[] = {
- icp_control_write,
- icp_control_write,
- icp_control_write
-};
+static const MemoryRegionOps icp_control_ops = {
+ .read = icp_control_read,
+ .write = icp_control_write,
+ .endianness = DEVICE_NATIVE_ENDIAN,
+};
-static void icp_control_init(uint32_t base)
+static void icp_control_init(target_phys_addr_t base)
{
- int iomemtype;
-
- iomemtype = cpu_register_io_memory(icp_control_readfn,
- icp_control_writefn, NULL,
- DEVICE_NATIVE_ENDIAN);
- cpu_register_physical_memory(base, 0x00800000, iomemtype);
+ MemoryRegion *io;
+
+ io = (MemoryRegion *)g_malloc0(sizeof(MemoryRegion));
+ memory_region_init_io(io, &icp_control_ops, NULL,
+ "control", 0x00800000);
+ memory_region_add_subregion(get_system_memory(), base, io);
/* ??? Save/restore. */
}
--
1.7.5.4
- [Qemu-devel] [PATCH] finish to convert integratorcp.c and stellaris.c to the new memory API, Benoît Canet, 2011/10/13
- [Qemu-devel] [PATCH 1/7] integratorcp: convert core to memory API, Benoît Canet, 2011/10/13
- [Qemu-devel] [PATCH 2/7] integratorcp: convert icp pic to memory API, Benoît Canet, 2011/10/13
- [Qemu-devel] [PATCH 4/7] stellaris: convert sys to memory API, Benoît Canet, 2011/10/13
- [Qemu-devel] [PATCH 3/7] integratorcp: convert control to memory API,
Benoît Canet <=
- [Qemu-devel] [PATCH 5/7] stellaris: convert i2c to memory API, Benoît Canet, 2011/10/13
- [Qemu-devel] [PATCH 7/7] stellaris: convert gptm to memory API, Benoît Canet, 2011/10/13
- [Qemu-devel] [PATCH 6/7] stellaris: convert adc to memory API, Benoît Canet, 2011/10/13