diff options
Diffstat (limited to 'hw/isa-bus.c')
-rw-r--r-- | hw/isa-bus.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/hw/isa-bus.c b/hw/isa-bus.c index 1cb497f5ca..6c15a31fe8 100644 --- a/hw/isa-bus.c +++ b/hw/isa-bus.c @@ -24,6 +24,7 @@ struct ISABus { BusState qbus; + MemoryRegion *address_space_io; qemu_irq *irqs; }; static ISABus *isabus; @@ -39,7 +40,7 @@ static struct BusInfo isa_bus_info = { .get_fw_dev_path = isabus_get_fw_dev_path, }; -ISABus *isa_bus_new(DeviceState *dev) +ISABus *isa_bus_new(DeviceState *dev, MemoryRegion *address_space_io) { if (isabus) { fprintf(stderr, "Can't create a second ISA bus\n"); @@ -51,6 +52,7 @@ ISABus *isa_bus_new(DeviceState *dev) } isabus = FROM_QBUS(ISABus, qbus_create(&isa_bus_info, dev, NULL)); + isabus->address_space_io = address_space_io; return isabus; } @@ -106,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); |