Date: Sun, 16 Dec 2012 19:10:51 +0200 From: Alexander Motin <mav@FreeBSD.org> To: Adrian Chadd <adrian@freebsd.org> Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r244287 - projects/calloutng/sys/x86/isa Message-ID: <50CE009B.7010804@FreeBSD.org> In-Reply-To: <CAJ-VmonYuh4dTwY9PjBmE4uOq8nNAL_kDKXpi6knwvc99PqJcw@mail.gmail.com> References: <201212161116.qBGBGEwn063983@svn.freebsd.org> <CAJ-VmonYuh4dTwY9PjBmE4uOq8nNAL_kDKXpi6knwvc99PqJcw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 16.12.2012 18:57, Adrian Chadd wrote: > Have you guys even remotely verified that all the weird i8254 clones > support this operation? > > Considering our track record with breaking some of the legacy hardware > (and preventing stable operation on things like Alix boards), I'd > really like to see this particular option hide behind a runtime or > build config twiddle. This change affects only one-shot operation mode of i8254 eventtimer, which we can't enable by default because it can't coexist with i8254 timecounter, which we can't disable by default because we can't be sure that there is any other timecounter. That is why I've written about fun. And no, I have no all possible weird i8254 clones to test, so any help and ideas are welcome. :) > On 16 December 2012 03:16, Alexander Motin <mav@freebsd.org> wrote: >> Author: mav >> Date: Sun Dec 16 11:16:13 2012 >> New Revision: 244287 >> URL: http://svnweb.freebsd.org/changeset/base/244287 >> >> Log: >> Mostly out of fun, teach i8254 eventtimer driver to program only LSB for >> very short time intervals (<214us). This allows to get less then 22us >> usleep(1) time from this anscient timer. It is even better then HPET time >> now, just with much higher CPU usage. >> >> Modified: >> projects/calloutng/sys/x86/isa/clock.c >> >> Modified: projects/calloutng/sys/x86/isa/clock.c >> ============================================================================== >> --- projects/calloutng/sys/x86/isa/clock.c Sun Dec 16 10:12:40 2012 (r244286) >> +++ projects/calloutng/sys/x86/isa/clock.c Sun Dec 16 11:16:13 2012 (r244287) >> @@ -125,6 +125,7 @@ struct attimer_softc { >> static struct attimer_softc *attimer_sc = NULL; >> >> static int timer0_period = -2; >> +static int timer0_last = 0xffff; >> >> /* Values for timerX_state: */ >> #define RELEASED 0 >> @@ -433,11 +434,17 @@ set_i8254_freq(int mode, uint32_t period >> outb(TIMER_CNTR0, new_count >> 8); >> break; >> case MODE_ONESHOT: >> + if (new_count < 256 && timer0_last < 256) { >> + outb(TIMER_MODE, TIMER_SEL0 | TIMER_INTTC | TIMER_LSB); >> + outb(TIMER_CNTR0, new_count & 0xff); >> + break; >> + } >> outb(TIMER_MODE, TIMER_SEL0 | TIMER_INTTC | TIMER_16BIT); >> outb(TIMER_CNTR0, new_count & 0xff); >> outb(TIMER_CNTR0, new_count >> 8); >> break; >> } >> + timer0_last = new_count; >> out: >> mtx_unlock_spin(&clock_lock); >> } -- Alexander Motin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?50CE009B.7010804>