diff options
author | Gleb Natapov <gleb@redhat.com> | 2009-06-10 15:12:46 +0300 |
---|---|---|
committer | Eduardo Habkost <ehabkost@redhat.com> | 2009-06-15 17:36:29 -0300 |
commit | 113a0ccebd5289869e8e626272d1e64ab1b83f39 (patch) | |
tree | 0fcb7749a1c4cda74e6993ca91ba41cdbe7c5b7f | |
parent | dc37c352502491c23bba26c1e0354303fd03a972 (diff) |
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>
Message-Id: <1244635966-21609-4-git-send-email-gleb@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
RH-Upstream-status: submitted
Obsoletes: <20090608135639.GH27210@redhat.com>
Acked-by: john cooper <john.cooper@redhat.com>
Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
Acked-by: Avi Kivity <avi@redhat.com>
Bugzilla: 504237
-rw-r--r-- | qemu/hw/mc146818rtc.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/qemu/hw/mc146818rtc.c b/qemu/hw/mc146818rtc.c index dd5a6951..1426f8e7 100644 --- a/qemu/hw/mc146818rtc.c +++ b/qemu/hw/mc146818rtc.c @@ -55,6 +55,13 @@ #define REG_B_PIE 0x40 #define REG_B_AIE 0x20 #define REG_B_UIE 0x10 +#define REG_B_SQWE 0x08 +#define REG_B_DM 0x04 + +#define REG_C_UF 0x10 +#define REG_C_IRQF 0x80 +#define REG_C_PF 0x40 +#define REG_C_AF 0x20 struct RTCState { uint8_t cmos_data[128]; @@ -561,6 +568,21 @@ static int rtc_load_td(QEMUFile *f, void *opaque, int version_id) } #endif +static void rtc_reset(void *opaque) +{ + RTCState *s = opaque; + + s->cmos_data[RTC_REG_B] &= ~(REG_B_PIE | REG_B_AIE | REG_B_SQWE); + s->cmos_data[RTC_REG_C] &= ~(REG_C_UF | REG_C_IRQF | REG_C_PF | REG_C_AF); + + qemu_irq_lower(s->irq); + +#ifdef TARGET_I386 + if (rtc_td_hack) + s->irq_coalesced = 0; +#endif +} + RTCState *rtc_init(int base, qemu_irq irq) { RTCState *s; @@ -599,6 +621,8 @@ RTCState *rtc_init(int base, 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, s); + return s; } @@ -709,5 +733,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, s); return s; } |