1522a3b5fSAlexander Motin.\" Copyright (c) 2010 Alexander Motin <mav@FreeBSD.org> 2d1108778SAlexander Motin.\" All rights reserved. 3d1108778SAlexander Motin.\" 4d1108778SAlexander Motin.\" Redistribution and use in source and binary forms, with or without 5d1108778SAlexander Motin.\" modification, are permitted provided that the following conditions 6d1108778SAlexander Motin.\" are met: 7d1108778SAlexander Motin.\" 1. Redistributions of source code must retain the above copyright 8d1108778SAlexander Motin.\" notice, this list of conditions and the following disclaimer. 9d1108778SAlexander Motin.\" 2. Redistributions in binary form must reproduce the above copyright 10d1108778SAlexander Motin.\" notice, this list of conditions and the following disclaimer in the 11d1108778SAlexander Motin.\" documentation and/or other materials provided with the distribution. 12d1108778SAlexander Motin.\" 13522a3b5fSAlexander Motin.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14522a3b5fSAlexander Motin.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15522a3b5fSAlexander Motin.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16522a3b5fSAlexander Motin.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17522a3b5fSAlexander Motin.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18522a3b5fSAlexander Motin.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19522a3b5fSAlexander Motin.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20522a3b5fSAlexander Motin.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21522a3b5fSAlexander Motin.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22522a3b5fSAlexander Motin.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23522a3b5fSAlexander Motin.\" SUCH DAMAGE. 24d1108778SAlexander Motin.\" 25d1108778SAlexander Motin.Dd September 14, 2010 26d1108778SAlexander Motin.Dt HPET 4 27d1108778SAlexander Motin.Os 28d1108778SAlexander Motin.Sh NAME 29d1108778SAlexander Motin.Nm hpet 30d1108778SAlexander Motin.Nd High Precision Event Timer driver 31d1108778SAlexander Motin.Sh SYNOPSIS 32d1108778SAlexander MotinTo compile this driver into the kernel, 33d1108778SAlexander Motinplace the following lines in your 34d1108778SAlexander Motinkernel configuration file: 35d1108778SAlexander Motin.Bd -ragged -offset indent 36d1108778SAlexander Motin.Cd "device acpi" 37d1108778SAlexander Motin.Ed 38d1108778SAlexander Motin.Pp 39d1108778SAlexander MotinThe following tunables are settable from the 40d1108778SAlexander Motin.Xr loader 8 : 41d1108778SAlexander Motin.Bl -ohang 42d1108778SAlexander Motin.It Va hint.hpet. Ns Ar X Ns Va .allowed_irqs 43*25972509SEdward Tomasz Napieralais a 32bit mask. 44*25972509SEdward Tomasz NapieralaEach set bit allows driver to use respective IRQ, 45d1108778SAlexander Motinif BIOS also set respective capability bit in comparator's configuration 46d1108778SAlexander Motinregister. 47d1108778SAlexander MotinDefault value is 0xffff0000, except some known broken hardware. 48d1108778SAlexander Motin.It Va hint.hpet. Ns Ar X Ns Va .clock 49*25972509SEdward Tomasz Napieralacontrols event timers functionality support. 50*25972509SEdward Tomasz NapieralaSetting to 0, disables it. 51d1108778SAlexander MotinDefault value is 1. 52d1108778SAlexander Motin.It Va hint.hpet. Ns Ar X Ns Va .legacy_route 53*25972509SEdward Tomasz Napieralacontrols "LegacyReplacement Route" mode. 54*25972509SEdward Tomasz NapieralaIf enabled, HPET will steal IRQ0 of i8254 timer and IRQ8 of RTC. 55*25972509SEdward Tomasz NapieralaBefore using it, make sure that respective 56d1108778SAlexander Motindrivers are not using interrupts, by setting also: 57d1108778SAlexander Motin.Bd -literal 58d1108778SAlexander Motinhint.attimer.0.clock=0 59d1108778SAlexander Motinhint.atrtc.0.clock=0 60d1108778SAlexander Motin.Ed 61d1108778SAlexander MotinDefault value is 0. 62d1108778SAlexander Motin.It Va hint.hpet. Ns Ar X Ns Va .per_cpu 63d1108778SAlexander Motincontrols how much per-CPU event timers should driver attempt to register. 64d1108778SAlexander MotinThis functionality requires every comparator in a group to have own unshared 65d1108778SAlexander MotinIRQ, so it depends on hardware capabilities and interrupts configuration. 66d1108778SAlexander MotinDefault value is 1. 67d1108778SAlexander Motin.El 68d1108778SAlexander Motin.Sh DESCRIPTION 69d1108778SAlexander MotinThis driver uses High Precision Event Timer hardware (part of the chipset, 70d1108778SAlexander Motinusually enumerated via ACPI) to supply kernel with one time counter and 71d1108778SAlexander Motinseveral (usually from 3 to 8) event timers. 72d1108778SAlexander MotinThis hardware includes single main counter with known increment frequency 737480c2a5SAlexander Motin(10MHz or more), and several programmable comparators (optionally with 74d1108778SAlexander Motinautomatic reload feature). 75d1108778SAlexander MotinWhen value of the main counter matches current value of any comparator, 76d1108778SAlexander Motininterrupt can be generated. 77d1108778SAlexander MotinDepending on hardware capabilities and configuration, interrupt can be 78d1108778SAlexander Motindelivered as regular I/O APIC interrupt (ISA or PCI) in range from 0 to 31, 79d1108778SAlexander Motinor as Front Side Bus interrupt, alike to PCI MSI interrupts, or in so called 807480c2a5SAlexander Motin"LegacyReplacement Route" HPET can steal IRQ0 of i8254 and IRQ8 of the RTC. 81*25972509SEdward Tomasz NapieralaInterrupt can be either edge- or level-triggered. 82*25972509SEdward Tomasz NapieralaIn last case they could be safely shared with PCI IRQs. 83d1108778SAlexander MotinDriver prefers to use FSB interrupts, if supported, to avoid sharing. 84d1108778SAlexander MotinIf it is not possible, it uses single sharable IRQ from PCI range. 85d1108778SAlexander MotinOther modes (LegacyReplacement and ISA IRQs) require special care to setup, 86d1108778SAlexander Motinbut could be configured manually via device hints. 87d1108778SAlexander Motin.Pp 88d1108778SAlexander MotinEvent timers provided by the driver support both one-shot an periodic modes 89d1108778SAlexander Motinand irrelevant to CPU power states. 90d1108778SAlexander Motin.Pp 91d1108778SAlexander MotinDepending on hardware capabilities and configuration, driver can expose each 92d1108778SAlexander Motincomparator as separate event timer or group them into one or several per-CPU 93*25972509SEdward Tomasz Napieralaevent timers. 94*25972509SEdward Tomasz NapieralaIn last case interrupt of every of those comparators within 95*25972509SEdward Tomasz Napieralagroup is bound to specific CPU core. 96*25972509SEdward Tomasz NapieralaThis is possible only when each of these comparators has own unsharable IRQ. 97d1108778SAlexander Motin.Sh SEE ALSO 98d1108778SAlexander Motin.Xr acpi 4 , 9973889c80SAlexander Motin.Xr apic 4 , 100c45456fbSAlexander Motin.Xr atrtc 4 , 10174f3a46aSAlexander Motin.Xr attimer 4 , 1022a6be868SAlexander Motin.Xr eventtimers 4 , 1032a6be868SAlexander Motin.Xr timecounters 4 104d1108778SAlexander Motin.Sh HISTORY 105d1108778SAlexander MotinThe 106d1108778SAlexander Motin.Nm 107d1108778SAlexander Motindriver first appeared in 108d1108778SAlexander Motin.Fx 6.3 . 109d1108778SAlexander MotinSupport for event timers was added in 110d1108778SAlexander Motin.Fx 9.0 . 111