Date: Mon, 11 Jun 2007 22:13:26 +1000 (EST) From: Bruce Evans <brde@optusnet.com.au> To: Ed Schouten <ed@fxq.nl> Cc: FreeBSD-gnats-submit@FreeBSD.org, freebsd-i386@FreeBSD.org Subject: Re: i386/113540: decrease i8254 calibration precision to make it work with Xbox, remove warnings Message-ID: <20070611203755.Y10311@besplex.bde.org> In-Reply-To: <20070611083745.GL89502@hoeg.nl> References: <20070610201813.B11831CCB7@palm.hoeg.nl> <20070611132137.G7222@besplex.bde.org> <20070611083745.GL89502@hoeg.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 11 Jun 2007, Ed Schouten wrote: > * Bruce Evans <brde@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. I mean, is it always different from the current default of 1193182 by about -6%. A 6% difference depending on the machine sub-type would be surprising. >>> - 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, >> ... > > 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. That's much simpler. Grep for TIMER_FREQ and values like 119 and 149 in the kernel and in utilities like kbdcontrol and you will find a few more problems. The variable is supposed to be used, but some places use the macro or worse. The spkr driver seems to do everything correctly, but everything else has messes converting from "pitch"es to periods in i8254 timer ticks. The magic numbers here are: - 119 = first few digits of 1193182. 1193182 may be found in kbdcontrol.c. - 149 = first few digits of 1491 = the period in 1193182-Hz timer ticks for the intended syscons default bell frequncy of BELL_PITCH = 800 Hz = the frequency that results from not converting BELL_PITCH to 1193182-Hz timer ticks. 1491 may be found miscalculated as 1493 in the dead pcvt driver. Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070611203755.Y10311>