On 02/01/2023 19.25, Bernhard Beschow wrote:
Am 2. Januar 2023 17:03:29 UTC schrieb Thomas Huth <th...@redhat.com>:
On 21/12/2022 17.59, Bernhard Beschow wrote:
Just like in the real hardware (and in PIIX4), create the RTC
controllers in the south bridges.
Signed-off-by: Bernhard Beschow <shen...@gmail.com>
Reviewed-by: Michael S. Tsirkin <m...@redhat.com>
Message-Id: <20221022150508.26830-11-shen...@gmail.com>
---
hw/i386/pc.c | 12 +++++++++++-
hw/i386/pc_piix.c | 8 ++++++++
hw/i386/pc_q35.c | 1 +
hw/isa/Kconfig | 2 ++
hw/isa/lpc_ich9.c | 8 ++++++++
hw/isa/piix3.c | 15 +++++++++++++++
include/hw/i386/ich9.h | 2 ++
include/hw/southbridge/piix.h | 3 +++
8 files changed, 50 insertions(+), 1 deletion(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index fa69b6f43e..d154eedcb3 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1299,7 +1299,17 @@ void pc_basic_device_init(struct PCMachineState *pcms,
pit_alt_irq = qdev_get_gpio_in(hpet, HPET_LEGACY_PIT_INT);
rtc_irq = qdev_get_gpio_in(hpet, HPET_LEGACY_RTC_INT);
}
- *rtc_state = mc146818_rtc_init(isa_bus, 2000, rtc_irq);
+
+ if (rtc_irq) {
+ qdev_connect_gpio_out(DEVICE(*rtc_state), 0, rtc_irq);
+ } else {
+ uint32_t irq = object_property_get_uint(OBJECT(*rtc_state),
+ "irq",
+ &error_fatal);
+ isa_connect_gpio_out(*rtc_state, 0, irq);
+ }
+ object_property_add_alias(OBJECT(pcms), "rtc-time", OBJECT(*rtc_state),
+ "date");
I think you could turn now the "ISADevice **rtc_state" parameter of this function into a
normal "ISADevice *rtc_state" since the pointer is not a return value anymore.
This is done in patch 9/30:
https://lists.gnu.org/archive/html/qemu-devel/2022-12/msg03799.html
Ah, right, sorry for my shortsightness, then this is fine here:
Reviewed-by: Thomas Huth <th...@redhat.com>