Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/39806 )
Change subject: acpi: Bump MADT to revision 3 ......................................................................
acpi: Bump MADT to revision 3
Add structs and methods for revision 3.
Change-Id: Ida75f530551ad2b8b20ce7fdeffb3befc51296bc Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M src/arch/x86/acpi.c M src/arch/x86/include/arch/acpi.h 2 files changed, 57 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/06/39806/1
diff --git a/src/arch/x86/acpi.c b/src/arch/x86/acpi.c index 30c6346..e4932be 100644 --- a/src/arch/x86/acpi.c +++ b/src/arch/x86/acpi.c @@ -127,6 +127,18 @@ return lapic->length; }
+int acpi_create_madt_lx2apic(acpi_madt_lx2apic_t *lapic, u32 cpu, u32 apic) +{ + lapic->type = LOCAL_X2APIC; /* Local APIC structure */ + lapic->reserved = 0; + lapic->length = sizeof(acpi_madt_lx2apic_t); + lapic->flags = (1 << 0); /* Processor/LAPIC enabled */ + lapic->processor_id = cpu; + lapic->x2apic_id = apic; + + return lapic->length; +} + unsigned long acpi_create_madt_lapics(unsigned long current) { struct device *cpu; @@ -146,8 +158,12 @@ 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]); + if (apic_ids[index] < 0xff) + current += acpi_create_madt_lapic((acpi_madt_lapic_t *)current, + index, apic_ids[index]); + else + current += acpi_create_madt_lx2apic((acpi_madt_lx2apic_t *)current, + index, apic_ids[index]); }
return current; @@ -191,6 +207,21 @@ return lapic_nmi->length; }
+int acpi_create_madt_lx2apic_nmi(acpi_madt_lx2apic_nmi_t *lapic_nmi, u32 cpu, + u16 flags, u8 lint) +{ + lapic_nmi->type = LOCAL_X2APIC_NMI; /* Local APIC NMI structure */ + lapic_nmi->length = sizeof(acpi_madt_lx2apic_nmi_t); + lapic_nmi->flags = flags; + lapic_nmi->processor_id = cpu; + lapic_nmi->lint = lint; + lapic_nmi->reserved[0] = 0; + lapic_nmi->reserved[1] = 0; + lapic_nmi->reserved[2] = 0; + + return lapic_nmi->length; +} + void acpi_create_madt(acpi_madt_t *madt) { acpi_header_t *header = &(madt->header); @@ -1558,7 +1589,7 @@ case FADT: return ACPI_FADT_REV_ACPI_6_0; case MADT: /* ACPI 3.0: 2, ACPI 4.0/5.0: 3, ACPI 6.2b/6.3: 5 */ - return 2; + return 3; case MCFG: return 1; case TCPA: diff --git a/src/arch/x86/include/arch/acpi.h b/src/arch/x86/include/arch/acpi.h index fc20c79..4351678 100644 --- a/src/arch/x86/include/arch/acpi.h +++ b/src/arch/x86/include/arch/acpi.h @@ -439,6 +439,26 @@ u16 flags; /* MPS INTI flags */ } __packed acpi_madt_irqoverride_t;
+/* MADT: Processor Local x2APIC Structure */ +typedef struct acpi_madt_lx2apic { + u8 type; /* Type (9) */ + u8 length; /* Length in bytes (16) */ + u16 reserved; + u32 x2apic_id; /* Local x2APIC ID */ + u32 flags; /* Same as Local APIC flags */ + u32 processor_id; /* ACPI processor ID */ +} __packed acpi_madt_lx2apic_t; + +/* MADT: Processor Local x2APIC NMI Structure */ +typedef struct acpi_madt_lx2apic_nmi { + u8 type; /* Type (10) */ + u8 length; /* Length in bytes (12) */ + u16 flags; /* Same as MPS INTI flags */ + u32 processor_id; /* ACPI processor ID */ + u8 lint; /* Local APIC LINT# */ + u8 reserved[3]; +} __packed acpi_madt_lx2apic_nmi_t; + #define ACPI_DBG2_PORT_SERIAL 0x8000 #define ACPI_DBG2_PORT_SERIAL_16550 0x0000 #define ACPI_DBG2_PORT_SERIAL_16550_DBGP 0x0001 @@ -844,7 +864,9 @@ unsigned long acpi_create_madt_lapics(unsigned long current); unsigned long acpi_create_madt_lapic_nmis(unsigned long current, u16 flags, u8 lint); - +int acpi_create_madt_lx2apic(acpi_madt_lx2apic_t *lapic, u32 cpu, u32 apic); +int acpi_create_madt_lx2apic_nmi(acpi_madt_lx2apic_nmi_t *lapic_nmi, u32 cpu, + u16 flags, u8 lint); int acpi_create_srat_lapic(acpi_srat_lapic_t *lapic, u8 node, u8 apic); int acpi_create_srat_mem(acpi_srat_mem_t *mem, u8 node, u32 basek, u32 sizek, u32 flags);
HAOUAS Elyes has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/39806 )
Change subject: acpi: Bump MADT to revision 3 ......................................................................
Patch Set 1: Code-Review+1
Matt DeVillier has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/39806 )
Change subject: acpi: Bump MADT to revision 3 ......................................................................
Patch Set 1: Code-Review+2
doesn't seem to break anything 😊
Matt DeVillier has submitted this change. ( https://review.coreboot.org/c/coreboot/+/39806 )
Change subject: acpi: Bump MADT to revision 3 ......................................................................
acpi: Bump MADT to revision 3
Add structs and methods for revision 3.
Change-Id: Ida75f530551ad2b8b20ce7fdeffb3befc51296bc Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/39806 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: HAOUAS Elyes ehaouas@noos.fr Reviewed-by: Matt DeVillier matt.devillier@gmail.com --- M src/arch/x86/acpi.c M src/arch/x86/include/arch/acpi.h 2 files changed, 57 insertions(+), 4 deletions(-)
Approvals: build bot (Jenkins): Verified HAOUAS Elyes: Looks good to me, but someone else must approve Matt DeVillier: Looks good to me, approved
diff --git a/src/arch/x86/acpi.c b/src/arch/x86/acpi.c index a5c5c49..4ff1ad5 100644 --- a/src/arch/x86/acpi.c +++ b/src/arch/x86/acpi.c @@ -127,6 +127,18 @@ return lapic->length; }
+int acpi_create_madt_lx2apic(acpi_madt_lx2apic_t *lapic, u32 cpu, u32 apic) +{ + lapic->type = LOCAL_X2APIC; /* Local APIC structure */ + lapic->reserved = 0; + lapic->length = sizeof(acpi_madt_lx2apic_t); + lapic->flags = (1 << 0); /* Processor/LAPIC enabled */ + lapic->processor_id = cpu; + lapic->x2apic_id = apic; + + return lapic->length; +} + unsigned long acpi_create_madt_lapics(unsigned long current) { struct device *cpu; @@ -146,8 +158,12 @@ 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]); + if (apic_ids[index] < 0xff) + current += acpi_create_madt_lapic((acpi_madt_lapic_t *)current, + index, apic_ids[index]); + else + current += acpi_create_madt_lx2apic((acpi_madt_lx2apic_t *)current, + index, apic_ids[index]); }
return current; @@ -191,6 +207,21 @@ return lapic_nmi->length; }
+int acpi_create_madt_lx2apic_nmi(acpi_madt_lx2apic_nmi_t *lapic_nmi, u32 cpu, + u16 flags, u8 lint) +{ + lapic_nmi->type = LOCAL_X2APIC_NMI; /* Local APIC NMI structure */ + lapic_nmi->length = sizeof(acpi_madt_lx2apic_nmi_t); + lapic_nmi->flags = flags; + lapic_nmi->processor_id = cpu; + lapic_nmi->lint = lint; + lapic_nmi->reserved[0] = 0; + lapic_nmi->reserved[1] = 0; + lapic_nmi->reserved[2] = 0; + + return lapic_nmi->length; +} + void acpi_create_madt(acpi_madt_t *madt) { acpi_header_t *header = &(madt->header); @@ -1556,7 +1587,7 @@ case FADT: return ACPI_FADT_REV_ACPI_6_0; case MADT: /* ACPI 3.0: 2, ACPI 4.0/5.0: 3, ACPI 6.2b/6.3: 5 */ - return 2; + return 3; case MCFG: return 1; case TCPA: diff --git a/src/arch/x86/include/arch/acpi.h b/src/arch/x86/include/arch/acpi.h index f5ec9f1..0ed89d1 100644 --- a/src/arch/x86/include/arch/acpi.h +++ b/src/arch/x86/include/arch/acpi.h @@ -466,6 +466,26 @@ u16 flags; /* MPS INTI flags */ } __packed acpi_madt_irqoverride_t;
+/* MADT: Processor Local x2APIC Structure */ +typedef struct acpi_madt_lx2apic { + u8 type; /* Type (9) */ + u8 length; /* Length in bytes (16) */ + u16 reserved; + u32 x2apic_id; /* Local x2APIC ID */ + u32 flags; /* Same as Local APIC flags */ + u32 processor_id; /* ACPI processor ID */ +} __packed acpi_madt_lx2apic_t; + +/* MADT: Processor Local x2APIC NMI Structure */ +typedef struct acpi_madt_lx2apic_nmi { + u8 type; /* Type (10) */ + u8 length; /* Length in bytes (12) */ + u16 flags; /* Same as MPS INTI flags */ + u32 processor_id; /* ACPI processor ID */ + u8 lint; /* Local APIC LINT# */ + u8 reserved[3]; +} __packed acpi_madt_lx2apic_nmi_t; + #define ACPI_DBG2_PORT_SERIAL 0x8000 #define ACPI_DBG2_PORT_SERIAL_16550 0x0000 #define ACPI_DBG2_PORT_SERIAL_16550_DBGP 0x0001 @@ -871,7 +891,9 @@ unsigned long acpi_create_madt_lapics(unsigned long current); unsigned long acpi_create_madt_lapic_nmis(unsigned long current, u16 flags, u8 lint); - +int acpi_create_madt_lx2apic(acpi_madt_lx2apic_t *lapic, u32 cpu, u32 apic); +int acpi_create_madt_lx2apic_nmi(acpi_madt_lx2apic_nmi_t *lapic_nmi, u32 cpu, + u16 flags, u8 lint); int acpi_create_srat_lapic(acpi_srat_lapic_t *lapic, u8 node, u8 apic); int acpi_create_srat_mem(acpi_srat_mem_t *mem, u8 node, u32 basek, u32 sizek, u32 flags);
9elements QA has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/39806 )
Change subject: acpi: Bump MADT to revision 3 ......................................................................
Patch Set 6:
Automatic boot test returned (PASS/FAIL/TOTAL): 3/0/3 Emulation targets: EMULATION_QEMU_X86_Q35 using payload TianoCore : SUCCESS : https://lava.9esec.io/r/2305 EMULATION_QEMU_X86_Q35 using payload SeaBIOS : SUCCESS : https://lava.9esec.io/r/2304 EMULATION_QEMU_X86_I440FX using payload SeaBIOS : SUCCESS : https://lava.9esec.io/r/2303
Please note: This test is under development and might not be accurate at all!