Platforms/ARM/Juno: fix GTDT compilation error.
This commit fixes a GTDT compilation error
"excess elements in array initializer [-Werror]"
in the EFI_ACPI_5_1_SBSA_GENERIC_WATCHDOG_STRUCTURE_INIT() macro
with options in ArmPlatformPkg/ArmJunoPkg/Include/ArmPlatform.h:
Number of Watchdog timers set to 0:
#define JUNO_WATCHDOG_COUNT 0
ACPI tables are based on ACPI 5.1 or later:
//#define ARM_JUNO_ACPI_5_0
This fix also prevents declaration of an ISO C90 non-compliant
zero-length array, causing the error:
"ISO C forbids zero-size array 'Watchdogs'"
when compiled with the "-pedantic" option.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Alexei Fedorov <alexei.fedorov@arm.com>
Signed-off-by: Evan Lloyd <evan.lloyd@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
diff --git a/Platforms/ARM/Juno/AcpiTables/Gtdt.aslc b/Platforms/ARM/Juno/AcpiTables/Gtdt.aslc
index 1c258fc..3995059 100644
--- a/Platforms/ARM/Juno/AcpiTables/Gtdt.aslc
+++ b/Platforms/ARM/Juno/AcpiTables/Gtdt.aslc
@@ -61,7 +61,9 @@
typedef struct {
EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLE Gtdt;
+#if (JUNO_WATCHDOG_COUNT != 0)
EFI_ACPI_5_1_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE Watchdogs[JUNO_WATCHDOG_COUNT];
+#endif
} EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLES;
#pragma pack ()
@@ -87,12 +89,14 @@
JUNO_WATCHDOG_COUNT, // UINT32 PlatformTimerCount
sizeof (EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLE) // UINT32 PlatfromTimerOffset
},
+#if (JUNO_WATCHDOG_COUNT != 0)
{
EFI_ACPI_5_1_SBSA_GENERIC_WATCHDOG_STRUCTURE_INIT(
FixedPcdGet32 (PcdGenericWatchdogRefreshBase), FixedPcdGet32 (PcdGenericWatchdogControlBase), 93, 0),
EFI_ACPI_5_1_SBSA_GENERIC_WATCHDOG_STRUCTURE_INIT(
FixedPcdGet32 (PcdGenericWatchdogRefreshBase), FixedPcdGet32 (PcdGenericWatchdogControlBase), 94, EFI_ACPI_5_1_GTDT_SBSA_GENERIC_WATCHDOG_FLAG_SECURE_TIMER)
}
+#endif
};
#endif