
Hi Bin,
+static int acpi_create_madt_lapic(struct acpi_madt_lapic *lapic, u8 cpu, u8 apic) +{
lapic->type = 0; /* Local APIC structure */
lapic->length = sizeof(struct acpi_madt_lapic);
lapic->flags = (1 << 0); /* Processor/LAPIC enabled */
lapic->processor_id = cpu;
lapic->apic_id = apic;
return lapic->length;
+}
+static unsigned long acpi_create_madt_lapics(unsigned long current) +{
struct udevice *dev;
for (uclass_find_first_device(UCLASS_CPU, &dev);
dev;
uclass_find_next_device(&dev)) {
struct cpu_platdata *plat = dev_get_parent_platdata(dev);
current += acpi_create_madt_lapic((struct acpi_madt_lapic *)current, plat->cpu_id, plat->cpu_id);
The processor id (2nd parameter) is not equal to lapic id. Per the ACPI spec, it should match the ProcessorID in the ASL file, format below.
Processor (ProcessorName, ProcessorID, PBlockAddress, PblockLength) {ObjectList}
Thanks for bringing this to my notice. In my boot up logs, I am getting "ACPI: No LAPIC entries present". This might be the reason for that.
As per our previous discussion, I reported an error in bringing up u-boot for qemu - " Cannot find uclass for id 10: please add the UCLASS_DRIVER() declaration for this UCLASS_... id" You told me that this is because QEMU has not been converted to use dm cpu driver.
If this issue is resolved, and thus UCLASS_CPU would be available for qemu, the patch below would fix the lapic error.
diff --git a/arch/x86/cpu/qemu/acpi_table.c b/arch/x86/cpu/qemu/acpi_table.c index cefd5f4..f055646 100644 --- a/arch/x86/cpu/qemu/acpi_table.c +++ b/arch/x86/cpu/qemu/acpi_table.c @@ -98,13 +98,15 @@ static int acpi_create_madt_lapic(struct acpi_madt_lapic *lapic, u8 cpu, u8 apic static unsigned long acpi_create_madt_lapics(unsigned long current) { struct udevice *dev; + int index = 0;
for (uclass_find_first_device(UCLASS_CPU, &dev); dev; uclass_find_next_device(&dev)) { struct cpu_platdata *plat = dev_get_parent_platdata(dev);
- current += acpi_create_madt_lapic((struct acpi_madt_lapic *)current, plat->cpu_id, plat->cpu_id); + current += acpi_create_madt_lapic((struct acpi_madt_lapic *)current, index, plat->cpu_id); + index++; } return current; }
Regards, Saket Sinha