From: Zdenek S. <st...@us...> - 2013-07-17 10:45:58
|
Update of /cvsroot/ipmitool/ipmitool/lib In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv3813/lib Modified Files: ipmi_hpmfwupg.c Log Message: ID: 70 - Fixes and updates for ipmitool hpm Fixed the hpm upgstatus command to print the results of the command without having to specify -v to enable verbose operation. It's not clear that this command is even useful to the user at all. Perhaps it should be removed entirely. Commit for Dan Gora Index: ipmi_hpmfwupg.c =================================================================== RCS file: /cvsroot/ipmitool/ipmitool/lib/ipmi_hpmfwupg.c,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** ipmi_hpmfwupg.c 17 Jul 2013 10:42:19 -0000 1.44 --- ipmi_hpmfwupg.c 17 Jul 2013 10:45:56 -0000 1.45 *************** *** 1068,1074 **** struct HpmfwupgActivateFirmwareCtx* pCtx, struct HpmfwupgUpgradeCtx* pFwupgCtx); ! static int HpmfwupgGetUpgradeStatus(struct ipmi_intf *intf, ! struct HpmfwupgGetUpgradeStatusCtx* pCtxstruct, ! struct HpmfwupgUpgradeCtx* pFwupgCtx); static int HpmfwupgManualFirmwareRollback(struct ipmi_intf *intf, struct HpmfwupgManualFirmwareRollbackCtx* pCtx, --- 1068,1072 ---- struct HpmfwupgActivateFirmwareCtx* pCtx, struct HpmfwupgUpgradeCtx* pFwupgCtx); ! static int HpmfwupgGetUpgradeStatus(struct ipmi_intf *intf, struct HpmfwupgGetUpgradeStatusCtx* pCtxstruct, struct HpmfwupgUpgradeCtx* pFwupgCtx, int silent); static int HpmfwupgManualFirmwareRollback(struct ipmi_intf *intf, struct HpmfwupgManualFirmwareRollbackCtx* pCtx, *************** *** 3155,3220 **** } ! int HpmfwupgGetUpgradeStatus(struct ipmi_intf *intf, struct HpmfwupgGetUpgradeStatusCtx* pCtx, ! struct HpmfwupgUpgradeCtx* pFwupgCtx) { ! int rc = HPMFWUPG_SUCCESS; ! struct ipmi_rs * rsp; ! struct ipmi_rq req; ! pCtx->req.picmgId = HPMFWUPG_PICMG_IDENTIFIER; ! memset(&req, 0, sizeof(req)); ! req.msg.netfn = IPMI_NETFN_PICMG; req.msg.cmd = HPMFWUPG_GET_UPGRADE_STATUS; req.msg.data = (unsigned char*)&pCtx->req; req.msg.data_len = sizeof(struct HpmfwupgGetUpgradeStatusReq); ! rsp = HpmfwupgSendCmd(intf, req, pFwupgCtx); ! ! if ( rsp ) ! { ! if ( rsp->ccode == 0x00 ) ! { ! memcpy(&pCtx->resp, rsp->data, sizeof(struct HpmfwupgGetUpgradeStatusResp)); ! if ( verbose > 1 ) ! { ! lprintf(LOG_NOTICE,"Upgrade status:"); ! lprintf(LOG_NOTICE," Command in progress: %x", pCtx->resp.cmdInProcess); ! lprintf(LOG_NOTICE," Last command completion code: %x", pCtx->resp.lastCmdCompCode); ! } ! } ! /* ! * PATCH --> This validation is to handle retryables errors codes on IPMB bus. ! * This will be fixed in the next release of open ipmi and this ! * check will have to be removed. (Buggy version = 39) ! */ ! else if ( HPMFWUPG_IS_RETRYABLE(rsp->ccode) ) ! { ! lprintf(LOG_DEBUG,"HPM: [PATCH]Retryable error detected"); ! pCtx->resp.lastCmdCompCode = HPMFWUPG_COMMAND_IN_PROGRESS; ! } ! else ! { ! if ( verbose ) ! { lprintf(LOG_NOTICE,"Error getting upgrade status"); lprintf(LOG_NOTICE,"compcode=0x%x: %s", rsp->ccode, val2str(rsp->ccode, completion_code_vals)); ! rc = HPMFWUPG_ERROR; ! } ! } ! } ! else ! { ! if ( verbose ) ! { ! lprintf(LOG_NOTICE,"Error getting upgrade status"); ! rc = HPMFWUPG_ERROR; ! } ! } ! return rc; } --- 3153,3213 ---- } ! int HpmfwupgGetUpgradeStatus(struct ipmi_intf *intf, ! struct HpmfwupgGetUpgradeStatusCtx *pCtx, ! struct HpmfwupgUpgradeCtx *pFwupgCtx, ! int silent) { ! int rc = HPMFWUPG_SUCCESS; ! struct ipmi_rs * rsp; ! struct ipmi_rq req; ! pCtx->req.picmgId = HPMFWUPG_PICMG_IDENTIFIER; ! memset(&req, 0, sizeof(req)); ! req.msg.netfn = IPMI_NETFN_PICMG; req.msg.cmd = HPMFWUPG_GET_UPGRADE_STATUS; req.msg.data = (unsigned char*)&pCtx->req; req.msg.data_len = sizeof(struct HpmfwupgGetUpgradeStatusReq); ! rsp = HpmfwupgSendCmd(intf, req, pFwupgCtx); ! if (!rsp){ ! lprintf(LOG_NOTICE, ! "Error getting upgrade status. Failed to get response."); ! return HPMFWUPG_ERROR; ! } ! if ( rsp->ccode == 0x00 ) { ! memcpy(&pCtx->resp, rsp->data, ! sizeof(struct HpmfwupgGetUpgradeStatusResp)); ! if (!silent) ! { ! lprintf(LOG_NOTICE,"Upgrade status:"); ! lprintf(LOG_NOTICE," Command in progress: %x", ! pCtx->resp.cmdInProcess); ! lprintf(LOG_NOTICE," Last command completion code: %x", ! pCtx->resp.lastCmdCompCode); ! } ! } else if ( HPMFWUPG_IS_RETRYABLE(rsp->ccode) ) { ! /* ! * PATCH --> This validation is to handle retryable errors ! * codes on the IPMB bus. ! * This will be fixed in the next release of ! * open ipmi and this check can be removed. ! * (Buggy version = 39) ! */ ! if (!silent) ! { ! lprintf(LOG_DEBUG,"HPM: Retryable error detected"); ! } ! pCtx->resp.lastCmdCompCode = HPMFWUPG_COMMAND_IN_PROGRESS; ! } else { lprintf(LOG_NOTICE,"Error getting upgrade status"); lprintf(LOG_NOTICE,"compcode=0x%x: %s", rsp->ccode, val2str(rsp->ccode, completion_code_vals)); ! return HPMFWUPG_ERROR; ! } ! return HPMFWUPG_SUCCESS; } *************** *** 3699,3703 **** timeoutSec1 = time(NULL); timeoutSec2 = time(NULL); ! rc = HpmfwupgGetUpgradeStatus(intf, &upgStatusCmd, pFwupgCtx); } --- 3692,3696 ---- timeoutSec1 = time(NULL); timeoutSec2 = time(NULL); ! rc = HpmfwupgGetUpgradeStatus(intf, &upgStatusCmd, pFwupgCtx, 1); } *************** *** 3712,3716 **** usleep(1000000); timeoutSec2 = time(NULL); ! rc = HpmfwupgGetUpgradeStatus(intf, &upgStatusCmd, pFwupgCtx); //printf("Get Status: %x - %x = %x _ %x [%x]\n", timeoutSec2, timeoutSec1,(timeoutSec2 - timeoutSec1),upgradeTimeout, rc); } --- 3705,3709 ---- usleep(1000000); timeoutSec2 = time(NULL); ! rc = HpmfwupgGetUpgradeStatus(intf, &upgStatusCmd, pFwupgCtx, 1); //printf("Get Status: %x - %x = %x _ %x [%x]\n", timeoutSec2, timeoutSec1,(timeoutSec2 - timeoutSec1),upgradeTimeout, rc); } *************** *** 3938,3942 **** struct HpmfwupgGetUpgradeStatusCtx cmdCtx; verbose++; ! rc = HpmfwupgGetUpgradeStatus(intf, &cmdCtx, NULL); } else if ( (argc == 1) && (strcmp(argv[0], "rollback") == 0) ) --- 3931,3935 ---- struct HpmfwupgGetUpgradeStatusCtx cmdCtx; verbose++; ! rc = HpmfwupgGetUpgradeStatus(intf, &cmdCtx, NULL, 0); } else if ( (argc == 1) && (strcmp(argv[0], "rollback") == 0) ) |