Add ide_init_ioport() which is not restricted to the ISA bus. (Next commit will use it for a PCI device).
Inspired-by: Mark Cave-Ayland <mark.cave-ayl...@ilande.co.uk> Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org> --- hw/ide/ioport.c | 11 +++++++++-- include/hw/ide/internal.h | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/hw/ide/ioport.c b/hw/ide/ioport.c index ac804a89e8..494fa88368 100644 --- a/hw/ide/ioport.c +++ b/hw/ide/ioport.c @@ -54,8 +54,6 @@ int ide_init_ioport_isa(IDEBus *bus, ISADevice *dev, int iobase, int iobase2) { int ret; - /* ??? Assume only ISA and PCI configurations, and that the PCI-ISA - bridge has been setup properly to always register with ISA. */ ret = isa_register_portio_list(dev, &bus->portio_list, iobase, ide_portio_list, bus, "ide"); @@ -66,3 +64,12 @@ int ide_init_ioport_isa(IDEBus *bus, ISADevice *dev, int iobase, int iobase2) return ret; } + +void ide_init_ioport(IDEBus *bus, Object *owner, MemoryRegion *io, + int iobase, int iobase2) +{ + portio_list_register(&bus->portio_list, owner, ide_portio_list, + bus, "ide", io, iobase); + portio_list_register(&bus->portio2_list, owner, ide_portio2_list, + bus, "ide", io, iobase2); +} diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h index 88a096f9df..79db902505 100644 --- a/include/hw/ide/internal.h +++ b/include/hw/ide/internal.h @@ -629,6 +629,8 @@ int ide_init_drive(IDEState *s, BlockBackend *blk, IDEDriveKind kind, void ide_init2(IDEBus *bus, qemu_irq irq); void ide_exit(IDEState *s); int ide_init_ioport_isa(IDEBus *bus, ISADevice *isa, int iobase, int iobase2); +void ide_init_ioport(IDEBus *bus, Object *owner, MemoryRegion *io, + int iobase, int iobase2); void ide_register_restart_cb(IDEBus *bus); void ide_exec_cmd(IDEBus *bus, uint32_t val); -- 2.38.1