aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2023-03-24 19:30:43 +0100
committerFelix Held <felix-coreboot@felixheld.de>2023-03-29 16:17:10 +0000
commit56f1221f2fd00d27fedb6de9f8501127e66f5878 (patch)
treec71684d61bab000be4799bdeca3f842472a00391 /src
parent4057ab4f314ae17402fa7635d17d86304b9ce060 (diff)
soc/amd/common/block/cpu/tsc_freq: move static variable inside function
Move the static mhz variable inside the only function that is accessing it. Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: Ief98c0a1c35fe1bbc4ff38dd175f12e0b3ddc515 Reviewed-on: https://review.coreboot.org/c/coreboot/+/74014 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com> Reviewed-by: Martin Roth <martin.roth@amd.corp-partner.google.com>
Diffstat (limited to 'src')
-rw-r--r--src/soc/amd/common/block/cpu/tsc/tsc_freq.c3
1 files changed, 1 insertions, 2 deletions
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 f177b77673..40bac9df3a 100644
--- a/src/soc/amd/common/block/cpu/tsc/tsc_freq.c
+++ b/src/soc/amd/common/block/cpu/tsc/tsc_freq.c
@@ -7,8 +7,6 @@
#include <console/console.h>
#include <soc/msr.h>
-static unsigned long mhz;
-
/* Use this default TSC frequency when it can not be correctly calculated.
Higher numbers are safer as it will result in longer delays using TSC */
#define TSC_DEFAULT_FREQ_MHZ 4000
@@ -17,6 +15,7 @@ unsigned long tsc_freq_mhz(void)
{
union pstate_msr pstate_reg;
uint8_t high_state;
+ static unsigned long mhz;
if (mhz)
return mhz;