mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
ID: 46 - ipmi_fwum needs some re-work
KfwumGetDeviceInfo() - simplify, code formatting
This commit is contained in:
parent
3df72b68bc
commit
700658e91e
@ -658,73 +658,55 @@ static tKFWUM_Status KfwumGetInfo(struct ipmi_intf * intf, unsigned char output,
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* KfwumGetDeviceInfo - Get IPMC/Board information
|
/* KfwumGetDeviceInfo - Get IPMC/Board information
|
||||||
*
|
*
|
||||||
* * intf : IPMI interface
|
* *intf: IPMI interface
|
||||||
* output : when set to non zero, queried information is displayed
|
* output: when set to non zero, queried information is displayed
|
||||||
* tKFWUM_BoardInfo: output ptr for IPMC/Board information
|
* tKFWUM_BoardInfo: output ptr for IPMC/Board information
|
||||||
|
*
|
||||||
|
* returns KFWUM_STATUS_OK on success, otherwise KFWUM_STATUS_ERROR
|
||||||
*/
|
*/
|
||||||
static tKFWUM_Status KfwumGetDeviceInfo(struct ipmi_intf * intf,
|
static tKFWUM_Status KfwumGetDeviceInfo(struct ipmi_intf *intf,
|
||||||
unsigned char output, tKFWUM_BoardInfo * pBoardInfo)
|
unsigned char output, tKFWUM_BoardInfo *pBoardInfo)
|
||||||
{
|
{
|
||||||
struct ipm_devid_rsp *pGetDevId;
|
struct ipm_devid_rsp *pGetDevId;
|
||||||
tKFWUM_Status status = KFWUM_STATUS_OK;
|
struct ipmi_rs *rsp;
|
||||||
struct ipmi_rs * rsp;
|
struct ipmi_rq req;
|
||||||
struct ipmi_rq req;
|
/* Send Get Device Id */
|
||||||
|
memset(&req, 0, sizeof(req));
|
||||||
|
req.msg.netfn = IPMI_NETFN_APP;
|
||||||
|
req.msg.cmd = BMC_GET_DEVICE_ID;
|
||||||
|
req.msg.data_len = 0;
|
||||||
|
|
||||||
/* Send Get Device Id */
|
rsp = intf->sendrecv(intf, &req);
|
||||||
if(status == KFWUM_STATUS_OK)
|
if (rsp == NULL) {
|
||||||
{
|
lprintf(LOG_ERR, "Error in Get Device Id Command");
|
||||||
memset(&req, 0, sizeof(req));
|
return KFWUM_STATUS_ERROR;
|
||||||
req.msg.netfn = IPMI_NETFN_APP;
|
} else if (rsp->ccode != 0) {
|
||||||
req.msg.cmd = BMC_GET_DEVICE_ID;
|
lprintf(LOG_ERR, "Get Device Id returned %x",
|
||||||
req.msg.data_len = 0;
|
rsp->ccode);
|
||||||
|
return KFWUM_STATUS_ERROR;
|
||||||
rsp = intf->sendrecv(intf, &req);
|
}
|
||||||
if (!rsp)
|
pGetDevId = (struct ipm_devid_rsp *)rsp->data;
|
||||||
{
|
pBoardInfo->iana = IPM_DEV_MANUFACTURER_ID(pGetDevId->manufacturer_id);
|
||||||
printf("Error in Get Device Id Command\n");
|
pBoardInfo->boardId = buf2short(pGetDevId->product_id);
|
||||||
status = KFWUM_STATUS_ERROR;
|
if (output) {
|
||||||
}
|
printf("\nIPMC Info\n");
|
||||||
else if (rsp->ccode)
|
printf("=========\n");
|
||||||
{
|
printf("Manufacturer Id : %u\n",
|
||||||
printf("Get Device Id returned %x\n", rsp->ccode);
|
pBoardInfo->iana);
|
||||||
status = KFWUM_STATUS_ERROR;
|
printf("Board Id : %u\n",
|
||||||
}
|
pBoardInfo->boardId);
|
||||||
}
|
printf("Firmware Revision : %u.%u%u",
|
||||||
|
pGetDevId->fw_rev1, pGetDevId->fw_rev2 >> 4,
|
||||||
if(status == KFWUM_STATUS_OK)
|
pGetDevId->fw_rev2 & 0x0f);
|
||||||
{
|
if (((pBoardInfo->iana == KFWUM_IANA_KONTRON)
|
||||||
pGetDevId = (struct ipm_devid_rsp *) rsp->data;
|
&& (pBoardInfo->boardId = KFWUM_BOARD_KONTRON_5002))) {
|
||||||
pBoardInfo->iana = IPM_DEV_MANUFACTURER_ID(pGetDevId->manufacturer_id);
|
printf(" SDR %u", pGetDevId->aux_fw_rev[0]);
|
||||||
pBoardInfo->boardId = buf2short(pGetDevId->product_id);
|
}
|
||||||
if(output)
|
printf("\n");
|
||||||
{
|
}
|
||||||
printf("\nIPMC Info\n");
|
return KFWUM_STATUS_OK;
|
||||||
printf("=========\n");
|
|
||||||
printf("Manufacturer Id : %u\n",pBoardInfo->iana);
|
|
||||||
printf("Board Id : %u\n",pBoardInfo->boardId);
|
|
||||||
printf("Firmware Revision : %u.%u%u",
|
|
||||||
pGetDevId->fw_rev1, pGetDevId->fw_rev2 >> 4,
|
|
||||||
pGetDevId->fw_rev2 & 0x0f);
|
|
||||||
if(
|
|
||||||
(
|
|
||||||
( pBoardInfo->iana == KFWUM_IANA_KONTRON)
|
|
||||||
&&
|
|
||||||
(pBoardInfo->boardId = KFWUM_BOARD_KONTRON_5002)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
printf(" SDR %u\n", pGetDevId->aux_fw_rev[0]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user