diff options
author | Patrick Rudolph <patrick.rudolph@9elements.com> | 2023-09-25 08:10:58 +0200 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2023-10-06 12:16:46 +0000 |
commit | 130643277c348113064977b69159b145a7578294 (patch) | |
tree | fd81a206ee3b1fd42f911d533032644baea23b76 | |
parent | 6a13b520e9ae8dbb85a2522f78b931285b0e8f95 (diff) |
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>
-rw-r--r-- | src/cpu/intel/model_206ax/acpi.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/cpu/intel/model_206ax/acpi.c b/src/cpu/intel/model_206ax/acpi.c index 994f3bbe9e..2fceda18c0 100644 --- a/src/cpu/intel/model_206ax/acpi.c +++ b/src/cpu/intel/model_206ax/acpi.c @@ -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); |