summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ipmi-storage.c
blob: 7251fdbd951129829ca8200b99fd169df767b485 (plain)
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
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
/* packet-ipmi-storage.c
 * Sub-dissectors for IPMI messages (netFn=Storage)
 * Copyright 2007-2008, Alexey Neyman, Pigeon Point Systems <avn@pigeonpoint.com>
 *
 * Wireshark - Network traffic analyzer
 * By Gerald Combs <gerald@wireshark.org>
 * Copyright 1998 Gerald Combs
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

#include "config.h"

#include <epan/packet.h>

#include "packet-ipmi.h"

void proto_register_ipmi_storage(void);

static gint ett_ipmi_stor_10_flags = -1;
static gint ett_ipmi_stor_20_ops = -1;
static gint ett_ipmi_stor_25_byte6 = -1;
static gint ett_ipmi_stor_27_status = -1;
static gint ett_ipmi_stor_2c_rq_byte1 = -1;
static gint ett_ipmi_stor_2c_rs_byte1 = -1;
static gint ett_ipmi_stor_40_ops = -1;
static gint ett_ipmi_stor_45_byte6 = -1;
static gint ett_ipmi_stor_47_status = -1;
static gint ett_ipmi_stor_5a_byte1 = -1;
static gint ett_ipmi_stor_5b_byte1 = -1;

static gint hf_ipmi_stor_10_fruid = -1;
static gint hf_ipmi_stor_10_size = -1;
static gint hf_ipmi_stor_10_access = -1;

static gint hf_ipmi_stor_11_fruid = -1;
static gint hf_ipmi_stor_11_offset = -1;
static gint hf_ipmi_stor_11_count = -1;
static gint hf_ipmi_stor_11_ret_count = -1;
static gint hf_ipmi_stor_11_data = -1;

static gint hf_ipmi_stor_12_fruid = -1;
static gint hf_ipmi_stor_12_offset = -1;
static gint hf_ipmi_stor_12_data = -1;
static gint hf_ipmi_stor_12_ret_count = -1;

static gint hf_ipmi_stor_20_sdr_version = -1;
static gint hf_ipmi_stor_20_rec_count = -1;
static gint hf_ipmi_stor_20_free_space = -1;
static gint hf_ipmi_stor_20_ts_add = -1;
static gint hf_ipmi_stor_20_ts_erase = -1;
static gint hf_ipmi_stor_20_op_overflow = -1;
static gint hf_ipmi_stor_20_op_update = -1;
static gint hf_ipmi_stor_20_op_delete = -1;
static gint hf_ipmi_stor_20_op_partial_add = -1;
static gint hf_ipmi_stor_20_op_reserve = -1;
static gint hf_ipmi_stor_20_op_allocinfo = -1;

static gint hf_ipmi_stor_21_units = -1;
static gint hf_ipmi_stor_21_size = -1;
static gint hf_ipmi_stor_21_free = -1;
static gint hf_ipmi_stor_21_largest = -1;
static gint hf_ipmi_stor_21_maxrec = -1;

static gint hf_ipmi_stor_22_rsrv_id = -1;

static gint hf_ipmi_stor_23_rsrv_id = -1;
static gint hf_ipmi_stor_23_rec_id = -1;
static gint hf_ipmi_stor_23_offset = -1;
static gint hf_ipmi_stor_23_count = -1;
static gint hf_ipmi_stor_23_next = -1;
static gint hf_ipmi_stor_23_data = -1;

static gint hf_ipmi_stor_24_data = -1;
static gint hf_ipmi_stor_24_added_rec_id = -1;

static gint hf_ipmi_stor_25_rsrv_id = -1;
static gint hf_ipmi_stor_25_rec_id = -1;
static gint hf_ipmi_stor_25_offset = -1;
static gint hf_ipmi_stor_25_inprogress = -1;
static gint hf_ipmi_stor_25_data = -1;
static gint hf_ipmi_stor_25_added_rec_id = -1;

#if 0
static gint hf_ipmi_stor_26_rsrv_id = -1;
static gint hf_ipmi_stor_26_rec_id = -1;
#endif
static gint hf_ipmi_stor_26_del_rec_id = -1;

static gint hf_ipmi_stor_27_rsrv_id = -1;
static gint hf_ipmi_stor_27_clr = -1;
static gint hf_ipmi_stor_27_action = -1;
static gint hf_ipmi_stor_27_status = -1;

static gint hf_ipmi_stor_28_time = -1;

static gint hf_ipmi_stor_29_time = -1;

static gint hf_ipmi_stor_2c_init_agent = -1;
static gint hf_ipmi_stor_2c_init_state = -1;

static gint hf_ipmi_stor_40_sel_version = -1;
static gint hf_ipmi_stor_40_entries = -1;
static gint hf_ipmi_stor_40_free_space = -1;
static gint hf_ipmi_stor_40_ts_add = -1;
static gint hf_ipmi_stor_40_ts_erase = -1;
static gint hf_ipmi_stor_40_op_overflow = -1;
static gint hf_ipmi_stor_40_op_delete = -1;
static gint hf_ipmi_stor_40_op_partial_add = -1;
static gint hf_ipmi_stor_40_op_reserve = -1;
static gint hf_ipmi_stor_40_op_allocinfo = -1;

static gint hf_ipmi_stor_41_units = -1;
static gint hf_ipmi_stor_41_size = -1;
static gint hf_ipmi_stor_41_free = -1;
static gint hf_ipmi_stor_41_largest = -1;
static gint hf_ipmi_stor_41_maxrec = -1;

static gint hf_ipmi_stor_42_rsrv_id = -1;

static gint hf_ipmi_stor_43_rsrv_id = -1;
static gint hf_ipmi_stor_43_rec_id = -1;
static gint hf_ipmi_stor_43_offset = -1;
static gint hf_ipmi_stor_43_count = -1;
static gint hf_ipmi_stor_43_next = -1;
static gint hf_ipmi_stor_43_data = -1;

static gint hf_ipmi_stor_44_data = -1;
static gint hf_ipmi_stor_44_added_rec_id = -1;

static gint hf_ipmi_stor_45_rsrv_id = -1;
static gint hf_ipmi_stor_45_rec_id = -1;
static gint hf_ipmi_stor_45_offset = -1;
static gint hf_ipmi_stor_45_inprogress = -1;
static gint hf_ipmi_stor_45_data = -1;
static gint hf_ipmi_stor_45_added_rec_id = -1;

#if 0
static gint hf_ipmi_stor_46_rsrv_id = -1;
static gint hf_ipmi_stor_46_rec_id = -1;
#endif
static gint hf_ipmi_stor_46_del_rec_id = -1;

static gint hf_ipmi_stor_47_rsrv_id = -1;
static gint hf_ipmi_stor_47_clr = -1;
static gint hf_ipmi_stor_47_action = -1;
static gint hf_ipmi_stor_47_status = -1;

static gint hf_ipmi_stor_48_time = -1;

static gint hf_ipmi_stor_49_time = -1;

static gint hf_ipmi_stor_5a_log_type = -1;
static gint hf_ipmi_stor_5a_ts_add = -1;
static gint hf_ipmi_stor_5a_num_entries = -1;
static gint hf_ipmi_stor_5a_iana = -1;
static gint hf_ipmi_stor_5a_bytes = -1;
static gint hf_ipmi_stor_5a_unknown = -1;

static gint hf_ipmi_stor_5b_log_type = -1;
static gint hf_ipmi_stor_5b_ts_add = -1;
static gint hf_ipmi_stor_5b_num_entries = -1;
static gint hf_ipmi_stor_5b_iana = -1;
static gint hf_ipmi_stor_5b_bytes = -1;
static gint hf_ipmi_stor_5b_unknown = -1;

static const struct true_false_string tfs_10_access = {
	"by words", "by bytes"
};

static const value_string vals_20_update[] = {
	{ 0x00, "Unspecified" },
	{ 0x01, "Supported non-modal" },
	{ 0x02, "Supported modal" },
	{ 0x03, "Supported both modal and non-modal" },
	{ 0, NULL }
};

static const value_string vals_25_inprogress[] = {
	{ 0x00, "Partial add in progress" },
	{ 0x01, "Last record data being transferred" },
	{ 0, NULL }
};

static const value_string vals_27_action[] = {
	{ 0x00, "Get Erasure Status" },
	{ 0xaa, "Initiate Erase" },
	{ 0, NULL }
};

static const value_string vals_27_status[] = {
	{ 0x00, "Erasure in progress" },
	{ 0x01, "Erase completed" },
	{ 0, NULL }
};

static const struct true_false_string tfs_2c_init_agent = {
	"Run", "Get status"
};

static const struct true_false_string tfs_2c_init_state = {
	"Completed", "In progress"
};

static const value_string vals_45_inprogress[] = {
	{ 0x00, "Partial add in progress" },
	{ 0x01, "Last record data being transferred" },
	{ 0, NULL }
};

static const value_string vals_47_action[] = {
	{ 0x00, "Get Erasure Status" },
	{ 0xaa, "Initiate Erase" },
	{ 0, NULL }
};

static const value_string vals_47_status[] = {
	{ 0x00, "Erasure in progress" },
	{ 0x01, "Erase completed" },
	{ 0, NULL }
};

static const value_string log_type_vals[] = {
	{ 0x00, "MCA Log" },
	{ 0x01, "OEM 1" },
	{ 0x02, "OEM 2" },
	{ 0, NULL }
};

/* Get FRU Inventory Area Info
 */
