Index: Db/Makefile =================================================================== RCS file: /afs/slac/g/lcls/cvs/epics/site/src/ipmiComm/Db/Makefile,v retrieving revision 1.8 diff -r1.8 Makefile 25,27c25,30 < DB += module_basic.db < DB += module_pm.db < DB += module_cu.db --- > DB += fru_basic.db > DB += fru_pm.db > DB += fru_cu.db > > DB += mgmt_basic.db > 29a33,34 > DB += server.db > Index: Db/sensor_ai.db =================================================================== RCS file: /afs/slac/g/lcls/cvs/epics/site/src/ipmiComm/Db/sensor_ai.db,v retrieving revision 1.2 diff -r1.2 sensor_ai.db 8a9 > field(PINI, "YES") Index: Db/shelf.substitutions =================================================================== RCS file: /afs/slac/g/lcls/cvs/epics/site/src/ipmiComm/Db/shelf.substitutions,v retrieving revision 1.4 diff -r1.4 shelf.substitutions 23c23 < file shelf_common.db --- > file system_common.db 29c29 < file module_basic.db --- > file fru_basic.db 72c72 < file module_cu.db --- > file fru_cu.db 79c79 < file module_pm.db --- > file fru_pm.db Index: configure/RELEASE =================================================================== RCS file: /afs/slac/g/lcls/cvs/epics/site/src/ipmiComm/configure/RELEASE,v retrieving revision 1.5 diff -r1.5 RELEASE 20a21 > #ASYN_MODULE_VERSION=sonya Index: iocBoot/sioc-ipmicomm-test/st.cmd =================================================================== RCS file: /afs/slac/g/lcls/cvs/epics/site/src/ipmiComm/iocBoot/sioc-ipmicomm-test/st.cmd,v retrieving revision 1.1 diff -r1.1 st.cmd 31c31,34 < drvAsynIPPortConfigure ("mch-test","mch-b34-cd42:623 udp",0,0,0) --- > drvAsynIPPortConfigure ("mch-test","ioc-b34-bd32-mgt:623 udp",0,0,0) > #drvAsynIPPortConfigure ("mch-test","ioc-b34-pm32-mgt:623 udp",0,0,0) > #drvAsynIPPortConfigure ("mch-test","mch-b34-cd46:623 udp",0,0,0) > #drvAsynIPPortConfigure ("mch-test2","mch-b34-cd48:623 udp",0,0,0) 33c36,40 < dbLoadRecords("db/shelf.db","dev=MCH:TEST,link=mch-test") --- > #mchInit("mch-test2") > #dbLoadRecords("db/shelf.db","dev=MCH:TEST,link=mch-test") > #dbLoadRecords("db/shelf.db","dev=MCH:TEST2,link=mch-test2") > dbLoadRecords("db/server_dell.db","dev=MCH:TEST,link=mch-test") > #dbLoadRecords("db/server_dell.db","dev=MCH:TEST,link=mch-test") Index: src/devMch.c =================================================================== RCS file: /afs/slac/g/lcls/cvs/epics/site/src/ipmiComm/src/devMch.c,v retrieving revision 1.24 diff -r1.24 devMch.c 289d288 < 300,303c299,302 < m = TWOS_COMP_SIGNED_NBIT(SENSOR_CONV_M_B( sdr->M, sdr->MTol ), 10 ); < b = TWOS_COMP_SIGNED_NBIT(SENSOR_CONV_M_B( sdr->B, sdr->BAcc ), 10 ); < rexp = TWOS_COMP_SIGNED_NBIT(SENSOR_CONV_REXP( sdr->RexpBexp ), 4 ); < bexp = TWOS_COMP_SIGNED_NBIT(SENSOR_CONV_BEXP( sdr->RexpBexp ), 4 ); --- > m = sdr->m; > b = sdr->b; > rexp = sdr->rexp; > bexp = sdr->bexp; 358c357 < printf("unknown sensor conversion algorithm\n"); --- > printf("sensorConverstion %s: unknown sensor conversion algorithm\n", name); 376a376 > /* If unspecified, copy empty string to .EGU */ 378c378 < strcpy( egu, "Unspecified"); --- > strcpy( egu, ""); 417d416 < 506c505 < recPvt->task = task; --- > strcpy( recPvt->task, task ); 528c527 < if ( ! ( recPvt = init_record_chk( plink, &status, str )) ) --- > if ( ! ( recPvt = init_record_chk( &pai->inp, &status, str )) ) 548c547 < recGblRecordError( status, (void *)pai , (const char *)str ); --- > recGblRecordError( status, (void *)pai, (const char *)str ); 600a600,603 > if ( MCH_INIT_NOT_DONE( mchStat[inst] ) ) { > > return ERROR;} > 614,615c617 < bits = data[IPMI_RPLY_SENSOR_ENABLE_BITS_OFFSET + offs]; < --- > bits = data[IPMI_RPLY_SENSOR_ENABLE_BITS_OFFSET]; 622c624 < sens->val = raw = data[IPMI_RPLY_SENSOR_READING_OFFSET + offs]; --- > sens->val = raw = data[IPMI_RPLY_SENSOR_READING_OFFSET]; 642d643 < 655,657c656,658 < if ( MCH_DBG( mchStat[inst] ) > 1 ) < printf("%s read_ai: sensor index is %i, sensor number is %i, value is %.0f, rval is %i\n", < pai->name, index, sdr->number, pai->val, pai->rval); --- > if ( MCH_DBG( mchStat[inst] ) >= MCH_DBG_MED ) > printf("%s read_ai: sensor index is %i, sensor number is %i, value is %.0f, rval is %i, raw is 0x%02x\n", > pai->name, index, sdr->number, pai->val, pai->rval, raw); 666,667d666 < < 682c681 < if ( ! ( recPvt = init_record_chk( plink, &status, str )) ) --- > if ( ! ( recPvt = init_record_chk( &pbo->out, &status, str )) ) 797c796 < if ( ! ( recPvt = init_record_chk( plink, &status, str )) ) --- > if ( ! ( recPvt = init_record_chk( &pbi->inp, &status, str )) ) 832a832 > Mgmt mgmt; 861,862c861,870 < id = pbi->inp.value.camacio.b; /* FRU id */ < fru = &mchSys->fru[id]; --- > id = pbi->inp.value.camacio.b; /* FRU or Management Controller id */ > > if ( id < 255 ) { > fru = &mchSys->fru[id]; > pbi->rval = ( fru->sdr.recType ) ? 1 : 0; > } > else { > mgmt = &mchSys->mgmt[id]; > pbi->rval = ( mgmt->sdr.recType ) ? 1 : 0; > } 864d871 < pbi->rval = ( fru->sdr.entityInst ) ? 1 : 0; 967c974 < else if ( !(strcmp( task, "pwr" )) && fru->sdr.entityInst ) --- > else if ( !(strcmp( task, "pwr" )) && fru->sdr.recType ) 984a992,998 > /* possibly add this later > int readoffset; > if ( SENSOR_NUMERIC_FORMAT( mchSys->sens[index].sdr.units1) == SENSOR_NUMERIC_FORMAT_NONNUMERIC ) > readoffset = IPMI_RPLY_DISCRETE_SENSOR_READING_OFFSET; > */ > > 987a1002 > 993a1009 > 996c1012,1013 < value = data[IPMI_RPLY_HS_SENSOR_READING_OFFSET + offs]; --- > value = data[IPMI_RPLY_DISCRETE_SENSOR_READING_OFFSET]; > 999,1000c1016,1018 < if ( MCH_DBG( mchStat[inst] ) > 1 ) < printf("%s read_mbbi: value %02x, sensor %02x, owner %i, lun %i, index %i, value %i\n",pmbbi->name, value, sensor, mchSys->sens[index].sdr.owner, mchSys->sens[index].sdr.lun, index, value); --- > if ( MCH_DBG( mchStat[inst] ) >= MCH_DBG_MED ) > printf("%s read_mbbi: value %02x, sensor %i, owner %i, lun %i, index %i, value %i\n", > pmbbi->name, value, sensor, mchSys->sens[index].sdr.owner, mchSys->sens[index].sdr.lun, index, value); 1034c1052 < if ( ! ( recPvt = init_record_chk( plink, &status, str )) ) --- > if ( ! ( recPvt = init_record_chk( &pmbbo->out, &status, str )) ) 1103c1121 < else if ( !(strcmp( task, "fru" )) && fru->sdr.entityInst ) { --- > else if ( !(strcmp( task, "fru" )) && fru->sdr.recType ) { 1166c1184 < if ( ! ( recPvt = init_record_chk( plink, &status, str )) ) --- > if ( ! ( recPvt = init_record_chk( &pai->inp, &status, str )) ) 1224c1242 < if ( MCH_INIT_DONE( mchStat[inst] ) && MCH_ONLN( mchStat[inst] ) && mchSess->session && fru->sdr.entityInst ) { --- > if ( MCH_INIT_DONE( mchStat[inst] ) && MCH_ONLN( mchStat[inst] ) && mchSess->session && fru->sdr.recType ) { 1231c1249 < pai->rval = data[IPMI_RPLY_GET_FAN_LEVEL_OFFSET + offs]; --- > pai->rval = data[IPMI_RPLY_GET_FAN_LEVEL_OFFSET]; 1245c1263 < prop = data[IPMI_RPLY_GET_POWER_LEVEL_PROP_OFFSET + offs]; --- > prop = data[PICMG_RPLY_GET_POWER_LEVEL_PROP_OFFSET]; 1247,1266c1265,1284 < if ( (level = FRU_PWR_LEVEL( prop )) ) { < draw = data[IPMI_RPLY_GET_POWER_LEVEL_DRAW_OFFSET + (level - 1)]; < mult = data[IPMI_RPLY_GET_POWER_LEVEL_MULT_OFFSET]; < pai->rval = draw * mult * 0.1; /* Convert from 0.1 Watts to Watts */ < } < < /* If these don't change, consider i/o scanning these after initialization */ < switch ( parm ) { < < default: < break; < < case FRU_PWR_STEADY_STATE: < fru->pwrDyn = FRU_PWR_DYNAMIC( prop ) ? 1 : 0; < break; < < case FRU_PWR_EARLY: < fru->pwrDly = data[IPMI_RPLY_GET_POWER_LEVEL_DELAY_OFFSET]; < break; < } --- > if ( (level = FRU_PWR_LEVEL( prop )) ) { > draw = data[PICMG_RPLY_GET_POWER_LEVEL_DRAW_OFFSET + (level - 1)]; > mult = data[PICMG_RPLY_GET_POWER_LEVEL_MULT_OFFSET]; > pai->rval = draw * mult * 0.1; /* Convert from 0.1 Watts to Watts */ > } > > /* If these don't change, consider i/o scanning these after initialization */ > switch ( parm ) { > > default: > break; > > case FRU_PWR_STEADY_STATE: > fru->pwrDyn = FRU_PWR_DYNAMIC( prop ) ? 1 : 0; > break; > > case FRU_PWR_EARLY: > fru->pwrDly = data[PICMG_RPLY_GET_POWER_LEVEL_DELAY_OFFSET]; > break; > } 1284c1302 < if ( MCH_DBG( mchStat[inst] ) > 1 ) --- > if ( MCH_DBG( mchStat[inst] ) >= MCH_DBG_MED ) 1328c1346 < if ( ! ( recPvt = init_record_chk( plink, &status, str )) ) --- > if ( ! ( recPvt = init_record_chk( &pstringin->inp, &status, str )) ) 1355a1374,1379 > static void > mchConvertData(uint8_t type, uint8_t *input, uint8_t *output, size_t bytes, size_t chars) > { > > } > 1383c1407 < if ( MCH_INIT_DONE( mchStat[inst] ) && fru->sdr.entityInst ) { --- > if ( MCH_INIT_DONE( mchStat[inst] ) && fru->sdr.recType ) { 1426c1450 < if ( MCH_DBG( mchStat[inst] ) > 1 ) --- > if ( MCH_DBG( mchStat[inst] ) >= MCH_DBG_MED ) 1447a1472,1475 > int id = plongout->out.value.camacio.b; /* FRU ID */ > MchData mchData; > MchSess mchSess; > MchSys mchSys; 1449c1477 < if ( ! ( recPvt = init_record_chk( plink, &status, str )) ) --- > if ( ! ( recPvt = init_record_chk( &plongout->out, &status, str )) ) 1464c1492 < else --- > else { 1465a1494,1502 > if ( 0 == strcmp( task, "fan" ) ) { > mch = recPvt->mch; > mchData = mch->udata; > mchSess = mchData->mchSess; > mchSys = mchData->mchSys; > plongout->drvl = plongout->lopr = mchSys->fru[id].fanMin; > plongout->drvh = plongout->hopr = mchSys->fru[id].fanMax; > } > } 1504c1541 < if ( MCH_DBG( mchStat[inst] ) > 1 ) --- > if ( MCH_DBG( mchStat[inst] ) >= MCH_DBG_MED ) 1507c1544 < if ( MCH_ONLN( mchStat[inst] ) && mchSess->session && MCH_INIT_DONE( mchStat[inst] ) && fru->sdr.entityInst ) { --- > if ( MCH_ONLN( mchStat[inst] ) && mchSess->session && MCH_INIT_DONE( mchStat[inst] ) && fru->sdr.recType ) { 1510c1547 < /* For now test init done above and then always set these; change this to after detect config change ? */ --- > /* Need to change this so that these limits are also set after a config update */ Index: src/devMch.h =================================================================== RCS file: /afs/slac/g/lcls/cvs/epics/site/src/ipmiComm/src/devMch.h,v retrieving revision 1.3 diff -r1.3 devMch.h 17a18,21 > /* Some arbitrary sizes */ > #define MAX_NAME_LENGTH 50 > #define MAX_TASK_LENGTH 10 > 27,28c31 < performing modifications or non-atomical reads. */ < --- > performing modifications or non-atomical reads. */ 30c33 < const char name[1]; /* space for the terminating NULL; the entire string is appended here, however. */ --- > const char name[MAX_NAME_LENGTH]; /* space for the terminating NULL; the entire string is appended here, however. */ 36c39 < char *task; /* operation type */ --- > char task[MAX_TASK_LENGTH]; /* operation type */ Index: src/drvMch.c =================================================================== RCS file: /afs/slac/g/lcls/cvs/epics/site/src/ipmiComm/src/drvMch.c,v retrieving revision 1.23 diff -r1.23 drvMch.c 32,33c32,33 < int mchSdrGetDataAll(MchData mchData); < int mchFruGetDataAll(MchData mchData); --- > static int mchSdrGetDataAll(MchData mchData); > static int mchFruGetDataAll(MchData mchData); 36c36 < void --- > static void 58c58 < int --- > static int 72c72 < if ( ipmiMsgGetSess( mchSess, ipmiSess, response ) ) --- > if ( mchMsgGetSess( mchSess, ipmiSess, response ) ) 126a127,271 > static uint8_t > bcdPlusConvert(uint8_t raw) > { > > switch( raw ) { > > default: > printf("Illegal or reserved BCD PLUS byte 0x%02x\n", raw); > case 0: > return '0'; > case 1: > return '1'; > break; > case 2: > return '2'; > break; > case 3: > return '3'; > break; > case 4: > return '4'; > break; > case 5: > return '5'; > break; > case 6: > return '6'; > break; > case 7: > return '7'; > break; > case 8: > return '8'; > break; > case 9: > return '9'; > break; > case 0xA: > return ' '; > break; > case 0xB: > return '-'; > break; > case 0xC: > return '.'; > break; > } > } > > static void > sixBitAsciiConvert(uint8_t *input, uint8_t *output, uint8_t n_input, uint8_t n_output) > { > int i = 0, j = 0; > > while( 1 ) { > > output[i++] = (input[j*3 + 0] & 0x3F) + 0x20; > if ( i >= n_output) > break; > > output[i++] = (((input[j*3 + 0] & 0xC0) >> 6) | ((input[j*3 + 1] & 0xF) << 2)) + 0x20; > if ( i >= n_output) > break; > > output[i++] = (((input[j*3 + 1] & 0xF0) >> 4) | ((input[j*3 + 2] & 0x3) << 4)) + 0x20; > if ( i >= n_output) > break; > > output[i++] = ((input[j*3 + 2] & 0xFC) >> 2) + 0x20; > if ( i >= n_output) > break; > > j++; > } > } > > /* If error, set field->length to zero to indicate no valid data */ > static int > mchFruFieldConvertData(FruField field, uint8_t lang) > { > int i; > > switch( field->type ) { > > //printf("field->data is %i is NULL %i\n", field->data, field->data == NULL ); > default: > printf("FRU field data type %i is not supported\n", field->type); > return -1; > > case FRU_DATA_TYPE_BINARY: > printf("FRU field data type binary or unspecified. Add support!\n"); > > case FRU_DATA_TYPE_BCDPLUS: > > field->length = field->rlength; > if ( !( field->data = ipmiReallocZeros( field->data, field->length ) ) ) { > // if ( !( field->data = calloc( 1, field->length ) ) ) { > printf("No memory for FRU field data\n"); > field->length = 0; > return -1; > } > else { > for ( i = 0; i < field->length; i++ ) > field->data[i] = bcdPlusConvert( field->rdata[i] ); > return 0; > } > > case FRU_DATA_TYPE_6BITASCII: > > field->length = ceil( 8*((float)field->rlength/6) ); > if ( field->rlength % 3 ) > printf("6-bit ASCII data length not integer multiple of 3, something may be wrong.\n"); > > if ( !( field->data = ipmiReallocZeros( field->data, field->length ) ) ) { > // if ( !( field->data = calloc( 1, field->length ) ) ) { > printf("No memory for FRU field data\n"); > field->length = 0; > return -1; > } > else { > sixBitAsciiConvert( field->rdata, field->data, field->rlength, field->length); > return 0; > } > > case FRU_DATA_TYPE_LANG: > > if ( IPMI_DATA_LANG_ENGLISH( lang ) ) { > > field->length = field->rlength; > if ( !( field->data = ipmiReallocZeros( field->data, field->length ) ) ) { > // if ( !( field->data = calloc( 1, field->length ) ) ) { > printf("No memory for FRU field data\n"); > field->length = 0; > return -1; > } > > memcpy( field->data, field->rdata, field->length ); > return 0; > } > else > printf("Warning FRU data language %i is not english; need to add 2-byte unicode support\n", lang); > } > return 0; > } > 135,136c280,281 < int < mchFruFieldGet(FruField field, uint8_t *raw, unsigned *offset) --- > static int > mchFruFieldGet(FruField field, uint8_t *raw, unsigned *offset, uint8_t lang) 139c284 < if ( ( field->length = IPMI_DATA_LENGTH( raw[*offset] ) ) ) { --- > if ( ( field->rlength = IPMI_DATA_LENGTH( raw[*offset] ) ) ) { 141a287 > 144c290,293 < if ( !( field->data = calloc( field->length, 1 ) ) ) --- > //printf("field->rdata is %i is NULL %i\n", field->rdata, field->rdata == NULL ); > > if ( !( field->rdata = ipmiReallocZeros( field->rdata, field->rlength ) ) ) > // if ( !( field->rdata = calloc( 1, field->rlength ) ) ) 147,148c296,297 < for ( i = 0; i < field->length; i++ ) < field->data[i] = raw[*offset + i]; --- > for ( i = 0; i < field->rlength; i++ ) > field->rdata[i] = raw[*offset + i]; 150c299 < *offset += field->length; --- > *offset += field->rlength; 152c301,303 < return 0; --- > return mchFruFieldConvertData( field, lang ); > > printf("After mchFruFieldConvertData raw %s converted %s, raw length %i, converted length %i\n", field->rdata, field->data, field->rlength, field->length); 159c310 < * Copy FRU product area data to product structure --- > * Copy FRU Chassis area data to chassis structure 163c314,335 < void --- > static void > mchFruChassisDataGet(FruChassis chas, uint8_t *raw, unsigned *offset) > { > if ( 0 != (*offset = 8*raw[FRU_DATA_COMMON_HEADER_OFFSET + FRU_DATA_COMMON_HEADER_CHASSIS_AREA_OFFSET]) ) { > > chas->type = raw[*offset + FRU_DATA_CHASSIS_TYPE_OFFSET]; > > *offset += FRU_DATA_CHASSIS_AREA_PART_LENGTH_OFFSET; > > if ( mchFruFieldGet( &(chas->part), raw, offset, IPMI_DATA_LANG_CODE_ENGLISH1 ) ) > (*offset)++; > if ( mchFruFieldGet( &(chas->sn), raw, offset, IPMI_DATA_LANG_CODE_ENGLISH1 ) ) > (*offset)++; > } > } > > /* > * Copy FRU Product area data to product structure > * > * Caller must perform locking. > */ > static void 166c338 < if ( 0 != (*offset = prod->offset = 8*raw[FRU_DATA_COMMON_HEADER_OFFSET + FRU_DATA_COMMON_HEADER_PROD_AREA_OFFSET] ) ) { --- > if ( 0 != (*offset = 8*raw[FRU_DATA_COMMON_HEADER_OFFSET + FRU_DATA_COMMON_HEADER_PROD_AREA_OFFSET]) ) { 172c344 < if ( mchFruFieldGet( &(prod->manuf), raw, offset ) ) --- > if ( mchFruFieldGet( &(prod->manuf), raw, offset, prod->lang ) ) 174c346 < if ( mchFruFieldGet( &(prod->prod), raw, offset ) ) --- > if ( mchFruFieldGet( &(prod->prod), raw, offset, prod->lang) ) 176c348 < if ( mchFruFieldGet( &(prod->part), raw, offset ) ) --- > if ( mchFruFieldGet( &(prod->part), raw, offset, prod->lang ) ) 178c350 < if ( mchFruFieldGet( &(prod->version), raw, offset ) ) --- > if ( mchFruFieldGet( &(prod->version), raw, offset, prod->lang ) ) 180c352 < if ( mchFruFieldGet( &(prod->sn), raw, offset ) ) --- > if ( mchFruFieldGet( &(prod->sn), raw, offset, prod->lang ) ) 186c358 < * Copy FRU board area data to board structure --- > * Copy FRU Board area data to board structure 190c362 < void --- > static void 193c365 < if ( 0 != (*offset = board->offset = 8*raw[FRU_DATA_COMMON_HEADER_OFFSET + FRU_DATA_COMMON_HEADER_BOARD_AREA_OFFSET] ) ) { --- > if ( 0 != (*offset = 8*raw[FRU_DATA_COMMON_HEADER_OFFSET + FRU_DATA_COMMON_HEADER_BOARD_AREA_OFFSET] ) ) { 199c371 < if ( mchFruFieldGet( &(board->manuf), raw, offset ) ) --- > if ( mchFruFieldGet( &(board->manuf), raw, offset, board->lang ) ) 201c373 < if ( mchFruFieldGet( &(board->prod), raw, offset ) ) --- > if ( mchFruFieldGet( &(board->prod), raw, offset, board->lang ) ) 203c375 < if ( mchFruFieldGet( &(board->sn), raw, offset ) ) --- > if ( mchFruFieldGet( &(board->sn), raw, offset, board->lang ) ) 205c377 < if ( mchFruFieldGet( &(board->part), raw, offset ) ) --- > if ( mchFruFieldGet( &(board->part), raw, offset, board->lang ) ) 211a384 > * 218c391 < int --- > static int 224c397 < uint8_t *raw; --- > uint8_t *raw = 0; 229c402 < int offs = ( MCH_IS_NAT( mchSess->type ) ) ? IPMI_RPLY_OFFSET_NAT : 0; /* Offset into reply message */ --- > int rval; 232c405,406 < if ( mchMsgGetFruInfo( mchData, response, id ) ) --- > if ( mchMsgGetFruInvInfo( mchData, response, id ) ) { > printf("error from mchMsgGetFruInvInfo\n"); 233a408 > } 235,237c410,412 < fru->size[0] = response[IPMI_RPLY_FRU_AREA_SIZE_LSB_OFFSET + offs]; < fru->size[1] = response[IPMI_RPLY_FRU_AREA_SIZE_MSB_OFFSET + offs]; < fru->access = response[IPMI_RPLY_FRU_AREA_ACCESS_OFFSET + offs]; --- > fru->size[0] = response[IPMI_RPLY_FRU_AREA_SIZE_LSB_OFFSET]; > fru->size[1] = response[IPMI_RPLY_FRU_AREA_SIZE_MSB_OFFSET]; > fru->access = response[IPMI_RPLY_FRU_AREA_ACCESS_OFFSET]; 239c414 < if ( 0 == (sizeInt = arrayToUint16( fru->size )) ) --- > if ( 0 == (sizeInt = arrayToUint16( fru->size )) ) { 240a416 > } 242,243c418 < < if ( MCH_DBG( mchStat[inst] ) ) --- > // if ( MCH_DBG( mchStat[inst] ) ) 246c421,424 < if ( !(raw = calloc( sizeInt ,1 ) ) ) { --- > //printf("raw is %i is NULL %i\n", raw, raw == NULL ); > > if ( !(raw = ipmiReallocZeros( raw, sizeInt ) ) ) { > // if ( !(raw = calloc( 1, sizeInt ) ) ) { 262,264c440,447 < if ( (IPMI_COMP_CODE_REQUESTED_DATA == mchMsgReadFru( mchData, response, id, fru->readOffset, MSG_FRU_DATA_READ_SIZE )) ) < break; < memcpy( raw + i*MSG_FRU_DATA_READ_SIZE, response + IPMI_RPLY_FRU_DATA_READ_OFFSET + offs, MSG_FRU_DATA_READ_SIZE ); --- > > rval = mchMsgReadFru( mchData, response, id, fru->readOffset, MSG_FRU_DATA_READ_SIZE ); > if ( rval ) { > if ( IPMI_COMP_CODE_REQUESTED_DATA == rval ) > break; > } > else > memcpy( raw + i*MSG_FRU_DATA_READ_SIZE, response + IPMI_RPLY_FRU_DATA_READ_OFFSET, MSG_FRU_DATA_READ_SIZE ); 268c451,456 < if ( MCH_DBG( mchStat[inst] ) > 2 ) { --- > if ( MCH_DBG( mchStat[inst] ) >= MCH_DBG_HIGH ) { > printf("%s FRU %i raw data, size %i: \n", mchSess->name, id, sizeInt); > for ( i = 0; i < sizeInt; i++) > printf("0x%02x ",raw[i]); > printf("\n"); > 271c459 < printf("%u ",raw[i]); --- > printf("%c ",raw[i]); 273a462 > 277c466 < --- > mchFruChassisDataGet( &(fru->chassis), raw, &offset ); 292c481 < int --- > static int 297c486 < uint8_t response[MSG_MAX_LENGTH] = { 0 }; --- > uint8_t response[IPMI_RPLY_GET_FAN_PROP_LENGTH] = { 0 }; 300d488 < int offs = ( MCH_IS_NAT( mchSess->type ) ) ? IPMI_RPLY_2ND_BRIDGED_OFFSET_NAT : 0;; 305a494,495 > > //printf("mchfrugetdataall fru %i fru->sdrentityInst 0x%02x\n", i, fru->sdr.entityInst); 307c497,499 < if ( fru->sdr.entityInst ) { --- > if ( fru->sdr.recType ) { > > //printf("mchfrugetdataall fru %i\n", i); 312c504,507 < if ( (i >= UTCA_FRU_TYPE_CU_MIN) && (i <= UTCA_FRU_TYPE_CU_MAX) ) { --- > /* If not MCH, do not do MicroTCA-specific tasks; later change this to callbacks */ > if ( !MCH_IS_MICROTCA( mchSess->type ) ) { > } > else if ( (i >= UTCA_FRU_TYPE_CU_MIN) && (i <= UTCA_FRU_TYPE_CU_MAX) ) { 316,319c511,517 < fru->fanMin = response[IPMI_RPLY_GET_FAN_PROP_MIN_OFFSET + offs]; < fru->fanMax = response[IPMI_RPLY_GET_FAN_PROP_MAX_OFFSET + offs]; < fru->fanNom = response[IPMI_RPLY_GET_FAN_PROP_NOM_OFFSET + offs]; < fru->fanProp = response[IPMI_RPLY_GET_FAN_PROP_PROP_OFFSET + offs]; --- > fru->fanMin = response[IPMI_RPLY_GET_FAN_PROP_MIN_OFFSET]; > fru->fanMax = response[IPMI_RPLY_GET_FAN_PROP_MAX_OFFSET]; > fru->fanNom = response[IPMI_RPLY_GET_FAN_PROP_NOM_OFFSET]; > fru->fanProp = response[IPMI_RPLY_GET_FAN_PROP_PROP_OFFSET]; > > if ( MCH_DBG( mchStat[mchSess->instance] ) >= MCH_DBG_MED ) > printf("FRU %i fan properties min %i max %i nom %i prop 0x%02x\n", i, fru->fanMin, fru->fanMax, fru->fanNom, fru->fanProp); 321c519 < } --- > } 323c521 < if ( MCH_DBG( mchStat[mchSess->instance] ) > 1 ) { --- > if ( MCH_DBG( mchStat[mchSess->instance] ) >= MCH_DBG_MED ) { 341,343c539,540 < * the associated FRU and do the same. < * < * -For all hot-swap sensors, store sensor index in FRU structure --- > * the associated FRU and do the same. For NAT hot-swap sensors, parse > * description string to find associated FRU ID. 351c548 < void --- > static void 354c551 < int i, natid; --- > int i, natid, id; 356d552 < int id = -1; 359a556,565 > sens->fruId = sens->mgmtIndex = -1; /* Set default indices to indicate no corresponding fru/mgmt */ > > /* Supermicro does not use FRU device locator records, so no means to read a FRU ID > * Associate all Supermicro sensors with single FRU, arbitrarily choose...0? > */ > if ( MCH_IS_SUPERMICRO( type ) ) { > sens->fruId = 0; > return; > } > 364,366c570,571 < if ( (type == MCH_TYPE_NAT) && (sdr->sensType == SENSOR_TYPE_HOTSWAP) ) { < if ( 2 != sscanf( (const char *)(sdr->str), "HS %d %s", &natid, buff ) ) { < printf("sscanf parse error %s\n", sdr->str); --- > if ( MCH_IS_NAT( type ) && (sdr->sensType == SENSOR_TYPE_HOTSWAP) ) { > if ( 2 != sscanf( (const char *)(sdr->str), "HS %d %s", &natid, buff ) ) 368,369c573 < } < sens->fruIndex = natid; --- > sens->fruId = natid; 372,377c576,583 < < /* First loop through FRUs */ < for ( i = 0; i < MAX_FRU; i++ ) { < if ( (sens->sdr.entityId == mchSys->fru[i].sdr.entityId) && (sens->sdr.entityInst == mchSys->fru[i].sdr.entityInst ) ) { < id = i; < break; --- > > /* Loop through FRUs and Management Controllers > * Start at 1 for MicroTCA because FRU 0 is reserved logical > * entity with same entityId and entityInst as MCH 1 > */ > for ( i = 0; i < MAX_FRU_MGMT; i++ ) { > > if ( (i == 0) && MCH_IS_MICROTCA( type ) ) { 379c585,586 < } --- > else { > if ( i < MAX_FRU ) { 381,386c588,600 < /* Next find non-FRU entities */ < if ( id == -1 ) { < if ( sens->sdr.entityId == VT_ENTITY_ID_AMC ) < id = UTCA_FRU_TYPE_AMC_MIN + sens->sdr.entityInst - 0x60 - 1; < else if ( sens->sdr.entityId == VT_ENTITY_ID_RTM ) < id = UTCA_FRU_TYPE_RTM_MIN + sens->sdr.entityInst - 0x60 - 1; --- > if ( (sens->sdr.entityId == mchSys->fru[i].sdr.entityId) && (sens->sdr.entityInst == mchSys->fru[i].sdr.entityInst ) ) { > sens->fruId = mchSys->fru[i].sdr.fruId; /* FRU ID for associated FRU */ > return; > } > } > else { > id = i - MAX_FRU; > if ( (sens->sdr.entityId == mchSys->mgmt[id].sdr.entityId) && (sens->sdr.entityInst == mchSys->mgmt[id].sdr.entityInst) ) { > sens->mgmtIndex = id; > return; > } > } > } 389c603,615 < sens->fruIndex = id; --- > /* If not MCH, do not do MicroTCA-specific tasks; later change this to callbacks */ > if ( !MCH_IS_MICROTCA( type ) ) > return; > > /* Find entities that do not have SDRs */ > if ( sens->sdr.entityId == VT_ENTITY_ID_AMC ) { > sens->fruId = UTCA_FRU_TYPE_AMC_MIN + sens->sdr.entityInst - 0x60 - 1; > return; > } > else if ( sens->sdr.entityId == VT_ENTITY_ID_RTM ) { > sens->fruId = UTCA_FRU_TYPE_RTM_MIN + sens->sdr.entityInst - 0x60 - 1; > return; > } 393c619 < int --- > static int 400a627,628 > static void > mchSdrRepGetTs(uint8_t *response, uint32_t *addTs, uint32_t *delTs) { 402,406c630,631 < void < mchSdrRepGetTs(uint8_t *response, uint32_t *addTs, uint32_t *delTs, int offs) { < < *addTs = ntohl( *(uint32_t *)(response + IPMI_RPLY_SDRREP_ADD_TS_OFFSET + offs) ); < *delTs = ntohl( *(uint32_t *)(response + IPMI_RPLY_SDRREP_DEL_TS_OFFSET + offs) ); --- > *addTs = ntohl( *(uint32_t *)(response + IPMI_RPLY_SDRREP_ADD_TS_OFFSET) ); > *delTs = ntohl( *(uint32_t *)(response + IPMI_RPLY_SDRREP_DEL_TS_OFFSET) ); 413c638 < int --- > static int 420d644 < int offs = ( MCH_IS_NAT( mchSess->type ) ) ? IPMI_RPLY_OFFSET_NAT : 0; 425,426c649 < mchSdrRepGetTs( buff, &add, &del, offs); < --- > mchSdrRepGetTs( buff, &add, &del ); 447c670 < int --- > static int 450,451c673 < MchSess mchSess = mchData->mchSess; < MchSys mchSys = mchData->mchSys; --- > MchSys mchSys = mchData->mchSys; 454d675 < int offs = ( MCH_IS_NAT( mchSess->type ) ) ? IPMI_RPLY_OFFSET_NAT : 0; 457a679,688 > /* > int i; > printf("sdr rep get info reply:\n"); > for ( i = 0; i < MSG_MAX_LENGTH; i++ ) > printf("0x%02x ", response[i]); > printf("\n"); > */ > mchSys->sdrRep.ver = response[IPMI_RPLY_SDRREP_VER_OFFSET]; > mchSys->sdrRep.size[0] = response[IPMI_RPLY_SDRREP_CNT_LSB_OFFSET]; > mchSys->sdrRep.size[1] = response[IPMI_RPLY_SDRREP_CNT_MSB_OFFSET]; 459,463c690 < mchSys->sdrRep.ver = response[IPMI_RPLY_SDRREP_VER_OFFSET + offs]; < mchSys->sdrRep.size[0] = response[IPMI_RPLY_SDRREP_CNT_LSB_OFFSET + offs]; < mchSys->sdrRep.size[1] = response[IPMI_RPLY_SDRREP_CNT_MSB_OFFSET + offs]; < < mchSdrRepGetTs( response, &mchSys->sdrRep.addTs, &mchSys->sdrRep.delTs, offs ); --- > mchSdrRepGetTs( response, &mchSys->sdrRep.addTs, &mchSys->sdrRep.delTs ); 467c694 < if ( response[IPMI_RPLY_COMPLETION_CODE_OFFSET + offs] ) --- > if ( response[0] ) // completion code 470,471c697,698 < mchSys->sdrRep.devSdrSize = response[IPMI_RPLY_DEV_SDR_CNT_OFFSET + offs]; < flags = response[IPMI_RPLY_DEV_SDR_FLAGS_OFFSET + offs]; --- > mchSys->sdrRep.devSdrSize = response[IPMI_RPLY_DEV_SDR_CNT_OFFSET]; > flags = response[IPMI_RPLY_DEV_SDR_FLAGS_OFFSET]; 486c713 < void --- > static void 506c733 < --- > 518c745 < void --- > static void 548c775 < void --- > static void 551a779 > int m = 0, b = 0; 589c817 < sdr->BAcc = raw[SDR_B_ACC_OFFSET]; --- > sdr->BAcc = raw[SDR_B_ACC_OFFSET]; 597a826,834 > m = SENSOR_CONV_M_B( sdr->M, sdr->MTol ); > b = SENSOR_CONV_M_B( sdr->B, sdr->BAcc ); > > sdr->m = TWOS_COMP_SIGNED_NBIT( m, 10 ); > sdr->b = TWOS_COMP_SIGNED_NBIT( b, 10 ); > sdr->rexp = TWOS_COMP_SIGNED_NBIT(SENSOR_CONV_REXP( sdr->RexpBexp ), 4 ); > sdr->bexp = TWOS_COMP_SIGNED_NBIT(SENSOR_CONV_BEXP( sdr->RexpBexp ), 4 ); > > 605c842,843 < printf("mchSdrFullSens: owner 0x%02x lun %i sdr number %i type 0x%02x, str l %i\n", sdr->owner, sdr->lun, sdr->number, sdr->sensType, l); --- > printf("mchSdrFullSens: owner 0x%02x lun %i sdr number %i type 0x%02x, m %i, b %i, rexp %i bexp %i\n", > sdr->owner, sdr->lun, sdr->number, sdr->sensType, sdr->m, sdr->b, sdr->rexp, sdr->bexp); 609d846 < 620c857 < void --- > static void 624,625c861 < size_t responseSize; < //int offs = ( MCH_IS_NAT( mchData->mchSess->type ) ) ? IPMI_RPLY_OFFSET_NAT : 0; /* Offset into reply message, used for get sensor thresholds */ --- > size_t sensReadMsgLength; 627,628c863 < < responseSize = sens->readMsgLength = ( MCH_IS_NAT( mchData->mchSess->type ) ) ? IPMI_RPLY_SENSOR_READ_MAX_LENGTH_NAT : IPMI_RPLY_SENSOR_READ_MAX_LENGTH_VT; --- > sensReadMsgLength = sens->readMsgLength = IPMI_RPLY_SENSOR_READ_MAX_LENGTH; 636,638c871,872 < /* Do not check status because timeout is allowed here */ < mchMsgReadSensor( mchData, response, sens->sdr.number, (sens->sdr.lun & 0x3) , &responseSize ); < sens->readMsgLength = responseSize; --- > mchMsgReadSensor( mchData, response, sens->sdr.number, (sens->sdr.lun & 0x3) , &sensReadMsgLength ); > sens->readMsgLength = sensReadMsgLength; 640c874 < responseSize = ( MCH_IS_NAT( mchData->mchSess->type ) ) ? IPMI_RPLY_GET_SENSOR_THRESH_LENGTH_NAT : IPMI_RPLY_GET_SENSOR_THRESH_LENGTH_VT; --- > sens->tmask = 0; /* Set default to no readable thresholds */ 642,648c876 < /* not ready for prime time; seems MCH does not respond if discrete sensor < if ( mchMsgGetSensorThresholds( mchData, response, sens->sdr.number, (sens->sdr.lun & 0x3), &responseSize ) ) { < if ( MCH_DBG( mchStat[mchData->mchSess->instance] ) ) < printf("%s mchGetSensorInfo: mchMsgGetSensorThresholds error, assume no thresholds are readable\n", mchData->mchSess->name); < sens->tmask = 0; < return; < } --- > if ( IPMI_SENSOR_THRESH_IS_READABLE( IPMI_SDR_SENSOR_THRESH_ACCESS( sens->sdr.cap ) ) ) { 649a878,882 > if ( mchMsgGetSensorThresholds( mchData, response, sens->sdr.number, (sens->sdr.lun & 0x3) ) ) { > if ( MCH_DBG( mchStat[mchData->mchSess->instance] ) ) > printf("%s mchGetSensorInfo: mchMsgGetSensorThresholds error, assume no thresholds are readable\n", mchData->mchSess->name); > return; > } 651,658c884,895 < sens->tmask = response[IPMI_RPLY_SENSOR_THRESH_MASK_OFFSET + offs]; < sens->tlnc = response[IPMI_RPLY_SENSOR_THRESH_LNC_OFFSET + offs]; < sens->tlc = response[IPMI_RPLY_SENSOR_THRESH_LC_OFFSET + offs]; < sens->tlnr = response[IPMI_RPLY_SENSOR_THRESH_LNR_OFFSET + offs]; < sens->tunc = response[IPMI_RPLY_SENSOR_THRESH_UNC_OFFSET + offs]; < sens->tuc = response[IPMI_RPLY_SENSOR_THRESH_UC_OFFSET + offs]; < sens->tunr = response[IPMI_RPLY_SENSOR_THRESH_UNR_OFFSET + offs]; < */ --- > sens->tmask = response[IPMI_RPLY_SENSOR_THRESH_MASK_OFFSET]; > sens->tlnc = response[IPMI_RPLY_SENSOR_THRESH_LNC_OFFSET]; > sens->tlc = response[IPMI_RPLY_SENSOR_THRESH_LC_OFFSET]; > sens->tlnr = response[IPMI_RPLY_SENSOR_THRESH_LNR_OFFSET]; > sens->tunc = response[IPMI_RPLY_SENSOR_THRESH_UNC_OFFSET]; > sens->tuc = response[IPMI_RPLY_SENSOR_THRESH_UC_OFFSET]; > sens->tunr = response[IPMI_RPLY_SENSOR_THRESH_UNR_OFFSET]; > > if ( MCH_DBG( mchStat[mchData->mchSess->instance] ) >= MCH_DBG_HIGH ) > printf("sensor %s thresholds tmask 0x%02x, tlnc %i tlc %i tlnr %i tunc %i tuc %i tunr %i\n", > sens->sdr.str, sens->tmask, sens->tlnc, sens->tlc, sens->tlnr, sens->tunc, sens->tuc, sens->tunr); > } 668c905 < int --- > static int 681,682c918,919 < int err; < int size; /* SDR record size (after header) */ --- > int err = 0; > int size; /* SDR record read size (after header) */ 685,686d921 < int offs = ( MCH_IS_NAT( mchSess->type ) ) ? IPMI_RPLY_OFFSET_NAT : 0; < int base = ( MCH_IS_NAT( mchSess->type ) ) ? IPMI_RPLY_GET_SDR_BASE_LENGTH_NAT : IPMI_RPLY_GET_SDR_BASE_LENGTH_VT; 689c924,925 < SdrMgmt mgmt; --- > Mgmt mgmt; > int remainder = 0; 696c932,935 < if ( !(raw = calloc( sdrCount, SDR_MAX_LENGTH ) ) ) { --- > printf("sdrcount %i, raw is %i is NULL %i\n", sdrCount, raw, raw == NULL ); > > if ( !(raw = ipmiReallocZeros( raw, sdrCount*SDR_MAX_LENGTH ) ) ) { > // if ( !(raw = calloc( 1, sdrCount*SDR_MAX_LENGTH ) ) ) { 699a939,947 > > if ( mchMsgReserveSdrRep( mchData, response ) ) { > printf("mchSdrGetDataAll: Error reserving SDR repository %s\n", mchSess->name); > goto bail; > } > > res[0] = response[IPMI_RPLY_GET_SDR_RES_LSB_OFFSET]; > res[1] = response[IPMI_RPLY_GET_SDR_RES_MSB_OFFSET]; > 701,704c949 < < err = 0; < /* readSize = 5 because 5th byte is remaining record length; 0xFF reads entire record */ < if ( mchMsgGetSdr( mchData, response, id, res, offset, 5, 0, 0 ) ) { --- > offset = 0; 705a951,952 > /* readSize = 5 because 5th byte is remaining record length; 0xFF reads entire record */ > if ( (mchMsgGetSdr( mchData, response, id, res, offset, 5, 0, 0 )) ) { 706a954 > printf("*************sdr %i getsdr error\n", i); 708c956 < printf("mchSdrGetDataAll: too many errors reading SDR for %s", mchSess->name); --- > printf("mchSdrGetDataAll: too many errors reading SDR for %s\n", mchSess->name); 713,719c961,975 < size = response[base - 1]; < if ( mchMsgGetSdr( mchData, response, id, res, offset, 0xFF, 0, size ) ) { < i--; < if ( err++ > 5 ) { < printf("mchSdrGetDataAll: too many errors reading SDR for %s", mchSess->name); < goto bail; < } --- > > /*int z; > for ( z = 0; z < MSG_MAX_LENGTH; z++ ) > printf("0x%02x ", response[z]); > printf("\n"); > */ > size = response[IPMI_RPLY_GET_SDR_DATA_OFFSET + SDR_LENGTH_OFFSET] + SDR_HEADER_LENGTH; > //printf("size is %i max size is %i max read size %i\n", size, SDR_MAX_LENGTH, SDR_MAX_READ_SIZE); > if ( size > SDR_MAX_LENGTH ) > size = SDR_MAX_LENGTH; > type = response[IPMI_RPLY_GET_SDR_DATA_OFFSET + SDR_REC_TYPE_OFFSET]; > > if ( size > SDR_MAX_READ_SIZE ) { > remainder = size - SDR_MAX_READ_SIZE; > size = SDR_MAX_READ_SIZE; 722,723c978,985 < else { < memcpy( raw + (i*SDR_MAX_LENGTH), response + IPMI_RPLY_GET_SDR_DATA_OFFSET + offs, SDR_MAX_LENGTH ); --- > while ( size > 0 ) { > if ( mchMsgGetSdr( mchData, response, id, res, offset, size, 0, 0 /* recordsize, can be removed */ ) ) { > /*int z; > for ( z = 0; z < MSG_MAX_LENGTH; z++ ) > printf("0x%02x ", response[z]); > printf("\n"); > */ > printf("*************sdr %i getsdr error\n", i); 725c987,993 < switch ( response[IPMI_RPLY_GET_SDR_DATA_OFFSET + offs + SDR_REC_TYPE_OFFSET] ) { --- > i--; > if ( err++ > 5 ) { > printf("mchSdrGetDataAll: too many errors reading SDR for %s", mchSess->name); > goto bail; > } > break; > } 727,743c995,997 < default: < break; < < case SDR_TYPE_FULL_SENSOR: < mchSys->sensCount++; < break; < < case SDR_TYPE_COMPACT_SENSOR: < mchSys->sensCount++; < break; < < case SDR_TYPE_FRU_DEV: < break; < < case SDR_TYPE_MGMT_CTRL_DEV: < mchSys->mgmtCount++; < break; --- > else { > memcpy( raw + (i*SDR_MAX_LENGTH) + offset, response + IPMI_RPLY_GET_SDR_DATA_OFFSET, size ); > offset += size; 745,746d998 < id[0] = response[IPMI_RPLY_GET_SDR_NEXT_ID_LSB_OFFSET + offs]; < id[1] = response[IPMI_RPLY_GET_SDR_NEXT_ID_MSB_OFFSET + offs]; 748c1000,1026 < if ( arrayToUint16( id ) == 0xFFFF ) // last record in SDR --- > if ( remainder > SDR_MAX_READ_SIZE ) { > remainder = remainder - SDR_MAX_READ_SIZE; > size = SDR_MAX_READ_SIZE; > } > else { > size = remainder; > remainder = 0; > } > } > > switch ( type ) { > > default: > break; > > case SDR_TYPE_FULL_SENSOR: > mchSys->sensCount++; > break; > > case SDR_TYPE_COMPACT_SENSOR: > mchSys->sensCount++; > break; > > case SDR_TYPE_FRU_DEV: > break; > > case SDR_TYPE_MGMT_CTRL_DEV: 750a1029,1033 > id[0] = response[IPMI_RPLY_GET_SDR_NEXT_ID_LSB_OFFSET]; > id[1] = response[IPMI_RPLY_GET_SDR_NEXT_ID_MSB_OFFSET]; > > if ( arrayToUint16( id ) == SDR_ID_LAST_SENSOR ) // last record in SDR > break; 756,759c1039,1040 < if ( !(mchSys->sens = calloc( mchSys->sensCount, sizeof(*sens) ) ) ) { < printf("mchSdrGetDataAll: No memory for sensor data for %s\n", mchSess->name); < goto bail; < } --- > // no need for both sdrCount and sens; change to only use one or at least stop using sdrCount once sens is assigned > //printf("mchSys->sens is %i is NULL %i mchSys->sensCount %i, sizeof(*sens) %i, mchSys->sensCount*sizeof(*sens) %i\n", mchSys->sens, mchSys->sens == NULL, mchSys->sensCount, sizeof(*sens), mchSys->sensCount*sizeof(*sens) ); 761c1042,1043 < if ( !(mchSys->mgmt = calloc( mchSys->mgmtCount, sizeof(*mgmt) ) ) ) { --- > if ( !(mchSys->sens = ipmiReallocZeros( mchSys->sens, mchSys->sensCount*sizeof(*sens) ) ) ) { > // if ( !(mchSys->sens = calloc( 1, mchSys->sensCount*sizeof(*sens) ) ) ) { 769a1052 > //printf("sdr %i type %i\n", i, type); 780a1064 > //printf("fruId %i\n", fruId); 782c1066,1067 < mchSys->fru[iFru].instance = 0; /* Initialize instance to 0 */ --- > mchSys->fru[fruId].instance = 0; /* Initialize instance to 0 */ > // mchSys->fru[iFru].instance = 0; /* Initialize instance to 0 */ 786c1071 < mchSdrMgmtCtrlDev( &(mchSys->mgmt[iMgmt]), raw + i*SDR_MAX_LENGTH ); --- > mchSdrMgmtCtrlDev( &(mchSys->mgmt[iMgmt].sdr), raw + i*SDR_MAX_LENGTH ); 792c1077 < if ( MCH_DBG( mchStat[inst] ) > 1 ) { --- > if ( MCH_DBG( mchStat[inst] ) >= MCH_DBG_MED ) { 796c1081,1085 < printf("SDR %i, %s entity ID 0x%02x, entity inst 0x%02x, sensor number %i, sens type 0x%02x, owner 0x%02x, LUN %i, RexpBexp %i, M %i, MTol %i, B %i, BAcc %i\n", i, sens->sdr.str, sens->sdr.entityId, sens->sdr.entityInst, sens->sdr.number, sens->sdr.sensType, sens->sdr.owner, sens->sdr.lun, sens->sdr.RexpBexp, sens->sdr.M, sens->sdr.MTol, sens->sdr.B, sens->sdr.BAcc); --- > printf("SDR %i, %s entity ID 0x%02x, entity inst 0x%02x, sensor number %i, sens type 0x%02x, " > "owner 0x%02x, LUN %i, RexpBexp %i, M %i, MTol %i, B %i, BAcc %i\n", > sens->sdr.number, sens->sdr.str, sens->sdr.entityId, sens->sdr.entityInst, > sens->sdr.number, sens->sdr.sensType, sens->sdr.owner, sens->sdr.lun, > sens->sdr.RexpBexp, sens->sdr.M, sens->sdr.MTol, sens->sdr.B, sens->sdr.BAcc); 800c1089 < if ( fru->sdr.entityInst ) --- > if ( fru->sdr.recType ) 806,807c1095,1096 < printf("Mgmt Ctrl %i, entity ID 0x%02x, entity inst 0x%02x, %s\n", < i, mgmt->entityId, mgmt->entityInst, mgmt->str); --- > printf("Mgmt Ctrl %i, entity ID 0x%02x, entity inst 0x%02x, %s, cap 0x%02x\n", > i, mgmt->sdr.entityId, mgmt->sdr.entityInst, mgmt->sdr.str, mgmt->sdr.cap); 814a1104,1105 > printf("sdrcount %i before free, raw is %i is NULL %i\n", sdrCount, raw, raw == NULL ); > 828c1119 < * during the message write We call ipmiMsgWriteRead directly, --- > * during the message write. We call ipmiMsgWriteRead directly, 856c1147,1148 < ipmiMsgWriteRead( mchSess->name, message, sizeof( RMCP_HEADER ) + sizeof( ASF_MSG ), response, &responseSize, RPLY_TIMEOUT_NAT, &responseLen ); --- > ipmiMsgWriteRead( mchSess->name, message, sizeof( RMCP_HEADER ) + sizeof( ASF_MSG ), > response, &responseSize, RPLY_TIMEOUT_NAT, &responseLen ); 951c1243 < int --- > static int 956,958c1248,1250 < uint8_t response[MSG_MAX_LENGTH] = { 0 }; < uint8_t tmpvt[4] = { 0 }, tmpnat[4] = { 0 }, vers; < uint32_t mfvt, mfnat; --- > uint8_t response[IPMI_RPLY_GET_DEVICE_ID_LENGTH] = { 0 }; > uint8_t tmp[4] = { 0 }, vers; > uint32_t mf; 960,992c1252,1264 < if ( mchMsgGetDeviceId( mchData, response, IPMI_MSG_ADDR_CM ) ) { < printf("mchIdentify: Error from Get Device ID command\n"); < return -1; < } < < /* Extract Manufacturer ID */ < for ( i = 0; i < IPMI_RPLY_MANUF_ID_LENGTH ; i++) < tmpvt[i] = response[IPMI_RPLY_MANUF_ID_OFFSET + i]; < for ( i = 0; i < IPMI_RPLY_MANUF_ID_LENGTH ; i++) < tmpnat[i] = response[IPMI_RPLY_MANUF_ID_OFFSET + i + IPMI_RPLY_OFFSET_NAT]; < < mfvt = arrayToUint32( tmpvt ); < mfnat = arrayToUint32( tmpnat ); < < mfvt = IPMI_MANUF_ID( mfvt ); < mfnat = IPMI_MANUF_ID( mfnat ); < < if ( mfvt == MCH_MANUF_ID_VT ) { < mchSess->type = MCH_TYPE_VT; < mchSess->timeout = RPLY_TIMEOUT_VT; < vers = response[IPMI_RPLY_IPMI_VERS_OFFSET]; < printf("Identified %s to be Vadatech. IPMI version %i.%i\n", mchSess->name, IPMI_VER_MSD( vers ), IPMI_VER_LSD( vers )); < } < else if ( mfnat == MCH_MANUF_ID_NAT ) { < mchSess->type = MCH_TYPE_NAT; < vers = response[IPMI_RPLY_IPMI_VERS_OFFSET + IPMI_RPLY_OFFSET_NAT]; < printf("Identified %s to be N.A.T. IPMI version %i.%i\n", mchSess->name, IPMI_VER_MSD( vers ), IPMI_VER_LSD( vers )); < } < else { < printf("mchIdentify: Unknown type of MCH, Manufacturer ID 0x%08x or 0x%08x?\n", mfvt, mfnat); < mchSess->type = MCH_TYPE_UNKNOWN; < return -1; < } --- > if ( mchMsgGetDeviceId( mchData, response, 0, 0 ) ) { > printf("mchIdentify: Error from Get Device ID command\n"); > return -1; > } > > /* Extract Manufacturer ID */ > for ( i = 0; i < IPMI_RPLY_MANUF_ID_LENGTH ; i++) > tmp[i] = response[IPMI_RPLY_MANUF_ID_OFFSET + i]; > > vers = response[IPMI_RPLY_IPMI_VERS_OFFSET]; > > mf = arrayToUint32( tmp ); > mf = IPMI_MANUF_ID( mf ); 993a1266,1296 > switch ( mf ) { > > default: > printf("mchIdentify: Unknown type of MCH, failed to match manuf ID 0x%08x\n", mf); > mchSess->type = MCH_TYPE_UNKNOWN; > return -1; > > case MCH_MANUF_ID_NAT: > mchSess->type = MCH_TYPE_NAT; > printf("Identified %s to be N.A.T. IPMI version %i.%i\n", mchSess->name, IPMI_VER_MSD( vers ), IPMI_VER_LSD( vers )); > break; > > case MCH_MANUF_ID_VT: > mchSess->type = MCH_TYPE_VT; > mchSess->timeout = RPLY_TIMEOUT_VT; > printf("Identified %s to be Vadatech. IPMI version %i.%i\n", mchSess->name, IPMI_VER_MSD( vers ), IPMI_VER_LSD( vers )); > break; > > case MCH_MANUF_ID_DELL: > mchSess->type = MCH_TYPE_DELL; > mchSess->timeout = RPLY_TIMEOUT_NAT; > printf("Identified %s to be Dell. IPMI version %i.%i\n", mchSess->name, IPMI_VER_MSD( vers ), IPMI_VER_LSD( vers )); > break; > > case MCH_MANUF_ID_SUPERMICRO: > mchSess->type = MCH_TYPE_SUPERMICRO; // Was previously DELL; need to figure this out > mchSess->timeout = RPLY_TIMEOUT_NAT; > printf("Identified %s to be Supermicro. IPMI version %i.%i\n", mchSess->name, IPMI_VER_MSD( vers ), IPMI_VER_LSD( vers )); > break; > > } 997,998c1300,1301 < void < mchSensorFruGetInstance(MchSys mchSys) --- > static void > mchSensorFruGetInstance(int type, MchSys mchSys) 1000d1302 < int f = MAX_FRU; 1002,1006c1304,1307 < uint8_t fruEntId[f]; /* Entity IDs */ < uint8_t fruEntInst[f]; /* Counts of each ID */ < uint8_t sensTypeInst[f][MAX_SENSOR_TYPE]; /* Counts of sensor type per ID instance */ < int i, j, found, id; < Fru fru; --- > uint8_t sensTypeInst[MAX_FRU_MGMT][MAX_SENSOR_TYPE] = { { 0 } }; /* Counts of sensor type per ID instance */ > int i, j, id, mgmtId; > Fru fru = 0; > Mgmt mgmt = 0; 1007a1309,1312 > uint8_t mgmtEntId, mgmtEntInst; > > /* Find FRU or management controller associated with this sensor, assign sensor an instance based on type */ > for ( j = 0; j < s; j++ ) { 1009,1011c1314 < memset( fruEntId, 0, f ); < memset( fruEntInst, 0, f ); < memset( sensTypeInst, 0, f*MAX_SENSOR_TYPE ); --- > printf("sensor %i senscount %i\n", j, s); 1013c1316 < for ( i = 0; i < f; i++ ) { --- > sens = &mchSys->sens[j]; 1015,1017c1318,1329 < fru = &mchSys->fru[i]; < id = fru->sdr.fruId; < found = 0; --- > if ( -1 == (id = sens->fruId) ) { > printf("sens %i fruid %i id %i\n", j, sens->fruId, id ); > continue; > } > > /* Skip FRU 0 for MicroTCA because it is reserved logical entity with same entityId and entityInst as MCH 1 */ > if ( (id == 0) && MCH_IS_MICROTCA( type ) ) { > printf("id 0 MICROTCA sens %i fruid %i id %i\n", j, sens->fruId, id ); > continue; > } > printf("sensor %i id %i\n", j, id ); > if ( id < MAX_FRU ) { 1019,1020c1331 < /* Find sensors associated with this FRU, assign each an instance based on sensor type */ < for ( j = 0; j < s; j++ ) { --- > fru = &mchSys->fru[id]; 1022c1333,1350 < sens = &mchSys->sens[j]; --- > printf("id %i rec type %x\n", id, fru->sdr.recType ); > /* If a real entity */ > if ( fru->sdr.recType ) { > sens->instance = ++sensTypeInst[id][sens->sdr.sensType]; > printf("real entity rec type %x sens instance %i\n", fru->sdr.recType, sens->instance); > if ( sens->instance > MAX_SENS_INST ) { > printf("WARNING: FRU %i sensor type 0x%02x instance %i exceeds allowed instance %i\n", id, sens->sdr.sensType, sens->instance, MAX_SENS_INST); > continue; > } > mchSys->sensLkup[id][sens->sdr.sensType][sens->instance] = j; > } > } > else { > id = sens->fruId; > mgmtId = id - MAX_FRU; > mgmt = &mchSys->mgmt[mgmtId]; > mgmtEntId = mgmt->sdr.entityId; > mgmtEntInst = mgmt->sdr.entityInst; 1024c1352 < if ( mchSys->fru[sens->fruIndex].sdr.fruId == id ) { --- > if ( mchSys->sens->mgmtIndex == mgmtId ) { 1027,1028c1355,1360 < if ( fru->sdr.entityInst ) { < sens->instance = ++sensTypeInst[i][sens->sdr.sensType]; --- > if ( mgmt->sdr.recType ) { > sens->instance = ++sensTypeInst[id][sens->sdr.sensType]; > if ( sens->instance > MAX_SENS_INST ) { > printf("WARNING: FRU %i sensor type 0x%02x instance %i exceeds allowed instance %i\n", id, sens->sdr.sensType, sens->instance, MAX_SENS_INST); > continue; > } 1034a1367,1459 > //#ifdef DEBUG > printf("mchSensorFruGetInstance:\n"); > for ( i = 0; i < s; i++ ) { > sens = &mchSys->sens[i]; > if ( sens->fruId != -1 ) { > fru = &mchSys->fru[sens->fruId]; > printf("FRU sensor %s %i, type 0x%02x, inst %i, FRU entId 0x%02x, entInst 0x%02x, sens entId 0x%02x entInst 0x%02x recType %i fruId %i fruId %i\n", > sens->sdr.str, sens->sdr.number, sens->sdr.sensType, sens->instance, fru->sdr.entityId, fru->sdr.entityInst, > sens->sdr.entityId, sens->sdr.entityInst, sens->sdr.recType, sens->fruId, sens->fruId); > } > else if ( sens->mgmtIndex != -1 ) { > mgmt = &mchSys->mgmt[sens->mgmtIndex]; > printf("Mgmt sensor %s %i, type 0x%02x, inst %i, MGMT entId 0x%02x, entInst 0x%02x, sens entId 0x%02x entInst 0x%02x recType %i\n", > sens->sdr.str, sens->sdr.number, sens->sdr.sensType, sens->instance, mgmt->sdr.entityId, mgmt->sdr.entityInst, > sens->sdr.entityId, sens->sdr.entityInst, sens->sdr.recType); > } > else > printf("Sensor %s %i, type 0x%02x, inst %i, entId 0x%02x entInst 0x%02x recType %i, no corresponding FRU or MGTM\n", > sens->sdr.str, sens->sdr.number, sens->sdr.sensType, sens->instance, sens->sdr.entityId, sens->sdr.entityInst, sens->sdr.recType); > } > //#endif > } > > static void > mchSensorFruGetInstanceOld(int type, MchSys mchSys) > { > int s = mchSys->sensCount; > uint8_t sensTypeInst[MAX_FRU_MGMT][MAX_SENSOR_TYPE] = { { 0 } }; /* Counts of sensor type per ID instance */ > int i, j, id, mgmtId; > Fru fru = 0; > Mgmt mgmt = 0; > Sensor sens; > uint8_t mgmtEntId, mgmtEntInst; > > /* Find FRU or management controller associated with this sensor, assign sensor an instance based on type */ > for ( j = 0; j < s; j++ ) { > > sens = &mchSys->sens[j]; > > /* Start at 1 for MicroTCA because FRU 0 is reserved logical entity with same entityId and entityInst as MCH 1 */ > for ( i = 0; i < MAX_FRU_MGMT; i++ ) { > > if ( (i == 0) && MCH_IS_MICROTCA( type ) ) { > } > else { > if ( i < MAX_FRU ) { > fru = &mchSys->fru[i]; > id = fru->sdr.fruId; > > if ( mchSys->fru[sens->fruId].sdr.fruId == id ) { > > /* If a real entity */ > if ( fru->sdr.recType ) { > sens->instance = ++sensTypeInst[id][sens->sdr.sensType]; > if ( sens->instance > MAX_SENS_INST ) { > printf("WARNING: FRU %i sensor type 0x%02x instance %i exceeds allowed instance %i\n", i, sens->sdr.sensType, sens->instance, MAX_SENS_INST); > break; > } > mchSys->sensLkup[id][sens->sdr.sensType][sens->instance] = j; > break; > } > } > else > printf("id %i does not match %i\n", id, mchSys->fru[sens->fruId].sdr.fruId); > } > else { > id = i; > mgmtId = i - MAX_FRU; > mgmt = &mchSys->mgmt[mgmtId]; > mgmtEntId = mgmt->sdr.entityId; > mgmtEntInst = mgmt->sdr.entityInst; > > if ( mchSys->sens->mgmtIndex == mgmtId ) { > > /* If a real entity */ > if ( mgmt->sdr.recType ) { > sens->instance = ++sensTypeInst[id][sens->sdr.sensType]; > if ( sens->instance > MAX_SENS_INST ) { > printf("WARNING: FRU %i sensor type 0x%02x instance %i exceeds allowed instance %i\n", i, sens->sdr.sensType, sens->instance, MAX_SENS_INST); > break; > } > mchSys->sensLkup[id][sens->sdr.sensType][sens->instance] = j; > break; > } > } > else > printf("mgmt id %i does not match %i\n", mgmtId, mchSys->sens->mgmtIndex, mgmtId); > > } > } > } > } > 1039,1041c1464,1478 < int fruIndex = sens->fruIndex; < fru = &mchSys->fru[fruIndex]; < printf("Sensor %i, type %02x, inst %i, FRU entId %02x, entInst %02x, sens entId %02x entInst %02x recType %i\n",sens->sdr.number, sens->sdr.sensType, sens->instance, fru->sdr.entityId, fru->sdr.entityInst, sens->sdr.entityId, sens->sdr.entityInst, sens->sdr.recType); --- > if ( sens->fruId!= -1 ) { > fru = &mchSys->fru[sens->fruId]; > printf("FRU sensor %s %i, type 0x%02x, inst %i, FRU entId 0x%02x, entInst 0x%02x, sens entId 0x%02x entInst 0x%02x recType %i\n", > sens->sdr.str, sens->sdr.number, sens->sdr.sensType, sens->instance, fru->sdr.entityId, fru->sdr.entityInst, > sens->sdr.entityId, sens->sdr.entityInst, sens->sdr.recType); > } > else if ( sens->mgmtIndex != -1 ) { > mgmt = &mchSys->mgmt[sens->mgmtIndex]; > printf("Mgmt sensor %s %i, type 0x%02x, inst %i, MGMT entId 0x%02x, entInst 0x%02x, sens entId 0x%02x entInst 0x%02x recType %i\n", > sens->sdr.str, sens->sdr.number, sens->sdr.sensType, sens->instance, mgmt->sdr.entityId, mgmt->sdr.entityInst, > sens->sdr.entityId, sens->sdr.entityInst, sens->sdr.recType); > } > else > printf("Sensor %s %i, type 0x%02x, inst %i, entId 0x%02x entInst 0x%02x recType %i, no corresponding FRU or MGTM\n", > sens->sdr.str, sens->sdr.number, sens->sdr.sensType, sens->instance, sens->sdr.entityId, sens->sdr.entityInst, sens->sdr.recType); 1058c1495 < set3DArrayVals( MAX_FRU, MAX_SENSOR_TYPE, MAX_SENS, mchSys->sensLkup, -1 ); --- > set3DArrayVals( MAX_FRU_MGMT, MAX_SENSOR_TYPE, MAX_SENS_INST, mchSys->sensLkup, -1 ); 1062,1068d1498 < /* Determine MCH type */ < if ( mchIdentify( mchData ) ) { < printf("Failed to identify %s MCH type; cannot complete initialization\n",mchSess->name); < mchStatSet( inst, MCH_MASK_INIT, MCH_MASK_INIT_NOT_DONE ); < return -1; < } < 1072,1073c1502,1508 < mchStatSet( inst, MCH_MASK_INIT, MCH_MASK_INIT_NOT_DONE ); < return -1; --- > goto bail; > } > > /* Determine MCH type */ > if ( mchIdentify( mchData ) ) { > printf("Failed to identify %s MCH type; cannot complete initialization\n",mchSess->name); > goto bail; 1079,1080c1514 < mchStatSet( inst, MCH_MASK_INIT, MCH_MASK_INIT_NOT_DONE ); < return -1; --- > goto bail; 1091c1525 < mchSensorFruGetInstance( mchSys ); --- > mchSensorFruGetInstance( mchSess->type, mchSys ); 1098a1533,1537 > > bail: > > mchStatSet( inst, MCH_MASK_INIT, MCH_MASK_INIT_NOT_DONE ); > return -1; 1100a1540,1542 > > // !! need to make sure initial values do not lead to records sending messages i.e. assume not initialized if cannot establish session > 1112,1114c1554,1556 < MchDev mch = 0; /* Device support data structure */ < MchData mchData = 0; /* MCH-specific info */ < MchSess mchSess = 0; --- > MchDev mch = 0; /* Device support data structure */ > MchData mchData = 0; /* MCH-specific info */ > MchSess mchSess = 0; 1116,1118c1558,1560 < MchSys mchSys = 0; < char taskName[50]; < int inst; --- > MchSys mchSys = 0; > char taskName[MAX_NAME_LENGTH+10]; > int inst; 1135a1578,1580 > if ( !(mchSys->mgmt = calloc( MAX_MGMT , sizeof(MgmtRec) ) ) ) > cantProceed("FATAL ERROR: No memory for Management Controller data for %s for %s\n", name); > 1153,1154c1598,1599 < mchSess->name = mch->name; < mchSys->name = mch->name; --- > strncpy( mchSess->name, mch->name, MAX_NAME_LENGTH ); > strncpy( mchSys->name, mch->name, MAX_NAME_LENGTH ); // okay to remove this and from drvMch.h? 1165c1610 < epicsThreadSleep( PING_PERIOD ); --- > epicsThreadSleep( 2 ); Index: src/drvMch.h =================================================================== RCS file: /afs/slac/g/lcls/cvs/epics/site/src/ipmiComm/src/drvMch.h,v retrieving revision 1.11 diff -r1.11 drvMch.h 8a9,10 > #define MAX_MGMT 5 // management controller device > #define MAX_FRU_MGMT MAX_FRU + MAX_MGMT 10c12 < #define MAX_SENS 32 /* CHANGE THIS? */ --- > #define MAX_SENS_INST 32 /* Max instances of one sensor type on one FRU or Management Controller entity */ 38a41,45 > #define MCH_DBG_OFF 0 > #define MCH_DBG_LOW 1 > #define MCH_DBG_MED 2 > #define MCH_DBG_HIGH 3 > 43,181c50,54 < // Much of this should be moved to ipmiDef.h < < typedef struct FruFieldRec_ { < uint8_t type; /* Type of data */ < uint8_t length; /* Length of data (bytes) */ < uint8_t *data; < } FruFieldRec, *FruField; < < typedef struct FruChassisRec_ { < uint8_t offset; /* Offset into FRU storage */ < uint8_t ver; /* Format version (0x01) */ < uint8_t length; /* Length of FRU area */ < uint8_t type; /* Chassis type */ < FruFieldRec part; /* Part number */ < FruFieldRec sn; /* Serial number */ < /* optional custom fields */ < } FruChassisRec, *FruChassis; < < typedef struct FruBoardRec_ { < uint8_t offset; /* Offset into FRU storage */ < uint8_t ver; /* Format version (0x01) */ < uint8_t length; /* Length of FRU area */ < uint8_t lang; /* Language code */ < uint8_t date; /* Manufacturer date/time (minutes from 00:00 1/1/96) */ < FruFieldRec manuf; /* Manufacturer */ < FruFieldRec prod; /* Product name */ < FruFieldRec sn; /* Serial number */ < FruFieldRec part; /* Part number */ < /* more */ < } FruBoardRec, *FruBoard; < < typedef struct FruProdRec_ { < uint8_t offset; /* Offset into FRU storage */ < uint8_t ver; /* Format version (0x01) */ < uint8_t length; /* Length of FRU area */ < uint8_t lang; /* Language code */ < FruFieldRec manuf; /* Manufacturer */ < FruFieldRec prod; /* Product name */ < FruFieldRec part; /* Part number */ < FruFieldRec version; /* Version number */ < FruFieldRec sn; /* Serial number */ < /* more */ < } FruProdRec, *FruProd; < < /* Handle for Sensor Data Record (one per sensor) IPMI Section 43.1 < * Used for both Full and Compact SDRs < * In this implementation, we don't support all of the Full SDR fields < */ < typedef struct SdrFullRec_ { < uint8_t id[2]; /* Sensor ID (can change, so key bytes must also be used to identify a sensor) */ < uint8_t ver; /* SDR version (0x51) */ < uint8_t recType; /* Record type, 0x01 for Full Sensor Record */ < uint8_t length; /* Number of remaining record bytes */ < uint8_t owner; /* Sensor owner ID, [7:1] slave address or software ID; [0] 0 = IPMB, 1 = system software */ < uint8_t lun; /* Sensor owner LUN, [7:4] channel number; [3:2] reserved; [1:0] sensor owner LUN */ < uint8_t number; /* Sensor number, unique behind given address and LUN, 0xFF reserved */ < uint8_t entityId; /* Entity ID (physical entity that sensor is associated with) */ < uint8_t entityInst; /* Entity instance, [7] 0 = physical entity, 1 = logical; [6:0] instance number 0x00-0x5F system-relative, 0x60-0x7F device-relative */ < uint8_t init; /* Sensor initialization (see IPMI spec page 472 for details) */ < uint8_t cap; /* Sensor capabilities (see IPMI spec page 473 for details) */ < uint8_t sensType; /* Sensor type code (see IPMI spec table 42-3) */ < uint8_t readType; /* Event/reading type code (see IPMI spec table 42-1) */ < /* Following fields only applicable to Full SDR */ < uint8_t units1; /* [7:6] analog data format, [5:3] rate unit, [2:1] modifier unit, [0] percentage */ < uint8_t units2; /* Units type code, IPMI 43-15 */ < uint8_t units3; /* Units type code, 0x00 if unused */ < uint8_t linear; /* Linearization [7] reserved, [6:0] formula type */ < uint8_t M; /* M in conversion, LS 8 bits (2's complement signed 10-bit 'M' value) */ < uint8_t MTol; /* [7:6] MS 2 bits of M, [5:0] tolerance 6 bits unsigned (in +/- 1/2 raw counts) */ < uint8_t B; /* B in conversion, LS 8 bits (2's complement signed 10-bit 'B' value) */ < uint8_t BAcc; /* [7:6] MS 2 bits of B, [5:0] accuracy LW 6 bits (unsigned 10-bit Basic Sensor Accuracy in 1/100 % scaled up by accuracy exponent */ < uint8_t acc; /* [7:4] MS 4 bits of accuracy, [3:2] accuracy exponent 2 bits unsigned, [1:0] sensor direction */ < uint8_t RexpBexp; /* [7:4] R (result) exponent 4 bits 2's complement signed, [3:0] B exponent 4 bits, 2's complement signed */ < uint8_t strLength; /* Sensor ID string type/length */ < uint8_t anlgChar; /* Analog characteristics [7:3] reserved, [2] normal min specified, [1] normal max specified [0], nominal reading specified */ < uint8_t nominal; /* Nominal reading (raw units) */ < uint8_t normMax; /* Normal maximum (raw units) */ < uint8_t normMin; /* Normal minimum (raw units) */ < char str[17]; /* Sensor ID string, 16 bytes maximum */ < /* more... */ < } SdrFullRec, *SdrFull; < < /* < * Handle for FRU Device Locator Record, IPMI v2.0 Table 43-7 < */ < typedef struct SdrFruRec_ { < uint8_t id[2]; /* Sensor ID (can change, so key bytes must also be used to identify a sensor) */ < uint8_t ver; /* SDR version (0x51) */ < uint8_t recType; /* Record type, 0x01 for Full Sensor Record */ < uint8_t length; /* Number of remaining record bytes */ < uint8_t addr; /* [7:1] slave address of controller, all 0 if dev on IPMB, [0] reserved */ < uint8_t fruId; /* FRU Device ID/Slave address. For logical FRU device, [7:0] FRU dev ID, for non-intelligent, [7:1] slave address, [0] reserved */ < uint8_t lun; /* [7] logical/physical FRU device, [6:5] reserved, [4:3] LUN for FRU commands, [2:0] private bus ID */ < uint8_t chan; /* [7:4] Channel number to access device, 0 if on IPMB (MS bit in next byte?); [3:0] reserved */ < uint8_t devType; /* Device type code Table 43-12 */ < uint8_t devMod; /* Device type modifier Table 43-12 */ < uint8_t entityId; /* Entity ID (physical entity that sensor is associated with) */ < uint8_t entityInst; /* Entity instance, [7] 0 = physical entity, 1 = logical; [6:0] instance number 0x00-0x5F system-relative, 0x60-0x7F device-relative */ < uint8_t strLength; /* Device ID string type/length Section 43.15*/ < char str[17]; /* Device ID string, 16 bytes maximum */ < } SdrFruRec, *SdrFru; < < /* < * Handle for Management Controller Device Locator Record, IPMI v2.0 Table 43-8 < */ < typedef struct SdrMgmtRec_ { < uint8_t id[2]; /* Record ID */ < uint8_t ver; /* SDR version */ < uint8_t recType; /* Record type, 0x12 for Management Controller Locator */ < uint8_t length; /* Number of remaining record bytes */ < uint8_t addr; /* [7:1] I2C slave address of device on channel, [0] reserved */ < uint8_t chan; /* [7:4] reserved; [3:0] Channel number for the channel that the management controller is on, use 0 for primary BMC */ < uint8_t pwr; /* Power state notification and Global initialization, see IPMI spec for meaning of each bit */ < uint8_t cap; /* Device capabilities, see IPMI spec for meaning of each bit */ < /* next 3 bytes reserved */ < uint8_t entityId; /* Entity ID for the FRU associated with this device, 0 if not specified */ < uint8_t entityInst; /* Entity instance */ < uint8_t strLength; /* Device ID string type/length Section 43.15*/ < char str[17]; /* Device ID string, 16 bytes maximum */ < } SdrMgmtRec, *SdrMgmt; < < < /* Handle for Sensor Data Record Repository and Dynamic Sensor Device */ < typedef struct SdrRepRec_ { < uint8_t ver; /* SDR Version (0x51) */ < uint8_t size[2]; /* Number of sensor data records; LS byte stored first */ < uint8_t free[2]; /* Free space in bytes; LS byte stored first */ < uint32_t addTs; /* Timestamp of most recent addition - remove: ; LS byte stored first */ < uint32_t delTs; /* Timestamp of most recent erase - remove: ; LS byte stored first */ < uint8_t config[1]; /* 8 bits to describe Respository configuration, mostly supported commands */ < uint8_t resId; /* Reservation ID assigned when reserving SDR */ < /* remaining members used by dynamic sensor device only */ < uint8_t devSdrSize; /* Number of sensor data records in chassis dynamic Device SDR */ < uint8_t devSdrDyn; /* Sensor population dynamic, 1 is dynamic, 0 is static */ < uint8_t lun0; /* Sensors in LUN 0, 1 yes, 0 no */ < uint8_t lun1; /* Sensors in LUN 1, 1 yes, 0 no */ < uint8_t lun2; /* Sensors in LUN 2, 1 yes, 0 no */ < uint8_t lun3; /* Sensors in LUN 3, 1 yes, 0 no */ < } SdrRepRec, *SdrRep; --- > /* Handle for each Management Controller Device */ > typedef struct MgmtRec_ { > uint8_t instance; /* Instance of management controller set in drvMch.c - needed? */ > SdrMgmtRec sdr; > } MgmtRec, *Mgmt; 186c59 < uint8_t instance; /* Instance of this FRU type, set in drvMch.c */ --- > uint8_t instance; /* Instance of this FRU type, set in drvMch.c - still in use? */ 209c82,83 < int fruIndex; /* Index into FRU array (same as FRU ID) for associated FRU ( -1 if no associated FRU ) */ --- > int fruId; /* FRU ID for associated FRU, same as index into FRU array ( -1 if no associated FRU ) */ > int mgmtIndex; /* Index into MGMT array for associated Management Controller ( -1 if no associated MGMT ) */ 225c99 < const char *name; /* MCH port name used by asyn */ --- > char name[MAX_NAME_LENGTH]; /* MCH port name used by asyn */ 231c105 < int type; /* MCH vendor, Vadatech, NAT, etc. */ --- > int type; /* MCH vendor, Vadatech, NAT, etc. - need to clean this up, perhaps merge with vendor and/or add 'features' */ 236c110 < const char *name; /* MCH port name used by asyn */ --- > char name[MAX_NAME_LENGTH]; /* MCH port name used by asyn */ 239,240c113,115 < int sensLkup[MAX_FRU][MAX_SENSOR_TYPE][MAX_SENS]; /* Index into sens struct array, used by devsup, -1 if not used */ < uint8_t sensCount; /* Sensor count */ --- > int sensLkup[MAX_FRU_MGMT][MAX_SENSOR_TYPE][MAX_SENS_INST]; /* Index into sens struct array, used by devsup, -1 if not used */ > /*sens count used to be 8-bit !! */ > uint32_t sensCount; /* Sensor count, data type must be larger than MAX_FRU_MGMT*MAX_SENSOR_TYPE*MAX_SENS_INST */ 243c118 < SdrMgmtRec *mgmt; /* Array of management controller devices (size of mgmtCount) */ --- > MgmtRec *mgmt; /* Array of management controller devices (size of mgmtCount) */ 307c182 < #define IPMI_RPLY_2ND_BRIDGED_OFFSET_NAT -8 --- > #define IPMI_RPLY_2ND_BRIDGED_OFFSET_NAT 14 312a188,189 > #define IPMI_RPLY_AUTH_CAP_CHAN_OFFSET 22 /* Get Authentication Capabilities response - channel number */ > #define IPMI_RPLY_AUTH_CAP_AUTH_OFFSET 23 /* Get Authentication Capabilities response - authentication type support */ 328,330c205,207 < #define IPMI_RPLY_COMPLETION_CODE_OFFSET 42 < #define IPMI_RPLY_IPMI_VERS_OFFSET 47 /* Returned from Get Device ID Command */ < #define IPMI_RPLY_MANUF_ID_OFFSET 49 /* Returned from Get Device ID Command */ --- > #define IPMI_RPLY_COMPLETION_CODE_OFFSET_OLD 42 > #define IPMI_RPLY_IPMI_VERS_OFFSET_OLD 47 /* Returned from Get Device ID Command */ > #define IPMI_RPLY_MANUF_ID_OFFSET_OLD 49 /* Returned from Get Device ID Command */ 332,364c209,225 < #define IPMI_RPLY_SENSOR_READING_OFFSET 43 /* Sensor reading (1 byte) */ < #define IPMI_RPLY_SENSOR_ENABLE_BITS_OFFSET 44 /* Sensor enable bits: event msgs; scanning; reading/state */ < #define IPMI_RPLY_HS_SENSOR_READING_OFFSET 45 /* Hot swap sensor reading (1 byte) */ < #define IPMI_RPLY_SENSOR_THRESH_MASK_OFFSET 43 /* Mask of readable thresholds */ < #define IPMI_RPLY_SENSOR_THRESH_LNC_OFFSET 44 /* Lower non-critical threshold */ < #define IPMI_RPLY_SENSOR_THRESH_LC_OFFSET 45 /* Lower critical threshold */ < #define IPMI_RPLY_SENSOR_THRESH_LNR_OFFSET 46 /* Lower non-recoverable threshold */ < #define IPMI_RPLY_SENSOR_THRESH_UNC_OFFSET 47 /* Upper non-critical threshold */ < #define IPMI_RPLY_SENSOR_THRESH_UC_OFFSET 48 /* Upper critical threshold */ < #define IPMI_RPLY_SENSOR_THRESH_UNR_OFFSET 49 /* Upper non-recoverable threshold */ < #define IPMI_RPLY_FRU_AREA_SIZE_LSB_OFFSET 43 /* FRU inventory area size in bytes, LSB */ < #define IPMI_RPLY_FRU_AREA_SIZE_MSB_OFFSET 44 /* FRU inventory area size in bytes, MSB */ < #define IPMI_RPLY_FRU_AREA_ACCESS_OFFSET 45 /* Bit 0 indicates if device is accessed by bytes (0) or words (1) */ < #define IPMI_RPLY_FRU_DATA_READ_OFFSET 44 /* FRU data */ < #define IPMI_RPLY_SDRREP_VER_OFFSET 43 /* SDR Repository Info */ < #define IPMI_RPLY_SDRREP_CNT_LSB_OFFSET 44 /* Number of records in repository, LSB */ < #define IPMI_RPLY_SDRREP_CNT_MSB_OFFSET 45 /* Number of records in repository, MSB */ < #define IPMI_RPLY_SDRREP_ADD_TS_OFFSET 48 /* Timestamp of most recent addition, LSB first */ < #define IPMI_RPLY_SDRREP_DEL_TS_OFFSET 52 /* Timestamp of most recent deletion, LSB first */ < #define IPMI_RPLY_DEV_SDR_CNT_OFFSET 43 /* Number of SDRs for device */ < #define IPMI_RPLY_DEV_SDR_FLAGS_OFFSET 44 /* Number of SDRs for device */ < #define IPMI_RPLY_GET_SDR_NEXT_ID_LSB_OFFSET 43 /* ID of next sensor in repository, LSB */ < #define IPMI_RPLY_GET_SDR_NEXT_ID_MSB_OFFSET 44 /* ID of next sensor in repository, MSB */ < #define IPMI_RPLY_GET_SDR_DATA_OFFSET 45 /* ID of next sensor in repository, MSB */ < #define IPMI_RPLY_GET_FAN_PROP_MIN_OFFSET 44 /* Fan tray minimum fan level */ < #define IPMI_RPLY_GET_FAN_PROP_MAX_OFFSET 45 /* Fan tray maximum fan level */ < #define IPMI_RPLY_GET_FAN_PROP_NOM_OFFSET 46 /* Fan tray nominal fan level */ < #define IPMI_RPLY_GET_FAN_PROP_PROP_OFFSET 47 /* Fan tray properties */ < #define IPMI_RPLY_GET_FAN_LEVEL_OFFSET 44 /* Current fan level */ < #define IPMI_RPLY_GET_POWER_LEVEL_PROP_OFFSET 44 /* FRU power properties */ < #define IPMI_RPLY_GET_POWER_LEVEL_DELAY_OFFSET 45 /* Delay to stable power */ < #define IPMI_RPLY_GET_POWER_LEVEL_MULT_OFFSET 46 /* Power multiplier */ < #define IPMI_RPLY_GET_POWER_LEVEL_DRAW_OFFSET 47 /* Draw of first level (optional: next levels follow this, up to 25 total) */ --- > #define IPMI_RPLY_SENSOR_READING_OFFSET_OLD 43 /* Sensor reading (1 byte) */ > #define IPMI_RPLY_SENSOR_ENABLE_BITS_OFFSET_OLD 44 /* Sensor enable bits: event msgs; scanning; reading/state */ > #define IPMI_RPLY_HS_SENSOR_READING_OFFSET_OLD 45 /* Hot swap sensor reading (1 byte) */ > #define IPMI_RPLY_FRU_AREA_SIZE_LSB_OFFSET_OLD 43 /* FRU inventory area size in bytes, LSB */ > #define IPMI_RPLY_FRU_AREA_SIZE_MSB_OFFSET_OLD 44 /* FRU inventory area size in bytes, MSB */ > #define IPMI_RPLY_FRU_AREA_ACCESS_OFFSET_OLD 45 /* Bit 0 indicates if device is accessed by bytes (0) or words (1) */ > #define IPMI_RPLY_FRU_DATA_READ_OFFSET_OLD 44 /* FRU data */ > #define IPMI_RPLY_SDRREP_VER_OFFSET_OLD 43 /* SDR Repository Info */ > #define IPMI_RPLY_SDRREP_CNT_LSB_OFFSET_OLD 44 /* Number of records in repository, LSB */ > #define IPMI_RPLY_SDRREP_CNT_MSB_OFFSET_OLD 45 /* Number of records in repository, MSB */ > #define IPMI_RPLY_SDRREP_ADD_TS_OFFSET_OLD 48 /* Timestamp of most recent addition, LSB first */ > #define IPMI_RPLY_SDRREP_DEL_TS_OFFSET_OLD 52 /* Timestamp of most recent deletion, LSB first */ > #define IPMI_RPLY_DEV_SDR_CNT_OFFSET_OLD 43 /* Number of SDRs for device */ > #define IPMI_RPLY_DEV_SDR_FLAGS_OFFSET_OLD 44 /* Number of SDRs for device */ > #define IPMI_RPLY_GET_SDR_NEXT_ID_LSB_OFFSET_OLD 43 /* ID of next sensor in repository, LSB */ > #define IPMI_RPLY_GET_SDR_NEXT_ID_MSB_OFFSET_OLD 44 /* ID of next sensor in repository, MSB */ > #define IPMI_RPLY_GET_SDR_DATA_OFFSET_OLD 45 /* ID of next sensor in repository, MSB */ 369c230,334 < #define SENSOR_TYPE_HOTSWAP 0xF0 --- > #define IPMI_RPLY_COMPLETION_CODE_OFFSET 20 > > /* Offsets into payload message > * (0-leading as these are used as index arrays, > * 0th element always completion code) > */ > #define IPMI_RPLY_MANUF_ID_OFFSET 10 /* Returned from Get Device ID Command */ > #define IPMI_RPLY_IPMI_VERS_OFFSET 8 /* Returned from Get Device ID Command */ > #define IPMI_RPLY_SDRREP_VER_OFFSET 1 /* SDR Repository Info */ > #define IPMI_RPLY_SDRREP_CNT_LSB_OFFSET 2 /* Number of records in repository, LSB */ > #define IPMI_RPLY_SDRREP_CNT_MSB_OFFSET 3 /* Number of records in repository, MSB */ > #define IPMI_RPLY_SDRREP_ADD_TS_OFFSET 6 /* Timestamp of most recent addition, LSB first */ > #define IPMI_RPLY_SDRREP_DEL_TS_OFFSET 10 /* Timestamp of most recent deletion, LSB first */ > #define IPMI_RPLY_DEV_SDR_CNT_OFFSET 1 /* Number of SDRs for device */ > #define IPMI_RPLY_DEV_SDR_FLAGS_OFFSET 2 /* Number of SDRs for device */ > #define IPMI_RPLY_GET_SDR_NEXT_ID_LSB_OFFSET 1 /* ID of next sensor in repository, LSB */ > #define IPMI_RPLY_GET_SDR_NEXT_ID_MSB_OFFSET 2 /* ID of next sensor in repository, MSB */ > #define IPMI_RPLY_GET_SDR_DATA_OFFSET 3 /* Requested SDR data */ > #define IPMI_RPLY_GET_SDR_RES_LSB_OFFSET 1 /* Reservation ID returned by Reserve SDR Rep */ > #define IPMI_RPLY_GET_SDR_RES_MSB_OFFSET 2 /* Reservation ID returned by Reserve SDR Rep */ > #define IPMI_RPLY_FRU_AREA_SIZE_LSB_OFFSET 1 /* FRU inventory area size in bytes, LSB */ > #define IPMI_RPLY_FRU_AREA_SIZE_MSB_OFFSET 2 /* FRU inventory area size in bytes, MSB */ > #define IPMI_RPLY_FRU_AREA_ACCESS_OFFSET 3 /* Bit 0 indicates if device is accessed by bytes (0) or words (1) */ > #define IPMI_RPLY_FRU_DATA_READ_OFFSET 2 /* FRU data */ > #define IPMI_RPLY_SENSOR_READING_OFFSET 1 /* Sensor reading (1 byte) */ > #define IPMI_RPLY_DISCRETE_SENSOR_READING_OFFSET 3 /* Discrete multi-state sensor value in threshold/assertions byte */ > #define IPMI_RPLY_SENSOR_ENABLE_BITS_OFFSET 2 /* Sensor enable bits: event msgs; scanning; reading/state */ > #define IPMI_RPLY_SENSOR_THRESH_MASK_OFFSET 1 /* Mask of readable thresholds */ > #define IPMI_RPLY_SENSOR_THRESH_LNC_OFFSET 2 /* Lower non-critical threshold */ > #define IPMI_RPLY_SENSOR_THRESH_LC_OFFSET 3 /* Lower critical threshold */ > #define IPMI_RPLY_SENSOR_THRESH_LNR_OFFSET 4 /* Lower non-recoverable threshold */ > #define IPMI_RPLY_SENSOR_THRESH_UNC_OFFSET 5 /* Upper non-critical threshold */ > #define IPMI_RPLY_SENSOR_THRESH_UC_OFFSET 6 /* Upper critical threshold */ > #define IPMI_RPLY_SENSOR_THRESH_UNR_OFFSET 7 /* Upper non-recoverable threshold */ > > /* PICMG */ > #define PICMG_RPLY_GET_POWER_LEVEL_PROP_OFFSET 2 /* FRU power properties */ > #define PICMG_RPLY_GET_POWER_LEVEL_DELAY_OFFSET 3 /* Delay to stable power */ > #define PICMG_RPLY_GET_POWER_LEVEL_MULT_OFFSET 4 /* Power multiplier */ > #define PICMG_RPLY_GET_POWER_LEVEL_DRAW_OFFSET 5 /* Draw of first level (optional: next levels follow this, up to 25 total) */ > #define IPMI_RPLY_GET_FAN_PROP_MIN_OFFSET 2 /* Fan tray minimum fan level */ > #define IPMI_RPLY_GET_FAN_PROP_MAX_OFFSET 3 /* Fan tray maximum fan level */ > #define IPMI_RPLY_GET_FAN_PROP_NOM_OFFSET 4 /* Fan tray nominal fan level */ > #define IPMI_RPLY_GET_FAN_PROP_PROP_OFFSET 5 /* Fan tray properties */ > > > /* Read offset: bridged request, reply is in 1 message packet (NAT) */ > #define IPMI_RPLY_BRIDGED_1REPLY_OFFSET 7 > /* Read offset: bridged request, reply is in 2 message packet2 (VT) */ > #define IPMI_RPLY_BRIDGED_2REPLY_OFFSET 22 > /* Read offset: double bridged request, reply is in 1 message packet (NAT), not sure about this one */ > #define IPMI_RPLY_2BRIDGED_1REPLY_OFFSET 0 > > #define FOOTER_LENGTH 1 /* checksum */ > > #define IPMI_RPLY_GET_DEVICE_ID_LENGTH 16 > #define IPMI_RPLY_GET_SDRREP_INFO_LENGTH 15 > #define IPMI_RPLY_RESERVE_SDRREP_LENGTH 3 > #define IPMI_RPLY_GET_DEV_SDR_INFO_LENGTH 7 > #define IPMI_RPLY_GET_DEV_SDR_LENGTH_HDR 3 > > #define SDR_MAX_READ_SIZE 22 /*not all systems can deliver full SDR in one message, ipmitool uses 22 for VT (and maybe others */ > > #define IPMI_RPLY_CLOSE_SESSION_LENGTH_VT 22 > #define IPMI_RPLY_SENSOR_READ_MAX_LENGTH 5 /* max, length varies */ > #define IPMI_RPLY_GET_SENSOR_THRESH_LENGTH 8 > #define IPMI_RPLY_GET_CHAS_STATUS_LENGTH_VT 47 /* does NOT include optional byte */ > #define IPMI_RPLY_CHAS_CTRL_LENGTH 1 > #define IPMI_RPLY_GET_FRU_INV_INFO_LENGTH 4 > #define IPMI_RPLY_READ_FRU_DATA_LENGTH_HDR 2 > #define IPMI_RPLY_WRITE_FRU_DATA_LENGTH 2 > #define IPMI_RPLY_GET_SDR_LENGTH_HDR 3 /* get sdr message length is this + remaining data bytes */ > //#define IPMI_RPLY_GET_SDR_LENGTH 0 /* varies */ > #define IPMI_RPLY_COLD_RESET_LENGTH 1 > #define IPMI_RPLY_CHAS_CTRL_LENGTH 1 > > /* picmg > #define IPMI_RPLY_SET_FRU_POLICY_LENGTH_VT 44 > #define IPMI_RPLY_GET_FRU_POLICY_LENGTH_VT 45 > #define IPMI_RPLY_SET_FRU_ACT_LENGTH_VT 45 > #define IPMI_RPLY_GET_FAN_PROP_LENGTH_VT 49 > #define IPMI_RPLY_SET_FAN_LEVEL_LENGTH_VT 45 > */ > #define IPMI_RPLY_GET_FAN_PROP_LENGTH 6 > #define IPMI_RPLY_GET_FAN_LEVEL_LENGTH 3 /* ignore optional bytes for now */ > #define IPMI_RPLY_GET_POWER_LEVEL_LENGTH 25 /* max length due to optional bytes */ > #define IPMI_RPLY_SET_FAN_LEVEL_LENGTH 3 /* ignore optional byte for now */ > > /* PICMG */ > #define IPMI_MSG2_SET_FRU_ACT_DEACTIVATE 0 /* Command value in Set FRU Activate command */ > #define IPMI_MSG2_SET_FRU_ACT_ACTIVATE 1 > #define IPMI_MSG2_SET_FRU_ACT_FRU_OFFSET 4 /* FRU ID, used in many commands */ > #define IPMI_MSG2_SET_FRU_ACT_CMD_OFFSET 5 > #define IPMI_MSG2_SET_FRU_POLICY_MASK_OFFSET 5 > #define IPMI_MSG2_SET_FRU_POLICY_BITS_OFFSET 6 > #define IPMI_MSG2_SET_FAN_LEVEL_OFFSET 5 /* New fan level to set */ > #define IPMI_MSG2_GET_POWER_LEVEL_TYPE_OFFSET 5 > #define IPMI_RPLY_GET_FAN_LEVEL_OFFSET 2 /* Current fan level */ > > #define IPMI_MSG_CMD_GET_POWER_LEVEL 0x12 > #define IPMI_MSG_CMD_GET_FAN_PROP 0x14 > #define IPMI_MSG_CMD_GET_FAN_LEVEL 0x16 > #define IPMI_MSG_CMD_SET_FAN_LEVEL 0x15 > > #define SENSOR_TYPE_HOTSWAP 0xF0 /* Contains M-state */ 372,377c337,347 < /* MCH vendors */ < #define MCH_TYPE_UNKNOWN 0 < #define MCH_TYPE_VT 1 < #define MCH_TYPE_NAT 2 < #define MCH_IS_VT(x) (x == MCH_TYPE_VT) < #define MCH_IS_NAT(x) (x == MCH_TYPE_NAT) --- > /* MCH vendors, MicroTCA MCHs are odd, other devices are even */ > #define MCH_TYPE_UNKNOWN 0 > #define MCH_TYPE_VT 1 > #define MCH_TYPE_NAT 3 > #define MCH_TYPE_DELL 2 > #define MCH_TYPE_SUPERMICRO 4 > #define MCH_IS_VT(x) (x == MCH_TYPE_VT) > #define MCH_IS_NAT(x) (x == MCH_TYPE_NAT) > #define MCH_IS_DELL(x) (x == MCH_TYPE_DELL) > #define MCH_IS_SUPERMICRO(x) (x == MCH_TYPE_SUPERMICRO) > #define MCH_IS_MICROTCA(x) (x & 1) 380,381c350,356 < #define MCH_MANUF_ID_VT 0x5D32 < #define MCH_MANUF_ID_NAT 0x6C78 --- > #define MCH_MANUF_ID_VT 0x5D32 > #define MCH_MANUF_ID_NAT 0x6C78 > #define MCH_MANUF_ID_DELL 0x02A2 > #define MCH_MANUF_ID_SUPERMICRO 0x2A7C > > /* Product ID */ > #define MCH_PROD_ID_DELL 0x0100 Index: src/drvMchMsg.c =================================================================== RCS file: /afs/slac/g/lcls/cvs/epics/site/src/ipmiComm/src/drvMchMsg.c,v retrieving revision 1.4 diff -r1.4 drvMchMsg.c 12a13 > 51a53,58 > /* > printf("%s Message status %i, received %i, expected %i, raw data:\n", mchSess->name, status, (int)responseLen, *(int *)responseSize ); > for ( i = 0; i < responseLen; i++ ) > printf("%02x ", response[i]); > printf("\n"); > */ 53c60 < if ( MCH_DBG( mchStat[inst] ) > 1 ) { --- > if ( MCH_DBG( mchStat[inst] ) >= MCH_DBG_MED ) { 55c62 < if ( MCH_DBG( mchStat[inst] ) > 2 ) { --- > if ( MCH_DBG( mchStat[inst] ) >= MCH_DBG_HIGH ) { 63d69 < 66c72 < if ( outSess ) { --- > *responseSize = responseLen; /* Pass actual response length back to caller */ 68c74,75 < if ( (code = response[IPMI_RPLY_COMPLETION_CODE_UNBRIDGED_OFFSET]) && MCH_DBG( mchStat[inst] ) ) --- > if ( outSess ) { > if ( (code = response[IPMI_RPLY_COMPLETION_CODE_OFFSET]) && MCH_DBG( mchStat[inst] ) ) 73c80 < if ( (responseLen == 0) || (mchSess->err > 9) ) { --- > if ( /*(responseLen == 0) ||*/ (mchSess->err > 9) ) { 85a93,97 > if ( responseLen == 0 ) { > mchSess->err++; > return -1; > } > 110c122 < if ( MCH_DBG( mchStat[inst] ) > 1 ) --- > if ( MCH_DBG( mchStat[inst] ) >= MCH_DBG_MED ) 123c135 < mchSess->err++; --- > //mchSess->err++; // only increment error count for some errors ? --not parameter out of range, for example 129a142,204 > } > > static void > mchSetSizeOffs(int type, int *offs, size_t *responseSize, int *bridged, uint8_t *rsAddr, uint8_t *rqAddr) > { > switch ( type ) { > > default: > *offs = 0; > *responseSize = HEADER_LENGTH +3; > *bridged = 0; > *rsAddr = 0; > *rqAddr = 0; > break; > /* > case MCH_TYPE_NAT: > *offs = IPMI_RPLY_BRIDGED_1REPLY_OFFSET; > *responseSize += *offs; > *bridged = 1; > *rsAddr = IPMI_MSG_ADDR_CM; > *rqAddr = IPMI_MSG_ADDR_BMC; > */ > > break; > > case MCH_TYPE_VT: // note that we used to only check comp code of send msg reply (not payload reply) which is different than other devices; may need to revert to that > *offs = IPMI_RPLY_BRIDGED_2REPLY_OFFSET; > *responseSize = HEADER_LENGTH + 3 + *offs; > *bridged = 1; > *rsAddr = IPMI_MSG_ADDR_CM; > *rqAddr = IPMI_MSG_ADDR_BMC; > break; > } > } > > int > mchMsgCheckSizes(size_t destSize, int offset, size_t srcSize) > { > if ( 0 >= srcSize ) { > printf("mchMsgCheckSizes: message size %i less than zero\n", srcSize); > return -1; > } > else if ( (offset + srcSize) > destSize ) { > printf("mchMsgCheckSizes: copy size %i larger than destination %i \n", offset+srcSize, destSize); > return -1; > } > > return 0; > } > > > /* Temporary workaround for using different usernames across different devices */ > int > mchMsgGetSess(MchSess mchSess, IpmiSess ipmiSess, uint8_t *response) > { > size_t size = sizeof( GET_SESS_MSG ); > uint8_t msg[size]; > uint8_t code; > uint8_t user1[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; > uint8_t user2[16] = { 'i', 'p', 'm', 'i', 'u', 's', 'e', 'r', 0, 0, 0, 0, 0, 0, 0, 0 }; > uint8_t user3[16] = { 'A', 'D', 'M', 'I', 'N', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; > > memcpy( msg, GET_SESS_MSG, size ); 130a206,223 > memcpy( msg + 4, user1, sizeof( user1 ) ); > > code = ipmiMsgGetSess( mchSess, ipmiSess, response, msg ); > > if ( (code == IPMI_COMP_CODE_GET_SESS_INVALID_USER) || (code == IPMI_COMP_CODE_GET_SESS_NULL_USER) ) { > > memcpy( msg + 4, user2, sizeof( user2 ) ); > > return ipmiMsgGetSess( mchSess, ipmiSess, response, msg ); > } > else if ( code == IPMI_COMP_CODE_INVALID_FIELD ) { > > memcpy( msg + 4, user3, sizeof( user3 ) ); > > return ipmiMsgGetSess( mchSess, ipmiSess, response, msg ); > } > > return code; 151,152c244,260 < size_t responseSize = 0; /* determine length */ < int offs = MCH_IS_NAT( mchData->mchSess->type ) ? IPMI_RPLY_OFFSET_NAT : 0; --- > uint8_t response[MSG_MAX_LENGTH] = { 0 }; > size_t roffs, responseSize, payloadSize = IPMI_RPLY_CHAS_CTRL_LENGTH; > int rval, offs, bridged; > uint8_t rsAddr, rqAddr; > > mchSetSizeOffs( mchData->mchSess->type, &offs, &responseSize, &bridged, &rsAddr, &rqAddr ); > roffs = responseSize; /* Offset into packet our section of interest */ > responseSize += payloadSize + FOOTER_LENGTH; > > if ( (rval = ipmiMsgChassisControl( mchData->mchSess, mchData->ipmiSess, response, bridged, rsAddr, rqAddr, parm, &responseSize, offs )) ) > goto bail; > > if ( (rval = mchMsgCheckSizes( sizeof( response ), roffs, payloadSize )) ) { > printf("mchMsgChassisControl size error\n"); > goto bail; > } > memcpy( data, response + roffs, payloadSize ); 154c262,263 < return ipmiMsgChassisControl( mchData->mchSess, mchData->ipmiSess, data, parm, &responseSize, offs ); --- > bail: > return rval; 164c273 < mchMsgGetFruInfo(MchData mchData, uint8_t *data, uint8_t id) --- > mchMsgGetFruInvInfo(MchData mchData, uint8_t *data, uint8_t id) 166,167c275,292 < size_t responseSize = MCH_IS_NAT( mchData->mchSess->type ) ? IPMI_RPLY_GET_FRU_INFO_LENGTH_NAT : IPMI_RPLY_GET_FRU_INFO_LENGTH_VT; < int offs = MCH_IS_NAT( mchData->mchSess->type ) ? IPMI_RPLY_OFFSET_NAT : 0; --- > uint8_t response[MSG_MAX_LENGTH] = { 0 }; > size_t roffs, responseSize, payloadSize = IPMI_RPLY_GET_FRU_INV_INFO_LENGTH; > int rval, offs, bridged; > uint8_t rsAddr, rqAddr; > > mchSetSizeOffs( mchData->mchSess->type, &offs, &responseSize, &bridged, &rsAddr, &rqAddr ); > roffs = responseSize; /* Offset into packet our section of interest */ > responseSize += payloadSize + FOOTER_LENGTH; > > if ( (rval = ipmiMsgGetFruInvInfo( mchData->mchSess, mchData->ipmiSess, response, bridged, rsAddr, rqAddr, id, &responseSize, offs )) ) > goto bail; > > if ( (rval = mchMsgCheckSizes( sizeof( response ), roffs, payloadSize )) ) { > printf("mchMsgGetFruInvInfo size error\n"); > goto bail; > } > > memcpy( data, response + roffs, payloadSize ); 169c294,295 < return ipmiMsgGetFruInfo( mchData->mchSess, mchData->ipmiSess, data, id, &responseSize, offs ); --- > bail: > return rval; 181,182c307,322 < size_t responseSize = MCH_IS_NAT( mchData->mchSess->type ) ? IPMI_RPLY_READ_FRU_DATA_BASE_LENGTH_NAT : IPMI_RPLY_READ_FRU_DATA_BASE_LENGTH_VT; < int offs = MCH_IS_NAT( mchData->mchSess->type ) ? IPMI_RPLY_OFFSET_NAT : 0; --- > uint8_t response[MSG_MAX_LENGTH] = { 0 }; > size_t roffs, responseSize, payloadSize = IPMI_RPLY_READ_FRU_DATA_LENGTH_HDR + readSize; > int rval, offs, bridged; > uint8_t rsAddr, rqAddr; > > mchSetSizeOffs( mchData->mchSess->type, &offs, &responseSize, &bridged, &rsAddr, &rqAddr ); > roffs = responseSize; /* Offset into packet our section of interest */ > responseSize += payloadSize + FOOTER_LENGTH; > > if ( (rval = ipmiMsgReadFru( mchData->mchSess, mchData->ipmiSess, response, bridged, rsAddr, rqAddr, id, readOffset, readSize, &responseSize, offs )) ) > goto bail; > > if ( (rval = mchMsgCheckSizes( sizeof( response ), roffs, payloadSize )) ) { > printf("mchMsgReadFru size error\n"); > goto bail; > } 184c324,327 < return ipmiMsgReadFru( mchData->mchSess, mchData->ipmiSess, data, id, readOffset, readSize, &responseSize, offs ); --- > memcpy( data, response + roffs, payloadSize ); > > bail: > return rval; 186a330 > 196,197c340,355 < size_t responseSize = MCH_IS_NAT( mchData->mchSess->type ) ? IPMI_RPLY_GET_SDRREP_INFO_LENGTH_NAT : IPMI_RPLY_GET_SDRREP_INFO_LENGTH_VT; < int offs = MCH_IS_NAT( mchData->mchSess->type ) ? IPMI_RPLY_OFFSET_NAT : 0; --- > uint8_t response[MSG_MAX_LENGTH] = { 0 }; > size_t roffs, responseSize, payloadSize = IPMI_RPLY_GET_SDRREP_INFO_LENGTH; > int rval, offs, bridged; > uint8_t rsAddr, rqAddr; > > mchSetSizeOffs( mchData->mchSess->type, &offs, &responseSize, &bridged, &rsAddr, &rqAddr ); > roffs = responseSize; /* Offset into packet our section of interest */ > responseSize += payloadSize + FOOTER_LENGTH; > > if ( (rval = ipmiMsgGetSdrRepInfo( mchData->mchSess, mchData->ipmiSess, response, bridged, rsAddr, rqAddr, &responseSize, offs )) ) > goto bail; > > if ( (rval = mchMsgCheckSizes( sizeof( response ), roffs, payloadSize )) ) { > printf("mchMsgGetSdrRepInfo size error roffs %i payloadSize %i responseSize %i\n", roffs, payloadSize, responseSize); > goto bail; > } 199c357,400 < return ipmiMsgGetSdrRepInfo( mchData->mchSess, mchData->ipmiSess, data, &responseSize, offs ); --- > memcpy( data, response + roffs, payloadSize ); > > bail: > return rval; > } > > /* Reserve SDR (Sensor Data Record) Repository > * > * RETURNS: status from mchMsgWriteReadHelper > * 0 on success > * non-zero for error > */ > int > mchMsgReserveSdrRep(MchData mchData, uint8_t *data) > { > uint8_t response[MSG_MAX_LENGTH] = { 0 }; > size_t roffs, responseSize, payloadSize = IPMI_RPLY_RESERVE_SDRREP_LENGTH; > int rval, offs, bridged; > uint8_t rsAddr, rqAddr; > > mchSetSizeOffs( mchData->mchSess->type, &offs, &responseSize, &bridged, &rsAddr, &rqAddr ); > roffs = responseSize; /* Offset into packet our section of interest */ > responseSize += payloadSize + FOOTER_LENGTH; > > //printf("expected response size %i\n", responseSize); > if ( (rval = ipmiMsgReserveSdrRep( mchData->mchSess, mchData->ipmiSess, response, bridged, rsAddr, rqAddr, &responseSize, offs )) ) > goto bail; > /* > printf("\nmchmsgreservesdrrep roffs %i payloadSize %i\n", roffs, payloadSize); > int z; > for ( z = 0; z < MSG_MAX_LENGTH; z++ ) > printf("0x%02x ", response[z]); > printf("\n\n"); > */ > > if ( (rval = mchMsgCheckSizes( sizeof( response ), roffs, payloadSize )) ) { > printf("mchMsgReserveSdrRep size error\n"); > goto bail; > } > > memcpy( data, response + roffs, payloadSize ); > > bail: > return rval; 218,219c419,445 < size_t responseSize = ( MCH_IS_NAT( mchData->mchSess->type ) ? IPMI_RPLY_GET_SDR_BASE_LENGTH_NAT : IPMI_RPLY_GET_SDR_BASE_LENGTH_VT) + recordSize; < int offs = MCH_IS_NAT( mchData->mchSess->type ) ? IPMI_RPLY_OFFSET_NAT : 0; --- > uint8_t response[MSG_MAX_LENGTH] = { 0 }; > uint8_t sdrDataSize = ( readSize == 0xFF ) ? SDR_MAX_LENGTH : readSize; > size_t roffs, responseSize, payloadSize = IPMI_RPLY_GET_SDR_LENGTH_HDR + sdrDataSize; > int rval, offs, bridged; > uint8_t rsAddr, rqAddr; > > mchSetSizeOffs( mchData->mchSess->type, &offs, &responseSize, &bridged, &rsAddr, &rqAddr ); > roffs = responseSize; /* Offset into packet our section of interest */ > responseSize += payloadSize + FOOTER_LENGTH; > > if ( (rval = ipmiMsgGetSdr( mchData->mchSess, mchData->ipmiSess, response, bridged, rsAddr, rqAddr, id, res, offset, readSize, parm, recordSize, &responseSize, offs )) ) > goto bail; > > /* > printf("\nmchmsggetsdr\n"); > int z; > for ( z = 0; z < MSG_MAX_LENGTH; z++ ) > printf("0x%02x ", response[z]); > printf("\n\n"); > */ > > if ( (rval = mchMsgCheckSizes( sizeof( response ), roffs, payloadSize )) ) { > printf("mchMsgGetSdr size error\n"); > goto bail; > } > > memcpy( data, response + roffs, payloadSize ); 221c447,448 < return ipmiMsgGetSdr( mchData->mchSess, mchData->ipmiSess, data, id, res, offset, readSize, parm, recordSize, &responseSize, offs ); --- > bail: > return rval; 233,234c460,475 < size_t responseSize = 0; < int offs = MCH_IS_NAT( mchData->mchSess->type ) ? IPMI_RPLY_OFFSET_NAT : 0; --- > uint8_t response[MSG_MAX_LENGTH] = { 0 }; > size_t roffs, responseSize, payloadSize = IPMI_RPLY_GET_DEV_SDR_INFO_LENGTH; > int rval, offs, bridged; > uint8_t rsAddr, rqAddr; > > mchSetSizeOffs( mchData->mchSess->type, &offs, &responseSize, &bridged, &rsAddr, &rqAddr ); > roffs = responseSize; /* Offset into packet our section of interest */ > responseSize += payloadSize + FOOTER_LENGTH; > > if ( (rval = ipmiMsgGetDevSdrInfo( mchData->mchSess, mchData->ipmiSess, response, bridged, rsAddr, rqAddr, parm, &responseSize, offs )) ) > goto bail; > > if ( (rval = mchMsgCheckSizes( sizeof( response ), roffs, payloadSize )) ) { > printf("mchMsgGetDevSdrInfo size error\n"); > goto bail; > } 236c477,480 < return ipmiMsgGetDevSdrInfo( mchData->mchSess, mchData->ipmiSess, data, parm, &responseSize, offs ); --- > memcpy( data, response + roffs, payloadSize ); > > bail: > return rval; 238c482 < --- > 246c490 < mchMsgReadSensor(MchData mchData, uint8_t *data, uint8_t sens, uint8_t lun, size_t *responseSize) --- > mchMsgReadSensor(MchData mchData, uint8_t *data, uint8_t sens, uint8_t lun, size_t *sensReadMsgSize) 248c492,510 < int offs = 0; /* doesn't seem to be used; look into this */ --- > uint8_t response[MSG_MAX_LENGTH] = { 0 }; > size_t roffs, responseSize, payloadSize; > int rval, offs, bridged; > uint8_t rsAddr, rqAddr; > > mchSetSizeOffs( mchData->mchSess->type, &offs, &responseSize, &bridged, &rsAddr, &rqAddr ); > roffs = responseSize; /* Offset into packet our section of interest */ > responseSize += *sensReadMsgSize + FOOTER_LENGTH; > > if ( (rval = ipmiMsgReadSensor( mchData->mchSess, mchData->ipmiSess, response, bridged, rsAddr, rqAddr, sens, lun, &responseSize, offs )) ) > goto bail; > > payloadSize = *sensReadMsgSize = responseSize - roffs - FOOTER_LENGTH; > if ( (rval = mchMsgCheckSizes( sizeof( response ), roffs, payloadSize )) ) { > printf("mchMsgReadSensor size error\n"); > goto bail; > } > > memcpy( data, response + roffs, payloadSize ); 250c512,513 < return ipmiMsgReadSensor( mchData->mchSess, mchData->ipmiSess, data, sens, lun, responseSize, offs ); --- > bail: > return rval; 254c517 < mchMsgGetSensorThresholds(MchData mchData, uint8_t *data, uint8_t sens, uint8_t lun, size_t *responseSize) --- > mchMsgGetSensorThresholds(MchData mchData, uint8_t *data, uint8_t sens, uint8_t lun) 256c519,526 < int offs = 0; /* doesn't seem to be used; look into this */ --- > uint8_t response[MSG_MAX_LENGTH] = { 0 }; > size_t roffs, responseSize, payloadSize = IPMI_RPLY_GET_SENSOR_THRESH_LENGTH; > int rval, offs, bridged; > uint8_t rsAddr, rqAddr; > > mchSetSizeOffs( mchData->mchSess->type, &offs, &responseSize, &bridged, &rsAddr, &rqAddr); > roffs = responseSize; /* Offset into packet our section of interest */ > responseSize += payloadSize + FOOTER_LENGTH; 258c528,539 < return ipmiMsgGetSensorThresholds( mchData->mchSess, mchData->ipmiSess, data, sens, lun, responseSize, offs ); --- > if ( (rval = ipmiMsgGetSensorThresholds( mchData->mchSess, mchData->ipmiSess, response, bridged, rsAddr, rqAddr, sens, lun, &responseSize, offs )) ) > goto bail; > > if ( (rval = mchMsgCheckSizes( sizeof( response ), roffs, payloadSize )) ) { > printf("mchMsgGetSensorThresholds size error\n"); > goto bail; > } > > memcpy( data, response + roffs, payloadSize ); > > bail: > return rval; 294c575 < messageSize = ipmiMsgBuild( mchData->ipmiSess, message, cmd, 0, imsg2, imsg2Size, b1msg1, b1msg2, b1msg2Size, 0, 0, 0 ); --- > messageSize = ipmiMsgBuild( mchData->ipmiSess, message, cmd, IPMI_MSG_NETFN_APP_REQUEST, imsg2, imsg2Size, b1msg1, b1msg2, b1msg2Size, 0, 0, 0 ); 324c605 < messageSize = ipmiMsgBuild( mchData->ipmiSess, message, cmd, &netfn, imsg2, imsg2Size, 0, 0, 0, 0, 0, 0 ); --- > messageSize = ipmiMsgBuild( mchData->ipmiSess, message, cmd, netfn, imsg2, imsg2Size, 0, 0, 0, 0, 0, 0 ); 368c649 < messageSize = ipmiMsgBuild( mchData->ipmiSess, message, cmd, 0, imsg2, imsg2Size, b1msg1, b1msg2, b1msg2Size, 0, 0, 0 ); --- > messageSize = ipmiMsgBuild( mchData->ipmiSess, message, cmd, IPMI_MSG_NETFN_APP_REQUEST, imsg2, imsg2Size, b1msg1, b1msg2, b1msg2Size, 0, 0, 0 ); 417c698 < messageSize = ipmiMsgBuild( mchData->ipmiSess, message, cmd, 0, imsg2, imsg2Size, b1msg1, b1msg2, b1msg2Size, b2msg1, b2msg2, b2msg2Size ); --- > messageSize = ipmiMsgBuild( mchData->ipmiSess, message, cmd, IPMI_MSG_NETFN_APP_REQUEST, imsg2, imsg2Size, b1msg1, b1msg2, b1msg2Size, b2msg1, b2msg2, b2msg2Size ); 455d735 < 490c770 < messageSize = ipmiMsgBuild( mchData->ipmiSess, message, cmd, 0, imsg2, imsg2Size, b1msg1, b1msg2, b1msg2Size, 0, 0, 0 ); --- > messageSize = ipmiMsgBuild( mchData->ipmiSess, message, cmd, IPMI_MSG_NETFN_APP_REQUEST, imsg2, imsg2Size, b1msg1, b1msg2, b1msg2Size, 0, 0, 0 ); 538c818 < messageSize = ipmiMsgBuild( mchData->ipmiSess, message, cmd, 0, imsg2, imsg2Size, b1msg1, b1msg2, b1msg2Size, b2msg1, b2msg2, b2msg2Size ); --- > messageSize = ipmiMsgBuild( mchData->ipmiSess, message, cmd, IPMI_MSG_NETFN_APP_REQUEST, imsg2, imsg2Size, b1msg1, b1msg2, b1msg2Size, b2msg1, b2msg2, b2msg2Size ); 553c833 < /* Get Device ID --- > /* Get Device ID -- this is called before we know device type -- need to update this 560c840 < mchMsgGetDeviceId(MchData mchData, uint8_t *data, uint8_t rsAddr) --- > mchMsgGetDeviceId(MchData mchData, uint8_t *data, int bridged, uint8_t rsAddr) // change this to either never be bridged or to implement device checking and offsets; handle rqAddr too 562,563c842,853 < size_t responseSize = MCH_IS_NAT( mchData->mchSess->type ) ? IPMI_RPLY_GET_DEVICE_ID_LENGTH_NAT : IPMI_RPLY_GET_DEVICE_ID_LENGTH_VT; < int offs = MCH_IS_NAT( mchData->mchSess->type ) ? IPMI_RPLY_OFFSET_NAT : 0; --- > uint8_t response[MSG_MAX_LENGTH] = { 0 }; > size_t responseSize = IPMI_RPLY_GET_DEVICE_ID_LENGTH + HEADER_LENGTH; > int rval, offs = 0, rqAddr = 0; > > if ( (rval = ipmiMsgGetDeviceId( mchData->mchSess, mchData->ipmiSess, response, bridged, rsAddr, rqAddr, &responseSize, offs )) ) > goto bail; > > if ( (rval = mchMsgCheckSizes( sizeof( response ), HEADER_LENGTH, IPMI_RPLY_GET_DEVICE_ID_LENGTH )) ) { > printf("mchMsgGetDeviceId size error\n"); > goto bail; > } > memcpy( data, response + HEADER_LENGTH, IPMI_RPLY_GET_DEVICE_ID_LENGTH ); 565c855,856 < return ipmiMsgGetDeviceId( mchData->mchSess, mchData->ipmiSess, data, rsAddr, &responseSize, offs ); --- > bail: > return rval; 578,580c869 < size_t imsg2Size = sizeof( SEND_MSG_MSG ); < size_t b1msg1Size = sizeof( IPMI_MSG1 ); < size_t b1msg2Size = sizeof( GET_FAN_PROP_MSG ); --- > uint8_t imsg2Size = sizeof( GET_FAN_PROP_MSG ); 582,583d870 < uint8_t b1msg1[b1msg1Size]; < uint8_t b1msg2[b1msg2Size]; 585c872,876 < size_t responseSize = IPMI_RPLY_GET_FAN_PROP_LENGTH_VT; --- > > uint8_t response[MSG_MAX_LENGTH] = { 0 }; > size_t roffs, responseSize, payloadSize = IPMI_RPLY_GET_FAN_PROP_LENGTH; > int rval, offs, bridged; > uint8_t rsAddr, rqAddr; 589,591c880,882 < memcpy( imsg2, SEND_MSG_MSG , imsg2Size ); < memcpy( b1msg1, IPMI_MSG1 , b1msg1Size ); < memcpy( b1msg2, GET_FAN_PROP_MSG, b1msg2Size ); --- > mchSetSizeOffs( mchData->mchSess->type, &offs, &responseSize, &bridged, &rsAddr, &rqAddr); > roffs = responseSize; /* Offset into packet our section of interest */ > responseSize += payloadSize + FOOTER_LENGTH; 593c884 < imsg2[IPMI_MSG2_CHAN_OFFSET] = IPMI_MSG_CHAN_IPMB0 + IPMI_MSG_TRACKING; --- > memcpy( imsg2, GET_FAN_PROP_MSG, imsg2Size ); 595,596c886 < b1msg1[IPMI_MSG1_RSADDR_OFFSET] = IPMI_MSG_ADDR_CM; < b1msg1[IPMI_MSG1_NETFNLUN_OFFSET] = netfn << 2; --- > imsg2[IPMI_MSG2_SET_FRU_ACT_FRU_OFFSET] = fru; 598c888,891 < b1msg2[IPMI_MSG2_SET_FRU_ACT_FRU_OFFSET] = fru; --- > if ( bridged ) // may need to distinguish between once and twice-bridged messages > ipmiBuildSendMsg( mchData->ipmiSess, message, &messageSize, cmd, netfn, rsAddr, rqAddr, imsg2, imsg2Size, 0 ); > else > messageSize = ipmiMsgBuild( mchData->ipmiSess, message, cmd, netfn, imsg2, imsg2Size, 0, 0, 0, 0, 0, 0 ); 600c893,900 < messageSize = ipmiMsgBuild( mchData->ipmiSess, message, cmd, 0, imsg2, imsg2Size, b1msg1, b1msg2, b1msg2Size, 0, 0, 0 ); --- > if ( (rval = mchMsgWriteReadHelper( mchData->mchSess, mchData->ipmiSess, message, messageSize, response, &responseSize, cmd, netfn, offs, 0 )) ) { > printf("mchmsggetfanpropvt rval %i\n", rval); > goto bail; > } > if ( (rval = mchMsgCheckSizes( sizeof( response ), roffs, payloadSize )) ) { > printf("mchMsgGetFanPropVt size error\n"); > goto bail; > } 602,603c902 < return mchMsgWriteReadHelper( mchData->mchSess, mchData->ipmiSess, message, messageSize, data, &responseSize, cmd, netfn, 0, 0 ); < } --- > memcpy( data, response + roffs, payloadSize ); 604a904,906 > bail: > return rval; > } 615c917,918 < uint8_t message[MSG_MAX_LENGTH] = { 0 }; --- > uint8_t message[MSG_MAX_LENGTH] = { 0 }; > uint8_t response[MSG_MAX_LENGTH] = { 0 }; 627c930,933 < size_t responseSize = IPMI_RPLY_GET_FAN_PROP_LENGTH_NAT; --- > size_t offs = IPMI_RPLY_2ND_BRIDGED_OFFSET_NAT; > size_t roffs = HEADER_LENGTH + 3 + offs; > size_t payloadSize = IPMI_RPLY_GET_FAN_PROP_LENGTH; > size_t responseSize = roffs + payloadSize + FOOTER_LENGTH; 630c936 < int offs = IPMI_RPLY_2ND_BRIDGED_OFFSET_NAT; --- > int rval; 638,639c944,945 < memcpy( b1msg2, SEND_MSG_MSG , b1msg2Size ); < memcpy( b2msg1, IPMI_MSG1 , b2msg1Size ); --- > memcpy( b1msg2, SEND_MSG_MSG , b1msg2Size ); > memcpy( b2msg1, IPMI_MSG1 , b2msg1Size ); 648c954 < messageSize = ipmiMsgBuild( mchData->ipmiSess, message, cmd, 0, imsg2, imsg2Size, b1msg1, b1msg2, b1msg2Size, b2msg1, b2msg2, b2msg2Size ); --- > messageSize = ipmiMsgBuild( mchData->ipmiSess, message, cmd, IPMI_MSG_NETFN_APP_REQUEST, imsg2, imsg2Size, b1msg1, b1msg2, b1msg2Size, b2msg1, b2msg2, b2msg2Size ); 650c956,967 < return mchMsgWriteReadHelper( mchData->mchSess, mchData->ipmiSess, message, messageSize, data, &responseSize, cmd, netfn, offs, 0); --- > if ( (rval = mchMsgWriteReadHelper( mchData->mchSess, mchData->ipmiSess, message, messageSize, response, &responseSize, cmd, netfn, offs, 0 )) ) > goto bail; > > if ( (rval = mchMsgCheckSizes( sizeof( response ), roffs, payloadSize )) ) { > printf("mchMsgGetFanPropNat size error\n"); > goto bail; > } > > memcpy( data, response + roffs, payloadSize ); > > bail: > return rval; 663,669d979 < < /* Get Fan Level using Vadatech MCH; message contains 1 bridged message < * < * RETURNS: status from mchMsgWriteReadHelper < * 0 on success < * non-zero for error < */ 674,676c984 < size_t imsg2Size = sizeof( SEND_MSG_MSG ); < size_t b1msg1Size = sizeof( IPMI_MSG1 ); < size_t b1msg2Size = sizeof( GET_FAN_LEVEL_MSG ); --- > uint8_t imsg2Size = sizeof( GET_FAN_LEVEL_MSG ); 678,679d985 < uint8_t b1msg1[b1msg1Size]; < uint8_t b1msg2[b1msg2Size]; 681,682c987,992 < size_t responseSize = IPMI_RPLY_GET_FAN_LEVEL_LENGTH_VT; < uint8_t cmd = IPMI_MSG_CMD_GET_FAN_LEVEL; --- > > uint8_t response[MSG_MAX_LENGTH] = { 0 }; > size_t roffs, responseSize, payloadSize = IPMI_RPLY_GET_FAN_LEVEL_LENGTH; > int rval, offs, bridged; > uint8_t rsAddr, rqAddr; > uint8_t cmd = IPMI_MSG_CMD_GET_FAN_LEVEL; 685,687c995,997 < memcpy( imsg2, SEND_MSG_MSG , imsg2Size ); < memcpy( b1msg1, IPMI_MSG1 , b1msg1Size ); < memcpy( b1msg2, GET_FAN_LEVEL_MSG, b1msg2Size ); --- > mchSetSizeOffs( mchData->mchSess->type, &offs, &responseSize, &bridged, &rsAddr, &rqAddr); > roffs = responseSize; /* Offset into packet our section of interest */ > responseSize += payloadSize + FOOTER_LENGTH; 689c999 < imsg2[IPMI_MSG2_CHAN_OFFSET] = IPMI_MSG_CHAN_IPMB0 + IPMI_MSG_TRACKING; --- > memcpy( imsg2, GET_FAN_LEVEL_MSG, imsg2Size ); 691,692c1001 < b1msg1[IPMI_MSG1_RSADDR_OFFSET] = IPMI_MSG_ADDR_CM; < b1msg1[IPMI_MSG1_NETFNLUN_OFFSET] = netfn << 2; --- > imsg2[IPMI_MSG2_SET_FRU_ACT_FRU_OFFSET] = fru; 694c1003,1006 < b1msg2[IPMI_MSG2_SET_FRU_ACT_FRU_OFFSET] = fru; --- > if ( bridged ) // may need to distinguish between once and twice-bridged messages > ipmiBuildSendMsg( mchData->ipmiSess, message, &messageSize, cmd, netfn, rsAddr, rqAddr, imsg2, imsg2Size, 0 ); > else > messageSize = ipmiMsgBuild( mchData->ipmiSess, message, cmd, netfn, imsg2, imsg2Size, 0, 0, 0, 0, 0, 0 ); 696c1008,1009 < messageSize = ipmiMsgBuild( mchData->ipmiSess, message, cmd, 0, imsg2, imsg2Size, b1msg1, b1msg2, b1msg2Size, 0, 0, 0 ); --- > if ( (rval = mchMsgWriteReadHelper( mchData->mchSess, mchData->ipmiSess, message, messageSize, response, &responseSize, cmd, netfn, offs, 0 )) ) > goto bail; 698c1011,1019 < return mchMsgWriteReadHelper( mchData->mchSess, mchData->ipmiSess, message, messageSize, data, &responseSize, cmd, netfn, 0, 0 ); --- > if ( (rval = mchMsgCheckSizes( sizeof( response ), roffs, payloadSize )) ) { > printf("mchMsgGetFanLevelVt size error\n"); > goto bail; > } > > memcpy( data, response + roffs, payloadSize ); > > bail: > return rval; 710c1031,1032 < uint8_t message[MSG_MAX_LENGTH] = { 0 }; --- > uint8_t message[MSG_MAX_LENGTH] = { 0 }; > uint8_t response[MSG_MAX_LENGTH] = { 0 }; 722c1044,1047 < size_t responseSize = IPMI_RPLY_GET_FAN_LEVEL_LENGTH_NAT; --- > size_t offs = IPMI_RPLY_2ND_BRIDGED_OFFSET_NAT; > size_t roffs = HEADER_LENGTH + 3 + offs; > size_t payloadSize = IPMI_RPLY_GET_FAN_LEVEL_LENGTH; > size_t responseSize = roffs + payloadSize + FOOTER_LENGTH; 725c1050 < int offs = IPMI_RPLY_2ND_BRIDGED_OFFSET_NAT; --- > int rval; 743c1068 < messageSize = ipmiMsgBuild( mchData->ipmiSess, message, cmd, 0, imsg2, imsg2Size, b1msg1, b1msg2, b1msg2Size, b2msg1, b2msg2, b2msg2Size ); --- > messageSize = ipmiMsgBuild( mchData->ipmiSess, message, cmd, IPMI_MSG_NETFN_APP_REQUEST, imsg2, imsg2Size, b1msg1, b1msg2, b1msg2Size, b2msg1, b2msg2, b2msg2Size ); 745c1070,1081 < return mchMsgWriteReadHelper( mchData->mchSess, mchData->ipmiSess, message, messageSize, data, &responseSize, cmd, netfn, offs, 0 ); --- > if ( (rval = mchMsgWriteReadHelper( mchData->mchSess, mchData->ipmiSess, message, messageSize, response, &responseSize, cmd, netfn, offs, 0 )) ) > goto bail; > > if ( (rval = mchMsgCheckSizes( sizeof( response ), roffs, payloadSize )) ) { > printf("mchMsgGetFanLevelNat size error\n"); > goto bail; > } > > memcpy( data, response + roffs, payloadSize ); > > bail: > return rval; 768,770c1104 < size_t imsg2Size = sizeof( SEND_MSG_MSG ); < size_t b1msg1Size = sizeof( IPMI_MSG1 ); < size_t b1msg2Size = sizeof( SET_FAN_LEVEL_MSG ); --- > uint8_t imsg2Size = sizeof( SET_FAN_LEVEL_MSG ); 772,773d1105 < uint8_t b1msg1[b1msg1Size]; < uint8_t b1msg2[b1msg2Size]; 775c1107,1111 < size_t responseSize = IPMI_RPLY_SET_FAN_LEVEL_LENGTH_VT; --- > > uint8_t response[MSG_MAX_LENGTH] = { 0 }; > size_t roffs, responseSize, payloadSize = IPMI_RPLY_SET_FAN_LEVEL_LENGTH; > int rval, offs, bridged; > uint8_t rsAddr, rqAddr; 779,781c1115,1117 < memcpy( imsg2, SEND_MSG_MSG , imsg2Size ); < memcpy( b1msg1, IPMI_MSG1 , b1msg1Size ); < memcpy( b1msg2, SET_FAN_LEVEL_MSG, b1msg2Size ); --- > mchSetSizeOffs( mchData->mchSess->type, &offs, &responseSize, &bridged, &rsAddr, &rqAddr); > roffs = responseSize; /* Offset into packet our section of interest */ > responseSize += payloadSize + FOOTER_LENGTH; 783c1119 < imsg2[IPMI_MSG2_CHAN_OFFSET] = IPMI_MSG_CHAN_IPMB0 + IPMI_MSG_TRACKING; --- > memcpy( imsg2, SET_FAN_LEVEL_MSG, imsg2Size ); 785,786c1121,1122 < b1msg1[IPMI_MSG1_RSADDR_OFFSET] = IPMI_MSG_ADDR_CM; < b1msg1[IPMI_MSG1_NETFNLUN_OFFSET] = netfn << 2; --- > imsg2[IPMI_MSG2_SET_FRU_ACT_FRU_OFFSET] = fru; > imsg2[IPMI_MSG2_SET_FAN_LEVEL_OFFSET] = level; 788,789c1124,1127 < b1msg2[IPMI_MSG2_SET_FRU_ACT_FRU_OFFSET] = fru; < b1msg2[IPMI_MSG2_SET_FAN_LEVEL_LEVEL_OFFSET] = level; --- > if ( bridged ) // may need to distinguish between once and twice-bridged messages > ipmiBuildSendMsg( mchData->ipmiSess, message, &messageSize, cmd, netfn, rsAddr, rqAddr, imsg2, imsg2Size, 0 ); > else > messageSize = ipmiMsgBuild( mchData->ipmiSess, message, cmd, netfn, imsg2, imsg2Size, 0, 0, 0, 0, 0, 0 ); 791c1129,1130 < messageSize = ipmiMsgBuild( mchData->ipmiSess, message, cmd, 0, imsg2, imsg2Size, b1msg1, b1msg2, b1msg2Size, 0, 0, 0 ); --- > if ( (rval = mchMsgWriteReadHelper( mchData->mchSess, mchData->ipmiSess, message, messageSize, response, &responseSize, cmd, netfn, offs, 0 )) ) > goto bail; 793c1132,1139 < return mchMsgWriteReadHelper( mchData->mchSess, mchData->ipmiSess, message, messageSize, data, &responseSize, cmd, netfn, 0, 0 ); --- > if ( (rval = mchMsgCheckSizes( sizeof( response ), roffs, payloadSize )) ) { > printf("mchMsgSetFanLevelVt size error\n"); > goto bail; > } > memcpy( data, response + roffs, payloadSize ); > > bail: > return rval; 805c1151,1152 < uint8_t message[MSG_MAX_LENGTH] = { 0 }; --- > uint8_t message[MSG_MAX_LENGTH] = { 0 }; > uint8_t response[MSG_MAX_LENGTH] = { 0 }; 810c1157 < size_t b2msg2Size = sizeof( SET_FAN_LEVEL_MSG ); --- > size_t b2msg2Size = sizeof( GET_FAN_LEVEL_MSG ); 817,818c1164,1168 < size_t responseSize = IPMI_RPLY_SET_FAN_LEVEL_LENGTH_NAT; < uint8_t cmd = IPMI_MSG_CMD_GET_FAN_LEVEL; --- > size_t offs = IPMI_RPLY_2ND_BRIDGED_OFFSET_NAT; > size_t roffs = HEADER_LENGTH + 3 + offs; > size_t payloadSize = IPMI_RPLY_SET_FAN_LEVEL_LENGTH; > size_t responseSize = roffs + payloadSize + FOOTER_LENGTH; > uint8_t cmd = IPMI_MSG_CMD_SET_FAN_LEVEL; 820c1170 < int offs = IPMI_RPLY_2ND_BRIDGED_OFFSET_NAT; --- > int rval; 837c1187 < b2msg2[IPMI_MSG2_SET_FAN_LEVEL_LEVEL_OFFSET] = level; --- > b2msg2[IPMI_MSG2_SET_FAN_LEVEL_OFFSET] = level; 839c1189 < messageSize = ipmiMsgBuild( mchData->ipmiSess, message, cmd, 0, imsg2, imsg2Size, b1msg1, b1msg2, b1msg2Size, b2msg1, b2msg2, b2msg2Size ); --- > messageSize = ipmiMsgBuild( mchData->ipmiSess, message, cmd, IPMI_MSG_NETFN_APP_REQUEST, imsg2, imsg2Size, b1msg1, b1msg2, b1msg2Size, b2msg1, b2msg2, b2msg2Size ); 841c1191,1201 < return mchMsgWriteReadHelper( mchData->mchSess, mchData->ipmiSess, message, messageSize, data, &responseSize, cmd, netfn, offs, 0 ); --- > if ( (rval = mchMsgWriteReadHelper( mchData->mchSess, mchData->ipmiSess, message, messageSize, response, &responseSize, cmd, netfn, offs, 0 )) ) > goto bail; > > if ( (rval = mchMsgCheckSizes( sizeof( response ), roffs, payloadSize )) ) { > printf("mchMsgSetFanLevelNat size error\n"); > goto bail; > } > memcpy( data, response + roffs, payloadSize ); > > bail: > return rval; 851d1210 < 854,859d1212 < /* Get FRU Power Level (NAT does not support this command) < * < * RETURNS: status from mchMsgWriteReadHelper < * 0 on success < * non-zero for error < */ 864,866c1217 < size_t imsg2Size = sizeof( SEND_MSG_MSG ); < size_t b1msg1Size = sizeof( IPMI_MSG1 ); < size_t b1msg2Size = sizeof( GET_POWER_LEVEL_MSG ); --- > uint8_t imsg2Size = sizeof( GET_POWER_LEVEL_MSG ); 868,869d1218 < uint8_t b1msg1[b1msg1Size]; < uint8_t b1msg2[b1msg2Size]; 871,872c1220,1225 < size_t responseSize = 0; /* determine responseSize */ < uint8_t cmd = IPMI_MSG_CMD_GET_POWER_LEVEL; --- > > uint8_t response[MSG_MAX_LENGTH] = { 0 }; > size_t roffs, responseSize, payloadSize = IPMI_RPLY_GET_POWER_LEVEL_LENGTH; > int rval, offs, bridged; > uint8_t rsAddr, rqAddr; > uint8_t cmd = IPMI_MSG_CMD_GET_POWER_LEVEL; 875,877c1228,1230 < memcpy( imsg2, SEND_MSG_MSG , imsg2Size ); < memcpy( b1msg1, IPMI_MSG1 , b1msg1Size ); < memcpy( b1msg2, GET_POWER_LEVEL_MSG, b1msg2Size ); --- > mchSetSizeOffs( mchData->mchSess->type, &offs, &responseSize, &bridged, &rsAddr, &rqAddr); > roffs = responseSize; /* Offset into packet our section of interest */ > responseSize += payloadSize + FOOTER_LENGTH; 879c1232 < imsg2[IPMI_MSG2_CHAN_OFFSET] = IPMI_MSG_CHAN_IPMB0 + IPMI_MSG_TRACKING; --- > memcpy( imsg2, GET_POWER_LEVEL_MSG, imsg2Size ); 881,882c1234,1235 < b1msg1[IPMI_MSG1_RSADDR_OFFSET] = IPMI_MSG_ADDR_CM; < b1msg1[IPMI_MSG1_NETFNLUN_OFFSET] = netfn << 2; --- > imsg2[IPMI_MSG2_SET_FRU_ACT_FRU_OFFSET] = fru; > imsg2[IPMI_MSG2_GET_POWER_LEVEL_TYPE_OFFSET] = parm; 884,885c1237,1240 < b1msg2[IPMI_MSG2_SET_FRU_ACT_FRU_OFFSET] = fru; < b1msg2[IPMI_MSG2_GET_POWER_LEVEL_TYPE_OFFSET] = parm; --- > if ( bridged ) // may need to distinguish between once and twice-bridged messages > ipmiBuildSendMsg( mchData->ipmiSess, message, &messageSize, cmd, netfn, rsAddr, rqAddr, imsg2, imsg2Size, 0 ); > else > messageSize = ipmiMsgBuild( mchData->ipmiSess, message, cmd, netfn, imsg2, imsg2Size, 0, 0, 0, 0, 0, 0 ); 887c1242,1243 < messageSize = ipmiMsgBuild( mchData->ipmiSess, message, cmd, 0, imsg2, imsg2Size, b1msg1, b1msg2, b1msg2Size, 0, 0, 0 ); --- > if ( (rval = mchMsgWriteReadHelper( mchData->mchSess, mchData->ipmiSess, message, messageSize, response, &responseSize, cmd, netfn, offs, 0 )) ) > goto bail; 889c1245,1252 < return mchMsgWriteReadHelper( mchData->mchSess, mchData->ipmiSess, message, messageSize, data, &responseSize, cmd, netfn, 0, 0 ); --- > if ( (rval = mchMsgCheckSizes( sizeof( response ), roffs, payloadSize )) ) { > printf("mchMsgGetPowerLevelVt size error\n"); > goto bail; > } > memcpy( data, response + roffs, payloadSize ); > > bail: > return rval; Index: src/drvMchMsg.h =================================================================== RCS file: /afs/slac/g/lcls/cvs/epics/site/src/ipmiComm/src/drvMchMsg.h,v retrieving revision 1.2 diff -r1.2 drvMchMsg.h 11a12,13 > int mchMsgGetSess(MchSess mchSess, IpmiSess ipmiSess, uint8_t *response); > 18c20 < int mchMsgGetFruInfo(MchData mchData, uint8_t *data, uint8_t id); --- > int mchMsgGetFruInvInfo(MchData mchData, uint8_t *data, uint8_t id); 23a26,27 > int mchMsgReserveSdrRep(MchData mchData, uint8_t *data); > 30c34 < int mchMsgGetSensorThresholds(MchData mchData, uint8_t *data, uint8_t sens, uint8_t lun, size_t *responseSize); --- > int mchMsgGetSensorThresholds(MchData mchData, uint8_t *data, uint8_t sens, uint8_t lun); 36c40 < int mchMsgGetDeviceId(MchData mchData, uint8_t *data, uint8_t rsAddr); --- > int mchMsgGetDeviceId(MchData mchData, uint8_t *data, int bridged, uint8_t rsAddr); Index: src/ipmiDef.c =================================================================== RCS file: /afs/slac/g/lcls/cvs/epics/site/src/ipmiComm/src/ipmiDef.c,v retrieving revision 1.8 diff -r1.8 ipmiDef.c 5,6c5,6 < 0, /* Reserved */ < RMCP_MSG_SEQ, /* RMCP message header */ --- > 0, /* Reserved */ > RMCP_MSG_SEQ, /* RMCP message header */ 15a16 > /* For unauthenticated messages */ 20a22,28 > /* For authenticated messages, we don't yet support this */ > uint8_t IPMI_HEADER_AUTH[] = { 0, /* Auth type */ > 0, 0, 0, 0, /* 4-byte Session sequence number */ > 0, 0, 0, 0, /* 4-byte Session ID */ > 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* Message Authentication Code */ > 0 }; /* Number of bytes in message */ > 25a34,36 > size_t IPMI_MSG1_LENGTH = sizeof( IPMI_MSG1 ); > > 43c54,56 < 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* Null user name */ --- > // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* Null user name */ > 'A', 'D', 'M', 'I', 'N', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* Null user name */ > // 'i', 'p', 'm', 'i', 'u', 's', 'e', 'r', 0, 0, 0, 0, 0, 0, 0, 0, /* Null user name */ 50c63,64 < IPMI_MSG_AUTH_TYPE_NONE, /* Authentication type */ --- > IPMI_MSG_AUTH_TYPE_NONE, /* Authentication type (must match that in GET_SESS_MSG) */ > // IPMI_MSG_AUTH_TYPE_PWD_KEY, /* Authentication type (must match that in GET_SESS_MSG) */ 74c88 < uint8_t SENS_READ_MSG[] = { IPMI_MSG_ADDR_BMC, /* Requester's address (BMC) */ --- > uint8_t SENS_READ_MSG[] = { IPMI_MSG_ADDR_SW, /* Requester's address */ 81c95 < uint8_t GET_SENSOR_THRESH_MSG[] = { IPMI_MSG_ADDR_BMC, /* Requester's address (BMC) */ --- > uint8_t GET_SENSOR_THRESH_MSG[] = { IPMI_MSG_ADDR_SW, /* Requester's address */ 88c102 < uint8_t FRU_READ_MSG[] = { IPMI_MSG_ADDR_BMC, /* Requester's address (BMC) */ --- > uint8_t FRU_READ_MSG[] = { IPMI_MSG_ADDR_SW, /* Requester's address */ 96a111,116 > /* Reserve SDR Repository */ > uint8_t RESERVE_SDR_MSG[] = { IPMI_MSG_ADDR_SW, /* Requester's address */ > 0, /* Message sequence number */ > 0, /* Command code */ > 0 }; /* For checksum */ > 98c118 < uint8_t GET_SDR_MSG[] = { IPMI_MSG_ADDR_BMC, /* Requester's address (BMC) */ --- > uint8_t GET_SDR_MSG[] = { IPMI_MSG_ADDR_SW, /* Requester's address */ 108c128 < uint8_t GET_DEV_SDR_INFO_MSG[] = { IPMI_MSG_ADDR_BMC, /* Requester's address (BMC) */ --- > uint8_t GET_DEV_SDR_INFO_MSG[] = { IPMI_MSG_ADDR_SW, /* Requester's address */ 122c142 < uint8_t CHAS_CTRL_MSG[] = { IPMI_MSG_ADDR_BMC, /* Requester's address */ --- > uint8_t CHAS_CTRL_MSG[] = { IPMI_MSG_ADDR_SW, /* Requester's address */ Index: src/ipmiDef.h =================================================================== RCS file: /afs/slac/g/lcls/cvs/epics/site/src/ipmiComm/src/ipmiDef.h,v retrieving revision 1.18 diff -r1.18 ipmiDef.h 33a34,36 > uint8_t chan; /* Channel number, returned by Get Channel Authentication Capabilities response */ > uint8_t authSup; /* Channel authentication types supported, returned by Get Channel Authentication Capabilities response */ > uint8_t authReq; /* Authentication type requested, used in Get Session Challenge and Activate Session requests (and any other authenticated requests) */ 36a40,148 > > /* Data structure for Sensor Data Record (one per sensor) IPMI v2.0 Section 43.1 > * Used for both Full and Compact SDRs > * In this implementation, we don't support all of the Full SDR fields > */ > typedef struct SdrFullRec_ { > uint8_t id[2]; /* Sensor ID (can change, so key bytes must also be used to identify a sensor) */ > uint8_t ver; /* SDR version (0x51) */ > uint8_t recType; /* Record type, 0x01 for Full Sensor Record */ > uint8_t length; /* Number of remaining record bytes */ > uint8_t owner; /* Sensor owner ID, [7:1] slave address or software ID; [0] 0 = IPMB, 1 = system software */ > uint8_t lun; /* Sensor owner LUN, [7:4] channel number; [3:2] reserved; [1:0] sensor owner LUN */ > uint8_t number; /* Sensor number, unique behind given address and LUN, 0xFF reserved */ > uint8_t entityId; /* Entity ID (physical entity that sensor is associated with) */ > uint8_t entityInst; /* Entity instance, [7] 0 = physical entity, 1 = logical; [6:0] instance number 0x00-0x5F system-relative, 0x60-0x7F device-relative */ > uint8_t init; /* Sensor initialization (see IPMI spec page 472 for details) */ > uint8_t cap; /* Sensor capabilities (see IPMI spec page 473 for details) */ > uint8_t sensType; /* Sensor type code (see IPMI spec table 42-3) */ > uint8_t readType; /* Event/reading type code (see IPMI spec table 42-1) */ > /* Following fields only applicable to Full SDR */ > uint8_t units1; /* [7:6] analog data format, [5:3] rate unit, [2:1] modifier unit, [0] percentage */ > uint8_t units2; /* Units type code, IPMI 43-15 */ > uint8_t units3; /* Units type code, 0x00 if unused */ > uint8_t linear; /* Linearization [7] reserved, [6:0] formula type */ > uint8_t M; /* M in conversion, LS 8 bits (2's complement signed 10-bit 'M' value) */ > uint8_t MTol; /* [7:6] MS 2 bits of M, [5:0] tolerance 6 bits unsigned (in +/- 1/2 raw counts) */ > uint8_t B; /* B in conversion, LS 8 bits (2's complement signed 10-bit 'B' value) */ > uint8_t BAcc; /* [7:6] MS 2 bits of B, [5:0] accuracy LW 6 bits (unsigned 10-bit Basic Sensor Accuracy in 1/100 % scaled up by accuracy exponent */ > uint8_t acc; /* [7:4] MS 4 bits of accuracy, [3:2] accuracy exponent 2 bits unsigned, [1:0] sensor direction */ > uint8_t RexpBexp; /* [7:4] R (result) exponent 4 bits 2's complement signed, [3:0] B exponent 4 bits, 2's complement signed */ > uint8_t strLength; /* Sensor ID string type/length */ > uint8_t anlgChar; /* Analog characteristics [7:3] reserved, [2] normal min specified, [1] normal max specified [0], nominal reading specified */ > uint8_t nominal; /* Nominal reading (raw units) */ > uint8_t normMax; /* Normal maximum (raw units) */ > uint8_t normMin; /* Normal minimum (raw units) */ > char str[17]; /* Sensor ID string, 16 bytes maximum */ > /* calculated values, only supported for Full SDR */ > int m; > int b; > int rexp; > int bexp; > > } SdrFullRec, *SdrFull; > > /* > * Data structure for FRU Device Locator Record, IPMI v2.0 Table 43-7 > */ > typedef struct SdrFruRec_ { > uint8_t id[2]; /* Sensor ID (can change, so key bytes must also be used to identify a sensor) */ > uint8_t ver; /* SDR version (0x51) */ > uint8_t recType; /* Record type, 0x11 for FRU Device Locator Record */ > uint8_t length; /* Number of remaining record bytes */ > uint8_t addr; /* [7:1] slave address of controller, all 0 if dev on IPMB, [0] reserved */ > uint8_t fruId; /* FRU Device ID/Slave address. For logical FRU device, [7:0] FRU dev ID, for non-intelligent, [7:1] slave address, [0] reserved */ > uint8_t lun; /* [7] logical/physical FRU device, [6:5] reserved, [4:3] LUN for FRU commands, [2:0] private bus ID */ > uint8_t chan; /* [7:4] Channel number to access device, 0 if on IPMB (MS bit in next byte?); [3:0] reserved */ > uint8_t devType; /* Device type code Table 43-12 */ > uint8_t devMod; /* Device type modifier Table 43-12 */ > uint8_t entityId; /* Entity ID (physical entity that sensor is associated with) */ > uint8_t entityInst; /* Entity instance, [7] 0 = physical entity, 1 = logical; [6:0] instance number 0x00-0x5F system-relative, 0x60-0x7F device-relative */ > uint8_t strLength; /* Device ID string type/length Section 43.15*/ > char str[17]; /* Device ID string, 16 bytes maximum */ > } SdrFruRec, *SdrFru; > > /* > * Data structure for Management Controller Device Locator Record, IPMI v2.0 Table 43-8 > */ > typedef struct SdrMgmtRec_ { > uint8_t id[2]; /* Record ID */ > uint8_t ver; /* SDR version */ > uint8_t recType; /* Record type, 0x12 for Management Controller Locator */ > uint8_t length; /* Number of remaining record bytes */ > uint8_t addr; /* [7:1] I2C slave address of device on channel, [0] reserved */ > uint8_t chan; /* [7:4] reserved; [3:0] Channel number for the channel that the management controller is on, use 0 for primary BMC */ > uint8_t pwr; /* Power state notification and Global initialization, see IPMI spec for meaning of each bit */ > uint8_t cap; /* Device capabilities, see IPMI spec for meaning of each bit */ > /* next 3 bytes reserved */ > uint8_t entityId; /* Entity ID for the FRU associated with this device, 0 if not specified */ > uint8_t entityInst; /* Entity instance */ > uint8_t strLength; /* Device ID string type/length Section 43.15*/ > char str[17]; /* Device ID string, 16 bytes maximum */ > } SdrMgmtRec, *SdrMgmt; > > > /* Data structure for Sensor Data Record Repository and Dynamic Sensor Device */ > typedef struct SdrRepRec_ { > uint8_t ver; /* SDR Version (0x51) */ > uint8_t size[2]; /* Number of sensor data records; LS byte stored first */ > uint8_t free[2]; /* Free space in bytes; LS byte stored first */ > uint32_t addTs; /* Timestamp of most recent addition - remove: ; LS byte stored first */ > uint32_t delTs; /* Timestamp of most recent erase - remove: ; LS byte stored first */ > uint8_t config[1]; /* 8 bits to describe Respository configuration, mostly supported commands */ > uint8_t resId; /* Reservation ID assigned when reserving SDR */ > /* remaining members used by dynamic sensor device only */ > uint8_t devSdrSize; /* Number of sensor data records in chassis dynamic Device SDR */ > uint8_t devSdrDyn; /* Sensor population dynamic, 1 is dynamic, 0 is static */ > uint8_t lun0; /* Sensors in LUN 0, 1 yes, 0 no */ > uint8_t lun1; /* Sensors in LUN 1, 1 yes, 0 no */ > uint8_t lun2; /* Sensors in LUN 2, 1 yes, 0 no */ > uint8_t lun3; /* Sensors in LUN 3, 1 yes, 0 no */ > } SdrRepRec, *SdrRep; > > > extern size_t IPMI_MSG1_LENGTH; > #define HEADER_LENGTH 17 // change how this is defined (RMCP+IPMI headers + IMSG1) > #define RPLY_HEADER_LENGTH 23 // change how this is defined (RMCP+IPMI headers + reply header) > > > // Find a way to not hard-code array sizes below 78a191,201 > /* Authentication type request and > * Supported authentication types from > * Get Channel Authentication Capabilities response > */ > #define IPMI_AUTH_TYPE_SUPPORT(x) x & 0x3F > #define IPMI_MSG_AUTH_TYPE_NONE 0 > #define IPMI_MSG_AUTH_TYPE_MD2 1 > #define IPMI_MSG_AUTH_TYPE_MD5 2 > #define IPMI_MSG_AUTH_TYPE_PWD_KEY 4 > #define IPMI_MSG_AUTH_TYPE_OEM 5 > 80c203 < #define IPMI_MSG1_LENGTH 3 --- > //#define IPMI_MSG1_LENGTH 3 92,93d214 < #define IPMI_MSG_AUTH_TYPE_NONE 0 < #define IPMI_MSG_AUTH_TYPE_MD5 2 98a220,221 > #define IPMI_MSG_HDR_AUTH_OFFSET 9 /* Message authentication code (used in authenticated messages only) */ > #define IPMI_MSG_HDR_AUTH_LENGTH 16 99a223 > #define IPMI_MSG_HDR_AUTH_NBYTES_OFFSET 9 + IPMI_MSG_HDR_AUTH_LENGTH /* Number of bytes in IPMI message (includes bridged message) */ 111c235 < #define IPMI_MSG2_CHAN_OFFSET 3 /* For channel number in bridged request */ --- > #define IPMI_MSG2_AUTH_TYPE_OFFSET 3 /* For Get Session Challenge and Activate Session */ 124,131d247 < #define IPMI_MSG2_SET_FRU_ACT_DEACTIVATE 0 /* Command value in Set FRU Activate command */ < #define IPMI_MSG2_SET_FRU_ACT_ACTIVATE 1 < #define IPMI_MSG2_SET_FRU_ACT_FRU_OFFSET 4 /* FRU ID, used in many commands */ < #define IPMI_MSG2_SET_FRU_ACT_CMD_OFFSET 5 < #define IPMI_MSG2_SET_FRU_POLICY_MASK_OFFSET 5 < #define IPMI_MSG2_SET_FRU_POLICY_BITS_OFFSET 6 < #define IPMI_MSG2_SET_FAN_LEVEL_LEVEL_OFFSET 5 /* New fan level to set */ < #define IPMI_MSG2_GET_POWER_LEVEL_TYPE_OFFSET 5 140d255 < 166,169d280 < #define IPMI_MSG_CMD_GET_POWER_LEVEL 0x12 < #define IPMI_MSG_CMD_GET_FAN_PROP 0x14 < #define IPMI_MSG_CMD_GET_FAN_LEVEL 0x16 < #define IPMI_MSG_CMD_SET_FAN_LEVEL 0x15 178,179c289,290 < /* Response message lengths */ < #define IPMI_RPLY_PONG_LENGTH 28 --- > /* Response message lengths, not just payload, includes RMCP, header, etc. */ > #define IPMI_RPLY_PONG_LENGTH 28 186a298 > /* These aren't used, remove? */ 193a306,312 > #define IPMI_SDR_SENSOR_THRESH_ACCESS(x) (x & 0xC) >> 2 > #define IPMI_SDR_SENSOR_THRESH_NONE 0 > #define IPMI_SDR_SENSOR_THRESH_READABLE 1 > #define IPMI_SDR_SENSOR_THRESH_READABLE_SETTABLE 2 > #define IPMI_SDR_SENSOR_THRESH_FIXED_UNREADABLE 3 > #define IPMI_SENSOR_THRESH_IS_READABLE(x) ((x == IPMI_SDR_SENSOR_THRESH_READABLE) || (x == IPMI_SDR_SENSOR_THRESH_READABLE_SETTABLE)) > 201c320,323 < #define IPMI_DATA_TYPE(x) x & 3<<6 --- > #define IPMI_DATA_LANG_CODE_ENGLISH1 0 > #define IPMI_DATA_LANG_CODE_ENGLISH2 25 > > #define IPMI_DATA_TYPE(x) (x & 0xC0) >> 6 203c325 < #define IPMI_DATA_LANG_ENGLISH(x) x==0 || x==25 --- > #define IPMI_DATA_LANG_ENGLISH(x) (x==IPMI_DATA_LANG_CODE_ENGLISH1) || (x==IPMI_DATA_LANG_CODE_ENGLISH2) 211c333 < /* Completion codes, IPMI spec Table 5-2 */ --- > /* Completion codes, IPMI v2.0 Table 5-2 */ 241a364,367 > /* Command-specific completion codes */ > #define IPMI_COMP_CODE_GET_SESS_INVALID_USER 0x81 > #define IPMI_COMP_CODE_GET_SESS_NULL_USER 0x82 > 255c381 < /*SDR data*/ --- > /* SDR data */ 307c433 < #define SENSOR_CONV_M_B(x,y) (x + ( (y & 0xC0) << 8)) --- > #define SENSOR_CONV_M_B(x,y) (x + ( (y & 0xC0) << 2)) 382d507 < 457c582,630 < /* FRU data */ --- > /* FRU data storage, specified in IPMI Platform Management FRU > * Information Storage Definition V1.0, Document Revision 1.1 > */ > typedef struct FruFieldRec_ { > uint8_t type; /* Type of data */ > uint8_t rlength; /* Length of raw data (bytes) */ > uint8_t *rdata; /* Raw data */ > uint8_t length; /* Length of data after converted to ASCII (bytes) */ > uint8_t *data; /* Data */ > } FruFieldRec, *FruField; > > /* Chassis area doesn't have a language field > * Serial number always encoded in English > */ > typedef struct FruChassisRec_ { > uint8_t offset; /* Offset into FRU storage */ > uint8_t ver; /* Format version (0x01) */ > uint8_t length; /* Length of FRU area */ > uint8_t type; /* Chassis type */ > FruFieldRec part; /* Part number */ > FruFieldRec sn; /* Serial number */ > /* optional custom fields */ > } FruChassisRec, *FruChassis; > > typedef struct FruBoardRec_ { > uint8_t offset; /* Offset into FRU storage */ > uint8_t ver; /* Format version (0x01) */ > uint8_t length; /* Length of FRU area */ > uint8_t lang; /* Language code */ > uint8_t date; /* Manufacturer date/time (minutes from 00:00 1/1/96) */ > FruFieldRec manuf; /* Manufacturer */ > FruFieldRec prod; /* Product name */ > FruFieldRec sn; /* Serial number */ > FruFieldRec part; /* Part number */ > /* more */ > } FruBoardRec, *FruBoard; > > typedef struct FruProdRec_ { > uint8_t offset; /* Offset into FRU storage */ > uint8_t ver; /* Format version (0x01) */ > uint8_t length; /* Length of FRU area */ > uint8_t lang; /* Language code */ > FruFieldRec manuf; /* Manufacturer */ > FruFieldRec prod; /* Product name */ > FruFieldRec part; /* Part number */ > FruFieldRec version; /* Version number */ > FruFieldRec sn; /* Serial number */ > /* more */ > } FruProdRec, *FruProd; 458a632 > /* FRU data */ 534a709,716 > /* MultiRecord area (optional) */ > #define FRU_DATA_MULTIREC_AREA_HEADER_RECORD_TYPE_OFFSET 0 > #define FRU_DATA_MULTIREC_AREA_HEADER_END_OF_LIST_OFFSET 1 > #define FRU_DATA_MULTIREC_AREA_HEADER_RECORD_LENGTH_OFFSET 2 > #define FRU_DATA_MULTIREC_AREA_HEADER_RECORD_CS_OFFSET 3 > #define FRU_DATA_MULTIREC_AREA_HEADER_HEADER_CS_OFFSET 4 > #define FRU_DATA_MULTIREC_END_OF_LIST(x) (x & 0x80) >> 7 > 536,539c718,721 < #define FRU_DATA_TYPE_BINARY 0 /* binary of unspecified */ < #define FRU_DATA_TYPE_BCDPLUS 1<<6 < #define FRU_DATA_TYPE_6BITASCII 2<<6 < #define FRU_DATA_TYPE_LANG 3<<6 /* 8-bit ASCII + Latin 1 if language is English; --- > #define FRU_DATA_TYPE_BINARY 0 /* binary or unspecified */ > #define FRU_DATA_TYPE_BCDPLUS 1 > #define FRU_DATA_TYPE_6BITASCII 2 > #define FRU_DATA_TYPE_LANG 3 /* 8-bit ASCII + Latin 1 if language is English; Index: src/ipmiMsg.c =================================================================== RCS file: /afs/slac/g/lcls/cvs/epics/site/src/ipmiComm/src/ipmiMsg.c,v retrieving revision 1.15 diff -r1.15 ipmiMsg.c 0a1,5 > #include > #include > #include > #include /* pow */ > 8,11d12 < #include < #include < #include /* pow */ < 14a16,32 > //void ipmiBuildSendMsg(IpmiSess sess, uint8_t *message, size_t *messageSize, uint8_t cmd, uint8_t netfn, uint8_t rsAddr, uint8_t rqAddr, uint8_t *msg2, size_t imsg2Size, uint8_t lun); > > void * > ipmiReallocZeros(void *dest, size_t size) > { > > if ( !( dest = realloc( dest, size ) ) ) { > printf("**********realloc failed\n"); > dest = NULL; > goto bail; > } > memset( dest, 0, size ); > > bail: > return dest; > } > 291c309 < case 0x81: --- > case IPMI_COMP_CODE_GET_SESS_INVALID_USER: 294c312 < case 0x82: --- > case IPMI_COMP_CODE_GET_SESS_NULL_USER: 415c433 < sprintf( cmdStr, "Set FRU Activaion" ); --- > sprintf( cmdStr, "Set FRU Activation" ); 441d458 < 453c470 < if ( cmd != IPMI_MSG_CMD_GET_CHAN_AUTH && cmd != IPMI_MSG_CMD_GET_SESSION_CHALLENGE && cmd != IPMI_MSG_CMD_ACTIVATE_SESSION && cmd != IPMI_MSG_CMD_SET_PRIV_LEVEL && cmd ) --- > if ( cmd != IPMI_MSG_CMD_GET_CHAN_AUTH && cmd != IPMI_MSG_CMD_GET_SESSION_CHALLENGE && cmd != IPMI_MSG_CMD_ACTIVATE_SESSION && cmd != IPMI_MSG_CMD_SET_PRIV_LEVEL && cmd != 0 ) 507c524 < ipmiMsgBuild(IpmiSess sess, uint8_t *message, uint8_t cmd, uint8_t *imsg1netfn, uint8_t *imsg2, size_t imsg2Size, uint8_t *b1msg1, uint8_t *b1msg2, size_t b1msg2Size, uint8_t *b2msg1, uint8_t *b2msg2, size_t b2msg2Size) --- > ipmiMsgBuild(IpmiSess sess, uint8_t *message, uint8_t cmd, uint8_t imsg1netfn, uint8_t *imsg2, size_t imsg2Size, uint8_t *b1msg1, uint8_t *b1msg2, size_t b1msg2Size, uint8_t *b2msg1, uint8_t *b2msg2, size_t b2msg2Size) 519,520c536 < if ( imsg1netfn ) < imsg1[IPMI_MSG1_NETFNLUN_OFFSET] = *imsg1netfn << 2; --- > imsg1[IPMI_MSG1_NETFNLUN_OFFSET] = imsg1netfn << 2; 620a637 > //printf("%s entered writeread pasynUser %i\n", name, pasynUser); 621a639 > //printf("pasynUser %i\n", pasynUser); 622a641 > printf("%s connect error %i pasynUser %i\n", name, status, pasynUser); 659c678 < size_t messageSize = ipmiMsgBuild( sess, message, cmd, 0, imsg2, imsg2Size, 0, 0, 0, 0, 0, 0 ); --- > size_t messageSize = ipmiMsgBuild( sess, message, cmd, IPMI_MSG_NETFN_APP_REQUEST, imsg2, imsg2Size, 0, 0, 0, 0, 0, 0 ); 667c686 < ipmiMsgGetSess(void *device, IpmiSess sess, uint8_t *data) --- > ipmiMsgGetSess(void *device, IpmiSess sess, uint8_t *data, uint8_t *msg) 670c689 < uint8_t *imsg2 = GET_SESS_MSG; --- > uint8_t *imsg2 = msg; // temporary - GET_SESS_MSG; 673c692 < size_t messageSize = ipmiMsgBuild( sess, message, cmd, 0, imsg2, imsg2Size, 0, 0, 0, 0, 0, 0 ); --- > size_t messageSize = ipmiMsgBuild( sess, message, cmd, IPMI_MSG_NETFN_APP_REQUEST, imsg2, imsg2Size, 0, 0, 0, 0, 0, 0 ); 695c714 < messageSize = ipmiMsgBuild( sess, message, cmd, 0, imsg2, imsg2Size, 0, 0, 0, 0, 0, 0 ); --- > messageSize = ipmiMsgBuild( sess, message, cmd, IPMI_MSG_NETFN_APP_REQUEST, imsg2, imsg2Size, 0, 0, 0, 0, 0, 0 ); 713c732 < messageSize = ipmiMsgBuild( sess, message, cmd, 0, imsg2, imsg2Size, 0, 0, 0, 0, 0, 0 ); --- > messageSize = ipmiMsgBuild( sess, message, cmd, IPMI_MSG_NETFN_APP_REQUEST, imsg2, imsg2Size, 0, 0, 0, 0, 0, 0 ); 726c745 < size_t messageSize = ipmiMsgBuild( sess, message, cmd, 0, imsg2, imsg2Size, 0, 0, 0, 0, 0, 0 ); --- > size_t messageSize = ipmiMsgBuild( sess, message, cmd, IPMI_MSG_NETFN_APP_REQUEST, imsg2, imsg2Size, 0, 0, 0, 0, 0, 0 ); 750c769 < messageSize = ipmiMsgBuild( sess, message, cmd, 0, imsg2, imsg2Size, 0, 0, 0, 0, 0, 0 ); --- > messageSize = ipmiMsgBuild( sess, message, cmd, IPMI_MSG_NETFN_APP_REQUEST, imsg2, imsg2Size, 0, 0, 0, 0, 0, 0 ); 762c781 < ipmiMsgChassisControl(void *device, IpmiSess sess, uint8_t *data, uint8_t parm, size_t *responseSize, int offs) --- > ipmiMsgChassisControl(void *device, IpmiSess sess, uint8_t *data, int bridged, uint8_t rsAddr, uint8_t rqAddr, uint8_t parm, size_t *responseSize, int offs) 765,770c784,785 < size_t imsg2Size = sizeof( SEND_MSG_MSG ); < size_t b1msg1Size = sizeof( IPMI_MSG1 ); < size_t b1msg2Size = sizeof( CHAS_CTRL_MSG ); < uint8_t imsg2[imsg2Size]; < uint8_t b1msg1[b1msg1Size]; < uint8_t b1msg2[b1msg2Size]; --- > uint8_t imsg2Size = sizeof( CHAS_CTRL_MSG ); > uint8_t imsg2[imsg2Size]; 775,782c790,791 < memcpy( imsg2, SEND_MSG_MSG , imsg2Size ); < memcpy( b1msg1, IPMI_MSG1 , b1msg1Size ); < memcpy( b1msg2, CHAS_CTRL_MSG, b1msg2Size ); < < imsg2[IPMI_MSG2_CHAN_OFFSET] = IPMI_MSG_CHAN_IPMB0 + IPMI_MSG_TRACKING; < < b1msg1[IPMI_MSG1_RSADDR_OFFSET] = IPMI_MSG_ADDR_CM; < b1msg1[IPMI_MSG1_NETFNLUN_OFFSET] = netfn << 2; --- > memcpy( imsg2, CHAS_CTRL_MSG, imsg2Size ); > imsg2[IPMI_MSG2_CMD_OFFSET] = cmd; 784,785c793 < b1msg2[IPMI_MSG2_CMD_OFFSET] = cmd; < b1msg2[IPMI_MSG2_SENSOR_OFFSET] = parm; --- > imsg2[IPMI_MSG2_SENSOR_OFFSET] = parm; 787c795,798 < messageSize = ipmiMsgBuild( sess, message, cmd, 0, imsg2, imsg2Size, b1msg1, b1msg2, b1msg2Size, 0, 0, 0 ); --- > if ( bridged ) // may need to distinguish between once and twice-bridged messages > ipmiBuildSendMsg( sess, message, &messageSize, cmd, netfn, rsAddr, rqAddr, imsg2, imsg2Size, 0 ); > else > messageSize = ipmiMsgBuild( sess, message, cmd, netfn, imsg2, imsg2Size, 0, 0, 0, 0, 0, 0 ); 791a803 > 799c811 < ipmiMsgGetFruInfo(void *device, IpmiSess sess, uint8_t *data, uint8_t id, size_t *responseSize, int offs) --- > ipmiMsgGetFruInvInfo(void *device, IpmiSess sess, uint8_t *data, int bridged, uint8_t rsAddr, uint8_t rqAddr, uint8_t id, size_t *responseSize, int offs) 802,804c814 < size_t imsg2Size = sizeof( SEND_MSG_MSG ); < size_t b1msg1Size = sizeof( IPMI_MSG1 ); < size_t b1msg2Size = sizeof( SENS_READ_MSG ); --- > uint8_t imsg2Size = sizeof( SENS_READ_MSG ); 806,807d815 < uint8_t b1msg1[b1msg1Size]; < uint8_t b1msg2[b1msg2Size]; 812,819c820,821 < memcpy( imsg2, SEND_MSG_MSG , imsg2Size ); < memcpy( b1msg1, IPMI_MSG1 , b1msg1Size ); < memcpy( b1msg2, SENS_READ_MSG, b1msg2Size ); < < imsg2[IPMI_MSG2_CHAN_OFFSET] = IPMI_MSG_CHAN_IPMB0 + IPMI_MSG_TRACKING; < < b1msg1[IPMI_MSG1_RSADDR_OFFSET] = IPMI_MSG_ADDR_CM; < b1msg1[IPMI_MSG1_NETFNLUN_OFFSET] = netfn << 2; --- > memcpy( imsg2, SENS_READ_MSG, imsg2Size ); > imsg2[IPMI_MSG2_CMD_OFFSET] = cmd; 821,822c823 < b1msg2[IPMI_MSG2_CMD_OFFSET] = cmd; < b1msg2[IPMI_MSG2_SENSOR_OFFSET] = id; --- > imsg2[IPMI_MSG2_SENSOR_OFFSET] = id; 824c825,828 < messageSize = ipmiMsgBuild( sess, message, cmd, 0, imsg2, imsg2Size, b1msg1, b1msg2, b1msg2Size, 0, 0, 0 ); --- > if ( bridged ) // may need to distinguish between once and twice-bridged messages > ipmiBuildSendMsg( sess, message, &messageSize, cmd, netfn, rsAddr, rqAddr, imsg2, imsg2Size, 0 ); > else > messageSize = ipmiMsgBuild( sess, message, cmd, netfn, imsg2, imsg2Size, 0, 0, 0, 0, 0, 0 ); 836c840 < ipmiMsgReadFru(void *device, IpmiSess sess, uint8_t *data, uint8_t id, uint8_t *readOffset, uint8_t readSize, size_t *responseSize, int offs) --- > ipmiMsgReadFru(void *device, IpmiSess sess, uint8_t *data, int bridged, uint8_t rsAddr, uint8_t rqAddr, uint8_t id, uint8_t *readOffset, uint8_t readSize, size_t *responseSize, int offs) 839,841c843 < size_t imsg2Size = sizeof( SEND_MSG_MSG ); < size_t b1msg1Size = sizeof( IPMI_MSG1 ); < size_t b1msg2Size = sizeof( FRU_READ_MSG ); --- > uint8_t imsg2Size = sizeof( FRU_READ_MSG ); 843,844d844 < uint8_t b1msg1[b1msg1Size]; < uint8_t b1msg2[b1msg2Size]; 849,858c849,850 < *responseSize += readSize; < < memcpy( imsg2, SEND_MSG_MSG , imsg2Size ); < memcpy( b1msg1, IPMI_MSG1 , b1msg1Size ); < memcpy( b1msg2, FRU_READ_MSG, b1msg2Size ); < < imsg2[IPMI_MSG2_CHAN_OFFSET] = IPMI_MSG_CHAN_IPMB0 + IPMI_MSG_TRACKING; < < b1msg1[IPMI_MSG1_RSADDR_OFFSET] = IPMI_MSG_ADDR_CM; < b1msg1[IPMI_MSG1_NETFNLUN_OFFSET] = netfn << 2; --- > memcpy( imsg2, FRU_READ_MSG, imsg2Size ); > imsg2[IPMI_MSG2_CMD_OFFSET] = cmd; 860,864c852,856 < b1msg2[IPMI_MSG2_CMD_OFFSET] = cmd; < b1msg2[IPMI_MSG2_READ_FRU_ID_OFFSET] = id; < b1msg2[IPMI_MSG2_READ_FRU_LSB_OFFSET] = readOffset[0]; < b1msg2[IPMI_MSG2_READ_FRU_MSB_OFFSET] = readOffset[1]; < b1msg2[IPMI_MSG2_READ_FRU_CNT_OFFSET] = readSize; --- > imsg2[IPMI_MSG2_CMD_OFFSET] = cmd; > imsg2[IPMI_MSG2_READ_FRU_ID_OFFSET] = id; > imsg2[IPMI_MSG2_READ_FRU_LSB_OFFSET] = readOffset[0]; > imsg2[IPMI_MSG2_READ_FRU_MSB_OFFSET] = readOffset[1]; > imsg2[IPMI_MSG2_READ_FRU_CNT_OFFSET] = readSize; 866c858,861 < messageSize = ipmiMsgBuild( sess, message, cmd, 0, imsg2, imsg2Size, b1msg1, b1msg2, b1msg2Size, 0, 0, 0 ); --- > if ( bridged ) // may need to distinguish between once and twice-bridged messages > ipmiBuildSendMsg( sess, message, &messageSize, cmd, netfn, rsAddr, rqAddr, imsg2, imsg2Size, 0 ); > else > messageSize = ipmiMsgBuild( sess, message, cmd, netfn, imsg2, imsg2Size, 0, 0, 0, 0, 0, 0 ); 878c873 < ipmiMsgGetSdrRepInfo(void *device, IpmiSess sess, uint8_t *data, size_t *responseSize, int offs) --- > ipmiMsgGetSdrRepInfo(void *device, IpmiSess sess, uint8_t *data, int bridged, uint8_t rsAddr, uint8_t rqAddr, size_t *responseSize, int offs) 881,883c876 < size_t imsg2Size = sizeof( SEND_MSG_MSG ); < size_t b1msg1Size = sizeof( IPMI_MSG1 ); < size_t b1msg2Size = sizeof( BASIC_MSG ); --- > uint8_t imsg2Size = sizeof( BASIC_MSG ); 885,886d877 < uint8_t b1msg1[b1msg1Size]; < uint8_t b1msg2[b1msg2Size]; 891,893c882,883 < memcpy( imsg2, SEND_MSG_MSG , imsg2Size ); < memcpy( b1msg1, IPMI_MSG1 , b1msg1Size ); < memcpy( b1msg2, BASIC_MSG, b1msg2Size ); --- > memcpy( imsg2, BASIC_MSG, imsg2Size ); > imsg2[IPMI_MSG2_CMD_OFFSET] = cmd; 895c885,907 < imsg2[IPMI_MSG2_CHAN_OFFSET] = IPMI_MSG_CHAN_IPMB0 + IPMI_MSG_TRACKING; --- > if ( bridged ) // may need to distinguish between once and twice-bridged messages > ipmiBuildSendMsg( sess, message, &messageSize, cmd, netfn, rsAddr, rqAddr, imsg2, imsg2Size, 0 ); > else > messageSize = ipmiMsgBuild( sess, message, cmd, netfn, imsg2, imsg2Size, 0, 0, 0, 0, 0, 0 ); > > return sess->wrf( device, sess, message, messageSize, data, responseSize, cmd, netfn, offs, 0 ); > } > > /* Reserve SDR (Sensor Data Record) Repository > * > * RETURNS: status from sess->wrf > * 0 on success > * non-zero for error > */ > int > ipmiMsgReserveSdrRep(void *device, IpmiSess sess, uint8_t *data, int bridged, uint8_t rsAddr, uint8_t rqAddr, size_t *responseSize, int offs) > { > uint8_t message[MSG_MAX_LENGTH] = { 0 }; > uint8_t imsg2Size = sizeof( BASIC_MSG ); > uint8_t imsg2[imsg2Size]; > size_t messageSize; > uint8_t cmd = IPMI_MSG_CMD_RESERVE_SDRREP; > uint8_t netfn = IPMI_MSG_NETFN_STORAGE; 897,898c909,911 < b1msg1[IPMI_MSG1_RSADDR_OFFSET] = IPMI_MSG_ADDR_CM; < b1msg1[IPMI_MSG1_NETFNLUN_OFFSET] = netfn << 2; --- > //printf("enter ipmiMsgReserveSdrRep\n"); > memcpy( imsg2, BASIC_MSG, imsg2Size ); > imsg2[IPMI_MSG2_CMD_OFFSET] = cmd; 900,901c913,916 < b1msg2[IPMI_MSG2_RQADDR_OFFSET] = IPMI_MSG_ADDR_BMC; < b1msg2[IPMI_MSG2_CMD_OFFSET] = cmd; --- > if ( bridged ) // may need to distinguish between once and twice-bridged messages > ipmiBuildSendMsg( sess, message, &messageSize, cmd, netfn, rsAddr, rqAddr, imsg2, imsg2Size, 0 ); > else > messageSize = ipmiMsgBuild( sess, message, cmd, netfn, imsg2, imsg2Size, 0, 0, 0, 0, 0, 0 ); 903c918 < messageSize = ipmiMsgBuild( sess, message, cmd, 0, imsg2, imsg2Size, b1msg1, b1msg2, b1msg2Size, 0, 0, 0 ); --- > /*return*/ int r = sess->wrf( device, sess, message, messageSize, data, responseSize, cmd, netfn, offs, 0 ); 905c920,927 < return sess->wrf( device, sess, message, messageSize, data, responseSize, cmd, netfn, offs, 0 ); --- > /* > printf("\nipmiMsgReserveSdrRep\n"); > int z; > for ( z = 0; z < MSG_MAX_LENGTH; z++ ) > printf("0x%02x ", data[z]); > printf("\n\n"); > */ > return r; 922c944 < ipmiMsgGetSdr(void *device, IpmiSess sess, uint8_t *data, uint8_t *id, uint8_t *res, uint8_t offset, uint8_t readSize, uint8_t parm, uint8_t recordSize, size_t *responseSize, int offs) --- > ipmiMsgGetSdr(void *device, IpmiSess sess, uint8_t *data, int bridged, uint8_t rsAddr, uint8_t rqAddr, uint8_t *id, uint8_t *res, uint8_t offset, uint8_t readSize, uint8_t parm, uint8_t recordSize, size_t *responseSize, int offs) 925,927c947 < size_t imsg2Size = sizeof( SEND_MSG_MSG ); < size_t b1msg1Size = sizeof( IPMI_MSG1 ); < size_t b1msg2Size = sizeof( GET_SDR_MSG ); --- > uint8_t imsg2Size = sizeof( GET_SDR_MSG ); 929,930d948 < uint8_t b1msg1[b1msg1Size]; < uint8_t b1msg2[b1msg2Size]; 935,942c953,954 < memcpy( imsg2, SEND_MSG_MSG , imsg2Size ); < memcpy( b1msg1, IPMI_MSG1 , b1msg1Size ); < memcpy( b1msg2, GET_SDR_MSG , b1msg2Size ); < < imsg2[IPMI_MSG2_CHAN_OFFSET] = IPMI_MSG_CHAN_IPMB0 + IPMI_MSG_TRACKING; < < b1msg1[IPMI_MSG1_RSADDR_OFFSET] = IPMI_MSG_ADDR_CM; < b1msg1[IPMI_MSG1_NETFNLUN_OFFSET] = netfn << 2; --- > memcpy( imsg2, GET_SDR_MSG, imsg2Size ); > imsg2[IPMI_MSG2_CMD_OFFSET] = cmd; 944,950c956,962 < b1msg2[IPMI_MSG2_CMD_OFFSET] = cmd; < b1msg2[IPMI_MSG2_GET_SDR_RES_LSB_OFFSET] = res[0]; < b1msg2[IPMI_MSG2_GET_SDR_RES_MSB_OFFSET] = res[1]; < b1msg2[IPMI_MSG2_GET_SDR_ID_LSB_OFFSET] = id[0]; < b1msg2[IPMI_MSG2_GET_SDR_ID_MSB_OFFSET] = id[1]; < b1msg2[IPMI_MSG2_GET_SDR_OFFSET_OFFSET] = offset; < b1msg2[IPMI_MSG2_GET_SDR_CNT_OFFSET] = readSize; --- > imsg2[IPMI_MSG2_CMD_OFFSET] = cmd; > imsg2[IPMI_MSG2_GET_SDR_RES_LSB_OFFSET] = res[0]; > imsg2[IPMI_MSG2_GET_SDR_RES_MSB_OFFSET] = res[1]; > imsg2[IPMI_MSG2_GET_SDR_ID_LSB_OFFSET] = id[0]; > imsg2[IPMI_MSG2_GET_SDR_ID_MSB_OFFSET] = id[1]; > imsg2[IPMI_MSG2_GET_SDR_OFFSET_OFFSET] = offset; > imsg2[IPMI_MSG2_GET_SDR_CNT_OFFSET] = readSize; 952c964,967 < messageSize = ipmiMsgBuild( sess, message, cmd, 0, imsg2, imsg2Size, b1msg1, b1msg2, b1msg2Size, 0, 0, 0 ); --- > if ( bridged ) // may need to distinguish between once and twice-bridged messages > ipmiBuildSendMsg( sess, message, &messageSize, cmd, netfn, rsAddr, rqAddr, imsg2, imsg2Size, 0 ); > else > messageSize = ipmiMsgBuild( sess, message, cmd, netfn, imsg2, imsg2Size, 0, 0, 0, 0, 0, 0 ); 964c979 < ipmiMsgGetDevSdrInfo(void *device, IpmiSess sess, uint8_t *data, uint8_t parm, size_t *responseSize, int offs) --- > ipmiMsgGetDevSdrInfo(void *device, IpmiSess sess, uint8_t *data, int bridged, uint8_t rsAddr, uint8_t rqAddr, uint8_t parm, size_t *responseSize, int offs) 967,969c982 < size_t imsg2Size = sizeof( SEND_MSG_MSG ); < size_t b1msg1Size = sizeof( IPMI_MSG1 ); < size_t b1msg2Size = sizeof( GET_DEV_SDR_INFO_MSG ); --- > uint8_t imsg2Size = sizeof( GET_DEV_SDR_INFO_MSG ); 971,972d983 < uint8_t b1msg1[b1msg1Size]; < uint8_t b1msg2[b1msg2Size]; 977,988c988,989 < memcpy( imsg2, SEND_MSG_MSG , imsg2Size ); < memcpy( b1msg1, IPMI_MSG1 , b1msg1Size ); < memcpy( b1msg2, GET_DEV_SDR_INFO_MSG, b1msg2Size ); < < imsg2[IPMI_MSG2_CHAN_OFFSET] = IPMI_MSG_CHAN_IPMB0 + IPMI_MSG_TRACKING; < < b1msg1[IPMI_MSG1_RSADDR_OFFSET] = IPMI_MSG_ADDR_CM; < b1msg1[IPMI_MSG1_NETFNLUN_OFFSET] = netfn << 2; < < b1msg2[IPMI_MSG2_RQADDR_OFFSET] = IPMI_MSG_ADDR_BMC; < b1msg2[IPMI_MSG2_CMD_OFFSET] = cmd; < b1msg2[IPMI_MSG2_GET_DEV_SDR_INFO_OP_OFFSET] = parm; --- > memcpy( imsg2, GET_DEV_SDR_INFO_MSG, imsg2Size ); > imsg2[IPMI_MSG2_CMD_OFFSET] = cmd; 990c991,994 < messageSize = ipmiMsgBuild( sess, message, cmd, 0, imsg2, imsg2Size, b1msg1, b1msg2, b1msg2Size, 0, 0, 0 ); --- > if ( bridged ) // may need to distinguish between once and twice-bridged messages > ipmiBuildSendMsg( sess, message, &messageSize, cmd, netfn, rsAddr, rqAddr, imsg2, imsg2Size, 0 ); > else > messageSize = ipmiMsgBuild( sess, message, cmd, netfn, imsg2, imsg2Size, 0, 0, 0, 0, 0, 0 ); 1002c1006 < ipmiMsgReadSensor(void *device, IpmiSess sess, uint8_t *data, uint8_t sens, uint8_t lun, size_t *responseSize, int offs) --- > ipmiMsgReadSensor(void *device, IpmiSess sess, uint8_t *data, uint8_t bridged, uint8_t rsAddr, uint8_t rqAddr, uint8_t sens, uint8_t lun, size_t *responseSize, int offs) 1005,1007c1009 < size_t imsg2Size = sizeof( SEND_MSG_MSG ); < size_t b1msg1Size = sizeof( IPMI_MSG1 ); < size_t b1msg2Size = sizeof( SENS_READ_MSG ); --- > uint8_t imsg2Size = sizeof( SENS_READ_MSG ); 1009,1010d1010 < uint8_t b1msg1[b1msg1Size]; < uint8_t b1msg2[b1msg2Size]; 1015,1023c1015,1016 < memcpy( imsg2, SEND_MSG_MSG , imsg2Size ); < memcpy( b1msg1, IPMI_MSG1 , b1msg1Size ); < memcpy( b1msg2, SENS_READ_MSG, b1msg2Size ); < < imsg2[IPMI_MSG2_CHAN_OFFSET] = IPMI_MSG_CHAN_IPMB0 + IPMI_MSG_TRACKING; < imsg2[IPMI_MSG2_SEQLUN_OFFSET] = lun; < < b1msg1[IPMI_MSG1_RSADDR_OFFSET] = IPMI_MSG_ADDR_CM; < b1msg1[IPMI_MSG1_NETFNLUN_OFFSET] = netfn << 2; --- > memcpy( imsg2, SENS_READ_MSG, imsg2Size ); > imsg2[IPMI_MSG2_CMD_OFFSET] = cmd; 1025c1018 < b1msg2[IPMI_MSG2_SENSOR_OFFSET] = sens; --- > imsg2[IPMI_MSG2_SENSOR_OFFSET] = sens; 1027c1020,1023 < messageSize = ipmiMsgBuild( sess, message, cmd, 0, imsg2, imsg2Size, b1msg1, b1msg2, b1msg2Size, 0, 0, 0 ); --- > if ( bridged ) // may need to distinguish between once and twice-bridged messages > ipmiBuildSendMsg( sess, message, &messageSize, cmd, netfn, rsAddr, rqAddr, imsg2, imsg2Size, lun ); > else > messageSize = ipmiMsgBuild( sess, message, cmd, netfn, imsg2, imsg2Size, 0, 0, 0, 0, 0, 0 ); 1038,1039c1034,1035 < int < ipmiMsgGetSensorThresholds(void *device, IpmiSess sess, uint8_t *data, uint8_t sens, uint8_t lun, size_t *responseSize, int offs) --- > int > ipmiMsgGetSensorThresholds(void *device, IpmiSess sess, uint8_t *data, uint8_t bridged, uint8_t rsAddr, uint8_t rqAddr, uint8_t sens, uint8_t lun, size_t *responseSize, int offs) 1042,1044c1038 < size_t imsg2Size = sizeof( SEND_MSG_MSG ); < size_t b1msg1Size = sizeof( IPMI_MSG1 ); < size_t b1msg2Size = sizeof( GET_SENSOR_THRESH_MSG ); --- > uint8_t imsg2Size = sizeof( GET_SENSOR_THRESH_MSG ); 1046,1047d1039 < uint8_t b1msg1[b1msg1Size]; < uint8_t b1msg2[b1msg2Size]; 1052,1060c1044,1045 < memcpy( imsg2, SEND_MSG_MSG , imsg2Size ); < memcpy( b1msg1, IPMI_MSG1 , b1msg1Size ); < memcpy( b1msg2, GET_SENSOR_THRESH_MSG, b1msg2Size ); < < imsg2[IPMI_MSG2_CHAN_OFFSET] = IPMI_MSG_CHAN_IPMB0 + IPMI_MSG_TRACKING; < imsg2[IPMI_MSG2_SEQLUN_OFFSET] = lun; < < b1msg1[IPMI_MSG1_RSADDR_OFFSET] = IPMI_MSG_ADDR_CM; < b1msg1[IPMI_MSG1_NETFNLUN_OFFSET] = netfn << 2; --- > memcpy( imsg2, GET_SENSOR_THRESH_MSG, imsg2Size ); > imsg2[IPMI_MSG2_CMD_OFFSET] = cmd; 1062c1047 < b1msg2[IPMI_MSG2_SENSOR_OFFSET] = sens; --- > imsg2[IPMI_MSG2_SENSOR_OFFSET] = sens; 1064c1049,1052 < messageSize = ipmiMsgBuild( sess, message, cmd, 0, imsg2, imsg2Size, b1msg1, b1msg2, b1msg2Size, 0, 0, 0 ); --- > if ( bridged ) // may need to distinguish between once and twice-bridged messages > ipmiBuildSendMsg( sess, message, &messageSize, cmd, netfn, rsAddr, rqAddr, imsg2, imsg2Size, lun ); > else > messageSize = ipmiMsgBuild( sess, message, cmd, netfn, imsg2, imsg2Size, 0, 0, 0, 0, 0, 0 ); 1068a1057 > 1076c1065 < ipmiMsgGetDeviceId(void *device, IpmiSess sess, uint8_t *data, uint8_t rsAddr, size_t *responseSize, int offs) --- > ipmiMsgGetDeviceId(void *device, IpmiSess sess, uint8_t *data, int bridged, uint8_t rsAddr, uint8_t rqAddr, size_t *responseSize, int offs) 1079,1081c1068 < size_t imsg2Size = sizeof( SEND_MSG_MSG ); < size_t b1msg1Size = sizeof( IPMI_MSG1 ); < size_t b1msg2Size = sizeof( BASIC_MSG ); --- > uint8_t imsg2Size = sizeof( BASIC_MSG ); 1083,1084d1069 < uint8_t b1msg1[b1msg1Size]; < uint8_t b1msg2[b1msg2Size]; 1088a1074,1092 > memcpy( imsg2, BASIC_MSG, imsg2Size ); > imsg2[IPMI_MSG2_CMD_OFFSET] = cmd; > > if ( bridged ) // may need to distinguish between once and twice-bridged messages > ipmiBuildSendMsg( sess, message, &messageSize, cmd, netfn, rsAddr, rqAddr, imsg2, imsg2Size, 0 ); > else > messageSize = ipmiMsgBuild( sess, message, cmd, netfn, imsg2, imsg2Size, 0, 0, 0, 0, 0, 0 ); > > return sess->wrf( device, sess, message, messageSize, data, responseSize, cmd, netfn, offs, 0 ); > } > > void > ipmiBuildSendMsg(IpmiSess sess, uint8_t *message, size_t *messageSize, uint8_t cmd, uint8_t netfn, uint8_t rsAddr, uint8_t rqAddr, uint8_t *msg2, size_t msg2Size, uint8_t lun) > { > size_t imsg2Size = sizeof( SEND_MSG_MSG ); > size_t b1msg1Size = sizeof( IPMI_MSG1 ); > uint8_t imsg2[imsg2Size]; > uint8_t b1msg1[b1msg1Size]; > 1091d1094 < memcpy( b1msg2, BASIC_MSG, b1msg2Size ); 1095,1100c1098,1099 < b1msg1[IPMI_MSG1_RSADDR_OFFSET] = rsAddr;/* ? rsAddr : IPMI_MSG_ADDR_CM;*/ < b1msg1[IPMI_MSG1_NETFNLUN_OFFSET] = netfn << 2; < < b1msg2[IPMI_MSG2_CMD_OFFSET] = cmd; < < messageSize = ipmiMsgBuild( sess, message, cmd, 0, imsg2, imsg2Size, b1msg1, b1msg2, b1msg2Size, 0, 0, 0 ); --- > b1msg1[IPMI_MSG1_RSADDR_OFFSET] = rsAddr; > b1msg1[IPMI_MSG1_NETFNLUN_OFFSET] = lun | (netfn << 2); 1102c1101,1103 < return sess->wrf( device, sess, message, messageSize, data, responseSize, cmd, netfn, offs, 1 ); --- > msg2[IPMI_MSG2_RQADDR_OFFSET] = rqAddr; > > *messageSize = ipmiMsgBuild( sess, message, cmd, IPMI_MSG_NETFN_APP_REQUEST, imsg2, imsg2Size, b1msg1, msg2, msg2Size, 0, 0, 0 ); Index: src/ipmiMsg.h =================================================================== RCS file: /afs/slac/g/lcls/cvs/epics/site/src/ipmiComm/src/ipmiMsg.h,v retrieving revision 1.13 diff -r1.13 ipmiMsg.h 9a10,12 > /* Call realloc to allocate memory block; Use memset to set block to all zeros */ > void *ipmiReallocZeros(void *dest, size_t size); > 89a93,94 > void ipmiBuildSendMsg(IpmiSess sess, uint8_t *message, size_t *messageSize, uint8_t cmd, uint8_t netfn, uint8_t rsAddr, uint8_t rqAddr, uint8_t *msg2, size_t msg2Size, uint8_t lun); > 92c97 < int ipmiMsgBuild(IpmiSess sess, uint8_t *message, uint8_t cmd, uint8_t *imsg1netfn, uint8_t *imsg2, size_t imsg2Size, uint8_t *b1msg1, uint8_t *b1msg2, size_t b1msg2Size, uint8_t *b2msg1, uint8_t *b2msg2, size_t b2msg2Size); --- > int ipmiMsgBuild(IpmiSess sess, uint8_t *message, uint8_t cmd, uint8_t imsg1netfn, uint8_t *imsg2, size_t imsg2Size, uint8_t *b1msg1, uint8_t *b1msg2, size_t b1msg2Size, uint8_t *b2msg1, uint8_t *b2msg2, size_t b2msg2Size); 96c101 < int ipmiMsgGetDeviceId(void *device, IpmiSess sess, uint8_t *data, uint8_t rsAddr, size_t *responseSize, int offs); --- > int ipmiMsgGetDeviceId(void *device, IpmiSess sess, uint8_t *data, int bridged, uint8_t rsAddr, uint8_t rqAddr, size_t *responseSize, int offs); 100c105 < int ipmiMsgGetSess(void *device, IpmiSess sess, uint8_t *data); --- > int ipmiMsgGetSess(void *device, IpmiSess sess, uint8_t *data, uint8_t *msg); 110c115,117 < int ipmiMsgChassisControl(void *device, IpmiSess sess, uint8_t *data, uint8_t parm, size_t *responseSize, int offs); --- > int ipmiMsgChassisControl(void *device, IpmiSess sess, uint8_t *data, int bridged, uint8_t rsAddr, uint8_t rqAddr, uint8_t parm, size_t *responseSize, int offs); > > int ipmiMsgGetFruInvInfo(void *device, IpmiSess sess, uint8_t *data, int bridged, uint8_t rsAddr, uint8_t rqAddr, uint8_t id, size_t *responseSize, int offs); 112c119 < int ipmiMsgGetFruInfo(void *device, IpmiSess sess, uint8_t *data, uint8_t id, size_t *responseSize, int offs); --- > int ipmiMsgReadFru(void *device, IpmiSess sess, uint8_t *data, int bridged, uint8_t rsAddr, uint8_t rqAddr, uint8_t id, uint8_t *readOffset, uint8_t readSize, size_t *responseSize, int offs); 114c121 < int ipmiMsgReadFru(void *device, IpmiSess sess, uint8_t *data, uint8_t id, uint8_t *readOffset, uint8_t readSize, size_t *responseSize, int offs); --- > int ipmiMsgGetSdrRepInfo(void *device, IpmiSess sess, uint8_t *data, int bridged, uint8_t rsAddr, uint8_t rqAddr, size_t *responseSize, int offs); 116c123 < int ipmiMsgGetSdrRepInfo(void *device, IpmiSess sess, uint8_t *data, size_t *responseSize, int offs); --- > int ipmiMsgReserveSdrRep(void *device, IpmiSess sess, uint8_t *data, int bridged, uint8_t rsAddr, uint8_t rqAddr, size_t *responseSize, int offs); 118c125 < int ipmiMsgGetDevSdrInfo(void *device, IpmiSess sess, uint8_t *data, uint8_t parm, size_t *responseSize, int offs); --- > int ipmiMsgGetDevSdrInfo(void *device, IpmiSess sess, uint8_t *data, int bridged, uint8_t rsAddr, uint8_t rqAddr, uint8_t parm, size_t *responseSize, int offs); 120c127 < int ipmiMsgGetSdr(void *device, IpmiSess sess, uint8_t *data, uint8_t *id, uint8_t *res, uint8_t offset, uint8_t readSize, uint8_t parm, uint8_t recordSize, size_t *responseSize, int offs); --- > int ipmiMsgGetSdr(void *device, IpmiSess sess, uint8_t *data, int bridged, uint8_t rsAddr, uint8_t rqAddr, uint8_t *id, uint8_t *res, uint8_t offset, uint8_t readSize, uint8_t parm, uint8_t recordSize, size_t *responseSize, int offs); 122c129 < int ipmiMsgReadSensor(void *device, IpmiSess sess, uint8_t *data, uint8_t sens, uint8_t lun, size_t *responseSize, int offs); --- > int ipmiMsgReadSensor(void *device, IpmiSess sess, uint8_t *data, uint8_t bridged, uint8_t rsAddr, uint8_t rqAddr, uint8_t sens, uint8_t lun, size_t *responseSize, int offs); 124c131 < int ipmiMsgGetSensorThresholds(void *device, IpmiSess sess, uint8_t *data, uint8_t sens, uint8_t lun, size_t *responseSize, int offs); --- > int ipmiMsgGetSensorThresholds(void *device, IpmiSess sess, uint8_t *data, uint8_t bridged, uint8_t rsAddr, uint8_t rqAddr, uint8_t sens, uint8_t lun, size_t *responseSize, int offs);