1 /* 2 * This file and its contents are supplied under the terms of the 3 * Common Development and Distribution License ("CDDL"), version 1.0. 4 * You may only use this file in accordance with the terms of version 5 * 1.0 of the CDDL. 6 * 7 * A full copy of the text of the CDDL should have accompanied this 8 * source. A copy of the CDDL is also available via the Internet at 9 * http://www.illumos.org/license/CDDL. 10 */ 11 12 /* 13 * Copyright 2026 Oxide Computer Company 14 */ 15 16 #ifndef _SPD_LP5_H 17 #define _SPD_LP5_H 18 19 /* 20 * Definitions for use in LPDDR5/LPDDR5X Serial Presence Detect decoding based 21 * on JEDEC standard JESD406-5D LPDDR5/5X Serial Presence Detect (SPD) Contents. 22 * Release 1.3. This does not cover DDR5. That is covered in spd_ddr5.h. 23 * 24 * LPDDR5/X modules are organized into a few main regions which is identical to 25 * DDR5; however, the contents vary: 26 * 27 * o Base Configuration, DRAM, and Module Parameters (0x00-0x7f) 28 * o Common Module Parameters (0xc0, 0xef) 29 * o Standard Module Parameters (0xf0-0x1bf) which vary on the specific DIMM 30 * type. 31 * o A CRC check for the first 510 bytes (0x1fe-0x1ff) 32 * o Manufacturing Information (0x200-0x27f) 33 * o Optional end-user programmable regions (0x280-0x3ff) 34 * 35 * This covers all LPDDR5/X variants other than NVDIMMs. 36 */ 37 38 #include <sys/bitext.h> 39 #include "spd_common.h" 40 41 #ifdef __cplusplus 42 extern "C" { 43 #endif 44 45 /* 46 * Number of Bytes in SPD Device and Beta Level 47 */ 48 #define SPD_LP5_NBYTES 0x00 49 #define SPD_LP5_NBYTES_BETAHI(r) bitx8(r, 7, 7) 50 #define SPD_LP5_NBYTES_TOTAL(r) bitx8(r, 6, 4) 51 #define SPD_LP5_NBYTES_TOTAL_UNDEF 0 52 #define SPD_LP5_NBYTES_TOTAL_256 1 53 #define SPD_LP5_NBYTES_TOTAL_512 2 54 #define SPD_LP5_NBYTES_TOTAL_1024 3 55 #define SPD_LP5_NBYTES_TOTAL_2048 4 56 #define SPD_LP5_NBYTES_BETA(r) bitx8(r, 3, 0) 57 58 /* 59 * SPD Revision for Base Configuration Parameters. This is the same as described 60 * in SPD_DDR4_SPD_REV as defined in spd_ddr4.h. 61 */ 62 #define SPD_LP5_SPD_REV 0x001 63 #define SPD_LP5_SPD_REV_ENC(r) bitx8(r, 7, 4) 64 #define SPD_LP5_SPD_REV_ADD(r) bitx8(r, 3, 0) 65 #define SPD_LP5_SPD_REV_V1 1 66 67 /* 68 * Key Byte / DRAM Device Type. This field identifies the type of DDR device and 69 * is actually consistent across all SPD versions. Known values are in the 70 * spd_dram_type_t enumeration. 71 */ 72 #define SPD_LP5_DRAM_TYPE 0x002 73 74 /* 75 * Key Byte / Module Type 76 */ 77 #define SPD_LP5_MOD_TYPE 0x003 78 #define SPD_LP5_MOD_TYPE_ISHYBRID(r) bitx8(r, 7, 7) 79 #define SPD_LP5_MOD_TYPE_HYBRID(r) bitx8(r, 6, 4) 80 #define SPD_LP5_MOD_TYPE_HYBRID_NONE 0 81 #define SPD_LP5_MOD_TYPE_HYBRID_NVDIMM_N 1 82 #define SPD_LP5_MOD_TYPE_HYBRID_NVDIMM_P 2 83 #define SPD_LP5_MOD_TYPE_TYPE(r) bitx8(r, 3, 0) 84 #define SPD_LP5_MOD_TYPE_TYPE_RDIMM 1 85 #define SPD_LP5_MOD_TYPE_TYPE_UDIMM 2 86 #define SPD_LP5_MOD_TYPE_TYPE_SODIMM 3 87 #define SPD_LP5_MOD_TYPE_TYPE_LRDIMM 4 88 #define SPD_LP5_MOD_TYPE_TYPE_CUDIMM 5 89 #define SPD_LP5_MOD_TYPE_TYPE_CSODIMM 6 90 #define SPD_LP5_MOD_TYPE_TYPE_MRDIMM 7 91 #define SPD_LP5_MOD_TYPE_TYPE_CAMM2 8 92 #define SPD_LP5_MOD_TYPE_TYPE_SOCAMM2 9 93 #define SPD_LP5_MOD_TYPE_TYPE_DDIMM 10 94 #define SPD_LP5_MOD_TYPE_TYPE_SOLDER 11 95 96 /* 97 * SDRAM Density and Banks 98 */ 99 #define SPD_LP5_DENSITY 0x004 100 #define SPD_LP5_DENSITY_NBG_BITS(r) bitx8(r, 7, 6) 101 #define SPD_LP5_DENSITY_NBG_BITS_MAX 2 102 #define SPD_LP5_DENSITY_NBA_BITS(r) bitx8(r, 5, 4) 103 #define SPD_LP5_DENSITY_NBA_BITS_BASE 2 104 #define SPD_LP5_DENSITY_NBA_BITS_MAX 4 105 #define SPD_LP5_DENSITY_DENSITY(r) bitx8(r, 3, 0) 106 #define SPD_LP5_DENSITY_DENSITY_1Gb 2 107 #define SPD_LP5_DENSITY_DENSITY_2Gb 3 108 #define SPD_LP5_DENSITY_DENSITY_4Gb 4 109 #define SPD_LP5_DENSITY_DENSITY_8Gb 5 110 #define SPD_LP5_DENSITY_DENSITY_16Gb 6 111 #define SPD_LP5_DENSITY_DENSITY_32Gb 7 112 #define SPD_LP5_DENSITY_DENSITY_12Gb 8 113 #define SPD_LP5_DENSITY_DENSITY_24Gb 9 114 #define SPD_LP5_DENSITY_DENSITY_3Gb 10 115 #define SPD_LP5_DENSITY_DENSITY_6Gb 11 116 117 /* 118 * SDRAM Addressing 119 * 120 * While the number of banks and bank groups is described above, the values for 121 * the number of columns is combined with the number of bank group and bank 122 * address bits. 123 */ 124 #define SPD_LP5_ADDRESS 0x005 125 #define SPD_LP5_ADDRESS_NROWS(x) bitx8(x, 5, 3) 126 #define SPD_LP5_ADDRESS_NROW_BASE 12 127 #define SPD_LP5_ADDRESS_NROW_MAX 18 128 #define SPD_LP5_ADDRESS_BCOL(x) bitx8(x, 2, 0) 129 #define SPD_LP5_ADDRESS_BCOL_3BA6C 0 130 #define SPD_LP5_ADDRESS_BCOL_4BA6C 1 131 132 /* 133 * SDRAM Package Type 134 */ 135 #define SPD_LP5_PKG 0x006 136 #define SPD_LP5_PKG_TYPE(r) bitx8(r, 7, 7) 137 #define SPD_LP5_PKG_TYPE_MONO 0 138 #define SPD_LP5_PKG_TYPE_NOT 1 139 #define SPD_LP5_PKG_DIE_CNT(r) bitx8(r, 6, 4) 140 #define SPD_LP5_DIE_CNT_1 0 141 #define SPD_LP5_DIE_CNT_2 1 142 #define SPD_LP5_DIE_CNT_3 2 143 #define SPD_LP5_DIE_CNT_4 3 144 #define SPD_LP5_DIE_CNT_5 4 145 #define SPD_LP5_DIE_CNT_6 5 146 #define SPD_LP5_DIE_CNT_16 6 147 #define SPD_LP5_DIE_CNT_8 7 148 #define SPD_LP5_PKG_DQSDW(r) bitx8(r, 3, 1) 149 #define SPD_LP5_PKG_DQSDW_1 0 150 #define SPD_LP5_PKG_DQSDW_16 1 151 #define SPD_LP5_PKG_DQSDW_2 2 152 #define SPD_LP5_PKG_DQSDW_4 4 153 #define SPD_LP5_PKG_DQSDW_8 8 154 #define SPD_LP5_PKG_SLIDX(r) bitx8(r, 1, 0) 155 #define SPD_LP5_PKG_SLIDX_UNSPEC 0 156 #define SPD_LP5_PKG_SLIDX_B16SLM1 1 157 158 /* 159 * Optional Features 160 */ 161 #define SPD_LP5_OPT_FEAT 0x009 162 #define SPD_LP5_OPT_FEAT_PPR(r) bitx8(r, 7, 6) 163 #define SPD_LP5_OPT_FEAT_PPR_NOTSUP 0 164 #define SPD_LP5_OPT_FEAT_PPR_SUP 1 165 #define SPD_LP5_OPT_FEAT_SOFT_PPR(r) bitx8(r, 5, 5) 166 167 /* 168 * Module Organization 169 */ 170 #define SPD_LP5_MOD_ORG 0x00c 171 #define SPD_LP5_MOD_ORG_IDENT(r) bitx8(r, 6, 6) 172 #define SPD_LP5_MOD_ORG_IDENT_STD 0 173 #define SPD_LP5_MOD_ORG_IDENT_BYTE 1 174 #define SPD_LP5_MOD_ORG_RANK(r) bitx8(r, 5, 3) 175 #define SPD_LP5_MOD_ORG_RANK_BASE 1 176 #define SPD_LP5_MOD_ORG_RANK_MAX 4 177 #define SPD_LP5_MOD_ORG_WIDTH(r) bitx8(r, 2, 0) 178 #define SPD_LP5_MOD_ORG_WIDTH_BASE 2 179 #define SPD_LP5_MOD_ORG_WIDTH_MAX 32 180 181 /* 182 * System Sub-Channel Bus Width 183 */ 184 #define SPD_LP5_WIDTH 0x00d 185 #define SPD_LP5_WIDTH_SUBCHAN(r) bitx8(r, 2, 0) 186 #define SP5_LP5_WIDTH_SUBCHAN_16b 1 187 #define SP5_LP5_WIDTH_SUBCHAN_32b 2 188 189 /* 190 * Signal Loading 191 * 192 * The values of the signal loading are dependent on the value found in the 193 * SPD_LP5_PKG (byte 6) register, The interpretation varies based on the value 194 * of SPD_LP5_PKG_SLIDX(). 195 */ 196 #define SPD_LP5_SIGLOAD 0x010 197 #define SPD_LP5_SIGLOAD1_DSM_LOAD(r) bitx8(r, 7, 6) 198 #define SPD_LP5_SIGLOAD1_DSM_LOAD_MAX 4 199 #define SPD_LP5_SIGLOAD1_CAC_LOAD(r) bitx8(r, 5, 3) 200 #define SPD_LP5_SIGLOAD1_CAC_LOAD_MAX 8 201 #define SPD_LP5_SIGLOAD1_CS_LOAD(r) bitx8(r, 2, 0) 202 #define SPD_LP5_SIGLOAD1_CS_LOAD_MAX 8 203 204 /* 205 * Timebases 206 * 207 * Like with DDR4, there are strictly speaking timebase values encoded in the 208 * registers that describe how to calculate other values. These are broken into 209 * the Medium and Fine timebases respectively which as of v1.0 have fixed 210 * values of 125ps and 1ps respectively. See the DDR4 version for more 211 * information. 212 */ 213 #define SPD_LP5_TIMEBASE 0x011 214 #define SPD_LP5_TIMEBASE_MTB(r) bitx8(r, 3, 2) 215 #define SPD_LP5_TIMEBASE_MTB_125ps 0 216 #define SPD_LP5_TIMEBASE_FTB(r) bitx8(r, 1, 0) 217 #define SPD_LP5_TIMEBASE_FTB_1ps 0 218 #define SPD_LP5_MTB_PS 125 219 #define SPD_LP5_FTB_PS 1 220 221 /* 222 * SDRAM Minimum Cycle Time t~ckavg~min. 223 * Fine Offset for ^ 224 * SDRAM Maximum Cycle Time t~ckavg~max. 225 * Fine Offset for ^ 226 */ 227 #define SPD_LP5_TCKAVG_MIN 0x012 228 #define SPD_LP5_TCKAVG_MIN_FINE 0x07d 229 #define SPD_LP5_TCKAVG_MAX 0x013 230 #define SPD_LP5_TCKAVG_MAX_FINE 0x07c 231 232 /* 233 * Minimum CAS Latency Time t~AA~min. This uses the MTB. 234 * Fine Offset for ^ 235 */ 236 #define SPD_LP5_TAA_MIN 0x018 237 #define SPD_LP5_TAA_MIN_FINE 0x07b 238 239 /* 240 * Minimum RAS to CAS Delay Time t~RCD~min. 241 * Fine Offset for ^ 242 */ 243 #define SPD_LP5_TRCD_MIN 0x01a 244 #define SPD_LP5_TRCD_MIN_FINE 0x07a 245 246 /* 247 * All Banks Minimum Row Precharge Delay Time t~RPab~min. 248 * Fine Offset for ^ 249 */ 250 #define SPD_LP5_TRPAB_MIN 0x01b 251 #define SPD_LP5_TRPAB_MIN_FINE 0x079 252 253 /* 254 * Per Bank Minimum Row Precharge Delay Time t~RPpb~min. 255 * Fine Offset for ^ 256 */ 257 #define SPD_LP5_TRPPB_MIN 0x01c 258 #define SPD_LP5_TRPPB_MIN_FINE 0x078 259 260 /* 261 * All Banks Minimum Refresh Recovery Delay Time t~RFCab~min. This is a 16-bit 262 * quantity that is split between a lower and upper value. Both registers are in 263 * terms of the medium time base. 264 */ 265 #define SPD_LP5_TRFCAB_MIN_LO 0x1d 266 #define SPD_LP5_TRFCAB_MIN_HI 0x1e 267 268 /* 269 * Per Bank Minimum Refresh Recovery Delay Time t~RFCpb~min. This is a 16-bit 270 * quantity that is split between a lower and upper value. Both registers are in 271 * terms of the medium time base. 272 */ 273 #define SPD_LP5_TRFCPB_MIN_LO 0x1f 274 #define SPD_LP5_TRFCPB_MIN_HI 0x20 275 276 /* 277 * DDR5 and LPDDR5/x share the common definitions for the module and 278 * manufacturer's information. The module-type specific overlays such as 279 * soldered down and CAMM2 are shared between all of them and are currently 280 * defined in the spd_ddr5.h header. 281 */ 282 283 #ifdef __cplusplus 284 } 285 #endif 286 287 #endif /* _SPD_LP5_H */ 288