mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-11 02:57:22 +00:00
ID: 46 - ipmi_fwum needs some re-work
KfwumGetInfo() - simplify logic, code formatting
This commit is contained in:
parent
068bcb02e4
commit
3df72b68bc
@ -582,23 +582,17 @@ static tKFWUM_Status KfwumGetInfo(struct ipmi_intf * intf, unsigned char output,
|
|||||||
req.msg.data_len = 0;
|
req.msg.data_len = 0;
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
|
if (!rsp) {
|
||||||
if (!rsp)
|
lprintf(LOG_ERR, "Error in FWUM Firmware Get Info Command.");
|
||||||
{
|
return KFWUM_STATUS_ERROR;
|
||||||
printf("Error in FWUM Firmware Get Info Command\n");
|
} else if (rsp->ccode != 0) {
|
||||||
status = KFWUM_STATUS_ERROR;
|
lprintf(LOG_ERR, "FWUM Firmware Get Info returned %x\n",
|
||||||
}
|
rsp->ccode);
|
||||||
else if (rsp->ccode)
|
return KFWUM_STATUS_ERROR;
|
||||||
{
|
|
||||||
printf("FWUM Firmware Get Info returned %x\n", rsp->ccode);
|
|
||||||
status = KFWUM_STATUS_ERROR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(status == KFWUM_STATUS_OK)
|
|
||||||
{
|
|
||||||
pGetInfo = (struct KfwumGetInfoResp *)rsp->data;
|
pGetInfo = (struct KfwumGetInfoResp *)rsp->data;
|
||||||
if(output)
|
if (output) {
|
||||||
{
|
|
||||||
printf("\nFWUM info\n");
|
printf("\nFWUM info\n");
|
||||||
printf("=========\n");
|
printf("=========\n");
|
||||||
printf("Protocol Revision : %02Xh\n",
|
printf("Protocol Revision : %02Xh\n",
|
||||||
@ -608,84 +602,59 @@ static tKFWUM_Status KfwumGetInfo(struct ipmi_intf * intf, unsigned char output,
|
|||||||
printf("Firmware Revision : %u.%u%u",
|
printf("Firmware Revision : %u.%u%u",
|
||||||
pGetInfo->firmRev1, pGetInfo->firmRev2 >> 4,
|
pGetInfo->firmRev1, pGetInfo->firmRev2 >> 4,
|
||||||
pGetInfo->firmRev2 & 0x0f);
|
pGetInfo->firmRev2 & 0x0f);
|
||||||
if(pGetInfo->byte.mode != 0)
|
if (pGetInfo->byte.mode != 0) {
|
||||||
{
|
|
||||||
printf(" - DEBUG BUILD\n");
|
printf(" - DEBUG BUILD\n");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
printf("Number Of Memory Bank : %u\n", pGetInfo->numBank);
|
printf("Number Of Memory Bank : %u\n", pGetInfo->numBank);
|
||||||
}
|
}
|
||||||
*pNumBank = pGetInfo->numBank;
|
*pNumBank = pGetInfo->numBank;
|
||||||
|
|
||||||
/* Determine wich type of download to use: */
|
/* Determine wich type of download to use: */
|
||||||
/* Old FWUM or Old IPMC fw (data_len < 7) -->
|
/* Old FWUM or Old IPMC fw (data_len < 7)
|
||||||
Address with small buffer size */
|
* --> Address with small buffer size
|
||||||
if ( (pGetInfo->protocolRevision) <= 0x05 || (rsp->data_len < 7 ) )
|
*/
|
||||||
{
|
if ((pGetInfo->protocolRevision) <= 0x05 || (rsp->data_len < 7 )) {
|
||||||
saveFirmwareInfo.downloadType = KFWUM_DOWNLOAD_TYPE_ADDRESS;
|
saveFirmwareInfo.downloadType = KFWUM_DOWNLOAD_TYPE_ADDRESS;
|
||||||
saveFirmwareInfo.bufferSize = KFWUM_SMALL_BUFFER;
|
saveFirmwareInfo.bufferSize = KFWUM_SMALL_BUFFER;
|
||||||
saveFirmwareInfo.overheadSize = KFWUM_OLD_CMD_OVERHEAD;
|
saveFirmwareInfo.overheadSize = KFWUM_OLD_CMD_OVERHEAD;
|
||||||
|
if (verbose) {
|
||||||
if(verbose)
|
|
||||||
{
|
|
||||||
printf("Protocol Revision :");
|
printf("Protocol Revision :");
|
||||||
printf(" <= 5 detected, adjusting buffers\n");
|
printf(" <= 5 detected, adjusting buffers\n");
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else /* Both fw are using the new protocol */
|
/* Both fw are using the new protocol */
|
||||||
{
|
|
||||||
saveFirmwareInfo.downloadType = KFWUM_DOWNLOAD_TYPE_SEQUENCE;
|
saveFirmwareInfo.downloadType = KFWUM_DOWNLOAD_TYPE_SEQUENCE;
|
||||||
saveFirmwareInfo.overheadSize = KFWUM_NEW_CMD_OVERHEAD;
|
saveFirmwareInfo.overheadSize = KFWUM_NEW_CMD_OVERHEAD;
|
||||||
/* Buffer size depending on access type (Local or remote) */
|
/* Buffer size depending on access type (Local or remote) */
|
||||||
/* Look if we run remote or locally */
|
/* Look if we run remote or locally */
|
||||||
|
if (verbose) {
|
||||||
if(verbose)
|
|
||||||
{
|
|
||||||
printf("Protocol Revision :");
|
printf("Protocol Revision :");
|
||||||
printf(" > 5 optimizing buffers\n");
|
printf(" > 5 optimizing buffers\n");
|
||||||
}
|
}
|
||||||
|
if (strstr(intf->name,"lan") != NULL) {
|
||||||
if(strstr(intf->name,"lan")!= NULL) /* also covers lanplus */
|
/* also covers lanplus */
|
||||||
{
|
|
||||||
saveFirmwareInfo.bufferSize = KFWUM_SMALL_BUFFER;
|
saveFirmwareInfo.bufferSize = KFWUM_SMALL_BUFFER;
|
||||||
if(verbose)
|
if (verbose) {
|
||||||
{
|
|
||||||
printf("IOL payload size : %d\n",
|
printf("IOL payload size : %d\n",
|
||||||
saveFirmwareInfo.bufferSize);
|
saveFirmwareInfo.bufferSize);
|
||||||
}
|
}
|
||||||
}
|
} else if ((strstr(intf->name,"open")!= NULL)
|
||||||
else if
|
&& intf->target_addr != IPMI_BMC_SLAVE_ADDR
|
||||||
(
|
&& (intf->target_addr != intf->my_addr)) {
|
||||||
(strstr(intf->name,"open")!= NULL)
|
|
||||||
&&
|
|
||||||
intf->target_addr != IPMI_BMC_SLAVE_ADDR
|
|
||||||
&&
|
|
||||||
(
|
|
||||||
intf->target_addr != intf->my_addr
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
saveFirmwareInfo.bufferSize = KFWUM_SMALL_BUFFER;
|
saveFirmwareInfo.bufferSize = KFWUM_SMALL_BUFFER;
|
||||||
if(verbose)
|
if (verbose) {
|
||||||
{
|
|
||||||
printf("IPMB payload size : %d\n",
|
printf("IPMB payload size : %d\n",
|
||||||
saveFirmwareInfo.bufferSize);
|
saveFirmwareInfo.bufferSize);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
saveFirmwareInfo.bufferSize = KFWUM_BIG_BUFFER;
|
saveFirmwareInfo.bufferSize = KFWUM_BIG_BUFFER;
|
||||||
if(verbose)
|
if (verbose) {
|
||||||
{
|
|
||||||
printf("SMI payload size : %d\n",
|
printf("SMI payload size : %d\n",
|
||||||
saveFirmwareInfo.bufferSize);
|
saveFirmwareInfo.bufferSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user