Added ability to map OEM sensor types to OEM description string using

IANA number.
Moved IANA number table
This commit is contained in:
Francois Isabelle 2006-11-03 21:10:59 +00:00
parent 583a5e7cd0
commit 86a32205be
7 changed files with 79 additions and 14 deletions

View File

@ -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);

View File

@ -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 */

View File

@ -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);

View File

@ -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*/

View File

@ -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;

View File

@ -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)) {

View File

@ -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" },