xref: /illumos-gate/usr/src/lib/libjedec/common/libjedec.h (revision f7379be0e8a103179bb13516195101c745bd6a30)
11566bc34SRobert Mustacchi /*
21566bc34SRobert Mustacchi  * This file and its contents are supplied under the terms of the
31566bc34SRobert Mustacchi  * Common Development and Distribution License ("CDDL"), version 1.0.
41566bc34SRobert Mustacchi  * You may only use this file in accordance with the terms of version
51566bc34SRobert Mustacchi  * 1.0 of the CDDL.
61566bc34SRobert Mustacchi  *
71566bc34SRobert Mustacchi  * A full copy of the text of the CDDL should have accompanied this
81566bc34SRobert Mustacchi  * source.  A copy of the CDDL is also available via the Internet at
91566bc34SRobert Mustacchi  * http://www.illumos.org/license/CDDL.
101566bc34SRobert Mustacchi  */
111566bc34SRobert Mustacchi 
121566bc34SRobert Mustacchi /*
131566bc34SRobert Mustacchi  * Copyright (c) 2018, Joyent, Inc.
148119dad8SRobert Mustacchi  * Copyright 2024 Oxide Computer Company
151566bc34SRobert Mustacchi  */
161566bc34SRobert Mustacchi 
171566bc34SRobert Mustacchi #ifndef _LIBJEDEC_H
181566bc34SRobert Mustacchi #define	_LIBJEDEC_H
191566bc34SRobert Mustacchi 
201566bc34SRobert Mustacchi /*
21fe82ebb0SRobert Mustacchi  * Library routines that support various JEDEC standards:
22fe82ebb0SRobert Mustacchi  *
23fe82ebb0SRobert Mustacchi  *  o JEDEC JEP-106 vendor data
24fe82ebb0SRobert Mustacchi  *  o Temperature range and Measurement Standards for Components and Modules
25fe82ebb0SRobert Mustacchi  *    (JESD402-1)
268119dad8SRobert Mustacchi  *  o DDR3 Serial Presence Detect (SPD) decoding
27fe82ebb0SRobert Mustacchi  *  o DDR4 Serial Presence Detect (SPD) decoding
288119dad8SRobert Mustacchi  *  o LPDDR3/4/4x Serial Presence Detect (SPD) decoding
29fe82ebb0SRobert Mustacchi  *  o DDR5 Serial Presence Detect (SPD) decoding
308119dad8SRobert Mustacchi  *  o LPDDR5/x Serial Presence Detect (SPD) decoding
311566bc34SRobert Mustacchi  */
321566bc34SRobert Mustacchi 
33fe82ebb0SRobert Mustacchi #include <sys/types.h>
34fe82ebb0SRobert Mustacchi #include <stdint.h>
35fe82ebb0SRobert Mustacchi #include <libnvpair.h>
36fe82ebb0SRobert Mustacchi 
371566bc34SRobert Mustacchi #ifdef __cplusplus
381566bc34SRobert Mustacchi extern "C" {
391566bc34SRobert Mustacchi #endif
401566bc34SRobert Mustacchi 
41fe82ebb0SRobert Mustacchi /*
42fe82ebb0SRobert Mustacchi  * Decode a JEDEC continuation ID (without parity) and a group ID.
43fe82ebb0SRobert Mustacchi  */
441566bc34SRobert Mustacchi extern const char *libjedec_vendor_string(uint_t, uint_t);
451566bc34SRobert Mustacchi 
46fe82ebb0SRobert Mustacchi /*
47*f7379be0SRobert Mustacchi  * JEDEC operating temperature ranges. These are defined in JESD402-1B
48*f7379be0SRobert Mustacchi  * (September 2024).
49fe82ebb0SRobert Mustacchi  */
50fe82ebb0SRobert Mustacchi typedef enum {
51fe82ebb0SRobert Mustacchi 	/*
52*f7379be0SRobert Mustacchi 	 * Operating Case Temperature Ranges
53fe82ebb0SRobert Mustacchi 	 */
54fe82ebb0SRobert Mustacchi 	JEDEC_TEMP_CASE_A1T,
55fe82ebb0SRobert Mustacchi 	JEDEC_TEMP_CASE_A2T,
56fe82ebb0SRobert Mustacchi 	JEDEC_TEMP_CASE_A3T,
57fe82ebb0SRobert Mustacchi 	JEDEC_TEMP_CASE_IT,
58fe82ebb0SRobert Mustacchi 	JEDEC_TEMP_CASE_ET,
59fe82ebb0SRobert Mustacchi 	JEDEC_TEMP_CASE_ST,
60fe82ebb0SRobert Mustacchi 	JEDEC_TEMP_CASE_XT,
61fe82ebb0SRobert Mustacchi 	JEDEC_TEMP_CASE_NT,
62fe82ebb0SRobert Mustacchi 	JEDEC_TEMP_CASE_RT,
63fe82ebb0SRobert Mustacchi 	/*
64fe82ebb0SRobert Mustacchi 	 * Operating Ambient Temperature Ranges
65fe82ebb0SRobert Mustacchi 	 */
66fe82ebb0SRobert Mustacchi 	JEDEC_TEMP_AMB_CT,
67fe82ebb0SRobert Mustacchi 	JEDEC_TEMP_AMB_IOT,
68fe82ebb0SRobert Mustacchi 	JEDEC_TEMP_AMB_IPT,
69fe82ebb0SRobert Mustacchi 	JEDEC_TEMP_AMB_IXT,
70fe82ebb0SRobert Mustacchi 	JEDEC_TEMP_AMB_AO3T,
71fe82ebb0SRobert Mustacchi 	JEDEC_TEMP_AMB_AO2T,
72fe82ebb0SRobert Mustacchi 	JEDEC_TEMP_AMB_AO1T,
73fe82ebb0SRobert Mustacchi 	/*
74*f7379be0SRobert Mustacchi 	 * Storage Temperature Ranges
75fe82ebb0SRobert Mustacchi 	 */
76fe82ebb0SRobert Mustacchi 	JEDEC_TEMP_STOR_2,
77fe82ebb0SRobert Mustacchi 	JEDEC_TEMP_STOR_1B,
78fe82ebb0SRobert Mustacchi 	JEDEC_TEMP_STOR_1A,
79*f7379be0SRobert Mustacchi 	JEDEC_TEMP_STOR_ST,
80*f7379be0SRobert Mustacchi 	/*
81*f7379be0SRobert Mustacchi 	 * Operating Junction Temperature Ranges
82*f7379be0SRobert Mustacchi 	 */
83*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_A135,
84*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_A130,
85*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_A1T,
86*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_A120,
87*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_A115,
88*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_A110,
89*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_A2T,
90*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_A100,
91*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_A95,
92*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_A90,
93*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_A3T,
94*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_LT135,
95*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_LT130,
96*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_LT125,
97*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_LT120,
98*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_LT115,
99*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_LT110,
100*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_LT105,
101*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_LT100,
102*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_IT,
103*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_LT90,
104*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_LT85,
105*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_ET120,
106*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_ET115,
107*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_ET110,
108*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_ET,
109*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_ET100,
110*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_ET95,
111*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_ET90,
112*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_ST,
113*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_120,
114*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_115,
115*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_110,
116*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_105,
117*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_100,
118*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_XT,
119*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_90,
120*f7379be0SRobert Mustacchi 	JEDEC_TEMP_JNCT_NT
121fe82ebb0SRobert Mustacchi } libjedec_temp_range_t;
122fe82ebb0SRobert Mustacchi extern boolean_t libjedec_temp_range(libjedec_temp_range_t, int32_t *,
123fe82ebb0SRobert Mustacchi     int32_t *);
124fe82ebb0SRobert Mustacchi 
125fe82ebb0SRobert Mustacchi /*
126fe82ebb0SRobert Mustacchi  * This is a series of error codes that libjedec may produce while trying to
127fe82ebb0SRobert Mustacchi  * parse the overall SPD data structure. These represent a top-level failure and
128fe82ebb0SRobert Mustacchi  * have meaning when no nvlist_t is returned.
129fe82ebb0SRobert Mustacchi  */
130fe82ebb0SRobert Mustacchi typedef enum {
131fe82ebb0SRobert Mustacchi 	/*
132fe82ebb0SRobert Mustacchi 	 * Indicates that we didn't encounter a fatal error; however, we may
133fe82ebb0SRobert Mustacchi 	 * have a specific parsing error that relates to a key in the nvlist.
134fe82ebb0SRobert Mustacchi 	 */
135fe82ebb0SRobert Mustacchi 	LIBJEDEC_SPD_OK	= 0,
136fe82ebb0SRobert Mustacchi 	/*
137fe82ebb0SRobert Mustacchi 	 * Indicates that we did not have enough memory while trying to
138fe82ebb0SRobert Mustacchi 	 * construct the generated nvlist_t.
139fe82ebb0SRobert Mustacchi 	 */
140fe82ebb0SRobert Mustacchi 	LIBJEDEC_SPD_NOMEM,
141fe82ebb0SRobert Mustacchi 	/*
142fe82ebb0SRobert Mustacchi 	 * Indicates that the data that we found was insufficient to
143fe82ebb0SRobert Mustacchi 	 * successfully parse basic information. The required size varies per
144fe82ebb0SRobert Mustacchi 	 * SPD key byte type.
145fe82ebb0SRobert Mustacchi 	 */
146fe82ebb0SRobert Mustacchi 	LIBJEDEC_SPD_TOOSHORT,
147fe82ebb0SRobert Mustacchi 	/*
148fe82ebb0SRobert Mustacchi 	 * Indicates that we found an unsupported type of SPD data and therefore
149fe82ebb0SRobert Mustacchi 	 * cannot parse this.
150fe82ebb0SRobert Mustacchi 	 */
151fe82ebb0SRobert Mustacchi 	LIBJEDEC_SPD_UNSUP_TYPE,
152fe82ebb0SRobert Mustacchi 	/*
153fe82ebb0SRobert Mustacchi 	 * Indicates that while we found a supported type of SPD data, we do not
154fe82ebb0SRobert Mustacchi 	 * understand its revision.
155fe82ebb0SRobert Mustacchi 	 */
156fe82ebb0SRobert Mustacchi 	LIBJEDEC_SPD_UNSUP_REV
157fe82ebb0SRobert Mustacchi } spd_error_t;
158fe82ebb0SRobert Mustacchi 
159fe82ebb0SRobert Mustacchi /*
160fe82ebb0SRobert Mustacchi  * Decode a binary payload of SPD data, if possible. The returned nvlist is made
161fe82ebb0SRobert Mustacchi  * up of a series of keys described below. Parsing errors are broken into two
162fe82ebb0SRobert Mustacchi  * categories. Fatal errors set a value in the spd_error_t below. Non-fatal
163fe82ebb0SRobert Mustacchi  * errors, such as encountering a value which we don't have a translation for,
164fe82ebb0SRobert Mustacchi  * are in a nested errors nvlist_t indexed by key.
165fe82ebb0SRobert Mustacchi  *
166fe82ebb0SRobert Mustacchi  * The keys are all dot delineated to create a few different top-level
167fe82ebb0SRobert Mustacchi  * namespaces. These include:
168fe82ebb0SRobert Mustacchi  *
169fe82ebb0SRobert Mustacchi  * "meta" -- Which includes information about the SPD, encoding, and things like
170fe82ebb0SRobert Mustacchi  * the type of module.
171fe82ebb0SRobert Mustacchi  *
172fe82ebb0SRobert Mustacchi  * "dram" -- Parameters that are specific to the SDRAM dies present. What one
173fe82ebb0SRobert Mustacchi  * thinks of as a stick of DRAM consists of several different SDRAM dies on the
174fe82ebb0SRobert Mustacchi  * PCB. This includes things like the row and columns bits and timing
175fe82ebb0SRobert Mustacchi  * information.
176fe82ebb0SRobert Mustacchi  *
1778119dad8SRobert Mustacchi  * "channel" -- Parameters that are tied to an implementation of a channel. DDR4
1788119dad8SRobert Mustacchi  * has a single channel where as DDR5 and LPDDR[345] have some number of
1798119dad8SRobert Mustacchi  * sub-channels.
1808119dad8SRobert Mustacchi  *
181fe82ebb0SRobert Mustacchi  * "ddr4", "ddr5" -- These include information which is specific to the general
182fe82ebb0SRobert Mustacchi  * DDR standard. While we have tried to consolidate information between them
183fe82ebb0SRobert Mustacchi  * where applicable, some things are specific to the standard.
184fe82ebb0SRobert Mustacchi  *
1858119dad8SRobert Mustacchi  * "lp" -- These are parameters that are currently specific to one of the
1868119dad8SRobert Mustacchi  * low-power DDR specifications such as LPDDR5.
1878119dad8SRobert Mustacchi  *
188fe82ebb0SRobert Mustacchi  * "module" -- Parameters that are specific to the broader module and PCB
189fe82ebb0SRobert Mustacchi  * itself. This includes information like the height or devices present.
190fe82ebb0SRobert Mustacchi  *
191fe82ebb0SRobert Mustacchi  * "ddr4.rdimm", "ddr4.lrdimm", "ddr5.rdimm", etc. -- These are parameter that
192fe82ebb0SRobert Mustacchi  * are specific to a module being both the combination of a specific DDR
193fe82ebb0SRobert Mustacchi  * standard and a specific type of module. Common parameters are often in the
194fe82ebb0SRobert Mustacchi  * "module" section.
195fe82ebb0SRobert Mustacchi  *
1968119dad8SRobert Mustacchi  * "ddr3.mb", "ddr4.rcd", etc. -- These are generation-specific parameters that
1978119dad8SRobert Mustacchi  * refer to a specific component like the rcd found on RDIMMs and LRDIMMs or the
1988119dad8SRobert Mustacchi  * mb on LRDIMMs.
1998119dad8SRobert Mustacchi  *
200fe82ebb0SRobert Mustacchi  * "mfg" -- Manufacturing related information.
201fe82ebb0SRobert Mustacchi  *
202fe82ebb0SRobert Mustacchi  * "errors" -- The key for the errors nvlist_t. See the spd_error_kind_t
203fe82ebb0SRobert Mustacchi  * definition later on. Each error has both a numeric code and a string message.
204fe82ebb0SRobert Mustacchi  */
205fe82ebb0SRobert Mustacchi extern nvlist_t *libjedec_spd(const uint8_t *, size_t, spd_error_t *);
206fe82ebb0SRobert Mustacchi 
207fe82ebb0SRobert Mustacchi /*
208fe82ebb0SRobert Mustacchi  * The following are keys in the metadata nvlist_t. The SPD_KEY_NBYTES_TOTAL is
209fe82ebb0SRobert Mustacchi  * present in DDR4 and DDR5. The SPD_KEY_NBYTES_USED is only present on DDR4
210fe82ebb0SRobert Mustacchi  * right now. All supported SPD encodings have the raw revision information. If
211fe82ebb0SRobert Mustacchi  * the values for the total bytes or used bytes are set to undefined, then they
212fe82ebb0SRobert Mustacchi  * will not be present.
213fe82ebb0SRobert Mustacchi  *
214fe82ebb0SRobert Mustacchi  * DDR5 introduces an idea of a public beta level that gets reset between
215fe82ebb0SRobert Mustacchi  * external releases. It theoretically modifies every scion. DDR5 also
216fe82ebb0SRobert Mustacchi  * introduces a second revision that is for the module information. This will
217fe82ebb0SRobert Mustacchi  * not be present on systems prior to DDR5.
218fe82ebb0SRobert Mustacchi  */
219fe82ebb0SRobert Mustacchi #define	SPD_KEY_NBYTES_TOTAL	"meta.total-bytes"	/* uint32_t */
220fe82ebb0SRobert Mustacchi #define	SPD_KEY_NBYTES_USED	"meta.used-bytes"	/* uint32_t */
221fe82ebb0SRobert Mustacchi #define	SPD_KEY_REV_ENC	"meta.revision-encoding"	/* uint32_t */
222fe82ebb0SRobert Mustacchi #define	SPD_KEY_REV_ADD	"meta.revision-additions"	/* uint32_t */
223fe82ebb0SRobert Mustacchi #define	SPD_KEY_BETA	"meta.beta-version"		/* uint32_t */
224fe82ebb0SRobert Mustacchi #define	SPD_KEY_MOD_REV_ENC	"meta.module-revision-encoding"	/* uint32_t */
225fe82ebb0SRobert Mustacchi #define	SPD_KEY_MOD_REV_ADD	"meta.module-revision-additions" /* uint32_t */
226fe82ebb0SRobert Mustacchi 
227fe82ebb0SRobert Mustacchi /*
228fe82ebb0SRobert Mustacchi  * DRAM Type information. This indicates the standard that the device conforms
229fe82ebb0SRobert Mustacchi  * to. This enumeration's values match the JEDEC specification's values. This is
230fe82ebb0SRobert Mustacchi  * present for everything.
231fe82ebb0SRobert Mustacchi  */
232fe82ebb0SRobert Mustacchi typedef enum {
233fe82ebb0SRobert Mustacchi 	SPD_DT_FAST_PAGE_MODE		= 0x01,
234fe82ebb0SRobert Mustacchi 	SPD_DT_EDO			= 0x02,
235fe82ebb0SRobert Mustacchi 	SPD_DT_PIPE_NIBBLE		= 0x03,
236fe82ebb0SRobert Mustacchi 	SPD_DT_SDRAM			= 0x04,
237fe82ebb0SRobert Mustacchi 	SPD_DT_ROM			= 0x05,
238fe82ebb0SRobert Mustacchi 	SPD_DT_DDR_SGRAM		= 0x06,
239fe82ebb0SRobert Mustacchi 	SPD_DT_DDR_SDRAM		= 0x07,
240fe82ebb0SRobert Mustacchi 	SPD_DT_DDR2_SDRAM		= 0x08,
241fe82ebb0SRobert Mustacchi 	SPD_DT_DDR2_SDRAM_FBDIMM	= 0x09,
242fe82ebb0SRobert Mustacchi 	SPD_DT_DDR2_SDRAM_FDIMM_P	= 0x0a,
243fe82ebb0SRobert Mustacchi 	SPD_DT_DDR3_SDRAM		= 0x0b,
244fe82ebb0SRobert Mustacchi 	SPD_DT_DDR4_SDRAM		= 0x0c,
245fe82ebb0SRobert Mustacchi 	SPD_DT_DDR4E_SDRAM		= 0x0e,
246fe82ebb0SRobert Mustacchi 	SPD_DT_LPDDR3_SDRAM		= 0x0f,
247fe82ebb0SRobert Mustacchi 	SPD_DT_LPDDR4_SDRAM		= 0x10,
248fe82ebb0SRobert Mustacchi 	SPD_DT_LPDDR4X_SDRAM		= 0x11,
249fe82ebb0SRobert Mustacchi 	SPD_DT_DDR5_SDRAM		= 0x12,
250fe82ebb0SRobert Mustacchi 	SPD_DT_LPDDR5_SDRAM		= 0x13,
251fe82ebb0SRobert Mustacchi 	SPD_DT_DDR5_NVDIMM_P		= 0x14,
252fe82ebb0SRobert Mustacchi 	SPD_DT_LPDDR5X_SDRAM		= 0x15
253fe82ebb0SRobert Mustacchi } spd_dram_type_t;
254fe82ebb0SRobert Mustacchi #define	SPD_KEY_DRAM_TYPE	"meta.dram-type"	/* uint32_t (enum) */
255fe82ebb0SRobert Mustacchi 
256fe82ebb0SRobert Mustacchi typedef enum {
257fe82ebb0SRobert Mustacchi 	SPD_MOD_TYPE_RDIMM,
258fe82ebb0SRobert Mustacchi 	SPD_MOD_TYPE_UDIMM,
259fe82ebb0SRobert Mustacchi 	SPD_MOD_TYPE_SODIMM,
260fe82ebb0SRobert Mustacchi 	SPD_MOD_TYPE_LRDIMM,
261fe82ebb0SRobert Mustacchi 	SPD_MOD_TYPE_MRDIMM,
262fe82ebb0SRobert Mustacchi 	SPD_MOD_TYPE_DDIMM,
263fe82ebb0SRobert Mustacchi 	SPD_MOD_TYPE_SOLDER,
264fe82ebb0SRobert Mustacchi 	SPD_MOD_TYPE_MINI_RDIMM,
265fe82ebb0SRobert Mustacchi 	SPD_MOD_TYPE_MINI_UDIMM,
2668119dad8SRobert Mustacchi 	SPD_MOD_TYPE_MINI_CDIMM,
267fe82ebb0SRobert Mustacchi 	SPD_MOD_TYPE_72b_SO_RDIMM,
268fe82ebb0SRobert Mustacchi 	SPD_MOD_TYPE_72b_SO_UDIMM,
2698119dad8SRobert Mustacchi 	SPD_MOD_TYPE_72b_SO_CDIMM,
270fe82ebb0SRobert Mustacchi 	SPD_MOD_TYPE_16b_SO_DIMM,
2718119dad8SRobert Mustacchi 	SPD_MOD_TYPE_32b_SO_DIMM,
2728119dad8SRobert Mustacchi 	SPD_MOD_TYPE_CUDIMM,
2738119dad8SRobert Mustacchi 	SPD_MOD_TYPE_CSODIMM,
2748119dad8SRobert Mustacchi 	SPD_MOD_TYPE_CAMM2,
2758119dad8SRobert Mustacchi 	SPD_MOD_TYPE_LPDIMM,
2768119dad8SRobert Mustacchi 	SPD_MOD_TYPE_MICRO_DIMM
277fe82ebb0SRobert Mustacchi } spd_module_type_t;
278fe82ebb0SRobert Mustacchi #define	SPD_KEY_MOD_TYPE	"meta.module-type"	/* uint32_t (enum) */
279fe82ebb0SRobert Mustacchi typedef enum {
280fe82ebb0SRobert Mustacchi 	SPD_MOD_NOT_HYBRID,
281fe82ebb0SRobert Mustacchi 	SPD_MOD_HYBRID_NVDIMMM
282fe82ebb0SRobert Mustacchi } spd_module_hybrid_t;
283fe82ebb0SRobert Mustacchi #define	SPD_KEY_MOD_HYBRID_TYPE	"meta.hybrid-type"	/* uint32_t */
284fe82ebb0SRobert Mustacchi 
285fe82ebb0SRobert Mustacchi typedef enum {
286fe82ebb0SRobert Mustacchi 	SPD_MOD_TYPE_NVDIMM_N,
287fe82ebb0SRobert Mustacchi 	SPD_MOD_TYPE_NVDIMM_P,
288fe82ebb0SRobert Mustacchi 	SPD_MOD_TYPE_NVDIMM_H
289fe82ebb0SRobert Mustacchi } spd_module_nvdimm_type_t;
290fe82ebb0SRobert Mustacchi #define	SPD_KEY_MOD_NVDIMM_TYPE	"meta.nvdimm-type"	/* uint32_t */
291fe82ebb0SRobert Mustacchi 
292fe82ebb0SRobert Mustacchi /*
293fe82ebb0SRobert Mustacchi  * Different SPD standards have different integrity rules. The regions covered
294fe82ebb0SRobert Mustacchi  * by the CRCs also vary. We end up with per-spec keys. All data types for these
295fe82ebb0SRobert Mustacchi  * are uint32_t's so that way we can record the expected CRC. We use a uint32_t
296fe82ebb0SRobert Mustacchi  * for consistency even though the data only fits in a uint16_t. Note, callers
297fe82ebb0SRobert Mustacchi  * must check to see if these exist. If there are keys with these names in the
298fe82ebb0SRobert Mustacchi  * errors object, then the rest of the data should be considered suspect, but we
2998119dad8SRobert Mustacchi  * will have attempted to parse everything we can. The DDR4 values are shared
3008119dad8SRobert Mustacchi  * across LPDDR3/4/4X. The DDR5 values are shared across LPDDR5/5X.
301fe82ebb0SRobert Mustacchi  */
3028119dad8SRobert Mustacchi #define	SPD_KEY_CRC_DDR3	"meta.crc-ddr3"		/* uint32_t */
3038119dad8SRobert Mustacchi #define	SPD_KEY_CRC_DDR3_LEN	"meta.crc-ddr3-len"	/* uint32_t */
304fe82ebb0SRobert Mustacchi #define	SPD_KEY_CRC_DDR4_BASE	"meta.crc-ddr4-base"	/* uint32_t */
305fe82ebb0SRobert Mustacchi #define	SPD_KEY_CRC_DDR4_BLK1	"meta.crc-ddr4-block1"	/* uint32_t */
306fe82ebb0SRobert Mustacchi #define	SPD_KEY_CRC_DDR5	"meta.crc-ddr5"		/* uint32_t */
307fe82ebb0SRobert Mustacchi 
308fe82ebb0SRobert Mustacchi /*
309fe82ebb0SRobert Mustacchi  * DDR5 adds a field in the SPD to describe how data should be hashed to compute
310fe82ebb0SRobert Mustacchi  * and compare to an attribute certification to authenticate modules. This is
311fe82ebb0SRobert Mustacchi  * only present in DDR5. We only add a value here if this is actually supported.
312fe82ebb0SRobert Mustacchi  */
313fe82ebb0SRobert Mustacchi typedef enum {
314fe82ebb0SRobert Mustacchi 	SPD_HASH_SEQ_ALG_1
315fe82ebb0SRobert Mustacchi } spd_hash_seq_alg_t;
316fe82ebb0SRobert Mustacchi #define	SPD_KEY_HASH_SEQ	"meta.hash-sequence-algorithm"	/* uint32_t */
317fe82ebb0SRobert Mustacchi 
318fe82ebb0SRobert Mustacchi /*
319fe82ebb0SRobert Mustacchi  * This section contains information related to DRAM technology.
320fe82ebb0SRobert Mustacchi  */
321fe82ebb0SRobert Mustacchi 
322fe82ebb0SRobert Mustacchi /*
323fe82ebb0SRobert Mustacchi  * Bank, bank group, row, and column bits. These are all present in both DDR4
324fe82ebb0SRobert Mustacchi  * and DDR5. DDR4 allows cases where there are no bank groups. If no bits are
325fe82ebb0SRobert Mustacchi  * used, then this item is empty.
326fe82ebb0SRobert Mustacchi  */
327fe82ebb0SRobert Mustacchi #define	SPD_KEY_NROW_BITS	"dram.num-row-bits"	/* uint32_t */
328fe82ebb0SRobert Mustacchi #define	SPD_KEY_NCOL_BITS	"dram.num-column-bits"	/* uint32_t */
329fe82ebb0SRobert Mustacchi #define	SPD_KEY_NBANK_BITS	"dram.num-bank-bits"	/* uint32_t */
330fe82ebb0SRobert Mustacchi #define	SPD_KEY_NBGRP_BITS	"dram.num-bank-group-bits"	/* uint32_t */
331fe82ebb0SRobert Mustacchi #define	SPD_KEY_SEC_NROW_BITS	"dram.sec-num-row-bits"		/* uint32_t */
332fe82ebb0SRobert Mustacchi #define	SPD_KEY_SEC_NCOL_BITS	"dram.sec-num-column-bits"	/* uint32_t */
333fe82ebb0SRobert Mustacchi #define	SPD_KEY_SEC_NBANK_BITS	"dram.sec-num-bank-bits"	/* uint32_t */
334fe82ebb0SRobert Mustacchi #define	SPD_KEY_SEC_NBGRP_BITS	"dram.sec-num-bank-group-bits"	/* uint32_t */
335fe82ebb0SRobert Mustacchi 
336fe82ebb0SRobert Mustacchi /*
337fe82ebb0SRobert Mustacchi  * Die Density. This is the capacity that each die contains in bits.
338fe82ebb0SRobert Mustacchi  */
339fe82ebb0SRobert Mustacchi #define	SPD_KEY_DIE_SIZE	"dram.die-bit-size"	/* uint64_t */
340fe82ebb0SRobert Mustacchi #define	SPD_KEY_SEC_DIE_SIZE	"dram.sec-die-bit-size"	/* uint64_t */
341fe82ebb0SRobert Mustacchi 
342fe82ebb0SRobert Mustacchi /*
343fe82ebb0SRobert Mustacchi  * Package information. DRAM may be made up of a monolithic package type or
344fe82ebb0SRobert Mustacchi  * several different types. There is a boolean property present to indicate that
345fe82ebb0SRobert Mustacchi  * it is not monolithic. For these there is a die count and then a separate
346fe82ebb0SRobert Mustacchi  * notion of what the signal loading type is. If the property is present then we
347fe82ebb0SRobert Mustacchi  * will also have the die count and loading type for the secondary. Note, these
348fe82ebb0SRobert Mustacchi  * loading parameters are considered at the device balls as opposed to specific
349fe82ebb0SRobert Mustacchi  * signals.
350fe82ebb0SRobert Mustacchi  */
351fe82ebb0SRobert Mustacchi #define	SPD_KEY_PKG_NOT_MONO	"meta.non-monolithic-package"	/* key only */
352fe82ebb0SRobert Mustacchi #define	SPD_KEY_PKG_NDIE	"dram.package-die-count"	/* uint32_t */
353fe82ebb0SRobert Mustacchi #define	SPD_KEY_SEC_PKG_NDIE	"dram.sec-package-die-count"	/* uint32_t */
354fe82ebb0SRobert Mustacchi typedef enum {
355fe82ebb0SRobert Mustacchi 	SPD_SL_UNSPECIFIED,
356fe82ebb0SRobert Mustacchi 	SPD_SL_MUTLI_STACK,
357fe82ebb0SRobert Mustacchi 	SPD_SL_3DS
358fe82ebb0SRobert Mustacchi } spd_signal_loading_t;
359fe82ebb0SRobert Mustacchi #define	SPD_KEY_PKG_SL		"dram.package-sig-loading"	/* uint32_t */
360fe82ebb0SRobert Mustacchi #define	SPD_KEY_SEC_PKG_SL	"dram.sec-package-sig-loading"	/* uint32_t */
361fe82ebb0SRobert Mustacchi 
362fe82ebb0SRobert Mustacchi /*
3638119dad8SRobert Mustacchi  * Post-package Repair. PPR is supported in DDR4, DDR5. LPDDR4, and LPDDR5. PPR
3648119dad8SRobert Mustacchi  * support is indicated by the presence of the spd_ppr_flags_t structure. If it
3658119dad8SRobert Mustacchi  * is not supported, then there will be no PPR related keys present. In some
3668119dad8SRobert Mustacchi  * cases the PPR granularity may not be known, in which case it is not present.
367fe82ebb0SRobert Mustacchi  */
368fe82ebb0SRobert Mustacchi typedef enum {
369fe82ebb0SRobert Mustacchi 	SPD_PPR_F_HARD_PPR		= 1 << 0,
3708119dad8SRobert Mustacchi 	SPD_PPR_F_SOFT_PPR		= 1 << 1,
3718119dad8SRobert Mustacchi 	SPD_PPR_F_MBIST_PPR		= 1 << 2,
3728119dad8SRobert Mustacchi 	SPD_PPR_F_PPR_UNDO		= 1 << 3
373fe82ebb0SRobert Mustacchi } spd_ppr_flags_t;
374fe82ebb0SRobert Mustacchi 
375fe82ebb0SRobert Mustacchi typedef enum {
376fe82ebb0SRobert Mustacchi 	SPD_PPR_GRAN_BANK_GROUP,
377fe82ebb0SRobert Mustacchi 	SPD_PPR_GRAN_BANK
378fe82ebb0SRobert Mustacchi } spd_ppr_gran_t;
379fe82ebb0SRobert Mustacchi #define	SPD_KEY_PPR		"dram.ppr-flags"	/* uint32_t (enum) */
380fe82ebb0SRobert Mustacchi #define	SPD_KEY_PPR_GRAN	"dram.ppr-gran"		/* uint32_t (enum) */
381fe82ebb0SRobert Mustacchi 
382fe82ebb0SRobert Mustacchi /*
383fe82ebb0SRobert Mustacchi  * Voltages in mV. This is an array of nominal voltages that are supported. DDR3
384fe82ebb0SRobert Mustacchi  * defines multiple voltages, but DDR4 and DDR5 only have a single voltage
385fe82ebb0SRobert Mustacchi  * (specific to the supply). DDR3 and DDR4 only defined V~DD~ in SPD. While
386fe82ebb0SRobert Mustacchi  * V~DQ~ and V~PP~ are defined in DDR5.
387fe82ebb0SRobert Mustacchi  */
388fe82ebb0SRobert Mustacchi #define	SPD_KEY_NOM_VDD		"dram.nominal-vdd"	/* uint32_t[] */
389fe82ebb0SRobert Mustacchi #define	SPD_KEY_NOM_VDDQ	"dram.nominal-vddq"	/* uint32_t[] */
390fe82ebb0SRobert Mustacchi #define	SPD_KEY_NOM_VPP		"dram.nominal-vpp"	/* uint32_t[] */
391fe82ebb0SRobert Mustacchi 
392fe82ebb0SRobert Mustacchi /*
3938119dad8SRobert Mustacchi  * DRAM module organization.
3948119dad8SRobert Mustacchi  *
3958119dad8SRobert Mustacchi  * This describes the number of ranks that exist on a per-channel basis. In
3968119dad8SRobert Mustacchi  * DDR4, there is only one channel and so this effectively covers the entire
3978119dad8SRobert Mustacchi  * module. In DDR5 and LPDDR there are multiple channels or sub-channels. The
3988119dad8SRobert Mustacchi  * rank mix may be symmetrical or asymmetrical. A key will be set if that's the
3998119dad8SRobert Mustacchi  * case.
400fe82ebb0SRobert Mustacchi  */
401fe82ebb0SRobert Mustacchi #define	SPD_KEY_RANK_ASYM	"dram.asymmetrical-ranks"	/* key */
4028119dad8SRobert Mustacchi #define	SPD_KEY_NRANKS		"channel.num-ranks"	/* uint32_t */
403fe82ebb0SRobert Mustacchi 
404fe82ebb0SRobert Mustacchi /*
4058119dad8SRobert Mustacchi  * DRAM and Module/Channel widths.
4068119dad8SRobert Mustacchi  *
4078119dad8SRobert Mustacchi  * A 'channel' refers to the entire interface between a memory
4088119dad8SRobert Mustacchi  * controller and memory. In DDR4 there is only a single channel that covers the
4098119dad8SRobert Mustacchi  * entire 72-bit (64-bit data, 8-bit ECC) bus. In DDR5 and LPDDR5 this is made
4108119dad8SRobert Mustacchi  * up of a pair of sub-channels. In LPDDR3/4 the device exposed a number of
4118119dad8SRobert Mustacchi  * channels, that are effecitvely similar in spirit to the DDR5 sub-channel. The
4128119dad8SRobert Mustacchi  * channel keys below cover whatever the smallest defined unit is. For DDR4 (and
4138119dad8SRobert Mustacchi  * earlier) this is the entire channel. For LPDDR3/4 these are the independent
4148119dad8SRobert Mustacchi  * channels in the SPD spec and for DDR5 and LPDDR5 these are sub-channels. The
4158119dad8SRobert Mustacchi  * channel width is split between a primary data and ECC size.
4168119dad8SRobert Mustacchi  *
4178119dad8SRobert Mustacchi  * In LPDDR3/4 a given DRAM die may support a varying number of channels. That
4188119dad8SRobert Mustacchi  * is stored in the num-channels calculation and otherwise set to 1 for all
4198119dad8SRobert Mustacchi  * other types of memory.
4208119dad8SRobert Mustacchi  *
421fe82ebb0SRobert Mustacchi  * Separately the individual DRAM dies themselves have a width which is
4228119dad8SRobert Mustacchi  * SPD_KEY_DRAM_WIDTH. This is the portion of each die that contributes to the
4238119dad8SRobert Mustacchi  * given channel.
424fe82ebb0SRobert Mustacchi  */
425fe82ebb0SRobert Mustacchi #define	SPD_KEY_DRAM_WIDTH	"dram.width"		/* uint32_t */
426fe82ebb0SRobert Mustacchi #define	SPD_KEY_SEC_DRAM_WIDTH	"dram.sec-width"	/* uint32_t */
4278119dad8SRobert Mustacchi #define	SPD_KEY_DRAM_NCHAN	"dram.num-channels"	/* uint32_t */
428fe82ebb0SRobert Mustacchi #define	SPD_KEY_NSUBCHAN	"module.num-subchan"	/* uint32_t */
4298119dad8SRobert Mustacchi #define	SPD_KEY_DATA_WIDTH	"channel.data-width"	/* uint32_t */
4308119dad8SRobert Mustacchi #define	SPD_KEY_ECC_WIDTH	"channel.ecc-width"	/* uint32_t */
431fe82ebb0SRobert Mustacchi 
432fe82ebb0SRobert Mustacchi /*
4338119dad8SRobert Mustacchi  * LPDDR offers a notion of a 'byte mode' where half of the I/Os can be shared
4348119dad8SRobert Mustacchi  * between multiple dies. This key is set when tihs is true.
4358119dad8SRobert Mustacchi  */
4368119dad8SRobert Mustacchi #define	SPD_KEY_LP_BYTE_MODE	"lp.byte-mode"	/* key */
4378119dad8SRobert Mustacchi 
4388119dad8SRobert Mustacchi /*
4398119dad8SRobert Mustacchi  * LPDDR3-5 have a signal loading matrix that indicates the amount of load that
4408119dad8SRobert Mustacchi  * is on different groups of signals. All values are a uint32_t of the count of
4418119dad8SRobert Mustacchi  * loads.
4428119dad8SRobert Mustacchi  */
4438119dad8SRobert Mustacchi #define	SPD_KEY_LP_LOAD_DSM	"lp.load-data-strobe-mask"
4448119dad8SRobert Mustacchi #define	SPD_KEY_LP_LOAD_CAC	"lp.load-command-address-clock"
4458119dad8SRobert Mustacchi #define	SPD_KEY_LP_LOAD_CS	"lp.load-chip-select"
4468119dad8SRobert Mustacchi 
4478119dad8SRobert Mustacchi /*
4488119dad8SRobert Mustacchi  * DDR3, DDR4, and LPDDR3-5/x specify specific timebases in the SPD data. DDR5
4498119dad8SRobert Mustacchi  * just requires a specific timebase and therefore does not define these keys.
4508119dad8SRobert Mustacchi  * This like all other time values is explicitly in ps.
451fe82ebb0SRobert Mustacchi  */
452fe82ebb0SRobert Mustacchi #define	SPD_KEY_MTB	"dram.median-time-base"		/* uint32_t */
453fe82ebb0SRobert Mustacchi #define	SPD_KEY_FTB	"dram.fine-time-base"		/* uint32_t */
454fe82ebb0SRobert Mustacchi 
455fe82ebb0SRobert Mustacchi /*
456fe82ebb0SRobert Mustacchi  * Supported CAS Latencies. This is an array of integers to indicate which index
457fe82ebb0SRobert Mustacchi  * CAS latencies are possible.
458fe82ebb0SRobert Mustacchi  */
459fe82ebb0SRobert Mustacchi #define	SPD_KEY_CAS	"dram.cas-latencies"		/* uint32_t [] */
460fe82ebb0SRobert Mustacchi 
461fe82ebb0SRobert Mustacchi /*
462fe82ebb0SRobert Mustacchi  * Time parameters. These are all in picoseconds. All values are uint64_t.
463fe82ebb0SRobert Mustacchi  */
464fe82ebb0SRobert Mustacchi #define	SPD_KEY_TCKAVG_MIN	"dram.t~CKAVG~min"
465fe82ebb0SRobert Mustacchi #define	SPD_KEY_TCKAVG_MAX	"dram.t~CKAVG~max"
466fe82ebb0SRobert Mustacchi #define	SPD_KEY_TAA_MIN		"dram.t~AA~min"
467fe82ebb0SRobert Mustacchi #define	SPD_KEY_TRCD_MIN	"dram.t~RCD~min"
468fe82ebb0SRobert Mustacchi #define	SPD_KEY_TRP_MIN		"dram.t~RP~min"
469fe82ebb0SRobert Mustacchi #define	SPD_KEY_TRAS_MIN	"dram.t~RAS~min"
470fe82ebb0SRobert Mustacchi #define	SPD_KEY_TRC_MIN		"dram.t~RC~min"
471fe82ebb0SRobert Mustacchi #define	SPD_KEY_TRFC1_MIN	"dram.t~RFC1~min"
472fe82ebb0SRobert Mustacchi #define	SPD_KEY_TRFC2_MIN	"dram.t~RFC2~min"
473fe82ebb0SRobert Mustacchi #define	SPD_KEY_TFAW		"dram.t~FAW~"
4748119dad8SRobert Mustacchi #define	SPD_KEY_TRRD_L_MIN	"dram.t~RRD_L~min"
475fe82ebb0SRobert Mustacchi #define	SPD_KEY_TCCD_L_MIN	"dram.t~CCD_S~min"
476fe82ebb0SRobert Mustacchi #define	SPD_KEY_TWR_MIN		"dram.t~WR~min"
477fe82ebb0SRobert Mustacchi 
478fe82ebb0SRobert Mustacchi /*
479fe82ebb0SRobert Mustacchi  * The following time are only used in DDR4. While some of the DDR4 and DDR5
480fe82ebb0SRobert Mustacchi  * write to read or write to write parameters are similar, because they use
481fe82ebb0SRobert Mustacchi  * different names for times, we distinguish them as different values.
482fe82ebb0SRobert Mustacchi  */
483fe82ebb0SRobert Mustacchi #define	SPD_KEY_TRFC4_MIN	"dram.t~RFC4~min"
484fe82ebb0SRobert Mustacchi #define	SPD_KEY_TRRD_S_MIN	"dram.t~RRD_S~min"
485fe82ebb0SRobert Mustacchi #define	SPD_KEY_TWTRS_MIN	"dram.t~WTR_S~min"
486fe82ebb0SRobert Mustacchi #define	SPD_KEY_TWTRL_MIN	"dram.t~WTR_L~min"
487fe82ebb0SRobert Mustacchi 
488fe82ebb0SRobert Mustacchi /*
489fe82ebb0SRobert Mustacchi  * The following times are specific to DDR5. t~CCD_L_WTR~ in DDR5 is the
490fe82ebb0SRobert Mustacchi  * equivalent to t~WTRS_L~min, same with t~CCD_S_WTR~.
491fe82ebb0SRobert Mustacchi  */
492fe82ebb0SRobert Mustacchi #define	SPD_KEY_TCCDLWR		"dram.t~CCD_L_WR"
493fe82ebb0SRobert Mustacchi #define	SPD_KEY_TCCDLWR2	"dram.t~CCD_L_WR2"
494fe82ebb0SRobert Mustacchi #define	SPD_KEY_TCCDLWTR	"dram.t~CCD_L_WTR"
495fe82ebb0SRobert Mustacchi #define	SPD_KEY_TCCDSWTR	"dram.t~CCD_S_WTR"
496fe82ebb0SRobert Mustacchi #define	SPD_KEY_TRTP		"dram.t~RTP~"
4978119dad8SRobert Mustacchi #define	SPD_KEY_TCCDM		"dram.t~CCD_M~"
4988119dad8SRobert Mustacchi #define	SPD_KEY_TCCDMWR		"dram.t~CCD_M_WR~"
4998119dad8SRobert Mustacchi #define	SPD_KEY_TCCDMWTR	"dram.t~CCD_M_WTR~"
500fe82ebb0SRobert Mustacchi 
501fe82ebb0SRobert Mustacchi /*
502fe82ebb0SRobert Mustacchi  * While prior DDR standards did have minimum clock times for certain
503fe82ebb0SRobert Mustacchi  * activities, these were first added to the SPD data in DDR5. All values for
504fe82ebb0SRobert Mustacchi  * these are uint32_t's and are in clock cycles.
505fe82ebb0SRobert Mustacchi  */
5068119dad8SRobert Mustacchi #define	SPD_KEY_TRRD_L_NCK	"dram.t~RRD_L~nCK"
5078119dad8SRobert Mustacchi #define	SPD_KEY_TCCD_L_NCK	"dram.t~CCD_L~nCK"
508fe82ebb0SRobert Mustacchi #define	SPD_KEY_TCCDLWR_NCK	"dram.t~CCD_L_WR~nCK"
509fe82ebb0SRobert Mustacchi #define	SPD_KEY_TCCDLWR2_NCK	"dram.t~CCD_L_WR2~nCK"
510fe82ebb0SRobert Mustacchi #define	SPD_KEY_TFAW_NCK	"dram.t~FAW~nCK"
511fe82ebb0SRobert Mustacchi #define	SPD_KEY_TCCDLWTR_NCK	"dram.t~CCD_L_WTR~nCK"
512fe82ebb0SRobert Mustacchi #define	SPD_KEY_TCCDSWTR_NCK	"dram.t~CCD_S_WTR~nCK"
513fe82ebb0SRobert Mustacchi #define	SPD_KEY_TRTP_NCK	"dram.t~RTP~nCK"
5148119dad8SRobert Mustacchi #define	SPD_KEY_TCCDM_NCK	"dram.t~CCD_M~nCK"
5158119dad8SRobert Mustacchi #define	SPD_KEY_TCCDMWR_NCK	"dram.t~CCD_M_WR~nCK"
5168119dad8SRobert Mustacchi #define	SPD_KEY_TCCDMWTR_NCK	"dram.t~CCD_M_WTR~nCK"
517fe82ebb0SRobert Mustacchi 
518fe82ebb0SRobert Mustacchi /*
519fe82ebb0SRobert Mustacchi  * The following times are only used in DDR5. The RFCx_dlr values are for 3DS
520fe82ebb0SRobert Mustacchi  * RDIMMs.
521fe82ebb0SRobert Mustacchi  */
522fe82ebb0SRobert Mustacchi #define	SPD_KEY_TRFCSB		"dram.t~RFCsb~"
523fe82ebb0SRobert Mustacchi #define	SPD_KEY_TRFC1_DLR	"dram.3ds-t~RFC1_dlr~"
524fe82ebb0SRobert Mustacchi #define	SPD_KEY_TRFC2_DLR	"dram.3ds-t~RFC2_dlr~"
525fe82ebb0SRobert Mustacchi #define	SPD_KEY_TRFCSB_DLR	"dram.3ds-t~RFCsb_dlr~"
526fe82ebb0SRobert Mustacchi 
527fe82ebb0SRobert Mustacchi /*
5288119dad8SRobert Mustacchi  * The following times are only used by LPDDR3-5, but like other variable timing
5298119dad8SRobert Mustacchi  * entries, we still use the "dram" prefix. These are per-bank and all bank row
5308119dad8SRobert Mustacchi  * precharges and minimum refresh recovery times.
531fe82ebb0SRobert Mustacchi  */
5328119dad8SRobert Mustacchi #define	SPD_KEY_TRPAB_MIN	"dram.t~RPab~"
5338119dad8SRobert Mustacchi #define	SPD_KEY_TRPPB_MIN	"dram.t~RPpb~"
5348119dad8SRobert Mustacchi #define	SPD_KEY_TRFCAB_MIN	"dram.t~RFCab~"
5358119dad8SRobert Mustacchi #define	SPD_KEY_TRFCPB_MIN	"dram.t~RFCpb~"
5368119dad8SRobert Mustacchi 
5378119dad8SRobert Mustacchi /*
5388119dad8SRobert Mustacchi  * These refer to the maximum activate window and the maximum activate count. In
5398119dad8SRobert Mustacchi  * cases where the MAC is unknown no key will be present. This was present in
5408119dad8SRobert Mustacchi  * DDR and LPDDR 3 and 4. It is no longer present in DDR and LPDDR4 5 and
5418119dad8SRobert Mustacchi  * therefore will not be present for those.
5428119dad8SRobert Mustacchi  */
5438119dad8SRobert Mustacchi #define	SPD_KEY_MAW	"dram.maw"		/* uint32_t */
5448119dad8SRobert Mustacchi #define	SPD_KEY_MAC	"dram.mac"		/* uint32_t */
5458119dad8SRobert Mustacchi #define	SPD_KEY_MAC_UNLIMITED	UINT32_MAX
5468119dad8SRobert Mustacchi 
5478119dad8SRobert Mustacchi /*
5488119dad8SRobert Mustacchi  * LPDDR3/4/4X have specific latency sets. The following enum, stored as a u32
5498119dad8SRobert Mustacchi  * contains these options.
5508119dad8SRobert Mustacchi  */
5518119dad8SRobert Mustacchi typedef enum {
5528119dad8SRobert Mustacchi 	SPD_LP_RWLAT_WRITE_A	= 1 << 0,
5538119dad8SRobert Mustacchi 	SPD_LP_RWLAT_WRITE_B	= 1 << 1,
5548119dad8SRobert Mustacchi 	SPD_LP_RWLAT_DBIRD_EN	= 1 << 2
5558119dad8SRobert Mustacchi } spd_lp_rwlat_t;
5568119dad8SRobert Mustacchi #define	SPD_KEY_LP_RWLAT	"lp.read-write-latency"	/* uint32_t */
5578119dad8SRobert Mustacchi 
5588119dad8SRobert Mustacchi /*
5598119dad8SRobert Mustacchi  * Partial Automatic self-refresh (PASR) was introduced in DDR3 and continued in
5608119dad8SRobert Mustacchi  * DDR5. Automatic self-refresh (ASR) was only in DDR3. We treat it as a part of
5618119dad8SRobert Mustacchi  * the other DDR3 assorted features. The last DDR3 specific thing is the
5628119dad8SRobert Mustacchi  * extended temperature fresh rate.
5638119dad8SRobert Mustacchi  */
5648119dad8SRobert Mustacchi #define	SPD_KEY_DDR_PASR	"dram.pasr"		/* key */
5658119dad8SRobert Mustacchi typedef enum {
5668119dad8SRobert Mustacchi 	SPD_DDR3_FEAT_ASR	= 1 << 0,
5678119dad8SRobert Mustacchi 	SPD_DDR3_FEAT_DLL_OFF	= 1 << 1,
5688119dad8SRobert Mustacchi 	SPD_DDR3_FEAT_RZQ_7	= 1 << 2,
5698119dad8SRobert Mustacchi 	SPD_DDR3_FEAT_RZQ_6	= 1 << 3
5708119dad8SRobert Mustacchi } spd_ddr3_feat_t;
5718119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_FEAT	"ddr3.asr"		/* uint32_t */
5728119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_XTRR	"ddr3.xt-refresh-rate"	/* uint32_t */
573fe82ebb0SRobert Mustacchi 
574fe82ebb0SRobert Mustacchi /*
575fe82ebb0SRobert Mustacchi  * The following are DDR5 specific properties. BL32 indicates whether burst
576fe82ebb0SRobert Mustacchi  * length 32 mode is supported, which is a key. Along with the partial array
5778119dad8SRobert Mustacchi  * self refresh. The Duty Cycle Adjuster is an enumeration because there are
578fe82ebb0SRobert Mustacchi  * multiple modes. The wide temperature sensing is another DDR5 bit represented
579fe82ebb0SRobert Mustacchi  * as a key as well as an enum of fault handling.
580fe82ebb0SRobert Mustacchi  */
581fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_BL32	"ddr5.bl32"		/* key */
582fe82ebb0SRobert Mustacchi typedef enum {
583fe82ebb0SRobert Mustacchi 	SPD_DCA_UNSPPORTED,
584fe82ebb0SRobert Mustacchi 	SPD_DCA_1_OR_2_PHASE,
585fe82ebb0SRobert Mustacchi 	SPD_DCA_4_PHASE
586fe82ebb0SRobert Mustacchi } spd_dca_t;
587fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_DCA	"ddr5.dca"		/* uint32_t */
588fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_WIDE_TS	"ddr5.wide-temp-sense"	/* key */
589fe82ebb0SRobert Mustacchi typedef enum {
590fe82ebb0SRobert Mustacchi 	SPD_FLT_BOUNDED		= 1 << 0,
591fe82ebb0SRobert Mustacchi 	SPD_FLT_WRSUP_MR9	= 1 << 1,
592fe82ebb0SRobert Mustacchi 	SPD_FLT_WRSUP_MR15	= 1 << 2
593fe82ebb0SRobert Mustacchi } spd_fault_t;
594fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_FLT	"ddr5.fault-handling"	/* uint32_t */
595fe82ebb0SRobert Mustacchi 
596fe82ebb0SRobert Mustacchi /*
597fe82ebb0SRobert Mustacchi  * DDR5 allows for non-standard core timing options. This is indicated by a
598fe82ebb0SRobert Mustacchi  * single key that acts as a flag.
599fe82ebb0SRobert Mustacchi  */
600fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_NONSTD_TIME	"ddr5.non-standard-timing" /* key */
601fe82ebb0SRobert Mustacchi 
602fe82ebb0SRobert Mustacchi /*
603fe82ebb0SRobert Mustacchi  * DDR5 adds information about refresh management. This is split into
604fe82ebb0SRobert Mustacchi  * information about general refresh management and then optional adaptive
605fe82ebb0SRobert Mustacchi  * refresh management. There are three levels of adaptive refresh management
606fe82ebb0SRobert Mustacchi  * titled A, B, and C. Both the general refresh management and the adaptive
607fe82ebb0SRobert Mustacchi  * refresh management exist for both the primary and secondary types in
6088119dad8SRobert Mustacchi  * asymmetrical modules. Information about the RAAIMT and RAAMMT is only present
6098119dad8SRobert Mustacchi  * if refresh management is required. Similarly, BRC information is only present
6108119dad8SRobert Mustacchi  * if DRFM is supported. All values here are uint32_t's.
611fe82ebb0SRobert Mustacchi  */
612fe82ebb0SRobert Mustacchi typedef enum {
613fe82ebb0SRobert Mustacchi 	SPD_RFM_F_REQUIRED	= 1 << 0,
614fe82ebb0SRobert Mustacchi 	SPD_RFM_F_DRFM_SUP	= 1 << 1,
615fe82ebb0SRobert Mustacchi } spd_rfm_flags_t;
616fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_RFM_FLAGS_PRI	"ddr5.rfm.flags"
617fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_RFM_RAAIMT_PRI	"ddr5.rfm.raaimt"
618fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_RFM_RAAIMT_FGR_PRI	"ddr5.rfm.raaimt-fgr"
619fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_RFM_RAAMMT_PRI	"ddr5.rfm.raammt"
620fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_RFM_RAAMMT_FGR_PRI	"ddr5.rfm.raammt-fgr"
621fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_RFM_BRC_CFG_PRI	"ddr5.rfm.brc-config"
622fe82ebb0SRobert Mustacchi 
623fe82ebb0SRobert Mustacchi typedef enum {
624fe82ebb0SRobert Mustacchi 	SPD_BRC_F_LVL_2		= 1 << 0,
625fe82ebb0SRobert Mustacchi 	SPD_BRC_F_LVL_3		= 1 << 1,
626fe82ebb0SRobert Mustacchi 	SPD_BRC_F_LVL_4		= 1 << 2
627fe82ebb0SRobert Mustacchi } spd_brc_flags_t;
628fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_RFM_BRC_SUP_PRI	"ddr5.rfm.brc-level"
629fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_RFM_RAA_DEC_PRI	"ddr5.rfm.raa-dec"
630fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_RFM_FLAGS_SEC	"ddr5.rfm.sec-flags"
631fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_RFM_RAAIMT_SEC	"ddr5.rfm.sec-raaimt"
632fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_RFM_RAAIMT_FGR_SEC	"ddr5.rfm.sec-raaimt-fgr"
633fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_RFM_RAAMMT_SEC	"ddr5.rfm.sec-raammt"
634fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_RFM_RAAMMT_FGR_SEC	"ddr5.rfm.sec-raammt-fgr"
635fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_RFM_BRC_CFG_SEC	"ddr5.rfm.sec-brc-config"
636fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_RFM_BRC_SUP_SEC	"ddr5.rfm.sec-brc-level"
637fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_RFM_RAA_DEC_SEC	"ddr5.rfm.sec-raa-dec"
638fe82ebb0SRobert Mustacchi 
639fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMA_FLAGS_PRI		"ddr5.arfm-a.flags"
640fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMA_RAAIMT_PRI		"ddr5.arfm-a.raaimt"
641fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMA_RAAIMT_FGR_PRI	"ddr5.arfm-a.raaimt-fgr"
642fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMA_RAAMMT_PRI		"ddr5.arfm-a.raammt"
643fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMA_RAAMMT_FGR_PRI	"ddr5.arfm-a.raammt-fgr"
644fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMA_BRC_CFG_PRI		"ddr5.arfm-a.brc-config"
645fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMA_BRC_SUP_PRI		"ddr5.arfm-a.brc-level"
646fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMA_RAA_DEC_PRI		"ddr5.arfm-a.raa-dec"
647fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMA_FLAGS_SEC		"ddr5.arfm-a.sec-flags"
648fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMA_RAAIMT_SEC		"ddr5.arfm-a.sec-raaimt"
649fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMA_RAAIMT_FGR_SEC	"ddr5.arfm-a.sec-raaimt-fgr"
650fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMA_RAAMMT_SEC		"ddr5.arfm-a.sec-raammt"
651fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMA_RAAMMT_FGR_SEC	"ddr5.arfm-a.sec-raammt-fgr"
652fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMA_BRC_CFG_SEC		"ddr5.arfm-a.sec-brc-config"
653fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMA_BRC_SUP_SEC		"ddr5.arfm-a.sec-brc-level"
654fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMA_RAA_DEC_SEC		"ddr5.arfm-a.sec-raa-dec"
655fe82ebb0SRobert Mustacchi 
656fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMB_FLAGS_PRI		"ddr5.arfm-b.flags"
657fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMB_RAAIMT_PRI		"ddr5.arfm-b.raaimt"
658fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMB_RAAIMT_FGR_PRI	"ddr5.arfm-b.raaimt-fgr"
659fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMB_RAAMMT_PRI		"ddr5.arfm-b.raammt"
660fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMB_RAAMMT_FGR_PRI	"ddr5.arfm-b.raammt-fgr"
661fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMB_BRC_CFG_PRI		"ddr5.arfm-b.brc-config"
662fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMB_BRC_SUP_PRI		"ddr5.arfm-b.brc-level"
663fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMB_RAA_DEC_PRI		"ddr5.arfm-b.raa-dec"
664fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMB_FLAGS_SEC		"ddr5.arfm-b.sec-flags"
665fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMB_RAAIMT_SEC		"ddr5.arfm-b.sec-raaimt"
666fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMB_RAAIMT_FGR_SEC	"ddr5.arfm-b.sec-raaimt-fgr"
667fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMB_RAAMMT_SEC		"ddr5.arfm-b.sec-raammt"
668fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMB_RAAMMT_FGR_SEC	"ddr5.arfm-b.sec-raammt-fgr"
669fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMB_BRC_CFG_SEC		"ddr5.arfm-b.sec-brc-config"
670fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMB_BRC_SUP_SEC		"ddr5.arfm-b.sec-brc-level"
671fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMB_RAA_DEC_SEC		"ddr5.arfm-b.sec-raa-dec"
672fe82ebb0SRobert Mustacchi 
673fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMC_FLAGS_PRI		"ddr5.arfm-c.flags"
674fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMC_RAAIMT_PRI		"ddr5.arfm-c.raaimt"
675fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMC_RAAIMT_FGR_PRI	"ddr5.arfm-c.raaimt-fgr"
676fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMC_RAAMMT_PRI		"ddr5.arfm-c.raammt"
677fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMC_RAAMMT_FGR_PRI	"ddr5.arfm-c.raammt-fgr"
678fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMC_BRC_CFG_PRI		"ddr5.arfm-c.brc-config"
679fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMC_BRC_SUP_PRI		"ddr5.arfm-c.brc-level"
680fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMC_RAA_DEC_PRI		"ddr5.arfm-c.raa-dec"
681fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMC_FLAGS_SEC		"ddr5.arfm-c.sec-flags"
682fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMC_RAAIMT_SEC		"ddr5.arfm-c.sec-raaimt"
683fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMC_RAAIMT_FGR_SEC	"ddr5.arfm-c.sec-raaimt-fgr"
684fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMC_RAAMMT_SEC		"ddr5.arfm-c.sec-raammt"
685fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMC_RAAMMT_FGR_SEC	"ddr5.arfm-c.sec-raammt-fgr"
686fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMC_BRC_CFG_SEC		"ddr5.arfm-c.sec-brc-config"
687fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMC_BRC_SUP_SEC		"ddr5.arfm-c.sec-brc-level"
688fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR5_ARFMC_RAA_DEC_SEC		"ddr5.arfm-c.sec-raa-dec"
689fe82ebb0SRobert Mustacchi /*
690fe82ebb0SRobert Mustacchi  * Module-type specific keys and values. These are often the intersection of
691fe82ebb0SRobert Mustacchi  * both the DDR standard and the module type. That is, a DDR4 and DDR5 RDIMM
692fe82ebb0SRobert Mustacchi  * expose some information that isn't quite the same. These often contain things
693fe82ebb0SRobert Mustacchi  * that are drive strengths and slew rates. These kinds of items fall into two
694fe82ebb0SRobert Mustacchi  * categories. Ones where there is a fixed resistance and one where there is a
695fe82ebb0SRobert Mustacchi  * qualitative range that depends on things like the specific parts present.
696fe82ebb0SRobert Mustacchi  */
697fe82ebb0SRobert Mustacchi typedef enum {
698fe82ebb0SRobert Mustacchi 	SPD_DRIVE_LIGHT,
699fe82ebb0SRobert Mustacchi 	SPD_DRIVE_MODERATE,
700fe82ebb0SRobert Mustacchi 	SPD_DRIVE_STRONG,
7018119dad8SRobert Mustacchi 	SPD_DRIVE_VERY_STRONG,
7028119dad8SRobert Mustacchi 	SPD_DRIVE_WEAK
703fe82ebb0SRobert Mustacchi } spd_drive_t;
704fe82ebb0SRobert Mustacchi 
705fe82ebb0SRobert Mustacchi typedef enum {
706fe82ebb0SRobert Mustacchi 	SPD_SLEW_SLOW,
707fe82ebb0SRobert Mustacchi 	SPD_SLEW_MODERATE,
708fe82ebb0SRobert Mustacchi 	SPD_SLEW_FAST
709fe82ebb0SRobert Mustacchi } spd_slew_t;
710fe82ebb0SRobert Mustacchi 
711fe82ebb0SRobert Mustacchi /*
7128119dad8SRobert Mustacchi  * DDR4 RDIMM and LRDIMM drive strengths. These all use the spd_drive_t. These
7138119dad8SRobert Mustacchi  * are all on the RCD. There is also a key for whether or not slew-control is
7148119dad8SRobert Mustacchi  * supported.
7158119dad8SRobert Mustacchi  *
7168119dad8SRobert Mustacchi  * DDR3 has similar, but not identical drive strengths. Rather than trying to
7178119dad8SRobert Mustacchi  * combine them awkwardly, we just have a separate set of definitions. These may
7188119dad8SRobert Mustacchi  * be made more uniform in the future. In DDR3 the LRDIMM does not incorporate a
7198119dad8SRobert Mustacchi  * register like in DDR4, therefore the MB has overlapping drive strength keys.
720fe82ebb0SRobert Mustacchi  */
7218119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_RCD_DS_CAA	"ddr3.rcd.ca-a-drive-strength"
7228119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_RCD_DS_CAB	"ddr3.rcd.ca-b-drive-strength"
7238119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_RCD_DS_CTLA	"ddr3.rcd.cs-a-drive-strength"
7248119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_RCD_DS_CTLB	"ddr3.rcd.cs-b-drive-strength"
7258119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_RCD_DS_Y0	"ddr3.rcd.y0-drive-strength"
7268119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_RCD_DS_Y1	"ddr3.rcd.y1-drive-strength"
7278119dad8SRobert Mustacchi 
7288119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_DS_Y0	"ddr3.mb.y0-drive-strength"
7298119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_DS_Y1	"ddr3.mb.y1-drive-strength"
7308119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_DS_CKE	"ddr3.mb.cke-drive-strength"
7318119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_DS_ODT	"ddr3.mb.cke-drive-strength"
7328119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_DS_CS	"ddr3.mb.cs-drive-strength"
7338119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_DS_CA	"ddr3.mb.ca-drive-strength"
7348119dad8SRobert Mustacchi 
7358119dad8SRobert Mustacchi #define	SPD_KEY_DDR4_RCD_SLEW	"ddr4.rcd.rcd-slew-control"	/* key */
7368119dad8SRobert Mustacchi #define	SPD_KEY_DDR4_RCD_DS_CKE	"ddr4.rcd.cke-drive-strength"
7378119dad8SRobert Mustacchi #define	SPD_KEY_DDR4_RCD_DS_ODT	"ddr4.rcd.odt-drive-strength"
7388119dad8SRobert Mustacchi #define	SPD_KEY_DDR4_RCD_DS_CA	"ddr4.rcd.ca-drive-strength"
7398119dad8SRobert Mustacchi #define	SPD_KEY_DDR4_RCD_DS_CS	"ddr4.rcd.cs-drive-strength"
7408119dad8SRobert Mustacchi #define	SPD_KEY_DDR4_RCD_DS_Y0	"ddr4.rcd.y0-drive-strength"
7418119dad8SRobert Mustacchi #define	SPD_KEY_DDR4_RCD_DS_Y1	"ddr4.rcd.y1-drive-strength"
7428119dad8SRobert Mustacchi #define	SPD_KEY_DDR4_RCD_DS_BCOM	"ddr4.rcd.bcom-drive-strength"
7438119dad8SRobert Mustacchi #define	SPD_KEY_DDR4_RCD_DS_BCK	"ddr4.rcd.bck-drive-strength"
7448119dad8SRobert Mustacchi 
7458119dad8SRobert Mustacchi /*
7468119dad8SRobert Mustacchi  * DDR3 LRDIMMs have the ability to specify the orientation of the memory
7478119dad8SRobert Mustacchi  * buffer. These describe the physical orientation relative to the edge
7488119dad8SRobert Mustacchi  * connector.
7498119dad8SRobert Mustacchi  */
7508119dad8SRobert Mustacchi typedef enum {
7518119dad8SRobert Mustacchi 	SPD_ORNT_HORIZONTAL,
7528119dad8SRobert Mustacchi 	SPD_ORNT_VERTICAL
7538119dad8SRobert Mustacchi } spd_orientation_t;
7548119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_ORIENT	"ddr3.mb.orientation"		/* uint32_t */
7558119dad8SRobert Mustacchi 
7568119dad8SRobert Mustacchi /*
7578119dad8SRobert Mustacchi  * DDR3 LRDIMMs have various extended and additive clock delays for various
7588119dad8SRobert Mustacchi  * signals. The extended delay is x/128 * tCK while the additive delay is x/32 *
7598119dad8SRobert Mustacchi  * tCK. We store these all as uint32_t keys where the value is the value of x
7608119dad8SRobert Mustacchi  * above. If there is no delay or the delay is not enabled, then the key will
7618119dad8SRobert Mustacchi  * not exist.
7628119dad8SRobert Mustacchi  */
7638119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_EXTD_Y		"ddr4.mb.y-extended-delay"
7648119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_EXTD_CS		"ddr4.mb.cs-extended-delay"
7658119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_EXTD_ODT	"ddr4.mb.odt-extended-delay"
7668119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_EXTD_CKE	"ddr4.mb.cke-extended-delay"
7678119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_ADDD_Y		"ddr4.mb.y-additive-delay"
7688119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_ADDD_CS		"ddr4.mb.cs-additive-delay"
7698119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_ADDD_ODT	"ddr4.mb.odt-additive-delay"
7708119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_ADDD_CKE	"ddr4.mb.cke-additive-delay"
7718119dad8SRobert Mustacchi 
7728119dad8SRobert Mustacchi /*
7738119dad8SRobert Mustacchi  * DDR3 LRDIMMs have the ability to control whether or not QxODT[1:0] is
7748119dad8SRobert Mustacchi  * asserted during reads or writes on each rank. There is a value for each of
7758119dad8SRobert Mustacchi  * the three primary speed buckets in DDR3: 800/1066, 1333/1600, and
7768119dad8SRobert Mustacchi  * 1866/2133. This is organized as a series of boolean_t[3] entries where each
7778119dad8SRobert Mustacchi  * entry corresponds to one of the three speeds.
7788119dad8SRobert Mustacchi  */
7798119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R0_ODT0_RD	"ddr3.mb.r0-qxodt0-read-assert"
7808119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R0_ODT1_RD	"ddr3.mb.r0-qxodt1-read-assert"
7818119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R0_ODT0_WR	"ddr3.mb.r0-qxodt0-write-assert"
7828119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R0_ODT1_WR	"ddr3.mb.r0-qxodt1-write-assert"
7838119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R1_ODT0_RD	"ddr3.mb.r1-qxodt0-read-assert"
7848119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R1_ODT1_RD	"ddr3.mb.r1-qxodt1-read-assert"
7858119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R1_ODT0_WR	"ddr3.mb.r1-qxodt0-write-assert"
7868119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R1_ODT1_WR	"ddr3.mb.r1-qxodt1-write-assert"
7878119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R2_ODT0_RD	"ddr3.mb.r2-qxodt0-read-assert"
7888119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R2_ODT1_RD	"ddr3.mb.r2-qxodt1-read-assert"
7898119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R2_ODT0_WR	"ddr3.mb.r2-qxodt0-write-assert"
7908119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R2_ODT1_WR	"ddr3.mb.r2-qxodt1-write-assert"
7918119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R3_ODT0_RD	"ddr3.mb.r3-qxodt0-read-assert"
7928119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R3_ODT1_RD	"ddr3.mb.r3-qxodt1-read-assert"
7938119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R3_ODT0_WR	"ddr3.mb.r3-qxodt0-write-assert"
7948119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R3_ODT1_WR	"ddr3.mb.r3-qxodt1-write-assert"
7958119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R4_ODT0_RD	"ddr3.mb.r4-qxodt0-read-assert"
7968119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R4_ODT1_RD	"ddr3.mb.r4-qxodt1-read-assert"
7978119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R4_ODT0_WR	"ddr3.mb.r4-qxodt0-write-assert"
7988119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R4_ODT1_WR	"ddr3.mb.r4-qxodt1-write-assert"
7998119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R5_ODT0_RD	"ddr3.mb.r5-qxodt0-read-assert"
8008119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R5_ODT1_RD	"ddr3.mb.r5-qxodt1-read-assert"
8018119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R5_ODT0_WR	"ddr3.mb.r5-qxodt0-write-assert"
8028119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R5_ODT1_WR	"ddr3.mb.r5-qxodt1-write-assert"
8038119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R6_ODT0_RD	"ddr3.mb.r6-qxodt0-read-assert"
8048119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R6_ODT1_RD	"ddr3.mb.r6-qxodt1-read-assert"
8058119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R6_ODT0_WR	"ddr3.mb.r6-qxodt0-write-assert"
8068119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R6_ODT1_WR	"ddr3.mb.r6-qxodt1-write-assert"
8078119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R7_ODT0_RD	"ddr3.mb.r7-qxodt0-read-assert"
8088119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R7_ODT1_RD	"ddr3.mb.r7-qxodt1-read-assert"
8098119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R7_ODT0_WR	"ddr3.mb.r7-qxodt0-write-assert"
8108119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_R7_ODT1_WR	"ddr3.mb.r7-qxodt1-write-assert"
811fe82ebb0SRobert Mustacchi 
812fe82ebb0SRobert Mustacchi /*
813fe82ebb0SRobert Mustacchi  * DDR4 LRDIMMs specify the VrefDQ for each package rank. These are communicated
814fe82ebb0SRobert Mustacchi  * in terms of the DDR4 spec which specifies them as a percentage of the actual
815fe82ebb0SRobert Mustacchi  * voltage. This is always phrased in the spec as AB.CD%, so for example 60.25%.
816fe82ebb0SRobert Mustacchi  * We treat this percentage as a four digit unsigned value rather than trying to
817fe82ebb0SRobert Mustacchi  * play games with whether or not the value can be represented in floating
818fe82ebb0SRobert Mustacchi  * point. Divide the value by 100 to get the percentage. That is, 47.60% will be
819fe82ebb0SRobert Mustacchi  * encoded as 4760. All of these values are a uint32_t.
820fe82ebb0SRobert Mustacchi  */
821fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR4_VREFDQ_R0	"ddr4.lrdimm.VrefDQ-rank0"
822fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR4_VREFDQ_R1	"ddr4.lrdimm.VrefDQ-rank1"
823fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR4_VREFDQ_R2	"ddr4.lrdimm.VrefDQ-rank2"
824fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR4_VREFDQ_R3	"ddr4.lrdimm.VrefDQ-rank3"
825fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR4_VREFDQ_DB	"ddr4.lrdimm.VrefDQ-db"
826fe82ebb0SRobert Mustacchi 
827fe82ebb0SRobert Mustacchi /*
828fe82ebb0SRobert Mustacchi  * DDR4 LRDIMMs define the data buffer drive strength and termination in terms
829fe82ebb0SRobert Mustacchi  * of various data rate ranges. Specifically (0, 1866], (1866, 2400], and (2400,
830fe82ebb0SRobert Mustacchi  * 3200]. All of these values are measured in terms of Ohms. As such, all of
831fe82ebb0SRobert Mustacchi  * these values are an array of three uint32_t's whose values correspond to each
832fe82ebb0SRobert Mustacchi  * of those ranges. We define a few additional values for these to represent
833fe82ebb0SRobert Mustacchi  * cases where they are disabled or high-impedance.
8348119dad8SRobert Mustacchi  *
8358119dad8SRobert Mustacchi  * DDR3 LRDIMMs are similar, but their groups are 800/1066, 1333/1600, and
8368119dad8SRobert Mustacchi  * 1866/2133.
837fe82ebb0SRobert Mustacchi  */
8388119dad8SRobert Mustacchi #define	SPD_TERM_DISABLED	0
8398119dad8SRobert Mustacchi #define	SPD_TERM_HIZ		UINT32_MAX
840fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR4_MDQ_RTT	"ddr4.lrdimm.mdq-read-termination"
841fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR4_MDQ_DS	"ddr4.lrdimm.mdq-drive-strength"
842fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR4_DRAM_DS	"ddr4.lrdimm.dram-drive-strength"
843fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR4_RTT_WR	"ddr4.lrdimm.odt-read-termination-wr"
844fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR4_RTT_NOM	"ddr4.lrdimm.odt-read-termination-nom"
845fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR4_RTT_PARK_R0	"ddr4.lrdimm.odt-r0_1-rtt-park"
846fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR4_RTT_PARK_R2	"ddr4.lrdimm.odt-r2_3-rtt-park"
847fe82ebb0SRobert Mustacchi 
8488119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MDQ_DS	"ddr3.lrdimm.mdq-drive-strength"
8498119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MDQ_ODT	"ddr3.lrdimm.mdq-odt-strength"
8508119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_RTT_WRT	"ddr3.lrdimm.mdq-odt-read-termination-wr"
8518119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_RTT_NOM	"ddr3.lrdimm.mdq-odt-read-termination-nom"
8528119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_DRAM_DS	"ddr3.lrdimm.dram-drive-strength"
8538119dad8SRobert Mustacchi 
8548119dad8SRobert Mustacchi /*
8558119dad8SRobert Mustacchi  * DDR3 LRDIMMs specify a minimum and maximum delay for the various supported
8568119dad8SRobert Mustacchi  * voltage types. These are stored as two uint64_t[3] arrays ordered as 1.25,
8578119dad8SRobert Mustacchi  * 1.35, and 1.5V. These are times in ps.
8588119dad8SRobert Mustacchi  */
8598119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MOD_MIN_DELAY	"ddr3.lrdimm.minimum-module-delay"
8608119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MOD_MAX_DELAY	"ddr3.lrdimm.maximum-module-delay"
8618119dad8SRobert Mustacchi 
8628119dad8SRobert Mustacchi /*
8638119dad8SRobert Mustacchi  * DDR3 LRDIMMs also have personality bytes that are loaded directly into the
8648119dad8SRobert Mustacchi  * memory buffer control words. We pass these through as a uint8_t[15].
8658119dad8SRobert Mustacchi  */
8668119dad8SRobert Mustacchi #define	SPD_KEY_DDR3_MB_PERS	"ddr3.lrdimm.personality"
8678119dad8SRobert Mustacchi 
868fe82ebb0SRobert Mustacchi /*
869fe82ebb0SRobert Mustacchi  * The last DDR4 LRDIMM specific component is whether or not the data buffer's
870fe82ebb0SRobert Mustacchi  * gain and decision feedback equalization are supported. These both are keys.
871fe82ebb0SRobert Mustacchi  */
872fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR4_DB_GAIN	"ddr4.lrdimm.db-gain-adjustment"
873fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR4_DB_DFE	"ddr4.lrdimm.decision-feedback-eq"
874fe82ebb0SRobert Mustacchi 
875fe82ebb0SRobert Mustacchi /*
876fe82ebb0SRobert Mustacchi  * DDR5 RDIMMs and LRDIMMs have specific enables for groups of pins. There are
8778119dad8SRobert Mustacchi  * then drive strength values which are encoded as a spd_drive_t. Note, prior to
8788119dad8SRobert Mustacchi  * DDR5 RDIMMs v1.1, these were differential impedance values measured in Ohms.
8798119dad8SRobert Mustacchi  * These have been normalized to the general drive strength enums. Separately
8808119dad8SRobert Mustacchi  * there are slew rates, those use the spd_slew_t. Because these use different
8818119dad8SRobert Mustacchi  * units between DDR4 and DDR5, we treat them as different keys.
882fe82ebb0SRobert Mustacchi  */
8838119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_RCD_QACK_EN	"ddr5.rcd.qack-enabled"
8848119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_RCD_QBCK_EN	"ddr5.rcd.qbck-enabled"
8858119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_RCD_QCCK_EN	"ddr5.rcd.qcck-enabled"
8868119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_RCD_QDCK_EN	"ddr5.rcd.qdck-enabled"
8878119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_RCD_BCK_EN		"ddr5.rcd.bck-enabled"
8888119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_RCD_QACA_EN	"ddr5.rcd.qaca-enabled"
8898119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_RCD_QBCA_EN	"ddr5.rcd.qbca-enabled"
8908119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_RCD_QxCS_EN	"ddr5.rcd.qxcs-enabled"
8918119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_RCD_QxCA13_EN	"ddr5.rcd.qxca13-enabled"
8928119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_RCD_QACS_EN	"ddr5.rcd.qacs-enabled"
8938119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_RCD_QBCS_EN	"ddr5.rcd.qbcs-enabled"
894fe82ebb0SRobert Mustacchi 
8958119dad8SRobert Mustacchi /* Drive strengths use the spd_drive_t encoded as a uint32_t */
8968119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_RCD_QACK_DS	"ddr5.rcd.qack-drive-strength"
8978119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_RCD_QBCK_DS	"ddr5.rcd.qbck-drive-strength"
8988119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_RCD_QCCK_DS	"ddr5.rcd.qcck-drive-strength"
8998119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_RCD_QDCK_DS	"ddr5.rcd.qdck-drive-strength"
9008119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_RCD_QxCS_DS	"ddr5.rcd.qxcs-drive-strength"
9018119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_RCD_CA_DS		"ddr5.rcd.ca-drive-strength"
902fe82ebb0SRobert Mustacchi 
903fe82ebb0SRobert Mustacchi /* Slew rates use the spd_rate_t encoded as a uint32_t */
9048119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_RCD_QCK_SLEW	"ddr5.rcd.qck-slew"
9058119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_RCD_QCA_SLEW	"ddr5.rcd.qca-slew"
9068119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_RCD_QCS_SLEW	"ddr5.rcd.qcs-slew"
907fe82ebb0SRobert Mustacchi 
908fe82ebb0SRobert Mustacchi /*
9098119dad8SRobert Mustacchi  * These are all specific to DDR5 LRDIMMs. The values are the same as above. The
9108119dad8SRobert Mustacchi  * RTT value is a value in Ohms. If RTT termination is disabled then the key
9118119dad8SRobert Mustacchi  * will not be present.
912fe82ebb0SRobert Mustacchi  */
9138119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_RCD_BCS_EN		"ddr5.rcd.bcs-enabled" /* key */
9148119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_RCD_BCOM_DS	"ddr5.rcd.bcom-drive-strength"
9158119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_RCD_BCK_DS		"ddr5.rcd.bck-drive-strength"
9168119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_RCD_RTT_TERM	"ddr5.rcd.dqs-rtt"
9178119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_RCD_BCOM_SLEW	"ddr5.rcd.bcom-slew"
9188119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_RCD_BCK_SLEW	"ddr5.rcd.bck-slew"
919fe82ebb0SRobert Mustacchi 
9208119dad8SRobert Mustacchi /*
9218119dad8SRobert Mustacchi  * DDR5 UDIMM specific values. Note, these are only present in UDIMM v1.1 and
9228119dad8SRobert Mustacchi  * therefore may be missing in older revisions.
9238119dad8SRobert Mustacchi  */
9248119dad8SRobert Mustacchi 
9258119dad8SRobert Mustacchi /*
9268119dad8SRobert Mustacchi  * Unbuffered clock configuration, drivers, and slew rates. The various -enabled
9278119dad8SRobert Mustacchi  * values are keys. The drive strengths and slew rates use the spd_drive_t and
9288119dad8SRobert Mustacchi  * spd_slew_t respectively encoded as uint32_t values.
9298119dad8SRobert Mustacchi  */
9308119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_CKD_CHAQCK0_EN	"ddr5.ckd.cha-qck0_A-enabled"
9318119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_CKD_CHAQCK1_EN	"ddr5.ckd.cha-qck1_A-enabled"
9328119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_CKD_CHBQCK0_EN	"ddr5.ckd.chb-qck0_B-enabled"
9338119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_CKD_CHBQCK1_EN	"ddr5.ckd.chb-qck1_B-enabled"
9348119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_CKD_CHAQCK0_DS	"ddr5.ckd.cha-qck0_A-drive-strength"
9358119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_CKD_CHAQCK1_DS	"ddr5.ckd.cha-qck1_A-drive-strength"
9368119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_CKD_CHBQCK0_DS	"ddr5.ckd.chb-qck0_B-drive-strength"
9378119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_CKD_CHBQCK1_DS	"ddr5.ckd.chb-qck1_B-drive-strength"
9388119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_CKD_CHAQCK_SLEW	"ddr5.ckd.cha-qck_slew"
9398119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_CKD_CHBQCK_SLEW	"ddr5.ckd.chb-qck_slew"
9408119dad8SRobert Mustacchi 
9418119dad8SRobert Mustacchi /*
9428119dad8SRobert Mustacchi  * DDR5 MRDIMM specific values. Note, these are only present in MRDIMM v1.1 and
9438119dad8SRobert Mustacchi  * therefore may be missing in older revisions. While these values are really
9448119dad8SRobert Mustacchi  * similar to the RDIMM variants, because they are taken from the MRCD instead
9458119dad8SRobert Mustacchi  * of the RCD specification, we define different keys.
9468119dad8SRobert Mustacchi  */
9478119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_MRCD_QACK_EN	"ddr5.mrcd.qack-enabled"
9488119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_MRCD_QBCK_EN	"ddr5.mrcd.qbck-enabled"
9498119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_MRCD_QCCK_EN	"ddr5.mrcd.qcck-enabled"
9508119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_MRCD_QDCK_EN	"ddr5.mrcd.qdck-enabled"
9518119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_MRCD_BCK_EN	"ddr5.mrcd.bck-enabled"
9528119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_MRCD_QACA_EN	"ddr5.mrcd.qaca-enabled"
9538119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_MRCD_QBCA_EN	"ddr5.mrcd.qbca-enabled"
9548119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_MRCD_BCS_EN	"ddr5.mrcd.bcs-enabled"
9558119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_MRCD_QxCS_EN	"ddr5.mrcd.qxcs-enabled"
9568119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_MRCD_QxCA13_EN	"ddr5.mrcd.qxca13-enabled"
9578119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_MRCD_QACS_EN	"ddr5.mrcd.qacs-enabled"
9588119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_MRCD_QBCS_EN	"ddr5.mrcd.qbcs-enabled"
9598119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_MRCD_DCS1_EN	"ddr5.mrcd.dcs1-enabled"
9608119dad8SRobert Mustacchi 
9618119dad8SRobert Mustacchi /* Drive strengths use the spd_drive_t encoded as a uint32_t */
9628119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_MRCD_QACK_DS	"ddr5.mrcd.qack-drive-strength"
9638119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_MRCD_QBCK_DS	"ddr5.mrcd.qbck-drive-strength"
9648119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_MRCD_QCCK_DS	"ddr5.mrcd.qcck-drive-strength"
9658119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_MRCD_QDCK_DS	"ddr5.mrcd.qdck-drive-strength"
9668119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_MRCD_QxCS_DS	"ddr5.mrcd.qxcs-drive-strength"
9678119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_MRCD_CA_DS		"ddr5.mrcd.ca-drive-strength"
9688119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_MRCD_BCOM_DS	"ddr5.mrcd.bcom-drive-strength"
9698119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_MRCD_BCK_DS	"ddr5.mrcd.bck-drive-strength"
9708119dad8SRobert Mustacchi 
9718119dad8SRobert Mustacchi /* Slew rates use the spd_rate_t encoded as a uint32_t */
9728119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_MRCD_QCK_SLEW	"ddr5.mrcd.qck-slew"
9738119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_MRCD_QCA_SLEW	"ddr5.mrcd.qca-slew"
9748119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_MRCD_QCS_SLEW	"ddr5.mrcd.qcs-slew"
9758119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_MRCD_BCOM_SLEW	"ddr5.mrcd.bcom-slew"
9768119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_MRCD_BCK_SLEW	"ddr5.mrcd.bck-slew"
9778119dad8SRobert Mustacchi 
9788119dad8SRobert Mustacchi typedef enum {
9798119dad8SRobert Mustacchi 	SPD_MRCD_OUT_NORMAL,
9808119dad8SRobert Mustacchi 	SPD_MRCD_OUT_DISABLED,
9818119dad8SRobert Mustacchi 	SPD_MRCD_OUT_LOW
9828119dad8SRobert Mustacchi } spd_mrcd_output_ctrl_t;
9838119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_MRCD_QxCS_OUT	"ddr5.mrcd.qxcs-output-control"
9848119dad8SRobert Mustacchi 
9858119dad8SRobert Mustacchi typedef enum {
9868119dad8SRobert Mustacchi 	SPD_MRCD_DCA_CFG_0,
9878119dad8SRobert Mustacchi 	SPD_MRCD_DCA_CFG_1
9888119dad8SRobert Mustacchi } spd_mrcd_dca_cfg_t;
9898119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_MRCD_DCA_CFG	"ddr5.mrcd.dca-configuration"
9908119dad8SRobert Mustacchi 
9918119dad8SRobert Mustacchi typedef enum {
9928119dad8SRobert Mustacchi 	SPD_MRDIMM_IRXT_UNMATCHED,
9938119dad8SRobert Mustacchi 	SPD_MRDIMM_IRXT_MATCHED
9948119dad8SRobert Mustacchi } spd_mrdimm_irxt_t;
9958119dad8SRobert Mustacchi #define	SPD_KEY_DDR5_MRDIMM_IRXT	"ddr5.mrdimm.interface-rx-type"
996fe82ebb0SRobert Mustacchi 
997fe82ebb0SRobert Mustacchi /*
998fe82ebb0SRobert Mustacchi  * Module Properties. These are items that generally relate to the module as a
999fe82ebb0SRobert Mustacchi  * whole.
1000fe82ebb0SRobert Mustacchi  */
1001fe82ebb0SRobert Mustacchi 
1002fe82ebb0SRobert Mustacchi /*
1003fe82ebb0SRobert Mustacchi  * Connection Mapping. In DDR4 there is the ability to remap groups of pins from
1004fe82ebb0SRobert Mustacchi  * the connector to the various package SDRAMs. Every 4 bits can be remapped to
1005fe82ebb0SRobert Mustacchi  * either another upper or lower nibble in a package. Separately bits can also
1006fe82ebb0SRobert Mustacchi  * be flipped between packages. These exist for all 64-bits of DQ and 8 bits of
1007fe82ebb0SRobert Mustacchi  * CBs. If mirroring is set, then a key will be added for that pin group. For
1008fe82ebb0SRobert Mustacchi  * each pin group, the mapping to a specific type of rewriting will be done. We
1009fe82ebb0SRobert Mustacchi  * conventionally use 0, 1, 2, and 3 as the lower nibble and 4, 5, 6, 7 as the
1010fe82ebb0SRobert Mustacchi  * upper nibble, though the actual pins will vary based on where they are.
1011fe82ebb0SRobert Mustacchi  */
1012fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR4_MAP_DQ0	"module.dq0-map"	/* uint32_t [4] */
1013fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR4_MAP_DQ4	"module.dq4-map"	/* uint32_t [4] */
1014fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR4_MAP_DQ8	"module.dq8-map"	/* uint32_t [4] */
1015fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR4_MAP_DQ12	"module.dq12-map"	/* uint32_t [4] */
1016fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR4_MAP_DQ16	"module.dq16-map"	/* uint32_t [4] */
1017fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR4_MAP_DQ20	"module.dq20-map"	/* uint32_t [4] */
1018fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR4_MAP_DQ24	"module.dq24-map"	/* uint32_t [4] */
1019fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR4_MAP_DQ28	"module.dq28-map"	/* uint32_t [4] */
1020fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR4_MAP_DQ32	"module.dq32-map"	/* uint32_t [4] */
1021fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR4_MAP_DQ36	"module.dq36-map"	/* uint36_t [4] */
1022fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR4_MAP_DQ40	"module.dq40-map"	/* uint32_t [4] */
1023fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR4_MAP_DQ44	"module.dq44-map"	/* uint32_t [4] */
1024fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR4_MAP_DQ48	"module.dq48-map"	/* uint32_t [4] */
1025fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR4_MAP_DQ52	"module.dq52-map"	/* uint32_t [4] */
1026fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR4_MAP_DQ56	"module.dq56-map"	/* uint32_t [4] */
1027fe82ebb0SRobert Mustacchi #define	SPD_KEY_DDR4_MAP_DQ60	"module.dq60-map"	/* uint32_t [4] */
10288119dad8SRobert Mustacchi #define	SPD_KEY_DDR4_MAP_CB0	"module.cb0-map"	/* uint32_t [4] */
10298119dad8SRobert Mustacchi #define	SPD_KEY_DDR4_MAP_CB4	"module.cb4-map"	/* uint32_t [4] */
1030fe82ebb0SRobert Mustacchi 
1031fe82ebb0SRobert Mustacchi /*
10328119dad8SRobert Mustacchi  * In addition, there is module level mapping in DDR3/DDR4 that is used to
10338119dad8SRobert Mustacchi  * indicate that odd ranks are mirrored. This is between the edge connector and
10348119dad8SRobert Mustacchi  * the DRAM itself. We only add a key when it is mirrored.
1035fe82ebb0SRobert Mustacchi  */
10368119dad8SRobert Mustacchi #define	SPD_KEY_MOD_EDGE_MIRROR	"module.edge-odd-mirror"	/* key */
1037fe82ebb0SRobert Mustacchi 
1038fe82ebb0SRobert Mustacchi /*
1039fe82ebb0SRobert Mustacchi  * Present devices. Modules often have multiple additional types of devices
1040fe82ebb0SRobert Mustacchi  * present like temperature sensors, voltage regulators, registers, etc. The
1041fe82ebb0SRobert Mustacchi  * following key indicates what all is present on this DIMM. Depending on the
1042fe82ebb0SRobert Mustacchi  * DDR revision, we will then have additional keys with its ID, revision, name,
1043fe82ebb0SRobert Mustacchi  * and compliant type. In a few cases we will define the type and presence based
1044fe82ebb0SRobert Mustacchi  * on information. For example, DDR4 only allows a single type of temperature
1045fe82ebb0SRobert Mustacchi  * sensor or SPD device. Even though we don't know the manufacturer, we will
1046fe82ebb0SRobert Mustacchi  * still note this.
1047fe82ebb0SRobert Mustacchi  *
1048fe82ebb0SRobert Mustacchi  * Each of these items will have four keys. One for the manufacturer ID, one for
1049fe82ebb0SRobert Mustacchi  * their string name, one for the device type, and one for the revision. Note,
1050fe82ebb0SRobert Mustacchi  * while TS1 and TS2 are both flags in DDR5, they share common manufacturer
1051fe82ebb0SRobert Mustacchi  * information, which is why there is only one entry here.
1052fe82ebb0SRobert Mustacchi  *
1053fe82ebb0SRobert Mustacchi  * For each device type there is a separate enum with supported types of devices
1054fe82ebb0SRobert Mustacchi  * that can be present for these.
1055fe82ebb0SRobert Mustacchi  */
1056fe82ebb0SRobert Mustacchi typedef enum {
1057fe82ebb0SRobert Mustacchi 	SPD_DEVICE_TEMP_1	= 1 << 0,
1058fe82ebb0SRobert Mustacchi 	SPD_DEVICE_TEMP_2	= 1 << 1,
1059fe82ebb0SRobert Mustacchi 	SPD_DEVICE_HS		= 1 << 2,
1060fe82ebb0SRobert Mustacchi 	SPD_DEVICE_PMIC_0	= 1 << 3,
1061fe82ebb0SRobert Mustacchi 	SPD_DEVICE_PMIC_1	= 1 << 4,
1062fe82ebb0SRobert Mustacchi 	SPD_DEVICE_PMIC_2	= 1 << 5,
10638119dad8SRobert Mustacchi 	SPD_DEVICE_CD_0		= 1 << 6,
10648119dad8SRobert Mustacchi 	SPD_DEVICE_CD_1		= 1 << 7,
10658119dad8SRobert Mustacchi 	SPD_DEVICE_RCD		= 1 << 8,
10668119dad8SRobert Mustacchi 	SPD_DEVICE_DB		= 1 << 9,
10678119dad8SRobert Mustacchi 	SPD_DEVICE_MRCD		= 1 << 10,
10688119dad8SRobert Mustacchi 	SPD_DEVICE_MDB		= 1 << 11,
10698119dad8SRobert Mustacchi 	SPD_DEVICE_DMB		= 1 << 12,
10708119dad8SRobert Mustacchi 	SPD_DEVICE_SPD		= 1 << 13
1071fe82ebb0SRobert Mustacchi } spd_device_t;
1072fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEVS		"module.devices"	/* uint32_t */
1073fe82ebb0SRobert Mustacchi 
1074fe82ebb0SRobert Mustacchi typedef enum {
1075fe82ebb0SRobert Mustacchi 	/* DDR3 */
1076fe82ebb0SRobert Mustacchi 	SPD_TEMP_T_TSE2002,
1077fe82ebb0SRobert Mustacchi 	/* DDR4 and LPDDR4 */
1078fe82ebb0SRobert Mustacchi 	SPD_TEMP_T_TSE2004av,
1079fe82ebb0SRobert Mustacchi 	/* DDR5 */
1080fe82ebb0SRobert Mustacchi 	SPD_TEMP_T_TS5111,
10818119dad8SRobert Mustacchi 	SPD_TEMP_T_TS5110,
10828119dad8SRobert Mustacchi 	SPD_TEMP_T_TS5211,
10838119dad8SRobert Mustacchi 	SPD_TEMP_T_TS5210
1084fe82ebb0SRobert Mustacchi } spd_temp_type_t;
1085fe82ebb0SRobert Mustacchi 
1086fe82ebb0SRobert Mustacchi typedef enum {
1087fe82ebb0SRobert Mustacchi 	/* DDR5 */
1088fe82ebb0SRobert Mustacchi 	SPD_PMIC_T_PMIC5000,
1089fe82ebb0SRobert Mustacchi 	SPD_PMIC_T_PMIC5010,
10908119dad8SRobert Mustacchi 	SPD_PMIC_T_PMIC5100,
10918119dad8SRobert Mustacchi 	SPD_PMIC_T_PMIC5020,
10928119dad8SRobert Mustacchi 	SPD_PMIC_T_PMIC5120,
10938119dad8SRobert Mustacchi 	SPD_PMIC_T_PMIC5200,
10948119dad8SRobert Mustacchi 	SPD_PMIC_T_PMIC5030
1095fe82ebb0SRobert Mustacchi } spd_pmic_type_t;
1096fe82ebb0SRobert Mustacchi 
1097fe82ebb0SRobert Mustacchi typedef enum {
1098fe82ebb0SRobert Mustacchi 	/* DDR5 */
1099fe82ebb0SRobert Mustacchi 	SPD_CD_T_DDR5CK01
1100fe82ebb0SRobert Mustacchi } spd_cd_type_t;
1101fe82ebb0SRobert Mustacchi 
1102fe82ebb0SRobert Mustacchi typedef enum {
1103fe82ebb0SRobert Mustacchi 	/* DDR3 */
1104fe82ebb0SRobert Mustacchi 	SPD_RCD_T_SSTE32882,
1105fe82ebb0SRobert Mustacchi 	/* DDR4 */
1106fe82ebb0SRobert Mustacchi 	SPD_RCD_T_DDR4RCD01,
1107fe82ebb0SRobert Mustacchi 	SPD_RCD_T_DDR4RCD02,
1108fe82ebb0SRobert Mustacchi 	/* DDR5 */
1109fe82ebb0SRobert Mustacchi 	SPD_RCD_T_DDR5RCD01,
1110fe82ebb0SRobert Mustacchi 	SPD_RCD_T_DDR5RCD02,
11118119dad8SRobert Mustacchi 	SPD_RCD_T_DDR5RCD03,
11128119dad8SRobert Mustacchi 	SPD_RCD_T_DDR5RCD04,
11138119dad8SRobert Mustacchi 	SPD_RCD_T_DDR5RCD05
1114fe82ebb0SRobert Mustacchi } spd_rcd_type_t;
1115fe82ebb0SRobert Mustacchi 
1116fe82ebb0SRobert Mustacchi typedef enum {
1117fe82ebb0SRobert Mustacchi 	/* DDR4 */
1118fe82ebb0SRobert Mustacchi 	SPD_DB_T_DDR4DB01,
1119fe82ebb0SRobert Mustacchi 	SPD_DB_T_DDR4DB02,
1120fe82ebb0SRobert Mustacchi 	/* DDR5 */
1121fe82ebb0SRobert Mustacchi 	SPD_DB_T_DDR5DB01,
11228119dad8SRobert Mustacchi 	SPD_DB_T_DDR5DB02,
11238119dad8SRobert Mustacchi 	/*
11248119dad8SRobert Mustacchi 	 * DDR3 LRDIMMs had a memory buffer that did not have a full
11258119dad8SRobert Mustacchi 	 * desgination. We count them here.
11268119dad8SRobert Mustacchi 	 */
11278119dad8SRobert Mustacchi 	SPD_DB_T_DDR3MB
1128fe82ebb0SRobert Mustacchi } spd_db_type_t;
1129fe82ebb0SRobert Mustacchi 
1130fe82ebb0SRobert Mustacchi typedef enum {
1131fe82ebb0SRobert Mustacchi 	/* DDR5 */
11328119dad8SRobert Mustacchi 	SPD_MRCD_T_DDR5MRCD01,
11338119dad8SRobert Mustacchi 	SPD_MRCD_T_DDR5MRCD02,
1134fe82ebb0SRobert Mustacchi } spd_mrcd_type_t;
1135fe82ebb0SRobert Mustacchi 
1136fe82ebb0SRobert Mustacchi typedef enum {
1137fe82ebb0SRobert Mustacchi 	/* DDR5 */
11388119dad8SRobert Mustacchi 	SPD_MDB_T_DDR5MDB01,
11398119dad8SRobert Mustacchi 	SPD_MDB_T_DDR5MDB02
1140fe82ebb0SRobert Mustacchi } spd_mdb_type_t;
1141fe82ebb0SRobert Mustacchi 
1142fe82ebb0SRobert Mustacchi typedef enum {
1143fe82ebb0SRobert Mustacchi 	/* DDR5 */
1144fe82ebb0SRobert Mustacchi 	SPD_DMB_T_DMB5011
1145fe82ebb0SRobert Mustacchi } spd_dmb_type_t;
1146fe82ebb0SRobert Mustacchi 
1147fe82ebb0SRobert Mustacchi typedef enum {
1148fe82ebb0SRobert Mustacchi 	/* DDR4 */
1149fe82ebb0SRobert Mustacchi 	SPD_SPD_T_EE1004,
1150fe82ebb0SRobert Mustacchi 	/* DDR5 */
1151fe82ebb0SRobert Mustacchi 	SPD_SPD_T_SPD5118,
11528119dad8SRobert Mustacchi 	SPD_SPD_T_ESPD5216,
11538119dad8SRobert Mustacchi 	/* DDR3 */
11548119dad8SRobert Mustacchi 	SPD_SPD_T_EE1002
1155fe82ebb0SRobert Mustacchi } spd_spd_type_t;
1156fe82ebb0SRobert Mustacchi 
1157fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_TEMP_MFG	"module.temp.mfg-id"	/* uint32_t [2] */
1158fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_TEMP_MFG_NAME	"module.temp.mfg-name"	/* string */
1159fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_TEMP_TYPE	"module.temp.type"	/* uint32_t */
1160fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_TEMP_REV	"module.temp.revision"	/* string */
1161fe82ebb0SRobert Mustacchi 
1162fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_PMIC0_MFG	"module.pmic0.mfg-id"	/* uint32_t [2] */
1163fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_PMIC0_MFG_NAME	"module.pmic0.mfg-name"	/* string */
1164fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_PMIC0_TYPE	"module.pmic0.type"	/* uint32_t */
1165fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_PMIC0_REV	"module.pmic0.revision"	/* string */
1166fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_PMIC1_MFG	"module.pmic1.mfg-id"	/* uint32_t [2] */
1167fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_PMIC1_MFG_NAME	"module.pmic1.mfg-name"	/* string */
1168fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_PMIC1_TYPE	"module.pmic1.type"	/* uint32_t */
1169fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_PMIC1_REV	"module.pmic1.revision"	/* string */
1170fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_PMIC2_MFG	"module.pmic2.mfg-id"	/* uint32_t [2] */
1171fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_PMIC2_MFG_NAME	"module.pmic2.mfg-name"	/* string */
1172fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_PMIC2_TYPE	"module.pmic2.type"	/* uint32_t */
1173fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_PMIC2_REV	"module.pmic2.revision"	/* string */
1174fe82ebb0SRobert Mustacchi 
11758119dad8SRobert Mustacchi #define	SPD_KEY_DEV_CD0_MFG	"module.cd0.mfg-id"	/* uint32_t [2] */
11768119dad8SRobert Mustacchi #define	SPD_KEY_DEV_CD0_MFG_NAME	"module.cd0.mfg-name"	/* string */
11778119dad8SRobert Mustacchi #define	SPD_KEY_DEV_CD0_TYPE	"module.cd0.type"	/* uint32_t */
11788119dad8SRobert Mustacchi #define	SPD_KEY_DEV_CD0_REV	"module.cd0.revision"	/* string */
11798119dad8SRobert Mustacchi #define	SPD_KEY_DEV_CD1_MFG	"module.cd1.mfg-id"	/* uint32_t [2] */
11808119dad8SRobert Mustacchi #define	SPD_KEY_DEV_CD1_MFG_NAME	"module.cd1.mfg-name"	/* string */
11818119dad8SRobert Mustacchi #define	SPD_KEY_DEV_CD1_TYPE	"module.cd1.type"	/* uint32_t */
11828119dad8SRobert Mustacchi #define	SPD_KEY_DEV_CD1_REV	"module.cd1.revision"	/* string */
1183fe82ebb0SRobert Mustacchi 
1184fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_RCD_MFG	"module.rcd.mfg-id"	/* uint32_t [2] */
1185fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_RCD_MFG_NAME	"module.rcd.mfg-name"	/* string */
1186fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_RCD_TYPE	"module.rcd.type"	/* uint32_t */
1187fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_RCD_REV	"module.rcd.revision"	/* string */
1188fe82ebb0SRobert Mustacchi 
1189fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_DB_MFG	"module.db.mfg-id"	/* uint32_t [2] */
1190fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_DB_MFG_NAME	"module.db.mfg-name"	/* string */
1191fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_DB_TYPE	"module.db.type"	/* uint32_t */
1192fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_DB_REV	"module.db.revision"	/* string */
1193fe82ebb0SRobert Mustacchi 
1194fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_MRCD_MFG	"module.mrcd.mfg-id"	/* uint32_t [2] */
1195fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_MRCD_MFG_NAME	"module.mrcd.mfg-name"	/* string */
1196fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_MRCD_TYPE	"module.mrcd.type"	/* uint32_t */
1197fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_MRCD_REV	"module.mrcd.revision"	/* string */
1198fe82ebb0SRobert Mustacchi 
1199fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_MDB_MFG	"module.mdb.mfg-id"	/* uint32_t [2] */
1200fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_MDB_MFG_NAME	"module.mdb.mfg-name"	/* string */
1201fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_MDB_TYPE	"module.mdb.type"	/* uint32_t */
1202fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_MDB_REV	"module.mdb.revision"	/* string */
1203fe82ebb0SRobert Mustacchi 
1204fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_DMB_MFG	"module.dmb.mfg-id"	/* uint32_t [2] */
1205fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_DMB_MFG_NAME	"module.dmb.mfg-name"	/* string */
1206fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_DMB_TYPE	"module.dmb.type"	/* uint32_t */
1207fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_DMB_REV	"module.dmb.revision"	/* string */
1208fe82ebb0SRobert Mustacchi 
1209fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_SPD_MFG	"module.spd.mfg-id"	/* uint32_t [2] */
1210fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_SPD_MFG_NAME	"module.spd.mfg-name"	/* string */
1211fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_SPD_TYPE	"module.spd.type"	/* uint32_t */
1212fe82ebb0SRobert Mustacchi #define	SPD_KEY_DEV_SPD_REV	"module.spd.revision"	/* string */
1213fe82ebb0SRobert Mustacchi 
1214fe82ebb0SRobert Mustacchi /*
1215fe82ebb0SRobert Mustacchi  * Module physical dimensions. DRAM modules provide information about their
1216fe82ebb0SRobert Mustacchi  * height and their front and back thicknesses. All values are in millimeters.
1217fe82ebb0SRobert Mustacchi  * In general, values are defined as 1 mm ranges in the form such as 18mm <
1218fe82ebb0SRobert Mustacchi  * height <= 19mm or 2mm < thickness <= 3mm. As such in all these ranges we
1219fe82ebb0SRobert Mustacchi  * encode it as the less than or equal to side of the thickness or height.
1220fe82ebb0SRobert Mustacchi  *
1221fe82ebb0SRobert Mustacchi  * However, at the extremes of thickness and height, it can be arbitrary. The
1222fe82ebb0SRobert Mustacchi  * minimum height can be any value <= 15mm and the maximum is just > 45mm.
1223fe82ebb0SRobert Mustacchi  * Similarly the maximum thickness is just any value greater than 15mm. For
1224fe82ebb0SRobert Mustacchi  * these values, we define aliases that can be used to indicate we're in these
1225fe82ebb0SRobert Mustacchi  * conditions for the height and thickness, allowing this to otherwise be the
1226fe82ebb0SRobert Mustacchi  * common well understood value.
1227fe82ebb0SRobert Mustacchi  */
1228fe82ebb0SRobert Mustacchi #define	SPD_MOD_HEIGHT_LT15MM	15
1229fe82ebb0SRobert Mustacchi #define	SPD_MOD_HEIGHT_GT45MM	46
1230fe82ebb0SRobert Mustacchi #define	SPD_KEY_MOD_HEIGHT	"module.height"		/* uint32_t */
1231fe82ebb0SRobert Mustacchi #define	SPD_MOD_THICK_GT15MM	16
1232fe82ebb0SRobert Mustacchi #define	SPD_KEY_MOD_FRONT_THICK	"module.front-thickness"	/* uint32_t */
1233fe82ebb0SRobert Mustacchi #define	SPD_KEY_MOD_BACK_THICK	"module.back-thickness"	/* uint32_t */
1234fe82ebb0SRobert Mustacchi 
1235fe82ebb0SRobert Mustacchi /*
12368119dad8SRobert Mustacchi  * This is the number of rows of DRAM dies on the module. In addition, DDR3 and
12378119dad8SRobert Mustacchi  * DDR4 provides the number of registers present on the device. This is not
12388119dad8SRobert Mustacchi  * present in DDR5.
1239fe82ebb0SRobert Mustacchi  */
1240fe82ebb0SRobert Mustacchi #define	SPD_KEY_MOD_NROWS	"module.dram-die-rows"		/* uint32_t */
1241fe82ebb0SRobert Mustacchi #define	SPD_KEY_MOD_NREGS	"module.total-registers"	/* uint32_t */
1242fe82ebb0SRobert Mustacchi 
1243fe82ebb0SRobert Mustacchi /*
1244fe82ebb0SRobert Mustacchi  * Operating temperature ranges. These ranges are defined by JEDEC. The code can
1245fe82ebb0SRobert Mustacchi  * be translated with libjedec_temp_range() to transform it into a pair of
1246fe82ebb0SRobert Mustacchi  * values.
1247fe82ebb0SRobert Mustacchi  */
1248fe82ebb0SRobert Mustacchi #define	SPD_KEY_MOD_OPER_TEMP	"module.operating-temperature"	/* uint32_t */
1249fe82ebb0SRobert Mustacchi 
1250fe82ebb0SRobert Mustacchi /*
1251fe82ebb0SRobert Mustacchi  * Module reference card and design revision. JEDEC provides various reference
1252fe82ebb0SRobert Mustacchi  * designs for modules and revisions of those.
1253fe82ebb0SRobert Mustacchi  */
1254fe82ebb0SRobert Mustacchi #define	SPD_KEY_MOD_REF_DESIGN	"module.reference-design"	/* string */
1255fe82ebb0SRobert Mustacchi #define	SPD_KEY_MOD_DESIGN_REV	"module.design-revision"	/* uint32_t */
1256fe82ebb0SRobert Mustacchi 
1257fe82ebb0SRobert Mustacchi /*
1258fe82ebb0SRobert Mustacchi  * Manufacturing Section. These keys are present if manufacturing related
1259fe82ebb0SRobert Mustacchi  * information is made available. This space is not DIMM-revision specific. All
1260fe82ebb0SRobert Mustacchi  * fields are defined in DDR4 and DDR5. Note, the SPD_KEY_MFG_DRAM_STEP is
1261fe82ebb0SRobert Mustacchi  * optional and therefore an invalid value will result in this not being
1262fe82ebb0SRobert Mustacchi  * present.
1263fe82ebb0SRobert Mustacchi  */
1264fe82ebb0SRobert Mustacchi #define	SPD_KEY_MFG_MOD_MFG_ID	"mfg.module-mfg-id"	/* uint32[2] */
1265fe82ebb0SRobert Mustacchi #define	SPD_KEY_MFG_MOD_MFG_NAME	"mfg.module-mfg-name"	/* string */
1266fe82ebb0SRobert Mustacchi #define	SPD_KEY_MFG_DRAM_MFG_ID	"mfg.dram-mfg-id"	/* uint32[2] */
1267fe82ebb0SRobert Mustacchi #define	SPD_KEY_MFG_DRAM_MFG_NAME	"mfg.dram-mfg-name"	/* string */
1268fe82ebb0SRobert Mustacchi #define	SPD_KEY_MFG_MOD_LOC_ID	"mfg.module-loc-id"	/* uint32 */
1269fe82ebb0SRobert Mustacchi #define	SPD_KEY_MFG_MOD_YEAR	"mfg.module-year"	/* string */
1270fe82ebb0SRobert Mustacchi #define	SPD_KEY_MFG_MOD_WEEK	"mfg.module-week"	/* string */
1271fe82ebb0SRobert Mustacchi #define	SPD_KEY_MFG_MOD_PN	"mfg.module-pn"		/* string */
1272fe82ebb0SRobert Mustacchi #define	SPD_KEY_MFG_MOD_SN	"mfg.module-sn"		/* string */
1273fe82ebb0SRobert Mustacchi #define	SPD_KEY_MFG_MOD_REV	"mfg.module-rev"	/* string */
1274fe82ebb0SRobert Mustacchi #define	SPD_KEY_MFG_DRAM_STEP	"mfg.dram-step"		/* string */
1275fe82ebb0SRobert Mustacchi 
1276fe82ebb0SRobert Mustacchi /*
1277fe82ebb0SRobert Mustacchi  * The errors nvlist_t is designed such that it is a nested nvlist_t in the
1278fe82ebb0SRobert Mustacchi  * returned data. Each key in that nvlist_t corresponds to a key that we would
1279fe82ebb0SRobert Mustacchi  * otherwise produce. Each key is an nvlist_t that has two keys, a 'code' and a
1280fe82ebb0SRobert Mustacchi  * 'message'.
1281fe82ebb0SRobert Mustacchi  *
1282fe82ebb0SRobert Mustacchi  * There is currently an additional top-level special key. This is the
1283fe82ebb0SRobert Mustacchi  * 'incomplete' key. When data is too short to process an entry, rather than
1284fe82ebb0SRobert Mustacchi  * flag every possible missing key (as most times the consumer will know the
1285fe82ebb0SRobert Mustacchi  * amount of data they have), for the time being we will insert a single
1286fe82ebb0SRobert Mustacchi  * incomplete key with a uint32_t whose value indicates the starting offset of
1287fe82ebb0SRobert Mustacchi  * the key that we could not process. Note, this may not be the first byte that
1288fe82ebb0SRobert Mustacchi  * was missing (if we had 100 bytes and a 20 byte key at offset 90, we would
1289fe82ebb0SRobert Mustacchi  * insert 90).
1290fe82ebb0SRobert Mustacchi  */
1291fe82ebb0SRobert Mustacchi typedef enum {
1292fe82ebb0SRobert Mustacchi 	/*
1293fe82ebb0SRobert Mustacchi 	 * Indicates that the error occurred because we could not translate a
1294fe82ebb0SRobert Mustacchi 	 * given piece of information. For example, a value that we didn't know
1295fe82ebb0SRobert Mustacchi 	 * or a failure to look up something in a string table.
1296fe82ebb0SRobert Mustacchi 	 */
1297fe82ebb0SRobert Mustacchi 	SPD_ERROR_NO_XLATE,
1298fe82ebb0SRobert Mustacchi 	/*
1299fe82ebb0SRobert Mustacchi 	 * This indicates that we encountered an non-ASCII or unprintable
1300fe82ebb0SRobert Mustacchi 	 * character in an SPD string which should not be allowed per se.
1301fe82ebb0SRobert Mustacchi 	 */
1302fe82ebb0SRobert Mustacchi 	SPD_ERROR_UNPRINT,
1303fe82ebb0SRobert Mustacchi 	/*
1304fe82ebb0SRobert Mustacchi 	 * This indicates that there was no data for a given key. For example, a
1305fe82ebb0SRobert Mustacchi 	 * string that was all padded spaces.
1306fe82ebb0SRobert Mustacchi 	 */
1307fe82ebb0SRobert Mustacchi 	SPD_ERROR_NO_DATA,
1308fe82ebb0SRobert Mustacchi 	/*
1309fe82ebb0SRobert Mustacchi 	 * Indicates that some kind of internal error occurred.
1310fe82ebb0SRobert Mustacchi 	 */
1311fe82ebb0SRobert Mustacchi 	SPD_ERROR_INTERNAL,
1312fe82ebb0SRobert Mustacchi 	/*
1313fe82ebb0SRobert Mustacchi 	 * This indicates that there's something suspicious or weird to us about
1314fe82ebb0SRobert Mustacchi 	 * the data in question. The most common case is a bad CRC.
1315fe82ebb0SRobert Mustacchi 	 */
1316fe82ebb0SRobert Mustacchi 	SPD_ERROR_BAD_DATA
1317fe82ebb0SRobert Mustacchi } spd_error_kind_t;
1318fe82ebb0SRobert Mustacchi #define	SPD_KEY_INCOMPLETE	"incomplete"	/* uint32_t */
1319fe82ebb0SRobert Mustacchi #define	SPD_KEY_ERRS		"errors"	/* nvlist_t */
1320fe82ebb0SRobert Mustacchi #define	SPD_KEY_ERRS_CODE	"code"		/* uint32_t */
1321fe82ebb0SRobert Mustacchi #define	SPD_KEY_ERRS_MSG	"message"	/* string */
1322fe82ebb0SRobert Mustacchi 
13231566bc34SRobert Mustacchi #ifdef __cplusplus
13241566bc34SRobert Mustacchi }
13251566bc34SRobert Mustacchi #endif
13261566bc34SRobert Mustacchi 
13271566bc34SRobert Mustacchi #endif /* _LIBJEDEC_H */
1328