diff --git a/ipmitool/include/ipmitool/helper.h b/ipmitool/include/ipmitool/helper.h index 5331cd8..3bf4f9d 100644 --- a/ipmitool/include/ipmitool/helper.h +++ b/ipmitool/include/ipmitool/helper.h @@ -44,7 +44,14 @@ struct valstr { uint16_t val; const char * str; }; +struct oemvalstr { + uint16_t oem; + uint16_t val; + const char * str; +}; + const char * val2str(uint16_t val, const struct valstr * vs); +const char * oemval2str(uint16_t oem,uint16_t val, const struct oemvalstr * vs); uint16_t str2val(const char * str, const struct valstr * vs); void print_valstr(const struct valstr * vs, const char * title, int loglevel); void print_valstr_2col(const struct valstr * vs, const char * title, int loglevel); diff --git a/ipmitool/include/ipmitool/ipmi.h b/ipmitool/include/ipmitool/ipmi.h index fa9965c..ac0812a 100644 --- a/ipmitool/include/ipmitool/ipmi.h +++ b/ipmitool/include/ipmitool/ipmi.h @@ -234,6 +234,21 @@ struct ipmi_rs { #define IPMI_BMC_SLAVE_ADDR 0x20 #define IPMI_REMOTE_SWID 0x81 + +/* These values are IANA numbers */ +typedef enum IPMI_OEM { + IPMI_OEM_UNKNOWN = 0, + IPMI_OEM_SUN = 42, + IPMI_OEM_NOKIA = 94, + IPMI_OEM_INTEL = 343, + IPMI_OEM_TYAN = 6653, + IPMI_OEM_NEWISYS = 9237, + IPMI_OEM_SUPERMICRO = 10876, + IPMI_OEM_GOOGLE = 11129, + IPMI_OEM_PICMG = 12634, + IPMI_OEM_KONTRON = 15000, +} IPMI_OEM; + extern const struct valstr completion_code_vals[]; #endif /* IPMI_H */ diff --git a/ipmitool/include/ipmitool/ipmi_sel.h b/ipmitool/include/ipmitool/ipmi_sel.h index 2c82125..ffa30fa 100644 --- a/ipmitool/include/ipmitool/ipmi_sel.h +++ b/ipmitool/include/ipmitool/ipmi_sel.h @@ -521,19 +521,6 @@ static struct ipmi_event_sensor_types sensor_specific_types[] __attribute__((unu { 0x00, 0x00, 0x00, 0x00, NULL, NULL }, }; - -/* These values are IANA numbers */ -typedef enum IPMI_OEM { - IPMI_OEM_UNKNOWN = 0, - IPMI_OEM_SUN = 42, - IPMI_OEM_INTEL = 343, - IPMI_OEM_TYAN = 6653, - IPMI_OEM_NEWISYS = 9237, - IPMI_OEM_SUPERMICRO = 10876, - IPMI_OEM_GOOGLE = 11129, - IPMI_OEM_KONTRON = 15000, -} IPMI_OEM; - int ipmi_sel_main(struct ipmi_intf *, int, char **); void ipmi_sel_print_std_entry(struct ipmi_intf * intf, struct sel_event_record * evt); void ipmi_sel_print_std_entry_verbose(struct ipmi_intf * intf, struct sel_event_record * evt); diff --git a/ipmitool/include/ipmitool/ipmi_strings.h b/ipmitool/include/ipmitool/ipmi_strings.h index 1ad8bb6..4116431 100644 --- a/ipmitool/include/ipmitool/ipmi_strings.h +++ b/ipmitool/include/ipmitool/ipmi_strings.h @@ -53,5 +53,8 @@ extern const struct valstr ipmi_integrity_algorithms[]; extern const struct valstr ipmi_encryption_algorithms[]; extern const struct valstr ipmi_oem_info[]; +extern const struct oemvalstr ipmi_oem_sdr_type_vals[]; + + #endif /*IPMI_STRINGS_H*/ diff --git a/ipmitool/lib/helper.c b/ipmitool/lib/helper.c index 4dec4b9..bde52b3 100644 --- a/ipmitool/lib/helper.c +++ b/ipmitool/lib/helper.c @@ -124,6 +124,35 @@ const char * val2str(uint16_t val, const struct valstr *vs) return un_str; } +const char * oemval2str(uint16_t oem, uint16_t val, + const struct oemvalstr *vs) +{ + static char un_str[32]; + int i; + + for (i = 0; vs[i].oem != 0x00 && vs[i].str != NULL; i++) { + /* FIXME: for now on we assume PICMG capability on all IANAs */ + if + ( + ( + vs[i].oem == oem + || + vs[i].oem == IPMI_OEM_PICMG + ) + && + vs[i].val == val + ) + { + return vs[i].str; + } + } + + memset(un_str, 0, 32); + snprintf(un_str, 32, "OEM reserved #%02x", val); + + return un_str; +} + uint16_t str2val(const char *str, const struct valstr *vs) { int i; diff --git a/ipmitool/lib/ipmi_sdr.c b/ipmitool/lib/ipmi_sdr.c index bce6baa..9f6ec77 100644 --- a/ipmitool/lib/ipmi_sdr.c +++ b/ipmitool/lib/ipmi_sdr.c @@ -56,6 +56,7 @@ extern int verbose; static int use_built_in; /* Uses DeviceSDRs instead of SDRR */ static int sdr_max_read_len = GET_SDR_ENTIRE_RECORD; static int sdr_extended = 0; +static long sdriana = 0; static struct sdr_record_list *sdr_list_head = NULL; static struct sdr_record_list *sdr_list_tail = NULL; @@ -518,7 +519,10 @@ ipmi_sdr_get_sensor_type_desc(const uint8_t type) if (type < 0xc0) snprintf(desc, 32, "reserved #%02x", type); else - snprintf(desc, 32, "OEM reserved #%02x", type); + { + snprintf(desc, 32, oemval2str(sdriana,type,ipmi_oem_sdr_type_vals), + type); + } return desc; } @@ -2511,6 +2515,8 @@ ipmi_sdr_start(struct ipmi_intf *intf) } devid = (struct ipm_devid_rsp *) rsp->data; + sdriana = (long)IPM_DEV_MANUFACTURER_ID(devid->manufacturer_id); + if (devid->device_revision & IPM_DEV_DEVICE_ID_SDR_MASK) { if ((devid->adtl_device_support & 0x02) == 0) { if ((devid->adtl_device_support & 0x01)) { diff --git a/ipmitool/lib/ipmi_strings.c b/ipmitool/lib/ipmi_strings.c index a29ebcc..1941704 100644 --- a/ipmitool/lib/ipmi_strings.c +++ b/ipmitool/lib/ipmi_strings.c @@ -46,9 +46,27 @@ const struct valstr ipmi_oem_info[] = { { IPMI_OEM_SUPERMICRO, "Supermicro" }, { IPMI_OEM_GOOGLE, "Google" }, { IPMI_OEM_KONTRON, "Kontron" }, + { IPMI_OEM_NOKIA, "Nokia" }, { 0xffff , NULL }, }; +const struct oemvalstr ipmi_oem_sdr_type_vals[] = { + /* Keep OEM grouped together */ + { IPMI_OEM_KONTRON , 0xC0 , "OEM Firmware Info" }, + { IPMI_OEM_KONTRON , 0xC2 , "OEM Init Agent" }, + { IPMI_OEM_KONTRON , 0xC3 , "OEM IPMBL Link State" }, + { IPMI_OEM_KONTRON , 0xC4 , "OEM Board Reset" }, + { IPMI_OEM_KONTRON , 0xC5 , "OEM FRU Information Agent" }, + { IPMI_OEM_KONTRON , 0xC6 , "OEM POST Value Sensor" }, + { IPMI_OEM_KONTRON , 0xC7 , "OEM FWUM Status" }, + { IPMI_OEM_KONTRON , 0xC8 , "OEM Switch Mngt Software Status" }, + + { IPMI_OEM_PICMG , 0xF0 , "PICMG FRU Hotswap" }, + { IPMI_OEM_PICMG , 0xF1 , "PICMG IPMB0 Link State" }, + + { 0xffff, 0x00, NULL } +}; + const struct valstr ipmi_netfn_vals[] = { { IPMI_NETFN_CHASSIS, "Chassis" }, { IPMI_NETFN_BRIDGE, "Bridge" },