iPXE
|
RDTSC timer. More...
#include <string.h>
#include <errno.h>
#include <ipxe/timer.h>
#include <ipxe/cpuid.h>
#include <ipxe/pit8254.h>
Go to the source code of this file.
Macros | |
#define | TSC_CALIBRATE_US 1024 |
Number of microseconds to use for TSC calibration. More... | |
#define | TSC_SCALED_HZ 32 |
Minimum resolution for scaled TSC timer. More... | |
#define | colour &tsc_per_us |
Colour for debug messages. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static __always_inline unsigned long | rdtsc_raw (void) |
Get raw TSC value. More... | |
static __always_inline unsigned long | rdtsc_scaled (void) |
Get TSC value, shifted to avoid rollover within a realistic timescale. More... | |
static unsigned long | rdtsc_currticks (void) |
Get current system time in ticks. More... | |
static void | rdtsc_udelay (unsigned long usecs) |
Delay for a fixed number of microseconds. More... | |
static int | rdtsc_probe (void) |
Probe RDTSC timer. More... | |
struct timer rdtsc_timer | __timer (TIMER_PREFERRED) |
RDTSC timer. More... | |
Variables | |
static unsigned long | tsc_per_us |
TSC increment per microsecond. More... | |
static unsigned int | tsc_scale |
TSC scale (expressed as a bit shift) More... | |
static unsigned long | ticks_per_scaled_tsc |
Number of timer ticks per scaled TSC increment. More... | |
RDTSC timer.
Definition in file rdtsc_timer.c.
#define TSC_CALIBRATE_US 1024 |
Number of microseconds to use for TSC calibration.
Definition at line 39 of file rdtsc_timer.c.
#define TSC_SCALED_HZ 32 |
Minimum resolution for scaled TSC timer.
Definition at line 45 of file rdtsc_timer.c.
#define colour &tsc_per_us |
Colour for debug messages.
Definition at line 57 of file rdtsc_timer.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
inlinestatic |
Get raw TSC value.
tsc | Raw TSC value |
Definition at line 64 of file rdtsc_timer.c.
References __asm__(), __volatile__(), and raw.
Referenced by rdtsc_probe(), and rdtsc_udelay().
|
inlinestatic |
Get TSC value, shifted to avoid rollover within a realistic timescale.
tsc | Scaled TSC value |
Definition at line 76 of file rdtsc_timer.c.
References __asm__(), __volatile__(), and tsc_scale.
Referenced by rdtsc_currticks().
|
static |
Get current system time in ticks.
ticks | Current time, in ticks |
Definition at line 90 of file rdtsc_timer.c.
References rdtsc_scaled(), and ticks_per_scaled_tsc.
|
static |
Delay for a fixed number of microseconds.
usecs | Number of microseconds for which to delay |
Definition at line 102 of file rdtsc_timer.c.
References rdtsc_raw(), start, and tsc_per_us.
|
static |
Probe RDTSC timer.
rc | Return status code |
Definition at line 119 of file rdtsc_timer.c.
References after, before, colour, CPUID_APM, CPUID_APM_EDX_TSC_INVARIANT, cpuid_supported(), DBGC, discard_c, EIO, ENOTTY, rc, rdtsc_raw(), strerror(), ticks_per_scaled_tsc, TICKS_PER_SEC, TSC_CALIBRATE_US, tsc_per_us, tsc_scale, and TSC_SCALED_HZ.
struct timer acpi_timer __timer | ( | TIMER_PREFERRED | ) |
RDTSC timer.
ACPI timer.
|
static |
TSC increment per microsecond.
Definition at line 42 of file rdtsc_timer.c.
Referenced by rdtsc_probe(), and rdtsc_udelay().
|
static |
TSC scale (expressed as a bit shift)
We use this to avoid the need for 64-bit divsion on 32-bit systems.
Definition at line 51 of file rdtsc_timer.c.
Referenced by rdtsc_probe(), and rdtsc_scaled().
|
static |
Number of timer ticks per scaled TSC increment.
Definition at line 54 of file rdtsc_timer.c.
Referenced by rdtsc_currticks(), and rdtsc_probe().