]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/PlatformBootManagerLib: use static assertion for console type
authorArd Biesheuvel <ard.biesheuvel@arm.com>
Tue, 19 May 2020 12:23:50 +0000 (14:23 +0200)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Wed, 3 Jun 2020 14:04:59 +0000 (14:04 +0000)
Replace the runtime ASSERT with the build time STATIC_ASSERT on the
check that ensures that the terminal type we use for the serial
console matches the one we explicitly add to the ConIn/ConOut/StdErr
variables.

This helps catch serial console issues early, even in RELEASE builds,
reducing the risk of ending up with no console at all, which can be
tricky to debug on bare metal.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
Reviewed-by: Sami Mujawar <Sami.Mujawar@arm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c

index e6e788e0f10715415ff8ff6519b10c55625a5b18..f713605c02b20546aac3d464e0b19824b165bf73 100644 (file)
@@ -583,7 +583,9 @@ PlatformBootManagerBeforeConsole (
   //\r
   // Add the hardcoded serial console device path to ConIn, ConOut, ErrOut.\r
   //\r
-  ASSERT (FixedPcdGet8 (PcdDefaultTerminalType) == 4);\r
+  STATIC_ASSERT (FixedPcdGet8 (PcdDefaultTerminalType) == 4,\r
+    "PcdDefaultTerminalType must be TTYTERM");\r
+\r
   CopyGuid (&mSerialConsole.TermType.Guid, &gEfiTtyTermGuid);\r
 \r
   EfiBootManagerUpdateConsoleVariable (ConIn,\r