Documentation: Fix sphinx configuration
[coreboot.git] / src / include / spd.h
blobf46bde6522d021ed18885f0f3aa28137aefa8af3
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 /*
4 * Serial Presence Detect (SPD) data stored on SDRAM modules.
6 * Datasheet:
7 * - Name: PC SDRAM Serial Presence Detect (SPD) Specification
8 * Revision 1.2A, December, 1997
9 * - PDF: http://www.intel.com/design/chipsets/memory/spdsd12a.pdf
11 * Datasheet (alternative):
12 * - Name: SERIAL PRESENCE DETECT STANDARD, General Standard
13 * JEDEC Standard No. 21-C
14 * Annex J: Serial Presence Detects for DDR2 SDRAM (Revision 1.3):
15 * - PDF: http://www.jedec.org/download/search/4_01_02_10R17.pdf
18 #ifndef _SPD_H_
19 #define _SPD_H_
21 /* Byte numbers. */
22 /* Number of bytes used by module manufacturer */
23 #define SPD_NUM_MANUFACTURER_BYTES 0
24 #define SPD_TOTAL_SPD_MEMORY_SIZE 1 /* Total SPD memory size */
25 #define SPD_MEMORY_TYPE 2 /* (Fundamental) memory type */
26 #define SPD_NUM_ROWS 3 /* Number of row address bits */
27 /* Number of column address bits */
28 #define SPD_NUM_COLUMNS 4
29 /* Number of module rows (banks) */
30 #define SPD_NUM_DIMM_BANKS 5
31 #define SPD_MODULE_DATA_WIDTH_LSB 6 /* Module data width (LSB) */
32 #define SPD_MODULE_DATA_WIDTH_MSB 7 /* Module data width (MSB) */
33 /* Module interface signal levels */
34 #define SPD_MODULE_VOLTAGE 8
35 /* SDRAM cycle time (highest CAS latency), RAS access time (tRAC) */
36 #define SPD_MIN_CYCLE_TIME_AT_CAS_MAX 9
37 /* SDRAM access time from clock (highest CAS latency), CAS access time (Tac,
38 * tCAC)
40 #define SPD_ACCESS_TIME_FROM_CLOCK 10
41 #define SPD_DIMM_CONFIG_TYPE 11 /* Module configuration type */
42 #define SPD_REFRESH 12 /* Refresh rate/type */
43 #define SPD_PRIMARY_SDRAM_WIDTH 13 /* SDRAM width (primary SDRAM) */
44 /* Error checking SDRAM (data) width */
45 #define SPD_ERROR_CHECKING_SDRAM_WIDTH 14
46 /* SDRAM device attributes, minimum clock delay for back to back random
47 * column
49 #define SPD_MIN_CLOCK_DELAY_B2B_RAND_COLUMN 15
50 /* SDRAM device attributes, burst lengths supported */
51 #define SPD_SUPPORTED_BURST_LENGTHS 16
52 /* SDRAM device attributes, number of banks on SDRAM device */
53 #define SPD_NUM_BANKS_PER_SDRAM 17
54 /* SDRAM device attributes, CAS latency */
55 #define SPD_ACCEPTABLE_CAS_LATENCIES 18
56 /* SDRAM device attributes, CS latency */
57 #define SPD_CS_LATENCY 19
58 /* SDRAM device attributes, WE latency */
59 #define SPD_WE_LATENCY 20
60 #define SPD_MODULE_ATTRIBUTES 21 /* SDRAM module attributes */
61 /* SDRAM device attributes, general */
62 #define SPD_DEVICE_ATTRIBUTES_GENERAL 22
63 /* SDRAM cycle time (2nd highest CAS latency) */
64 #define SPD_SDRAM_CYCLE_TIME_2ND 23
65 /* SDRAM access from clock (2nd highest CAS latency) */
66 #define SPD_ACCESS_TIME_FROM_CLOCK_2ND 24
67 /* SDRAM cycle time (3rd highest CAS latency) */
68 #define SPD_SDRAM_CYCLE_TIME_3RD 25
69 /* SDRAM access from clock (3rd highest CAS latency) */
70 #define SPD_ACCESS_TIME_FROM_CLOCK_3RD 26
71 /* Minimum row precharge time (Trp) */
72 #define SPD_MIN_ROW_PRECHARGE_TIME 27
73 /* Minimum row active to row active (Trrd) */
74 #define SPD_MIN_ROWACTIVE_TO_ROWACTIVE 28
75 /* Minimum RAS to CAS delay (Trcd) */
76 #define SPD_MIN_RAS_TO_CAS_DELAY 29
77 /* Minimum RAS pulse width (Tras) */
78 #define SPD_MIN_ACTIVE_TO_PRECHARGE_DELAY 30
79 /* Density of each row on module */
80 #define SPD_DENSITY_OF_EACH_ROW_ON_MODULE 31
81 /* Command and address signal input setup time */
82 #define SPD_CMD_SIGNAL_INPUT_SETUP_TIME 32
83 /* Command and address signal input hold time */
84 #define SPD_CMD_SIGNAL_INPUT_HOLD_TIME 33
85 /* Data signal input setup time */
86 #define SPD_DATA_SIGNAL_INPUT_SETUP_TIME 34
87 #define SPD_DATA_SIGNAL_INPUT_HOLD_TIME 35 /* Data signal input hold time */
88 #define SPD_WRITE_RECOVERY_TIME 36 /* Write recovery time (tWR) */
89 /* Internal write to read command delay (tWTR) */
90 #define SPD_INT_WRITE_TO_READ_DELAY 37
91 /* Internal read to precharge command delay (tRTP) */
92 #define SPD_INT_READ_TO_PRECHARGE_DELAY 38
93 /* Memory analysis probe characteristics */
94 #define SPD_MEM_ANALYSIS_PROBE_PARAMS 39
95 /* Extension of byte 41 (tRC) and byte 42 (tRFC) */
96 #define SPD_BYTE_41_42_EXTENSION 40
97 /* Minimum active to active auto refresh (tRCmin) */
98 #define SPD_MIN_ACT_TO_ACT_AUTO_REFRESH 41
99 /* Minimum auto refresh to active/auto refresh (tRFC) */
100 #define SPD_MIN_AUTO_REFRESH_TO_ACT 42
101 /* Maximum device cycle time (tCKmax) */
102 #define SPD_MAX_DEVICE_CYCLE_TIME 43
103 /* Maximum skew between DQS and DQ (tDQSQ) */
104 #define SPD_MAX_DQS_DQ_SKEW 44
105 /* Maximum read data-hold skew factor (tQHS) */
106 #define SPD_MAX_READ_DATAHOLD_SKEW 45
107 #define SPD_PLL_RELOCK_TIME 46 /* PLL relock time */
108 #define SPD_SPD_DATA_REVISION_CODE 62 /* SPD data revision code */
109 #define SPD_CHECKSUM_FOR_BYTES_0_TO_62 63 /* Checksum for bytes 0-62 */
110 /* Manufacturer's JEDEC ID code, per EIA/JEP106 (bytes 64-71) */
111 #define SPD_MANUFACTURER_JEDEC_ID_CODE 64
112 #define SPD_MANUFACTURING_LOCATION 72 /* Manufacturing location */
113 /* Manufacturer's part number, in 6-bit ASCII (bytes 73-90) */
114 #define SPD_MANUFACTURER_PART_NUMBER 73
115 #define SPD_REVISION_CODE 91 /* Revision code (bytes 91-92) */
116 /* Manufacturing date (byte 93: year, byte 94: week) */
117 #define SPD_MANUFACTURING_DATE 93
118 /* Assembly serial number (bytes 95-98) */
119 #define SPD_ASSEMBLY_SERIAL_NUMBER 95
120 /* Manufacturer specific data (bytes 99-125) */
121 #define SPD_MANUFACTURER_SPECIFIC_DATA 99
122 /* Intel specification for frequency */
123 #define SPD_INTEL_SPEC_FOR_FREQUENCY 126
124 /* Intel specification details for 100MHz support */
125 #define SPD_INTEL_SPEC_100_MHZ 127
127 /* DRAM specifications use the following naming conventions for SPD locations */
128 #define SPD_tRP SPD_MIN_ROW_PRECHARGE_TIME
129 #define SPD_tRRD SPD_MIN_ROWACTIVE_TO_ROWACTIVE
130 #define SPD_tRCD SPD_MIN_RAS_TO_CAS_DELAY
131 #define SPD_tRAS SPD_MIN_ACTIVE_TO_PRECHARGE_DELAY
132 #define SPD_BANK_DENSITY SPD_DENSITY_OF_EACH_ROW_ON_MODULE
133 #define SPD_ADDRESS_CMD_HOLD SPD_CMD_SIGNAL_INPUT_HOLD_TIME
134 /* SDRAM Device Minimum Active to Active/Auto Refresh Time (tRC) */
135 #define SPD_tRC 41
136 /* SDRAM Device Minimum Auto Refresh to Active/Auto Refresh (tRFC) */
137 #define SPD_tRFC 42
140 /* SPD_MEMORY_TYPE values. */
141 enum spd_memory_type {
142 SPD_MEMORY_TYPE_UNDEFINED = 0x00,
143 SPD_MEMORY_TYPE_FPM_DRAM = 0x01,
144 SPD_MEMORY_TYPE_EDO = 0x02,
145 SPD_MEMORY_TYPE_PIPELINED_NIBBLE = 0x03,
146 SPD_MEMORY_TYPE_SDRAM = 0x04,
147 SPD_MEMORY_TYPE_MULTIPLEXED_ROM = 0x05,
148 SPD_MEMORY_TYPE_SGRAM_DDR = 0x06,
149 SPD_MEMORY_TYPE_SDRAM_DDR = 0x07,
150 SPD_MEMORY_TYPE_SDRAM_DDR2 = 0x08,
151 SPD_MEMORY_TYPE_FBDIMM_DDR2 = 0x09,
152 SPD_MEMORY_TYPE_FB_PROBE_DDR2 = 0x0a,
153 SPD_MEMORY_TYPE_SDRAM_DDR3 = 0x0b,
154 SPD_MEMORY_TYPE_DDR4_SDRAM = 0x0c,
155 SPD_MEMORY_TYPE_DDR4E_SDRAM = 0x0e,
156 SPD_MEMORY_TYPE_LPDDR3_SDRAM = 0x0f,
157 SPD_MEMORY_TYPE_LPDDR4_SDRAM = 0x10,
160 /* SPD_MODULE_VOLTAGE values. */
161 #define SPD_VOLTAGE_TTL 0 /* 5.0 Volt/TTL */
162 #define SPD_VOLTAGE_LVTTL 1 /* LVTTL */
163 #define SPD_VOLTAGE_HSTL 2 /* HSTL 1.5 */
164 #define SPD_VOLTAGE_SSTL3 3 /* SSTL 3.3 */
165 #define SPD_VOLTAGE_SSTL2 4 /* SSTL 2.5 */
166 #define SPD_VOLTAGE_SSTL1 5 /* SSTL 1.8 */
168 /* SPD_DIMM_CONFIG_TYPE values. */
169 #define ERROR_SCHEME_NONE 0
170 #define ERROR_SCHEME_PARITY 1
171 #define ERROR_SCHEME_ECC 2
173 /* SPD_ACCEPTABLE_CAS_LATENCIES values. */
174 // TODO: Check values.
175 #define SPD_CAS_LATENCY_1_0 0x01
176 #define SPD_CAS_LATENCY_1_5 0x02
177 #define SPD_CAS_LATENCY_2_0 0x04
178 #define SPD_CAS_LATENCY_2_5 0x08
179 #define SPD_CAS_LATENCY_3_0 0x10
180 #define SPD_CAS_LATENCY_3_5 0x20
181 #define SPD_CAS_LATENCY_4_0 0x40
183 #define SPD_CAS_LATENCY_DDR2_2 (1 << 2)
184 #define SPD_CAS_LATENCY_DDR2_3 (1 << 3)
185 #define SPD_CAS_LATENCY_DDR2_4 (1 << 4)
186 #define SPD_CAS_LATENCY_DDR2_5 (1 << 5)
187 #define SPD_CAS_LATENCY_DDR2_6 (1 << 6)
188 #define SPD_CAS_LATENCY_DDR2_7 (1 << 7)
190 /* SPD_SUPPORTED_BURST_LENGTHS values. */
191 #define SPD_BURST_LENGTH_1 1
192 #define SPD_BURST_LENGTH_2 2
193 #define SPD_BURST_LENGTH_4 4
194 #define SPD_BURST_LENGTH_8 8
195 #define SPD_BURST_LENGTH_PAGE (1 << 7)
197 /* SPD_MODULE_ATTRIBUTES values. */
198 #define MODULE_BUFFERED 1
199 #define MODULE_REGISTERED 2
201 /* DIMM SPD addresses */
202 #define DIMM0 0x50
203 #define DIMM1 0x51
204 #define DIMM2 0x52
205 #define DIMM3 0x53
206 #define DIMM4 0x54
207 #define DIMM5 0x55
208 #define DIMM6 0x56
209 #define DIMM7 0x57
211 #define RC00 0
212 #define RC01 1
213 #define RC02 2
214 #define RC03 3
215 #define RC04 4
216 #define RC05 5
217 #define RC06 6
218 #define RC07 7
219 #define RC08 8
220 #define RC09 9
221 #define RC10 10
222 #define RC11 11
223 #define RC12 12
224 #define RC13 13
225 #define RC14 14
226 #define RC15 15
227 #define RC16 16
228 #define RC17 17
229 #define RC18 18
230 #define RC19 19
231 #define RC20 20
232 #define RC21 21
233 #define RC22 22
234 #define RC23 23
235 #define RC24 24
236 #define RC25 25
237 #define RC26 26
238 #define RC27 27
239 #define RC28 28
240 #define RC29 29
241 #define RC30 30
242 #define RC31 31
244 #define RC32 32
245 #define RC33 33
246 #define RC34 34
247 #define RC35 35
248 #define RC36 36
249 #define RC37 37
250 #define RC38 38
251 #define RC39 39
252 #define RC40 40
253 #define RC41 41
254 #define RC42 42
255 #define RC43 43
256 #define RC44 44
257 #define RC45 45
258 #define RC46 46
259 #define RC47 47
260 #define RC48 48
261 #define RC49 49
262 #define RC50 50
263 #define RC51 51
264 #define RC52 52
265 #define RC53 53
266 #define RC54 54
267 #define RC55 55
268 #define RC56 56
269 #define RC57 57
270 #define RC58 58
271 #define RC59 59
272 #define RC60 60
273 #define RC61 61
274 #define RC62 62
275 #define RC63 63
277 /* Byte 3: Module type information */
278 #define SPD_UNDEFINED 0x00
279 #define SPD_RDIMM 0x01
280 #define SPD_UDIMM 0x02
281 #define SPD_SODIMM 0x04
282 #define SPD_72B_SO_CDIMM 0x06
283 #define SPD_72B_SO_RDIMM 0x07
284 #define SPD_MICRO_DIMM 0x08
285 #define SPD_MINI_RDIMM 0x10
286 #define SPD_MINI_UDIMM 0x20
288 #define SPD_ECC_8BIT (1<<3)
290 #endif