aboutsummaryrefslogtreecommitdiff
path: root/hw/i386/pc_piix.c
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:36 +0200
commitee7318bc09d25aa250f0e58ac1eebf87abc88b03 (patch)
treea4a7ddd18fcfd92e6d16e6ca016900cd3c109344 /hw/i386/pc_piix.c
parentb49e94424cbdc2f02725dcd37b8916ff64f74dcd (diff)
downloadqemu-ee7318bc09d25aa250f0e58ac1eebf87abc88b03.zip
qemu-ee7318bc09d25aa250f0e58ac1eebf87abc88b03.tar.gz
qemu-ee7318bc09d25aa250f0e58ac1eebf87abc88b03.tar.bz2
hw/i386/pc_piix: 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-11-mark.cave-ayland@ilande.co.uk> Reviewed-by: Bernhard Beschow <shentey@gmail.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Diffstat (limited to 'hw/i386/pc_piix.c')
-rw-r--r--hw/i386/pc_piix.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 89c4f07..7d55466 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -47,6 +47,7 @@
#include "hw/xen/xen-x86.h"
#include "exec/memory.h"
#include "hw/acpi/acpi.h"
+#include "hw/acpi/piix4.h"
#include "qapi/error.h"
#include "qemu/error-report.h"
#include "sysemu/xen.h"
@@ -280,11 +281,15 @@ static void pc_init1(MachineState *machine,
}
if (pcmc->pci_enabled && x86_machine_is_acpi_enabled(X86_MACHINE(pcms))) {
- PIIX4PMState *piix4_pm;
+ PCIDevice *piix4_pm;
smi_irq = qemu_allocate_irq(pc_acpi_smi_interrupt, first_cpu, 0);
- piix4_pm = piix4_pm_initfn(pci_bus, piix3_devfn + 3, 0xb100,
- x86_machine_is_smm_enabled(x86ms));
+ piix4_pm = pci_new(piix3_devfn + 3, TYPE_PIIX4_PM);
+ qdev_prop_set_uint32(DEVICE(piix4_pm), "smb_io_base", 0xb100);
+ qdev_prop_set_bit(DEVICE(piix4_pm), "smm-enabled",
+ x86_machine_is_smm_enabled(x86ms));
+ pci_realize_and_unref(piix4_pm, pci_bus, &error_fatal);
+
qdev_connect_gpio_out(DEVICE(piix4_pm), 0, x86ms->gsi[9]);
qdev_connect_gpio_out_named(DEVICE(piix4_pm), "smi-irq", 0, smi_irq);
pcms->smbus = I2C_BUS(qdev_get_child_bus(DEVICE(piix4_pm), "i2c"));