aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2022-05-28 10:02:11 +0100
committerPhilippe Mathieu-Daudé <f4bug@amsat.org>2022-06-11 11:44:40 +0200
commit5a9715c26f19675c32a4113867a3a073fa1e8595 (patch)
tree2b4b3f22abe1aec601fecedee8d126fabc6ec510
parentee7318bc09d25aa250f0e58ac1eebf87abc88b03 (diff)
downloadqemu-5a9715c26f19675c32a4113867a3a073fa1e8595.zip
qemu-5a9715c26f19675c32a4113867a3a073fa1e8595.tar.gz
qemu-5a9715c26f19675c32a4113867a3a073fa1e8595.tar.bz2
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>
-rw-r--r--hw/isa/piix4.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c
index 775e15e..9a6d981 100644
--- a/hw/isa/piix4.c
+++ b/hw/isa/piix4.c
@@ -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);