Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 83432
b: refs/heads/master
c: 11025e8
h: refs/heads/master
v: v3
  • Loading branch information
Dave Jones authored and Linus Torvalds committed Feb 6, 2008
1 parent f0cb681 commit 482ea72
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ece95912db94d98e202cbedb8f35206deb29d83d
refs/heads/master: 11025e855235144271a0e447e3650b203f8215f4
14 changes: 14 additions & 0 deletions trunk/drivers/char/hw_random/via-rng.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ enum {
VIA_STRFILT_ENABLE = (1 << 14),
VIA_RAWBITS_ENABLE = (1 << 13),
VIA_RNG_ENABLE = (1 << 6),
VIA_NOISESRC1 = (1 << 8),
VIA_NOISESRC2 = (1 << 9),
VIA_XSTORE_CNT_MASK = 0x0F,

VIA_RNG_CHUNK_8 = 0x00, /* 64 rand bits, 64 stored bits */
Expand Down Expand Up @@ -119,6 +121,7 @@ static int via_rng_data_read(struct hwrng *rng, u32 *data)

static int via_rng_init(struct hwrng *rng)
{
struct cpuinfo_x86 *c = &cpu_data(0);
u32 lo, hi, old_lo;

/* Control the RNG via MSR. Tread lightly and pay very close
Expand All @@ -134,6 +137,17 @@ static int via_rng_init(struct hwrng *rng)
lo &= ~VIA_XSTORE_CNT_MASK;
lo &= ~(VIA_STRFILT_ENABLE | VIA_STRFILT_FAIL | VIA_RAWBITS_ENABLE);
lo |= VIA_RNG_ENABLE;
lo |= VIA_NOISESRC1;

/* Enable secondary noise source on CPUs where it is present. */

/* Nehemiah stepping 8 and higher */
if ((c->x86_model == 9) && (c->x86_mask > 7))
lo |= VIA_NOISESRC2;

/* Esther */
if (c->x86_model >= 10)
lo |= VIA_NOISESRC2;

if (lo != old_lo)
wrmsr(MSR_VIA_RNG, lo, hi);
Expand Down

0 comments on commit 482ea72

Please sign in to comment.