[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 09/12] hw/isa/vt82c686: Instantiate PM function in host device
From: |
Bernhard Beschow |
Subject: |
[PATCH v4 09/12] hw/isa/vt82c686: Instantiate PM function in host device |
Date: |
Wed, 31 Aug 2022 17:46:02 +0200 |
The PM controller has activity bits which monitor activity of other
built-in devices in the host device.
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
hw/isa/vt82c686.c | 13 +++++++++++++
hw/mips/fuloong2e.c | 2 +-
hw/ppc/pegasos2.c | 3 +--
include/hw/isa/vt82c686.h | 2 --
4 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c
index f05fd9948a..d048607079 100644
--- a/hw/isa/vt82c686.c
+++ b/hw/isa/vt82c686.c
@@ -250,6 +250,8 @@ static const ViaPMInitInfo vt82c686b_pm_init_info = {
.device_id = PCI_DEVICE_ID_VIA_82C686B_PM,
};
+#define TYPE_VT82C686B_PM "vt82c686b-pm"
+
static const TypeInfo vt82c686b_pm_info = {
.name = TYPE_VT82C686B_PM,
.parent = TYPE_VIA_PM,
@@ -261,6 +263,8 @@ static const ViaPMInitInfo vt8231_pm_init_info = {
.device_id = PCI_DEVICE_ID_VIA_8231_PM,
};
+#define TYPE_VT8231_PM "vt8231-pm"
+
static const TypeInfo vt8231_pm_info = {
.name = TYPE_VT8231_PM,
.parent = TYPE_VIA_PM,
@@ -548,6 +552,7 @@ struct ViaISAState {
ViaSuperIOState via_sio;
PCIIDEState ide;
UHCIState uhci[2];
+ ViaPMState pm;
};
static const VMStateDescription vmstate_via = {
@@ -641,6 +646,12 @@ static void via_isa_realize(PCIDevice *d, Error **errp)
return;
}
}
+
+ /* Function 4: Power Management */
+ qdev_prop_set_int32(DEVICE(&s->pm), "addr", d->devfn + 4);
+ if (!qdev_realize(DEVICE(&s->pm), BUS(pci_bus), errp)) {
+ return;
+ }
}
/* TYPE_VT82C686B_ISA */
@@ -683,6 +694,7 @@ static void vt82c686b_init(Object *obj)
ViaISAState *s = VIA_ISA(obj);
object_initialize_child(obj, "sio", &s->via_sio, TYPE_VT82C686B_SUPERIO);
+ object_initialize_child(obj, "pm", &s->pm, TYPE_VT82C686B_PM);
}
static void vt82c686b_class_init(ObjectClass *klass, void *data)
@@ -746,6 +758,7 @@ static void vt8231_init(Object *obj)
ViaISAState *s = VIA_ISA(obj);
object_initialize_child(obj, "sio", &s->via_sio, TYPE_VT8231_SUPERIO);
+ object_initialize_child(obj, "pm", &s->pm, TYPE_VT8231_PM);
}
static void vt8231_class_init(ObjectClass *klass, void *data)
diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c
index dc92223b76..377108d313 100644
--- a/hw/mips/fuloong2e.c
+++ b/hw/mips/fuloong2e.c
@@ -208,7 +208,7 @@ static void vt82c686b_southbridge_init(PCIBus *pci_bus, int
slot, qemu_irq intc,
dev = PCI_DEVICE(object_resolve_path_component(OBJECT(via), "ide"));
pci_ide_create_devs(dev);
- dev = pci_create_simple(pci_bus, PCI_DEVFN(slot, 4), TYPE_VT82C686B_PM);
+ dev = PCI_DEVICE(object_resolve_path_component(OBJECT(via), "pm"));
*i2c_bus = I2C_BUS(qdev_get_child_bus(DEVICE(dev), "i2c"));
/* Audio support */
diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c
index 85cca6f7a6..e32944ee2b 100644
--- a/hw/ppc/pegasos2.c
+++ b/hw/ppc/pegasos2.c
@@ -168,8 +168,7 @@ static void pegasos2_init(MachineState *machine)
dev = PCI_DEVICE(object_resolve_path_component(OBJECT(via), "ide"));
pci_ide_create_devs(dev);
- /* VT8231 function 4: Power Management Controller */
- dev = pci_create_simple(pci_bus, PCI_DEVFN(12, 4), TYPE_VT8231_PM);
+ dev = PCI_DEVICE(object_resolve_path_component(OBJECT(via), "pm"));
i2c_bus = I2C_BUS(qdev_get_child_bus(DEVICE(dev), "i2c"));
spd_data = spd_data_generate(DDR, machine->ram_size);
smbus_eeprom_init_one(i2c_bus, 0x57, spd_data);
diff --git a/include/hw/isa/vt82c686.h b/include/hw/isa/vt82c686.h
index e6f6dd4d43..eaa07881c5 100644
--- a/include/hw/isa/vt82c686.h
+++ b/include/hw/isa/vt82c686.h
@@ -4,10 +4,8 @@
#include "hw/pci/pci.h"
#define TYPE_VT82C686B_ISA "vt82c686b-isa"
-#define TYPE_VT82C686B_PM "vt82c686b-pm"
#define TYPE_VT82C686B_USB_UHCI "vt82c686b-usb-uhci"
#define TYPE_VT8231_ISA "vt8231-isa"
-#define TYPE_VT8231_PM "vt8231-pm"
#define TYPE_VIA_AC97 "via-ac97"
#define TYPE_VIA_IDE "via-ide"
#define TYPE_VIA_MC97 "via-mc97"
--
2.37.3
- [PATCH v4 00/12] Instantiate VT82xx functions in host device, Bernhard Beschow, 2022/08/31
- [PATCH v4 02/12] hw/isa/vt82c686: Resolve unneeded attribute, Bernhard Beschow, 2022/08/31
- [PATCH v4 01/12] hw/isa/vt82c686: Resolve chip-specific realize methods, Bernhard Beschow, 2022/08/31
- [PATCH v4 03/12] hw/isa/vt82c686: Prefer pci_address_space() over get_system_memory(), Bernhard Beschow, 2022/08/31
- [PATCH v4 08/12] hw/isa/vt82c686: Instantiate USB functions in host device, Bernhard Beschow, 2022/08/31
- [PATCH v4 04/12] hw/isa/vt82c686: Reuse errp, Bernhard Beschow, 2022/08/31
- [PATCH v4 05/12] hw/isa/vt82c686: Introduce TYPE_VIA_IDE define, Bernhard Beschow, 2022/08/31
- [PATCH v4 07/12] hw/isa/vt82c686: Introduce TYPE_VT82C686B_USB_UHCI define, Bernhard Beschow, 2022/08/31
- [PATCH v4 06/12] hw/isa/vt82c686: Instantiate IDE function in host device, Bernhard Beschow, 2022/08/31
- [PATCH v4 09/12] hw/isa/vt82c686: Instantiate PM function in host device,
Bernhard Beschow <=
- [PATCH v4 10/12] hw/isa/vt82c686: Instantiate AC97 and MC97 functions in host device, Bernhard Beschow, 2022/08/31
- [PATCH v4 11/12] hw/isa/vt82c686: Embed RTCState in host device, Bernhard Beschow, 2022/08/31
- [PATCH v4 12/12] hw/isa/vt82c686: Create rtc-time alias in boards instead, Bernhard Beschow, 2022/08/31