diff options
author | PaytonX Hsieh <paytonx.hsieh@intel.com> | 2023-04-26 20:36:56 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2023-05-02 07:11:21 +0000 |
commit | 23c71536efbebed57942947668f470f934324477 (patch) | |
tree | 53fd8b83378c41d78ca1d309a556bb3ed5c9d299 /UefiPayloadPkg/Library/BaseSerialPortLibHob/DxeBaseSerialPortLibHob.c | |
parent | 56e9828380b7425678a080bd3a08e7c741af67ba (diff) | |
download | edk2-23c71536efbebed57942947668f470f934324477.zip edk2-23c71536efbebed57942947668f470f934324477.tar.gz edk2-23c71536efbebed57942947668f470f934324477.tar.bz2 |
UefiPayloadPkg: Fix issues when MULTIPLE_DEBUG_PORT_SUPPORT is true
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4427
1. Since UART speed is slower than CPU, BIOS need to check the write
buffer is empty, to avoid overwrite the buffer content.
2. LPSS UART might disable MMIO space for Windows debug usage during
ExitBootServices event. BIOS need to avoid access the MMIO space
after ExitBootServices.
Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: James Lu <james.lu@intel.com>
Reviewed-by: Gua Guo <gua.guo@intel.com>
Signed-off-by: PaytonX Hsieh <paytonx.hsieh@intel.com>
Diffstat (limited to 'UefiPayloadPkg/Library/BaseSerialPortLibHob/DxeBaseSerialPortLibHob.c')
-rw-r--r-- | UefiPayloadPkg/Library/BaseSerialPortLibHob/DxeBaseSerialPortLibHob.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/UefiPayloadPkg/Library/BaseSerialPortLibHob/DxeBaseSerialPortLibHob.c b/UefiPayloadPkg/Library/BaseSerialPortLibHob/DxeBaseSerialPortLibHob.c new file mode 100644 index 0000000..6106e9a --- /dev/null +++ b/UefiPayloadPkg/Library/BaseSerialPortLibHob/DxeBaseSerialPortLibHob.c @@ -0,0 +1,56 @@ +/** @file
+ UART Serial Port library functions.
+
+ Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+#include <Uefi.h>
+
+extern BOOLEAN mBaseSerialPortLibHobAtRuntime;
+
+/**
+ Set mSerialIoUartLibAtRuntime flag as TRUE after ExitBootServices.
+
+ @param[in] Event The Event that is being processed.
+ @param[in] Context The Event Context.
+
+**/
+STATIC
+VOID
+EFIAPI
+BaseSerialPortLibHobExitBootServicesEvent (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ mBaseSerialPortLibHobAtRuntime = TRUE;
+}
+
+/**
+ The constructor function registers a callback for the ExitBootServices event.
+
+ @param[in] ImageHandle The firmware allocated handle for the EFI image.
+ @param[in] SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The operation completed successfully.
+ @retval other Either the serial port failed to initialize or the
+ ExitBootServices event callback registration failed.
+**/
+EFI_STATUS
+EFIAPI
+DxeBaseSerialPortLibHobConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_EVENT SerialPortLibHobExitBootServicesEvent;
+
+ return SystemTable->BootServices->CreateEvent (
+ EVT_SIGNAL_EXIT_BOOT_SERVICES,
+ TPL_NOTIFY,
+ BaseSerialPortLibHobExitBootServicesEvent,
+ NULL,
+ &SerialPortLibHobExitBootServicesEvent
+ );
+}
|