]> git.proxmox.com Git - mirror_edk2.git/commitdiff
As variable area is not reliable in recovery path, then we should not produce Readonl...
authoreric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 5 Jan 2009 05:50:22 +0000 (05:50 +0000)
committereric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 5 Jan 2009 05:50:22 +0000 (05:50 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7183 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/Variable/Pei/Variable.c

index e2a79a0fb362ddf85999d1df1a8c578409de2b59..a8132d6eaae48944dce4577c0e08fead1a8a7d19 100644 (file)
@@ -38,8 +38,8 @@ EFI_GUID mEfiVariableIndexTableGuid = EFI_VARIABLE_INDEX_TABLE_GUID;
 /**\r
   Provide the functionality of the variable services.\r
   \r
-  @param  FileHandle  Handle of the file being invoked. \r
-                      Type EFI_PEI_FILE_HANDLE is defined in FfsFindNextFile().\r
+  @param  FileHandle   Handle of the file being invoked. \r
+                       Type EFI_PEI_FILE_HANDLE is defined in FfsFindNextFile().\r
   @param  PeiServices  General purpose services available to every PEIM.\r
 \r
   @retval EFI_SUCCESS  If the interface could be successfully installed\r
@@ -53,9 +53,21 @@ PeimInitializeVariableServices (
   IN CONST EFI_PEI_SERVICES          **PeiServices\r
   )\r
 {\r
+  EFI_BOOT_MODE BootMode;\r
+  EFI_STATUS    Status;\r
+\r
   //\r
-  // Publish the variable capability to other modules\r
-  //\r
+  // Check if this is recovery boot path. If no, publish the variable access capability\r
+  // to other modules. If yes, the content of variable area is not reliable. Therefore,\r
+  // in this case we should not provide variable service to other pei modules. \r
+  // \r
+  Status = (*PeiServices)->GetBootMode (PeiServices, &BootMode);\r
+  ASSERT_EFI_ERROR (Status);\r
+  \r
+  if (BootMode == BOOT_IN_RECOVERY_MODE) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+\r
   return PeiServicesInstallPpi (&mPpiListVariable);\r
 \r
 }\r