[time] Allow timer to be selected at runtime
authorMichael Brown <mcb30@ipxe.org>
Wed, 25 Jan 2017 20:59:15 +0000 (20:59 +0000)
committerMichael Brown <mcb30@ipxe.org>
Thu, 26 Jan 2017 08:17:37 +0000 (08:17 +0000)
commit302f1eeb80706fb10067efedb1279fa3f85ddda2
tree90e58309094b20a26cedc8244fabf72d96fe6135
parentd37e025b81cb6fd0e7833b927ed138b42a628bc8
[time] Allow timer to be selected at runtime

Allow the active timer (providing udelay() and currticks()) to be
selected at runtime based on probing during the INIT_EARLY stage of
initialisation.

TICKS_PER_SEC is now a fixed compile-time constant for all builds, and
is independent of the underlying clock tick rate.  We choose the value
1024 to allow multiplications and divisions on seconds to be converted
to bit shifts.

TICKS_PER_MS is defined as 1, allowing multiplications and divisions
on milliseconds to be omitted entirely.  The 2% inaccuracy in this
definition is negligible when using the standard BIOS timer (running
at around 18.2Hz).

TIMER_RDTSC now checks for a constant TSC before claiming to be a
usable timer.  (This timer can be tested in KVM via the command-line
option "-cpu host,+invtsc".)

Signed-off-by: Michael Brown <mcb30@ipxe.org>
24 files changed:
src/arch/arm/include/bits/timer.h [deleted file]
src/arch/x86/core/rdtsc_timer.c
src/arch/x86/include/bios.h
src/arch/x86/include/bits/errfile.h
src/arch/x86/include/bits/timer.h [deleted file]
src/arch/x86/include/ipxe/bios_timer.h [deleted file]
src/arch/x86/include/ipxe/cpuid.h
src/arch/x86/include/ipxe/rdtsc_timer.h [deleted file]
src/arch/x86/interface/pcbios/bios_timer.c
src/config/config_timer.c [new file with mode: 0644]
src/core/parseopt.c
src/core/timer.c
src/drivers/net/ath/ath5k/ath5k.c
src/drivers/net/forcedeth.c
src/hci/commands/time_cmd.c
src/include/ipxe/efi/efi_timer.h [deleted file]
src/include/ipxe/linux/linux_timer.h [deleted file]
src/include/ipxe/timer.h
src/include/unistd.h
src/interface/efi/efi_timer.c
src/interface/linux/linux_timer.c
src/net/80211/net80211.c
src/net/fcoe.c
src/net/stp.c