aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2009-06-08 15:56:04 +0300
committerAnthony Liguori <aliguori@us.ibm.com>2009-06-14 21:50:09 -0500
commiteeb7c03c0f49a8678028a734f1d6575f36a44edc (patch)
treed6dcca9f73faa611535a7cb35b6b6cc84b053395 /hw
parente19252d32c45e92c919109ec32616382eb2afe6b (diff)
downloadqemu-eeb7c03c0f49a8678028a734f1d6575f36a44edc.zip
qemu-eeb7c03c0f49a8678028a734f1d6575f36a44edc.tar.gz
qemu-eeb7c03c0f49a8678028a734f1d6575f36a44edc.tar.bz2
Add rtc reset function.
On reset: Periodic Interrupt Enable (PIE) bit is cleared to zero Alarm Interrupt Enable (AIE) bit is cleared to zero Update ended Interrupt Flag (UF) bit is cleared to zero Interrupt Request status Flag (IRQF) bit is cleared to zero Periodic Interrupt Flag (PF) bit is cleared to zero Alarm Interrupt Flag (AF) bit is cleared to zero Square Wave output Enable (SQWE) zero Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/mc146818rtc.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c
index 888b85a..98a2273 100644
--- a/hw/mc146818rtc.c
+++ b/hw/mc146818rtc.c
@@ -568,6 +568,22 @@ static int rtc_load_td(QEMUFile *f, void *opaque, int version_id)
}
#endif
+static void rtc_reset(void *opaque)
+{
+ RTCState *s = opaque;
+
+ /* clear PIE,AIE,SQWE on reset */
+ s->cmos_data[RTC_REG_B] &= ~((1<<6) | (1<<5) | (1<<3));
+
+ /* clear UF,IRQF,PF,AF on reset */
+ s->cmos_data[RTC_REG_C] &= ~((1<<4) | (1<<7) | (1<<6) | (1<<5));
+
+#ifdef TARGET_I386
+ if (rtc_td_hack)
+ s->irq_coalesced = 0;
+#endif
+}
+
RTCState *rtc_init_sqw(int base, qemu_irq irq, qemu_irq sqw_irq, int base_year)
{
RTCState *s;
@@ -606,6 +622,8 @@ RTCState *rtc_init_sqw(int base, qemu_irq irq, qemu_irq sqw_irq, int base_year)
if (rtc_td_hack)
register_savevm("mc146818rtc-td", base, 1, rtc_save_td, rtc_load_td, s);
#endif
+ qemu_register_reset(rtc_reset, 0, s);
+
return s;
}
@@ -721,5 +739,6 @@ RTCState *rtc_mm_init(target_phys_addr_t base, int it_shift, qemu_irq irq,
if (rtc_td_hack)
register_savevm("mc146818rtc-td", base, 1, rtc_save_td, rtc_load_td, s);
#endif
+ qemu_register_reset(rtc_reset, 0, s);
return s;
}