From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MDfc1-000497-PF for qemu-devel@nongnu.org; Mon, 08 Jun 2009 10:14:09 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MDfbw-00043v-Ot for qemu-devel@nongnu.org; Mon, 08 Jun 2009 10:14:09 -0400 Received: from [199.232.76.173] (port=34323 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MDfbw-00043j-IM for qemu-devel@nongnu.org; Mon, 08 Jun 2009 10:14:04 -0400 Received: from mx2.redhat.com ([66.187.237.31]:50263) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MDfbw-00087I-1w for qemu-devel@nongnu.org; Mon, 08 Jun 2009 10:14:04 -0400 Date: Mon, 8 Jun 2009 17:13:57 +0300 From: Gleb Natapov Message-ID: <20090608141357.GK27210@redhat.com> References: <1244465766-6349-1-git-send-email-gleb@redhat.com> <4A2D1AAF.4090406@siemens.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4A2D1AAF.4090406@siemens.com> Subject: [Qemu-devel] Re: [PATCH 1/3] Add rtc reset function. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: qemu-devel@nongnu.org On Mon, Jun 08, 2009 at 04:05:35PM +0200, Jan Kiszka wrote: > 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 > > --- > > hw/mc146818rtc.c | 19 +++++++++++++++++++ > > 1 files changed, 19 insertions(+), 0 deletions(-) > > > > diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c > > index 888b85a..98a2273 100644 > > --- a/hw/mc146818rtc.c > > +++ b/hw/mc146818rtc.c > > @@ -568,6 +568,22 @@ static int rtc_load_td(QEMUFile *f, void *opaque, int version_id) > > } > > #endif > > > > +static void rtc_reset(void *opaque) > > +{ > > + RTCState *s = opaque; > > + > > + /* clear PIE,AIE,SQWE on reset */ > > + s->cmos_data[RTC_REG_B] &= ~((1<<6) | (1<<5) | (1<<3)); > > + > > + /* clear UF,IRQF,PF,AF on reset */ > > + s->cmos_data[RTC_REG_C] &= ~((1<<4) | (1<<7) | (1<<6) | (1<<5)); > > Didn't check what the rest of this file does, but maybe it's a chance to > give those bits names, ie. #define something. > Part of them already has names, I'll define rest. > > + > > +#ifdef TARGET_I386 > > + if (rtc_td_hack) > > + s->irq_coalesced = 0; > > +#endif > > +} > > + > > RTCState *rtc_init_sqw(int base, qemu_irq irq, qemu_irq sqw_irq, int base_year) > > { > > RTCState *s; > > @@ -606,6 +622,8 @@ RTCState *rtc_init_sqw(int base, qemu_irq irq, qemu_irq sqw_irq, int base_year) > > if (rtc_td_hack) > > register_savevm("mc146818rtc-td", base, 1, rtc_save_td, rtc_load_td, s); > > #endif > > + qemu_register_reset(rtc_reset, 0, s); > > + > > return s; > > } > > > > @@ -721,5 +739,6 @@ RTCState *rtc_mm_init(target_phys_addr_t base, int it_shift, qemu_irq irq, > > if (rtc_td_hack) > > register_savevm("mc146818rtc-td", base, 1, rtc_save_td, rtc_load_td, s); > > #endif > > + qemu_register_reset(rtc_reset, 0, s); > > return s; > > } > > Jan > > -- > Siemens AG, Corporate Technology, CT SE 2 > Corporate Competence Center Embedded Linux -- Gleb.