aboutsummaryrefslogtreecommitdiff
path: root/src/soc/amd/phoenix
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2023-03-07 01:41:56 +0100
committerFelix Held <felix-coreboot@felixheld.de>2023-03-08 14:05:46 +0000
commite266dacaa103ce399f5bb2d5254f18fc978b934f (patch)
treef2982fa5ead5cc854942209305b8397684e9ade3 /src/soc/amd/phoenix
parenta4284b0bd4db7e046802a3a2d6637c84352ce4c1 (diff)
soc/amd/*/acpi: factor out common generate_cpu_entries implementation
With the exception of the generate_cppc_entries call, the implementations of generate_cpu_entries of Picasso, Cezanne, Mendocino, Phoenix and Glinda are identical, so factor it out and move it to the common AMD SoC code. Since all SoCs that support CPPC already select the SOC_AMD_COMMON_BLOCK_ACPI_CPPC Kconfig option, this can be used to only call generate_cppc_entries for platforms where it is available. Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: I71323d9d071b6f9d82852479b60dc56c24f2b9ec Reviewed-on: https://review.coreboot.org/c/coreboot/+/73504 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com>
Diffstat (limited to 'src/soc/amd/phoenix')
-rw-r--r--src/soc/amd/phoenix/acpi.c59
1 files changed, 2 insertions, 57 deletions
diff --git a/src/soc/amd/phoenix/acpi.c b/src/soc/amd/phoenix/acpi.c
index 2646f2f1a1..ca60e8c721 100644
--- a/src/soc/amd/phoenix/acpi.c
+++ b/src/soc/amd/phoenix/acpi.c
@@ -187,8 +187,8 @@ static uint32_t get_pstate_core_power(msr_t pstate_def)
/*
* Populate structure describing enabled p-states and return count of enabled p-states.
*/
-static size_t get_pstate_info(struct acpi_sw_pstate *pstate_values,
- struct acpi_xpss_sw_pstate *pstate_xpss_values)
+size_t get_pstate_info(struct acpi_sw_pstate *pstate_values,
+ struct acpi_xpss_sw_pstate *pstate_xpss_values)
{
msr_t pstate_def;
size_t pstate_count, pstate;
@@ -249,58 +249,3 @@ const acpi_cstate_t *get_cstate_config_data(size_t *size)
*size = ARRAY_SIZE(cstate_cfg_table);
return cstate_cfg_table;
}
-
-void generate_cpu_entries(const struct device *device)
-{
- int logical_cores;
- size_t cstate_count, pstate_count, cpu;
- acpi_cstate_t cstate_values[MAX_CSTATE_COUNT] = { {0} };
- struct acpi_sw_pstate pstate_values[MAX_PSTATES] = { {0} };
- struct acpi_xpss_sw_pstate pstate_xpss_values[MAX_PSTATES] = { {0} };
- uint32_t threads_per_core;
-
- const acpi_addr_t perf_ctrl = {
- .space_id = ACPI_ADDRESS_SPACE_FIXED,
- .bit_width = 64,
- .addrl = PS_CTL_REG,
- };
- const acpi_addr_t perf_sts = {
- .space_id = ACPI_ADDRESS_SPACE_FIXED,
- .bit_width = 64,
- .addrl = PS_STS_REG,
- };
-
- threads_per_core = get_threads_per_core();
- cstate_count = get_cstate_info(cstate_values);
- pstate_count = get_pstate_info(pstate_values, pstate_xpss_values);
- logical_cores = get_cpu_count();
-
- for (cpu = 0; cpu < logical_cores; cpu++) {
- acpigen_write_processor_device(cpu);
-
- acpigen_write_pct_package(&perf_ctrl, &perf_sts);
-
- acpigen_write_pss_object(pstate_values, pstate_count);
-
- acpigen_write_xpss_object(pstate_xpss_values, pstate_count);
-
- if (CONFIG(ACPI_SSDT_PSD_INDEPENDENT))
- acpigen_write_PSD_package(cpu / threads_per_core, threads_per_core,
- HW_ALL);
- else
- acpigen_write_PSD_package(0, logical_cores, SW_ALL);
-
- acpigen_write_PPC(0);
-
- acpigen_write_CST_package(cstate_values, cstate_count);
-
- acpigen_write_CSD_package(cpu / threads_per_core, threads_per_core,
- CSD_HW_ALL, 0);
-
- generate_cppc_entries(cpu);
-
- acpigen_write_processor_device_end();
- }
-
- acpigen_write_processor_package("PPKG", 0, logical_cores);
-}