[coreboot-gerrit] Patch set updated for coreboot: 238c1d1 mtrr: retry fitting w/o WRCOMB if usage exceeds BIOS allocation

Aaron Durbin (adurbin@google.com) gerrit at coreboot.org
Wed Feb 5 23:09:08 CET 2014


Aaron Durbin (adurbin at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5151

-gerrit

commit 238c1d1d3b2dfadbe405fb9d2017893561cbd004
Author: Aaron Durbin <adurbin at chromium.org>
Date:   Wed Feb 5 16:00:43 2014 -0600

    mtrr: retry fitting w/o WRCOMB if usage exceeds BIOS allocation
    
    If the MTRR usage exceeds the BIOS allocation for MTRR usage
    re-try without the WRCOMB type.
    
    Change-Id: Ie70ce84994428ff6700c36310264c3c44d9ed128
    Signed-off-by: Aaron Durbin <adurbin at chromium.org>
---
 src/cpu/x86/mtrr/mtrr.c | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/src/cpu/x86/mtrr/mtrr.c b/src/cpu/x86/mtrr/mtrr.c
index dbedf0f..cdaa791 100644
--- a/src/cpu/x86/mtrr/mtrr.c
+++ b/src/cpu/x86/mtrr/mtrr.c
@@ -661,8 +661,9 @@ static void calc_var_mtrrs_without_hole(struct var_mtrr_state *var_state,
 	calc_var_mtrr_range(var_state, c1, c2 - c1, mtrr_type);
 }
 
-static int calc_var_mtrrs(struct memranges *addr_space,
-                          int above4gb, int address_bits)
+static void __calc_var_mtrrs(struct memranges *addr_space,
+                             int above4gb, int address_bits,
+                             int *num_def_wb_mtrrs, int *num_def_uc_mtrrs)
 {
 	int wb_deftype_count;
 	int uc_deftype_count;
@@ -738,6 +739,28 @@ static int calc_var_mtrrs(struct memranges *addr_space,
 			wb_deftype_count += var_state.mtrr_index;
 		}
 	}
+	*num_def_wb_mtrrs = wb_deftype_count;
+	*num_def_uc_mtrrs = uc_deftype_count;
+}
+
+static int calc_var_mtrrs(struct memranges *addr_space,
+                          int above4gb, int address_bits)
+{
+	int wb_deftype_count = 0;
+	int uc_deftype_count = 0;
+
+	__calc_var_mtrrs(addr_space, above4gb, address_bits, &wb_deftype_count,
+	                 &uc_deftype_count);
+
+	if (wb_deftype_count > bios_mtrrs && uc_deftype_count > bios_mtrrs) {
+		printk(BIOS_DEBUG, "MTRR: Removing WRCOMB type. "
+		       "WB/UC MTRR counts: %d/%d > %d.\n",
+		       wb_deftype_count, uc_deftype_count, bios_mtrrs);
+		memranges_update_tag(addr_space, MTRR_TYPE_WRCOMB,
+		                     MTRR_TYPE_UNCACHEABLE);
+		__calc_var_mtrrs(addr_space, above4gb, address_bits,
+		                 &wb_deftype_count, &uc_deftype_count);
+	}
 
 	printk(BIOS_DEBUG, "MTRR: default type WB/UC MTRR counts: %d/%d.\n",
 	       wb_deftype_count, uc_deftype_count);



More information about the coreboot-gerrit mailing list