mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
hw/rtc/mc146818rtc: Pass MC146818RtcState instead of ISADevice argument
rtc_get_memory() and rtc_set_memory() methods can not take any TYPE_ISA_DEVICE object. They expect a TYPE_MC146818_RTC one. Simplify the API by passing a MC146818RtcState. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230210233116.80311-3-philmd@linaro.org>
This commit is contained in:
parent
8df7129790
commit
55c86cb803
6 changed files with 25 additions and 25 deletions
|
@ -739,16 +739,14 @@ static uint64_t cmos_ioport_read(void *opaque, hwaddr addr,
|
|||
}
|
||||
}
|
||||
|
||||
void rtc_set_memory(ISADevice *dev, int addr, int val)
|
||||
void rtc_set_memory(MC146818RtcState *s, int addr, int val)
|
||||
{
|
||||
MC146818RtcState *s = MC146818_RTC(dev);
|
||||
if (addr >= 0 && addr <= 127)
|
||||
s->cmos_data[addr] = val;
|
||||
}
|
||||
|
||||
int rtc_get_memory(ISADevice *dev, int addr)
|
||||
int rtc_get_memory(MC146818RtcState *s, int addr)
|
||||
{
|
||||
MC146818RtcState *s = MC146818_RTC(dev);
|
||||
assert(addr >= 0 && addr <= 127);
|
||||
return s->cmos_data[addr];
|
||||
}
|
||||
|
@ -859,7 +857,7 @@ static void rtc_notify_suspend(Notifier *notifier, void *data)
|
|||
{
|
||||
MC146818RtcState *s = container_of(notifier, MC146818RtcState,
|
||||
suspend_notifier);
|
||||
rtc_set_memory(ISA_DEVICE(s), 0xF, 0xFE);
|
||||
rtc_set_memory(s, 0xF, 0xFE);
|
||||
}
|
||||
|
||||
static const MemoryRegionOps cmos_ops = {
|
||||
|
@ -946,7 +944,8 @@ static void rtc_realizefn(DeviceState *dev, Error **errp)
|
|||
QLIST_INSERT_HEAD(&rtc_devices, s, link);
|
||||
}
|
||||
|
||||
ISADevice *mc146818_rtc_init(ISABus *bus, int base_year, qemu_irq intercept_irq)
|
||||
MC146818RtcState *mc146818_rtc_init(ISABus *bus, int base_year,
|
||||
qemu_irq intercept_irq)
|
||||
{
|
||||
DeviceState *dev;
|
||||
ISADevice *isadev;
|
||||
|
@ -966,7 +965,7 @@ ISADevice *mc146818_rtc_init(ISABus *bus, int base_year, qemu_irq intercept_irq)
|
|||
object_property_add_alias(qdev_get_machine(), "rtc-time", OBJECT(isadev),
|
||||
"date");
|
||||
|
||||
return isadev;
|
||||
return s;
|
||||
}
|
||||
|
||||
static Property mc146818rtc_properties[] = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue