hw/isa/piix4: Move piix4_create() to hw/isa/piix4.c

Now that we properly refactored the piix4_create() function, let's
move it to hw/isa/piix4.c where it belongs, so it can be reused
on other places.

Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
This commit is contained in:
Philippe Mathieu-Daudé 2019-02-02 01:13:12 +01:00 committed by Philippe Mathieu-Daudé
parent c74d2c047e
commit e29f237996
5 changed files with 37 additions and 30 deletions

View file

@ -1210,34 +1210,6 @@ static void mips_create_cpu(MachineState *ms, MaltaState *s,
}
}
static DeviceState *piix4_create(PCIBus *pci_bus, ISABus **isa_bus,
I2CBus **smbus, size_t ide_buses)
{
const size_t ide_drives = ide_buses * MAX_IDE_DEVS;
DriveInfo **hd;
PCIDevice *pci;
DeviceState *dev;
pci = pci_create_simple_multifunction(pci_bus, PCI_DEVFN(10, 0),
true, TYPE_PIIX4_PCI_DEVICE);
dev = DEVICE(pci);
if (isa_bus) {
*isa_bus = ISA_BUS(qdev_get_child_bus(dev, "isa.0"));
}
hd = g_new(DriveInfo *, ide_drives);
ide_drive_get(hd, ide_drives);
pci_piix4_ide_init(pci_bus, hd, pci->devfn + 1);
g_free(hd);
pci_create_simple(pci_bus, pci->devfn + 2, "piix4-usb-uhci");
if (smbus) {
*smbus = piix4_pm_init(pci_bus, pci->devfn + 3, 0x1100,
isa_get_irq(NULL, 9), NULL, 0, NULL);
}
return dev;
}
static
void mips_malta_init(MachineState *machine)
{