summaryrefslogtreecommitdiff
path: root/src/soc/amd/picasso/include
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2023-03-10 00:00:19 +0100
committerFelix Held <felix-coreboot@felixheld.de>2023-03-20 19:52:10 +0000
commit659e154d68a5dd706e1d99513a9a7947ab3b87fc (patch)
treef350b86dcd3e98ac65d09f52bba0f3f38ff49595 /src/soc/amd/picasso/include
parent2b824fd28ff5cb0e771683076378a327624cfad3 (diff)
soc/amd/picasso: introduce and use pstate_msr bitfield struct
Add the pstate_msr union of a bitfield struct and a raw uint64_t to allow easier access of the bitfields of the P state MSRs and use this bitfield struct in get_pstate_core_freq and get_pstate_core_power. The signature of those two function will be changed in a follow-up commit. TEST=The coreboot-generated SSDT containing the P state packages stays identical on Mandolin. Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: I8dc293351f9941cfb8a9c84d9fb9a4fd76361d5d Reviewed-on: https://review.coreboot.org/c/coreboot/+/73643 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com>
Diffstat (limited to 'src/soc/amd/picasso/include')
-rw-r--r--src/soc/amd/picasso/include/soc/msr.h23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/soc/amd/picasso/include/soc/msr.h b/src/soc/amd/picasso/include/soc/msr.h
index 23926144c2..05cda1ca89 100644
--- a/src/soc/amd/picasso/include/soc/msr.h
+++ b/src/soc/amd/picasso/include/soc/msr.h
@@ -8,19 +8,22 @@
#define AMD_PICASSO_MSR_H
/* MSRC001_00[6B:64] P-state [7:0] bit definitions */
-#define PSTATE_DEF_LO_CUR_DIV_SHIFT 30
-#define PSTATE_DEF_LO_CUR_DIV_MASK (0x3 << PSTATE_DEF_LO_CUR_DIV_SHIFT)
-#define PSTATE_DEF_LO_CUR_VAL_SHIFT 22
-#define PSTATE_DEF_LO_CUR_VAL_MASK (0xFF << PSTATE_DEF_LO_CUR_VAL_SHIFT)
-#define PSTATE_DEF_LO_CORE_VID_SHIFT 14
-#define PSTATE_DEF_LO_CORE_VID_MASK (0xFF << PSTATE_DEF_LO_CORE_VID_SHIFT)
-#define PSTATE_DEF_LO_FREQ_DIV_SHIFT 8
-#define PSTATE_DEF_LO_FREQ_DIV_MASK (0x3F << PSTATE_DEF_LO_FREQ_DIV_SHIFT)
+union pstate_msr {
+ struct {
+ uint64_t cpu_fid_0_7 : 8; /* [ 0.. 7] */
+ uint64_t cpu_dfs_id : 6; /* [ 8..13] */
+ uint64_t cpu_vid_0_7 : 8; /* [14..21] */
+ uint64_t idd_value : 8; /* [22..29] */
+ uint64_t idd_div : 2; /* [30..31] */
+ uint64_t : 31; /* [32..62] */
+ uint64_t pstate_en : 1; /* [63..63] */
+ };
+ uint64_t raw;
+};
+
#define PSTATE_DEF_LO_FREQ_DIV_MIN 0x8
#define PSTATE_DEF_LO_EIGHTH_STEP_MAX 0x1A
#define PSTATE_DEF_LO_FREQ_DIV_MAX 0x3E
-#define PSTATE_DEF_LO_FREQ_MUL_SHIFT 0
-#define PSTATE_DEF_LO_FREQ_MUL_MASK (0xFF << PSTATE_DEF_LO_FREQ_MUL_SHIFT)
#define PSTATE_DEF_LO_CORE_FREQ_BASE 25
/* Value defined in Serial VID Interface 2.0 spec (#48022, NDA only) */