aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoƮt Canet <benoit.canet@gmail.com>2011-11-15 12:13:57 +0100
committerAvi Kivity <avi@redhat.com>2011-11-24 18:32:02 +0200
commitcccd43c544c300b207f8b049dbed768cf19285b7 (patch)
tree43a949b8bcd0bb4afc5e61f9fccb17a78da2a1ef
parentcd64a524fae457586c35dad53b6216f81fd7bb2c (diff)
slavio_misc: convert aux1 to memory API
Signed-off-by: Benoit Canet <benoit.canet@gmail.com> Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r--hw/slavio_misc.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/hw/slavio_misc.c b/hw/slavio_misc.c
index 29eca9b5b4..7a51e1bfec 100644
--- a/hw/slavio_misc.c
+++ b/hw/slavio_misc.c
@@ -41,6 +41,7 @@ typedef struct MiscState {
MemoryRegion mdm_iomem;
MemoryRegion led_iomem;
MemoryRegion sysctrl_iomem;
+ MemoryRegion aux1_iomem;
qemu_irq irq;
qemu_irq fdc_tc;
uint32_t dummy;
@@ -197,7 +198,7 @@ static const MemoryRegionOps slavio_mdm_mem_ops = {
};
static void slavio_aux1_mem_writeb(void *opaque, target_phys_addr_t addr,
- uint32_t val)
+ uint64_t val, unsigned size)
{
MiscState *s = opaque;
@@ -213,7 +214,8 @@ static void slavio_aux1_mem_writeb(void *opaque, target_phys_addr_t addr,
s->aux1 = val & 0xff;
}
-static uint32_t slavio_aux1_mem_readb(void *opaque, target_phys_addr_t addr)
+static uint64_t slavio_aux1_mem_readb(void *opaque, target_phys_addr_t addr,
+ unsigned size)
{
MiscState *s = opaque;
uint32_t ret = 0;
@@ -223,16 +225,14 @@ static uint32_t slavio_aux1_mem_readb(void *opaque, target_phys_addr_t addr)
return ret;
}
-static CPUReadMemoryFunc * const slavio_aux1_mem_read[3] = {
- slavio_aux1_mem_readb,
- NULL,
- NULL,
-};
-
-static CPUWriteMemoryFunc * const slavio_aux1_mem_write[3] = {
- slavio_aux1_mem_writeb,
- NULL,
- NULL,
+static const MemoryRegionOps slavio_aux1_mem_ops = {
+ .read = slavio_aux1_mem_readb,
+ .write = slavio_aux1_mem_writeb,
+ .endianness = DEVICE_NATIVE_ENDIAN,
+ .valid = {
+ .min_access_size = 1,
+ .max_access_size = 1,
+ },
};
static void slavio_aux2_mem_writeb(void *opaque, target_phys_addr_t addr,
@@ -455,10 +455,9 @@ static int slavio_misc_init1(SysBusDevice *dev)
sysbus_init_mmio_region(dev, &s->sysctrl_iomem);
/* AUX 1 (Misc System Functions) */
- io = cpu_register_io_memory(slavio_aux1_mem_read,
- slavio_aux1_mem_write, s,
- DEVICE_NATIVE_ENDIAN);
- sysbus_init_mmio(dev, MISC_SIZE, io);
+ memory_region_init_io(&s->aux1_iomem, &slavio_aux1_mem_ops, s,
+ "misc-system-functions", MISC_SIZE);
+ sysbus_init_mmio_region(dev, &s->aux1_iomem);
/* AUX 2 (Software Powerdown Control) */
io = cpu_register_io_memory(slavio_aux2_mem_read,