mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
ID:400 - Add support for VITA-specific sensor types and events.
Reworked event type code/sensor type parsing in order to support VITA-specific extensions. Added VITA-specific sensor-specific event types and VITA-specific sensor types.
This commit is contained in:
parent
e88e5c8186
commit
b44366e92d
@ -298,6 +298,7 @@ typedef enum IPMI_OEM {
|
|||||||
/* 24339 for [ADLINK TECHNOLOGY INC.] */
|
/* 24339 for [ADLINK TECHNOLOGY INC.] */
|
||||||
IPMI_OEM_ADLINK_24339 = 24339,
|
IPMI_OEM_ADLINK_24339 = 24339,
|
||||||
IPMI_OEM_NOKIA_SOLUTIONS_AND_NETWORKS = 28458,
|
IPMI_OEM_NOKIA_SOLUTIONS_AND_NETWORKS = 28458,
|
||||||
|
IPMI_OEM_VITA = 33196,
|
||||||
IPMI_OEM_SUPERMICRO_47488 = 47488
|
IPMI_OEM_SUPERMICRO_47488 = 47488
|
||||||
} IPMI_OEM;
|
} IPMI_OEM;
|
||||||
|
|
||||||
|
@ -907,7 +907,6 @@ struct ipmi_rs *ipmi_sdr_get_sensor_thresholds(struct ipmi_intf *intf,
|
|||||||
struct ipmi_rs *ipmi_sdr_get_sensor_hysteresis(struct ipmi_intf *intf,
|
struct ipmi_rs *ipmi_sdr_get_sensor_hysteresis(struct ipmi_intf *intf,
|
||||||
uint8_t sensor,
|
uint8_t sensor,
|
||||||
uint8_t target, uint8_t lun, uint8_t channel);
|
uint8_t target, uint8_t lun, uint8_t channel);
|
||||||
const char *ipmi_sdr_get_sensor_type_desc(const uint8_t type);
|
|
||||||
int ipmi_sdr_get_reservation(struct ipmi_intf *intf, int use_builtin,
|
int ipmi_sdr_get_reservation(struct ipmi_intf *intf, int use_builtin,
|
||||||
uint16_t * reserve_id);
|
uint16_t * reserve_id);
|
||||||
|
|
||||||
@ -937,10 +936,12 @@ int ipmi_sdr_list_cache(struct ipmi_intf *intf);
|
|||||||
int ipmi_sdr_list_cache_fromfile(struct ipmi_intf *intf, const char *ifile);
|
int ipmi_sdr_list_cache_fromfile(struct ipmi_intf *intf, const char *ifile);
|
||||||
void ipmi_sdr_list_empty(struct ipmi_intf *intf);
|
void ipmi_sdr_list_empty(struct ipmi_intf *intf);
|
||||||
int ipmi_sdr_print_info(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,
|
void ipmi_sdr_print_discrete_state(struct ipmi_intf *intf,
|
||||||
|
const char *desc, uint8_t sensor_type,
|
||||||
uint8_t event_type, uint8_t state1,
|
uint8_t event_type, uint8_t state1,
|
||||||
uint8_t state2);
|
uint8_t state2);
|
||||||
void ipmi_sdr_print_discrete_state_mini(const char *header, const char *separator,
|
void ipmi_sdr_print_discrete_state_mini(struct ipmi_intf *intf,
|
||||||
|
const char *header, const char *separator,
|
||||||
uint8_t sensor_type, uint8_t event_type,
|
uint8_t sensor_type, uint8_t event_type,
|
||||||
uint8_t state1, uint8_t state2);
|
uint8_t state1, uint8_t state2);
|
||||||
int ipmi_sdr_print_sensor_event_status(struct ipmi_intf *intf,
|
int ipmi_sdr_print_sensor_event_status(struct ipmi_intf *intf,
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -68,8 +68,7 @@ extern const struct oemvalstr picmg_busres_shmc_status_vals[];
|
|||||||
/* these are similar, expect that the lookup takes the IANA number
|
/* these are similar, expect that the lookup takes the IANA number
|
||||||
as first parameter */
|
as first parameter */
|
||||||
extern const struct oemvalstr ipmi_oem_product_info[];
|
extern const struct oemvalstr ipmi_oem_product_info[];
|
||||||
extern const struct oemvalstr ipmi_oem_sdr_type_vals[];
|
extern const char *ipmi_generic_sensor_type_vals[];
|
||||||
|
extern const struct oemvalstr ipmi_oem_sensor_type_vals[];
|
||||||
|
|
||||||
|
|
||||||
#endif /*IPMI_STRINGS_H*/
|
#endif /*IPMI_STRINGS_H*/
|
||||||
|
@ -207,18 +207,20 @@ ipmi_send_platform_event_num(struct ipmi_intf * intf, int num)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ipmi_event_find_offset(uint8_t code,
|
ipmi_event_find_offset(struct ipmi_intf *intf, uint8_t sensor_type, uint8_t event_type, char *desc)
|
||||||
struct ipmi_event_sensor_types * evt,
|
|
||||||
char * desc)
|
|
||||||
{
|
{
|
||||||
if (desc == NULL || code == 0)
|
const struct ipmi_event_sensor_types *evt;
|
||||||
return 0x00;
|
|
||||||
|
|
||||||
while (evt->type) {
|
if (desc == NULL || sensor_type == 0 || event_type == 0) {
|
||||||
if (evt->code == code && evt->desc != NULL &&
|
return 0x00;
|
||||||
strncasecmp(desc, evt->desc, __maxlen(desc, evt->desc)) == 0)
|
}
|
||||||
|
|
||||||
|
for (evt = ipmi_get_first_event_sensor_type(intf, sensor_type, event_type);
|
||||||
|
evt != NULL; evt = ipmi_get_next_event_sensor_type(evt)) {
|
||||||
|
if (evt->desc != NULL &&
|
||||||
|
strncasecmp(desc, evt->desc, __maxlen(desc, evt->desc)) == 0) {
|
||||||
return evt->offset;
|
return evt->offset;
|
||||||
evt++;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lprintf(LOG_WARN, "Unable to find matching event offset for '%s'", desc);
|
lprintf(LOG_WARN, "Unable to find matching event offset for '%s'", desc);
|
||||||
@ -226,9 +228,9 @@ ipmi_event_find_offset(uint8_t code,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_sensor_states(uint8_t sensor_type, uint8_t event_type)
|
print_sensor_states(struct ipmi_intf *intf, uint8_t sensor_type, uint8_t event_type)
|
||||||
{
|
{
|
||||||
ipmi_sdr_print_discrete_state_mini(
|
ipmi_sdr_print_discrete_state_mini(intf,
|
||||||
"Sensor States: \n ", "\n ", sensor_type,
|
"Sensor States: \n ", "\n ", sensor_type,
|
||||||
event_type, 0xff, 0xff);
|
event_type, 0xff, 0xff);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@ -400,7 +402,7 @@ ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * e
|
|||||||
* print list of available states for this sensor
|
* print list of available states for this sensor
|
||||||
*/
|
*/
|
||||||
if (state == NULL || strncasecmp(state, "list", 4) == 0) {
|
if (state == NULL || strncasecmp(state, "list", 4) == 0) {
|
||||||
print_sensor_states(emsg.sensor_type, emsg.event_type);
|
print_sensor_states(intf, emsg.sensor_type, emsg.event_type);
|
||||||
printf("Sensor State Shortcuts:\n");
|
printf("Sensor State Shortcuts:\n");
|
||||||
for (x = 0; x < sizeof(digi_on)/sizeof(*digi_on); x++) {
|
for (x = 0; x < sizeof(digi_on)/sizeof(*digi_on); x++) {
|
||||||
printf(" %-9s %-9s\n", digi_on[x], digi_off[x]);
|
printf(" %-9s %-9s\n", digi_on[x], digi_off[x]);
|
||||||
@ -422,8 +424,8 @@ ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * e
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (off == 0) {
|
if (off == 0) {
|
||||||
off = ipmi_event_find_offset(
|
off = ipmi_event_find_offset(intf,
|
||||||
emsg.event_type, generic_event_types, state);
|
emsg.sensor_type, emsg.event_type, state);
|
||||||
if (off < 0)
|
if (off < 0)
|
||||||
return -1;
|
return -1;
|
||||||
emsg.event_data[0] = off;
|
emsg.event_data[0] = off;
|
||||||
@ -440,11 +442,11 @@ ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * e
|
|||||||
* print list of available states for this sensor
|
* print list of available states for this sensor
|
||||||
*/
|
*/
|
||||||
if (state == NULL || strncasecmp(state, "list", 4) == 0) {
|
if (state == NULL || strncasecmp(state, "list", 4) == 0) {
|
||||||
print_sensor_states(emsg.sensor_type, emsg.event_type);
|
print_sensor_states(intf, emsg.sensor_type, emsg.event_type);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
off = ipmi_event_find_offset(
|
off = ipmi_event_find_offset(intf,
|
||||||
emsg.event_type, generic_event_types, state);
|
emsg.sensor_type, emsg.event_type, state);
|
||||||
if (off < 0)
|
if (off < 0)
|
||||||
return -1;
|
return -1;
|
||||||
emsg.event_data[0] = off;
|
emsg.event_data[0] = off;
|
||||||
@ -460,11 +462,11 @@ ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * e
|
|||||||
* print list of available states for this sensor
|
* print list of available states for this sensor
|
||||||
*/
|
*/
|
||||||
if (state == NULL || strncasecmp(state, "list", 4) == 0) {
|
if (state == NULL || strncasecmp(state, "list", 4) == 0) {
|
||||||
print_sensor_states(emsg.sensor_type, emsg.event_type);
|
print_sensor_states(intf, emsg.sensor_type, emsg.event_type);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
off = ipmi_event_find_offset(
|
off = ipmi_event_find_offset(intf,
|
||||||
emsg.sensor_type, sensor_specific_types, state);
|
emsg.sensor_type, emsg.event_type, state);
|
||||||
if (off < 0)
|
if (off < 0)
|
||||||
return -1;
|
return -1;
|
||||||
emsg.event_data[0] = off;
|
emsg.event_data[0] = off;
|
||||||
|
130
lib/ipmi_sdr.c
130
lib/ipmi_sdr.c
@ -689,32 +689,6 @@ ipmi_sdr_get_sensor_event_enable(struct ipmi_intf *intf, uint8_t sensor,
|
|||||||
return rsp;
|
return rsp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ipmi_sdr_get_sensor_type_desc - Get sensor type descriptor
|
|
||||||
*
|
|
||||||
* @type: ipmi sensor type
|
|
||||||
*
|
|
||||||
* returns
|
|
||||||
* string from sensor_type_desc
|
|
||||||
* or "reserved"
|
|
||||||
* or "OEM reserved"
|
|
||||||
*/
|
|
||||||
const char *
|
|
||||||
ipmi_sdr_get_sensor_type_desc(const uint8_t type)
|
|
||||||
{
|
|
||||||
static char desc[32];
|
|
||||||
memset(desc, 0, 32);
|
|
||||||
if (type <= SENSOR_TYPE_MAX)
|
|
||||||
return sensor_type_desc[type];
|
|
||||||
if (type < 0xc0)
|
|
||||||
snprintf(desc, 32, "reserved #%02x", type);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
snprintf(desc, 32, oemval2str(sdriana,type,ipmi_oem_sdr_type_vals),
|
|
||||||
type);
|
|
||||||
}
|
|
||||||
return desc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ipmi_sdr_get_thresh_status - threshold status indicator
|
/* ipmi_sdr_get_thresh_status - threshold status indicator
|
||||||
*
|
*
|
||||||
* @rsp: response from Get Sensor Reading comand
|
* @rsp: response from Get Sensor Reading comand
|
||||||
@ -1014,21 +988,21 @@ ipmi_sdr_print_sensor_event_status(struct ipmi_intf *intf,
|
|||||||
switch (numeric_fmt) {
|
switch (numeric_fmt) {
|
||||||
case DISCRETE_SENSOR:
|
case DISCRETE_SENSOR:
|
||||||
if (rsp->data_len == 2) {
|
if (rsp->data_len == 2) {
|
||||||
ipmi_sdr_print_discrete_state("Assertion Events",
|
ipmi_sdr_print_discrete_state(intf, "Assertion Events",
|
||||||
sensor_type, event_type,
|
sensor_type, event_type,
|
||||||
rsp->data[1], 0);
|
rsp->data[1], 0);
|
||||||
} else if (rsp->data_len > 2) {
|
} else if (rsp->data_len > 2) {
|
||||||
ipmi_sdr_print_discrete_state("Assertion Events",
|
ipmi_sdr_print_discrete_state(intf, "Assertion Events",
|
||||||
sensor_type, event_type,
|
sensor_type, event_type,
|
||||||
rsp->data[1],
|
rsp->data[1],
|
||||||
rsp->data[2]);
|
rsp->data[2]);
|
||||||
}
|
}
|
||||||
if (rsp->data_len == 4) {
|
if (rsp->data_len == 4) {
|
||||||
ipmi_sdr_print_discrete_state("Deassertion Events",
|
ipmi_sdr_print_discrete_state(intf, "Deassertion Events",
|
||||||
sensor_type, event_type,
|
sensor_type, event_type,
|
||||||
rsp->data[3], 0);
|
rsp->data[3], 0);
|
||||||
} else if (rsp->data_len > 4) {
|
} else if (rsp->data_len > 4) {
|
||||||
ipmi_sdr_print_discrete_state("Deassertion Events",
|
ipmi_sdr_print_discrete_state(intf, "Deassertion Events",
|
||||||
sensor_type, event_type,
|
sensor_type, event_type,
|
||||||
rsp->data[3],
|
rsp->data[3],
|
||||||
rsp->data[4]);
|
rsp->data[4]);
|
||||||
@ -1081,7 +1055,8 @@ ipmi_sdr_print_sensor_event_status(struct ipmi_intf *intf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ipmi_sdr_print_sensor_mask(struct sdr_record_mask *mask,
|
ipmi_sdr_print_sensor_mask(struct ipmi_intf *intf,
|
||||||
|
struct sdr_record_mask *mask,
|
||||||
uint8_t sensor_type,
|
uint8_t sensor_type,
|
||||||
uint8_t event_type, int numeric_fmt)
|
uint8_t event_type, int numeric_fmt)
|
||||||
{
|
{
|
||||||
@ -1090,13 +1065,13 @@ ipmi_sdr_print_sensor_mask(struct sdr_record_mask *mask,
|
|||||||
|
|
||||||
switch (numeric_fmt) {
|
switch (numeric_fmt) {
|
||||||
case DISCRETE_SENSOR:
|
case DISCRETE_SENSOR:
|
||||||
ipmi_sdr_print_discrete_state("Assert Event Mask", sensor_type,
|
ipmi_sdr_print_discrete_state(intf, "Assert Event Mask", sensor_type,
|
||||||
event_type,
|
event_type,
|
||||||
mask->type.discrete.
|
mask->type.discrete.
|
||||||
assert_event & 0xff,
|
assert_event & 0xff,
|
||||||
(mask->type.discrete.
|
(mask->type.discrete.
|
||||||
assert_event & 0xff00) >> 8);
|
assert_event & 0xff00) >> 8);
|
||||||
ipmi_sdr_print_discrete_state("Deassert Event Mask",
|
ipmi_sdr_print_discrete_state(intf, "Deassert Event Mask",
|
||||||
sensor_type, event_type,
|
sensor_type, event_type,
|
||||||
mask->type.discrete.
|
mask->type.discrete.
|
||||||
deassert_event & 0xff,
|
deassert_event & 0xff,
|
||||||
@ -1224,21 +1199,21 @@ ipmi_sdr_print_sensor_event_enable(struct ipmi_intf *intf,
|
|||||||
case DISCRETE_SENSOR:
|
case DISCRETE_SENSOR:
|
||||||
/* discrete */
|
/* discrete */
|
||||||
if (rsp->data_len == 2) {
|
if (rsp->data_len == 2) {
|
||||||
ipmi_sdr_print_discrete_state("Assertions Enabled",
|
ipmi_sdr_print_discrete_state(intf, "Assertions Enabled",
|
||||||
sensor_type, event_type,
|
sensor_type, event_type,
|
||||||
rsp->data[1], 0);
|
rsp->data[1], 0);
|
||||||
} else if (rsp->data_len > 2) {
|
} else if (rsp->data_len > 2) {
|
||||||
ipmi_sdr_print_discrete_state("Assertions Enabled",
|
ipmi_sdr_print_discrete_state(intf, "Assertions Enabled",
|
||||||
sensor_type, event_type,
|
sensor_type, event_type,
|
||||||
rsp->data[1],
|
rsp->data[1],
|
||||||
rsp->data[2]);
|
rsp->data[2]);
|
||||||
}
|
}
|
||||||
if (rsp->data_len == 4) {
|
if (rsp->data_len == 4) {
|
||||||
ipmi_sdr_print_discrete_state("Deassertions Enabled",
|
ipmi_sdr_print_discrete_state(intf, "Deassertions Enabled",
|
||||||
sensor_type, event_type,
|
sensor_type, event_type,
|
||||||
rsp->data[3], 0);
|
rsp->data[3], 0);
|
||||||
} else if (rsp->data_len > 4) {
|
} else if (rsp->data_len > 4) {
|
||||||
ipmi_sdr_print_discrete_state("Deassertions Enabled",
|
ipmi_sdr_print_discrete_state(intf, "Deassertions Enabled",
|
||||||
sensor_type, event_type,
|
sensor_type, event_type,
|
||||||
rsp->data[3],
|
rsp->data[3],
|
||||||
rsp->data[4]);
|
rsp->data[4]);
|
||||||
@ -1381,7 +1356,8 @@ print_sensor_min_max(struct sdr_record_full_sensor *full)
|
|||||||
* returns void
|
* returns void
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
print_csv_discrete(struct sdr_record_common_sensor *sensor,
|
print_csv_discrete(struct ipmi_intf *intf,
|
||||||
|
struct sdr_record_common_sensor *sensor,
|
||||||
const struct sensor_reading *sr)
|
const struct sensor_reading *sr)
|
||||||
{
|
{
|
||||||
if (!sr->s_reading_valid || sr->s_reading_unavailable) {
|
if (!sr->s_reading_valid || sr->s_reading_unavailable) {
|
||||||
@ -1400,7 +1376,7 @@ print_csv_discrete(struct sdr_record_common_sensor *sensor,
|
|||||||
printf("ok,%d.%d,",
|
printf("ok,%d.%d,",
|
||||||
sensor->entity.id,
|
sensor->entity.id,
|
||||||
sensor->entity.instance);
|
sensor->entity.instance);
|
||||||
ipmi_sdr_print_discrete_state_mini(NULL, ", ",
|
ipmi_sdr_print_discrete_state_mini(intf, NULL, ", ",
|
||||||
sensor->sensor.type,
|
sensor->sensor.type,
|
||||||
sensor->event_type,
|
sensor->event_type,
|
||||||
sr->s_data2,
|
sr->s_data2,
|
||||||
@ -1567,7 +1543,7 @@ ipmi_sdr_print_sensor_fc(struct ipmi_intf *intf,
|
|||||||
printf("%s,", sr->s_id);
|
printf("%s,", sr->s_id);
|
||||||
if (!IS_THRESHOLD_SENSOR(sensor)) {
|
if (!IS_THRESHOLD_SENSOR(sensor)) {
|
||||||
/* Discrete/Non-Threshold */
|
/* Discrete/Non-Threshold */
|
||||||
print_csv_discrete(sensor, sr);
|
print_csv_discrete(intf, sensor, sr);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1581,7 +1557,7 @@ ipmi_sdr_print_sensor_fc(struct ipmi_intf *intf,
|
|||||||
printf("%s,%s", sr->s_a_units,
|
printf("%s,%s", sr->s_a_units,
|
||||||
ipmi_sdr_get_thresh_status(sr, "ns"));
|
ipmi_sdr_get_thresh_status(sr, "ns"));
|
||||||
} else { /* Discrete/Threshold */
|
} else { /* Discrete/Threshold */
|
||||||
print_csv_discrete(sensor, sr);
|
print_csv_discrete(intf, sensor, sr);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
printf(",,ns");
|
printf(",,ns");
|
||||||
@ -1591,8 +1567,7 @@ ipmi_sdr_print_sensor_fc(struct ipmi_intf *intf,
|
|||||||
printf(",%d.%d,%s,%s,",
|
printf(",%d.%d,%s,%s,",
|
||||||
sensor->entity.id, sensor->entity.instance,
|
sensor->entity.id, sensor->entity.instance,
|
||||||
val2str(sensor->entity.id, entity_id_vals),
|
val2str(sensor->entity.id, entity_id_vals),
|
||||||
ipmi_sdr_get_sensor_type_desc(sensor->sensor.
|
ipmi_get_sensor_type(intf, sensor->sensor.type));
|
||||||
type));
|
|
||||||
|
|
||||||
if (sr->full) {
|
if (sr->full) {
|
||||||
SENSOR_PRINT_CSV(sr->full, sr->full->analog_flag.nominal_read,
|
SENSOR_PRINT_CSV(sr->full, sr->full->analog_flag.nominal_read,
|
||||||
@ -1712,7 +1687,7 @@ ipmi_sdr_print_sensor_fc(struct ipmi_intf *intf,
|
|||||||
printf("%s %s", sr->s_a_str, sr->s_a_units);
|
printf("%s %s", sr->s_a_str, sr->s_a_units);
|
||||||
header = ", ";
|
header = ", ";
|
||||||
}
|
}
|
||||||
ipmi_sdr_print_discrete_state_mini(header, ", ",
|
ipmi_sdr_print_discrete_state_mini(intf, header, ", ",
|
||||||
sensor->sensor.type,
|
sensor->sensor.type,
|
||||||
sensor->event_type,
|
sensor->event_type,
|
||||||
sr->s_data2,
|
sr->s_data2,
|
||||||
@ -1740,7 +1715,7 @@ ipmi_sdr_print_sensor_fc(struct ipmi_intf *intf,
|
|||||||
if (!IS_THRESHOLD_SENSOR(sensor)) {
|
if (!IS_THRESHOLD_SENSOR(sensor)) {
|
||||||
/* Discrete */
|
/* Discrete */
|
||||||
printf(" Sensor Type (Discrete): %s (0x%02x)\n",
|
printf(" Sensor Type (Discrete): %s (0x%02x)\n",
|
||||||
ipmi_sdr_get_sensor_type_desc(sensor->sensor.type),
|
ipmi_get_sensor_type(intf, sensor->sensor.type),
|
||||||
sensor->sensor.type);
|
sensor->sensor.type);
|
||||||
lprintf(LOG_DEBUG, " Event Type Code : 0x%02x",
|
lprintf(LOG_DEBUG, " Event Type Code : 0x%02x",
|
||||||
sensor->event_type);
|
sensor->event_type);
|
||||||
@ -1776,12 +1751,12 @@ ipmi_sdr_print_sensor_fc(struct ipmi_intf *intf,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ipmi_sdr_print_discrete_state("States Asserted",
|
ipmi_sdr_print_discrete_state(intf, "States Asserted",
|
||||||
sensor->sensor.type,
|
sensor->sensor.type,
|
||||||
sensor->event_type,
|
sensor->event_type,
|
||||||
sr->s_data2,
|
sr->s_data2,
|
||||||
sr->s_data3);
|
sr->s_data3);
|
||||||
ipmi_sdr_print_sensor_mask(&sensor->mask, sensor->sensor.type,
|
ipmi_sdr_print_sensor_mask(intf, &sensor->mask, sensor->sensor.type,
|
||||||
sensor->event_type, DISCRETE_SENSOR);
|
sensor->event_type, DISCRETE_SENSOR);
|
||||||
ipmi_sdr_print_sensor_event_status(intf,
|
ipmi_sdr_print_sensor_event_status(intf,
|
||||||
sensor->keys.sensor_num,
|
sensor->keys.sensor_num,
|
||||||
@ -1804,7 +1779,7 @@ ipmi_sdr_print_sensor_fc(struct ipmi_intf *intf,
|
|||||||
return 0; /* done */
|
return 0; /* done */
|
||||||
}
|
}
|
||||||
printf(" Sensor Type (Threshold) : %s (0x%02x)\n",
|
printf(" Sensor Type (Threshold) : %s (0x%02x)\n",
|
||||||
ipmi_sdr_get_sensor_type_desc(sensor->sensor.type),
|
ipmi_get_sensor_type(intf, sensor->sensor.type),
|
||||||
sensor->sensor.type);
|
sensor->sensor.type);
|
||||||
|
|
||||||
printf(" Sensor Reading : ");
|
printf(" Sensor Reading : ");
|
||||||
@ -1945,7 +1920,7 @@ ipmi_sdr_print_sensor_fc(struct ipmi_intf *intf,
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
ipmi_sdr_print_sensor_mask(&sensor->mask,
|
ipmi_sdr_print_sensor_mask(intf, &sensor->mask,
|
||||||
sensor->sensor.type,
|
sensor->sensor.type,
|
||||||
sensor->event_type, ANALOG_SENSOR);
|
sensor->event_type, ANALOG_SENSOR);
|
||||||
ipmi_sdr_print_sensor_event_status(intf,
|
ipmi_sdr_print_sensor_event_status(intf,
|
||||||
@ -1988,48 +1963,45 @@ get_offset(uint8_t x)
|
|||||||
* no meaningful return value
|
* no meaningful return value
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ipmi_sdr_print_discrete_state_mini(const char *header, const char *separator,
|
ipmi_sdr_print_discrete_state_mini(struct ipmi_intf *intf,
|
||||||
|
const char *header, const char *separator,
|
||||||
uint8_t sensor_type, uint8_t event_type,
|
uint8_t sensor_type, uint8_t event_type,
|
||||||
uint8_t state1, uint8_t state2)
|
uint8_t state1, uint8_t state2)
|
||||||
{
|
{
|
||||||
uint8_t typ;
|
const struct ipmi_event_sensor_types *evt;
|
||||||
struct ipmi_event_sensor_types *evt;
|
|
||||||
int pre = 0, c = 0;
|
int pre = 0, c = 0;
|
||||||
|
|
||||||
if (state1 == 0 && (state2 & 0x7f) == 0)
|
if (state1 == 0 && (state2 & 0x7f) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event_type == 0x6f) {
|
|
||||||
evt = sensor_specific_types;
|
|
||||||
typ = sensor_type;
|
|
||||||
} else {
|
|
||||||
evt = generic_event_types;
|
|
||||||
typ = event_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (header)
|
if (header)
|
||||||
printf("%s", header);
|
printf("%s", header);
|
||||||
|
|
||||||
for (; evt->type != NULL; evt++) {
|
for (evt = ipmi_get_first_event_sensor_type(intf, sensor_type, event_type);
|
||||||
if ((evt->code != typ) ||
|
evt != NULL; evt = ipmi_get_next_event_sensor_type(evt)) {
|
||||||
(evt->data != 0xFF))
|
if (evt->data != 0xFF) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (evt->offset > 7) {
|
if (evt->offset > 7) {
|
||||||
if ((1 << (evt->offset - 8)) & (state2 & 0x7f)) {
|
if ((1 << (evt->offset - 8)) & (state2 & 0x7f)) {
|
||||||
if (pre++ != 0)
|
if (pre++ != 0) {
|
||||||
printf("%s", separator);
|
printf("%s", separator);
|
||||||
if (evt->desc)
|
}
|
||||||
|
if (evt->desc) {
|
||||||
printf("%s", evt->desc);
|
printf("%s", evt->desc);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if ((1 << evt->offset) & state1) {
|
if ((1 << evt->offset) & state1) {
|
||||||
if (pre++ != 0)
|
if (pre++ != 0) {
|
||||||
printf("%s", separator);
|
printf("%s", separator);
|
||||||
if (evt->desc)
|
}
|
||||||
|
if (evt->desc) {
|
||||||
printf("%s", evt->desc);
|
printf("%s", evt->desc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2045,32 +2017,24 @@ ipmi_sdr_print_discrete_state_mini(const char *header, const char *separator,
|
|||||||
* no meaningful return value
|
* no meaningful return value
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ipmi_sdr_print_discrete_state(const char *desc,
|
ipmi_sdr_print_discrete_state(struct ipmi_intf *intf, const char *desc,
|
||||||
uint8_t sensor_type, uint8_t event_type,
|
uint8_t sensor_type, uint8_t event_type,
|
||||||
uint8_t state1, uint8_t state2)
|
uint8_t state1, uint8_t state2)
|
||||||
{
|
{
|
||||||
uint8_t typ;
|
const struct ipmi_event_sensor_types *evt;
|
||||||
struct ipmi_event_sensor_types *evt;
|
|
||||||
int pre = 0, c = 0;
|
int pre = 0, c = 0;
|
||||||
|
|
||||||
if (state1 == 0 && (state2 & 0x7f) == 0)
|
if (state1 == 0 && (state2 & 0x7f) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event_type == 0x6f) {
|
for (evt = ipmi_get_first_event_sensor_type(intf, sensor_type, event_type);
|
||||||
evt = sensor_specific_types;
|
evt != NULL; evt = ipmi_get_next_event_sensor_type(evt)) {
|
||||||
typ = sensor_type;
|
if (evt->data != 0xFF) {
|
||||||
} else {
|
continue;
|
||||||
evt = generic_event_types;
|
|
||||||
typ = event_type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; evt->type != NULL; evt++) {
|
|
||||||
if ((evt->code != typ) ||
|
|
||||||
(evt->data != 0xFF))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (pre == 0) {
|
if (pre == 0) {
|
||||||
printf(" %-21s : %s\n", desc, evt->type);
|
printf(" %-21s : %s\n", desc, ipmi_get_sensor_type(intf, sensor_type));
|
||||||
pre = 1;
|
pre = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2129,7 +2093,7 @@ ipmi_sdr_print_sensor_eventonly(struct ipmi_intf *intf,
|
|||||||
sensor->entity.id, sensor->entity.instance,
|
sensor->entity.id, sensor->entity.instance,
|
||||||
val2str(sensor->entity.id, entity_id_vals));
|
val2str(sensor->entity.id, entity_id_vals));
|
||||||
printf("Sensor Type : %s (0x%02x)\n",
|
printf("Sensor Type : %s (0x%02x)\n",
|
||||||
ipmi_sdr_get_sensor_type_desc(sensor->sensor_type),
|
ipmi_get_sensor_type(intf, sensor->sensor_type),
|
||||||
sensor->sensor_type);
|
sensor->sensor_type);
|
||||||
lprintf(LOG_DEBUG, "Event Type Code : 0x%02x",
|
lprintf(LOG_DEBUG, "Event Type Code : 0x%02x",
|
||||||
sensor->event_type);
|
sensor->event_type);
|
||||||
|
234
lib/ipmi_sel.c
234
lib/ipmi_sel.c
@ -49,6 +49,7 @@
|
|||||||
#include <ipmitool/ipmi_sdr.h>
|
#include <ipmitool/ipmi_sdr.h>
|
||||||
#include <ipmitool/ipmi_fru.h>
|
#include <ipmitool/ipmi_fru.h>
|
||||||
#include <ipmitool/ipmi_sensor.h>
|
#include <ipmitool/ipmi_sensor.h>
|
||||||
|
#include <ipmitool/ipmi_strings.h>
|
||||||
|
|
||||||
extern int verbose;
|
extern int verbose;
|
||||||
static int sel_extended = 0;
|
static int sel_extended = 0;
|
||||||
@ -447,8 +448,9 @@ ipmi_sel_add_entries_fromfile(struct ipmi_intf * intf, const char * filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct ipmi_event_sensor_types oem_kontron_event_reading_types[] __attribute__((unused)) = {
|
static struct ipmi_event_sensor_types oem_kontron_event_reading_types[] __attribute__((unused)) = {
|
||||||
{ 0x70 , 0x00 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "OEM Firmware Info 1", "Code Assert" },
|
{ 0x70 , 0x00 , 0xff, "Code Assert" },
|
||||||
{ 0x71 , 0x00 , 0xff, IPMI_EVENT_CLASS_DISCRETE , "OEM Firmware Info 2", "Code Assert" },
|
{ 0x71 , 0x00 , 0xff, "Code Assert" },
|
||||||
|
{ 0, 0, 0xFF, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
char *
|
char *
|
||||||
@ -462,8 +464,8 @@ get_kontron_evt_desc(struct ipmi_intf * intf, struct sel_event_record * rec)
|
|||||||
|
|
||||||
/* Only standard records are defined so far */
|
/* Only standard records are defined so far */
|
||||||
if( rec->record_type < 0xC0 ){
|
if( rec->record_type < 0xC0 ){
|
||||||
struct ipmi_event_sensor_types *st=NULL;
|
const struct ipmi_event_sensor_types *st=NULL;
|
||||||
for ( st=oem_kontron_event_reading_types ; st->type != NULL; st++){
|
for ( st=oem_kontron_event_types ; st->desc != NULL; st++){
|
||||||
if (st->code == rec->sel_type.standard_type.event_type ){
|
if (st->code == rec->sel_type.standard_type.event_type ){
|
||||||
size_t len =strlen(st->desc);
|
size_t len =strlen(st->desc);
|
||||||
description = (char*)malloc( len + 1 );
|
description = (char*)malloc( len + 1 );
|
||||||
@ -1200,11 +1202,71 @@ ipmi_get_oem_desc(struct ipmi_intf * intf, struct sel_event_record * rec)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const struct ipmi_event_sensor_types *
|
||||||
|
ipmi_get_first_event_sensor_type(struct ipmi_intf *intf,
|
||||||
|
uint8_t sensor_type, uint8_t event_type)
|
||||||
|
{
|
||||||
|
const struct ipmi_event_sensor_types *evt, *start, *next = NULL;
|
||||||
|
uint8_t code;
|
||||||
|
|
||||||
|
if (event_type == 0x6f) {
|
||||||
|
if (sensor_type >= 0xC0
|
||||||
|
&& sensor_type < 0xF0
|
||||||
|
&& ipmi_get_oem(intf) == IPMI_OEM_KONTRON) {
|
||||||
|
/* check Kontron OEM sensor event types */
|
||||||
|
start = oem_kontron_event_types;
|
||||||
|
} else if (intf->vita_avail) {
|
||||||
|
/* check VITA sensor event types first */
|
||||||
|
start = vita_sensor_event_types;
|
||||||
|
|
||||||
|
/* then check generic sensor types */
|
||||||
|
next = sensor_specific_event_types;
|
||||||
|
} else {
|
||||||
|
/* check generic sensor types */
|
||||||
|
start = sensor_specific_event_types;
|
||||||
|
}
|
||||||
|
code = sensor_type;
|
||||||
|
} else {
|
||||||
|
start = generic_event_types;
|
||||||
|
code = event_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (evt = start; evt->desc != NULL || next != NULL; evt++) {
|
||||||
|
/* check if VITA sensor event types has finished */
|
||||||
|
if (evt->desc == NULL) {
|
||||||
|
/* proceed with next table */
|
||||||
|
evt = next;
|
||||||
|
next = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (code == evt->code)
|
||||||
|
return evt;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const struct ipmi_event_sensor_types *
|
||||||
|
ipmi_get_next_event_sensor_type(const struct ipmi_event_sensor_types *evt)
|
||||||
|
{
|
||||||
|
const struct ipmi_event_sensor_types *start = evt;
|
||||||
|
|
||||||
|
for (evt = start + 1; evt->desc != NULL; evt++) {
|
||||||
|
if (evt->code == start->code) {
|
||||||
|
return evt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ipmi_get_event_desc(struct ipmi_intf * intf, struct sel_event_record * rec, char ** desc)
|
ipmi_get_event_desc(struct ipmi_intf * intf, struct sel_event_record * rec, char ** desc)
|
||||||
{
|
{
|
||||||
uint8_t code, offset;
|
uint8_t offset;
|
||||||
struct ipmi_event_sensor_types *evt = NULL;
|
const struct ipmi_event_sensor_types *evt = NULL;
|
||||||
char *sfx = NULL; /* This will be assigned if the Platform is DELL,
|
char *sfx = NULL; /* This will be assigned if the Platform is DELL,
|
||||||
additional info is appended to the current Description */
|
additional info is appended to the current Description */
|
||||||
|
|
||||||
@ -1223,86 +1285,61 @@ ipmi_get_event_desc(struct ipmi_intf * intf, struct sel_event_record * rec, char
|
|||||||
case IPMI_OEM_KONTRON:
|
case IPMI_OEM_KONTRON:
|
||||||
lprintf(LOG_DEBUG, "oem sensor type %x %d using oem type supplied description",
|
lprintf(LOG_DEBUG, "oem sensor type %x %d using oem type supplied description",
|
||||||
rec->sel_type.standard_type.sensor_type , iana);
|
rec->sel_type.standard_type.sensor_type , iana);
|
||||||
|
|
||||||
evt = oem_kontron_event_types;
|
|
||||||
code = rec->sel_type.standard_type.sensor_type;
|
|
||||||
break;
|
break;
|
||||||
case IPMI_OEM_DELL: /* OEM Bytes Decoding for DELLi */
|
case IPMI_OEM_DELL: /* OEM Bytes Decoding for DELLi */
|
||||||
evt = sensor_specific_types;
|
|
||||||
code = rec->sel_type.standard_type.sensor_type;
|
|
||||||
if ( (OEM_CODE_IN_BYTE2 == (rec->sel_type.standard_type.event_data[0] & DATA_BYTE2_SPECIFIED_MASK)) ||
|
if ( (OEM_CODE_IN_BYTE2 == (rec->sel_type.standard_type.event_data[0] & DATA_BYTE2_SPECIFIED_MASK)) ||
|
||||||
(OEM_CODE_IN_BYTE3 == (rec->sel_type.standard_type.event_data[0] & DATA_BYTE3_SPECIFIED_MASK)) )
|
(OEM_CODE_IN_BYTE3 == (rec->sel_type.standard_type.event_data[0] & DATA_BYTE3_SPECIFIED_MASK)) )
|
||||||
{
|
{
|
||||||
if(rec->sel_type.standard_type.event_data[0] & DATA_BYTE2_SPECIFIED_MASK)
|
|
||||||
evt->data = rec->sel_type.standard_type.event_data[1];
|
|
||||||
|
|
||||||
sfx = ipmi_get_oem_desc(intf, rec);
|
sfx = ipmi_get_oem_desc(intf, rec);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IPMI_OEM_SUPERMICRO:
|
case IPMI_OEM_SUPERMICRO:
|
||||||
case IPMI_OEM_SUPERMICRO_47488:
|
case IPMI_OEM_SUPERMICRO_47488:
|
||||||
evt = sensor_specific_types;
|
|
||||||
code = rec->sel_type.standard_type.sensor_type;
|
|
||||||
sfx = ipmi_get_oem_desc(intf, rec);
|
sfx = ipmi_get_oem_desc(intf, rec);
|
||||||
break;
|
break;
|
||||||
/* add your oem sensor assignation here */
|
/* add your oem sensor assignation here */
|
||||||
default:
|
default:
|
||||||
break;
|
|
||||||
}
|
|
||||||
if( evt == NULL ){
|
|
||||||
lprintf(LOG_DEBUG, "oem sensor type %x using standard type supplied description",
|
lprintf(LOG_DEBUG, "oem sensor type %x using standard type supplied description",
|
||||||
rec->sel_type.standard_type.sensor_type );
|
rec->sel_type.standard_type.sensor_type );
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (ipmi_get_oem(intf)) {
|
switch (ipmi_get_oem(intf)) {
|
||||||
case IPMI_OEM_SUPERMICRO:
|
case IPMI_OEM_SUPERMICRO:
|
||||||
case IPMI_OEM_SUPERMICRO_47488:
|
case IPMI_OEM_SUPERMICRO_47488:
|
||||||
evt = sensor_specific_types;
|
|
||||||
code = rec->sel_type.standard_type.sensor_type;
|
|
||||||
sfx = ipmi_get_oem_desc(intf, rec);
|
sfx = ipmi_get_oem_desc(intf, rec);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( evt == NULL ){
|
|
||||||
evt = sensor_specific_types;
|
|
||||||
code = rec->sel_type.standard_type.sensor_type;
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* Check for the OEM DELL Interface based on the Dell Specific Vendor Code.
|
* Check for the OEM DELL Interface based on the Dell Specific Vendor Code.
|
||||||
* If its Dell Platform, do the OEM Byte decode from the SEL Records.
|
* If its Dell Platform, do the OEM Byte decode from the SEL Records.
|
||||||
* Additional information should be written by the ipmi_get_oem_desc()
|
* Additional information should be written by the ipmi_get_oem_desc()
|
||||||
*/
|
*/
|
||||||
if(ipmi_get_oem(intf) == IPMI_OEM_DELL) {
|
if(ipmi_get_oem(intf) == IPMI_OEM_DELL) {
|
||||||
code = rec->sel_type.standard_type.sensor_type;
|
|
||||||
if ( (OEM_CODE_IN_BYTE2 == (rec->sel_type.standard_type.event_data[0] & DATA_BYTE2_SPECIFIED_MASK)) ||
|
if ( (OEM_CODE_IN_BYTE2 == (rec->sel_type.standard_type.event_data[0] & DATA_BYTE2_SPECIFIED_MASK)) ||
|
||||||
(OEM_CODE_IN_BYTE3 == (rec->sel_type.standard_type.event_data[0] & DATA_BYTE3_SPECIFIED_MASK)) )
|
(OEM_CODE_IN_BYTE3 == (rec->sel_type.standard_type.event_data[0] & DATA_BYTE3_SPECIFIED_MASK)) )
|
||||||
{
|
{
|
||||||
if(rec->sel_type.standard_type.event_data[0] & DATA_BYTE2_SPECIFIED_MASK)
|
|
||||||
evt->data = rec->sel_type.standard_type.event_data[1];
|
|
||||||
sfx = ipmi_get_oem_desc(intf, rec);
|
sfx = ipmi_get_oem_desc(intf, rec);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(SENSOR_TYPE_OEM_SEC_EVENT == rec->sel_type.standard_type.event_data[0])
|
else if(SENSOR_TYPE_OEM_SEC_EVENT == rec->sel_type.standard_type.event_data[0])
|
||||||
{
|
{
|
||||||
/* 0x23 : Sensor Number.*/
|
/* 0x23 : Sensor Number.*/
|
||||||
if(0x23 == rec->sel_type.standard_type.sensor_num)
|
if(0x23 == rec->sel_type.standard_type.sensor_num)
|
||||||
{
|
|
||||||
evt->data = rec->sel_type.standard_type.event_data[1];
|
|
||||||
sfx = ipmi_get_oem_desc(intf, rec);
|
sfx = ipmi_get_oem_desc(intf, rec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
evt = generic_event_types;
|
|
||||||
code = rec->sel_type.standard_type.event_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
offset = rec->sel_type.standard_type.event_data[0] & 0xf;
|
offset = rec->sel_type.standard_type.event_data[0] & 0xf;
|
||||||
|
|
||||||
while (evt->type) {
|
for (evt = ipmi_get_first_event_sensor_type(intf,
|
||||||
if ((evt->code == code && evt->offset == offset && evt->desc != NULL) &&
|
rec->sel_type.standard_type.sensor_type,
|
||||||
|
rec->sel_type.standard_type.event_type);
|
||||||
|
evt != NULL; evt = ipmi_get_next_event_sensor_type(evt)) {
|
||||||
|
if ((evt->offset == offset && evt->desc != NULL) &&
|
||||||
((evt->data == ALL_OFFSETS_SPECIFIED) ||
|
((evt->data == ALL_OFFSETS_SPECIFIED) ||
|
||||||
((rec->sel_type.standard_type.event_data[0] & DATA_BYTE2_SPECIFIED_MASK) &&
|
((rec->sel_type.standard_type.event_data[0] & DATA_BYTE2_SPECIFIED_MASK) &&
|
||||||
(evt->data == rec->sel_type.standard_type.event_data[1]))))
|
(evt->data == rec->sel_type.standard_type.event_data[1]))))
|
||||||
@ -1327,14 +1364,13 @@ ipmi_get_event_desc(struct ipmi_intf * intf, struct sel_event_record * rec, char
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
evt++;
|
|
||||||
}
|
}
|
||||||
/* The Above while Condition was not met beacouse the below sensor type were Newly defined OEM
|
/* The Above while Condition was not met beacouse the below sensor type were Newly defined OEM
|
||||||
Secondary Events. 0xC1, 0xC2, 0xC3. */
|
Secondary Events. 0xC1, 0xC2, 0xC3. */
|
||||||
if((sfx) && (0x6F == rec->sel_type.standard_type.event_type))
|
if((sfx) && (0x6F == rec->sel_type.standard_type.event_type))
|
||||||
{
|
{
|
||||||
uint8_t flag = 0x00;
|
uint8_t flag = 0x00;
|
||||||
switch(code)
|
switch(rec->sel_type.standard_type.sensor_type)
|
||||||
{
|
{
|
||||||
case SENSOR_TYPE_FRM_PROG:
|
case SENSOR_TYPE_FRM_PROG:
|
||||||
if(0x0F == offset)
|
if(0x0F == offset)
|
||||||
@ -1380,73 +1416,57 @@ ipmi_get_event_desc(struct ipmi_intf * intf, struct sel_event_record * rec, char
|
|||||||
|
|
||||||
|
|
||||||
const char*
|
const char*
|
||||||
ipmi_sel_get_oem_sensor_type(IPMI_OEM iana, uint8_t code)
|
ipmi_get_generic_sensor_type(uint8_t code)
|
||||||
{
|
{
|
||||||
struct ipmi_event_sensor_types *st = NULL;
|
if (code <= SENSOR_TYPE_MAX) {
|
||||||
|
return ipmi_generic_sensor_type_vals[code];
|
||||||
switch(iana){
|
|
||||||
case IPMI_OEM_KONTRON:
|
|
||||||
st = oem_kontron_event_types;
|
|
||||||
break;
|
|
||||||
/* add you oem sensor type lookup assignement here */
|
|
||||||
default:
|
|
||||||
lprintf(LOG_DEBUG, "ipmitool: missing OEM sensor type for %ul",iana);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( st != NULL )
|
return NULL;
|
||||||
for (; st->type != NULL; st++)
|
|
||||||
if (st->code == code)
|
|
||||||
return st->type;
|
|
||||||
|
|
||||||
return ipmi_sel_get_sensor_type(code);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
ipmi_sel_get_oem_sensor_type_offset(IPMI_OEM iana, uint8_t code, uint8_t offset)
|
ipmi_get_oem_sensor_type(struct ipmi_intf *intf, uint8_t code)
|
||||||
{
|
{
|
||||||
struct ipmi_event_sensor_types *st = NULL;
|
const struct oemvalstr *v, *found = NULL;
|
||||||
|
uint32_t iana = ipmi_get_oem(intf);
|
||||||
|
|
||||||
switch(iana){
|
for (v = ipmi_oem_sensor_type_vals; v->str; v++) {
|
||||||
case IPMI_OEM_KONTRON:
|
if (v->oem == iana && v->val == code) {
|
||||||
st = oem_kontron_event_types;
|
return v->str;
|
||||||
break;
|
|
||||||
/* add you oem sensor type lookup assignement here */
|
|
||||||
default:
|
|
||||||
lprintf(LOG_DEBUG,
|
|
||||||
"ipmitool: missing OEM sensor type offset for %ul",iana);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( st != NULL )
|
if ((intf->picmg_avail
|
||||||
for (; st->type != NULL; st++)
|
&& v->oem == IPMI_OEM_PICMG
|
||||||
{
|
&& v->val == code)
|
||||||
if (st->code == code && st->offset == (offset&0xf))
|
|| (intf->vita_avail
|
||||||
return st->type;
|
&& v->oem == IPMI_OEM_VITA
|
||||||
|
&& v->val == code)) {
|
||||||
|
found = v;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ipmi_sel_get_oem_sensor_type(iana,code);
|
return found ? found->str : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
ipmi_sel_get_sensor_type(uint8_t code)
|
ipmi_get_sensor_type(struct ipmi_intf *intf, uint8_t code)
|
||||||
{
|
{
|
||||||
struct ipmi_event_sensor_types *st;
|
const char *type;
|
||||||
for (st = sensor_specific_types; st->type != NULL; st++)
|
|
||||||
if (st->code == code)
|
if (code >= 0xC0) {
|
||||||
return st->type;
|
type = ipmi_get_oem_sensor_type(intf, code);
|
||||||
return "Unknown";
|
} else {
|
||||||
|
type = ipmi_get_generic_sensor_type(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
if (type == NULL) {
|
||||||
ipmi_sel_get_sensor_type_offset(uint8_t code, uint8_t offset)
|
type = "Unknown";
|
||||||
{
|
}
|
||||||
struct ipmi_event_sensor_types *st;
|
|
||||||
for (st = sensor_specific_types; st->type != NULL; st++)
|
|
||||||
if (st->code == code && st->offset == (offset&0xf))
|
|
||||||
return st->type;
|
|
||||||
|
|
||||||
return ipmi_sel_get_sensor_type(code);
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1693,13 +1713,7 @@ ipmi_sel_print_event_file(struct ipmi_intf * intf, struct sel_event_record * evt
|
|||||||
evt->sel_type.standard_type.event_data[0],
|
evt->sel_type.standard_type.event_data[0],
|
||||||
evt->sel_type.standard_type.event_data[1],
|
evt->sel_type.standard_type.event_data[1],
|
||||||
evt->sel_type.standard_type.event_data[2],
|
evt->sel_type.standard_type.event_data[2],
|
||||||
(
|
ipmi_get_sensor_type(intf, evt->sel_type.standard_type.sensor_type),
|
||||||
(evt->sel_type.standard_type.sensor_type >=0xC0 && evt->sel_type.standard_type.sensor_type < 0xF0)
|
|
||||||
?
|
|
||||||
ipmi_sel_get_oem_sensor_type_offset(ipmi_get_oem(intf),evt->sel_type.standard_type.sensor_type, evt->sel_type.standard_type.event_data[0])
|
|
||||||
:
|
|
||||||
ipmi_sel_get_sensor_type_offset(evt->sel_type.standard_type.sensor_type, evt->sel_type.standard_type.event_data[0])
|
|
||||||
),
|
|
||||||
evt->sel_type.standard_type.sensor_num,
|
evt->sel_type.standard_type.sensor_num,
|
||||||
(description != NULL) ? description : "Unknown");
|
(description != NULL) ? description : "Unknown");
|
||||||
|
|
||||||
@ -1819,15 +1833,8 @@ ipmi_sel_print_std_entry(struct ipmi_intf * intf, struct sel_event_record * evt)
|
|||||||
|
|
||||||
/* lookup SDR entry based on sensor number and type */
|
/* lookup SDR entry based on sensor number and type */
|
||||||
if (sdr != NULL) {
|
if (sdr != NULL) {
|
||||||
printf("%s ",
|
printf("%s ", ipmi_get_sensor_type(intf,
|
||||||
(
|
evt->sel_type.standard_type.sensor_type));
|
||||||
(evt->sel_type.standard_type.sensor_type >=0xC0 && evt->sel_type.standard_type.sensor_type < 0xF0)
|
|
||||||
?
|
|
||||||
ipmi_sel_get_oem_sensor_type_offset(ipmi_get_oem(intf),evt->sel_type.standard_type.sensor_type, evt->sel_type.standard_type.event_data[0])
|
|
||||||
:
|
|
||||||
ipmi_sel_get_sensor_type_offset(evt->sel_type.standard_type.sensor_type, evt->sel_type.standard_type.event_data[0])
|
|
||||||
)
|
|
||||||
);
|
|
||||||
switch (sdr->type) {
|
switch (sdr->type) {
|
||||||
case SDR_RECORD_TYPE_FULL_SENSOR:
|
case SDR_RECORD_TYPE_FULL_SENSOR:
|
||||||
printf("%s", sdr->record.full->id_string);
|
printf("%s", sdr->record.full->id_string);
|
||||||
@ -1852,13 +1859,8 @@ ipmi_sel_print_std_entry(struct ipmi_intf * intf, struct sel_event_record * evt)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
printf("%s",(
|
printf("%s", ipmi_get_sensor_type(intf,
|
||||||
(evt->sel_type.standard_type.sensor_type >=0xC0 && evt->sel_type.standard_type.sensor_type < 0xF0)
|
evt->sel_type.standard_type.sensor_type));
|
||||||
?
|
|
||||||
ipmi_sel_get_oem_sensor_type_offset(ipmi_get_oem(intf),evt->sel_type.standard_type.sensor_type, evt->sel_type.standard_type.event_data[0])
|
|
||||||
:
|
|
||||||
ipmi_sel_get_sensor_type_offset(evt->sel_type.standard_type.sensor_type, evt->sel_type.standard_type.event_data[0])
|
|
||||||
));
|
|
||||||
if (evt->sel_type.standard_type.sensor_num != 0)
|
if (evt->sel_type.standard_type.sensor_num != 0)
|
||||||
printf(" #0x%02x", evt->sel_type.standard_type.sensor_num);
|
printf(" #0x%02x", evt->sel_type.standard_type.sensor_num);
|
||||||
}
|
}
|
||||||
@ -2025,14 +2027,8 @@ ipmi_sel_print_std_entry_verbose(struct ipmi_intf * intf, struct sel_event_recor
|
|||||||
printf(" EvM Revision : %02x\n",
|
printf(" EvM Revision : %02x\n",
|
||||||
evt->sel_type.standard_type.evm_rev);
|
evt->sel_type.standard_type.evm_rev);
|
||||||
printf(" Sensor Type : %s\n",
|
printf(" Sensor Type : %s\n",
|
||||||
(
|
ipmi_get_sensor_type(intf,
|
||||||
(evt->sel_type.standard_type.sensor_type >=0xC0 && evt->sel_type.standard_type.sensor_type < 0xF0)
|
evt->sel_type.standard_type.sensor_type));
|
||||||
?
|
|
||||||
ipmi_sel_get_oem_sensor_type_offset(ipmi_get_oem(intf),evt->sel_type.standard_type.sensor_type, evt->sel_type.standard_type.event_data[0])
|
|
||||||
:
|
|
||||||
ipmi_sel_get_sensor_type_offset(evt->sel_type.standard_type.sensor_type, evt->sel_type.standard_type.event_data[0])
|
|
||||||
)
|
|
||||||
);
|
|
||||||
printf(" Sensor Number : %02x\n",
|
printf(" Sensor Number : %02x\n",
|
||||||
evt->sel_type.standard_type.sensor_num);
|
evt->sel_type.standard_type.sensor_num);
|
||||||
printf(" Event Type : %s\n",
|
printf(" Event Type : %s\n",
|
||||||
@ -2096,7 +2092,7 @@ ipmi_sel_print_extended_entry_verbose(struct ipmi_intf * intf, struct sel_event_
|
|||||||
printf(" EvM Revision : %02x\n",
|
printf(" EvM Revision : %02x\n",
|
||||||
evt->sel_type.standard_type.evm_rev);
|
evt->sel_type.standard_type.evm_rev);
|
||||||
printf(" Sensor Type : %s\n",
|
printf(" Sensor Type : %s\n",
|
||||||
ipmi_sel_get_sensor_type_offset(evt->sel_type.standard_type.sensor_type, evt->sel_type.standard_type.event_data[0]));
|
ipmi_get_sensor_type(intf, evt->sel_type.standard_type.sensor_type));
|
||||||
printf(" Sensor Number : %02x\n",
|
printf(" Sensor Number : %02x\n",
|
||||||
evt->sel_type.standard_type.sensor_num);
|
evt->sel_type.standard_type.sensor_num);
|
||||||
printf(" Event Type : %s\n",
|
printf(" Event Type : %s\n",
|
||||||
|
@ -200,14 +200,14 @@ ipmi_sensor_print_fc_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.
|
ipmi_get_sensor_type(intf, sensor->sensor.
|
||||||
type));
|
type));
|
||||||
if( sr->s_reading_valid )
|
if( sr->s_reading_valid )
|
||||||
{
|
{
|
||||||
if (sr->s_has_analog_value) {
|
if (sr->s_has_analog_value) {
|
||||||
printf(" Sensor Reading : %s %s\n", sr->s_a_str, sr->s_a_units);
|
printf(" Sensor Reading : %s %s\n", sr->s_a_str, sr->s_a_units);
|
||||||
}
|
}
|
||||||
ipmi_sdr_print_discrete_state("States Asserted",
|
ipmi_sdr_print_discrete_state(intf, "States Asserted",
|
||||||
sensor->sensor.type,
|
sensor->sensor.type,
|
||||||
sensor->event_type,
|
sensor->event_type,
|
||||||
sr->s_data2,
|
sr->s_data2,
|
||||||
@ -315,7 +315,7 @@ ipmi_sensor_print_fc_threshold(struct ipmi_intf *intf,
|
|||||||
sensor->entity.id, sensor->entity.instance);
|
sensor->entity.id, sensor->entity.instance);
|
||||||
|
|
||||||
printf(" Sensor Type (Threshold) : %s\n",
|
printf(" Sensor Type (Threshold) : %s\n",
|
||||||
ipmi_sdr_get_sensor_type_desc(sensor->sensor.
|
ipmi_get_sensor_type(intf, sensor->sensor.
|
||||||
type));
|
type));
|
||||||
|
|
||||||
printf(" Sensor Reading : ");
|
printf(" Sensor Reading : ");
|
||||||
|
@ -70,6 +70,7 @@ const struct valstr ipmi_oem_info[] = {
|
|||||||
{ IPMI_OEM_BROADCOM, "Broadcom Corporation" },
|
{ IPMI_OEM_BROADCOM, "Broadcom Corporation" },
|
||||||
{ IPMI_OEM_ERICSSON, "Ericsson AB"},
|
{ IPMI_OEM_ERICSSON, "Ericsson AB"},
|
||||||
{ IPMI_OEM_QUANTA, "Quanta" },
|
{ IPMI_OEM_QUANTA, "Quanta" },
|
||||||
|
{ IPMI_OEM_VITA, "VITA" },
|
||||||
{ IPMI_OEM_ADVANTECH, "Advantech" },
|
{ IPMI_OEM_ADVANTECH, "Advantech" },
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Add ID String for IANA Enterprise Number of IBM & ADLINK
|
* Add ID String for IANA Enterprise Number of IBM & ADLINK
|
||||||
@ -286,32 +287,61 @@ const struct oemvalstr ipmi_oem_product_info[] = {
|
|||||||
{ 0xffffff , 0xffff , NULL },
|
{ 0xffffff , 0xffff , NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct oemvalstr ipmi_oem_sdr_type_vals[] = {
|
const char *ipmi_generic_sensor_type_vals[] = {
|
||||||
/* Keep OEM grouped together */
|
"reserved",
|
||||||
{ IPMI_OEM_KONTRON , 0xC0 , "OEM Firmware Info" },
|
"Temperature", "Voltage", "Current", "Fan",
|
||||||
{ IPMI_OEM_KONTRON , 0xC2 , "OEM Init Agent" },
|
"Physical Security", "Platform Security", "Processor",
|
||||||
{ IPMI_OEM_KONTRON , 0xC3 , "OEM IPMBL Link State" },
|
"Power Supply", "Power Unit", "Cooling Device", "Other",
|
||||||
{ IPMI_OEM_KONTRON , 0xC4 , "OEM Board Reset" },
|
"Memory", "Drive Slot / Bay", "POST Memory Resize",
|
||||||
{ IPMI_OEM_KONTRON , 0xC5 , "OEM FRU Information Agent" },
|
"System Firmwares", "Event Logging Disabled", "Watchdog1",
|
||||||
{ IPMI_OEM_KONTRON , 0xC6 , "OEM POST Value Sensor" },
|
"System Event", "Critical Interrupt", "Button",
|
||||||
{ IPMI_OEM_KONTRON , 0xC7 , "OEM FWUM Status" },
|
"Module / Board", "Microcontroller", "Add-in Card",
|
||||||
{ IPMI_OEM_KONTRON , 0xC8 , "OEM Switch Mngt Software Status" },
|
"Chassis", "Chip Set", "Other FRU", "Cable / Interconnect",
|
||||||
{ IPMI_OEM_KONTRON , 0xC9 , "OEM OEM Diagnostic Status" },
|
"Terminator", "System Boot Initiated", "Boot Error",
|
||||||
{ IPMI_OEM_KONTRON , 0xCA , "OEM Component Firmware Upgrade" },
|
"OS Boot", "OS Critical Stop", "Slot / Connector",
|
||||||
{ IPMI_OEM_KONTRON , 0xCB , "OEM FRU Over Current" },
|
"System ACPI Power State", "Watchdog2", "Platform Alert",
|
||||||
{ IPMI_OEM_KONTRON , 0xCC , "OEM FRU Sensor Error" },
|
"Entity Presence", "Monitor ASIC", "LAN",
|
||||||
{ IPMI_OEM_KONTRON , 0xCD , "OEM FRU Power Denied" },
|
"Management Subsys Health", "Battery", "Session Audit",
|
||||||
{ IPMI_OEM_KONTRON , 0xCE , "OEM Reserved" },
|
"Version Change", "FRU State",
|
||||||
{ IPMI_OEM_KONTRON , 0xCF , "OEM Board Reset" },
|
NULL
|
||||||
{ IPMI_OEM_KONTRON , 0xD0 , "OEM Clock Resource Control" },
|
};
|
||||||
{ IPMI_OEM_KONTRON , 0xD1 , "OEM Power State" },
|
|
||||||
{ IPMI_OEM_KONTRON , 0xD2 , "OEM FRU Mngt Power Failure" },
|
|
||||||
{ IPMI_OEM_KONTRON , 0xD3 , "OEM Jumper Status" },
|
|
||||||
{ IPMI_OEM_KONTRON , 0xF2 , "OEM RTM Module Hotswap" },
|
|
||||||
|
|
||||||
{ IPMI_OEM_PICMG , 0xF0 , "PICMG FRU Hotswap" },
|
const struct oemvalstr ipmi_oem_sensor_type_vals[] = {
|
||||||
{ IPMI_OEM_PICMG , 0xF1 , "PICMG IPMB0 Link State" },
|
/* Keep OEM grouped together */
|
||||||
{ IPMI_OEM_PICMG , 0xF2 , "PICMG Module Hotswap" },
|
{ IPMI_OEM_KONTRON, 0xC0, "Firmware Info" },
|
||||||
|
{ IPMI_OEM_KONTRON, 0xC2, "Init Agent" },
|
||||||
|
{ IPMI_OEM_KONTRON, 0xC2, "Board Reset(cPCI)" },
|
||||||
|
{ IPMI_OEM_KONTRON, 0xC3, "IPMBL Link State" },
|
||||||
|
{ IPMI_OEM_KONTRON, 0xC4, "Board Reset" },
|
||||||
|
{ IPMI_OEM_KONTRON, 0xC5, "FRU Information Agent" },
|
||||||
|
{ IPMI_OEM_KONTRON, 0xC6, "POST Value Sensor" },
|
||||||
|
{ IPMI_OEM_KONTRON, 0xC7, "FWUM Status" },
|
||||||
|
{ IPMI_OEM_KONTRON, 0xC8, "Switch Mngt Software Status" },
|
||||||
|
{ IPMI_OEM_KONTRON, 0xC9, "OEM Diagnostic Status" },
|
||||||
|
{ IPMI_OEM_KONTRON, 0xCA, "Component Firmware Upgrade" },
|
||||||
|
{ IPMI_OEM_KONTRON, 0xCB, "FRU Over Current" },
|
||||||
|
{ IPMI_OEM_KONTRON, 0xCC, "FRU Sensor Error" },
|
||||||
|
{ IPMI_OEM_KONTRON, 0xCD, "FRU Power Denied" },
|
||||||
|
{ IPMI_OEM_KONTRON, 0xCE, "Reserved" },
|
||||||
|
{ IPMI_OEM_KONTRON, 0xCF, "Board Reset" },
|
||||||
|
{ IPMI_OEM_KONTRON, 0xD0, "Clock Resource Control" },
|
||||||
|
{ IPMI_OEM_KONTRON, 0xD1, "Power State" },
|
||||||
|
{ IPMI_OEM_KONTRON, 0xD2, "FRU Mngt Power Failure" },
|
||||||
|
{ IPMI_OEM_KONTRON, 0xD3, "Jumper Status" },
|
||||||
|
{ IPMI_OEM_KONTRON, 0xF2, "RTM Module Hotswap" },
|
||||||
|
/* PICMG Sensor Types */
|
||||||
|
{ IPMI_OEM_PICMG, 0xF0, "FRU Hot Swap" },
|
||||||
|
{ IPMI_OEM_PICMG, 0xF1,"IPMB Physical Link" },
|
||||||
|
{ IPMI_OEM_PICMG, 0xF2, "Module Hot Swap" },
|
||||||
|
{ IPMI_OEM_PICMG, 0xF3, "Power Channel Notification" },
|
||||||
|
{ IPMI_OEM_PICMG, 0xF4, "Telco Alarm Input" },
|
||||||
|
/* VITA 46.11 Sensor Types */
|
||||||
|
{ IPMI_OEM_VITA, 0xF0, "FRU State" },
|
||||||
|
{ IPMI_OEM_VITA, 0xF1, "System IPMB Link" },
|
||||||
|
{ IPMI_OEM_VITA, 0xF2, "FRU Health" },
|
||||||
|
{ IPMI_OEM_VITA, 0xF3, "FRU Temperature" },
|
||||||
|
{ IPMI_OEM_VITA, 0xF4, "Payload Test Results" },
|
||||||
|
{ IPMI_OEM_VITA, 0xF5, "Payload Test Status" },
|
||||||
|
|
||||||
{ 0xffffff, 0x00, NULL }
|
{ 0xffffff, 0x00, NULL }
|
||||||
};
|
};
|
||||||
|
@ -239,8 +239,7 @@ log_event(struct ipmi_event_intf * eintf, struct sel_event_record * evt)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
type = ipmi_sel_get_sensor_type_offset(evt->sel_type.standard_type.sensor_type,
|
type = ipmi_get_sensor_type(intf, evt->sel_type.standard_type.sensor_type);
|
||||||
evt->sel_type.standard_type.event_data[0]);
|
|
||||||
|
|
||||||
ipmi_get_event_desc(intf, evt, &desc);
|
ipmi_get_event_desc(intf, evt, &desc);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user