From 0a466040e0dc3351ac819ba00146f284e5f70f05 Mon Sep 17 00:00:00 2001 From: Felix Held Date: Mon, 27 Feb 2023 23:56:39 +0100 Subject: soc/amd: introduce and use PSTATE_MSR macro Instead of adding the P-state number to the PSTATE_0_MSR number to get the P-state MSR number for the rdmsr call, provide a macro that directly calculates the MSR number for a given power state. Also drop the unused PSTATE_[1..4]_MSR definitions which also didn't cover all P-state MSRs available in the hardware. Signed-off-by: Felix Held Change-Id: If85acf556efe82c209e1608e56c05f7a2a748403 Reviewed-on: https://review.coreboot.org/c/coreboot/+/73323 Tested-by: build bot (Jenkins) Reviewed-by: Elyes Haouas Reviewed-by: Fred Reitberger Reviewed-by: Arthur Heymans --- src/soc/amd/common/block/cpu/tsc/tsc_freq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/soc/amd/common/block/cpu/tsc') diff --git a/src/soc/amd/common/block/cpu/tsc/tsc_freq.c b/src/soc/amd/common/block/cpu/tsc/tsc_freq.c index 55c86653ce..fbbf399731 100644 --- a/src/soc/amd/common/block/cpu/tsc/tsc_freq.c +++ b/src/soc/amd/common/block/cpu/tsc/tsc_freq.c @@ -22,7 +22,7 @@ unsigned long tsc_freq_mhz(void) return mhz; high_state = rdmsr(PS_LIM_REG).lo & 0x7; - msr = rdmsr(PSTATE_0_MSR + high_state); + msr = rdmsr(PSTATE_MSR(high_state)); if (!(msr.hi & 0x80000000)) die("Unknown error: cannot determine P-state 0\n"); -- cgit v1.2.3