Date: Mon, 14 Jul 2003 22:16:10 -0500 From: David Kelly <dkelly@HiWAAY.net> To: FreeBSD-Questions@FreeBSD.org Subject: Re: Seting the hardware clock Message-ID: <200307142216.10191.dkelly@HiWAAY.net> In-Reply-To: <5.1.0.14.2.20030714201034.00a742b0@209.152.117.178> References: <20030714231604.GA27924@teddy.fas.com> <5.1.0.14.2.20030714201034.00a742b0@209.152.117.178>
next in thread | previous in thread | raw e-mail | index | archive | help
On Monday 14 July 2003 08:11 pm, W. D. wrote: > At 19:24 7/14/2003, David Kelly, wrote: > >Another thing we saw with Soekris and FreeBSD 4.x was that FreeBSD > > wrote Sunday as 0 but would accept 0 or 7 on read, Soekris clock > > hardware was happy with 0, but BIOS demanded 7 else it assumed the > > clock was corrupt and reset its time to Jan 1, 1980. This only > > mattered if you rebooted on Sunday. Its a 2 byte patch to FreeBSD > > 4.x, already included in 5.x. > > Where would one find this 2 byte patch for 4.7? Look for messages from phk in the soekris-tech mail list archives at http://www.soekris.com/ to be sure of finding the right thing. Nosing around a bit I believe the file is /usr/src/sys/i386/isa/clock.c. The fixed version (copied from 5.1): writertc(RTC_WDAY, (tm + 4) % 7 + 1); /* Write back Weekday */ The old version ("+ 1" hacked out of above): writertc(RTC_WDAY, (tm + 4) % 7 ); /* Write back Weekday */ % cvs log /usr/src/sys/i386/isa/clock.c says: revision 1.191 date: 2002/12/04 13:46:49; author: phk; state: Exp; lines: +1 -1 Use the correct value when writing the Day Of Week byte in the CMOS. The correct range is [1...7] with Sunday=1, but we have been writing [0...6] with Sunday=0. The Soekris computers flagged the zero, zapped the date, so if you rebooted your soekris on a sunday, it would come up with a wrong date. Bruce has a more extensive rework of this code, but we will stick with the minimalist fix for now. Spotted by: Soren Kristensen <soren@soekris.com> Thanks to: Michael Sierchio <kudzu@tenebras.com>. Confirmed by: bde Approved by: re IIRC the comment above about Sunday is incorrect. Have been using 0, but 7 (not 1) is correct. I believe 1-6 is still Monday thru Saturday in both versions. But I'm not going to sweat it tonight. Both versions work on most BIOS's. -- David Kelly N4HHE, dkelly@hiwaay.net ===================================================================== The human mind ordinarily operates at only ten percent of its capacity -- the rest is overhead for the operating system.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200307142216.10191.dkelly>