From b6b5afebfab6db6a2e451309945235e51b89d04d Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Mon, 31 Jul 2023 11:46:07 -0500 Subject: [PATCH] UefiPayloadPkg/PLatformHookLib: Set PcdSerialClockRate using HOB data Fixes serial output on platforms using coreboot and a non-default clock rate such as AMD Picasso and newer. Signed-off-by: Matt DeVillier --- UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.c | 7 +++++++ UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.inf | 1 + 2 files changed, 8 insertions(+) diff --git a/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.c b/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.c index efaab326bb687..70569ec995eac 100644 --- a/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.c +++ b/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.c @@ -94,6 +94,13 @@ PlatformHookSerialPortInitialize ( return Status; } + if (SerialPortInfo->Header.Revision >= 2) { + Status = PcdSet32S (PcdSerialClockRate, SerialPortInfo->ClockRate); + if (RETURN_ERROR (Status)) { + return Status; + } + } + return RETURN_SUCCESS; } diff --git a/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.inf b/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.inf index 7ac6bfa1b1b08..e2908cfbca249 100644 --- a/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.inf +++ b/UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.inf @@ -38,3 +38,4 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase ## PRODUCES gEfiMdeModulePkgTokenSpaceGuid.PcdSerialBaudRate ## PRODUCES gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterStride ## PRODUCES + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate ## PRODUCES