diff options
author | Naresh Solanki <Naresh.Solanki@9elements.com> | 2023-01-20 19:13:02 +0100 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2023-03-03 17:08:27 +0000 |
commit | 76835cc678c704e3b96b7b72108f577e50d1dbce (patch) | |
tree | d28f7e6e746060276e49a7885499e4b7f14a2391 | |
parent | 87d97ffe16c7644ffca4d91b8be498041b7dc4a7 (diff) |
acpi: Add SRAT x2APIC table support
For platforms using X2APIC mode add SRAT x2APIC table
generation. This allows to setup proper SRAT tables.
Change-Id: If78c423884b7ce9330f0f46998ac83da334ee26d
Signed-off-by: Naresh Solanki <Naresh.Solanki@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/73365
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
-rw-r--r-- | src/acpi/acpi.c | 13 | ||||
-rw-r--r-- | src/include/acpi/acpi.h | 13 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/acpi/acpi.c b/src/acpi/acpi.c index 04a59b1767..2706bf7f15 100644 --- a/src/acpi/acpi.c +++ b/src/acpi/acpi.c @@ -531,6 +531,19 @@ int acpi_create_srat_lapic(acpi_srat_lapic_t *lapic, u8 node, u8 apic) return lapic->length; } +int acpi_create_srat_x2apic(acpi_srat_x2apic_t *x2apic, u32 node, u32 apic) +{ + memset((void *)x2apic, 0, sizeof(acpi_srat_x2apic_t)); + + x2apic->type = 2; /* Processor x2APIC structure */ + x2apic->length = sizeof(acpi_srat_x2apic_t); + x2apic->flags = (1 << 0); /* Enabled (the use of this structure). */ + x2apic->proximity_domain = node; + x2apic->x2apic_id = apic; + + return x2apic->length; +} + int acpi_create_srat_mem(acpi_srat_mem_t *mem, u8 node, u32 basek, u32 sizek, u32 flags) { diff --git a/src/include/acpi/acpi.h b/src/include/acpi/acpi.h index b92c77e5d5..a108d6aa65 100644 --- a/src/include/acpi/acpi.h +++ b/src/include/acpi/acpi.h @@ -353,6 +353,18 @@ typedef struct acpi_srat { #define ACPI_SRAT_STRUCTURE_MEM 1 #define ACPI_SRAT_STRUCTURE_GIA 5 +/* SRAT: Processor x2APIC Structure */ +typedef struct acpi_srat_x2apic { + u8 type; /* Type (0) */ + u8 length; /* Length in bytes (16) */ + u16 reserved; /* Reserved - Must be zero */ + u32 proximity_domain; /* Proximity domain */ + u32 x2apic_id; /* x2APIC ID */ + u32 flags; /* Enable bit 0 = 1, other bits reserved to 0 */ + u32 clock_domain; /* _CDM Clock Domain */ + u32 reserved1; /* Reserved */ +} __packed acpi_srat_x2apic_t; + /* SRAT: Processor Local APIC/SAPIC Affinity Structure */ typedef struct acpi_srat_lapic { u8 type; /* Type (0) */ @@ -1337,6 +1349,7 @@ 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_x2apic(acpi_srat_x2apic_t *x2apic, u32 node, u32 apic); int acpi_create_srat_mem(acpi_srat_mem_t *mem, u8 node, u32 basek, u32 sizek, u32 flags); /* |