DynamicTablesPkg: MadtGenerator: make GICD info as option

GICD information is not a mandatory in the platform where use
the GicV5 interrupt controller.

Therefore, make GICD information as optional one.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
This commit is contained in:
Levi Yun 2025-10-24 11:03:20 +01:00 committed by levi.yun
parent 499e6a8cc2
commit 4639733287

View file

@ -815,7 +815,10 @@ BuildMadtTable (
&GicDInfo, &GicDInfo,
&GicDCount &GicDCount
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status) &&
((AcpiTableInfo->AcpiTableRevision < EFI_ACPI_6_7_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION) ||
(Status != EFI_NOT_FOUND)))
{
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
"ERROR: MADT: Failed to get GICD Info. Status = %r\n", "ERROR: MADT: Failed to get GICD Info. Status = %r\n",
@ -824,16 +827,6 @@ BuildMadtTable (
goto error_handler; goto error_handler;
} }
if (GicDCount == 0) {
DEBUG ((
DEBUG_ERROR,
"ERROR: MADT: GIC Distributor information not provided.\n"
));
ASSERT (GicDCount != 0);
Status = EFI_INVALID_PARAMETER;
goto error_handler;
}
if (GicDCount > 1) { if (GicDCount > 1) {
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
@ -936,6 +929,28 @@ BuildMadtTable (
goto error_handler; goto error_handler;
} }
if (((GicIrsCount == 0) && (GicDCount == 0)) ||
((GicIrsCount > 0) && (GicDCount > 0)))
{
Status = EFI_INVALID_PARAMETER;
DEBUG ((
DEBUG_ERROR,
"ERROR: MADT: No GicIrs and GicD Info or have both. Status = %r\n",
Status
));
goto error_handler;
}
if ((GicItsV5Count != 0) && (GicItsV5Count > GicItsV5TransFrameCount)) {
Status = EFI_INVALID_PARAMETER;
DEBUG ((
DEBUG_ERROR,
"ERROR: MADT: Each GicItsV5 should have at least 1 Translate Frame. Status = %r\n",
Status
));
goto error_handler;
}
TableSize = sizeof (EFI_ACPI_6_7_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER); TableSize = sizeof (EFI_ACPI_6_7_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER);
GicCOffset = TableSize; GicCOffset = TableSize;
@ -1019,10 +1034,12 @@ BuildMadtTable (
goto error_handler; goto error_handler;
} }
AddGICD ( if (GicDCount != 0) {
(EFI_ACPI_6_5_GIC_DISTRIBUTOR_STRUCTURE *)((UINT8 *)Madt + GicDOffset), AddGICD (
GicDInfo (EFI_ACPI_6_5_GIC_DISTRIBUTOR_STRUCTURE *)((UINT8 *)Madt + GicDOffset),
); GicDInfo
);
}
if (GicMSICount != 0) { if (GicMSICount != 0) {
AddGICMsiFrameInfoList ( AddGICMsiFrameInfoList (