@@ -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"
@@ -281,11 +282,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"));