Kyösti Mälkki has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/74399 )
Change subject: cpu,soc/intel: Separate single SSDT CPU entry ......................................................................
cpu,soc/intel: Separate single SSDT CPU entry
Change-Id: Ic75e8907de9730c6fdb06dbe799a7644fa90f904 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M src/cpu/intel/haswell/acpi.c M src/cpu/intel/model_2065x/acpi.c M src/cpu/intel/model_206ax/acpi.c M src/soc/intel/baytrail/acpi.c M src/soc/intel/braswell/acpi.c M src/soc/intel/common/block/acpi/acpi.c 6 files changed, 129 insertions(+), 98 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/99/74399/1
diff --git a/src/cpu/intel/haswell/acpi.c b/src/cpu/intel/haswell/acpi.c index 66d58ad..3727d8a 100644 --- a/src/cpu/intel/haswell/acpi.c +++ b/src/cpu/intel/haswell/acpi.c @@ -325,6 +325,23 @@ acpigen_pop_len(); }
+static void generate_cpu_entry(const struct device *device, int cpu, int core, int cores_per_package) +{ + /* Generate Scope(_SB) { Device(CPUx */ + acpigen_write_processor_device(cpu * cores_per_package + core); + + /* Generate P-state tables */ + generate_P_state_entries(core, cores_per_package); + + /* Generate C-state tables */ + generate_C_state_entries(device); + + /* Generate T-state tables */ + generate_T_state_entries(cpu, cores_per_package); + + acpigen_write_processor_device_end(); +} + void generate_cpu_entries(const struct device *device) { int totalcores = dev_count_cpu(); @@ -334,23 +351,9 @@ printk(BIOS_DEBUG, "Found %d CPU(s) with %d core(s) each.\n", numcpus, cores_per_package);
- for (int cpu_id = 0; cpu_id < numcpus; cpu_id++) { - for (int core_id = 0; core_id < cores_per_package; core_id++) { - /* Generate Scope(_SB) { Device(CPUx */ - acpigen_write_processor_device(cpu_id * cores_per_package + core_id); - - /* Generate P-state tables */ - generate_P_state_entries(core_id, cores_per_package); - - /* Generate C-state tables */ - generate_C_state_entries(device); - - /* Generate T-state tables */ - generate_T_state_entries(cpu_id, cores_per_package); - - acpigen_write_processor_device_end(); - } - } + 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);
/* PPKG is usually used for thermal management of the first and only package. */ diff --git a/src/cpu/intel/model_2065x/acpi.c b/src/cpu/intel/model_2065x/acpi.c index 370ea96..d8fef62 100644 --- a/src/cpu/intel/model_2065x/acpi.c +++ b/src/cpu/intel/model_2065x/acpi.c @@ -203,6 +203,23 @@ acpigen_pop_len(); }
+static void generate_cpu_entry(int cpu, int core, int cores_per_package) +{ + /* Generate Scope(_SB) { Device(CPUx */ + acpigen_write_processor_device(cpu * cores_per_package + core); + + /* Generate P-state tables */ + generate_P_state_entries(cpu, cores_per_package); + + /* Generate C-state tables */ + generate_C_state_entries(); + + /* Generate T-state tables */ + generate_T_state_entries(cpu, cores_per_package); + + acpigen_write_processor_device_end(); +} + void generate_cpu_entries(const struct device *device) { int totalcores = dev_count_cpu(); @@ -212,23 +229,9 @@ printk(BIOS_DEBUG, "Found %d CPU(s) with %d core(s) each.\n", numcpus, cores_per_package);
- for (int cpu_id = 0; cpu_id < numcpus; cpu_id++) { - for (int core_id = 0; core_id < cores_per_package; core_id++) { - /* Generate Scope(_SB) { Device(CPUx */ - acpigen_write_processor_device(cpu_id * cores_per_package + core_id); - - /* Generate P-state tables */ - generate_P_state_entries(cpu_id, cores_per_package); - - /* Generate C-state tables */ - generate_C_state_entries(); - - /* Generate T-state tables */ - generate_T_state_entries(cpu_id, cores_per_package); - - acpigen_write_processor_device_end(); - } - } + 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(cpu_id, core_id, cores_per_package);
/* PPKG is usually used for thermal management of the first and only package. */ diff --git a/src/cpu/intel/model_206ax/acpi.c b/src/cpu/intel/model_206ax/acpi.c index a10f8dc..994f3bb 100644 --- a/src/cpu/intel/model_206ax/acpi.c +++ b/src/cpu/intel/model_206ax/acpi.c @@ -294,6 +294,23 @@ acpigen_pop_len(); }
+static void generate_cpu_entry(const struct device *device, int cpu, int core, int cores_per_package) +{ + /* Generate Scope(_SB) { Device(CPUx */ + acpigen_write_processor_device(cpu * cores_per_package + core); + + /* Generate P-state tables */ + generate_P_state_entries(cpu, cores_per_package); + + /* Generate C-state tables */ + generate_C_state_entries(device); + + /* Generate T-state tables */ + generate_T_state_entries(cpu, cores_per_package); + + acpigen_write_processor_device_end(); +} + void generate_cpu_entries(const struct device *device) { int totalcores = dev_count_cpu(); @@ -303,23 +320,9 @@ printk(BIOS_DEBUG, "Found %d CPU(s) with %d core(s) each.\n", numcpus, cores_per_package);
- for (int cpu_id = 0; cpu_id < numcpus; cpu_id++) { - for (int core_id = 0; core_id < cores_per_package; core_id++) { - /* Generate Scope(_SB) { Device(CPUx */ - acpigen_write_processor_device(cpu_id * cores_per_package + core_id); - - /* Generate P-state tables */ - generate_P_state_entries(cpu_id, cores_per_package); - - /* Generate C-state tables */ - generate_C_state_entries(device); - - /* Generate T-state tables */ - generate_T_state_entries(cpu_id, cores_per_package); - - acpigen_write_processor_device_end(); - } - } + 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);
/* PPKG is usually used for thermal management of the first and only package. */ diff --git a/src/soc/intel/baytrail/acpi.c b/src/soc/intel/baytrail/acpi.c index 42e4b26..e1e92f0 100644 --- a/src/soc/intel/baytrail/acpi.c +++ b/src/soc/intel/baytrail/acpi.c @@ -145,7 +145,7 @@ return (int)power; }
-static void generate_p_state_entries(int core, int cores_per_package) +static void generate_p_state_entries(int core) { int ratio_min, ratio_max, ratio_turbo, ratio_step, ratio_range_2; int coord_type, power_max, power_unit, num_entries; @@ -260,26 +260,30 @@ acpigen_pop_len(); }
+static void generate_cpu_entry(int core, int cores_per_package) +{ + /* Generate Scope(_SB) { Device(CPUx */ + acpigen_write_processor_device(core); + + /* Generate P-state tables */ + generate_p_state_entries(core); + + /* Generate C-state tables */ + acpigen_write_CST_package(cstate_map, ARRAY_SIZE(cstate_map)); + + /* Generate T-state tables */ + generate_t_state_entries(core, cores_per_package); + + acpigen_write_processor_device_end(); +} + void generate_cpu_entries(const struct device *device) { int core; const struct pattrs *pattrs = pattrs_get();
- for (core = 0; core < pattrs->num_cpus; core++) { - /* Generate Scope(_SB) { Device(CPUx */ - acpigen_write_processor_device(core); - - /* Generate P-state tables */ - generate_p_state_entries(core, pattrs->num_cpus); - - /* Generate C-state tables */ - acpigen_write_CST_package(cstate_map, ARRAY_SIZE(cstate_map)); - - /* Generate T-state tables */ - generate_t_state_entries(core, pattrs->num_cpus); - - acpigen_write_processor_device_end(); - } + for (core = 0; core < pattrs->num_cpus; core++) + generate_cpu_entry(core, pattrs->num_cpus);
/* PPKG is usually used for thermal management of the first and only package. */ diff --git a/src/soc/intel/braswell/acpi.c b/src/soc/intel/braswell/acpi.c index 9ef7a75..5898ad1 100644 --- a/src/soc/intel/braswell/acpi.c +++ b/src/soc/intel/braswell/acpi.c @@ -161,7 +161,7 @@ return (int)power; }
-static void generate_p_state_entries(int core, int cores_per_package) +static void generate_p_state_entries(int core) { int ratio_min, ratio_max, ratio_turbo, ratio_step, ratio_range_2; int coord_type, power_max, power_unit, num_entries; @@ -276,26 +276,30 @@ acpigen_pop_len(); }
+static void generate_cpu_entry(int core, int cores_per_package) +{ + /* Generate Scope(_SB) { Device(CPUx */ + acpigen_write_processor_device(core); + + /* Generate P-state tables */ + generate_p_state_entries(core); + + /* Generate C-state tables */ + acpigen_write_CST_package(cstate_map, ARRAY_SIZE(cstate_map)); + + /* Generate T-state tables */ + generate_t_state_entries(core, cores_per_package); + + acpigen_write_processor_device_end(); +} + void generate_cpu_entries(const struct device *device) { int core; const struct pattrs *pattrs = pattrs_get();
- for (core = 0; core < pattrs->num_cpus; core++) { - /* Generate Scope(_SB) { Device(CPUx */ - acpigen_write_processor_device(core); - - /* Generate P-state tables */ - generate_p_state_entries(core, pattrs->num_cpus); - - /* Generate C-state tables */ - acpigen_write_CST_package(cstate_map, ARRAY_SIZE(cstate_map)); - - /* Generate T-state tables */ - generate_t_state_entries(core, pattrs->num_cpus); - - acpigen_write_processor_device_end(); - } + for (core = 0; core < pattrs->num_cpus; core++) + generate_cpu_entry(core, pattrs->num_cpus);
/* PPKG is usually used for thermal management of the first and only package. */ diff --git a/src/soc/intel/common/block/acpi/acpi.c b/src/soc/intel/common/block/acpi/acpi.c index 4139054..0e2fb38 100644 --- a/src/soc/intel/common/block/acpi/acpi.c +++ b/src/soc/intel/common/block/acpi/acpi.c @@ -387,6 +387,22 @@ { }
+static void generate_cpu_entry(const struct device *device, int cpu, int core, int cores_per_package) +{ + /* Generate processor _SB.CPUx */ + acpigen_write_processor_device(cpu * cores_per_package + core); + + /* Generate C-state tables */ + generate_c_state_entries(); + + generate_cppc_entries(core); + + /* Soc specific power states generation */ + soc_power_states_generation(core, cores_per_package); + + acpigen_write_processor_device_end(); +} + void generate_cpu_entries(const struct device *device) { int core_id, cpu_id; @@ -401,22 +417,10 @@ printk(BIOS_DEBUG, "Found %d CPU(s) with %d/%d physical/logical core(s) each.\n", numcpus, num_phys, num_virt);
- for (cpu_id = 0; cpu_id < numcpus; cpu_id++) { - for (core_id = 0; core_id < num_virt; core_id++) { - /* Generate processor _SB.CPUx */ - acpigen_write_processor_device(cpu_id * num_virt + core_id); + for (cpu_id = 0; cpu_id < numcpus; cpu_id++) + for (core_id = 0; core_id < num_virt; core_id++) + generate_cpu_entry(device, cpu_id, core_id, num_virt);
- /* Generate C-state tables */ - generate_c_state_entries(); - - generate_cppc_entries(core_id); - - /* Soc specific power states generation */ - soc_power_states_generation(core_id, num_virt); - - acpigen_write_processor_device_end(); - } - } /* PPKG is usually used for thermal management of the first and only package. */ acpigen_write_processor_package("PPKG", 0, num_virt);