xref: /illumos-gate/usr/src/uts/common/sys/nvme/wdc_sn65x.h (revision 43379a280422204006ceee5a5c5380444cb515d9)
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 2024 Oxide Computer Company
14  */
15 
16 #ifndef _SYS_NVME_WDC_SN65X_H
17 #define	_SYS_NVME_WDC_SN65X_H
18 
19 /*
20  * This header defines vendor-specific NVMe interfaces and is not a committed
21  * interface. Its contents and existence are subject to change.
22  *
23  * Vendor-specific definitions for the WDC SN650 and SN655 NVMe devices.
24  */
25 
26 #include <sys/debug.h>
27 #include <sys/stdint.h>
28 #include <sys/nvme/ocp.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #define	WDC_SN650_DID	0x2720
35 #define	WDC_SN655_DID	0x2722
36 
37 typedef enum {
38 	/*
39 	 * This is the same as the OCP SMART log.
40 	 */
41 	WDC_SN65X_LOG_OCP_SMART		= OCP_LOG_DSSD_SMART,
42 	/*
43 	 * This uses the common wdc_vul_power_t structure.
44 	 */
45 	WDC_SN65X_LOG_POWER		= 0xc5,
46 	/*
47 	 * This uses the common wdc_vul_temp_t structure. The specific
48 	 * measurements are recorded in the wdc_log_sn65x_temp_t.
49 	 */
50 	WDC_SN65X_LOG_TEMP		= 0xc6,
51 	WDC_SN65X_LOG_UNIQUE_SMART	= 0xca
52 } wdc_sn65x_vul_t;
53 
54 typedef enum {
55 	WDC_SN65X_TEMP_BOARD1	= 0,
56 	WDC_SN65X_TEMP_BOARD2,
57 	WDC_SN65X_TEMP_BOARD3,
58 	WDC_SN65X_TEMP_INLET_LED,
59 	WDC_SN65X_TEMP_OUTLET_HOST,
60 	WDC_SN65X_TEMP_NAND,
61 	WDC_SN65X_TEMP_FE,
62 	WDC_SN65X_TEMP_FM0,
63 	WDC_SN65X_TEMP_FM1,
64 	WDC_SN65X_TEMP_THERMR,
65 	WDC_SN65X_TEMP_AVG_THERMR,
66 	WDC_SN65X_TEMP_AVG_NAND,
67 	WDC_SN65X_TEMP_AVG_FE,
68 	WDC_SN65X_TEMP_NSAMPLES
69 } wdc_sn65x_temp_sample_t;
70 
71 /*
72  * All data structures must be packed to account for the layout from the various
73  * programmer's manuals.
74  */
75 #pragma pack(1)
76 
77 /*
78  * This structure represents an individual entry in the WDC Customer Unique
79  * SMART log page.
80  */
81 typedef struct {
82 	uint8_t vulp_id;
83 	uint8_t vulp_rsvd0[2];
84 	uint8_t vulp_norm;
85 	uint8_t vulp_rsvd1[1];
86 	uint8_t vulp_data[4];
87 	uint8_t vulp_pad[3];
88 } wdc_vul_sn65x_smart_ent_t;
89 
90 /*
91  * This structure represents the layout of the 0xca log page. Each entry has an
92  * id that corresponds to it and should be validated when reading this.
93  */
94 typedef struct {
95 	wdc_vul_sn65x_smart_ent_t sm_prog_fail;
96 	wdc_vul_sn65x_smart_ent_t sm_erase_fail;
97 	wdc_vul_sn65x_smart_ent_t sm_wear_level;
98 	wdc_vul_sn65x_smart_ent_t sm_etoe_edet;
99 	wdc_vul_sn65x_smart_ent_t sm_crc_err;
100 	wdc_vul_sn65x_smart_ent_t sm_timed_wear;
101 	wdc_vul_sn65x_smart_ent_t sm_timed_read;
102 	wdc_vul_sn65x_smart_ent_t sm_timed_timer;
103 	wdc_vul_sn65x_smart_ent_t sm_therm_throt;
104 	wdc_vul_sn65x_smart_ent_t sm_retry_buf_over;
105 	wdc_vul_sn65x_smart_ent_t sm_pll_lock_loss;
106 	wdc_vul_sn65x_smart_ent_t sm_nand_write;
107 	wdc_vul_sn65x_smart_ent_t sm_host_write;
108 } wdc_vul_sn65x_smart_t;
109 
110 typedef enum {
111 	WDC_SN65X_SMART_ENT_ID_PROG_FAIL	= 0,
112 	WDC_SN65X_SMART_END_ID_ERASE_FAIL,
113 	WDC_SN65X_SMART_ENT_ID_WEAR_LEVEL,
114 	WDC_SN65X_SMART_ENT_ID_ETOE_ERROR_DET,
115 	WDC_SN65X_SMART_ENT_ID_CRC_ERROR,
116 	WDC_SN65X_SMART_ENT_ID_TIMED_MEDIA_WEAR,
117 	WDC_SN65X_SMART_ENT_ID_TIMED_READS,
118 	WDC_SN65X_SMART_ENT_ID_TIMED_TIMER,
119 	WDC_SN65X_SMART_ENT_ID_THERMAL_THROTLE,
120 	WDC_SN65X_SMART_ENT_ID_RETRY_BUF_OVERFLOW,
121 	WDC_SN65X_SMART_ENT_ID_PLL_LOCK_LOSS,
122 	WDC_SN65X_SMART_ENT_ID_NAND_WRITTEN,
123 	WDC_SN65X_SMART_ENT_ID_HOST_WRITTEN
124 } wdc_sn65x_smart_ent_id_t;
125 
126 #pragma	pack()	/* pack(1) */
127 
128 #ifdef __cplusplus
129 }
130 #endif
131 
132 #endif /* _SYS_NVME_WDC_SN65X_H */
133