diff options
author | Oliver Smith-Denny <osde@linux.microsoft.com> | 2024-08-21 13:59:15 -0700 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-08-28 01:26:39 +0000 |
commit | 39a999eb1decf486c615489174912f2d278636d1 (patch) | |
tree | 60fbc66237f3cb8a335bb84857178dd14e16e508 /ArmPlatformPkg | |
parent | ded4191e1087c56e0bdeb118fd519d18cb353ef3 (diff) | |
download | edk2-39a999eb1decf486c615489174912f2d278636d1.tar.gz edk2-39a999eb1decf486c615489174912f2d278636d1.tar.bz2 edk2-39a999eb1decf486c615489174912f2d278636d1.zip |
ArmPlatformPkg: Initialize Serial Port Before Writing
PrePeiCore and Sec directly write the firmware version to the serial port.
They relies on another component to initialize the serial port, however
in certain configurations (such as release builds that don't use a
DebugLib that initializes the serial port), the serial port can be
uninitialized at this point, causing a crash when SerialPortWrite
is called here.
This patch updates PrePeiCore and Sec to call SerialPortInitialize before
calling SerialPortWrite directly, which follows the pattern of
other serial port writes. It is accepted to call the initialization
routine multiple times, it is supposed to dump out if the serial
port is already initialized.
Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
Diffstat (limited to 'ArmPlatformPkg')
-rw-r--r-- | ArmPlatformPkg/PrePeiCore/PrePeiCore.c | 4 | ||||
-rw-r--r-- | ArmPlatformPkg/Sec/Sec.c | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCore.c b/ArmPlatformPkg/PrePeiCore/PrePeiCore.c index cbaccbbad9..5911c3a08a 100644 --- a/ArmPlatformPkg/PrePeiCore/PrePeiCore.c +++ b/ArmPlatformPkg/PrePeiCore/PrePeiCore.c @@ -76,6 +76,10 @@ PrintFirmwareVersion ( __TIME__,
__DATE__
);
+
+ // Because we are directly bit banging the serial port instead of going through the DebugLib, we need to make sure
+ // the serial port is initialized before we write to it
+ SerialPortInitialize ();
SerialPortWrite ((UINT8 *)Buffer, CharCount);
}
diff --git a/ArmPlatformPkg/Sec/Sec.c b/ArmPlatformPkg/Sec/Sec.c index 482e68ad42..9a700e5ef2 100644 --- a/ArmPlatformPkg/Sec/Sec.c +++ b/ArmPlatformPkg/Sec/Sec.c @@ -139,6 +139,10 @@ PrintFirmwareVersion ( __TIME__,
__DATE__
);
+
+ // Because we are directly bit banging the serial port instead of going through the DebugLib, we need to make sure
+ // the serial port is initialized before we write to it
+ SerialPortInitialize ();
SerialPortWrite ((UINT8 *)Buffer, CharCount);
}
|