summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/Makefile.am2
-rw-r--r--util/Makefile.in6
-rw-r--r--util/ialarms.c2
-rw-r--r--util/icmd.c2
-rw-r--r--util/iconfig.c3
-rw-r--r--util/idcmi.c2
-rw-r--r--util/ievents.c28
-rw-r--r--util/ifirewall.c2
-rw-r--r--util/ifru.c2
-rw-r--r--util/ifruset.c2
-rw-r--r--util/igetevent.c2
-rw-r--r--util/ihealth.c11
-rw-r--r--util/ilan.c8
-rw-r--r--util/imbapi.c14
-rw-r--r--util/ipicmg.c2
-rw-r--r--util/ipmicmd.c1
-rw-r--r--util/ipmicmd.h2
-rw-r--r--util/ipmidir.c31
-rw-r--r--util/ipmilan.c6
-rw-r--r--util/ipmimv.c6
-rw-r--r--util/ipmiutil.c4
-rw-r--r--util/ipmiutil.mak11
-rw-r--r--util/ipmiutil64.mak11
-rw-r--r--util/ireset.c2
-rw-r--r--util/isel.c2
-rw-r--r--util/iseltime.c2
-rw-r--r--util/isensor.c169
-rw-r--r--util/iserial.c5
-rw-r--r--util/isol.c2
-rw-r--r--util/itsol.c2
-rw-r--r--util/iwdt.c2
-rw-r--r--util/oem_dell.c63
-rw-r--r--util/oem_lenovo.c365
-rw-r--r--util/oem_lenovo.h46
-rw-r--r--util/oem_newisys.c2
-rw-r--r--util/oem_sun.c2
-rw-r--r--util/oem_supermicro.c91
-rw-r--r--util/subs.c4
38 files changed, 788 insertions, 131 deletions
diff --git a/util/Makefile.am b/util/Makefile.am
index c3312ac..583cbe5 100644
--- a/util/Makefile.am
+++ b/util/Makefile.am
@@ -23,7 +23,7 @@ CMDMOD += ipmilanplus.c
# CMDMOD = ipmicmd.c mem_if.c @OS_DRIVERS@
# am: configure substitutions are not allowed in _SOURCES variables
LIBOBJ = ipmicmd.o mem_if.o ipmidir.o imbapi.o ipmimv.o ipmild.o ipmibmc.o ipmilipmi.o subs.o md5.o md2.o $(tmpobj)/ipmilan.o $(tmpobj)/ipmilanplus.o @LIBSENSORS@
-OEMMOD = oem_kontron.c oem_fujitsu.c oem_intel.c oem_sun.c oem_supermicro.c oem_dell.c oem_quanta.c oem_hp.c oem_newisys.c iekanalyzer.c
+OEMMOD = oem_kontron.c oem_fujitsu.c oem_intel.c oem_sun.c oem_supermicro.c oem_dell.c oem_quanta.c oem_hp.c oem_newisys.c oem_lenovo.c iekanalyzer.c
L2OBJ = @SAM2OBJ@
AM_CPPFLAGS += -I. -I.. -DMETACOMMAND
diff --git a/util/Makefile.in b/util/Makefile.in
index a745663..bf37fdf 100644
--- a/util/Makefile.in
+++ b/util/Makefile.in
@@ -73,7 +73,8 @@ ipmi_sample_evt_DEPENDENCIES = $(am__DEPENDENCIES_1)
am__objects_1 = oem_kontron.$(OBJEXT) oem_fujitsu.$(OBJEXT) \
oem_intel.$(OBJEXT) oem_sun.$(OBJEXT) oem_supermicro.$(OBJEXT) \
oem_dell.$(OBJEXT) oem_quanta.$(OBJEXT) oem_hp.$(OBJEXT) \
- oem_newisys.$(OBJEXT) iekanalyzer.$(OBJEXT)
+ oem_newisys.$(OBJEXT) oem_lenovo.$(OBJEXT) \
+ iekanalyzer.$(OBJEXT)
am__objects_2 = ipmicmd.$(OBJEXT) mem_if.$(OBJEXT) ipmidir.$(OBJEXT) \
imbapi.$(OBJEXT) ipmimv.$(OBJEXT) ipmild.$(OBJEXT) \
ipmibmc.$(OBJEXT) ipmilipmi.$(OBJEXT) subs.$(OBJEXT) \
@@ -294,7 +295,7 @@ CMDMOD = ipmicmd.c mem_if.c ipmidir.c imbapi.c ipmimv.c ipmild.c \
# CMDMOD = ipmicmd.c mem_if.c @OS_DRIVERS@
# am: configure substitutions are not allowed in _SOURCES variables
LIBOBJ = ipmicmd.o mem_if.o ipmidir.o imbapi.o ipmimv.o ipmild.o ipmibmc.o ipmilipmi.o subs.o md5.o md2.o $(tmpobj)/ipmilan.o $(tmpobj)/ipmilanplus.o @LIBSENSORS@
-OEMMOD = oem_kontron.c oem_fujitsu.c oem_intel.c oem_sun.c oem_supermicro.c oem_dell.c oem_quanta.c oem_hp.c oem_newisys.c iekanalyzer.c
+OEMMOD = oem_kontron.c oem_fujitsu.c oem_intel.c oem_sun.c oem_supermicro.c oem_dell.c oem_quanta.c oem_hp.c oem_newisys.c oem_lenovo.c iekanalyzer.c
L2OBJ = @SAM2OBJ@
METASOURCE = ipmiutil.c ialarms.c ihealth.c ievents.c ifru.c ifru_picmg.c igetevent.c ireset.c icmd.c ilan.c isensor.c isel.c iserial.c iwdt.c isol.c idiscover.c iconfig.c ipicmg.c ifirewall.c ifwum.c ihpm.c itsol.c idcmi.c $(OEMMOD) $(CMDMOD)
LANPLUS_OBJ = $(shell ar t @LANPLUS_LIB@ 2>/dev/null)
@@ -484,6 +485,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oem_hp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oem_intel.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oem_kontron.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oem_lenovo.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oem_newisys.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oem_quanta.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oem_sun.Po@am__quote@
diff --git a/util/ialarms.c b/util/ialarms.c
index 460b3eb..afa8073 100644
--- a/util/ialarms.c
+++ b/util/ialarms.c
@@ -75,7 +75,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/*
* Global variables
*/
-static char * progver = "3.00";
+static char * progver = "3.01";
static char * progname = "ialarms";
static char fdebug = 0;
static char fbmctam = 0;
diff --git a/util/icmd.c b/util/icmd.c
index 3d55642..04763ae 100644
--- a/util/icmd.c
+++ b/util/icmd.c
@@ -78,7 +78,7 @@ extern void ipmi_lan_set_timeout(int ipmito, int tries, int pingto);
/*
* Global variables
*/
-static char * progver = "3.00";
+static char * progver = "3.01";
static char * progname = "icmd";
static char fdebug = 0;
static char fquiet = 0;
diff --git a/util/iconfig.c b/util/iconfig.c
index 240e530..ede54ff 100644
--- a/util/iconfig.c
+++ b/util/iconfig.c
@@ -90,6 +90,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endif
#include "ipmicmd.h"
#include "oem_intel.h"
+#include "oem_supermicro.h"
extern int find_ifname(char *ifname); /*see idiscover.c*/
/* atoip was moved to subs.c, defined in ipmicmd.h */
@@ -171,7 +172,7 @@ typedef struct
/*
* Global variables
*/
-static char * progver = "3.00";
+static char * progver = "3.01";
static char * progname = "iconfig";
static char fdebug = 0;
static char fipmilan = 0;
diff --git a/util/idcmi.c b/util/idcmi.c
index 5731af5..65342d6 100644
--- a/util/idcmi.c
+++ b/util/idcmi.c
@@ -62,7 +62,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "idcmi.h"
static char * progname = "idcmi";
-static char * progver = "3.00";
+static char * progver = "3.01";
extern char fdebug; /*from ipmicmd.c*/
static uchar g_bus = PUBLIC_BUS;
static uchar g_sa = BMC_SA;
diff --git a/util/ievents.c b/util/ievents.c
index 7ff61e1..1e7f8e2 100644
--- a/util/ievents.c
+++ b/util/ievents.c
@@ -76,7 +76,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define SELprintf printf
#define SMS_SA 0x41
#define SMI_SA 0x21
-static char *progver = "3.00";
+static char *progver = "3.01";
static char *progname = "ievents";
static char fsensdesc = 0; /* 1= get extended sensor descriptions*/
static char fcanonical = 0; /* 1= show canonical, delimited output*/
@@ -318,8 +318,8 @@ char * batt_str[NBATT] = { /* Battery assert descriptions */
/*01*/ "Failed",
/*02*/ "Present" };
char * batt_clr[NBATT] = { /* Battery deassert descriptions */
- /*00*/ "Low OK",
- /*01*/ "Failed OK",
+ /*00*/ "Low is OK now",
+ /*01*/ "Failed is OK now",
/*02*/ "Absent" };
#define N_NMH 6
@@ -731,6 +731,7 @@ extern int decode_sel_kontron(uchar *evt, char *obuf,int sz,char fdesc,char fdbg
extern int decode_sel_fujitsu(uchar *evt, char *obuf,int sz,char fdesc,char fdbg); /*oem_fujitsu.c*/
extern int decode_sel_intel(uchar *evt, char *obuf,int sz,char fdesc,char fdbg); /*oem_intel.c*/
extern int decode_sel_supermicro(uchar *evt, char *obuf,int sz,char fdesc,char fdbg); /*oem_supermicro.c*/
+extern int decode_sel_lenovo(uchar *evt, char *obuf,int sz,char fdesc,char fdbg); /*oem_lenovo.c*/
extern int decode_sel_quanta(uchar *evt, char *obuf,int sz,char fdesc,char fdbg); /*oem_quanta.c*/
extern int decode_sel_newisys(uchar *evt, char *obuf,int sz,char fdesc,char fdbg); /*oem_newisys.c*/
extern int decode_sel_dell(uchar *evt, char *obuf,int sz,char fdesc,char fdbg); /*oem_dell.c*/
@@ -1380,6 +1381,10 @@ int decode_sel_oem(int vend, uchar *pevt, char *outbuf,int szbuf,
case VENDOR_SUPERMICROX:
rv = decode_sel_supermicro(pevt,outbuf,szbuf,fdesc,fdbg);
break;
+ case VENDOR_LENOVO:
+ case VENDOR_LENOVO2:
+ rv = decode_sel_lenovo(pevt,outbuf,szbuf,fdesc,fdbg);
+ break;
case VENDOR_QUANTA:
rv = decode_sel_quanta(pevt,outbuf,szbuf,fdesc,fdbg);
break;
@@ -1850,6 +1855,23 @@ int decode_sel_entry( uchar *pevt, char *outbuf, int szbuf)
else { pstr = "ProcErr Asserted"; sev = SEV_CRIT; }
}
break;
+ case 0x08: /*Power Supply*/
+ pstr = NULL; /*falls through to unknown*/
+ if ((psel->event_trigger == 0x0b) ||
+ (psel->event_trigger == 0x8b)) {
+ rv = decode_redund(psel->event_trigger,
+ psel->event_data1, mystr, &sev);
+ if (rv == 0) pstr = mystr;
+ } else {
+ pstr = get_misc_desc( psel->generator_id,
+ psel->sensor_type,
+ psel->sensor_number,
+ psel->event_trigger,
+ psel->event_data1,
+ psel->event_data2,
+ psel->event_data3, &sev);
+ }
+ break;
case 0x09: /*Power Unit*/
if ((psel->event_trigger == 0x0b) ||
(psel->event_trigger == 0x8b)) {
diff --git a/util/ifirewall.c b/util/ifirewall.c
index 9048de0..7938cd9 100644
--- a/util/ifirewall.c
+++ b/util/ifirewall.c
@@ -64,7 +64,7 @@
/* global variables */
static char * progname = "ifirewall";
-static char * progver = "3.00";
+static char * progver = "3.01";
static char fdebug = 0;
static uchar g_bus = PUBLIC_BUS;
static uchar g_sa = BMC_SA;
diff --git a/util/ifru.c b/util/ifru.c
index 2390354..f9d35df 100644
--- a/util/ifru.c
+++ b/util/ifru.c
@@ -116,7 +116,7 @@ extern int ipmi_kontronoem_main(void * intf, int argc, char ** argv);
#endif
static char *progname = "ifru";
-static char *progver = "3.00";
+static char *progver = "3.01";
static int vend_id = 0;
static int prod_id = 0;
static char fdebug = 0;
diff --git a/util/ifruset.c b/util/ifruset.c
index 652167f..360b84b 100644
--- a/util/ifruset.c
+++ b/util/ifruset.c
@@ -106,7 +106,7 @@ extern void fmt_time(time_t etime, char *buf, int bufsz); /*see ievents.c*/
#define IPROD_OEM 7
static char *progname = "ifruset";
-static char *progver = "3.00";
+static char *progver = "3.01";
static char fdebug = 0;
static char fpicmg = 0;
static char fonlybase = 0;
diff --git a/util/igetevent.c b/util/igetevent.c
index f73c71f..4b0de05 100644
--- a/util/igetevent.c
+++ b/util/igetevent.c
@@ -169,7 +169,7 @@ extern void free_sdr_cache(uchar *pret); /*see isensor.c*/
* Global variables
*/
static char * progname = "igetevent";
-static char * progver = "3.00";
+static char * progver = "3.01";
static char fdebug = 0;
static char fipmilan = 0;
static char frunonce = 0;
diff --git a/util/ihealth.c b/util/ihealth.c
index 1389ba2..db228bf 100644
--- a/util/ihealth.c
+++ b/util/ihealth.c
@@ -82,7 +82,7 @@ extern int oem_supermicro_get_firmware_str(char *pstr, int sz); /*oem_supermicro
* Global variables
*/
static char * progname = "ihealth";
-static char * progver = "3.00";
+static char * progver = "3.01";
static char fdebug = 0;
static char fipmilan = 0;
static char fcanonical = 0;
@@ -634,6 +634,11 @@ void show_devid_all(int dtype, uchar *devrec, int sdevrec)
if (prod >= 0x200) prodstr = "(iRMC S2)";
else prodstr = "";
break;
+ case VENDOR_LENOVO:
+ case VENDOR_LENOVO2:
+ if (prod == 0x143) prodstr = "(x3650 M4)";
+ else prodstr = "";
+ break;
case VENDOR_CISCO: /*=0x00168b, 5771.*/
if (prod == 0x0005) prodstr = "(UCS C200)";
else prodstr = "";
@@ -763,6 +768,8 @@ void show_devid_all(int dtype, uchar *devrec, int sdevrec)
case 1636: prodstr = "(X9DRH)"; break; /*0x0664*/
case 1643: prodstr = "(X9SRL)"; break; /*0x066b*/
case 1797: prodstr = "(X9DR7)"; break; /*0x0705*/
+ case 2097: prodstr = "(X10DRL)"; /*0x0831*/
+ do_powerstate = 0; break;
case 2137: prodstr = "(X10DRH)"; break; /*0x0859*/
case 4520: prodstr = "(H8DGU)"; break;
case 43025: prodstr = "(H8DGU-F)"; break;
@@ -790,7 +797,7 @@ void show_devid_all(int dtype, uchar *devrec, int sdevrec)
prodstr = "";
break;
} /*end switch(prod)*/
- if (prodstr == "") prodstr = getdmiprod();
+ if (prodstr[0] == '\0') prodstr = getdmiprod();
if (kcs_loops != 0) set_max_kcs_loops(kcs_loops);
} /*end-else BMC*/
diff --git a/util/ilan.c b/util/ilan.c
index 91dda48..0c47e4d 100644
--- a/util/ilan.c
+++ b/util/ilan.c
@@ -305,7 +305,7 @@ extern char *get_sensor_type_desc(uchar stype); /*from ievents.c*/
/*
* Global variables
*/
-static char * progver = "3.00";
+static char * progver = "3.01";
static char * progname = "ilan";
static char fdebug = 0;
static char fipmilan = 0;
@@ -4745,12 +4745,12 @@ main(int argc, char **argv)
if (ret != 0) { nerrs++; lasterr = ret; }
else ngood++;
}
- if (lan_user != 0) {
+ if (lan_user != 0) {
j = DisableUser(lan_user); /*disable this lan user*/
printf("DisableUser(%d), ret = %d\n",lan_user,j);
if (j != 0) { nerrs++; lasterr = j; }
- else ngood++;
- }
+ else ngood++;
+ }
LanRecord.data[0] = 0x01; /* static IP address source */
ret = SetLanEntry(4, &LanRecord, 1);
printf("SetLanEntry(4), ret = %d\n",ret);
diff --git a/util/imbapi.c b/util/imbapi.c
index dd62e8b..3859e0d 100644
--- a/util/imbapi.c
+++ b/util/imbapi.c
@@ -441,7 +441,7 @@ SendTimedIpmbpRequest (
sizeof( responseData ),
& respLength,
NULL);
- if (fdebug) printf("sendIpmb: send_message status=%d rlen=%d cc=%x\n",
+ if (fdebug) printf("sendIpmb: send_message status=%d rlen=%lu cc=%x\n",
status,respLength,resp->cCode);
if ( status != TRUE ) {
DWORD error;
@@ -478,7 +478,7 @@ SendTimedIpmbpRequest (
sizeof( responseData ),
& respLength,
NULL);
- if (fdebug) printf("sendIpmb: get_message status=%d rlen=%d cc=%x\n",
+ if (fdebug) printf("sendIpmb: get_message status=%d rlen=%lu cc=%x\n",
status,respLength,resp->cCode);
if ( status != TRUE ) {
DWORD error;
@@ -1322,7 +1322,7 @@ SendTimedEmpMessageResponse_Ex (
#endif
if (fdebug) {
- printf("SendTimedEmp(%x,%x): status=%d cc=%x rlen=%d i=%d\n",
+ printf("SendTimedEmp(%x,%x): status=%d cc=%x rlen=%lu i=%d\n",
sessionHandle, channelNumber,
status,responseData[0],respLength,i);
_dump_buf("requestData",requestData,sizeof(requestData),0);
@@ -1428,7 +1428,7 @@ SendTimedLanMessageResponse(
);
if (fdebug) {
- printf("SendTimedLan(): status=%d cc=%x rlen=%d i=%d\n",
+ printf("SendTimedLan(): status=%d cc=%x rlen=%lu i=%d\n",
status, responseData[0],respLength,i);
_dump_buf("requestData",requestData,sizeof(requestData),0);
}
@@ -1579,7 +1579,7 @@ SendTimedLanMessageResponse_Ex(
DEBUG("%s: DeviceIoControl status = %d\n",__FUNCTION__, status);
#endif
if (fdebug) {
- printf("SendTimedLan(%x,%x): status=%d cc=%x rlen=%d i=%d\n",
+ printf("SendTimedLan(%x,%x): status=%d cc=%x rlen=%lu i=%d\n",
sessionHandle, channelNumber,
status,responseData[0],respLength,i);
if (responseData[0] != 0) /*0xcc == invalid request data*/
@@ -2020,7 +2020,7 @@ IsAsyncMessageAvailable (HandleType eventId )
if ( AsyncEventHandle != eventId) {
#ifdef LINUX
- printf("Invalid AsyncHandle %x!=%x\n",AsyncEventHandle,eventId);
+ printf("Invalid AsyncHandle %lx!=%lx\n",AsyncEventHandle,eventId);
#endif
return ACCESN_ERROR;
}
@@ -2239,7 +2239,7 @@ RegisterForImbAsyncMessageNotification (HandleType *handleId)
if( (respLength != sizeof(int)) || (status != TRUE )) {
if (fdebug) {
- printf("RegisterForImbAsync error status=%d, len=%d sizeint=%d\n", status, respLength, sizeof(int));
+ printf("RegisterForImbAsync error status=%d, len=%lu sizeint=%lu\n", status, respLength, sizeof(int));
if( respLength != sizeof(int)) printf("Async len err\n");
if( status != TRUE) printf("Async status err\n");
}
diff --git a/util/ipicmg.c b/util/ipicmg.c
index a85bde9..735ad87 100644
--- a/util/ipicmg.c
+++ b/util/ipicmg.c
@@ -81,7 +81,7 @@
/* Global data */
static char * progname = "ipicmg";
-static char * progver = "3.00";
+static char * progver = "3.01";
static char fdebug = 0;
static char fset_mc = 0;
static uint8_t g_bus = PUBLIC_BUS;
diff --git a/util/ipmicmd.c b/util/ipmicmd.c
index ffb59e2..45d6e8c 100644
--- a/util/ipmicmd.c
+++ b/util/ipmicmd.c
@@ -1050,7 +1050,6 @@ int ipmi_getpicmg(uchar *presp, int sresp, char fdebug)
int ipmi_getdeviceid(uchar *presp, int sresp, char fdebug)
{
int rc, i; uchar cc;
- char mbstr[80] = "unknown";
/* check that sresp is big enough (default is 15 bytes for Langley)*/
if (sresp < 15) return(ERR_BAD_LENGTH);
diff --git a/util/ipmicmd.h b/util/ipmicmd.h
index 02a0052..9e13d4e 100644
--- a/util/ipmicmd.h
+++ b/util/ipmicmd.h
@@ -312,6 +312,8 @@ struct oemvalstr {
#define VENDOR_XYRATEX 1993
#define VENDOR_NEWISYS 9237
#define VENDOR_CISCO 5771 /*=0x168B*/
+#define VENDOR_LENOVO 0x004A66
+#define VENDOR_LENOVO2 0x004F4D
#define PRODUCT_QUANTA_S99Q 21401
#define PRODUCT_QUANTA_QSSC_S4R 64 /*0x0040*/
diff --git a/util/ipmidir.c b/util/ipmidir.c
index 2aeb6f3..12b379c 100644
--- a/util/ipmidir.c
+++ b/util/ipmidir.c
@@ -415,13 +415,13 @@ int ipmi_open_direct(int fdebugcmd)
g_DriverType = DRV_SMB;
mBMC_baseAddr = mybase;
} else { /*0x01==KCS*/
- g_DriverType = DRV_KCS;
+ g_DriverType = DRV_KCS;
+ BMC_base = mybase;
if (sa == 0x20 && mybase != 0) { /*valid*/
kcsBaseAddress = mybase;
kcs_inc = inc;
}
}
- BMC_base = mybase;
DBGP("smbios: Driver=%d(%s), sa=%02x, Base=0x%04x, Spacing=%d\n",
g_DriverType,BmcDesc(g_DriverType),sa,mybase,inc);
} else {
@@ -1207,7 +1207,7 @@ int ImbInit_dir(void)
uchar iftype, iver, sa, inc;
int mybase, status;
char *ifstr;
- status = get_IpmiStruct(&iftype,&iver,&sa,&mybase,&inc);
+ status = get_IpmiStruct(&iftype,&iver,&sa,&mybase,&inc);
if (status == 0) {
if (iftype == 0x04) {
g_DriverType = DRV_SMB;
@@ -1215,13 +1215,13 @@ int ImbInit_dir(void)
mBMC_baseAddr = mybase;
} else /*0x01==KCS*/ {
g_DriverType = DRV_KCS;
+ BMC_base = mybase;
ifstr = "KCS";
if (sa == BMC_SA && mybase != 0) { /*valid*/
kcsBaseAddress = mybase;
kcs_inc = inc;
}
}
- BMC_base = mybase;
DBGP("SMBIOS IPMI Record found: type=%s sa=%02x base=0x%04x spacing=%d\n",
ifstr, sa, mybase, inc);
}
@@ -1230,9 +1230,14 @@ int ImbInit_dir(void)
/* Use KCS here. There are no known SMBus implementations on 64-bit */
if (BMC_base == 0) {
DBGP("No IPMI Data Structure Found in SMBIOS Table,\n");
+#ifdef TRY_KCS
g_DriverType = DRV_KCS;
- BMC_base = kcsBaseAddress;
+ BMC_base = kcsBaseAddress;
DBGP("Continuing with KCS on Default Port 0x%04x\n",kcsBaseAddress);
+#else
+ printf("No IPMI interface detected...Exiting\n");
+ return ERR_NO_DRV;
+#endif
}
#if defined(BSD) || defined(MACOS) || defined(HPUX)
iofd = open("/dev/io",O_RDWR);
@@ -1242,14 +1247,14 @@ int ImbInit_dir(void)
}
#endif
if (g_DriverType == DRV_SMB) {
- /* Perhaps add controller type in ipmi_if.txt (?)*/
- /* Intel SSIF: 0x0540=SJR, 0x0400=STP */
- if (mBMC_baseAddr == 0x540 || mBMC_baseAddr == 0x400)
- SMBChar.Controller = INTEL_SMBC;
- else /*else try ServerWorks*/
- SMBChar.Controller = SW_SMBC;
- SMBChar.baseAddr = mBMC_baseAddr;
- DBGP("BMC SSIF/SMBus Interface at i2c=%02x base=0x%04x\n",
+ /* Perhaps add controller type in ipmi_if.txt (?)*/
+ /* Intel SSIF: 0x0540=SJR, 0x0400=STP */
+ if (mBMC_baseAddr == 0x540 || mBMC_baseAddr == 0x400)
+ SMBChar.Controller = INTEL_SMBC;
+ else /*else try ServerWorks*/
+ SMBChar.Controller = SW_SMBC;
+ SMBChar.baseAddr = mBMC_baseAddr;
+ DBGP("BMC SSIF/SMBus Interface at i2c=%02x base=0x%04x\n",
mBMCADDR,mBMC_baseAddr);
}
if (g_DriverType == DRV_KCS) {
diff --git a/util/ipmilan.c b/util/ipmilan.c
index acea438..fb5a477 100644
--- a/util/ipmilan.c
+++ b/util/ipmilan.c
@@ -680,8 +680,6 @@ sig_abort(int sig)
{
static int sig_aborting = 0;
int rv;
- // uchar buf_rs[4];
- // uchar *cmd_rs;
if (sig_aborting == 0) {
sig_aborting = 1;
@@ -1057,7 +1055,7 @@ static int _send_lan_cmd(SockType s, uchar *pcmd, int scmd, uchar *presp,
}
clen = hlen + msglen;
if (clen > sizeof(cbuf)) {
- fprintf(fpdbg,"message size %d > buffer size %d\n",clen,sizeof(cbuf));
+ fprintf(fpdbg,"message size %d > buffer size %lu\n",clen,sizeof(cbuf));
return(LAN_ERR_TOO_SHORT);
}
@@ -2242,7 +2240,6 @@ int lan_recv_sol( SOL_RSP_PKT *rsp )
uchar rdata[MAX_BUFFER_SIZE];
int rlen, hlen;
IPMI_HDR *phdr;
- int fdoauth = 1;
uchar *pdata;
int itry;
int flags;
@@ -2250,7 +2247,6 @@ int lan_recv_sol( SOL_RSP_PKT *rsp )
phdr = &ipmi_hdr;
rsp->data = rsdata;
- fdoauth = 0;
hlen = SOL_HLEN;
rlen = 0;
if (fdebuglan)
diff --git a/util/ipmimv.c b/util/ipmimv.c
index 8962ef5..4cf995d 100644
--- a/util/ipmimv.c
+++ b/util/ipmimv.c
@@ -241,16 +241,16 @@ static void dbgmsg(char *pattn, ...)
fflush( fpdbg );
}
-int set_cloexec(fd,fdebugcmd)
+int set_cloexec(int fd, int fdebugcmd)
{
int flags;
- flags = fcntl(ipmi_fd, F_GETFD);
+ flags = fcntl(fd, F_GETFD);
if (flags == -1) {
if (fdebugcmd) printf("fcntl(get) errno = %d\n",errno);
return -1;
}
flags |= FD_CLOEXEC;
- if (fcntl(ipmi_fd, F_SETFD, flags) == -1)
+ if (fcntl(fd, F_SETFD, flags) == -1)
{
if (fdebugcmd) printf("fcntl(set) errno = %d\n",errno);
return -1;
diff --git a/util/ipmiutil.c b/util/ipmiutil.c
index 167236d..43acf40 100644
--- a/util/ipmiutil.c
+++ b/util/ipmiutil.c
@@ -57,7 +57,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "ipmiutil.h"
static char *progname = "ipmiutil";
-static char *progver = "3.00";
+static char *progver = "3.01";
// static char fdebug = 0;
/*int ipmiutil(int argc, char **argv); */
@@ -83,7 +83,7 @@ static struct {
{ 11, "getevent", i_getevt, "get IPMI events and display them, event daemon" },
{ 12, "health", i_health, "check and show the basic health of the IPMI BMC"},
{ 13, "hpm", i_hpm, "HPM firmware update manager extensions" },
- { 14, "lan", i_lan, "show/set IPMI LAN parameters and PEF table"},
+ { 14, "lan", i_lan, "show/set IPMI LAN parameters, users, PEF rules"},
{ 15, "picmg", i_picmg, "show/set picmg extended functions" },
{ 25, "power", i_reset, "issue IPMI reset or power control to the system"},
{ 16, "reset", i_reset, "issue IPMI reset or power control to the system"},
diff --git a/util/ipmiutil.mak b/util/ipmiutil.mak
index 9d63953..021851a 100644
--- a/util/ipmiutil.mak
+++ b/util/ipmiutil.mak
@@ -83,10 +83,10 @@ E_OBJ=$(TMP_D)\ipmiutil.obj \
$(TMP_D)\iconfig.obj $(TMP_D)\igetevent.obj $(TMP_D)\isensor.obj \
$(TMP_D)\isel.obj $(TMP_D)\ievents.obj \
$(TMP_D)\ipicmg.obj $(TMP_D)\ifirewall.obj \
- $(TMP_D)\iekanalyzer.obj $(TMP_D)\ifru_picmg.obj \
- $(TMP_D)\oem_kontron.obj $(TMP_D)\ihpm.obj $(TMP_D)\ifwum.obj \
- $(TMP_D)\oem_fujitsu.obj $(TMP_D)\oem_intel.obj \
- $(TMP_D)\oem_sun.obj $(TMP_D)\oem_dell.obj $(TMP_D)\oem_hp.obj \
+ $(TMP_D)\iekanalyzer.obj $(TMP_D)\ifru_picmg.obj \
+ $(TMP_D)\oem_kontron.obj $(TMP_D)\ihpm.obj $(TMP_D)\ifwum.obj \
+ $(TMP_D)\oem_fujitsu.obj $(TMP_D)\oem_intel.obj $(TMP_D)\oem_lenovo.obj \
+ $(TMP_D)\oem_sun.obj $(TMP_D)\oem_dell.obj $(TMP_D)\oem_hp.obj \
$(TMP_D)\oem_supermicro.obj $(TMP_D)\itsol.obj $(TMP_D)\idcmi.obj \
$(TMP_D)\oem_quanta.obj $(TMP_D)\oem_newisys.obj $(CMD_OBJ) mem_if.obj
@@ -330,6 +330,9 @@ $(TMP_D)\oem_hp.obj: oem_hp.c
$(TMP_D)\oem_supermicro.obj: oem_supermicro.c
$(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\oem_supermicro.obj oem_supermicro.c
+$(TMP_D)\oem_lenovo.obj: oem_lenovo.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\oem_lenovo.obj oem_lenovo.c
+
$(TMP_D)\oem_quanta.obj: oem_quanta.c
$(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\oem_quanta.obj oem_quanta.c
diff --git a/util/ipmiutil64.mak b/util/ipmiutil64.mak
index 45e1bec..27f0a50 100644
--- a/util/ipmiutil64.mak
+++ b/util/ipmiutil64.mak
@@ -83,10 +83,10 @@ E_OBJ=$(TMP_D)\ipmiutil.obj \
$(TMP_D)\iconfig.obj $(TMP_D)\igetevent.obj $(TMP_D)\isensor.obj \
$(TMP_D)\isel.obj $(TMP_D)\ievents.obj \
$(TMP_D)\ipicmg.obj $(TMP_D)\ifirewall.obj \
- $(TMP_D)\iekanalyzer.obj $(TMP_D)\ifru_picmg.obj \
- $(TMP_D)\oem_kontron.obj $(TMP_D)\ihpm.obj $(TMP_D)\ifwum.obj \
- $(TMP_D)\oem_fujitsu.obj $(TMP_D)\oem_intel.obj \
- $(TMP_D)\oem_sun.obj $(TMP_D)\oem_dell.obj $(TMP_D)\oem_hp.obj \
+ $(TMP_D)\iekanalyzer.obj $(TMP_D)\ifru_picmg.obj \
+ $(TMP_D)\oem_kontron.obj $(TMP_D)\ihpm.obj $(TMP_D)\ifwum.obj \
+ $(TMP_D)\oem_fujitsu.obj $(TMP_D)\oem_intel.obj $(TMP_D)\oem_lenovo.obj \
+ $(TMP_D)\oem_sun.obj $(TMP_D)\oem_dell.obj $(TMP_D)\oem_hp.obj \
$(TMP_D)\oem_supermicro.obj $(TMP_D)\itsol.obj $(TMP_D)\idcmi.obj \
$(TMP_D)\oem_quanta.obj $(TMP_D)\oem_newisys.obj $(CMD_OBJ) mem_if.obj
@@ -330,6 +330,9 @@ $(TMP_D)\oem_hp.obj: oem_hp.c
$(TMP_D)\oem_supermicro.obj: oem_supermicro.c
$(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\oem_supermicro.obj oem_supermicro.c
+$(TMP_D)\oem_lenovo.obj: oem_lenovo.c
+ $(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\oem_lenovo.obj oem_lenovo.c
+
$(TMP_D)\oem_quanta.obj: oem_quanta.c
$(CC) /c $(CFLAGS_M) /Fo$(TMP_D)\oem_quanta.obj oem_quanta.c
diff --git a/util/ireset.c b/util/ireset.c
index 679ce97..d0d30de 100644
--- a/util/ireset.c
+++ b/util/ireset.c
@@ -108,7 +108,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/*
* Global variables
*/
-static char * progver = "3.00";
+static char * progver = "3.01";
static char * progname = "ireset";
static uchar ipmi_maj;
static uchar ipmi_min;
diff --git a/util/isel.c b/util/isel.c
index a2b5703..909e28c 100644
--- a/util/isel.c
+++ b/util/isel.c
@@ -162,7 +162,7 @@ typedef struct
#define RDATA_OFFSET 13 //byte offset to the record event data
static char *progname = "isel";
-static char *progver = "3.00";
+static char *progver = "3.01";
#ifdef WIN32
#define IDXFILE "sel.idx"
static char idxfile[80] = IDXFILE;
diff --git a/util/iseltime.c b/util/iseltime.c
index 1b2cc95..a61fd34 100644
--- a/util/iseltime.c
+++ b/util/iseltime.c
@@ -75,7 +75,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/*
* Global variables
*/
-static char * progver = "3.00";
+static char * progver = "3.01";
static char * progname = "iseltime";
static char fdebug = 0;
static char fset = 0;
diff --git a/util/isensor.c b/util/isensor.c
index a59e18b..9456613 100644
--- a/util/isensor.c
+++ b/util/isensor.c
@@ -164,10 +164,12 @@ extern int decode_sensor_supermicro(uchar *sdr,uchar *reading,char *pstring,
int slen); /*see oem_supermicro.c*/
extern int decode_sensor_quanta(uchar *sdr,uchar *reading,char *pstring,
int slen); /*see oem_quanta.c*/
-extern int decode_sensor_hp(uchar *sdr,uchar *reading,char *pstring,
- int slen); /*see oem_hp.c*/
extern int decode_sensor_dell(uchar *sdr,uchar *reading,char *pstring,
int slen); /*see oem_dell.c*/
+extern int decode_sensor_lenovo(uchar *sdr,uchar *reading,char *pstring,
+ int slen); /*see oem_lenovo.c*/
+extern int decode_sensor_hp(uchar *sdr,uchar *reading,char *pstring,
+ int slen); /*see oem_hp.c*/
extern void show_oemsdr_hp(uchar *sdr);
#else
int is_romley(int vend, int prod) {
@@ -252,7 +254,7 @@ char *decode_entity_id(int id) {
* Global Data
************************/
static char *progname = "isensor";
-static char *progver = "3.00";
+static char *progver = "3.01";
#ifdef WIN32
static char savefile[] = "%ipmiutildir%\\thresholds.cmd";
#else
@@ -314,7 +316,7 @@ static int prod_id;
* This is used to decode the sensor reading types and meanings.
* Use IPMI Table 36-1 and 36-2 for this.
*/
-#define N_DSTATUS 82
+#define N_DSTATUS 101
#define STR_CUSTOM 58
#define STR_OEM 71
#define STR_AC_LOST 76
@@ -351,10 +353,10 @@ static char *sensor_dstatus[N_DSTATUS] = {
/*19 Avl */ "RedunLost",
/*20 Avl */ "RedunDegr",
/* ACPI Device Power States */
-/*21 ACPI*/ "Off ",
-/*22 ACPI*/ "Working",
+/*21 ACPI*/ "Off ", /*D3*/
+/*22 ACPI*/ "Working", /*D1*/
/*23 ACPI*/ "Sleeping", /*D2/S2*/
-/*24 ACPI*/ "On",
+/*24 ACPI*/ "On", /*D0*/
/* Critical Interrupt event states */
/*25 CrI */ "FP_NMI ",
/*26 CrI */ "Bus_TimOut",
@@ -424,7 +426,26 @@ static char *sensor_dstatus[N_DSTATUS] = {
/*78 PS */ "Config_Err",
/*79 HSC */ "Offline",
/*80 HSC */ "Rebuilding",
-/*81 other*/ " _ "
+/*81 other*/ " _ ",
+/*82 Avl */ "NonRedund_Sufficient",
+/*83 Avl */ "NonRedund_Insufficient",
+/*84 Usage */ "Idle",
+/*85 Usage */ "Active",
+/*86 Usage */ "Busy",
+/*87 Trans */ "Non-Critical",
+/*88 Trans */ "Critical",
+/*89 Trans */ "Non-Recoverable",
+/*90 Trans */ "Monitor",
+/*91 Trans */ "Informational",
+/*92 State */ "Running",
+/*93 State */ "In_Test",
+/*94 State */ "Power_Off",
+/*95 State */ "Online",
+/*96 State */ "Offline",
+/*97 State */ "Off_Duty",
+/*98 State */ "Degraded",
+/*99 State */ "PowerSave",
+/*100 State */ "InstallError"
};
static char *raid_states[9] = { /*for sensor type 0x0d drive status */
@@ -1941,6 +1962,10 @@ int decode_oem_sensor(uchar *sdr,uchar *reading,char *pstring,int slen)
case VENDOR_DELL:
rv = decode_sensor_dell(sdr, reading, pstring, slen);
break;
+ case VENDOR_LENOVO:
+ case VENDOR_LENOVO2:
+ rv = decode_sensor_lenovo(sdr, reading, pstring, slen);
+ break;
default:
break;
} /*end-switch vend_id*/
@@ -2109,6 +2134,97 @@ ShowThresh(int flg, uchar bits, uchar *vals, uchar *sdr)
} /*endif full sdr*/
}
+int decode_comp_generic(uchar type, uchar evtype, uchar num, ushort reading)
+{
+ int istr = 0;
+ uchar b;
+ /* decode via evtype */
+ switch(evtype)
+ {
+ case 0x02:
+ if (reading & 0x01) istr = 85; /* Active */
+ if (reading & 0x02) istr = 86; /* Busy */
+ else istr = 84; /* Idle (OK)) */
+ case 0x03:
+ if (reading & 0x01) istr = 13; /* Asserted */
+ else istr = 0; /* "OK" Deasserted */
+ break;
+ case 0x04:
+ if (reading & 0x01) istr = 15; /* Predictive Failure */
+ else istr = 0; /* "OK" Deasserted */
+ break;
+ case 0x05:
+ if (reading & 0x01) istr = 65; /* Limit Exceeded*/
+ else istr = 0; /* "OK" LimitNotExceeded*/
+ break;
+ case 0x07: /* transition */
+ b = bitnum(reading);
+ switch(b) {
+ case 0: istr = 0; break; /*no bits set, OK*/
+ case 1: istr = 87; break; /*transition up to Non-Critical*/
+ case 2: istr = 88; break; /*transition up to Critical */
+ case 3: istr = 89; break; /*transition up to Non-recoverable */
+ case 4: istr = 87; break; /*transition down to Non-Critical */
+ case 5: istr = 88; break; /*transition down to Critical */
+ case 6: istr = 89; break; /*transition to Non-recoverable */
+ case 7: istr = 90; break; /*Monitor*/
+ case 8: istr = 91; break; /*Informational*/
+ default: istr = 8; break; /*'OK*'*/
+ }
+ break;
+ case 0x08:
+ if (reading & 0x01) istr = 9; /* Present */
+ else istr = 10; /*Absent*/
+ break;
+ case 0x09: /* Availability event states */
+ if (reading & 0x01) istr = 17; /* Enabled */
+ else istr = 16; /*Disabled*/
+ break;
+ case 0x0A: /* */
+ b = (reading & 0x7f);
+ switch(b) {
+ case 0x00: istr = 8; break; /* 00 'OK*'*/
+ case 0x01: istr = 92; break; /* transition to Running */
+ case 0x02: istr = 93; break; /* transition to In Test */
+ case 0x04: istr = 94; break; /* transition to Power Off */
+ case 0x08: istr = 95; break; /* transition to On Line */
+ case 0x10: istr = 96; break; /* transition to Off Line */
+ case 0x20: istr = 97; break; /* transition to Off Duty */
+ case 0x40: istr = 98; break; /* transition to Degraded */
+ case 0x80: istr = 99; break; /* transition to Power Save */
+ default: istr = 100; break; /* Install Error */
+ }
+ break;
+ case 0x0B: /* Redundancy */
+ b = (reading & 0x7f);
+ switch(b) {
+ case 0x00: istr = 8; break; /* 00 'OK*'*/
+ case 0x01: istr = 18; break; /* 01 Fully Redundant */
+ case 0x02: istr = 19; break; /* 02 Redundancy Lost */
+ case 0x04: istr = 20; break; /* 04 Redundancy Degraded */
+ case 0x08: istr = 82; break; /* 08 Non-Redundant/Sufficient down */
+ case 0x10: istr = 82; break; /* 10 Non-Redundant/Sufficient up*/
+ case 0x20: istr = 83; break; /* 20 Non-Redundant/Insufficient */
+ case 0x40: istr = 20; break; /* 40 Redundancy Degraded down */
+ default: istr = 20; break; /* Redundancy Degraded up */
+ }
+ break;
+ case 0x0C: /* ACPI Power States */
+ if (reading & 0x04) istr = 21; /* D3, Off */
+ else if (reading & 0x02) istr = 23; /* D2, Sleeping */
+ else if (reading & 0x01) istr = 22; /* D1, Working */
+ else istr = 24; /*D0, On*/
+ break;
+ default:
+ if (fdebug)
+ printf("sensor[%x] et %02x type %02x not decoded, reading = %04x\n",
+ num,evtype,type,reading);
+ istr = STR_OTHER; /* other " - " */
+ break;
+ }
+ return(istr);
+}
+
/*
* decode_comp_reading
*
@@ -2147,10 +2263,10 @@ decode_comp_reading(uchar type, uchar evtype, uchar num,
} else if (evtype == 0x05) {
/* see CPU1 VRD Temp on S5000, snum 0xc0 thru 0xcf */
if (reading & 0x01) istr = 65; /* Limit Exceeded*/
- else istr = 0; /* "OK" LimitNotExceeded*/
+ else istr = 0; /* "OK" LimitNotExceeded*/
} else if (evtype == 0x03) {
if (reading & 0x01) istr = 13; /* Asserted */
- else istr = 0; /* "OK" Deasserted */
+ else istr = 0; /* "OK" Deasserted */
} else { /* evtype == other 0x05 */
if (reading & 0x01) istr = 0; /* 8="OK*", 0="OK" */
else istr = 5; /*state asserted, Crit-hi */
@@ -2351,8 +2467,8 @@ decode_comp_reading(uchar type, uchar evtype, uchar num,
case 7:
case 8:
case 11:
- case 13: istr = 21; break; /*Off*/
case 12: istr = 24; break; /*On*/
+ case 13: istr = 21; break; /*Off*/
default: istr = 41; /*unknown*/
}
break;
@@ -2378,8 +2494,12 @@ decode_comp_reading(uchar type, uchar evtype, uchar num,
else istr = 42; /* NotAvailable */
break;
case 0x28: /* BMC FW Health */
- if (reading == 0) istr = 0; /*OK*/
- else istr = 12; /*Faulty*/
+ if (evtype == 0x6F) { /*Sensor-specific*/
+ if (reading == 0) istr = 0; /*OK*/
+ else istr = 12; /*Faulty*/
+ } else { /*use event/reading type*/
+ istr = decode_comp_generic(type, evtype, num, reading);
+ }
break;
case 0x29: /* Battery */
switch(reading & 0x7f) {
@@ -2395,8 +2515,8 @@ decode_comp_reading(uchar type, uchar evtype, uchar num,
else istr = 46; /*Deactivated*/
break;
case 0x2B: /* Version Change */
- b = bitnum(reading1);
- switch(b) {
+ b = bitnum(reading1);
+ switch(b) {
case 0: istr = 0; break; /*OK, no bits set*/
case 1: istr = 72; break; /*HW Changed, bit 0 set*/
case 2: istr = 73; break; /*SW Changed, bit 1 set*/
@@ -2404,9 +2524,7 @@ decode_comp_reading(uchar type, uchar evtype, uchar num,
default: istr = 75; break; /*Change error*/
}
break;
- case 0x60: /* SCSI 1 Term Flt */
- case 0x61: /* SCSI 2 Term Flt */
- break;
+
/* sensor types 0xC0 - 0xFF are OEM RESERVED */
case 0xF1: /* ATCA IPMB-0 Sensor */
if ((reading & 0x7fff) == 0x0008) istr = 0; /*OK*/
@@ -2418,13 +2536,14 @@ decode_comp_reading(uchar type, uchar evtype, uchar num,
case 0xF2: /* ATCA Module HotSwap, TODO: refine this */
case 0xF3: /* SMI Timeout, etc. */
if (reading & 0x01) istr = 13; /* Asserted */
- else istr = 0; /* "OK", Deasserted */
+ else istr = 0; /* "OK", Deasserted */
break;
+
+ case 0x60: /* SCSI 1 Term Flt */
+ case 0x61: /* SCSI 2 Term Flt */
default:
- if (fdebug)
- printf("sensor[%x] type %02x not decoded, reading = %04x\n",
- num,type,reading);
- istr = STR_OTHER; /* other " - " */
+ istr = decode_comp_generic(type, evtype, num, reading);
+ break;
}
return(istr);
} /* end decode_comp_reading */
@@ -2553,7 +2672,7 @@ ShowSDR(char *tag, uchar *sdr)
sens[0], sensor_dstatus[i],val,typestr);
}
sep[0] = 0; /*null string*/
- printf("%s", tag);
+ printf("%s", tag);
if (fsimple) {
sprintf(sep,"%c ",bdelim);
printf("%04x %c Full %c %s %c %02x %c %s %c %s%c",
@@ -3350,7 +3469,7 @@ int i_sensor(int argc, char **argv)
fmBMC = 0;
if (is_romley(vend_id,prod_id)) fRomley = 1;
if (is_grantley(vend_id,prod_id)) fGrantley = 1;
- if (prod_id == 0x003E || fRomley) /*Urbanna NSN2U,CG2100*/
+ if (prod_id == 0x003E || fRomley || fGrantley) /*Urbanna,CG2100*/
set_max_kcs_loops(URNLOOPS); /*longer KCS timeout*/
} else if ((vend_id == VENDOR_SUPERMICRO)
|| (vend_id == VENDOR_SUPERMICROX)) {
diff --git a/util/iserial.c b/util/iserial.c
index 579d19d..e0cc7e9 100644
--- a/util/iserial.c
+++ b/util/iserial.c
@@ -155,7 +155,7 @@ typedef struct
/*
* Global variables
*/
-static char * progver = "3.00";
+static char * progver = "3.01";
static char * progname = "iserial";
static int vend_id = 0;
static int prod_id = 0;
@@ -965,10 +965,11 @@ main(int argc, char **argv)
if ((ipmi_maj == 0) || (ipmi_maj == 1 && ipmi_min < 5)) {
/* IPMI 0.9 and 1.0 dont support this. */
printf("This system does not support EMP Terminal Mode.\n");
- if (!fdoanyway)
+ if (!fdoanyway) {
ret = LAN_ERR_NOTSUPPORT;
goto do_exit;
}
+ }
if (ipmi_maj >= 2) fIPMI20 = 1;
/* Determine if Basic or Terminal Mode is supported by product id */
if (vend_id == VENDOR_INTEL) { /*Intel*/
diff --git a/util/isol.c b/util/isol.c
index 1fddc98..0dd7f22 100644
--- a/util/isol.c
+++ b/util/isol.c
@@ -165,7 +165,7 @@ void dbglog( char *pattn, ... ); /*local prototype*/
/*
* Global variables
*/
-static char * progver = "3.00";
+static char * progver = "3.01";
static char * progname = "isol";
static char fdebug = 0;
static char fpicmg = 0;
diff --git a/util/itsol.c b/util/itsol.c
index 20a0b8d..67ff688 100644
--- a/util/itsol.c
+++ b/util/itsol.c
@@ -98,7 +98,7 @@ int gettimeofday(struct timeval *tv, struct timezone *tz);
extern int verbose;
extern char fdebug; /*from ipmicmd.c*/
static char * progname = "itsol";
-static char * progver = "3.00";
+static char * progver = "3.01";
static uchar g_bus = PUBLIC_BUS;
static uchar g_sa = BMC_SA;
static uchar g_lun = BMC_LUN;
diff --git a/util/iwdt.c b/util/iwdt.c
index 324bcf6..121270a 100644
--- a/util/iwdt.c
+++ b/util/iwdt.c
@@ -100,7 +100,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/*
* Global variables
*/
-static char * progver = "3.00";
+static char * progver = "3.01";
static char * progname = "iwdt";
static char fdebug = 0;
static char fdontlog = 0;
diff --git a/util/oem_dell.c b/util/oem_dell.c
index bd11446..0389355 100644
--- a/util/oem_dell.c
+++ b/util/oem_dell.c
@@ -132,7 +132,7 @@ char NIC_Selection_Mode_String_12g[] [50] = {
"shared with failover all loms"
};
-static char * progver = "3.00";
+static char * progver = "3.01";
static char * progname = "idelloem";
static int verbose = 0;
static char fdebug = 0;
@@ -1319,16 +1319,12 @@ ipmi_lcd_get_single_line_text (void * intf, char* lcdstring, uint8_t max_length)
static int
ipmi_lcd_get_info_wh(void * intf)
-
{
uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv;
struct ipmi_rq req;
uint8_t data[4];
- uint8_t command = 0;
IPMI_DELL_LCD_CAPS* lcd_caps;
char lcdstring[IPMI_DELL_LCD_STRING_LENGTH_MAX+1] = {0};
- int rc;
-
printf("LCD info\n");
@@ -1382,7 +1378,7 @@ ipmi_lcd_get_info_wh(void * intf)
{
memset(lcdstring, 0, IPMI_DELL_LCD_STRING_LENGTH_MAX+1);
- rc = ipmi_lcd_get_single_line_text (intf, lcdstring, lcd_caps->max_chars[0]);
+ rv = ipmi_lcd_get_single_line_text (intf, lcdstring, lcd_caps->max_chars[0]);
printf(" Text: %s\n", lcdstring);
}
else
@@ -1454,7 +1450,6 @@ static int ipmi_lcd_get_info(void * intf)
IPMI_DELL_LCD_CAPS * lcd_caps;
uint8_t command = 0;
char lcdstring[IPMI_DELL_LCD_STRING_LENGTH_MAX+1] = {0};
- int rc;
printf("LCD info\n");
@@ -1504,7 +1499,7 @@ static int ipmi_lcd_get_info(void * intf)
if (lcd_caps->number_lines > 0)
{
memset (lcdstring,0,IPMI_DELL_LCD_STRING_LENGTH_MAX+1);
- rc = ipmi_lcd_get_single_line_text (intf, lcdstring, lcd_caps->max_chars[0]);
+ rv = ipmi_lcd_get_single_line_text (intf, lcdstring, lcd_caps->max_chars[0]);
printf(" Text: %s\n", lcdstring);
}
else
@@ -4141,7 +4136,7 @@ static int ipmi_get_peakpower_consmpt_history(void* intf,IPMI_POWER_CONSUMP_HIST
if (verbose > 1)
{
- printf("Peak power consmhistory Data : %x %x %x %x %x %x %x %x %x %x\n %x %x %x %x %x %x %x %x %x %x %x %x %x\n\n",
+ printf("Peak power consmhistory Data : %x %x %x %x %x %x %x %x %x %x\n %x %x %x %x %x %x %x %x %x %x %x %x %x %x\n\n",
rsp[0], rsp[1], rsp[2], rsp[3],
rsp[4], rsp[5], rsp[6], rsp[7],
rsp[8], rsp[9], rsp[10], rsp[11],
@@ -5461,7 +5456,7 @@ int decode_sensor_dell(uchar *sdr,uchar *reading,char *pstring, int slen)
#define BIT(x) (1 << x)
#define SIZE_OF_DESC 128
-char * get_dell_evt_desc(uchar *sel_rec)
+char * get_dell_evt_desc(uchar *sel_rec, int *psev)
{
struct sel_event_record * rec = (struct sel_event_record *)sel_rec;
int data1, data2, data3;
@@ -5505,6 +5500,7 @@ char * get_dell_evt_desc(uchar *sel_rec)
case 0x07:
if( ((data1 & DATA_BYTE2_SPECIFIED_MASK) == 0x80))
{
+ *psev = SEV_CRIT;
if((data1 & 0x0f) == 0x00)
snprintf(desc,SIZE_OF_DESC,"CPU Internal Err | ");
if((data1 & 0x0f) == 0x06)
@@ -5530,6 +5526,7 @@ char * get_dell_evt_desc(uchar *sel_rec)
if ( (rec->sel_type.standard_type.event_type == 0x0B) &&
!(data1 & 0x03) )
{
+ *psev = SEV_INFO;
if(data2 & 0x04)
strcpy(desc,"Memory is in Spare Mode");
else if(data2 & 0x02)
@@ -5538,12 +5535,13 @@ char * get_dell_evt_desc(uchar *sel_rec)
strcpy(desc,"Memory is in Mirror Mode ");
break;
}
- case 0x10:
+ case 0x10:
get_devid_ver(NULL,NULL,&iver);
// rv = ipmi_getdeviceid(devid,sizeof(devid),fdbg);
// if (rv != 0) return NULL;
version = iver;
/* Memory DIMMS */
+ *psev = SEV_MAJ; /*default severity for DIMM events*/
if( (data1 & 0x80) || (data1 & 0x20 ) )
{
if( (code == 0x0c) && (rec->sel_type.standard_type.event_type == 0x0B) )
@@ -5551,10 +5549,12 @@ char * get_dell_evt_desc(uchar *sel_rec)
if((data1 & 0x0f) == 0x00)
{
snprintf(desc,SIZE_OF_DESC," Redundancy Regained | ");
+ *psev = SEV_INFO;
}
else if((data1 & 0x0f) == 0x01)
{
snprintf(desc,SIZE_OF_DESC,"Redundancy Lost | ");
+ *psev = SEV_MAJ;
}
}
else if(code == 0x0c)
@@ -5610,29 +5610,37 @@ char * get_dell_evt_desc(uchar *sel_rec)
break;
}
snprintf(desc,SIZE_OF_DESC,"Correctable ECC | ");
+ *psev = SEV_MAJ;
}
else if((data1 & 0x0f) == 0x01)
{
snprintf(desc,SIZE_OF_DESC,"UnCorrectable ECC | ");
+ *psev = SEV_CRIT;
}
}
else if(code == 0x10)
{
- if((data1 & 0x0f) == 0x00)
- snprintf(desc,SIZE_OF_DESC,"Corr Memory Log Dissabled | ");
+ if((data1 & 0x0f) == 0x00) {
+ snprintf(desc,SIZE_OF_DESC,"Corr Memory Log Disabled | ");
+ *psev = SEV_INFO;
+ }
}
}
else
{
if(code == 0x12)
{
- if((data1 & 0x0f) == 0x02)
+ if((data1 & 0x0f) == 0x02) {
snprintf(desc,SIZE_OF_DESC,"Unknown System Hardware Failure ");
+ *psev = SEV_MAJ;
+ }
}
if(code == 0x10)
{
- if((data1 & 0x0f) == 0x03)
+ if((data1 & 0x0f) == 0x03) {
snprintf(desc,SIZE_OF_DESC,"All Even Logging Dissabled");
+ *psev = SEV_INFO;
+ }
}
}
if(data1 & 0x80 )
@@ -5731,6 +5739,7 @@ char * get_dell_evt_desc(uchar *sel_rec)
case 0x20:
if(((data1 & 0x0f)== 0x00)&&((data1 & 0x80) && (data1 & 0x20)))
{
+ *psev = SEV_MAJ;
if((data2 > 0x00)&&(data2<0xFF))
{
//Add the code to display 194 entries.This sensor present only in ORCA
@@ -5764,6 +5773,7 @@ char * get_dell_evt_desc(uchar *sel_rec)
{
if(data2 == 0x04)
{
+ *psev = SEV_CRIT;
snprintf(desc,SIZE_OF_DESC,"Hard Reset|Interrupt type None,SMS/OS Timer used at expiration");
}
}
@@ -5774,6 +5784,7 @@ char * get_dell_evt_desc(uchar *sel_rec)
{
if(data2 == 0x02)
{
+ *psev = SEV_MAJ;
if(data3 == 0x00)
{
snprintf(desc, SIZE_OF_DESC, "between BMC/iDRAC Firmware and other hardware");
@@ -5789,6 +5800,7 @@ char * get_dell_evt_desc(uchar *sel_rec)
case 0xC1:
if(rec->sel_type.standard_type.sensor_num == 0x25)
{
+ *psev = SEV_MAJ;
if((data1 & 0x0f) == 0x01)
{
snprintf(desc, SIZE_OF_DESC, "Failed to program Virtual Mac Address");
@@ -5819,6 +5831,7 @@ char * get_dell_evt_desc(uchar *sel_rec)
case 0xC3:
if(rec->sel_type.standard_type.sensor_num == 0x29)
{
+ *psev = SEV_MAJ;
if(((data1 & 0x0f)== 0x02)&&((data1 & 0x80) && (data1 & 0x20)))
{
#if 1 /*This sensor is not implemented in iDRAC code*/
@@ -5850,11 +5863,12 @@ char * get_dell_evt_desc(uchar *sel_rec)
}
strcat(desc,tmpdesc);
#endif
+ *psev = SEV_MAJ;
}
}
else
{
-
+ *psev = SEV_MAJ;
if((data1 & 0x0f) == 0x02)
{
sprintf(desc,"%s","IO channel Check NMI");
@@ -5889,11 +5903,13 @@ char * get_dell_evt_desc(uchar *sel_rec)
data2 & 0x7);
strcat(desc,tmpdesc);
}
+ *psev = SEV_CRIT;
}
break;
case 0x0F:
if(((data1 & 0x0f)== 0x0F)&&(data1 & 0x80))
{
+ *psev = SEV_CRIT;
switch(data2)
{
case 0x80:
@@ -5944,6 +5960,11 @@ char * get_dell_evt_desc(uchar *sel_rec)
default:
break;
}
+ if (desc[0] == 0) { /* if no description specified above */
+ /* snprintf(desc,SIZE_OF_DESC,"%02x [%02x %02x %02x]",
+ code,data1,date2,data3); // show raw data */
+ desc = NULL; /*if empty, handle with default logic*/
+ }
}
else
{
@@ -5986,8 +6007,6 @@ int decode_sel_dell(uint8_t *evt, char *outbuf, int outsz, char fdesc,
snum = evt[11];
gstr = "BMC ";
if (genid == 0x0033) gstr = "Bios";
- type_str = "";
- if (rectype == 0x02) type_str = get_sensor_type_desc(stype);
#ifdef OTHER
/* evt[13] is data1/offset*/
@@ -5995,18 +6014,20 @@ int decode_sel_dell(uint8_t *evt, char *outbuf, int outsz, char fdesc,
((evt[13] & DATA_BYTE3_SPECIFIED_MASK) == 0x20) ) {
// if (evt[13] & DATA_BYTE2_SPECIFIED_MASK)
// evt->data = rec->sel_type.standard_type.event_data[1];
- pstr = get_dell_evt_desc(evt);
+ pstr = get_dell_evt_desc(evt,&sevid);
} else if (evt[13] == 0xC1) {
if (snum == 0x23) {
// evt->data = rec->sel_type.standard_type.event_data[1];
- pstr = get_dell_evt_desc(evt);
+ pstr = get_dell_evt_desc(evt,&sevid);
}
}
#endif
- pstr = get_dell_evt_desc(evt);
+ pstr = get_dell_evt_desc(evt,&sevid);
if (pstr != NULL) rv = 0;
if (rv == 0) {
+ type_str = "";
+ if (rectype == 0x02) type_str = get_sensor_type_desc(stype);
format_event(id,timestamp, sevid, genid, type_str,
snum,NULL,pstr,NULL,outbuf,outsz);
}
diff --git a/util/oem_lenovo.c b/util/oem_lenovo.c
new file mode 100644
index 0000000..9c5079f
--- /dev/null
+++ b/util/oem_lenovo.c
@@ -0,0 +1,365 @@
+/*
+ * oem_lenovo.c
+ * Handle Lenovo OEM command functions
+ *
+ * Author: Andy Cress arcress at users.sourceforge.net
+ * Change history:
+ * 11/21/2016 ARCress - created
+ *
+ *---------------------------------------------------------------------
+ */
+/*M*
+Copyright (c) 2016 Andy Cress
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ a.. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ b.. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ c.. Neither the name of the copyright holder nor the names of contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *M*/
+#ifdef WIN32
+#include <windows.h>
+#include "getopt.h"
+#else
+#if defined(HPUX)
+/* getopt is defined in stdio.h */
+#elif defined(MACOS)
+/* getopt is defined in unistd.h */
+#include <unistd.h>
+#include <sys/time.h>
+#else
+#include <getopt.h>
+#endif
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include "ipmicmd.h"
+#include "ievents.h"
+#include "oem_lenovo.h"
+
+void set_loglevel(int level); /*prototype */
+
+static char * progver = "3.01";
+static char * progname = "ioemlenovo";
+static int verbose = 0;
+static char fdebug = 0;
+static uchar g_bus = PUBLIC_BUS;
+static uchar g_sa = BMC_SA;
+static uchar g_lun = BMC_LUN;
+static uchar g_addrtype = ADDR_SMI;
+static int vend_id = 0;
+static int prod_id = 0;
+
+extern uchar bitnum(ushort value); /*isensor.c*/
+
+/*
+ * decode_sensor_lenovo
+ * inputs:
+ * sdr = the SDR buffer
+ * reading = the 3 or 4 bytes of data from GetSensorReading
+ * pstring = points to the output string buffer
+ * slen = size of the output buffer
+ * outputs:
+ * rv = 0 if this sensor was successfully interpreted here,
+ * non-zero otherwise, to use default interpretations.
+ * pstring = contains the sensor reading interpretation string (if rv==0)
+ */
+int decode_sensor_lenovo(uchar *sdr,uchar *reading,char *pstring, int slen)
+{
+ int rv = -1;
+ uchar stype, etype, entity;
+ uchar bval;
+ ushort rval;
+ char *pstr = NULL;
+ int b;
+
+ if (sdr == NULL || reading == NULL) return(rv);
+ if (pstring == NULL || slen == 0) return(rv);
+ /* sdr[3] is 0x01 for Full, 0x02 for Compact */
+ bval = reading[2];
+ if (sdr[3] == 0x01) return(rv); /*skip if full sensor*/
+ entity = sdr[8];
+ stype = sdr[12];
+ etype = sdr[13];
+ rval = reading[2] | ((reading[3] & 0x7f) << 8);
+ b = bitnum(rval);
+ if (fdebug) printf("oem_lenovo: sensor type=%x evt=%x entity=%x rval=%04x\n",
+ stype,etype,entity,rval);
+ switch(stype) {
+ case 0x07: /* All CPUs */
+ if (etype == 0x6F) {
+ switch(b) {
+ case 0x00: pstr = "OK"; break;
+ case 0x02: pstr = "BIST_Fail"; break;
+ case 0x05: pstr = "Config_Error"; break;
+ case 0x06: pstr = "Uncorr_Error"; break;
+ case 0x08: pstr = "Disabled"; break;
+ default: pstr = "OK*"; break;
+ }
+ snprintf(pstring,slen,"%04x %s",bval,pstr);
+ rv = 0;
+ }
+ break;
+ case 0x0F: /* ABR Status, Firmware Error, Sys Boot Status, etc. */
+ if (etype == 0x6F) { /* should be entity 0x22 */
+ if (bval == 0x00) pstr = "OK";
+ else if (bval & 0x01) pstr = "FirmwareError"; /*bit 0*/
+ else if ((bval & 0x02) != 0) pstr = "FirmwareHang"; /*bit 1*/
+ else pstr = "OK*";
+ snprintf(pstring,slen,"%04x %s",bval,pstr);
+ rv = 0;
+ }
+ break;
+ case 0x1B: /* Front USB, nvDIMM Cable, etc. */
+ if (etype == 0x6F) {
+ /* 0x01 = connected/OK, 0x02 = cable connect error */
+ switch(bval) {
+ case 0x01: pstr = "OK"; break;
+ case 0x02: pstr = "CableError"; break;
+ default: pstr = "OK*"; break;
+ }
+ snprintf(pstring,slen,"%04x %s",rval,pstr);
+ rv = 0;
+ }
+ break;
+ case 0x1E: /* No Boot Device */
+ if (etype == 0x6F) {
+ switch(b) {
+ case 0x00: pstr = "OK"; break; /*No Media*/
+ default: pstr = "Asserted"; break;
+ }
+ snprintf(pstring,slen,"%04x %s",rval,pstr);
+ rv = 0;
+ }
+ case 0x21: /*All PCI Error, PCI 1, Internal RAID, No Op ROM, etc.*/
+ if (etype == 0x6F) {
+ if (bval == 0x00) pstr = "OK";
+ else pstr = "Fault";
+ snprintf(pstring,slen,"%04x %s",bval,pstr);
+ rv = 0;
+ }
+ break;
+ case 0x25: /* DASD Backplane*/
+ /*spec says 00 = Present, 01 = Absent, but not match results*/
+ /*
+0066 SDR Comp 02 6f 20 a 25 snum 20 DASD Backplane 1 = 0001 OK*
+0067 SDR Comp 02 6f 20 a 25 snum 21 DASD Backplane 2 = 0000 Absent
+0068 SDR Comp 02 6f 20 a 25 snum 22 DASD Backplane 3 = 0000 Absent
+0069 SDR Comp 02 6f 20 a 25 snum 23 DASD Backplane 4 = 0000 Absent
+006a SDR Comp 02 6f 20 a 25 snum 24 DASD Backplane 5 = 0000 Absent
+006b SDR Comp 02 6f 20 a 25 snum 25 DASD Backplane 6 = 0000 Absent
+ */
+ rv = -1;
+ break;
+ case 0x2B: /* ROM Recovery, Bkup Auto Update, IMM*/
+ if (etype == 0x6F) {
+ switch(bval) {
+ case 0x00: pstr = "OK"; break;
+ case 0x01: pstr = "Changed"; break; /*entity 0x22*/
+ case 0x05: pstr = "Invalid"; break; /*entity 0x21*/
+ case 0x07: pstr = "ChangedOK"; break; /*entity 21,22*/
+ default: pstr = "_"; break;
+ }
+ snprintf(pstring,slen,"%04x %s",rval,pstr);
+ rv = 0;
+ }
+ break;
+ case 0x02: /* SysBrd Vol Fault: et 07 8004=error */
+ if (etype == 0x07) {
+ if ((bval & 0x04) != 0) pstr = "Faulty";
+ else pstr = "OK";
+ snprintf(pstring,slen,"%04x %s",bval,pstr);
+ rv = 0;
+ }
+ break;
+ case 0x28: /* Low Security Jmp et 08 8002=error*/
+ if (etype == 0x08) {
+ if ((bval & 0x02) != 0) pstr = "Faulty";
+ else pstr = "OK";
+ snprintf(pstring,slen,"%04x %s",bval,pstr);
+ rv = 0;
+ }
+ break;
+ default: break;
+ }
+ // if (rv == 0) strncpy(pstring, pstr, slen);
+ return(rv);
+}
+
+/*
+ * decode_sel_lenovo
+ * inputs:
+ * evt = the 16-byte IPMI SEL event
+ * outbuf = points to the output string buffer
+ * outsz = size of the output buffer
+ * outputs:
+ * rv = 0 if this event was successfully interpreted here,
+ * non-zero otherwise, to use default interpretations.
+ * outbuf = will contain the interpreted event text string (if rv==0)
+ */
+int decode_sel_lenovo(uchar *evt, char *outbuf, int outsz, char fdesc,
+ char fdbg)
+{
+ int rv = -1;
+ ushort id;
+ uchar rectype;
+ ulong timestamp;
+ char mybuf[64];
+ char *type_str = "";
+ char *pstr = NULL;
+ int sevid;
+ ushort genid;
+ uchar snum;
+ uchar data1, data2, data3;
+
+ fdebug = fdbg;
+ sevid = SEV_INFO;
+ id = evt[0] + (evt[1] << 8);
+ rectype = evt[2];
+ snum = evt[11];
+ timestamp = evt[3] + (evt[4] << 8) + (evt[5] << 16) + (evt[6] << 24);
+ genid = evt[7] | (evt[8] << 8);
+ 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 (rv == 0) {
+ format_event(id,timestamp, sevid, genid, type_str,
+ snum,NULL,pstr,mybuf,outbuf,outsz);
+ }
+ return(rv);
+}
+
+static void usage(void)
+{
+ printf("Usage: %s <command> [arg]\n",progname);
+ printf("These commands may not work on all Lenovo systems\n");
+}
+
+static int ipmi_oemlenovo_main(int argc, char **argv)
+{
+ int rv = 0;
+
+ if (strncmp(argv[0],"other",9) == 0) {
+ usage();
+ rv = ERR_USAGE;
+ } else {
+ usage();
+ rv = ERR_USAGE;
+ }
+ return(rv);
+}
+
+#ifdef METACOMMAND
+int i_oemlenovo(int argc, char **argv)
+#else
+#ifdef WIN32
+int __cdecl
+#else
+int
+#endif
+main(int argc, char **argv)
+#endif
+{
+ int rv = 0;
+ uchar devrec[16];
+ int c, i;
+ char *s1;
+
+ printf("%s ver %s\n", progname,progver);
+ set_loglevel(LOG_NOTICE);
+ parse_lan_options('V',"4",0); /*default to admin priv*/
+
+ while ( (c = getopt( argc, argv,"m:xzEF:J:N:P:R:T:U:V:YZ:?")) != EOF )
+ switch(c) {
+ case 'm': /* specific IPMB MC, 3-byte address, e.g. "409600" */
+ g_bus = htoi(&optarg[0]); /*bus/channel*/
+ g_sa = htoi(&optarg[2]); /*device slave address*/
+ g_lun = htoi(&optarg[4]); /*LUN*/
+ g_addrtype = ADDR_IPMB;
+ if (optarg[6] == 's') {
+ g_addrtype = ADDR_SMI; s1 = "SMI";
+ } else { g_addrtype = ADDR_IPMB; s1 = "IPMB"; }
+ ipmi_set_mc(g_bus,g_sa,g_lun,g_addrtype);
+ printf("Use MC at %s bus=%x sa=%x lun=%x\n",
+ s1,g_bus,g_sa,g_lun);
+ break;
+ case 'x': fdebug = 2; /* normal (dbglog if isol) */
+ verbose = 1;
+ break;
+ case 'z': fdebug = 3; /*full debug (for isol)*/
+ verbose = 1;
+ break;
+ case 'N': /* nodename */
+ case 'U': /* remote username */
+ case 'P': /* remote password */
+ case 'R': /* remote password */
+ case 'E': /* get password from IPMI_PASSWORD environment var */
+ case 'F': /* force driver type */
+ case 'T': /* auth type */
+ case 'J': /* cipher suite */
+ case 'V': /* priv level */
+ case 'Y': /* prompt for remote password */
+ case 'Z': /* set local MC address */
+ parse_lan_options(c,optarg,fdebug);
+ break;
+ default:
+ usage();
+ return(ERR_USAGE);
+ break;
+ }
+ for (i = 0; i < optind; i++) { argv++; argc--; }
+ if (argc == 0) {
+ usage();
+ return(ERR_USAGE);
+ }
+
+ rv = ipmi_getdeviceid(devrec,16,fdebug);
+ if (rv == 0) {
+ char ipmi_maj, ipmi_min;
+ ipmi_maj = devrec[4] & 0x0f;
+ ipmi_min = devrec[4] >> 4;
+ vend_id = devrec[6] + (devrec[7] << 8) + (devrec[8] << 16);
+ prod_id = devrec[9] + (devrec[10] << 8);
+ show_devid( devrec[2], devrec[3], ipmi_maj, ipmi_min);
+ }
+
+ rv = ipmi_oemlenovo_main(argc, argv);
+
+ ipmi_close_();
+ return(rv);
+}
+/* end oem_lenovo.c */
diff --git a/util/oem_lenovo.h b/util/oem_lenovo.h
new file mode 100644
index 0000000..41d8955
--- /dev/null
+++ b/util/oem_lenovo.h
@@ -0,0 +1,46 @@
+/*
+ * oem_lenovo.h
+ * Handle Lenovo OEM command functions
+ *
+ * Author: Andy Cress arcress at users.sourceforge.net
+ * Change history:
+ * 11/21/2016 ARCress - created
+ *
+ *---------------------------------------------------------------------
+ */
+/*M*
+Copyright (c) 2016 Andy Cress
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ a.. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ b.. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ c.. Neither the name of the copyright holder nor the names of contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *M*/
+
+#ifndef IPMI_OEMLENOVO_H
+#define IPMI_OEMLENOVO_H
+
+int ipmi_oem_lenovo_main(void *, int, char **);
+int decode_sensor_lenovo(uchar *sdr,uchar *reading,char *pstring, int slen);
+
+#endif /*IPMI_OEMLENOVO_H*/
+
diff --git a/util/oem_newisys.c b/util/oem_newisys.c
index 7b78532..dd4d759 100644
--- a/util/oem_newisys.c
+++ b/util/oem_newisys.c
@@ -47,7 +47,7 @@ static char fdebug = 0;
static uchar g_bus = PUBLIC_BUS;
static uchar g_sa = BMC_SA;
static uchar g_lun = BMC_LUN;
-static uchar g_addrtype = ADDR_SMI;
+//static uchar g_addrtype = ADDR_SMI;
#define DESC_MAX 200
/*
diff --git a/util/oem_sun.c b/util/oem_sun.c
index 5cbf82c..85b761f 100644
--- a/util/oem_sun.c
+++ b/util/oem_sun.c
@@ -109,7 +109,7 @@ static const struct valstr sunoem_led_mode_optvals[] = {
/* global variables */
static char * progname = "isunoem";
-static char * progver = "3.00";
+static char * progver = "3.01";
static char fdebug = 0;
static uchar g_bus = PUBLIC_BUS;
static uchar g_sa = BMC_SA;
diff --git a/util/oem_supermicro.c b/util/oem_supermicro.c
index 3937f0d..f3e42dd 100644
--- a/util/oem_supermicro.c
+++ b/util/oem_supermicro.c
@@ -54,6 +54,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <time.h>
#include "ipmicmd.h"
#include "ievents.h"
+#include "isensor.h"
#include "oem_supermicro.h"
#ifdef MOVED /*moved to oem_supermicro.h*/
@@ -67,7 +68,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
void set_loglevel(int level); /*prototype */
extern char fsm_debug; /*mem_if.c*/
-static char * progver = "3.00";
+static char * progver = "3.01";
static char * progname = "ismcoem";
static int verbose = 0;
static char fdebug = 0;
@@ -372,6 +373,35 @@ int oem_supermicro_reset_intrusion(void)
return(rv);
}
+/* decode_threshold_supermicro() assumes Fans, not Temp
+ * Temp thresholds are different order. */
+int decode_threshold_supermicro(uchar rval, uchar *thresh)
+{
+ int idx = 0;
+ uchar bits;
+
+ bits = thresh[0];
+ if (bits & 0x20) { /*hi-unrec*/
+ if (rval >= thresh[6]) { idx = 6; return(idx); }
+ }
+ if (bits & 0x10) { /*hi-crit*/
+ if (rval >= thresh[5]) { idx = 5; return(idx); }
+ }
+ if (bits & 0x08) { /*hi-noncr*/
+ if (rval >= thresh[4]) { idx = 4; return(idx); }
+ }
+ if (bits & 0x01) { /*lo-noncr*/
+ if (rval <= thresh[1]) { idx = 1; }
+ }
+ if (bits & 0x02) { /*lo-crit*/
+ if (rval <= thresh[2]) { idx = 2; }
+ }
+ if (bits & 0x04) { /*lo-unrec*/
+ if (rval <= thresh[3]) { idx = 3; }
+ }
+ return(idx);
+}
+
/*
* decode_sensor_supermicro
* inputs:
@@ -386,16 +416,48 @@ int oem_supermicro_reset_intrusion(void)
*/
int decode_sensor_supermicro(uchar *sdr,uchar *reading,char *pstring, int slen)
{
- int rv = -1;
- uchar stype;
+ int i, rv = -1;
+ uchar stype, etype, snum;
uchar bval;
char *pstr = NULL;
+ uchar thresh[7];
+ SDR01REC *sdr01;
+ char *typestr = NULL;
+ double val;
if (sdr == NULL || reading == NULL) return(rv);
if (pstring == NULL || slen == 0) return(rv);
- /* sdr[3] is 0x01 for Full, 0x02 for Compact */
- bval = reading[2];
- stype = sdr[12];
+ bval = (reading[2] & 0x3f);
+ snum = sdr[7]; /*sdr01->sens_num*/
+ stype = sdr[12]; /*sensor_type*/
+ etype = sdr[13]; /*sdr01->ev_type*/
+ /* sdr[3] rec_type is 0x01 for Full, 0x02 for Compact */
+ if ((sdr[3] == 0x01) && (etype == 0x01)) { /* full threshold sensor */
+ if (bval == 0) return(-1); /* OK, treat it normally */
+ /*cannot rely upon the sensor reading[2], so get thresholds and compare*/
+ rv = GetSensorThresholds(snum,&thresh[0]);
+ if (rv != 0) return(rv);
+ i = decode_threshold_supermicro(reading[0],thresh);
+ if (fdebug)
+ printf("decode_sensor_supermicro: snum=%x rdg=%x:%x thresh=%x:%x:%x:%x:%x:%x:%x i=%d rv=%d\n",
+ snum,reading[0],reading[2], thresh[0], thresh[1], thresh[2], thresh[3],
+ thresh[4], thresh[5], thresh[6], i,rv);
+ switch(i) {
+ case 0: pstr = "OK*"; break;
+ case 1: pstr = "Warn-lo"; break;
+ case 2: pstr = "Crit-lo"; break;
+ case 3: pstr = "BelowCrit"; break;
+ case 4: pstr = "Warn-hi"; break;
+ case 5: pstr = "Crit-hi"; break;
+ case 6: pstr = "AboveCrit"; break;
+ default: pstr = "OK*"; break;
+ }
+ sdr01 = (SDR01REC *)sdr;
+ val = RawToFloat(reading[0],sdr);
+ typestr = get_unit_type(sdr01->sens_units,sdr01->sens_base,sdr01->sens_mod, 0);
+ snprintf(pstring, slen, "%s %.2f %s",pstr,val,typestr);
+ return(rv);
+ }
switch(stype) {
case 0xC0: /* CPU Temp Sensor, EvTyp=0x70 (Full) */
//if (dbg) printf("supermicro %x sensor reading %x\n",stype,reading);
@@ -457,14 +519,6 @@ int decode_mem_supermicro(int prod, uchar b2, uchar b3, char *desc, int *psz)
cpu = bdata / 10;
dimm = bdata % 10;
#endif
-#ifdef DMIOK
- /* Use DMI if we get confirmation about cpu/dimm indices. */
- if (! is_remote()) {
- fsm_debug = fdebug;
- rv = get_MemDesc(cpu,dimm,desc,psz);
- /* if (rv != 0) desc has "DIMM[%d}" */
- }
-#endif
/* ver 0 previous SuperMicro firmware returned all zeros here.
* ver 1 returns data3 with some info (X9)
* ver 2 returns data2 with some info (X9,X10)
@@ -496,6 +550,14 @@ int decode_mem_supermicro(int prod, uchar b2, uchar b3, char *desc, int *psz)
dimm = (bdata & 0x0F) - 9; /*0x0A=dimmX1, 0x0B=dimmX2*/
n = sprintf(desc,"P%d_DIMM%c%d",cpu,rgpair[pair],dimm);
}
+#ifdef DMIOK
+ /* Use DMI if we get confirmation about cpu/dimm indices. */
+ if (! is_remote()) {
+ fsm_debug = fdebug;
+ rv = get_MemDesc(cpu,dimm,desc,psz);
+ /* if (rv != 0) desc has "DIMM[%d}" */
+ }
+#endif
if (fdebug)
printf("decode_mem_supermicro: v%d bdata=%02x(%d) cpu=%d dimm=%d pair=%d\n",ver,bdata,bdata,cpu,dimm,pair);
@@ -514,6 +576,7 @@ int decode_mem_supermicro(int prod, uchar b2, uchar b3, char *desc, int *psz)
* rv = 0 if this event was successfully interpreted here,
* non-zero otherwise, to use default interpretations.
* outbuf = will contain the interpreted event text string (if rv==0)
+ * See also decode_mem_supermicro above
*/
int decode_sel_supermicro(uchar *evt, char *outbuf, int outsz, char fdesc,
char fdbg)
diff --git a/util/subs.c b/util/subs.c
index 135fcd9..f2af5da 100644
--- a/util/subs.c
+++ b/util/subs.c
@@ -403,7 +403,7 @@ int get_errno(void)
/* For a list of all IANA enterprise mfg vendor numbers,
* see http://www.iana.org/assignments/enterprise-numbers
* Product numbers are different for each mfg vendor. */
-#define N_MFG 44
+#define N_MFG 46
static struct { int val; char *pstr; } mfgs[N_MFG] = {
{0, " "},
{0x0000BA, "Toshiba"},
@@ -448,6 +448,8 @@ static struct { int val; char *pstr; } mfgs[N_MFG] = {
{VENDOR_LMC, "LMC"}, /*=0x000878 with SuperMicro*/
{VENDOR_TYAN, "Tyan"}, /*=0x0019FD*/
{VENDOR_SUN, "Sun"}, /*=0x00002A*/
+ {VENDOR_LENOVO, "Lenovo"}, /*=0x004A66*/
+ {VENDOR_LENOVO2, "Lenovo"}, /*=0x004F4D*/
{VENDOR_INTEL, "Intel"} /*=0x000157*/
};