aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Walle <michael@walle.cc>2011-08-31 16:48:39 +0200
committerAvi Kivity <avi@redhat.com>2011-10-02 16:14:02 +0200
commit9496e1c335993eca3901d94f19c86fd501715a49 (patch)
tree3c0e3a6c06dac2eb5c1d0fb4bbe89cc083a5deea
parent71cf9e62427230ebc0ddd68a206b261952dffc57 (diff)
milkymist-ac97: convert to memory API
Signed-off-by: Michael Walle <michael@walle.cc> Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r--hw/milkymist-ac97.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/hw/milkymist-ac97.c b/hw/milkymist-ac97.c
index 6104732f7d..5c5ed275b3 100644
--- a/hw/milkymist-ac97.c
+++ b/hw/milkymist-ac97.c
@@ -53,6 +53,7 @@ enum {
struct MilkymistAC97State {
SysBusDevice busdev;
+ MemoryRegion regs_region;
QEMUSoundCard card;
SWVoiceIn *voice_in;
@@ -82,7 +83,8 @@ static void update_voices(MilkymistAC97State *s)
}
}
-static uint32_t ac97_read(void *opaque, target_phys_addr_t addr)
+static uint64_t ac97_read(void *opaque, target_phys_addr_t addr,
+ unsigned size)
{
MilkymistAC97State *s = opaque;
uint32_t r = 0;
@@ -113,7 +115,8 @@ static uint32_t ac97_read(void *opaque, target_phys_addr_t addr)
return r;
}
-static void ac97_write(void *opaque, target_phys_addr_t addr, uint32_t value)
+static void ac97_write(void *opaque, target_phys_addr_t addr, uint64_t value,
+ unsigned size)
{
MilkymistAC97State *s = opaque;
@@ -159,16 +162,14 @@ static void ac97_write(void *opaque, target_phys_addr_t addr, uint32_t value)
}
-static CPUReadMemoryFunc * const ac97_read_fn[] = {
- NULL,
- NULL,
- &ac97_read,
-};
-
-static CPUWriteMemoryFunc * const ac97_write_fn[] = {
- NULL,
- NULL,
- &ac97_write,
+static const MemoryRegionOps ac97_mmio_ops = {
+ .read = ac97_read,
+ .write = ac97_write,
+ .valid = {
+ .min_access_size = 4,
+ .max_access_size = 4,
+ },
+ .endianness = DEVICE_NATIVE_ENDIAN,
};
static void ac97_in_cb(void *opaque, int avail_b)
@@ -280,7 +281,6 @@ static int ac97_post_load(void *opaque, int version_id)
static int milkymist_ac97_init(SysBusDevice *dev)
{
MilkymistAC97State *s = FROM_SYSBUS(typeof(*s), dev);
- int ac97_regs;
struct audsettings as;
sysbus_init_irq(dev, &s->crrequest_irq);
@@ -300,9 +300,9 @@ static int milkymist_ac97_init(SysBusDevice *dev)
s->voice_out = AUD_open_out(&s->card, s->voice_out,
"mm_ac97.out", s, ac97_out_cb, &as);
- ac97_regs = cpu_register_io_memory(ac97_read_fn, ac97_write_fn, s,
- DEVICE_NATIVE_ENDIAN);
- sysbus_init_mmio(dev, R_MAX * 4, ac97_regs);
+ memory_region_init_io(&s->regs_region, &ac97_mmio_ops, s,
+ "milkymist-ac97", R_MAX * 4);
+ sysbus_init_mmio_region(dev, &s->regs_region);
return 0;
}