From owner-freebsd-sparc64@FreeBSD.ORG Sun Sep 19 21:52:10 2004 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 35CD716A4CE for ; Sun, 19 Sep 2004 21:52:10 +0000 (GMT) Received: from newtrinity.zeist.de (newtrinity.zeist.de [217.24.217.8]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6B0DC43D46 for ; Sun, 19 Sep 2004 21:52:09 +0000 (GMT) (envelope-from marius@newtrinity.zeist.de) Received: from newtrinity.zeist.de (localhost [127.0.0.1]) i8JLq71a097069 for ; Sun, 19 Sep 2004 23:52:07 +0200 (CEST) (envelope-from marius@newtrinity.zeist.de) Received: (from marius@localhost) by newtrinity.zeist.de (8.12.10/8.12.10/Submit) id i8JLq2be097068 for freebsd-sparc64@freebsd.org; Sun, 19 Sep 2004 23:52:02 +0200 (CEST) (envelope-from marius) Date: Sun, 19 Sep 2004 23:52:02 +0200 From: Marius Strobl To: freebsd-sparc64@freebsd.org Message-ID: <20040919235202.A68697@newtrinity.zeist.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i X-AntiVirus: checked by AntiVir Milter 1.1-beta; AVE 6.27.0.11; VDF 6.27.0.67 (host: newtrinity.zeist.de) Subject: HEADS UP [marius@freebsd.org: cvs commit: src/sys/dev/mk48txx mk48txx.c mk48txxreg.h] X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2004 21:52:10 -0000 As this commit changes the format FreeBSD stores the date in the clock of the 'eeprom' device you will get another "Invalid time in real time clock. Check and reset the date immediately!" after updating when the date was previously set using FreeBSD. To get rid of it set the date again with date(1) or ntpdate(8). Modified files: sys/dev/mk48txx mk48txx.c mk48txxreg.h Log: - Some of the upper bits of the time related (seconds, minutes, etc.) registers are control bits or depending on the model contain additional time bits with a different meaning than the lower ones. In order to only read the desired time bits and not change the upper bits on write use appropriate masks in the gettime and settime function respectively. Due to the polarity of the stop oscillator bit and the fact that the century bits aren't used on sparc64 not masking them didn't cause problems so far. - Fix two off-by-one errors in the handling of the day of week. The genclock code represents the dow as 0 - 6 with 0 being Sunday but the mk48txx use 1 - 7 with 1 being Sunday. In the settime function when writing the dow to the clock the range wasn't adjusted accordingly but the clock apparently played along nicely otherwise the second bug in the gettime function which mapped 1 - 7 to 0 - 6 but with 0 meaning Saturday would have been triggered. Fixing these makes the date being stored in the same format Sun/Solaris uses and cures the "Invalid time in real time clock. Check and reset the date immediately!" when the date was set under Solaris prior to booting FreeBSD/sparc64. [1] Looking at other clock drivers/code e.g. FreeBSD/alpha the former "bug", i.e. storing the dow as 0 - 6 even when the clock uses 1 - 7, seems to be common but might be on purpose for compatibility when multi-booting with other OS which do the same. So it might make sense to add a flag to handle the dow off-by-one for use of this driver on platforms other than sparc64. - Check the state of the battery on mk48txx that support this in the attach function. - Add a note that use of the century bit should be implemented but isn't required at the moment because it isn't used on sparc64. Problem noted by: joerg [1] MT5 candidate. Revision Changes Path 1.4 +53 -14 src/sys/dev/mk48txx/mk48txx.c 1.2 +78 -5 src/sys/dev/mk48txx/mk48txxreg.h