diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2018-07-11 07:36:21 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2018-07-11 07:36:21 +0200 |
commit | 341aee5e3e3625173e4b684cc4166e60f6eb147f (patch) | |
tree | 133bb01bc02539bb98f98bfa6807dc084b995bec /util/oem_lenovo.c | |
parent | 631fa5250443f5441549bf3184830bc34b0c042e (diff) | |
parent | 788a8d509d66a15ecb1810599885792a1acaaeb9 (diff) |
Merge branch 'release/debian/3.1.1-1'debian/3.1.1-1
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) { |