summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2016-05-08 23:32:28 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2016-05-08 23:32:28 +0200
commit55adddbc16f65732b57ab8585c47001fced91d77 (patch)
tree27e8239d48c8a6b353db356aff92ee4d225c0a0e /util
parentd3c90cdcdf56146af89056ed36bfcc7b4d4956c5 (diff)
Imported Upstream version 2.9.9upstream/2.9.9
Diffstat (limited to 'util')
-rw-r--r--util/ialarms.c2
-rw-r--r--util/icmd.c2
-rw-r--r--util/iconfig.c4
-rw-r--r--util/idcmi.c8
-rw-r--r--util/idiscover.c18
-rw-r--r--util/iekanalyzer.c11
-rw-r--r--util/ievents.c8
-rw-r--r--util/ifirewall.c2
-rw-r--r--util/ifru.c6
-rw-r--r--util/ifruset.c2
-rw-r--r--util/igetevent.c4
-rw-r--r--util/ihealth.c12
-rw-r--r--util/ilan.c29
-rw-r--r--util/ipicmg.c96
-rw-r--r--util/ipicmg.h90
-rw-r--r--util/ipmicmd.c1
-rw-r--r--util/ipmicmd.h3
-rw-r--r--util/ipmilan.c13
-rw-r--r--util/ipmimv.c18
-rw-r--r--util/ipmiutil.c2
-rw-r--r--util/ireset.c6
-rw-r--r--util/isel.c2
-rw-r--r--util/iseltime.c2
-rw-r--r--util/isensor.c193
-rw-r--r--util/iserial.c2
-rw-r--r--util/isol.c2
-rw-r--r--util/itsol.c2
-rw-r--r--util/iwdt.c2
-rw-r--r--util/oem_dell.c68
-rw-r--r--util/oem_intel.c2
-rw-r--r--util/oem_kontron.c1
-rw-r--r--util/oem_sun.c2
-rw-r--r--util/oem_supermicro.c90
-rw-r--r--util/subs.c7
34 files changed, 416 insertions, 296 deletions
diff --git a/util/ialarms.c b/util/ialarms.c
index 2519345..f9c80cc 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 = "2.98";
+static char * progver = "2.99";
static char * progname = "ialarms";
static char fdebug = 0;
static char fbmctam = 0;
diff --git a/util/icmd.c b/util/icmd.c
index b481c96..cbd35d1 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 = "2.98";
+static char * progver = "2.99";
static char * progname = "icmd";
static char fdebug = 0;
static char fquiet = 0;
diff --git a/util/iconfig.c b/util/iconfig.c
index 6f7fd83..21eb76e 100644
--- a/util/iconfig.c
+++ b/util/iconfig.c
@@ -171,7 +171,7 @@ typedef struct
/*
* Global variables
*/
-static char * progver = "2.98";
+static char * progver = "2.99";
static char * progname = "iconfig";
static char fdebug = 0;
static char fipmilan = 0;
@@ -2636,7 +2636,7 @@ main(int argc, char **argv)
case SYS_INFO: /* System Info */
if (! fIPMI20) continue; /*skip if not IPMI 2.0*/
/* j = #bytes read into LanRecord */
- ret = set_system_info(bset,LanRecord,j);
+ ret = set_system_info(bset,(char *)LanRecord,j);
break;
case LAN_FAILOVER: /* Intel LAN Failover */
if (is_romley(vend_id,prod_id))
diff --git a/util/idcmi.c b/util/idcmi.c
index 2786efb..a21ee2a 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 = "2.98";
+static char * progver = "2.99";
extern char fdebug; /*from ipmicmd.c*/
static uchar g_bus = PUBLIC_BUS;
static uchar g_sa = BMC_SA;
@@ -334,7 +334,7 @@ void dcmi_show_power_read(int parm, uchar *cdata, int sdata)
printf(" Max Power over sample duration: %d Watts\n",cdata[5]+(cdata[6]<<8));
printf(" Avg Power over sample duration: %d Watts\n",cdata[7]+(cdata[8]<<8));
printf(" Timestamp: %s\n",ctime(&t));
- printf(" Sampling period: %d ms\n",sample_period);
+ printf(" Sampling period: %lu ms\n",sample_period);
printf(" Power reading state is: %s\n",(state&0x40)? "active":"not active");
break;
case 2: /* Mode 2 - Enhanced System Power Statistics */
@@ -369,7 +369,7 @@ void dcmi_show_power_limit(uchar *cdata, int sdata, int rv)
else
printf("OEM defined\n");
printf(" Power Limit: %d Watts %s\n",cdata[4]+(cdata[5]<<8), pstr);
- printf(" Correction Time: %d ms\n", correction_time);
+ printf(" Correction Time: %lu ms\n", correction_time);
printf(" Sampling period: %d sec\n", cdata[12]+(cdata[13]<<8));
}
@@ -494,6 +494,7 @@ static int dcmi_get_asset_tag(char *pdata, int sdata, int *dlen)
if (rv == 0) rv = cc;
if (rv == 0) { /* if here, success */
if (n == 0) sz_all = rdata[1];
+ if ((rlen - 2) < sz_chunk) sz_chunk = rlen - 2;
if ((n + sz_chunk) > sdata) {
if (fdebug)
printf("dcmi_get_asset(%d): data truncated from %d to %d\n",
@@ -535,6 +536,7 @@ static int dcmi_get_mc_id(char *pdata, int sdata, int *dlen)
if (rv == 0) rv = cc;
if (rv == 0) { /* if here, success */
if (n == 0) sz_all = rdata[1];
+ if ((rlen - 2) < sz_chunk) sz_chunk = rlen - 2;
if ((n + sz_chunk) > sdata) {
if (fdebug)
printf("dcmi_get_mc_id(%d): data truncated from %d to %d\n",
diff --git a/util/idiscover.c b/util/idiscover.c
index 6dd0225..567cf05 100644
--- a/util/idiscover.c
+++ b/util/idiscover.c
@@ -17,6 +17,7 @@
* 09/20/07 Andy Cress - fixed send/receive thread order
* 07/15/08 Andy Cress - added -r for ping repeats
* 11/21/08 Andy Cress - detect eth intf and broadcast ip addr
+ * 01/04/16 Andy Cress - v1.11, allow 0 if fBroadcastOk (-a)
*/
/*M*
Copyright (c) 2006, Intel Corporation
@@ -157,7 +158,7 @@ int GetFirstIP(uchar *ipaddr, uchar *macadr, char *ipname, char fdb); /*ilan.c*/
/*
* Global variables
*/
-static char * progver = "1.10";
+static char * progver = "1.11";
static char * progname = "idiscover";
static char fdebug = 0;
static char fping = 1;
@@ -504,7 +505,7 @@ int sock_init( char *_interface, char *_startIP, char *_endIP)
strcpy(ifr.ifr_name, devname);
ifr.ifr_addr.sa_family = AF_INET;
if (ioctl(g_sockfd, SIOCGIFADDR, &ifr) >= 0) {
- /* valid IP address, so active interface, use it */
+ /* valid IP address, so active interface, use it */
temp_sockaddr = *((struct sockaddr_in *)&ifr.ifr_addr);
memcpy(&_srcaddr.sin_addr.s_addr, &temp_sockaddr.sin_addr.s_addr,
sizeof(_srcaddr.sin_addr.s_addr));
@@ -575,14 +576,15 @@ int sock_init( char *_interface, char *_startIP, char *_endIP)
if (rv ) {
_startAddr.s_addr = ntohl(_startAddr.s_addr);
if (fdebug) show_ip(_startAddr.s_addr);
- pb = (unsigned char*)&_startAddr.s_addr;
- if (pb[0] < 1)
+ pb = (unsigned char*)&_startAddr.s_addr;
+ if (!fBroadcastOk && (pb[0] < 1) )
printerr("Malformed begin IP: %s\n", _startIP);
else if (!fBroadcastOk && (pb[0] >254) )
printerr("Malformed begin IP: %s\n", _startIP);
else if (fBroadcastOk) {
- val = pb[0] & 0x0f;
- if (val == 0x0f) rv = 0;
+ val = pb[0] & 0x0f;
+ if (val == 0x0f) rv = 0;
+ else if (val == 0x00) rv = 0;
else printerr("Malformed begin broadcast IP: %s\n", _startIP);
} else rv = 0;
} else {
@@ -594,8 +596,8 @@ int sock_init( char *_interface, char *_startIP, char *_endIP)
if (rv ) {
_endAddr.s_addr = ntohl(_endAddr.s_addr);
if (fdebug) show_ip(_endAddr.s_addr);
- pb = (unsigned char*)&_endAddr.s_addr;
- if (pb[0] < 1)
+ pb = (unsigned char*)&_endAddr.s_addr;
+ if (!fBroadcastOk && (pb[0] < 1) )
printerr("Malformed end IP: %s\n", _endIP);
else if (!fBroadcastOk && (pb[0] >254) )
printerr("Malformed end IP: %s\n", _endIP);
diff --git a/util/iekanalyzer.c b/util/iekanalyzer.c
index 1f405cc..c6e92eb 100644
--- a/util/iekanalyzer.c
+++ b/util/iekanalyzer.c
@@ -63,6 +63,7 @@
#include "ipmicmd.h"
#include "iekanalyzer.h"
+#ifdef HAVE_EK
extern int verbose; /*ipmilanplus.c*/
extern void lprintf(int level, const char * format, ...); /*ipmilanplus.c*/
extern void set_loglevel(int level);
@@ -4127,5 +4128,15 @@ main(int argc, char **argv)
ipmi_close_();
return rc;
}
+#else
+/* ekanalyzer stub */
+#ifdef METACOMMAND
+int i_ekanalyzer(int argc, char **argv)
+{
+ printf("ekanalyzer function is not enabled\n");
+ return -1;
+}
+#endif
+#endif
/*end iekanalyzer.c*/
diff --git a/util/ievents.c b/util/ievents.c
index cc40318..6a34e16 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 = "2.98";
+static char *progver = "2.99";
static char *progname = "ievents";
static char fsensdesc = 0; /* 1= get extended sensor descriptions*/
static char fcanonical = 0; /* 1= show canonical, delimited output*/
@@ -2221,7 +2221,7 @@ int decode_raw_sel(char *raw_file, int mode)
{
FILE *fp;
char buff[256];
- uchar msg[132];
+ char msg[132];
uchar hbuf[50];
int fvalid = 0;
int len, i;
@@ -2585,7 +2585,7 @@ int i_events(int argc, char **argv)
} else i++;
}
}
- decode_sel_entry(buf,msg,sizeof(msg));
+ decode_sel_entry(buf,(char *)msg,sizeof(msg));
printf("%s", evt_hdr); /*"RecId Date/Time_______*/
printf("%s", msg);
} else if (fnewevt) {
@@ -2598,7 +2598,7 @@ int i_events(int argc, char **argv)
if (fdebug) printf("decoding standard IPMI event bytes\n");
if (fdebug) dump_buf("IPMI event",buf,16,0);
set_sel_opts(2,0, NULL,fdebug,futc);
- rv = decode_sel_entry(buf,msg,sizeof(msg));
+ rv = decode_sel_entry(buf,(char *)msg,sizeof(msg));
/* show header for the event record */
printf("%s", evt_hdr); /*"RecId Date/Time_______*/
printf("%s", msg);
diff --git a/util/ifirewall.c b/util/ifirewall.c
index 18dca7a..f81deda 100644
--- a/util/ifirewall.c
+++ b/util/ifirewall.c
@@ -64,7 +64,7 @@
/* global variables */
static char * progname = "ifirewall";
-static char * progver = "2.98";
+static char * progver = "2.99";
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 b10c42e..5e6acf8 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 = "2.98";
+static char *progver = "2.99";
static int vend_id = 0;
static int prod_id = 0;
static char fdebug = 0;
@@ -1521,7 +1521,7 @@ static int test_show_fru(char *infile)
int rv = -1;
FILE *fp;
int len, i, idx, sz, off;
- uchar buff[256];
+ char buff[256];
uchar sa = 0x20;
uchar fruid =0;
uchar frutype = 0;
@@ -1624,7 +1624,7 @@ int i_fru(int argc, char **argv)
{
int ret, rv;
int c;
- char DevRecord[16];
+ uchar DevRecord[16];
ushort recid;
ushort nextid;
ushort rsvid;
diff --git a/util/ifruset.c b/util/ifruset.c
index b7a894c..8ff4294 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 = "2.98";
+static char *progver = "2.99";
static char fdebug = 0;
static char fpicmg = 0;
static char fonlybase = 0;
diff --git a/util/igetevent.c b/util/igetevent.c
index 9d1786c..1c420e2 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 = "2.98";
+static char * progver = "2.99";
static char fdebug = 0;
static char fipmilan = 0;
static char frunonce = 0;
@@ -757,7 +757,7 @@ static int startevent_sel(ushort *precid, uint *ptime)
if (fdebug) msgout("start: idxfile=%s fd=%p\n",idxfile,fd);
if (fd != NULL) {
// Read the file, get savtime & savid
- rv = fscanf(fd,"%x %x",&t,&r);
+ rv = fscanf(fd,"%x %x",&t,(uint *)&r);
fclose(fd);
if (r == LAST_REC) r = 0;
rv = 0; /*read it, success*/
diff --git a/util/ihealth.c b/util/ihealth.c
index 76f1121..abc7fdb 100644
--- a/util/ihealth.c
+++ b/util/ihealth.c
@@ -74,7 +74,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
extern int get_BiosVersion(char *str);
extern int get_SystemGuid(uchar *guid);
extern int GetSDR(int id, int *next, uchar *recdata, int srecdata, int *rlen);
-extern int get_device_guid(char *pbuf, int *sz); /*subs.c*/
+extern int get_device_guid(uchar *pbuf, int *sz); /*subs.c*/
extern int oem_supermicro_get_health(char *pstr, int sz); /*oem_supermicro.c*/
extern int oem_supermicro_get_firmware_str(char *pstr, int sz); /*oem_supermicro.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 = "2.98";
+static char * progver = "2.99";
static char fdebug = 0;
static char fipmilan = 0;
static char fcanonical = 0;
@@ -604,11 +604,15 @@ void show_devid_all(int dtype, uchar *devrec, int sdevrec)
if (prod >= 0x200) prodstr = "(iRMC S2)";
else prodstr = "";
break;
- case VENDOR_CISCO: /*=0x00168b*/
+ case VENDOR_CISCO: /*=0x00168b, 5771.*/
if (prod == 0x0005) prodstr = "(UCS C200)";
else prodstr = "";
if (fipmilan) lan_ch_restrict = 1; /*fw bug, gets 0xC1 on ipmilan*/
break;
+ case 0x003C0A: /*=15370, Giga-Byte*/
+ prodstr = "";
+ lan_ch_restrict = 1; /*fw bug, gets 0xC1*/
+ break;
case VENDOR_INTEL: /*=0x000157*/
if (do_hsc && (dtype == BMC)) /*if HSC option, also show extra*/
sprintf(extraver," (Boot %x.%x PIA %x.%x)", /*BMC extra*/
@@ -796,7 +800,7 @@ int GetPowerOnHours(unsigned int *val)
char *decode_selftest(int stat)
{
- uchar *s;
+ char *s;
uchar b;
if (stat == 0x0055) s = "(OK)";
else {
diff --git a/util/ilan.c b/util/ilan.c
index 3499ed9..c81c7a9 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 = "2.98";
+static char * progver = "2.99";
static char * progname = "ilan";
static char fdebug = 0;
static char fipmilan = 0;
@@ -721,7 +721,7 @@ SetPasswd(int unum, char *uname, char *upswd)
int responseLength = MAX_BUFFER_SIZE;
int status, i, psw_len;
uchar completionCode;
- char inputData[24];
+ uchar inputData[24];
int ret = 0;
inputData[0] = (uchar)unum; /*user 1 = null user */
@@ -797,7 +797,7 @@ SetPasswd(int unum, char *uname, char *upswd)
psw_len = PSW_LEN; /*=16 change if 20-byte passwords supported */
memset(&inputData[2],0,psw_len);
if (upswd != NULL)
- strcpy(&inputData[2],upswd);
+ strcpy((char *)&inputData[2],upswd);
if (fdebug) {
char apsw[PSW_MAX+1];
char c;
@@ -824,7 +824,7 @@ SetPasswd(int unum, char *uname, char *upswd)
inputData[1] = 0x03; /*test password*/
memset(&inputData[2],0,psw_len);
if (upswd != NULL)
- strcpy(&inputData[2],upswd);
+ strcpy((char *)&inputData[2],upswd);
responseLength = sizeof(responseData);
status = ipmi_cmd(SET_USER_PASSWORD, inputData, 2+psw_len,
responseData,&responseLength, &completionCode,fdebug);
@@ -870,7 +870,7 @@ DisableUser(int unum)
int responseLength = MAX_BUFFER_SIZE;
int status;
uchar completionCode;
- char inputData[24];
+ uchar inputData[24];
inputData[0] = 0x80 | lan_ch; /* = 0x87, no IPMI */
inputData[1] = (uchar)unum; /* user 1 */
@@ -931,7 +931,7 @@ int GetUser(uchar user_num)
int responseLength = MAX_BUFFER_SIZE;
int status;
uchar completionCode;
- char inputData[24];
+ uchar inputData[24];
inputData[0] = lan_ch;
inputData[1] = user_num; /* usually = 1 for BMC LAN */
@@ -2070,7 +2070,7 @@ int FindEthNum(uchar *macadrin)
#endif
{
uchar *pb;
- pb = get_ifreq_mac(&ifr);
+ pb = (uchar *)get_ifreq_mac(&ifr);
#ifdef DBG
if (fdebug) {
printf("%s mac: %02x:%02x:%02x:%02x:%02x:%02x\n",
@@ -2948,7 +2948,7 @@ int Get_IPMac_Addr()
else if (fdebug)
printf("ioctl(SIOCGIFADDR,%s) error, errno=%d\n",_ifname,err);
} else { /* got the local OS IP successfully */
- pc = &ifr.ifr_addr.sa_data[2];
+ pc = (uchar *)&ifr.ifr_addr.sa_data[2];
if (fdebug)
printf("%s addr = %d.%d.%d.%d\n",_ifname,pc[0],pc[1],pc[2],pc[3]);
memcpy(osmyip, pc, 4);
@@ -2962,7 +2962,7 @@ int Get_IPMac_Addr()
printf("ioctl(SIOCGIFNETMASK) error, errno=%d\n",get_errno());
/* if leave invalid, will use default rgsubnet */
} else { // sizeof(struct sockaddr)
- pc = &ifr.ifr_netmask.sa_data[2];
+ pc = (uchar *)&ifr.ifr_netmask.sa_data[2];
if (fdebug)
printf("subnet = %d.%d.%d.%d \n", pc[0],pc[1],pc[2],pc[3]);
memcpy(ossubnet, pc, 4);
@@ -3675,6 +3675,8 @@ main(int argc, char **argv)
char mystr[80];
char fpefok = 1;
uchar * pc; int sz;
+ char *pa;
+ char *pb;
// progname = argv[0];
printf("%s ver %s \n",progname,progver);
@@ -4188,7 +4190,6 @@ main(int argc, char **argv)
{
ret = GetPefEntry( 0x06, (ushort)idx, &PefRecord);
if (ret == 0) { // Show the PEF record
- char *pa;
pc = (uchar *)&PefRecord;
sz = 21; // sizeof(PEF_RECORD) = 21
if (PefRecord.sensor_type == 0) {
@@ -4198,8 +4199,8 @@ main(int argc, char **argv)
if (fAdjustPefNum) pefnum = (char)idx;
} else {
memcpy(pef_array[idx-1], &PefRecord, sz);
- if (PefRecord.fconfig & 0x80) pc = "enabled";
- else pc = "disabled";
+ if (PefRecord.fconfig & 0x80) pb = "enabled";
+ else pb = "disabled";
i = PefRecord.rec_id;
switch(PefRecord.action) {
case 0x01: pa = "alert"; break;
@@ -4212,7 +4213,7 @@ main(int argc, char **argv)
}
printf("PEFilter(%02d): %02x %s event - %s for %s\n",
idx, PefRecord.sensor_type,
- PefDesc(i,PefRecord.sensor_type), pc,pa);
+ PefDesc(i,PefRecord.sensor_type), pb,pa);
}
if (fdebug) { /* show raw PEFilter record */
pc = &PefRecord.rec_id;
@@ -5062,7 +5063,7 @@ main(int argc, char **argv)
printf("snmp community \t%s\n",rgcommunity);
/* Only need the SNMP community if there is an Alert Destination */
memset(&LanRecord.data[0], 0, 18); /* make sure zero-filled */
- strcpy(&LanRecord.data[0],rgcommunity);
+ strcpy((char *)&LanRecord.data[0],rgcommunity);
ret = SetLanEntry(16, &LanRecord, 18);
printf("SetLanEntry(16), ret = %d\n",ret);
if (ret != 0) { nerrs++; lasterr = ret; }
diff --git a/util/ipicmg.c b/util/ipicmg.c
index a920f37..6421f2b 100644
--- a/util/ipicmg.c
+++ b/util/ipicmg.c
@@ -81,7 +81,7 @@
/* Global data */
static char * progname = "ipicmg";
-static char * progver = "2.98";
+static char * progver = "2.99";
static char fdebug = 0;
static char fset_mc = 0;
static uint8_t g_bus = PUBLIC_BUS;
@@ -91,6 +91,96 @@ static uint8_t g_addrtype = ADDR_SMI;
static uint8_t g_fruid = 0;
static unsigned char PicmgExtMajorVersion;
+/* the LED color capabilities */
+static const char* led_color_str[] = { //__attribute__((unused)) = {
+ "reserved",
+ "BLUE",
+ "RED",
+ "GREEN",
+ "AMBER",
+ "ORANGE",
+ "WHITE",
+ "reserved"
+};
+
+
+static const char* amc_link_type_str[] = { // __attribute__((unused)) = {
+ "RESERVED",
+ "RESERVED1",
+ "PCI EXPRESS",
+ "ADVANCED SWITCHING1",
+ "ADVANCED SWITCHING2",
+ "ETHERNET",
+ "RAPIDIO",
+ "STORAGE",
+};
+
+static const char* amc_link_type_ext_str[][16]= { // __attribute__((unused))
+ /* FRU_PICMGEXT_AMC_LINK_TYPE_RESERVED */
+ {
+ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""
+ },
+ /* FRU_PICMGEXT_AMC_LINK_TYPE_RESERVED1 */
+ {
+ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""
+ },
+ /* FRU_PICMGEXT_AMC_LINK_TYPE_PCI_EXPRESS */
+ {
+ "Gen 1 - NSSC",
+ "Gen 1 - SSC",
+ "Gen 2 - NSSC",
+ "Gen 2 - SSC",
+ "", "", "", "",
+ "", "", "", "",
+ "", "", "", ""
+ },
+ /* FRU_PICMGEXT_AMC_LINK_TYPE_ADVANCED_SWITCHING1 */
+ {
+ "Gen 1 - NSSC",
+ "Gen 1 - SSC",
+ "Gen 2 - NSSC",
+ "Gen 2 - SSC",
+ "", "", "", "",
+ "", "", "", "",
+ "", "", "", ""
+ },
+ /* FRU_PICMGEXT_AMC_LINK_TYPE_ADVANCED_SWITCHING2 */
+ {
+ "Gen 1 - NSSC",
+ "Gen 1 - SSC",
+ "Gen 2 - NSSC",
+ "Gen 2 - SSC",
+ "", "", "", "",
+ "", "", "", "",
+ "", "", "", ""
+ },
+ /* FRU_PICMGEXT_AMC_LINK_TYPE_ETHERNET */
+ {
+ "1000BASE-BX (SerDES Gigabit)",
+ "10GBASE-BX410 Gigabit XAUI",
+ "", "",
+ "", "", "", "",
+ "", "", "", "",
+ "", "", "", ""
+ },
+ /* FRU_PICMGEXT_AMC_LINK_TYPE_RAPIDIO */
+ {
+ "1.25 Gbaud transmission rate",
+ "2.5 Gbaud transmission rate",
+ "3.125 Gbaud transmission rate",
+ "", "", "", "", "",
+ "", "", "", "", "", "", "", ""
+ },
+ /* FRU_PICMGEXT_AMC_LINK_TYPE_STORAGE */
+ {
+ "Fibre Channel",
+ "Serial ATA",
+ "Serial Attached SCSI",
+ "", "", "", "", "",
+ "", "", "", "", "", "", "", ""
+ }
+};
+
typedef enum picmg_bused_resource_mode {
PICMG_BUSED_RESOURCE_SUMMARY,
} t_picmg_bused_resource_mode ;
@@ -1297,7 +1387,7 @@ ipmi_picmg_clk_get(void * intf, int clk_id,int clk_res,int mode)
val2str( rsp[3], picmg_clk_family_vals));
printf(" - AccLVL: %3d [ %s ]\n", rsp[4],
oemval2str(rsp[3],rsp[4],picmg_clk_accuracy_vals));
- printf(" - Freq: %d\n", freq);
+ printf(" - Freq: %lu\n", freq);
}
}
}
@@ -1356,7 +1446,7 @@ printf("## index: %d\n", msg_data[2]);
printf("## setting: 0x%02x\n", msg_data[3]);
printf("## family: %d\n", msg_data[4]);
printf("## acc: %d\n", msg_data[5]);
-printf("## freq: %d\n", freq );
+printf("## freq: %lu\n", freq );
printf("## res: %d\n", msg_data[10]);
#endif
diff --git a/util/ipicmg.h b/util/ipicmg.h
index 59fce39..6f6554b 100644
--- a/util/ipicmg.h
+++ b/util/ipicmg.h
@@ -197,96 +197,6 @@ typedef enum picmg_busres_resource_id {
PICMG_BUSRES_SYNC_CLOCK_GROUP_3
} t_picmg_busres_resource_id;
-/* the LED color capabilities */
-static const char* led_color_str[] = { //__attribute__((unused)) = {
- "reserved",
- "BLUE",
- "RED",
- "GREEN",
- "AMBER",
- "ORANGE",
- "WHITE",
- "reserved"
-};
-
-
-static const char* amc_link_type_str[] = { // __attribute__((unused)) = {
- "RESERVED",
- "RESERVED1",
- "PCI EXPRESS",
- "ADVANCED SWITCHING1",
- "ADVANCED SWITCHING2",
- "ETHERNET",
- "RAPIDIO",
- "STORAGE",
-};
-
-static const char* amc_link_type_ext_str[][16]= { // __attribute__((unused))
- /* FRU_PICMGEXT_AMC_LINK_TYPE_RESERVED */
- {
- "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""
- },
- /* FRU_PICMGEXT_AMC_LINK_TYPE_RESERVED1 */
- {
- "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""
- },
- /* FRU_PICMGEXT_AMC_LINK_TYPE_PCI_EXPRESS */
- {
- "Gen 1 - NSSC",
- "Gen 1 - SSC",
- "Gen 2 - NSSC",
- "Gen 2 - SSC",
- "", "", "", "",
- "", "", "", "",
- "", "", "", ""
- },
- /* FRU_PICMGEXT_AMC_LINK_TYPE_ADVANCED_SWITCHING1 */
- {
- "Gen 1 - NSSC",
- "Gen 1 - SSC",
- "Gen 2 - NSSC",
- "Gen 2 - SSC",
- "", "", "", "",
- "", "", "", "",
- "", "", "", ""
- },
- /* FRU_PICMGEXT_AMC_LINK_TYPE_ADVANCED_SWITCHING2 */
- {
- "Gen 1 - NSSC",
- "Gen 1 - SSC",
- "Gen 2 - NSSC",
- "Gen 2 - SSC",
- "", "", "", "",
- "", "", "", "",
- "", "", "", ""
- },
- /* FRU_PICMGEXT_AMC_LINK_TYPE_ETHERNET */
- {
- "1000BASE-BX (SerDES Gigabit)",
- "10GBASE-BX410 Gigabit XAUI",
- "", "",
- "", "", "", "",
- "", "", "", "",
- "", "", "", ""
- },
- /* FRU_PICMGEXT_AMC_LINK_TYPE_RAPIDIO */
- {
- "1.25 Gbaud transmission rate",
- "2.5 Gbaud transmission rate",
- "3.125 Gbaud transmission rate",
- "", "", "", "", "",
- "", "", "", "", "", "", "", ""
- },
- /* FRU_PICMGEXT_AMC_LINK_TYPE_STORAGE */
- {
- "Fibre Channel",
- "Serial ATA",
- "Serial Attached SCSI",
- "", "", "", "", "",
- "", "", "", "", "", "", "", ""
- }
-};
-
struct sAmcPortState {
#ifndef WORDS_BIGENDIAN
unsigned short lane0 : 1;
diff --git a/util/ipmicmd.c b/util/ipmicmd.c
index efaadec..369d2e4 100644
--- a/util/ipmicmd.c
+++ b/util/ipmicmd.c
@@ -409,6 +409,7 @@ char *decode_rv(int rv)
/* ipmidir.h: ERGETTINGIPMIMESSAGE -504 */
case ERR_BAD_FORMAT: msg = "bad format"; break;
case ERR_BAD_LENGTH: msg = "length less than min"; break;
+ case ERR_SDR_MALFORMED: msg = "an SDR is malformed"; break;
default:
sprintf(msgbuf,"error %d",rv);
msg = msgbuf;
diff --git a/util/ipmicmd.h b/util/ipmicmd.h
index 989cd8d..5c41151 100644
--- a/util/ipmicmd.h
+++ b/util/ipmicmd.h
@@ -245,6 +245,7 @@ struct oemvalstr {
#define SEV_CRIT 3
/* Errors returned by ipmiutil functions, lan, etc, see decode_rv() */
+#define ERR_SDR_MALFORMED -25 /*SDR is malformed */
#define ERR_BAD_LENGTH -24 /*length < MIN */
#define ERR_BAD_FORMAT -23 /*bad format*/
#define ERR_USAGE -22 /*usage/help requested*/
@@ -542,7 +543,7 @@ int str2uchar(char *str_in, uchar *uchr_out);
uchar atob(char *str_in); /* calls str2uchar*/
void atoip(uchar *array,char *instr);
int get_system_info(uchar parm, char *pbuf, int *szbuf); /*subs.c*/
-int set_system_info(uchar parm, uchar *pbuf, int szbuf); /*subs.c*/
+int set_system_info(uchar parm, char *pbuf, int szbuf); /*subs.c*/
int ipmi_reserved_user(int vend, int userid); /*subs.c*/
/* from mem_if.c */
diff --git a/util/ipmilan.c b/util/ipmilan.c
index 1f5b949..acea438 100644
--- a/util/ipmilan.c
+++ b/util/ipmilan.c
@@ -352,8 +352,10 @@ static uchar g_Cipher[ 16 ][ 16 ]; /*SeedCount x CipherHash for SOL 1.5*/
#ifdef WIN32
int econnrefused = WSAECONNREFUSED; /*=10061.*/
+int econnreset = WSAECONNRESET; /*=10054.*/
#else
int econnrefused = ECONNREFUSED; /*=111. from Linux asm/errno.h */
+int econnreset = ECONNRESET; /*=104.*/
#endif
#ifdef WIN32
@@ -1232,7 +1234,7 @@ static int _send_lan_cmd(SockType s, uchar *pcmd, int scmd, uchar *presp,
fprintf(fpdbg,"ipmilan_cmd timeout, after request, seq=%x itry=%d\n",
phdr->seq_num, itry);
rv = LAN_ERR_RECV_FAIL;
- if (fdopoke2) ipmilan_poke2(s, to, tolen);
+ if (fdopoke2) ipmilan_poke2(s, to, tolen);
os_usleep(0,5000);
continue; /* retry */
}
@@ -1243,14 +1245,15 @@ static int _send_lan_cmd(SockType s, uchar *pcmd, int scmd, uchar *presp,
if (fdebuglan) {
fprintf(fpdbg,"ipmilan_recvfrom rlen=%d, err=%d iseq=%x itry=%d\n",
rlen,lasterr,phdr->iseq_num,itry);
- show_LastError("ipmilan_recvfrom",lasterr);
- }
- rv = rlen; /* -3 = LAN_ERR_RECV_FAIL */
- rlen = 0;
+ show_LastError("ipmilan_recvfrom",lasterr);
+ }
+ rv = rlen; /* -3 = LAN_ERR_RECV_FAIL */
+ rlen = 0;
*sresp = rlen;
/* Sometimes the OS sends an ECONNREFUSED error, but
* retrying will catch the BMC's reply packet. */
if (lasterr == econnrefused) continue; /*try again*/
+ else if (lasterr == econnreset) continue; /*try again*/
else break; /* goto EXIT; */
} else { /* successful receive */
net2h(&phdr->iseq_num,&rbuf[5],4); /*incoming seq_num from hdr*/
diff --git a/util/ipmimv.c b/util/ipmimv.c
index accda41..8962ef5 100644
--- a/util/ipmimv.c
+++ b/util/ipmimv.c
@@ -241,6 +241,23 @@ static void dbgmsg(char *pattn, ...)
fflush( fpdbg );
}
+int set_cloexec(fd,fdebugcmd)
+{
+ int flags;
+ flags = fcntl(ipmi_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 (fdebugcmd) printf("fcntl(set) errno = %d\n",errno);
+ return -1;
+ }
+ return 0;
+}
+
int ipmi_open_mv(char fdebugcmd)
{
char *pdev;
@@ -285,6 +302,7 @@ int ipmi_open_mv(char fdebugcmd)
}
}
+ set_cloexec(ipmi_fd,fdebugcmd);
if (fdebugcmd) {
dbgmsg("ipmi_open_mv: successfully opened %s, fd=%d\n",pdev,ipmi_fd);
}
diff --git a/util/ipmiutil.c b/util/ipmiutil.c
index 4c04956..765f5e6 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 = "2.98";
+static char *progver = "2.99";
// static char fdebug = 0;
/*int ipmiutil(int argc, char **argv); */
diff --git a/util/ireset.c b/util/ireset.c
index a796393..e95b597 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 = "2.98";
+static char * progver = "2.99";
static char * progname = "ireset";
static uchar ipmi_maj;
static uchar ipmi_min;
@@ -242,10 +242,10 @@ int set_boot_init_string(char *istr)
idata[2] = iana[0];
idata[3] = iana[1];
idata[4] = iana[2];
- strncpy(&idata[5],&istr[n],13);
+ strncpy((char *)&idata[5],&istr[n],13);
n += 13;
} else {
- strncpy(&idata[2],&istr[n],16);
+ strncpy((char *)&idata[2],&istr[n],16);
n += 16;
}
rlen = MAX_BUFFER_SIZE;
diff --git a/util/isel.c b/util/isel.c
index 04c7c97..a6058e6 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 = "2.98";
+static char *progver = "2.99";
#ifdef WIN32
#define IDXFILE "sel.idx"
static char idxfile[80] = IDXFILE;
diff --git a/util/iseltime.c b/util/iseltime.c
index 9b74231..687db22 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 = "2.98";
+static char * progver = "2.99";
static char * progname = "iseltime";
static char fdebug = 0;
static char fset = 0;
diff --git a/util/isensor.c b/util/isensor.c
index 6aaf3fb..a8694f9 100644
--- a/util/isensor.c
+++ b/util/isensor.c
@@ -247,7 +247,7 @@ char *decode_entity_id(int id) {
* Global Data
************************/
static char *progname = "isensor";
-static char *progver = "2.98";
+static char *progver = "2.99";
#ifdef WIN32
static char savefile[] = "%ipmiutildir%\\thresholds.cmd";
#else
@@ -277,6 +277,7 @@ static int fgetmem = 0;
static int fprivset = 0;
static char fremote = 0;
static int nloops = 1; /* num times to show repeated sensor readings */
+static int loopsec = 1; /* wait N sec between loops, default 1 */
static char bdelim = BDELIM; /* delimiter for canonical output */
static char tmpstr[20]; /* temp string */
static char *binfile = NULL;
@@ -1298,7 +1299,8 @@ int GetSDR(int r_id, int *r_next, uchar *recdata, int srecdata, int *rlen)
if (sresp >= 2) thislen = sresp - 2;
else thislen = 0;
reclen = off + thislen; /* truncate, stop reading */
- fprintf(stderr,"SDR record %x is malformed, length %d is less than minimum %d\n",sresp,thislen+2);
+ fprintf(stderr,"SDR record %x is malformed, length %d is less than minimum %d\n",r_id,sresp,thislen+2);
+ rc = ERR_SDR_MALFORMED;
}
/* successful */
memcpy(&resp[off],&respchunk[2],thislen);
@@ -1342,7 +1344,7 @@ int get_sdr_file(char *sdrfile, uchar **sdrlist)
FILE *fp = NULL;
int i, n, num, nsdr, isdr, len;
uchar *sdrbuf;
- uchar buff[255];
+ char buff[255];
uchar hbuf[85];
char fvalid;
@@ -1468,7 +1470,7 @@ int find_nsdrs(uchar *pcache)
ulong asz = 0;
int i, len;
uchar *sdr;
- ushort recid;
+ ushort recid = 0;
if (pcache == NULL) return(num);
for (i = 0; (int)asz < sz_sdrs; i++)
@@ -1559,7 +1561,7 @@ int find_sdr_by_tag(uchar *psdr, uchar *pcache, char *tag, uchar dbg)
printf("sdr[%d] idx=%02x%02x num=%x tag: %s\n",i,sdr[1],sdr[0],
sdr[7],tmp);
}
- if (strncmp(tag,&sdr[k],n) == 0) {
+ if (strncmp(tag,(char *)&sdr[k],n) == 0) {
memcpy(psdr,sdr,len);
return(0);
}
@@ -2499,7 +2501,7 @@ ShowSDR(char *tag, uchar *sdr)
idstr[ilen] = 0; /* stringify */
if ((sdr01->sens_capab & 0x40) == 0) brearm = 'm'; /*manual rearm*/
else brearm = 'a'; /*automatic rearm*/
- if (fdebug) printf("entity %d.%d, idlen=%d sizeof=%d idstr0=%c s0=%x\n",
+ if (fdebug) printf("entity %d.%d, idlen=%d sizeof=%lu idstr0=%c s0=%x\n",
sdr01->entity_id, sdr01->entity_inst,
ilen,sizeof(SDR01REC),idstr[0],sdr[ioff]);
rc = GetSensorReading(sdr01->sens_num,sdr01,sens);
@@ -2508,7 +2510,7 @@ ShowSDR(char *tag, uchar *sdr)
val = 0;
if (rc == 0xCB) { /*sensor not present*/
i = 10; /* Absent */
- typestr = "na";
+ typestr = "na";
} else typestr = decode_rv(rc);
} else {
j = (sens[2] & 0x3f); /*sensor reading state*/
@@ -2518,6 +2520,10 @@ ShowSDR(char *tag, uchar *sdr)
sens[2],i,sens[0],sens[1],sdr01->sens_base,
sdr01->sens_units);
if ((sens[1] & 0x20) != 0) { i = 7; val = 0; } /* Init state */
+ else if (sens[2] == 0xc7) { i = 10; val = 0; /* Absent (Intel) */
+ if (fdebug) printf("sensor[%x] is absent (c7), no reading\n",
+ sdr01->sens_num);
+ }
else val = RawToFloat(sens[0],sdr);
typestr = get_unit_type(sdr01->sens_units, sdr01->sens_base,
sdr01->sens_mod, fsimple);
@@ -2616,7 +2622,7 @@ ShowSDR(char *tag, uchar *sdr)
idstr[ilen] = 0; /* stringify */
if ((sdr02->sens_capab & 0x40) == 0) brearm = 'm'; /*manual rearm*/
else brearm = 'a'; /*automatic rearm*/
- if (fdebug) printf("ilen=%d, istr0=%c, sizeof=%d, s0=%x\n",
+ if (fdebug) printf("ilen=%d, istr0=%c, sizeof=%lu, s0=%x\n",
ilen,idstr[0],sizeof(SDR02REC),sdr[ioff]);
memset(sens,0,sizeof(sens));
rc = GetSensorReading(sdr02->sens_num,sdr02,sens);
@@ -2792,7 +2798,7 @@ ShowSDR(char *tag, uchar *sdr)
if (ilen >= sizeof(idstr)) ilen = sizeof(idstr) - 1;
memcpy(idstr,&sdr[ioff],ilen);
idstr[ilen] = 0; /* stringify */
- if (fdebug) printf("ilen=%d, istr0=%c, sizeof=%d, s0=%x\n",
+ if (fdebug) printf("ilen=%d, istr0=%c, sizeof=%lu, s0=%x\n",
ilen,idstr[0],sizeof(SDR11REC),sdr[ioff]);
printf("%s", tag);
if (fsimple)
@@ -2822,7 +2828,7 @@ ShowSDR(char *tag, uchar *sdr)
if (ilen >= sizeof(idstr)) ilen = sizeof(idstr) - 1;
memcpy(idstr,&sdr[ioff],ilen);
idstr[ilen] = 0; /* stringify */
- if (fdebug) printf("ilen=%d, istr0=%c, sizeof=%d, s0=%x\n",
+ if (fdebug) printf("ilen=%d, istr0=%c, sizeof=%lu, s0=%x\n",
ilen,idstr[0],sizeof(SDR12REC),sdr[ioff]);
printf("%s", tag);
if (fsimple)
@@ -2986,6 +2992,31 @@ static int get_filesize(char *fileName, ulong *psize)
}
#endif
+int write_sdr_binfile(char *binfile)
+{
+ uchar *pbuf = NULL;
+ FILE *fp;
+ int len, ret;
+ ret = get_sdr_cache(&pbuf); /* sets nsdrs, sz_sdrs */
+ if (ret == 0) {
+ fp = fopen(binfile,"wb");
+ if (fp == NULL) {
+ ret = get_LastError();
+ printf("Cannot open file %s for writing, error %d\n",binfile,ret);
+ } else {
+ printf("Writing SDR size %d to %s ...\n",sz_sdrs,binfile);
+ len = (int)fwrite(pbuf, 1, sz_sdrs, fp);
+ fclose(fp);
+ if (len <= 0) {
+ ret = get_LastError();
+ printf("Error %d writing file %s\n",ret,binfile);
+ } else ret = 0;
+ }
+ free_sdr_cache(pbuf);
+ }
+ return(ret);
+}
+
int read_sdr_binfile(char *binfile, uchar **pbufret, int *buflen)
{
uchar *pbuf = NULL;
@@ -3006,9 +3037,9 @@ int read_sdr_binfile(char *binfile, uchar **pbufret, int *buflen)
#endif
fp = fopen(binfile,"rb");
if (fp == NULL) {
- ret = get_LastError();
- printf("Cannot open file %s, error %d\n",binfile,ret);
- return(ret);
+ ret = get_LastError();
+ printf("Cannot open file %s, error %d\n",binfile,ret);
+ return(ret);
}
fseek(fp, 0L, SEEK_SET);
#ifndef WIN32
@@ -3030,29 +3061,29 @@ int read_sdr_binfile(char *binfile, uchar **pbufret, int *buflen)
pbuf = malloc(len);
if (fdebug) printf("sdr_binfile: malloc(%d) pbuf=%p\n",len,pbuf);
if (pbuf == NULL) {
- ret = -1;
- fclose(fp);
- return(ret);
+ ret = -2;
+ fclose(fp);
+ return(ret);
}
psdrcache = pbuf;
/*ok, so proceed with restore*/
ret = 0;
len = (int)fread(pbuf, 1, sz_sdrs, fp);
if (len <= 0) {
- ret = get_LastError();
- printf("Error %d reading file %s\n",ret,binfile);
- sz_sdrs = 0; /*for safety*/
+ ret = get_LastError();
+ printf("Error %d reading file %s\n",ret,binfile);
+ sz_sdrs = 0; /*for safety*/
} else if (len < sz_sdrs) {
- /* Show error if this happens in Windows */
- ret = get_LastError();
- printf("truncated fread(%s): attempted %d, got %d, error %d\n",
- binfile,sz_sdrs,len,ret);
+ /* Show error if this happens in Windows */
+ ret = get_LastError();
+ printf("truncated fread(%s): attempted %d, got %d, error %d\n",
+ binfile,sz_sdrs,len,ret);
ret = 0; /*try to keep going*/
}
fclose(fp);
if (fdebug) {
- printf("SDR buffer from file (len=%d,sz=%d)\n",len,sz_sdrs);
- dump_buf("SDR buffer",pbuf,len,1);
+ printf("SDR buffer from file (len=%d,sz=%d)\n",len,sz_sdrs);
+ dump_buf("SDR buffer",pbuf,len,1);
}
*pbufret = pbuf;
*buflen = len;
@@ -3086,7 +3117,7 @@ int i_sensor(int argc, char **argv)
printf("%s: version %s\n",progname,progver);
- while ( (c = getopt( argc, argv,"a:bcd:ef:g:h:i:j:l:m:n:opqrstu:vwxT:V:J:L:EYF:P:N:R:U:Z:?")) != EOF )
+ while ( (c = getopt( argc, argv,"a:bcd:ef:g:h:i:j:k:l:m:n:opqrstu:vwxT:V:J:L:EYF:P:N:R:U:Z:?")) != EOF )
switch(c) {
case 'a': /* reArm sensor number N */
if (strncmp(optarg,"0x",2) == 0) frearm = htoi(&optarg[2]);
@@ -3116,11 +3147,7 @@ int i_sensor(int argc, char **argv)
break;
case 'j': fjumpstart = 1; /* Load SDR cache from a file*/
binfile = optarg; break;
- case 't': fshowthr = 1; break;
- case 'v': fshowthr = 1; sens_verbose = 1; break;
- case 'p': fsavethresh = 1; break;
- case 'q': fshowthr = 2; fwrap = 1; break;
- case 'r': frawsdr = 1; break;
+ case 'k': loopsec = atoi(optarg); break; /*N sec between loops*/
case 'm': /* specific MC, 3-byte address, e.g. "409600" */
g_bus = htoi(&optarg[0]); /*bus/channel*/
g_sa = htoi(&optarg[2]); /*device slave address*/
@@ -3161,6 +3188,11 @@ int i_sensor(int argc, char **argv)
fsetthresh = 2; /*indicates float conversion*/
}
break;
+ case 'p': fsavethresh = 1; break;
+ case 'q': fshowthr = 2; fwrap = 1; break;
+ case 'r': frawsdr = 1; break;
+ case 't': fshowthr = 1; break;
+ case 'v': fshowthr = 1; sens_verbose = 1; break;
case 'u': /* specify unique thresholds in hex or float */
/* raw hex format: 0xLNLCLUHNHCHU, all 6 required */
if (strncmp(optarg,"0x",2) == 0) { /*raw hex thresholds*/
@@ -3246,8 +3278,9 @@ int i_sensor(int argc, char **argv)
// printf(" -f file Restore SDRs from a binary dump file\n");
printf(" -g fan show only this sensor type group\n");
printf(" -h tval specifies the Highest threshold to set\n");
- printf(" -i id only show these sensor ids\n");
+ printf(" -i id only show these sensor id numbers\n");
printf(" -j file Jump-start SDR cache from a binary file\n");
+ printf(" -k K If -L, wait K sec between loops (default=1)\n");
printf(" -l tval specifies the Lowest threshold to set\n");
printf(" -m002000 specific MC (bus 00,sa 20,lun 00)\n");
printf(" -n snum specifies the sensor Number to set hi/lo\n");
@@ -3260,7 +3293,7 @@ int i_sensor(int argc, char **argv)
printf(" -u thr set Unique threshold values (e.g. 3:2:1:48:49:50)\n");
printf(" -v Verbose: thresholds, max/min, hysteresis\n");
printf(" -w Wrap thresholds on sensor line\n");
- printf(" -L n Loop n times\n");
+ printf(" -L n Loop n times every k seconds (default k=1)\n");
print_lan_opt_usage(0);
ret = ERR_USAGE;
goto do_exit;
@@ -3374,26 +3407,7 @@ int i_sensor(int argc, char **argv)
}
if (fdump) {
- uchar *pbuf = NULL;
- FILE *fp;
- int len;
- ret = get_sdr_cache(&pbuf);
- if (ret == 0) {
- fp = fopen(binfile,"wb");
- if (fp == NULL) {
- ret = get_LastError();
- printf("Cannot open file %s, error %d\n",binfile,ret);
- } else {
- printf("Writing SDR size %d to %s ...\n",sz_sdrs,binfile);
- len = (int)fwrite(pbuf, 1, sz_sdrs, fp);
- fclose(fp);
- if (len <= 0) {
- ret = get_LastError();
- printf("Error %d writing file %s\n",ret,binfile);
- } else ret = 0;
- }
- free_sdr_cache(pbuf);
- }
+ ret = write_sdr_binfile(binfile);
goto do_exit;
} /*endif fdump*/
@@ -3405,25 +3419,25 @@ int i_sensor(int argc, char **argv)
ret = read_sdr_binfile(binfile,&pbuf,&slen);
if (ret == 0) { /*successful, so write SDRs */
- nsdrs = find_nsdrs(pbuf);
- printf("Ready to restore %d SDRs\n",nsdrs);
- set_reserve(1);
- ret = sdr_clear_repo(fdevsdrs);
- if (ret != 0) {
- printf("SDR Clear Repository error %d\n",ret);
- goto do_exit;
- }
- id = 0;
- while(find_sdr_next(sdr,pbuf,id) == 0) {
- id = sdr[0] + (sdr[1] << 8);
- if (fdebug) printf("adding SDR[%x]\n",id);
- set_reserve(1);
- ret = sdr_add_record(sdr,fdevsdrs);
- if (ret != 0) {
- printf("SDR[%x] add error %d\n",id,ret);
- break;
- }
- } /*end while sdr*/
+ nsdrs = find_nsdrs(pbuf);
+ printf("Ready to restore %d SDRs\n",nsdrs);
+ set_reserve(1);
+ ret = sdr_clear_repo(fdevsdrs);
+ if (ret != 0) {
+ printf("SDR Clear Repository error %d\n",ret);
+ goto do_exit;
+ }
+ id = 0;
+ while(find_sdr_next(sdr,pbuf,id) == 0) {
+ id = sdr[0] + (sdr[1] << 8);
+ if (fdebug) printf("adding SDR[%x]\n",id);
+ set_reserve(1);
+ ret = sdr_add_record(sdr,fdevsdrs);
+ if (ret != 0) {
+ printf("SDR[%x] add error %d\n",id,ret);
+ break;
+ }
+ } /*end while sdr*/
}
if (ret == 0) printf("Restored %d SDRs successfully.\n",nsdrs);
free_sdr_cache(pbuf); /* does nothing if (pbuf == NULL) */
@@ -3434,12 +3448,19 @@ int i_sensor(int argc, char **argv)
uchar *pbuf = NULL;
int slen;
ret = read_sdr_binfile(binfile,&pbuf,&slen);
- if (ret != 0) fjumpstart = 0; /* use normal method if error*/
- else { /* set this as the SDR cache */
- psdrcache = pbuf;
- sz_sdrs = slen;
- nsdrs = find_nsdrs(pbuf);
- if (fdebug) printf("jumpstart cache: nsdrs=%d size=%d\n",nsdrs,slen);
+ if (ret != 0) {
+ /* Try to dump sdrs to this file if not there */
+ ret = write_sdr_binfile(binfile);
+ if (ret == 0)
+ ret = read_sdr_binfile(binfile,&pbuf,&slen);
+ if (ret != 0) {
+ fjumpstart = 0; /*cannot do jumpstart*/
+ }
+ } else { /* set this as the SDR cache */
+ psdrcache = pbuf;
+ sz_sdrs = slen;
+ nsdrs = find_nsdrs(pbuf);
+ if (fdebug) printf("jumpstart cache: nsdrs=%d size=%d\n",nsdrs,slen);
}
} /*endif fjumpstart*/
@@ -3493,9 +3514,9 @@ int i_sensor(int argc, char **argv)
printf("GetSDR[%04x]: ret = %x, next=%x\n",recid,ret,recnext);
if (ret != 0) {
if (ret > 0) { /* ret is a completion code error */
- fprintf(stderr,"%04x GetSDR error 0x%02x %s, rlen=%d\n",
+ fprintf(stderr,"%04x GetSDR error 0x%02x %s, rlen=%d\n",
recid,ret,decode_cc((ushort)0,(uchar)ret),sz);
- if (ret == 0xC5) { /* lost Reservation ID, retry */
+ if (ret == 0xC5) { /* lost Reservation ID, retry */
/* This means that some other IPMI software has
* requested a Reservation before we finished, so
* we need to refresh the Reservation ID * retry. */
@@ -3504,11 +3525,12 @@ int i_sensor(int argc, char **argv)
if (fdebug)
printf("GetSDR[%04x]: ret = %x, next=%x\n",recid,ret,
recnext);
- }
+ if (ret == 0xC5) sz = 0; /*failed to get Reservation ID*/
+ }
} else fprintf(stderr,"%04x GetSDR error %d, rlen = %d\n",
- recid,ret,sz);
+ recid,ret,sz);
if (sz < MIN_SDR_SZ) { /* don't have recnext, so abort */
- break;
+ break;
} /* else fall through & continue */
}
} /*end-else*/
@@ -3662,6 +3684,7 @@ int i_sensor(int argc, char **argv)
} /*endif ok, got full SDR */
NextSdr:
+ if (ret == ERR_SDR_MALFORMED) break;
if (fjumpstart) recid = recnext;
else {
if (recnext == recid) recid = 0xffff; /*break;*/
@@ -3674,8 +3697,8 @@ NextSdr:
irec++;
} /*end while recid*/
if (fdoloop && (nloops > 1)) {
- printf("\n"); /* output an empty separator line */
- os_usleep(1,0); /*delay 1 sec between loops*/
+ printf("\n"); /* output an empty separator line */
+ os_usleep(loopsec,0); /*delay 1 sec between loops*/
}
} /*end for nloops*/
diff --git a/util/iserial.c b/util/iserial.c
index d4fd427..c34d10c 100644
--- a/util/iserial.c
+++ b/util/iserial.c
@@ -155,7 +155,7 @@ typedef struct
/*
* Global variables
*/
-static char * progver = "2.98";
+static char * progver = "2.99";
static char * progname = "iserial";
static int vend_id = 0;
static int prod_id = 0;
diff --git a/util/isol.c b/util/isol.c
index d141452..d76f10d 100644
--- a/util/isol.c
+++ b/util/isol.c
@@ -165,7 +165,7 @@ void dbglog( char *pattn, ... ); /*local prototype*/
/*
* Global variables
*/
-static char * progver = "2.98";
+static char * progver = "2.99";
static char * progname = "isol";
static char fdebug = 0;
static char fpicmg = 0;
diff --git a/util/itsol.c b/util/itsol.c
index 9aad458..410ce7f 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 = "2.98";
+static char * progver = "2.99";
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 552867d..bd06e0c 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 = "2.98";
+static char * progver = "2.99";
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 e700ebd..4fa7e5f 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 = "2.98";
+static char * progver = "2.99";
static char * progname = "idelloem";
static int verbose = 0;
static char fdebug = 0;
@@ -399,7 +399,7 @@ ipmi_delloem_password_policy(void * intf, int argc, char ** argv)
{
int rv = 0;
int rsp_len;
- struct ipmi_rq req = {0};
+ struct ipmi_rq req;
uint8_t data[4];
uint8_t rsp[IPMI_RSPBUF_SIZE];
uint8_t bval;
@@ -889,7 +889,7 @@ ipmi_lcd_get_platform_model_name (void * intf,
{
uint8_t rsp[IPMI_RSPBUF_SIZE];
int rsp_len, rv;
- struct ipmi_rq req = {0};
+ struct ipmi_rq req;
uint8_t data[4];
IPMI_DELL_LCD_STRING * lcdstringblock;
int lcdstring_len = 0;
@@ -967,7 +967,7 @@ ipmi_idracvalidator_command (void * intf)
{
uint8_t rsp[IPMI_RSPBUF_SIZE];
int rsp_len, rv;
- struct ipmi_rq req = {0};
+ struct ipmi_rq req;
uint8_t data[4];
memset (&req,0,sizeof(req));
@@ -1024,7 +1024,7 @@ ipmi_lcd_get_configure_command_wh (void * intf)
{
uint8_t rsp[IPMI_RSPBUF_SIZE];
int rsp_len, rv;
- struct ipmi_rq req = {0};
+ struct ipmi_rq req;
uint8_t data[4];
req.msg.netfn = IPMI_NETFN_APP;
@@ -1068,7 +1068,7 @@ ipmi_lcd_get_configure_command (void * intf,
{
uint8_t rsp[IPMI_RSPBUF_SIZE];
int rsp_len, rv;
- struct ipmi_rq req = {0};
+ struct ipmi_rq req;
uint8_t data[4];
req.msg.netfn = IPMI_NETFN_APP;
@@ -1114,7 +1114,7 @@ ipmi_lcd_set_configure_command (void * intf, int command)
uint8_t rsp[IPMI_RSPBUF_SIZE];
int rsp_len, rv;
- struct ipmi_rq req = {0};
+ struct ipmi_rq req;
uint8_t data[2];
req.msg.netfn = IPMI_NETFN_APP;
@@ -1159,7 +1159,7 @@ ipmi_lcd_set_configure_command_wh (void * intf,
uint8_t rsp[IPMI_RSPBUF_SIZE];
int rsp_len, rv;
- struct ipmi_rq req = {0};
+ struct ipmi_rq req;
uint8_t data[13];
ipmi_lcd_get_configure_command_wh(intf);
@@ -1248,7 +1248,7 @@ ipmi_lcd_get_single_line_text (void * intf, char* lcdstring, uint8_t max_length)
{
uint8_t rsp[IPMI_RSPBUF_SIZE];
int rsp_len, rv;
- struct ipmi_rq req = {0};
+ struct ipmi_rq req;
uint8_t data[4];
IPMI_DELL_LCD_STRING * lcdstringblock;
int lcdstring_len = 0;
@@ -1322,7 +1322,7 @@ ipmi_lcd_get_info_wh(void * intf)
{
uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv;
- struct ipmi_rq req = {0};
+ struct ipmi_rq req;
uint8_t data[4];
uint8_t command = 0;
IPMI_DELL_LCD_CAPS* lcd_caps;
@@ -1449,7 +1449,7 @@ ipmi_lcd_get_info_wh(void * intf)
static int ipmi_lcd_get_info(void * intf)
{
uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv;
- struct ipmi_rq req = {0};
+ struct ipmi_rq req;
uint8_t data[4];
IPMI_DELL_LCD_CAPS * lcd_caps;
uint8_t command = 0;
@@ -1531,7 +1531,7 @@ static int
ipmi_lcd_get_status_val(void * intf, LCD_STATUS* lcdstatus)
{
uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv;
- struct ipmi_rq req = {0};
+ struct ipmi_rq req;
uint8_t data[4];
@@ -1588,7 +1588,7 @@ static int IsLCDSupported ()
static void CheckLCDSupport(void * intf)
{
uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv;
- struct ipmi_rq req = {0};
+ struct ipmi_rq req;
uint8_t data[4];
LcdSupported = 0;
@@ -1695,7 +1695,7 @@ ipmi_lcd_set_kvm(void * intf, char status)
LCD_STATUS lcdstatus;
int rc=0;
uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv;
- struct ipmi_rq req = {0};
+ struct ipmi_rq req;
uint8_t data[5];
rc=ipmi_lcd_get_status_val(intf,&lcdstatus);
if (rc < 0)
@@ -1737,7 +1737,7 @@ ipmi_lcd_set_lock(void * intf, char lock)
LCD_STATUS lcdstatus;
int rc =0;
uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv;
- struct ipmi_rq req = {0};
+ struct ipmi_rq req;
uint8_t data[5];
rc=ipmi_lcd_get_status_val(intf,&lcdstatus);
if (rc < 0)
@@ -1777,7 +1777,7 @@ static int
ipmi_lcd_set_single_line_text (void * intf, char * text)
{
uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv;
- struct ipmi_rq req = {0};
+ struct ipmi_rq req;
uint8_t data[18];
int bytes_to_store = strlen_(text);
int bytes_stored = 0;
@@ -1858,7 +1858,7 @@ ipmi_lcd_set_text(void * intf, char * text, int line_number)
int rc = 0;
uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv;
- struct ipmi_rq req = {0};
+ struct ipmi_rq req;
uint8_t data[4];
IPMI_DELL_LCD_CAPS * lcd_caps;
@@ -3431,7 +3431,7 @@ static int
ipmi_get_power_capstatus_command (void * intf)
{
uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv;
- struct ipmi_rq req = {0};
+ struct ipmi_rq req;
uint8_t data[2];
req.msg.netfn = IPMI_DELL_OEM_NETFN;
@@ -3473,7 +3473,7 @@ static int
ipmi_set_power_capstatus_command (void * intf,uint8_t val)
{
uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv;
- struct ipmi_rq req = {0};
+ struct ipmi_rq req;
uint8_t data[2];
if(ipmi_get_power_capstatus_command(intf) < 0)
return -1;
@@ -3767,7 +3767,7 @@ static uint32_t btuphr_to_watt_conversion(uint64_t powerinbtuphr)
static int ipmi_get_power_headroom_command (void * intf,uint8_t unit)
{
uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv;
- struct ipmi_rq req = {0};
+ struct ipmi_rq req;
uint64_t peakpowerheadroombtuphr;
uint64_t instantpowerhearoom;
@@ -3809,8 +3809,8 @@ static int ipmi_get_power_headroom_command (void * intf,uint8_t unit)
}
else
{
- printf ("System Instantaneous Headroom : %ld W\n",powerheadroom.instheadroom);
- printf ("System Peak Headroom : %ld W\n",powerheadroom.peakheadroom);
+ printf ("System Instantaneous Headroom : %d W\n",powerheadroom.instheadroom);
+ printf ("System Peak Headroom : %d W\n",powerheadroom.peakheadroom);
}
return 0;
@@ -3926,7 +3926,7 @@ static int ipmi_get_instan_power_consmpt_data(void* intf,
{
uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv;
- struct ipmi_rq req={0};
+ struct ipmi_rq req;
uint8_t msg_data[2];
@@ -4056,7 +4056,7 @@ static int ipmi_print_get_power_consmpt_data(void* intf,uint8_t unit)
static int ipmi_get_avgpower_consmpt_history(void* intf,IPMI_AVGPOWER_CONSUMP_HISTORY* pavgpower )
{
uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv;
- struct ipmi_rq req = {0};
+ struct ipmi_rq req;
uint8_t data[4];
req.msg.netfn = IPMI_NETFN_APP;
@@ -4114,7 +4114,7 @@ static int ipmi_get_peakpower_consmpt_history(void* intf,IPMI_POWER_CONSUMP_HIST
{
uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv;
- struct ipmi_rq req = {0};
+ struct ipmi_rq req;
uint8_t data[4];
req.msg.netfn = IPMI_NETFN_APP;
@@ -4180,7 +4180,7 @@ static int ipmi_get_minpower_consmpt_history(void* intf,IPMI_POWER_CONSUMP_HISTO
{
uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv;
- struct ipmi_rq req = {0};
+ struct ipmi_rq req;
uint8_t data[4];
req.msg.netfn = IPMI_NETFN_APP;
@@ -4207,7 +4207,7 @@ static int ipmi_get_minpower_consmpt_history(void* intf,IPMI_POWER_CONSUMP_HISTO
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],
@@ -4401,7 +4401,7 @@ static int ipmi_print_power_consmpt_history(void* intf,int unit )
static int ipmi_get_power_cap(void* intf,IPMI_POWER_CAP* ipmipowercap )
{
uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv;
- struct ipmi_rq req={0};
+ struct ipmi_rq req;
//uint64_t tempbtuphrconv;
uint8_t data[4];
@@ -4505,7 +4505,7 @@ static int ipmi_print_power_cap(void* intf,uint8_t unit )
static int ipmi_set_power_cap(void* intf,int unit,int val )
{
uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv;
- struct ipmi_rq req={0};
+ struct ipmi_rq req;
uint8_t data[13];
uint16_t powercapval;
uint64_t maxpowerbtuphr;
@@ -4552,7 +4552,7 @@ static int ipmi_set_power_cap(void* intf,int unit,int val )
}
if (verbose > 1)
{
- printf("power cap Data :%x %x %x %x %x %x %x %x %x %x ",
+ printf("power cap Data :%x %x %x %x %x %x %x %x %x %x %x",
rsp[1], rsp[2], rsp[3],
rsp[4], rsp[5], rsp[6], rsp[7],
rsp[8], rsp[9], rsp[10],rsp[11]);
@@ -5142,7 +5142,7 @@ static int
CheckSetLEDSupport(void * intf)
{
uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv;
- struct ipmi_rq req = {0};
+ struct ipmi_rq req;
uint8_t data[10];
SetLEDSupported = 0;
@@ -5186,7 +5186,7 @@ static int
ipmi_getdrivemap(void * intf, int b, int d, int f, int *bay, int *slot)
{
uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv;
- struct ipmi_rq req = {0};
+ struct ipmi_rq req;
uint8_t data[8];
/* Get mapping of BDF to bay:slot */
@@ -5240,7 +5240,7 @@ static int
ipmi_setled_state (void * intf, int bayId, int slotId, int state)
{
uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv;
- struct ipmi_rq req = {0};
+ struct ipmi_rq req;
uint8_t data[20];
/* Issue Drive Status Update to bay:slot */
@@ -5278,7 +5278,7 @@ ipmi_setled_state (void * intf, int bayId, int slotId, int state)
int ipmi_delloem_getled_state (void * intf, uint8_t *state)
{
uint8_t rsp[IPMI_RSPBUF_SIZE]; int rsp_len, rv;
- struct ipmi_rq req = {0};
+ struct ipmi_rq req;
uint8_t data[2];
uint8_t led_state = 0;
diff --git a/util/oem_intel.c b/util/oem_intel.c
index f568300..638f08f 100644
--- a/util/oem_intel.c
+++ b/util/oem_intel.c
@@ -87,7 +87,7 @@ static char fRelayBits = 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;
#ifdef OLD
#ifdef WIN32
diff --git a/util/oem_kontron.c b/util/oem_kontron.c
index 263560f..259fbdc 100644
--- a/util/oem_kontron.c
+++ b/util/oem_kontron.c
@@ -931,7 +931,6 @@ int decode_sel_kontron(uint8_t *evt, char *outbuf, int outsz, char fdesc,
int sevid;
ushort genid;
uchar snum;
- int isdr = 0;
char *p1, *p2;
sevid = SEV_INFO;
diff --git a/util/oem_sun.c b/util/oem_sun.c
index 7ab480e..4f8e496 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 = "2.98";
+static char * progver = "2.99";
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 0c4a001..47838da 100644
--- a/util/oem_supermicro.c
+++ b/util/oem_supermicro.c
@@ -49,6 +49,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endif
#endif
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "ipmicmd.h"
@@ -66,7 +67,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 = "2.98";
+static char * progver = "2.99";
static char * progname = "ismcoem";
static int verbose = 0;
static char fdebug = 0;
@@ -426,34 +427,70 @@ int decode_sensor_supermicro(uchar *sdr,uchar *reading,char *pstring, int slen)
return(rv);
}
+#define NPAIRS 26
+char rgpair[NPAIRS] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int decode_mem_supermicro(int prod, uchar b2, uchar b3, char *desc, int *psz)
{
- int array, dimm, n;
+ int cpu, pair, dimm, n;
int rv = -1;
+ int ver = 0;
uchar bdata;
if ((desc == NULL) || (psz == NULL)) return -1;
- if (b2 == 0xff) bdata = b3; /*ff is reserved*/
- else bdata = b2; /* normal case */
- array = (bdata & 0xc0) >> 6;
+ if (b2 == 0xff) { ver = 1; bdata = b3; } /*ff is reserved*/
+ else { ver = 2; bdata = b2; } /* normal case */
+#ifdef SMC_OLD
+ /* normal method for other vendors */
+ cpu = (bdata & 0xc0) >> 6;
dimm = bdata & 0x3f;
+ /* SuperMicro advertised method (wrong) */
/* bdata = 0x10 (16.) means CPU 1, DIMM 6 */
- array = bdata / 10;
+ cpu = bdata / 10;
dimm = bdata % 10;
-
+#endif
#ifdef DMIOK
- /* Use DMI if we get confirmation about array/dimm indices. */
+ /* Use DMI if we get confirmation about cpu/dimm indices. */
if (! is_remote()) {
fsm_debug = fdebug;
- rv = get_MemDesc(array,dimm,desc,psz);
+ rv = get_MemDesc(cpu,dimm,desc,psz);
/* if (rv != 0) desc has "DIMM[%d}" */
}
#endif
-
- if (rv != 0) {
- n = sprintf(desc,"DIMM%d/CPU%d",dimm,array);
- *psz = n;
- rv = 0;
+ /* 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)
+ * There have been bugs in these SuperMicro events, but this
+ * has been derived from test data by comparing BIOS data. */
+ if (ver == 0) {
+ cpu = (bdata & 0xc0) >> 6;
+ dimm =bdata & 0x3f;
+ pair = 0;
+ n = sprintf(desc,"CPU%d/DIMM%d",cpu,dimm);
+ } else if (ver == 1) {
+ cpu = 1;
+ if (bdata > 0x80) cpu = 2;
+ pair = (bdata & 0x70) >> 4;
+ if (pair > NPAIRS) pair = NPAIRS - 1;
+ dimm = (bdata & 0x07) + 1; /*convert to 1-based*/
+ n = sprintf(desc,"P%d_DIMM%c%d",cpu,rgpair[pair],dimm);
+ } else {
+ /* ver 2 method: 2A 80 = P1_DIMMB1 */
+ /* SuperMicro says:
+ * pair: %c (data2 >> 4) + 0x40 + (data3 & 0x3) * 3, (='B')
+ * dimm: %c (data2 & 0xf) + 0x27,
+ * cpu: %x (data3 & 0x03) + 1);
+ */
+ cpu = (b3 & 0x0F) + 1; /*0x80=CPU1, 0x81=CPU2*/
+ pair = ((bdata & 0xF0) >> 4) - 1; /*0x10=pairA, 0x20=pairB*/
+ if (pair < 0) pair = 0;
+ if (pair > NPAIRS) pair = NPAIRS - 1;
+ dimm = (bdata & 0x0F) - 9; /*0x0A=dimmX1, 0x0B=dimmX2*/
+ n = sprintf(desc,"P%d_DIMM%c%d",cpu,rgpair[pair],dimm);
}
+ if (fdebug)
+ printf("decode_mem_supermicro: v%d bdata=%02x(%d) cpu=%d dimm=%d pair=%d\n",ver,bdata,bdata,cpu,dimm,pair);
+
+ *psz = n;
+ rv = 0;
return(rv);
} /*end decode_mem_supermicro*/
@@ -481,6 +518,7 @@ int decode_sel_supermicro(uchar *evt, char *outbuf, int outsz, char fdesc,
int sevid;
ushort genid;
uchar snum;
+ uchar data1, data2, data3;
fdebug = fdbg;
sevid = SEV_INFO;
@@ -489,13 +527,16 @@ int decode_sel_supermicro(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);
+ data1 = evt[13];
+ data2 = evt[14];
+ data3 = evt[15];
if (rectype == 0x02)
{
sprintf(mybuf,"%02x [%02x %02x %02x]", evt[12],evt[13],evt[14],evt[15]);
switch(evt[10]) { /*sensor type*/
- case 0xC0: /* CPU Temp Sensor */
+ case 0xC0: /* CPU Temp Sensor */
type_str = "OEM_CpuTemp";
- switch((evt[13] &0x0f)) { /*offset/data1 l.o. nibble*/
+ switch((evt[13] & 0x0f)) { /*offset/data1 l.o. nibble*/
case 0x02: /* CPU Temp Sensor Overheat event offset */
if (evt[12] & 0x80) { /*EvTyp==0xF0 if deassert*/
pstr = "CpuTemp Overheat OK"; sevid = SEV_INFO;
@@ -507,7 +548,7 @@ int decode_sel_supermicro(uchar *evt, char *outbuf, int outsz, char fdesc,
default: pstr = "CpuTemp Event"; break;
}
break;
- case 0xC2: /* CPLD Event */
+ case 0xC2: /* CPLD Event */
type_str = "OEM_CPLD";
switch((evt[13] & 0x0f)) { /* data1 usu 0xa0*/
case 0x00:
@@ -519,7 +560,20 @@ int decode_sel_supermicro(uchar *evt, char *outbuf, int outsz, char fdesc,
default: pstr = "CPLD Event"; break;
}
break;
- default: /*other sensor types*/
+ case 0xD0: /* BMC Event */
+ type_str = "OEM_BMC";
+ pstr = "BMC unknown event";
+ sevid = SEV_CRIT;
+ if (data1 == 0x80 && data3 == 0xFF) {
+ switch(data2) {
+ case 0x00: pstr = "BMC unexpected reset"; break;
+ case 0x01: pstr = "BMC cold reset"; break;
+ case 0x02: pstr = "BMC warm reset"; break;
+ }
+ }
+ break;
+ case 0xC8: /* Observed Event */
+ default: /*other sensor types*/
break;
}
}
diff --git a/util/subs.c b/util/subs.c
index 13e1603..135fcd9 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 43
+#define N_MFG 44
static struct { int val; char *pstr; } mfgs[N_MFG] = {
{0, " "},
{0x0000BA, "Toshiba"},
@@ -424,6 +424,7 @@ static struct { int val; char *pstr; } mfgs[N_MFG] = {
{ 7154, "IPMI forum"},
{ 11129, "Google"},
{ 12634, "PICMG"},
+ { 15370, "Giga-Byte"}, /*0x3C0A*/
{ 16394, "Pigeon Point"},
{ 20569, "Inventec ESC"},
{ 24673, "ServerEngines"},
@@ -608,7 +609,7 @@ static int sysinfo_has_len(uchar enc, int vendor)
return(rv);
}
-int get_device_guid(char *pbuf, int *szbuf)
+int get_device_guid(uchar *pbuf, int *szbuf)
{
int rv = -1;
//uchar idata[8];
@@ -668,7 +669,7 @@ int get_sysinfo(uchar parm, uchar set, uchar block, uchar *pbuf, int *szbuf)
return(rv);
}
-int set_system_info(uchar parm, uchar *pbuf, int szbuf)
+int set_system_info(uchar parm, char *pbuf, int szbuf)
{
uchar idata[32];
uchar rdata[8];