qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: [PATCH 1/3] Add rtc reset function.


From: Jan Kiszka
Subject: [Qemu-devel] Re: [PATCH 1/3] Add rtc reset function.
Date: Mon, 08 Jun 2009 16:05:35 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

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 <address@hidden>
> ---
>  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.

> +
> +#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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]