diff options
author | Bernhard Beschow <shentey@gmail.com> | 2023-05-19 10:47:33 +0200 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2023-05-19 10:30:46 -0400 |
commit | f0bc6bf725428860b479cb771e99bb33a3f5847d (patch) | |
tree | eace5e68847209ed95cbde054134f88b3e42dd60 /hw/i386 | |
parent | 547a652fd1e10c2b6a2b9b91084e4c1cea8665a2 (diff) | |
download | qemu-f0bc6bf725428860b479cb771e99bb33a3f5847d.zip qemu-f0bc6bf725428860b479cb771e99bb33a3f5847d.tar.gz qemu-f0bc6bf725428860b479cb771e99bb33a3f5847d.tar.bz2 |
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')
-rw-r--r-- | hw/i386/pc.c | 12 | ||||
-rw-r--r-- | hw/i386/pc_piix.c | 8 | ||||
-rw-r--r-- | hw/i386/pc_q35.c | 2 |
3 files changed, 21 insertions, 1 deletions
diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 03da571..4a73786 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) { diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 1acf02e..34e81b7 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -32,6 +32,7 @@ #include "hw/i386/pc.h" #include "hw/i386/apic.h" #include "hw/pci-host/i440fx.h" +#include "hw/rtc/mc146818rtc.h" #include "hw/southbridge/piix.h" #include "hw/display/ramfb.h" #include "hw/firmware/smbios.h" @@ -240,10 +241,17 @@ static void pc_init1(MachineState *machine, piix3->pic = x86ms->gsi; piix3_devfn = piix3->dev.devfn; isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(piix3), "isa.0")); + rtc_state = ISA_DEVICE(object_resolve_path_component(OBJECT(pci_dev), + "rtc")); } else { pci_bus = NULL; isa_bus = isa_bus_new(NULL, system_memory, system_io, &error_abort); + + rtc_state = isa_new(TYPE_MC146818_RTC); + qdev_prop_set_int32(DEVICE(rtc_state), "base_year", 2000); + isa_realize_and_unref(rtc_state, isa_bus, &error_fatal); + i8257_dma_init(isa_bus, 0); pcms->hpet_enabled = false; } diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index c1535af..8faeb6c 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -241,6 +241,8 @@ static void pc_q35_init(MachineState *machine) x86_machine_is_smm_enabled(x86ms)); pci_realize_and_unref(lpc, host_bus, &error_fatal); + rtc_state = ISA_DEVICE(object_resolve_path_component(OBJECT(lpc), "rtc")); + object_property_add_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP, TYPE_HOTPLUG_HANDLER, (Object **)&x86ms->acpi_dev, |