qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 08/30] hw/i386/pc: Create RTC controllers in south bridges


From: Thomas Huth
Subject: Re: [PATCH v4 08/30] hw/i386/pc: Create RTC controllers in south bridges
Date: Mon, 2 Jan 2023 18:03:29 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0

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 <shentey@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20221022150508.26830-11-shentey@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.

 Thomas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]