static void
rq10(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	proto_tree_add_item(tree, hf_ipmi_stor_10_fruid, tvb, 0, 1, ENC_LITTLE_ENDIAN);
}

static void
rs10(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	static int * const flags[] = { &hf_ipmi_stor_10_access, NULL };

	proto_tree_add_item(tree, hf_ipmi_stor_10_size, tvb, 0, 2, ENC_LITTLE_ENDIAN);
	proto_tree_add_bitmask_text(tree, tvb, 2, 1, NULL, NULL, ett_ipmi_stor_10_flags, flags, ENC_LITTLE_ENDIAN, 0);
}

/* Read FRU Data
 */
static void
rq11(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	proto_tree_add_item(tree, hf_ipmi_stor_11_fruid, tvb, 0, 1, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(tree, hf_ipmi_stor_11_offset, tvb, 1, 2, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(tree, hf_ipmi_stor_11_count, tvb, 3, 1, ENC_LITTLE_ENDIAN);
}

static void
rs11(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	proto_tree_add_item(tree, hf_ipmi_stor_11_ret_count, tvb, 0, 1, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(tree, hf_ipmi_stor_11_data, tvb, 1, -1, ENC_NA);
}

static const value_string cc11[] = {
	{ 0x81, "FRU Device Busy" },
	{ 0, NULL }
};

/* Write FRU Data
 */
static void
rq12(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	proto_tree_add_item(tree, hf_ipmi_stor_12_fruid, tvb, 0, 1, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(tree, hf_ipmi_stor_12_offset, tvb, 1, 2, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(tree, hf_ipmi_stor_12_data, tvb, 3, -1, ENC_NA);
}

static void
rs12(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	proto_tree_add_item(tree, hf_ipmi_stor_12_ret_count, tvb, 0, 1, ENC_LITTLE_ENDIAN);
}

static const value_string cc12[] = {
	{ 0x80, "Write-protected offset" },
	{ 0x81, "FRU Device Busy" },
	{ 0, NULL }
};

/* Get SDR Repository Info
 */
static void
rs20(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
	static int * const ops[] = { &hf_ipmi_stor_20_op_overflow, &hf_ipmi_stor_20_op_update,
		&hf_ipmi_stor_20_op_delete, &hf_ipmi_stor_20_op_partial_add, &hf_ipmi_stor_20_op_reserve,
		&hf_ipmi_stor_20_op_allocinfo, NULL };

	proto_tree_add_item(tree, hf_ipmi_stor_20_sdr_version, tvb, 0, 1, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(tree, hf_ipmi_stor_20_rec_count, tvb, 1, 2, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(tree, hf_ipmi_stor_20_free_space, tvb, 3, 2, ENC_LITTLE_ENDIAN);
	ipmi_add_timestamp(pinfo, tree, hf_ipmi_stor_20_ts_add, tvb, 5);
	ipmi_add_timestamp(pinfo, tree, hf_ipmi_stor_20_ts_erase, tvb, 9);
	proto_tree_add_bitmask_text(tree, tvb, 13, 1, "Operation Support: ", NULL,
			ett_ipmi_stor_20_ops, ops, ENC_LITTLE_ENDIAN, 0);
}

/* Get SDR Repository Allocation Info
 */
static void
rs21(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	proto_tree_add_item(tree, hf_ipmi_stor_21_units, tvb, 0, 2, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(tree, hf_ipmi_stor_21_size, tvb, 2, 2, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(tree, hf_ipmi_stor_21_free, tvb, 4, 2, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(tree, hf_ipmi_stor_21_largest, tvb, 6, 2, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(tree, hf_ipmi_stor_21_maxrec, tvb, 8, 1, ENC_LITTLE_ENDIAN);
}

/* Reserve SDR Repository
 */
static void
rs22(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	proto_tree_add_item(tree, hf_ipmi_stor_22_rsrv_id, tvb, 0, 2, ENC_LITTLE_ENDIAN);
}

/* Get SDR
 */
static void
rq23(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	guint8 v = tvb_get_guint8(tvb, 5);

	proto_tree_add_item(tree, hf_ipmi_stor_23_rsrv_id, tvb, 0, 2, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(tree, hf_ipmi_stor_23_rec_id, tvb, 2, 2, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(tree, hf_ipmi_stor_23_offset, tvb, 4, 1, ENC_LITTLE_ENDIAN);
	proto_tree_add_uint_format_value(tree, hf_ipmi_stor_23_count, tvb, 5, 1,
			v, "%d%s", v, v == 0xff ? " (entire record)" : "");
}

static void
rs23(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	proto_tree_add_item(tree, hf_ipmi_stor_23_next, tvb, 0, 2, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(tree, hf_ipmi_stor_23_data, tvb, 2, -1, ENC_NA);
}

/* Add SDR
 */
static void
rq24(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	proto_tree_add_item(tree, hf_ipmi_stor_24_data, tvb, 0, -1, ENC_NA);
}

static void
rs24(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	proto_tree_add_item(tree, hf_ipmi_stor_24_added_rec_id, tvb, 0, 2, ENC_LITTLE_ENDIAN);
}

/* Partial Add SDR
 */
static void
rq25(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	static int * const byte6[] = { &hf_ipmi_stor_25_inprogress, NULL };

	proto_tree_add_item(tree, hf_ipmi_stor_25_rsrv_id, tvb, 0, 2, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(tree, hf_ipmi_stor_25_rec_id, tvb, 2, 2, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(tree, hf_ipmi_stor_25_offset, tvb, 4, 1, ENC_LITTLE_ENDIAN);
	proto_tree_add_bitmask_text(tree, tvb, 5, 1, NULL, NULL,
			ett_ipmi_stor_25_byte6, byte6, ENC_LITTLE_ENDIAN, 0);
	proto_tree_add_item(tree, hf_ipmi_stor_25_data, tvb, 6, -1, ENC_NA);
}

static void
rs25(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	proto_tree_add_item(tree, hf_ipmi_stor_25_added_rec_id, tvb, 0, 2, ENC_LITTLE_ENDIAN);
}

static const value_string cc25[] = {
	{ 0x80, "Record rejected due to length mismatch" },
	{ 0, NULL }
};

/* Delete SDR
 */
static void
rq26(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	proto_tree_add_item(tree, hf_ipmi_stor_25_rsrv_id, tvb, 0, 2, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(tree, hf_ipmi_stor_25_rec_id, tvb, 2, 2, ENC_LITTLE_ENDIAN);
}

static void
rs26(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	proto_tree_add_item(tree, hf_ipmi_stor_26_del_rec_id, tvb, 0, 2, ENC_LITTLE_ENDIAN);
}

/* Clear SDR Repository
 */
static void
rq27(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	proto_tree_add_item(tree, hf_ipmi_stor_27_rsrv_id, tvb, 0, 2, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(tree, hf_ipmi_stor_27_clr, tvb, 2, 3, ENC_ASCII);
	proto_tree_add_item(tree, hf_ipmi_stor_27_action, tvb, 5, 1, ENC_LITTLE_ENDIAN);
}

static void
rs27(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	static int * const status[] = { &hf_ipmi_stor_27_status, NULL };

	proto_tree_add_bitmask_text(tree, tvb, 0, 1, NULL, NULL,
			ett_ipmi_stor_27_status, status, ENC_LITTLE_ENDIAN, 0);
}

/* Get SDR Repository Time
 */
static void
rs28(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
	ipmi_add_timestamp(pinfo, tree, hf_ipmi_stor_28_time, tvb, 0);
}

/* Set SDR Repository Time
 */
static void
rq29(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
	ipmi_add_timestamp(pinfo, tree, hf_ipmi_stor_29_time, tvb, 0);
}

/* Run Initialization Agent
 */
static void
rq2c(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	static int * const byte1[] = { &hf_ipmi_stor_2c_init_agent, NULL };

	proto_tree_add_bitmask_text(tree, tvb, 0, 1, NULL, NULL,
			ett_ipmi_stor_2c_rq_byte1, byte1, ENC_LITTLE_ENDIAN, 0);
}

static void
rs2c(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	static int * const byte1[] = { &hf_ipmi_stor_2c_init_state, NULL };

	proto_tree_add_bitmask_text(tree, tvb, 0, 1, NULL, NULL,
			ett_ipmi_stor_2c_rs_byte1, byte1, ENC_LITTLE_ENDIAN, 0);
}

/* Get SEL Info
 */
static void
rs40(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
	static int * const ops[] = { &hf_ipmi_stor_40_op_overflow, &hf_ipmi_stor_40_op_delete,
		&hf_ipmi_stor_40_op_partial_add, &hf_ipmi_stor_40_op_reserve, &hf_ipmi_stor_40_op_allocinfo, NULL };

	proto_tree_add_item(tree, hf_ipmi_stor_40_sel_version, tvb, 0, 1, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(tree, hf_ipmi_stor_40_entries, tvb, 1, 2, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(tree, hf_ipmi_stor_40_free_space, tvb, 3, 2, ENC_LITTLE_ENDIAN);
	ipmi_add_timestamp(pinfo, tree, hf_ipmi_stor_40_ts_add, tvb, 5);
	ipmi_add_timestamp(pinfo, tree, hf_ipmi_stor_40_ts_erase, tvb, 9);
	proto_tree_add_bitmask_text(tree, tvb, 13, 1, "Operation Support: ", NULL,
			ett_ipmi_stor_40_ops, ops, ENC_LITTLE_ENDIAN, 0);
}

static const value_string cc40[] = {
	{ 0x81, "Cannot execute command, SEL erase in progress" },
	{ 0, NULL }
};

/* Get SEL Allocation Info
 */
static void
rs41(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	proto_tree_add_item(tree, hf_ipmi_stor_41_units, tvb, 0, 2, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(tree, hf_ipmi_stor_41_size, tvb, 2, 2, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(tree, hf_ipmi_stor_41_free, tvb, 4, 2, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(tree, hf_ipmi_stor_41_largest, tvb, 6, 2, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(tree, hf_ipmi_stor_41_maxrec, tvb, 8, 1, ENC_LITTLE_ENDIAN);
}

/* Reserve SEL
 */
static void
rs42(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	proto_tree_add_item(tree, hf_ipmi_stor_42_rsrv_id, tvb, 0, 2, ENC_LITTLE_ENDIAN);
}

static const value_string cc42[] = {
	{ 0x81, "Cannot execute command, SEL erase in progress" },
	{ 0, NULL }
};

/* Get SEL Entry
 */
static void
rq43(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	guint8 v = tvb_get_guint8(tvb, 5);

	proto_tree_add_item(tree, hf_ipmi_stor_43_rsrv_id, tvb, 0, 2, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(tree, hf_ipmi_stor_43_rec_id, tvb, 2, 2, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(tree, hf_ipmi_stor_43_offset, tvb, 4, 1, ENC_LITTLE_ENDIAN);
	proto_tree_add_uint_format_value(tree, hf_ipmi_stor_43_count, tvb, 5, 1,
			v, "%d%s", v, v == 0xff ? " (entire record)" : "");
}

static void
rs43(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	proto_tree_add_item(tree, hf_ipmi_stor_43_next, tvb, 0, 2, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(tree, hf_ipmi_stor_43_data, tvb, 2, -1, ENC_NA);
}

static const value_string cc43[] = {
	{ 0x81, "Cannot execute command, SEL erase in progress" },
	{ 0, NULL }
};

/* Add SEL Entry
 */

static void
rq44(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	proto_tree_add_item(tree, hf_ipmi_stor_44_data, tvb, 0, -1, ENC_NA);
}

static void
rs44(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	proto_tree_add_item(tree, hf_ipmi_stor_44_added_rec_id, tvb, 0, 2, ENC_LITTLE_ENDIAN);
}

static const value_string cc44[] = {
	{ 0x80, "Operation not supported for this Record Type" },
	{ 0x81, "Cannot execute command, SEL erase in progress" },
	{ 0, NULL }
};

/* Partial Add SEL Entry
 */
static void
rq45(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	static int * const byte6[] = { &hf_ipmi_stor_45_inprogress, NULL };

	proto_tree_add_item(tree, hf_ipmi_stor_45_rsrv_id, tvb, 0, 2, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(tree, hf_ipmi_stor_45_rec_id, tvb, 2, 2, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(tree, hf_ipmi_stor_45_offset, tvb, 4, 1, ENC_LITTLE_ENDIAN);
	proto_tree_add_bitmask_text(tree, tvb, 5, 1, NULL, NULL,
			ett_ipmi_stor_45_byte6, byte6, ENC_LITTLE_ENDIAN, 0);
	proto_tree_add_item(tree, hf_ipmi_stor_45_data, tvb, 6, -1, ENC_NA);
}

static void
rs45(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	proto_tree_add_item(tree, hf_ipmi_stor_45_added_rec_id, tvb, 0, 2, ENC_LITTLE_ENDIAN);
}

static const value_string cc45[] = {
	{ 0x80, "Record rejected due to length mismatch" },
	{ 0x81, "Cannot execute command, SEL erase in progress" },
	{ 0, NULL }
};

/* Delete SEL Entry
 */
static void
rq46(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	proto_tree_add_item(tree, hf_ipmi_stor_45_rsrv_id, tvb, 0, 2, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(tree, hf_ipmi_stor_45_rec_id, tvb, 2, 2, ENC_LITTLE_ENDIAN);
}

static void
rs46(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	proto_tree_add_item(tree, hf_ipmi_stor_46_del_rec_id, tvb, 0, 2, ENC_LITTLE_ENDIAN);
}

static const value_string cc46[] = {
	{ 0x80, "Operation not supported for this Record Type" },
	{ 0x81, "Cannot execute command, SEL erase in progress" },
	{ 0, NULL }
};

/* Clear SEL
 */
static void
rq47(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	proto_tree_add_item(tree, hf_ipmi_stor_47_rsrv_id, tvb, 0, 2, ENC_LITTLE_ENDIAN);
	proto_tree_add_item(tree, hf_ipmi_stor_47_clr, tvb, 2, 3, ENC_ASCII);
	proto_tree_add_item(tree, hf_ipmi_stor_47_action, tvb, 5, 1, ENC_LITTLE_ENDIAN);
}

static void
rs47(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	static int * const status[] = { &hf_ipmi_stor_47_status, NULL };

	proto_tree_add_bitmask_text(tree, tvb, 0, 1, NULL, NULL,
			ett_ipmi_stor_47_status, status, ENC_LITTLE_ENDIAN, 0);
}

/* Get SEL Time
 */
static void
rs48(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
	ipmi_add_timestamp(pinfo, tree, hf_ipmi_stor_48_time, tvb, 0);
}

/* Set SEL Time
 */
static void
rq49(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
	ipmi_add_timestamp(pinfo, tree, hf_ipmi_stor_49_time, tvb, 0);
}

/* Get Auxiliary Log Status
 */
static void
rq5a(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
{
	static int * const byte1[] = { &hf_ipmi_stor_5a_log_type, NULL };

	ipmi_set_data(pinfo, 0, tvb_get_guint8(tvb, 0) & 0x0f);
	if (!tree) {
		return;
	}

	proto_tree_add_bitmask_text(tree, tvb, 0, 1, NULL, NULL,
			ett_ipmi_stor_5a_byte1, byte1, ENC_LITTLE_ENDIAN, 0);
}

static void
rs5a(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
	guint32 v;

	if (!ipmi_get_data(pinfo, 0, &v) || v > 2) {
		proto_tree_add_item(tree, hf_ipmi_stor_5a_unknown, tvb, 0, -1, ENC_NA);
		return;
	}

	ipmi_add_timestamp(pinfo, tree, hf_ipmi_stor_5a_ts_add, tvb, 0);
	if (v  == 0) {
		proto_tree_add_item(tree, hf_ipmi_stor_5a_num_entries, tvb, 4, 4, ENC_LITTLE_ENDIAN);
	} else if (v == 1 || v == 2) {
		proto_tree_add_item(tree, hf_ipmi_stor_5a_iana, tvb, 4, 3, ENC_LITTLE_ENDIAN);
		proto_tree_add_item(tree, hf_ipmi_stor_5a_bytes, tvb, 7, 7, ENC_NA);
	}
}

/* Set Auxiliary Log Status
 */
static void
rq5b(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
	static int * const byte1[] = { &hf_ipmi_stor_5b_log_type, NULL };
	guint8 v = tvb_get_guint8(tvb, 0);

	proto_tree_add_bitmask_text(tree, tvb, 0, 1, NULL, NULL,
			ett_ipmi_stor_5b_byte1, byte1, ENC_LITTLE_ENDIAN, 0);

	if (v > 2) {
		proto_tree_add_item(tree, hf_ipmi_stor_5b_unknown, tvb, 1, -1, ENC_NA);
		return;
	}

	ipmi_add_timestamp(pinfo, tree, hf_ipmi_stor_5b_ts_add, tvb, 1);
	if (v  == 0) {
		proto_tree_add_item(tree, hf_ipmi_stor_5b_num_entries, tvb, 5, 4, ENC_LITTLE_ENDIAN);
	} else if (v == 1 || v == 2) {
		proto_tree_add_item(tree, hf_ipmi_stor_5b_iana, tvb, 5, 3, ENC_LITTLE_ENDIAN);
		proto_tree_add_item(tree, hf_ipmi_stor_5b_bytes, tvb, 8, 8, ENC_NA);
	}
}

static ipmi_cmd_t cmd_storage[] = {
	/* FRU Device Commands */
	{ 0x10, rq10, rs10, NULL, NULL, "Get FRU Inventory Area Info", 0 },
	{ 0x11, rq11, rs11, cc11, NULL, "Read FRU Data", 0 },
	{ 0x12, rq12, rs12, cc12, NULL, "Write FRU Data", 0 },

	/* SDR Device Commands */
	{ 0x20, NULL, rs20, NULL, NULL, "Get SDR Repository Info", 0 },
	{ 0x21, NULL, rs21, NULL, NULL, "Get SDR Repository Allocation Info", 0 },
	{ 0x22, NULL, rs22, NULL, NULL, "Reserve SDR Repository", 0 },
	{ 0x23, rq23, rs23, NULL, NULL, "Get SDR", 0 },
	{ 0x24, rq24, rs24, NULL, NULL, "Add SDR", 0 },
	{ 0x25, rq25, rs25, cc25, NULL, "Partial Add SDR", 0 },
	{ 0x26, rq26, rs26, NULL, NULL, "Delete SDR", 0 },
	{ 0x27, rq27, rs27, NULL, NULL, "Clear SDR Repository", 0 },
	{ 0x28, NULL, rs28, NULL, NULL, "Get SDR Repository Time", 0 },
	{ 0x29, rq29, NULL, NULL, NULL, "Set SDR Repository Time", 0 },
	{ 0x2a, NULL, NULL, NULL, NULL, "Enter SDR Repository Update Mode", 0 },
	{ 0x2b, NULL, NULL, NULL, NULL, "Exit SDR Repository Update Mode", 0 },
	{ 0x2c, rq2c, rs2c, NULL, NULL, "Run Initialization Agent", 0 },

	/* SEL Device Commands */
	{ 0x40, NULL, rs40, cc40, NULL, "Get SEL Info", 0 },
	{ 0x41, NULL, rs41, NULL, NULL, "Get SEL Allocation Info", 0 },
	{ 0x42, NULL, rs42, cc42, NULL, "Reserve SEL", 0 },
	{ 0x43, rq43, rs43, cc43, NULL, "Get SEL Entry", 0 },
	{ 0x44, rq44, rs44, cc44, NULL, "Add SEL Entry", 0 },
	{ 0x45, rq45, rs45, cc45, NULL, "Partial Add SEL Entry", 0 },
	{ 0x46, rq46, rs46, cc46, NULL, "Delete SEL Entry", 0 },
	{ 0x47, rq47, rs47, NULL, NULL, "Clear SEL", 0 },
	{ 0x48, NULL, rs48, NULL, NULL, "Get SEL Time", 0 },
	{ 0x49, rq49, NULL, NULL, NULL, "Set SEL Time", 0 },
	{ 0x5a, rq5a, rs5a, NULL, NULL, "Get Auxiliary Log Status", CMD_CALLRQ },
	{ 0x5b, rq5b, NULL, NULL, NULL, "Set Auxiliary Log Status", 0 },
	{ 0x5c, IPMI_TBD,   NULL, NULL, "Get SEL Time UTC Offset", 0 },
	{ 0x5d, IPMI_TBD,   NULL, NULL, "Set SEL Time UTC Offset", 0 },
};

void
proto_register_ipmi_storage(void)
{
	static hf_register_info hf[] = {
		{ &hf_ipmi_stor_10_fruid,
			{ "FRU ID",
				"ipmi.st10.fruid", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_10_size,
			{ "FRU Inventory area size",
				"ipmi.st10.size", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_10_access,
			{ "Device is accessed",
				"ipmi.st10.access", FT_BOOLEAN, 8, TFS(&tfs_10_access), 0x01, NULL, HFILL }},

		{ &hf_ipmi_stor_11_fruid,
			{ "FRU ID",
				"ipmi.st11.fruid", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_11_offset,
			{ "Offset to read",
				"ipmi.st11.offset", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_11_count,
			{ "Count to read",
				"ipmi.st11.count", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_11_ret_count,
			{ "Returned count",
				"ipmi.st11.ret_count", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_11_data,
			{ "Requested data",
				"ipmi.st11.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},

		{ &hf_ipmi_stor_12_fruid,
			{ "FRU ID",
				"ipmi.st12.fruid", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_12_offset,
			{ "Offset to read",
				"ipmi.st12.offset", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_12_data,
			{ "Requested data",
				"ipmi.st12.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_12_ret_count,
			{ "Returned count",
				"ipmi.st12.ret_count", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},

		{ &hf_ipmi_stor_20_sdr_version,
			{ "SDR Version",
				"ipmi.st20.sdr_version", FT_UINT8, BASE_CUSTOM, CF_FUNC(ipmi_fmt_version), 0, NULL, HFILL }},
		{ &hf_ipmi_stor_20_rec_count,
			{ "Record Count",
				"ipmi.st20.rec_count", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_20_free_space,
			{ "Free Space",
				"ipmi.st20.free_space", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_20_ts_add,
			{ "Most recent addition timestamp",
				"ipmi.st20.ts_add", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_20_ts_erase,
			{ "Most recent erase timestamp",
				"ipmi.st20.ts_erase", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_20_op_overflow,
			{ "Overflow",
				"ipmi.st20.op_overflow", FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
		{ &hf_ipmi_stor_20_op_update,
			{ "SDR Repository Update",
				"ipmi.st20.op_update", FT_UINT8, BASE_HEX, VALS(vals_20_update), 0x60, NULL, HFILL }},
		{ &hf_ipmi_stor_20_op_delete,
			{ "Delete SDR",
				"ipmi.st20.op_delete", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
		{ &hf_ipmi_stor_20_op_partial_add,
			{ "Partial Add SDR",
				"ipmi.st20.op_partial_add", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
		{ &hf_ipmi_stor_20_op_reserve,
			{ "Reserve SDR Repository",
				"ipmi.st20.op_reserve", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }},
		{ &hf_ipmi_stor_20_op_allocinfo,
			{ "Get SDR Repository Allocation Info",
				"ipmi.st20.op_allocinfo", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},

		{ &hf_ipmi_stor_21_units,
			{ "Number of allocation units",
				"ipmi.st21.units", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_21_size,
			{ "Allocation unit size",
				"ipmi.st21.size", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_21_free,
			{ "Number of free units",
				"ipmi.st21.free", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_21_largest,
			{ "Largest free block (in units)",
				"ipmi.st21.largest", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_21_maxrec,
			{ "Maximum record size (in units)",
				"ipmi.st21.maxrec", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},

		{ &hf_ipmi_stor_22_rsrv_id,
			{ "Reservation ID",
				"ipmi.st22.rsrv_id", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},

		{ &hf_ipmi_stor_23_rsrv_id,
			{ "Reservation ID",
				"ipmi.st23.rsrv_id", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_23_rec_id,
			{ "Record ID",
				"ipmi.st23.rec_id", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_23_offset,
			{ "Offset into record",
				"ipmi.st23.offset", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_23_count,
			{ "Bytes to read",
				"ipmi.st23.count", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_23_next,
			{ "Next Record ID",
				"ipmi.st23.next", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_23_data,
			{ "Record Data",
				"ipmi.st23.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},

		{ &hf_ipmi_stor_24_data,
			{ "SDR Data",
				"ipmi.st24.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_24_added_rec_id,
			{ "Record ID for added record",
				"ipmi.st23.added_rec_id", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},

		{ &hf_ipmi_stor_25_rsrv_id,
			{ "Reservation ID",
				"ipmi.st25.rsrv_id", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_25_rec_id,
			{ "Record ID",
				"ipmi.st25.rec_id", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_25_offset,
			{ "Offset into record",
				"ipmi.st25.offset", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_25_inprogress,
			{ "In progress",
				"ipmi.st25.inprogress", FT_UINT8, BASE_HEX, VALS(vals_25_inprogress), 0x0f, NULL, HFILL }},
		{ &hf_ipmi_stor_25_data,
			{ "SDR Data",
				"ipmi.st25.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_25_added_rec_id,
			{ "Record ID for added record",
				"ipmi.st25.added_rec_id", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},

#if 0
		{ &hf_ipmi_stor_26_rsrv_id,
			{ "Reservation ID",
				"ipmi.st26.rsrv_id", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},

		{ &hf_ipmi_stor_26_rec_id,
			{ "Record ID",
				"ipmi.st26.rec_id", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
#endif
		{ &hf_ipmi_stor_26_del_rec_id,
			{ "Deleted Record ID",
				"ipmi.st26.del_rec_id", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},

		{ &hf_ipmi_stor_27_rsrv_id,
			{ "Reservation ID",
				"ipmi.st27.rsrv_id", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_27_clr,
			{ "Confirmation (should be CLR)",
				"ipmi.st27.clr", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_27_action,
			{ "Action",
				"ipmi.st27.action", FT_UINT8, BASE_HEX, VALS(vals_27_action), 0, NULL, HFILL }},
		{ &hf_ipmi_stor_27_status,
			{ "Erasure Status",
				"ipmi.st27.status", FT_UINT8, BASE_HEX, VALS(vals_27_status), 0x0f, NULL, HFILL }},

		{ &hf_ipmi_stor_28_time,
			{ "Time",
				"ipmi.st28.time", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},

		{ &hf_ipmi_stor_29_time,
			{ "Time",
				"ipmi.st29.time", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},

		{ &hf_ipmi_stor_2c_init_agent,
			{ "Initialization agent",
				"ipmi.st2c.init_agent", FT_BOOLEAN, 8, TFS(&tfs_2c_init_agent), 0x01, NULL, HFILL }},
		{ &hf_ipmi_stor_2c_init_state,
			{ "Initialization",
				"ipmi.st2c.init_state", FT_BOOLEAN, 8, TFS(&tfs_2c_init_state), 0x01, NULL, HFILL }},

		{ &hf_ipmi_stor_40_sel_version,
			{ "SEL Version",
				"ipmi.st40.sel_version", FT_UINT8, BASE_CUSTOM, CF_FUNC(ipmi_fmt_version), 0, NULL, HFILL }},
		{ &hf_ipmi_stor_40_entries,
			{ "Entries",
				"ipmi.st40.rec_count", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_40_free_space,
			{ "Free Space",
				"ipmi.st40.free_space", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_40_ts_add,
			{ "Most recent addition timestamp",
				"ipmi.st40.ts_add", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_40_ts_erase,
			{ "Most recent erase timestamp",
				"ipmi.st40.ts_erase", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_40_op_overflow,
			{ "Overflow",
				"ipmi.st40.op_overflow", FT_BOOLEAN, 8, NULL, 0x80, NULL, HFILL }},
		{ &hf_ipmi_stor_40_op_delete,
			{ "Delete SEL",
				"ipmi.st40.op_delete", FT_BOOLEAN, 8, NULL, 0x08, NULL, HFILL }},
		{ &hf_ipmi_stor_40_op_partial_add,
			{ "Partial Add SEL Entry",
				"ipmi.st40.op_partial_add", FT_BOOLEAN, 8, NULL, 0x04, NULL, HFILL }},
		{ &hf_ipmi_stor_40_op_reserve,
			{ "Reserve SEL",
				"ipmi.st40.op_reserve", FT_BOOLEAN, 8, NULL, 0x02, NULL, HFILL }},
		{ &hf_ipmi_stor_40_op_allocinfo,
			{ "Get SEL Allocation Info",
				"ipmi.st40.op_allocinfo", FT_BOOLEAN, 8, NULL, 0x01, NULL, HFILL }},

		{ &hf_ipmi_stor_41_units,
			{ "Number of allocation units",
				"ipmi.st41.units", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_41_size,
			{ "Allocation unit size",
				"ipmi.st41.size", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_41_free,
			{ "Number of free units",
				"ipmi.st41.free", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_41_largest,
			{ "Largest free block (in units)",
				"ipmi.st41.largest", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_41_maxrec,
			{ "Maximum record size (in units)",
				"ipmi.st41.maxrec", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},

		{ &hf_ipmi_stor_42_rsrv_id,
			{ "Reservation ID",
				"ipmi.st42.rsrv_id", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},

		{ &hf_ipmi_stor_43_rsrv_id,
			{ "Reservation ID",
				"ipmi.st43.rsrv_id", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_43_rec_id,
			{ "Record ID",
				"ipmi.st43.rec_id", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_43_offset,
			{ "Offset into record",
				"ipmi.st43.offset", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_43_count,
			{ "Bytes to read",
				"ipmi.st43.count", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_43_next,
			{ "Next Record ID",
				"ipmi.st43.next", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_43_data,
			{ "Record Data",
				"ipmi.st43.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},

		{ &hf_ipmi_stor_44_data,
			{ "SDR Data",
				"ipmi.st44.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_44_added_rec_id,
			{ "Record ID for added record",
				"ipmi.st43.added_rec_id", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},

		{ &hf_ipmi_stor_45_rsrv_id,
			{ "Reservation ID",
				"ipmi.st45.rsrv_id", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_45_rec_id,
			{ "Record ID",
				"ipmi.st45.rec_id", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_45_offset,
			{ "Offset into record",
				"ipmi.st45.offset", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_45_inprogress,
			{ "In progress",
				"ipmi.st45.inprogress", FT_UINT8, BASE_HEX, VALS(vals_45_inprogress), 0x0f, NULL, HFILL }},
		{ &hf_ipmi_stor_45_data,
			{ "Record Data",
				"ipmi.st45.data", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_45_added_rec_id,
			{ "Record ID for added record",
				"ipmi.st45.added_rec_id", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},

#if 0
		{ &hf_ipmi_stor_46_rsrv_id,
			{ "Reservation ID",
				"ipmi.st46.rsrv_id", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},

		{ &hf_ipmi_stor_46_rec_id,
			{ "Record ID",
				"ipmi.st46.rec_id", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
#endif
		{ &hf_ipmi_stor_46_del_rec_id,
			{ "Deleted Record ID",
				"ipmi.st46.del_rec_id", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},

		{ &hf_ipmi_stor_47_rsrv_id,
			{ "Reservation ID",
				"ipmi.st47.rsrv_id", FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_47_clr,
			{ "Confirmation (should be CLR)",
				"ipmi.st47.clr", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_47_action,
			{ "Action",
				"ipmi.st47.action", FT_UINT8, BASE_HEX, VALS(vals_47_action), 0, NULL, HFILL }},
		{ &hf_ipmi_stor_47_status,
			{ "Erasure Status",
				"ipmi.st47.status", FT_UINT8, BASE_HEX, VALS(vals_47_status), 0x0f, NULL, HFILL }},

		{ &hf_ipmi_stor_48_time,
			{ "Time",
				"ipmi.st48.time", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},

		{ &hf_ipmi_stor_49_time,
			{ "Time",
				"ipmi.st49.time", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},

		{ &hf_ipmi_stor_5a_log_type,
			{ "Log type",
				"ipmi.st5a.log_type", FT_UINT8, BASE_HEX, VALS(log_type_vals), 0x0f, NULL, HFILL }},
		{ &hf_ipmi_stor_5a_ts_add,
			{ "Last addition timestamp",
				"ipmi.st5a.ts_add", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_5a_num_entries,
			{ "Number of entries in MCA Log",
				"ipmi.st5a.num_entries", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_5a_iana,
			{ "OEM IANA",
				"ipmi.st5a.iana", FT_UINT24, BASE_HEX, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_5a_bytes,
			{ "Log status bytes",
				"ipmi.st5a.bytes", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_5a_unknown,
			{ "Unknown log format (cannot parse data)",
				"ipmi.st5a.unknown", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},

		{ &hf_ipmi_stor_5b_log_type,
			{ "Log type",
				"ipmi.st5b.log_type", FT_UINT8, BASE_HEX, VALS(log_type_vals), 0x0f, NULL, HFILL }},
		{ &hf_ipmi_stor_5b_ts_add,
			{ "Last addition timestamp",
				"ipmi.st5b.ts_add", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_5b_num_entries,
			{ "Number of entries in MCA Log",
				"ipmi.st5b.num_entries", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_5b_iana,
			{ "OEM IANA",
				"ipmi.st5b.iana", FT_UINT24, BASE_HEX, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_5b_bytes,
			{ "Log status bytes",
				"ipmi.st5b.bytes", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
		{ &hf_ipmi_stor_5b_unknown,
			{ "Unknown log format (cannot parse data)",
				"ipmi.st5b.unknown", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},

	};
	static gint *ett[] = {
		&ett_ipmi_stor_10_flags,
		&ett_ipmi_stor_20_ops,
		&ett_ipmi_stor_25_byte6,
		&ett_ipmi_stor_27_status,
		&ett_ipmi_stor_2c_rq_byte1,
		&ett_ipmi_stor_2c_rs_byte1,
		&ett_ipmi_stor_40_ops,
		&ett_ipmi_stor_45_byte6,
		&ett_ipmi_stor_47_status,
		&ett_ipmi_stor_5a_byte1,
		&ett_ipmi_stor_5b_byte1,
	};

	proto_register_field_array(proto_ipmi, hf, array_length(hf));
	proto_register_subtree_array(ett, array_length(ett));
	ipmi_register_netfn_cmdtab(IPMI_STORAGE_REQ, IPMI_OEM_NONE, NULL, 0, NULL,
			cmd_storage, array_length(cmd_storage));
}

/*
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
 *
 * Local variables:
 * c-basic-offset: 8
 * tab-width: 8
 * indent-tabs-mode: t
 * End:
 *
 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
 * :indentSize=8:tabSize=8:noTabs=false:
 */