aboutsummaryrefslogtreecommitdiff
path: root/src/cpu/x86
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2023-09-19 17:38:16 +0200
committerFelix Held <felix-coreboot@felixheld.de>2023-09-20 17:47:03 +0000
commit94b91c3ebb2b51958c1984934ed202463212d5fd (patch)
treef5115d7f517cb81d2e8fd794277c0cc868983b47 /src/cpu/x86
parentce14b611d4d24c8c89c3f4c685998237b62a695e (diff)
cpu/x86/mtrr/debug: drop unnecessary MSR union
Commit 407e00dca06e ("include/cpu/msr.h: transform into an union") changed the msr_t type to a union that allows accessing the full 64 bit via the raw element, so there's no need to wrap it again in another union for the full 64 bit access. Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: I750307297283802021fac19e2cdf5faa12ede196 Reviewed-on: https://review.coreboot.org/c/coreboot/+/78003 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Diffstat (limited to 'src/cpu/x86')
-rw-r--r--src/cpu/x86/mtrr/debug.c80
1 files changed, 25 insertions, 55 deletions
diff --git a/src/cpu/x86/mtrr/debug.c b/src/cpu/x86/mtrr/debug.c
index a3e40d3a6c..635362f8a5 100644
--- a/src/cpu/x86/mtrr/debug.c
+++ b/src/cpu/x86/mtrr/debug.c
@@ -52,46 +52,29 @@ 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)
{
- union {
- uint64_t u64;
- msr_t s;
- } msr;
-
- msr.s = rdmsr(msr_reg);
- printk(BIOS_DEBUG, "0x%016llx: %s\n", msr.u64, name);
- display_mtrr_fixed_types(msr.u64, starting_address, 0x1000);
+ 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);
}
static void display_16k_mtrr(uint32_t msr_reg, uint32_t starting_address,
const char *name)
{
- union {
- uint64_t u64;
- msr_t s;
- } msr;
-
- msr.s = rdmsr(msr_reg);
- printk(BIOS_DEBUG, "0x%016llx: %s\n", msr.u64, name);
- display_mtrr_fixed_types(msr.u64, starting_address, 0x4000);
+ 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)
{
- union {
- uint64_t u64;
- msr_t s;
- } msr;
-
- msr.s = rdmsr(MTRR_FIX_64K_00000);
- printk(BIOS_DEBUG, "0x%016llx: IA32_MTRR_FIX64K_00000\n", msr.u64);
- display_mtrr_fixed_types(msr.u64, 0, 0x10000);
+ 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;
-
- msr = rdmsr(MTRR_CAP_MSR);
+ 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,
@@ -104,17 +87,12 @@ static void display_mtrrcap(void)
static void display_mtrr_def_type(void)
{
- union {
- uint64_t u64;
- msr_t s;
- } msr;
-
- msr.s = rdmsr(MTRR_DEF_TYPE_MSR);
+ msr_t msr = rdmsr(MTRR_DEF_TYPE_MSR);
printk(BIOS_DEBUG, "0x%016llx: IA32_MTRR_DEF_TYPE:%s%s %s\n",
- msr.u64,
- (msr.u64 & MTRR_DEF_TYPE_EN) ? " E," : "",
- (msr.u64 & MTRR_DEF_TYPE_FIX_EN) ? " FE," : "",
- display_mtrr_type((uint32_t)(msr.u64 &
+ msr.raw,
+ (msr.raw & MTRR_DEF_TYPE_EN) ? " E," : "",
+ (msr.raw & MTRR_DEF_TYPE_FIX_EN) ? " FE," : "",
+ display_mtrr_type((uint32_t)(msr.raw &
MTRR_DEF_TYPE_MASK)));
}
@@ -124,33 +102,25 @@ static void display_variable_mtrr(int index, uint64_t address_mask)
uint64_t base_address;
uint64_t length;
uint64_t mask;
- union {
- uint64_t u64;
- msr_t s;
- } msr_a;
- union {
- uint64_t u64;
- msr_t s;
- } msr_m;
+ msr_t msr_a = rdmsr(msr_reg);
+ msr_t msr_m = rdmsr(msr_reg + 1);
- msr_a.s = rdmsr(msr_reg);
- msr_m.s = rdmsr(msr_reg + 1);
- if (msr_m.u64 & MTRR_PHYS_MASK_VALID) {
- base_address = (msr_a.u64 & 0xfffffffffffff000ULL)
+ if (msr_m.raw & MTRR_PHYS_MASK_VALID) {
+ base_address = (msr_a.raw & 0xfffffffffffff000ULL)
& address_mask;
printk(BIOS_DEBUG,
"0x%016llx: PHYBASE%d: Address = 0x%016llx, %s\n",
- msr_a.u64, index, base_address,
- display_mtrr_type(msr_a.u64 & MTRR_DEF_TYPE_MASK));
- mask = (msr_m.u64 & 0xfffffffffffff000ULL) & address_mask;
+ msr_a.raw, index, base_address,
+ display_mtrr_type(msr_a.raw & MTRR_DEF_TYPE_MASK));
+ mask = (msr_m.raw & 0xfffffffffffff000ULL) & address_mask;
length = (~mask & address_mask) + 1;
printk(BIOS_DEBUG,
"0x%016llx: PHYMASK%d: Length = 0x%016llx, Valid\n",
- msr_m.u64, index, length);
+ msr_m.raw, index, length);
} else {
- printk(BIOS_DEBUG, "0x%016llx: PHYBASE%d\n", msr_a.u64, index);
+ printk(BIOS_DEBUG, "0x%016llx: PHYBASE%d\n", msr_a.raw, index);
printk(BIOS_DEBUG, "0x%016llx: PHYMASK%d: Disabled\n",
- msr_m.u64, index);
+ msr_m.raw, index);
}
}