};\r
\r
\r
+/**\r
+ Check if it runs in Recovery mode.\r
+ \r
+ @param PeiServices General purpose services available to every PEIM.\r
+\r
+ @retval TRUE It's in Recovery mode.\r
+ @retval FALSE It's not in Recovery mode.\r
+\r
+**/\r
+BOOLEAN\r
+IsInRecoveryMode (\r
+ IN CONST EFI_PEI_SERVICES **PeiServices\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_BOOT_MODE BootMode;\r
+\r
+ Status = (*PeiServices)->GetBootMode (PeiServices, &BootMode);\r
+ ASSERT_EFI_ERROR (Status);\r
+ \r
+ if (BootMode == BOOT_IN_RECOVERY_MODE) {\r
+ return TRUE;\r
+ }\r
+ return FALSE;\r
+}\r
+\r
/**\r
Provide the functionality of the variable services.\r
\r
IN CONST EFI_PEI_SERVICES **PeiServices\r
)\r
{\r
- EFI_BOOT_MODE BootMode;\r
- EFI_STATUS Status;\r
-\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
\r
/**\r
if (VariableName == NULL || VariableGuid == NULL || DataSize == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
+\r
+ //\r
+ // Check if this is recovery boot path.\r
+ // If yes, the content of variable area is not reliable. Therefore we directly\r
+ // return EFI_NOT_FOUND. \r
+ // \r
+ if (IsInRecoveryMode(PeiServices)) {\r
+ return EFI_NOT_FOUND;\r
+ }\r
+\r
//\r
// Find existing variable\r
//\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
+ //\r
+ // Check if this is recovery boot path.\r
+ // If yes, the content of variable area is not reliable. Therefore we directly\r
+ // return EFI_NOT_FOUND. \r
+ // \r
+ if (IsInRecoveryMode(PeiServices)) {\r
+ return EFI_NOT_FOUND;\r
+ }\r
+\r
Status = FindVariable (PeiServices, VariableName, VariableGuid, &Variable);\r
if (Variable.CurrPtr == NULL || Status != EFI_SUCCESS) {\r
return Status;\r