From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MDyUM-0002lo-9W for qemu-devel@nongnu.org; Tue, 09 Jun 2009 06:23:30 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MDyUH-0002lP-IW for qemu-devel@nongnu.org; Tue, 09 Jun 2009 06:23:29 -0400 Received: from [199.232.76.173] (port=39166 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MDyUH-0002lM-Eu for qemu-devel@nongnu.org; Tue, 09 Jun 2009 06:23:25 -0400 Received: from gecko.sbs.de ([194.138.37.40]:19208) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MDyUG-0003H8-Sr for qemu-devel@nongnu.org; Tue, 09 Jun 2009 06:23:25 -0400 Message-ID: <4A2E3819.8050509@siemens.com> Date: Tue, 09 Jun 2009 12:23:21 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <20090609092605.GU27210@redhat.com> In-Reply-To: <20090609092605.GU27210@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCHv2] Add rtc reset function. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gleb Natapov Cc: qemu-devel@nongnu.org Gleb Natapov wrote: > 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 > diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c > index 888b85a..8c446e1 100644 > --- a/hw/mc146818rtc.c > +++ b/hw/mc146818rtc.c > @@ -57,6 +57,11 @@ > #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]; > uint8_t cmos_index; > @@ -568,6 +573,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; Sorry, missed that on first run: Isn't it safer, clearer, more beautiful to reset this unconditionally? Jan