Now that the PIIX3 and PIIX4 device models are sufficiently consolidated,
their implementations can be merged into one file for further
consolidation.
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20221022150508.26830-37-shentey@gmail.com>
---
hw/isa/{piix3.c => piix.c} | 158 ++++++++++++++++++++
hw/isa/piix4.c | 285 -------------------------------------
MAINTAINERS | 6 +-
hw/i386/Kconfig | 2 +-
hw/isa/Kconfig | 12 +-
hw/isa/meson.build | 3 +-
hw/mips/Kconfig | 2 +-
7 files changed, 165 insertions(+), 303 deletions(-)
rename hw/isa/{piix3.c => piix.c} (75%)
delete mode 100644 hw/isa/piix4.c
+static void piix4_realize(PCIDevice *dev, Error **errp)
+{
+ PIIXState *s = PIIX_PCI_DEVICE(dev);
+ PCIBus *pci_bus = pci_get_bus(dev);
+ ISABus *isa_bus;
+
+ isa_bus = isa_bus_new(DEVICE(dev), pci_address_space(dev),
+ pci_address_space_io(dev), errp);
+ if (!isa_bus) {
+ return;
+ }
+
+ memory_region_init_io(&s->rcr_mem, OBJECT(dev), &rcr_ops, s,
+ "reset-control", 1);
+ memory_region_add_subregion_overlap(pci_address_space_io(dev),
+ PIIX_RCR_IOPORT, &s->rcr_mem, 1);
+
+ /* initialize i8259 pic */
+ if (!qdev_realize(DEVICE(&s->pic), NULL, errp)) {
+ return;
+ }
+
+ /* initialize ISA irqs */
+ isa_bus_irqs(isa_bus, s->pic.in_irqs);
+
+ /* initialize pit */
+ i8254_pit_init(isa_bus, 0x40, 0, NULL);
+
+ /* DMA */
+ i8257_dma_init(isa_bus, 0);
+
+ /* RTC */
+ qdev_prop_set_int32(DEVICE(&s->rtc), "base_year", 2000);
+ if (!qdev_realize(DEVICE(&s->rtc), BUS(isa_bus), errp)) {
+ return;
+ }
+ s->rtc.irq = qdev_get_gpio_in(DEVICE(&s->pic), s->rtc.isairq);