From patchwork Mon Jul 5 08:36:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 57871 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C3F54B6F17 for ; Mon, 5 Jul 2010 18:37:29 +1000 (EST) Received: from localhost ([127.0.0.1]:40809 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OVhB7-0005Ch-UK for incoming@patchwork.ozlabs.org; Mon, 05 Jul 2010 04:37:25 -0400 Received: from [140.186.70.92] (port=56639 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OVhAM-0005Ca-UR for qemu-devel@nongnu.org; Mon, 05 Jul 2010 04:36:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OVhAL-0004S0-OT for qemu-devel@nongnu.org; Mon, 05 Jul 2010 04:36:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39908) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OVhAL-0004Ri-EK for qemu-devel@nongnu.org; Mon, 05 Jul 2010 04:36:37 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o658aZL1004037 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 5 Jul 2010 04:36:36 -0400 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o658aZgk012954 for ; Mon, 5 Jul 2010 04:36:35 -0400 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 13519) id B9C1318D472; Mon, 5 Jul 2010 11:36:34 +0300 (IDT) Date: Mon, 5 Jul 2010 11:36:34 +0300 From: Gleb Natapov To: qemu-devel@nongnu.org Message-ID: <20100705083634.GL4689@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH] make rtc alatm work X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Convert alarm time from BCD if needed before comparing with current time. Signed-off-by: Gleb Natapov --- Gleb. diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c index c3459bf..2b91fa8 100644 --- a/hw/mc146818rtc.c +++ b/hw/mc146818rtc.c @@ -214,7 +214,6 @@ static void cmos_ioport_write(void *opaque, uint32_t addr, uint32_t data) case RTC_SECONDS_ALARM: case RTC_MINUTES_ALARM: case RTC_HOURS_ALARM: - /* XXX: not supported */ s->cmos_data[s->cmos_index] = data; break; case RTC_SECONDS: @@ -414,11 +413,11 @@ static void rtc_update_second2(void *opaque) /* check alarm */ if (s->cmos_data[RTC_REG_B] & REG_B_AIE) { if (((s->cmos_data[RTC_SECONDS_ALARM] & 0xc0) == 0xc0 || - s->cmos_data[RTC_SECONDS_ALARM] == s->current_tm.tm_sec) && + rtc_from_bcd(s, s->cmos_data[RTC_SECONDS_ALARM]) == s->current_tm.tm_sec) && ((s->cmos_data[RTC_MINUTES_ALARM] & 0xc0) == 0xc0 || - s->cmos_data[RTC_MINUTES_ALARM] == s->current_tm.tm_mon) && + rtc_from_bcd(s, s->cmos_data[RTC_MINUTES_ALARM]) == s->current_tm.tm_min) && ((s->cmos_data[RTC_HOURS_ALARM] & 0xc0) == 0xc0 || - s->cmos_data[RTC_HOURS_ALARM] == s->current_tm.tm_hour)) { + rtc_from_bcd(s, s->cmos_data[RTC_HOURS_ALARM]) == s->current_tm.tm_hour)) { s->cmos_data[RTC_REG_C] |= 0xa0; qemu_irq_raise(s->irq);