aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoƮt Canet <benoit.canet@gmail.com>2011-11-15 12:13:55 +0100
committerAvi Kivity <avi@redhat.com>2011-11-24 18:32:02 +0200
commitaca23c71d306ed5719c90bcb117f2c05a64f3e99 (patch)
tree159d0c1d476e4447f499f811448b5940d1ed8d17
parent2e66ac3d47643779cc35f71e7625cf8536b3307a (diff)
slavio_misc: convert leds 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 9110c64b79..db266ba8ad 100644
--- a/hw/slavio_misc.c
+++ b/hw/slavio_misc.c
@@ -39,6 +39,7 @@ typedef struct MiscState {
MemoryRegion cfg_iomem;
MemoryRegion diag_iomem;
MemoryRegion mdm_iomem;
+ MemoryRegion led_iomem;
qemu_irq irq;
qemu_irq fdc_tc;
uint32_t dummy;
@@ -345,7 +346,8 @@ static CPUWriteMemoryFunc * const slavio_sysctrl_mem_write[3] = {
slavio_sysctrl_mem_writel,
};
-static uint32_t slavio_led_mem_readw(void *opaque, target_phys_addr_t addr)
+static uint64_t slavio_led_mem_readw(void *opaque, target_phys_addr_t addr,
+ unsigned size)
{
MiscState *s = opaque;
uint32_t ret = 0;
@@ -362,7 +364,7 @@ static uint32_t slavio_led_mem_readw(void *opaque, target_phys_addr_t addr)
}
static void slavio_led_mem_writew(void *opaque, target_phys_addr_t addr,
- uint32_t val)
+ uint64_t val, unsigned size)
{
MiscState *s = opaque;
@@ -376,16 +378,14 @@ static void slavio_led_mem_writew(void *opaque, target_phys_addr_t addr,
}
}
-static CPUReadMemoryFunc * const slavio_led_mem_read[3] = {
- NULL,
- slavio_led_mem_readw,
- NULL,
-};
-
-static CPUWriteMemoryFunc * const slavio_led_mem_write[3] = {
- NULL,
- slavio_led_mem_writew,
- NULL,
+static const MemoryRegionOps slavio_led_mem_ops = {
+ .read = slavio_led_mem_readw,
+ .write = slavio_led_mem_writew,
+ .endianness = DEVICE_NATIVE_ENDIAN,
+ .valid = {
+ .min_access_size = 2,
+ .max_access_size = 2,
+ },
};
static const VMStateDescription vmstate_misc = {
@@ -444,10 +444,9 @@ static int slavio_misc_init1(SysBusDevice *dev)
/* 16 bit registers */
/* ss600mp diag LEDs */
- io = cpu_register_io_memory(slavio_led_mem_read,
- slavio_led_mem_write, s,
- DEVICE_NATIVE_ENDIAN);
- sysbus_init_mmio(dev, MISC_SIZE, io);
+ memory_region_init_io(&s->led_iomem, &slavio_led_mem_ops, s,
+ "leds", MISC_SIZE);
+ sysbus_init_mmio_region(dev, &s->led_iomem);
/* 32 bit registers */
/* System control */