summaryrefslogtreecommitdiff
path: root/arch/x86
diff options
context:
space:
mode:
authorGeorge McCollister <george.mccollister@gmail.com>2016-06-07 13:40:18 -0500
committerBin Meng <bmeng.cn@gmail.com>2016-06-12 12:19:35 +0800
commit8a1a7595cfbcb12d01a5c1f486ebfd50af90c34c (patch)
tree1da1fecd1f5351708d332e80c3be032049f44606 /arch/x86
parent6b3943f1b04be60f147ee540fbd72c4c7ea89f80 (diff)
downloadu-boot-8a1a7595cfbcb12d01a5c1f486ebfd50af90c34c.tar.gz
u-boot-8a1a7595cfbcb12d01a5c1f486ebfd50af90c34c.tar.bz2
u-boot-8a1a7595cfbcb12d01a5c1f486ebfd50af90c34c.zip
x86: acpi: Fix madt lapic generation
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@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/lib/acpi_table.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c
index ffb4678e51..bb71286dba 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,