coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
raminit.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <console/console.h>
4 #include <commonlib/region.h>
5 #include <cf9_reset.h>
6 #include <string.h>
7 #include <arch/cpu.h>
8 #include <device/mmio.h>
9 #include <device/pci_ops.h>
10 #include <device/smbus_host.h>
11 #include <cbmem.h>
12 #include <timestamp.h>
13 #include <mrc_cache.h>
16 #include <cpu/x86/msr.h>
17 #include <types.h>
18 
19 #include "raminit_native.h"
20 #include "raminit_common.h"
21 #include "sandybridge.h"
22 
23 /* FIXME: no support for 3-channel chipsets */
24 
25 static void wait_txt_clear(void)
26 {
27  struct cpuid_result cp = cpuid_ext(1, 0);
28 
29  /* Check if TXT is supported */
30  if (!(cp.ecx & (1 << 6)))
31  return;
32 
33  /* Some TXT public bit */
34  if (!(read32((void *)0xfed30010) & 1))
35  return;
36 
37  /* Wait for TXT clear */
38  while (!(read8((void *)0xfed40000) & (1 << 7)))
39  ;
40 }
41 
42 /* Disable a channel in ramctr_timing */
43 static void disable_channel(ramctr_timing *ctrl, int channel)
44 {
45  ctrl->rankmap[channel] = 0;
46 
47  memset(&ctrl->rank_mirror[channel][0], 0, sizeof(ctrl->rank_mirror[0]));
48 
49  ctrl->channel_size_mb[channel] = 0;
50  ctrl->cmd_stretch[channel] = 0;
51  ctrl->mad_dimm[channel] = 0;
52  memset(&ctrl->timings[channel][0], 0, sizeof(ctrl->timings[0]));
53  memset(&ctrl->info.dimm[channel][0], 0, sizeof(ctrl->info.dimm[0]));
54 }
55 
56 static uint8_t nb_get_ecc_type(const uint32_t capid0_a)
57 {
59 }
60 
61 static uint16_t nb_slots_per_channel(const uint32_t capid0_a)
62 {
63  return !(capid0_a & CAPID_DDPCD) + 1;
64 }
65 
66 static uint16_t nb_number_of_channels(const uint32_t capid0_a)
67 {
68  return !(capid0_a & CAPID_PDCD) + 1;
69 }
70 
72 {
73  uint32_t ddrsz;
74 
75  /* Values from documentation, which assume two DIMMs per channel */
76  switch (CAPID_DDRSZ(capid0_a)) {
77  case 1:
78  ddrsz = 8192;
79  break;
80  case 2:
81  ddrsz = 2048;
82  break;
83  case 3:
84  ddrsz = 512;
85  break;
86  default:
87  ddrsz = 16384;
88  break;
89  }
90 
91  /* Account for the maximum number of DIMMs per channel */
92  return (ddrsz / 2) * nb_slots_per_channel(capid0_a);
93 }
94 
95 /* Fill cbmem with information for SMBIOS type 16 and type 17 */
97 {
98  int channel, slot;
99  const u16 ddr_freq = (1000 << 8) / ctrl->tCK;
100 
101  FOR_ALL_CHANNELS for (slot = 0; slot < NUM_SLOTS; slot++) {
102  enum cb_err ret = spd_add_smbios17(channel, slot, ddr_freq,
103  &ctrl->info.dimm[channel][slot]);
104  if (ret != CB_SUCCESS)
105  printk(BIOS_ERR, "RAMINIT: Failed to add SMBIOS17\n");
106  }
107 
108  /* The 'spd_add_smbios17' function allocates this CBMEM area */
110  if (m == NULL)
111  return;
112 
113  const uint32_t capid0_a = pci_read_config32(HOST_BRIDGE, CAPID0_A);
114 
115  const uint16_t channels = nb_number_of_channels(capid0_a);
116 
117  m->ecc_type = nb_get_ecc_type(capid0_a);
118  m->max_capacity_mib = channels * nb_max_chan_capacity_mib(capid0_a);
119  m->number_of_devices = channels * nb_slots_per_channel(capid0_a);
120 }
121 
122 /* Return CRC16 match for all SPDs */
124 {
125  int channel, slot, spd_slot;
126  int match = 1;
127 
129  for (slot = 0; slot < NUM_SLOTS; slot++) {
130  spd_slot = 2 * channel + slot;
131  match &= ctrl->spd_crc[channel][slot] ==
132  spd_ddr3_calc_unique_crc(spd[spd_slot], sizeof(spd_raw_data));
133  }
134  }
135  return match;
136 }
137 
138 void read_spd(spd_raw_data * spd, u8 addr, bool id_only)
139 {
140  int j;
141  if (id_only) {
142  for (j = 117; j < 128; j++)
143  (*spd)[j] = smbus_read_byte(addr, j);
144  } else {
145  for (j = 0; j < 256; j++)
146  (*spd)[j] = smbus_read_byte(addr, j);
147  }
148 }
149 
151 {
152  int dimms = 0, ch_dimms;
153  int channel, slot, spd_slot;
154  bool can_use_ecc = ctrl->ecc_supported;
155 
156  memset (ctrl->rankmap, 0, sizeof(ctrl->rankmap));
157 
158  ctrl->extended_temperature_range = 1;
159  ctrl->auto_self_refresh = 1;
160 
162  ctrl->channel_size_mb[channel] = 0;
163 
164  ch_dimms = 0;
165  /* Count dimms on channel */
166  for (slot = 0; slot < NUM_SLOTS; slot++) {
167  spd_slot = 2 * channel + slot;
168 
169  if (spd[spd_slot][SPD_MEMORY_TYPE] == SPD_MEMORY_TYPE_SDRAM_DDR3)
170  ch_dimms++;
171  }
172 
173  for (slot = 0; slot < NUM_SLOTS; slot++) {
174  spd_slot = 2 * channel + slot;
175  printk(BIOS_DEBUG, "SPD probe channel%d, slot%d\n", channel, slot);
176 
177  struct dimm_attr_ddr3_st *const dimm = &ctrl->info.dimm[channel][slot];
178 
179  /* Search for XMP profile */
180  spd_xmp_decode_ddr3(dimm, spd[spd_slot],
182 
183  if (dimm->dram_type != SPD_MEMORY_TYPE_SDRAM_DDR3) {
184  printram("No valid XMP profile found.\n");
185  spd_decode_ddr3(dimm, spd[spd_slot]);
186 
187  } else if (ch_dimms > dimm->dimms_per_channel) {
188  printram(
189  "XMP profile supports %u DIMMs, but %u DIMMs are installed.\n",
190  dimm->dimms_per_channel, ch_dimms);
191 
192  if (CONFIG(NATIVE_RAMINIT_IGNORE_XMP_MAX_DIMMS))
194  "XMP maximum DIMMs will be ignored.\n");
195  else
196  spd_decode_ddr3(dimm, spd[spd_slot]);
197 
198  } else if (dimm->voltage != 1500) {
199  /* TODO: Support DDR3 voltages other than 1500mV */
200  printram("XMP profile's requested %u mV is unsupported.\n",
201  dimm->voltage);
202 
203  if (CONFIG(NATIVE_RAMINIT_IGNORE_XMP_REQUESTED_VOLTAGE))
205  "XMP requested voltage will be ignored.\n");
206  else
207  spd_decode_ddr3(dimm, spd[spd_slot]);
208  }
209 
210  /* Fill in CRC16 for MRC cache */
211  ctrl->spd_crc[channel][slot] =
212  spd_ddr3_calc_unique_crc(spd[spd_slot], sizeof(spd_raw_data));
213 
214  if (dimm->dram_type != SPD_MEMORY_TYPE_SDRAM_DDR3) {
215  /* Mark DIMM as invalid */
216  dimm->ranks = 0;
217  dimm->size_mb = 0;
218  continue;
219  }
220 
221  dram_print_spd_ddr3(dimm);
222  dimms++;
223  ctrl->rank_mirror[channel][slot * 2] = 0;
224  ctrl->rank_mirror[channel][slot * 2 + 1] = dimm->flags.pins_mirrored;
225 
226  ctrl->channel_size_mb[channel] += dimm->size_mb;
227 
228  if (!dimm->flags.is_ecc)
229  can_use_ecc = false;
230 
231  ctrl->auto_self_refresh &= dimm->flags.asr;
232 
234 
235  ctrl->rankmap[channel] |= ((1 << dimm->ranks) - 1) << (2 * slot);
236 
237  printk(BIOS_DEBUG, "channel[%d] rankmap = 0x%x\n", channel,
238  ctrl->rankmap[channel]);
239  }
240 
241  const u8 rc_0 = ctrl->info.dimm[channel][0].reference_card;
242  const u8 rc_1 = ctrl->info.dimm[channel][1].reference_card;
243 
244  if (ch_dimms == NUM_SLOTS && rc_0 < 6 && rc_1 < 6) {
245  const int ref_card_offset_table[6][6] = {
246  { 0, 0, 0, 0, 2, 2 },
247  { 0, 0, 0, 0, 2, 2 },
248  { 0, 0, 0, 0, 2, 2 },
249  { 0, 0, 0, 0, 1, 1 },
250  { 2, 2, 2, 1, 0, 0 },
251  { 2, 2, 2, 1, 0, 0 },
252  };
253  ctrl->ref_card_offset[channel] = ref_card_offset_table[rc_0][rc_1];
254  } else {
255  ctrl->ref_card_offset[channel] = 0;
256  }
257  }
258 
259  if (ctrl->ecc_forced || CONFIG(RAMINIT_ENABLE_ECC))
260  ctrl->ecc_enabled = can_use_ecc;
261  if (ctrl->ecc_forced && !ctrl->ecc_enabled)
262  die("ECC mode forced but non-ECC DIMM installed!");
263  printk(BIOS_DEBUG, "ECC is %s\n", ctrl->ecc_enabled ? "enabled" : "disabled");
264 
265  ctrl->lanes = ctrl->ecc_enabled ? 9 : 8;
266 
267  if (!dimms)
268  die("No DIMMs were found");
269 }
270 
271 static void save_timings(ramctr_timing *ctrl)
272 {
273  /* Save the MRC S3 restore data to cbmem */
275 }
276 
277 static void reinit_ctrl(ramctr_timing *ctrl, const u32 cpuid)
278 {
279  /* Reset internal state */
280  memset(ctrl, 0, sizeof(*ctrl));
281 
282  /* Get architecture */
283  ctrl->cpu = cpuid;
284 
285  /* Get ECC support and mode */
287  ctrl->ecc_supported = ctrl->ecc_forced || get_host_ecc_cap();
288  printk(BIOS_DEBUG, "ECC supported: %s ECC forced: %s\n",
289  ctrl->ecc_supported ? "yes" : "no",
290  ctrl->ecc_forced ? "yes" : "no");
291 }
292 
293 static void init_dram_ddr3(int s3resume, const u32 cpuid)
294 {
295  int me_uma_size, cbmem_was_inited, fast_boot, err;
296  ramctr_timing ctrl;
297  spd_raw_data spds[4];
298  size_t mrc_size;
299  ramctr_timing *ctrl_cached = NULL;
300 
302 
303  mchbar_setbits32(SAPMCTL, 1 << 0);
304 
305  /* Wait for ME to be ready */
307  me_uma_size = intel_early_me_uma_size();
308 
309  printk(BIOS_DEBUG, "Starting native Platform init\n");
310 
311  wait_txt_clear();
312 
313  wrmsr(0x2e6, (msr_t) { .lo = 0, .hi = 0 });
314 
315  const u32 sskpd = mchbar_read32(SSKPD); // !!! = 0x00000000
316  if ((pci_read_config16(SOUTHBRIDGE, 0xa2) & 0xa0) == 0x20 && sskpd && !s3resume) {
317  mchbar_write32(SSKPD, 0);
318  /* Need reset */
319  system_reset();
320  }
321 
323  early_init_dmi();
325 
326  /* Try to find timings in MRC cache */
329  &mrc_size);
330  if (mrc_size < sizeof(ctrl))
331  ctrl_cached = NULL;
332 
333  /* Before reusing training data, assert that the CPU has not been replaced */
334  if (ctrl_cached && cpuid != ctrl_cached->cpu) {
335 
336  /* It is not really worrying on a cold boot, but fatal when resuming from S3 */
337  printk(s3resume ? BIOS_ALERT : BIOS_NOTICE,
338  "CPUID %x differs from stored CPUID %x, CPU was replaced!\n",
339  cpuid, ctrl_cached->cpu);
340 
341  /* Invalidate the stored data, it likely does not apply to the current CPU */
342  ctrl_cached = NULL;
343  }
344 
345  if (s3resume && !ctrl_cached) {
346  /* S3 resume is impossible, reset to come up cleanly */
347  system_reset();
348  }
349 
350  /* Verify MRC cache for fast boot */
351  if (!s3resume && ctrl_cached) {
352  /* Load SPD unique information data. */
353  memset(spds, 0, sizeof(spds));
354  mainboard_get_spd(spds, 1);
355 
356  /* check SPD CRC16 to make sure the DIMMs haven't been replaced */
357  fast_boot = verify_crc16_spds_ddr3(spds, ctrl_cached);
358  if (!fast_boot)
359  printk(BIOS_DEBUG, "Stored timings CRC16 mismatch.\n");
360  } else {
361  fast_boot = s3resume;
362  }
363 
364  if (fast_boot) {
365  printk(BIOS_DEBUG, "Trying stored timings.\n");
366  memcpy(&ctrl, ctrl_cached, sizeof(ctrl));
367 
368  err = try_init_dram_ddr3(&ctrl, fast_boot, s3resume, me_uma_size);
369  if (err) {
370  if (s3resume) {
371  /* Failed S3 resume, reset to come up cleanly */
372  system_reset();
373  }
374  /* No need to erase bad MRC cache here, it gets overwritten on a
375  successful boot */
376  printk(BIOS_ERR, "Stored timings are invalid !\n");
377  fast_boot = 0;
378  }
379  }
380  if (!fast_boot) {
381  /* Reset internal state */
382  reinit_ctrl(&ctrl, cpuid);
383 
384  printk(BIOS_INFO, "ECC RAM %s.\n", ctrl.ecc_forced ? "required" :
385  ctrl.ecc_supported ? "supported" : "unsupported");
386 
387  /* Get DDR3 SPD data */
388  memset(spds, 0, sizeof(spds));
389  mainboard_get_spd(spds, 0);
390  dram_find_spds_ddr3(spds, &ctrl);
391 
392  err = try_init_dram_ddr3(&ctrl, fast_boot, s3resume, me_uma_size);
393  }
394 
395  if (err) {
396  /* Fallback: disable failing channel */
397  printk(BIOS_ERR, "RAM training failed, trying fallback.\n");
398  printram("Disable failing channel.\n");
399 
400  /* Reset internal state */
401  reinit_ctrl(&ctrl, cpuid);
402 
403  /* Reset DDR3 frequency */
404  dram_find_spds_ddr3(spds, &ctrl);
405 
406  /* Disable failing channel */
407  disable_channel(&ctrl, GET_ERR_CHANNEL(err));
408 
409  err = try_init_dram_ddr3(&ctrl, fast_boot, s3resume, me_uma_size);
410  }
411 
412  if (err)
413  die("raminit failed");
414 
415  /* FIXME: should be hardware revision-dependent. The register only exists on IVB. */
416  mchbar_write32(CHANNEL_HASH, 0x00a030ce);
417 
418  set_scrambling_seed(&ctrl);
419 
420  if (!s3resume && ctrl.ecc_enabled)
421  channel_scrub(&ctrl);
422 
423  set_normal_operation(&ctrl);
424 
425  final_registers(&ctrl);
426 
427  /* can't do this earlier because it needs to be done in normal operation */
428  if (CONFIG(DEBUG_RAM_SETUP) && !s3resume && ctrl.ecc_enabled) {
430 
431  printk(BIOS_INFO, "RAMINIT: ECC scrub test on first channel up to 0x%x\n",
432  tseg);
433 
434  /*
435  * This test helps to debug the ECC scrubbing.
436  * It likely tests every channel/rank, as rank interleave and enhanced
437  * interleave are enabled, but there's no guarantee for it.
438  */
439 
440  /* Skip first MB to avoid special case for A-seg and test up to TSEG */
441  for (i = 1; i < tseg >> 20; i++) {
442  for (int j = 0; j < 1 * MiB; j += 4096) {
443  uintptr_t addr = i * MiB + j;
444  if (read32((u32 *)addr) == 0)
445  continue;
446 
447  printk(BIOS_ERR, "RAMINIT: ECC scrub: DRAM not cleared at"
448  " addr 0x%lx\n", addr);
449  break;
450  }
451  }
452  printk(BIOS_INFO, "RAMINIT: ECC scrub test done.\n");
453  }
454 
455  /* Zone config */
456  dram_zones(&ctrl, 0);
457 
460 
462 
464 
465  cbmem_was_inited = !cbmem_recovery(s3resume);
466  if (!fast_boot)
467  save_timings(&ctrl);
468  if (s3resume && !cbmem_was_inited) {
469  /* Failed S3 resume, reset to come up cleanly */
470  system_reset();
471  }
472 
473  if (!s3resume)
474  setup_sdram_meminfo(&ctrl);
475 }
476 
477 void perform_raminit(int s3resume)
478 {
479  post_code(0x3a);
480  init_dram_ddr3(s3resume, cpu_get_cpuid());
481 }
static uint32_t read32(const void *addr)
Definition: mmio.h:22
static uint8_t read8(const void *addr)
Definition: mmio.h:12
static struct cpuid_result cpuid_ext(int op, unsigned int ecx)
Definition: cpu.h:59
void * memcpy(void *dest, const void *src, size_t n)
Definition: memcpy.c:7
void * memset(void *dstpp, int c, size_t len)
Definition: memset.c:12
int intel_early_me_init(void)
Definition: early_me.c:43
void intel_early_me_status(void)
Definition: early_me.c:26
int intel_early_me_uma_size(void)
Definition: early_me.c:74
int intel_early_me_init_done(u8 status)
Definition: early_me.c:88
void early_thermal_init(void)
Definition: early_thermal.c:14
#define MiB
Definition: helpers.h:76
cb_err
coreboot error codes
Definition: cb_err.h:15
@ CB_SUCCESS
Call completed successfully.
Definition: cb_err.h:16
int cbmem_recovery(int s3resume)
Definition: imd_cbmem.c:125
void * cbmem_find(u32 id)
Definition: imd_cbmem.c:166
#define CBMEM_ID_MEMINFO
Definition: cbmem_id.h:33
void system_reset(void)
Definition: cf9_reset.c:37
static u32 addr
Definition: cirrus.c:14
#define printk(level,...)
Definition: stdlib.h:16
void __noreturn die(const char *fmt,...)
Definition: die.c:17
uint32_t cpu_get_cpuid(void)
Definition: cpu_common.c:63
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
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
int spd_decode_ddr3(struct dimm_attr_ddr3_st *dimm, spd_raw_data spd)
Decode the raw SPD data.
Definition: ddr3.c:101
u16 spd_ddr3_calc_unique_crc(u8 *spd, int len)
Calculate the CRC of a DDR3 SPD unique identifier.
Definition: ddr3.c:74
@ CONFIG
Definition: dsi_common.h:201
void early_init_dmi(void)
Definition: early_dmi.c:171
#define mchbar_setbits32(addr, set)
Definition: fixed_bars.h:58
static __always_inline void mchbar_write32(const uintptr_t offset, const uint32_t value)
Definition: fixed_bars.h:36
static __always_inline uint32_t mchbar_read32(const uintptr_t offset)
Definition: fixed_bars.h:21
#define CAPID0_A
Definition: host_bridge.h:65
#define CAPID_ECCDIS
Definition: host_bridge.h:66
#define CAPID_PDCD
Definition: host_bridge.h:69
#define CAPID_DDPCD
Definition: host_bridge.h:68
#define CAPID_DDRSZ(x)
Definition: host_bridge.h:70
#define SAPMCTL
Definition: mchbar.h:65
#define SSKPD
Definition: mchbar.h:36
#define NUM_SLOTS
Definition: mchbar.h:8
static __always_inline void wrmsr(unsigned int index, msr_t msr)
Definition: msr.h:157
#define printram(x,...)
Convenience macro for enabling printk with CONFIG(DEBUG_RAM_SETUP)
Definition: common.h:46
@ DDR3_XMP_PROFILE_1
Definition: ddr3.h:152
u8 spd_raw_data[256]
Definition: ddr3.h:156
static __always_inline u16 pci_read_config16(const struct device *dev, u16 reg)
Definition: pci_ops.h:52
static __always_inline u32 pci_read_config32(const struct device *dev, u16 reg)
Definition: pci_ops.h:58
static int smbus_read_byte(struct device *const dev, u8 addr)
Definition: smbus.h:43
@ MEMORY_ARRAY_ECC_SINGLE_BIT
Definition: smbios.h:232
@ MEMORY_ARRAY_ECC_NONE
Definition: smbios.h:230
@ SPD_MEMORY_TYPE_SDRAM_DDR3
Definition: spd.h:152
#define SPD_MEMORY_TYPE
Definition: spd.h:25
void timestamp_add_now(enum timestamp_id id)
Definition: timestamp.c:141
#define BIOS_INFO
BIOS_INFO - Expected events.
Definition: loglevel.h:113
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
Definition: loglevel.h:128
#define BIOS_NOTICE
BIOS_NOTICE - Unexpected but relatively insignificant.
Definition: loglevel.h:100
#define BIOS_ALERT
BIOS_ALERT - Dying / Unrecoverable.
Definition: loglevel.h:41
#define BIOS_ERR
BIOS_ERR - System in incomplete state.
Definition: loglevel.h:72
#define BIOS_WARNING
BIOS_WARNING - Bad configuration.
Definition: loglevel.h:86
void mainboard_get_spd(spd_raw_data *spd, bool id_only)
Definition: early_init.c:25
int mrc_cache_stash_data(int type, uint32_t version, const void *data, size_t size)
Returns < 0 on error, 0 on success.
Definition: mrc_cache.c:687
void * mrc_cache_current_mmap_leak(int type, uint32_t version, size_t *data_size)
mrc_cache_mmap_leak
Definition: mrc_cache.c:342
@ MRC_TRAINING_DATA
Definition: mrc_cache.h:11
#define MRC_CACHE_VERSION
Definition: raminit.c:31
void perform_raminit(const int s3resume)
Definition: raminit.c:342
#define SOUTHBRIDGE
Definition: raminit.c:36
static uint16_t nb_slots_per_channel(const uint32_t capid0_a)
Definition: raminit.c:61
static int verify_crc16_spds_ddr3(spd_raw_data *spd, ramctr_timing *ctrl)
Definition: raminit.c:123
void read_spd(spd_raw_data *spd, u8 addr, bool id_only)
Definition: raminit.c:138
static void init_dram_ddr3(int s3resume, const u32 cpuid)
Definition: raminit.c:293
static void setup_sdram_meminfo(ramctr_timing *ctrl)
Definition: raminit.c:96
static void disable_channel(ramctr_timing *ctrl, int channel)
Definition: raminit.c:43
static uint8_t nb_get_ecc_type(const uint32_t capid0_a)
Definition: raminit.c:56
static void dram_find_spds_ddr3(spd_raw_data *spd, ramctr_timing *ctrl)
Definition: raminit.c:150
static uint32_t nb_max_chan_capacity_mib(const uint32_t capid0_a)
Definition: raminit.c:71
static void wait_txt_clear(void)
Definition: raminit.c:25
static uint16_t nb_number_of_channels(const uint32_t capid0_a)
Definition: raminit.c:66
static void reinit_ctrl(ramctr_timing *ctrl, const u32 cpuid)
Definition: raminit.c:277
static void save_timings(ramctr_timing *ctrl)
Definition: raminit.c:271
#define post_code(value)
Definition: post_code.h:12
bool get_host_ecc_cap(void)
void set_normal_operation(ramctr_timing *ctrl)
void final_registers(ramctr_timing *ctrl)
void channel_scrub(ramctr_timing *ctrl)
bool get_host_ecc_forced(void)
void dram_zones(ramctr_timing *ctrl, int training)
void set_scrambling_seed(ramctr_timing *ctrl)
int try_init_dram_ddr3(ramctr_timing *ctrl, int fast_boot, int s3resume, int me_uma_size)
#define GET_ERR_CHANNEL(x)
#define FOR_ALL_CHANNELS
#define TSEGMB
Definition: host_bridge.h:48
#define CHANNEL_HASH
Definition: mchbar.h:476
u32 cpuid
#define ME_INIT_STATUS_SUCCESS
Definition: me.h:79
static void report_memory_config(void)
Definition: raminit.c:42
@ HOST_BRIDGE
Definition: reg_access.h:23
void early_pch_init_native(void)
Definition: early_pch.c:136
#define NULL
Definition: stddef.h:19
unsigned short uint16_t
Definition: stdint.h:11
unsigned int uint32_t
Definition: stdint.h:14
uint32_t u32
Definition: stdint.h:51
unsigned long uintptr_t
Definition: stdint.h:21
uint16_t u16
Definition: stdint.h:48
uint8_t u8
Definition: stdint.h:45
unsigned char uint8_t
Definition: stdint.h:8
uint32_t ecx
Definition: cpu.h:32
DIMM characteristics.
Definition: ddr3.h:106
union dimm_flags_ddr3_st flags
Definition: ddr3.h:111
enum spd_memory_type dram_type
Definition: ddr3.h:107
u8 dimms_per_channel
Definition: ddr3.h:142
u8 rankmap[NUM_CHANNELS]
int rank_mirror[NUM_CHANNELS][NUM_SLOTRANKS]
u32 cmd_stretch[NUM_CHANNELS]
u16 spd_crc[NUM_CHANNELS][NUM_SLOTS]
int ref_card_offset[NUM_CHANNELS]
int channel_size_mb[NUM_CHANNELS]
u32 mad_dimm[NUM_CHANNELS]
struct ram_rank_timings timings[NUM_CHANNELS][NUM_SLOTRANKS]
#define m(clkreg, src_bits, pmcreg, dst_bits)
@ TS_INITRAM_END
@ TS_INITRAM_START
unsigned int is_ecc
Definition: ddr3.h:78
unsigned int asr
Definition: ddr3.h:90
unsigned int pins_mirrored
Definition: ddr3.h:70
unsigned int ext_temp_refresh
Definition: ddr3.h:94