43 #define RTC_MAX_WAIT_MS 100 53 #define rtc_flag __use_text16 ( rtc_flag ) 67 "movb $0x01, %%cs:rtc_flag\n\t" 75 "movb $0x20, %%al\n\t" 76 "outb %%al, $0xa0\n\t" 77 "outb %%al, $0x20\n\t" 168 DBGC ( &
rtc_flag,
"RTC timed out waiting for interrupt\n" );
234 "movb %b2, %%cs:rtc_flag\n\t" 236 "xchgb %b2, %%cs:rtc_flag\n\t" 245 "movb %b2, %%cs:rtc_flag\n\t" 247 "xchgb %b2, %%cs:rtc_flag\n\t" 257 :
"=a" ( after ),
"=d" ( before ),
"=Q" ( temp )
260 return ( after - before );
struct arbelprm_rc_send_wqe rc
CMOS Real-Time Clock (RTC)
void entropy_disable(void)
Disable entropy gathering.
#define CMOS_DEFAULT_ADDRESS
CMOS default address.
min_entropy_t min_entropy_per_sample(void)
min-entropy per sample
int get_noise(noise_sample_t *noise)
Get noise sample.
void x86_features(struct x86_features *features)
Get x86 CPU features.
#define RTC_STATUS_B
RTC status register B.
#define ENOTSUP
Operation not supported.
void hook_bios_interrupt(unsigned int interrupt, unsigned int handler, struct segoff *chain_vector)
Hook INT vector.
void rtc_isr(void)
RTC interrupt handler.
static struct segoff rtc_old_handler
Previous RTC interrupt handler.
#define CMOS_DATA
CMOS/RTC data register.
int unhook_bios_interrupt(unsigned int interrupt, unsigned int handler, struct segoff *chain_vector)
Unhook INT vector.
uint8_t rtc_sample(void)
Measure a single RTC tick.
static void rtc_enable_int(void)
Enable RTC interrupts.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
PROVIDE_ENTROPY(rtc, entropy_enable, rtc_entropy_enable)
static int rtc_entropy_enable(void)
Enable entropy gathering.
x86 CPU feature detection
uint32_t features
Supported features.
int entropy_enable(void)
Enable entropy gathering.
static void rtc_hook_isr(void)
Hook RTC interrupt handler.
PROVIDE_ENTROPY_INLINE(rtc, min_entropy_per_sample)
__asm__ __volatile__("\n1:\n\t" "movb -1(%3,%1), %%al\n\t" "stosb\n\t" "loop 1b\n\t" "xorl %%eax, %%eax\n\t" "mov %4, %1\n\t" "rep stosb\n\t" :"=&D"(discard_D), "=&c"(discard_c), "+m"(*value) :"r"(data), "g"(pad_len), "0"(value0), "1"(len) :"eax")
uint8_t inb(volatile uint8_t *io_addr)
Read byte from I/O-mapped device.
#define RTC_INT
RTC interrupt vector.
static int rtc_entropy_check(void)
Check that entropy gathering is functional.
#define RTC_MAX_WAIT_MS
Maximum time to wait for an RTC interrupt, in milliseconds.
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
__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")
#define outb(data, io_addr)
static void rtc_disable_int(void)
Disable RTC interrupts.
#define RTC_STATUS_C
RTC status register C.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
static void rtc_unhook_isr(void)
Unhook RTC interrupt handler.
#define CMOS_ADDRESS
CMOS/RTC address (and NMI) register.
#define CPUID_FEATURES_INTEL_EDX_TSC
TSC is present.
#define REAL_CODE(asm_code_str)
volatile uint8_t __text16(rtc_flag)
Flag set by RTC interrupt handler.
#define ETIMEDOUT
Connection timed out.
static void rtc_entropy_disable(void)
Disable entropy gathering.
#define TEXT16_CODE(asm_code_str)
#define CMOS_DISABLE_NMI
NMI disable bit.
#define RTC_STATUS_B_PIE
RTC Periodic Interrupt Enabled bit.