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