Skip to content

Commit 5090c39

Browse files
kraxelmergify[bot]
authored andcommitted
OvmfPkg/PlatformDxe: register log buffer as efi config table
If a memory debug log buffer is present, register the buffer location as config table so the OS can find and show it. Signed-off-by: Gerd Hoffmann <[email protected]>
1 parent 7f756db commit 5090c39

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

OvmfPkg/PlatformDxe/Platform.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include <Library/DebugLib.h>
1414
#include <Library/DevicePathLib.h>
1515
#include <Library/HiiLib.h>
16+
#include <Library/HobLib.h>
17+
#include <Library/MemDebugLogLib.h>
1618
#include <Library/MemoryAllocationLib.h>
1719
#include <Library/PrintLib.h>
1820
#include <Library/UefiBootServicesTableLib.h>
@@ -943,6 +945,28 @@ GopInstalled (
943945
mGopTracker = NULL;
944946
}
945947

948+
/**
949+
If a memory debug log buffer is present, register the buffer location as
950+
config table so the OS can find and show it.
951+
**/
952+
VOID
953+
EFIAPI
954+
MemDebugLogInstallTable (
955+
VOID
956+
)
957+
{
958+
EFI_HOB_GUID_TYPE *GuidHob;
959+
MEM_DEBUG_LOG_HOB_DATA *HobData;
960+
VOID *LogBuffer;
961+
962+
GuidHob = GetFirstGuidHob (&gMemDebugLogHobGuid);
963+
if (GuidHob != NULL) {
964+
HobData = (MEM_DEBUG_LOG_HOB_DATA *)GET_GUID_HOB_DATA (GuidHob);
965+
LogBuffer = (VOID *)(UINTN)HobData->MemDebugLogBufAddr;
966+
gBS->InstallConfigurationTable (&gMemDebugLogHobGuid, LogBuffer);
967+
}
968+
}
969+
946970
/**
947971
Entry point for this driver.
948972
@@ -1030,6 +1054,8 @@ PlatformInit (
10301054
Status = gBS->SignalEvent (mGopEvent);
10311055
ASSERT_EFI_ERROR (Status);
10321056

1057+
MemDebugLogInstallTable ();
1058+
10331059
return EFI_SUCCESS;
10341060

10351061
CloseGopEvent:

OvmfPkg/PlatformDxe/Platform.inf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
DebugLib
3737
DevicePathLib
3838
HiiLib
39+
HobLib
3940
MemoryAllocationLib
4041
PrintLib
4142
UefiBootServicesTableLib
@@ -59,6 +60,7 @@
5960
[Guids]
6061
gEfiIfrTianoGuid
6162
gOvmfPlatformConfigGuid
63+
gMemDebugLogHobGuid
6264

6365
[Depex]
6466
gEfiHiiConfigRoutingProtocolGuid AND

0 commit comments

Comments
 (0)