cpu/x86/mtrr: Make 'above4gb' variable a bool
No need for this to be a signed or unsigned int. TEST=tested with rest of patch train. Change-Id: I409c04b928211e0e89eec324fdf3fa3997c73576 Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/86942 Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de> Reviewed-by: Jérémy Compostella <jeremy.compostella@intel.com> Reviewed-by: Shuo Liu <shuo.liu@intel.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
c8069bc53f
commit
8da0d01ba0
2 changed files with 15 additions and 14 deletions
|
|
@ -361,7 +361,7 @@ static struct var_mtrr_solution mtrr_global_solution;
|
|||
|
||||
struct var_mtrr_state {
|
||||
struct memranges *addr_space;
|
||||
int above4gb;
|
||||
bool above4gb;
|
||||
int address_bits;
|
||||
int prepare_msrs;
|
||||
int mtrr_index;
|
||||
|
|
@ -607,7 +607,7 @@ static void calc_var_mtrrs_with_hole(struct var_mtrr_state *var_state,
|
|||
}
|
||||
|
||||
static void __calc_var_mtrrs(struct memranges *addr_space,
|
||||
int above4gb, int address_bits,
|
||||
bool above4gb, int address_bits,
|
||||
int *num_def_wb_mtrrs, int *num_def_uc_mtrrs)
|
||||
{
|
||||
int wb_deftype_count;
|
||||
|
|
@ -661,7 +661,7 @@ static void __calc_var_mtrrs(struct memranges *addr_space,
|
|||
}
|
||||
|
||||
static int calc_var_mtrrs(struct memranges *addr_space,
|
||||
int above4gb, int address_bits)
|
||||
bool above4gb, int address_bits)
|
||||
{
|
||||
int wb_deftype_count = 0;
|
||||
int uc_deftype_count = 0;
|
||||
|
|
@ -692,7 +692,7 @@ static int calc_var_mtrrs(struct memranges *addr_space,
|
|||
}
|
||||
|
||||
static void prepare_var_mtrrs(struct memranges *addr_space, int def_type,
|
||||
int above4gb, int address_bits,
|
||||
bool above4gb, int address_bits,
|
||||
struct var_mtrr_solution *sol)
|
||||
{
|
||||
struct range_entry *r;
|
||||
|
|
@ -742,7 +742,7 @@ static int commit_var_mtrrs(const struct var_mtrr_solution *sol)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void x86_setup_var_mtrrs(unsigned int address_bits, unsigned int above4gb)
|
||||
void x86_setup_var_mtrrs(unsigned int address_bits, bool above4gb)
|
||||
{
|
||||
static struct var_mtrr_solution *sol = NULL;
|
||||
struct memranges *addr_space;
|
||||
|
|
@ -752,15 +752,15 @@ void x86_setup_var_mtrrs(unsigned int address_bits, unsigned int above4gb)
|
|||
if (sol == NULL) {
|
||||
sol = &mtrr_global_solution;
|
||||
sol->mtrr_default_type =
|
||||
calc_var_mtrrs(addr_space, !!above4gb, address_bits);
|
||||
calc_var_mtrrs(addr_space, above4gb, address_bits);
|
||||
prepare_var_mtrrs(addr_space, sol->mtrr_default_type,
|
||||
!!above4gb, address_bits, sol);
|
||||
above4gb, address_bits, sol);
|
||||
}
|
||||
|
||||
commit_var_mtrrs(sol);
|
||||
}
|
||||
|
||||
static void _x86_setup_mtrrs(unsigned int above4gb)
|
||||
static void _x86_setup_mtrrs(bool above4gb)
|
||||
{
|
||||
int address_size;
|
||||
|
||||
|
|
@ -778,20 +778,21 @@ void x86_setup_mtrrs(void)
|
|||
/* Without detect, assume the minimum */
|
||||
total_mtrrs = MIN_MTRRS;
|
||||
/* Always handle addresses above 4GiB. */
|
||||
_x86_setup_mtrrs(1);
|
||||
_x86_setup_mtrrs(true);
|
||||
}
|
||||
|
||||
void x86_setup_mtrrs_with_detect(void)
|
||||
{
|
||||
detect_var_mtrrs();
|
||||
/* Always handle addresses above 4GiB. */
|
||||
_x86_setup_mtrrs(1);
|
||||
_x86_setup_mtrrs(true);
|
||||
}
|
||||
|
||||
void x86_setup_mtrrs_with_detect_no_above_4gb(void)
|
||||
{
|
||||
detect_var_mtrrs();
|
||||
_x86_setup_mtrrs(0);
|
||||
/* Ignore addresses above 4GiB. */
|
||||
_x86_setup_mtrrs(false);
|
||||
}
|
||||
|
||||
void x86_mtrr_check(void)
|
||||
|
|
@ -827,7 +828,7 @@ void mtrr_use_temp_range(uintptr_t begin, size_t size, int type)
|
|||
const struct memranges *orig;
|
||||
struct var_mtrr_solution sol;
|
||||
struct memranges addr_space;
|
||||
const int above4gb = 1; /* Cover above 4GiB by default. */
|
||||
const bool above4gb = true; /* Cover above 4GiB by default. */
|
||||
int address_bits;
|
||||
static struct temp_range {
|
||||
uintptr_t begin;
|
||||
|
|
|
|||
|
|
@ -103,10 +103,10 @@ void x86_setup_mtrrs_with_detect_no_above_4gb(void);
|
|||
/*
|
||||
* x86_setup_var_mtrrs() parameters:
|
||||
* address_bits - number of physical address bits supported by cpu
|
||||
* above4gb - if set setup MTRRs for addresses above 4GiB else ignore
|
||||
* above4gb - if true, 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 x86_setup_var_mtrrs(unsigned int address_bits, bool above4gb);
|
||||
void enable_fixed_mtrr(void);
|
||||
/* Unhide Rd/WrDram bits and allow modification for AMD. */
|
||||
void fixed_mtrrs_expose_amd_rwdram(void);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue