summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-07-31 09:01:08 +0300
committerBin Meng <bmeng.cn@gmail.com>2023-08-01 05:06:46 +0300
commitd560f7cae04128061167c1507af08293b666c766 (patch)
tree40b7c63100576964d588780ea35f4dfa86a2c781 /arch
parentbff002d45b0d006458613790eb43397c37f93ae8 (diff)
downloadu-boot-d560f7cae04128061167c1507af08293b666c766.tar.xz
x86: Return mtrr_add_request() to its old purpose
This function used to be for adding a list of requests to be actioned on relocation. Revert it back to this purpose, to avoid problems with boards which need control of their MTRRs (i.e. those which don't use FSP). The mtrr_set_next_var() function is available when the next free variable-MTRR must be set, so this can be used instead. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Fixes: 3bcd6cf89ef ("x86: mtrr: Skip MSRs that were already programmed..") Fixes: 596bd0589ad ("x86: mtrr: Do not clear the unused ones..") Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/cpu/mtrr.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/x86/cpu/mtrr.c b/arch/x86/cpu/mtrr.c
index d57fcface0..9c24ae984e 100644
--- a/arch/x86/cpu/mtrr.c
+++ b/arch/x86/cpu/mtrr.c
@@ -166,8 +166,12 @@ int mtrr_commit(bool do_caches)
debug("open done\n");
qsort(req, gd->arch.mtrr_req_count, sizeof(*req), h_comp_mtrr);
for (i = 0; i < gd->arch.mtrr_req_count; i++, req++)
- mtrr_set_next_var(req->type, req->start, req->size);
+ set_var_mtrr(i, req->type, req->start, req->size);
+ /* Clear the ones that are unused */
+ debug("clear\n");
+ for (; i < mtrr_get_var_count(); i++)
+ wrmsrl(MTRR_PHYS_MASK_MSR(i), 0);
debug("close\n");
mtrr_close(&state, do_caches);
debug("mtrr done\n");