I've been debugging an issue where it looks like a threshold mask is
getting read in incorrectly.

I have the following raw SDR:

00000760  1f 00 51 01 3b 20 00 1d  07 01 23 c3 03 09 00 00  |..Q.; ....#.....|
00000770  00 00 03 00 00 06 00 00  02 00 00 00 00 00 02 00  |................|
00000780  1e 00 ff 00 00 00 00 00  00 00 00 00 00 00 00 cb  |................|
00000790  50 6f 77 65 72 20 4d 65  74 65 72 00 00 00 00 00  |Power Meter.....|

Byte 19 (Settable Threshold Mask) = 0x03
Byte 20 (Readable Threshold Mask) = 0x00

However, after parsing this sdr, ipmitool is seeing bits set in the Readable
Threshold Mask. I verified that w/ the following patch:

--- lib/ipmi_sdr.c.orig 2010-03-01 15:47:05.000000000 -0700
+++ lib/ipmi_sdr.c      2010-03-01 15:47:09.000000000 -0700
@@ -2472,6 +2472,8 @@ ipmi_sdr_print_sdr(struct ipmi_intf *int
                case SDR_RECORD_TYPE_FULL_SENSOR:
                        sdrr->record.full =
                            (struct sdr_record_full_sensor *) rec;
+                       printf("Readable Threshold Mask LC is %x\n",
+                              sdrr->record.full->mask.type.threshold.read.lcr);
                        break;
                case SDR_RECORD_TYPE_COMPACT_SENSOR:
                        sdrr->record.compact =


Which outputs "Readable Threshold Mask LC is 1" for the sensor in question.

This seems to be related to the use of uint16_t as the type, though I can't
put my finger on exactly why. The patch below appears to fix it for me.
fyi, my patch basically looks like a revert of this one:

  http://bit.ly/c539td

---
 include/ipmitool/ipmi_sdr.h |   75 +++++++++++++++++++-----------------------
 1 files changed, 34 insertions(+), 41 deletions(-)

diff --git a/include/ipmitool/ipmi_sdr.h b/include/ipmitool/ipmi_sdr.h
index f84700e..f824dd4 100644
--- a/include/ipmitool/ipmi_sdr.h
+++ b/include/ipmitool/ipmi_sdr.h
@@ -232,52 +232,45 @@ struct sdr_record_mask {
                        uint16_t status_unr:1;
                        uint16_t reserved_2:1;
 #endif
-                       union {
+#if WORDS_BIGENDIAN
                                struct {
-#if WORDS_BIGENDIAN                    /* settable threshold mask */
-                                       uint16_t reserved:2;
-                                       uint16_t unr:1;
-                                       uint16_t ucr:1;
-                                       uint16_t unc:1;
-                                       uint16_t lnr:1;
-                                       uint16_t lcr:1;
-                                       uint16_t lnc:1;
-                                       /* padding lower 8 bits */
-                                       uint16_t readable:8;
-#else
-                                       uint16_t readable:8;
-                                       uint16_t lnc:1;
-                                       uint16_t lcr:1;
-                                       uint16_t lnr:1;
-                                       uint16_t unc:1;
-                                       uint16_t ucr:1;
-                                       uint16_t unr:1;
-                                       uint16_t reserved:2;
-#endif
+                                       uint8_t reserved:2;
+                                       uint8_t unr:1;
+                                       uint8_t ucr:1;
+                                       uint8_t unc:1;
+                                       uint8_t lnr:1;
+                                       uint8_t lcr:1;
+                                       uint8_t lnc:1;
                                } set;
                                struct {
-#if WORDS_BIGENDIAN                    /* readable threshold mask */
-                                       /* padding upper 8 bits */
-                                       uint16_t settable:8;
-                                       uint16_t reserved:2;
-                                       uint16_t unr:1;
-                                       uint16_t ucr:1;
-                                       uint16_t unc:1;
-                                       uint16_t lnr:1;
-                                       uint16_t lcr:1;
-                                       uint16_t lnc:1;
+                                       uint8_t reserved:2;
+                                       uint8_t unr:1;
+                                       uint8_t ucr:1;
+                                       uint8_t unc:1;
+                                       uint8_t lnr:1;
+                                       uint8_t lcr:1;
+                                       uint8_t lnc:1;
+                               } read;
 #else
-                                       uint16_t lnc:1;
-                                       uint16_t lcr:1;
-                                       uint16_t lnr:1;
-                                       uint16_t unc:1;
-                                       uint16_t ucr:1;
-                                       uint16_t unr:1;
-                                       uint16_t reserved:2;
-                                       uint16_t settable:8;
-#endif
+                               struct {
+                                       uint8_t lnc:1;
+                                       uint8_t lcr:1;
+                                       uint8_t lnr:1;
+                                       uint8_t unc:1;
+                                       uint8_t ucr:1;
+                                       uint8_t unr:1;
+                                       uint8_t reserved:2;
+                               } set;
+                               struct {
+                                       uint8_t lnc:1;
+                                       uint8_t lcr:1;
+                                       uint8_t lnr:1;
+                                       uint8_t unc:1;
+                                       uint8_t ucr:1;
+                                       uint8_t unr:1;
+                                       uint8_t reserved:2;
                                } read;
-                       };
+#endif
                } threshold;
        } type;
 } __attribute__ ((packed));
-- 
1.5.6.5








------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Ipmitool-devel mailing list
Ipmitool-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipmitool-devel

Reply via email to