include/cpu/amd/msr: introduce and use PSTATE_MSR_COUNT

Add and use a define for the total number of P-state MSRs to avoid magic
constants in the code.

Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: I37a89faa0f216790b3404fc03edc62408684cc24
Reviewed-on: https://review.coreboot.org/c/coreboot/+/76546
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
This commit is contained in:
Felix Held 2023-07-17 22:59:02 +02:00
parent 8e0bbb30b6
commit c04d3ddbae
2 changed files with 2 additions and 1 deletions

View File

@ -41,6 +41,7 @@
#define PS_STS_REG 0xC0010063
#define PSTATE_0_MSR 0xC0010064
#define PSTATE_MSR(pstate) (PSTATE_0_MSR + (pstate))
#define PSTATE_MSR_COUNT 8
#define MSR_PATCH_LOADER 0xC0010020

View File

@ -21,7 +21,7 @@ static bool all_pstates_have_same_frequency_id(void)
bool first = true;
uint32_t frequency_id;
for (i = 0; i < 8; i++) {
for (i = 0; i < PSTATE_MSR_COUNT; i++) {
pstate_reg.raw = rdmsr(PSTATE_MSR(i)).raw;
if (!pstate_reg.pstate_en)