[U-Boot] [PATCH] x86: acpi: Fix madt lapic generation
George McCollister
george.mccollister at gmail.com
Tue Jun 7 20:40:18 CEST 2016
An accumulated length was incorrectly added to current each pass
through the loop. On system with more than 2 cores this caused a
corrupt MADT to be generated.
Signed-off-by: George McCollister <george.mccollister at gmail.com>
---
arch/x86/lib/acpi_table.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c
index ffb4678..bb71286 100644
--- a/arch/x86/lib/acpi_table.c
+++ b/arch/x86/lib/acpi_table.c
@@ -183,20 +183,20 @@ static int acpi_create_madt_lapic(struct acpi_madt_lapic *lapic,
int acpi_create_madt_lapics(u32 current)
{
struct udevice *dev;
- int length = 0;
+ int total_length = 0;
for (uclass_find_first_device(UCLASS_CPU, &dev);
dev;
uclass_find_next_device(&dev)) {
struct cpu_platdata *plat = dev_get_parent_platdata(dev);
-
- length += acpi_create_madt_lapic(
- (struct acpi_madt_lapic *)current,
- plat->cpu_id, plat->cpu_id);
+ int length = acpi_create_madt_lapic(
+ (struct acpi_madt_lapic *)current,
+ plat->cpu_id, plat->cpu_id);
current += length;
+ total_length += length;
}
- return length;
+ return total_length;
}
int acpi_create_madt_ioapic(struct acpi_madt_ioapic *ioapic, u8 id,
--
2.8.0
More information about the U-Boot
mailing list