intel/i82371eb,speedstep: Use dev_count_cpu()

Change-Id: I8582d401c72ad44137f117315c5c6869654c3e99
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/74397
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
This commit is contained in:
Kyösti Mälkki 2023-04-12 21:25:16 +03:00
parent c77b607138
commit 8e6146049f
2 changed files with 2 additions and 26 deletions

View File

@ -9,18 +9,6 @@
#include <device/device.h> #include <device/device.h>
#include <types.h> #include <types.h>
static int determine_total_number_of_cores(void)
{
struct device *cpu;
int count = 0;
for (cpu = all_devices; cpu; cpu = cpu->next) {
if (!is_enabled_cpu(cpu))
continue;
count++;
}
return count;
}
static void gen_pstate_entries(const sst_table_t *const pstates, static void gen_pstate_entries(const sst_table_t *const pstates,
const int cpuID, const int cores_per_package, const int cpuID, const int cores_per_package,
const uint8_t coordination) const uint8_t coordination)
@ -78,7 +66,7 @@ static void gen_pstate_entries(const sst_table_t *const pstates,
void generate_cpu_entries(const struct device *device) void generate_cpu_entries(const struct device *device)
{ {
int coreID, cpuID, pcontrol_blk = PMB0_BASE, plen = 6; int coreID, cpuID, pcontrol_blk = PMB0_BASE, plen = 6;
int totalcores = determine_total_number_of_cores(); int totalcores = dev_count_cpu();
int cores_per_package = (cpuid_ebx(1)>>16) & 0xff; int cores_per_package = (cpuid_ebx(1)>>16) & 0xff;
int numcpus = totalcores/cores_per_package; /* This assumes that all int numcpus = totalcores/cores_per_package; /* This assumes that all
CPUs share the same CPUs share the same

View File

@ -6,22 +6,10 @@
#include <device/device.h> #include <device/device.h>
#include "i82371eb.h" #include "i82371eb.h"
static int determine_total_number_of_cores(void)
{
struct device *cpu;
int count = 0;
for (cpu = all_devices; cpu; cpu = cpu->next) {
if (!is_enabled_cpu(cpu))
continue;
count++;
}
return count;
}
void generate_cpu_entries(const struct device *device) void generate_cpu_entries(const struct device *device)
{ {
int cpu, pcontrol_blk=DEFAULT_PMBASE+PCNTRL, plen=6; int cpu, pcontrol_blk=DEFAULT_PMBASE+PCNTRL, plen=6;
int numcpus = determine_total_number_of_cores(); int numcpus = dev_count_cpu();
printk(BIOS_DEBUG, "Found %d CPU(s).\n", numcpus); printk(BIOS_DEBUG, "Found %d CPU(s).\n", numcpus);
/* without the outer scope, further ssdt addition will end up /* without the outer scope, further ssdt addition will end up