ipmi_hpmfwupg.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809
  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_HPMFWUPG_H
  33. #define IPMI_HPMFWUPG_H
  34. #include <inttypes.h>
  35. #include <ipmitool/ipmi.h>
  36. int ipmi_hpmfwupg_main(struct ipmi_intf *, int, char **);
  37. /* Agent version */
  38. #define HPMFWUPG_VERSION_MAJOR 1
  39. #define HPMFWUPG_VERSION_MINOR 0
  40. #define HPMFWUPG_VERSION_SUBMINOR 9
  41. /* HPM.1 FIRMWARE UPGRADE COMMANDS (part of PICMG) */
  42. #define HPMFWUPG_GET_TARGET_UPG_CAPABILITIES 0x2E
  43. #define HPMFWUPG_GET_COMPONENT_PROPERTIES 0x2F
  44. #define HPMFWUPG_ABORT_UPGRADE 0x30
  45. #define HPMFWUPG_INITIATE_UPGRADE_ACTION 0x31
  46. #define HPMFWUPG_UPLOAD_FIRMWARE_BLOCK 0x32
  47. #define HPMFWUPG_FINISH_FIRMWARE_UPLOAD 0x33
  48. #define HPMFWUPG_GET_UPGRADE_STATUS 0x34
  49. #define HPMFWUPG_ACTIVATE_FIRMWARE 0x35
  50. #define HPMFWUPG_QUERY_SELFTEST_RESULT 0x36
  51. #define HPMFWUPG_QUERY_ROLLBACK_STATUS 0x37
  52. #define HPMFWUPG_MANUAL_FIRMWARE_ROLLBACK 0x38
  53. /* HPM.1 SPECIFIC COMPLETION CODES */
  54. #define HPMFWUPG_ROLLBACK_COMPLETED 0x00
  55. #define HPMFWUPG_COMMAND_IN_PROGRESS 0x80
  56. #define HPMFWUPG_NOT_SUPPORTED 0x81
  57. #define HPMFWUPG_SIZE_MISMATCH 0x81
  58. #define HPMFWUPG_ROLLBACK_FAILURE 0x81
  59. #define HPMFWUPG_INV_COMP_MASK 0x81
  60. #define HPMFWUPG__ABORT_FAILURE 0x81
  61. #define HPMFWUPG_INV_COMP_ID 0x82
  62. #define HPMFWUPG_INT_CHECKSUM_ERROR 0x82
  63. #define HPMFWUPG_INV_UPLOAD_MODE 0x82
  64. #define HPMFWUPG_ROLLBACK_OVERRIDE 0x82
  65. #define HPMFWUPG_INV_COMP_PROP 0x83
  66. #define HPMFWUPG_FW_MISMATCH 0x83
  67. #define HPMFWUPG_ROLLBACK_DENIED 0x83
  68. /*
  69. * This error code is used as a temporary PATCH to
  70. * the latest Open ipmi driver. This PATCH
  71. * will be removed once a new Open IPMI driver is released.
  72. * (Buggy version = 39)
  73. */
  74. #define ENABLE_OPENIPMI_V39_PATCH
  75. #ifdef ENABLE_OPENIPMI_V39_PATCH
  76. # define RETRY_COUNT_MAX 3
  77. static int errorCount;
  78. # define HPMFWUPG_IS_RETRYABLE(error) \
  79. ((((error==0x83)||(error==0x82)||(error==0x80)) && (errorCount++<RETRY_COUNT_MAX))?TRUE:FALSE)
  80. #else
  81. # define HPMFWUPG_IS_RETRYABLE(error) FALSE
  82. #endif
  83. /* HPM FIRMWARE UPGRADE GENERAL DEFINITIONS */
  84. #define HPMFWUPG_PICMG_IDENTIFIER 0
  85. #define HPMFWUPG_VERSION_SIZE 6
  86. #define HPMFWUPG_DESC_STRING_LENGTH 12
  87. #define HPMFWUPG_DEFAULT_INACCESS_TIMEOUT 60 /* sec */
  88. #define HPMFWUPG_DEFAULT_UPGRADE_TIMEOUT 60 /* sec */
  89. #define HPMFWUPG_MD5_SIGNATURE_LENGTH 16
  90. /* Component IDs */
  91. typedef enum eHpmfwupgComponentId {
  92. HPMFWUPG_COMPONENT_ID_0 = 0,
  93. HPMFWUPG_COMPONENT_ID_1,
  94. HPMFWUPG_COMPONENT_ID_2,
  95. HPMFWUPG_COMPONENT_ID_3,
  96. HPMFWUPG_COMPONENT_ID_4,
  97. HPMFWUPG_COMPONENT_ID_5,
  98. HPMFWUPG_COMPONENT_ID_6,
  99. HPMFWUPG_COMPONENT_ID_7,
  100. HPMFWUPG_COMPONENT_ID_MAX
  101. } tHpmfwupgComponentId;
  102. #ifdef HAVE_PRAGMA_PACK
  103. # pragma pack(1)
  104. #endif
  105. struct HpmfwupgComponentBitMask {
  106. union {
  107. unsigned char byte;
  108. struct {
  109. #ifdef WORDS_BIGENDIAN
  110. unsigned char component7 : 1;
  111. unsigned char component6 : 1;
  112. unsigned char component5 : 1;
  113. unsigned char component4 : 1;
  114. unsigned char component3 : 1;
  115. unsigned char component2 : 1;
  116. unsigned char component1 : 1;
  117. unsigned char component0 : 1;
  118. #else
  119. unsigned char component0 : 1;
  120. unsigned char component1 : 1;
  121. unsigned char component2 : 1;
  122. unsigned char component3 : 1;
  123. unsigned char component4 : 1;
  124. unsigned char component5 : 1;
  125. unsigned char component6 : 1;
  126. unsigned char component7 : 1;
  127. #endif
  128. } ATTRIBUTE_PACKING bitField;
  129. } ATTRIBUTE_PACKING ComponentBits;
  130. } ATTRIBUTE_PACKING;
  131. #ifdef HAVE_PRAGMA_PACK
  132. # pragma pack(0)
  133. #endif
  134. static const int HPMFWUPG_SUCCESS = 0;
  135. static const int HPMFWUPG_ERROR = -1;
  136. /* Upload firmware specific error codes */
  137. static const int HPMFWUPG_UPLOAD_BLOCK_LENGTH = 1;
  138. static const int HPMFWUPG_UPLOAD_RETRY = 2;
  139. /* TARGET UPGRADE CAPABILITIES DEFINITIONS */
  140. #ifdef HAVE_PRAGMA_PACK
  141. # pragma pack(1)
  142. #endif
  143. struct HpmfwupgGetTargetUpgCapabilitiesReq {
  144. unsigned char picmgId;
  145. } ATTRIBUTE_PACKING;
  146. #ifdef HAVE_PRAGMA_PACK
  147. # pragma pack(0)
  148. #endif
  149. #ifdef HAVE_PRAGMA_PACK
  150. # pragma pack(1)
  151. #endif
  152. struct HpmfwupgGetTargetUpgCapabilitiesResp {
  153. unsigned char picmgId;
  154. unsigned char hpmVersion;
  155. union {
  156. unsigned char byte;
  157. struct {
  158. #if WORDS_BIGENDIAN
  159. unsigned char fwUpgUndesirable : 1;
  160. unsigned char autRollbackOverride : 1;
  161. unsigned char ipmcDegradedDurinUpg: 1;
  162. unsigned char deferActivation : 1;
  163. unsigned char servAffectDuringUpg : 1;
  164. unsigned char manualRollback : 1;
  165. unsigned char autRollback : 1;
  166. unsigned char ipmcSelftestCap : 1;
  167. #else
  168. unsigned char ipmcSelftestCap : 1;
  169. unsigned char autRollback : 1;
  170. unsigned char manualRollback : 1;
  171. unsigned char servAffectDuringUpg : 1;
  172. unsigned char deferActivation : 1;
  173. unsigned char ipmcDegradedDurinUpg: 1;
  174. unsigned char autRollbackOverride : 1;
  175. unsigned char fwUpgUndesirable : 1;
  176. #endif
  177. } ATTRIBUTE_PACKING bitField;
  178. } ATTRIBUTE_PACKING GlobalCapabilities;
  179. unsigned char upgradeTimeout;
  180. unsigned char selftestTimeout;
  181. unsigned char rollbackTimeout;
  182. unsigned char inaccessTimeout;
  183. struct HpmfwupgComponentBitMask componentsPresent;
  184. } ATTRIBUTE_PACKING;
  185. #ifdef HAVE_PRAGMA_PACK
  186. # pragma pack(0)
  187. #endif
  188. #ifdef HAVE_PRAGMA_PACK
  189. # pragma pack(1)
  190. #endif
  191. struct HpmfwupgGetTargetUpgCapabilitiesCtx {
  192. struct HpmfwupgGetTargetUpgCapabilitiesReq req;
  193. struct HpmfwupgGetTargetUpgCapabilitiesResp resp;
  194. } ATTRIBUTE_PACKING;
  195. #ifdef HAVE_PRAGMA_PACK
  196. # pragma pack(0)
  197. #endif
  198. /* COMPONENT PROPERTIES DEFINITIONS */
  199. typedef enum eHpmfwupgCompPropertiesSelect {
  200. HPMFWUPG_COMP_GEN_PROPERTIES = 0,
  201. HPMFWUPG_COMP_CURRENT_VERSION,
  202. HPMFWUPG_COMP_DESCRIPTION_STRING,
  203. HPMFWUPG_COMP_ROLLBACK_FIRMWARE_VERSION,
  204. HPMFWUPG_COMP_DEFERRED_FIRMWARE_VERSION,
  205. HPMFWUPG_COMP_RESERVED,
  206. HPMFWUPG_COMP_OEM_PROPERTIES = 192
  207. } tHpmfwupgCompPropertiesSelect;
  208. #ifdef HAVE_PRAGMA_PACK
  209. # pragma pack(1)
  210. #endif
  211. struct HpmfwupgGetComponentPropertiesReq {
  212. unsigned char picmgId;
  213. unsigned char componentId;
  214. unsigned char selector;
  215. } ATTRIBUTE_PACKING;
  216. #ifdef HAVE_PRAGMA_PACK
  217. # pragma pack(0)
  218. #endif
  219. #ifdef HAVE_PRAGMA_PACK
  220. # pragma pack(1)
  221. #endif
  222. struct HpmfwupgGetGeneralPropResp {
  223. unsigned char picmgId;
  224. union {
  225. unsigned char byte;
  226. struct {
  227. #if WORDS_BIGENDIAN
  228. unsigned char reserved : 2;
  229. unsigned char payloadColdReset : 1;
  230. unsigned char deferredActivation : 1;
  231. unsigned char comparisonSupport : 1;
  232. unsigned char preparationSupport : 1;
  233. unsigned char rollbackBackup : 2;
  234. #else
  235. unsigned char rollbackBackup : 2;
  236. unsigned char preparationSupport : 1;
  237. unsigned char comparisonSupport : 1;
  238. unsigned char deferredActivation : 1;
  239. unsigned char payloadColdReset : 1;
  240. unsigned char reserved : 2;
  241. #endif
  242. } ATTRIBUTE_PACKING bitfield;
  243. } ATTRIBUTE_PACKING GeneralCompProperties;
  244. } ATTRIBUTE_PACKING;
  245. #ifdef HAVE_PRAGMA_PACK
  246. # pragma pack(0)
  247. #endif
  248. #ifdef HAVE_PRAGMA_PACK
  249. # pragma pack(1)
  250. #endif
  251. struct HpmfwupgGetCurrentVersionResp {
  252. unsigned char picmgId;
  253. unsigned char currentVersion[HPMFWUPG_VERSION_SIZE];
  254. } ATTRIBUTE_PACKING;
  255. #ifdef HAVE_PRAGMA_PACK
  256. # pragma pack(0)
  257. #endif
  258. #ifdef HAVE_PRAGMA_PACK
  259. # pragma pack(1)
  260. #endif
  261. struct HpmfwupgGetDescStringResp {
  262. unsigned char picmgId;
  263. char descString[HPMFWUPG_DESC_STRING_LENGTH];
  264. } ATTRIBUTE_PACKING;
  265. #ifdef HAVE_PRAGMA_PACK
  266. # pragma pack(0)
  267. #endif
  268. #ifdef HAVE_PRAGMA_PACK
  269. # pragma pack(1)
  270. #endif
  271. struct HpmfwupgGetRollbackFwVersionResp {
  272. unsigned char picmgId;
  273. unsigned char rollbackFwVersion[HPMFWUPG_VERSION_SIZE];
  274. } ATTRIBUTE_PACKING;
  275. #ifdef HAVE_PRAGMA_PACK
  276. # pragma pack(0)
  277. #endif
  278. #ifdef HAVE_PRAGMA_PACK
  279. # pragma pack(1)
  280. #endif
  281. struct HpmfwupgGetDeferredFwVersionResp {
  282. unsigned char picmgId;
  283. unsigned char deferredFwVersion[HPMFWUPG_VERSION_SIZE];
  284. } ATTRIBUTE_PACKING;
  285. #ifdef HAVE_PRAGMA_PACK
  286. # pragma pack(0)
  287. #endif
  288. /* GetComponentProperties - OEM properties (192) */
  289. #define HPMFWUPG_OEM_LENGTH 4
  290. #ifdef HAVE_PRAGMA_PACK
  291. # pragma pack(1)
  292. #endif
  293. struct HpmfwupgGetOemProperties {
  294. unsigned char picmgId;
  295. unsigned char oemRspData[HPMFWUPG_OEM_LENGTH];
  296. } ATTRIBUTE_PACKING;
  297. #ifdef HAVE_PRAGMA_PACK
  298. # pragma pack(0)
  299. #endif
  300. #ifdef HAVE_PRAGMA_PACK
  301. # pragma pack(1)
  302. #endif
  303. struct HpmfwupgGetComponentPropertiesResp {
  304. union {
  305. struct HpmfwupgGetGeneralPropResp generalPropResp;
  306. struct HpmfwupgGetCurrentVersionResp currentVersionResp;
  307. struct HpmfwupgGetDescStringResp descStringResp;
  308. struct HpmfwupgGetRollbackFwVersionResp rollbackFwVersionResp;
  309. struct HpmfwupgGetDeferredFwVersionResp deferredFwVersionResp;
  310. struct HpmfwupgGetOemProperties oemProperties;
  311. } ATTRIBUTE_PACKING Response;
  312. } ATTRIBUTE_PACKING;
  313. #ifdef HAVE_PRAGMA_PACK
  314. # pragma pack(0)
  315. #endif
  316. #ifdef HAVE_PRAGMA_PACK
  317. # pragma pack(1)
  318. #endif
  319. struct HpmfwupgGetComponentPropertiesCtx {
  320. struct HpmfwupgGetComponentPropertiesReq req;
  321. struct HpmfwupgGetComponentPropertiesResp resp;
  322. } ATTRIBUTE_PACKING;
  323. #ifdef HAVE_PRAGMA_PACK
  324. # pragma pack(0)
  325. #endif
  326. /* ABORT UPGRADE DEFINITIONS */
  327. #ifdef HAVE_PRAGMA_PACK
  328. # pragma pack(1)
  329. #endif
  330. struct HpmfwupgAbortUpgradeReq {
  331. unsigned char picmgId;
  332. } ATTRIBUTE_PACKING;
  333. #ifdef HAVE_PRAGMA_PACK
  334. # pragma pack(0)
  335. #endif
  336. #ifdef HAVE_PRAGMA_PACK
  337. # pragma pack(1)
  338. #endif
  339. struct HpmfwupgAbortUpgradeResp {
  340. unsigned char picmgId;
  341. } ATTRIBUTE_PACKING;
  342. #ifdef HAVE_PRAGMA_PACK
  343. # pragma pack(0)
  344. #endif
  345. #ifdef HAVE_PRAGMA_PACK
  346. # pragma pack(1)
  347. #endif
  348. struct HpmfwupgAbortUpgradeCtx {
  349. struct HpmfwupgAbortUpgradeReq req;
  350. struct HpmfwupgAbortUpgradeResp resp;
  351. } ATTRIBUTE_PACKING;
  352. #ifdef HAVE_PRAGMA_PACK
  353. # pragma pack(0)
  354. #endif
  355. /* UPGRADE ACTIONS DEFINITIONS */
  356. typedef enum eHpmfwupgUpgradeAction {
  357. HPMFWUPG_UPGRADE_ACTION_BACKUP = 0,
  358. HPMFWUPG_UPGRADE_ACTION_PREPARE,
  359. HPMFWUPG_UPGRADE_ACTION_UPGRADE,
  360. HPMFWUPG_UPGRADE_ACTION_COMPARE,
  361. HPMFWUPG_UPGRADE_ACTION_INVALID = 0xff
  362. } tHpmfwupgUpgradeAction;
  363. #ifdef HAVE_PRAGMA_PACK
  364. # pragma pack(1)
  365. #endif
  366. struct HpmfwupgInitiateUpgradeActionReq {
  367. unsigned char picmgId;
  368. struct HpmfwupgComponentBitMask componentsMask;
  369. unsigned char upgradeAction;
  370. } ATTRIBUTE_PACKING;
  371. #ifdef HAVE_PRAGMA_PACK
  372. # pragma pack(0)
  373. #endif
  374. #ifdef HAVE_PRAGMA_PACK
  375. # pragma pack(1)
  376. #endif
  377. struct HpmfwupgInitiateUpgradeActionResp {
  378. unsigned char picmgId;
  379. } ATTRIBUTE_PACKING;
  380. #ifdef HAVE_PRAGMA_PACK
  381. # pragma pack(0)
  382. #endif
  383. #ifdef HAVE_PRAGMA_PACK
  384. # pragma pack(1)
  385. #endif
  386. struct HpmfwupgInitiateUpgradeActionCtx {
  387. struct HpmfwupgInitiateUpgradeActionReq req;
  388. struct HpmfwupgInitiateUpgradeActionResp resp;
  389. } ATTRIBUTE_PACKING;
  390. #ifdef HAVE_PRAGMA_PACK
  391. # pragma pack(0)
  392. #endif
  393. /* UPLOAD FIRMWARE BLOCK DEFINITIONS */
  394. #define HPMFWUPG_SEND_DATA_COUNT_KCS 30
  395. #define HPMFWUPG_SEND_DATA_COUNT_LAN 25
  396. #define HPMFWUPG_SEND_DATA_COUNT_IPMB 26
  397. #define HPMFWUPG_SEND_DATA_COUNT_IPMBL 26
  398. #ifdef HAVE_PRAGMA_PACK
  399. # pragma pack(1)
  400. #endif
  401. struct HpmfwupgUploadFirmwareBlockReq {
  402. unsigned char picmgId;
  403. unsigned char blockNumber;
  404. unsigned char data[];
  405. } ATTRIBUTE_PACKING;
  406. #ifdef HAVE_PRAGMA_PACK
  407. # pragma pack(0)
  408. #endif
  409. #ifdef HAVE_PRAGMA_PACK
  410. # pragma pack(1)
  411. #endif
  412. struct HpmfwupgUploadFirmwareBlockResp {
  413. unsigned char picmgId;
  414. } ATTRIBUTE_PACKING;
  415. #ifdef HAVE_PRAGMA_PACK
  416. # pragma pack(0)
  417. #endif
  418. #ifdef HAVE_PRAGMA_PACK
  419. # pragma pack(1)
  420. #endif
  421. struct HpmfwupgUploadFirmwareBlockCtx {
  422. struct HpmfwupgUploadFirmwareBlockReq * req;
  423. struct HpmfwupgUploadFirmwareBlockResp resp;
  424. } ATTRIBUTE_PACKING;
  425. #ifdef HAVE_PRAGMA_PACK
  426. # pragma pack(0)
  427. #endif
  428. /* FINISH FIRMWARE UPLOAD DEFINITIONS */
  429. #define HPMFWUPG_IMAGE_SIZE_BYTE_COUNT 4
  430. #ifdef HAVE_PRAGMA_PACK
  431. # pragma pack(1)
  432. #endif
  433. struct HpmfwupgFinishFirmwareUploadReq {
  434. unsigned char picmgId;
  435. unsigned char componentId;
  436. unsigned char imageLength[HPMFWUPG_IMAGE_SIZE_BYTE_COUNT];
  437. } ATTRIBUTE_PACKING;
  438. #ifdef HAVE_PRAGMA_PACK
  439. # pragma pack(0)
  440. #endif
  441. #ifdef HAVE_PRAGMA_PACK
  442. # pragma pack(1)
  443. #endif
  444. struct HpmfwupgFinishFirmwareUploadResp {
  445. unsigned char picmgId;
  446. } ATTRIBUTE_PACKING;
  447. #ifdef HAVE_PRAGMA_PACK
  448. # pragma pack(0)
  449. #endif
  450. #ifdef HAVE_PRAGMA_PACK
  451. # pragma pack(1)
  452. #endif
  453. struct HpmfwupgFinishFirmwareUploadCtx {
  454. struct HpmfwupgFinishFirmwareUploadReq req;
  455. struct HpmfwupgFinishFirmwareUploadResp resp;
  456. } ATTRIBUTE_PACKING;
  457. #ifdef HAVE_PRAGMA_PACK
  458. # pragma pack(0)
  459. #endif
  460. /* ACTIVATE FW DEFINITIONS */
  461. #ifdef HAVE_PRAGMA_PACK
  462. # pragma pack(1)
  463. #endif
  464. struct HpmfwupgActivateFirmwareReq {
  465. unsigned char picmgId;
  466. unsigned char rollback_override;
  467. } ATTRIBUTE_PACKING;
  468. #ifdef HAVE_PRAGMA_PACK
  469. # pragma pack(0)
  470. #endif
  471. #ifdef HAVE_PRAGMA_PACK
  472. # pragma pack(1)
  473. #endif
  474. struct HpmfwupgActivateFirmwareResp {
  475. unsigned char picmgId;
  476. } ATTRIBUTE_PACKING;
  477. #ifdef HAVE_PRAGMA_PACK
  478. # pragma pack(0)
  479. #endif
  480. #ifdef HAVE_PRAGMA_PACK
  481. # pragma pack(1)
  482. #endif
  483. struct HpmfwupgActivateFirmwareCtx {
  484. struct HpmfwupgActivateFirmwareReq req;
  485. struct HpmfwupgActivateFirmwareResp resp;
  486. } ATTRIBUTE_PACKING;
  487. #ifdef HAVE_PRAGMA_PACK
  488. # pragma pack(0)
  489. #endif
  490. /* GET UPGRADE STATUS DEFINITIONS */
  491. #ifdef HAVE_PRAGMA_PACK
  492. # pragma pack(1)
  493. #endif
  494. struct HpmfwupgGetUpgradeStatusReq {
  495. unsigned char picmgId;
  496. } ATTRIBUTE_PACKING;
  497. #ifdef HAVE_PRAGMA_PACK
  498. # pragma pack(0)
  499. #endif
  500. #ifdef HAVE_PRAGMA_PACK
  501. # pragma pack(1)
  502. #endif
  503. struct HpmfwupgGetUpgradeStatusResp {
  504. unsigned char picmgId;
  505. unsigned char cmdInProcess;
  506. unsigned char lastCmdCompCode;
  507. } ATTRIBUTE_PACKING;
  508. #ifdef HAVE_PRAGMA_PACK
  509. # pragma pack(0)
  510. #endif
  511. #ifdef HAVE_PRAGMA_PACK
  512. # pragma pack(1)
  513. #endif
  514. struct HpmfwupgGetUpgradeStatusCtx {
  515. struct HpmfwupgGetUpgradeStatusReq req;
  516. struct HpmfwupgGetUpgradeStatusResp resp;
  517. } ATTRIBUTE_PACKING;
  518. #ifdef HAVE_PRAGMA_PACK
  519. # pragma pack(0)
  520. #endif
  521. /* MANUAL FW ROLLBACK DEFINITIONS */
  522. #ifdef HAVE_PRAGMA_PACK
  523. # pragma pack(1)
  524. #endif
  525. struct HpmfwupgManualFirmwareRollbackReq {
  526. unsigned char picmgId;
  527. } ATTRIBUTE_PACKING;
  528. #ifdef HAVE_PRAGMA_PACK
  529. # pragma pack(0)
  530. #endif
  531. #ifdef HAVE_PRAGMA_PACK
  532. # pragma pack(1)
  533. #endif
  534. struct HpmfwupgManualFirmwareRollbackResp {
  535. unsigned char picmgId;
  536. } ATTRIBUTE_PACKING;
  537. #ifdef HAVE_PRAGMA_PACK
  538. # pragma pack(0)
  539. #endif
  540. #ifdef HAVE_PRAGMA_PACK
  541. # pragma pack(0)
  542. #endif
  543. struct HpmfwupgManualFirmwareRollbackCtx {
  544. struct HpmfwupgManualFirmwareRollbackReq req;
  545. struct HpmfwupgManualFirmwareRollbackResp resp;
  546. } ATTRIBUTE_PACKING;
  547. #ifdef HAVE_PRAGMA_PACK
  548. # pragma pack(0)
  549. #endif
  550. /* QUERY ROLLBACK STATUS DEFINITIONS */
  551. #ifdef HAVE_PRAGMA_PACK
  552. # pragma pack(1)
  553. #endif
  554. struct HpmfwupgQueryRollbackStatusReq {
  555. unsigned char picmgId;
  556. } ATTRIBUTE_PACKING;
  557. #ifdef HAVE_PRAGMA_PACK
  558. # pragma pack(0)
  559. #endif
  560. #ifdef HAVE_PRAGMA_PACK
  561. # pragma pack(1)
  562. #endif
  563. struct HpmfwupgQueryRollbackStatusResp {
  564. unsigned char picmgId;
  565. struct HpmfwupgComponentBitMask rollbackComp;
  566. } ATTRIBUTE_PACKING;
  567. #ifdef HAVE_PRAGMA_PACK
  568. # pragma pack(0)
  569. #endif
  570. #ifdef HAVE_PRAGMA_PACK
  571. # pragma pack(1)
  572. #endif
  573. struct HpmfwupgQueryRollbackStatusCtx {
  574. struct HpmfwupgQueryRollbackStatusReq req;
  575. struct HpmfwupgQueryRollbackStatusResp resp;
  576. } ATTRIBUTE_PACKING;
  577. #ifdef HAVE_PRAGMA_PACK
  578. # pragma pack(0)
  579. #endif
  580. /* QUERY SELF TEST RESULT DEFINITIONS */
  581. #ifdef HAVE_PRAGMA_PACK
  582. # pragma pack(1)
  583. #endif
  584. struct HpmfwupgQuerySelftestResultReq {
  585. unsigned char picmgId;
  586. } ATTRIBUTE_PACKING;
  587. #ifdef HAVE_PRAGMA_PACK
  588. # pragma pack(0)
  589. #endif
  590. #ifdef HAVE_PRAGMA_PACK
  591. # pragma pack(1)
  592. #endif
  593. struct HpmfwupgQuerySelftestResultResp {
  594. unsigned char picmgId;
  595. unsigned char result1;
  596. unsigned char result2;
  597. } ATTRIBUTE_PACKING;
  598. #ifdef HAVE_PRAGMA_PACK
  599. # pragma pack(0)
  600. #endif
  601. #ifdef HAVE_PRAGMA_PACK
  602. # pragma pack(1)
  603. #endif
  604. struct HpmfwupgQuerySelftestResultCtx {
  605. struct HpmfwupgQuerySelftestResultReq req;
  606. struct HpmfwupgQuerySelftestResultResp resp;
  607. } ATTRIBUTE_PACKING;
  608. #ifdef HAVE_PRAGMA_PACK
  609. # pragma pack(0)
  610. #endif
  611. /* HPM.1 IMAGE DEFINITIONS */
  612. #define HPMFWUPG_HEADER_SIGNATURE_LENGTH 8
  613. #define HPMFWUPG_MANUFATURER_ID_LENGTH 3
  614. #define HPMFWUPG_PRODUCT_ID_LENGTH 2
  615. #define HPMFWUPG_TIME_LENGTH 4
  616. #define HPMFWUPG_TIMEOUT_LENGTH 1
  617. #define HPMFWUPG_COMP_REVISION_LENGTH 2
  618. #define HPMFWUPG_FIRM_REVISION_LENGTH 6
  619. #define HPMFWUPG_IMAGE_HEADER_VERSION 0
  620. #define HPMFWUPG_IMAGE_SIGNATURE "PICMGFWU"
  621. #ifdef HAVE_PRAGMA_PACK
  622. #pragma pack(1)
  623. #endif
  624. struct HpmfwupgImageHeader {
  625. char signature[HPMFWUPG_HEADER_SIGNATURE_LENGTH];
  626. unsigned char formatVersion;
  627. unsigned char deviceId;
  628. unsigned char manId[HPMFWUPG_MANUFATURER_ID_LENGTH];
  629. unsigned char prodId[HPMFWUPG_PRODUCT_ID_LENGTH];
  630. unsigned char time[HPMFWUPG_TIME_LENGTH];
  631. union {
  632. struct {
  633. #if WORDS_BIGENDIAN
  634. unsigned char imageSelfTest : 1;
  635. unsigned char autRollback : 1;
  636. unsigned char manRollback : 1;
  637. unsigned char servAffected : 1;
  638. unsigned char reserved : 4;
  639. #else
  640. unsigned char reserved : 4;
  641. unsigned char servAffected : 1;
  642. unsigned char manRollback : 1;
  643. unsigned char autRollback : 1;
  644. unsigned char imageSelfTest : 1;
  645. #endif
  646. } ATTRIBUTE_PACKING bitField;
  647. unsigned char byte;
  648. }ATTRIBUTE_PACKING imageCapabilities;
  649. struct HpmfwupgComponentBitMask components;
  650. unsigned char selfTestTimeout;
  651. unsigned char rollbackTimeout;
  652. unsigned char inaccessTimeout;
  653. unsigned char compRevision[HPMFWUPG_COMP_REVISION_LENGTH];
  654. unsigned char firmRevision[HPMFWUPG_FIRM_REVISION_LENGTH];
  655. unsigned short oemDataLength;
  656. } ATTRIBUTE_PACKING;
  657. #ifdef HAVE_PRAGMA_PACK
  658. # pragma pack(0)
  659. #endif
  660. #define HPMFWUPG_DESCRIPTION_LENGTH 21
  661. #ifdef HAVE_PRAGMA_PACK
  662. # pragma pack(1)
  663. #endif
  664. struct HpmfwupgActionRecord {
  665. unsigned char actionType;
  666. struct HpmfwupgComponentBitMask components;
  667. unsigned char checksum;
  668. } ATTRIBUTE_PACKING;
  669. #ifdef HAVE_PRAGMA_PACK
  670. # pragma pack(0)
  671. #endif
  672. #define HPMFWUPG_FIRMWARE_SIZE_LENGTH 4
  673. #ifdef HAVE_PRAGMA_PACK
  674. # pragma pack(1)
  675. #endif
  676. struct HpmfwupgFirmwareImage {
  677. unsigned char version[HPMFWUPG_FIRM_REVISION_LENGTH];
  678. char desc[HPMFWUPG_DESCRIPTION_LENGTH];
  679. unsigned char length[HPMFWUPG_FIRMWARE_SIZE_LENGTH];
  680. } ATTRIBUTE_PACKING;
  681. #ifdef HAVE_PRAGMA_PACK
  682. # pragma pack(0)
  683. #endif
  684. #ifdef HAVE_PRAGMA_PACK
  685. # pragma pack(1)
  686. #endif
  687. struct HpmfwupgUpgradeCtx {
  688. struct HpmfwupgComponentBitMask compUpdateMask;
  689. unsigned int imageSize;
  690. unsigned char* pImageData;
  691. unsigned char componentId;
  692. struct HpmfwupgGetTargetUpgCapabilitiesResp targetCap;
  693. struct HpmfwupgGetGeneralPropResp genCompProp[HPMFWUPG_COMPONENT_ID_MAX];
  694. struct ipm_devid_rsp devId;
  695. } ATTRIBUTE_PACKING;
  696. #ifdef HAVE_PRAGMA_PACK
  697. # pragma pack(0)
  698. #endif
  699. typedef enum eHpmfwupgActionType {
  700. HPMFWUPG_ACTION_BACKUP_COMPONENTS = 0,
  701. HPMFWUPG_ACTION_PREPARE_COMPONENTS,
  702. HPMFWUPG_ACTION_UPLOAD_FIRMWARE,
  703. HPMFWUPG_ACTION_RESERVED = 0xFF
  704. } tHpmfwupgActionType;
  705. /* FUNCTIONS PROTOTYPES */
  706. #define HPMFWUPG_MAJORMINOR_VERSION_SIZE 2
  707. /* Options added for user to check the version and to view both the FILE and
  708. * TARGET Version
  709. */
  710. #define VIEW_MODE 0x01
  711. #define DEBUG_MODE 0x02
  712. #define FORCE_MODE 0x04
  713. #define COMPARE_MODE 0x08
  714. typedef struct _VERSIONINFO {
  715. unsigned char componentId;
  716. unsigned char targetMajor;
  717. unsigned char targetMinor;
  718. unsigned char targetAux[4];
  719. unsigned char rollbackMajor;
  720. unsigned char rollbackMinor;
  721. unsigned char rollbackAux[4];
  722. unsigned char deferredMajor;
  723. unsigned char deferredMinor;
  724. unsigned char deferredAux[4];
  725. unsigned char imageMajor;
  726. unsigned char imageMinor;
  727. unsigned char imageAux[4];
  728. unsigned char coldResetRequired;
  729. unsigned char rollbackSupported;
  730. unsigned char deferredActivationSupported;
  731. char descString[HPMFWUPG_DESC_STRING_LENGTH + 1];
  732. }VERSIONINFO, *PVERSIONINFO;
  733. VERSIONINFO gVersionInfo[HPMFWUPG_COMPONENT_ID_MAX];
  734. #define TARGET_VER (0x01)
  735. #define ROLLBACK_VER (0x02)
  736. #define IMAGE_VER (0x04)
  737. #endif /* IPMI_KFWUM_H */