blob: 9ada5c3c6dc9f1c710ec63235f3861494256f5f7 [file] [log] [blame]
Stefan Reinauereca92fb2006-08-23 14:28:37 +00001/*
Stefan Reinauer7e61e452008-01-18 10:35:56 +00002 * This file is part of the coreboot project.
Stefan Reinauereca92fb2006-08-23 14:28:37 +00003 *
4 * Copyright (C) 2005 Digital Design Corporation
Uwe Hermann998a57c2006-11-22 11:41:32 +00005 * Copyright (C) 2006 Uwe Hermann <uwe@hermann-uwe.de>
Stefan Reinauereca92fb2006-08-23 14:28:37 +00006 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
Stefan Reinauereca92fb2006-08-23 14:28:37 +000016 */
17
Uwe Hermann998a57c2006-11-22 11:41:32 +000018/*
19 * Serial Presence Detect (SPD) data stored on SDRAM modules.
20 *
21 * Datasheet:
22 * - Name: PC SDRAM Serial Presence Detect (SPD) Specification
23 * Revision 1.2A, December, 1997
24 * - PDF: http://www.intel.com/design/chipsets/memory/spdsd12a.pdf
25 *
26 * Datasheet (alternative):
27 * - Name: SERIAL PRESENCE DETECT STANDARD, General Standard
28 * JEDEC Standard No. 21-C
Elyes HAOUASc8d24dd2016-06-15 21:13:07 +020029 * Annex J: Serial Presence Detects for DDR2 SDRAM (Revision 1.3):
30 * - PDF: http://www.jedec.org/download/search/4_01_02_10R17.pdf
Uwe Hermann998a57c2006-11-22 11:41:32 +000031 */
Stefan Reinauereca92fb2006-08-23 14:28:37 +000032
Uwe Hermann998a57c2006-11-22 11:41:32 +000033#ifndef _SPD_H_
34#define _SPD_H_
Stefan Reinauereca92fb2006-08-23 14:28:37 +000035
Uwe Hermann998a57c2006-11-22 11:41:32 +000036/* Byte numbers. */
Lee Leahy6a566d72017-03-07 17:45:12 -080037/* Number of bytes used by module manufacturer */
38#define SPD_NUM_MANUFACTURER_BYTES 0
Uwe Hermann998a57c2006-11-22 11:41:32 +000039#define SPD_TOTAL_SPD_MEMORY_SIZE 1 /* Total SPD memory size */
40#define SPD_MEMORY_TYPE 2 /* (Fundamental) memory type */
41#define SPD_NUM_ROWS 3 /* Number of row address bits */
Lee Leahy6a566d72017-03-07 17:45:12 -080042/* Number of column address bits */
43#define SPD_NUM_COLUMNS 4
44/* Number of module rows (banks) */
45#define SPD_NUM_DIMM_BANKS 5
Uwe Hermann998a57c2006-11-22 11:41:32 +000046#define SPD_MODULE_DATA_WIDTH_LSB 6 /* Module data width (LSB) */
47#define SPD_MODULE_DATA_WIDTH_MSB 7 /* Module data width (MSB) */
Lee Leahy6a566d72017-03-07 17:45:12 -080048/* Module interface signal levels */
49#define SPD_MODULE_VOLTAGE 8
50/* SDRAM cycle time (highest CAS latency), RAS access time (tRAC) */
51#define SPD_MIN_CYCLE_TIME_AT_CAS_MAX 9
52/* SDRAM access time from clock (highest CAS latency), CAS access time (Tac,
53 * tCAC)
54 */
55#define SPD_ACCESS_TIME_FROM_CLOCK 10
Uwe Hermann998a57c2006-11-22 11:41:32 +000056#define SPD_DIMM_CONFIG_TYPE 11 /* Module configuration type */
57#define SPD_REFRESH 12 /* Refresh rate/type */
58#define SPD_PRIMARY_SDRAM_WIDTH 13 /* SDRAM width (primary SDRAM) */
Lee Leahy6a566d72017-03-07 17:45:12 -080059/* Error checking SDRAM (data) width */
60#define SPD_ERROR_CHECKING_SDRAM_WIDTH 14
61/* SDRAM device attributes, minimum clock delay for back to back random
62 * column
63 */
64#define SPD_MIN_CLOCK_DELAY_B2B_RAND_COLUMN 15
65/* SDRAM device attributes, burst lengths supported */
66#define SPD_SUPPORTED_BURST_LENGTHS 16
67/* SDRAM device attributes, number of banks on SDRAM device */
68#define SPD_NUM_BANKS_PER_SDRAM 17
69/* SDRAM device attributes, CAS latency */
70#define SPD_ACCEPTABLE_CAS_LATENCIES 18
71/* SDRAM device attributes, CS latency */
72#define SPD_CS_LATENCY 19
73/* SDRAM device attributes, WE latency */
74#define SPD_WE_LATENCY 20
Uwe Hermann998a57c2006-11-22 11:41:32 +000075#define SPD_MODULE_ATTRIBUTES 21 /* SDRAM module attributes */
Lee Leahy6a566d72017-03-07 17:45:12 -080076/* SDRAM device attributes, general */
77#define SPD_DEVICE_ATTRIBUTES_GENERAL 22
78/* SDRAM cycle time (2nd highest CAS latency) */
79#define SPD_SDRAM_CYCLE_TIME_2ND 23
80/* SDRAM access from clock (2nd highest CAS latency) */
81#define SPD_ACCESS_TIME_FROM_CLOCK_2ND 24
82/* SDRAM cycle time (3rd highest CAS latency) */
83#define SPD_SDRAM_CYCLE_TIME_3RD 25
84/* SDRAM access from clock (3rd highest CAS latency) */
85#define SPD_ACCESS_TIME_FROM_CLOCK_3RD 26
86/* Minimum row precharge time (Trp) */
87#define SPD_MIN_ROW_PRECHARGE_TIME 27
88/* Minimum row active to row active (Trrd) */
89#define SPD_MIN_ROWACTIVE_TO_ROWACTIVE 28
90/* Minimum RAS to CAS delay (Trcd) */
91#define SPD_MIN_RAS_TO_CAS_DELAY 29
92/* Minimum RAS pulse width (Tras) */
93#define SPD_MIN_ACTIVE_TO_PRECHARGE_DELAY 30
94/* Density of each row on module */
95#define SPD_DENSITY_OF_EACH_ROW_ON_MODULE 31
96/* Command and address signal input setup time */
97#define SPD_CMD_SIGNAL_INPUT_SETUP_TIME 32
98/* Command and address signal input hold time */
99#define SPD_CMD_SIGNAL_INPUT_HOLD_TIME 33
100/* Data signal input setup time */
101#define SPD_DATA_SIGNAL_INPUT_SETUP_TIME 34
Uwe Hermann998a57c2006-11-22 11:41:32 +0000102#define SPD_DATA_SIGNAL_INPUT_HOLD_TIME 35 /* Data signal input hold time */
Stefan Reinauer951c62f2008-08-01 11:40:16 +0000103#define SPD_WRITE_RECOVERY_TIME 36 /* Write recovery time (tWR) */
Lee Leahy6a566d72017-03-07 17:45:12 -0800104/* Internal write to read command delay (tWTR) */
105#define SPD_INT_WRITE_TO_READ_DELAY 37
106/* Internal read to precharge command delay (tRTP) */
107#define SPD_INT_READ_TO_PRECHARGE_DELAY 38
108/* Memory analysis probe characteristics */
109#define SPD_MEM_ANALYSIS_PROBE_PARAMS 39
110/* Extension of byte 41 (tRC) and byte 42 (tRFC) */
111#define SPD_BYTE_41_42_EXTENSION 40
112/* Minimum active to active auto refresh (tRCmin) */
113#define SPD_MIN_ACT_TO_ACT_AUTO_REFRESH 41
114/* Minimum auto refresh to active/auto refresh (tRFC) */
115#define SPD_MIN_AUTO_REFRESH_TO_ACT 42
116/* Maximum device cycle time (tCKmax) */
117#define SPD_MAX_DEVICE_CYCLE_TIME 43
118/* Maximum skew between DQS and DQ (tDQSQ) */
119#define SPD_MAX_DQS_DQ_SKEW 44
120/* Maximum read data-hold skew factor (tQHS) */
121#define SPD_MAX_READ_DATAHOLD_SKEW 45
Ed Swierkd39aad92008-08-28 18:23:58 +0000122#define SPD_PLL_RELOCK_TIME 46 /* PLL relock time */
Uwe Hermann998a57c2006-11-22 11:41:32 +0000123#define SPD_SPD_DATA_REVISION_CODE 62 /* SPD data revision code */
124#define SPD_CHECKSUM_FOR_BYTES_0_TO_62 63 /* Checksum for bytes 0-62 */
Lee Leahy6a566d72017-03-07 17:45:12 -0800125/* Manufacturer's JEDEC ID code, per EIA/JEP106 (bytes 64-71) */
126#define SPD_MANUFACTURER_JEDEC_ID_CODE 64
Uwe Hermann998a57c2006-11-22 11:41:32 +0000127#define SPD_MANUFACTURING_LOCATION 72 /* Manufacturing location */
Lee Leahy6a566d72017-03-07 17:45:12 -0800128/* Manufacturer's part number, in 6-bit ASCII (bytes 73-90) */
129#define SPD_MANUFACTURER_PART_NUMBER 73
Uwe Hermann998a57c2006-11-22 11:41:32 +0000130#define SPD_REVISION_CODE 91 /* Revision code (bytes 91-92) */
Lee Leahy6a566d72017-03-07 17:45:12 -0800131/* Manufacturing date (byte 93: year, byte 94: week) */
132#define SPD_MANUFACTURING_DATE 93
133/* Assembly serial number (bytes 95-98) */
134#define SPD_ASSEMBLY_SERIAL_NUMBER 95
135/* Manufacturer specific data (bytes 99-125) */
136#define SPD_MANUFACTURER_SPECIFIC_DATA 99
137/* Intel specification for frequency */
138#define SPD_INTEL_SPEC_FOR_FREQUENCY 126
139/* Intel specification details for 100MHz support */
140#define SPD_INTEL_SPEC_100_MHZ 127
Stefan Reinauereca92fb2006-08-23 14:28:37 +0000141
Marc Jonesbc8176c2007-05-04 18:24:55 +0000142/* DRAM specifications use the following naming conventions for SPD locations */
143#define SPD_tRP SPD_MIN_ROW_PRECHARGE_TIME
144#define SPD_tRRD SPD_MIN_ROWACTIVE_TO_ROWACTIVE
145#define SPD_tRCD SPD_MIN_RAS_TO_CAS_DELAY
146#define SPD_tRAS SPD_MIN_ACTIVE_TO_PRECHARGE_DELAY
147#define SPD_BANK_DENSITY SPD_DENSITY_OF_EACH_ROW_ON_MODULE
148#define SPD_ADDRESS_CMD_HOLD SPD_CMD_SIGNAL_INPUT_HOLD_TIME
Lee Leahy6a566d72017-03-07 17:45:12 -0800149/* SDRAM Device Minimum Active to Active/Auto Refresh Time (tRC) */
150#define SPD_tRC 41
151/* SDRAM Device Minimum Auto Refresh to Active/Auto Refresh (tRFC) */
152#define SPD_tRFC 42
Marc Jonesbc8176c2007-05-04 18:24:55 +0000153
154
Uwe Hermann998a57c2006-11-22 11:41:32 +0000155/* SPD_MEMORY_TYPE values. */
Alexandru Gagniuc32610462013-05-21 14:07:41 -0500156enum spd_memory_type {
157 SPD_MEMORY_TYPE_UNDEFINED = 0x00,
158 SPD_MEMORY_TYPE_FPM_DRAM = 0x01,
159 SPD_MEMORY_TYPE_EDO = 0x02,
160 SPD_MEMORY_TYPE_PIPELINED_NIBBLE = 0x03,
161 SPD_MEMORY_TYPE_SDRAM = 0x04,
162 SPD_MEMORY_TYPE_MULTIPLEXED_ROM = 0x05,
163 SPD_MEMORY_TYPE_SGRAM_DDR = 0x06,
164 SPD_MEMORY_TYPE_SDRAM_DDR = 0x07,
165 SPD_MEMORY_TYPE_SDRAM_DDR2 = 0x08,
166 SPD_MEMORY_TYPE_FBDIMM_DDR2 = 0x09,
167 SPD_MEMORY_TYPE_FB_PROBE_DDR2 = 0x0a,
168 SPD_MEMORY_TYPE_SDRAM_DDR3 = 0x0b,
Elyes HAOUASed3ccc22016-06-20 18:57:19 +0200169 SPD_MEMORY_TYPE_DDR4_SDRAM = 0x0c,
170 SPD_MEMORY_TYPE_DDR4E_SDRAM = 0x0e,
171 SPD_MEMORY_TYPE_LPDDR3_SDRAM = 0x0f,
172 SPD_MEMORY_TYPE_LPDDR4_SDRAM = 0x10,
Alexandru Gagniuc32610462013-05-21 14:07:41 -0500173};
Stefan Reinauereca92fb2006-08-23 14:28:37 +0000174
Uwe Hermann998a57c2006-11-22 11:41:32 +0000175/* SPD_MODULE_VOLTAGE values. */
176#define SPD_VOLTAGE_TTL 0 /* 5.0 Volt/TTL */
177#define SPD_VOLTAGE_LVTTL 1 /* LVTTL */
178#define SPD_VOLTAGE_HSTL 2 /* HSTL 1.5 */
179#define SPD_VOLTAGE_SSTL3 3 /* SSTL 3.3 */
180#define SPD_VOLTAGE_SSTL2 4 /* SSTL 2.5 */
Elyes HAOUAS46bfce32016-06-15 19:05:11 +0200181#define SPD_VOLTAGE_SSTL1 5 /* SSTL 1.8 */
Stefan Reinauereca92fb2006-08-23 14:28:37 +0000182
Uwe Hermann998a57c2006-11-22 11:41:32 +0000183/* SPD_DIMM_CONFIG_TYPE values. */
184#define ERROR_SCHEME_NONE 0
185#define ERROR_SCHEME_PARITY 1
186#define ERROR_SCHEME_ECC 2
Stefan Reinauereca92fb2006-08-23 14:28:37 +0000187
Uwe Hermann998a57c2006-11-22 11:41:32 +0000188/* SPD_ACCEPTABLE_CAS_LATENCIES values. */
189// TODO: Check values.
190#define SPD_CAS_LATENCY_1_0 0x01
191#define SPD_CAS_LATENCY_1_5 0x02
192#define SPD_CAS_LATENCY_2_0 0x04
193#define SPD_CAS_LATENCY_2_5 0x08
194#define SPD_CAS_LATENCY_3_0 0x10
195#define SPD_CAS_LATENCY_3_5 0x20
196#define SPD_CAS_LATENCY_4_0 0x40
Stefan Reinauereca92fb2006-08-23 14:28:37 +0000197
Elyes HAOUAS89186b22016-06-26 17:46:21 +0200198#define SPD_CAS_LATENCY_DDR2_2 (1 << 2)
Stefan Reinauer951c62f2008-08-01 11:40:16 +0000199#define SPD_CAS_LATENCY_DDR2_3 (1 << 3)
200#define SPD_CAS_LATENCY_DDR2_4 (1 << 4)
201#define SPD_CAS_LATENCY_DDR2_5 (1 << 5)
202#define SPD_CAS_LATENCY_DDR2_6 (1 << 6)
Elyes HAOUASd4506092016-05-26 19:53:29 +0200203#define SPD_CAS_LATENCY_DDR2_7 (1 << 7)
Stefan Reinauer951c62f2008-08-01 11:40:16 +0000204
Uwe Hermann998a57c2006-11-22 11:41:32 +0000205/* SPD_SUPPORTED_BURST_LENGTHS values. */
206#define SPD_BURST_LENGTH_1 1
207#define SPD_BURST_LENGTH_2 2
208#define SPD_BURST_LENGTH_4 4
209#define SPD_BURST_LENGTH_8 8
210#define SPD_BURST_LENGTH_PAGE (1 << 7)
Stefan Reinauereca92fb2006-08-23 14:28:37 +0000211
Uwe Hermann998a57c2006-11-22 11:41:32 +0000212/* SPD_MODULE_ATTRIBUTES values. */
213#define MODULE_BUFFERED 1
214#define MODULE_REGISTERED 2
Stefan Reinauereca92fb2006-08-23 14:28:37 +0000215
Patrick Georgi9bd9a902010-11-20 10:31:00 +0000216/* DIMM SPD addresses */
217#define DIMM0 0x50
218#define DIMM1 0x51
219#define DIMM2 0x52
220#define DIMM3 0x53
221#define DIMM4 0x54
222#define DIMM5 0x55
223#define DIMM6 0x56
224#define DIMM7 0x57
225
Uwe Hermannd773fd32010-11-20 20:23:08 +0000226#define RC00 0
227#define RC01 1
228#define RC02 2
229#define RC03 3
230#define RC04 4
231#define RC05 5
232#define RC06 6
233#define RC07 7
234#define RC08 8
235#define RC09 9
236#define RC10 10
237#define RC11 11
238#define RC12 12
239#define RC13 13
240#define RC14 14
241#define RC15 15
242#define RC16 16
243#define RC17 17
244#define RC18 18
245#define RC19 19
246#define RC20 20
247#define RC21 21
248#define RC22 22
249#define RC23 23
250#define RC24 24
251#define RC25 25
252#define RC26 26
253#define RC27 27
254#define RC28 28
255#define RC29 29
256#define RC30 30
257#define RC31 31
Stefan Reinauereca92fb2006-08-23 14:28:37 +0000258
Uwe Hermannd773fd32010-11-20 20:23:08 +0000259#define RC32 32
260#define RC33 33
261#define RC34 34
262#define RC35 35
263#define RC36 36
264#define RC37 37
265#define RC38 38
266#define RC39 39
267#define RC40 40
268#define RC41 41
269#define RC42 42
270#define RC43 43
271#define RC44 44
272#define RC45 45
273#define RC46 46
274#define RC47 47
275#define RC48 48
276#define RC49 49
277#define RC50 50
278#define RC51 51
279#define RC52 52
280#define RC53 53
281#define RC54 54
282#define RC55 55
283#define RC56 56
284#define RC57 57
285#define RC58 58
286#define RC59 59
287#define RC60 60
288#define RC61 61
289#define RC62 62
290#define RC63 63
291
Elyes HAOUASc8d24dd2016-06-15 21:13:07 +0200292/* Byte 20: DIMM type information */
293#define SPD_UNDEFINED 0x00
294#define SPD_RDIMM 0x01
295#define SPD_UDIMM 0x02
296#define SPD_SODIMM 0x04
297#define SPD_72B_SO_CDIMM 0x06
298#define SPD_72B_SO_RDIMM 0x07
299#define SPD_MICRO_DIMM 0x08
300#define SPD_MINI_RDIMM 0x10
301#define SPD_MINI_UDIMM 0x20
Kane Chen33faac62014-07-27 12:54:44 -0700302
Uwe Hermannd773fd32010-11-20 20:23:08 +0000303#endif