diff options
author | BALATON Zoltan | 2019-01-25 20:52:11 +0100 |
---|---|---|
committer | John Snow | 2019-01-25 20:52:11 +0100 |
commit | 0252e66c5a577e80ba353f3048a681c4e5ab2ddd (patch) | |
tree | a022deada31ee541bf93ba8f55ffa7554ff75aaa /hw/ide/via.c | |
parent | sii3112: Remove duplicated code and use PCI IDE ops instead (diff) | |
download | qemu-0252e66c5a577e80ba353f3048a681c4e5ab2ddd.tar.gz qemu-0252e66c5a577e80ba353f3048a681c4e5ab2ddd.tar.xz qemu-0252e66c5a577e80ba353f3048a681c4e5ab2ddd.zip |
ide/via: Remove vt82c686b_init_ports() function
This function is only called once from vt82c686b_ide_realize() and its
content is simple enough to not need a separate function but be
included in realize directly (as done in other IDE models except PIIX
currently).
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Message-id: 47d854e0fa41dad6861107eac61327c247965566.1548160772.git.balaton@eik.bme.hu
Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'hw/ide/via.c')
-rw-r--r-- | hw/ide/via.c | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/hw/ide/via.c b/hw/ide/via.c index 987d99c5ec..46cac7b8d6 100644 --- a/hw/ide/via.c +++ b/hw/ide/via.c @@ -32,6 +32,15 @@ #include "hw/ide/pci.h" #include "trace.h" +static const struct { + int iobase; + int iobase2; + int isairq; +} port_info[] = { + {0x1f0, 0x3f6, 14}, + {0x170, 0x376, 15}, +}; + static uint64_t bmdma_read(void *opaque, hwaddr addr, unsigned size) { @@ -143,34 +152,12 @@ static void via_reset(void *opaque) pci_set_long(pci_conf + 0xc0, 0x00020001); } -static void vt82c686b_init_ports(PCIIDEState *d) { - static const struct { - int iobase; - int iobase2; - int isairq; - } port_info[] = { - {0x1f0, 0x3f6, 14}, - {0x170, 0x376, 15}, - }; - int i; - - for (i = 0; i < 2; i++) { - ide_bus_new(&d->bus[i], sizeof(d->bus[i]), DEVICE(d), i, 2); - ide_init_ioport(&d->bus[i], NULL, port_info[i].iobase, - port_info[i].iobase2); - ide_init2(&d->bus[i], isa_get_irq(NULL, port_info[i].isairq)); - - bmdma_init(&d->bus[i], &d->bmdma[i], d); - d->bmdma[i].bus = &d->bus[i]; - ide_register_restart_cb(&d->bus[i]); - } -} - /* via ide func */ static void vt82c686b_ide_realize(PCIDevice *dev, Error **errp) { PCIIDEState *d = PCI_IDE(dev); uint8_t *pci_conf = dev->config; + int i; pci_config_set_prog_interface(pci_conf, 0x8a); /* legacy ATA mode */ pci_set_long(pci_conf + PCI_CAPABILITY_LIST, 0x000000c0); @@ -181,7 +168,16 @@ static void vt82c686b_ide_realize(PCIDevice *dev, Error **errp) vmstate_register(DEVICE(dev), 0, &vmstate_ide_pci, d); - vt82c686b_init_ports(d); + for (i = 0; i < 2; i++) { + ide_bus_new(&d->bus[i], sizeof(d->bus[i]), DEVICE(d), i, 2); + ide_init_ioport(&d->bus[i], NULL, port_info[i].iobase, + port_info[i].iobase2); + ide_init2(&d->bus[i], isa_get_irq(NULL, port_info[i].isairq)); + + bmdma_init(&d->bus[i], &d->bmdma[i], d); + d->bmdma[i].bus = &d->bus[i]; + ide_register_restart_cb(&d->bus[i]); + } } static void vt82c686b_ide_exitfn(PCIDevice *dev) |