summaryrefslogtreecommitdiff
path: root/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitDxe/PlatformInitDxe.c
diff options
context:
space:
mode:
Diffstat (limited to 'Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitDxe/PlatformInitDxe.c')
-rw-r--r--Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitDxe/PlatformInitDxe.c211
1 files changed, 55 insertions, 156 deletions
diff --git a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitDxe/PlatformInitDxe.c b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitDxe/PlatformInitDxe.c
index feb54e93b3..7694d27423 100644
--- a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitDxe/PlatformInitDxe.c
+++ b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitDxe/PlatformInitDxe.c
@@ -25,15 +25,6 @@
#include <Library/TestPointCheckLib.h>
#include <Library/PerformanceLib.h>
#include <Library/HobLib.h>
-#include <Protocol/ReportStatusCodeHandler.h>
-
-EFI_STATUS
-PlatformInitUnRegisterRscHandler (
- VOID
- );
-
-EFI_EVENT mRscNotifyEvent = NULL;
-EFI_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL;
/**
PciEnumerationComplete Protocol notification event handler.
@@ -132,6 +123,47 @@ OnDxeSmmReadyToLock (
/**
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.
+
+**/
+VOID
+EFIAPI
+OnReadyToBootLater (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ DEBUG ((DEBUG_INFO, "OnReadyToBootLater\n"));
+
+ gBS->CloseEvent (Event);
+
+ TestPointReadyToBootMemoryTypeInformationFunctional ();
+ TestPointReadyToBootUefiMemoryAttributeTableFunctional ();
+ TestPointReadyToBootUefiBootVariableFunctional ();
+ TestPointReadyToBootUefiConsoleVariableFunctional ();
+ TestPointReadyToBootHstiTableFunctional ();
+ TestPointReadyToBootAcpiTableFuntional ();
+ TestPointReadyToBootGcdResourceFuntional ();
+
+ TestPointDxeSmmReadyToBootSmiHandlerInstrument ();
+ TestPointDxeSmmReadyToBootSmmPageProtection ();
+
+ TestPointReadyToBootUefiSecureBootEnabled ();
+ TestPointReadyToBootPiSignedFvBootEnabled ();
+ TestPointReadyToBootTcgTrustedBootEnabled ();
+ TestPointReadyToBootTcgMorEnabled ();
+ TestPointReadyToBootEsrtTableFunctional ();
+}
+
+/**
+ 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
@@ -149,13 +181,25 @@ OnReadyToBoot (
)
{
EFI_STATUS Status;
+ EFI_EVENT ReadyToBootLaterEvent;
+
+ DEBUG ((DEBUG_INFO, "OnReadyToBoot\n"));
gBS->CloseEvent (Event);
Status = BoardInitReadyToBoot ();
ASSERT_EFI_ERROR(Status);
-
- TestPointDxeSmmReadyToBootSmmPageProtection ();
+
+ Status = gBS->CreateEvent (
+ EVT_NOTIFY_SIGNAL,
+ TPL_CALLBACK,
+ OnReadyToBootLater,
+ NULL,
+ &ReadyToBootLaterEvent
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ gBS->SignalEvent (ReadyToBootLaterEvent);
}
/**
@@ -177,8 +221,6 @@ OnEndOfFirmware (
EFI_STATUS Status;
gBS->CloseEvent (Event);
-
- PlatformInitUnRegisterRscHandler ();
Status = BoardInitEndOfFirmware ();
ASSERT_EFI_ERROR(Status);
@@ -261,148 +303,6 @@ BoardNotificationInitEntryPoint (
}
/**
- 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.
-
-**/
-EFI_STATUS
-EFIAPI
-PlatformInitStatusCodeListener (
- 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
- )
-{
- EFI_STATUS Status;
- STATIC BOOLEAN Tested = 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 (!Tested) {
- TestPointReadyToBootAcpiTableFuntional ();
- TestPointReadyToBootGcdResourceFuntional ();
- TestPointReadyToBootMemoryTypeInformationFunctional ();
- TestPointReadyToBootUefiMemoryAttributeTableFunctional ();
- TestPointReadyToBootUefiBootVariableFunctional ();
- TestPointReadyToBootUefiConsoleVariableFunctional ();
- TestPointReadyToBootHstiTableFunctional ();
- TestPointDxeSmmReadyToBootSmiHandlerInstrument ();
-
- TestPointReadyToBootUefiSecureBootEnabled ();
- TestPointReadyToBootPiSignedFvBootEnabled ();
- TestPointReadyToBootTcgTrustedBootEnabled ();
- TestPointReadyToBootTcgMorEnabled ();
- TestPointReadyToBootEsrtTableFunctional ();
- Tested = 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)) {
- PlatformInitUnRegisterRscHandler ();
- } else if (Value == (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_LEGACY_BOOT_EVENT)) {
- } else {
- //
- // Ignore else progress code.
- //
- Status = EFI_UNSUPPORTED;
- }
-
- return Status;
-}
-
-/**
- RscHandler Protocol notification event handler.
-
- @param[in] Event Event whose notification function is being invoked.
- @param[in] Context Pointer to the notification function's context.
-**/
-VOID
-EFIAPI
-OnRscHandlerInstalled (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- EFI_STATUS Status;
-
- Status = gBS->LocateProtocol (
- &gEfiRscHandlerProtocolGuid,
- NULL,
- &mRscHandlerProtocol
- );
- if (EFI_ERROR (Status)) {
- return ;
- }
-
- //
- // Register report status code listener for OS Loader load and start.
- //
- Status = mRscHandlerProtocol->Register (PlatformInitStatusCodeListener, TPL_HIGH_LEVEL);
- ASSERT_EFI_ERROR (Status);
-
- gBS->CloseEvent (mRscNotifyEvent);
- mRscNotifyEvent = NULL;
-}
-
-EFI_STATUS
-PlatformInitRegisterRscHandler (
- VOID
- )
-{
- VOID *Registration;
-
- mRscNotifyEvent = EfiCreateProtocolNotifyEvent (
- &gEfiRscHandlerProtocolGuid,
- TPL_CALLBACK,
- OnRscHandlerInstalled,
- NULL,
- &Registration
- );
- ASSERT (mRscNotifyEvent != NULL);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-PlatformInitUnRegisterRscHandler (
- VOID
- )
-{
- if (mRscHandlerProtocol != NULL) {
- mRscHandlerProtocol->Unregister (PlatformInitStatusCodeListener);
- mRscHandlerProtocol = NULL;
- }
- if (mRscNotifyEvent != NULL) {
- gBS->CloseEvent (mRscNotifyEvent);
- mRscNotifyEvent = NULL;
- }
- return EFI_SUCCESS;
-}
-
-/**
Initialize DXE Platform.
@param[in] ImageHandle Image handle of this driver.
@@ -420,7 +320,6 @@ PlatformInitDxeEntryPoint (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
- PlatformInitRegisterRscHandler ();
BoardNotificationInitEntryPoint ();
return EFI_SUCCESS;