summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c55
-rw-r--r--MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c31
2 files changed, 60 insertions, 26 deletions
diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c
index 30165ce4dc..521cb4ed24 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c
@@ -342,6 +342,40 @@ OnEndOfDxe (
}
/**
+ Initializes variable write service for DXE.
+
+**/
+VOID
+VariableWriteServiceInitializeDxe (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ Status = VariableWriteServiceInitialize ();
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "Variable write service initialization failed. Status = %r\n", Status));
+ }
+
+ //
+ // Some Secure Boot Policy Var (SecureBoot, etc) updates following other
+ // Secure Boot Policy Variable change. Record their initial value.
+ //
+ RecordSecureBootPolicyVarData();
+
+ //
+ // Install the Variable Write Architectural protocol.
+ //
+ Status = gBS->InstallProtocolInterface (
+ &mHandle,
+ &gEfiVariableWriteArchProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+}
+
+/**
Fault Tolerant Write protocol notification event handler.
Non-Volatile variable write may needs FTW protocol to reclaim when
@@ -423,27 +457,10 @@ FtwNotificationEvent (
}
}
- Status = VariableWriteServiceInitialize ();
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "Variable write service initialization failed. Status = %r\n", Status));
- }
-
//
- // Some Secure Boot Policy Var (SecureBoot, etc) updates following other
- // Secure Boot Policy Variable change. Record their initial value.
+ // Initializes variable write service after FTW was ready.
//
- RecordSecureBootPolicyVarData();
-
- //
- // Install the Variable Write Architectural protocol.
- //
- Status = gBS->InstallProtocolInterface (
- &mHandle,
- &gEfiVariableWriteArchProtocolGuid,
- EFI_NATIVE_INTERFACE,
- NULL
- );
- ASSERT_EFI_ERROR (Status);
+ VariableWriteServiceInitializeDxe ();
//
// Close the notify event to avoid install gEfiVariableWriteArchProtocolGuid again.
diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c
index 4b136464a2..e6734acdf2 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c
@@ -840,6 +840,28 @@ SmmEndOfDxeCallback (
}
/**
+ Initializes variable write service for SMM.
+
+**/
+VOID
+VariableWriteServiceInitializeSmm (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+
+ Status = VariableWriteServiceInitialize ();
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "Variable write service initialization failed. Status = %r\n", Status));
+ }
+
+ //
+ // Notify the variable wrapper driver the variable write service is ready
+ //
+ VariableNotifySmmWriteReady ();
+}
+
+/**
SMM Fault Tolerant Write protocol notification event handler.
Non-Volatile variable write may needs FTW protocol to reclaim when
@@ -903,15 +925,10 @@ SmmFtwNotificationEvent (
mVariableModuleGlobal->FvbInstance = FvbProtocol;
- Status = VariableWriteServiceInitialize ();
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "Variable write service initialization failed. Status = %r\n", Status));
- }
-
//
- // Notify the variable wrapper driver the variable write service is ready
+ // Initializes variable write service after FTW was ready.
//
- VariableNotifySmmWriteReady ();
+ VariableWriteServiceInitializeSmm ();
return EFI_SUCCESS;
}