summaryrefslogtreecommitdiff
path: root/Platform/Intel/MinPlatformPkg/Test
diff options
context:
space:
mode:
authorJiewen Yao <jiewen.yao@intel.com>2017-11-22 16:51:29 +0800
committerJiewen Yao <jiewen.yao@intel.com>2017-11-28 20:50:50 +0800
commit0d770a3213eb66b56682ccd1ab775ef96d6cb069 (patch)
tree5988c9099e4f604ff9cbd2a6701b57a0317167f6 /Platform/Intel/MinPlatformPkg/Test
parent471ddafeea4fbd1599e8b0293499e7ae18d23983 (diff)
downloadedk2-platforms-0d770a3213eb66b56682ccd1ab775ef96d6cb069.tar.xz
TestPoint: avoid using ReportStatus code to make test point check as last one.
Use event signal instead. Cc: Michael A Kubacki <michael.a.kubacki@intel.com> Cc: Amy Chan <amy.chan@intel.com> Cc: Chasel Chiu <chasel.chiu@intel.com> Cc: Brett Wang <brett.wang@intel.com> Cc: Daocheng Bu <daocheng.bu@intel.com> Cc: Isaac W Oram <isaac.w.oram@intel.com> Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Amy Chan <amy.chan@intel.com>
Diffstat (limited to 'Platform/Intel/MinPlatformPkg/Test')
-rw-r--r--Platform/Intel/MinPlatformPkg/Test/TestPointStubDxe/TestPointStubDxe.c158
-rw-r--r--Platform/Intel/MinPlatformPkg/Test/TestPointStubDxe/TestPointStubDxe.inf5
2 files changed, 44 insertions, 119 deletions
diff --git a/Platform/Intel/MinPlatformPkg/Test/TestPointStubDxe/TestPointStubDxe.c b/Platform/Intel/MinPlatformPkg/Test/TestPointStubDxe/TestPointStubDxe.c
index b80db2d547..d6878f45de 100644
--- a/Platform/Intel/MinPlatformPkg/Test/TestPointStubDxe/TestPointStubDxe.c
+++ b/Platform/Intel/MinPlatformPkg/Test/TestPointStubDxe/TestPointStubDxe.c
@@ -23,19 +23,10 @@
#include <Protocol/AdapterInformation.h>
#include <Protocol/SmmCommunication.h>
#include <Guid/PiSmmCommunicationRegionTable.h>
-#include <Protocol/ReportStatusCodeHandler.h>
-
-EFI_STATUS
-TestPointStubUnRegisterRscHandler (
- VOID
- );
UINTN mSmmTestPointDatabaseSize;
VOID *mSmmTestPointDatabase;
-EFI_EVENT mRscNotifyEvent = NULL;
-EFI_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL;
-
VOID
PublishPeiTestPoint (
VOID
@@ -256,132 +247,62 @@ PublishSmmTestPoint (
}
/**
- Report status code listener
- for OsLoaderLoadImageStart and OsLoaderStartImageStart.
-
- @param[in] CodeType Indicates the type of status code being reported.
- @param[in] Value Describes the current status of a hardware or software entity.
- This included information about the class and subclass that is used to
- classify the entity as well as an operation.
- @param[in] Instance The enumeration of a hardware or software entity within
- the system. Valid instance numbers start with 1.
- @param[in] CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to
- different callers.
- @param[in] Data This optional parameter may be used to pass additional data.
-
- @retval EFI_SUCCESS Status code is what we expected.
- @retval EFI_UNSUPPORTED Status code not supported.
+ Notification function of EVT_GROUP_READY_TO_BOOT event group.
+ It runs after most ReadyToBoot event signaled.
+
+ This is a notification function registered on EVT_GROUP_READY_TO_BOOT event group.
+ When the Boot Manager is about to load and execute a boot option, it reclaims variable
+ storage if free size is below the threshold.
+
+ @param[in] Event Event whose notification function is being invoked.
+ @param[in] Context Pointer to the notification function's context.
**/
-EFI_STATUS
+VOID
EFIAPI
-TestPointStubStatusCodeListener (
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId,
- IN EFI_STATUS_CODE_DATA *Data
+OnReadyToBootLater (
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
- EFI_STATUS Status;
- STATIC BOOLEAN Published = FALSE;
-
- //
- // Check whether status code is what we are interested in.
- //
- if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) != EFI_PROGRESS_CODE) {
- return EFI_UNSUPPORTED;
- }
-
- Status = EFI_SUCCESS;
- if (Value == (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_READY_TO_BOOT_EVENT)) {
- if (!Published) {
- PublishSmmTestPoint ();
- Published = TRUE;
- }
- } else if (Value == PcdGet32 (PcdProgressCodeOsLoaderLoad)) {
- } else if (Value == PcdGet32 (PcdProgressCodeOsLoaderStart)) {
- } else if (Value == (EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_BS_PC_EXIT_BOOT_SERVICES)) {
- TestPointStubUnRegisterRscHandler ();
- } else if (Value == (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_LEGACY_BOOT_EVENT)) {
- } else {
- //
- // Ignore else progress code.
- //
- Status = EFI_UNSUPPORTED;
- }
+ gBS->CloseEvent (Event);
- return Status;
+ PublishSmmTestPoint ();
}
/**
- RscHandler Protocol notification event handler.
+ Notification function of EVT_GROUP_READY_TO_BOOT event group.
+
+ This is a notification function registered on EVT_GROUP_READY_TO_BOOT event group.
+ When the Boot Manager is about to load and execute a boot option, it reclaims variable
+ storage if free size is below the threshold.
+
+ @param[in] Event Event whose notification function is being invoked.
+ @param[in] Context Pointer to the notification function's context.
- @param[in] Event Event whose notification function is being invoked.
- @param[in] Context Pointer to the notification function's context.
**/
VOID
EFIAPI
-OnRscHandlerInstalled (
+OnReadyToBoot (
IN EFI_EVENT Event,
IN VOID *Context
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
+ EFI_EVENT ReadyToBootLaterEvent;
+
+ gBS->CloseEvent (Event);
- Status = gBS->LocateProtocol (
- &gEfiRscHandlerProtocolGuid,
+ Status = gBS->CreateEvent (
+ EVT_NOTIFY_SIGNAL,
+ TPL_CALLBACK,
+ OnReadyToBootLater,
NULL,
- &mRscHandlerProtocol
+ &ReadyToBootLaterEvent
);
- if (EFI_ERROR (Status)) {
- return ;
- }
-
- //
- // Register report status code listener for OS Loader load and start.
- //
- Status = mRscHandlerProtocol->Register (TestPointStubStatusCodeListener, TPL_HIGH_LEVEL);
ASSERT_EFI_ERROR (Status);
-
- gBS->CloseEvent (mRscNotifyEvent);
- mRscNotifyEvent = NULL;
-}
-
-EFI_STATUS
-TestPointStubRegisterRscHandler (
- VOID
- )
-{
- VOID *Registration;
-
- mRscNotifyEvent = EfiCreateProtocolNotifyEvent (
- &gEfiRscHandlerProtocolGuid,
- TPL_CALLBACK,
- OnRscHandlerInstalled,
- NULL,
- &Registration
- );
- ASSERT (mRscNotifyEvent != NULL);
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-TestPointStubUnRegisterRscHandler (
- VOID
- )
-{
- if (mRscHandlerProtocol != NULL) {
- mRscHandlerProtocol->Unregister (TestPointStubStatusCodeListener);
- mRscHandlerProtocol = NULL;
- }
- if (mRscNotifyEvent != NULL) {
- gBS->CloseEvent (mRscNotifyEvent);
- mRscNotifyEvent = NULL;
- }
- return EFI_SUCCESS;
+ gBS->SignalEvent (ReadyToBootLaterEvent);
}
VOID
@@ -389,7 +310,16 @@ TestPointStubForSmm (
VOID
)
{
- TestPointStubRegisterRscHandler ();
+ EFI_STATUS Status;
+ EFI_EVENT ReadyToBootEvent;
+
+ Status = EfiCreateEventReadyToBootEx (
+ TPL_CALLBACK,
+ OnReadyToBoot,
+ NULL,
+ &ReadyToBootEvent
+ );
+ ASSERT_EFI_ERROR (Status);
}
/**
diff --git a/Platform/Intel/MinPlatformPkg/Test/TestPointStubDxe/TestPointStubDxe.inf b/Platform/Intel/MinPlatformPkg/Test/TestPointStubDxe/TestPointStubDxe.inf
index 09d6f2a9f0..de7aa8a10f 100644
--- a/Platform/Intel/MinPlatformPkg/Test/TestPointStubDxe/TestPointStubDxe.inf
+++ b/Platform/Intel/MinPlatformPkg/Test/TestPointStubDxe/TestPointStubDxe.inf
@@ -44,14 +44,9 @@
gAdapterInfoPlatformTestPointGuid
gEdkiiPiSmmCommunicationRegionTableGuid
-[Pcd]
- gEfiMdeModulePkgTokenSpaceGuid.PcdProgressCodeOsLoaderLoad
- gEfiMdeModulePkgTokenSpaceGuid.PcdProgressCodeOsLoaderStart
-
[Protocols]
gEfiAdapterInformationProtocolGuid
gEfiSmmCommunicationProtocolGuid
- gEfiRscHandlerProtocolGuid
[Depex]
TRUE