From c0dbedac431a2038cd7382d4c0cd8ccb958675ac Mon Sep 17 00:00:00 2001 From: Marshall Dawson Date: Thu, 19 Oct 2017 09:45:16 -0600 Subject: 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 Reviewed-on: https://review.coreboot.org/23722 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/include/cpu/x86/mtrr.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/include/cpu') diff --git a/src/include/cpu/x86/mtrr.h b/src/include/cpu/x86/mtrr.h index a72d602ccd..0d64be517e 100644 --- a/src/include/cpu/x86/mtrr.h +++ b/src/include/cpu/x86/mtrr.h @@ -76,6 +76,10 @@ void x86_setup_mtrrs_with_detect(void); */ void x86_setup_var_mtrrs(unsigned int address_bits, unsigned int above4gb); void enable_fixed_mtrr(void); +/* Unhide Rd/WrDram bits and allow modification for AMD. */ +void fixed_mtrrs_expose_amd_rwdram(void); +/* Hide Rd/WrDram bits and allow modification for AMD. */ +void fixed_mtrrs_hide_amd_rwdram(void); void x86_setup_fixed_mtrrs(void); /* Set up fixed MTRRs but do not enable them. */ void x86_setup_fixed_mtrrs_no_enable(void); -- cgit v1.2.3