Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Dec 1998 00:26:41 +0200 (SAT)
From:      Robert Nordier <rnordier@nordier.com>
To:        robert+freebsd@cyrus.watson.org
Cc:        jbryant@unix.tfs.net, freebsd-hackers@FreeBSD.ORG
Subject:   Re: Year 2k and PC hardware
Message-ID:  <199812022226.AAA12106@ceia.nordier.com>
In-Reply-To: <Pine.BSF.3.96.981202154058.5892B-100000@fledge.watson.org> from Robert Watson at "Dec 2, 98 03:41:53 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
Robert Watson wrote:

> On Wed, 2 Dec 1998, Jim Bryant wrote:
> 
> > In reply:
> > > Having recently visited the web pages of a number of the hardware vendors
> > > of machines I run FreeBSD on, I am a little concerned about some of the
> > > older machines.  For example, Gateway 2000 refers to BIOS fixes for
> > > >= pentium machines that fix the bios access functions for the real time
> > > clock.  However, they note that the fix does not apply if the OS attempts
> > > to access the RTC directly (I'm not sure what this means -- I don't know
> > > how the RTC is implemented on PC machines).  Similarly, Dell suggested the
> > 
> > the original ibm at, and every "compatable" rtc on the market stores
> > the year as a 4 digit bcd number.  hardware problem solved, circa
> > 1984.
>
> Gateway 2000 seems to dispute this claim -- not that I necessarily believe
> everything they say (I'm not impressed by GW2K), I am concerned by the
> seeming inconsistency:
> 
> http://www.gateway2000.com/frameset2.asp?s=corp&p=support&a=&url=/corp/y2k/y2k/default.html
[ ... ]

The Gateway 2000 explanation is essentially correct.  The PC RTC is a
Motorola MC146818 or compatible chip which presents itself as 64 bytes
of CMOS memory.  The first 14 bytes are wired to the RTC clock itself;
the remaining 50 bytes are storage only (not updated by the RTC logic)
and are intended for passive retention of configuration data.

The year is accessible at offset 0x9 in BCD (00-99).  The century is
stored at offset 0x32 (on standard PCs) usually also in BCD (eg. 19),
but this is not part of the RTC, just of the CMOS storage area.

To correct the problem, logic would typically examine the RTC "year"
value and apply a common-sense correction such as:

    century = year >= 70 ? 19 : 20;

If the PC BIOS correctly honors the century (offset 0x32) value, a
once-off correction may be all that's needed; and this could even be
done by hand.  Otherwise, resident real address mode code would have
to be loaded (a TSR or device driver).

That "fixes" the BIOS, which would be the concern of the hardware
vendor.

However, whether the BIOS was fixed or not, most recent operating
systems including FreeBSD, would have an option to apply a similar
{0-69, 70-99} interpretation to the RTC year value.

For FreeBSD handling of the RTC, see src/sys/i386/isa/clock.c.

-- 
Robert Nordier

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199812022226.AAA12106>