mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
added support for built-in sdrs
This commit is contained in:
parent
4d2f9ebdc2
commit
96876bb061
@ -92,6 +92,8 @@ enum {
|
|||||||
#define SDR_SENSOR_STAT_HI_CR (1<<4)
|
#define SDR_SENSOR_STAT_HI_CR (1<<4)
|
||||||
#define SDR_SENSOR_STAT_HI_NR (1<<5)
|
#define SDR_SENSOR_STAT_HI_NR (1<<5)
|
||||||
|
|
||||||
|
#define GET_DEVICE_SDR_INFO 0x20
|
||||||
|
#define GET_DEVICE_SDR 0x21
|
||||||
#define GET_SENSOR_FACTORS 0x23
|
#define GET_SENSOR_FACTORS 0x23
|
||||||
#define GET_SENSOR_FACTORS 0x23
|
#define GET_SENSOR_FACTORS 0x23
|
||||||
#define SET_SENSOR_HYSTERESIS 0x24
|
#define SET_SENSOR_HYSTERESIS 0x24
|
||||||
@ -115,6 +117,13 @@ struct sdr_repo_info_rs {
|
|||||||
uint8_t op_support; /* supported operations */
|
uint8_t op_support; /* supported operations */
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
/* builtin (device) sdrs support */
|
||||||
|
struct sdr_device_info_rs {
|
||||||
|
unsigned char count; /* number of records */
|
||||||
|
unsigned char flags; /* flags */
|
||||||
|
unsigned char popChangeInd[3]; /* free space in SDR */
|
||||||
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
#define GET_SDR_RESERVE_REPO 0x22
|
#define GET_SDR_RESERVE_REPO 0x22
|
||||||
struct sdr_reserve_repo_rs {
|
struct sdr_reserve_repo_rs {
|
||||||
uint16_t reserve_id; /* reservation ID */
|
uint16_t reserve_id; /* reservation ID */
|
||||||
@ -148,7 +157,6 @@ struct sdr_get_rs {
|
|||||||
uint8_t length; /* remaining record bytes */
|
uint8_t length; /* remaining record bytes */
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
|
||||||
struct sdr_record_mask {
|
struct sdr_record_mask {
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
@ -158,129 +166,128 @@ struct sdr_record_mask {
|
|||||||
} discrete;
|
} discrete;
|
||||||
struct {
|
struct {
|
||||||
#if WORDS_BIGENDIAN
|
#if WORDS_BIGENDIAN
|
||||||
uint16_t reserved : 1;
|
uint16_t reserved:1;
|
||||||
uint16_t status_lnr : 1;
|
uint16_t status_lnr:1;
|
||||||
uint16_t status_lcr : 1;
|
uint16_t status_lcr:1;
|
||||||
uint16_t status_lnc : 1;
|
uint16_t status_lnc:1;
|
||||||
uint16_t assert_unr_high : 1;
|
uint16_t assert_unr_high:1;
|
||||||
uint16_t assert_unr_low : 1;
|
uint16_t assert_unr_low:1;
|
||||||
uint16_t assert_ucr_high : 1;
|
uint16_t assert_ucr_high:1;
|
||||||
uint16_t assert_ucr_low : 1;
|
uint16_t assert_ucr_low:1;
|
||||||
uint16_t assert_unc_high : 1;
|
uint16_t assert_unc_high:1;
|
||||||
uint16_t assert_unc_low : 1;
|
uint16_t assert_unc_low:1;
|
||||||
uint16_t assert_lnr_high : 1;
|
uint16_t assert_lnr_high:1;
|
||||||
uint16_t assert_lnr_low : 1;
|
uint16_t assert_lnr_low:1;
|
||||||
uint16_t assert_lcr_high : 1;
|
uint16_t assert_lcr_high:1;
|
||||||
uint16_t assert_lcr_low : 1;
|
uint16_t assert_lcr_low:1;
|
||||||
uint16_t assert_lnc_high : 1;
|
uint16_t assert_lnc_high:1;
|
||||||
uint16_t assert_lnc_low : 1;
|
uint16_t assert_lnc_low:1;
|
||||||
#else
|
#else
|
||||||
uint16_t assert_lnc_low : 1;
|
uint16_t assert_lnc_low:1;
|
||||||
uint16_t assert_lnc_high : 1;
|
uint16_t assert_lnc_high:1;
|
||||||
uint16_t assert_lcr_low : 1;
|
uint16_t assert_lcr_low:1;
|
||||||
uint16_t assert_lcr_high : 1;
|
uint16_t assert_lcr_high:1;
|
||||||
uint16_t assert_lnr_low : 1;
|
uint16_t assert_lnr_low:1;
|
||||||
uint16_t assert_lnr_high : 1;
|
uint16_t assert_lnr_high:1;
|
||||||
uint16_t assert_unc_low : 1;
|
uint16_t assert_unc_low:1;
|
||||||
uint16_t assert_unc_high : 1;
|
uint16_t assert_unc_high:1;
|
||||||
uint16_t assert_ucr_low : 1;
|
uint16_t assert_ucr_low:1;
|
||||||
uint16_t assert_ucr_high : 1;
|
uint16_t assert_ucr_high:1;
|
||||||
uint16_t assert_unr_low : 1;
|
uint16_t assert_unr_low:1;
|
||||||
uint16_t assert_unr_high : 1;
|
uint16_t assert_unr_high:1;
|
||||||
uint16_t status_lnc : 1;
|
uint16_t status_lnc:1;
|
||||||
uint16_t status_lcr : 1;
|
uint16_t status_lcr:1;
|
||||||
uint16_t status_lnr : 1;
|
uint16_t status_lnr:1;
|
||||||
uint16_t reserved : 1;
|
uint16_t reserved:1;
|
||||||
#endif
|
#endif
|
||||||
#if WORDS_BIGENDIAN
|
#if WORDS_BIGENDIAN
|
||||||
uint16_t reserved_2 : 1;
|
uint16_t reserved_2:1;
|
||||||
uint16_t status_unr : 1;
|
uint16_t status_unr:1;
|
||||||
uint16_t status_ucr : 1;
|
uint16_t status_ucr:1;
|
||||||
uint16_t status_unc : 1;
|
uint16_t status_unc:1;
|
||||||
uint16_t deassert_unr_high : 1;
|
uint16_t deassert_unr_high:1;
|
||||||
uint16_t deassert_unr_low : 1;
|
uint16_t deassert_unr_low:1;
|
||||||
uint16_t deassert_ucr_high : 1;
|
uint16_t deassert_ucr_high:1;
|
||||||
uint16_t deassert_ucr_low : 1;
|
uint16_t deassert_ucr_low:1;
|
||||||
uint16_t deassert_unc_high : 1;
|
uint16_t deassert_unc_high:1;
|
||||||
uint16_t deassert_unc_low : 1;
|
uint16_t deassert_unc_low:1;
|
||||||
uint16_t deassert_lnr_high : 1;
|
uint16_t deassert_lnr_high:1;
|
||||||
uint16_t deassert_lnr_low : 1;
|
uint16_t deassert_lnr_low:1;
|
||||||
uint16_t deassert_lcr_high : 1;
|
uint16_t deassert_lcr_high:1;
|
||||||
uint16_t deassert_lcr_low : 1;
|
uint16_t deassert_lcr_low:1;
|
||||||
uint16_t deassert_lnc_high : 1;
|
uint16_t deassert_lnc_high:1;
|
||||||
uint16_t deassert_lnc_low : 1;
|
uint16_t deassert_lnc_low:1;
|
||||||
#else
|
#else
|
||||||
uint16_t deassert_lnc_low : 1;
|
uint16_t deassert_lnc_low:1;
|
||||||
uint16_t deassert_lnc_high : 1;
|
uint16_t deassert_lnc_high:1;
|
||||||
uint16_t deassert_lcr_low : 1;
|
uint16_t deassert_lcr_low:1;
|
||||||
uint16_t deassert_lcr_high : 1;
|
uint16_t deassert_lcr_high:1;
|
||||||
uint16_t deassert_lnr_low : 1;
|
uint16_t deassert_lnr_low:1;
|
||||||
uint16_t deassert_lnr_high : 1;
|
uint16_t deassert_lnr_high:1;
|
||||||
uint16_t deassert_unc_low : 1;
|
uint16_t deassert_unc_low:1;
|
||||||
uint16_t deassert_unc_high : 1;
|
uint16_t deassert_unc_high:1;
|
||||||
uint16_t deassert_ucr_low : 1;
|
uint16_t deassert_ucr_low:1;
|
||||||
uint16_t deassert_ucr_high : 1;
|
uint16_t deassert_ucr_high:1;
|
||||||
uint16_t deassert_unr_low : 1;
|
uint16_t deassert_unr_low:1;
|
||||||
uint16_t deassert_unr_high : 1;
|
uint16_t deassert_unr_high:1;
|
||||||
uint16_t status_unc : 1;
|
uint16_t status_unc:1;
|
||||||
uint16_t status_ucr : 1;
|
uint16_t status_ucr:1;
|
||||||
uint16_t status_unr : 1;
|
uint16_t status_unr:1;
|
||||||
uint16_t reserved_2 : 1;
|
uint16_t reserved_2:1;
|
||||||
#endif
|
#endif
|
||||||
struct {
|
struct {
|
||||||
#if WORDS_BIGENDIAN /* settable threshold mask */
|
#if WORDS_BIGENDIAN /* settable threshold mask */
|
||||||
uint8_t reserved : 2;
|
uint8_t reserved:2;
|
||||||
uint8_t unr : 1;
|
uint8_t unr:1;
|
||||||
uint8_t ucr : 1;
|
uint8_t ucr:1;
|
||||||
uint8_t unc : 1;
|
uint8_t unc:1;
|
||||||
uint8_t lnr : 1;
|
uint8_t lnr:1;
|
||||||
uint8_t lcr : 1;
|
uint8_t lcr:1;
|
||||||
uint8_t lnc : 1;
|
uint8_t lnc:1;
|
||||||
#else
|
#else
|
||||||
uint8_t lnc : 1;
|
uint8_t lnc:1;
|
||||||
uint8_t lcr : 1;
|
uint8_t lcr:1;
|
||||||
uint8_t lnr : 1;
|
uint8_t lnr:1;
|
||||||
uint8_t unc : 1;
|
uint8_t unc:1;
|
||||||
uint8_t ucr : 1;
|
uint8_t ucr:1;
|
||||||
uint8_t unr : 1;
|
uint8_t unr:1;
|
||||||
uint8_t reserved : 2;
|
uint8_t reserved:2;
|
||||||
#endif
|
#endif
|
||||||
} set;
|
} set;
|
||||||
struct {
|
struct {
|
||||||
#if WORDS_BIGENDIAN /* readable threshold mask */
|
#if WORDS_BIGENDIAN /* readable threshold mask */
|
||||||
uint8_t reserved : 2;
|
uint8_t reserved:2;
|
||||||
uint8_t unr : 1;
|
uint8_t unr:1;
|
||||||
uint8_t ucr : 1;
|
uint8_t ucr:1;
|
||||||
uint8_t unc : 1;
|
uint8_t unc:1;
|
||||||
uint8_t lnr : 1;
|
uint8_t lnr:1;
|
||||||
uint8_t lcr : 1;
|
uint8_t lcr:1;
|
||||||
uint8_t lnc : 1;
|
uint8_t lnc:1;
|
||||||
#else
|
#else
|
||||||
uint8_t lnc : 1;
|
uint8_t lnc:1;
|
||||||
uint8_t lcr : 1;
|
uint8_t lcr:1;
|
||||||
uint8_t lnr : 1;
|
uint8_t lnr:1;
|
||||||
uint8_t unc : 1;
|
uint8_t unc:1;
|
||||||
uint8_t ucr : 1;
|
uint8_t ucr:1;
|
||||||
uint8_t unr : 1;
|
uint8_t unr:1;
|
||||||
uint8_t reserved : 2;
|
uint8_t reserved:2;
|
||||||
#endif
|
#endif
|
||||||
} read;
|
} read;
|
||||||
} threshold;
|
} threshold;
|
||||||
} type;
|
} type;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
|
||||||
struct sdr_record_compact_sensor {
|
struct sdr_record_compact_sensor {
|
||||||
struct {
|
struct {
|
||||||
uint8_t owner_id;
|
uint8_t owner_id;
|
||||||
#if WORDS_BIGENDIAN
|
#if WORDS_BIGENDIAN
|
||||||
uint8_t channel : 4; /* channel number */
|
uint8_t channel:4; /* channel number */
|
||||||
uint8_t __reserved : 2;
|
uint8_t __reserved:2;
|
||||||
uint8_t lun : 2; /* sensor owner lun */
|
uint8_t lun:2; /* sensor owner lun */
|
||||||
#else
|
#else
|
||||||
uint8_t lun : 2; /* sensor owner lun */
|
uint8_t lun:2; /* sensor owner lun */
|
||||||
uint8_t __reserved : 2;
|
uint8_t __reserved:2;
|
||||||
uint8_t channel : 4; /* channel number */
|
uint8_t channel:4; /* channel number */
|
||||||
#endif
|
#endif
|
||||||
uint8_t sensor_num; /* unique sensor number */
|
uint8_t sensor_num; /* unique sensor number */
|
||||||
} keys;
|
} keys;
|
||||||
@ -290,38 +297,38 @@ struct sdr_record_compact_sensor {
|
|||||||
struct {
|
struct {
|
||||||
struct {
|
struct {
|
||||||
#if WORDS_BIGENDIAN
|
#if WORDS_BIGENDIAN
|
||||||
uint8_t __reserved : 1;
|
uint8_t __reserved:1;
|
||||||
uint8_t scanning : 1;
|
uint8_t scanning:1;
|
||||||
uint8_t events : 1;
|
uint8_t events:1;
|
||||||
uint8_t thresholds : 1;
|
uint8_t thresholds:1;
|
||||||
uint8_t hysteresis : 1;
|
uint8_t hysteresis:1;
|
||||||
uint8_t type : 1;
|
uint8_t type:1;
|
||||||
uint8_t event_gen : 1;
|
uint8_t event_gen:1;
|
||||||
uint8_t sensor_scan : 1;
|
uint8_t sensor_scan:1;
|
||||||
#else
|
#else
|
||||||
uint8_t sensor_scan : 1;
|
uint8_t sensor_scan:1;
|
||||||
uint8_t event_gen : 1;
|
uint8_t event_gen:1;
|
||||||
uint8_t type : 1;
|
uint8_t type:1;
|
||||||
uint8_t hysteresis : 1;
|
uint8_t hysteresis:1;
|
||||||
uint8_t thresholds : 1;
|
uint8_t thresholds:1;
|
||||||
uint8_t events : 1;
|
uint8_t events:1;
|
||||||
uint8_t scanning : 1;
|
uint8_t scanning:1;
|
||||||
uint8_t __reserved : 1;
|
uint8_t __reserved:1;
|
||||||
#endif
|
#endif
|
||||||
} init;
|
} init;
|
||||||
struct {
|
struct {
|
||||||
#if WORDS_BIGENDIAN
|
#if WORDS_BIGENDIAN
|
||||||
uint8_t ignore : 1;
|
uint8_t ignore:1;
|
||||||
uint8_t rearm : 1;
|
uint8_t rearm:1;
|
||||||
uint8_t hysteresis : 2;
|
uint8_t hysteresis:2;
|
||||||
uint8_t threshold : 2;
|
uint8_t threshold:2;
|
||||||
uint8_t event_msg : 2;
|
uint8_t event_msg:2;
|
||||||
#else
|
#else
|
||||||
uint8_t event_msg : 2;
|
uint8_t event_msg:2;
|
||||||
uint8_t threshold : 2;
|
uint8_t threshold:2;
|
||||||
uint8_t hysteresis : 2;
|
uint8_t hysteresis:2;
|
||||||
uint8_t rearm : 1;
|
uint8_t rearm:1;
|
||||||
uint8_t ignore : 1;
|
uint8_t ignore:1;
|
||||||
#endif
|
#endif
|
||||||
} capabilities;
|
} capabilities;
|
||||||
uint8_t type; /* sensor type */
|
uint8_t type; /* sensor type */
|
||||||
@ -333,15 +340,15 @@ struct sdr_record_compact_sensor {
|
|||||||
|
|
||||||
struct {
|
struct {
|
||||||
#if WORDS_BIGENDIAN
|
#if WORDS_BIGENDIAN
|
||||||
uint8_t analog : 2;
|
uint8_t analog:2;
|
||||||
uint8_t rate : 3;
|
uint8_t rate:3;
|
||||||
uint8_t modifier : 2;
|
uint8_t modifier:2;
|
||||||
uint8_t pct : 1;
|
uint8_t pct:1;
|
||||||
#else
|
#else
|
||||||
uint8_t pct : 1;
|
uint8_t pct:1;
|
||||||
uint8_t modifier : 2;
|
uint8_t modifier:2;
|
||||||
uint8_t rate : 3;
|
uint8_t rate:3;
|
||||||
uint8_t analog : 2;
|
uint8_t analog:2;
|
||||||
#endif
|
#endif
|
||||||
struct {
|
struct {
|
||||||
uint8_t base;
|
uint8_t base;
|
||||||
@ -351,20 +358,20 @@ struct sdr_record_compact_sensor {
|
|||||||
|
|
||||||
struct {
|
struct {
|
||||||
#if WORDS_BIGENDIAN
|
#if WORDS_BIGENDIAN
|
||||||
uint8_t __reserved : 2;
|
uint8_t __reserved:2;
|
||||||
uint8_t mod_type : 2;
|
uint8_t mod_type:2;
|
||||||
uint8_t count : 4;
|
uint8_t count:4;
|
||||||
#else
|
#else
|
||||||
uint8_t count : 4;
|
uint8_t count:4;
|
||||||
uint8_t mod_type : 2;
|
uint8_t mod_type:2;
|
||||||
uint8_t __reserved : 2;
|
uint8_t __reserved:2;
|
||||||
#endif
|
#endif
|
||||||
#if WORDS_BIGENDIAN
|
#if WORDS_BIGENDIAN
|
||||||
uint8_t entity_inst : 1;
|
uint8_t entity_inst:1;
|
||||||
uint8_t mod_offset : 7;
|
uint8_t mod_offset:7;
|
||||||
#else
|
#else
|
||||||
uint8_t mod_offset : 7;
|
uint8_t mod_offset:7;
|
||||||
uint8_t entity_inst : 1;
|
uint8_t entity_inst:1;
|
||||||
#endif
|
#endif
|
||||||
} share;
|
} share;
|
||||||
|
|
||||||
@ -385,13 +392,13 @@ struct sdr_record_eventonly_sensor {
|
|||||||
struct {
|
struct {
|
||||||
uint8_t owner_id;
|
uint8_t owner_id;
|
||||||
#if WORDS_BIGENDIAN
|
#if WORDS_BIGENDIAN
|
||||||
uint8_t channel : 4; /* channel number */
|
uint8_t channel:4; /* channel number */
|
||||||
uint8_t fru_owner : 2; /* fru device owner lun */
|
uint8_t fru_owner:2; /* fru device owner lun */
|
||||||
uint8_t lun : 2; /* sensor owner lun */
|
uint8_t lun:2; /* sensor owner lun */
|
||||||
#else
|
#else
|
||||||
uint8_t lun : 2; /* sensor owner lun */
|
uint8_t lun:2; /* sensor owner lun */
|
||||||
uint8_t fru_owner : 2; /* fru device owner lun */
|
uint8_t fru_owner:2; /* fru device owner lun */
|
||||||
uint8_t channel : 4; /* channel number */
|
uint8_t channel:4; /* channel number */
|
||||||
#endif
|
#endif
|
||||||
uint8_t sensor_num; /* unique sensor number */
|
uint8_t sensor_num; /* unique sensor number */
|
||||||
} keys;
|
} keys;
|
||||||
@ -403,20 +410,20 @@ struct sdr_record_eventonly_sensor {
|
|||||||
|
|
||||||
struct {
|
struct {
|
||||||
#if WORDS_BIGENDIAN
|
#if WORDS_BIGENDIAN
|
||||||
uint8_t __reserved : 2;
|
uint8_t __reserved:2;
|
||||||
uint8_t mod_type : 2;
|
uint8_t mod_type:2;
|
||||||
uint8_t count : 4;
|
uint8_t count:4;
|
||||||
#else
|
#else
|
||||||
uint8_t count : 4;
|
uint8_t count:4;
|
||||||
uint8_t mod_type : 2;
|
uint8_t mod_type:2;
|
||||||
uint8_t __reserved : 2;
|
uint8_t __reserved:2;
|
||||||
#endif
|
#endif
|
||||||
#if WORDS_BIGENDIAN
|
#if WORDS_BIGENDIAN
|
||||||
uint8_t entity_inst : 1;
|
uint8_t entity_inst:1;
|
||||||
uint8_t mod_offset : 7;
|
uint8_t mod_offset:7;
|
||||||
#else
|
#else
|
||||||
uint8_t mod_offset : 7;
|
uint8_t mod_offset:7;
|
||||||
uint8_t entity_inst : 1;
|
uint8_t entity_inst:1;
|
||||||
#endif
|
#endif
|
||||||
} share;
|
} share;
|
||||||
|
|
||||||
@ -431,13 +438,13 @@ struct sdr_record_full_sensor {
|
|||||||
struct {
|
struct {
|
||||||
uint8_t owner_id;
|
uint8_t owner_id;
|
||||||
#if WORDS_BIGENDIAN
|
#if WORDS_BIGENDIAN
|
||||||
uint8_t channel : 4; /* channel number */
|
uint8_t channel:4; /* channel number */
|
||||||
uint8_t __reserved : 2;
|
uint8_t __reserved:2;
|
||||||
uint8_t lun : 2; /* sensor owner lun */
|
uint8_t lun:2; /* sensor owner lun */
|
||||||
#else
|
#else
|
||||||
uint8_t lun : 2; /* sensor owner lun */
|
uint8_t lun:2; /* sensor owner lun */
|
||||||
uint8_t __reserved : 2;
|
uint8_t __reserved:2;
|
||||||
uint8_t channel : 4; /* channel number */
|
uint8_t channel:4; /* channel number */
|
||||||
#endif
|
#endif
|
||||||
uint8_t sensor_num; /* unique sensor number */
|
uint8_t sensor_num; /* unique sensor number */
|
||||||
} keys;
|
} keys;
|
||||||
@ -447,38 +454,38 @@ struct sdr_record_full_sensor {
|
|||||||
struct {
|
struct {
|
||||||
struct {
|
struct {
|
||||||
#if WORDS_BIGENDIAN
|
#if WORDS_BIGENDIAN
|
||||||
uint8_t __reserved : 1;
|
uint8_t __reserved:1;
|
||||||
uint8_t scanning : 1;
|
uint8_t scanning:1;
|
||||||
uint8_t events : 1;
|
uint8_t events:1;
|
||||||
uint8_t thresholds : 1;
|
uint8_t thresholds:1;
|
||||||
uint8_t hysteresis : 1;
|
uint8_t hysteresis:1;
|
||||||
uint8_t type : 1;
|
uint8_t type:1;
|
||||||
uint8_t event_gen : 1;
|
uint8_t event_gen:1;
|
||||||
uint8_t sensor_scan : 1;
|
uint8_t sensor_scan:1;
|
||||||
#else
|
#else
|
||||||
uint8_t sensor_scan : 1;
|
uint8_t sensor_scan:1;
|
||||||
uint8_t event_gen : 1;
|
uint8_t event_gen:1;
|
||||||
uint8_t type : 1;
|
uint8_t type:1;
|
||||||
uint8_t hysteresis : 1;
|
uint8_t hysteresis:1;
|
||||||
uint8_t thresholds : 1;
|
uint8_t thresholds:1;
|
||||||
uint8_t events : 1;
|
uint8_t events:1;
|
||||||
uint8_t scanning : 1;
|
uint8_t scanning:1;
|
||||||
uint8_t __reserved : 1;
|
uint8_t __reserved:1;
|
||||||
#endif
|
#endif
|
||||||
} init;
|
} init;
|
||||||
struct {
|
struct {
|
||||||
#if WORDS_BIGENDIAN
|
#if WORDS_BIGENDIAN
|
||||||
uint8_t ignore : 1;
|
uint8_t ignore:1;
|
||||||
uint8_t rearm : 1;
|
uint8_t rearm:1;
|
||||||
uint8_t hysteresis : 2;
|
uint8_t hysteresis:2;
|
||||||
uint8_t threshold : 2;
|
uint8_t threshold:2;
|
||||||
uint8_t event_msg : 2;
|
uint8_t event_msg:2;
|
||||||
#else
|
#else
|
||||||
uint8_t event_msg : 2;
|
uint8_t event_msg:2;
|
||||||
uint8_t threshold : 2;
|
uint8_t threshold:2;
|
||||||
uint8_t hysteresis : 2;
|
uint8_t hysteresis:2;
|
||||||
uint8_t rearm : 1;
|
uint8_t rearm:1;
|
||||||
uint8_t ignore : 1;
|
uint8_t ignore:1;
|
||||||
#endif
|
#endif
|
||||||
} capabilities;
|
} capabilities;
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
@ -490,15 +497,15 @@ struct sdr_record_full_sensor {
|
|||||||
|
|
||||||
struct {
|
struct {
|
||||||
#if WORDS_BIGENDIAN
|
#if WORDS_BIGENDIAN
|
||||||
uint8_t analog : 2;
|
uint8_t analog:2;
|
||||||
uint8_t rate : 3;
|
uint8_t rate:3;
|
||||||
uint8_t modifier : 2;
|
uint8_t modifier:2;
|
||||||
uint8_t pct : 1;
|
uint8_t pct:1;
|
||||||
#else
|
#else
|
||||||
uint8_t pct : 1;
|
uint8_t pct:1;
|
||||||
uint8_t modifier : 2;
|
uint8_t modifier:2;
|
||||||
uint8_t rate : 3;
|
uint8_t rate:3;
|
||||||
uint8_t analog : 2;
|
uint8_t analog:2;
|
||||||
#endif
|
#endif
|
||||||
struct {
|
struct {
|
||||||
uint8_t base;
|
uint8_t base;
|
||||||
@ -526,15 +533,15 @@ struct sdr_record_full_sensor {
|
|||||||
|
|
||||||
struct {
|
struct {
|
||||||
#if WORDS_BIGENDIAN
|
#if WORDS_BIGENDIAN
|
||||||
uint8_t __reserved : 5;
|
uint8_t __reserved:5;
|
||||||
uint8_t normal_min : 1; /* normal min field specified */
|
uint8_t normal_min:1; /* normal min field specified */
|
||||||
uint8_t normal_max : 1; /* normal max field specified */
|
uint8_t normal_max:1; /* normal max field specified */
|
||||||
uint8_t nominal_read : 1; /* nominal reading field specified */
|
uint8_t nominal_read:1; /* nominal reading field specified */
|
||||||
#else
|
#else
|
||||||
uint8_t nominal_read : 1; /* nominal reading field specified */
|
uint8_t nominal_read:1; /* nominal reading field specified */
|
||||||
uint8_t normal_max : 1; /* normal max field specified */
|
uint8_t normal_max:1; /* normal max field specified */
|
||||||
uint8_t normal_min : 1; /* normal min field specified */
|
uint8_t normal_min:1; /* normal min field specified */
|
||||||
uint8_t __reserved : 5;
|
uint8_t __reserved:5;
|
||||||
#endif
|
#endif
|
||||||
} analog_flag;
|
} analog_flag;
|
||||||
|
|
||||||
@ -569,20 +576,20 @@ struct sdr_record_full_sensor {
|
|||||||
struct sdr_record_mc_locator {
|
struct sdr_record_mc_locator {
|
||||||
uint8_t dev_slave_addr;
|
uint8_t dev_slave_addr;
|
||||||
#if WORDS_BIGENDIAN
|
#if WORDS_BIGENDIAN
|
||||||
uint8_t __reserved2 : 4;
|
uint8_t __reserved2:4;
|
||||||
uint8_t channel_num : 4;
|
uint8_t channel_num:4;
|
||||||
#else
|
#else
|
||||||
uint8_t channel_num : 4;
|
uint8_t channel_num:4;
|
||||||
uint8_t __reserved2 : 4;
|
uint8_t __reserved2:4;
|
||||||
#endif
|
#endif
|
||||||
#if WORDS_BIGENDIAN
|
#if WORDS_BIGENDIAN
|
||||||
uint8_t pwr_state_notif : 3;
|
uint8_t pwr_state_notif:3;
|
||||||
uint8_t __reserved3 : 1;
|
uint8_t __reserved3:1;
|
||||||
uint8_t global_init : 4;
|
uint8_t global_init:4;
|
||||||
#else
|
#else
|
||||||
uint8_t global_init : 4;
|
uint8_t global_init:4;
|
||||||
uint8_t __reserved3 : 1;
|
uint8_t __reserved3:1;
|
||||||
uint8_t pwr_state_notif : 3;
|
uint8_t pwr_state_notif:3;
|
||||||
#endif
|
#endif
|
||||||
uint8_t dev_support;
|
uint8_t dev_support;
|
||||||
uint8_t __reserved4[3];
|
uint8_t __reserved4[3];
|
||||||
@ -596,22 +603,22 @@ struct sdr_record_fru_locator {
|
|||||||
uint8_t dev_slave_addr;
|
uint8_t dev_slave_addr;
|
||||||
uint8_t device_id;
|
uint8_t device_id;
|
||||||
#if WORDS_BIGENDIAN
|
#if WORDS_BIGENDIAN
|
||||||
uint8_t logical : 1;
|
uint8_t logical:1;
|
||||||
uint8_t __reserved2 : 2;
|
uint8_t __reserved2:2;
|
||||||
uint8_t lun : 2;
|
uint8_t lun:2;
|
||||||
uint8_t bus : 3;
|
uint8_t bus:3;
|
||||||
#else
|
#else
|
||||||
uint8_t bus : 3;
|
uint8_t bus:3;
|
||||||
uint8_t lun : 2;
|
uint8_t lun:2;
|
||||||
uint8_t __reserved2 : 2;
|
uint8_t __reserved2:2;
|
||||||
uint8_t logical : 1;
|
uint8_t logical:1;
|
||||||
#endif
|
#endif
|
||||||
#if WORDS_BIGENDIAN
|
#if WORDS_BIGENDIAN
|
||||||
uint8_t channel_num : 4;
|
uint8_t channel_num:4;
|
||||||
uint8_t __reserved3 : 4;
|
uint8_t __reserved3:4;
|
||||||
#else
|
#else
|
||||||
uint8_t __reserved3 : 4;
|
uint8_t __reserved3:4;
|
||||||
uint8_t channel_num : 4;
|
uint8_t channel_num:4;
|
||||||
#endif
|
#endif
|
||||||
uint8_t __reserved4;
|
uint8_t __reserved4;
|
||||||
uint8_t dev_type;
|
uint8_t dev_type;
|
||||||
@ -626,20 +633,20 @@ struct sdr_record_generic_locator {
|
|||||||
uint8_t dev_access_addr;
|
uint8_t dev_access_addr;
|
||||||
uint8_t dev_slave_addr;
|
uint8_t dev_slave_addr;
|
||||||
#if WORDS_BIGENDIAN
|
#if WORDS_BIGENDIAN
|
||||||
uint8_t channel_num : 3;
|
uint8_t channel_num:3;
|
||||||
uint8_t lun : 2;
|
uint8_t lun:2;
|
||||||
uint8_t bus : 3;
|
uint8_t bus:3;
|
||||||
#else
|
#else
|
||||||
uint8_t bus : 3;
|
uint8_t bus:3;
|
||||||
uint8_t lun : 2;
|
uint8_t lun:2;
|
||||||
uint8_t channel_num : 3;
|
uint8_t channel_num:3;
|
||||||
#endif
|
#endif
|
||||||
#if WORDS_BIGENDIAN
|
#if WORDS_BIGENDIAN
|
||||||
uint8_t addr_span : 3;
|
uint8_t addr_span:3;
|
||||||
uint8_t __reserved1 : 5;
|
uint8_t __reserved1:5;
|
||||||
#else
|
#else
|
||||||
uint8_t __reserved1 : 5;
|
uint8_t __reserved1:5;
|
||||||
uint8_t addr_span : 3;
|
uint8_t addr_span:3;
|
||||||
#endif
|
#endif
|
||||||
uint8_t __reserved2;
|
uint8_t __reserved2;
|
||||||
uint8_t dev_type;
|
uint8_t dev_type;
|
||||||
@ -654,15 +661,15 @@ struct sdr_record_entity_assoc {
|
|||||||
struct entity_id entity; /* container entity ID and instance */
|
struct entity_id entity; /* container entity ID and instance */
|
||||||
struct {
|
struct {
|
||||||
#if WORDS_BIGENDIAN
|
#if WORDS_BIGENDIAN
|
||||||
uint8_t isrange : 1;
|
uint8_t isrange:1;
|
||||||
uint8_t islinked : 1;
|
uint8_t islinked:1;
|
||||||
uint8_t isaccessable : 1;
|
uint8_t isaccessable:1;
|
||||||
uint8_t __reserved : 5;
|
uint8_t __reserved:5;
|
||||||
#else
|
#else
|
||||||
uint8_t __reserved : 5;
|
uint8_t __reserved:5;
|
||||||
uint8_t isaccessable : 1;
|
uint8_t isaccessable:1;
|
||||||
uint8_t islinked : 1;
|
uint8_t islinked:1;
|
||||||
uint8_t isrange : 1;
|
uint8_t isrange:1;
|
||||||
#endif
|
#endif
|
||||||
} flags;
|
} flags;
|
||||||
uint8_t entity_id_1; /* entity ID 1 | range 1 entity */
|
uint8_t entity_id_1; /* entity ID 1 | range 1 entity */
|
||||||
@ -676,11 +683,10 @@ struct sdr_record_entity_assoc {
|
|||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
struct sdr_record_oem {
|
struct sdr_record_oem {
|
||||||
uint8_t * data;
|
uint8_t *data;
|
||||||
int data_len;
|
int data_len;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The Get SDR Repository Info response structure
|
* The Get SDR Repository Info response structure
|
||||||
* From table 33-3 of the IPMI v2.0 spec
|
* From table 33-3 of the IPMI v2.0 spec
|
||||||
@ -693,29 +699,25 @@ struct get_sdr_repository_info_rsp {
|
|||||||
uint8_t most_recent_addition_timestamp[4];
|
uint8_t most_recent_addition_timestamp[4];
|
||||||
uint8_t most_recent_erase_timestamp[4];
|
uint8_t most_recent_erase_timestamp[4];
|
||||||
#if WORDS_BIGENDIAN
|
#if WORDS_BIGENDIAN
|
||||||
uint8_t overflow_flag : 1;
|
uint8_t overflow_flag:1;
|
||||||
uint8_t modal_update_support : 2;
|
uint8_t modal_update_support:2;
|
||||||
uint8_t __reserved1 : 1;
|
uint8_t __reserved1:1;
|
||||||
uint8_t delete_sdr_supported : 1;
|
uint8_t delete_sdr_supported:1;
|
||||||
uint8_t partial_add_sdr_supported : 1;
|
uint8_t partial_add_sdr_supported:1;
|
||||||
uint8_t reserve_sdr_repository_supported : 1;
|
uint8_t reserve_sdr_repository_supported:1;
|
||||||
uint8_t get_sdr_repository_allo_info_supported : 1;
|
uint8_t get_sdr_repository_allo_info_supported:1;
|
||||||
#else
|
#else
|
||||||
uint8_t get_sdr_repository_allo_info_supported : 1;
|
uint8_t get_sdr_repository_allo_info_supported:1;
|
||||||
uint8_t reserve_sdr_repository_supported : 1;
|
uint8_t reserve_sdr_repository_supported:1;
|
||||||
uint8_t partial_add_sdr_supported : 1;
|
uint8_t partial_add_sdr_supported:1;
|
||||||
uint8_t delete_sdr_supported : 1;
|
uint8_t delete_sdr_supported:1;
|
||||||
uint8_t __reserved1 : 1;
|
uint8_t __reserved1:1;
|
||||||
uint8_t modal_update_support : 2;
|
uint8_t modal_update_support:2;
|
||||||
uint8_t overflow_flag : 1;
|
uint8_t overflow_flag:1;
|
||||||
#endif
|
#endif
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
struct ipmi_sdr_iterator {
|
||||||
|
|
||||||
|
|
||||||
struct ipmi_sdr_iterator
|
|
||||||
{
|
|
||||||
uint16_t reservation;
|
uint16_t reservation;
|
||||||
int total;
|
int total;
|
||||||
int next;
|
int next;
|
||||||
@ -724,101 +726,132 @@ struct ipmi_sdr_iterator
|
|||||||
struct sdr_record_list {
|
struct sdr_record_list {
|
||||||
uint16_t id;
|
uint16_t id;
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
struct sdr_record_list * next;
|
struct sdr_record_list *next;
|
||||||
union {
|
union {
|
||||||
struct sdr_record_full_sensor * full;
|
struct sdr_record_full_sensor *full;
|
||||||
struct sdr_record_compact_sensor * compact;
|
struct sdr_record_compact_sensor *compact;
|
||||||
struct sdr_record_eventonly_sensor * eventonly;
|
struct sdr_record_eventonly_sensor *eventonly;
|
||||||
struct sdr_record_generic_locator * genloc;
|
struct sdr_record_generic_locator *genloc;
|
||||||
struct sdr_record_fru_locator * fruloc;
|
struct sdr_record_fru_locator *fruloc;
|
||||||
struct sdr_record_mc_locator * mcloc;
|
struct sdr_record_mc_locator *mcloc;
|
||||||
struct sdr_record_entity_assoc * entassoc;
|
struct sdr_record_entity_assoc *entassoc;
|
||||||
struct sdr_record_oem * oem;
|
struct sdr_record_oem *oem;
|
||||||
} record;
|
} record;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* unit description codes (IPMI v1.5 section 37.16) */
|
/* unit description codes (IPMI v1.5 section 37.16) */
|
||||||
#define UNIT_MAX 0x90
|
#define UNIT_MAX 0x90
|
||||||
static const char * unit_desc[] __attribute__((unused)) = {
|
static const char *unit_desc[] __attribute__ ((unused)) = {
|
||||||
"unspecified",
|
"unspecified",
|
||||||
"degrees C", "degrees F", "degrees K",
|
"degrees C", "degrees F", "degrees K",
|
||||||
"Volts", "Amps", "Watts", "Joules",
|
"Volts", "Amps", "Watts", "Joules",
|
||||||
"Coulombs", "VA", "Nits",
|
"Coulombs", "VA", "Nits",
|
||||||
"lumen", "lux", "Candela",
|
"lumen", "lux", "Candela",
|
||||||
"kPa", "PSI", "Newton",
|
"kPa", "PSI", "Newton",
|
||||||
"CFM", "RPM", "Hz",
|
"CFM", "RPM", "Hz",
|
||||||
"microsecond", "millisecond", "second", "minute", "hour", "day", "week",
|
"microsecond", "millisecond", "second", "minute", "hour",
|
||||||
"mil", "inches", "feet", "cu in", "cu feet", "mm", "cm", "m", "cu cm", "cu m",
|
"day", "week", "mil", "inches", "feet", "cu in", "cu feet",
|
||||||
"liters", "fluid ounce",
|
"mm", "cm", "m", "cu cm", "cu m", "liters", "fluid ounce",
|
||||||
"radians", "steradians", "revolutions", "cycles", "gravities",
|
"radians", "steradians", "revolutions", "cycles",
|
||||||
"ounce", "pound", "ft-lb", "oz-in",
|
"gravities", "ounce", "pound", "ft-lb", "oz-in", "gauss",
|
||||||
"gauss", "gilberts", "henry", "millihenry",
|
"gilberts", "henry", "millihenry", "farad", "microfarad",
|
||||||
"farad", "microfarad", "ohms", "siemens", "mole", "becquerel",
|
"ohms", "siemens", "mole", "becquerel", "PPM", "reserved",
|
||||||
"PPM", "reserved",
|
"Decibels", "DbA", "DbC", "gray", "sievert",
|
||||||
"Decibels", "DbA", "DbC",
|
"color temp deg K", "bit", "kilobit", "megabit", "gigabit",
|
||||||
"gray", "sievert", "color temp deg K",
|
"byte", "kilobyte", "megabyte", "gigabyte", "word", "dword",
|
||||||
"bit", "kilobit", "megabit", "gigabit",
|
"qword", "line", "hit", "miss", "retry", "reset",
|
||||||
"byte", "kilobyte", "megabyte", "gigabyte",
|
"overflow", "underrun", "collision", "packets", "messages",
|
||||||
"word", "dword", "qword", "line",
|
"characters", "error", "correctable error", "uncorrectable error",};
|
||||||
"hit", "miss", "retry", "reset",
|
|
||||||
"overflow", "underrun",
|
|
||||||
"collision", "packets",
|
|
||||||
"messages", "characters",
|
|
||||||
"error", "correctable error", "uncorrectable error",
|
|
||||||
};
|
|
||||||
|
|
||||||
/* sensor type codes (IPMI v1.5 table 36.3) */
|
/* sensor type codes (IPMI v1.5 table 36.3) */
|
||||||
#define SENSOR_TYPE_MAX 0x29
|
#define SENSOR_TYPE_MAX 0x29
|
||||||
static const char * sensor_type_desc[] __attribute__((unused)) = {
|
static const char *sensor_type_desc[] __attribute__ ((unused)) = {
|
||||||
"reserved",
|
"reserved",
|
||||||
"Temperature", "Voltage", "Current", "Fan", "Physical Security", "Platform Security",
|
"Temperature", "Voltage", "Current", "Fan",
|
||||||
"Processor", "Power Supply", "Power Unit", "Cooling Device", "Other", "Memory", "Drive Slot / Bay",
|
"Physical Security", "Platform Security", "Processor",
|
||||||
"POST Memory Resize", "System Firmwares", "Event Logging Disabled", "Watchdog", "System Event",
|
"Power Supply", "Power Unit", "Cooling Device", "Other",
|
||||||
"Critical Interrupt", "Button", "Module / Board", "Microcontroller", "Add-in Card",
|
"Memory", "Drive Slot / Bay", "POST Memory Resize",
|
||||||
"Chassis", "Chip Set", "Other FRU", "Cable / Interconnect", "Terminator", "System Boot Initiated",
|
"System Firmwares", "Event Logging Disabled", "Watchdog",
|
||||||
"Boot Error", "OS Boot", "OS Critical Stop", "Slot / Connector", "System ACPI Power State", "Watchdog",
|
"System Event", "Critical Interrupt", "Button",
|
||||||
"Platform Alert", "Entity Presence", "Monitor ASIC", "LAN", "Management Subsystem Health", "Battery"
|
"Module / Board", "Microcontroller", "Add-in Card",
|
||||||
};
|
"Chassis", "Chip Set", "Other FRU", "Cable / Interconnect",
|
||||||
|
"Terminator", "System Boot Initiated", "Boot Error",
|
||||||
|
"OS Boot", "OS Critical Stop", "Slot / Connector",
|
||||||
|
"System ACPI Power State", "Watchdog", "Platform Alert",
|
||||||
|
"Entity Presence", "Monitor ASIC", "LAN",
|
||||||
|
"Management Subsystem Health", "Battery"};
|
||||||
|
|
||||||
struct ipmi_sdr_iterator * ipmi_sdr_start(struct ipmi_intf * intf);
|
struct ipmi_sdr_iterator *ipmi_sdr_start(struct ipmi_intf *intf);
|
||||||
struct sdr_get_rs * ipmi_sdr_get_next_header(struct ipmi_intf * intf, struct ipmi_sdr_iterator * i);
|
struct sdr_get_rs *ipmi_sdr_get_next_header(struct ipmi_intf *intf,
|
||||||
uint8_t * ipmi_sdr_get_record(struct ipmi_intf * intf, struct sdr_get_rs * header, struct ipmi_sdr_iterator * i);
|
struct ipmi_sdr_iterator *i);
|
||||||
void ipmi_sdr_end(struct ipmi_intf * intf, struct ipmi_sdr_iterator * i);
|
uint8_t *ipmi_sdr_get_record(struct ipmi_intf *intf, struct sdr_get_rs *header,
|
||||||
int ipmi_sdr_print_sdr(struct ipmi_intf * intf, uint8_t type);
|
struct ipmi_sdr_iterator *i);
|
||||||
int ipmi_sdr_print_rawentry(struct ipmi_intf * intf, uint8_t type, uint8_t * raw, int len);
|
void ipmi_sdr_end(struct ipmi_intf *intf, struct ipmi_sdr_iterator *i);
|
||||||
int ipmi_sdr_print_listentry(struct ipmi_intf * intf, struct sdr_record_list * entry);
|
int ipmi_sdr_print_sdr(struct ipmi_intf *intf, uint8_t type);
|
||||||
char * ipmi_sdr_get_unit_string(uint8_t type, uint8_t base, uint8_t modifier);
|
int ipmi_sdr_print_rawentry(struct ipmi_intf *intf, uint8_t type, uint8_t * raw,
|
||||||
const char * ipmi_sdr_get_status(struct sdr_record_full_sensor * sensor, uint8_t stat);
|
int len);
|
||||||
double sdr_convert_sensor_reading(struct sdr_record_full_sensor * sensor, uint8_t val);
|
int ipmi_sdr_print_listentry(struct ipmi_intf *intf,
|
||||||
uint8_t sdr_convert_sensor_value_to_raw(struct sdr_record_full_sensor * sensor, double val);
|
struct sdr_record_list *entry);
|
||||||
struct ipmi_rs * ipmi_sdr_get_sensor_reading(struct ipmi_intf * intf, uint8_t sensor);
|
char *ipmi_sdr_get_unit_string(uint8_t type, uint8_t base, uint8_t modifier);
|
||||||
struct ipmi_rs * ipmi_sdr_get_sensor_reading_ipmb(struct ipmi_intf * intf, uint8_t sensor, uint8_t target);
|
const char *ipmi_sdr_get_status(struct sdr_record_full_sensor *sensor,
|
||||||
struct ipmi_rs * ipmi_sdr_get_sensor_thresholds(struct ipmi_intf * intf, uint8_t sensor);
|
uint8_t stat);
|
||||||
struct ipmi_rs * ipmi_sdr_get_sensor_hysteresis(struct ipmi_intf * intf, uint8_t sensor);
|
double sdr_convert_sensor_reading(struct sdr_record_full_sensor *sensor,
|
||||||
const char * ipmi_sdr_get_sensor_type_desc(const uint8_t type);
|
uint8_t val);
|
||||||
int ipmi_sdr_get_reservation(struct ipmi_intf * intf, uint16_t *reserve_id);
|
uint8_t sdr_convert_sensor_value_to_raw(struct sdr_record_full_sensor *sensor,
|
||||||
|
double val);
|
||||||
|
struct ipmi_rs *ipmi_sdr_get_sensor_reading(struct ipmi_intf *intf,
|
||||||
|
uint8_t sensor);
|
||||||
|
struct ipmi_rs *ipmi_sdr_get_sensor_reading_ipmb(struct ipmi_intf *intf,
|
||||||
|
uint8_t sensor,
|
||||||
|
uint8_t target);
|
||||||
|
struct ipmi_rs *ipmi_sdr_get_sensor_thresholds(struct ipmi_intf *intf,
|
||||||
|
uint8_t sensor);
|
||||||
|
struct ipmi_rs *ipmi_sdr_get_sensor_hysteresis(struct ipmi_intf *intf,
|
||||||
|
uint8_t sensor);
|
||||||
|
const char *ipmi_sdr_get_sensor_type_desc(const uint8_t type);
|
||||||
|
int ipmi_sdr_get_reservation(struct ipmi_intf *intf, uint16_t * reserve_id);
|
||||||
|
|
||||||
|
int ipmi_sdr_print_sensor_full(struct ipmi_intf *intf,
|
||||||
|
struct sdr_record_full_sensor *sensor);
|
||||||
|
int ipmi_sdr_print_sensor_compact(struct ipmi_intf *intf,
|
||||||
|
struct sdr_record_compact_sensor *sensor);
|
||||||
|
int ipmi_sdr_print_sensor_eventonly(struct ipmi_intf *intf,
|
||||||
|
struct sdr_record_eventonly_sensor *sensor);
|
||||||
|
int ipmi_sdr_print_sensor_generic_locator(struct ipmi_intf *intf,
|
||||||
|
struct sdr_record_generic_locator
|
||||||
|
*fru);
|
||||||
|
int ipmi_sdr_print_sensor_fru_locator(struct ipmi_intf *intf,
|
||||||
|
struct sdr_record_fru_locator *fru);
|
||||||
|
int ipmi_sdr_print_sensor_mc_locator(struct ipmi_intf *intf,
|
||||||
|
struct sdr_record_mc_locator *mc);
|
||||||
|
int ipmi_sdr_print_sensor_entity_assoc(struct ipmi_intf *intf,
|
||||||
|
struct sdr_record_entity_assoc *assoc);
|
||||||
|
|
||||||
int ipmi_sdr_print_sensor_full(struct ipmi_intf * intf, struct sdr_record_full_sensor * sensor);
|
struct sdr_record_list *ipmi_sdr_find_sdr_byentity(struct ipmi_intf *intf,
|
||||||
int ipmi_sdr_print_sensor_compact(struct ipmi_intf * intf, struct sdr_record_compact_sensor * sensor);
|
struct entity_id *entity);
|
||||||
int ipmi_sdr_print_sensor_eventonly(struct ipmi_intf * intf, struct sdr_record_eventonly_sensor * sensor);
|
struct sdr_record_list *ipmi_sdr_find_sdr_bynumtype(struct ipmi_intf *intf,
|
||||||
int ipmi_sdr_print_sensor_generic_locator(struct ipmi_intf * intf, struct sdr_record_generic_locator * fru);
|
uint8_t num, uint8_t type);
|
||||||
int ipmi_sdr_print_sensor_fru_locator(struct ipmi_intf * intf, struct sdr_record_fru_locator * fru);
|
struct sdr_record_list *ipmi_sdr_find_sdr_bysensortype(struct ipmi_intf *intf,
|
||||||
int ipmi_sdr_print_sensor_mc_locator(struct ipmi_intf * intf, struct sdr_record_mc_locator * mc);
|
uint8_t type);
|
||||||
int ipmi_sdr_print_sensor_entity_assoc(struct ipmi_intf * intf, struct sdr_record_entity_assoc * assoc);
|
struct sdr_record_list *ipmi_sdr_find_sdr_byid(struct ipmi_intf *intf,
|
||||||
|
char *id);
|
||||||
struct sdr_record_list * ipmi_sdr_find_sdr_byentity(struct ipmi_intf * intf, struct entity_id * entity);
|
struct sdr_record_list *ipmi_sdr_find_sdr_bytype(struct ipmi_intf *intf,
|
||||||
struct sdr_record_list * ipmi_sdr_find_sdr_bynumtype(struct ipmi_intf * intf, uint8_t num, uint8_t type);
|
uint8_t type);
|
||||||
struct sdr_record_list * ipmi_sdr_find_sdr_bysensortype(struct ipmi_intf * intf, uint8_t type);
|
int ipmi_sdr_list_cache(struct ipmi_intf *intf);
|
||||||
struct sdr_record_list * ipmi_sdr_find_sdr_byid(struct ipmi_intf * intf, char * id);
|
int ipmi_sdr_list_cache_fromfile(struct ipmi_intf *intf, const char *ifile);
|
||||||
struct sdr_record_list * ipmi_sdr_find_sdr_bytype(struct ipmi_intf * intf, uint8_t type);
|
void ipmi_sdr_list_empty(struct ipmi_intf *intf);
|
||||||
int ipmi_sdr_list_cache(struct ipmi_intf * intf);
|
int ipmi_sdr_print_info(struct ipmi_intf *intf);
|
||||||
int ipmi_sdr_list_cache_fromfile(struct ipmi_intf * intf, const char * ifile);
|
void ipmi_sdr_print_discrete_state(const char *desc, uint8_t sensor_type,
|
||||||
void ipmi_sdr_list_empty(struct ipmi_intf * intf);
|
uint8_t event_type, uint8_t state1,
|
||||||
int ipmi_sdr_print_info(struct ipmi_intf * intf);
|
uint8_t state2);
|
||||||
void ipmi_sdr_print_discrete_state(const char * desc, uint8_t sensor_type, uint8_t event_type, uint8_t state1, uint8_t state2);
|
void ipmi_sdr_print_discrete_state_mini(const char *separator,
|
||||||
void ipmi_sdr_print_discrete_state_mini(const char * separator, uint8_t sensor_type, uint8_t event_type, uint8_t state1, uint8_t state2);
|
uint8_t sensor_type, uint8_t event_type,
|
||||||
int ipmi_sdr_print_sensor_event_status(struct ipmi_intf * intf, uint8_t sensor_num, uint8_t sensor_type, uint8_t event_type, int numeric_fmt);
|
uint8_t state1, uint8_t state2);
|
||||||
int ipmi_sdr_print_sensor_event_enable(struct ipmi_intf * intf, uint8_t sensor_num, uint8_t sensor_type, uint8_t event_type, int numeric_fmt);
|
int ipmi_sdr_print_sensor_event_status(struct ipmi_intf *intf,
|
||||||
|
uint8_t sensor_num, uint8_t sensor_type,
|
||||||
|
uint8_t event_type, int numeric_fmt);
|
||||||
|
int ipmi_sdr_print_sensor_event_enable(struct ipmi_intf *intf,
|
||||||
|
uint8_t sensor_num, uint8_t sensor_type,
|
||||||
|
uint8_t event_type, int numeric_fmt);
|
||||||
|
|
||||||
#endif /* IPMI_SDR_H */
|
#endif /* IPMI_SDR_H */
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -51,15 +51,14 @@ extern int verbose;
|
|||||||
|
|
||||||
static
|
static
|
||||||
struct ipmi_rs *
|
struct ipmi_rs *
|
||||||
ipmi_sensor_set_sensor_thresholds(struct ipmi_intf * intf,
|
ipmi_sensor_set_sensor_thresholds(struct ipmi_intf *intf,
|
||||||
uint8_t sensor,
|
uint8_t sensor,
|
||||||
uint8_t threshold,
|
uint8_t threshold, uint8_t setting)
|
||||||
uint8_t setting)
|
|
||||||
{
|
{
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
static struct sensor_set_thresh_rq set_thresh_rq;
|
static struct sensor_set_thresh_rq set_thresh_rq;
|
||||||
|
|
||||||
memset(&set_thresh_rq, 0, sizeof(set_thresh_rq));
|
memset(&set_thresh_rq, 0, sizeof (set_thresh_rq));
|
||||||
set_thresh_rq.sensor_num = sensor;
|
set_thresh_rq.sensor_num = sensor;
|
||||||
set_thresh_rq.set_mask = threshold;
|
set_thresh_rq.set_mask = threshold;
|
||||||
if (threshold == UPPER_NON_RECOV_SPECIFIED)
|
if (threshold == UPPER_NON_RECOV_SPECIFIED)
|
||||||
@ -77,29 +76,29 @@ ipmi_sensor_set_sensor_thresholds(struct ipmi_intf * intf,
|
|||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
memset(&req, 0, sizeof(req));
|
memset(&req, 0, sizeof (req));
|
||||||
req.msg.netfn = IPMI_NETFN_SE;
|
req.msg.netfn = IPMI_NETFN_SE;
|
||||||
req.msg.cmd = SET_SENSOR_THRESHOLDS;
|
req.msg.cmd = SET_SENSOR_THRESHOLDS;
|
||||||
req.msg.data = (uint8_t *)&set_thresh_rq;
|
req.msg.data = (uint8_t *) & set_thresh_rq;
|
||||||
req.msg.data_len = sizeof(set_thresh_rq);
|
req.msg.data_len = sizeof (set_thresh_rq);
|
||||||
|
|
||||||
return intf->sendrecv(intf, &req);
|
return intf->sendrecv(intf, &req);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ipmi_sensor_print_full_discrete(struct ipmi_intf * intf,
|
ipmi_sensor_print_full_discrete(struct ipmi_intf *intf,
|
||||||
struct sdr_record_full_sensor * sensor)
|
struct sdr_record_full_sensor *sensor)
|
||||||
{
|
{
|
||||||
char id[17];
|
char id[17];
|
||||||
char * unitstr = "discrete";
|
char *unitstr = "discrete";
|
||||||
int validread=1;
|
int validread = 1;
|
||||||
uint8_t val = 0;
|
uint8_t val = 0;
|
||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs *rsp;
|
||||||
|
|
||||||
if (sensor == NULL)
|
if (sensor == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
memset(id, 0, sizeof(id));
|
memset(id, 0, sizeof (id));
|
||||||
memcpy(id, sensor->id_string, 16);
|
memcpy(id, sensor->id_string, 16);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -119,12 +118,9 @@ ipmi_sensor_print_full_discrete(struct ipmi_intf * intf,
|
|||||||
val = rsp->data[0];
|
val = rsp->data[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (csv_output)
|
if (csv_output) {
|
||||||
{
|
|
||||||
/* NOT IMPLEMENTED */
|
/* NOT IMPLEMENTED */
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
if (verbose == 0) {
|
if (verbose == 0) {
|
||||||
/* output format
|
/* output format
|
||||||
* id value units status thresholds....
|
* id value units status thresholds....
|
||||||
@ -133,14 +129,10 @@ ipmi_sensor_print_full_discrete(struct ipmi_intf * intf,
|
|||||||
if (validread) {
|
if (validread) {
|
||||||
printf("| 0x%-8x | %-10s | 0x%02x%02x",
|
printf("| 0x%-8x | %-10s | 0x%02x%02x",
|
||||||
val,
|
val,
|
||||||
unitstr,
|
unitstr, rsp->data[2], rsp->data[3]);
|
||||||
rsp->data[2],
|
|
||||||
rsp->data[3]);
|
|
||||||
} else {
|
} else {
|
||||||
printf("| %-10s | %-10s | %-6s",
|
printf("| %-10s | %-10s | %-6s",
|
||||||
"na",
|
"na", unitstr, "na");
|
||||||
unitstr,
|
|
||||||
"na");
|
|
||||||
}
|
}
|
||||||
printf("| %-10s| %-10s| %-10s| %-10s| %-10s| %-10s",
|
printf("| %-10s| %-10s| %-10s| %-10s| %-10s| %-10s",
|
||||||
"na", "na", "na", "na", "na", "na");
|
"na", "na", "na", "na", "na", "na");
|
||||||
@ -152,7 +144,8 @@ ipmi_sensor_print_full_discrete(struct ipmi_intf * intf,
|
|||||||
printf(" Entity ID : %d.%d\n",
|
printf(" Entity ID : %d.%d\n",
|
||||||
sensor->entity.id, sensor->entity.instance);
|
sensor->entity.id, sensor->entity.instance);
|
||||||
printf(" Sensor Type (Discrete): %s\n",
|
printf(" Sensor Type (Discrete): %s\n",
|
||||||
ipmi_sdr_get_sensor_type_desc(sensor->sensor.type));
|
ipmi_sdr_get_sensor_type_desc(sensor->sensor.
|
||||||
|
type));
|
||||||
ipmi_sdr_print_discrete_state("States Asserted",
|
ipmi_sdr_print_discrete_state("States Asserted",
|
||||||
sensor->sensor.type,
|
sensor->sensor.type,
|
||||||
sensor->event_type,
|
sensor->event_type,
|
||||||
@ -166,23 +159,23 @@ ipmi_sensor_print_full_discrete(struct ipmi_intf * intf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ipmi_sensor_print_full_analog(struct ipmi_intf * intf,
|
ipmi_sensor_print_full_analog(struct ipmi_intf *intf,
|
||||||
struct sdr_record_full_sensor * sensor)
|
struct sdr_record_full_sensor *sensor)
|
||||||
{
|
{
|
||||||
char unitstr[16], id[17];
|
char unitstr[16], id[17];
|
||||||
int i=0, validread=1, thresh_available = 1;
|
int i = 0, validread = 1, thresh_available = 1;
|
||||||
double val = 0.0;
|
double val = 0.0;
|
||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs *rsp;
|
||||||
char * status = NULL;
|
char *status = NULL;
|
||||||
|
|
||||||
if (sensor == NULL)
|
if (sensor == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
memset(id, 0, sizeof(id));
|
memset(id, 0, sizeof (id));
|
||||||
memcpy(id, sensor->id_string, 16);
|
memcpy(id, sensor->id_string, 16);
|
||||||
|
|
||||||
/* only handle linear and linearized sensors (for now) */
|
/* only handle linear and linearized sensors (for now) */
|
||||||
if (sensor->linearization>=SDR_SENSOR_L_NONLINEAR) {
|
if (sensor->linearization >= SDR_SENSOR_L_NONLINEAR) {
|
||||||
printf("sensor %s non-linear!\n", id);
|
printf("sensor %s non-linear!\n", id);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -204,28 +197,27 @@ ipmi_sensor_print_full_analog(struct ipmi_intf * intf,
|
|||||||
val = (rsp->data[0] > 0)
|
val = (rsp->data[0] > 0)
|
||||||
? sdr_convert_sensor_reading(sensor, rsp->data[0])
|
? sdr_convert_sensor_reading(sensor, rsp->data[0])
|
||||||
: 0;
|
: 0;
|
||||||
status = (char*)ipmi_sdr_get_status(sensor, rsp->data[2]);
|
status = (char *) ipmi_sdr_get_status(sensor, rsp->data[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Figure out units
|
* Figure out units
|
||||||
*/
|
*/
|
||||||
memset(unitstr, 0, sizeof(unitstr));
|
memset(unitstr, 0, sizeof (unitstr));
|
||||||
switch (sensor->unit.modifier)
|
switch (sensor->unit.modifier) {
|
||||||
{
|
|
||||||
case 2:
|
case 2:
|
||||||
i += snprintf(unitstr, sizeof(unitstr), "%s * %s",
|
i += snprintf(unitstr, sizeof (unitstr), "%s * %s",
|
||||||
unit_desc[sensor->unit.type.base],
|
unit_desc[sensor->unit.type.base],
|
||||||
unit_desc[sensor->unit.type.modifier]);
|
unit_desc[sensor->unit.type.modifier]);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
i += snprintf(unitstr, sizeof(unitstr), "%s/%s",
|
i += snprintf(unitstr, sizeof (unitstr), "%s/%s",
|
||||||
unit_desc[sensor->unit.type.base],
|
unit_desc[sensor->unit.type.base],
|
||||||
unit_desc[sensor->unit.type.modifier]);
|
unit_desc[sensor->unit.type.modifier]);
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
default:
|
default:
|
||||||
i += snprintf(unitstr, sizeof(unitstr), "%s",
|
i += snprintf(unitstr, sizeof (unitstr), "%s",
|
||||||
unit_desc[sensor->unit.type.base]);
|
unit_desc[sensor->unit.type.base]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -237,14 +229,10 @@ ipmi_sensor_print_full_analog(struct ipmi_intf * intf,
|
|||||||
if (rsp == NULL)
|
if (rsp == NULL)
|
||||||
thresh_available = 0;
|
thresh_available = 0;
|
||||||
|
|
||||||
if (csv_output)
|
if (csv_output) {
|
||||||
{
|
|
||||||
/* NOT IPMLEMENTED */
|
/* NOT IPMLEMENTED */
|
||||||
}
|
} else {
|
||||||
else
|
if (verbose == 0) {
|
||||||
{
|
|
||||||
if (verbose == 0)
|
|
||||||
{
|
|
||||||
/* output format
|
/* output format
|
||||||
* id value units status thresholds....
|
* id value units status thresholds....
|
||||||
*/
|
*/
|
||||||
@ -256,43 +244,51 @@ ipmi_sensor_print_full_analog(struct ipmi_intf * intf,
|
|||||||
printf("| %-10s | %-10s | %-6s",
|
printf("| %-10s | %-10s | %-6s",
|
||||||
"na", unitstr, "na");
|
"na", unitstr, "na");
|
||||||
}
|
}
|
||||||
if (thresh_available)
|
if (thresh_available) {
|
||||||
{
|
|
||||||
if (rsp->data[0] & LOWER_NON_RECOV_SPECIFIED)
|
if (rsp->data[0] & LOWER_NON_RECOV_SPECIFIED)
|
||||||
printf("| %-10.3f", sdr_convert_sensor_reading(sensor, rsp->data[3]));
|
printf("| %-10.3f",
|
||||||
|
sdr_convert_sensor_reading
|
||||||
|
(sensor, rsp->data[3]));
|
||||||
else
|
else
|
||||||
printf("| %-10s", "na");
|
printf("| %-10s", "na");
|
||||||
if (rsp->data[0] & LOWER_CRIT_SPECIFIED)
|
if (rsp->data[0] & LOWER_CRIT_SPECIFIED)
|
||||||
printf("| %-10.3f", sdr_convert_sensor_reading(sensor, rsp->data[2]));
|
printf("| %-10.3f",
|
||||||
|
sdr_convert_sensor_reading
|
||||||
|
(sensor, rsp->data[2]));
|
||||||
else
|
else
|
||||||
printf("| %-10s", "na");
|
printf("| %-10s", "na");
|
||||||
if (rsp->data[0] & LOWER_NON_CRIT_SPECIFIED)
|
if (rsp->data[0] & LOWER_NON_CRIT_SPECIFIED)
|
||||||
printf("| %-10.3f", sdr_convert_sensor_reading(sensor, rsp->data[1]));
|
printf("| %-10.3f",
|
||||||
|
sdr_convert_sensor_reading
|
||||||
|
(sensor, rsp->data[1]));
|
||||||
else
|
else
|
||||||
printf("| %-10s", "na");
|
printf("| %-10s", "na");
|
||||||
if (rsp->data[0] & UPPER_NON_CRIT_SPECIFIED)
|
if (rsp->data[0] & UPPER_NON_CRIT_SPECIFIED)
|
||||||
printf("| %-10.3f", sdr_convert_sensor_reading(sensor, rsp->data[4]));
|
printf("| %-10.3f",
|
||||||
|
sdr_convert_sensor_reading
|
||||||
|
(sensor, rsp->data[4]));
|
||||||
else
|
else
|
||||||
printf("| %-10s", "na");
|
printf("| %-10s", "na");
|
||||||
if (rsp->data[0] & UPPER_CRIT_SPECIFIED)
|
if (rsp->data[0] & UPPER_CRIT_SPECIFIED)
|
||||||
printf("| %-10.3f", sdr_convert_sensor_reading(sensor, rsp->data[5]));
|
printf("| %-10.3f",
|
||||||
|
sdr_convert_sensor_reading
|
||||||
|
(sensor, rsp->data[5]));
|
||||||
else
|
else
|
||||||
printf("| %-10s", "na");
|
printf("| %-10s", "na");
|
||||||
if (rsp->data[0] & UPPER_NON_RECOV_SPECIFIED)
|
if (rsp->data[0] & UPPER_NON_RECOV_SPECIFIED)
|
||||||
printf("| %-10.3f", sdr_convert_sensor_reading(sensor, rsp->data[6]));
|
printf("| %-10.3f",
|
||||||
|
sdr_convert_sensor_reading
|
||||||
|
(sensor, rsp->data[6]));
|
||||||
else
|
else
|
||||||
printf("| %-10s", "na");
|
printf("| %-10s", "na");
|
||||||
}
|
} else {
|
||||||
else
|
printf
|
||||||
{
|
("| %-10s| %-10s| %-10s| %-10s| %-10s| %-10s",
|
||||||
printf("| %-10s| %-10s| %-10s| %-10s| %-10s| %-10s",
|
|
||||||
"na", "na", "na", "na", "na", "na");
|
"na", "na", "na", "na", "na", "na");
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("Sensor ID : %s (0x%x)\n",
|
printf("Sensor ID : %s (0x%x)\n",
|
||||||
id, sensor->keys.sensor_num);
|
id, sensor->keys.sensor_num);
|
||||||
|
|
||||||
@ -300,66 +296,89 @@ ipmi_sensor_print_full_analog(struct ipmi_intf * intf,
|
|||||||
sensor->entity.id, sensor->entity.instance);
|
sensor->entity.id, sensor->entity.instance);
|
||||||
|
|
||||||
printf(" Sensor Type (Analog) : %s\n",
|
printf(" Sensor Type (Analog) : %s\n",
|
||||||
ipmi_sdr_get_sensor_type_desc(sensor->sensor.type));
|
ipmi_sdr_get_sensor_type_desc(sensor->sensor.
|
||||||
|
type));
|
||||||
|
|
||||||
printf(" Sensor Reading : ");
|
printf(" Sensor Reading : ");
|
||||||
if (validread) {
|
if (validread) {
|
||||||
uint16_t raw_tol = __TO_TOL(sensor->mtol);
|
uint16_t raw_tol = __TO_TOL(sensor->mtol);
|
||||||
double tol = sdr_convert_sensor_reading(sensor, raw_tol * 2);
|
double tol =
|
||||||
|
sdr_convert_sensor_reading(sensor,
|
||||||
|
raw_tol * 2);
|
||||||
printf("%.*f (+/- %.*f) %s\n",
|
printf("%.*f (+/- %.*f) %s\n",
|
||||||
(val==(int)val) ? 0 : 3,
|
(val == (int) val) ? 0 : 3, val,
|
||||||
val,
|
(tol == (int) tol) ? 0 : 3, tol,
|
||||||
(tol==(int)tol) ? 0 : 3,
|
|
||||||
tol,
|
|
||||||
unitstr);
|
unitstr);
|
||||||
printf(" Status : %s\n", status ? : "");
|
printf(" Status : %s\n",
|
||||||
|
status ? : "");
|
||||||
|
|
||||||
if (thresh_available)
|
if (thresh_available) {
|
||||||
{
|
if (rsp->
|
||||||
if (rsp->data[0] & LOWER_NON_RECOV_SPECIFIED)
|
data[0] & LOWER_NON_RECOV_SPECIFIED)
|
||||||
printf(" Lower Non-Recoverable : %.3f\n",
|
printf
|
||||||
sdr_convert_sensor_reading(sensor, rsp->data[3]));
|
(" Lower Non-Recoverable : %.3f\n",
|
||||||
|
sdr_convert_sensor_reading
|
||||||
|
(sensor, rsp->data[3]));
|
||||||
else
|
else
|
||||||
printf(" Lower Non-Recoverable : na\n");
|
printf
|
||||||
|
(" Lower Non-Recoverable : na\n");
|
||||||
if (rsp->data[0] & LOWER_CRIT_SPECIFIED)
|
if (rsp->data[0] & LOWER_CRIT_SPECIFIED)
|
||||||
printf(" Lower Critical : %.3f\n",
|
printf
|
||||||
sdr_convert_sensor_reading(sensor, rsp->data[2]));
|
(" Lower Critical : %.3f\n",
|
||||||
|
sdr_convert_sensor_reading
|
||||||
|
(sensor, rsp->data[2]));
|
||||||
else
|
else
|
||||||
printf(" Lower Critical : na\n");
|
printf
|
||||||
if (rsp->data[0] & LOWER_NON_CRIT_SPECIFIED)
|
(" Lower Critical : na\n");
|
||||||
printf(" Lower Non-Critical : %.3f\n",
|
if (rsp->
|
||||||
sdr_convert_sensor_reading(sensor, rsp->data[1]));
|
data[0] & LOWER_NON_CRIT_SPECIFIED)
|
||||||
|
printf
|
||||||
|
(" Lower Non-Critical : %.3f\n",
|
||||||
|
sdr_convert_sensor_reading
|
||||||
|
(sensor, rsp->data[1]));
|
||||||
else
|
else
|
||||||
printf(" Lower Non-Critical : na\n");
|
printf
|
||||||
if (rsp->data[0] & UPPER_NON_CRIT_SPECIFIED)
|
(" Lower Non-Critical : na\n");
|
||||||
printf(" Upper Non-Critical : %.3f\n",
|
if (rsp->
|
||||||
sdr_convert_sensor_reading(sensor, rsp->data[4]));
|
data[0] & UPPER_NON_CRIT_SPECIFIED)
|
||||||
|
printf
|
||||||
|
(" Upper Non-Critical : %.3f\n",
|
||||||
|
sdr_convert_sensor_reading
|
||||||
|
(sensor, rsp->data[4]));
|
||||||
else
|
else
|
||||||
printf(" Upper Non-Critical : na\n");
|
printf
|
||||||
|
(" Upper Non-Critical : na\n");
|
||||||
if (rsp->data[0] & UPPER_CRIT_SPECIFIED)
|
if (rsp->data[0] & UPPER_CRIT_SPECIFIED)
|
||||||
printf(" Upper Critical : %.3f\n",
|
printf
|
||||||
sdr_convert_sensor_reading(sensor, rsp->data[5]));
|
(" Upper Critical : %.3f\n",
|
||||||
|
sdr_convert_sensor_reading
|
||||||
|
(sensor, rsp->data[5]));
|
||||||
else
|
else
|
||||||
printf(" Upper Critical : na\n");
|
printf
|
||||||
if (rsp->data[0] & UPPER_NON_RECOV_SPECIFIED)
|
(" Upper Critical : na\n");
|
||||||
printf(" Upper Non-Recoverable : %.3f\n",
|
if (rsp->
|
||||||
sdr_convert_sensor_reading(sensor, rsp->data[6]));
|
data[0] & UPPER_NON_RECOV_SPECIFIED)
|
||||||
|
printf
|
||||||
|
(" Upper Non-Recoverable : %.3f\n",
|
||||||
|
sdr_convert_sensor_reading
|
||||||
|
(sensor, rsp->data[6]));
|
||||||
else
|
else
|
||||||
printf(" Upper Non-Recoverable : na\n");
|
printf
|
||||||
|
(" Upper Non-Recoverable : na\n");
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("Not Present\n");
|
printf("Not Present\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
ipmi_sdr_print_sensor_event_status(intf,
|
ipmi_sdr_print_sensor_event_status(intf,
|
||||||
sensor->keys.sensor_num,
|
sensor->keys.
|
||||||
|
sensor_num,
|
||||||
sensor->sensor.type,
|
sensor->sensor.type,
|
||||||
sensor->event_type,
|
sensor->event_type,
|
||||||
ANALOG_SENSOR);
|
ANALOG_SENSOR);
|
||||||
ipmi_sdr_print_sensor_event_enable(intf,
|
ipmi_sdr_print_sensor_event_enable(intf,
|
||||||
sensor->keys.sensor_num,
|
sensor->keys.
|
||||||
|
sensor_num,
|
||||||
sensor->sensor.type,
|
sensor->sensor.type,
|
||||||
sensor->event_type,
|
sensor->event_type,
|
||||||
ANALOG_SENSOR);
|
ANALOG_SENSOR);
|
||||||
@ -372,8 +391,8 @@ ipmi_sensor_print_full_analog(struct ipmi_intf * intf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ipmi_sensor_print_full(struct ipmi_intf * intf,
|
ipmi_sensor_print_full(struct ipmi_intf *intf,
|
||||||
struct sdr_record_full_sensor * sensor)
|
struct sdr_record_full_sensor *sensor)
|
||||||
{
|
{
|
||||||
if (sensor->unit.analog != 3)
|
if (sensor->unit.analog != 3)
|
||||||
return ipmi_sensor_print_full_analog(intf, sensor);
|
return ipmi_sensor_print_full_analog(intf, sensor);
|
||||||
@ -382,19 +401,19 @@ ipmi_sensor_print_full(struct ipmi_intf * intf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ipmi_sensor_print_compact(struct ipmi_intf * intf,
|
ipmi_sensor_print_compact(struct ipmi_intf *intf,
|
||||||
struct sdr_record_compact_sensor * sensor)
|
struct sdr_record_compact_sensor *sensor)
|
||||||
{
|
{
|
||||||
char id[17];
|
char id[17];
|
||||||
char * unitstr = "discrete";
|
char *unitstr = "discrete";
|
||||||
int validread = 1;
|
int validread = 1;
|
||||||
uint8_t val = 0;
|
uint8_t val = 0;
|
||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs *rsp;
|
||||||
|
|
||||||
if (sensor == NULL)
|
if (sensor == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
memset(id, 0, sizeof(id));
|
memset(id, 0, sizeof (id));
|
||||||
memcpy(id, sensor->id_string, 16);
|
memcpy(id, sensor->id_string, 16);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -414,14 +433,10 @@ ipmi_sensor_print_compact(struct ipmi_intf * intf,
|
|||||||
val = rsp->data[0];
|
val = rsp->data[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (csv_output)
|
if (csv_output) {
|
||||||
{
|
|
||||||
/* NOT IMPLEMENTED */
|
/* NOT IMPLEMENTED */
|
||||||
}
|
} else {
|
||||||
else
|
if (!verbose) {
|
||||||
{
|
|
||||||
if (!verbose)
|
|
||||||
{
|
|
||||||
/* output format
|
/* output format
|
||||||
* id value units status thresholds....
|
* id value units status thresholds....
|
||||||
*/
|
*/
|
||||||
@ -439,17 +454,19 @@ ipmi_sensor_print_compact(struct ipmi_intf * intf,
|
|||||||
printf("| %-10s| %-10s| %-10s| %-10s| %-10s| %-10s",
|
printf("| %-10s| %-10s| %-10s| %-10s| %-10s| %-10s",
|
||||||
"na", "na", "na", "na", "na", "na");
|
"na", "na", "na", "na", "na", "na");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("Sensor ID : %s (0x%x)\n",
|
printf("Sensor ID : %s (0x%x)\n",
|
||||||
id, sensor->keys.sensor_num);
|
id, sensor->keys.sensor_num);
|
||||||
printf(" Entity ID : %d.%d\n",
|
printf(" Entity ID : %d.%d\n",
|
||||||
sensor->entity.id, sensor->entity.instance);
|
sensor->entity.id, sensor->entity.instance);
|
||||||
printf(" Sensor Type (Discrete): %s\n",
|
printf(" Sensor Type (Discrete): %s\n",
|
||||||
ipmi_sdr_get_sensor_type_desc(sensor->sensor.type));
|
ipmi_sdr_get_sensor_type_desc(sensor->sensor.
|
||||||
ipmi_sdr_print_discrete_state("States Asserted", sensor->sensor.type,
|
type));
|
||||||
sensor->event_type, rsp->data[2], rsp->data[3]);
|
ipmi_sdr_print_discrete_state("States Asserted",
|
||||||
|
sensor->sensor.type,
|
||||||
|
sensor->event_type,
|
||||||
|
rsp->data[2],
|
||||||
|
rsp->data[3]);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -458,10 +475,10 @@ ipmi_sensor_print_compact(struct ipmi_intf * intf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ipmi_sensor_list(struct ipmi_intf * intf)
|
ipmi_sensor_list(struct ipmi_intf *intf)
|
||||||
{
|
{
|
||||||
struct sdr_get_rs * header;
|
struct sdr_get_rs *header;
|
||||||
struct ipmi_sdr_iterator * itr;
|
struct ipmi_sdr_iterator *itr;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
lprintf(LOG_DEBUG, "Querying SDR for sensor list");
|
lprintf(LOG_DEBUG, "Querying SDR for sensor list");
|
||||||
@ -472,24 +489,28 @@ ipmi_sensor_list(struct ipmi_intf * intf)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((header = ipmi_sdr_get_next_header(intf, itr)) != NULL)
|
while ((header = ipmi_sdr_get_next_header(intf, itr)) != NULL) {
|
||||||
{
|
|
||||||
int r = 0;
|
int r = 0;
|
||||||
uint8_t * rec;
|
uint8_t *rec;
|
||||||
|
|
||||||
rec = ipmi_sdr_get_record(intf, header, itr);
|
rec = ipmi_sdr_get_record(intf, header, itr);
|
||||||
if (rec == NULL)
|
if (rec == NULL) {
|
||||||
|
lprintf(LOG_DEBUG, "rec == NULL");
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
switch(header->type)
|
switch (header->type) {
|
||||||
{
|
|
||||||
case SDR_RECORD_TYPE_FULL_SENSOR:
|
case SDR_RECORD_TYPE_FULL_SENSOR:
|
||||||
r = ipmi_sensor_print_full(intf,
|
r = ipmi_sensor_print_full(intf,
|
||||||
(struct sdr_record_full_sensor *)rec);
|
(struct
|
||||||
|
sdr_record_full_sensor *)
|
||||||
|
rec);
|
||||||
break;
|
break;
|
||||||
case SDR_RECORD_TYPE_COMPACT_SENSOR:
|
case SDR_RECORD_TYPE_COMPACT_SENSOR:
|
||||||
r = ipmi_sensor_print_compact(intf,
|
r = ipmi_sensor_print_compact(intf,
|
||||||
(struct sdr_record_compact_sensor *)rec);
|
(struct
|
||||||
|
sdr_record_compact_sensor
|
||||||
|
*) rec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
free(rec);
|
free(rec);
|
||||||
@ -504,21 +525,20 @@ ipmi_sensor_list(struct ipmi_intf * intf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct valstr threshold_vals[] = {
|
static const struct valstr threshold_vals[] = {
|
||||||
{ UPPER_NON_RECOV_SPECIFIED, "Upper Non-Recoverable" },
|
{UPPER_NON_RECOV_SPECIFIED, "Upper Non-Recoverable"},
|
||||||
{ UPPER_CRIT_SPECIFIED, "Upper Critical" },
|
{UPPER_CRIT_SPECIFIED, "Upper Critical"},
|
||||||
{ UPPER_NON_CRIT_SPECIFIED, "Upper Non-Critical" },
|
{UPPER_NON_CRIT_SPECIFIED, "Upper Non-Critical"},
|
||||||
{ LOWER_NON_RECOV_SPECIFIED, "Lower Non-Recoverable" },
|
{LOWER_NON_RECOV_SPECIFIED, "Lower Non-Recoverable"},
|
||||||
{ LOWER_CRIT_SPECIFIED, "Lower Critical" },
|
{LOWER_CRIT_SPECIFIED, "Lower Critical"},
|
||||||
{ LOWER_NON_CRIT_SPECIFIED, "Lower Non-Critical" },
|
{LOWER_NON_CRIT_SPECIFIED, "Lower Non-Critical"},
|
||||||
{ 0x00, NULL },
|
{0x00, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
__ipmi_sensor_set_threshold(struct ipmi_intf * intf,
|
__ipmi_sensor_set_threshold(struct ipmi_intf *intf,
|
||||||
uint8_t num, uint8_t mask, uint8_t setting)
|
uint8_t num, uint8_t mask, uint8_t setting)
|
||||||
{
|
{
|
||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs *rsp;
|
||||||
|
|
||||||
rsp = ipmi_sensor_set_sensor_thresholds(intf, num, mask, setting);
|
rsp = ipmi_sensor_set_sensor_thresholds(intf, num, mask, setting);
|
||||||
|
|
||||||
@ -535,36 +555,44 @@ __ipmi_sensor_set_threshold(struct ipmi_intf * intf,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ipmi_sensor_set_threshold(struct ipmi_intf * intf, int argc, char ** argv)
|
ipmi_sensor_set_threshold(struct ipmi_intf *intf, int argc, char **argv)
|
||||||
{
|
{
|
||||||
char * id, * thresh;
|
char *id, *thresh;
|
||||||
uint8_t settingMask = 0;
|
uint8_t settingMask = 0;
|
||||||
double setting1 = 0.0, setting2 = 0.0, setting3 = 0.0;
|
double setting1 = 0.0, setting2 = 0.0, setting3 = 0.0;
|
||||||
int allUpper = 0, allLower = 0;
|
int allUpper = 0, allLower = 0;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
struct sdr_record_list * sdr;
|
struct sdr_record_list *sdr;
|
||||||
|
|
||||||
if (argc < 3 || strncmp(argv[0], "help", 4) == 0)
|
if (argc < 3 || strncmp(argv[0], "help", 4) == 0) {
|
||||||
{
|
|
||||||
lprintf(LOG_NOTICE, "sensor thresh <id> <threshold> <setting>");
|
lprintf(LOG_NOTICE, "sensor thresh <id> <threshold> <setting>");
|
||||||
lprintf(LOG_NOTICE, " id : name of the sensor for which threshold is to be set");
|
lprintf(LOG_NOTICE,
|
||||||
|
" id : name of the sensor for which threshold is to be set");
|
||||||
lprintf(LOG_NOTICE, " threshold : which threshold to set");
|
lprintf(LOG_NOTICE, " threshold : which threshold to set");
|
||||||
lprintf(LOG_NOTICE, " unr = upper non-recoverable");
|
lprintf(LOG_NOTICE,
|
||||||
|
" unr = upper non-recoverable");
|
||||||
lprintf(LOG_NOTICE, " ucr = upper critical");
|
lprintf(LOG_NOTICE, " ucr = upper critical");
|
||||||
lprintf(LOG_NOTICE, " unc = upper non-critical");
|
lprintf(LOG_NOTICE,
|
||||||
lprintf(LOG_NOTICE, " lnc = lower non-critical");
|
" unc = upper non-critical");
|
||||||
|
lprintf(LOG_NOTICE,
|
||||||
|
" lnc = lower non-critical");
|
||||||
lprintf(LOG_NOTICE, " lcr = lower critical");
|
lprintf(LOG_NOTICE, " lcr = lower critical");
|
||||||
lprintf(LOG_NOTICE, " lnr = lower non-recoverable");
|
lprintf(LOG_NOTICE,
|
||||||
lprintf(LOG_NOTICE, " setting : the value to set the threshold to");
|
" lnr = lower non-recoverable");
|
||||||
|
lprintf(LOG_NOTICE,
|
||||||
|
" setting : the value to set the threshold to");
|
||||||
lprintf(LOG_NOTICE, "");
|
lprintf(LOG_NOTICE, "");
|
||||||
lprintf(LOG_NOTICE, "sensor thresh <id> lower <lnr> <lcr> <lnc>");
|
lprintf(LOG_NOTICE,
|
||||||
lprintf(LOG_NOTICE, " Set all lower thresholds at the same time");
|
"sensor thresh <id> lower <lnr> <lcr> <lnc>");
|
||||||
|
lprintf(LOG_NOTICE,
|
||||||
|
" Set all lower thresholds at the same time");
|
||||||
lprintf(LOG_NOTICE, "");
|
lprintf(LOG_NOTICE, "");
|
||||||
lprintf(LOG_NOTICE, "sensor thresh <id> upper <unc> <ucr> <unr>");
|
lprintf(LOG_NOTICE,
|
||||||
lprintf(LOG_NOTICE, " Set all upper thresholds at the same time");
|
"sensor thresh <id> upper <unc> <ucr> <unr>");
|
||||||
|
lprintf(LOG_NOTICE,
|
||||||
|
" Set all upper thresholds at the same time");
|
||||||
lprintf(LOG_NOTICE, "");
|
lprintf(LOG_NOTICE, "");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -574,26 +602,26 @@ ipmi_sensor_set_threshold(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
|
|
||||||
if (strncmp(thresh, "upper", 5) == 0) {
|
if (strncmp(thresh, "upper", 5) == 0) {
|
||||||
if (argc < 5) {
|
if (argc < 5) {
|
||||||
lprintf(LOG_ERR, "usage: sensor thresh <id> upper <unc> <ucr> <unr>");
|
lprintf(LOG_ERR,
|
||||||
|
"usage: sensor thresh <id> upper <unc> <ucr> <unr>");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
allUpper = 1;
|
allUpper = 1;
|
||||||
setting1 = (double)strtod(argv[2], NULL);
|
setting1 = (double) strtod(argv[2], NULL);
|
||||||
setting2 = (double)strtod(argv[3], NULL);
|
setting2 = (double) strtod(argv[3], NULL);
|
||||||
setting3 = (double)strtod(argv[4], NULL);
|
setting3 = (double) strtod(argv[4], NULL);
|
||||||
}
|
} else if (strncmp(thresh, "lower", 5) == 0) {
|
||||||
else if (strncmp(thresh, "lower", 5) == 0) {
|
|
||||||
if (argc < 5) {
|
if (argc < 5) {
|
||||||
lprintf(LOG_ERR, "usage: sensor thresh <id> lower <unc> <ucr> <unr>");
|
lprintf(LOG_ERR,
|
||||||
|
"usage: sensor thresh <id> lower <unc> <ucr> <unr>");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
allLower = 1;
|
allLower = 1;
|
||||||
setting1 = (double)strtod(argv[2], NULL);
|
setting1 = (double) strtod(argv[2], NULL);
|
||||||
setting2 = (double)strtod(argv[3], NULL);
|
setting2 = (double) strtod(argv[3], NULL);
|
||||||
setting3 = (double)strtod(argv[4], NULL);
|
setting3 = (double) strtod(argv[4], NULL);
|
||||||
}
|
} else {
|
||||||
else {
|
setting1 = (double) atof(argv[2]);
|
||||||
setting1 = (double)atof(argv[2]);
|
|
||||||
if (strncmp(thresh, "unr", 3) == 0)
|
if (strncmp(thresh, "unr", 3) == 0)
|
||||||
settingMask = UPPER_NON_RECOV_SPECIFIED;
|
settingMask = UPPER_NON_RECOV_SPECIFIED;
|
||||||
else if (strncmp(thresh, "ucr", 3) == 0)
|
else if (strncmp(thresh, "ucr", 3) == 0)
|
||||||
@ -607,7 +635,9 @@ ipmi_sensor_set_threshold(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
else if (strncmp(thresh, "lnr", 3) == 0)
|
else if (strncmp(thresh, "lnr", 3) == 0)
|
||||||
settingMask = LOWER_NON_RECOV_SPECIFIED;
|
settingMask = LOWER_NON_RECOV_SPECIFIED;
|
||||||
else {
|
else {
|
||||||
lprintf(LOG_ERR, "Valid threshold '%s' for sensor '%s' not specified!", thresh, id);
|
lprintf(LOG_ERR,
|
||||||
|
"Valid threshold '%s' for sensor '%s' not specified!",
|
||||||
|
thresh, id);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -632,67 +662,79 @@ ipmi_sensor_set_threshold(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
sdr->record.full->id_string,
|
sdr->record.full->id_string,
|
||||||
val2str(settingMask, threshold_vals), setting1);
|
val2str(settingMask, threshold_vals), setting1);
|
||||||
ret = __ipmi_sensor_set_threshold(intf,
|
ret = __ipmi_sensor_set_threshold(intf,
|
||||||
sdr->record.full->keys.sensor_num, settingMask,
|
sdr->record.full->keys.
|
||||||
sdr_convert_sensor_value_to_raw(sdr->record.full, setting1));
|
sensor_num, settingMask,
|
||||||
|
sdr_convert_sensor_value_to_raw
|
||||||
|
(sdr->record.full, setting1));
|
||||||
|
|
||||||
settingMask = UPPER_CRIT_SPECIFIED;
|
settingMask = UPPER_CRIT_SPECIFIED;
|
||||||
printf("Setting sensor \"%s\" %s threshold to %.3f\n",
|
printf("Setting sensor \"%s\" %s threshold to %.3f\n",
|
||||||
sdr->record.full->id_string,
|
sdr->record.full->id_string,
|
||||||
val2str(settingMask, threshold_vals), setting2);
|
val2str(settingMask, threshold_vals), setting2);
|
||||||
ret = __ipmi_sensor_set_threshold(intf,
|
ret = __ipmi_sensor_set_threshold(intf,
|
||||||
sdr->record.full->keys.sensor_num, settingMask,
|
sdr->record.full->keys.
|
||||||
sdr_convert_sensor_value_to_raw(sdr->record.full, setting2));
|
sensor_num, settingMask,
|
||||||
|
sdr_convert_sensor_value_to_raw
|
||||||
|
(sdr->record.full, setting2));
|
||||||
|
|
||||||
settingMask = UPPER_NON_RECOV_SPECIFIED;
|
settingMask = UPPER_NON_RECOV_SPECIFIED;
|
||||||
printf("Setting sensor \"%s\" %s threshold to %.3f\n",
|
printf("Setting sensor \"%s\" %s threshold to %.3f\n",
|
||||||
sdr->record.full->id_string,
|
sdr->record.full->id_string,
|
||||||
val2str(settingMask, threshold_vals), setting3);
|
val2str(settingMask, threshold_vals), setting3);
|
||||||
ret = __ipmi_sensor_set_threshold(intf,
|
ret = __ipmi_sensor_set_threshold(intf,
|
||||||
sdr->record.full->keys.sensor_num, settingMask,
|
sdr->record.full->keys.
|
||||||
sdr_convert_sensor_value_to_raw(sdr->record.full, setting3));
|
sensor_num, settingMask,
|
||||||
}
|
sdr_convert_sensor_value_to_raw
|
||||||
else if (allLower) {
|
(sdr->record.full, setting3));
|
||||||
|
} else if (allLower) {
|
||||||
settingMask = LOWER_NON_RECOV_SPECIFIED;
|
settingMask = LOWER_NON_RECOV_SPECIFIED;
|
||||||
printf("Setting sensor \"%s\" %s threshold to %.3f\n",
|
printf("Setting sensor \"%s\" %s threshold to %.3f\n",
|
||||||
sdr->record.full->id_string,
|
sdr->record.full->id_string,
|
||||||
val2str(settingMask, threshold_vals), setting1);
|
val2str(settingMask, threshold_vals), setting1);
|
||||||
ret = __ipmi_sensor_set_threshold(intf,
|
ret = __ipmi_sensor_set_threshold(intf,
|
||||||
sdr->record.full->keys.sensor_num, settingMask,
|
sdr->record.full->keys.
|
||||||
sdr_convert_sensor_value_to_raw(sdr->record.full, setting1));
|
sensor_num, settingMask,
|
||||||
|
sdr_convert_sensor_value_to_raw
|
||||||
|
(sdr->record.full, setting1));
|
||||||
|
|
||||||
settingMask = LOWER_CRIT_SPECIFIED;
|
settingMask = LOWER_CRIT_SPECIFIED;
|
||||||
printf("Setting sensor \"%s\" %s threshold to %.3f\n",
|
printf("Setting sensor \"%s\" %s threshold to %.3f\n",
|
||||||
sdr->record.full->id_string,
|
sdr->record.full->id_string,
|
||||||
val2str(settingMask, threshold_vals), setting2);
|
val2str(settingMask, threshold_vals), setting2);
|
||||||
ret = __ipmi_sensor_set_threshold(intf,
|
ret = __ipmi_sensor_set_threshold(intf,
|
||||||
sdr->record.full->keys.sensor_num, settingMask,
|
sdr->record.full->keys.
|
||||||
sdr_convert_sensor_value_to_raw(sdr->record.full, setting2));
|
sensor_num, settingMask,
|
||||||
|
sdr_convert_sensor_value_to_raw
|
||||||
|
(sdr->record.full, setting2));
|
||||||
|
|
||||||
settingMask = LOWER_NON_CRIT_SPECIFIED;
|
settingMask = LOWER_NON_CRIT_SPECIFIED;
|
||||||
printf("Setting sensor \"%s\" %s threshold to %.3f\n",
|
printf("Setting sensor \"%s\" %s threshold to %.3f\n",
|
||||||
sdr->record.full->id_string,
|
sdr->record.full->id_string,
|
||||||
val2str(settingMask, threshold_vals), setting3);
|
val2str(settingMask, threshold_vals), setting3);
|
||||||
ret = __ipmi_sensor_set_threshold(intf,
|
ret = __ipmi_sensor_set_threshold(intf,
|
||||||
sdr->record.full->keys.sensor_num, settingMask,
|
sdr->record.full->keys.
|
||||||
sdr_convert_sensor_value_to_raw(sdr->record.full, setting3));
|
sensor_num, settingMask,
|
||||||
}
|
sdr_convert_sensor_value_to_raw
|
||||||
else {
|
(sdr->record.full, setting3));
|
||||||
|
} else {
|
||||||
printf("Setting sensor \"%s\" %s threshold to %.3f\n",
|
printf("Setting sensor \"%s\" %s threshold to %.3f\n",
|
||||||
sdr->record.full->id_string,
|
sdr->record.full->id_string,
|
||||||
val2str(settingMask, threshold_vals), setting1);
|
val2str(settingMask, threshold_vals), setting1);
|
||||||
|
|
||||||
ret = __ipmi_sensor_set_threshold(intf,
|
ret = __ipmi_sensor_set_threshold(intf,
|
||||||
sdr->record.full->keys.sensor_num, settingMask,
|
sdr->record.full->keys.
|
||||||
sdr_convert_sensor_value_to_raw(sdr->record.full, setting1));
|
sensor_num, settingMask,
|
||||||
|
sdr_convert_sensor_value_to_raw
|
||||||
|
(sdr->record.full, setting1));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ipmi_sensor_get(struct ipmi_intf * intf, int argc, char ** argv)
|
ipmi_sensor_get(struct ipmi_intf *intf, int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct sdr_record_list * sdr;
|
struct sdr_record_list *sdr;
|
||||||
int i, v;
|
int i, v;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
@ -704,7 +746,7 @@ ipmi_sensor_get(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
printf("Locating sensor record...\n");
|
printf("Locating sensor record...\n");
|
||||||
|
|
||||||
/* lookup by sensor name */
|
/* lookup by sensor name */
|
||||||
for (i=0; i<argc; i++) {
|
for (i = 0; i < argc; i++) {
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
sdr = ipmi_sdr_find_sdr_byid(intf, argv[i]);
|
sdr = ipmi_sdr_find_sdr_byid(intf, argv[i]);
|
||||||
@ -723,16 +765,22 @@ ipmi_sensor_get(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
r = ipmi_sensor_print_full(intf, sdr->record.full);
|
r = ipmi_sensor_print_full(intf, sdr->record.full);
|
||||||
break;
|
break;
|
||||||
case SDR_RECORD_TYPE_COMPACT_SENSOR:
|
case SDR_RECORD_TYPE_COMPACT_SENSOR:
|
||||||
r = ipmi_sensor_print_compact(intf, sdr->record.compact);
|
r = ipmi_sensor_print_compact(intf,
|
||||||
|
sdr->record.compact);
|
||||||
break;
|
break;
|
||||||
case SDR_RECORD_TYPE_EVENTONLY_SENSOR:
|
case SDR_RECORD_TYPE_EVENTONLY_SENSOR:
|
||||||
r = ipmi_sdr_print_sensor_eventonly(intf, sdr->record.eventonly);
|
r = ipmi_sdr_print_sensor_eventonly(intf,
|
||||||
|
sdr->record.
|
||||||
|
eventonly);
|
||||||
break;
|
break;
|
||||||
case SDR_RECORD_TYPE_FRU_DEVICE_LOCATOR:
|
case SDR_RECORD_TYPE_FRU_DEVICE_LOCATOR:
|
||||||
r = ipmi_sdr_print_sensor_fru_locator(intf, sdr->record.fruloc);
|
r = ipmi_sdr_print_sensor_fru_locator(intf,
|
||||||
|
sdr->record.
|
||||||
|
fruloc);
|
||||||
break;
|
break;
|
||||||
case SDR_RECORD_TYPE_MC_DEVICE_LOCATOR:
|
case SDR_RECORD_TYPE_MC_DEVICE_LOCATOR:
|
||||||
r = ipmi_sdr_print_sensor_mc_locator(intf, sdr->record.mcloc);
|
r = ipmi_sdr_print_sensor_mc_locator(intf,
|
||||||
|
sdr->record.mcloc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
verbose = v;
|
verbose = v;
|
||||||
@ -745,28 +793,22 @@ ipmi_sensor_get(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ipmi_sensor_main(struct ipmi_intf * intf, int argc, char ** argv)
|
ipmi_sensor_main(struct ipmi_intf *intf, int argc, char **argv)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
rc = ipmi_sensor_list(intf);
|
rc = ipmi_sensor_list(intf);
|
||||||
}
|
} else if (strncmp(argv[0], "help", 4) == 0) {
|
||||||
else if (strncmp(argv[0], "help", 4) == 0) {
|
|
||||||
lprintf(LOG_NOTICE, "Sensor Commands: list thresh get");
|
lprintf(LOG_NOTICE, "Sensor Commands: list thresh get");
|
||||||
}
|
} else if (strncmp(argv[0], "list", 4) == 0) {
|
||||||
else if (strncmp(argv[0], "list", 4) == 0) {
|
|
||||||
rc = ipmi_sensor_list(intf);
|
rc = ipmi_sensor_list(intf);
|
||||||
}
|
} else if (strncmp(argv[0], "thresh", 5) == 0) {
|
||||||
else if (strncmp(argv[0], "thresh", 5) == 0) {
|
rc = ipmi_sensor_set_threshold(intf, argc - 1, &argv[1]);
|
||||||
rc = ipmi_sensor_set_threshold(intf, argc-1, &argv[1]);
|
} else if (strncmp(argv[0], "get", 3) == 0) {
|
||||||
}
|
rc = ipmi_sensor_get(intf, argc - 1, &argv[1]);
|
||||||
else if (strncmp(argv[0], "get", 3) == 0) {
|
} else {
|
||||||
rc = ipmi_sensor_get(intf, argc-1, &argv[1]);
|
lprintf(LOG_ERR, "Invalid sensor command: %s", argv[0]);
|
||||||
}
|
|
||||||
else {
|
|
||||||
lprintf(LOG_ERR, "Invalid sensor command: %s",
|
|
||||||
argv[0]);
|
|
||||||
rc = -1;
|
rc = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user