- Add support for BIG Buffer (Use when -z option is used)

This commit is contained in:
Jean-Michel Audet 2010-04-16 13:41:21 +00:00
parent c098938a4b
commit ea105cd83b

View File

@ -595,7 +595,7 @@ struct HpmfwupgInitiateUpgradeActionCtx
* UPLOAD FIRMWARE BLOCK DEFINITIONS * UPLOAD FIRMWARE BLOCK DEFINITIONS
*/ */
#define HPMFWUPG_SEND_DATA_COUNT_MAX 32 #define HPMFWUPG_SEND_DATA_COUNT_MAX 128
#define HPMFWUPG_SEND_DATA_COUNT_KCS 30 #define HPMFWUPG_SEND_DATA_COUNT_KCS 30
#define HPMFWUPG_SEND_DATA_COUNT_LAN 25 #define HPMFWUPG_SEND_DATA_COUNT_LAN 25
#define HPMFWUPG_SEND_DATA_COUNT_IPMB 26 #define HPMFWUPG_SEND_DATA_COUNT_IPMB 26
@ -2242,43 +2242,50 @@ static int HpmFwupgActionUploadFirmware
skip = FALSE; skip = FALSE;
} }
if(!skip) if(!skip)
{ {
/* Initialize parameters */ /* Initialize parameters */
uploadCmd.req.blockNumber = 0; uploadCmd.req.blockNumber = 0;
/* Find max buffer length according the connection parameters */ /* Check if we receive size in parameters */
if ( strstr(intf->name,"lan") != NULL ) if(intf->channel_buf_size != 0)
{ {
bufLength = HPMFWUPG_SEND_DATA_COUNT_LAN - 2; bufLength = intf->channel_buf_size - 9; /* Plan for overhead */
if ( intf->transit_addr != intf->my_addr && intf->transit_addr != 0 )
bufLength -= 8;
} }
else else
{ {
if /* Find max buffer length according the connection parameters */
( if ( strstr(intf->name,"lan") != NULL )
strstr(intf->name,"open") != NULL {
&& bufLength = HPMFWUPG_SEND_DATA_COUNT_LAN - 2;
( if ( intf->transit_addr != intf->my_addr && intf->transit_addr != 0 )
intf->target_addr == intf->my_addr bufLength -= 8;
) }
) else
{ {
bufLength = HPMFWUPG_SEND_DATA_COUNT_KCS - 2; if
} (
else strstr(intf->name,"open") != NULL
{ &&
if ( intf->target_channel == 7 ) (
{ intf->target_addr == intf->my_addr
bufLength = HPMFWUPG_SEND_DATA_COUNT_IPMBL; )
} )
else {
{ bufLength = HPMFWUPG_SEND_DATA_COUNT_KCS - 2;
bufLength = HPMFWUPG_SEND_DATA_COUNT_IPMB; }
} else
} {
if ( intf->target_channel == 7 )
{
bufLength = HPMFWUPG_SEND_DATA_COUNT_IPMBL;
}
else
{
bufLength = HPMFWUPG_SEND_DATA_COUNT_IPMB;
}
}
}
} }
/* Send Initiate Upgrade Action */ /* Send Initiate Upgrade Action */
@ -2304,6 +2311,7 @@ static int HpmFwupgActionUploadFirmware
totalSent = 0x00; totalSent = 0x00;
displayFWLength= firmwareLength; displayFWLength= firmwareLength;
time(&start); time(&start);
while ( (pData < (pDataTemp+lengthOfBlock)) && (rc == HPMFWUPG_SUCCESS) ) while ( (pData < (pDataTemp+lengthOfBlock)) && (rc == HPMFWUPG_SUCCESS) )
{ {
if ( (pData+bufLength) <= (pDataTemp+lengthOfBlock) ) if ( (pData+bufLength) <= (pDataTemp+lengthOfBlock) )
@ -2331,14 +2339,12 @@ static int HpmFwupgActionUploadFirmware
if ( strstr(intf->name,"lan") != NULL ) if ( strstr(intf->name,"lan") != NULL )
{ {
bufLength -= (unsigned char)8; bufLength -= (unsigned char)8;
lprintf(LOG_INFO,"Trying reduced buffer length: %d", lprintf(LOG_INFO,"Trying reduced buffer length: %d", bufLength);
bufLength);
} }
else else
{ {
bufLength -= (unsigned char)1; bufLength -= (unsigned char)1;
lprintf(LOG_INFO,"Trying reduced buffer length: %d", lprintf(LOG_INFO,"Trying reduced buffer length: %d", bufLength);
bufLength);
} }
rc = HPMFWUPG_SUCCESS; rc = HPMFWUPG_SUCCESS;
} }
@ -2914,11 +2920,7 @@ int HpmfwupgUploadFirmwareBlock(struct ipmi_intf *intf, struct HpmfwupgUploadFir
{ {
rc = HpmfwupgWaitLongDurationCmd(intf, pFwupgCtx); rc = HpmfwupgWaitLongDurationCmd(intf, pFwupgCtx);
} }
/* else if (rsp->ccode != 0x00)
* If we get 0xcc here this is probably because we send an invalid sequence
* number (Packet sent twice). Continue as if we had no error.
*/
else if ( (rsp->ccode != 0x00) && (rsp->ccode != 0xcc) )
{ {
/* /*
* PATCH --> This validation is to handle retryables errors codes on IPMB bus. * PATCH --> This validation is to handle retryables errors codes on IPMB bus.
@ -3431,7 +3433,6 @@ struct ipmi_rs * HpmfwupgSendCmd(struct ipmi_intf *intf, struct ipmi_rq req,
lprintf(LOG_DEBUG,"HPM: upg/rollback status firmware API called"); lprintf(LOG_DEBUG,"HPM: upg/rollback status firmware API called");
lprintf(LOG_DEBUG,"HPM: try to re-open IOL session"); lprintf(LOG_DEBUG,"HPM: try to re-open IOL session");
if ( intf->target_addr == intf->my_addr )
{ {
/* force session re-open */ /* force session re-open */
intf->opened = 0; intf->opened = 0;