hw/isa/piix4.c: create PIIX4_PM device directly instead of using piix4_pm_initfn()
Now that all external logic has been removed from piix4_pm_initfn() the PIIX4_PM device can be instantiated directly. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20220528091934.15520-12-mark.cave-ayland@ilande.co.uk> Reviewed-by: Bernhard Beschow <shentey@gmail.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
This commit is contained in:
parent
ee7318bc09
commit
5a9715c26f
@ -34,6 +34,7 @@
|
||||
#include "hw/timer/i8254.h"
|
||||
#include "hw/rtc/mc146818rtc.h"
|
||||
#include "hw/ide/pci.h"
|
||||
#include "hw/acpi/piix4.h"
|
||||
#include "migration/vmstate.h"
|
||||
#include "sysemu/reset.h"
|
||||
#include "sysemu/runstate.h"
|
||||
@ -293,7 +294,6 @@ static int pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num)
|
||||
DeviceState *piix4_create(PCIBus *pci_bus, ISABus **isa_bus, I2CBus **smbus)
|
||||
{
|
||||
PIIX4State *s;
|
||||
PIIX4PMState *pms;
|
||||
PCIDevice *pci;
|
||||
DeviceState *dev;
|
||||
int devfn = PCI_DEVFN(10, 0);
|
||||
@ -311,10 +311,13 @@ DeviceState *piix4_create(PCIBus *pci_bus, ISABus **isa_bus, I2CBus **smbus)
|
||||
|
||||
pci_create_simple(pci_bus, devfn + 2, "piix4-usb-uhci");
|
||||
if (smbus) {
|
||||
pms = piix4_pm_initfn(pci_bus, devfn + 3, 0x1100, 0);
|
||||
qdev_connect_gpio_out(DEVICE(pms), 0,
|
||||
pci = pci_new(devfn + 3, TYPE_PIIX4_PM);
|
||||
qdev_prop_set_uint32(DEVICE(pci), "smb_io_base", 0x1100);
|
||||
qdev_prop_set_bit(DEVICE(pci), "smm-enabled", 0);
|
||||
pci_realize_and_unref(pci, pci_bus, &error_fatal);
|
||||
qdev_connect_gpio_out(DEVICE(pci), 0,
|
||||
qdev_get_gpio_in_named(dev, "isa", 9));
|
||||
*smbus = I2C_BUS(qdev_get_child_bus(DEVICE(pms), "i2c"));
|
||||
*smbus = I2C_BUS(qdev_get_child_bus(DEVICE(pci), "i2c"));
|
||||
}
|
||||
|
||||
pci_bus_irqs(pci_bus, piix4_set_irq, pci_slot_get_pirq, s, PIIX_NUM_PIRQS);
|
||||
|
Loading…
Reference in New Issue
Block a user