aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2010-07-05 11:36:34 +0300
committerAnthony Liguori <aliguori@us.ibm.com>2010-07-06 10:36:27 -0500
commitf292787d9addffd5f0a2df9516c158bfb5792b61 (patch)
treeb2d0f5fb5473bae6cd720514eb5583e7a17a4e87
parent680a34eeb8f2d455121c67697fca146440e61612 (diff)
make rtc alatm work
Convert alarm time from BCD if needed before comparing with current time. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--hw/mc146818rtc.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c
index c3459bf605..2b91fa839e 100644
--- a/hw/mc146818rtc.c
+++ b/hw/mc146818rtc.c
@@ -214,7 +214,6 @@ static void cmos_ioport_write(void *opaque, uint32_t addr, uint32_t data)
case RTC_SECONDS_ALARM:
case RTC_MINUTES_ALARM:
case RTC_HOURS_ALARM:
- /* XXX: not supported */
s->cmos_data[s->cmos_index] = data;
break;
case RTC_SECONDS:
@@ -414,11 +413,11 @@ static void rtc_update_second2(void *opaque)
/* check alarm */
if (s->cmos_data[RTC_REG_B] & REG_B_AIE) {
if (((s->cmos_data[RTC_SECONDS_ALARM] & 0xc0) == 0xc0 ||
- s->cmos_data[RTC_SECONDS_ALARM] == s->current_tm.tm_sec) &&
+ rtc_from_bcd(s, s->cmos_data[RTC_SECONDS_ALARM]) == s->current_tm.tm_sec) &&
((s->cmos_data[RTC_MINUTES_ALARM] & 0xc0) == 0xc0 ||
- s->cmos_data[RTC_MINUTES_ALARM] == s->current_tm.tm_mon) &&
+ rtc_from_bcd(s, s->cmos_data[RTC_MINUTES_ALARM]) == s->current_tm.tm_min) &&
((s->cmos_data[RTC_HOURS_ALARM] & 0xc0) == 0xc0 ||
- s->cmos_data[RTC_HOURS_ALARM] == s->current_tm.tm_hour)) {
+ rtc_from_bcd(s, s->cmos_data[RTC_HOURS_ALARM]) == s->current_tm.tm_hour)) {
s->cmos_data[RTC_REG_C] |= 0xa0;
qemu_irq_raise(s->irq);