xref: /illumos-gate/usr/src/lib/libnvme/common/libnvme_micron.c (revision 7655c6d53c36750b508636f48c73a2de57754e5a)
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 /*
17  * libnvme logic specific to Micron device families. Currently this has support
18  * for the Micron 7300, 7400, 7450, 6500, and 7500 device generations. Right now
19  * we only have support for some of the device-specific log pages.
20  */
21 
22 #include <sys/sysmacros.h>
23 #include <sys/nvme/micron.h>
24 
25 #include "libnvme_impl.h"
26 
27 static const nvme_log_page_info_t micron_7300_log_smart = {
28 	.nlpi_short = "micron/smart",
29 	.nlpi_human = "Vendor Unique SMART",
30 	.nlpi_lid = MICRON_7300_LOG_SMART,
31 	.nlpi_csi = NVME_CSI_NVM,
32 	.nlpi_kind = NVME_LOG_ID_VENDOR_SPECIFIC,
33 	.nlpi_source = NVME_LOG_DISC_S_DB,
34 	.nlpi_scope = NVME_LOG_SCOPE_CTRL,
35 	.nlpi_len = sizeof (micron_vul_smart_t)
36 };
37 
38 static const nvme_log_page_info_t micron_7300_log_extsmart = {
39 	.nlpi_short = "micron/extsmart",
40 	.nlpi_human = "Extended SMART",
41 	.nlpi_lid = MICRON_7300_LOG_EXT_SMART,
42 	.nlpi_csi = NVME_CSI_NVM,
43 	.nlpi_kind = NVME_LOG_ID_VENDOR_SPECIFIC,
44 	.nlpi_source = NVME_LOG_DISC_S_DB,
45 	.nlpi_scope = NVME_LOG_SCOPE_CTRL,
46 	.nlpi_len = sizeof (micron_vul_ext_smart_t)
47 };
48 
49 static const nvme_log_page_info_t *micron_7300_log_pages[] = {
50 	&micron_7300_log_smart, &micron_7300_log_extsmart
51 };
52 
53 static const nvme_log_page_info_t micron_74x0_log_extsmart = {
54 	.nlpi_short = "micron/extsmart",
55 	.nlpi_human = "Extended SMART",
56 	.nlpi_lid = MICRON_74x0_LOG_EXT_SMART,
57 	.nlpi_csi = NVME_CSI_NVM,
58 	.nlpi_kind = NVME_LOG_ID_VENDOR_SPECIFIC,
59 	.nlpi_source = NVME_LOG_DISC_S_DB,
60 	.nlpi_scope = NVME_LOG_SCOPE_CTRL,
61 	.nlpi_len = sizeof (micron_vul_ext_smart_t)
62 };
63 
64 static const nvme_log_page_info_t *micron_74x0_log_pages[] = {
65 	&micron_74x0_log_extsmart
66 };
67 
68 static const nvme_log_page_info_t *micron_x500_log_pages[] = {
69 	&ocp_log_smart, &ocp_log_errrec, &ocp_log_fwact, &ocp_log_lat,
70 	&ocp_log_devcap, &ocp_log_unsup
71 };
72 
73 static const nvme_vsd_ident_t micron_7300_idents[] = {
74 	{
75 		.nvdi_vid = MICRON_PCI_VID,
76 		.nvdi_did = MICRON_7300_PRO_DID,
77 		.nvdi_human = "Micron 7300 Pro",
78 	}, {
79 		.nvdi_vid = MICRON_PCI_VID,
80 		.nvdi_did = MICRON_7300_MAX_DID,
81 		.nvdi_human = "Micron 7300 Max",
82 	}
83 };
84 
85 const nvme_vsd_t micron_7300 = {
86 	.nvd_ident = micron_7300_idents,
87 	.nvd_nident = ARRAY_SIZE(micron_7300_idents),
88 	.nvd_logs = micron_7300_log_pages,
89 	.nvd_nlogs = ARRAY_SIZE(micron_7300_log_pages)
90 };
91 
92 static const nvme_vsd_ident_t micron_74x0_idents[] = {
93 	{
94 		.nvdi_vid = MICRON_PCI_VID,
95 		.nvdi_did = MICRON_7400_PRO_DID,
96 		.nvdi_human = "Micron 7400 Pro",
97 	}, {
98 		.nvdi_vid = MICRON_PCI_VID,
99 		.nvdi_did = MICRON_7400_MAX_DID,
100 		.nvdi_human = "Micron 7400 Max",
101 	}, {
102 		.nvdi_vid = MICRON_PCI_VID,
103 		.nvdi_did = MICRON_7450_PRO_DID,
104 		.nvdi_human = "Micron 7450 Pro",
105 	}, {
106 		.nvdi_vid = MICRON_PCI_VID,
107 		.nvdi_did = MICRON_7450_MAX_DID,
108 		.nvdi_human = "Micron 7450 Max",
109 	}
110 };
111 
112 const nvme_vsd_t micron_74x0 = {
113 	.nvd_ident = micron_74x0_idents,
114 	.nvd_nident = ARRAY_SIZE(micron_74x0_idents),
115 	.nvd_logs = micron_74x0_log_pages,
116 	.nvd_nlogs = ARRAY_SIZE(micron_74x0_log_pages)
117 };
118 
119 static const nvme_vsd_ident_t micron_x500_idents[] = {
120 	{
121 		.nvdi_vid = MICRON_PCI_VID,
122 		.nvdi_did = MICRON_6500_ION_DID,
123 		.nvdi_human = "Micron 6500 ION"
124 	}, {
125 		.nvdi_vid = MICRON_PCI_VID,
126 		.nvdi_did = MICRON_7500_PRO_DID,
127 		.nvdi_human = "Micron 7500 Pro"
128 	}, {
129 		.nvdi_vid = MICRON_PCI_VID,
130 		.nvdi_did = MICRON_7500_MAX_DID,
131 		.nvdi_human = "Micron 7500 Max"
132 	}
133 };
134 
135 const nvme_vsd_t micron_x500 = {
136 	.nvd_ident = micron_x500_idents,
137 	.nvd_nident = ARRAY_SIZE(micron_x500_idents),
138 	.nvd_logs = micron_x500_log_pages,
139 	.nvd_nlogs = ARRAY_SIZE(micron_x500_log_pages)
140 };
141