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