coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
ddr3.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 /*
4  * JEDEC Standard No. 21-C
5  * Annex K: Serial Presence Detect (SPD) for DDR3 SDRAM Modules 2014
6  * http://www.jedec.org/sites/default/files/docs/4_01_02_11R24.pdf
7  */
8 
9 #ifndef DEVICE_DRAM_DDR3L_H
10 #define DEVICE_DRAM_DDR3L_H
11 
12 /**
13  * @file ddr3.h
14  *
15  * \brief Utilities for decoding DDR3 SPDs
16  */
17 
18 #include <spd.h>
19 #include <device/dram/common.h>
20 #include <types.h>
21 
22 /**
23  * Convenience definitions for SPD offsets
24  *
25  * @{
26  */
27 #define SPD_DIMM_MOD_ID1 117
28 #define SPD_DIMM_MOD_ID2 118
29 #define SPD_DIMM_SERIAL_NUM 122
30 #define SPD_DIMM_SERIAL_LEN 4
31 #define SPD_DIMM_PART_NUM 128
32 #define SPD_DIMM_PART_LEN 18
33 /** @} */
34 
35 /*
36  * Module type (byte 3, bits 3:0) of SPD
37  * This definition is specific to DDR3. DDR2 SPDs have a different structure.
38  */
54  /* Masks to bits 3:0 to give the dimm type */
56 };
57 
58 /**
59  * \brief DIMM flags
60  *
61  * Characteristic flags for the DIMM, as presented by the SPD
62  */
64  /* The whole point of the union/struct construct is to allow us to clear
65  * all the bits with one line: flags.raw = 0.
66  * We do not care how these bits are ordered */
67  struct {
68  /* Indicates if rank 1 of DIMM uses a mirrored pin mapping. See:
69  * Annex K: Serial Presence Detect (SPD) for DDR3 SDRAM */
70  unsigned int pins_mirrored:1;
71  /* Module can work at 1.50V - All DIMMS must be 1.5V operable */
72  unsigned int operable_1_50V:1;
73  /* Module can work at 1.35V */
74  unsigned int operable_1_35V:1;
75  /* Module can work at 1.20V */
76  unsigned int operable_1_25V:1;
77  /* Has an 8-bit bus extension, meaning the DIMM supports ECC */
78  unsigned int is_ecc:1;
79  /* DLL-Off Mode Support */
80  unsigned int dll_off_mode:1;
81  /* Indicates a drive strength of RZQ/6 (40 Ohm) is supported */
82  unsigned int rzq6_supported:1;
83  /* Indicates a drive strength of RZQ/7 (35 Ohm) is supported */
84  unsigned int rzq7_supported:1;
85  /* Partial Array Self Refresh */
86  unsigned int pasr:1;
87  /* On-die Thermal Sensor Readout */
88  unsigned int odts:1;
89  /* Auto Self Refresh */
90  unsigned int asr:1;
91  /* Extended temperature range supported */
92  unsigned int ext_temp_range:1;
93  /* Operating at extended temperature requires 2X refresh rate */
94  unsigned int ext_temp_refresh:1;
95  /* Thermal sensor incorporated */
96  unsigned int therm_sensor:1;
97  };
98  unsigned int raw;
99 };
100 
101 /**
102  * \brief DIMM characteristics
103  *
104  * The characteristics of each DIMM, as presented by the SPD
105  */
110  /* Flags extracted from SPD */
112  /* SDRAM width */
114  /* Number of ranks */
116  /* Number or row address bits */
118  /* Number or column address bits */
120  /* Size of module in MiB */
122  /* Latencies are in units of 1/256 ns */
137 
139  /* XMP: Module voltage in mV */
141  /* XMP: max DIMMs per channel supported (1-4) */
143  /* Manufacturer ID */
145  /* ASCII part number - NULL terminated */
147  /* Serial number */
149 };
150 
154 };
155 
156 typedef u8 spd_raw_data[256];
157 
158 u16 spd_ddr3_calc_crc(u8 *spd, int len);
159 u16 spd_ddr3_calc_unique_crc(u8 *spd, int len);
162 void dram_print_spd_ddr3(const struct dimm_attr_ddr3_st *dimm);
163 int spd_xmp_decode_ddr3(struct dimm_attr_ddr3_st *dimm,
164  spd_raw_data spd,
165  enum ddr3_xmp_profile profile);
166 enum cb_err spd_add_smbios17(const u8 channel, const u8 slot,
167  const u16 selected_freq,
168  const struct dimm_attr_ddr3_st *info);
169 
170 #endif /* DEVICE_DRAM_DDR3L_H */
cb_err
coreboot error codes
Definition: cb_err.h:15
static struct smmstore_params_info info
Definition: ramstage.c:12
spd_dimm_type_ddr3
Definition: ddr3.h:39
@ SPD_DDR3_DIMM_TYPE_SO_DIMM
Definition: ddr3.h:43
@ SPD_DDR3_DIMM_TYPE_72B_SO_CDIMM
Definition: ddr3.h:50
@ SPD_DDR3_DIMM_TYPE_LRDIMM
Definition: ddr3.h:51
@ SPD_DDR3_DIMM_TYPE_72B_SO_UDIMM
Definition: ddr3.h:48
@ SPD_DDR3_DIMM_TYPE_32B_SO_DIMM
Definition: ddr3.h:53
@ SPD_DDR3_DIMM_TYPE_16B_SO_DIMM
Definition: ddr3.h:52
@ SPD_DDR3_DIMM_TYPE_72B_SO_RDIMM
Definition: ddr3.h:49
@ SPD_DDR3_DIMM_TYPE_MINI_RDIMM
Definition: ddr3.h:45
@ SPD_DDR3_DIMM_TYPE_MICRO_DIMM
Definition: ddr3.h:44
@ SPD_DDR3_DIMM_TYPE_MINI_UDIMM
Definition: ddr3.h:46
@ SPD_DDR3_DIMM_TYPE_MASK
Definition: ddr3.h:55
@ SPD_DDR3_DIMM_TYPE_UNDEFINED
Definition: ddr3.h:40
@ SPD_DDR3_DIMM_TYPE_RDIMM
Definition: ddr3.h:41
@ SPD_DDR3_DIMM_TYPE_UDIMM
Definition: ddr3.h:42
@ SPD_DDR3_DIMM_TYPE_MINI_CDIMM
Definition: ddr3.h:47
int spd_dimm_is_registered_ddr3(enum spd_dimm_type_ddr3 type)
Checks if the DIMM is Registered based on byte[3] of the SPD.
Definition: ddr3.c:30
enum cb_err spd_add_smbios17(const u8 channel, const u8 slot, const u16 selected_freq, const struct dimm_attr_ddr3_st *info)
Fill cbmem with information for SMBIOS type 17.
Definition: ddr3.c:506
ddr3_xmp_profile
Definition: ddr3.h:151
@ DDR3_XMP_PROFILE_2
Definition: ddr3.h:153
@ DDR3_XMP_PROFILE_1
Definition: ddr3.h:152
void dram_print_spd_ddr3(const struct dimm_attr_ddr3_st *dimm)
Print the info in DIMM.
Definition: ddr3.c:600
int spd_xmp_decode_ddr3(struct dimm_attr_ddr3_st *dimm, spd_raw_data spd, enum ddr3_xmp_profile profile)
Decode the raw SPD XMP data.
Definition: ddr3.c:397
u16 spd_ddr3_calc_crc(u8 *spd, int len)
Calculate the CRC of a DDR3 SPD.
Definition: ddr3.c:48
u16 spd_ddr3_calc_unique_crc(u8 *spd, int len)
Calculate the CRC of a DDR3 SPD unique identifier.
Definition: ddr3.c:74
#define SPD_DIMM_SERIAL_LEN
Definition: ddr3.h:30
u8 spd_raw_data[256]
Definition: ddr3.h:156
int spd_decode_ddr3(struct dimm_attr_ddr3_st *dimm, spd_raw_data spd_data)
Decode the raw SPD data.
Definition: ddr3.c:101
spd_memory_type
Definition: spd.h:140
unsigned int type
Definition: edid.c:57
static u8 spd_data[CONFIG_DIMM_MAX *CONFIG_DIMM_SPD_SIZE]
Definition: smbuslib.c:70
uint32_t u32
Definition: stdint.h:51
uint16_t u16
Definition: stdint.h:48
uint8_t u8
Definition: stdint.h:45
DIMM characteristics.
Definition: ddr3.h:106
union dimm_flags_ddr3_st flags
Definition: ddr3.h:111
u16 cas_supported
Definition: ddr3.h:109
enum spd_memory_type dram_type
Definition: ddr3.h:107
u16 manufacturer_id
Definition: ddr3.h:144
u8 serial[SPD_DIMM_SERIAL_LEN]
Definition: ddr3.h:148
u8 dimms_per_channel
Definition: ddr3.h:142
u8 reference_card
Definition: ddr3.h:138
u8 part_number[17]
Definition: ddr3.h:146
enum spd_dimm_type_ddr3 dimm_type
Definition: ddr3.h:108
DIMM flags.
Definition: ddr3.h:63
unsigned int raw
Definition: ddr3.h:98
unsigned int rzq7_supported
Definition: ddr3.h:84
unsigned int is_ecc
Definition: ddr3.h:78
unsigned int asr
Definition: ddr3.h:90
unsigned int operable_1_25V
Definition: ddr3.h:76
unsigned int rzq6_supported
Definition: ddr3.h:82
unsigned int operable_1_50V
Definition: ddr3.h:72
unsigned int pins_mirrored
Definition: ddr3.h:70
unsigned int odts
Definition: ddr3.h:88
unsigned int dll_off_mode
Definition: ddr3.h:80
unsigned int operable_1_35V
Definition: ddr3.h:74
unsigned int ext_temp_range
Definition: ddr3.h:92
unsigned int pasr
Definition: ddr3.h:86
unsigned int therm_sensor
Definition: ddr3.h:96
unsigned int ext_temp_refresh
Definition: ddr3.h:94