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>
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 f177b77..40bac9d 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 @@
{
union pstate_msr pstate_reg;
uint8_t high_state;
+ static unsigned long mhz;
if (mhz)
return mhz;