diff options
author | Richard Henderson <rth@twiddle.net> | 2011-08-10 15:28:15 -0700 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-09-25 14:58:36 +0300 |
commit | 60ea6aa8fcf1bc678b13bf8cff5848e0c8eb8430 (patch) | |
tree | 24d7b4ea9109173c18771c2f0c3afc26e31ca0e9 | |
parent | beae3979451219e8dc288ae7d7a14e8b438cb5fb (diff) | |
download | qemu-60ea6aa8fcf1bc678b13bf8cff5848e0c8eb8430.zip qemu-60ea6aa8fcf1bc678b13bf8cff5848e0c8eb8430.tar.gz qemu-60ea6aa8fcf1bc678b13bf8cff5848e0c8eb8430.tar.bz2 |
i8254: Convert to MemoryRegion
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r-- | hw/i8254.c | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -55,6 +55,7 @@ typedef struct PITChannelState { typedef struct PITState { ISADevice dev; + MemoryRegion ioports; uint32_t irq; uint32_t iobase; PITChannelState channels[3]; @@ -506,6 +507,16 @@ void hpet_pit_enable(void) pit_load_count(s, 0); } +static const MemoryRegionPortio pit_portio[] = { + { 0, 4, 1, .write = pit_ioport_write }, + { 0, 3, 1, .read = pit_ioport_read }, + PORTIO_END_OF_LIST() +}; + +static const MemoryRegionOps pit_ioport_ops = { + .old_portio = pit_portio +}; + static int pit_initfn(ISADevice *dev) { PITState *pit = DO_UPCAST(PITState, dev, dev); @@ -516,9 +527,8 @@ static int pit_initfn(ISADevice *dev) s->irq_timer = qemu_new_timer_ns(vm_clock, pit_irq_timer, s); s->irq = isa_get_irq(pit->irq); - register_ioport_write(pit->iobase, 4, 1, pit_ioport_write, pit); - register_ioport_read(pit->iobase, 3, 1, pit_ioport_read, pit); - isa_init_ioport(dev, pit->iobase); + memory_region_init_io(&pit->ioports, &pit_ioport_ops, pit, "pit", 4); + isa_register_ioport(dev, &pit->ioports, pit->iobase); qdev_set_legacy_instance_id(&dev->qdev, pit->iobase, 2); |