Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/x86 fix validness check of sensor value



details:   https://anonhg.NetBSD.org/src/rev/7d80a49e9b57
branches:  trunk
changeset: 789269:7d80a49e9b57
user:      yamt <yamt%NetBSD.org@localhost>
date:      Mon Aug 12 15:40:34 2013 +0000

description:
fix validness check of sensor value

this change is intended to mirror what ipmitool does.
(their macros for these bits are IS_READING_UNAVAILABLE and
IS_SCANNING_DISABLED.)

see also:
    second-gen-interface-spec-v2-rev1-4
    Table 35-15, Get Sensor Reading Command

might fix PR/46833 from Francois Tigeot

reviewed by Masanobu SAITOH and Tom Ivar Helbekkmo
tested by Tom Ivar Helbekkmo

diffstat:

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

diffs (40 lines):

diff -r 6a0faa1afe1f -r 7d80a49e9b57 sys/arch/x86/x86/ipmi.c
--- a/sys/arch/x86/x86/ipmi.c   Mon Aug 12 15:08:13 2013 +0000
+++ b/sys/arch/x86/x86/ipmi.c   Mon Aug 12 15:40:34 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ipmi.c,v 1.54 2013/03/19 06:34:28 msaitoh Exp $ */
+/*     $NetBSD: ipmi.c,v 1.55 2013/08/12 15:40:34 yamt Exp $ */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -52,7 +52,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipmi.c,v 1.54 2013/03/19 06:34:28 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipmi.c,v 1.55 2013/08/12 15:40:34 yamt Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -146,7 +146,11 @@
 
 #define IPMI_ENTITY_PWRSUPPLY          0x0A
 
-#define IPMI_INVALID_SENSOR            (1L << 5)
+#define IPMI_SENSOR_SCANNING_ENABLED   (1L << 6)
+#define IPMI_SENSOR_UNAVAILABLE                (1L << 5)
+#define IPMI_INVALID_SENSOR_P(x) \
+       (((x) & (IPMI_SENSOR_SCANNING_ENABLED|IPMI_SENSOR_UNAVAILABLE)) \
+       != IPMI_SENSOR_SCANNING_ENABLED)
 
 #define IPMI_SDR_TYPEFULL              1
 #define IPMI_SDR_TYPECOMPACT           2
@@ -1716,7 +1720,7 @@
            s1->m, s1->m_tolerance, s1->b, s1->b_accuracy, s1->rbexp, s1->linear);
        dbg_printf(10, "values=%.2x %.2x %.2x %.2x %s\n",
            data[0],data[1],data[2],data[3], edata->desc);
-       if (data[1] & IPMI_INVALID_SENSOR) {
+       if (IPMI_INVALID_SENSOR_P(data[1])) {
                /* Check if sensor is valid */
                edata->state = ENVSYS_SINVALID;
        } else {



Home | Main Index | Thread Index | Old Index