summary refs log tree commit diff stats
path: root/hw/i386/pc.c
diff options
context:
space:
mode:
authorBernhard Beschow <shentey@gmail.com>2023-05-19 10:47:33 +0200
committerMichael S. Tsirkin <mst@redhat.com>2023-05-19 10:30:46 -0400
commitf0bc6bf725428860b479cb771e99bb33a3f5847d (patch)
treeeace5e68847209ed95cbde054134f88b3e42dd60 /hw/i386/pc.c
parent547a652fd1e10c2b6a2b9b91084e4c1cea8665a2 (diff)
downloadfocaccia-qemu-f0bc6bf725428860b479cb771e99bb33a3f5847d.tar.gz
focaccia-qemu-f0bc6bf725428860b479cb771e99bb33a3f5847d.zip
hw/i386/pc: Create RTC controllers in south bridges
Just like in the real hardware (and in PIIX4), create the RTC
controllers in the south bridges.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20230519084734.220480-2-shentey@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/i386/pc.c')
-rw-r--r--hw/i386/pc.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 03da571bda..4a73786e20 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1318,7 +1318,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 = ISA_DEVICE(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");
 
 #ifdef CONFIG_XEN_EMU
     if (xen_mode == XEN_EMULATE) {