28 #include <linux/module.h>
29 #include <linux/kernel.h>
34 #include <asm/cpufeature.h>
81 ts_state = irq_ts_save();
83 asm(
".byte 0x0F,0xA7,0xC0 /* xstore %%edi (addr=%0) */"
84 :
"=m" (*addr),
"=a" (eax_out),
"+d" (edx_in),
"+D" (
addr));
86 irq_ts_restore(ts_state);
90 static int via_rng_data_present(
struct hwrng *rng,
int wait)
111 for (i = 0; i < 20; i++) {
115 if (bytes_out || !wait)
119 rng->
priv = *via_rng_datum;
120 return bytes_out ? 1 : 0;
123 static int via_rng_data_read(
struct hwrng *rng,
u32 *
data)
127 *data = via_rng_datum;
132 static int via_rng_init(
struct hwrng *rng)
142 if (!cpu_has_xstore_enabled) {
144 "if XSTORE is not enabled\n");
190 static struct hwrng via_rng = {
192 .init = via_rng_init,
193 .data_present = via_rng_data_present,
194 .data_read = via_rng_data_read,
198 static int __init mod_init(
void)
215 static void __exit mod_exit(
void)