diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2018-05-01 10:13:19 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2018-05-01 10:13:19 +0200 |
commit | a1cf5d4924bb115d7de05e0bc080f88e04d24d29 (patch) | |
tree | 01484827e16d2c8e42a0fe32a561d1f9fd4a5472 /util/oem_lenovo.c | |
parent | 7a765f655540e4e254f4aaaf6ea3326a57d76e59 (diff) | |
parent | fc806628dbeecd34f41b2f6d04290631dca3955e (diff) |
Update upstream source from tag 'upstream/3.1.0'
Update to upstream version '3.1.0'
with Debian dir 7f3343aa24cd6de6310e636ce7444692bec74f2a
Diffstat (limited to 'util/oem_lenovo.c')
-rw-r--r-- | util/oem_lenovo.c | 111 |
1 files changed, 97 insertions, 14 deletions
diff --git a/util/oem_lenovo.c b/util/oem_lenovo.c index 1f23e0f..d190fbc 100644 --- a/util/oem_lenovo.c +++ b/util/oem_lenovo.c @@ -61,8 +61,13 @@ extern uchar bitnum(ushort value); /*isensor.c*/ extern char fdebug; /*ipmicmd.c*/ void set_loglevel(int level); /*prototype */ +#ifdef METACOMMAND +extern char * progver; /*from ipmiutil.c*/ +static char * progname = "ipmiutil lenovooem"; +#else static char * progver = "3.08"; static char * progname = "ilenovooem"; +#endif static int verbose = 0; static uchar g_bus = PUBLIC_BUS; static uchar g_sa = BMC_SA; @@ -71,6 +76,68 @@ static uchar g_addrtype = ADDR_SMI; static int vend_id = 0; static int prod_id = 0; +/* See oem_ibm_sel_map from ipmitool contrib, interpretation not verified yet */ +#define NIBMEVT 16 +struct { uchar stype; uchar snum; uchar etype; + uchar data1; uchar data2; uchar data3; + uchar sev; char *desc; } oem_ibm_events[NIBMEVT] = { +0xC1, 0xFF, 0xFF, 0xFF, 0x01, 0x00, SEV_MIN, "CPU shutdown - Potential cause 'triple fault' a software address problem", +0xC1, 0xFF, 0xFF, 0xFF, 0x02, 0x01, SEV_INFO, "Memory Mirrored Failover Occurred - System running from mirrored memory image", +0xC1, 0xFF, 0xFF, 0xFF, 0x02, 0x04, SEV_INFO, "Memory hot replace event", +0xC1, 0xFF, 0xFF, 0xFF, 0x02, 0x05, SEV_INFO, "Memory hot add event", +0xC1, 0xFF, 0xFF, 0xFF, 0x03, 0x00, SEV_INFO, "Scalability link down", +0xC1, 0xFF, 0xFF, 0xFF, 0x03, 0x01, SEV_INFO, "Scalability link up", +0xC1, 0xFF, 0xFF, 0xFF, 0x03, 0x02, SEV_INFO, "Scalability link double wide down", +0xC1, 0xFF, 0xFF, 0xFF, 0x03, 0x03, SEV_INFO, "Scalability link double wide up", +0xC1, 0xFF, 0xFF, 0xFF, 0x03, 0x80, SEV_INFO, "Scalability link PFA", +0xC1, 0xFF, 0xFF, 0xFF, 0x03, 0x81, SEV_INFO, "Scalability link invalid port", +0xC1, 0xFF, 0xFF, 0xFF, 0x03, 0x82, SEV_INFO, "Scalability link invalid node", +0xC1, 0xFF, 0xFF, 0xFF, 0x03, 0x83, SEV_INFO, "Scalability link kill", +0xE0, 0x00, 0x00, 0xFF, 0xFF, 0xFF, SEV_INFO, "Device OK", +0xE0, 0x00, 0x01, 0xFF, 0xFF, 0xFF, SEV_MAJ, "Required ROM space not available", +0xE0, 0x00, 0x02, 0xFF, 0xFF, 0xFF, SEV_MAJ, "Required I/O Space not available", +0xE0, 0x00, 0x03, 0xFF, 0xFF, 0xFF, SEV_MAJ, "Required memory not available" +}; + +/*------------------------------------------------------------------------ + * get_ibm_desc + * Uses the oem_ibm_events to decode IBM events not otherwise handled. + * Called by decode_sel_lenovo + *------------------------------------------------------------------------*/ +char * get_ibm_desc(uchar type, uchar num, uchar trig, + uchar data1, uchar data2, uchar data3, uchar *sev) +{ + int i; + char *pstr = NULL; + + /* Use oem_ibm_events array for other misc descriptions */ + data1 &= 0x0f; /*ignore top half of sensor offset for matching */ + for (i = 0; i < NIBMEVT; i++) { + if ((oem_ibm_events[i].stype == 0xff) || + (oem_ibm_events[i].stype == type)) { + if (oem_ibm_events[i].snum != 0xff && + oem_ibm_events[i].snum != num) + continue; + if (oem_ibm_events[i].etype != 0xff && + oem_ibm_events[i].etype != trig) + continue; + if (oem_ibm_events[i].data1 != 0xff && + (oem_ibm_events[i].data1 & 0x0f) != (data1 & 0x0f)) + continue; + if (oem_ibm_events[i].data2 != 0xff && + oem_ibm_events[i].data2 != data2) + continue; + if (oem_ibm_events[i].data3 != 0xff && + oem_ibm_events[i].data3 != data3) + continue; + /* have a match, use description */ + pstr = (char *)oem_ibm_events[i].desc; + if (sev != NULL) *sev = oem_ibm_events[i].sev; + break; + } + } /*end for*/ + return(pstr); +} /* end get_ibm_desc() */ /* * decode_sensor_lenovo @@ -164,6 +231,15 @@ int decode_sensor_lenovo(uchar *sdr,uchar *reading,char *pstring, int slen) rv = 0; } break; + case 0x17: /* RSA II Detect, Mem1 Detect (mfg=0002:0077) */ + /* mfg=0002:0077 sensor type=17 evt=8 entity=b rval=0002, RSA II*/ + /* mfg=0002:0077 sensor type=17 evt=8 entity=8 rval=0002, Mem1 */ + switch(rval) { + case 0x02: pstr = "OK"; break; + default: pstr = "Unknown"; break; + } + rv = 0; + break; case 0x1B: /* Front USB, nvDIMM Cable, etc. */ if (etype == 0x6F) { /* 0x01 = connected/OK, 0x02 = cable connect error */ @@ -257,9 +333,9 @@ int decode_sel_lenovo(uchar *evt, char *outbuf, int outsz, char fdesc, char mybuf[64]; char *type_str = ""; char *pstr = NULL; - int sevid; + uchar sevid; ushort genid; - uchar snum; + uchar snum, etype; uchar data1, data2, data3; fdebug = fdbg; @@ -269,21 +345,28 @@ int decode_sel_lenovo(uchar *evt, char *outbuf, int outsz, char fdesc, snum = evt[11]; timestamp = evt[3] + (evt[4] << 8) + (evt[5] << 16) + (evt[6] << 24); genid = evt[7] | (evt[8] << 8); + etype = evt[12]; data1 = evt[13]; data2 = evt[14]; data3 = evt[15]; - if (rectype == 0x02) - { - sprintf(mybuf,"%02x [%02x %02x %02x]", evt[12],data1,data2,data3); - switch(evt[10]) { /*sensor type*/ - case 0xC0: /* OEM type */ - type_str = "OEM_type"; - pstr = "OEM Sensor "; - sevid = SEV_MAJ; - rv = -1; - break; - default: /*other sensor types*/ - break; + + if (rectype == 0x02) { + sprintf(mybuf,"%02x [%02x %02x %02x]", etype,data1,data2,data3); + pstr = get_ibm_desc(evt[10], snum, etype, data1, data2, data3, &sevid); + if (pstr != NULL) { + type_str = "IBM_type"; + rv = 0; + } else { + switch(evt[10]) { /*sensor type*/ + case 0xC0: /* OEM type */ + type_str = "OEM_type"; + pstr = "OEM Sensor "; + sevid = SEV_MAJ; + rv = -1; + break; + default: /*other sensor types*/ + break; + } } } if (rv == 0) { |