[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 01/22] hw/rtc/mc146818rtc: QOM'ify IRQ number
From: |
Bernhard Beschow |
Subject: |
[PATCH 01/22] hw/rtc/mc146818rtc: QOM'ify IRQ number |
Date: |
Tue, 22 Feb 2022 18:37:58 +0100 |
Exposing the IRQ number as a QOM property not only allows it to be
configurable but also to be printed by standard QOM mechanisms. This allows
isabus_dev_print() to be retired eventually.
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
hw/isa/piix4.c | 2 +-
hw/rtc/mc146818rtc.c | 8 ++++++--
include/hw/rtc/mc146818rtc.h | 1 +
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c
index 0fe7b69bc4..cb291d121c 100644
--- a/hw/isa/piix4.c
+++ b/hw/isa/piix4.c
@@ -197,7 +197,7 @@ static void piix4_realize(PCIDevice *dev, Error **errp)
if (!qdev_realize(DEVICE(&s->rtc), BUS(isa_bus), errp)) {
return;
}
- isa_init_irq(ISA_DEVICE(&s->rtc), &s->rtc.irq, RTC_ISA_IRQ);
+ isa_init_irq(ISA_DEVICE(&s->rtc), &s->rtc.irq, s->rtc.isairq);
piix4_dev = dev;
}
diff --git a/hw/rtc/mc146818rtc.c b/hw/rtc/mc146818rtc.c
index e61a0cced4..f300f40257 100644
--- a/hw/rtc/mc146818rtc.c
+++ b/hw/rtc/mc146818rtc.c
@@ -956,15 +956,17 @@ ISADevice *mc146818_rtc_init(ISABus *bus, int base_year,
qemu_irq intercept_irq)
{
DeviceState *dev;
ISADevice *isadev;
+ RTCState *s;
isadev = isa_new(TYPE_MC146818_RTC);
dev = DEVICE(isadev);
+ s = MC146818_RTC(isadev);
qdev_prop_set_int32(dev, "base_year", base_year);
isa_realize_and_unref(isadev, bus, &error_fatal);
if (intercept_irq) {
qdev_connect_gpio_out(dev, 0, intercept_irq);
} else {
- isa_connect_gpio_out(isadev, 0, RTC_ISA_IRQ);
+ isa_connect_gpio_out(isadev, 0, s->isairq);
}
object_property_add_alias(qdev_get_machine(), "rtc-time", OBJECT(isadev),
@@ -975,6 +977,7 @@ ISADevice *mc146818_rtc_init(ISABus *bus, int base_year,
qemu_irq intercept_irq)
static Property mc146818rtc_properties[] = {
DEFINE_PROP_INT32("base_year", RTCState, base_year, 1980),
+ DEFINE_PROP_UINT32("irq", RTCState, isairq, RTC_ISA_IRQ),
DEFINE_PROP_LOSTTICKPOLICY("lost_tick_policy", RTCState,
lost_tick_policy, LOST_TICK_POLICY_DISCARD),
DEFINE_PROP_END_OF_LIST(),
@@ -1010,6 +1013,7 @@ static void rtc_reset_hold(Object *obj)
static void rtc_build_aml(ISADevice *isadev, Aml *scope)
{
+ RTCState *s = MC146818_RTC(isadev);
Aml *dev;
Aml *crs;
@@ -1020,7 +1024,7 @@ static void rtc_build_aml(ISADevice *isadev, Aml *scope)
crs = aml_resource_template();
aml_append(crs, aml_io(AML_DECODE16, RTC_ISA_BASE, RTC_ISA_BASE,
0x01, 0x08));
- aml_append(crs, aml_irq_no_flags(RTC_ISA_IRQ));
+ aml_append(crs, aml_irq_no_flags(s->isairq));
dev = aml_device("RTC");
aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0B00")));
diff --git a/include/hw/rtc/mc146818rtc.h b/include/hw/rtc/mc146818rtc.h
index 5b45b22924..c7586589ad 100644
--- a/include/hw/rtc/mc146818rtc.h
+++ b/include/hw/rtc/mc146818rtc.h
@@ -26,6 +26,7 @@ struct RTCState {
uint8_t cmos_data[128];
uint8_t cmos_index;
int32_t base_year;
+ uint32_t isairq;
uint64_t base_rtc;
uint64_t last_update;
int64_t offset;
--
2.35.1
- [PATCH 00/22] isa: Resolve unneeded IRQ attributes from ISADevice, Bernhard Beschow, 2022/02/22
- [PATCH 03/22] hw/input/pckbd: QOM'ify IRQ numbers, Bernhard Beschow, 2022/02/22
- [PATCH 01/22] hw/rtc/mc146818rtc: QOM'ify IRQ number,
Bernhard Beschow <=
- [PATCH 02/22] hw/rtc/m48t59-isa: QOM'ify IRQ number, Bernhard Beschow, 2022/02/22
- [PATCH 06/22] isa: Drop unused attributes from ISADevice, Bernhard Beschow, 2022/02/22
- [PATCH 04/22] hw/isa/isa-bus: Remove isabus_dev_print(), Bernhard Beschow, 2022/02/22
- [PATCH 07/22] hw/audio/cs4231a: Disuse isa_init_irq(), Bernhard Beschow, 2022/02/22
- [PATCH 08/22] hw/audio/gus: Disuse isa_init_irq(), Bernhard Beschow, 2022/02/22
- [PATCH 09/22] hw/audio/sb16: Disuse isa_init_irq(), Bernhard Beschow, 2022/02/22
- [PATCH 05/22] hw/ppc/pnv: Determine ns16550's IRQ number from QOM property, Bernhard Beschow, 2022/02/22
- [PATCH 10/22] hw/block/fdc-isa: Disuse isa_init_irq(), Bernhard Beschow, 2022/02/22