Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=11025e855235144271a0e447e3650b203f8215f4
Commit:     11025e855235144271a0e447e3650b203f8215f4
Parent:     ece95912db94d98e202cbedb8f35206deb29d83d
Author:     Dave Jones <[EMAIL PROTECTED]>
AuthorDate: Wed Feb 6 01:37:13 2008 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Wed Feb 6 10:41:05 2008 -0800

    via-rng: enable secondary noise source on CPUs where it is present
    
    In the padlock spec:
    
    "SRC Bits[9:8] Noise source select (I): These bits control the two noise
     sources on the processor that input bits to the accumulation buffers.
     On Nehemiah processors prior to stepping 8, these bits are reserved
     and undefined. The default RESET state is both bits = 0."
    
    Signed-off-by: Dave Jones <[EMAIL PROTECTED]>
    Tested-by: Udo van den Heuvel <[EMAIL PROTECTED]>
    Cc: Michael Buesch <[EMAIL PROTECTED]>
    Cc: folkert van Heusden <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 drivers/char/hw_random/via-rng.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/char/hw_random/via-rng.c b/drivers/char/hw_random/via-rng.c
index 868e39f..f7feae4 100644
--- a/drivers/char/hw_random/via-rng.c
+++ b/drivers/char/hw_random/via-rng.c
@@ -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 */
@@ -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
@@ -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);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to