39 #define TSC_CALIBRATE_US 1024 45 #define TSC_SCALED_HZ 32 57 #define colour &tsc_per_us 80 "shrdl %b1, %%edx, %%eax\n\t" 81 :
"=a" ( scaled ) :
"c" (
tsc_scale ) :
"edx" );
104 unsigned long elapsed;
105 unsigned long threshold;
111 }
while ( elapsed < threshold );
122 unsigned long elapsed;
131 DBGC (
colour,
"RDTSC cannot determine APM features: %s\n",
137 DBGC (
colour,
"RDTSC has non-invariant TSC (%#08x)\n",
149 DBGC (
colour,
"RDTSC has zero TSC per microsecond\n" );
161 DBGC (
colour,
"RDTSC has %ld tsc per us, %ld ticks per 2^%d tsc\n",
164 DBGC (
colour,
"RDTSC has zero ticks per TSC\n" );
int cpuid_supported(uint32_t function)
Check whether or not CPUID function is supported.
struct arbelprm_rc_send_wqe rc
struct timer rdtsc_timer __timer(TIMER_PREFERRED)
RDTSC timer.
#define TICKS_PER_SEC
Number of ticks per second.
int32_t before
Initial microcode version.
#define colour
Colour for debug messages.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
uint32_t start
Starting offset.
#define CPUID_APM_EDX_TSC_INVARIANT
Invariant TSC.
static int rdtsc_probe(void)
Probe RDTSC timer.
static unsigned int tsc_scale
TSC scale (expressed as a bit shift)
#define TIMER_PREFERRED
Preferred timer.
static void rdtsc_udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
static __always_inline unsigned long rdtsc_scaled(void)
Get TSC value, shifted to avoid rollover within a realistic timescale.
static unsigned long ticks_per_scaled_tsc
Number of timer ticks per scaled TSC increment.
char * strerror(int errno)
Retrieve string representation of error number.
x86 CPU feature detection
#define __always_inline
Declare a function to be always inline.
8254 Programmable Interval Timer
__asm__ __volatile__("call *%9" :"=a"(result), "=c"(discard_ecx), "=d"(discard_edx) :"d"(0), "a"(code), "b"(0), "c"(in_phys), "D"(0), "S"(out_phys), "m"(hypercall))
#define TSC_CALIBRATE_US
Number of microseconds to use for TSC calibration.
__asm__(".section \".rodata\", \"a\", " PROGBITS "\n\t" "\nprivate_key_data:\n\t" ".size private_key_data, ( . - private_key_data )\n\t" ".equ private_key_len, ( . - private_key_data )\n\t" ".previous\n\t")
static __always_inline unsigned long rdtsc_raw(void)
Get raw TSC value.
#define ENOTTY
Inappropriate I/O control operation.
static unsigned long tsc_per_us
TSC increment per microsecond.
int32_t after
Final microcode version.
#define CPUID_APM
Get APM information.
#define EIO
Input/output error.
#define TSC_SCALED_HZ
Minimum resolution for scaled TSC timer.
static unsigned long rdtsc_currticks(void)
Get current system time in ticks.