summaryrefslogtreecommitdiff
path: root/src/cpu/intel
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2023-04-12 16:39:12 +0300
committerKyösti Mälkki <kyosti.malkki@gmail.com>2023-04-14 17:35:56 +0000
commite39a3e39202c48c045848bf86d3e8c0e388908eb (patch)
tree3a345bdc5b6ebb5f6cdd45f3a18d9355ba6a06d4 /src/cpu/intel
parent9ac50e1575cd11346bab4343ddd8a6342c8a226b (diff)
cpu,soc/intel: Sync ACPI CPU object implementations
Take variable names from soc/intel and adjust counter to start from zero. Change-Id: I14e1120e74e1bd92acd782a53104fabfb266c3b5 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/74396 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Diffstat (limited to 'src/cpu/intel')
-rw-r--r--src/cpu/intel/haswell/acpi.c16
-rw-r--r--src/cpu/intel/model_2065x/acpi.c16
-rw-r--r--src/cpu/intel/model_206ax/acpi.c18
3 files changed, 19 insertions, 31 deletions
diff --git a/src/cpu/intel/haswell/acpi.c b/src/cpu/intel/haswell/acpi.c
index 1e1c724dbe..66d58adef2 100644
--- a/src/cpu/intel/haswell/acpi.c
+++ b/src/cpu/intel/haswell/acpi.c
@@ -327,30 +327,26 @@ static void generate_P_state_entries(int core, int cores_per_package)
void generate_cpu_entries(const struct device *device)
{
- int coreID, cpuID;
int totalcores = dev_count_cpu();
int cores_per_package = get_logical_cores_per_package();
- int numcpus = totalcores/cores_per_package;
+ int numcpus = totalcores / cores_per_package;
printk(BIOS_DEBUG, "Found %d CPU(s) with %d core(s) each.\n",
numcpus, cores_per_package);
- for (cpuID = 1; cpuID <= numcpus; cpuID++) {
- for (coreID = 1; coreID <= cores_per_package; coreID++) {
+ 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(
- (cpuID - 1) * cores_per_package+coreID - 1);
+ acpigen_write_processor_device(cpu_id * cores_per_package + core_id);
/* Generate P-state tables */
- generate_P_state_entries(
- coreID - 1, cores_per_package);
+ 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(
- cpuID - 1, cores_per_package);
+ generate_T_state_entries(cpu_id, cores_per_package);
acpigen_write_processor_device_end();
}
diff --git a/src/cpu/intel/model_2065x/acpi.c b/src/cpu/intel/model_2065x/acpi.c
index 834a3bbeee..370ea96518 100644
--- a/src/cpu/intel/model_2065x/acpi.c
+++ b/src/cpu/intel/model_2065x/acpi.c
@@ -205,30 +205,26 @@ static void generate_P_state_entries(int core, int cores_per_package)
void generate_cpu_entries(const struct device *device)
{
- int coreID, cpuID;
int totalcores = dev_count_cpu();
int cores_per_package = get_cores_per_package();
- int numcpus = totalcores/cores_per_package;
+ int numcpus = totalcores / cores_per_package;
printk(BIOS_DEBUG, "Found %d CPU(s) with %d core(s) each.\n",
numcpus, cores_per_package);
- for (cpuID = 1; cpuID <= numcpus; cpuID++) {
- for (coreID = 1; coreID <= cores_per_package; coreID++) {
+ 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(
- (cpuID-1)*cores_per_package+coreID-1);
+ acpigen_write_processor_device(cpu_id * cores_per_package + core_id);
/* Generate P-state tables */
- generate_P_state_entries(
- cpuID-1, cores_per_package);
+ 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(
- cpuID-1, cores_per_package);
+ generate_T_state_entries(cpu_id, cores_per_package);
acpigen_write_processor_device_end();
}
diff --git a/src/cpu/intel/model_206ax/acpi.c b/src/cpu/intel/model_206ax/acpi.c
index d7c048d519..a10f8dc66e 100644
--- a/src/cpu/intel/model_206ax/acpi.c
+++ b/src/cpu/intel/model_206ax/acpi.c
@@ -296,30 +296,26 @@ static void generate_P_state_entries(int core, int cores_per_package)
void generate_cpu_entries(const struct device *device)
{
- int coreID, cpuID;
int totalcores = dev_count_cpu();
int cores_per_package = get_logical_cores_per_package();
- int numcpus = totalcores/cores_per_package;
+ int numcpus = totalcores / cores_per_package;
printk(BIOS_DEBUG, "Found %d CPU(s) with %d core(s) each.\n",
numcpus, cores_per_package);
- for (cpuID = 1; cpuID <= numcpus; cpuID++) {
- for (coreID = 1; coreID <= cores_per_package; coreID++) {
- /* Generate Scope(\_SB) { Device(CPU */
- acpigen_write_processor_device(
- (cpuID-1)*cores_per_package+coreID-1);
+ 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(
- cpuID-1, cores_per_package);
+ 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(
- cpuID-1, cores_per_package);
+ generate_T_state_entries(cpu_id, cores_per_package);
acpigen_write_processor_device_end();
}