From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MR24c-0001S6-Th for qemu-devel@nongnu.org; Wed, 15 Jul 2009 06:50:54 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MR24X-0001Pw-Lu for qemu-devel@nongnu.org; Wed, 15 Jul 2009 06:50:53 -0400 Received: from [199.232.76.173] (port=40895 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MR24X-0001Pf-HH for qemu-devel@nongnu.org; Wed, 15 Jul 2009 06:50:49 -0400 Received: from os.inf.tu-dresden.de ([141.76.48.99]:34687) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MR24X-0001Lr-3s for qemu-devel@nongnu.org; Wed, 15 Jul 2009 06:50:49 -0400 Date: Wed, 15 Jul 2009 12:50:43 +0200 From: Bernhard Kauer Message-ID: <20090715105043.GA26311@chrom.inf.tu-dresden.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] RTC polling mode broken List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: bochs-developers@lists.sourceforge.net The RTC emulation does not set the IRQ flags independent of the IRQ enable bits. The original MC146818A datasheet from 1964 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 currently does not fix the handling of the other flags. Signed-off-by: Bernhard Kauer diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c index 2022548..2b040a7 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 */