nb/intel/sandybridge/raminit: Add ECC support

Add ECC support for native raminit on SandyBridge/IvyBridge.

Change-Id: I1206746332c9939a78b67e7b48d3098bdef8a2ed
Depends-On: I5b7599746195cfa996a48320404a8dbe6820483a
Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Signed-off-by: Jonathan A. Kollasch <jakllsch@kollasch.net>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/22215
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Patrick Rudolph
2017-10-28 18:20:11 +02:00
committed by Patrick Georgi
parent 05d4bf7ea7
commit dd662870dd
5 changed files with 85 additions and 10 deletions

View File

@ -102,6 +102,7 @@ static void dram_find_spds_ddr3(spd_raw_data *spd, ramctr_timing *ctrl)
{
int dimms = 0, ch_dimms;
int channel, slot, spd_slot;
bool can_use_ecc = ctrl->ecc_supported;
dimm_info *dimm = &ctrl->info;
memset (ctrl->rankmap, 0, sizeof(ctrl->rankmap));
@ -173,6 +174,9 @@ static void dram_find_spds_ddr3(spd_raw_data *spd, ramctr_timing *ctrl)
ctrl->channel_size_mb[channel] += dimm->dimm[channel][slot].size_mb;
if (!dimm->dimm[channel][slot].flags.is_ecc)
can_use_ecc = false;
ctrl->auto_self_refresh &= dimm->dimm[channel][slot].flags.asr;
ctrl->extended_temperature_range &=
@ -204,6 +208,14 @@ static void dram_find_spds_ddr3(spd_raw_data *spd, ramctr_timing *ctrl)
}
}
if (ctrl->ecc_forced || CONFIG(RAMINIT_ENABLE_ECC))
ctrl->ecc_enabled = can_use_ecc;
if (ctrl->ecc_forced && !ctrl->ecc_enabled)
die("ECC mode forced but non-ECC DIMM installed!");
printk(BIOS_DEBUG, "ECC is %s\n", ctrl->ecc_enabled ? "enabled" : "disabled");
ctrl->lanes = ctrl->ecc_enabled ? 9 : 8;
if (!dimms)
die("No DIMMs were found");
}