x86/acpi: Only sort CPU IDs if more than one available

Sorting makes only sense if there are at least two entries available.

Change-Id: If40638bf1fe24dcff4b7839967445fb4218184f8
Signed-off-by: Werner Zeh <werner.zeh@siemens.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/31853
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
This commit is contained in:
Werner Zeh 2019-03-12 07:07:50 +01:00
parent 423adfb0d3
commit fedb36e3c8
1 changed files with 2 additions and 1 deletions

View File

@ -163,7 +163,8 @@ unsigned long acpi_create_madt_lapics(unsigned long current)
break;
apic_ids[num_cpus++] = cpu->path.apic.apic_id;
}
bubblesort(apic_ids, num_cpus, NUM_ASCENDING);
if (num_cpus > 1)
bubblesort(apic_ids, num_cpus, NUM_ASCENDING);
for (index = 0; index < num_cpus; index++) {
current += acpi_create_madt_lapic((acpi_madt_lapic_t *)current,
index, apic_ids[index]);