blob: b6e2d65e96518a6094628869af28794463787208 [file] [log] [blame]
Angel Ponsf23ae0b2020-04-02 23:48:12 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Stefan Reinauer5c554632012-04-04 00:09:50 +02002
3#ifndef _CPU_INTEL_MODEL_206AX_H
4#define _CPU_INTEL_MODEL_206AX_H
5
Angel Pons964d91f2020-12-07 13:11:17 +01006#include <arch/cpu.h>
Elyes HAOUASdfbe6bd2018-10-29 06:56:52 +01007#include <stdint.h>
8
Stefan Reinauerc0f2cfb2012-07-10 17:16:10 -07009/* SandyBridge/IvyBridge bus clock is fixed at 100MHz */
Stefan Reinauer5c554632012-04-04 00:09:50 +020010#define SANDYBRIDGE_BCLK 100
11
Elyes HAOUASa6a396d2019-05-26 13:25:30 +020012#define MSR_CORE_THREAD_COUNT 0x35
Stefan Reinauer5c554632012-04-04 00:09:50 +020013#define MSR_FEATURE_CONFIG 0x13c
Duncan Laurie22935e12012-07-09 09:58:35 -070014#define MSR_FLEX_RATIO 0x194
15#define FLEX_RATIO_LOCK (1 << 20)
16#define FLEX_RATIO_EN (1 << 16)
Duncan Laurie55632112012-07-16 12:19:00 -070017#define MSR_TEMPERATURE_TARGET 0x1a2
Stefan Reinauer5c554632012-04-04 00:09:50 +020018#define MSR_LT_LOCK_MEMORY 0x2e7
Stefan Reinauer5c554632012-04-04 00:09:50 +020019#define MSR_PLATFORM_INFO 0xce
20#define PLATFORM_INFO_SET_TDP (1 << 29)
Stefan Reinauer5c554632012-04-04 00:09:50 +020021
22#define MSR_MISC_PWR_MGMT 0x1aa
23#define MISC_PWR_MGMT_EIST_HW_DIS (1 << 0)
24#define MSR_TURBO_RATIO_LIMIT 0x1ad
25#define MSR_POWER_CTL 0x1fc
26
27#define MSR_PKGC3_IRTL 0x60a
28#define MSR_PKGC6_IRTL 0x60b
29#define MSR_PKGC7_IRTL 0x60c
30#define IRTL_VALID (1 << 15)
31#define IRTL_1_NS (0 << 10)
32#define IRTL_32_NS (1 << 10)
33#define IRTL_1024_NS (2 << 10)
34#define IRTL_32768_NS (3 << 10)
35#define IRTL_1048576_NS (4 << 10)
36#define IRTL_33554432_NS (5 << 10)
37#define IRTL_RESPONSE_MASK (0x3ff)
38
39/* long duration in low dword, short duration in high dword */
40#define MSR_PKG_POWER_LIMIT 0x610
41#define PKG_POWER_LIMIT_MASK 0x7fff
42#define PKG_POWER_LIMIT_EN (1 << 15)
43#define PKG_POWER_LIMIT_CLAMP (1 << 16)
44#define PKG_POWER_LIMIT_TIME_SHIFT 17
45#define PKG_POWER_LIMIT_TIME_MASK 0x7f
46
47#define MSR_PP0_CURRENT_CONFIG 0x601
48#define PP0_CURRENT_LIMIT (112 << 3) /* 112 A */
49#define MSR_PP1_CURRENT_CONFIG 0x602
Duncan Laurie4e4320f2012-06-25 09:53:58 -070050#define PP1_CURRENT_LIMIT_SNB (35 << 3) /* 35 A */
51#define PP1_CURRENT_LIMIT_IVB (50 << 3) /* 50 A */
Stefan Reinauer5c554632012-04-04 00:09:50 +020052#define MSR_PKG_POWER_SKU_UNIT 0x606
53#define MSR_PKG_POWER_SKU 0x614
54#define MSR_PP0_POWER_LIMIT 0x638
55#define MSR_PP1_POWER_LIMIT 0x640
56
Duncan Laurie77dbbac2012-06-25 09:51:59 -070057#define IVB_CONFIG_TDP_MIN_CPUID 0x306a2
58#define MSR_CONFIG_TDP_NOMINAL 0x648
59#define MSR_CONFIG_TDP_LEVEL1 0x649
60#define MSR_CONFIG_TDP_LEVEL2 0x64a
61#define MSR_CONFIG_TDP_CONTROL 0x64b
62#define MSR_TURBO_ACTIVATION_RATIO 0x64c
63
Stefan Reinauer5c554632012-04-04 00:09:50 +020064/* P-state configuration */
65#define PSS_MAX_ENTRIES 8
66#define PSS_RATIO_STEP 2
67#define PSS_LATENCY_TRANSITION 10
68#define PSS_LATENCY_BUSMASTER 10
69
Arthur Heymans67031a52018-02-05 19:08:03 +010070/* Sanity check config options. */
Kyösti Mälkkif6c20682019-08-02 06:14:50 +030071#if (CONFIG_SMM_TSEG_SIZE <= (CONFIG_IED_REGION_SIZE + CONFIG_SMM_RESERVED_SIZE))
72# error "CONFIG_SMM_TSEG_SIZE <= (CONFIG_IED_REGION_SIZE + CONFIG_SMM_RESERVED_SIZE)"
Arthur Heymans67031a52018-02-05 19:08:03 +010073#endif
74#if (CONFIG_SMM_TSEG_SIZE < 0x800000)
75# error "CONFIG_SMM_TSEG_SIZE must at least be 8MiB"
76#endif
77#if ((CONFIG_SMM_TSEG_SIZE & (CONFIG_SMM_TSEG_SIZE - 1)) != 0)
78# error "CONFIG_SMM_TSEG_SIZE is not a power of 2"
79#endif
80#if ((CONFIG_IED_REGION_SIZE & (CONFIG_IED_REGION_SIZE - 1)) != 0)
81# error "CONFIG_IED_REGION_SIZE is not a power of 2"
82#endif
83
Stefan Reinauer5c554632012-04-04 00:09:50 +020084/* Lock MSRs */
85void intel_model_206ax_finalize_smm(void);
Kyösti Mälkki82c0e7e2019-11-05 19:06:56 +020086
Stefan Reinauer5c554632012-04-04 00:09:50 +020087/* Configure power limits for turbo mode */
88void set_power_limits(u8 power_limit_1_time);
Duncan Laurie77dbbac2012-06-25 09:51:59 -070089int cpu_config_tdp_levels(void);
Patrick Rudolph74203de2017-11-20 11:57:01 +010090int get_platform_id(void);
Stefan Reinauer5c554632012-04-04 00:09:50 +020091
Angel Pons964d91f2020-12-07 13:11:17 +010092static inline u8 cpu_stepping(void)
93{
94 return cpuid_eax(1) & 0xf;
95}
96
Stefan Reinauer5c554632012-04-04 00:09:50 +020097#endif