From c65b20614417f625a7a138cd229ad4d566cee198 Mon Sep 17 00:00:00 2001 From: Duncan Laurie Date: Sun, 19 Mar 2006 20:54:44 +0000 Subject: [PATCH] fix gcc4 compile warnings --- ipmitool/include/ipmitool/ipmi_picmg.h | 132 +- ipmitool/include/ipmitool/ipmi_sel.h | 2 +- ipmitool/lib/ipmi_channel.c | 8 +- ipmitool/lib/ipmi_fru.c | 1327 +++++++++-------- ipmitool/lib/ipmi_fwum.c | 19 +- ipmitool/lib/ipmi_lanp.c | 10 +- ipmitool/lib/ipmi_mc.c | 2 +- ipmitool/lib/ipmi_pef.c | 2 +- ipmitool/lib/ipmi_picmg.c | 1066 ++++++------- ipmitool/lib/ipmi_sdr.c | 78 +- ipmitool/lib/ipmi_sel.c | 12 +- ipmitool/lib/ipmi_sol.c | 2 +- ipmitool/lib/ipmi_user.c | 8 +- ipmitool/src/plugins/lan/auth.c | 2 +- ipmitool/src/plugins/lan/lan.c | 6 +- ipmitool/src/plugins/lanplus/lanplus.c | 22 +- ipmitool/src/plugins/lanplus/lanplus_crypt.c | 61 +- ipmitool/src/plugins/lanplus/lanplus_crypt.h | 2 +- .../src/plugins/lanplus/lanplus_crypt_impl.c | 8 +- ipmitool/src/plugins/open/open.c | 31 +- 20 files changed, 1403 insertions(+), 1397 deletions(-) diff --git a/ipmitool/include/ipmitool/ipmi_picmg.h b/ipmitool/include/ipmitool/ipmi_picmg.h index 2f7d4cc..be2d864 100644 --- a/ipmitool/include/ipmitool/ipmi_picmg.h +++ b/ipmitool/include/ipmitool/ipmi_picmg.h @@ -1,75 +1,75 @@ - -/* - (C) Kontron -*/ - -#ifndef _IPMI_PICMG_H_ -#define _IPMI_PICMG_H_ - -#include - -/* PICMG commands */ -#define PICMG_GET_PICMG_PROPERTIES_CMD 0x00 -#define PICMG_GET_ADDRESS_INFO_CMD 0x01 -#define PICMG_GET_SHELF_ADDRESS_INFO_CMD 0x02 -#define PICMG_SET_SHELF_ADDRESS_INFO_CMD 0x03 -#define PICMG_FRU_CONTROL_CMD 0x04 -#define PICMG_GET_FRU_LED_PROPERTIES_CMD 0x05 -#define PICMG_GET_LED_COLOR_CAPABILITIES_CMD 0x06 -#define PICMG_SET_FRU_LED_STATE_CMD 0x07 -#define PICMG_GET_FRU_LED_STATE_CMD 0x08 -#define PICMG_SET_IPMB_CMD 0x09 -#define PICMG_SET_FRU_POLICY_CMD 0x0A -#define PICMG_GET_FRU_POLICY_CMD 0x0B -#define PICMG_FRU_ACTIVATION_CMD 0x0C -#define PICMG_GET_DEVICE_LOCATOR_RECORD_CMD 0x0D -#define PICMG_SET_PORT_STATE_CMD 0x0E -#define PICMG_GET_PORT_STATE_CMD 0x0F -#define PICMG_COMPUTE_POWER_PROPERTIES_CMD 0x10 -#define PICMG_SET_POWER_LEVEL_CMD 0x11 -#define PICMG_GET_POWER_LEVEL_CMD 0x12 -#define PICMG_RENEGOTIATE_POWER_CMD 0x13 -#define PICMG_GET_FAN_SPEED_PROPERTIES_CMD 0x14 -#define PICMG_SET_FAN_LEVEL_CMD 0x15 -#define PICMG_GET_FAN_LEVEL_CMD 0x16 -#define PICMG_BUSED_RESOURCE_CMD 0x17 - -/* Site Types */ -#define PICMG_ATCA_BOARD 0x00 -#define PICMG_POWER_ENTRY 0x01 -#define PICMG_SHELF_FRU 0x02 -#define PICMG_DEDICATED_SHMC 0x03 -#define PICMG_FAN_TRAY 0x04 -#define PICMG_FAN_FILTER_TRAY 0x05 -#define PICMG_ALARM 0x06 -#define PICMG_AMC 0x07 -#define PICMG_PMC 0x08 -#define PICMG_RTM 0x09 - - - + +/* + (C) Kontron +*/ + +#ifndef _IPMI_PICMG_H_ +#define _IPMI_PICMG_H_ + +#include + +/* PICMG commands */ +#define PICMG_GET_PICMG_PROPERTIES_CMD 0x00 +#define PICMG_GET_ADDRESS_INFO_CMD 0x01 +#define PICMG_GET_SHELF_ADDRESS_INFO_CMD 0x02 +#define PICMG_SET_SHELF_ADDRESS_INFO_CMD 0x03 +#define PICMG_FRU_CONTROL_CMD 0x04 +#define PICMG_GET_FRU_LED_PROPERTIES_CMD 0x05 +#define PICMG_GET_LED_COLOR_CAPABILITIES_CMD 0x06 +#define PICMG_SET_FRU_LED_STATE_CMD 0x07 +#define PICMG_GET_FRU_LED_STATE_CMD 0x08 +#define PICMG_SET_IPMB_CMD 0x09 +#define PICMG_SET_FRU_POLICY_CMD 0x0A +#define PICMG_GET_FRU_POLICY_CMD 0x0B +#define PICMG_FRU_ACTIVATION_CMD 0x0C +#define PICMG_GET_DEVICE_LOCATOR_RECORD_CMD 0x0D +#define PICMG_SET_PORT_STATE_CMD 0x0E +#define PICMG_GET_PORT_STATE_CMD 0x0F +#define PICMG_COMPUTE_POWER_PROPERTIES_CMD 0x10 +#define PICMG_SET_POWER_LEVEL_CMD 0x11 +#define PICMG_GET_POWER_LEVEL_CMD 0x12 +#define PICMG_RENEGOTIATE_POWER_CMD 0x13 +#define PICMG_GET_FAN_SPEED_PROPERTIES_CMD 0x14 +#define PICMG_SET_FAN_LEVEL_CMD 0x15 +#define PICMG_GET_FAN_LEVEL_CMD 0x16 +#define PICMG_BUSED_RESOURCE_CMD 0x17 + +/* Site Types */ +#define PICMG_ATCA_BOARD 0x00 +#define PICMG_POWER_ENTRY 0x01 +#define PICMG_SHELF_FRU 0x02 +#define PICMG_DEDICATED_SHMC 0x03 +#define PICMG_FAN_TRAY 0x04 +#define PICMG_FAN_FILTER_TRAY 0x05 +#define PICMG_ALARM 0x06 +#define PICMG_AMC 0x07 +#define PICMG_PMC 0x08 +#define PICMG_RTM 0x09 + + + struct picmg_set_fru_activation_cmd { unsigned char picmg_id; /* always 0*/ - unsigned char fru_id; /* threshold setting mask */ + unsigned char fru_id; /* threshold setting mask */ unsigned char fru_state; /* fru activation/deactivation */ } __attribute__ ((packed)); - - - + + + /* the LED color capabilities */ -static unsigned char* led_color_str[] = { - "reserved", +static const char* led_color_str[] = { + "reserved", "BLUE", "RED", "GREEN", - "AMBER", - "ORANGE", - "WHITE", + "AMBER", + "ORANGE", + "WHITE", "reserved" -}; - - - -int ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv); - -#endif +}; + + + +int ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv); + +#endif diff --git a/ipmitool/include/ipmitool/ipmi_sel.h b/ipmitool/include/ipmitool/ipmi_sel.h index 02366ef..6301ca8 100644 --- a/ipmitool/include/ipmitool/ipmi_sel.h +++ b/ipmitool/include/ipmitool/ipmi_sel.h @@ -545,6 +545,6 @@ uint16_t ipmi_sel_get_std_entry(struct ipmi_intf * intf, uint16_t id, struct sel char * get_newisys_evt_desc(struct ipmi_intf * intf, struct sel_event_record * rec); IPMI_OEM ipmi_get_oem(struct ipmi_intf * intf); char * ipmi_get_oem_desc(struct ipmi_intf * intf, struct sel_event_record * rec); -int ipmi_sel_oem_init(char * filename); +int ipmi_sel_oem_init(const char * filename); #endif /* IPMI_SEL_H */ diff --git a/ipmitool/lib/ipmi_channel.c b/ipmitool/lib/ipmi_channel.c index ad5dd73..17d9bff 100644 --- a/ipmitool/lib/ipmi_channel.c +++ b/ipmitool/lib/ipmi_channel.c @@ -222,16 +222,16 @@ ipmi_get_channel_info(struct ipmi_intf * intf, uint8_t channel) printf(" Session Support : "); switch (channel_info.session_support) { - case 0x00: + case 0x0: printf("session-less\n"); break; - case 0x40: + case 0x1: printf("single-session\n"); break; - case 0x80: + case 0x2: printf("multi-session\n"); break; - case 0xc0: + case 0x3: default: printf("session-based\n"); break; diff --git a/ipmitool/lib/ipmi_fru.c b/ipmitool/lib/ipmi_fru.c index fd8e048..b0eb064 100644 --- a/ipmitool/lib/ipmi_fru.c +++ b/ipmitool/lib/ipmi_fru.c @@ -57,26 +57,26 @@ extern int verbose; extern int ipmi_spd_print(struct ipmi_intf * intf, uint8_t id); -static void ipmi_fru_read_to_bin(struct ipmi_intf * intf,unsigned char * pFileName, unsigned char fruId); -static void ipmi_fru_write_from_bin(struct ipmi_intf * intf, unsigned char * pFileName, unsigned char fruId); -static int ipmi_fru_upg_ekeying(struct ipmi_intf * intf,unsigned char * pFileName, unsigned char fruId); +static void ipmi_fru_read_to_bin(struct ipmi_intf * intf, char * pFileName, unsigned char fruId); +static void ipmi_fru_write_from_bin(struct ipmi_intf * intf, char * pFileName, unsigned char fruId); +static int ipmi_fru_upg_ekeying(struct ipmi_intf * intf, char * pFileName, unsigned char fruId); static int ipmi_fru_get_multirec_location_from_fru(struct ipmi_intf * intf, unsigned char fruId, struct fru_info *pFruInfo, unsigned long * pRetLocation, unsigned long * pRetSize); -static int ipmi_fru_get_multirec_from_file(unsigned char * pFileName, +static int ipmi_fru_get_multirec_from_file(char * pFileName, unsigned char * pBufArea, unsigned long size, unsigned long offset); -static int ipmi_fru_get_multirec_size_from_file(unsigned char * pFileName, +static int ipmi_fru_get_multirec_size_from_file(char * pFileName, unsigned long * pSize, unsigned long * pOffset); static void ipmi_fru_get_adjust_size_from_buffer(unsigned char * pBufArea, unsigned long *pSize); -static unsigned char fileName[512]; +static char fileName[512]; static void ipmi_fru_picmg_ext_print(unsigned char * fru_data, int off, int length); @@ -206,68 +206,68 @@ write_fru_area(struct ipmi_intf * intf, struct fru_info *fru, unsigned char id, // fill in frubuf[offset:length] from the FRU[offset:length] // rc=1 on success */ - static unsigned int fru_data_rqst_size = 32; - unsigned int off=0, tmp, finish; - struct ipmi_rs * rsp; - struct ipmi_rq req; - unsigned char msg_data[25]; - unsigned char writeLength; + static unsigned int fru_data_rqst_size = 32; + unsigned int off=0, tmp, finish; + struct ipmi_rs * rsp; + struct ipmi_rq req; + unsigned char msg_data[25]; + unsigned char writeLength; - finish = doffset + length; /* destination offset */ - if (finish > fru->size) - { - printf("Return error\n"); - return -1; - } - memset(&req, 0, sizeof(req)); - req.msg.netfn = IPMI_NETFN_STORAGE; - req.msg.cmd = SET_FRU_DATA; - req.msg.data = msg_data; + finish = doffset + length; /* destination offset */ + if (finish > fru->size) + { + printf("Return error\n"); + return -1; + } + memset(&req, 0, sizeof(req)); + req.msg.netfn = IPMI_NETFN_STORAGE; + req.msg.cmd = SET_FRU_DATA; + req.msg.data = msg_data; #ifdef LIMIT_ALL_REQUEST_SIZE - if (fru_data_rqst_size > 16) + if (fru_data_rqst_size > 16) #else - if (fru->access && fru_data_rqst_size > 16) + if (fru->access && fru_data_rqst_size > 16) #endif - fru_data_rqst_size = 16; - do - { - /* real destination offset */ - tmp = fru->access ? (doffset+off) >> 1 : (doffset+off); - msg_data[0] = id; - msg_data[1] = (unsigned char)tmp; - msg_data[2] = (unsigned char)(tmp >> 8); - tmp = finish - (doffset+off); /* bytes remaining */ - if (tmp > 16) - { - lprintf(LOG_INFO,"Writting 16 bytes"); - memcpy(&msg_data[3],(pFrubuf+soffset+off), 16); - req.msg.data_len = 16 + 3; - } - else - { - lprintf(LOG_INFO,"Writting %d bytes", tmp); - memcpy(&msg_data[3],(pFrubuf+soffset+off), (unsigned char) tmp); - req.msg.data_len = tmp + 3; - } + fru_data_rqst_size = 16; + do + { + /* real destination offset */ + tmp = fru->access ? (doffset+off) >> 1 : (doffset+off); + msg_data[0] = id; + msg_data[1] = (unsigned char)tmp; + msg_data[2] = (unsigned char)(tmp >> 8); + tmp = finish - (doffset+off); /* bytes remaining */ + if (tmp > 16) + { + lprintf(LOG_INFO,"Writting 16 bytes"); + memcpy(&msg_data[3],(pFrubuf+soffset+off), 16); + req.msg.data_len = 16 + 3; + } + else + { + lprintf(LOG_INFO,"Writting %d bytes", tmp); + memcpy(&msg_data[3],(pFrubuf+soffset+off), (unsigned char) tmp); + req.msg.data_len = tmp + 3; + } - writeLength = req.msg.data_len-3; + writeLength = req.msg.data_len-3; - rsp = intf->sendrecv(intf, &req); - if (!rsp) - break; - if ((rsp->ccode==0xc7 || rsp->ccode==0xc8 || rsp->ccode==0xca ) && --fru_data_rqst_size > 8) - { - lprintf(LOG_NOTICE,"Bad CC -> %x\n", rsp->ccode); - break; /*continue;*/ - } - if (rsp->ccode) - break; + rsp = intf->sendrecv(intf, &req); + if (!rsp) + break; + if ((rsp->ccode==0xc7 || rsp->ccode==0xc8 || rsp->ccode==0xca ) && --fru_data_rqst_size > 8) + { + lprintf(LOG_NOTICE,"Bad CC -> %x\n", rsp->ccode); + break; /*continue;*/ + } + if (rsp->ccode) + break; - off += writeLength; - } while ((doffset+off) < finish); + off += writeLength; + } while ((doffset+off) < finish); - return ((doffset+off) >= finish); + return ((doffset+off) >= finish); } /* read_fru_area - fill in frubuf[offset:length] from the FRU[offset:length] @@ -377,7 +377,8 @@ static void fru_area_print_chassis(struct ipmi_intf * intf, struct fru_info * fru, uint8_t id, uint32_t offset) { - uint8_t * fru_area, * fru_data; + char * fru_area; + uint8_t * fru_data; uint32_t fru_len, area_len, i; i = offset; @@ -449,7 +450,8 @@ static void fru_area_print_board(struct ipmi_intf * intf, struct fru_info * fru, uint8_t id, uint32_t offset) { - uint8_t * fru_area, * fru_data; + char * fru_area; + uint8_t * fru_data; uint32_t fru_len, area_len, i; i = offset; @@ -540,7 +542,8 @@ static void fru_area_print_product(struct ipmi_intf * intf, struct fru_info * fru, uint8_t id, uint32_t offset) { - uint8_t * fru_area, * fru_data; + char * fru_area; + uint8_t * fru_data; uint32_t fru_len, area_len, i; i = offset; @@ -817,261 +820,261 @@ fru_area_print_multirec(struct ipmi_intf * intf, struct fru_info * fru, static void ipmi_fru_picmg_ext_print(unsigned char * fru_data, int off, int length) { - struct fru_multirec_picmgext_header *h; - int guid_count; - int offset = off; - int start_offset = off; - int i; + struct fru_multirec_picmgext_header *h; + int guid_count; + int offset = off; + int start_offset = off; + int i; - h = (struct fru_multirec_picmgext_header *) &fru_data[offset]; - offset += sizeof(struct fru_multirec_picmgext_header); + h = (struct fru_multirec_picmgext_header *) &fru_data[offset]; + offset += sizeof(struct fru_multirec_picmgext_header); - switch (h->record_id) - { + switch (h->record_id) + { - case FRU_PICMG_BACKPLANE_P2P: - { - unsigned char index, index2; - struct fru_picmgext_slot_desc * slot_d - = (struct fru_picmgext_slot_desc*) &fru_data[offset]; + case FRU_PICMG_BACKPLANE_P2P: + { + unsigned char index, index2; + struct fru_picmgext_slot_desc * slot_d + = (struct fru_picmgext_slot_desc*) &fru_data[offset]; - offset += sizeof(struct fru_picmgext_slot_desc); - printf(" FRU_PICMG_BACKPLANE_P2P\n"); + offset += sizeof(struct fru_picmgext_slot_desc); + printf(" FRU_PICMG_BACKPLANE_P2P\n"); - for ( ; offset <= (start_offset+length) ; ) - { - printf("\n"); - printf(" Channel Type: "); - switch ( slot_d -> chan_type ) - { - case 0x00: - case 0x07: - printf("PICMG 2.9\n"); - break; - case 0x08: - printf("Single Port Fabric IF\n"); - break; - case 0x09: - printf("Double Port Fabric IF\n"); - break; - case 0x0a: - printf("Full Channel Fabric IF\n"); - break; - case 0x0b: - printf("Base IF\n"); - break; - case 0x0c: - printf("Update Channel IF\n"); - break; - default: - printf("Unknown IF\n"); - break; - } - printf(" Slot Addr. : %02x\n", slot_d -> slot_addr ); - printf(" Channel Count: %i\n", slot_d -> chn_count); + for ( ; offset <= (start_offset+length) ; ) + { + printf("\n"); + printf(" Channel Type: "); + switch ( slot_d -> chan_type ) + { + case 0x00: + case 0x07: + printf("PICMG 2.9\n"); + break; + case 0x08: + printf("Single Port Fabric IF\n"); + break; + case 0x09: + printf("Double Port Fabric IF\n"); + break; + case 0x0a: + printf("Full Channel Fabric IF\n"); + break; + case 0x0b: + printf("Base IF\n"); + break; + case 0x0c: + printf("Update Channel IF\n"); + break; + default: + printf("Unknown IF\n"); + break; + } + printf(" Slot Addr. : %02x\n", slot_d -> slot_addr ); + printf(" Channel Count: %i\n", slot_d -> chn_count); - for ( index = 0 ; index < (slot_d -> chn_count) ; index++ ) - { - struct fru_picmgext_chn_desc * d - = (struct fru_picmgext_chn_desc *) &fru_data[offset]; + for ( index = 0 ; index < (slot_d -> chn_count) ; index++ ) + { + struct fru_picmgext_chn_desc * d + = (struct fru_picmgext_chn_desc *) &fru_data[offset]; - if (verbose) - printf( " " - "Chn: %02x -> " - "Chn: %02x in " - "Slot: %02x\n", - d->local_chn, d->remote_chn, d->remote_slot); + if (verbose) + printf( " " + "Chn: %02x -> " + "Chn: %02x in " + "Slot: %02x\n", + d->local_chn, d->remote_chn, d->remote_slot); - offset += sizeof(struct fru_picmgext_chn_desc); - } + offset += sizeof(struct fru_picmgext_chn_desc); + } - slot_d = (struct fru_picmgext_slot_desc*) &fru_data[offset]; - offset += sizeof(struct fru_picmgext_slot_desc); - } - } - break; + slot_d = (struct fru_picmgext_slot_desc*) &fru_data[offset]; + offset += sizeof(struct fru_picmgext_slot_desc); + } + } + break; - case FRU_PICMG_ADDRESS_TABLE: - printf(" FRU_PICMG_ADDRESS_TABLE\n"); - break; + case FRU_PICMG_ADDRESS_TABLE: + printf(" FRU_PICMG_ADDRESS_TABLE\n"); + break; - case FRU_PICMG_SHELF_POWER_DIST: - printf(" FRU_PICMG_SHELF_POWER_DIST\n"); - break; + case FRU_PICMG_SHELF_POWER_DIST: + printf(" FRU_PICMG_SHELF_POWER_DIST\n"); + break; - case FRU_PICMG_SHELF_ACTIVATION: - printf(" FRU_PICMG_SHELF_ACTIVATION\n"); - break; + case FRU_PICMG_SHELF_ACTIVATION: + printf(" FRU_PICMG_SHELF_ACTIVATION\n"); + break; - case FRU_PICMG_SHMC_IP_CONN: - printf(" FRU_PICMG_SHMC_IP_CONN\n"); - break; + case FRU_PICMG_SHMC_IP_CONN: + printf(" FRU_PICMG_SHMC_IP_CONN\n"); + break; - case FRU_PICMG_BOARD_P2P: - printf(" FRU_PICMG_BOARD_P2P\n"); + case FRU_PICMG_BOARD_P2P: + printf(" FRU_PICMG_BOARD_P2P\n"); - guid_count = fru_data[offset]; - printf(" GUID count: %2d\n", guid_count); - for (i = 0 ; i < guid_count; i++ ) - { - printf(" GUID %2d:\n", i); - offset += sizeof(struct fru_picmgext_guid); - } + guid_count = fru_data[offset]; + printf(" GUID count: %2d\n", guid_count); + for (i = 0 ; i < guid_count; i++ ) + { + printf(" GUID %2d:\n", i); + offset += sizeof(struct fru_picmgext_guid); + } - for ( - ++offset; - offset < off + length; - offset += sizeof(struct fru_picmgext_link_desc) - ) - { - struct fru_picmgext_link_desc * d = - (struct fru_picmgext_link_desc *) &fru_data[offset]; + for ( + ++offset; + offset < off + length; + offset += sizeof(struct fru_picmgext_link_desc) + ) + { + struct fru_picmgext_link_desc * d = + (struct fru_picmgext_link_desc *) &fru_data[offset]; - printf(" Link Grouping ID: 0x%02x\n", d->grouping); - printf(" Link Type Extension: 0x%02x\n", d->ext); - printf(" Link Type: "); - if (d->type == 0 || d->type == 0xff) - { - printf("Reserved\n"); - } - else if (d->type >= 0x06 && d->type <= 0xef) - { - printf("Reserved\n"); - } - else if (d->type >= 0xf0 && d->type <= 0xfe) - { - printf("OEM GUID Definition\n"); - } - else - { - switch (d->type) - { - case FRU_PICMGEXT_LINK_TYPE_BASE: - printf("PICMG 3.0 Base Interface 10/100/1000\n"); - break; - case FRU_PICMGEXT_LINK_TYPE_FABRIC_ETHERNET: - printf("PICMG 3.1 Ethernet Fabric Interface\n"); - break; - case FRU_PICMGEXT_LINK_TYPE_FABRIC_INFINIBAND: - printf("PICMG 3.2 Infiniband Fabric Interface\n"); - break; - case FRU_PICMGEXT_LINK_TYPE_FABRIC_STAR: - printf("PICMG 3.3 Star Fabric Interface\n"); - break; - case FRU_PICMGEXT_LINK_TYPE_PCIE: - printf("PCI Express Fabric Interface\n"); - default: - printf("Invalid\n"); - } - } - printf(" Link Designator: 0x%03x\n", d->designator); - printf(" Port Flag: 0x%02x\n", d->designator >> 8); - printf(" Interface: "); - switch ((d->designator & 0xff) >> 6) - { - case FRU_PICMGEXT_DESIGN_IF_BASE: - printf("Base Interface\n"); - break; - case FRU_PICMGEXT_DESIGN_IF_FABRIC: - printf("Fabric Interface\n"); - break; - case FRU_PICMGEXT_DESIGN_IF_UPDATE_CHANNEL: - printf("Update Channel\n"); - break; - case FRU_PICMGEXT_DESIGN_IF_RESERVED: - printf("Reserved\n"); - default: - printf("Invalid"); - } - printf(" Channel Number: 0x%02x\n", d->designator & 0x1f); - printf("\n"); - } + printf(" Link Grouping ID: 0x%02x\n", d->grouping); + printf(" Link Type Extension: 0x%02x\n", d->ext); + printf(" Link Type: "); + if (d->type == 0 || d->type == 0xff) + { + printf("Reserved\n"); + } + else if (d->type >= 0x06 && d->type <= 0xef) + { + printf("Reserved\n"); + } + else if (d->type >= 0xf0 && d->type <= 0xfe) + { + printf("OEM GUID Definition\n"); + } + else + { + switch (d->type) + { + case FRU_PICMGEXT_LINK_TYPE_BASE: + printf("PICMG 3.0 Base Interface 10/100/1000\n"); + break; + case FRU_PICMGEXT_LINK_TYPE_FABRIC_ETHERNET: + printf("PICMG 3.1 Ethernet Fabric Interface\n"); + break; + case FRU_PICMGEXT_LINK_TYPE_FABRIC_INFINIBAND: + printf("PICMG 3.2 Infiniband Fabric Interface\n"); + break; + case FRU_PICMGEXT_LINK_TYPE_FABRIC_STAR: + printf("PICMG 3.3 Star Fabric Interface\n"); + break; + case FRU_PICMGEXT_LINK_TYPE_PCIE: + printf("PCI Express Fabric Interface\n"); + default: + printf("Invalid\n"); + } + } + printf(" Link Designator: 0x%03x\n", d->designator); + printf(" Port Flag: 0x%02x\n", d->designator >> 8); + printf(" Interface: "); + switch ((d->designator & 0xff) >> 6) + { + case FRU_PICMGEXT_DESIGN_IF_BASE: + printf("Base Interface\n"); + break; + case FRU_PICMGEXT_DESIGN_IF_FABRIC: + printf("Fabric Interface\n"); + break; + case FRU_PICMGEXT_DESIGN_IF_UPDATE_CHANNEL: + printf("Update Channel\n"); + break; + case FRU_PICMGEXT_DESIGN_IF_RESERVED: + printf("Reserved\n"); + default: + printf("Invalid"); + } + printf(" Channel Number: 0x%02x\n", d->designator & 0x1f); + printf("\n"); + } - break; + break; - case FRU_AMC_CURRENT: - printf(" FRU_AMC_CURRENT\n"); - break; + case FRU_AMC_CURRENT: + printf(" FRU_AMC_CURRENT\n"); + break; - case FRU_AMC_ACTIVATION: - printf(" FRU_AMC_ACTIVATION\n"); - { - unsigned short max_current; + case FRU_AMC_ACTIVATION: + printf(" FRU_AMC_ACTIVATION\n"); + { + unsigned short max_current; - max_current = fru_data[offset]; - max_current |= fru_data[++offset]<<8; - printf(" Maximum Internal Current(@12V): %i A\n", max_current / 10); - printf(" Module Activation Rediness: %i sec.\n", fru_data[++offset]); + max_current = fru_data[offset]; + max_current |= fru_data[++offset]<<8; + printf(" Maximum Internal Current(@12V): %i A\n", max_current / 10); + printf(" Module Activation Rediness: %i sec.\n", fru_data[++offset]); - printf(" Descriptor Count: %i\n", fru_data[++offset]); - printf("\n"); + printf(" Descriptor Count: %i\n", fru_data[++offset]); + printf("\n"); - for(++offset; offset < off + length; offset += sizeof(struct fru_picmgext_activation_record)) - { - struct fru_picmgext_activation_record * a = - (struct fru_picmgext_activation_record *) &fru_data[offset]; + for(++offset; offset < off + length; offset += sizeof(struct fru_picmgext_activation_record)) + { + struct fru_picmgext_activation_record * a = + (struct fru_picmgext_activation_record *) &fru_data[offset]; - printf(" IPMB-Address: 0x%x\n", a->ibmb_addr); - printf(" Max. Module Current: %i A\n", a->max_module_curr/10); - printf("\n"); - } - } - break; + printf(" IPMB-Address: 0x%x\n", a->ibmb_addr); + printf(" Max. Module Current: %i A\n", a->max_module_curr/10); + printf("\n"); + } + } + break; - case FRU_AMC_CARRIER_P2P: - printf(" FRU_CARRIER_P2P\n"); - { - unsigned int index; + case FRU_AMC_CARRIER_P2P: + printf(" FRU_CARRIER_P2P\n"); + { + unsigned int index; - for(offset; offset < off + length; ) - { - struct fru_picmgext_carrier_p2p_record * h = - (struct fru_picmgext_carrier_p2p_record *) &fru_data[offset]; + for(offset; offset < off + length; ) + { + struct fru_picmgext_carrier_p2p_record * h = + (struct fru_picmgext_carrier_p2p_record *) &fru_data[offset]; - printf("\n"); - printf(" Resource ID: %i", h->resource_id & 0x07); - printf(" Type: "); - if ((h->resource_id>>7) == 1) { - printf("AMC\n"); - } else { - printf("Local\n"); - } - printf(" Descriptor Count: %i\n", h->p2p_count); + printf("\n"); + printf(" Resource ID: %i", h->resource_id & 0x07); + printf(" Type: "); + if ((h->resource_id>>7) == 1) { + printf("AMC\n"); + } else { + printf("Local\n"); + } + printf(" Descriptor Count: %i\n", h->p2p_count); - offset += sizeof(struct fru_picmgext_carrier_p2p_record); + offset += sizeof(struct fru_picmgext_carrier_p2p_record); - for (index = 0; index < h->p2p_count; index++) - { - struct fru_picmgext_carrier_p2p_descriptor * d = - (struct fru_picmgext_carrier_p2p_descriptor*)&fru_data[offset]; + for (index = 0; index < h->p2p_count; index++) + { + struct fru_picmgext_carrier_p2p_descriptor * d = + (struct fru_picmgext_carrier_p2p_descriptor*)&fru_data[offset]; - printf(" Port: %02d\t-> Remote Port: %02d\t", - d->local_port, d->remote_port); - if((d->remote_resource_id >> 7) == 1) - printf("[ AMC ID: %02d ]\n", d->remote_resource_id & 0x07); - else - printf("[ local ID: %02d ]\n", d->remote_resource_id & 0x07); + printf(" Port: %02d\t-> Remote Port: %02d\t", + d->local_port, d->remote_port); + if((d->remote_resource_id >> 7) == 1) + printf("[ AMC ID: %02d ]\n", d->remote_resource_id & 0x07); + else + printf("[ local ID: %02d ]\n", d->remote_resource_id & 0x07); - offset += sizeof(struct fru_picmgext_carrier_p2p_descriptor); + offset += sizeof(struct fru_picmgext_carrier_p2p_descriptor); - } - } - } - break; + } + } + } + break; - case FRU_AMC_P2P: - printf(" FRU_AMC_P2P\n"); - break; + case FRU_AMC_P2P: + printf(" FRU_AMC_P2P\n"); + break; - case FRU_AMC_CARRIER_INFO: - printf(" FRU_CARRIER_INFO\n"); - break; + case FRU_AMC_CARRIER_INFO: + printf(" FRU_CARRIER_INFO\n"); + break; - default: - printf(" Unknown PICMG Extension Record ID: %x\n", h->record_id); - break; + default: + printf(" Unknown PICMG Extension Record ID: %x\n", h->record_id); + break; - } + } } @@ -1335,82 +1338,82 @@ ipmi_fru_main(struct ipmi_intf * intf, int argc, char ** argv) else if (strncmp(argv[0], "help", 4) == 0) lprintf(LOG_ERR, "FRU Commands: print read write upgEkey"); else if (strncmp(argv[0], "print", 5) == 0 || - strncmp(argv[0], "list", 4) == 0) - { - if (argc > 1) { - rc = __ipmi_fru_print(intf, strtol(argv[1], NULL, 0)); - } else { - rc = ipmi_fru_print_all(intf); - } - } - else if (!strncmp(argv[0], "read", 5)) - { - unsigned char fruId=0; - if((argc >= 3) && (strlen(argv[2]) > 0)) - { - /* There is a file name in the parameters */ - if(strlen(argv[2]) < 512) - { - fruId = atoi(argv[1]); - strcpy(fileName, argv[2]); - if (verbose) - { - printf("Fru Id : %d\n", fruId); - printf("Fru File : %s\n", fileName); - } - ipmi_fru_read_to_bin(intf,fileName,fruId); - } - else - { - fprintf(stderr,"File name must be smaller than 512 bytes\n"); - } - } - else - { - printf("fru read \n"); - } - } - else if (!strncmp(argv[0], "write", 5)) - { - unsigned char fruId=0; - if((argc >= 3) && (strlen(argv[2]) > 0)) - { - /* There is a file name in the parameters */ - if(strlen(argv[2]) < 512) - { - fruId = atoi(argv[1]); - strcpy(fileName, argv[2]); - if (verbose) - { - printf("Fru Id : %d\n", fruId); - printf("Fru File : %s\n", fileName); - } - ipmi_fru_write_from_bin(intf,fileName,fruId); - } - else - { - fprintf(stderr,"File name must be smaller than 512 bytes\n"); - } - } - else - { - fprintf(stderr,"A Fru Id and a path/file name must be specified\n"); - fprintf(stderr,"Ex.: ipmitool fru write 0 /root/fru.bin\n"); - } - } - else if(!strncmp(argv[0], "upgEkey", 7)) - { - if((argc >= 3) && (strlen(argv[2]) > 0)) - { - strcpy(fileName, argv[2]); - ipmi_fru_upg_ekeying(intf,fileName,atoi(argv[1])); + strncmp(argv[0], "list", 4) == 0) + { + if (argc > 1) { + rc = __ipmi_fru_print(intf, strtol(argv[1], NULL, 0)); + } else { + rc = ipmi_fru_print_all(intf); + } + } + else if (!strncmp(argv[0], "read", 5)) + { + unsigned char fruId=0; + if((argc >= 3) && (strlen(argv[2]) > 0)) + { + /* There is a file name in the parameters */ + if(strlen(argv[2]) < 512) + { + fruId = atoi(argv[1]); + strcpy(fileName, argv[2]); + if (verbose) + { + printf("Fru Id : %d\n", fruId); + printf("Fru File : %s\n", fileName); + } + ipmi_fru_read_to_bin(intf,fileName,fruId); + } + else + { + fprintf(stderr,"File name must be smaller than 512 bytes\n"); + } + } + else + { + printf("fru read \n"); + } + } + else if (!strncmp(argv[0], "write", 5)) + { + unsigned char fruId=0; + if((argc >= 3) && (strlen(argv[2]) > 0)) + { + /* There is a file name in the parameters */ + if(strlen(argv[2]) < 512) + { + fruId = atoi(argv[1]); + strcpy(fileName, argv[2]); + if (verbose) + { + printf("Fru Id : %d\n", fruId); + printf("Fru File : %s\n", fileName); + } + ipmi_fru_write_from_bin(intf,fileName,fruId); + } + else + { + fprintf(stderr,"File name must be smaller than 512 bytes\n"); + } + } + else + { + fprintf(stderr,"A Fru Id and a path/file name must be specified\n"); + fprintf(stderr,"Ex.: ipmitool fru write 0 /root/fru.bin\n"); + } + } + else if(!strncmp(argv[0], "upgEkey", 7)) + { + if((argc >= 3) && (strlen(argv[2]) > 0)) + { + strcpy(fileName, argv[2]); + ipmi_fru_upg_ekeying(intf,fileName,atoi(argv[1])); - } - else - { - printf("fru upgEkey \n"); - } - } + } + else + { + printf("fru upgEkey \n"); + } + } else { lprintf(LOG_ERR, "Invalid FRU command: %s", argv[0]); lprintf(LOG_ERR, "FRU Commands: print"); @@ -1420,76 +1423,76 @@ ipmi_fru_main(struct ipmi_intf * intf, int argc, char ** argv) return rc; } -static void ipmi_fru_read_to_bin(struct ipmi_intf * intf,unsigned char * pFileName, unsigned char fruId) +static void ipmi_fru_read_to_bin(struct ipmi_intf * intf, char * pFileName, unsigned char fruId) { - struct ipmi_rs * rsp; - struct ipmi_rq req; - unsigned char * fru_data; - struct fru_info fru; - unsigned char msg_data[4]; + struct ipmi_rs * rsp; + struct ipmi_rq req; + unsigned char * fru_data; + struct fru_info fru; + unsigned char msg_data[4]; - unsigned char * pFruBuf; - unsigned int counter; - unsigned int len; + unsigned char * pFruBuf; + unsigned int counter; + unsigned int len; - msg_data[0] = fruId; + msg_data[0] = fruId; - memset(&req, 0, sizeof(req)); - req.msg.netfn = IPMI_NETFN_STORAGE; - req.msg.cmd = GET_FRU_INFO; - req.msg.data = msg_data; - req.msg.data_len = 1; + memset(&req, 0, sizeof(req)); + req.msg.netfn = IPMI_NETFN_STORAGE; + req.msg.cmd = GET_FRU_INFO; + req.msg.data = msg_data; + req.msg.data_len = 1; - rsp = intf->sendrecv(intf, &req); - if (!rsp) - return; + rsp = intf->sendrecv(intf, &req); + if (!rsp) + return; - if(rsp->ccode) - { - if (rsp->ccode == 0xc3) - printf (" Timeout accessing FRU info. (Device not present?)\n"); - return; - } - fru.size = (rsp->data[1] << 8) | rsp->data[0]; - fru.access = rsp->data[2] & 0x1; + if(rsp->ccode) + { + if (rsp->ccode == 0xc3) + printf (" Timeout accessing FRU info. (Device not present?)\n"); + return; + } + fru.size = (rsp->data[1] << 8) | rsp->data[0]; + fru.access = rsp->data[2] & 0x1; - if (verbose) - { - printf("Fru Size = %d bytes\n",fru.size); - printf("Fru Access = %xh\n", fru.access); - } + if (verbose) + { + printf("Fru Size = %d bytes\n",fru.size); + printf("Fru Access = %xh\n", fru.access); + } - pFruBuf = malloc(fru.size); - if(pFruBuf != NULL) - { - printf("Fru Size : %d bytes\n",fru.size); - read_fru_area(intf, &fru, fruId, 0, fru.size, pFruBuf); - } - else - { - fprintf(stderr, "Cannot allocate %d bytes\n", fru.size); - } + pFruBuf = malloc(fru.size); + if(pFruBuf != NULL) + { + printf("Fru Size : %d bytes\n",fru.size); + read_fru_area(intf, &fru, fruId, 0, fru.size, pFruBuf); + } + else + { + fprintf(stderr, "Cannot allocate %d bytes\n", fru.size); + } - if(pFruBuf != NULL) - { - FILE * pFile; - pFile = fopen(pFileName,"wb"); - if(pFile!=NULL) - { - fwrite(pFruBuf, fru.size, 1, pFile); - printf("Done\n\r"); - } - else - { - fprintf(stderr, "Error opening file %s\n", pFileName); - } - fclose(pFile); - } - free(pFruBuf); + if(pFruBuf != NULL) + { + FILE * pFile; + pFile = fopen(pFileName, "wb"); + if(pFile!=NULL) + { + fwrite(pFruBuf, fru.size, 1, pFile); + printf("Done\n\r"); + } + else + { + fprintf(stderr, "Error opening file %s\n", pFileName); + } + fclose(pFile); + } + free(pFruBuf); } static void ipmi_fru_write_from_bin(struct ipmi_intf * intf, - unsigned char * pFileName, unsigned char fruId) + char * pFileName, unsigned char fruId) { struct ipmi_rs *rsp; struct ipmi_rq req; @@ -1551,8 +1554,8 @@ static void ipmi_fru_write_from_bin(struct ipmi_intf * intf, } static int -ipmi_fru_upg_ekeying(struct ipmi_intf * intf,unsigned char * pFileName, - unsigned char fruId) +ipmi_fru_upg_ekeying(struct ipmi_intf * intf, char * pFileName, + unsigned char fruId) { unsigned int retStatus = 0; unsigned long offFruMultiRec; @@ -1615,188 +1618,188 @@ ipmi_fru_upg_ekeying(struct ipmi_intf * intf,unsigned char * pFileName, } } -static int ipmi_fru_get_multirec_size_from_file(unsigned char * pFileName, - unsigned long * pSize, - unsigned long * pOffset) +static int ipmi_fru_get_multirec_size_from_file(char * pFileName, + unsigned long * pSize, + unsigned long * pOffset) { - struct fru_header header; - FILE * pFile; - unsigned char len = 0; - unsigned long end; + struct fru_header header; + FILE * pFile; + unsigned char len = 0; + unsigned long end; - *pSize = 0; + *pSize = 0; - pFile = fopen(pFileName,"rb"); - if(pFile!=NULL) - { - rewind(pFile); - len = fread(&header, 1, 8, pFile); - fseek(pFile, 0, SEEK_END); - end = ftell(pFile); - fclose(pFile); - } + pFile = fopen(pFileName,"rb"); + if(pFile!=NULL) + { + rewind(pFile); + len = fread(&header, 1, 8, pFile); + fseek(pFile, 0, SEEK_END); + end = ftell(pFile); + fclose(pFile); + } - if(verbose) - { - printf("File Size = %lu\n", end); - printf("Len = %lu\n", len); - } + if(verbose) + { + printf("File Size = %lu\n", end); + printf("Len = %lu\n", len); + } - if(len != 8) - { - printf("Error with file %s in getting size\n", pFileName); - return -1; - } + if(len != 8) + { + printf("Error with file %s in getting size\n", pFileName); + return -1; + } - if (header.version != 0x01) - { - printf ("Unknown FRU header version %02x.\n", header.version); - return -1; - } + if (header.version != 0x01) + { + printf ("Unknown FRU header version %02x.\n", header.version); + return -1; + } - /* Retreive length */ - if( - ((header.offset.internal * 8) > (header.offset.internal * 8)) && - ((header.offset.internal * 8) < end) - ) - { - end = (header.offset.internal * 8); - } - if( - ((header.offset.chassis * 8) > (header.offset.chassis * 8)) && - ((header.offset.chassis * 8) < end) - ) - { - end = (header.offset.chassis * 8); - } - if( - ((header.offset.board * 8) > (header.offset.board * 8)) && - ((header.offset.board * 8) < end) - ) - { - end = (header.offset.board * 8); - } - if( - ((header.offset.product * 8) > (header.offset.product * 8)) && - ((header.offset.product * 8) < end) - ) - { - end = (header.offset.product * 8); - } + /* Retreive length */ + if( + ((header.offset.internal * 8) > (header.offset.internal * 8)) && + ((header.offset.internal * 8) < end) + ) + { + end = (header.offset.internal * 8); + } + if( + ((header.offset.chassis * 8) > (header.offset.chassis * 8)) && + ((header.offset.chassis * 8) < end) + ) + { + end = (header.offset.chassis * 8); + } + if( + ((header.offset.board * 8) > (header.offset.board * 8)) && + ((header.offset.board * 8) < end) + ) + { + end = (header.offset.board * 8); + } + if( + ((header.offset.product * 8) > (header.offset.product * 8)) && + ((header.offset.product * 8) < end) + ) + { + end = (header.offset.product * 8); + } - *pSize = end - (header.offset.multi * 8); - *pOffset = (header.offset.multi * 8); + *pSize = end - (header.offset.multi * 8); + *pOffset = (header.offset.multi * 8); - return 0; + return 0; } static void ipmi_fru_get_adjust_size_from_buffer(unsigned char * fru_data, unsigned long *pSize) { - struct fru_multirec_header * head; - unsigned int last_off; - #define CHUNK_SIZE (255 + sizeof(struct fru_multirec_header)) - unsigned int count = 0; - unsigned int status = 0; - unsigned char counter; - unsigned char checksum = 0; + struct fru_multirec_header * head; + unsigned int last_off; +#define CHUNK_SIZE (255 + sizeof(struct fru_multirec_header)) + unsigned int count = 0; + unsigned int status = 0; + unsigned char counter; + unsigned char checksum = 0; - do - { - checksum = 0; - head = (struct fru_multirec_header *) (fru_data + count); + do + { + checksum = 0; + head = (struct fru_multirec_header *) (fru_data + count); - if(verbose ) - { - printf("Adding ("); - } + if(verbose ) + { + printf("Adding ("); + } - for( - counter = 0 ; - counter < sizeof (struct fru_multirec_header); - counter ++ - ) - { - if(verbose ) - { - printf(" %02X", *(fru_data + count + counter)); - } - checksum += *(fru_data + count + counter); + for( + counter = 0 ; + counter < sizeof (struct fru_multirec_header); + counter ++ + ) + { + if(verbose ) + { + printf(" %02X", *(fru_data + count + counter)); + } + checksum += *(fru_data + count + counter); - } - if( verbose ) - { - printf(")"); - } + } + if( verbose ) + { + printf(")"); + } - if( checksum != 0) - { - printf("Bad checksum in Multi Records\n"); - status = -1; - } - else if ( verbose ) - { - printf("--> OK"); - } + if( checksum != 0) + { + printf("Bad checksum in Multi Records\n"); + status = -1; + } + else if ( verbose ) + { + printf("--> OK"); + } - if((verbose > 1 ) && (checksum == 0)) - { - for( - counter = 0 ; - counter < head->len; - counter ++ - ) - { - printf(" %02X", *(fru_data + count + counter + - sizeof(struct fru_multirec_header))); - } - } - if(verbose ) - { - printf("\n"); - } - count += head->len + sizeof (struct fru_multirec_header); - } while( (!(head->format & 0x80)) && (status == 0)); + if((verbose > 1 ) && (checksum == 0)) + { + for( + counter = 0 ; + counter < head->len; + counter ++ + ) + { + printf(" %02X", *(fru_data + count + counter + + sizeof(struct fru_multirec_header))); + } + } + if(verbose ) + { + printf("\n"); + } + count += head->len + sizeof (struct fru_multirec_header); + } while( (!(head->format & 0x80)) && (status == 0)); - *pSize = count; + *pSize = count; - if (verbose > 1) - { - printf("Size of multirec: %u\n\r", *pSize); - } + if (verbose > 1) + { + printf("Size of multirec: %u\n\r", *pSize); + } } -static int ipmi_fru_get_multirec_from_file(unsigned char * pFileName, +static int ipmi_fru_get_multirec_from_file(char * pFileName, unsigned char * pBufArea, unsigned long size, unsigned long offset) { - struct fru_header header; - FILE * pFile; - unsigned long len = 0; + struct fru_header header; + FILE * pFile; + unsigned long len = 0; - pFile = fopen(pFileName,"rb"); - if(pFile!=NULL) - { - fseek(pFile, offset,SEEK_SET); - len = fread(pBufArea, size, 1, pFile); - fclose(pFile); - } - else - { - printf("Error opening file\n"); - } + pFile = fopen(pFileName,"rb"); + if(pFile!=NULL) + { + fseek(pFile, offset,SEEK_SET); + len = fread(pBufArea, size, 1, pFile); + fclose(pFile); + } + else + { + printf("Error opening file\n"); + } - if(len != 1) - { - printf("Error with file %s\n", pFileName); - return -1; - } + if(len != 1) + { + printf("Error with file %s\n", pFileName); + return -1; + } - return 0; + return 0; } @@ -1807,121 +1810,121 @@ static int ipmi_fru_get_multirec_location_from_fru(struct ipmi_intf * intf, unsigned long * pRetLocation, unsigned long * pRetSize) { - struct ipmi_rs * rsp; - struct ipmi_rq req; - unsigned char * fru_data; - unsigned char msg_data[4]; - int i, len; - unsigned long end; + struct ipmi_rs * rsp; + struct ipmi_rq req; + unsigned char * fru_data; + unsigned char msg_data[4]; + int i, len; + unsigned long end; - struct fru_header header; + struct fru_header header; - *pRetLocation = 0; + *pRetLocation = 0; - msg_data[0] = fruId; + msg_data[0] = fruId; - memset(&req, 0, sizeof(req)); - req.msg.netfn = IPMI_NETFN_STORAGE; - req.msg.cmd = GET_FRU_INFO; - req.msg.data = msg_data; - req.msg.data_len = 1; + memset(&req, 0, sizeof(req)); + req.msg.netfn = IPMI_NETFN_STORAGE; + req.msg.cmd = GET_FRU_INFO; + req.msg.data = msg_data; + req.msg.data_len = 1; - rsp = intf->sendrecv(intf, &req); - if (!rsp) { - if (verbose > 1) { - printf("no response\n"); - } - return -1; - } + rsp = intf->sendrecv(intf, &req); + if (!rsp) { + if (verbose > 1) { + printf("no response\n"); + } + return -1; + } - if(rsp->ccode) - { - if (rsp->ccode == 0xc3) { - printf (" Timeout accessing FRU info. (Device not present?)\n"); - } else { - printf (" CCODE = 0x%02x\n", rsp->ccode); - } - return -1; - } - pFruInfo->size = (rsp->data[1] << 8) | rsp->data[0]; - pFruInfo->access = rsp->data[2] & 0x1; + if(rsp->ccode) + { + if (rsp->ccode == 0xc3) { + printf (" Timeout accessing FRU info. (Device not present?)\n"); + } else { + printf (" CCODE = 0x%02x\n", rsp->ccode); + } + return -1; + } + pFruInfo->size = (rsp->data[1] << 8) | rsp->data[0]; + pFruInfo->access = rsp->data[2] & 0x1; - if (verbose > 1) - printf("pFruInfo->size = %d bytes (accessed by %s)\n", - pFruInfo->size, pFruInfo->access ? "words" : "bytes"); - if (!pFruInfo->size) { - return -1; - } + if (verbose > 1) + printf("pFruInfo->size = %d bytes (accessed by %s)\n", + pFruInfo->size, pFruInfo->access ? "words" : "bytes"); + if (!pFruInfo->size) { + return -1; + } - msg_data[0] = fruId; - msg_data[1] = 0; - msg_data[2] = 0; - msg_data[3] = 8; + msg_data[0] = fruId; + msg_data[1] = 0; + msg_data[2] = 0; + msg_data[3] = 8; - memset(&req, 0, sizeof(req)); - req.msg.netfn = IPMI_NETFN_STORAGE; - req.msg.cmd = GET_FRU_DATA; - req.msg.data = msg_data; - req.msg.data_len = 4; + memset(&req, 0, sizeof(req)); + req.msg.netfn = IPMI_NETFN_STORAGE; + req.msg.cmd = GET_FRU_DATA; + req.msg.data = msg_data; + req.msg.data_len = 4; - rsp = intf->sendrecv(intf, &req); + rsp = intf->sendrecv(intf, &req); - if (!rsp) - return -1; + if (!rsp) + return -1; - if(rsp->ccode) - { - if (rsp->ccode == 0xc3) { - printf (" Timeout while reading FRU data. (Device not present?)\n"); - } - return -1; - } + if(rsp->ccode) + { + if (rsp->ccode == 0xc3) { + printf (" Timeout while reading FRU data. (Device not present?)\n"); + } + return -1; + } - if (verbose > 1) - printbuf(rsp->data, rsp->data_len, "FRU DATA"); + if (verbose > 1) + printbuf(rsp->data, rsp->data_len, "FRU DATA"); - memcpy(&header, rsp->data + 1, 8); + memcpy(&header, rsp->data + 1, 8); - if (header.version != 0x01) - { - printf (" Unknown FRU header version %02x.\n", header.version); - return -1; - } + if (header.version != 0x01) + { + printf (" Unknown FRU header version %02x.\n", header.version); + return -1; + } - end = pFruInfo->size; + end = pFruInfo->size; - /* Retreive length */ - if( - ((header.offset.internal * 8) > (header.offset.internal * 8)) && - ((header.offset.internal * 8) < end) - ) - { - end = (header.offset.internal * 8); - } - if( - ((header.offset.chassis * 8) > (header.offset.chassis * 8)) && - ((header.offset.chassis * 8) < end) - ) - { - end = (header.offset.chassis * 8); - } - if( - ((header.offset.board * 8) > (header.offset.board * 8)) && - ((header.offset.board * 8) < end) - ) - { - end = (header.offset.board * 8); - } - if( - ((header.offset.product * 8) > (header.offset.product * 8)) && - ((header.offset.product * 8) < end) - ) - { - end = (header.offset.product * 8); - } + /* Retreive length */ + if( + ((header.offset.internal * 8) > (header.offset.internal * 8)) && + ((header.offset.internal * 8) < end) + ) + { + end = (header.offset.internal * 8); + } + if( + ((header.offset.chassis * 8) > (header.offset.chassis * 8)) && + ((header.offset.chassis * 8) < end) + ) + { + end = (header.offset.chassis * 8); + } + if( + ((header.offset.board * 8) > (header.offset.board * 8)) && + ((header.offset.board * 8) < end) + ) + { + end = (header.offset.board * 8); + } + if( + ((header.offset.product * 8) > (header.offset.product * 8)) && + ((header.offset.product * 8) < end) + ) + { + end = (header.offset.product * 8); + } - *pRetSize = end; - *pRetLocation = 8 * header.offset.multi; - return 0; + *pRetSize = end; + *pRetLocation = 8 * header.offset.multi; + return 0; } diff --git a/ipmitool/lib/ipmi_fwum.c b/ipmitool/lib/ipmi_fwum.c index 6e9c9b1..313a6e3 100644 --- a/ipmitool/lib/ipmi_fwum.c +++ b/ipmitool/lib/ipmi_fwum.c @@ -109,18 +109,18 @@ typedef struct sKFWUM_InFirmwareInfo { #define KFWUM_PAGE_SIZE 256 extern int verbose; -static unsigned char fileName[512]; +static char fileName[512]; static unsigned char firmBuf[1024 * 512]; static unsigned char firmMaj; static unsigned char firmMinSub; static void KfwumOutputHelp(void); static void KfwumMain(struct ipmi_intf *intf, tKFWUM_Task task); -static tKFWUM_Status KfwumGetFileSize(unsigned char *pFileName, +static tKFWUM_Status KfwumGetFileSize(char *pFileName, unsigned long *pFileSize); -static tKFWUM_Status KfwumSetupBuffersFromFile(unsigned char *pFileName, +static tKFWUM_Status KfwumSetupBuffersFromFile(char *pFileName, unsigned long fileSize); -static void KfwumShowProgress(const unsigned char *task, +static void KfwumShowProgress(const char *task, unsigned long current, unsigned long total); static unsigned short KfwumCalculateChecksumPadding(unsigned char *pBuffer, unsigned long totalSize); @@ -353,7 +353,7 @@ KfwumMain(struct ipmi_intf *intf, tKFWUM_Task task) } static tKFWUM_Status -KfwumGetFileSize(unsigned char *pFileName, unsigned long *pFileSize) +KfwumGetFileSize(char *pFileName, unsigned long *pFileSize) { tKFWUM_Status status = KFWUM_STATUS_ERROR; FILE *pFileHandle; @@ -376,7 +376,7 @@ KfwumGetFileSize(unsigned char *pFileName, unsigned long *pFileSize) #define MAX_BUFFER_SIZE 1024*16 static tKFWUM_Status -KfwumSetupBuffersFromFile(unsigned char *pFileName, unsigned long fileSize) +KfwumSetupBuffersFromFile(char *pFileName, unsigned long fileSize) { tKFWUM_Status status = KFWUM_STATUS_OK; FILE *pFileHandle; @@ -391,8 +391,9 @@ KfwumSetupBuffersFromFile(unsigned char *pFileName, unsigned long fileSize) rewind(pFileHandle); for (qty = 0; qty < count; qty++) { - KfwumShowProgress("Reading Firmware from File", qty, - count); + KfwumShowProgress("Reading Firmware from File", + (unsigned long)qty, + (unsigned long)count); if (fread (&firmBuf[qty * MAX_BUFFER_SIZE], 1, MAX_BUFFER_SIZE, pFileHandle) @@ -417,7 +418,7 @@ KfwumSetupBuffersFromFile(unsigned char *pFileName, unsigned long fileSize) #define PROG_LENGTH 42 void -KfwumShowProgress(const unsigned char *task, unsigned long current, +KfwumShowProgress(const char *task, unsigned long current, unsigned long total) { static unsigned long staticProgress = 0xffffffff; diff --git a/ipmitool/lib/ipmi_lanp.c b/ipmitool/lib/ipmi_lanp.c index 8ef2696..cb757f4 100644 --- a/ipmitool/lib/ipmi_lanp.c +++ b/ipmitool/lib/ipmi_lanp.c @@ -456,7 +456,7 @@ lan_set_arp_interval(struct ipmi_intf * intf, return -1; if (ival != 0) { - interval = ((uint8_t)atoi(ival) * 2) - 1; + interval = ((uint8_t)atoi((const char *)ival) * 2) - 1; rc = set_lan_param(intf, chan, IPMI_LANP_GRAT_ARP, &interval, 1); } else { interval = lp->data[0]; @@ -897,7 +897,7 @@ ipmi_lan_set_password(struct ipmi_intf * intf, data[1] = 0x02; /* set password */ if (password != NULL) - memcpy(data+2, password, __min(strlen(password), 16)); + memcpy(data+2, password, __min(strlen((const char *)password), 16)); memset(&req, 0, sizeof(req)); req.msg.netfn = IPMI_NETFN_APP; @@ -919,7 +919,7 @@ ipmi_lan_set_password(struct ipmi_intf * intf, /* adjust our session password * or we will no longer be able to communicate with BMC */ - ipmi_intf_session_set_password(intf, password); + ipmi_intf_session_set_password(intf, (char *)password); printf("Password %s for user %d\n", (password == NULL) ? "cleared" : "set", userid); @@ -1349,7 +1349,7 @@ ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv) "example: lan set 7 arp gratuitous off\n"); } else if (strncmp(argv[2], "interval", 8) == 0) { - rc = lan_set_arp_interval(intf, chan, argv[3]); + rc = lan_set_arp_interval(intf, chan, (uint8_t *)argv[3]); } else if (strncmp(argv[2], "generate", 8) == 0) { if (argc < 4) @@ -1423,7 +1423,7 @@ ipmi_lan_set(struct ipmi_intf * intf, int argc, char ** argv) /* session password * not strictly a lan setting, but its used for lan connections */ else if (strncmp(argv[1], "password", 8) == 0) { - rc = ipmi_lan_set_password(intf, 1, argv[2]); + rc = ipmi_lan_set_password(intf, 1, (uint8_t *)argv[2]); } /* snmp community string */ else if (strncmp(argv[1], "snmp", 4) == 0) { diff --git a/ipmitool/lib/ipmi_mc.c b/ipmitool/lib/ipmi_mc.c index 6683ec2..c135234 100644 --- a/ipmitool/lib/ipmi_mc.c +++ b/ipmitool/lib/ipmi_mc.c @@ -412,7 +412,7 @@ ipmi_mc_get_guid(struct ipmi_intf * intf) } if (rsp->data_len == sizeof(struct ipmi_guid)) { - uint8_t tbuf[40]; + char tbuf[40]; time_t s; memset(tbuf, 0, 40); memset(&guid, 0, sizeof(struct ipmi_guid)); diff --git a/ipmitool/lib/ipmi_pef.c b/ipmitool/lib/ipmi_pef.c index c291c29..9906f72 100644 --- a/ipmitool/lib/ipmi_pef.c +++ b/ipmitool/lib/ipmi_pef.c @@ -307,7 +307,7 @@ ipmi_pef_print_lan_dest(struct ipmi_intf * intf, uint8_t ch, uint8_t dest) "PET community"); else { rsp->data[19] = '\0'; - ipmi_pef_print_str("PET Community", &rsp->data[1]); + ipmi_pef_print_str("PET Community", (const char *)&rsp->data[1]); } } ipmi_pef_print_dec("ACK timeout/retry (secs)", timeout); diff --git a/ipmitool/lib/ipmi_picmg.c b/ipmitool/lib/ipmi_picmg.c index b513a2d..e0ee439 100644 --- a/ipmitool/lib/ipmi_picmg.c +++ b/ipmitool/lib/ipmi_picmg.c @@ -1,40 +1,40 @@ - -/* - (C) Kontron - -*/ -#include -#include -#include /* for access to link descriptor defines */ - - -int -ipmi_picmg_help (void) -{ +/* + (C) Kontron + +*/ + +#include +#include +#include /* for access to link descriptor defines */ + + +int +ipmi_picmg_help (void) +{ printf(" properties - get PICMG properties\n"); - printf(" addrinfo - get address information\n"); - printf(" activate - activate a FRU\n"); - printf(" deactivate - deactivate a FRU\n"); - printf(" policy get - get the FRU activation policy\n"); - printf(" policy set - set the FRU activation policy\n"); - printf(" portstate get - get port state \n"); + printf(" addrinfo - get address information\n"); + printf(" activate - activate a FRU\n"); + printf(" deactivate - deactivate a FRU\n"); + printf(" policy get - get the FRU activation policy\n"); + printf(" policy set - set the FRU activation policy\n"); + printf(" portstate get - get port state \n"); printf(" portstate set - set port state \n"); - printf(" led prop - get led properties\n"); - printf(" led cap - get led color capabilities\n"); - printf(" led state get - get led state\n"); - printf(" led state set - set led state\n"); - printf(" power get - get power level info\n"); - printf(" power set - set power level\n"); -} - -int -ipmi_picmg_getaddr(struct ipmi_intf * intf) -{ + printf(" led prop - get led properties\n"); + printf(" led cap - get led color capabilities\n"); + printf(" led state get - get led state\n"); + printf(" led state set - set led state\n"); + printf(" power get - get power level info\n"); + printf(" power set - set power level\n"); +} + +int +ipmi_picmg_getaddr(struct ipmi_intf * intf) +{ struct ipmi_rs * rsp; struct ipmi_rq req; - unsigned char msg_data; - + unsigned char msg_data; + memset(&req, 0, sizeof(req)); req.msg.netfn = IPMI_NETFN_PICMG; req.msg.cmd = PICMG_GET_ADDRESS_INFO_CMD; @@ -43,66 +43,66 @@ ipmi_picmg_getaddr(struct ipmi_intf * intf) msg_data = 0; rsp = intf->sendrecv(intf, &req); - if (!rsp || rsp->ccode) { - printf("Error getting address information\n"); - return -1; - } - - printf("Hardware Address : 0x%02x\n", rsp->data[1]); - printf("IPMB-0 Address : 0x%02x\n", rsp->data[2]); - printf("FRU ID : 0x%02x\n", rsp->data[4]); - printf("Site ID : 0x%02x\n", rsp->data[5]); - - printf("Site Type : "); - switch (rsp->data[6]) { - case PICMG_ATCA_BOARD: - printf("ATCA board\n"); - break; - case PICMG_POWER_ENTRY: - printf("Power Entry Module\n"); - break; - case PICMG_SHELF_FRU: - printf("Shelf FRU\n"); - break; - case PICMG_DEDICATED_SHMC: - printf("Dedicated Shelf Manager\n"); - break; - case PICMG_FAN_TRAY: - printf("Fan Tray\n"); - break; - case PICMG_FAN_FILTER_TRAY: - printf("Fan Filter Tray\n"); - break; - case PICMG_ALARM: - printf("Alarm module\n"); - break; - case PICMG_AMC: - printf("AMC\n"); - break; - case PICMG_PMC: - printf("PMC\n"); - break; - case PICMG_RTM: - printf("RTM\n"); - break; - default: - if (rsp->data[6] >= 0xc0 && rsp->data[6] <= 0xcf) { - printf("OEM\n"); - } else { - printf("unknown\n"); - } - } - - return 0; -} - -int -ipmi_picmg_properties(struct ipmi_intf * intf) -{ + if (!rsp || rsp->ccode) { + printf("Error getting address information\n"); + return -1; + } + + printf("Hardware Address : 0x%02x\n", rsp->data[1]); + printf("IPMB-0 Address : 0x%02x\n", rsp->data[2]); + printf("FRU ID : 0x%02x\n", rsp->data[4]); + printf("Site ID : 0x%02x\n", rsp->data[5]); + + printf("Site Type : "); + switch (rsp->data[6]) { + case PICMG_ATCA_BOARD: + printf("ATCA board\n"); + break; + case PICMG_POWER_ENTRY: + printf("Power Entry Module\n"); + break; + case PICMG_SHELF_FRU: + printf("Shelf FRU\n"); + break; + case PICMG_DEDICATED_SHMC: + printf("Dedicated Shelf Manager\n"); + break; + case PICMG_FAN_TRAY: + printf("Fan Tray\n"); + break; + case PICMG_FAN_FILTER_TRAY: + printf("Fan Filter Tray\n"); + break; + case PICMG_ALARM: + printf("Alarm module\n"); + break; + case PICMG_AMC: + printf("AMC\n"); + break; + case PICMG_PMC: + printf("PMC\n"); + break; + case PICMG_RTM: + printf("RTM\n"); + break; + default: + if (rsp->data[6] >= 0xc0 && rsp->data[6] <= 0xcf) { + printf("OEM\n"); + } else { + printf("unknown\n"); + } + } + + return 0; +} + +int +ipmi_picmg_properties(struct ipmi_intf * intf) +{ struct ipmi_rs * rsp; struct ipmi_rq req; - unsigned char msg_data; - + unsigned char msg_data; + memset(&req, 0, sizeof(req)); req.msg.netfn = IPMI_NETFN_PICMG; req.msg.cmd = PICMG_GET_PICMG_PROPERTIES_CMD; @@ -111,74 +111,74 @@ ipmi_picmg_properties(struct ipmi_intf * intf) msg_data = 0; rsp = intf->sendrecv(intf, &req); - if (!rsp || rsp->ccode) { - printf("Error getting address information\n"); - return -1; - } - - printf("PICMG identifier : 0x%02x\n", rsp->data[0]); - 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("FRU Device ID : 0x%02x\n", rsp->data[3]); -} - - - -#define PICMG_FRU_DEACTIVATE (unsigned char) 0x00 -#define PICMG_FRU_ACTIVATE (unsigned char) 0x01 - -int -ipmi_picmg_fru_activation(struct ipmi_intf * intf, int argc, char ** argv, unsigned char state) -{ + if (!rsp || rsp->ccode) { + printf("Error getting address information\n"); + return -1; + } + + printf("PICMG identifier : 0x%02x\n", rsp->data[0]); + 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("FRU Device ID : 0x%02x\n", rsp->data[3]); +} + + + +#define PICMG_FRU_DEACTIVATE (unsigned char) 0x00 +#define PICMG_FRU_ACTIVATE (unsigned char) 0x01 + +int +ipmi_picmg_fru_activation(struct ipmi_intf * intf, int argc, char ** argv, unsigned char state) +{ struct ipmi_rs * rsp; struct ipmi_rq req; - - struct picmg_set_fru_activation_cmd cmd; - + + struct picmg_set_fru_activation_cmd cmd; + memset(&req, 0, sizeof(req)); req.msg.netfn = IPMI_NETFN_PICMG; req.msg.cmd = PICMG_FRU_ACTIVATION_CMD; req.msg.data = (unsigned char*) &cmd; req.msg.data_len = 3; - - cmd.picmg_id = 0; /* PICMG identifier */ - cmd.fru_id = (unsigned char) atoi(argv[0]); /* FRU ID */ + + cmd.picmg_id = 0; /* PICMG identifier */ + cmd.fru_id = (unsigned char) atoi(argv[0]); /* FRU ID */ cmd.fru_state = state; - rsp = intf->sendrecv(intf, &req); - - if (!rsp || rsp->ccode) { - printf("Error activation/deactivation of FRU\n"); - return -1; - } - if (rsp->data[0] != 0x00) { - printf("Error\n"); - } - - return 0; -} - - -int -ipmi_picmg_fru_activation_policy_get(struct ipmi_intf * intf, int argc, char ** argv) -{ + rsp = intf->sendrecv(intf, &req); + + if (!rsp || rsp->ccode) { + printf("Error activation/deactivation of FRU\n"); + return -1; + } + if (rsp->data[0] != 0x00) { + printf("Error\n"); + } + + return 0; +} + + +int +ipmi_picmg_fru_activation_policy_get(struct ipmi_intf * intf, int argc, char ** argv) +{ struct ipmi_rs * rsp; struct ipmi_rq req; - - unsigned char msg_data[4]; - + + unsigned char msg_data[4]; + memset(&req, 0, sizeof(req)); req.msg.netfn = IPMI_NETFN_PICMG; req.msg.cmd = PICMG_GET_FRU_POLICY_CMD; req.msg.data = msg_data; req.msg.data_len = 2; - - msg_data[0] = 0; /* PICMG identifier */ - msg_data[1] = (unsigned char) atoi(argv[0]); /* FRU ID */ + + msg_data[0] = 0; /* PICMG identifier */ + msg_data[1] = (unsigned char) atoi(argv[0]); /* FRU ID */ - rsp = intf->sendrecv(intf, &req); - + rsp = intf->sendrecv(intf, &req); + if (!rsp) { printf("no response\n"); return -1; @@ -187,37 +187,37 @@ ipmi_picmg_fru_activation_policy_get(struct ipmi_intf * intf, int argc, char ** if (rsp->ccode) { printf("returned CC code 0x%02x\n", rsp->ccode); return -1; - } - - printf("Activation Policy for FRU %x: ", atoi(argv[0]) ); - printf(" %s\n",(*(rsp->data+3)&0x01 == 0x01)?"is locked":"is not locked"); - - return 0; -} - -int -ipmi_picmg_portstate_get(struct ipmi_intf * intf, int argc, char ** argv) -{ + } + + printf("Activation Policy for FRU %x: ", atoi(argv[0]) ); + printf(" %s\n",(*(rsp->data+3)&0x01 == 0x01)?"is locked":"is not locked"); + + return 0; +} + +int +ipmi_picmg_portstate_get(struct ipmi_intf * intf, int argc, char ** argv) +{ struct ipmi_rs * rsp; struct ipmi_rq req; - - unsigned char msg_data[4]; - - struct fru_picmgext_link_desc* d; /* descriptor pointer for rec. data */ - + + unsigned char msg_data[4]; + + struct fru_picmgext_link_desc* d; /* descriptor pointer for rec. data */ + memset(&req, 0, sizeof(req)); - + req.msg.netfn = IPMI_NETFN_PICMG; req.msg.cmd = PICMG_GET_PORT_STATE_CMD; req.msg.data = msg_data; req.msg.data_len = 2; - - msg_data[0] = 0x00; /* PICMG identifier */ - msg_data[1] = (atoi(argv[0]) & 0x3)<<6; /* interface */ + + msg_data[0] = 0x00; /* PICMG identifier */ + msg_data[1] = (atoi(argv[0]) & 0x3)<<6; /* interface */ msg_data[1] |= (atoi(argv[1]) & 0x3F); /* channel number */ - - rsp = intf->sendrecv(intf, &req); - + + rsp = intf->sendrecv(intf, &req); + if (!rsp) { printf("no response\n"); return -1; @@ -226,14 +226,14 @@ ipmi_picmg_portstate_get(struct ipmi_intf * intf, int argc, char ** argv) if (rsp->ccode) { printf("returned CC code 0x%02x\n", rsp->ccode); return -1; - } - - if (rsp->data_len == 6) { - d = (struct fru_picmgext_link_desc *) &(rsp->data[1]); - + } + + if (rsp->data_len == 6) { + d = (struct fru_picmgext_link_desc *) &(rsp->data[1]); + printf(" Link Grouping ID: 0x%02x\n", d->grouping); printf(" Link Type Extension: 0x%02x\n", d->ext); - printf(" Link Type: "); + printf(" Link Type: "); if (d->type == 0 || d->type == 0xff) { printf("Reserved\n"); @@ -288,46 +288,46 @@ ipmi_picmg_portstate_get(struct ipmi_intf * intf, int argc, char ** argv) printf("Invalid"); } printf(" Channel Number: 0x%02x\n", d->designator & 0x1f); - printf("\n"); + printf("\n"); printf(" STATE: %s\n", rsp->data[5] == 0x01?"enabled":"disabled"); - } - - - return 0; -} - -int -ipmi_picmg_portstate_set(struct ipmi_intf * intf, int argc, char ** argv) -{ + } + + + return 0; +} + +int +ipmi_picmg_portstate_set(struct ipmi_intf * intf, int argc, char ** argv) +{ struct ipmi_rs * rsp; struct ipmi_rq req; - - unsigned char msg_data[6]; - struct fru_picmgext_link_desc* d; - + + unsigned char msg_data[6]; + struct fru_picmgext_link_desc* d; + memset(&req, 0, sizeof(req)); - + req.msg.netfn = IPMI_NETFN_PICMG; req.msg.cmd = PICMG_SET_PORT_STATE_CMD; req.msg.data = msg_data; - req.msg.data_len = 6; - - msg_data[0] = 0x00; /* PICMG identifier */ + req.msg.data_len = 6; - d = (struct fru_picmgext_link_desc*) &(msg_data[1]); - - d->designator = (unsigned char) (atoi(argv[0]) & 0x1F); /* channel */ - d->designator = (unsigned char) ((atoi(argv[1]) & 0x03) << 6); /* interface */ - d->designator = (unsigned char) ((atoi(argv[2]) & 0x03) << 8); /* port */ - - d->type = (unsigned char) (atoi(argv[3]) & 0xFF); /* link type */ - d->ext = (unsigned char) (atoi(argv[4]) & 0x03); /* type ext */ - d->grouping = (unsigned char) (atoi(argv[5]) & 0xFF); /* type ext */ - - msg_data[5] = (unsigned char) (atoi(argv[6]) & 0x01); /* en/dis */ + msg_data[0] = 0x00; /* PICMG identifier */ + + d = (struct fru_picmgext_link_desc*) &(msg_data[1]); + + d->designator = (unsigned char) (atoi(argv[0]) & 0x1F); /* channel */ + d->designator = (unsigned char) ((atoi(argv[1]) & 0x03) << 6); /* interface */ + d->designator = (unsigned char) ((atoi(argv[2]) & 0x03) << 8); /* port */ + + d->type = (unsigned char) (atoi(argv[3]) & 0xFF); /* link type */ + d->ext = (unsigned char) (atoi(argv[4]) & 0x03); /* type ext */ + d->grouping = (unsigned char) (atoi(argv[5]) & 0xFF); /* type ext */ + + msg_data[5] = (unsigned char) (atoi(argv[6]) & 0x01); /* en/dis */ + + rsp = intf->sendrecv(intf, &req); - rsp = intf->sendrecv(intf, &req); - if (!rsp) { printf("no response\n"); return -1; @@ -336,31 +336,31 @@ ipmi_picmg_portstate_set(struct ipmi_intf * intf, int argc, char ** argv) if (rsp->ccode) { printf("returned CC code 0x%02x\n", rsp->ccode); return -1; - } - - return 0; -} - -int -ipmi_picmg_get_led_properties(struct ipmi_intf * intf, int argc, char ** argv) -{ + } + + return 0; +} + +int +ipmi_picmg_get_led_properties(struct ipmi_intf * intf, int argc, char ** argv) +{ struct ipmi_rs * rsp; struct ipmi_rq req; - - unsigned char msg_data[6]; - + + unsigned char msg_data[6]; + memset(&req, 0, sizeof(req)); - + req.msg.netfn = IPMI_NETFN_PICMG; req.msg.cmd = PICMG_GET_FRU_LED_PROPERTIES_CMD; req.msg.data = msg_data; - req.msg.data_len = 2; - - msg_data[0] = 0x00; /* PICMG identifier */ - msg_data[1] = atoi(argv[0]); /* FRU-ID */ - - rsp = intf->sendrecv(intf, &req); - + req.msg.data_len = 2; + + msg_data[0] = 0x00; /* PICMG identifier */ + msg_data[1] = atoi(argv[0]); /* FRU-ID */ + + rsp = intf->sendrecv(intf, &req); + if (!rsp) { printf("no response\n"); return -1; @@ -369,37 +369,37 @@ ipmi_picmg_get_led_properties(struct ipmi_intf * intf, int argc, char ** argv) if (rsp->ccode) { printf("returned CC code 0x%02x\n", rsp->ccode); return -1; - } - - printf("General Status LED Properties: 0x%2x\n\r", rsp->data[1] ); - printf("App. Specific LED Count: 0x%2x\n\r", rsp->data[2] ); - - return 0; -} - -int -ipmi_picmg_get_led_capabilities(struct ipmi_intf * intf, int argc, char ** argv) -{ - int i; + } + + printf("General Status LED Properties: 0x%2x\n\r", rsp->data[1] ); + printf("App. Specific LED Count: 0x%2x\n\r", rsp->data[2] ); + + return 0; +} + +int +ipmi_picmg_get_led_capabilities(struct ipmi_intf * intf, int argc, char ** argv) +{ + int i; struct ipmi_rs * rsp; struct ipmi_rq req; - - unsigned char msg_data[6]; - + + unsigned char msg_data[6]; + memset(&req, 0, sizeof(req)); - + req.msg.netfn = IPMI_NETFN_PICMG; req.msg.cmd = PICMG_GET_LED_COLOR_CAPABILITIES_CMD; req.msg.data = msg_data; - req.msg.data_len = 3; - - msg_data[0] = 0x00; /* PICMG identifier */ - msg_data[1] = atoi(argv[0]); /* FRU-ID */ - msg_data[2] = atoi(argv[1]); /* LED-ID */ - - - rsp = intf->sendrecv(intf, &req); - + req.msg.data_len = 3; + + msg_data[0] = 0x00; /* PICMG identifier */ + msg_data[1] = atoi(argv[0]); /* FRU-ID */ + msg_data[2] = atoi(argv[1]); /* LED-ID */ + + + rsp = intf->sendrecv(intf, &req); + if (!rsp) { printf("no response\n"); return -1; @@ -408,46 +408,46 @@ ipmi_picmg_get_led_capabilities(struct ipmi_intf * intf, int argc, char ** argv) if (rsp->ccode) { printf("returned CC code 0x%02x\n", rsp->ccode); return -1; - } - - printf("LED Color Capabilities: ", rsp->data[1] ); - for ( i=0 ; i<8 ; i++ ) { - if ( rsp->data[1] & (0x01 << i) ) { - printf("%s, ", led_color_str[ i ]); - } - } - printf("\n\r"); - - printf("Default LED Color in\n\r"); - printf(" LOCAL control: %s\n\r", led_color_str[ rsp->data[2] ] ); - printf(" OVERRIDE state: %s\n\r", led_color_str[ rsp->data[3] ] ); - - return 0; -} - -int -ipmi_picmg_get_led_state(struct ipmi_intf * intf, int argc, char ** argv) -{ - int i; + } + + printf("LED Color Capabilities: ", rsp->data[1] ); + for ( i=0 ; i<8 ; i++ ) { + if ( rsp->data[1] & (0x01 << i) ) { + printf("%s, ", led_color_str[ i ]); + } + } + printf("\n\r"); + + printf("Default LED Color in\n\r"); + printf(" LOCAL control: %s\n\r", led_color_str[ rsp->data[2] ] ); + printf(" OVERRIDE state: %s\n\r", led_color_str[ rsp->data[3] ] ); + + return 0; +} + +int +ipmi_picmg_get_led_state(struct ipmi_intf * intf, int argc, char ** argv) +{ + int i; struct ipmi_rs * rsp; struct ipmi_rq req; - - unsigned char msg_data[6]; - + + unsigned char msg_data[6]; + memset(&req, 0, sizeof(req)); - + req.msg.netfn = IPMI_NETFN_PICMG; req.msg.cmd = PICMG_GET_FRU_LED_STATE_CMD; req.msg.data = msg_data; - req.msg.data_len = 3; - - msg_data[0] = 0x00; /* PICMG identifier */ - msg_data[1] = atoi(argv[0]); /* FRU-ID */ - msg_data[2] = atoi(argv[1]); /* LED-ID */ - - - rsp = intf->sendrecv(intf, &req); - + req.msg.data_len = 3; + + msg_data[0] = 0x00; /* PICMG identifier */ + msg_data[1] = atoi(argv[0]); /* FRU-ID */ + msg_data[2] = atoi(argv[1]); /* LED-ID */ + + + rsp = intf->sendrecv(intf, &req); + if (!rsp) { printf("no response\n"); return -1; @@ -456,54 +456,54 @@ ipmi_picmg_get_led_state(struct ipmi_intf * intf, int argc, char ** argv) if (rsp->ccode) { printf("returned CC code 0x%02x\n", rsp->ccode); return -1; - } - - printf("LED states: %x\n\r", rsp->data[1] ); - printf(" Local Control function: %x\n\r", rsp->data[2] ); - printf(" Local Control On-Duration: %x\n\r", rsp->data[3] ); - printf(" Local Control Color: %s\n\r", led_color_str[ rsp->data[4] ]); - - /* override state or lamp test */ - if (rsp->data[1] == 0x01) { - printf(" Override function: %x\n\r", rsp->data[5] ); - printf(" Override On-Duration: %x\n\r", rsp->data[6] ); - printf(" Override Color: %s\n\r", led_color_str[ rsp->data[7] ]); - - }else if (rsp->data[1] == 0x03) { - printf(" Override function: %x\n\r", rsp->data[5] ); - printf(" Override On-Duration: %x\n\r", rsp->data[6] ); - printf(" Override Color: %s\n\r", led_color_str[ rsp->data[7] ]); - printf(" Lamp test duration: %x\n\r", rsp->data[8] ); - } - - return 0; -} - -int -ipmi_picmg_set_led_state(struct ipmi_intf * intf, int argc, char ** argv) -{ - int i; + } + + printf("LED states: %x\n\r", rsp->data[1] ); + printf(" Local Control function: %x\n\r", rsp->data[2] ); + printf(" Local Control On-Duration: %x\n\r", rsp->data[3] ); + printf(" Local Control Color: %s\n\r", led_color_str[ rsp->data[4] ]); + + /* override state or lamp test */ + if (rsp->data[1] == 0x01) { + printf(" Override function: %x\n\r", rsp->data[5] ); + printf(" Override On-Duration: %x\n\r", rsp->data[6] ); + printf(" Override Color: %s\n\r", led_color_str[ rsp->data[7] ]); + + }else if (rsp->data[1] == 0x03) { + printf(" Override function: %x\n\r", rsp->data[5] ); + printf(" Override On-Duration: %x\n\r", rsp->data[6] ); + printf(" Override Color: %s\n\r", led_color_str[ rsp->data[7] ]); + printf(" Lamp test duration: %x\n\r", rsp->data[8] ); + } + + return 0; +} + +int +ipmi_picmg_set_led_state(struct ipmi_intf * intf, int argc, char ** argv) +{ + int i; struct ipmi_rs * rsp; struct ipmi_rq req; - - unsigned char msg_data[6]; - + + unsigned char msg_data[6]; + memset(&req, 0, sizeof(req)); - + req.msg.netfn = IPMI_NETFN_PICMG; req.msg.cmd = PICMG_SET_FRU_LED_STATE_CMD; req.msg.data = msg_data; - req.msg.data_len = 6; - - msg_data[0] = 0x00; /* PICMG identifier */ - msg_data[1] = atoi(argv[0]); /* FRU-ID */ - msg_data[2] = atoi(argv[1]); /* LED-ID */ - msg_data[3] = atoi(argv[2]); /* LED function */ - msg_data[4] = atoi(argv[3]); /* LED on duration */ - msg_data[5] = atoi(argv[4]); /* LED color */ - - rsp = intf->sendrecv(intf, &req); - + req.msg.data_len = 6; + + msg_data[0] = 0x00; /* PICMG identifier */ + msg_data[1] = atoi(argv[0]); /* FRU-ID */ + msg_data[2] = atoi(argv[1]); /* LED-ID */ + msg_data[3] = atoi(argv[2]); /* LED function */ + msg_data[4] = atoi(argv[3]); /* LED on duration */ + msg_data[5] = atoi(argv[4]); /* LED color */ + + rsp = intf->sendrecv(intf, &req); + if (!rsp) { printf("no response\n"); return -1; @@ -512,35 +512,35 @@ ipmi_picmg_set_led_state(struct ipmi_intf * intf, int argc, char ** argv) if (rsp->ccode) { printf("returned CC code 0x%02x\n", rsp->ccode); return -1; - } - - - return 0; -} - -int -ipmi_picmg_get_power_level(struct ipmi_intf * intf, int argc, char ** argv) -{ - int i; + } + + + return 0; +} + +int +ipmi_picmg_get_power_level(struct ipmi_intf * intf, int argc, char ** argv) +{ + int i; struct ipmi_rs * rsp; struct ipmi_rq req; - - unsigned char msg_data[6]; - + + unsigned char msg_data[6]; + memset(&req, 0, sizeof(req)); - + req.msg.netfn = IPMI_NETFN_PICMG; req.msg.cmd = PICMG_GET_POWER_LEVEL_CMD; req.msg.data = msg_data; - req.msg.data_len = 3; - - msg_data[0] = 0x00; /* PICMG identifier */ - msg_data[1] = atoi(argv[0]); /* FRU-ID */ - msg_data[2] = atoi(argv[1]); /* Power type */ - - - rsp = intf->sendrecv(intf, &req); - + req.msg.data_len = 3; + + msg_data[0] = 0x00; /* PICMG identifier */ + msg_data[1] = atoi(argv[0]); /* FRU-ID */ + msg_data[2] = atoi(argv[1]); /* Power type */ + + + rsp = intf->sendrecv(intf, &req); + if (!rsp) { printf("no response\n"); return -1; @@ -549,199 +549,199 @@ ipmi_picmg_get_power_level(struct ipmi_intf * intf, int argc, char ** argv) if (rsp->ccode) { printf("returned CC code 0x%02x\n", rsp->ccode); return -1; - } - - printf("Dynamic Power Configuration: %s\n", (rsp->data[1]&0x80)==0x80?"enabled":"disabled" ); - printf("Actual Power Level: %i\n", (rsp->data[1] & 0xf)); - printf("Delay to stable Power: %i\n", rsp->data[2]); - printf("Power Multiplier: %i\n", rsp->data[3]); - - - for ( i = 1; i+3 < rsp->data_len ; i++ ) { - printf(" Power Draw %i: %i\n", i, rsp->data[i+3]); - } - return 0; -} - -int -ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv) -{ - int rc; - + } + + printf("Dynamic Power Configuration: %s\n", (rsp->data[1]&0x80)==0x80?"enabled":"disabled" ); + printf("Actual Power Level: %i\n", (rsp->data[1] & 0xf)); + printf("Delay to stable Power: %i\n", rsp->data[2]); + printf("Power Multiplier: %i\n", rsp->data[3]); + + + for ( i = 1; i+3 < rsp->data_len ; i++ ) { + printf(" Power Draw %i: %i\n", i, rsp->data[i+3]); + } + return 0; +} + +int +ipmi_picmg_main (struct ipmi_intf * intf, int argc, char ** argv) +{ + int rc; + if (argc == 0 || (!strncmp(argv[0], "help", 4))) { ipmi_picmg_help(); return 0; - } - - /* address info command */ - else if (!strncmp(argv[0], "addrinfo", 8)) { - rc = ipmi_picmg_getaddr(intf); - } - - /* picmg properties command */ - else if (!strncmp(argv[0], "properties", 10)) { - rc = ipmi_picmg_properties(intf); - } - - /* fru activation command */ - else if (!strncmp(argv[0], "activate", 8)) { - if (argc > 1) { - rc = ipmi_picmg_fru_activation(intf, argc-1, &(argv[1]), PICMG_FRU_ACTIVATE); - } - else { - printf("specify the FRU to activate\n"); - return -1; - } - } - - /* fru deactivation command */ - else if (!strncmp(argv[0], "deactivate", 10)) { - if (argc > 1) { - rc = ipmi_picmg_fru_activation(intf, argc-1, &(argv[1]), PICMG_FRU_DEACTIVATE); - }else { - printf("specify the FRU to deactivate\n"); - return -1; - } - } - - /* activation policy command */ - else if (!strncmp(argv[0], "policy", 6)) { - if (argc > 2) { - if (!strncmp(argv[1], "get", 3)) { - rc = ipmi_picmg_fru_activation_policy_get(intf, argc-1, &(argv[2])); - } - else if (!strncmp(argv[1], "set", 6)) { - printf("tbd\n"); - return -1; - } - else { - printf("specify fru\n"); - return -1; - } - }else { - printf("wrong parameters\n"); - return -1; - } - } - - /* portstate command */ - else if (!strncmp(argv[0], "portstate", 9)) { - if (argc > 2) { - if (!strncmp(argv[1], "get", 3)) { - rc = ipmi_picmg_portstate_get(intf, argc-1, &(argv[2])); - } + } - else { - printf("portstate get \n"); - } - } - - else if (!strncmp(argv[1], "set", 3)) { - if (argc > 5) { - rc = ipmi_picmg_portstate_set(intf, argc-1, &(argv[2])); - } - else { - printf("portstate set \n"); - return -1; - } - } - else { - printf("|\n"); - return -1; - } - } - - /* ATCA led commands */ - else if (!strncmp(argv[0], "led", 3)) { - if (argc > 1) { - if (!strncmp(argv[1], "prop", 4)) { - if (argc > 2) { - rc = ipmi_picmg_get_led_properties(intf, argc-1, &(argv[2])); - } - else { - printf("led prop \n"); - } - } - else if (!strncmp(argv[1], "cap", 3)) { - if (argc > 3) { - rc = ipmi_picmg_get_led_capabilities(intf, argc-1, &(argv[2])); - } - else { - printf("led cap \n"); - } - } - else if (!strncmp(argv[1], "get", 3)) { - if (argc > 3) { - rc = ipmi_picmg_get_led_state(intf, argc-1, &(argv[2])); - } - else { - printf("led get \n"); - } - } - else if (!strncmp(argv[1], "set", 3)) { - if (argc > 6) { - rc = ipmi_picmg_set_led_state(intf, argc-1, &(argv[2])); - } - else { - printf("led set \n"); - printf(" \n"); - printf(" \n"); - printf(" 0: LED OFF override\n"); - printf(" 1 - 250: LED blinking override (off duration)\n"); - printf(" 251: LED Lamp Test\n"); - printf(" 252: LED restore to local control\n"); - printf(" 255: LED ON override\n"); - printf(" 1 - 127: LED Lamp Test / on duration\n"); - printf(" \n"); - } - } - else { - printf("prop | cap | get | set\n"); - } - } - } - /* power commands */ - else if (!strncmp(argv[0], "power", 5)) { - if (argc > 1) { - if (!strncmp(argv[1], "get", 3)) { - if (argc > 3) { - rc = ipmi_picmg_get_power_level(intf, argc-1, &(argv[2])); - } - else { - printf("power get \n"); - printf(" 0 : steady state powert draw levels\n"); - printf(" 1 : desired steady state draw levels\n"); - printf(" 2 : early power draw levels\n"); - printf(" 3 : desired early levels\n"); - - return -1; - } - } - else if (!strncmp(argv[1], "set", 3)) { - if (argc > 5) { - printf("not implemented yet\n"); - } - else { - return -1; - } - } - else { - printf("|\n"); - return -1; - } - } - else { - printf("|\n"); - return -1; - } - } - - else { - - ipmi_picmg_help(); - return -1; - } + /* address info command */ + else if (!strncmp(argv[0], "addrinfo", 8)) { + rc = ipmi_picmg_getaddr(intf); + } - return rc; + /* picmg properties command */ + else if (!strncmp(argv[0], "properties", 10)) { + rc = ipmi_picmg_properties(intf); + } -} + /* fru activation command */ + else if (!strncmp(argv[0], "activate", 8)) { + if (argc > 1) { + rc = ipmi_picmg_fru_activation(intf, argc-1, &(argv[1]), PICMG_FRU_ACTIVATE); + } + else { + printf("specify the FRU to activate\n"); + return -1; + } + } + + /* fru deactivation command */ + else if (!strncmp(argv[0], "deactivate", 10)) { + if (argc > 1) { + rc = ipmi_picmg_fru_activation(intf, argc-1, &(argv[1]), PICMG_FRU_DEACTIVATE); + }else { + printf("specify the FRU to deactivate\n"); + return -1; + } + } + + /* activation policy command */ + else if (!strncmp(argv[0], "policy", 6)) { + if (argc > 2) { + if (!strncmp(argv[1], "get", 3)) { + rc = ipmi_picmg_fru_activation_policy_get(intf, argc-1, &(argv[2])); + } + else if (!strncmp(argv[1], "set", 6)) { + printf("tbd\n"); + return -1; + } + else { + printf("specify fru\n"); + return -1; + } + }else { + printf("wrong parameters\n"); + return -1; + } + } + + /* portstate command */ + else if (!strncmp(argv[0], "portstate", 9)) { + if (argc > 2) { + if (!strncmp(argv[1], "get", 3)) { + rc = ipmi_picmg_portstate_get(intf, argc-1, &(argv[2])); + } + + else { + printf("portstate get \n"); + } + } + + else if (!strncmp(argv[1], "set", 3)) { + if (argc > 5) { + rc = ipmi_picmg_portstate_set(intf, argc-1, &(argv[2])); + } + else { + printf("portstate set \n"); + return -1; + } + } + else { + printf("|\n"); + return -1; + } + } + + /* ATCA led commands */ + else if (!strncmp(argv[0], "led", 3)) { + if (argc > 1) { + if (!strncmp(argv[1], "prop", 4)) { + if (argc > 2) { + rc = ipmi_picmg_get_led_properties(intf, argc-1, &(argv[2])); + } + else { + printf("led prop \n"); + } + } + else if (!strncmp(argv[1], "cap", 3)) { + if (argc > 3) { + rc = ipmi_picmg_get_led_capabilities(intf, argc-1, &(argv[2])); + } + else { + printf("led cap \n"); + } + } + else if (!strncmp(argv[1], "get", 3)) { + if (argc > 3) { + rc = ipmi_picmg_get_led_state(intf, argc-1, &(argv[2])); + } + else { + printf("led get \n"); + } + } + else if (!strncmp(argv[1], "set", 3)) { + if (argc > 6) { + rc = ipmi_picmg_set_led_state(intf, argc-1, &(argv[2])); + } + else { + printf("led set \n"); + printf(" \n"); + printf(" \n"); + printf(" 0: LED OFF override\n"); + printf(" 1 - 250: LED blinking override (off duration)\n"); + printf(" 251: LED Lamp Test\n"); + printf(" 252: LED restore to local control\n"); + printf(" 255: LED ON override\n"); + printf(" 1 - 127: LED Lamp Test / on duration\n"); + printf(" \n"); + } + } + else { + printf("prop | cap | get | set\n"); + } + } + } + /* power commands */ + else if (!strncmp(argv[0], "power", 5)) { + if (argc > 1) { + if (!strncmp(argv[1], "get", 3)) { + if (argc > 3) { + rc = ipmi_picmg_get_power_level(intf, argc-1, &(argv[2])); + } + else { + printf("power get \n"); + printf(" 0 : steady state powert draw levels\n"); + printf(" 1 : desired steady state draw levels\n"); + printf(" 2 : early power draw levels\n"); + printf(" 3 : desired early levels\n"); + + return -1; + } + } + else if (!strncmp(argv[1], "set", 3)) { + if (argc > 5) { + printf("not implemented yet\n"); + } + else { + return -1; + } + } + else { + printf("|\n"); + return -1; + } + } + else { + printf("|\n"); + return -1; + } + } + + else { + + ipmi_picmg_help(); + return -1; + } + + return rc; + +} diff --git a/ipmitool/lib/ipmi_sdr.c b/ipmitool/lib/ipmi_sdr.c index 15d0335..691cdf0 100644 --- a/ipmitool/lib/ipmi_sdr.c +++ b/ipmitool/lib/ipmi_sdr.c @@ -3191,39 +3191,39 @@ ipmi_sdr_find_sdr_byid(struct ipmi_intf *intf, char *id) for (e = sdr_list_head; e != NULL; e = e->next) { switch (e->type) { case SDR_RECORD_TYPE_FULL_SENSOR: - if (!strncmp(e->record.full->id_string, id, - __max(e->record.full->id_code & 0x1f, - idlen))) + if (!strncmp((const char *)e->record.full->id_string, + (const char *)id, + __max(e->record.full->id_code & 0x1f, idlen))) return e; break; case SDR_RECORD_TYPE_COMPACT_SENSOR: - if (!strncmp(e->record.compact->id_string, id, - __max(e->record.compact->id_code & 0x1f, - idlen))) + if (!strncmp((const char *)e->record.compact->id_string, + (const char *)id, + __max(e->record.compact->id_code & 0x1f, idlen))) return e; break; case SDR_RECORD_TYPE_EVENTONLY_SENSOR: - if (!strncmp(e->record.eventonly->id_string, id, - __max(e->record.eventonly->id_code & 0x1f, - idlen))) + if (!strncmp((const char *)e->record.eventonly->id_string, + (const char *)id, + __max(e->record.eventonly->id_code & 0x1f, idlen))) return e; break; case SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR: - if (!strncmp(e->record.genloc->id_string, id, - __max(e->record.genloc->id_code & 0x1f, - idlen))) + if (!strncmp((const char *)e->record.genloc->id_string, + (const char *)id, + __max(e->record.genloc->id_code & 0x1f, idlen))) return e; break; case SDR_RECORD_TYPE_FRU_DEVICE_LOCATOR: - if (!strncmp(e->record.fruloc->id_string, id, - __max(e->record.fruloc->id_code & 0x1f, - idlen))) + if (!strncmp((const char *)e->record.fruloc->id_string, + (const char *)id, + __max(e->record.fruloc->id_code & 0x1f, idlen))) return e; break; case SDR_RECORD_TYPE_MC_DEVICE_LOCATOR: - if (!strncmp(e->record.mcloc->id_string, id, - __max(e->record.mcloc->id_code & 0x1f, - idlen))) + if (!strncmp((const char *)e->record.mcloc->id_string, + (const char *)id, + __max(e->record.mcloc->id_code & 0x1f, idlen))) return e; break; } @@ -3251,51 +3251,57 @@ ipmi_sdr_find_sdr_byid(struct ipmi_intf *intf, char *id) case SDR_RECORD_TYPE_FULL_SENSOR: sdrr->record.full = (struct sdr_record_full_sensor *) rec; - if (!strncmp - (sdrr->record.full->id_string, id, - __max(sdrr->record.full->id_code & 0x1f, idlen))) + if (!strncmp( + (const char *)sdrr->record.full->id_string, + (const char *)id, + __max(sdrr->record.full->id_code & 0x1f, idlen))) found = 1; break; case SDR_RECORD_TYPE_COMPACT_SENSOR: sdrr->record.compact = (struct sdr_record_compact_sensor *) rec; - if (!strncmp - (sdrr->record.compact->id_string, id, - __max(sdrr->record.compact->id_code & 0x1f, + if (!strncmp( + (const char *)sdrr->record.compact->id_string, + (const char *)id, + __max(sdrr->record.compact->id_code & 0x1f, idlen))) found = 1; break; case SDR_RECORD_TYPE_EVENTONLY_SENSOR: sdrr->record.eventonly = (struct sdr_record_eventonly_sensor *) rec; - if (!strncmp - (sdrr->record.eventonly->id_string, id, - __max(sdrr->record.eventonly->id_code & 0x1f, + if (!strncmp( + (const char *)sdrr->record.eventonly->id_string, + (const char *)id, + __max(sdrr->record.eventonly->id_code & 0x1f, idlen))) found = 1; break; case SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR: sdrr->record.genloc = (struct sdr_record_generic_locator *) rec; - if (!strncmp - (sdrr->record.genloc->id_string, id, - __max(sdrr->record.genloc->id_code & 0x1f, idlen))) + if (!strncmp( + (const char *)sdrr->record.genloc->id_string, + (const char *)id, + __max(sdrr->record.genloc->id_code & 0x1f, idlen))) found = 1; break; case SDR_RECORD_TYPE_FRU_DEVICE_LOCATOR: sdrr->record.fruloc = (struct sdr_record_fru_locator *) rec; - if (!strncmp - (sdrr->record.fruloc->id_string, id, - __max(sdrr->record.fruloc->id_code & 0x1f, idlen))) + if (!strncmp( + (const char *)sdrr->record.fruloc->id_string, + (const char *)id, + __max(sdrr->record.fruloc->id_code & 0x1f, idlen))) found = 1; break; case SDR_RECORD_TYPE_MC_DEVICE_LOCATOR: sdrr->record.mcloc = (struct sdr_record_mc_locator *) rec; - if (!strncmp - (sdrr->record.mcloc->id_string, id, - __max(sdrr->record.mcloc->id_code & 0x1f, idlen))) + if (!strncmp( + (const char *)sdrr->record.mcloc->id_string, + (const char *)id, + __max(sdrr->record.mcloc->id_code & 0x1f, idlen))) found = 1; break; case SDR_RECORD_TYPE_ENTITY_ASSOC: diff --git a/ipmitool/lib/ipmi_sel.c b/ipmitool/lib/ipmi_sel.c index 979e849..587a74d 100644 --- a/ipmitool/lib/ipmi_sel.c +++ b/ipmitool/lib/ipmi_sel.c @@ -98,7 +98,7 @@ static int ipmi_sel_oem_match(uint8_t *evt, struct ipmi_sel_oem_msg_rec rec) } } -void ipmi_sel_oem_init(const char * filename) +int ipmi_sel_oem_init(const char * filename) { FILE * fp; int i, j, k, n, byte; @@ -215,7 +215,7 @@ ipmi_get_event_type(uint8_t code) static char * ipmi_sel_timestamp(uint32_t stamp) { - static uint8_t tbuf[40]; + static char tbuf[40]; time_t s = (time_t)stamp; memset(tbuf, 0, 40); strftime(tbuf, sizeof(tbuf), "%m/%d/%Y %H:%M:%S", localtime(&s)); @@ -225,7 +225,7 @@ ipmi_sel_timestamp(uint32_t stamp) static char * ipmi_sel_timestamp_date(uint32_t stamp) { - static uint8_t tbuf[11]; + static char tbuf[11]; time_t s = (time_t)stamp; strftime(tbuf, sizeof(tbuf), "%m/%d/%Y", localtime(&s)); return tbuf; @@ -234,7 +234,7 @@ ipmi_sel_timestamp_date(uint32_t stamp) static char * ipmi_sel_timestamp_time(uint32_t stamp) { - static uint8_t tbuf[9]; + static char tbuf[9]; time_t s = (time_t)stamp; strftime(tbuf, sizeof(tbuf), "%H:%M:%S", localtime(&s)); return tbuf; @@ -244,7 +244,7 @@ static char * hex2ascii (uint8_t * hexChars, uint8_t numBytes) { int count; - static uint8_t hexString[SEL_OEM_NOTS_DATA_LEN+1]; /*Max Size*/ + static char hexString[SEL_OEM_NOTS_DATA_LEN+1]; /*Max Size*/ if(numBytes > SEL_OEM_NOTS_DATA_LEN) numBytes = SEL_OEM_NOTS_DATA_LEN; @@ -1470,7 +1470,7 @@ ipmi_sel_get_time(struct ipmi_intf * intf) { struct ipmi_rs * rsp; struct ipmi_rq req; - static uint8_t tbuf[40]; + static char tbuf[40]; uint32_t timei; time_t time; diff --git a/ipmitool/lib/ipmi_sol.c b/ipmitool/lib/ipmi_sol.c index a6a45ec..8afd3c6 100644 --- a/ipmitool/lib/ipmi_sol.c +++ b/ipmitool/lib/ipmi_sol.c @@ -1366,7 +1366,7 @@ ipmi_sol_red_pill(struct ipmi_intf * intf) if (numRead > 0) { - int rc = processSolUserInput(intf, buffer, numRead); + int rc = processSolUserInput(intf, (uint8_t *)buffer, numRead); if (rc) { diff --git a/ipmitool/lib/ipmi_user.c b/ipmitool/lib/ipmi_user.c index 202a6cb..ffb7bae 100644 --- a/ipmitool/lib/ipmi_user.c +++ b/ipmitool/lib/ipmi_user.c @@ -326,7 +326,7 @@ ipmi_user_set_username( /* The channel number will remain constant throughout this function */ msg_data[0] = user_id; memset(msg_data + 1, 0, 16); - strcpy(msg_data + 1, name); + strcpy((char *)(msg_data + 1), name); rsp = intf->sendrecv(intf, &req); @@ -404,11 +404,11 @@ ipmi_user_set_password( { struct ipmi_rs * rsp; struct ipmi_rq req; - char * msg_data; + uint8_t * msg_data; int password_length = (is_twenty_byte_password? 20 : 16); - msg_data = (char*)malloc(password_length + 2); + msg_data = (uint8_t*)malloc(password_length + 2); memset(&req, 0, sizeof(req)); @@ -429,7 +429,7 @@ ipmi_user_set_password( memset(msg_data + 2, 0, password_length); if (password != NULL) - strncpy(msg_data + 2, password, password_length); + strncpy((char *)(msg_data + 2), password, password_length); rsp = intf->sendrecv(intf, &req); diff --git a/ipmitool/src/plugins/lan/auth.c b/ipmitool/src/plugins/lan/auth.c index 0e7a071..7410e3c 100644 --- a/ipmitool/src/plugins/lan/auth.c +++ b/ipmitool/src/plugins/lan/auth.c @@ -176,7 +176,7 @@ uint8_t * ipmi_auth_special(struct ipmi_session * s) memset(&ctx, 0, sizeof(MD5_CTX)); MD5_Init(&ctx); - MD5_Update(&ctx, (const uint8_t *)s->authcode, strlen(s->authcode)); + MD5_Update(&ctx, (const uint8_t *)s->authcode, strlen((const char *)s->authcode)); MD5_Final(md, &ctx); for (i=0; i<16; i++) diff --git a/ipmitool/src/plugins/lan/lan.c b/ipmitool/src/plugins/lan/lan.c index ec7af23..f79a1dd 100644 --- a/ipmitool/src/plugins/lan/lan.c +++ b/ipmitool/src/plugins/lan/lan.c @@ -1378,7 +1378,7 @@ int ipmi_lan_open(struct ipmi_intf * intf) if (s->retry == 0) s->retry = IPMI_LAN_RETRY; - if (s->hostname == NULL || strlen(s->hostname) == 0) { + if (s->hostname == NULL || strlen((const char *)s->hostname) == 0) { lprintf(LOG_ERR, "No hostname specified!"); return -1; } @@ -1390,9 +1390,9 @@ int ipmi_lan_open(struct ipmi_intf * intf) s->addr.sin_family = AF_INET; s->addr.sin_port = htons(s->port); - rc = inet_pton(AF_INET, s->hostname, &s->addr.sin_addr); + rc = inet_pton(AF_INET, (const char *)s->hostname, &s->addr.sin_addr); if (rc <= 0) { - struct hostent *host = gethostbyname(s->hostname); + struct hostent *host = gethostbyname((const char *)s->hostname); if (host == NULL) { lprintf(LOG_ERR, "Address lookup for %s failed", s->hostname); diff --git a/ipmitool/src/plugins/lanplus/lanplus.c b/ipmitool/src/plugins/lanplus/lanplus.c index 89449a4..30ebf3d 100644 --- a/ipmitool/src/plugins/lanplus/lanplus.c +++ b/ipmitool/src/plugins/lanplus/lanplus.c @@ -2876,7 +2876,7 @@ ipmi_lanplus_rakp1(struct ipmi_intf * intf) /* Username specification */ - msg[27] = strlen(session->username); + msg[27] = strlen((const char *)session->username); if (msg[27] > IPMI_MAX_USER_NAME_LENGTH) { lprintf(LOG_ERR, "ERROR: user name too long. " @@ -3204,7 +3204,7 @@ ipmi_lanplus_open(struct ipmi_intf * intf) if (!session->retry) session->retry = IPMI_LAN_RETRY; - if (session->hostname == NULL || strlen(session->hostname) == 0) { + if (session->hostname == NULL || strlen((const char *)session->hostname) == 0) { lprintf(LOG_ERR, "No hostname specified!"); return -1; } @@ -3232,9 +3232,9 @@ ipmi_lanplus_open(struct ipmi_intf * intf) addr.sin_family = AF_INET; addr.sin_port = htons(session->port); - rc = inet_pton(AF_INET, session->hostname, &addr.sin_addr); + rc = inet_pton(AF_INET, (const char *)session->hostname, &addr.sin_addr); if (rc <= 0) { - struct hostent *host = gethostbyname(session->hostname); + struct hostent *host = gethostbyname((const char *)session->hostname); if (host == NULL) { lprintf(LOG_ERR, "Address lookup for %s failed", session->hostname); @@ -3400,22 +3400,22 @@ void test_crypt2(void) uint8_t iv[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14}; - uint8_t * data = "12345678"; + uint8_t data[8] = "12345678"; - char encrypt_buffer[1000]; - char decrypt_buffer[1000]; + uint8_t encrypt_buffer[1000]; + uint8_t decrypt_buffer[1000]; uint32_t bytes_encrypted; uint32_t bytes_decrypted; - printbuf(data, strlen(data), "input data"); + printbuf((const uint8_t *)data, strlen((const char *)data), "input data"); lanplus_encrypt_aes_cbc_128(iv, key, data, - strlen(data), + strlen((const char *)data), encrypt_buffer, &bytes_encrypted); - printbuf(encrypt_buffer, bytes_encrypted, "encrypt_buffer"); + printbuf((const uint8_t *)encrypt_buffer, bytes_encrypted, "encrypt_buffer"); lanplus_decrypt_aes_cbc_128(iv, key, @@ -3423,7 +3423,7 @@ void test_crypt2(void) bytes_encrypted, decrypt_buffer, &bytes_decrypted); - printbuf(decrypt_buffer, bytes_decrypted, "decrypt_buffer"); + printbuf((const uint8_t *)decrypt_buffer, bytes_decrypted, "decrypt_buffer"); lprintf(LOG_INFO, "\nDone testing the encrypt/decyrpt methods!\n"); exit(0); diff --git a/ipmitool/src/plugins/lanplus/lanplus_crypt.c b/ipmitool/src/plugins/lanplus/lanplus_crypt.c index 7f3cbe4..1aa091b 100644 --- a/ipmitool/src/plugins/lanplus/lanplus_crypt.c +++ b/ipmitool/src/plugins/lanplus/lanplus_crypt.c @@ -70,7 +70,7 @@ int lanplus_rakp2_hmac_matches(const struct ipmi_session * session, const uint8_t * bmc_mac, struct ipmi_intf * intf) { - char * buffer; + uint8_t * buffer; int bufferLength, i; uint8_t mac[20]; uint32_t macLength; @@ -93,7 +93,7 @@ int lanplus_rakp2_hmac_matches(const struct ipmi_session * session, 16 + /* GUIDc */ 1 + /* ROLEm */ 1 + /* ULENGTHm */ - strlen(session->username); /* optional */ + strlen((const char *)session->username); /* optional */ buffer = malloc(bufferLength); if (buffer == NULL) { @@ -152,7 +152,7 @@ int lanplus_rakp2_hmac_matches(const struct ipmi_session * session, buffer[56] = session->v2_data.requested_role; /* ULENGTHm */ - buffer[57] = strlen(session->username); + buffer[57] = strlen((const char *)session->username); /* UserName [optional] */ for (i = 0; i < buffer[57]; ++i) @@ -160,8 +160,8 @@ int lanplus_rakp2_hmac_matches(const struct ipmi_session * session, if (verbose > 2) { - printbuf(buffer, bufferLength, ">> rakp2 mac input buffer"); - printbuf((char*)(session->authcode), IPMI_AUTHCODE_BUFFER_SIZE, ">> rakp2 mac key"); + printbuf((const uint8_t *)buffer, bufferLength, ">> rakp2 mac input buffer"); + printbuf((const uint8_t *)session->authcode, IPMI_AUTHCODE_BUFFER_SIZE, ">> rakp2 mac key"); } /* @@ -214,12 +214,11 @@ int lanplus_rakp4_hmac_matches(const struct ipmi_session * session, const uint8_t * bmc_mac, struct ipmi_intf * intf) { - char * buffer; + uint8_t * buffer; int bufferLength, i; uint8_t mac[20]; uint32_t macLength; - - uint32_t SIDc_lsbf; + uint32_t SIDc_lsbf; if (ipmi_oem_active(intf, "intelplus")){ /* Intel BMC responds with the integrity Algorithm in RAKP4 */ @@ -242,7 +241,7 @@ int lanplus_rakp4_hmac_matches(const struct ipmi_session * session, 4 + /* SIDc */ 16; /* GUIDc */ - buffer = (char*)malloc(bufferLength); + buffer = (uint8_t *)malloc(bufferLength); if (buffer == NULL) { lprintf(LOG_ERR, "ipmitool: malloc failure"); return 1; @@ -281,11 +280,11 @@ int lanplus_rakp4_hmac_matches(const struct ipmi_session * session, #endif - if (verbose > 2) - { - printbuf(buffer, bufferLength, ">> rakp4 mac input buffer"); - printbuf(session->v2_data.sik, 20l, ">> rakp4 mac key (sik)"); - } + if (verbose > 2) + { + printbuf((const uint8_t *)buffer, bufferLength, ">> rakp4 mac input buffer"); + printbuf(session->v2_data.sik, 20l, ">> rakp4 mac key (sik)"); + } /* @@ -301,7 +300,7 @@ int lanplus_rakp4_hmac_matches(const struct ipmi_session * session, mac, &macLength); - if (verbose > 2) + if (verbose > 2) { printbuf(bmc_mac, macLength, ">> rakp4 mac as computed by the BMC"); printbuf(mac, macLength, ">> rakp4 mac as computed by the remote console"); @@ -339,14 +338,14 @@ int lanplus_rakp4_hmac_matches(const struct ipmi_session * session, * returns 0 on success * 1 on failure */ -int lanplus_generate_rakp3_authcode(char * output_buffer, +int lanplus_generate_rakp3_authcode(uint8_t * output_buffer, const struct ipmi_session * session, uint32_t * mac_length, struct ipmi_intf * intf) { int ret = 0; int input_buffer_length, i; - char * input_buffer; + uint8_t * input_buffer; uint32_t SIDm_lsbf; @@ -364,7 +363,7 @@ int lanplus_generate_rakp3_authcode(char * output_buffer, 4 + /* SIDm */ 1 + /* ROLEm */ 1 + /* ULENGTHm */ - strlen(session->username); + strlen((const char *)session->username); input_buffer = malloc(input_buffer_length); if (input_buffer == NULL) { @@ -400,17 +399,17 @@ int lanplus_generate_rakp3_authcode(char * output_buffer, input_buffer[20] = session->v2_data.requested_role; /* ULENGTHm */ - input_buffer[21] = strlen(session->username); + input_buffer[21] = strlen((const char *)session->username); /* USERNAME */ for (i = 0; i < input_buffer[21]; ++i) input_buffer[22 + i] = session->username[i]; - if (verbose > 2) - { - printbuf(input_buffer, input_buffer_length, ">> rakp3 mac input buffer"); - printbuf((char*)(session->authcode), IPMI_AUTHCODE_BUFFER_SIZE, ">> rakp3 mac key"); - } + if (verbose > 2) + { + printbuf((const uint8_t *)input_buffer, input_buffer_length, ">> rakp3 mac input buffer"); + printbuf((const uint8_t *)session->authcode, IPMI_AUTHCODE_BUFFER_SIZE, ">> rakp3 mac key"); + } lanplus_HMAC(session->v2_data.auth_alg, session->authcode, @@ -420,8 +419,8 @@ int lanplus_generate_rakp3_authcode(char * output_buffer, output_buffer, mac_length); - if (verbose > 2) - printbuf(output_buffer, *mac_length, "generated rakp3 mac"); + if (verbose > 2) + printbuf((const uint8_t *)output_buffer, *mac_length, "generated rakp3 mac"); free(input_buffer); @@ -459,9 +458,9 @@ int lanplus_generate_rakp3_authcode(char * output_buffer, */ int lanplus_generate_sik(struct ipmi_session * session) { - char * input_buffer; + uint8_t * input_buffer; int input_buffer_length, i; - char * input_key; + uint8_t * input_key; uint32_t mac_length; @@ -478,7 +477,7 @@ int lanplus_generate_sik(struct ipmi_session * session) 16 + /* Rc */ 1 + /* ROLEm */ 1 + /* ULENGTHm */ - strlen(session->username); + strlen((const char *)session->username); input_buffer = malloc(input_buffer_length); if (input_buffer == NULL) { @@ -514,7 +513,7 @@ int lanplus_generate_sik(struct ipmi_session * session) input_buffer[32] = session->v2_data.requested_role; /* ULENGTHm */ - input_buffer[33] = strlen(session->username); + input_buffer[33] = strlen((const char *)session->username); /* USERNAME */ for (i = 0; i < input_buffer[33]; ++i) @@ -538,7 +537,7 @@ int lanplus_generate_sik(struct ipmi_session * session) if (verbose >= 2) - printbuf(input_buffer, input_buffer_length, "session integrity key input"); + printbuf((const uint8_t *)input_buffer, input_buffer_length, "session integrity key input"); lanplus_HMAC(session->v2_data.auth_alg, input_key, diff --git a/ipmitool/src/plugins/lanplus/lanplus_crypt.h b/ipmitool/src/plugins/lanplus/lanplus_crypt.h index fbbe38a..9b7f0d4 100644 --- a/ipmitool/src/plugins/lanplus/lanplus_crypt.h +++ b/ipmitool/src/plugins/lanplus/lanplus_crypt.h @@ -47,7 +47,7 @@ int lanplus_rakp2_hmac_matches(const struct ipmi_session * session, int lanplus_rakp4_hmac_matches(const struct ipmi_session * session, const uint8_t * hmac, struct ipmi_intf * intf); -int lanplus_generate_rakp3_authcode(char * buffer, +int lanplus_generate_rakp3_authcode(uint8_t * buffer, const struct ipmi_session * session, uint32_t * auth_length, struct ipmi_intf * intf); diff --git a/ipmitool/src/plugins/lanplus/lanplus_crypt_impl.c b/ipmitool/src/plugins/lanplus/lanplus_crypt_impl.c index 60083eb..51342ea 100644 --- a/ipmitool/src/plugins/lanplus/lanplus_crypt_impl.c +++ b/ipmitool/src/plugins/lanplus/lanplus_crypt_impl.c @@ -183,7 +183,7 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv, assert((input_length % IPMI_CRYPT_AES_CBC_128_BLOCK_SIZE) == 0); - if(!EVP_EncryptUpdate(&ctx, output, (unsigned int *)bytes_written, input, input_length)) + if(!EVP_EncryptUpdate(&ctx, output, (int *)bytes_written, input, input_length)) { /* Error */ *bytes_written = 0; @@ -193,7 +193,7 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv, { uint32_t tmplen; - if(!EVP_EncryptFinal_ex(&ctx, output + *bytes_written, (unsigned int *)&tmplen)) + if(!EVP_EncryptFinal_ex(&ctx, output + *bytes_written, (int *)&tmplen)) { *bytes_written = 0; return; /* Error */ @@ -259,7 +259,7 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv, assert((input_length % IPMI_CRYPT_AES_CBC_128_BLOCK_SIZE) == 0); - if (!EVP_DecryptUpdate(&ctx, output, (unsigned int *)bytes_written, input, input_length)) + if (!EVP_DecryptUpdate(&ctx, output, (int *)bytes_written, input, input_length)) { /* Error */ fprintf(stderr, "ERROR: decrypt update failed"); @@ -270,7 +270,7 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv, { uint32_t tmplen; - if (!EVP_DecryptFinal_ex(&ctx, output + *bytes_written, (unsigned int *)&tmplen)) + if (!EVP_DecryptFinal_ex(&ctx, output + *bytes_written, (int *)&tmplen)) { char buffer[1000]; ERR_error_string(ERR_get_error(), buffer); diff --git a/ipmitool/src/plugins/open/open.c b/ipmitool/src/plugins/open/open.c index eb670c0..c0fde86 100644 --- a/ipmitool/src/plugins/open/open.c +++ b/ipmitool/src/plugins/open/open.c @@ -105,28 +105,25 @@ ipmi_openipmi_open(struct ipmi_intf * intf) #ifdef INCLUDE_PICMG_GET_DEVICE_LOCATOR /* PICMG hack to set right IPMB address, - we might want to do GetPICMGProperties first. - - In any case, on a server board or a non-picmg IpmC blade , this code - will not have any adverse side effect - */ - if ( (intf->my_addr == IPMI_BMC_SLAVE_ADDR) ) { + * we might want to do GetPICMGProperties first. + * In any case, on a server board or a non-picmg IpmC blade , this code + * will not have any adverse side effect + */ + if (intf->my_addr == IPMI_BMC_SLAVE_ADDR) { lprintf(LOG_DEBUG, "Running PICMG GetDeviceLocator" ); memset(&req, 0, sizeof(req)); req.msg.netfn = IPMI_NETFN_PICMG; req.msg.cmd = 0x01; - msg_data = 0x00; + msg_data = 0x00; req.msg.data = &msg_data; req.msg.data_len = 1; msg_data = 0; rsp = intf->sendrecv(intf, &req); - if (rsp) { - if ( !rsp->ccode ) { - intf->my_addr = rsp->data[2]; - intf->target_addr = intf->my_addr; - lprintf(LOG_DEBUG, "Discovered IPMB address = 0x%x", intf->my_addr); - } + if (rsp && !rsp->ccode) { + intf->my_addr = rsp->data[2]; + intf->target_addr = intf->my_addr; + lprintf(LOG_DEBUG, "Discovered IPMB address = 0x%x", intf->my_addr); } } #endif @@ -183,7 +180,7 @@ ipmi_openipmi_send_cmd(struct ipmi_intf * intf, struct ipmi_rq * req) intf->target_addr != intf->my_addr) { /* use IPMB address if needed */ ipmb_addr.slave_addr = intf->target_addr; - _req.addr = (char *) &ipmb_addr; + _req.addr = (unsigned char *) &ipmb_addr; _req.addr_len = sizeof(ipmb_addr); lprintf(LOG_DEBUG, "Sending request to " "IPMB target @ 0x%x", intf->target_addr); @@ -191,8 +188,8 @@ ipmi_openipmi_send_cmd(struct ipmi_intf * intf, struct ipmi_rq * req) /* otherwise use system interface */ lprintf(LOG_DEBUG+2, "Sending request to " "System Interface"); - bmc_addr.lun = req->msg.lun; - _req.addr = (char *) &bmc_addr; + bmc_addr.lun = req->msg.lun; + _req.addr = (unsigned char *) &bmc_addr; _req.addr_len = sizeof(bmc_addr); } @@ -226,7 +223,7 @@ ipmi_openipmi_send_cmd(struct ipmi_intf * intf, struct ipmi_rq * req) return NULL; } - recv.addr = (char *) &addr; + recv.addr = (unsigned char *) &addr; recv.addr_len = sizeof(addr); recv.msg.data = rsp.data; recv.msg.data_len = sizeof(rsp.data);