aboutsummaryrefslogtreecommitdiff
path: root/hw/slavio_misc.c
diff options
context:
space:
mode:
authorBenoƮt Canet <benoit.canet@gmail.com>2011-11-15 12:13:54 +0100
committerAvi Kivity <avi@redhat.com>2011-11-24 18:32:02 +0200
commit2e66ac3d47643779cc35f71e7625cf8536b3307a (patch)
tree1213ca2e387475ff42e9d3cc3896a6431800deb2 /hw/slavio_misc.c
parent96891e593e5fa75385d3494adfec7492f2f919fc (diff)
slavio_misc: convert modem to memory API
Signed-off-by: Benoit Canet <benoit.canet@gmail.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'hw/slavio_misc.c')
-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 60a115dee5..9110c64b79 100644
--- a/hw/slavio_misc.c
+++ b/hw/slavio_misc.c
@@ -38,6 +38,7 @@ typedef struct MiscState {
SysBusDevice busdev;
MemoryRegion cfg_iomem;
MemoryRegion diag_iomem;
+ MemoryRegion mdm_iomem;
qemu_irq irq;
qemu_irq fdc_tc;
uint32_t dummy;
@@ -164,7 +165,7 @@ static const MemoryRegionOps slavio_diag_mem_ops = {
};
static void slavio_mdm_mem_writeb(void *opaque, target_phys_addr_t addr,
- uint32_t val)
+ uint64_t val, unsigned size)
{
MiscState *s = opaque;
@@ -172,7 +173,8 @@ static void slavio_mdm_mem_writeb(void *opaque, target_phys_addr_t addr,
s->mctrl = val & 0xff;
}
-static uint32_t slavio_mdm_mem_readb(void *opaque, target_phys_addr_t addr)
+static uint64_t slavio_mdm_mem_readb(void *opaque, target_phys_addr_t addr,
+ unsigned size)
{
MiscState *s = opaque;
uint32_t ret = 0;
@@ -182,16 +184,14 @@ static uint32_t slavio_mdm_mem_readb(void *opaque, target_phys_addr_t addr)
return ret;
}
-static CPUReadMemoryFunc * const slavio_mdm_mem_read[3] = {
- slavio_mdm_mem_readb,
- NULL,
- NULL,
-};
-
-static CPUWriteMemoryFunc * const slavio_mdm_mem_write[3] = {
- slavio_mdm_mem_writeb,
- NULL,
- NULL,
+static const MemoryRegionOps slavio_mdm_mem_ops = {
+ .read = slavio_mdm_mem_readb,
+ .write = slavio_mdm_mem_writeb,
+ .endianness = DEVICE_NATIVE_ENDIAN,
+ .valid = {
+ .min_access_size = 1,
+ .max_access_size = 1,
+ },
};
static void slavio_aux1_mem_writeb(void *opaque, target_phys_addr_t addr,
@@ -438,10 +438,9 @@ static int slavio_misc_init1(SysBusDevice *dev)
sysbus_init_mmio_region(dev, &s->diag_iomem);
/* Modem control */
- io = cpu_register_io_memory(slavio_mdm_mem_read,
- slavio_mdm_mem_write, s,
- DEVICE_NATIVE_ENDIAN);
- sysbus_init_mmio(dev, MISC_SIZE, io);
+ memory_region_init_io(&s->mdm_iomem, &slavio_mdm_mem_ops, s,
+ "modem", MISC_SIZE);
+ sysbus_init_mmio_region(dev, &s->mdm_iomem);
/* 16 bit registers */
/* ss600mp diag LEDs */