From: Zdenek S. <st...@us...> - 2013-10-26 19:31:46
|
Update of /cvsroot/ipmitool/ipmitool/lib In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv1364/lib Modified Files: ipmi_fwum.c Log Message: ID: 46 - ipmi_fwum needs some re-work Move 'struct' and 'enum' into header file Index: ipmi_fwum.c =================================================================== RCS file: /cvsroot/ipmitool/ipmitool/lib/ipmi_fwum.c,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** ipmi_fwum.c 26 Oct 2013 19:30:15 -0000 1.55 --- ipmi_fwum.c 26 Oct 2013 19:31:44 -0000 1.56 *************** *** 46,104 **** #include <ipmitool/ipmi_mc.h> - #define VER_MAJOR 1 - #define VER_MINOR 3 - - typedef enum eKFWUM_BoardList - { - KFWUM_BOARD_KONTRON_UNKNOWN = 0, - KFWUM_BOARD_KONTRON_5002 = 5002, - } tKFWUM_BoardList; - - typedef struct sKFWUM_BoardInfo - { - tKFWUM_BoardList boardId; - IPMI_OEM iana; - } tKFWUM_BoardInfo; - - typedef enum eKFWUM_DownloadType - { - KFWUM_DOWNLOAD_TYPE_ADDRESS = 0, - KFWUM_DOWNLOAD_TYPE_SEQUENCE, - } tKFWUM_DownloadType; - - typedef enum eKFWUM_DownloadBuffferType - { - KFWUM_SMALL_BUFFER_TYPE = 0, - KFUMW_BIG_BUFFER_TYPE - } tKFWUM_DownloadBuffferType; - - typedef struct sKFWUM_InFirmwareInfo - { - unsigned long fileSize; - 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 - */ - tKFWUM_BoardList boardId; - unsigned char deviceId; - unsigned char tableVers; - unsigned char implRev; - unsigned char versMajor; - unsigned char versMinor; - unsigned char versSubMinor; - unsigned char sdrRev; - IPMI_OEM iana; - } tKFWUM_InFirmwareInfo; - - typedef struct sKFWUM_SaveFirmwareInfo - { - tKFWUM_DownloadType downloadType; - unsigned char bufferSize; - unsigned char overheadSize; - } tKFWUM_SaveFirmwareInfo; - extern int verbose; unsigned char firmBuf[1024*512]; --- 46,49 ---- *************** *** 143,146 **** --- 88,136 ---- tKFWUM_InFirmwareInfo firmInfo); + /* String table */ + /* Must match eFWUM_CmdId */ + const char *CMD_ID_STRING[] = { + "GetFwInfo", + "KickWatchdog", + "GetLastAnswer", + "BootHandshake", + "ReportStatus", + "CtrlIPMBLine", + "SetFwState", + "GetFwStatus", + "GetSpiMemStatus", + "StartFwUpdate", + "StartFwImage", + "SaveFwImage", + "FinishFwImage", + "ReadFwImage", + "ManualRollback", + "GetTraceLog" + }; + + const char *EXT_CMD_ID_STRING[] = { + "FwUpgradeLock", + "ProcessFwUpg", + "ProcessFwRb", + "WaitHSAfterUpg", + "WaitFirstHSUpg", + "FwInfoStateChange" + }; + + const char *CMD_STATE_STRING[] = { + "Invalid", + "Begin", + "Progress", + "Completed" + }; + + const struct valstr bankStateValS[] = { + { 0x00, "Not programmed" }, + { 0x01, "New firmware" }, + { 0x02, "Wait for validation" }, + { 0x03, "Last Known Good" }, + { 0x04, "Previous Good" } + }; + /* ipmi_fwum_main - entry point for this ipmitool mode * *************** *** 392,399 **** * total : limit */ - # define PROG_LENGTH 42 void KfwumShowProgress(const char *task, unsigned long current, unsigned long total) { static unsigned long staticProgress=0xffffffff; unsigned char spaces[PROG_LENGTH + 1]; --- 382,389 ---- * total : limit */ void KfwumShowProgress(const char *task, unsigned long current, unsigned long total) { + # define PROG_LENGTH 42 static unsigned long staticProgress=0xffffffff; unsigned char spaces[PROG_LENGTH + 1]; *************** *** 439,462 **** } - /* COMMANDS */ - #ifdef HAVE_PRAGMA_PACK - #pragma pack(1) - #endif - struct KfwumGetInfoResp { - unsigned char protocolRevision; - unsigned char controllerDeviceId; - struct { - unsigned char mode:1; - unsigned char seqAdd:1; - unsigned char res : 6; - } byte; - unsigned char firmRev1; - unsigned char firmRev2; - unsigned char numBank; - } ATTRIBUTE_PACKING; - #ifdef HAVE_PRAGMA_PACK - #pragma pack(0) - #endif - /* KfwumGetInfo - Get Firmware Update Manager (FWUM) information * --- 429,432 ---- *************** *** 610,637 **** } - #ifdef HAVE_PRAGMA_PACK - #pragma pack(1) - #endif - struct KfwumGetStatusResp { - unsigned char bankState; - unsigned char firmLengthLSB; - unsigned char firmLengthMid; - unsigned char firmLengthMSB; - unsigned char firmRev1; - unsigned char firmRev2; - unsigned char firmRev3; - } ATTRIBUTE_PACKING; - #ifdef HAVE_PRAGMA_PACK - #pragma pack(0) - #endif - - const struct valstr bankStateValS[] = { - { 0x00, "Not programmed" }, - { 0x01, "New firmware" }, - { 0x02, "Wait for validation" }, - { 0x03, "Last Known Good" }, - { 0x04, "Previous Good" } - }; - /* KfwumGetStatus - Get (and prints) FWUM banks information * --- 580,583 ---- *************** *** 701,714 **** } - #ifdef HAVE_PRAGMA_PACK - #pragma pack(1) - #endif - struct KfwumManualRollbackReq { - unsigned char type; - } ATTRIBUTE_PACKING; - #ifdef HAVE_PRAGMA_PACK - #pragma pack(0) - #endif - /* KfwumManualRollback - Ask IPMC to rollback to previous version * --- 647,650 ---- *************** *** 746,774 **** } - #ifdef HAVE_PRAGMA_PACK - #pragma pack(1) - #endif - struct KfwumStartFirmwareDownloadReq { - unsigned char lengthLSB; - unsigned char lengthMid; - unsigned char lengthMSB; - unsigned char paddingLSB; - unsigned char paddingMSB; - unsigned char useSequence; - } ATTRIBUTE_PACKING; - #ifdef HAVE_PRAGMA_PACK - #pragma pack(0) - #endif - - #ifdef HAVE_PRAGMA_PACK - #pragma pack(1) - #endif - struct KfwumStartFirmwareDownloadResp { - unsigned char bank; - } ATTRIBUTE_PACKING; - #ifdef HAVE_PRAGMA_PACK - #pragma pack(0) - #endif - int KfwumStartFirmwareImage(struct ipmi_intf *intf, unsigned long length, --- 682,685 ---- *************** *** 813,843 **** } - #ifdef HAVE_PRAGMA_PACK - #pragma pack(1) - #endif - struct KfwumSaveFirmwareAddressReq - { - unsigned char addressLSB; - unsigned char addressMid; - unsigned char addressMSB; - unsigned char numBytes; - unsigned char txBuf[KFWUM_SMALL_BUFFER-KFWUM_OLD_CMD_OVERHEAD]; - } ATTRIBUTE_PACKING; - #ifdef HAVE_PRAGMA_PACK - #pragma pack(0) - #endif - - #ifdef HAVE_PRAGMA_PACK - #pragma pack(1) - #endif - struct KfwumSaveFirmwareSequenceReq - { - unsigned char sequenceNumber; - unsigned char txBuf[KFWUM_BIG_BUFFER]; - } ATTRIBUTE_PACKING; - #ifdef HAVE_PRAGMA_PACK - #pragma pack(0) - #endif - int KfwumSaveFirmwareImage(struct ipmi_intf *intf, unsigned char sequenceNumber, --- 724,727 ---- *************** *** 932,948 **** } - #ifdef HAVE_PRAGMA_PACK - #pragma pack(1) - #endif - struct KfwumFinishFirmwareDownloadReq { - unsigned char versionMaj; - unsigned char versionMinSub; - unsigned char versionSdr; - unsigned char reserved; - } ATTRIBUTE_PACKING; - #ifdef HAVE_PRAGMA_PACK - #pragma pack(0) - #endif - int KfwumFinishFirmwareImage(struct ipmi_intf *intf, tKFWUM_InFirmwareInfo firmInfo) --- 816,819 ---- *************** *** 1069,1109 **** } - /* String table */ - /* Must match eFWUM_CmdId */ - const char* CMD_ID_STRING[] = { - "GetFwInfo", - "KickWatchdog", - "GetLastAnswer", - "BootHandshake", - "ReportStatus", - "CtrlIPMBLine", - "SetFwState", - "GetFwStatus", - "GetSpiMemStatus", - "StartFwUpdate", - "StartFwImage", - "SaveFwImage", - "FinishFwImage", - "ReadFwImage", - "ManualRollback", - "GetTraceLog" - }; - - const char* EXT_CMD_ID_STRING[] = { - "FwUpgradeLock", - "ProcessFwUpg", - "ProcessFwRb", - "WaitHSAfterUpg", - "WaitFirstHSUpg", - "FwInfoStateChange" - }; - - const char* CMD_STATE_STRING[] = { - "Invalid", - "Begin", - "Progress", - "Completed" - }; - int KfwumGetTraceLog(struct ipmi_intf *intf) --- 940,943 ---- |