summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrey Petrov <anpetrov@fb.com>2019-10-23 17:12:10 -0700
committerAndrey Petrov <anpetrov@fb.com>2019-10-28 18:27:35 +0000
commit0108c8b742bd7a3a7c2db8357677211e7eb14fac (patch)
treea8a95f552020a2723228a8f6af4ea8869861e8e2 /src
parent2e032f07df0d4ff5c1d9814b82ed32820cb0ee59 (diff)
soc/intel/broadwell_de: Implement smbios_cpu_get_maximum_freq_mhz()
Determine maximum speed by looking at either turbo flex limit or uncore ratio limit. Signed-off-by: Andrey Petrov <anpetrov@fb.com> Change-Id: I0f3a64a40cb1d28d8eb9380c2071ec748e345b88 Reviewed-on: https://review.coreboot.org/c/coreboot/+/36284 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: David Hendricks <david.hendricks@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/soc/intel/fsp_broadwell_de/cpu.c22
-rw-r--r--src/soc/intel/fsp_broadwell_de/include/soc/msr.h1
2 files changed, 23 insertions, 0 deletions
diff --git a/src/soc/intel/fsp_broadwell_de/cpu.c b/src/soc/intel/fsp_broadwell_de/cpu.c
index ac4dcc92dd..b94ee78d7a 100644
--- a/src/soc/intel/fsp_broadwell_de/cpu.c
+++ b/src/soc/intel/fsp_broadwell_de/cpu.c
@@ -20,6 +20,7 @@
#include <cpu/cpu.h>
#include <cpu/intel/microcode.h>
#include <cpu/intel/smm_reloc.h>
+#include <cpu/intel/turbo.h>
#include <cpu/x86/cache.h>
#include <cpu/x86/lapic.h>
#include <cpu/x86/mp.h>
@@ -27,6 +28,8 @@
#include <cpu/x86/mtrr.h>
#include <device/device.h>
#include <device/pci_ops.h>
+#include <smbios.h>
+#include <soc/broadwell_de.h>
#include <soc/lpc.h>
#include <soc/msr.h>
#include <soc/pattrs.h>
@@ -98,6 +101,25 @@ static void set_max_ratio(void)
wrmsr(IA32_PERF_CTL, perf_ctl);
}
+unsigned int smbios_cpu_get_max_speed_mhz(void)
+{
+ msr_t msr;
+ uint32_t uncore_max_ratio, turbo_max_ratio = 0;
+
+ /*
+ * Use turbo's max ratio if it is enabled, otherwise use
+ * uncore's max ratio.
+ */
+ msr = rdmsr(MSR_UNCORE_RATIO_LIMIT);
+ uncore_max_ratio = msr.lo & 0x7f;
+ if (get_turbo_state() == TURBO_ENABLED) {
+ msr = rdmsr(MSR_TURBO_RATIO_LIMIT);
+ turbo_max_ratio = msr.lo & 0xff; /* 1 core */
+ }
+
+ return MAX(uncore_max_ratio, turbo_max_ratio) * CPU_BCLK;
+}
+
static void alt_smm_lock(void)
{
struct device *dev = pcidev_on_root(LPC_DEV, LPC_FUNC);
diff --git a/src/soc/intel/fsp_broadwell_de/include/soc/msr.h b/src/soc/intel/fsp_broadwell_de/include/soc/msr.h
index e4b8c50e20..f9fdffb2bf 100644
--- a/src/soc/intel/fsp_broadwell_de/include/soc/msr.h
+++ b/src/soc/intel/fsp_broadwell_de/include/soc/msr.h
@@ -23,6 +23,7 @@
#define MSR_TURBO_RATIO_LIMIT 0x1ad
#define MSR_PKG_POWER_SKU_UNIT 0x606
#define MSR_PKG_POWER_LIMIT 0x610
+#define MSR_UNCORE_RATIO_LIMIT 0x620
#define MSR_CONFIG_TDP_NOMINAL 0x648
#define SMM_MCA_CAP_MSR 0x17d