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
Finish off formatting, remove useless comments Commit finishes off formatting changes and removes useless, out-of-date, comments.
This commit is contained in:
parent
5bf68a4769
commit
24923222f6
@ -33,7 +33,6 @@
|
||||
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
@ -46,20 +45,9 @@
|
||||
#include <ipmitool/ipmi_intf.h>
|
||||
#include <ipmitool/ipmi_mc.h>
|
||||
|
||||
/******************************************************************************
|
||||
* HISTORY
|
||||
* ===========================================================================
|
||||
* 2007-01-11 [FI]
|
||||
* - Incremented to version 1.3
|
||||
* - Added lan packet size reduction mechanism to workaround fact
|
||||
* that lan iface will not return C7 on excessive length
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#define VERSION_MAJ 1
|
||||
#define VERSION_MIN 3
|
||||
|
||||
|
||||
typedef enum eKFWUM_Task
|
||||
{
|
||||
KFWUM_TASK_INFO,
|
||||
@ -69,42 +57,42 @@ typedef enum eKFWUM_Task
|
||||
KFWUM_TASK_START_UPGRADE,
|
||||
KFWUM_TASK_ROLLBACK,
|
||||
KFWUM_TASK_TRACELOG
|
||||
}tKFWUM_Task;
|
||||
} tKFWUM_Task;
|
||||
|
||||
typedef enum eKFWUM_BoardList
|
||||
{
|
||||
KFWUM_BOARD_KONTRON_UNKNOWN = 0,
|
||||
KFWUM_BOARD_KONTRON_5002 = 5002,
|
||||
}tKFWUM_BoardList;
|
||||
} tKFWUM_BoardList;
|
||||
|
||||
typedef enum eKFWUM_IanaList
|
||||
{
|
||||
KFWUM_IANA_KONTRON = 15000,
|
||||
}tKFWUM_IanaList;
|
||||
} tKFWUM_IanaList;
|
||||
|
||||
typedef struct sKFWUM_BoardInfo
|
||||
{
|
||||
tKFWUM_BoardList boardId;
|
||||
tKFWUM_IanaList iana;
|
||||
}tKFWUM_BoardInfo;
|
||||
} tKFWUM_BoardInfo;
|
||||
|
||||
typedef enum eKFWUM_Status
|
||||
{
|
||||
KFWUM_STATUS_OK,
|
||||
KFWUM_STATUS_ERROR
|
||||
}tKFWUM_Status;
|
||||
} tKFWUM_Status;
|
||||
|
||||
typedef enum eKFWUM_DownloadType
|
||||
{
|
||||
KFWUM_DOWNLOAD_TYPE_ADDRESS = 0,
|
||||
KFWUM_DOWNLOAD_TYPE_SEQUENCE,
|
||||
}tKFWUM_DownloadType;
|
||||
} tKFWUM_DownloadType;
|
||||
|
||||
typedef enum eKFWUM_DownloadBuffferType
|
||||
{
|
||||
KFWUM_SMALL_BUFFER_TYPE = 0,
|
||||
KFUMW_BIG_BUFFER_TYPE
|
||||
}tKFWUM_DownloadBuffferType;
|
||||
} tKFWUM_DownloadBuffferType;
|
||||
|
||||
typedef struct sKFWUM_InFirmwareInfo
|
||||
{
|
||||
@ -112,9 +100,10 @@ typedef struct sKFWUM_InFirmwareInfo
|
||||
unsigned short checksum;
|
||||
unsigned short sumToRemoveFromChecksum;
|
||||
/* Since the checksum is added in the bin
|
||||
after the checksum is calculated, we
|
||||
need to remove the each byte value. This
|
||||
byte will contain the addition of both bytes*/
|
||||
* after the checksum is calculated, we
|
||||
* need to remove the each byte value. This
|
||||
* byte will contain the addition of both bytes
|
||||
*/
|
||||
tKFWUM_BoardList boardId;
|
||||
unsigned char deviceId;
|
||||
unsigned char tableVers;
|
||||
@ -124,20 +113,24 @@ typedef struct sKFWUM_InFirmwareInfo
|
||||
unsigned char versSubMinor;
|
||||
unsigned char sdrRev;
|
||||
tKFWUM_IanaList iana;
|
||||
}tKFWUM_InFirmwareInfo;
|
||||
} tKFWUM_InFirmwareInfo;
|
||||
|
||||
typedef struct sKFWUM_SaveFirmwareInfo
|
||||
{
|
||||
tKFWUM_DownloadType downloadType;
|
||||
unsigned char bufferSize;
|
||||
unsigned char overheadSize;
|
||||
}tKFWUM_SaveFirmwareInfo;
|
||||
} tKFWUM_SaveFirmwareInfo;
|
||||
|
||||
#define KFWUM_SMALL_BUFFER 32 /* Minimum size (IPMB/IOL/old protocol) */
|
||||
#define KFWUM_BIG_BUFFER 32 /* Maximum size on KCS interface */
|
||||
/* Minimum size (IPMB/IOL/old protocol) */
|
||||
#define KFWUM_SMALL_BUFFER 32
|
||||
/* Maximum size on KCS interface */
|
||||
#define KFWUM_BIG_BUFFER 32
|
||||
|
||||
#define KFWUM_OLD_CMD_OVERHEAD 6 /*3 address + 1 size + 1 checksum + 1 command*/
|
||||
#define KFWUM_NEW_CMD_OVERHEAD 4 /*1 sequence+ 1 size + 1 checksum + 1 command*/
|
||||
/* 3 address + 1 size + 1 checksum + 1 command */
|
||||
#define KFWUM_OLD_CMD_OVERHEAD 6
|
||||
/* 1 sequence + 1 size + 1 checksum + 1 command */
|
||||
#define KFWUM_NEW_CMD_OVERHEAD 4
|
||||
#define KFWUM_PAGE_SIZE 256
|
||||
|
||||
extern int verbose;
|
||||
@ -146,56 +139,51 @@ static unsigned char firmBuf[1024*512];
|
||||
static tKFWUM_SaveFirmwareInfo saveFirmwareInfo;
|
||||
|
||||
void printf_kfwum_help(void);
|
||||
static void KfwumMain(struct ipmi_intf * intf, tKFWUM_Task task);
|
||||
static tKFWUM_Status KfwumGetFileSize(unsigned char * pFileName,
|
||||
unsigned long * pFileSize);
|
||||
static tKFWUM_Status KfwumSetupBuffersFromFile(unsigned char * pFileName,
|
||||
static void KfwumMain(struct ipmi_intf *intf, tKFWUM_Task task);
|
||||
static tKFWUM_Status KfwumGetFileSize(unsigned char *pFileName,
|
||||
unsigned long *pFileSize);
|
||||
static tKFWUM_Status KfwumSetupBuffersFromFile(unsigned char *pFileName,
|
||||
unsigned long fileSize);
|
||||
void KfwumShowProgress(const char *task, unsigned long current,
|
||||
unsigned long total);
|
||||
static unsigned short KfwumCalculateChecksumPadding(unsigned char * pBuffer,
|
||||
static unsigned short KfwumCalculateChecksumPadding(unsigned char *pBuffer,
|
||||
unsigned long totalSize);
|
||||
|
||||
|
||||
static tKFWUM_Status KfwumGetInfo(struct ipmi_intf * intf, unsigned char output,
|
||||
static tKFWUM_Status KfwumGetInfo(struct ipmi_intf *intf, unsigned char output,
|
||||
unsigned char *pNumBank);
|
||||
static tKFWUM_Status KfwumGetDeviceInfo(struct ipmi_intf * intf,
|
||||
unsigned char output, tKFWUM_BoardInfo * pBoardInfo);
|
||||
static tKFWUM_Status KfwumGetStatus(struct ipmi_intf * intf);
|
||||
static tKFWUM_Status KfwumManualRollback(struct ipmi_intf * intf);
|
||||
static tKFWUM_Status KfwumStartFirmwareImage(struct ipmi_intf * intf,
|
||||
unsigned long length,unsigned short padding);
|
||||
static tKFWUM_Status KfwumSaveFirmwareImage(struct ipmi_intf * intf,
|
||||
static tKFWUM_Status KfwumGetDeviceInfo(struct ipmi_intf *intf,
|
||||
unsigned char output, tKFWUM_BoardInfo *pBoardInfo);
|
||||
static tKFWUM_Status KfwumGetStatus(struct ipmi_intf *intf);
|
||||
static tKFWUM_Status KfwumManualRollback(struct ipmi_intf *intf);
|
||||
static tKFWUM_Status KfwumStartFirmwareImage(struct ipmi_intf *intf,
|
||||
unsigned long length, unsigned short padding);
|
||||
static tKFWUM_Status KfwumSaveFirmwareImage(struct ipmi_intf *intf,
|
||||
unsigned char sequenceNumber, unsigned long address,
|
||||
unsigned char *pFirmBuf, unsigned char * pInBufLength);
|
||||
static tKFWUM_Status KfwumFinishFirmwareImage(struct ipmi_intf * intf,
|
||||
unsigned char *pFirmBuf, unsigned char *pInBufLength);
|
||||
static tKFWUM_Status KfwumFinishFirmwareImage(struct ipmi_intf *intf,
|
||||
tKFWUM_InFirmwareInfo firmInfo);
|
||||
static tKFWUM_Status KfwumUploadFirmware(struct ipmi_intf * intf,
|
||||
unsigned char * pBuffer, unsigned long totalSize);
|
||||
static tKFWUM_Status KfwumStartFirmwareUpgrade(struct ipmi_intf * intf);
|
||||
|
||||
static tKFWUM_Status KfwumGetInfoFromFirmware(unsigned char * pBuf,
|
||||
unsigned long bufSize, tKFWUM_InFirmwareInfo * pInfo);
|
||||
static void KfwumFixTableVersionForOldFirmware(tKFWUM_InFirmwareInfo * pInfo);
|
||||
|
||||
static tKFWUM_Status KfwumGetTraceLog(struct ipmi_intf * intf);
|
||||
|
||||
static tKFWUM_Status KfwumUploadFirmware(struct ipmi_intf *intf,
|
||||
unsigned char *pBuffer, unsigned long totalSize);
|
||||
static tKFWUM_Status KfwumStartFirmwareUpgrade(struct ipmi_intf *intf);
|
||||
static tKFWUM_Status KfwumGetInfoFromFirmware(unsigned char *pBuf,
|
||||
unsigned long bufSize, tKFWUM_InFirmwareInfo *pInfo);
|
||||
static void KfwumFixTableVersionForOldFirmware(tKFWUM_InFirmwareInfo *pInfo);
|
||||
static tKFWUM_Status KfwumGetTraceLog(struct ipmi_intf *intf);
|
||||
tKFWUM_Status ipmi_kfwum_checkfwcompat(tKFWUM_BoardInfo boardInfo,
|
||||
tKFWUM_InFirmwareInfo firmInfo);
|
||||
void printf_kfwum_info(tKFWUM_BoardInfo boardInfo,
|
||||
tKFWUM_InFirmwareInfo firmInfo);
|
||||
|
||||
|
||||
/* ipmi_fwum_main - entry point for this ipmitool mode
|
||||
*
|
||||
* @intf: ipmi interface
|
||||
* @arc : number of arguments
|
||||
* @argv : point to argument array
|
||||
* @arc: number of arguments
|
||||
* @argv: point to argument array
|
||||
*
|
||||
* returns 0 on success
|
||||
* returns -1 on error
|
||||
*/
|
||||
int ipmi_fwum_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
int
|
||||
ipmi_fwum_main(struct ipmi_intf *intf, int argc, char **argv)
|
||||
{
|
||||
int rc = 0;
|
||||
printf("FWUM extension Version %d.%d\n", VERSION_MAJ, VERSION_MIN);
|
||||
@ -252,17 +240,14 @@ int ipmi_fwum_main(struct ipmi_intf * intf, int argc, char ** argv)
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
void printf_kfwum_help(void)
|
||||
void
|
||||
printf_kfwum_help(void)
|
||||
{
|
||||
lprintf(LOG_NOTICE,
|
||||
"KFWUM Commands: info status download upgrade rollback tracelog");
|
||||
}
|
||||
|
||||
|
||||
/****************************************/
|
||||
/** private definitions and macros **/
|
||||
/****************************************/
|
||||
/* private definitions and macros */
|
||||
typedef enum eFWUM_CmdId
|
||||
{
|
||||
KFWUM_CMD_ID_GET_FIRMWARE_INFO = 0,
|
||||
@ -282,36 +267,15 @@ typedef enum eFWUM_CmdId
|
||||
KFWUM_CMD_ID_EXTENDED_CMD = 0xC0
|
||||
} tKFWUM_CmdId;
|
||||
|
||||
|
||||
|
||||
/****************************************/
|
||||
/** global/static variables definition **/
|
||||
/****************************************/
|
||||
|
||||
/****************************************/
|
||||
/** functions definition **/
|
||||
/****************************************/
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Function Name: KfwumMain
|
||||
*
|
||||
* Description: This function implements the upload of the firware data
|
||||
* received as parameters.
|
||||
*
|
||||
* Restriction: Called only from main
|
||||
*
|
||||
* Input: unsigned char * pBuffer[] : The buffers
|
||||
* unsigned long bufSize : The size of the buffers
|
||||
*
|
||||
* Output: None
|
||||
*
|
||||
* Global: none
|
||||
*
|
||||
* Return: tIFWU_Status (success or failure)
|
||||
*
|
||||
*******************************************************************************/
|
||||
static void KfwumMain(struct ipmi_intf * intf, tKFWUM_Task task)
|
||||
/* KfwumMain - function implements upload of the firmware data received as
|
||||
* parameters
|
||||
*
|
||||
* @task: task to do
|
||||
*
|
||||
* returns void
|
||||
*/
|
||||
static void
|
||||
KfwumMain(struct ipmi_intf *intf, tKFWUM_Task task)
|
||||
{
|
||||
tKFWUM_Status status = KFWUM_STATUS_OK;
|
||||
tKFWUM_BoardInfo boardInfo;
|
||||
@ -398,8 +362,8 @@ static void KfwumMain(struct ipmi_intf * intf, tKFWUM_Task task)
|
||||
*
|
||||
* returns KFWUM_STATUS_OK or KFWUM_STATUS_ERROR
|
||||
*/
|
||||
static tKFWUM_Status KfwumGetFileSize(unsigned char *pFileName,
|
||||
unsigned long *pFileSize)
|
||||
static tKFWUM_Status
|
||||
KfwumGetFileSize(unsigned char *pFileName, unsigned long *pFileSize)
|
||||
{
|
||||
FILE *pFileHandle = NULL;
|
||||
pFileHandle = fopen((const char *)pFileName, "rb");
|
||||
@ -424,8 +388,8 @@ static tKFWUM_Status KfwumGetFileSize(unsigned char *pFileName,
|
||||
* returns KFWUM_STATUS_OK or KFWUM_STATUS_ERROR
|
||||
*/
|
||||
#define MAX_BUFFER_SIZE 1024*16
|
||||
static tKFWUM_Status KfwumSetupBuffersFromFile(unsigned char * pFileName,
|
||||
unsigned long fileSize)
|
||||
static tKFWUM_Status
|
||||
KfwumSetupBuffersFromFile(unsigned char * pFileName, unsigned long fileSize)
|
||||
{
|
||||
tKFWUM_Status status = KFWUM_STATUS_ERROR;
|
||||
FILE *pFileHandle = NULL;
|
||||
@ -443,7 +407,7 @@ static tKFWUM_Status KfwumSetupBuffersFromFile(unsigned char * pFileName,
|
||||
modulus = fileSize % MAX_BUFFER_SIZE;
|
||||
|
||||
rewind(pFileHandle);
|
||||
for (qty=0; qty < count; qty++) {
|
||||
for (qty = 0; qty < count; qty++) {
|
||||
KfwumShowProgress("Reading Firmware from File",
|
||||
qty, count);
|
||||
if (fread(&firmBuf[qty * MAX_BUFFER_SIZE], 1,
|
||||
@ -480,8 +444,8 @@ KfwumShowProgress(const char *task, unsigned long current, unsigned long total)
|
||||
static unsigned long staticProgress=0xffffffff;
|
||||
unsigned char spaces[PROG_LENGTH + 1];
|
||||
unsigned short hash;
|
||||
float percent = ((float)current/total);
|
||||
unsigned long progress = 100*(percent);
|
||||
float percent = ((float)current / total);
|
||||
unsigned long progress = 100 * (percent);
|
||||
|
||||
if (staticProgress == progress) {
|
||||
/* We displayed the same last time.. so don't do it */
|
||||
@ -490,7 +454,7 @@ KfwumShowProgress(const char *task, unsigned long current, unsigned long total)
|
||||
staticProgress = progress;
|
||||
printf("%-25s : ", task); /* total 20 bytes */
|
||||
hash = (percent * PROG_LENGTH);
|
||||
memset(spaces,'#', hash);
|
||||
memset(spaces, '#', hash);
|
||||
spaces[hash] = '\0';
|
||||
|
||||
printf("%s", spaces);
|
||||
@ -505,38 +469,29 @@ KfwumShowProgress(const char *task, unsigned long current, unsigned long total)
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
/* KfwumCalculateChecksumPadding
|
||||
*
|
||||
* TBD
|
||||
*
|
||||
/* KfwumCalculateChecksumPadding - TBD
|
||||
*/
|
||||
static unsigned short KfwumCalculateChecksumPadding(unsigned char * pBuffer,
|
||||
unsigned long totalSize)
|
||||
static unsigned short
|
||||
KfwumCalculateChecksumPadding(unsigned char *pBuffer, unsigned long totalSize)
|
||||
{
|
||||
unsigned short sumOfBytes = 0;
|
||||
unsigned short padding;
|
||||
unsigned long counter;
|
||||
|
||||
for(counter = 0; counter < totalSize; counter ++ )
|
||||
{
|
||||
for (counter = 0; counter < totalSize; counter ++) {
|
||||
sumOfBytes += pBuffer[counter];
|
||||
}
|
||||
|
||||
padding = 0 - sumOfBytes;
|
||||
return padding;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
******************************* COMMANDS **************************************
|
||||
******************************************************************************/
|
||||
/* COMMANDS */
|
||||
#ifdef HAVE_PRAGMA_PACK
|
||||
#pragma pack(1)
|
||||
#endif
|
||||
struct KfwumGetInfoResp {
|
||||
unsigned char protocolRevision;
|
||||
unsigned char controllerDeviceId;
|
||||
struct
|
||||
{
|
||||
struct {
|
||||
unsigned char mode:1;
|
||||
unsigned char seqAdd:1;
|
||||
unsigned char res : 6;
|
||||
@ -549,20 +504,19 @@ struct KfwumGetInfoResp {
|
||||
#pragma pack(0)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* KfwumGetInfo - Get Firmware Update Manager (FWUM) information
|
||||
*
|
||||
* * intf : IPMI interface
|
||||
* *intf : IPMI interface
|
||||
* output : when set to non zero, queried information is displayed
|
||||
* pNumBank: output ptr for number of banks
|
||||
*/
|
||||
static tKFWUM_Status KfwumGetInfo(struct ipmi_intf * intf, unsigned char output,
|
||||
static tKFWUM_Status
|
||||
KfwumGetInfo(struct ipmi_intf *intf, unsigned char output,
|
||||
unsigned char *pNumBank)
|
||||
{
|
||||
tKFWUM_Status status = KFWUM_STATUS_OK;
|
||||
static struct KfwumGetInfoResp *pGetInfo;
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rs *rsp;
|
||||
struct ipmi_rq req;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
@ -575,7 +529,7 @@ static tKFWUM_Status KfwumGetInfo(struct ipmi_intf * intf, unsigned char output,
|
||||
lprintf(LOG_ERR, "Error in FWUM Firmware Get Info Command.");
|
||||
return KFWUM_STATUS_ERROR;
|
||||
} else if (rsp->ccode != 0) {
|
||||
lprintf(LOG_ERR, "FWUM Firmware Get Info returned %x\n",
|
||||
lprintf(LOG_ERR, "FWUM Firmware Get Info returned %x",
|
||||
rsp->ccode);
|
||||
return KFWUM_STATUS_ERROR;
|
||||
}
|
||||
@ -655,8 +609,9 @@ static tKFWUM_Status KfwumGetInfo(struct ipmi_intf * intf, unsigned char output,
|
||||
*
|
||||
* returns KFWUM_STATUS_OK on success, otherwise KFWUM_STATUS_ERROR
|
||||
*/
|
||||
static tKFWUM_Status KfwumGetDeviceInfo(struct ipmi_intf *intf,
|
||||
unsigned char output, tKFWUM_BoardInfo *pBoardInfo)
|
||||
static tKFWUM_Status
|
||||
KfwumGetDeviceInfo(struct ipmi_intf *intf, unsigned char output,
|
||||
tKFWUM_BoardInfo *pBoardInfo)
|
||||
{
|
||||
struct ipm_devid_rsp *pGetDevId;
|
||||
struct ipmi_rs *rsp;
|
||||
@ -698,7 +653,6 @@ static tKFWUM_Status KfwumGetDeviceInfo(struct ipmi_intf *intf,
|
||||
return KFWUM_STATUS_OK;
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_PRAGMA_PACK
|
||||
#pragma pack(1)
|
||||
#endif
|
||||
@ -715,7 +669,6 @@ struct KfwumGetStatusResp {
|
||||
#pragma pack(0)
|
||||
#endif
|
||||
|
||||
|
||||
const struct valstr bankStateValS[] = {
|
||||
{ 0x00, "Not programmed" },
|
||||
{ 0x01, "New firmware" },
|
||||
@ -794,23 +747,23 @@ KfwumGetStatus(struct ipmi_intf * intf)
|
||||
#ifdef HAVE_PRAGMA_PACK
|
||||
#pragma pack(1)
|
||||
#endif
|
||||
struct KfwumManualRollbackReq{
|
||||
struct KfwumManualRollbackReq {
|
||||
unsigned char type;
|
||||
} ATTRIBUTE_PACKING;
|
||||
#ifdef HAVE_PRAGMA_PACK
|
||||
#pragma pack(0)
|
||||
#endif
|
||||
|
||||
|
||||
/* KfwumManualRollback - Ask IPMC to rollback to previous version
|
||||
*
|
||||
* *intf : IPMI interface
|
||||
*
|
||||
* returns KFWUM_STATUS_OK on success, otherwise KFWUM_STATUS_ERROR
|
||||
*/
|
||||
static tKFWUM_Status KfwumManualRollback(struct ipmi_intf * intf)
|
||||
static tKFWUM_Status
|
||||
KfwumManualRollback(struct ipmi_intf *intf)
|
||||
{
|
||||
struct ipmi_rs * rsp;
|
||||
struct ipmi_rs *rsp;
|
||||
struct ipmi_rq req;
|
||||
struct KfwumManualRollbackReq thisReq;
|
||||
|
||||
@ -838,7 +791,7 @@ static tKFWUM_Status KfwumManualRollback(struct ipmi_intf * intf)
|
||||
#ifdef HAVE_PRAGMA_PACK
|
||||
#pragma pack(1)
|
||||
#endif
|
||||
struct KfwumStartFirmwareDownloadReq{
|
||||
struct KfwumStartFirmwareDownloadReq {
|
||||
unsigned char lengthLSB;
|
||||
unsigned char lengthMid;
|
||||
unsigned char lengthMSB;
|
||||
@ -860,8 +813,9 @@ struct KfwumStartFirmwareDownloadResp {
|
||||
#pragma pack(0)
|
||||
#endif
|
||||
|
||||
static tKFWUM_Status KfwumStartFirmwareImage(struct ipmi_intf * intf,
|
||||
unsigned long length, unsigned short padding)
|
||||
static tKFWUM_Status
|
||||
KfwumStartFirmwareImage(struct ipmi_intf *intf, unsigned long length,
|
||||
unsigned short padding)
|
||||
{
|
||||
struct ipmi_rs *rsp;
|
||||
struct ipmi_rq req;
|
||||
@ -928,12 +882,12 @@ struct KfwumSaveFirmwareSequenceReq
|
||||
#pragma pack(0)
|
||||
#endif
|
||||
|
||||
|
||||
# define FWUM_SAVE_FIRMWARE_NO_RESPONSE_LIMIT 6
|
||||
|
||||
static tKFWUM_Status KfwumSaveFirmwareImage(struct ipmi_intf * intf,
|
||||
unsigned char sequenceNumber, unsigned long address,
|
||||
unsigned char *pFirmBuf, unsigned char *pInBufLength)
|
||||
static tKFWUM_Status
|
||||
KfwumSaveFirmwareImage(struct ipmi_intf *intf, unsigned char sequenceNumber,
|
||||
unsigned long address, unsigned char *pFirmBuf,
|
||||
unsigned char *pInBufLength)
|
||||
{
|
||||
tKFWUM_Status status = KFWUM_STATUS_OK;
|
||||
struct ipmi_rs *rsp;
|
||||
@ -1025,7 +979,7 @@ static tKFWUM_Status KfwumSaveFirmwareImage(struct ipmi_intf * intf,
|
||||
#ifdef HAVE_PRAGMA_PACK
|
||||
#pragma pack(1)
|
||||
#endif
|
||||
struct KfwumFinishFirmwareDownloadReq{
|
||||
struct KfwumFinishFirmwareDownloadReq {
|
||||
unsigned char versionMaj;
|
||||
unsigned char versionMinSub;
|
||||
unsigned char versionSdr;
|
||||
@ -1035,8 +989,8 @@ struct KfwumFinishFirmwareDownloadReq{
|
||||
#pragma pack(0)
|
||||
#endif
|
||||
|
||||
static tKFWUM_Status KfwumFinishFirmwareImage(struct ipmi_intf * intf,
|
||||
tKFWUM_InFirmwareInfo firmInfo)
|
||||
static tKFWUM_Status
|
||||
KfwumFinishFirmwareImage(struct ipmi_intf *intf, tKFWUM_InFirmwareInfo firmInfo)
|
||||
{
|
||||
struct ipmi_rs *rsp;
|
||||
struct ipmi_rq req;
|
||||
@ -1070,10 +1024,10 @@ static tKFWUM_Status KfwumFinishFirmwareImage(struct ipmi_intf * intf,
|
||||
return KFWUM_STATUS_OK;
|
||||
}
|
||||
|
||||
|
||||
#define FWUM_MAX_UPLOAD_RETRY 6
|
||||
static tKFWUM_Status KfwumUploadFirmware(struct ipmi_intf * intf,
|
||||
unsigned char *pBuffer, unsigned long totalSize)
|
||||
static tKFWUM_Status
|
||||
KfwumUploadFirmware(struct ipmi_intf *intf, unsigned char *pBuffer,
|
||||
unsigned long totalSize)
|
||||
{
|
||||
tKFWUM_Status status = KFWUM_STATUS_ERROR;
|
||||
unsigned long address = 0x0;
|
||||
@ -1181,7 +1135,8 @@ static const char* CMD_ID_STRING[] = {
|
||||
"FinishFwImage",
|
||||
"ReadFwImage",
|
||||
"ManualRollback",
|
||||
"GetTraceLog" };
|
||||
"GetTraceLog"
|
||||
};
|
||||
|
||||
static const char* EXT_CMD_ID_STRING[] = {
|
||||
"FwUpgradeLock",
|
||||
@ -1189,15 +1144,15 @@ static const char* EXT_CMD_ID_STRING[] = {
|
||||
"ProcessFwRb",
|
||||
"WaitHSAfterUpg",
|
||||
"WaitFirstHSUpg",
|
||||
"FwInfoStateChange" };
|
||||
|
||||
"FwInfoStateChange"
|
||||
};
|
||||
|
||||
static const char* CMD_STATE_STRING[] = {
|
||||
"Invalid",
|
||||
"Begin",
|
||||
"Progress",
|
||||
"Completed" };
|
||||
|
||||
"Completed"
|
||||
};
|
||||
|
||||
static tKFWUM_Status
|
||||
KfwumGetTraceLog(struct ipmi_intf *intf)
|
||||
@ -1255,30 +1210,6 @@ KfwumGetTraceLog(struct ipmi_intf *intf)
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name: KfwumGetInfoFromFirmware
|
||||
*
|
||||
* Description: This function retreive from the firmare the following info :
|
||||
*
|
||||
* o Checksum
|
||||
* o File size (expected)
|
||||
* o Board Id
|
||||
* o Device Id
|
||||
*
|
||||
* Restriction: None
|
||||
*
|
||||
* Input: char * fileName - File to get info from
|
||||
*
|
||||
* Output: pInfo - container that will hold all the informations gattered.
|
||||
* see structure for all details
|
||||
*
|
||||
* Global: None
|
||||
*
|
||||
* Return: IFWU_SUCCESS - file ok
|
||||
* IFWU_ERROR - file error
|
||||
*
|
||||
*******************************************************************************/
|
||||
#define IN_FIRMWARE_INFO_OFFSET_LOCATION 0x5a0
|
||||
#define IN_FIRMWARE_INFO_SIZE 20
|
||||
#define IN_FIRMWARE_INFO_OFFSET_FILE_SIZE 0
|
||||
@ -1373,16 +1304,17 @@ KfwumGetInfoFromFirmware(unsigned char *pBuf, unsigned long bufSize,
|
||||
return KFWUM_STATUS_OK;
|
||||
}
|
||||
|
||||
|
||||
void KfwumFixTableVersionForOldFirmware(tKFWUM_InFirmwareInfo * pInfo)
|
||||
void
|
||||
KfwumFixTableVersionForOldFirmware(tKFWUM_InFirmwareInfo * pInfo)
|
||||
{
|
||||
switch(pInfo->boardId)
|
||||
{
|
||||
switch(pInfo->boardId) {
|
||||
case KFWUM_BOARD_KONTRON_UNKNOWN:
|
||||
pInfo->tableVers = 0xff;
|
||||
break;
|
||||
default:
|
||||
/* pInfo->tableVers is already set for the right version */
|
||||
/* pInfo->tableVers is already set for
|
||||
* the right version
|
||||
*/
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1395,7 +1327,8 @@ void KfwumFixTableVersionForOldFirmware(tKFWUM_InFirmwareInfo * pInfo)
|
||||
*
|
||||
* returns KFWUM_STATUS_OK if compatible, otherwise KFWUM_STATUS_ERROR
|
||||
*/
|
||||
tKFWUM_Status ipmi_kfwum_checkfwcompat(tKFWUM_BoardInfo boardInfo,
|
||||
tKFWUM_Status
|
||||
ipmi_kfwum_checkfwcompat(tKFWUM_BoardInfo boardInfo,
|
||||
tKFWUM_InFirmwareInfo firmInfo)
|
||||
{
|
||||
tKFWUM_Status status = KFWUM_STATUS_OK;
|
||||
@ -1416,7 +1349,6 @@ tKFWUM_Status ipmi_kfwum_checkfwcompat(tKFWUM_BoardInfo boardInfo,
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
printf_kfwum_info(tKFWUM_BoardInfo boardInfo, tKFWUM_InFirmwareInfo firmInfo)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user