Skip to contentSkip to conversation

make rtc alatm work

PATCH Applied Gleb Natapov 2 participants 2 messages Jul 5, 2010 – Jul 6, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 make rtc alatm work

Convert alarm time from BCD if needed before comparing with current time.

hw/mc146818rtc.c +3 -4
index c3459bf..2b91fa8 100644
@@ -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);

--
Gleb.

#1 lore raw
Quoted 5 lines · Gleb Natapov

Convert alarm time from BCD if needed before comparing with current time.

Applied. Thanks.

Regards,

Anthony Liguori

Quoted 32 lines
hw/mc146818rtc.c +3 -5
index c3459bf..2b91fa8 100644
@@ -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);
--

Gleb.