diff options
author | Aaron Durbin <adurbin@chromium.org> | 2014-02-05 16:00:43 -0600 |
---|---|---|
committer | Aaron Durbin <adurbin@google.com> | 2014-02-06 00:09:09 +0100 |
commit | 5b9e3b60516d5255962604db7530089103f83ec1 (patch) | |
tree | 28740738a4c802ef01006a225852606187d88202 /src/cpu | |
parent | ed9307db13671ee347a3f1288e87da508139feea (diff) | |
download | coreboot-5b9e3b60516d5255962604db7530089103f83ec1.tar.xz |
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@chromium.org>
Reviewed-on: http://review.coreboot.org/5151
Reviewed-by: Vladimir Serbinenko <phcoder@gmail.com>
Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/cpu')
-rw-r--r-- | src/cpu/x86/mtrr/mtrr.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/cpu/x86/mtrr/mtrr.c b/src/cpu/x86/mtrr/mtrr.c index dbedf0fa9e..cdaa791de3 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); |