treewide: use is_enabled_cpu() on cycles over device list
use is_enabled_cpu() on cycles over device list to check whether the current device is enabled cpu. TEST: compile test and qemu run successfully with coreinfo payload Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com> Change-Id: If64bd18f006b6f5fecef4f606c1df7d3a4d42883 Reviewed-on: https://review.coreboot.org/c/coreboot/+/67797 Reviewed-by: Tim Wawrzynczak <inforichland@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
This commit is contained in:
parent
c5573d62b7
commit
45aae7f10f
|
@ -147,11 +147,7 @@ unsigned long acpi_create_madt_lapics(unsigned long current)
|
||||||
int index, apic_ids[CONFIG_MAX_CPUS] = {0}, num_cpus = 0;
|
int index, apic_ids[CONFIG_MAX_CPUS] = {0}, num_cpus = 0;
|
||||||
|
|
||||||
for (cpu = all_devices; cpu; cpu = cpu->next) {
|
for (cpu = all_devices; cpu; cpu = cpu->next) {
|
||||||
if ((cpu->path.type != DEVICE_PATH_APIC) ||
|
if (!is_enabled_cpu(cpu))
|
||||||
(cpu->bus->dev->path.type != DEVICE_PATH_CPU_CLUSTER)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!cpu->enabled)
|
|
||||||
continue;
|
continue;
|
||||||
if (num_cpus >= ARRAY_SIZE(apic_ids))
|
if (num_cpus >= ARRAY_SIZE(apic_ids))
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -160,12 +160,7 @@ void smp_write_processors(struct mp_config_table *mc)
|
||||||
for (order_id = 0; order_id < 256; order_id++) {
|
for (order_id = 0; order_id < 256; order_id++) {
|
||||||
for (cpu = all_devices; cpu; cpu = cpu->next) {
|
for (cpu = all_devices; cpu; cpu = cpu->next) {
|
||||||
unsigned long cpu_flag;
|
unsigned long cpu_flag;
|
||||||
if ((cpu->path.type != DEVICE_PATH_APIC) ||
|
if (!is_enabled_cpu(cpu))
|
||||||
(cpu->bus->dev->path.type !=
|
|
||||||
DEVICE_PATH_CPU_CLUSTER))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (!cpu->enabled)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
cpu_flag = MPC_CPU_ENABLED;
|
cpu_flag = MPC_CPU_ENABLED;
|
||||||
|
|
|
@ -14,11 +14,7 @@ static int determine_total_number_of_cores(void)
|
||||||
struct device *cpu;
|
struct device *cpu;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (cpu = all_devices; cpu; cpu = cpu->next) {
|
for (cpu = all_devices; cpu; cpu = cpu->next) {
|
||||||
if ((cpu->path.type != DEVICE_PATH_APIC) ||
|
if (!is_enabled_cpu(cpu))
|
||||||
(cpu->bus->dev->path.type != DEVICE_PATH_CPU_CLUSTER)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!cpu->enabled)
|
|
||||||
continue;
|
continue;
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -917,10 +917,7 @@ int dev_count_cpu(void)
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
for (cpu = all_devices; cpu; cpu = cpu->next) {
|
for (cpu = all_devices; cpu; cpu = cpu->next) {
|
||||||
if ((cpu->path.type != DEVICE_PATH_APIC) ||
|
if (!is_enabled_cpu(cpu))
|
||||||
(cpu->bus->dev->path.type != DEVICE_PATH_CPU_CLUSTER))
|
|
||||||
continue;
|
|
||||||
if (!cpu->enabled)
|
|
||||||
continue;
|
continue;
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,11 +104,7 @@ static void update_board_layout(void)
|
||||||
|
|
||||||
/* Update CPU fields */
|
/* Update CPU fields */
|
||||||
for (struct device *cpu = all_devices; cpu; cpu = cpu->next) {
|
for (struct device *cpu = all_devices; cpu; cpu = cpu->next) {
|
||||||
if (cpu->path.type != DEVICE_PATH_APIC)
|
if (!is_enabled_cpu(cpu))
|
||||||
continue;
|
|
||||||
if (cpu->bus->dev->path.type != DEVICE_PATH_CPU_CLUSTER)
|
|
||||||
continue;
|
|
||||||
if (!cpu->enabled)
|
|
||||||
continue;
|
continue;
|
||||||
layout.cpu_count++;
|
layout.cpu_count++;
|
||||||
if (!layout.cpu_name[0])
|
if (!layout.cpu_name[0])
|
||||||
|
|
|
@ -224,11 +224,7 @@ unsigned long xeonsp_acpi_create_madt_lapics(unsigned long current)
|
||||||
uint8_t num_cpus = 0;
|
uint8_t num_cpus = 0;
|
||||||
|
|
||||||
for (cpu = all_devices; cpu; cpu = cpu->next) {
|
for (cpu = all_devices; cpu; cpu = cpu->next) {
|
||||||
if ((cpu->path.type != DEVICE_PATH_APIC) ||
|
if (!is_enabled_cpu(cpu))
|
||||||
(cpu->bus->dev->path.type != DEVICE_PATH_CPU_CLUSTER)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!cpu->enabled)
|
|
||||||
continue;
|
continue;
|
||||||
current += acpi_create_madt_lapic((acpi_madt_lapic_t *)current,
|
current += acpi_create_madt_lapic((acpi_madt_lapic_t *)current,
|
||||||
num_cpus, cpu->path.apic.apic_id);
|
num_cpus, cpu->path.apic.apic_id);
|
||||||
|
|
|
@ -25,11 +25,7 @@ unsigned long acpi_create_srat_lapics(unsigned long current)
|
||||||
unsigned int cpu_index = 0;
|
unsigned int cpu_index = 0;
|
||||||
|
|
||||||
for (cpu = all_devices; cpu; cpu = cpu->next) {
|
for (cpu = all_devices; cpu; cpu = cpu->next) {
|
||||||
if ((cpu->path.type != DEVICE_PATH_APIC) ||
|
if (!is_enabled_cpu(cpu))
|
||||||
(cpu->bus->dev->path.type != DEVICE_PATH_CPU_CLUSTER)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!cpu->enabled)
|
|
||||||
continue;
|
continue;
|
||||||
printk(BIOS_DEBUG, "SRAT: lapic cpu_index=%02x, node_id=%02x, apic_id=%02x\n",
|
printk(BIOS_DEBUG, "SRAT: lapic cpu_index=%02x, node_id=%02x, apic_id=%02x\n",
|
||||||
cpu_index, cpu->path.apic.node_id, cpu->path.apic.apic_id);
|
cpu_index, cpu->path.apic.node_id, cpu->path.apic.apic_id);
|
||||||
|
|
|
@ -155,11 +155,7 @@ unsigned long xeonsp_acpi_create_madt_lapics(unsigned long current)
|
||||||
uint8_t num_cpus = 0;
|
uint8_t num_cpus = 0;
|
||||||
|
|
||||||
for (cpu = all_devices; cpu; cpu = cpu->next) {
|
for (cpu = all_devices; cpu; cpu = cpu->next) {
|
||||||
if ((cpu->path.type != DEVICE_PATH_APIC) ||
|
if (!is_enabled_cpu(cpu))
|
||||||
(cpu->bus->dev->path.type != DEVICE_PATH_CPU_CLUSTER)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!cpu->enabled)
|
|
||||||
continue;
|
continue;
|
||||||
current += acpi_create_madt_lapic((acpi_madt_lapic_t *)current,
|
current += acpi_create_madt_lapic((acpi_madt_lapic_t *)current,
|
||||||
num_cpus, cpu->path.apic.apic_id);
|
num_cpus, cpu->path.apic.apic_id);
|
||||||
|
|
|
@ -11,13 +11,8 @@ static int determine_total_number_of_cores(void)
|
||||||
struct device *cpu;
|
struct device *cpu;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (cpu = all_devices; cpu; cpu = cpu->next) {
|
for (cpu = all_devices; cpu; cpu = cpu->next) {
|
||||||
if ((cpu->path.type != DEVICE_PATH_APIC) ||
|
if (!is_enabled_cpu(cpu))
|
||||||
(cpu->bus->dev->path.type != DEVICE_PATH_CPU_CLUSTER)) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
if (!cpu->enabled) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
|
|
Loading…
Reference in New Issue