Now that we have Bootlog support for serial, let's also add it for the PV Debug Port. The only new platform we touch with this is Xen, where we just disable bootlogs for now.
Signed-off-by: Alexander Graf <g...@amazon.com> --- .../Library/PlatformDebugLibIoPort/DebugLib.c | 23 +++++++++++++++---- .../PlatformDebugLibIoPort.inf | 1 + .../PlatformRomDebugLibIoPort.inf | 1 + .../PlatformRomDebugLibIoPortNocheck.inf | 1 + OvmfPkg/OvmfXen.dsc | 1 + 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c index 4e25f198aa..80eb3cce0f 100644 --- a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c +++ b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c @@ -15,6 +15,7 @@ #include <Library/PrintLib.h> #include <Library/PcdLib.h> #include <Library/BaseMemoryLib.h> +#include <Library/DebugBootlog.h> #include <Library/DebugPrintErrorLevelLib.h> #include "DebugLibDetect.h" @@ -86,17 +87,20 @@ DebugPrintMarker ( { CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH]; UINTN Length; + UINT32 DebugPrintLevel, DebugBootlogLevel; // // If Format is NULL, then ASSERT(). // ASSERT (Format != NULL); + DebugPrintLevel = GetDebugPrintErrorLevel (); + DebugBootlogLevel = GetDebugBootlogErrorLevel (); + // - // Check if the global mask disables this message or the device is inactive + // Check if the global mask disables this message // - if (((ErrorLevel & GetDebugPrintErrorLevel ()) == 0) || - !PlatformDebugLibIoPortFound ()) + if ((ErrorLevel & (DebugPrintLevel | DebugBootlogLevel)) == 0) { return; } @@ -111,9 +115,18 @@ DebugPrintMarker ( } // - // Send the print string to the debug I/O port + // Send the print string to the debug I/O port if it is active // - IoWriteFifo8 (PcdGet16 (PcdDebugIoPort), Length, Buffer); + if (PlatformDebugLibIoPortFound () && (ErrorLevel & DebugPrintLevel)) { + IoWriteFifo8 (PcdGet16 (PcdDebugIoPort), Length, Buffer); + } + + // + // Append the print string to the Boot Log + // + if (ErrorLevel & DebugBootlogLevel) { + DebugBootlogAppend (Buffer, Length, ErrorLevel); + } } /** diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf index 94ab910507..4a121a3b7b 100644 --- a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf +++ b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf @@ -40,6 +40,7 @@ PrintLib BaseLib DebugPrintErrorLevelLib + DebugBootlogLib [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdDebugIoPort ## CONSUMES diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf index 8f721d249d..ba2052f81d 100644 --- a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf +++ b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf @@ -40,6 +40,7 @@ PrintLib BaseLib DebugPrintErrorLevelLib + DebugBootlogLib [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdDebugIoPort ## CONSUMES diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPortNocheck.inf b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPortNocheck.inf index 6a85b333ee..75cdfafd22 100644 --- a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPortNocheck.inf +++ b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPortNocheck.inf @@ -39,6 +39,7 @@ PrintLib BaseLib DebugPrintErrorLevelLib + DebugBootlogLib [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdDebugIoPort ## CONSUMES diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc index 6ba4bd729a..6f66d49855 100644 --- a/OvmfPkg/OvmfXen.dsc +++ b/OvmfPkg/OvmfXen.dsc @@ -226,6 +226,7 @@ !else DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf !endif + DebugBootlogLib|MdePkg/Library/BaseDebugBootlog/BaseDebugBootlogNullLib.inf [LibraryClasses.common] BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf -- 2.28.0.394.ge197136389 Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B Sitz: Berlin Ust-ID: DE 289 237 879 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#90077): https://edk2.groups.io/g/devel/message/90077 Mute This Topic: https://groups.io/mt/91368920/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-