Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-6]: src/sys/arch/x86/x86 Pull up following revision(s) (requested...



details:   https://anonhg.NetBSD.org/src/rev/b6872713432b
branches:  netbsd-6
changeset: 774002:b6872713432b
user:      riz <riz%NetBSD.org@localhost>
date:      Thu Apr 12 17:09:01 2012 +0000

description:
Pull up following revision(s) (requested by njoly in ticket #176):
        sys/arch/x86/x86/ipmi.c: revision 1.53
For 1's and 2's complement sensor data, convert unsigned raw data to a
signed type before proceeding any computation. Fix handling of
negative temperatures that can be set for critmin/warnmin limits.

diffstat:

 sys/arch/x86/x86/ipmi.c |  13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diffs (41 lines):

diff -r a9b1b8dbe679 -r b6872713432b sys/arch/x86/x86/ipmi.c
--- a/sys/arch/x86/x86/ipmi.c   Thu Apr 12 17:06:58 2012 +0000
+++ b/sys/arch/x86/x86/ipmi.c   Thu Apr 12 17:09:01 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ipmi.c,v 1.52 2012/02/02 19:43:01 tls Exp $ */
+/*     $NetBSD: ipmi.c,v 1.52.2.1 2012/04/12 17:09:01 riz Exp $ */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -52,7 +52,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipmi.c,v 1.52 2012/02/02 19:43:01 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipmi.c,v 1.52.2.1 2012/04/12 17:09:01 riz Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -1439,7 +1439,12 @@
 {
        int64_t M, B;
        char    K1, K2;
-       int64_t val, v1, v2;
+       int64_t val, v1, v2, vs;
+       int sign = (s1->units1 >> 6) & 0x3;
+
+       vs = (sign == 0x1 || sign == 0x2) ? (int8_t)v : v;
+       if ((vs < 0) && (sign == 0x1))
+               vs++;
 
        /* Calculate linear reading variables */
        M  = signextend((((short)(s1->m_tolerance & 0xC0)) << 2) + s1->m, 10);
@@ -1454,7 +1459,7 @@
         *  y = L(M*v * 10^(K2+adj) + B * 10^(K1+K2+adj)); */
        v1 = powx(FIX10, INT2FIX(K2 + adj));
        v2 = powx(FIX10, INT2FIX(K1 + K2 + adj));
-       val = M * v * v1 + B * v2;
+       val = M * vs * v1 + B * v2;
 
        /* Linearization function: y = f(x) 0 : y = x 1 : y = ln(x) 2 : y =
         * log10(x) 3 : y = log2(x) 4 : y = e^x 5 : y = 10^x 6 : y = 2^x 7 : y



Home | Main Index | Thread Index | Old Index