summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Variable
diff options
context:
space:
mode:
authoreric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>2009-01-05 05:50:22 +0000
committereric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>2009-01-05 05:50:22 +0000
commit721dfef39ec450e2506d40f89178cdc33a5dbb7c (patch)
tree0e3649e040b738197d3f09e71a531ef67a05a29f /MdeModulePkg/Universal/Variable
parent54656366f93c77b1bbda4e9bfd287c549eb5390e (diff)
downloadedk2-721dfef39ec450e2506d40f89178cdc33a5dbb7c.zip
edk2-721dfef39ec450e2506d40f89178cdc33a5dbb7c.tar.gz
edk2-721dfef39ec450e2506d40f89178cdc33a5dbb7c.tar.bz2
As variable area is not reliable in recovery path, then we should not produce ReadonlyVariable2 ppi at the point. This way causes other Pei module wanted to access to variable will fail
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7183 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/Variable')
-rw-r--r--MdeModulePkg/Universal/Variable/Pei/Variable.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/MdeModulePkg/Universal/Variable/Pei/Variable.c b/MdeModulePkg/Universal/Variable/Pei/Variable.c
index e2a79a0..a8132d6 100644
--- a/MdeModulePkg/Universal/Variable/Pei/Variable.c
+++ b/MdeModulePkg/Universal/Variable/Pei/Variable.c
@@ -38,8 +38,8 @@ EFI_GUID mEfiVariableIndexTableGuid = EFI_VARIABLE_INDEX_TABLE_GUID;
/**
Provide the functionality of the variable services.
- @param FileHandle Handle of the file being invoked.
- Type EFI_PEI_FILE_HANDLE is defined in FfsFindNextFile().
+ @param FileHandle Handle of the file being invoked.
+ Type EFI_PEI_FILE_HANDLE is defined in FfsFindNextFile().
@param PeiServices General purpose services available to every PEIM.
@retval EFI_SUCCESS If the interface could be successfully installed
@@ -53,9 +53,21 @@ PeimInitializeVariableServices (
IN CONST EFI_PEI_SERVICES **PeiServices
)
{
+ EFI_BOOT_MODE BootMode;
+ EFI_STATUS Status;
+
//
- // Publish the variable capability to other modules
- //
+ // Check if this is recovery boot path. If no, publish the variable access capability
+ // to other modules. If yes, the content of variable area is not reliable. Therefore,
+ // in this case we should not provide variable service to other pei modules.
+ //
+ Status = (*PeiServices)->GetBootMode (PeiServices, &BootMode);
+ ASSERT_EFI_ERROR (Status);
+
+ if (BootMode == BOOT_IN_RECOVERY_MODE) {
+ return EFI_UNSUPPORTED;
+ }
+
return PeiServicesInstallPpi (&mPpiListVariable);
}