ipmi_fwum.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. /*
  2. * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. *
  8. * Redistribution of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. *
  11. * Redistribution in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the distribution.
  14. *
  15. * Neither the name of Sun Microsystems, Inc. or the names of
  16. * contributors may be used to endorse or promote products derived
  17. * from this software without specific prior written permission.
  18. *
  19. * This software is provided "AS IS," without a warranty of any kind.
  20. * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
  21. * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
  22. * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.
  23. * SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE
  24. * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
  25. * OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
  26. * SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
  27. * OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
  28. * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
  29. * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
  30. * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  31. */
  32. #ifndef IPMI_KFWUM_H
  33. # define IPMI_KFWUM_H
  34. #include <inttypes.h>
  35. #include <ipmitool/ipmi.h>
  36. /* KFWUM Version */
  37. # define VER_MAJOR 1
  38. # define VER_MINOR 3
  39. /* Minimum size (IPMB/IOL/old protocol) */
  40. # define KFWUM_SMALL_BUFFER 32
  41. /* Maximum size on KCS interface */
  42. # define KFWUM_BIG_BUFFER 32
  43. # define MAX_BUFFER_SIZE 1024*16
  44. /* 3 address + 1 size + 1 checksum + 1 command */
  45. # define KFWUM_OLD_CMD_OVERHEAD 6
  46. /* 1 sequence + 1 size + 1 checksum + 1 command */
  47. # define KFWUM_NEW_CMD_OVERHEAD 4
  48. # define KFWUM_PAGE_SIZE 256
  49. # define FWUM_SAVE_FIRMWARE_NO_RESPONSE_LIMIT 6
  50. # define FWUM_MAX_UPLOAD_RETRY 6
  51. # define TRACE_LOG_CHUNK_COUNT 7
  52. # define TRACE_LOG_CHUNK_SIZE 7
  53. # define TRACE_LOG_ATT_COUNT 3
  54. # define IN_FIRMWARE_INFO_OFFSET_LOCATION 0x5a0
  55. # define IN_FIRMWARE_INFO_SIZE 20
  56. # define IN_FIRMWARE_INFO_OFFSET_FILE_SIZE 0
  57. # define IN_FIRMWARE_INFO_OFFSET_CHECKSUM 4
  58. # define IN_FIRMWARE_INFO_OFFSET_BOARD_ID 6
  59. # define IN_FIRMWARE_INFO_OFFSET_DEVICE_ID 8
  60. # define IN_FIRMWARE_INFO_OFFSET_TABLE_VERSION 9
  61. # define IN_FIRMWARE_INFO_OFFSET_IMPLEMENT_REV 10
  62. # define IN_FIRMWARE_INFO_OFFSET_VER_MAJOROR 11
  63. # define IN_FIRMWARE_INFO_OFFSET_VER_MINORSUB 12
  64. # define IN_FIRMWARE_INFO_OFFSET_SDR_REV 13
  65. # define IN_FIRMWARE_INFO_OFFSET_IANA0 14
  66. # define IN_FIRMWARE_INFO_OFFSET_IANA1 15
  67. # define IN_FIRMWARE_INFO_OFFSET_IANA2 16
  68. # define KWUM_GET_BYTE_AT_OFFSET(pBuffer,os) pBuffer[os]
  69. int ipmi_fwum_main(struct ipmi_intf *, int, char **);
  70. typedef enum eKFWUM_BoardList
  71. {
  72. KFWUM_BOARD_KONTRON_UNKNOWN = 0,
  73. KFWUM_BOARD_KONTRON_5002 = 5002,
  74. } tKFWUM_BoardList;
  75. typedef struct sKFWUM_BoardInfo
  76. {
  77. tKFWUM_BoardList boardId;
  78. IPMI_OEM iana;
  79. } tKFWUM_BoardInfo;
  80. typedef enum eKFWUM_DownloadType
  81. {
  82. KFWUM_DOWNLOAD_TYPE_ADDRESS = 0,
  83. KFWUM_DOWNLOAD_TYPE_SEQUENCE,
  84. } tKFWUM_DownloadType;
  85. typedef enum eKFWUM_DownloadBuffferType
  86. {
  87. KFWUM_SMALL_BUFFER_TYPE = 0,
  88. KFUMW_BIG_BUFFER_TYPE
  89. } tKFWUM_DownloadBuffferType;
  90. typedef struct sKFWUM_InFirmwareInfo
  91. {
  92. unsigned long fileSize;
  93. unsigned short checksum;
  94. unsigned short sumToRemoveFromChecksum;
  95. /* Since the checksum is added in the bin
  96. * after the checksum is calculated, we
  97. * need to remove the each byte value. This
  98. * byte will contain the addition of both bytes
  99. */
  100. tKFWUM_BoardList boardId;
  101. unsigned char deviceId;
  102. unsigned char tableVers;
  103. unsigned char implRev;
  104. unsigned char versMajor;
  105. unsigned char versMinor;
  106. unsigned char versSubMinor;
  107. unsigned char sdrRev;
  108. IPMI_OEM iana;
  109. } tKFWUM_InFirmwareInfo;
  110. typedef struct sKFWUM_SaveFirmwareInfo
  111. {
  112. tKFWUM_DownloadType downloadType;
  113. unsigned char bufferSize;
  114. unsigned char overheadSize;
  115. } tKFWUM_SaveFirmwareInfo;
  116. /* COMMANDS */
  117. # ifdef HAVE_PRAGMA_PACK
  118. # pragma pack(1)
  119. # endif
  120. struct KfwumGetInfoResp {
  121. unsigned char protocolRevision;
  122. unsigned char controllerDeviceId;
  123. struct {
  124. unsigned char mode:1;
  125. unsigned char seqAdd:1;
  126. unsigned char res : 6;
  127. } byte;
  128. unsigned char firmRev1;
  129. unsigned char firmRev2;
  130. unsigned char numBank;
  131. } ATTRIBUTE_PACKING;
  132. # ifdef HAVE_PRAGMA_PACK
  133. # pragma pack(0)
  134. # endif
  135. # ifdef HAVE_PRAGMA_PACK
  136. # pragma pack(1)
  137. # endif
  138. struct KfwumGetStatusResp {
  139. unsigned char bankState;
  140. unsigned char firmLengthLSB;
  141. unsigned char firmLengthMid;
  142. unsigned char firmLengthMSB;
  143. unsigned char firmRev1;
  144. unsigned char firmRev2;
  145. unsigned char firmRev3;
  146. } ATTRIBUTE_PACKING;
  147. # ifdef HAVE_PRAGMA_PACK
  148. # pragma pack(0)
  149. # endif
  150. # ifdef HAVE_PRAGMA_PACK
  151. # pragma pack(1)
  152. # endif
  153. struct KfwumManualRollbackReq {
  154. unsigned char type;
  155. } ATTRIBUTE_PACKING;
  156. # ifdef HAVE_PRAGMA_PACK
  157. # pragma pack(0)
  158. # endif
  159. # ifdef HAVE_PRAGMA_PACK
  160. # pragma pack(1)
  161. # endif
  162. struct KfwumStartFirmwareDownloadReq {
  163. unsigned char lengthLSB;
  164. unsigned char lengthMid;
  165. unsigned char lengthMSB;
  166. unsigned char paddingLSB;
  167. unsigned char paddingMSB;
  168. unsigned char useSequence;
  169. } ATTRIBUTE_PACKING;
  170. # ifdef HAVE_PRAGMA_PACK
  171. # pragma pack(0)
  172. # endif
  173. # ifdef HAVE_PRAGMA_PACK
  174. # pragma pack(1)
  175. # endif
  176. struct KfwumStartFirmwareDownloadResp {
  177. unsigned char bank;
  178. } ATTRIBUTE_PACKING;
  179. # ifdef HAVE_PRAGMA_PACK
  180. # pragma pack(0)
  181. # endif
  182. # ifdef HAVE_PRAGMA_PACK
  183. # pragma pack(1)
  184. # endif
  185. struct KfwumSaveFirmwareAddressReq
  186. {
  187. unsigned char addressLSB;
  188. unsigned char addressMid;
  189. unsigned char addressMSB;
  190. unsigned char numBytes;
  191. unsigned char txBuf[KFWUM_SMALL_BUFFER-KFWUM_OLD_CMD_OVERHEAD];
  192. } ATTRIBUTE_PACKING;
  193. # ifdef HAVE_PRAGMA_PACK
  194. # pragma pack(0)
  195. # endif
  196. # ifdef HAVE_PRAGMA_PACK
  197. # pragma pack(1)
  198. # endif
  199. struct KfwumSaveFirmwareSequenceReq
  200. {
  201. unsigned char sequenceNumber;
  202. unsigned char txBuf[KFWUM_BIG_BUFFER];
  203. } ATTRIBUTE_PACKING;
  204. # ifdef HAVE_PRAGMA_PACK
  205. # pragma pack(0)
  206. # endif
  207. # ifdef HAVE_PRAGMA_PACK
  208. # pragma pack(1)
  209. # endif
  210. struct KfwumFinishFirmwareDownloadReq {
  211. unsigned char versionMaj;
  212. unsigned char versionMinSub;
  213. unsigned char versionSdr;
  214. unsigned char reserved;
  215. } ATTRIBUTE_PACKING;
  216. # ifdef HAVE_PRAGMA_PACK
  217. # pragma pack(0)
  218. # endif
  219. #endif /* IPMI_KFWUM_H */