1
2
3
4
5
6#ifndef _MV_DDR_SPD_H
7#define _MV_DDR_SPD_H
8
9#include "mv_ddr_topology.h"
10
11
12
13
14
15
16
17#define MV_DDR_SPD_DATA_BLOCK0_SIZE 128
18
19#define MV_DDR_SPD_DATA_BLOCK1M_SIZE 64
20
21#define MV_DDR_SPD_DATA_BLOCK1H_SIZE 64
22
23#define MV_DDR_SPD_DATA_BLOCK2E_SIZE 64
24
25#define MV_DDR_SPD_DATA_BLOCK2M_SIZE 64
26
27#define MV_DDR_SPD_DATA_BLOCK3_SIZE 128
28
29#define MV_DDR_SPD_DEV_TYPE_DDR4 0xc
30#define MV_DDR_SPD_MODULE_TYPE_UDIMM 0x2
31#define MV_DDR_SPD_MODULE_TYPE_SO_DIMM 0x3
32#define MV_DDR_SPD_MODULE_TYPE_MINI_UDIMM 0x6
33#define MV_DDR_SPD_MODULE_TYPE_72BIT_SO_UDIMM 0x9
34#define MV_DDR_SPD_MODULE_TYPE_16BIT_SO_DIMM 0xc
35#define MV_DDR_SPD_MODULE_TYPE_32BIT_SO_DIMM 0xd
36
37
38
39
40
41union mv_ddr_spd_data {
42 unsigned char all_bytes[MV_DDR_SPD_DATA_BLOCK0_SIZE +
43 MV_DDR_SPD_DATA_BLOCK1M_SIZE];
44 struct {
45
46 union {
47 unsigned char all_bits;
48 struct {
49 unsigned char spd_bytes_used:4,
50 spd_bytes_total:3,
51 reserved:1;
52 } bit_fields;
53 } byte_0;
54 union {
55 unsigned char all_bits;
56 struct {
57 unsigned char addtions_level:4,
58 encoding_level:4;
59 } bit_fields;
60 } byte_1;
61 unsigned char byte_2;
62 union {
63 unsigned char all_bits;
64 struct {
65 unsigned char module_type:4,
66 hybrid_media:3,
67 hybrid:1;
68 } bit_fields;
69 } byte_3;
70 union {
71 unsigned char all_bits;
72 struct {
73 unsigned char die_capacity:4,
74 bank_address:2,
75 bank_group:2;
76 } bit_fields;
77 } byte_4;
78 union {
79 unsigned char all_bits;
80 struct {
81 unsigned char col_address:3,
82 row_address:3,
83 reserved:2;
84 } bit_fields;
85 } byte_5;
86 union {
87 unsigned char all_bits;
88 struct {
89 unsigned char signal_loading:2,
90 reserved:2,
91 die_count:3,
92 sdram_package_type:1;
93 } bit_fields;
94 } byte_6;
95 union {
96 unsigned char all_bits;
97 struct {
98 unsigned char mac:4,
99 t_maw:2,
100 reserved:2;
101 } bit_fields;
102 } byte_7;
103 unsigned char byte_8;
104 union {
105 unsigned char all_bits;
106 struct {
107 unsigned char reserved:5,
108 soft_ppr:1,
109 ppr:2;
110 } bit_fields;
111 } byte_9;
112 union {
113 unsigned char all_bits;
114 struct {
115 unsigned char signal_loading:2,
116 density_ratio:2,
117 die_count:3,
118 sdram_package_type:1;
119 } bit_fields;
120 } byte_10;
121 union {
122 unsigned char all_bits;
123 struct {
124 unsigned char operable:1,
125 endurant:1,
126 reserved:5;
127 } bit_fields;
128 } byte_11;
129 union {
130 unsigned char all_bits;
131 struct {
132 unsigned char device_width:3,
133 dimm_pkg_ranks_num:3,
134 rank_mix:1,
135 reserved:1;
136 } bit_fields;
137 } byte_12;
138 union {
139 unsigned char all_bits;
140 struct {
141 unsigned char primary_bus_width:3,
142 bus_width_ext:2,
143 reserved:3;
144 } bit_fields;
145 } byte_13;
146 union {
147 unsigned char all_bits;
148 struct {
149 unsigned char reserved:7,
150 thermal_sensor:1;
151 } bit_fields;
152 } byte_14;
153 union {
154 unsigned char all_bits;
155 struct {
156 unsigned char ext_base_module_type:4,
157 reserved:4;
158 } bit_fields;
159 } byte_15;
160 unsigned char byte_16;
161 union {
162 unsigned char all_bits;
163 struct {
164 unsigned char ftb:2,
165 mtb:2,
166 reserved:4;
167 } bit_fields;
168 } byte_17;
169 unsigned char byte_18;
170 unsigned char byte_19;
171 unsigned char byte_20;
172 unsigned char byte_21;
173 unsigned char byte_22;
174 unsigned char byte_23;
175 unsigned char byte_24;
176 unsigned char byte_25;
177 unsigned char byte_26;
178 union {
179 unsigned char all_bits;
180 struct {
181 unsigned char t_ras_min_msn:4,
182 t_rc_min_msn:4;
183 } bit_fields;
184 } byte_27;
185 unsigned char byte_28;
186 unsigned char byte_29;
187 unsigned char byte_30;
188 unsigned char byte_31;
189 unsigned char byte_32;
190 unsigned char byte_33;
191 unsigned char byte_34;
192 unsigned char byte_35;
193 union {
194 unsigned char all_bits;
195 struct {
196 unsigned char t_faw_min_msn:4,
197 reserved:4;
198 } bit_fields;
199 } byte_36;
200 unsigned char byte_37;
201
202 unsigned char byte_38;
203
204 unsigned char byte_39;
205 unsigned char byte_40;
206 union {
207 unsigned char all_bits;
208 struct {
209 unsigned char t_wr_min_msn:4,
210 reserved:4;
211 } bit_fields;
212 } byte_41;
213 unsigned char byte_42;
214 union {
215 unsigned char all_bits;
216 struct {
217 unsigned char t_wtr_s_min_msn:4,
218 t_wtr_l_min_msn:4;
219 } bit_fields;
220 } byte_43;
221 unsigned char byte_44;
222 unsigned char byte_45;
223 unsigned char bytes_46_59[14];
224 unsigned char bytes_60_77[18];
225 unsigned char bytes_78_116[39];
226
227 unsigned char byte_117;
228
229 unsigned char byte_118;
230
231 unsigned char byte_119;
232
233 unsigned char byte_120;
234 unsigned char byte_121;
235 unsigned char byte_122;
236 unsigned char byte_123;
237 unsigned char byte_124;
238 unsigned char byte_125;
239 unsigned char byte_126;
240 unsigned char byte_127;
241
242
243
244 union {
245 unsigned char all_bits;
246 struct {
247 unsigned char nom_height_max:5,
248 raw_cad_ext:3;
249 } bit_fields;
250 } byte_128;
251 union {
252 unsigned char all_bits;
253 struct {
254 unsigned char front_thickness_max:4,
255 back_thickness_max:4;
256 } bit_fields;
257 } byte_129;
258 union {
259 unsigned char all_bits;
260 struct {
261 unsigned char ref_raw_card:5,
262 ref_raw_card_rev:2,
263 ref_raw_card_ext:1;
264 } bit_fields;
265 } byte_130;
266 union {
267 unsigned char all_bits;
268 struct {
269 unsigned char rank_1_mapping:1,
270 reserved:7;
271 } bit_fields;
272 } byte_131;
273 unsigned char bytes_132_191[60];
274 } byte_fields;
275};
276
277int mv_ddr_spd_timing_calc(union mv_ddr_spd_data *spd_data, unsigned int timing_data[]);
278enum mv_ddr_dev_width mv_ddr_spd_dev_width_get(union mv_ddr_spd_data *spd_data);
279enum mv_ddr_die_capacity mv_ddr_spd_die_capacity_get(union mv_ddr_spd_data *spd_data);
280unsigned char mv_ddr_spd_mem_mirror_get(union mv_ddr_spd_data *spd_data);
281unsigned char mv_ddr_spd_cs_bit_mask_get(union mv_ddr_spd_data *spd_data);
282unsigned char mv_ddr_spd_dev_type_get(union mv_ddr_spd_data *spd_data);
283unsigned char mv_ddr_spd_module_type_get(union mv_ddr_spd_data *spd_data);
284int mv_ddr_spd_supported_cls_calc(union mv_ddr_spd_data *spd_data);
285unsigned int mv_ddr_spd_supported_cl_get(unsigned int cl);
286enum mv_ddr_pkg_rank mv_ddr_spd_pri_bus_width_get(union mv_ddr_spd_data *spd_data);
287enum mv_ddr_pkg_rank mv_ddr_spd_bus_width_ext_get(union mv_ddr_spd_data *spd_data);
288
289#endif
290