cpu/intel/model_206ax: Print supported C-states

According to the BWG C-states are processor specific
and BIOS must check if a C-state is supported at all.

Print the supported C-states in before ACPI _CNT generation.

Test: Tested on Lenovo X220 using Intel i5-2540M.
      All C-states are reported as supported.

Change-Id: I713712a1a104714cbf3091782e564e7e784cf21d
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/78133
Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Patrick Rudolph 2023-09-25 08:10:58 +02:00 committed by Felix Held
parent 6a13b520e9
commit 130643277c
1 changed files with 21 additions and 1 deletions

View File

@ -89,12 +89,31 @@ static const acpi_cstate_t cstate_map[] = {
},
};
static const char *const c_state_names[] = {"C0", "C1", "C1E", "C3", "C6", "C7", "C7S"};
static int get_logical_cores_per_package(void)
{
msr_t msr = rdmsr(MSR_CORE_THREAD_COUNT);
return msr.lo & 0xffff;
}
static void print_supported_cstates(void)
{
uint8_t state, substate;
printk(BIOS_DEBUG, "Supported C-states: ");
for (size_t i = 0; i < ARRAY_SIZE(cstate_map); i++) {
state = (cstate_map[i].resource.addrl >> 4) + 1;
substate = cstate_map[i].resource.addrl & 0xf;
/* CPU C0 is always supported */
if (i == 0 || cpu_get_c_substate_support(state) > substate)
printk(BIOS_DEBUG, " %s", c_state_names[i]);
}
printk(BIOS_DEBUG, "\n");
}
static void generate_C_state_entries(const struct device *dev)
{
struct cpu_intel_model_206ax_config *conf = dev->chip_info;
@ -102,7 +121,6 @@ static void generate_C_state_entries(const struct device *dev)
const int acpi_cstates[3] = { conf->acpi_c1, conf->acpi_c2, conf->acpi_c3 };
acpi_cstate_t acpi_cstate_map[ARRAY_SIZE(acpi_cstates)] = { 0 };
/* Count number of active C-states */
int count = 0;
@ -320,6 +338,8 @@ void generate_cpu_entries(const struct device *device)
printk(BIOS_DEBUG, "Found %d CPU(s) with %d core(s) each.\n",
numcpus, cores_per_package);
print_supported_cstates();
for (int cpu_id = 0; cpu_id < numcpus; cpu_id++)
for (int core_id = 0; core_id < cores_per_package; core_id++)
generate_cpu_entry(device, cpu_id, core_id, cores_per_package);