From 3ae3ff28286f1e752f01ccf9480414ff1d82615f Mon Sep 17 00:00:00 2001 From: Raul E Rangel Date: Mon, 27 Apr 2020 15:47:18 -0600 Subject: src/cpu/x86/mtrr/earlymtrr: Add clear_all_var_mtrr Picasso does not define the state of variable MTRRs on boot. Add a helper function to clear all MTRRs. BUG=b:147042464 TEST=Build trembyle Signed-off-by: Raul E Rangel Change-Id: I21b887ce12849a95ddd8f1698028fb6bbfb4a7f6 Reviewed-on: https://review.coreboot.org/c/coreboot/+/40764 Reviewed-by: Aaron Durbin Reviewed-by: Furquan Shaikh Tested-by: build bot (Jenkins) --- src/cpu/x86/mtrr/earlymtrr.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/cpu/x86') diff --git a/src/cpu/x86/mtrr/earlymtrr.c b/src/cpu/x86/mtrr/earlymtrr.c index 4d14a8de08..e4003591f9 100644 --- a/src/cpu/x86/mtrr/earlymtrr.c +++ b/src/cpu/x86/mtrr/earlymtrr.c @@ -42,3 +42,17 @@ void set_var_mtrr( maskm.hi = (1 << (cpu_phys_address_size() - 32)) - 1; wrmsr(MTRR_PHYS_MASK(reg), maskm); } + +void clear_all_var_mtrr(void) +{ + msr_t mtrr = {0, 0}; + int vcnt; + int i; + + vcnt = get_var_mtrr_count(); + + for (i = 0; i < vcnt; i++) { + wrmsr(MTRR_PHYS_MASK(i), mtrr); + wrmsr(MTRR_PHYS_BASE(i), mtrr); + } +} -- cgit v1.2.3