i386/113540: decrease i8254 calibration precision to make it work with Xbox, remove warnings

Ed Schouten ed at fxq.nl
Mon Jun 11 08:53:12 UTC 2007


Hello Bruce,

* Bruce Evans <brde at optusnet.com.au> wrote:
>  On Sun, 10 Jun 2007, Ed Schouten wrote:
> [...]
> > - It decreases the precision of the timer (by default disabled) timer
> >  calibration code from 1% to 10%; this is needed because the Xbox clock
> >  is 6% off.
> 
>  Is it only 6% off because the default is 6% off?  The error margin is
>  supposed to be just a sanity check, but if the i8254 clock frequency is
>  not required to be nearly 1193182 then this frequency can be almost
>  anything in theory and no sanity check works.

On all Xboxes it's 6% off.

> > - It removes the hardcoded Xbox timer value from the Xbox configuration
> >  file and enables timer calibration.
> 
>  I hope to remove the timer calibration.  It was mainly for RTC calibration,
>  but that most important part of it has been axed.  In practice, the i8254
>  has always been nearly 1193182 until now, with an error of about the same
>  as for the RTC, so it doesn't matter which of these is used as a reference.
>  What I do now is not worry much about initial calibration; then fix up
>  the frequencies of all timecounters in /etc/rc.local, using the results
>  of more accurate calibrations previously done in userland.  Unfortunately,
>  this requires a lot of setup (ntpd might be able to do it automatically
>  but might take years to stabilize if the initial frequencies are very
>  inaccurate).

So what do you think about this patch:

	http://g-rave.nl/junk/freebsd-xbox-clock.diff

We don't depend on the calibration code anymore, but just set the new
standard timer frequency in i8254_init(). It doesn't touch any existing
code outside ifdef's.

> [...]
> 
>  Does XBOX have any other timers/timecounters that might give a more
>  suitable reference?

As far as I know, they don't. Xbox'es don't have ACPI, so that means we
can't use things like the HPET. The only two counters that show up are:

| Timecounter "i8254" frequency 1124993 Hz quality 0
| Timecounter "TSC" frequency 733333526 Hz quality 800

Yours,
-- 
 Ed Schouten <ed at fxq.nl>
 WWW: http://g-rave.nl/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-i386/attachments/20070611/57af6788/attachment.pgp


More information about the freebsd-i386 mailing list