diff options
author | Felix Held <felix-coreboot@felixheld.de> | 2023-09-19 17:52:11 +0200 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2023-09-20 18:17:27 +0000 |
commit | 1663d188f3620a1c10ca5b4e9784d7dc225483f8 (patch) | |
tree | f3a1e5067ddd0ef57382755cea8e5b94e4f9c313 /src/cpu/x86/mtrr/debug.c | |
parent | 94b91c3ebb2b51958c1984934ed202463212d5fd (diff) |
cpu/x86/mtrr/debug: make local MSR variables const
In the functions the local MSR variables are only written once by rdmsr
calls at the beginning of the function and then only read, so those can
be made const.
Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: I1be6a5158c0c06abe128e9394d6001c40a8d4cbb
Reviewed-on: https://review.coreboot.org/c/coreboot/+/78004
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com>
Diffstat (limited to 'src/cpu/x86/mtrr/debug.c')
-rw-r--r-- | src/cpu/x86/mtrr/debug.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/cpu/x86/mtrr/debug.c b/src/cpu/x86/mtrr/debug.c index 635362f8a5..c74e71b0ac 100644 --- a/src/cpu/x86/mtrr/debug.c +++ b/src/cpu/x86/mtrr/debug.c @@ -52,7 +52,7 @@ static void display_mtrr_fixed_types(uint64_t msr, static void display_4k_mtrr(uint32_t msr_reg, uint32_t starting_address, const char *name) { - msr_t msr = rdmsr(msr_reg); + const msr_t msr = rdmsr(msr_reg); printk(BIOS_DEBUG, "0x%016llx: %s\n", msr.raw, name); display_mtrr_fixed_types(msr.raw, starting_address, 0x1000); } @@ -60,21 +60,21 @@ static void display_4k_mtrr(uint32_t msr_reg, uint32_t starting_address, static void display_16k_mtrr(uint32_t msr_reg, uint32_t starting_address, const char *name) { - msr_t msr = rdmsr(msr_reg); + const msr_t msr = rdmsr(msr_reg); printk(BIOS_DEBUG, "0x%016llx: %s\n", msr.raw, name); display_mtrr_fixed_types(msr.raw, starting_address, 0x4000); } static void display_64k_mtrr(void) { - msr_t msr = rdmsr(MTRR_FIX_64K_00000); + const msr_t msr = rdmsr(MTRR_FIX_64K_00000); printk(BIOS_DEBUG, "0x%016llx: IA32_MTRR_FIX64K_00000\n", msr.raw); display_mtrr_fixed_types(msr.raw, 0, 0x10000); } static void display_mtrrcap(void) { - msr_t msr = rdmsr(MTRR_CAP_MSR); + const msr_t msr = rdmsr(MTRR_CAP_MSR); printk(BIOS_DEBUG, "0x%08x%08x: IA32_MTRRCAP: %s%s%s%s%u variable MTRRs\n", msr.hi, msr.lo, @@ -87,7 +87,7 @@ static void display_mtrrcap(void) static void display_mtrr_def_type(void) { - msr_t msr = rdmsr(MTRR_DEF_TYPE_MSR); + const msr_t msr = rdmsr(MTRR_DEF_TYPE_MSR); printk(BIOS_DEBUG, "0x%016llx: IA32_MTRR_DEF_TYPE:%s%s %s\n", msr.raw, (msr.raw & MTRR_DEF_TYPE_EN) ? " E," : "", @@ -102,8 +102,8 @@ static void display_variable_mtrr(int index, uint64_t address_mask) uint64_t base_address; uint64_t length; uint64_t mask; - msr_t msr_a = rdmsr(msr_reg); - msr_t msr_m = rdmsr(msr_reg + 1); + const msr_t msr_a = rdmsr(msr_reg); + const msr_t msr_m = rdmsr(msr_reg + 1); if (msr_m.raw & MTRR_PHYS_MASK_VALID) { base_address = (msr_a.raw & 0xfffffffffffff000ULL) |