]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
x86: mtrr: Skip MSRs that were already programmed in mtrr_commit()
authorBin Meng <bmeng.cn@gmail.com>
Sat, 31 Jul 2021 08:45:25 +0000 (16:45 +0800)
committerBin Meng <bmeng.cn@gmail.com>
Mon, 2 Aug 2021 07:11:40 +0000 (15:11 +0800)
At present mtrr_commit() programs the MTRR MSRs starting from
index 0, which may overwrite MSRs that were already programmed
by previous boot stage or FSP.

Switch to call mtrr_set_next_var() instead.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested on chromebook_coral, chromebook_samus, chromebook_link, minnowmax
Tested-by: Simon Glass <sjg@chromium.org>
arch/x86/cpu/mtrr.c

index 73cf7bb2bea9b256cd69e7400ae431ddf8c6df67..14c644eb561c54255f0ac9fc238cff2a82c56e42 100644 (file)
@@ -155,7 +155,7 @@ 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++)
-               set_var_mtrr(i, req->type, req->start, req->size);
+               mtrr_set_next_var(req->type, req->start, req->size);
 
        debug("close\n");
        mtrr_close(&state, do_caches);