summaryrefslogtreecommitdiff
path: root/src/cpu/x86/mtrr
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2016-03-07 16:05:36 -0600
committerMartin Roth <martinroth@google.com>2016-03-08 16:46:16 +0100
commite63be8971bac14c50b97602aedcc2a85b7e5f540 (patch)
tree70211934fc59868accbcb91370840691248edba5 /src/cpu/x86/mtrr
parente99e2b65cfc594ecfa56cb12660f731a6f88a57a (diff)
cpu/x86/mtrr: add helper function to detect variable MTRRs
The current MTRR API doesn't allow one to detect variable MTRRs along with handling fixed MTRRs in one function call. Therefore, add x86_setup_mtrrs_with_detect() to perform the same actions as x86_setup_mtrrs() but always do the dynamic detection. Change-Id: I443909691afa28ce11882e2beab12e836e5bcb3d Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/13935 Reviewed-by: Furquan Shaikh <furquan@google.com> Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/cpu/x86/mtrr')
-rw-r--r--src/cpu/x86/mtrr/mtrr.c13
1 files changed, 10 insertions, 3 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 */