From: Bernhard Kauer Date: Wed, 2 Sep 2009 07:49:05 +0000 (+0200) Subject: RTC polling mode broken X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~1405^2~17^2~7024 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=98815437f731372d9456f6a2ad103f3b836a9646;p=sdk%2Femulator%2Fqemu.git RTC polling mode broken The RTC emulation does not set the IRQ flags independent of the IRQ enable bits. The original MC146818A datasheet from 1984 notes: "flag bits in Register C [...] are set independent of the state of the corresponding enable bits in Register B" Similar sections can be found in newer documentation e.g. in rtc82885. Qemu and Bochs set the IRQ flags only if they are enabled, which breaks drivers polling on them. The following patch corrects this for the update-ended-flag in Qemu only. It does not fix the handling of the other flags. Signed-off-by: Bernhard Kauer Signed-off-by: Anthony Liguori --- diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c index 5c8676ef68..5f1760c58c 100644 --- a/hw/mc146818rtc.c +++ b/hw/mc146818rtc.c @@ -421,9 +421,10 @@ static void rtc_update_second2(void *opaque) } /* update ended interrupt */ + s->cmos_data[RTC_REG_C] |= REG_C_UF; if (s->cmos_data[RTC_REG_B] & REG_B_UIE) { - s->cmos_data[RTC_REG_C] |= 0x90; - rtc_irq_raise(s->irq); + s->cmos_data[RTC_REG_C] |= REG_C_IRQF; + rtc_irq_raise(s->irq); } /* clear update in progress bit */