public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] ArmPkg/PlatformBootManagerLib: reject 'default' parity and stop bit count
@ 2020-05-18 17:11 Ard Biesheuvel
  2020-05-18 17:18 ` Leif Lindholm
  2020-05-19 10:00 ` [edk2-devel] " Laszlo Ersek
  0 siblings, 2 replies; 6+ messages in thread
From: Ard Biesheuvel @ 2020-05-18 17:11 UTC (permalink / raw)
  To: devel; +Cc: leif, graeme.gregory, tanmay.jagdale, Ard Biesheuvel

In the ArmPkg version of PlatformBootManagerLib, we construct a
serial device path based on the default settings for baud rate,
parity and the number of stop bits, to ensure that a serial console
is available even on the very first boot.

This assumes that PcdUartDefaultParity or PcdUartDefaultStopBits are
not set to '0', meaning 'the default', as there is no default for
these when constructing a device path.

So add a couple of ASSERT()s to make sure that we catch this condition,
since it otherwise ignores the bogus device path silently, which is
rather tedious to debug,.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
---
 ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c
index e6e788e0f107..a030d510aa62 100644
--- a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c
+++ b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c
@@ -583,6 +583,8 @@ PlatformBootManagerBeforeConsole (
   //
   // Add the hardcoded serial console device path to ConIn, ConOut, ErrOut.
   //
+  ASSERT (FixedPcdGet8 (PcdUartDefaultParity) > 0);
+  ASSERT (FixedPcdGet8 (PcdUartDefaultStopBits) > 0);
   ASSERT (FixedPcdGet8 (PcdDefaultTerminalType) == 4);
   CopyGuid (&mSerialConsole.TermType.Guid, &gEfiTtyTermGuid);
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-05-20  9:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-18 17:11 [PATCH] ArmPkg/PlatformBootManagerLib: reject 'default' parity and stop bit count Ard Biesheuvel
2020-05-18 17:18 ` Leif Lindholm
2020-05-19 10:00 ` [edk2-devel] " Laszlo Ersek
2020-05-19 11:15   ` Leif Lindholm
2020-05-20  9:16     ` Sami Mujawar
2020-05-19 12:12   ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox