summaryrefslogtreecommitdiffstats
path: root/UefiPayloadPkg/UefiPayloadPkg.dsc
diff options
context:
space:
mode:
authorBenjamin Doron <benjamin.doron00@gmail.com>2022-05-22 14:20:55 -0400
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2022-07-27 20:54:35 +0000
commitf26b70cb9f1367ceb25190ba2777631ee42c69fe (patch)
tree349032fa52a9d7af1422c5c456687617305c236e /UefiPayloadPkg/UefiPayloadPkg.dsc
parent2677286307c67b62c198cf6890d62ec540dd8c99 (diff)
downloadedk2-f26b70cb9f1367ceb25190ba2777631ee42c69fe.tar.gz
edk2-f26b70cb9f1367ceb25190ba2777631ee42c69fe.tar.bz2
edk2-f26b70cb9f1367ceb25190ba2777631ee42c69fe.zip
UefiPayloadPkg: Add support for logging to CBMEM console
Writes TianoCore debug logs into the CBMEM console ringbuffer, from where the user can retrieve them with the `cbmem` userspace utility. The intention is to aid in debugging non-fatal issues even in release builds, or simply make TianoCore's logs available to those interested. Consequently, MDEPKG_NDEBUG must be masked. As an in-memory debug logging library, ASSERTs must be non-fatal to be seen, so they neither dead-loop nor create a breakpoint. It is assumed that ASSERT() neither enforces fatal conditions nor security integrity, as release builds do not call DebugAssert() from the ASSERT macro. More detailed debug logs are produced with the DEBUG_CODE macro, but this guards other debug-related code throughout the codebase. To avoid changing behaviour on release builds, this is only set for debug builds. Tested on QEMU, dumping the appropriate memory region in the UEFI shell shows the TianoCore log. An improved revision of the debug library used in several coreboot-related EDK2 forks, including MrChromebox's. Previous revisions also tested on an Acer Aspire VN7-572G laptop. Cc: Guo Dong <guo.dong@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Maurice Ma <maurice.ma@intel.com> Cc: Benjamin You <benjamin.you@intel.com> Cc: Sean Rhodes <sean@starlabs.systems> Signed-off-by: Benjamin Doron <benjamin.doron00@gmail.com>
Diffstat (limited to 'UefiPayloadPkg/UefiPayloadPkg.dsc')
-rw-r--r--UefiPayloadPkg/UefiPayloadPkg.dsc25
1 files changed, 20 insertions, 5 deletions
diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 862d440b16..e78e959ce4 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -41,6 +41,7 @@
DEFINE PS2_MOUSE_ENABLE = TRUE
DEFINE CRYPTO_PROTOCOL_SUPPORT = FALSE
DEFINE SD_MMC_TIMEOUT = 1000000
+ DEFINE USE_CBMEM_FOR_CONSOLE = FALSE
#
# NULL: NullMemoryTestDxe
@@ -131,10 +132,11 @@
[BuildOptions]
*_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
- GCC:*_UNIXGCC_*_CC_FLAGS = -DMDEPKG_NDEBUG
+!if $(USE_CBMEM_FOR_CONSOLE) == FALSE
GCC:RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG
INTEL:RELEASE_*_*_CC_FLAGS = /D MDEPKG_NDEBUG
MSFT:RELEASE_*_*_CC_FLAGS = /D MDEPKG_NDEBUG
+!endif
[BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
@@ -246,8 +248,13 @@
TimerLib|UefiPayloadPkg/Library/AcpiTimerLib/AcpiTimerLib.inf
!endif
ResetSystemLib|UefiPayloadPkg/Library/ResetSystemLib/ResetSystemLib.inf
+!if $(USE_CBMEM_FOR_CONSOLE) == TRUE
+ SerialPortLib|UefiPayloadPkg/Library/CbSerialPortLib/CbSerialPortLib.inf
+ PlatformHookLib|MdeModulePkg/Library/BasePlatformHookLibNull/BasePlatformHookLibNull.inf
+!else
SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
PlatformHookLib|UefiPayloadPkg/Library/PlatformHookLib/PlatformHookLib.inf
+!endif
PlatformBootManagerLib|UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
IoApicLib|PcAtChipsetPkg/Library/BaseIoApicLib/BaseIoApicLib.inf
@@ -463,10 +470,18 @@
gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c, 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0x31 }
gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x7
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8000004F
-!if $(SOURCE_DEBUG_ENABLE)
- gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x17
+!if $(USE_CBMEM_FOR_CONSOLE) == FALSE
+ !if $(SOURCE_DEBUG_ENABLE)
+ gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x17
+ !else
+ gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2F
+ !endif
!else
- gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2F
+ !if $(TARGET) == DEBUG
+ gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x07
+ !else
+ gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x03
+ !endif
!endif
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizeNonPopulateCapsule|$(MAX_SIZE_NON_POPULATE_CAPSULE)
#
@@ -512,7 +527,7 @@
gUefiCpuPkgTokenSpaceGuid.PcdCpuApLoopMode
gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchAddress
gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchRegionSize
-!if $(TARGET) == DEBUG
+!if ($(TARGET) == DEBUG || $(USE_CBMEM_FOR_CONSOLE) == TRUE)
gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|TRUE
!else
gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|FALSE