Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 584fcff4 authored by Borislav Petkov's avatar Borislav Petkov
Browse files

amd64_edac: check only ECC bit in amd64_determine_edac_cap



Checking whether the machine is using ECC enabled DRAM is done through
testing the DimmEccEn bit in the DRAM Cfg Low register (F2x[1,0]90). Do
that instead of testing all bits from the DimmEccEn upwards.

Also, remove mci->edac_cap assignment and use value returned from
amd64_determine_edac_cap().

Signed-off-by: default avatarBorislav Petkov <borislav.petkov@amd.com>
parent 28d0325c
Loading
Loading
Loading
Loading
+2 −3
Original line number Original line Diff line number Diff line
@@ -754,13 +754,13 @@ static void amd64_cpu_display_info(struct amd64_pvt *pvt)
static enum edac_type amd64_determine_edac_cap(struct amd64_pvt *pvt)
static enum edac_type amd64_determine_edac_cap(struct amd64_pvt *pvt)
{
{
	int bit;
	int bit;
	enum dev_type edac_cap = EDAC_NONE;
	enum dev_type edac_cap = EDAC_FLAG_NONE;


	bit = (boot_cpu_data.x86 > 0xf || pvt->ext_model >= OPTERON_CPU_REV_F)
	bit = (boot_cpu_data.x86 > 0xf || pvt->ext_model >= OPTERON_CPU_REV_F)
		? 19
		? 19
		: 17;
		: 17;


	if (pvt->dclr0 >> BIT(bit))
	if (pvt->dclr0 & BIT(bit))
		edac_cap = EDAC_FLAG_SECDED;
		edac_cap = EDAC_FLAG_SECDED;


	return edac_cap;
	return edac_cap;
@@ -3006,7 +3006,6 @@ static void amd64_setup_mci_misc_attributes(struct mem_ctl_info *mci)


	mci->mtype_cap		= MEM_FLAG_DDR2 | MEM_FLAG_RDDR2;
	mci->mtype_cap		= MEM_FLAG_DDR2 | MEM_FLAG_RDDR2;
	mci->edac_ctl_cap	= EDAC_FLAG_NONE;
	mci->edac_ctl_cap	= EDAC_FLAG_NONE;
	mci->edac_cap		= EDAC_FLAG_NONE;


	if (pvt->nbcap & K8_NBCAP_SECDED)
	if (pvt->nbcap & K8_NBCAP_SECDED)
		mci->edac_ctl_cap |= EDAC_FLAG_SECDED;
		mci->edac_ctl_cap |= EDAC_FLAG_SECDED;