From d9c5beb159c4b54ba14e3ad731d0e69a2e85c6c0 Mon Sep 17 00:00:00 2001 From: Dandan Bi Date: Tue, 17 Jul 2018 13:09:02 +0800 Subject: [PATCH] SecurityPkg/Tcg: Add use case for new Perf macro Add an example case for the usage of PERF_CALLBACK_BEGIN/PERF_CALLBACK_END Cc: Liming Gao Cc: Chao Zhang Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi Reviewed-by: Liming Gao Reviewed-by: Chao Zhang --- SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c | 4 ++++ SecurityPkg/Tcg/TcgPei/TcgPei.c | 5 +++++ SecurityPkg/Tcg/TcgPei/TcgPei.inf | 1 + 3 files changed, 10 insertions(+) diff --git a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c index 74cdd1fa88..09ef0c70a5 100644 --- a/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c +++ b/SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c @@ -161,6 +161,8 @@ EndofPeiSignalNotifyCallBack ( MeasuredHobData = NULL; + PERF_CALLBACK_BEGIN (&gEfiEndOfPeiSignalPpiGuid); + // // Create a Guid hob to save all measured Fv // @@ -186,6 +188,8 @@ EndofPeiSignalNotifyCallBack ( CopyMem (&MeasuredHobData->MeasuredFvBuf[mMeasuredBaseFvIndex] , mMeasuredChildFvInfo, sizeof(EFI_PLATFORM_FIRMWARE_BLOB) * (mMeasuredChildFvIndex)); } + PERF_CALLBACK_END (&gEfiEndOfPeiSignalPpiGuid); + return EFI_SUCCESS; } diff --git a/SecurityPkg/Tcg/TcgPei/TcgPei.c b/SecurityPkg/Tcg/TcgPei/TcgPei.c index 1ed11a1b29..d07047580c 100644 --- a/SecurityPkg/Tcg/TcgPei/TcgPei.c +++ b/SecurityPkg/Tcg/TcgPei/TcgPei.c @@ -41,6 +41,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include +#include BOOLEAN mImageInMemory = FALSE; @@ -170,6 +171,8 @@ EndofPeiSignalNotifyCallBack ( MeasuredHobData = NULL; + PERF_CALLBACK_BEGIN (&gEfiEndOfPeiSignalPpiGuid); + // // Create a Guid hob to save all measured Fv // @@ -195,6 +198,8 @@ EndofPeiSignalNotifyCallBack ( CopyMem (&MeasuredHobData->MeasuredFvBuf[mMeasuredBaseFvIndex] , mMeasuredChildFvInfo, sizeof(EFI_PLATFORM_FIRMWARE_BLOB) * (mMeasuredChildFvIndex)); } + PERF_CALLBACK_END (&gEfiEndOfPeiSignalPpiGuid); + return EFI_SUCCESS; } diff --git a/SecurityPkg/Tcg/TcgPei/TcgPei.inf b/SecurityPkg/Tcg/TcgPei/TcgPei.inf index 0252511391..4c8a055c6c 100644 --- a/SecurityPkg/Tcg/TcgPei/TcgPei.inf +++ b/SecurityPkg/Tcg/TcgPei/TcgPei.inf @@ -56,6 +56,7 @@ MemoryAllocationLib ReportStatusCodeLib Tpm12CommandLib + PerformanceLib [Guids] gTcgEventEntryHobGuid ## PRODUCES ## HOB