forked from linux-nvme/nvme-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathocp-telemetry-decode.h
1451 lines (1347 loc) · 58.6 KB
/
ocp-telemetry-decode.h
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
/* SPDX-License-Identifier: GPL-2.0-or-later */
/* Copyright (c) 2024 Western Digital Corporation or its affiliates.
*
* Authors: Jeff Lien <jeff.lien@wdc.com>,
*/
#ifndef OCP_TELEMETRY_DECODE_H
#define OCP_TELEMETRY_DECODE_H
#include "nvme.h"
#include "nvme-print.h"
#include "util/utils.h"
#include "common.h"
#include "ocp-nvme.h"
extern __u8 *ptelemetry_buffer;
extern __u8 *pstring_buffer;
/*****************************************************************************
* Telemetry Statistics ID's and Strings
*****************************************************************************/
enum TELEMETRY_STATISTIC_ID {
TELEMETRY_STAT_ID_OAC = 0x1, /* Outstanding Admin Commands */
TELEMETRY_STAT_ID_HWB = 0x2, /* Host Write Bandwidth */
TELEMETRY_STAT_ID_GCWB = 0x3, /* Garbage Collection Write Bandwidth */
TELEMETRY_STAT_ID_AN = 0x4, /* Active Namespaces */
TELEMETRY_STAT_ID_IWW = 0x5, /* Internal Write Workload */
TELEMETRY_STAT_ID_IRW = 0x6, /* Internal Read Workload */
TELEMETRY_STAT_ID_IWQD = 0x7, /* Internal Write Queue Depth */
TELEMETRY_STAT_ID_IRQD = 0x8, /* Internal Read Queue Depth */
TELEMETRY_STAT_ID_PTC = 0x9, /* Pending Trim LBA Count */
TELEMETRY_STAT_ID_HTRC = 0xA, /* Host Trim LBA Request Count */
TELEMETRY_STAT_ID_CNPS = 0xB, /* Current NVMe Power State */
TELEMETRY_STAT_ID_CDPS = 0xC, /* Current DSSD Power State */
TELEMETRY_STAT_ID_PFC = 0xD, /* Program Fail Count */
TELEMETRY_STAT_ID_EFC = 0xE, /* Erase Fail Count */
TELEMETRY_STAT_ID_RDW = 0xF, /* Read Disturb Write */
TELEMETRY_STAT_ID_RW = 0x10, /* Retention Writes */
TELEMETRY_STAT_ID_WLW = 0x11, /* Wear Leveling Writes */
TELEMETRY_STAT_ID_RRW = 0x12, /* Read Recovery Writes */
TELEMETRY_STAT_ID_GCW = 0x13, /* Garbage Collection Writes */
TELEMETRY_STAT_ID_SCC = 0x14, /* SRAM Correctable Count */
TELEMETRY_STAT_ID_DCC = 0x15, /* DRAM Uncorrectable Count */
TELEMETRY_STAT_ID_SUC = 0x16, /* SRAM Correctable Count */
TELEMETRY_STAT_ID_DUC = 0x17, /* DRAM Uncorrectable Count */
TELEMETRY_STAT_ID_DIEC = 0x18, /* Data Integrity Error Count */
TELEMETRY_STAT_ID_RREC = 0x19, /* Read Retry Error Count */
TELEMETRY_STAT_ID_PEC = 0x1A, /* PERST Events Count */
TELEMETRY_STAT_ID_MAXDBB = 0x1B, /* Max Die Bad Block */
TELEMETRY_STAT_ID_MAXCBB = 0x1C, /* Max NAND Channel Bad Block */
TELEMETRY_STAT_ID_MINCBB = 0x1D, /* Min NAND Channel Bad Block */
TELEMETRY_STAT_ID_PMUW = 0x1E, /* Physical Media Units Written */
TELEMETRY_STAT_ID_PMUR = 0x1F, /* Physical Media Units Read */
TELEMETRY_STAT_ID_BUNB = 0x20, /* Bad User NAND Blocks */
TELEMETRY_STAT_ID_BSNB = 0x21, /* Bad System NAND Blocks */
TELEMETRY_STAT_ID_XORRC = 0x22, /* XOR Recovery Count */
TELEMETRY_STAT_ID_UNREC = 0x23, /* Uncorrectable Read Error Count */
TELEMETRY_STAT_ID_SECCEC = 0x24, /* Soft ECC Error Count */
TELEMETRY_STAT_ID_ETOECC = 0x25, /* End To End Correction Counts */
TELEMETRY_STAT_ID_SDU = 0x26, /* System Data % Used */
TELEMETRY_STAT_ID_RC = 0x27, /* Refresh Count */
TELEMETRY_STAT_ID_UDEC = 0x28, /* User Data Erase Counts */
TELEMETRY_STAT_ID_TTSC = 0x29, /* Thremal Throttling Status and Count */
TELEMETRY_STAT_ID_DSSDSV = 0x2A, /* DSSD Specification Version */
TELEMETRY_STAT_ID_PCIECEC = 0x2B, /* PCIe Correctable Error Count */
TELEMETRY_STAT_ID_IS = 0x2C, /* Incomplete Shutdown */
TELEMETRY_STAT_ID_FB = 0x2D, /* % Free Block */
TELEMETRY_STAT_ID_CH = 0x2E, /* Capacitor Health */
TELEMETRY_STAT_ID_NVMEBEV = 0x2F, /* NVM Express Base Errata Version */
TELEMETRY_STAT_ID_NVMCSEV = 0x30, /* NVM Command Set Errata Version */
TELEMETRY_STAT_ID_NVMEMIEV = 0x31, /* NVM Exp Mgmt Interface Err Version */
TELEMETRY_STAT_ID_UIO = 0x32, /* Unaligned IO */
TELEMETRY_STAT_ID_SVN = 0x33, /* Security Version Number */
TELEMETRY_STAT_ID_TNUSE = 0x34, /* Total NUSE */
TELEMETRY_STAT_ID_PLPSC = 0x35, /* PLP Start Count */
TELEMETRY_STAT_ID_EE = 0x36, /* Endurance Estimate */
TELEMETRY_STAT_ID_PCIELRC = 0x37, /* PCIe Link Retraining Count */
TELEMETRY_STAT_ID_PSCC = 0x38, /* Power State Change Count */
TELEMETRY_STAT_ID_LPFR = 0x39, /* Lowest Permitted Firmware Revision */
TELEMETRY_STAT_ID_LPV = 0x3A, /* Log Page Version */
TELEMETRY_STAT_ID_MDO = 0x3B, /* Media Dies Offline */
TELEMETRY_STAT_ID_MTR = 0x3C, /* Max Temperature Recorded */
TELEMETRY_STAT_ID_NAEC = 0x3D, /* Nand Avg Erase Count */
TELEMETRY_STAT_ID_CT = 0x3E, /* Command Timeout */
TELEMETRY_STAT_ID_SAPFC = 0x3F, /* System Area Program Fail Count */
TELEMETRY_STAT_ID_SARFC = 0x40, /* System Area Read Fail Count */
TELEMETRY_STAT_ID_SAEFC = 0x41, /* System Area Erase Fail Count */
TELEMETRY_STAT_ID_MPPC = 0x42, /* Max Peak Power Capability */
TELEMETRY_STAT_ID_CMAP = 0x43, /* Current Max Average Power */
TELEMETRY_STAT_ID_LPC = 0x44, /* Lifetime Power Consumed */
TELEMETRY_STAT_ID_PAC = 0x45, /* Panic Asset Count */
TELEMETRY_STAT_ID_DBT = 0x46, /* Device Busy Time */
TELEMETRY_STAT_ID_CW = 0x47, /* Critical Warning */
TELEMETRY_STAT_ID_COMTEMP = 0x48, /* Composite Temperature */
TELEMETRY_STAT_ID_AS = 0x49, /* Available Spare */
TELEMETRY_STAT_ID_AST = 0x4A, /* Available Spare Threshold */
TELEMETRY_STAT_ID_PU = 0x4B, /* Percentage Used */
TELEMETRY_STAT_ID_EGCWS = 0x4C, /* Endurance Gp CW Summary */
TELEMETRY_STAT_ID_DUR = 0x4D, /* Data Units Read */
TELEMETRY_STAT_ID_DUW = 0x4E, /* Data Units Written */
TELEMETRY_STAT_ID_HRC = 0x4F, /* Host Read Commands */
TELEMETRY_STAT_ID_HWC = 0x50, /* Host Write Commands */
TELEMETRY_STAT_ID_CBT = 0x51, /* Controller Busy Time */
TELEMETRY_STAT_ID_PC = 0x52, /* Power Cycles */
TELEMETRY_STAT_ID_POH = 0x53, /* Power On Hours */
TELEMETRY_STAT_ID_US = 0x54, /* Unsafe Shutdowns */
TELEMETRY_STAT_ID_MDIE = 0x55, /* Media and Data Integrity Er */
TELEMETRY_STAT_ID_NEILE = 0x56, /* No of Error Info Entries */
TELEMETRY_STAT_ID_WCTT = 0x57, /* Warning Composite Temp Time */
TELEMETRY_STAT_ID_CCTT = 0x58, /* Critical Comp Temp Time */
TELEMETRY_STAT_ID_TS1 = 0x59, /* Temperature Sensor 1 */
TELEMETRY_STAT_ID_TS2 = 0x5A, /* Temperature Sensor 2 */
TELEMETRY_STAT_ID_TS3 = 0x5B, /* Temperature Sensor 3 */
TELEMETRY_STAT_ID_TS4 = 0x5C, /* Temperature Sensor 4 */
TELEMETRY_STAT_ID_TS5 = 0x5D, /* Temperature Sensor 5 */
TELEMETRY_STAT_ID_TS6 = 0x5E, /* Temperature Sensor 6 */
TELEMETRY_STAT_ID_TS7 = 0x5F, /* Temperature Sensor 7 */
TELEMETRY_STAT_ID_TS8 = 0x60, /* Temperature Sensor 8 */
TELEMETRY_STAT_ID_TMT1TC = 0x61, /* Thermal Mgmt Temp1 TC */
TELEMETRY_STAT_ID_TMT2TC = 0x62, /* Thermal Mgmt Temp2 TC */
TELEMETRY_STAT_ID_TTTMT1 = 0x63, /* Total Time TMT1 */
TELEMETRY_STAT_ID_TTTMT2 = 0x64, /* Total Time TMT2 */
TELEMETRY_STAT_ID_EEE = 0x65, /* Endurance Estimate */
TELEMETRY_STAT_ID_EDUR = 0x66, /* Endurance Data Units Read */
TELEMETRY_STAT_ID_EDUW = 0x67, /* Endurance Data Units Written */
TELEMETRY_STAT_ID_EMUW = 0x68, /* Endurance Media Units Written */
TELEMETRY_STAT_ID_ENEILE = 0x69, /* Endurance No Of Err Info Log Entries */
};
static const char * const telemetry_stat_id_str[] = {
[TELEMETRY_STAT_ID_OAC] = "Outstanding Admin Commands",
[TELEMETRY_STAT_ID_HWB] = "Host Write Bandwidth",
[TELEMETRY_STAT_ID_GCWB] = "Garbage Collection Write Bandwidth",
[TELEMETRY_STAT_ID_AN] = "Active Namespaces",
[TELEMETRY_STAT_ID_IWW] = "Internal Write Workload",
[TELEMETRY_STAT_ID_IRW] = "Internal Read Workload",
[TELEMETRY_STAT_ID_IWQD] = "Internal Write Queue Depth",
[TELEMETRY_STAT_ID_IRQD] = "Internal Read Queue Depth",
[TELEMETRY_STAT_ID_PTC] = "Pending Trim LBA Count",
[TELEMETRY_STAT_ID_HTRC] = "Host Trim LBA Request Count",
[TELEMETRY_STAT_ID_CNPS] = "Current NVMe Power State",
[TELEMETRY_STAT_ID_CDPS] = "Current DSSD Power State",
[TELEMETRY_STAT_ID_PFC] = "Program Fail Count",
[TELEMETRY_STAT_ID_EFC] = "Erase Fail Count",
[TELEMETRY_STAT_ID_RDW] = "Read Disturb Write",
[TELEMETRY_STAT_ID_RW] = "Retention Writes",
[TELEMETRY_STAT_ID_WLW] = "Wear Leveling Writes",
[TELEMETRY_STAT_ID_RRW] = "Read Recovery Writes",
[TELEMETRY_STAT_ID_GCW] = "Garbage Collection Writes",
[TELEMETRY_STAT_ID_SCC] = "SRAM Correctable Count",
[TELEMETRY_STAT_ID_DCC] = "DRAM Correctable Count",
[TELEMETRY_STAT_ID_SUC] = "SRAM Uncorrectable Count",
[TELEMETRY_STAT_ID_DUC] = "DRAM Uncorrectable Count",
[TELEMETRY_STAT_ID_DIEC] = "Data Integrity Error Count",
[TELEMETRY_STAT_ID_RREC] = "Read Retry Error Count",
[TELEMETRY_STAT_ID_PEC] = "PERST Events Count",
[TELEMETRY_STAT_ID_MAXDBB] = "Max Die Bad Block",
[TELEMETRY_STAT_ID_MAXCBB] = "Max NAND Channel Bad Block",
[TELEMETRY_STAT_ID_MINCBB] = "Min NAND Channel Bad Block",
[TELEMETRY_STAT_ID_PMUW] = "Physical Media Units Written",
[TELEMETRY_STAT_ID_PMUR] = "Physical Media Units Read",
[TELEMETRY_STAT_ID_BUNB] = "Bad User NAND Blocks",
[TELEMETRY_STAT_ID_BSNB] = "Bad System NAND Blocks",
[TELEMETRY_STAT_ID_XORRC] = "XOR Recovery Count",
[TELEMETRY_STAT_ID_UNREC] = "Uncorrectable Read Error Count",
[TELEMETRY_STAT_ID_SECCEC] = "Soft ECC Error Count",
[TELEMETRY_STAT_ID_ETOECC] = "End To End Correction Counts",
[TELEMETRY_STAT_ID_SDU] = "System Data Used",
[TELEMETRY_STAT_ID_RC] = "Refresh Count",
[TELEMETRY_STAT_ID_UDEC] = "User Data Erase Counts",
[TELEMETRY_STAT_ID_TTSC] = "Thremal Throttling Status and Count",
[TELEMETRY_STAT_ID_DSSDSV] = "DSSD Specification Version",
[TELEMETRY_STAT_ID_PCIECEC] = "PCIe Correctable Error Count",
[TELEMETRY_STAT_ID_IS] = "Incomplete Shutdown",
[TELEMETRY_STAT_ID_FB] = "Free Block",
[TELEMETRY_STAT_ID_CH] = "Capacitor Health",
[TELEMETRY_STAT_ID_NVMEBEV] = "NVM Express Base Errata Version",
[TELEMETRY_STAT_ID_NVMCSEV] = "NVM Command Set Errata Version",
[TELEMETRY_STAT_ID_NVMEMIEV] = "NVM Express Management Interface Errata Version",
[TELEMETRY_STAT_ID_UIO] = "Unaligned IO",
[TELEMETRY_STAT_ID_SVN] = "Security Version Number",
[TELEMETRY_STAT_ID_TNUSE] = "Total NUSE",
[TELEMETRY_STAT_ID_PLPSC] = "PLP Start Count",
[TELEMETRY_STAT_ID_EE] = "Endurance Estimate",
[TELEMETRY_STAT_ID_PCIELRC] = "PCIe Link Retraining Count",
[TELEMETRY_STAT_ID_PSCC] = "Power State Change Count",
[TELEMETRY_STAT_ID_LPFR] = "Lowest Permitted Firmware Revision",
[TELEMETRY_STAT_ID_LPV] = "Log Page Version",
[TELEMETRY_STAT_ID_MDO] = "Media Dies Offline",
[TELEMETRY_STAT_ID_MTR] = "Max Temperature Recorded",
[TELEMETRY_STAT_ID_NAEC] = "Nand Avg Erase Count",
[TELEMETRY_STAT_ID_CT] = "Command Timeout",
[TELEMETRY_STAT_ID_SAPFC] = "System Area Program Fail Count",
[TELEMETRY_STAT_ID_SARFC] = "System Area Read Fail Count",
[TELEMETRY_STAT_ID_SAEFC] = "System Area Erase Fail Count",
[TELEMETRY_STAT_ID_MPPC] = "Max Peak Power Capability",
[TELEMETRY_STAT_ID_CMAP] = "Current Max Average Power",
[TELEMETRY_STAT_ID_LPC] = "Lifetime Power Consumed",
[TELEMETRY_STAT_ID_PAC] = "Panic Asset Count",
[TELEMETRY_STAT_ID_DBT] = "Device Busy Time",
[TELEMETRY_STAT_ID_CW] = "Critical Warning",
[TELEMETRY_STAT_ID_COMTEMP] = "Composite Temperature",
[TELEMETRY_STAT_ID_AS] = "Available Spare",
[TELEMETRY_STAT_ID_AST] = "Available Spare Threshold",
[TELEMETRY_STAT_ID_PU] = "Percentage Used",
[TELEMETRY_STAT_ID_EGCWS] = "Endurance Gp CW Summary",
[TELEMETRY_STAT_ID_DUR] = "Data Units Read",
[TELEMETRY_STAT_ID_DUW] = "Data Units Written",
[TELEMETRY_STAT_ID_HRC] = "Host Read Commands",
[TELEMETRY_STAT_ID_HWC] = "Host Write Commands",
[TELEMETRY_STAT_ID_CBT] = "Controller Busy Time",
[TELEMETRY_STAT_ID_PC] = "Power Cycles",
[TELEMETRY_STAT_ID_POH] = "Power On Hours",
[TELEMETRY_STAT_ID_US] = "Unsafe Shutdowns",
[TELEMETRY_STAT_ID_MDIE] = "Media and Data Integrity Er",
[TELEMETRY_STAT_ID_NEILE] = "No of Error Info Entries",
[TELEMETRY_STAT_ID_WCTT] = "Warning Composite Temp Time",
[TELEMETRY_STAT_ID_CCTT] = "Critical Comp Temp Time",
[TELEMETRY_STAT_ID_TS1] = "Temperature Sensor 1",
[TELEMETRY_STAT_ID_TS2] = "Temperature Sensor 2",
[TELEMETRY_STAT_ID_TS3] = "Temperature Sensor 3",
[TELEMETRY_STAT_ID_TS4] = "Temperature Sensor 4",
[TELEMETRY_STAT_ID_TS5] = "Temperature Sensor 5",
[TELEMETRY_STAT_ID_TS6] = "Temperature Sensor 6",
[TELEMETRY_STAT_ID_TS7] = "Temperature Sensor 7",
[TELEMETRY_STAT_ID_TS8] = "Temperature Sensor 8",
[TELEMETRY_STAT_ID_TMT1TC] = "Thermal Mgmt Temp1 TC",
[TELEMETRY_STAT_ID_TMT2TC] = "Thermal Mgmt Temp2 TC",
[TELEMETRY_STAT_ID_TTTMT1] = "Total Time TMT1",
[TELEMETRY_STAT_ID_TTTMT2] = "Total Time TMT2",
[TELEMETRY_STAT_ID_EEE] = "Endurance Estimate",
[TELEMETRY_STAT_ID_EDUR] = "Endurance Data Units Read",
[TELEMETRY_STAT_ID_EDUW] = "Endurance Data Units Written",
[TELEMETRY_STAT_ID_EMUW] = "Endurance Media Units Written",
[TELEMETRY_STAT_ID_ENEILE] = "Endurance No Of Err Info Log Entries",
};
/*****************************************************************************
* Telemetry FIFO Event Class ID's and Strings
*****************************************************************************/
enum TELEMETRY_EVENT_CLASS_TYPE {
TELEMETRY_TIMESTAMP_CLASS = 0x1,
TELEMETRY_PCIE_CLASS = 0x2,
TELEMETRY_NVME_CLASS = 0x3,
TELEMETRY_RESET_CLASS = 0x4,
TELEMETRY_BOOT_SEQ_CLASS = 0x5,
TELEMETRY_FW_ASSERT_CLASS = 0x6,
TELEMETRY_TEMPERATURE_CLASS = 0x7,
TELEMETRY_MEDIA_DBG_CLASS = 0x8,
TELEMETRY_MEDIA_WEAR_CLASS = 0x9,
TELEMETRY_STAT_SNAPSHOT_CLASS = 0xA,
TELEMETRY_VIRTUAL_FIFO_EVENT_CLASS = 0xB,
};
static const char * const telemetry_event_class_str[] = {
[TELEMETRY_TIMESTAMP_CLASS] = "Timestamp Class",
[TELEMETRY_PCIE_CLASS] = "PCIe Class",
[TELEMETRY_NVME_CLASS] = "NVMe Class",
[TELEMETRY_RESET_CLASS] = "Reset Class",
[TELEMETRY_BOOT_SEQ_CLASS] = "Boot Sequence Class",
[TELEMETRY_FW_ASSERT_CLASS] = "FW Assert Class",
[TELEMETRY_TEMPERATURE_CLASS] = "Temperature Class",
[TELEMETRY_MEDIA_DBG_CLASS] = "Media Debug Class",
[TELEMETRY_MEDIA_WEAR_CLASS] = "Media Wear Class",
[TELEMETRY_STAT_SNAPSHOT_CLASS] = "Statistic Snapshot Class",
[TELEMETRY_VIRTUAL_FIFO_EVENT_CLASS] = "Virtual FIFO Event Class",
};
/*****************************************************************************
* Telemetry Timestamp Class (01h) Event ID's and Strings
*****************************************************************************/
enum TELEMETRY_TIMESTAMP_EVENT_ID {
TIMESTAMP_FEATURE_HOST_ISSUED = 0x0000,
TIMESTAMP_FW_INTIATED_SNAPSHOT = 0x0001,
TIMESTAMP_OBSOLETE = 0x0002,
};
static const char * const telemetry_timestamp_event_id_str[] = {
[TIMESTAMP_FEATURE_HOST_ISSUED] = "Host Issued Timestamp Set Feature Cmd",
[TIMESTAMP_FW_INTIATED_SNAPSHOT] = "Fw Initiated Timestamp Snapshot",
[TIMESTAMP_OBSOLETE] = "TimeStamp Obsolete",
};
/*****************************************************************************
* Telemetry PCIE Class (02h) Event ID's and Strings
*****************************************************************************/
enum TELEMETRY_PCIE_EVENT_ID {
PCIE_LINK_UP = 0x0000,
PCIE_LINK_DOWN = 0x0001,
PCIE_ERROR_DETECTED = 0x0002,
PCIE_PERST_ASSERTED = 0x0003,
PCIE_PERST_DEASSERTED = 0x0004,
PCIE_REFCLK_STABLE = 0x0005,
PCIE_VMAIN_STABLE = 0x0006,
PCIE_LINK_NEGOTIATED = 0x0007,
};
static const char * const telemetry_pcie_event_id_str[] = {
[PCIE_LINK_UP] = "PCIe Link Up",
[PCIE_LINK_DOWN] = "PCIe Link Down",
[PCIE_ERROR_DETECTED] = "PCIe Error Detected",
[PCIE_PERST_ASSERTED] = "PCIe PERST Asserted",
[PCIE_PERST_DEASSERTED] = "PCIe PERST Deasserted",
[PCIE_REFCLK_STABLE] = "PCIe Refclk Stable",
[PCIE_VMAIN_STABLE] = "PCIe Vmain Stable",
[PCIE_LINK_NEGOTIATED] = "PCIe Link Negotiated",
};
enum TELEMETRY_PCIE_STATE_DATA {
PCIE_STATE_UNCHANGED = 0x00,
PCIE_SPEED_CHANGED = 0x01,
PCIE_WIDTH_CHANGED = 0x02,
};
static const char * const telemetry_pcie_state_data_str[] = {
[PCIE_STATE_UNCHANGED] = "PCIe State Unchained",
[PCIE_SPEED_CHANGED] = "PCIe Speed Changed",
[PCIE_WIDTH_CHANGED] = "PCIe Width Changed",
};
enum TELEMETRY_PCIE_SPEED_DATA {
PCIE_LINK_GEN1 = 0x01,
PCIE_LINK_GEN2 = 0x02,
PCIE_LINK_GEN3 = 0x03,
PCIE_LINK_GEN4 = 0x04,
PCIE_LINK_GEN5 = 0x05,
PCIE_LINK_GEN6 = 0x06,
PCIE_LINK_GEN7 = 0x07,
};
static const char * const telemetry_pcie_speed_data_str[] = {
[PCIE_LINK_GEN1] = "PCIe Link Speed Gen1",
[PCIE_LINK_GEN2] = "PCIe Link Speed Gen2",
[PCIE_LINK_GEN3] = "PCIe Link Speed Gen3",
[PCIE_LINK_GEN4] = "PCIe Link Speed Gen4",
[PCIE_LINK_GEN5] = "PCIe Link Speed Gen5",
[PCIE_LINK_GEN6] = "PCIe Link Speed Gen6",
[PCIE_LINK_GEN7] = "PCIe Link Speed Gen7",
};
enum TELEMETRY_PCIE_WIDTH_DATA {
PCIE_LINK_X1 = 0x01,
PCIE_LINK_X2 = 0x02,
PCIE_LINK_X4 = 0x03,
PCIE_LINK_X8 = 0x04,
PCIE_LINK_X16 = 0x05,
};
static const char * const telemetry_pcie_width_data_str[] = {
[PCIE_LINK_X1] = "PCIe Link Width x1",
[PCIE_LINK_X2] = "PCIe Link Width x2",
[PCIE_LINK_X4] = "PCIe Link Width x4",
[PCIE_LINK_X8] = "PCIe Link Width x8",
[PCIE_LINK_X16] = "PCIe Link Width x16",
};
/*****************************************************************************
* Telemetry NVMe Class (03h) Event ID's and Strings
*****************************************************************************/
enum TELEMETRY_NVME_EVENT_ID {
CC_EN_0_TO_1 = 0x0000,
CC_EN_1_TO_0 = 0x0001,
CSTS_RDY_0_TO_1 = 0x0002,
CSTS_RDY_1_TO_0 = 0x0003,
NVME_EVENT_ID_RESERVED = 0x0004,
CREATE_IO_QUEUE_PROCESSED = 0x0005,
ADMIN_QUEUE_CMD_PROCESSED = 0x0006,
ADMIN_QUEUE_NONZERO_STATUS = 0x0007,
IO_QUEUE_NONZERO_STATUS = 0x0008,
CSTS_CFS_0_TO_1 = 0x0009,
ADMIN_QUEUE_BASE_WRITTEN = 0x000A,
CC_REGISTER_CHANGED = 0x000B,
CSTS_REGISTER_CHANGED = 0x000C,
DELETE_IO_QUEUE_PROCESSED = 0x000D,
OOB_COMMAND = 0x000E,
OOB_AER_EVENT_MSG_TRANS = 0x000F
};
static const char * const telemetry_nvme_event_id_str[] = {
[CC_EN_0_TO_1] = "CC.EN Transitions from 0 to 1",
[CC_EN_1_TO_0] = "CC.EN Transitions from 1 to 0",
[CSTS_RDY_0_TO_1] = "CSTS.RDY Transitions from 0 to 1",
[CSTS_RDY_1_TO_0] = "CSTS.RDY Transitions from 1 to 0",
[NVME_EVENT_ID_RESERVED] = "Reserved NVMe Event ID",
[CREATE_IO_QUEUE_PROCESSED] = "Create IO SQ or CQ Command Processed",
[ADMIN_QUEUE_CMD_PROCESSED] = "Inb-Admin Que Cmd Proc other than Cr IO SQ/CQ",
[ADMIN_QUEUE_NONZERO_STATUS] = "Admin Command Returned Non-zero Status",
[IO_QUEUE_NONZERO_STATUS] = "IO Command Returned Non-zero Status",
[CSTS_CFS_0_TO_1] = "CSTS.CFS Transitions from 0 to 1",
[ADMIN_QUEUE_BASE_WRITTEN] = "Admin SQ or CQ Base Address Written",
[CC_REGISTER_CHANGED] = "CC Register Changed",
[CSTS_REGISTER_CHANGED] = "CSTS Register Changed",
[DELETE_IO_QUEUE_PROCESSED] = "Delete IO SQ or CQ Command Processed",
[OOB_COMMAND] = "Out of Band Command Process",
[OOB_AER_EVENT_MSG_TRANS] = "Out of Band AER Event Msg Transition"
};
/*****************************************************************************
* Telemetry Reset Class (04h) Event ID's and Strings
*****************************************************************************/
enum TELEMETRY_RESET_EVENT_ID {
PCIE_CONVENTIONAL_HOT_RESET = 0x0000,
MAIN_POWER_CYCLE = 0x0001,
PERST = 0x0002,
PCIE_FUNCTION_LEVEL_RESET = 0x0003,
NVME_SUBSYSTEM_RESET = 0x0004,
};
static const char * const telemetry_reset_event_id_str[] = {
[PCIE_CONVENTIONAL_HOT_RESET] = "PCIE Conventional Hot Reset",
[MAIN_POWER_CYCLE] = "Main Power_Cycle",
[PERST] = "PERST",
[PCIE_FUNCTION_LEVEL_RESET] = "PCIE Function Level Reset",
[NVME_SUBSYSTEM_RESET] = "NVMe Subsytem Reset",
};
/*****************************************************************************
* Telemetry Boot Sequence Class (05h) Event ID's and Strings
*****************************************************************************/
enum TELEMETRY_BOOT_SEQ_EVENT_ID {
MAIN_FW_BOOT_COMPLETE = 0x0000,
FTL_LOAD_FROM_NVM_COMPLETE = 0x0001,
FTL_REBUILD_STARTED = 0x0002,
FTL_REBUILD_COMPLETE = 0x0003,
};
static const char * const telemetry_boot_seq_event_id_str[] = {
[MAIN_FW_BOOT_COMPLETE] = "Main Firmware Boot Complete",
[FTL_LOAD_FROM_NVM_COMPLETE] = "FTL Load from NVM Complete",
[FTL_REBUILD_STARTED] = "FTL Rebuild Started",
[FTL_REBUILD_COMPLETE] = "FTL Rebuild Complete",
};
/*****************************************************************************
* Telemetry Firmware Assert Class (06h) Event ID's and Strings
*****************************************************************************/
enum TELEMETRY_FW_ASSERT_EVENT_ID {
ASSERT_NVME_CODE = 0x0000,
ASSERT_MEDIA_CODE = 0x0001,
ASSERT_SECURITY_CODE = 0x0002,
ASSERT_BACKGROUND_CODE = 0x0003,
FTL_REBUILD_FAILED = 0x0004,
FTL_DATA_MISMATCH = 0x0005,
ASSERT_OTHER_CODE = 0x0006,
};
static const char * const telemetry_fw_assert_event_id_str[] = {
[ASSERT_NVME_CODE] = "Assert in NVMe Processing Code",
[ASSERT_MEDIA_CODE] = "Assert in Media Code",
[ASSERT_SECURITY_CODE] = "Assert in Security Code",
[ASSERT_BACKGROUND_CODE] = "Assert in Background Services Code",
[FTL_REBUILD_FAILED] = "FTL Rebuild Failed",
[FTL_DATA_MISMATCH] = "FTL Data Mismatch",
[ASSERT_OTHER_CODE] = "Assert in Other Code",
};
/*****************************************************************************
* Telemetry Temperature Class (07h) Event ID's and Strings
*****************************************************************************/
enum TELEMETRY_TEMPERATURE_EVENT_ID {
COMPOSITE_TEMP_DECREASE = 0x0000,
COMPOSITE_TEMP_INCREASE_WCTEMP = 0x0001,
COMPOSITE_TEMP_INCREASE_CCTEMP = 0x0002,
};
static const char * const telemetry_temperature_event_id_str[] = {
[COMPOSITE_TEMP_DECREASE] = "Composite Temp Decreases to (WCTEMP-2)",
[COMPOSITE_TEMP_INCREASE_WCTEMP] = "Composite Temp Increases to WCTEMP",
[COMPOSITE_TEMP_INCREASE_CCTEMP] = "Composite Temp Increases to CCTEMP",
};
/*****************************************************************************
* Telemetry Media Debug Class (08h) Event ID's and Strings
*****************************************************************************/
enum TELEMETRY_MEDIA_DEBUG_EVENT_ID {
XOR_RECOVERY_INVOKED = 0x0000,
UNCORRECTABLE_MEDIA_ERROR = 0x0001,
BAD_BLOCK_PROGRAM_ERROR = 0x0002,
BAD_BLOCK_ERASE_ERROR = 0x0003,
BAD_BLOCK_READ_ERROR = 0x0004,
PLANE_FAILURE_EVENT = 0x0005,
};
static const char * const telemetry_media_debug_event_id_str[] = {
[XOR_RECOVERY_INVOKED] = "XOR Recovery Invoked",
[UNCORRECTABLE_MEDIA_ERROR] = "Uncorrectable Media Error",
[BAD_BLOCK_PROGRAM_ERROR] = "Block Marked Bad Due to Program Error",
[BAD_BLOCK_ERASE_ERROR] = "Block Marked Bad Due to Erase Error",
[BAD_BLOCK_READ_ERROR] = "Block Marked Bad Due to Read Error",
[PLANE_FAILURE_EVENT] = "Plane Failure Event",
};
/*****************************************************************************
* Telemetry Media Wear Class (09h) Event ID's and Strings
*****************************************************************************/
enum TELEMETRY_MEDIA_WEAR_EVENT_ID {
MEDIA_WEAR = 0x0000,
};
static const char * const telemetry_media_wear_event_id_str[] = {
[MEDIA_WEAR] = "Media Wear",
};
/*****************************************************************************
* Telemetry Virtual FIFO (0Bh) Event ID's and Strings
*****************************************************************************/
enum TELEMETRY_VIRTUAL_FIFO_EVENT_ID {
VIRTUAL_FIFO_START = 0x0000,
VIRTUAL_FIFO_END = 0x0002,
};
static const char * const telemetry_virtual_fifo_event_id_str[] = {
[VIRTUAL_FIFO_START] = "Virtual FIFO Start",
[VIRTUAL_FIFO_END] = "Virtual FIFO End",
};
/*****************************************************************************
* Telemetry Data Structures
*****************************************************************************/
#define TELEMETRY_HEADER_SIZE 512
#define TELEMETRY_DATA_SIZE 1536
#define TELEMETRY_BYTE_PER_BLOCK 512
#define TELEMETRY_TRANSFER_SIZE 1024
#define FILE_NAME_SIZE 2048
enum TELEMETRY_TYPE {
TELEMETRY_TYPE_HOST = 7,
TELEMETRY_TYPE_CONTROLLER = 8,
TELEMETRY_TYPE_HOST_0 = 9,
TELEMETRY_TYPE_HOST_1 = 10,
};
struct telemetry_initiated_log {
__u8 LogIdentifier;
__u8 Reserved1[4];
__u8 IEEE[3];
__le16 DataArea1LastBlock;
__le16 DataArea2LastBlock;
__le16 DataArea3LastBlock;
__u8 Reserved2[2];
__le32 DataArea4LastBlock;
__u8 Reserved3[361];
__u8 DataHostGenerationNumber;
__u8 CtlrDataAvailable;
__u8 DataCtlrGenerationNumber;
__u8 ReasonIdentifier[128];
};
struct telemetry_stats_desc {
__le16 id;
__u8 info;
__u8 ns_info;
__le16 size;
__le16 nsid;
__u8 data[];
};
struct __packed telemetry_event_desc {
__u8 class;
__le16 id;
__u8 size;
__u8 data[];
};
struct event_fifo {
__le64 start;
__le64 size;
};
struct telemetry_data_area_1 {
__le16 major_version;
__le16 minor_version;
__u8 reserved1[4];
__le64 timestamp;
__u8 log_page_guid[GUID_LEN];
__u8 no_of_tps_supp;
__u8 tps;
__u8 reserved2[6];
__le64 sls;
__u8 reserved3[8];
__u8 fw_revision[8];
__u8 reserved4[32];
__le64 da1_stat_start;
__le64 da1_stat_size;
__le64 da2_stat_start;
__le64 da2_stat_size;
__u8 reserved5[32];
__u8 event_fifo_da[16];
struct event_fifo event_fifos[16];
__u8 reserved6[80];
__u8 smart_health_info[512];
__u8 smart_health_info_extended[512];
};
#define DATA_SIZE_12 12
#define DATA_SIZE_8 8
#define DATA_SIZE_4 4
#define MAX_BUFFER_32_KB 0x8000
#define OCP_TELEMETRY_DATA_BLOCK_SIZE 512
#define SIZE_OF_DWORD 4
#define MAX_NUM_FIFOS 16
#define DA1_OFFSET 512
#define DEFAULT_ASCII_STRING_SIZE 16
#define SIZE_OF_VU_EVENT_ID 2
#define DEFAULT_TELEMETRY_BIN "telemetry.bin"
#define DEFAULT_STRING_BIN "string.bin"
#define DEFAULT_OUTPUT_FORMAT_JSON "json"
/* C9 Telemetry String Log Format Log Page */
#define C9_TELEMETRY_STR_LOG_LEN 432
#define C9_TELEMETRY_STR_LOG_SIST_OFST 431
#define STR_LOG_PAGE_HEADER "Log Page Header"
#define STR_REASON_IDENTIFIER "Reason Identifier"
#define STR_TELEMETRY_HOST_DATA_BLOCK_1 "Telemetry Host-Initiated Data Block 1"
#define STR_SMART_HEALTH_INFO "SMART / Health Information Log(LID-02h)"
#define STR_SMART_HEALTH_INTO_EXTENDED "SMART / Health Information Extended(LID-C0h)"
#define STR_DA_1_STATS "Data Area 1 Statistics"
#define STR_DA_2_STATS "Data Area 2 Statistics"
#define STR_DA_1_EVENT_FIFO_INFO "Data Area 1 Event FIFO info"
#define STR_DA_2_EVENT_FIFO_INFO "Data Area 2 Event FIFO info"
#define STR_STATISTICS_IDENTIFIER "Statistics Identifier"
#define STR_STATISTICS_IDENTIFIER_STR "Statistic Identifier String"
#define STR_STATISTICS_INFO_BEHAVIOUR_TYPE "Statistics Info Behavior Type"
#define STR_STATISTICS_INFO_RESERVED "Statistics Info Reserved"
#define STR_NAMESPACE_IDENTIFIER "Namespace Identifier"
#define STR_NAMESPACE_INFO_VALID "Namespace Information Valid"
#define STR_STATISTICS_DATA_SIZE "Statistic Data Size"
#define STR_RESERVED "Reserved"
#define STR_STATISTICS_SPECIFIC_DATA "Statistic Specific Data"
#define STR_STATISTICS_WORST_DIE_PERCENT "Worst die % of bad blocks"
#define STR_STATISTICS_WORST_DIE_RAW "Worst die raw number of bad blocks"
#define STR_STATISTICS_WORST_NAND_CHANNEL_PERCENT "Worst NAND channel % of bad blocks"
#define STR_STATISTICS_WORST_NAND_CHANNEL_RAW "Worst NAND channel number of bad blocks"
#define STR_STATISTICS_BEST_NAND_CHANNEL_PERCENT "Best NAND channel % of bad blocks"
#define STR_STATISTICS_BEST_NAND_CHANNEL_RAW "Best NAND channel number of bad blocks"
#define STR_CLASS_SPECIFIC_DATA "Class Specific Data"
#define STR_DBG_EVENT_CLASS_TYPE "Debug Event Class type"
#define STR_EVENT_IDENTIFIER "Event Identifier"
#define STR_EVENT_STRING "Event String"
#define STR_EVENT_DATA_SIZE "Event Data Size"
#define STR_VU_EVENT_STRING "VU Event String"
#define STR_VU_EVENT_ID_STRING "VU Event Identifier"
#define STR_VU_DATA "VU Data"
#define STR_LINE "==============================================================================\n"
#define STR_LINE2 "-----------------------------------------------------------------------------\n"
/**
* enum ocp_telemetry_data_area - Telemetry Data Areas
* @DATA_AREA_1: Data Area 1
* @DATA_AREA_2: Data Area 2
* @DATA_AREA_3: Data Area 3
* @DATA_AREA_4: Data Area 4
*/
enum ocp_telemetry_data_area {
DATA_AREA_1 = 0x01,
DATA_AREA_2 = 0x02,
DATA_AREA_3 = 0x03,
DATA_AREA_4 = 0x04,
};
/**
* enum ocp_telemetry_string_tables - OCP telemetry string tables
* @STATISTICS_IDENTIFIER_STRING: Statistic Identifier string
* @EVENT_STRING: Event String
* @VU_EVENT_STRING: VU Event String
*/
enum ocp_telemetry_string_tables {
STATISTICS_IDENTIFIER_STRING = 0,
EVENT_STRING,
VU_EVENT_STRING
};
/**
* enum ocp_telemetry_statistics_identifiers - OCP Statistics Identifiers
*/
enum ocp_telemetry_statistic_identifiers {
STATISTICS_RESERVED_ID = 0x00,
OUTSTANDING_ADMIN_CMDS_ID = 0x01,
HOST_WRTIE_BANDWIDTH_ID = 0x02,
GW_WRITE_BANDWITH_ID = 0x03,
ACTIVE_NAMESPACES_ID = 0x04,
INTERNAL_WRITE_WORKLOAD_ID = 0x05,
INTERNAL_READ_WORKLOAD_ID = 0x06,
INTERNAL_WRITE_QUEUE_DEPTH_ID = 0x07,
INTERNAL_READ_QUEUE_DEPTH_ID = 0x08,
PENDING_TRIM_LBA_COUNT_ID = 0x09,
HOST_TRIM_LBA_REQUEST_COUNT_ID = 0x0A,
CURRENT_NVME_POWER_STATE_ID = 0x0B,
CURRENT_DSSD_POWER_STATE_ID = 0x0C,
PROGRAM_FAIL_COUNT_ID = 0x0D,
ERASE_FAIL_COUNT_ID = 0x0E,
READ_DISTURB_WRITES_ID = 0x0F,
RETENTION_WRITES_ID = 0x10,
WEAR_LEVELING_WRITES_ID = 0x11,
READ_RECOVERY_WRITES_ID = 0x12,
GC_WRITES_ID = 0x13,
SRAM_CORRECTABLE_COUNT_ID = 0x14,
DRAM_CORRECTABLE_COUNT_ID = 0x15,
SRAM_UNCORRECTABLE_COUNT_ID = 0x16,
DRAM_UNCORRECTABLE_COUNT_ID = 0x17,
DATA_INTEGRITY_ERROR_COUNT_ID = 0x18,
READ_RETRY_ERROR_COUNT_ID = 0x19,
PERST_EVENTS_COUNT_ID = 0x1A,
MAX_DIE_BAD_BLOCK_ID = 0x1B,
MAX_NAND_CHANNEL_BAD_BLOCK_ID = 0x1C,
MIN_NAND_CHANNEL_BAD_BLOCK_ID = 0x1D,
//RESERVED = 7FFFh-1Eh,
//VENDOR_UNIQUE_CLASS_TYPE = FFFFh-8000h,
};
/**
* enum ocp_telemetry_debug_event_class_types - OCP Debug Event Class types
* @RESERVED_CLASS_TYPE: Reserved class
* @TIME_STAMP_CLASS_TYPE: Time stamp class
* @PCIE_CLASS_TYPE: PCIe class
* @NVME_CLASS_TYPE: NVME class
* @RESET_CLASS_TYPE: Reset class
* @BOOT_SEQUENCE_CLASS_TYPE: Boot Sequence class
* @FIRMWARE_ASSERT_CLASS_TYPE: Firmware Assert class
* @TEMPERATURE_CLASS_TYPE: Temperature class
* @MEDIA_CLASS_TYPE: Media class
* @MEDIA_WEAR_CLASS_TYPE: Media wear class
* @STATISTIC_SNAPSHOT_CLASS_TYPE: Statistic snapshot class
* @RESERVED: Reserved class
* @VENDOR_UNIQUE_CLASS_TYPE: Vendor Unique class
*/
enum ocp_telemetry_debug_event_class_types {
RESERVED_CLASS_TYPE = 0x00,
TIME_STAMP_CLASS_TYPE = 0x01,
PCIE_CLASS_TYPE = 0x02,
NVME_CLASS_TYPE = 0x03,
RESET_CLASS_TYPE = 0x04,
BOOT_SEQUENCE_CLASS_TYPE = 0x05,
FIRMWARE_ASSERT_CLASS_TYPE = 0x06,
TEMPERATURE_CLASS_TYPE = 0x07,
MEDIA_CLASS_TYPE = 0x08,
MEDIA_WEAR_CLASS_TYPE = 0x09,
STATISTIC_SNAPSHOT_CLASS_TYPE = 0x0A,
//RESERVED = 7Fh-0Bh,
//VENDOR_UNIQUE_CLASS_TYPE = FFh-80h,
};
/**
* struct telemetry_str_log_format - Telemetry String Log Format
* @log_page_version: indicates the version of the mapping this log page uses
* Shall be set to 01h.
* @reserved1: Reserved.
* @log_page_guid: Shall be set to B13A83691A8F408B9EA495940057AA44h.
* @sls: Shall be set to the number of DWORDS in the String Log.
* @reserved2: reserved.
* @sits: shall be set to the number of DWORDS in the Statistics
* Identifier String Table
* @ests: Shall be set to the number of DWORDS from byte 0 of this
* log page to the start of the Event String Table
* @estsz: shall be set to the number of DWORDS in the Event String Table
* @vu_eve_sts: Shall be set to the number of DWORDS from byte 0 of this
* log page to the start of the VU Event String Table
* @vu_eve_st_sz: shall be set to the number of DWORDS in the VU Event String Table
* @ascts: the number of DWORDS from byte 0 of this log page until the
* ASCII Table Starts.
* @asctsz: the number of DWORDS in the ASCII Table
* @fifo1: FIFO 0 ASCII String
* @fifo2: FIFO 1 ASCII String
* @fifo3: FIFO 2 ASCII String
* @fifo4: FIFO 3 ASCII String
* @fif05: FIFO 4 ASCII String
* @fifo6: FIFO 5 ASCII String
* @fifo7: FIFO 6 ASCII String
* @fifo8: FIFO 7 ASCII String
* @fifo9: FIFO 8 ASCII String
* @fifo10: FIFO 9 ASCII String
* @fif011: FIFO 10 ASCII String
* @fif012: FIFO 11 ASCII String
* @fifo13: FIFO 12 ASCII String
* @fif014: FIFO 13 ASCII String
* @fif015: FIFO 14 ASCII String
* @fif016: FIFO 15 ASCII String
* @reserved3: reserved
*/
struct __packed telemetry_str_log_format {
__u8 log_page_version;
__u8 reserved1[15];
__u8 log_page_guid[GUID_LEN];
__le64 sls;
__u8 reserved2[24];
__le64 sits;
__le64 sitsz;
__le64 ests;
__le64 estsz;
__le64 vu_eve_sts;
__le64 vu_eve_st_sz;
__le64 ascts;
__le64 asctsz;
__u8 fifo1[16];
__u8 fifo2[16];
__u8 fifo3[16];
__u8 fifo4[16];
__u8 fifo5[16];
__u8 fifo6[16];
__u8 fifo7[16];
__u8 fifo8[16];
__u8 fifo9[16];
__u8 fifo10[16];
__u8 fifo11[16];
__u8 fifo12[16];
__u8 fifo13[16];
__u8 fifo14[16];
__u8 fifo15[16];
__u8 fifo16[16];
__u8 reserved3[48];
};
/*
* struct statistics_id_str_table_entry - Statistics Identifier String Table Entry
* @vs_si: Shall be set the Vendor Unique Statistic Identifier number.
* @reserved1: Reserved
* @ascii_id_len: Shall be set the number of ASCII Characters that are valid.
* @ascii_id_ofst: Shall be set to the offset from DWORD 0/Byte 0 of the Start
* of the ASCII Table to the first character of the string for
* this Statistic Identifier string..
* @reserved2 reserved
*/
struct __packed statistics_id_str_table_entry {
__le16 vs_si;
__u8 reserved1;
__u8 ascii_id_len;
__le64 ascii_id_ofst;
__le32 reserved2;
};
/*
* struct event_id_str_table_entry - Event Identifier String Table Entry
* @deb_eve_class: Shall be set the Debug Class.
* @ei: Shall be set to the Event Identifier
* @ascii_id_len: Shall be set the number of ASCII Characters that are valid.
* @ascii_id_ofst: This is the offset from DWORD 0/ Byte 0 of the start of the
* ASCII table to the ASCII data for this identifier
* @reserved2 reserved
*/
struct __packed event_id_str_table_entry {
__u8 deb_eve_class;
__le16 ei;
__u8 ascii_id_len;
__le64 ascii_id_ofst;
__le32 reserved2;
};
/*
* struct vu_event_id_str_table_entry - VU Event Identifier String Table Entry
* @deb_eve_class: Shall be set the Debug Class.
* @vu_ei: Shall be set to the VU Event Identifier
* @ascii_id_len: Shall be set the number of ASCII Characters that are valid.
* @ascii_id_ofst: This is the offset from DWORD 0/ Byte 0 of the start of the
* ASCII table to the ASCII data for this identifier
* @reserved reserved
*/
struct __packed vu_event_id_str_table_entry {
__u8 deb_eve_class;
__le16 vu_ei;
__u8 ascii_id_len;
__le64 ascii_id_ofst;
__le32 reserved;
};
struct __packed ocp_telemetry_parse_options {
char *telemetry_log;
char *string_log;
char *output_file;
char *output_format;
int data_area;
char *telemetry_type;
};
struct __packed nvme_ocp_telemetry_reason_id
{
__u8 error_id[64]; // Bytes 63:00
__u8 file_id[8]; // Bytes 71:64
__le16 line_number; // Bytes 73:72
__u8 valid_flags; // Bytes 74
__u8 reserved[21]; // Bytes 95:75
__u8 vu_reason_ext[32]; // Bytes 127:96
};
struct __packed nvme_ocp_telemetry_common_header
{
__u8 log_id; // Byte 00
__le32 reserved1; // Bytes 04:01
__u8 ieee_oui_id[3]; // Bytes 07:05
__le16 da1_last_block; // Bytes 09:08
__le16 da2_last_block; // Bytes 11:10
__le16 da3_last_block; // Bytes 13:12
__le16 reserved2; // Bytes 15:14
__le32 da4_last_block; // Bytes 19:16
};
struct __packed nvme_ocp_telemetry_host_initiated_header
{
struct nvme_ocp_telemetry_common_header commonHeader; // Bytes 19:00
__u8 reserved3[360]; // Bytes 379:20
__u8 host_initiated_scope; // Byte 380
__u8 host_initiated_gen_number; // Byte 381
__u8 host_initiated_data_available; // Byte 382
__u8 ctrl_initiated_gen_number; // Byte 383
struct nvme_ocp_telemetry_reason_id reason_id; // Bytes 511:384
};
struct __packed nvme_ocp_telemetry_controller_initiated_header
{
struct nvme_ocp_telemetry_common_header commonHeader; // Bytes 19:00
__u8 reserved3[361]; // Bytes 380:20
__u8 ctrl_initiated_scope; // Byte 381
__u8 ctrl_initiated_data_available; // Byte 382
__u8 ctrl_initiated_gen_number; // Byte 383
struct nvme_ocp_telemetry_reason_id reason_id; // Bytes 511:384
};
struct __packed nvme_ocp_telemetry_smart
{
__u8 critical_warning; // Byte 0
__le16 composite_temperature; // Bytes 2:1
__u8 available_spare; // Bytes 3
__u8 available_spare_threshold; // Bytes 4
__u8 percentage_used; // Bytes 5
__u8 reserved1[26]; // Bytes 31:6
__u8 data_units_read[16]; // Bytes 47:32
__u8 data_units_written[16]; // Bytes 63:48
__u8 host_read_commands[16]; // Byte 79:64
__u8 host_write_commands[16]; // Bytes 95:80
__u8 controller_busy_time[16]; // Bytes 111:96
__u8 power_cycles[16]; // Bytes 127:112
__u8 power_on_hours[16]; // Bytes 143:128
__u8 unsafe_shutdowns[16]; // Bytes 159:144
__u8 media_and_data_integrity_errors[16]; // Bytes 175:160
__u8 number_of_error_information_log_entries[16]; // Bytes 191:176
__le32 warning_composite_temperature_time; // Byte 195:192
__le32 critical_composite_temperature_time; // Bytes 199:196
__le16 temperature_sensor1; // Bytes 201:200
__le16 temperature_sensor2; // Byte 203:202
__le16 temperature_sensor3; // Byte 205:204
__le16 temperature_sensor4; // Bytes 207:206
__le16 temperature_sensor5; // Bytes 209:208
__le16 temperature_sensor6; // Bytes 211:210
__le16 temperature_sensor7; // Bytes 213:212
__le16 temperature_sensor8; // Bytes 215:214
__le32 thermal_management_temperature1_transition_count; // Bytes 219:216
__le32 thermal_management_temperature2_transition_count; // Bytes 223:220
__le32 total_time_for_thermal_management_temperature1; // Bytes 227:224
__le32 total_time_for_thermal_management_temperature2; // Bytes 231:228
__u8 reserved2[280]; // Bytes 511:232
};
struct __packed nvme_ocp_telemetry_smart_extended
{
__u8 physical_media_units_written[16]; // Bytes 15:0
__u8 physical_media_units_read[16]; // Bytes 31:16
__u8 bad_user_nand_blocks_raw_count[6]; // Bytes 37:32
__le16 bad_user_nand_blocks_normalized_value; // Bytes 39:38
__u8 bad_system_nand_blocks_raw_count[6]; // Bytes 45:40
__le16 bad_system_nand_blocks_normalized_value; // Bytes 47:46
__le64 xor_recovery_count; // Bytes 55:48
__le64 uncorrectable_read_error_count; // Bytes 63:56
__le64 soft_ecc_error_count; // Bytes 71:64
__le32 end_to_end_correction_counts_detected_errors; // Bytes 75:72
__le32 end_to_end_correction_counts_corrected_errors; // Bytes 79:76
__u8 system_data_percent_used; // Byte 80
__u8 refresh_counts[7]; // Bytes 87:81
__le32 max_user_data_erase_count; // Bytes 91:88
__le32 min_user_data_erase_count; // Bytes 95:92
__u8 num_thermal_throttling_events; // Bytes 96
__u8 current_throttling_status; // Bytes 97
__u8 errata_version_field; // Byte 98
__le16 point_version_field; // Byte 100:99
__le16 minor_version_field; // Byte 102:101
__u8 major_version_field; // Byte 103
__le64 pcie_correctable_error_count; // Bytes 111:104
__le32 incomplete_shutdowns; // Bytes 115:112
__le32 reserved1; // Bytes 119:116
__u8 percent_free_blocks; // Byte 120
__u8 reserved2[7]; // Bytes 127:121
__le16 capacitor_health; // Bytes 129:128
__u8 nvme_base_errata_version; // Byte 130
__u8 nvme_command_set_errata_version; // Byte 131
__le32 reserved3; // Bytes 135:132
__le64 unaligned_io; // Bytes 143:136
__le64 security_version_number; // Bytes 151:144
__le64 total_nuse; // Bytes 159:152
__u8 plp_start_count[16]; // Bytes 175:160
__u8 endurance_estimate[16]; // Bytes 191:176
__le64 pcie_link_retraining_count; // Bytes 199:192
__le64 power_state_change_count; // Bytes 207:200
__le64 lowest_permitted_firmware_revision; // Bytes 215:208
__u8 reserved4[278]; // Bytes 493:216
__le16 log_page_version; // Bytes 495:494