[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 11/12] hw/isa/piix4.c: create PIIX4_PM device directly instead of
From: |
Mark Cave-Ayland |
Subject: |
[PATCH 11/12] hw/isa/piix4.c: create PIIX4_PM device directly instead of using piix4_pm_initfn() |
Date: |
Sat, 28 May 2022 10:19:33 +0100 |
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>
---
hw/isa/piix4.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c
index 775e15eb20..9a6d981037 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);
--
2.20.1
- [PATCH 06/12] hw/acpi/piix4: rename piix4_pm_init() to piix4_pm_initfn(), (continued)
- [PATCH 06/12] hw/acpi/piix4: rename piix4_pm_init() to piix4_pm_initfn(), Mark Cave-Ayland, 2022/05/28
- [PATCH 10/12] hw/i386/pc_piix: create PIIX4_PM device directly instead of using piix4_pm_initfn(), Mark Cave-Ayland, 2022/05/28
- [PATCH 12/12] hw/acpi/piix4: remove unused piix4_pm_initfn() function, Mark Cave-Ayland, 2022/05/28
- [PATCH 01/12] hw/acpi/piix4: move xen_enabled() logic from piix4_pm_init() to piix4_pm_realize(), Mark Cave-Ayland, 2022/05/28
- [PATCH 02/12] hw/acpi/piix4: change smm_enabled from int to bool, Mark Cave-Ayland, 2022/05/28
- [PATCH 03/12] hw/acpi/piix4: convert smm_enabled bool to qdev property, Mark Cave-Ayland, 2022/05/28
- [PATCH 11/12] hw/isa/piix4.c: create PIIX4_PM device directly instead of using piix4_pm_initfn(),
Mark Cave-Ayland <=
- [PATCH 08/12] hw/acpi/piix4: use qdev gpio to wire up sci_irq, Mark Cave-Ayland, 2022/05/28
- [PATCH 09/12] hw/acpi/piix4: use qdev gpio to wire up smi_irq, Mark Cave-Ayland, 2022/05/28
- [PATCH 07/12] hw/acpi/piix4: introduce piix4_pm_init() instance init function, Mark Cave-Ayland, 2022/05/28
- [PATCH 05/12] hw/acpi/piix4: alter piix4_pm_init() to return PIIX4PMState, Mark Cave-Ayland, 2022/05/28
- [PATCH 04/12] hw/acpi/piix4: move PIIX4PMState into separate piix4.h header, Mark Cave-Ayland, 2022/05/28