summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt DeVillier <matt.devillier@gmail.com>2023-07-31 11:40:32 -0500
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-09-20 03:13:11 +0000
commitc3580093520809cbfe2abd0e702d53707b7782a9 (patch)
treee6d8b5c7d9547be34975c11a6e85bce2b2bf9d46
parent3a3b12cbdae2e89b0e365eb01c378891d0d9037c (diff)
downloadedk2-c3580093520809cbfe2abd0e702d53707b7782a9.zip
edk2-c3580093520809cbfe2abd0e702d53707b7782a9.tar.gz
edk2-c3580093520809cbfe2abd0e702d53707b7782a9.tar.bz2
Set PcdSerialClockRate from SerialPortInfo in UefiPayloadEntry
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
-rw-r--r--UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c8
-rw-r--r--UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf1
2 files changed, 9 insertions, 0 deletions
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
index 030a5ba..abda593 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
@@ -432,6 +432,14 @@ _ModuleEntryPoint (
UniversalSerialPort->RegisterBase = SerialPortInfo.BaseAddr;
UniversalSerialPort->BaudRate = SerialPortInfo.Baud;
UniversalSerialPort->RegisterStride = (UINT8)SerialPortInfo.RegWidth;
+ // Set PCD here (vs in PlatformHookLib.c) to avoid adding a new field to UniversalSerialPort struct
+ if (SerialPortInfo.InputHertz > 0) {
+ Status = PcdSet32S (PcdSerialClockRate, SerialPortInfo.InputHertz);
+ if (RETURN_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "Failed to set PcdSerialClockRate; Status = %r\n", Status));
+ return Status;
+ }
+ }
}
// The library constructors might depend on serial port, so call it after serial port hob
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
index a3ff4b8..e84ef66 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
@@ -96,3 +96,4 @@
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy ## SOMETIMES_CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdImageProtectionPolicy ## SOMETIMES_CONSUMES
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate ## PRODUCES