diff options
author | Richard Henderson <rth@twiddle.net> | 2011-08-10 15:28:12 -0700 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-09-25 14:58:36 +0300 |
commit | 78e20593527ce35c5be9d89d686ba9d8e95041b6 (patch) | |
tree | 2a92b2c3da30997ad03202c3a2feee7f4b02c7f9 /hw | |
parent | c2d0d01202e07f87bf17ec9a9f43232c982aa1c2 (diff) | |
download | qemu-78e20593527ce35c5be9d89d686ba9d8e95041b6.zip qemu-78e20593527ce35c5be9d89d686ba9d8e95041b6.tar.gz qemu-78e20593527ce35c5be9d89d686ba9d8e95041b6.tar.bz2 |
isa: add isa_register_ioport()
To replace isa_init_ioport and isa_init_ioport_range
as the ISA devices are converted to the memory api.
[avi: use memory_region_size()]
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/isa-bus.c | 10 | ||||
-rw-r--r-- | hw/isa.h | 5 |
2 files changed, 14 insertions, 1 deletions
diff --git a/hw/isa-bus.c b/hw/isa-bus.c index d067505..6c15a31 100644 --- a/hw/isa-bus.c +++ b/hw/isa-bus.c @@ -108,6 +108,16 @@ void isa_init_ioport(ISADevice *dev, uint16_t ioport) isa_init_ioport_range(dev, ioport, 1); } +void isa_register_ioport(ISADevice *dev, MemoryRegion *io, uint16_t start) +{ + memory_region_add_subregion(isabus->address_space_io, start, io); + if (dev != NULL) { + assert(dev->nio < ARRAY_SIZE(dev->io)); + dev->io[dev->nio++] = io; + isa_init_ioport_range(dev, start, memory_region_size(io)); + } +} + static int isa_qdev_init(DeviceState *qdev, DeviceInfo *base) { ISADevice *dev = DO_UPCAST(ISADevice, qdev, qdev); @@ -13,10 +13,12 @@ typedef struct ISADeviceInfo ISADeviceInfo; struct ISADevice { DeviceState qdev; + MemoryRegion *io[32]; uint32_t isairq[2]; - int nirqs; uint16_t ioports[32]; + int nirqs; int nioports; + int nio; }; typedef int (*isa_qdev_initfn)(ISADevice *dev); @@ -29,6 +31,7 @@ ISABus *isa_bus_new(DeviceState *dev, MemoryRegion *address_space_io); void isa_bus_irqs(qemu_irq *irqs); qemu_irq isa_get_irq(int isairq); void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq); +void isa_register_ioport(ISADevice *dev, MemoryRegion *io, uint16_t start); void isa_init_ioport(ISADevice *dev, uint16_t ioport); void isa_init_ioport_range(ISADevice *dev, uint16_t start, uint16_t length); void isa_qdev_register(ISADeviceInfo *info); |