mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-11 19:17:22 +00:00
fix gcc4 + buildcheck compile problems
This commit is contained in:
parent
c65b206144
commit
21fb127ce2
@ -11,6 +11,7 @@ version 1.8.7
|
|||||||
* Add support for setting VLAN id and priority
|
* Add support for setting VLAN id and priority
|
||||||
* Add support for FreeBSD OpenIPMI-compatible driver
|
* Add support for FreeBSD OpenIPMI-compatible driver
|
||||||
* Add support for IPMIv2 Firmware Firewall
|
* Add support for IPMIv2 Firmware Firewall
|
||||||
|
* Fix gcc4 compile warnings
|
||||||
|
|
||||||
version 1.8.6
|
version 1.8.6
|
||||||
* Fix memory corruption when sending encrypted SOL traffic
|
* Fix memory corruption when sending encrypted SOL traffic
|
||||||
|
@ -104,7 +104,7 @@ static inline int bit_test(const unsigned char * bf, int n) {
|
|||||||
return !!(bf[n>>3]&(1<<(n%8)));
|
return !!(bf[n>>3]&(1<<(n%8)));
|
||||||
}
|
}
|
||||||
static inline void bit_set(unsigned char * bf, int n, int v) {
|
static inline void bit_set(unsigned char * bf, int n, int v) {
|
||||||
bf[n>>3] = bf[n>>3] & ~(1<<(n%8)) | (v?1:0)<<(n%8);
|
bf[n>>3] = (bf[n>>3] & ~(1<<(n%8))) | ((v?1:0)<<(n%8));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /*IPMI_FIREWALL_H */
|
#endif /*IPMI_FIREWALL_H */
|
||||||
|
@ -57,7 +57,7 @@ struct picmg_set_fru_activation_cmd {
|
|||||||
|
|
||||||
|
|
||||||
/* the LED color capabilities */
|
/* the LED color capabilities */
|
||||||
static const char* led_color_str[] = {
|
static const char* led_color_str[] __attribute__((unused)) = {
|
||||||
"reserved",
|
"reserved",
|
||||||
"BLUE",
|
"BLUE",
|
||||||
"RED",
|
"RED",
|
||||||
|
@ -148,7 +148,7 @@ print_valstr(const struct valstr * vs, const char * title, int loglevel)
|
|||||||
|
|
||||||
if (title != NULL) {
|
if (title != NULL) {
|
||||||
if (loglevel < 0)
|
if (loglevel < 0)
|
||||||
printf("\n%s:\n\n");
|
printf("\n%s:\n\n", title);
|
||||||
else
|
else
|
||||||
lprintf(loglevel, "\n%s:\n", title);
|
lprintf(loglevel, "\n%s:\n", title);
|
||||||
}
|
}
|
||||||
@ -197,7 +197,7 @@ print_valstr_2col(const struct valstr * vs, const char * title, int loglevel)
|
|||||||
|
|
||||||
if (title != NULL) {
|
if (title != NULL) {
|
||||||
if (loglevel < 0)
|
if (loglevel < 0)
|
||||||
printf("\n%s:\n\n");
|
printf("\n%s:\n\n", title);
|
||||||
else
|
else
|
||||||
lprintf(loglevel, "\n%s:\n", title);
|
lprintf(loglevel, "\n%s:\n", title);
|
||||||
}
|
}
|
||||||
|
@ -497,6 +497,8 @@ ipmi_chassis_get_bootparam(struct ipmi_intf * intf, char * arg)
|
|||||||
printf("Boot parameter %d is %s\n", rsp->data[1] & 0x7f,
|
printf("Boot parameter %d is %s\n", rsp->data[1] & 0x7f,
|
||||||
(rsp->data[1] & 0x80) ? "invalid/locked" : "valid/unlocked");
|
(rsp->data[1] & 0x80) ? "invalid/locked" : "valid/unlocked");
|
||||||
printf("Boot parameter data: %s\n", buf2str(rsp->data+2, rsp->data_len - 2));
|
printf("Boot parameter data: %s\n", buf2str(rsp->data+2, rsp->data_len - 2));
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
#include <ipmitool/ipmi_sdr.h>
|
#include <ipmitool/ipmi_sdr.h>
|
||||||
|
|
||||||
|
|
||||||
static int
|
static void
|
||||||
ipmi_event_msg_print(struct ipmi_intf * intf, struct platform_event_msg * pmsg)
|
ipmi_event_msg_print(struct ipmi_intf * intf, struct platform_event_msg * pmsg)
|
||||||
{
|
{
|
||||||
struct sel_event_record sel_event;
|
struct sel_event_record sel_event;
|
||||||
|
@ -555,7 +555,6 @@ _get_subfn_support(struct ipmi_intf * intf,
|
|||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs * rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
unsigned char rqdata[4];
|
unsigned char rqdata[4];
|
||||||
unsigned int c;
|
|
||||||
|
|
||||||
if (!p || !cmd) {
|
if (!p || !cmd) {
|
||||||
lprintf(LOG_ERR, "_get_subfn_support: p or cmd is NULL");
|
lprintf(LOG_ERR, "_get_subfn_support: p or cmd is NULL");
|
||||||
@ -603,7 +602,6 @@ _get_subfn_configurable(struct ipmi_intf * intf,
|
|||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs * rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
unsigned char rqdata[4];
|
unsigned char rqdata[4];
|
||||||
unsigned int c;
|
|
||||||
|
|
||||||
if (!p || !cmd) {
|
if (!p || !cmd) {
|
||||||
lprintf(LOG_ERR, "_get_subfn_configurable: p or cmd is NULL");
|
lprintf(LOG_ERR, "_get_subfn_configurable: p or cmd is NULL");
|
||||||
@ -651,7 +649,6 @@ _get_subfn_enables(struct ipmi_intf * intf,
|
|||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs * rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
unsigned char rqdata[4];
|
unsigned char rqdata[4];
|
||||||
unsigned int c;
|
|
||||||
|
|
||||||
if (!p || !cmd) {
|
if (!p || !cmd) {
|
||||||
lprintf(LOG_ERR, "_get_subfn_enables: p or cmd is NULL");
|
lprintf(LOG_ERR, "_get_subfn_enables: p or cmd is NULL");
|
||||||
@ -700,7 +697,7 @@ _set_subfn_enables(struct ipmi_intf * intf,
|
|||||||
{
|
{
|
||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs * rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
unsigned char * d, rqdata[8];
|
unsigned char rqdata[8];
|
||||||
unsigned int c;
|
unsigned int c;
|
||||||
|
|
||||||
if (!p || !cmd) {
|
if (!p || !cmd) {
|
||||||
@ -762,76 +759,78 @@ _set_subfn_enables(struct ipmi_intf * intf,
|
|||||||
*/
|
*/
|
||||||
static int _gather_info(struct ipmi_intf * intf, struct ipmi_function_params * p, struct bmc_fn_support * bmc)
|
static int _gather_info(struct ipmi_intf * intf, struct ipmi_function_params * p, struct bmc_fn_support * bmc)
|
||||||
{
|
{
|
||||||
int ret, i, l, n;
|
int ret, l, n;
|
||||||
unsigned char lun[MAX_LUN], netfn[16];
|
unsigned char lun[MAX_LUN], netfn[16];
|
||||||
|
|
||||||
ret = _get_netfn_support(intf, p->channel, lun, netfn);
|
ret = _get_netfn_support(intf, p->channel, lun, netfn);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
for (l=0; l<MAX_LUN; l++) {
|
for (l=0; l<MAX_LUN; l++) {
|
||||||
if (p->lun >= 0 && p->lun != l)
|
if (p->lun >= 0 && p->lun != l)
|
||||||
continue;
|
continue;
|
||||||
bmc->lun[l].support = lun[l];
|
bmc->lun[l].support = lun[l];
|
||||||
if (lun[l]) {
|
if (lun[l]) {
|
||||||
for (n=0; n<MAX_NETFN_PAIR; n++) {
|
for (n=0; n<MAX_NETFN_PAIR; n++) {
|
||||||
int offset = l*MAX_NETFN_PAIR+n;
|
int offset = l*MAX_NETFN_PAIR+n;
|
||||||
bmc->lun[l].netfn[n].support =
|
bmc->lun[l].netfn[n].support =
|
||||||
!!(netfn[offset>>3] & (1<<(offset%8)));
|
!!(netfn[offset>>3] & (1<<(offset%8)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (p->netfn >= 0) {
|
if (p->netfn >= 0) {
|
||||||
if (!((p->lun < 0 || bmc->lun[p->lun].support) &&
|
if (!((p->lun < 0 || bmc->lun[p->lun].support) &&
|
||||||
(p->netfn < 0 || bmc->lun[p->lun].netfn[p->netfn>>1].support))) {
|
(p->netfn < 0 || bmc->lun[p->lun].netfn[p->netfn>>1].support))) {
|
||||||
lprintf(LOG_ERR, "LUN or LUN/NetFn pair %d,%d not supported", p->lun, p->netfn);
|
lprintf(LOG_ERR, "LUN or LUN/NetFn pair %d,%d not supported", p->lun, p->netfn);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ret = _get_command_support(intf, p, &(bmc->lun[p->lun].netfn[p->netfn>>1]));
|
ret = _get_command_support(intf, p, &(bmc->lun[p->lun].netfn[p->netfn>>1]));
|
||||||
ret |= _get_command_configurable(intf, p, &(bmc->lun[p->lun].netfn[p->netfn>>1]));
|
ret |= _get_command_configurable(intf, p, &(bmc->lun[p->lun].netfn[p->netfn>>1]));
|
||||||
ret |= _get_command_enables(intf, p, &(bmc->lun[p->lun].netfn[p->netfn>>1]));
|
ret |= _get_command_enables(intf, p, &(bmc->lun[p->lun].netfn[p->netfn>>1]));
|
||||||
if (!ret && p->command >= 0) {
|
if (!ret && p->command >= 0) {
|
||||||
ret = _get_subfn_support(intf, p,
|
ret = _get_subfn_support(intf, p,
|
||||||
&(bmc->lun[p->lun].netfn[p->netfn>>1].command[p->command]));
|
&(bmc->lun[p->lun].netfn[p->netfn>>1].command[p->command]));
|
||||||
ret |= _get_subfn_configurable(intf, p,
|
ret |= _get_subfn_configurable(intf, p,
|
||||||
&(bmc->lun[p->lun].netfn[p->netfn>>1].command[p->command]));
|
&(bmc->lun[p->lun].netfn[p->netfn>>1].command[p->command]));
|
||||||
ret |= _get_subfn_enables(intf, p,
|
ret |= _get_subfn_enables(intf, p,
|
||||||
&(bmc->lun[p->lun].netfn[p->netfn>>1].command[p->command]));
|
&(bmc->lun[p->lun].netfn[p->netfn>>1].command[p->command]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (p->lun >= 0) {
|
else if (p->lun >= 0) {
|
||||||
l = p->lun;
|
l = p->lun;
|
||||||
if (bmc->lun[l].support) {
|
if (bmc->lun[l].support) {
|
||||||
for (n=0; n<MAX_NETFN_PAIR; n++) {
|
for (n=0; n<MAX_NETFN_PAIR; n++) {
|
||||||
p->netfn = n*2;
|
p->netfn = n*2;
|
||||||
if (bmc->lun[l].netfn[n].support) {
|
if (bmc->lun[l].netfn[n].support) {
|
||||||
ret = _get_command_support(intf, p, &(bmc->lun[l].netfn[n]));
|
ret = _get_command_support(intf, p, &(bmc->lun[l].netfn[n]));
|
||||||
ret |= _get_command_configurable(intf, p, &(bmc->lun[l].netfn[n]));
|
ret |= _get_command_configurable(intf, p, &(bmc->lun[l].netfn[n]));
|
||||||
ret |= _get_command_enables(intf, p, &(bmc->lun[l].netfn[n]));
|
ret |= _get_command_enables(intf, p, &(bmc->lun[l].netfn[n]));
|
||||||
}
|
}
|
||||||
if (ret)
|
if (ret)
|
||||||
bmc->lun[l].netfn[n].support = 0;
|
bmc->lun[l].netfn[n].support = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p->netfn = -1;
|
p->netfn = -1;
|
||||||
} else {
|
} else {
|
||||||
for (l=0; l<4; l++) {
|
for (l=0; l<4; l++) {
|
||||||
p->lun = l;
|
p->lun = l;
|
||||||
if (bmc->lun[l].support) {
|
if (bmc->lun[l].support) {
|
||||||
for (n=0; n<MAX_NETFN_PAIR; n++) {
|
for (n=0; n<MAX_NETFN_PAIR; n++) {
|
||||||
p->netfn = n*2;
|
p->netfn = n*2;
|
||||||
if (bmc->lun[l].netfn[n].support) {
|
if (bmc->lun[l].netfn[n].support) {
|
||||||
ret = _get_command_support(intf, p, &(bmc->lun[l].netfn[n]));
|
ret = _get_command_support(intf, p, &(bmc->lun[l].netfn[n]));
|
||||||
ret |= _get_command_configurable(intf, p, &(bmc->lun[l].netfn[n]));
|
ret |= _get_command_configurable(intf, p, &(bmc->lun[l].netfn[n]));
|
||||||
ret |= _get_command_enables(intf, p, &(bmc->lun[l].netfn[n]));
|
ret |= _get_command_enables(intf, p, &(bmc->lun[l].netfn[n]));
|
||||||
}
|
}
|
||||||
if (ret)
|
if (ret)
|
||||||
bmc->lun[l].netfn[n].support = 0;
|
bmc->lun[l].netfn[n].support = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p->lun = -1;
|
p->lun = -1;
|
||||||
p->netfn = -1;
|
p->netfn = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ipmi_firewall_info - print out info for firewall functions
|
/* ipmi_firewall_info - print out info for firewall functions
|
||||||
@ -846,7 +845,7 @@ static int _gather_info(struct ipmi_intf * intf, struct ipmi_function_params * p
|
|||||||
static int
|
static int
|
||||||
ipmi_firewall_info(struct ipmi_intf * intf, int argc, char ** argv)
|
ipmi_firewall_info(struct ipmi_intf * intf, int argc, char ** argv)
|
||||||
{
|
{
|
||||||
int ret, i;
|
int ret = 0;
|
||||||
struct ipmi_function_params p = {0xe, -1, -1, -1, -1};
|
struct ipmi_function_params p = {0xe, -1, -1, -1, -1};
|
||||||
struct bmc_fn_support * bmc_fn_support;
|
struct bmc_fn_support * bmc_fn_support;
|
||||||
unsigned int l, n, c;
|
unsigned int l, n, c;
|
||||||
@ -968,8 +967,6 @@ ipmi_firewall_info(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
static int
|
static int
|
||||||
ipmi_firewall_enable_disable(struct ipmi_intf * intf, int enable, int argc, char ** argv)
|
ipmi_firewall_enable_disable(struct ipmi_intf * intf, int enable, int argc, char ** argv)
|
||||||
{
|
{
|
||||||
struct ipmi_rs * rsp;
|
|
||||||
struct ipmi_rq req;
|
|
||||||
struct ipmi_function_params p = {0xe, -1, -1, -1, -1};
|
struct ipmi_function_params p = {0xe, -1, -1, -1, -1};
|
||||||
struct bmc_fn_support * bmc_fn_support;
|
struct bmc_fn_support * bmc_fn_support;
|
||||||
unsigned int l, n, c, ret;
|
unsigned int l, n, c, ret;
|
||||||
@ -1058,8 +1055,6 @@ ipmi_firewall_enable_disable(struct ipmi_intf * intf, int enable, int argc, char
|
|||||||
static int
|
static int
|
||||||
ipmi_firewall_reset(struct ipmi_intf * intf, int argc, char ** argv)
|
ipmi_firewall_reset(struct ipmi_intf * intf, int argc, char ** argv)
|
||||||
{
|
{
|
||||||
struct ipmi_rs * rsp;
|
|
||||||
struct ipmi_rq req;
|
|
||||||
struct ipmi_function_params p = {0xe, -1, -1, -1, -1};
|
struct ipmi_function_params p = {0xe, -1, -1, -1, -1};
|
||||||
struct bmc_fn_support * bmc_fn_support;
|
struct bmc_fn_support * bmc_fn_support;
|
||||||
unsigned int l, n, c, ret;
|
unsigned int l, n, c, ret;
|
||||||
|
@ -834,7 +834,7 @@ static void ipmi_fru_picmg_ext_print(unsigned char * fru_data, int off, int leng
|
|||||||
|
|
||||||
case FRU_PICMG_BACKPLANE_P2P:
|
case FRU_PICMG_BACKPLANE_P2P:
|
||||||
{
|
{
|
||||||
unsigned char index, index2;
|
unsigned char index;
|
||||||
struct fru_picmgext_slot_desc * slot_d
|
struct fru_picmgext_slot_desc * slot_d
|
||||||
= (struct fru_picmgext_slot_desc*) &fru_data[offset];
|
= (struct fru_picmgext_slot_desc*) &fru_data[offset];
|
||||||
|
|
||||||
@ -1026,7 +1026,7 @@ static void ipmi_fru_picmg_ext_print(unsigned char * fru_data, int off, int leng
|
|||||||
{
|
{
|
||||||
unsigned int index;
|
unsigned int index;
|
||||||
|
|
||||||
for(offset; offset < off + length; )
|
for(; offset < off + length; )
|
||||||
{
|
{
|
||||||
struct fru_picmgext_carrier_p2p_record * h =
|
struct fru_picmgext_carrier_p2p_record * h =
|
||||||
(struct fru_picmgext_carrier_p2p_record *) &fru_data[offset];
|
(struct fru_picmgext_carrier_p2p_record *) &fru_data[offset];
|
||||||
@ -1427,13 +1427,9 @@ static void ipmi_fru_read_to_bin(struct ipmi_intf * intf, char * pFileName, unsi
|
|||||||
{
|
{
|
||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs * rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
unsigned char * fru_data;
|
|
||||||
struct fru_info fru;
|
struct fru_info fru;
|
||||||
unsigned char msg_data[4];
|
unsigned char msg_data[4];
|
||||||
|
|
||||||
unsigned char * pFruBuf;
|
unsigned char * pFruBuf;
|
||||||
unsigned int counter;
|
|
||||||
unsigned int len;
|
|
||||||
|
|
||||||
msg_data[0] = fruId;
|
msg_data[0] = fruId;
|
||||||
|
|
||||||
@ -1496,7 +1492,6 @@ static void ipmi_fru_write_from_bin(struct ipmi_intf * intf,
|
|||||||
{
|
{
|
||||||
struct ipmi_rs *rsp;
|
struct ipmi_rs *rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
unsigned char *fru_data;
|
|
||||||
struct fru_info fru;
|
struct fru_info fru;
|
||||||
unsigned char msg_data[4];
|
unsigned char msg_data[4];
|
||||||
|
|
||||||
@ -1560,34 +1555,34 @@ ipmi_fru_upg_ekeying(struct ipmi_intf * intf, char * pFileName,
|
|||||||
unsigned int retStatus = 0;
|
unsigned int retStatus = 0;
|
||||||
unsigned long offFruMultiRec;
|
unsigned long offFruMultiRec;
|
||||||
unsigned long fruMultiRecSize = 0;
|
unsigned long fruMultiRecSize = 0;
|
||||||
unsigned long offFileMultiRec;
|
unsigned long offFileMultiRec = 0;
|
||||||
unsigned long fileMultiRecSize = 0;
|
unsigned long fileMultiRecSize = 0;
|
||||||
struct fru_info fruInfo;
|
struct fru_info fruInfo;
|
||||||
unsigned char *buf = NULL;
|
unsigned char *buf = NULL;
|
||||||
retStatus =
|
retStatus =
|
||||||
ipmi_fru_get_multirec_location_from_fru(intf, fruId, &fruInfo,
|
ipmi_fru_get_multirec_location_from_fru(intf, fruId, &fruInfo,
|
||||||
&offFruMultiRec,
|
&offFruMultiRec,
|
||||||
&fruMultiRecSize);
|
&fruMultiRecSize);
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
printf("FRU Size : %u\n\r", fruMultiRecSize);
|
printf("FRU Size : %lu\n\r", fruMultiRecSize);
|
||||||
printf("Multi Rec offset: %u\n\r", offFruMultiRec);
|
printf("Multi Rec offset: %lu\n\r", offFruMultiRec);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retStatus == 0) {
|
if (retStatus == 0) {
|
||||||
retStatus =
|
retStatus =
|
||||||
ipmi_fru_get_multirec_size_from_file(pFileName,
|
ipmi_fru_get_multirec_size_from_file(pFileName,
|
||||||
&fileMultiRecSize,
|
&fileMultiRecSize,
|
||||||
&offFileMultiRec);
|
&offFileMultiRec);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retStatus == 0) {
|
if (retStatus == 0) {
|
||||||
buf = malloc(fileMultiRecSize);
|
buf = malloc(fileMultiRecSize);
|
||||||
if (buf) {
|
if (buf) {
|
||||||
retStatus =
|
retStatus =
|
||||||
ipmi_fru_get_multirec_from_file(pFileName, buf,
|
ipmi_fru_get_multirec_from_file(pFileName, buf,
|
||||||
fileMultiRecSize,
|
fileMultiRecSize,
|
||||||
offFileMultiRec);
|
offFileMultiRec);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
printf("Error allocating memory for multirec buffer\n");
|
printf("Error allocating memory for multirec buffer\n");
|
||||||
@ -1595,10 +1590,10 @@ ipmi_fru_upg_ekeying(struct ipmi_intf * intf, char * pFileName,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(retStatus == 0)
|
if(retStatus == 0)
|
||||||
{
|
{
|
||||||
ipmi_fru_get_adjust_size_from_buffer(buf, &fileMultiRecSize);
|
ipmi_fru_get_adjust_size_from_buffer(buf, &fileMultiRecSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((retStatus == 0) && (buf)) {
|
if ((retStatus == 0) && (buf)) {
|
||||||
write_fru_area(intf, &fruInfo, fruId, 0, offFruMultiRec,
|
write_fru_area(intf, &fruInfo, fruId, 0, offFruMultiRec,
|
||||||
@ -1608,14 +1603,16 @@ ipmi_fru_upg_ekeying(struct ipmi_intf * intf, char * pFileName,
|
|||||||
if (buf) {
|
if (buf) {
|
||||||
free(buf);
|
free(buf);
|
||||||
}
|
}
|
||||||
if(retStatus == 0 )
|
if(retStatus == 0 )
|
||||||
{
|
{
|
||||||
lprintf(LOG_INFO, "Done");
|
lprintf(LOG_INFO, "Done");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lprintf(LOG_ERR, "Failed");
|
lprintf(LOG_ERR, "Failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ipmi_fru_get_multirec_size_from_file(char * pFileName,
|
static int ipmi_fru_get_multirec_size_from_file(char * pFileName,
|
||||||
@ -1625,7 +1622,7 @@ static int ipmi_fru_get_multirec_size_from_file(char * pFileName,
|
|||||||
struct fru_header header;
|
struct fru_header header;
|
||||||
FILE * pFile;
|
FILE * pFile;
|
||||||
unsigned char len = 0;
|
unsigned char len = 0;
|
||||||
unsigned long end;
|
unsigned long end = 0;
|
||||||
|
|
||||||
*pSize = 0;
|
*pSize = 0;
|
||||||
|
|
||||||
@ -1642,7 +1639,7 @@ static int ipmi_fru_get_multirec_size_from_file(char * pFileName,
|
|||||||
if(verbose)
|
if(verbose)
|
||||||
{
|
{
|
||||||
printf("File Size = %lu\n", end);
|
printf("File Size = %lu\n", end);
|
||||||
printf("Len = %lu\n", len);
|
printf("Len = %d\n", len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1698,7 +1695,6 @@ static void ipmi_fru_get_adjust_size_from_buffer(unsigned char * fru_data,
|
|||||||
unsigned long *pSize)
|
unsigned long *pSize)
|
||||||
{
|
{
|
||||||
struct fru_multirec_header * head;
|
struct fru_multirec_header * head;
|
||||||
unsigned int last_off;
|
|
||||||
#define CHUNK_SIZE (255 + sizeof(struct fru_multirec_header))
|
#define CHUNK_SIZE (255 + sizeof(struct fru_multirec_header))
|
||||||
unsigned int count = 0;
|
unsigned int count = 0;
|
||||||
unsigned int status = 0;
|
unsigned int status = 0;
|
||||||
@ -1766,7 +1762,7 @@ static void ipmi_fru_get_adjust_size_from_buffer(unsigned char * fru_data,
|
|||||||
|
|
||||||
if (verbose > 1)
|
if (verbose > 1)
|
||||||
{
|
{
|
||||||
printf("Size of multirec: %u\n\r", *pSize);
|
printf("Size of multirec: %lu\n\r", *pSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1776,10 +1772,8 @@ static int ipmi_fru_get_multirec_from_file(char * pFileName,
|
|||||||
unsigned long size,
|
unsigned long size,
|
||||||
unsigned long offset)
|
unsigned long offset)
|
||||||
{
|
{
|
||||||
struct fru_header header;
|
|
||||||
FILE * pFile;
|
FILE * pFile;
|
||||||
unsigned long len = 0;
|
unsigned long len = 0;
|
||||||
|
|
||||||
|
|
||||||
pFile = fopen(pFileName,"rb");
|
pFile = fopen(pFileName,"rb");
|
||||||
if(pFile!=NULL)
|
if(pFile!=NULL)
|
||||||
@ -1812,12 +1806,8 @@ static int ipmi_fru_get_multirec_location_from_fru(struct ipmi_intf * intf,
|
|||||||
{
|
{
|
||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs * rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
unsigned char * fru_data;
|
|
||||||
unsigned char msg_data[4];
|
unsigned char msg_data[4];
|
||||||
int i, len;
|
|
||||||
unsigned long end;
|
unsigned long end;
|
||||||
|
|
||||||
|
|
||||||
struct fru_header header;
|
struct fru_header header;
|
||||||
|
|
||||||
*pRetLocation = 0;
|
*pRetLocation = 0;
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <ipmitool/helper.h>
|
#include <ipmitool/helper.h>
|
||||||
#include <ipmitool/ipmi.h>
|
#include <ipmitool/ipmi.h>
|
||||||
@ -111,8 +112,6 @@ typedef struct sKFWUM_InFirmwareInfo {
|
|||||||
extern int verbose;
|
extern int verbose;
|
||||||
static char fileName[512];
|
static char fileName[512];
|
||||||
static unsigned char firmBuf[1024 * 512];
|
static unsigned char firmBuf[1024 * 512];
|
||||||
static unsigned char firmMaj;
|
|
||||||
static unsigned char firmMinSub;
|
|
||||||
|
|
||||||
static void KfwumOutputHelp(void);
|
static void KfwumOutputHelp(void);
|
||||||
static void KfwumMain(struct ipmi_intf *intf, tKFWUM_Task task);
|
static void KfwumMain(struct ipmi_intf *intf, tKFWUM_Task task);
|
||||||
@ -264,8 +263,8 @@ KfwumMain(struct ipmi_intf *intf, tKFWUM_Task task)
|
|||||||
{
|
{
|
||||||
tKFWUM_Status status = KFWUM_STATUS_OK;
|
tKFWUM_Status status = KFWUM_STATUS_OK;
|
||||||
tKFWUM_BoardInfo boardInfo;
|
tKFWUM_BoardInfo boardInfo;
|
||||||
tKFWUM_InFirmwareInfo firmInfo;
|
tKFWUM_InFirmwareInfo firmInfo = { 0 };
|
||||||
unsigned long fileSize;
|
unsigned long fileSize = 0;
|
||||||
static unsigned short padding;
|
static unsigned short padding;
|
||||||
|
|
||||||
if ((status == KFWUM_STATUS_OK) && (task == KFWUM_TASK_INFO)) {
|
if ((status == KFWUM_STATUS_OK) && (task == KFWUM_TASK_INFO)) {
|
||||||
@ -444,7 +443,7 @@ KfwumShowProgress(const char *task, unsigned long current,
|
|||||||
spaces[(PROG_LENGTH - hash)] = '\0';
|
spaces[(PROG_LENGTH - hash)] = '\0';
|
||||||
printf("%s", spaces);
|
printf("%s", spaces);
|
||||||
|
|
||||||
printf(" %3d %%\r", progress); /* total 7 bytes */
|
printf(" %3ld %%\r", progress); /* total 7 bytes */
|
||||||
|
|
||||||
if (progress == 100) {
|
if (progress == 100) {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@ -557,8 +556,6 @@ KfwumGetDeviceInfo(struct ipmi_intf *intf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (status == KFWUM_STATUS_OK) {
|
if (status == KFWUM_STATUS_OK) {
|
||||||
unsigned long manufId;
|
|
||||||
unsigned short boardId;
|
|
||||||
pGetDevId = (struct ipm_devid_rsp *) rsp->data;
|
pGetDevId = (struct ipm_devid_rsp *) rsp->data;
|
||||||
pBoardInfo->iana =
|
pBoardInfo->iana =
|
||||||
IPM_DEV_MANUFACTURER_ID(pGetDevId->manufacturer_id);
|
IPM_DEV_MANUFACTURER_ID(pGetDevId->manufacturer_id);
|
||||||
@ -654,7 +651,7 @@ KfwumGetStatus(struct ipmi_intf *intf)
|
|||||||
firmLength |= pGetStatus->firmLengthLSB;
|
firmLength |= pGetStatus->firmLengthLSB;
|
||||||
|
|
||||||
printf
|
printf
|
||||||
("Firmware Length : %d bytes\n",
|
("Firmware Length : %ld bytes\n",
|
||||||
firmLength);
|
firmLength);
|
||||||
printf
|
printf
|
||||||
("Firmware Revision : %u.%u%u SDR %u\n",
|
("Firmware Revision : %u.%u%u SDR %u\n",
|
||||||
@ -741,7 +738,6 @@ KfwumSaveFirmwareImage(struct ipmi_intf *intf,
|
|||||||
struct KfwumSaveFirmwareDownloadReq thisReq;
|
struct KfwumSaveFirmwareDownloadReq thisReq;
|
||||||
unsigned char out = 0;
|
unsigned char out = 0;
|
||||||
unsigned char retry = 0;
|
unsigned char retry = 0;
|
||||||
unsigned char counter;
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
thisReq.addressLSB = address & 0x000000ff;
|
thisReq.addressLSB = address & 0x000000ff;
|
||||||
@ -849,9 +845,6 @@ KfwumUploadFirmware(struct ipmi_intf *intf,
|
|||||||
unsigned char retry = 0;
|
unsigned char retry = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
unsigned char bytes;
|
|
||||||
unsigned char chksum = 0;
|
|
||||||
|
|
||||||
writeSize = KFWUM_BUFFER - KFWUM_CMD_OVERHEAD; /* Max */
|
writeSize = KFWUM_BUFFER - KFWUM_CMD_OVERHEAD; /* Max */
|
||||||
|
|
||||||
/* Reach the end */
|
/* Reach the end */
|
||||||
@ -1128,8 +1121,10 @@ KfwumOutputInfo(tKFWUM_BoardInfo boardInfo, tKFWUM_InFirmwareInfo firmInfo)
|
|||||||
|
|
||||||
printf("Target Board Id : %u\n", boardInfo.boardId);
|
printf("Target Board Id : %u\n", boardInfo.boardId);
|
||||||
printf("Target IANA number : %u\n", boardInfo.iana);
|
printf("Target IANA number : %u\n", boardInfo.iana);
|
||||||
printf("File Size : %u bytes\n", firmInfo.fileSize);
|
printf("File Size : %lu bytes\n", firmInfo.fileSize);
|
||||||
printf("Firmware Version : %d.%d%d SDR %d\n",
|
printf("Firmware Version : %d.%d%d SDR %d\n",
|
||||||
firmInfo.versMajor, firmInfo.versMinor, firmInfo.versSubMinor,
|
firmInfo.versMajor, firmInfo.versMinor, firmInfo.versSubMinor,
|
||||||
firmInfo.sdrRev);
|
firmInfo.sdrRev);
|
||||||
|
|
||||||
|
return KFWUM_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
@ -1644,6 +1644,7 @@ ipmi_lan_alert_print(struct ipmi_intf * intf, uint8_t channel, uint8_t alert)
|
|||||||
paddr->data[10], paddr->data[11], paddr->data[12]);
|
paddr->data[10], paddr->data[11], paddr->data[12]);
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1837,7 +1838,6 @@ ipmi_lan_alert(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
{
|
{
|
||||||
uint8_t alert;
|
uint8_t alert;
|
||||||
uint8_t channel = 1;
|
uint8_t channel = 1;
|
||||||
struct lan_param * p;
|
|
||||||
|
|
||||||
if (argc < 1 ||
|
if (argc < 1 ||
|
||||||
strncasecmp(argv[0], "help", 4) == 0) {
|
strncasecmp(argv[0], "help", 4) == 0) {
|
||||||
@ -1908,9 +1908,12 @@ ipmi_lan_alert(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
static int
|
static int
|
||||||
ipmi_lan_stats_get(struct ipmi_intf * intf, uint8_t chan)
|
ipmi_lan_stats_get(struct ipmi_intf * intf, uint8_t chan)
|
||||||
{
|
{
|
||||||
struct lan_param * p;
|
|
||||||
uint8_t medium;
|
uint8_t medium;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
struct ipmi_rs * rsp;
|
||||||
|
struct ipmi_rq req;
|
||||||
|
uint8_t msg_data[2];
|
||||||
|
uint16_t statsTemp;
|
||||||
|
|
||||||
if (chan < 1 || chan > IPMI_CHANNEL_NUMBER_MAX) {
|
if (chan < 1 || chan > IPMI_CHANNEL_NUMBER_MAX) {
|
||||||
lprintf(LOG_ERR, "Invalid Channel %d", chan);
|
lprintf(LOG_ERR, "Invalid Channel %d", chan);
|
||||||
@ -1926,76 +1929,67 @@ ipmi_lan_stats_get(struct ipmi_intf * intf, uint8_t chan)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
/* From here, we are ready to get the stats */
|
||||||
/* From here, we are ready to get the stats */
|
|
||||||
struct ipmi_rs * rsp;
|
msg_data[0] = chan;
|
||||||
struct ipmi_rq req;
|
msg_data[1] = 0; /* Don't clear */
|
||||||
uint8_t msg_data[2];
|
|
||||||
uint16_t statsTemp;
|
memset(&req, 0, sizeof(req));
|
||||||
uint16_t * pStatsTemp;
|
req.msg.netfn = IPMI_NETFN_TRANSPORT;
|
||||||
|
req.msg.cmd = IPMI_LAN_GET_STAT;
|
||||||
|
req.msg.data = msg_data;
|
||||||
|
req.msg.data_len = 2;
|
||||||
|
|
||||||
|
rsp = intf->sendrecv(intf, &req);
|
||||||
|
if (rsp == NULL) {
|
||||||
|
lprintf(LOG_INFO, "Get LAN Stats command failed");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rsp->ccode > 0) {
|
||||||
|
lprintf(LOG_INFO, "Get LAN Stats command failed: %s",
|
||||||
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (verbose > 1)
|
||||||
|
{
|
||||||
|
uint8_t counter;
|
||||||
|
printf("--- Rx Stats ---\n");
|
||||||
|
for(counter=0;counter<18;counter+=2)
|
||||||
|
{
|
||||||
|
printf("%02X", *(rsp->data + counter));
|
||||||
|
printf(" %02X - ", *(rsp->data + counter+1));
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
msg_data[0] = chan;
|
statsTemp = ((*(rsp->data + 0)) << 8) | (*(rsp->data + 1));
|
||||||
msg_data[1] = 0; /* Don't clear */
|
printf("IP Rx Packet : %d\n", statsTemp);
|
||||||
|
|
||||||
memset(&req, 0, sizeof(req));
|
statsTemp = ((*(rsp->data + 2)) << 8) | (*(rsp->data + 3));
|
||||||
req.msg.netfn = IPMI_NETFN_TRANSPORT;
|
printf("IP Rx Header Errors : %u\n", statsTemp);
|
||||||
req.msg.cmd = IPMI_LAN_GET_STAT;
|
|
||||||
req.msg.data = msg_data;
|
|
||||||
req.msg.data_len = 2;
|
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
statsTemp = ((*(rsp->data + 4)) << 8) | (*(rsp->data + 5));
|
||||||
if (rsp == NULL) {
|
printf("IP Rx Address Errors : %u\n", statsTemp);
|
||||||
lprintf(LOG_INFO, "Get LAN Stats command failed");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rsp->ccode > 0) {
|
statsTemp = ((*(rsp->data + 6)) << 8) | (*(rsp->data + 7));
|
||||||
lprintf(LOG_INFO, "Get LAN Stats command failed: %s",
|
printf("IP Rx Fragmented : %u\n", statsTemp);
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (verbose > 1)
|
|
||||||
{
|
|
||||||
uint8_t counter;
|
|
||||||
printf("--- Rx Stats ---\n");
|
|
||||||
for(counter=0;counter<18;counter+=2)
|
|
||||||
{
|
|
||||||
printf("%02X", *(rsp->data + counter));
|
|
||||||
printf(" %02X - ", *(rsp->data + counter+1));
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
statsTemp = ((*(rsp->data + 0)) << 8) | (*(rsp->data + 1));
|
statsTemp = ((*(rsp->data + 8)) << 8) | (*(rsp->data + 9));
|
||||||
printf("IP Rx Packet : %d\n", statsTemp);
|
printf("IP Tx Packet : %u\n", statsTemp);
|
||||||
|
|
||||||
statsTemp = ((*(rsp->data + 2)) << 8) | (*(rsp->data + 3));
|
statsTemp = ((*(rsp->data +10)) << 8) | (*(rsp->data +11));
|
||||||
printf("IP Rx Header Errors : %u\n", statsTemp);
|
printf("UDP Rx Packet : %u\n", statsTemp);
|
||||||
|
|
||||||
statsTemp = ((*(rsp->data + 4)) << 8) | (*(rsp->data + 5));
|
statsTemp = ((*(rsp->data + 12)) << 8) | (*(rsp->data + 13));
|
||||||
printf("IP Rx Address Errors : %u\n", statsTemp);
|
printf("RMCP Rx Valid : %u\n", statsTemp);
|
||||||
|
|
||||||
statsTemp = ((*(rsp->data + 6)) << 8) | (*(rsp->data + 7));
|
statsTemp = ((*(rsp->data + 14)) << 8) | (*(rsp->data + 15));
|
||||||
printf("IP Rx Fragmented : %u\n", statsTemp);
|
printf("UDP Proxy Packet Received : %u\n", statsTemp);
|
||||||
|
|
||||||
statsTemp = ((*(rsp->data + 8)) << 8) | (*(rsp->data + 9));
|
statsTemp = ((*(rsp->data + 16)) << 8) | (*(rsp->data + 17));
|
||||||
printf("IP Tx Packet : %u\n", statsTemp);
|
printf("UDP Proxy Packet Dropped : %u\n", statsTemp);
|
||||||
|
|
||||||
statsTemp = ((*(rsp->data +10)) << 8) | (*(rsp->data +11));
|
|
||||||
printf("UDP Rx Packet : %u\n", statsTemp);
|
|
||||||
|
|
||||||
statsTemp = ((*(rsp->data + 12)) << 8) | (*(rsp->data + 13));
|
|
||||||
printf("RMCP Rx Valid : %u\n", statsTemp);
|
|
||||||
|
|
||||||
statsTemp = ((*(rsp->data + 14)) << 8) | (*(rsp->data + 15));
|
|
||||||
printf("UDP Proxy Packet Received : %u\n", statsTemp);
|
|
||||||
|
|
||||||
statsTemp = ((*(rsp->data + 16)) << 8) | (*(rsp->data + 17));
|
|
||||||
printf("UDP Proxy Packet Dropped : %u\n", statsTemp);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@ -2004,9 +1998,11 @@ ipmi_lan_stats_get(struct ipmi_intf * intf, uint8_t chan)
|
|||||||
static int
|
static int
|
||||||
ipmi_lan_stats_clear(struct ipmi_intf * intf, uint8_t chan)
|
ipmi_lan_stats_clear(struct ipmi_intf * intf, uint8_t chan)
|
||||||
{
|
{
|
||||||
struct lan_param * p;
|
|
||||||
uint8_t medium;
|
uint8_t medium;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
struct ipmi_rs * rsp;
|
||||||
|
struct ipmi_rq req;
|
||||||
|
uint8_t msg_data[2];
|
||||||
|
|
||||||
if (chan < 1 || chan > IPMI_CHANNEL_NUMBER_MAX) {
|
if (chan < 1 || chan > IPMI_CHANNEL_NUMBER_MAX) {
|
||||||
lprintf(LOG_ERR, "Invalid Channel %d", chan);
|
lprintf(LOG_ERR, "Invalid Channel %d", chan);
|
||||||
@ -2022,36 +2018,27 @@ ipmi_lan_stats_clear(struct ipmi_intf * intf, uint8_t chan)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
/* From here, we are ready to get the stats */
|
||||||
/* From here, we are ready to get the stats */
|
msg_data[0] = chan;
|
||||||
struct ipmi_rs * rsp;
|
msg_data[1] = 1; /* Clear */
|
||||||
struct ipmi_rq req;
|
|
||||||
uint8_t msg_data[2];
|
|
||||||
uint16_t statsTemp;
|
|
||||||
uint16_t * pStatsTemp;
|
|
||||||
|
|
||||||
|
|
||||||
msg_data[0] = chan;
|
memset(&req, 0, sizeof(req));
|
||||||
msg_data[1] = 1; /* Clear */
|
req.msg.netfn = IPMI_NETFN_TRANSPORT;
|
||||||
|
req.msg.cmd = IPMI_LAN_GET_STAT;
|
||||||
|
req.msg.data = msg_data;
|
||||||
|
req.msg.data_len = 2;
|
||||||
|
|
||||||
memset(&req, 0, sizeof(req));
|
rsp = intf->sendrecv(intf, &req);
|
||||||
req.msg.netfn = IPMI_NETFN_TRANSPORT;
|
if (rsp == NULL) {
|
||||||
req.msg.cmd = IPMI_LAN_GET_STAT;
|
lprintf(LOG_INFO, "Get LAN Stats command failed");
|
||||||
req.msg.data = msg_data;
|
return 0;
|
||||||
req.msg.data_len = 2;
|
}
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
if (rsp->ccode > 0) {
|
||||||
if (rsp == NULL) {
|
lprintf(LOG_INFO, "Get LAN Stats command failed: %s",
|
||||||
lprintf(LOG_INFO, "Get LAN Stats command failed");
|
val2str(rsp->ccode, completion_code_vals));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rsp->ccode > 0) {
|
|
||||||
lprintf(LOG_INFO, "Get LAN Stats command failed: %s",
|
|
||||||
val2str(rsp->ccode, completion_code_vals));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include <ipmitool/ipmi_fru.h> /* for access to link descriptor defines */
|
#include <ipmitool/ipmi_fru.h> /* for access to link descriptor defines */
|
||||||
|
|
||||||
|
|
||||||
int
|
void
|
||||||
ipmi_picmg_help (void)
|
ipmi_picmg_help (void)
|
||||||
{
|
{
|
||||||
printf(" properties - get PICMG properties\n");
|
printf(" properties - get PICMG properties\n");
|
||||||
@ -120,6 +120,8 @@ ipmi_picmg_properties(struct ipmi_intf * intf)
|
|||||||
printf("PICMG Ext. Version : %i.%i\n", rsp->data[1]&0x0f, (rsp->data[1]&0xf0) >> 4);
|
printf("PICMG Ext. Version : %i.%i\n", rsp->data[1]&0x0f, (rsp->data[1]&0xf0) >> 4);
|
||||||
printf("Max FRU Device ID : 0x%02x\n", rsp->data[2]);
|
printf("Max FRU Device ID : 0x%02x\n", rsp->data[2]);
|
||||||
printf("FRU Device ID : 0x%02x\n", rsp->data[3]);
|
printf("FRU Device ID : 0x%02x\n", rsp->data[3]);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -190,7 +192,7 @@ ipmi_picmg_fru_activation_policy_get(struct ipmi_intf * intf, int argc, char **
|
|||||||
}
|
}
|
||||||
|
|
||||||
printf("Activation Policy for FRU %x: ", atoi(argv[0]) );
|
printf("Activation Policy for FRU %x: ", atoi(argv[0]) );
|
||||||
printf(" %s\n",(*(rsp->data+3)&0x01 == 0x01)?"is locked":"is not locked");
|
printf(" %s\n",(((*(rsp->data+3))&0x01) == 0x01)?"is locked":"is not locked");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -410,7 +412,7 @@ ipmi_picmg_get_led_capabilities(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("LED Color Capabilities: ", rsp->data[1] );
|
printf("LED Color Capabilities: ");
|
||||||
for ( i=0 ; i<8 ; i++ ) {
|
for ( i=0 ; i<8 ; i++ ) {
|
||||||
if ( rsp->data[1] & (0x01 << i) ) {
|
if ( rsp->data[1] & (0x01 << i) ) {
|
||||||
printf("%s, ", led_color_str[ i ]);
|
printf("%s, ", led_color_str[ i ]);
|
||||||
@ -428,7 +430,6 @@ ipmi_picmg_get_led_capabilities(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
int
|
int
|
||||||
ipmi_picmg_get_led_state(struct ipmi_intf * intf, int argc, char ** argv)
|
ipmi_picmg_get_led_state(struct ipmi_intf * intf, int argc, char ** argv)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs * rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
|
|
||||||
@ -482,7 +483,6 @@ ipmi_picmg_get_led_state(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
int
|
int
|
||||||
ipmi_picmg_set_led_state(struct ipmi_intf * intf, int argc, char ** argv)
|
ipmi_picmg_set_led_state(struct ipmi_intf * intf, int argc, char ** argv)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs * rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
|
|
||||||
@ -566,7 +566,7 @@ ipmi_picmg_get_power_level(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
int
|
int
|
||||||
ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc = 0;
|
||||||
|
|
||||||
if (argc == 0 || (!strncmp(argv[0], "help", 4))) {
|
if (argc == 0 || (!strncmp(argv[0], "help", 4))) {
|
||||||
ipmi_picmg_help();
|
ipmi_picmg_help();
|
||||||
|
@ -215,8 +215,6 @@ ipmi_raw_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
uint8_t netfn, cmd, lun;
|
uint8_t netfn, cmd, lun;
|
||||||
int i;
|
int i;
|
||||||
unsigned long ufn;
|
|
||||||
|
|
||||||
uint8_t data[256];
|
uint8_t data[256];
|
||||||
|
|
||||||
if (argc < 2 || strncmp(argv[0], "help", 4) == 0) {
|
if (argc < 2 || strncmp(argv[0], "help", 4) == 0) {
|
||||||
|
@ -922,7 +922,6 @@ ipmi_sdr_print_sensor_full(struct ipmi_intf *intf,
|
|||||||
int i = 0, validread = 1, do_unit = 1;
|
int i = 0, validread = 1, do_unit = 1;
|
||||||
double val = 0.0, creading = 0.0;
|
double val = 0.0, creading = 0.0;
|
||||||
struct ipmi_rs *rsp;
|
struct ipmi_rs *rsp;
|
||||||
uint8_t min_reading, max_reading;
|
|
||||||
|
|
||||||
if (sensor == NULL)
|
if (sensor == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#define __USE_XOPEN /* glibc2 needs this for strptime */
|
#define __USE_XOPEN /* glibc2 needs this for strptime */
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include <ipmitool/helper.h>
|
#include <ipmitool/helper.h>
|
||||||
#include <ipmitool/log.h>
|
#include <ipmitool/log.h>
|
||||||
@ -46,11 +47,9 @@
|
|||||||
#include <ipmitool/ipmi_sensor.h>
|
#include <ipmitool/ipmi_sensor.h>
|
||||||
|
|
||||||
extern int verbose;
|
extern int verbose;
|
||||||
|
|
||||||
static int sel_extended = 0;
|
static int sel_extended = 0;
|
||||||
|
|
||||||
static FILE * fp;
|
|
||||||
static int sel_oem_nrecs = 0;
|
static int sel_oem_nrecs = 0;
|
||||||
|
|
||||||
struct ipmi_sel_oem_msg_rec {
|
struct ipmi_sel_oem_msg_rec {
|
||||||
int value[14];
|
int value[14];
|
||||||
char *string[14];
|
char *string[14];
|
||||||
@ -112,15 +111,17 @@ int ipmi_sel_oem_init(const char * filename)
|
|||||||
fp = ipmi_open_file_read(filename);
|
fp = ipmi_open_file_read(filename);
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
lprintf(LOG_ERR, "Could not open %s file", filename);
|
lprintf(LOG_ERR, "Could not open %s file", filename);
|
||||||
return;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* count number of records (lines) in input file */
|
/* count number of records (lines) in input file */
|
||||||
sel_oem_nrecs = 0;
|
sel_oem_nrecs = 0;
|
||||||
while (fscanf(fp, "%*[^\n]\n", buf[0]) == 0) {
|
while (fscanf(fp, "%*[^\n]\n") == 0) {
|
||||||
sel_oem_nrecs++;
|
sel_oem_nrecs++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("nrecs=%d\n", sel_oem_nrecs);
|
||||||
|
|
||||||
rewind(fp);
|
rewind(fp);
|
||||||
sel_oem_msg = (struct ipmi_sel_oem_msg_rec *)calloc(sel_oem_nrecs,
|
sel_oem_msg = (struct ipmi_sel_oem_msg_rec *)calloc(sel_oem_nrecs,
|
||||||
sizeof(struct ipmi_sel_oem_msg_rec));
|
sizeof(struct ipmi_sel_oem_msg_rec));
|
||||||
@ -149,7 +150,7 @@ int ipmi_sel_oem_init(const char * filename)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
free (sel_oem_msg);
|
free (sel_oem_msg);
|
||||||
return;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (byte = 3; byte < 17; byte++) {
|
for (byte = 3; byte < 17; byte++) {
|
||||||
@ -164,8 +165,10 @@ int ipmi_sel_oem_init(const char * filename)
|
|||||||
sel_oem_msg[i].text = (char *)malloc(strlen(buf[SEL_BYTE(17)]) + 1);
|
sel_oem_msg[i].text = (char *)malloc(strlen(buf[SEL_BYTE(17)]) + 1);
|
||||||
strcpy(sel_oem_msg[i].text, buf[SEL_BYTE(17)]);
|
strcpy(sel_oem_msg[i].text, buf[SEL_BYTE(17)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
fp = NULL;
|
fp = NULL;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ipmi_sel_oem_message(struct sel_event_record * evt, int verbose)
|
static void ipmi_sel_oem_message(struct sel_event_record * evt, int verbose)
|
||||||
@ -267,8 +270,6 @@ ipmi_get_oem(struct ipmi_intf * intf)
|
|||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs * rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
struct ipm_devid_rsp *devid;
|
struct ipm_devid_rsp *devid;
|
||||||
uint32_t manufacturer_id;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (intf->fd == 0)
|
if (intf->fd == 0)
|
||||||
return IPMI_OEM_UNKNOWN;
|
return IPMI_OEM_UNKNOWN;
|
||||||
@ -475,6 +476,8 @@ ipmi_get_oem_desc(struct ipmi_intf * intf, struct sel_event_record * rec)
|
|||||||
case IPMI_OEM_NEWISYS:
|
case IPMI_OEM_NEWISYS:
|
||||||
desc = get_newisys_evt_desc(intf, rec);
|
desc = get_newisys_evt_desc(intf, rec);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return desc;
|
return desc;
|
||||||
@ -1086,12 +1089,13 @@ ipmi_sel_print_extended_entry_verbose(struct ipmi_intf * intf, struct sel_event_
|
|||||||
{
|
{
|
||||||
struct sdr_record_list * sdr;
|
struct sdr_record_list * sdr;
|
||||||
char * description;
|
char * description;
|
||||||
int data_count;
|
|
||||||
|
|
||||||
if (!evt)
|
if (!evt)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sdr = ipmi_sdr_find_sdr_bynumtype(intf, evt->sel_type.standard_type.sensor_num, evt->sel_type.standard_type.sensor_type);
|
sdr = ipmi_sdr_find_sdr_bynumtype(intf,
|
||||||
|
evt->sel_type.standard_type.sensor_num,
|
||||||
|
evt->sel_type.standard_type.sensor_type);
|
||||||
if (sdr == NULL) {
|
if (sdr == NULL) {
|
||||||
ipmi_sel_print_std_entry_verbose(intf, evt);
|
ipmi_sel_print_std_entry_verbose(intf, evt);
|
||||||
return;
|
return;
|
||||||
@ -1635,7 +1639,7 @@ ipmi_sel_delete(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
msg_data[0] = id & 0xff;
|
msg_data[0] = id & 0xff;
|
||||||
msg_data[1] = id >> 8;
|
msg_data[1] = id >> 8;
|
||||||
|
|
||||||
for (argc; argc != 0; argc--)
|
for (; argc != 0; argc--)
|
||||||
{
|
{
|
||||||
id = atoi(argv[argc-1]);
|
id = atoi(argv[argc-1]);
|
||||||
msg_data[2] = id & 0xff;
|
msg_data[2] = id & 0xff;
|
||||||
|
@ -732,7 +732,7 @@ ipmi_sensor_get_reading(struct ipmi_intf *intf, int argc, char **argv)
|
|||||||
{
|
{
|
||||||
struct sdr_record_list *sdr;
|
struct sdr_record_list *sdr;
|
||||||
struct ipmi_rs *rsp;
|
struct ipmi_rs *rsp;
|
||||||
int i, v, rc=0;
|
int i, rc=0;
|
||||||
double val = 0.0;
|
double val = 0.0;
|
||||||
|
|
||||||
if (argc < 1 || strncmp(argv[0], "help", 4) == 0) {
|
if (argc < 1 || strncmp(argv[0], "help", 4) == 0) {
|
||||||
|
@ -1243,7 +1243,7 @@ processSolUserInput(
|
|||||||
*/
|
*/
|
||||||
if (length)
|
if (length)
|
||||||
{
|
{
|
||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs * rsp = NULL;
|
||||||
int try = 0;
|
int try = 0;
|
||||||
|
|
||||||
while (try < intf->session->retry) {
|
while (try < intf->session->retry) {
|
||||||
|
@ -47,9 +47,11 @@
|
|||||||
|
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
# include <linux/termios.h>
|
# include <termios.h>
|
||||||
|
//# include <linux/termios.h>
|
||||||
#else
|
#else
|
||||||
# include <sys/termios.h>
|
# include <sys/termios.h>
|
||||||
#endif
|
#endif
|
||||||
@ -381,7 +383,6 @@ ipmi_tsol_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
struct pollfd fds_wait[3], fds_data_wait[3], *fds;
|
struct pollfd fds_wait[3], fds_data_wait[3], *fds;
|
||||||
struct sockaddr_in sin, myaddr;
|
struct sockaddr_in sin, myaddr;
|
||||||
socklen_t mylen;
|
socklen_t mylen;
|
||||||
char recvip_c[] = "0.0.0.0";
|
|
||||||
char *recvip = NULL;
|
char *recvip = NULL;
|
||||||
char out_buff[IPMI_BUF_SIZE * 8], in_buff[IPMI_BUF_SIZE];
|
char out_buff[IPMI_BUF_SIZE * 8], in_buff[IPMI_BUF_SIZE];
|
||||||
char buff[IPMI_BUF_SIZE + 4];
|
char buff[IPMI_BUF_SIZE + 4];
|
||||||
|
@ -367,7 +367,7 @@ openipmi_read(struct ipmi_event_intf * eintf)
|
|||||||
uint8_t data[80];
|
uint8_t data[80];
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
recv.addr = (char *) &addr;
|
recv.addr = (unsigned char *) &addr;
|
||||||
recv.addr_len = sizeof(addr);
|
recv.addr_len = sizeof(addr);
|
||||||
recv.msg.data = data;
|
recv.msg.data = data;
|
||||||
recv.msg.data_len = sizeof(data);
|
recv.msg.data_len = sizeof(data);
|
||||||
|
@ -211,7 +211,7 @@ ipmi_shell_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
|
|
||||||
#endif /* HAVE_READLINE */
|
#endif /* HAVE_READLINE */
|
||||||
|
|
||||||
int ipmi_echo_main(struct ipmi_intf * intf, int argc, char ** argv)
|
void ipmi_echo_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user