diff options
author | Simon Glass <sjg@chromium.org> | 2020-09-22 14:54:51 -0600 |
---|---|---|
committer | Bin Meng <bmeng.cn@gmail.com> | 2020-09-25 11:27:27 +0800 |
commit | 29d2d64ed55f2dfaff6d298b0f589ea0f8edef8d (patch) | |
tree | ddca703f01f651b8ac155ab17c802fcc9b00f0eb /arch/x86/include/asm/mtrr.h | |
parent | 51af144eb7a0bba3f54991059920ceccd83ddc91 (diff) | |
download | u-boot-29d2d64ed55f2dfaff6d298b0f589ea0f8edef8d.tar.gz u-boot-29d2d64ed55f2dfaff6d298b0f589ea0f8edef8d.tar.xz u-boot-29d2d64ed55f2dfaff6d298b0f589ea0f8edef8d.zip |
x86: Add support for more than 8 MTRRs
At present the mtrr command only support 8 MTRRs. Some SoCs have more than
that. Update the implementation to support up to 10. Read the number of
MTRRs dynamically instead.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'arch/x86/include/asm/mtrr.h')
-rw-r--r-- | arch/x86/include/asm/mtrr.h | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/arch/x86/include/asm/mtrr.h b/arch/x86/include/asm/mtrr.h index 48db1dd82f..3a98aacdef 100644 --- a/arch/x86/include/asm/mtrr.h +++ b/arch/x86/include/asm/mtrr.h @@ -36,8 +36,8 @@ #define MTRR_BASE_TYPE_MASK 0x7 -/* Number of MTRRs supported */ -#define MTRR_COUNT 8 +/* Maximum number of MTRRs supported - see also mtrr_get_var_count() */ +#define MTRR_MAX_COUNT 10 #define NUM_FIXED_MTRRS 11 #define RANGES_PER_FIXED_MTRR 8 @@ -87,7 +87,7 @@ struct mtrr { * @mtrr: Information about each mtrr */ struct mtrr_info { - struct mtrr mtrr[MTRR_COUNT]; + struct mtrr mtrr[MTRR_MAX_COUNT]; }; /** @@ -180,6 +180,15 @@ int mtrr_set_valid(int cpu_select, int reg, bool valid); */ int mtrr_set(int cpu_select, int reg, u64 base, u64 mask); +/** + * mtrr_get_var_count() - Get the number of variable MTRRs + * + * Some CPUs have more than 8 MTRRs. This function returns the actual number + * + * @return number of variable MTRRs + */ +int mtrr_get_var_count(void); + #endif #if ((CONFIG_XIP_ROM_SIZE & (CONFIG_XIP_ROM_SIZE - 1)) != 0) |