From owner-svn-src-projects@FreeBSD.ORG Sun Dec 16 16:57:53 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3709418D; Sun, 16 Dec 2012 16:57:53 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wg0-f52.google.com (mail-wg0-f52.google.com [74.125.82.52]) by mx1.freebsd.org (Postfix) with ESMTP id 695998FC0A; Sun, 16 Dec 2012 16:57:51 +0000 (UTC) Received: by mail-wg0-f52.google.com with SMTP id 12so2179206wgh.31 for ; Sun, 16 Dec 2012 08:57:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=EMoi6sAKTVjGiUwmfdZir7Y0zkIvSuAPjlG0q8l45yg=; b=Atr2FleW9Hus6C8GN90C5+txVQoU948tYX9R8Xeq29Hfrl2Yiakiw20VZHImSA2atS 4ymlnEspZQHT/c0wuczXsRALsdBLDxKh0N3UWQgVnc04FfzNZgG3KzIEYihmUDJTKR/U HSEWRbdaqPciYhCDSQou0J6ToOMX+RCgx2s2Z363sRjRf3uo4ygx+JreqiaSkPpCFYFN o8fG9pkVpX4WFYlfL0mFto4nZcFdVVudb4iXBcGtPXOVwYwHt1NrskMso7ZtzE/z04En xfdecOhLvifYqHBf4+3Kv4vpT5c45P3f1z2uZNwhT6xJhYdt2crhDKAPdwmTQ7cU+ljT ZRyQ== MIME-Version: 1.0 Received: by 10.194.93.40 with SMTP id cr8mr12872526wjb.16.1355677071296; Sun, 16 Dec 2012 08:57:51 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.217.57.9 with HTTP; Sun, 16 Dec 2012 08:57:51 -0800 (PST) In-Reply-To: <201212161116.qBGBGEwn063983@svn.freebsd.org> References: <201212161116.qBGBGEwn063983@svn.freebsd.org> Date: Sun, 16 Dec 2012 08:57:51 -0800 X-Google-Sender-Auth: ys1dizEOPe2Bm8NWqvtFRsoGIEU Message-ID: Subject: Re: svn commit: r244287 - projects/calloutng/sys/x86/isa From: Adrian Chadd To: Alexander Motin Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2012 16:57:53 -0000 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. Thanks, Adrian On 16 December 2012 03:16, Alexander Motin 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); > }