mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
hw/isa/piix3: Create power management controller in host device
The power management controller is an integral part of PIIX3 (function 3). So create it as part of the south bridge. Note that the ACPI function is optional in QEMU. This is why it gets object_initialize_child()'ed in realize rather than in instance_init. Signed-off-by: Bernhard Beschow <shentey@gmail.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Message-Id: <20231007123843.127151-14-shentey@gmail.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
6fe4464c05
commit
0a15cf0801
4 changed files with 33 additions and 13 deletions
|
@ -50,7 +50,6 @@
|
|||
#include "hw/i2c/smbus_eeprom.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"
|
||||
|
@ -115,7 +114,7 @@ static void pc_init1(MachineState *machine,
|
|||
MemoryRegion *system_io = get_system_io();
|
||||
PCIBus *pci_bus = NULL;
|
||||
ISABus *isa_bus;
|
||||
int piix3_devfn = -1;
|
||||
Object *piix4_pm = NULL;
|
||||
qemu_irq smi_irq;
|
||||
GSIState *gsi_state;
|
||||
BusState *idebus[MAX_IDE_BUS];
|
||||
|
@ -266,6 +265,13 @@ static void pc_init1(MachineState *machine,
|
|||
pci_dev = pci_new_multifunction(-1, TYPE_PIIX3_DEVICE);
|
||||
object_property_set_bool(OBJECT(pci_dev), "has-usb",
|
||||
machine_usb(machine), &error_abort);
|
||||
object_property_set_bool(OBJECT(pci_dev), "has-acpi",
|
||||
x86_machine_is_acpi_enabled(x86ms),
|
||||
&error_abort);
|
||||
qdev_prop_set_uint32(DEVICE(pci_dev), "smb_io_base", 0xb100);
|
||||
object_property_set_bool(OBJECT(pci_dev), "smm-enabled",
|
||||
x86_machine_is_smm_enabled(x86ms),
|
||||
&error_abort);
|
||||
dev = DEVICE(pci_dev);
|
||||
for (i = 0; i < ISA_NUM_IRQS; i++) {
|
||||
qdev_connect_gpio_out_named(dev, "isa-irqs", i, x86ms->gsi[i]);
|
||||
|
@ -286,10 +292,10 @@ static void pc_init1(MachineState *machine,
|
|||
XEN_IOAPIC_NUM_PIRQS);
|
||||
}
|
||||
|
||||
piix3_devfn = pci_dev->devfn;
|
||||
isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(pci_dev), "isa.0"));
|
||||
rtc_state = ISA_DEVICE(object_resolve_path_component(OBJECT(pci_dev),
|
||||
"rtc"));
|
||||
piix4_pm = object_resolve_path_component(OBJECT(pci_dev), "pm");
|
||||
dev = DEVICE(object_resolve_path_component(OBJECT(pci_dev), "ide"));
|
||||
pci_ide_create_devs(PCI_DEVICE(dev));
|
||||
idebus[0] = qdev_get_child_bus(dev, "ide.0");
|
||||
|
@ -360,17 +366,9 @@ static void pc_init1(MachineState *machine,
|
|||
}
|
||||
#endif
|
||||
|
||||
if (pcmc->pci_enabled && x86_machine_is_acpi_enabled(X86_MACHINE(pcms))) {
|
||||
PCIDevice *piix4_pm;
|
||||
|
||||
if (piix4_pm) {
|
||||
smi_irq = qemu_allocate_irq(pc_acpi_smi_interrupt, first_cpu, 0);
|
||||
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"));
|
||||
/* TODO: Populate SPD eeprom data. */
|
||||
|
@ -382,7 +380,7 @@ static void pc_init1(MachineState *machine,
|
|||
object_property_allow_set_link,
|
||||
OBJ_PROP_LINK_STRONG);
|
||||
object_property_set_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP,
|
||||
OBJECT(piix4_pm), &error_abort);
|
||||
piix4_pm, &error_abort);
|
||||
}
|
||||
|
||||
if (machine->nvdimms_state->is_enabled) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue