From: "Ard Biesheuvel" <ard.biesheuvel@arm.com>
To: devel@edk2.groups.io
Cc: leif@nuviainc.com, graeme.gregory@linaro.org,
tanmay.jagdale@linaro.org, lersek@redhat.com,
sami.mujawar@arm.com, Ard Biesheuvel <ard.biesheuvel@arm.com>
Subject: [PATCH v2 1/2] ArmPkg/PlatformBootManagerLib: use static assertion for console type
Date: Tue, 19 May 2020 14:23:50 +0200 [thread overview]
Message-ID: <20200519122351.18405-2-ard.biesheuvel@arm.com> (raw)
In-Reply-To: <20200519122351.18405-1-ard.biesheuvel@arm.com>
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>
---
ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c
index e6e788e0f107..f713605c02b2 100644
--- a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c
+++ b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c
@@ -583,7 +583,9 @@ PlatformBootManagerBeforeConsole (
//
// Add the hardcoded serial console device path to ConIn, ConOut, ErrOut.
//
- ASSERT (FixedPcdGet8 (PcdDefaultTerminalType) == 4);
+ STATIC_ASSERT (FixedPcdGet8 (PcdDefaultTerminalType) == 4,
+ "PcdDefaultTerminalType must be TTYTERM");
+
CopyGuid (&mSerialConsole.TermType.Guid, &gEfiTtyTermGuid);
EfiBootManagerUpdateConsoleVariable (ConIn,
--
2.17.1
next prev parent reply other threads:[~2020-05-19 12:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-19 12:23 [PATCH v2 0/2] ArmPkg/PlatformBootManagerLib: add build time checks for serial terminal settings Ard Biesheuvel
2020-05-19 12:23 ` Ard Biesheuvel [this message]
2020-05-19 12:23 ` [PATCH v2 2/2] ArmPkg/PlatformBootManagerLib: reject 'default' parity and stop bit count Ard Biesheuvel
2020-05-19 12:28 ` [PATCH v2 0/2] ArmPkg/PlatformBootManagerLib: add build time checks for serial terminal settings Leif Lindholm
2020-05-19 12:40 ` Sami Mujawar
2020-05-19 16:32 ` Laszlo Ersek
2020-06-03 14:07 ` Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200519122351.18405-2-ard.biesheuvel@arm.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox