summaryrefslogtreecommitdiff
path: root/arch/x86/include
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2019-09-25 17:56:46 +0300
committerBin Meng <bmeng.cn@gmail.com>2019-10-08 08:57:48 +0300
commitadd3f4c9186fbd94b6e89c1d277b544a7a6ad404 (patch)
treea59d8963c9491687391aae34f638e344b919b665 /arch/x86/include
parent6ccb2f890bb5bfdd6aed4a99294fd77508436c40 (diff)
downloadu-boot-add3f4c9186fbd94b6e89c1d277b544a7a6ad404.tar.xz
x86: Add a function to set variable MTRRs
Normally U-Boot handles MTRRs through an add/commit process which overwrites all MTRRs. But in very early boot it is not desirable to clear the existing MTRRs since they may be in use and it can cause a hang. Add a new mtrr_set_next_var() function which sets up the next available MTRR to the required region. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> [bmeng: pass 'type' to set_var_mtrr() in mtrr_set_next_var()] Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'arch/x86/include')
-rw-r--r--arch/x86/include/asm/mtrr.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/x86/include/asm/mtrr.h b/arch/x86/include/asm/mtrr.h
index 6f29e75ce6..672617256e 100644
--- a/arch/x86/include/asm/mtrr.h
+++ b/arch/x86/include/asm/mtrr.h
@@ -117,6 +117,18 @@ int mtrr_add_request(int type, uint64_t start, uint64_t size);
*/
int mtrr_commit(bool do_caches);
+/**
+ * mtrr_set_next_var() - set up a variable MTRR
+ *
+ * This finds the first free variable MTRR and sets to the given area
+ *
+ * @type: Requested type (MTRR_TYPE_)
+ * @start: Start address
+ * @size: Size
+ * @return 0 on success, -ENOSPC if there are no more MTRRs
+ */
+int mtrr_set_next_var(uint type, uint64_t base, uint64_t size);
+
#endif
#if ((CONFIG_XIP_ROM_SIZE & (CONFIG_XIP_ROM_SIZE - 1)) != 0)