x86/mtrr: Enable Rd/WrDram mod in AMD fixed MTRRs

AMD's fixed MTRRs have RdDram and WrDram bits that route memory
accesses to DRAM vs. MMIO.  These are typically hidden for normal
operation by clearing SYS_CFG[19] (MtrrFixDramModEn).  According to
BKDGs and AMD64 Programmer's Manual vol 2, this bit is clear at
reset, should be set for configuration during POST, then cleared for
normal operation.

Attempting to modify the RdDram and WrDram settings without unhiding
them causes a General Protection Fault.  Add functions to enable and
disable MtrrFixDramModEn.  Unhide/hide as necessary when copying or
writing the fixed MTRRs.

Finally, modify sipi_vector.S to enable the bits prior to writing
the fixed MTRRs and disable when complete.

This functionality is compiled out on non-AMD platforms.

BUG=b:68019051
TEST=Boot Kahlee, check steps with HDT

Change-Id: Ie195131ff752400eb886dfccc39b314b4fa6b3f3
Signed-off-by: Marshall Dawson <marshalldawson3rd@gmail.com>
Reviewed-on: https://review.coreboot.org/23722
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Marshall Dawson
2017-10-19 09:45:16 -06:00
committed by Aaron Durbin
parent ed089376e3
commit c0dbedac43
4 changed files with 54 additions and 1 deletions

View File

@ -299,6 +299,8 @@ static int save_bsp_msrs(char *start, int size)
return -1;
}
fixed_mtrrs_expose_amd_rwdram();
msr_entry = (void *)start;
for (i = 0; i < NUM_FIXED_MTRRS; i++)
msr_entry = save_msr(fixed_mtrrs[i], msr_entry);
@ -310,6 +312,8 @@ static int save_bsp_msrs(char *start, int size)
msr_entry = save_msr(MTRR_DEF_TYPE_MSR, msr_entry);
fixed_mtrrs_hide_amd_rwdram();
return msr_count;
}