summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cpu/x86/mtrr/mtrr.c13
-rw-r--r--src/include/cpu/x86/mtrr.h12
2 files changed, 19 insertions, 6 deletions
diff --git a/src/cpu/x86/mtrr/mtrr.c b/src/cpu/x86/mtrr/mtrr.c
index efd0b68368..794df9922b 100644
--- a/src/cpu/x86/mtrr/mtrr.c
+++ b/src/cpu/x86/mtrr/mtrr.c
@@ -789,8 +789,6 @@ void x86_setup_var_mtrrs(unsigned int address_bits, unsigned int above4gb)
addr_space = get_physical_address_space();
if (sol == NULL) {
- if (above4gb == 2)
- detect_var_mtrrs();
sol = &mtrr_global_solution;
sol->mtrr_default_type =
calc_var_mtrrs(addr_space, !!above4gb, address_bits);
@@ -804,12 +802,21 @@ void x86_setup_var_mtrrs(unsigned int address_bits, unsigned int above4gb)
void x86_setup_mtrrs(void)
{
int address_size;
+
x86_setup_fixed_mtrrs();
address_size = cpu_phys_address_size();
- printk(BIOS_DEBUG, "CPU physical address size: %d bits\n", address_size);
+ printk(BIOS_DEBUG, "CPU physical address size: %d bits\n",
+ address_size);
+ /* Always handle addresses above 4GiB. */
x86_setup_var_mtrrs(address_size, 1);
}
+void x86_setup_mtrrs_with_detect(void)
+{
+ detect_var_mtrrs();
+ x86_setup_mtrrs();
+}
+
void x86_mtrr_check(void)
{
/* Only Pentium Pro and later have MTRR */
diff --git a/src/include/cpu/x86/mtrr.h b/src/include/cpu/x86/mtrr.h
index 8fd4261081..d15873595e 100644
--- a/src/include/cpu/x86/mtrr.h
+++ b/src/include/cpu/x86/mtrr.h
@@ -56,14 +56,20 @@
* of the nature of the global MTRR enable flag. Therefore, all direct
* or indirect callers of enable_fixed_mtrr() should ensure that the
* variable MTRR MSRs do not contain bad ranges.
+ *
+ * Note that this function sets up MTRRs for addresses above 4GiB.
*/
void x86_setup_mtrrs(void);
/*
+ * x86_setup_mtrrs_with_detect() does the same thing as x86_setup_mtrrs(), but
+ * it always dynamically detects the number of variable MTRRs available.
+ */
+void x86_setup_mtrrs_with_detect(void);
+/*
* x86_setup_var_mtrrs() parameters:
* address_bits - number of physical address bits supported by cpu
- * above4gb - 2 means dynamically detect number of variable MTRRs available.
- * non-zero means handle memory ranges above 4GiB.
- * 0 means ignore memory ranges above 4GiB
+ * above4gb - if set setup MTRRs for addresses above 4GiB else ignore
+ * memory ranges above 4GiB
*/
void x86_setup_var_mtrrs(unsigned int address_bits, unsigned int above4gb);
void enable_fixed_mtrr(void);