summaryrefslogtreecommitdiff
path: root/src/cpu
diff options
context:
space:
mode:
authorRaul E Rangel <rrangel@chromium.org>2020-04-27 15:47:18 -0600
committerAaron Durbin <adurbin@chromium.org>2020-04-29 04:59:56 +0000
commit3ae3ff28286f1e752f01ccf9480414ff1d82615f (patch)
tree57579c2d77f8ee36fa5f4527617333faca91d0ed /src/cpu
parentfa52f31e114d7d15b49dca448832138c884138cd (diff)
downloadcoreboot-3ae3ff28286f1e752f01ccf9480414ff1d82615f.tar.xz
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 <rrangel@chromium.org> Change-Id: I21b887ce12849a95ddd8f1698028fb6bbfb4a7f6 Reviewed-on: https://review.coreboot.org/c/coreboot/+/40764 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Furquan Shaikh <furquan@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/cpu')
-rw-r--r--src/cpu/x86/mtrr/earlymtrr.c14
1 files changed, 14 insertions, 0 deletions
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);
+ }
+}