xref: /illumos-gate/usr/src/cmd/nvmeadm/nvmeadm_solidigm.c (revision 0439b35b4c5b977fedef1ab5cbeff2c08150aba5)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright 2026 Oxide Computer Company
14  */
15 
16 /*
17  * Deal with Solidigm-specific logs.
18  */
19 
20 #include <sys/stddef.h>
21 #include <sys/sysmacros.h>
22 #include <sys/nvme/solidigm.h>
23 
24 #include "nvmeadm.h"
25 
26 #define	SOLIDIGM_F_POWER(f)	\
27 	.nf_off = offsetof(solidigm_vul_p5x2x_power_t, pow_##f), \
28 	.nf_len = sizeof (((solidigm_vul_p5x2x_power_t *)NULL)->pow_##f)
29 
30 static const nvmeadm_field_t solidigm_vul_power_fields[] = { {
31 	SOLIDIGM_F_POWER(vin1),
32 	.nf_short = "pin1",
33 	.nf_desc = "Voltage Rail 1 Power",
34 	.nf_type = NVMEADM_FT_UNIT,
35 	.nf_addend = { .nfa_unit = "uW" }
36 }, {
37 	SOLIDIGM_F_POWER(vin2),
38 	.nf_short = "pin2",
39 	.nf_desc = "Voltage Rail 2 Power",
40 	.nf_type = NVMEADM_FT_UNIT,
41 	.nf_addend = { .nfa_unit = "uW" }
42 } };
43 
44 const nvmeadm_log_field_info_t solidigm_vul_power_field_info = {
45 	.nlfi_log = "solidigm/power",
46 	.nlfi_fields = solidigm_vul_power_fields,
47 	.nlfi_nfields = ARRAY_SIZE(solidigm_vul_power_fields),
48 	.nlfi_min = sizeof (solidigm_vul_p5x2x_power_t)
49 };
50 
51 #define	SOLIDIGM_F_TEMP(f)	\
52 	.nf_off = offsetof(solidigm_vul_temp_t, temp_##f), \
53 	.nf_len = sizeof (((solidigm_vul_temp_t *)NULL)->temp_##f)
54 
55 static const nvmeadm_field_t solidigm_vul_temp_fields[] = { {
56 	SOLIDIGM_F_TEMP(cur),
57 	.nf_short = "cur",
58 	.nf_desc = "Current Internal Temperature",
59 	.nf_type = NVMEADM_FT_UNIT,
60 	.nf_addend = { .nfa_unit = "C" }
61 }, {
62 	SOLIDIGM_F_TEMP(over_last),
63 	.nf_short = "otlpow",
64 	.nf_desc = "SSD Overtemp Shutdown flag for Last Power On",
65 	.nf_type = NVMEADM_FT_HEX
66 }, {
67 	SOLIDIGM_F_TEMP(over_life),
68 	.nf_short = "otlife",
69 	.nf_desc = "SSD Overtemp Shutdown flag for Lifetime",
70 	.nf_type = NVMEADM_FT_HEX
71 }, {
72 	SOLIDIGM_F_TEMP(comp_life_high),
73 	.nf_short = "lifehigh",
74 	.nf_desc = "Highest (Lifetime) Composite Temperature",
75 	.nf_type = NVMEADM_FT_UNIT,
76 	.nf_addend = { .nfa_unit = "C" }
77 }, {
78 	SOLIDIGM_F_TEMP(comp_life_low),
79 	.nf_short = "lifelow",
80 	.nf_desc = "Lowest (Lifetime) Composite Temperature",
81 	.nf_type = NVMEADM_FT_UNIT,
82 	.nf_addend = { .nfa_unit = "C" }
83 }, {
84 	SOLIDIGM_F_TEMP(norm_max_warn),
85 	.nf_short = "maxnorm",
86 	.nf_desc = "Max Warning Normalized Threshold",
87 	.nf_type = NVMEADM_FT_UNIT,
88 	.nf_addend = { .nfa_unit = "C" }
89 }, {
90 	SOLIDIGM_F_TEMP(spec_min_op),
91 	.nf_short = "minorm",
92 	.nf_desc = "Specified Minimum Operating Temp",
93 	.nf_type = NVMEADM_FT_UNIT,
94 	.nf_addend = { .nfa_unit = "C" }
95 }, {
96 	SOLIDIGM_F_TEMP(est_off),
97 	.nf_short = "estoff",
98 	.nf_desc = "Estimated Offset",
99 	.nf_type = NVMEADM_FT_UNIT,
100 	.nf_addend = { .nfa_unit = "C" }
101 } };
102 
103 const nvmeadm_log_field_info_t solidigm_vul_temp_field_info = {
104 	.nlfi_log = "solidigm/temp",
105 	.nlfi_fields = solidigm_vul_temp_fields,
106 	.nlfi_nfields = ARRAY_SIZE(solidigm_vul_temp_fields),
107 	.nlfi_min = sizeof (solidigm_vul_temp_t)
108 };
109