cpu/x86/mtrr: add x86_setup_mtrrs_with_detect_no_above_4gb()

There's not a function that is the equivalent to
x86_setup_mtrrs_with_detect() but not solving for above 4GiB.
Provide x86_setup_mtrrs_with_detect_no_above_4gb() which is the
equivalent to x86_setup_mtrrs_with_detect() but instructs the MTRR
solver to not take into account memory above 4GiB.

BUG=b:155426691

Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Change-Id: Ia1b5d67d6f139aaa929e03ddbc394d57dfb949e0
Reviewed-on: https://review.coreboot.org/c/coreboot/+/41897
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Aaron Durbin 2020-05-28 10:17:34 -06:00
parent e1bf0656af
commit 1ebbb165ef
2 changed files with 16 additions and 3 deletions

View File

@ -774,7 +774,7 @@ void x86_setup_var_mtrrs(unsigned int address_bits, unsigned int above4gb)
commit_var_mtrrs(sol); commit_var_mtrrs(sol);
} }
void x86_setup_mtrrs(void) static void _x86_setup_mtrrs(unsigned int above4gb)
{ {
int address_size; int address_size;
@ -782,14 +782,26 @@ void x86_setup_mtrrs(void)
address_size = cpu_phys_address_size(); address_size = cpu_phys_address_size();
printk(BIOS_DEBUG, "CPU physical address size: %d bits\n", printk(BIOS_DEBUG, "CPU physical address size: %d bits\n",
address_size); address_size);
x86_setup_var_mtrrs(address_size, above4gb);
}
void x86_setup_mtrrs(void)
{
/* Always handle addresses above 4GiB. */ /* Always handle addresses above 4GiB. */
x86_setup_var_mtrrs(address_size, 1); _x86_setup_mtrrs(1);
} }
void x86_setup_mtrrs_with_detect(void) void x86_setup_mtrrs_with_detect(void)
{ {
detect_var_mtrrs(); detect_var_mtrrs();
x86_setup_mtrrs(); /* Always handle addresses above 4GiB. */
_x86_setup_mtrrs(1);
}
void x86_setup_mtrrs_with_detect_no_above_4gb(void)
{
detect_var_mtrrs();
_x86_setup_mtrrs(0);
} }
void x86_mtrr_check(void) void x86_mtrr_check(void)

View File

@ -77,6 +77,7 @@ void x86_setup_mtrrs(void);
* it always dynamically detects the number of variable MTRRs available. * it always dynamically detects the number of variable MTRRs available.
*/ */
void x86_setup_mtrrs_with_detect(void); void x86_setup_mtrrs_with_detect(void);
void x86_setup_mtrrs_with_detect_no_above_4gb(void);
/* /*
* x86_setup_var_mtrrs() parameters: * x86_setup_var_mtrrs() parameters:
* address_bits - number of physical address bits supported by cpu * address_bits - number of physical address bits supported by cpu