include/cpu/x86/msr: introduce IA32_MC_*(x) macros

When accessing the MCA MSRs, the MCA bank number gets multiplied by 4
and added to the IA32_MC0_* define to get the MSR number. Add a macro
that already does this calculation to avoid open coding this repeatedly.

Change-Id: I2de753b8c8ac8dcff5a94d5bba43aa13bbf94b99
Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56243
Reviewed-by: Raul Rangel <rrangel@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Felix Held
2021-07-13 00:54:32 +02:00
parent e3f7ef2286
commit 1b46e76df9
11 changed files with 22 additions and 19 deletions

View File

@@ -483,7 +483,7 @@ bool intel_txt_prepare_txt_env(void)
*/
size_t max_mc_msr = mca_get_bank_count();
for (size_t i = 0; i < max_mc_msr; i++) {
msr = rdmsr(IA32_MC0_STATUS + 4 * i);
msr = rdmsr(IA32_MC_STATUS(i));
if (!(msr.hi & MCA_STATUS_HI_UC))
continue;