From 3c007f36531accd5e6d92f5f56fce01a42aa2720 Mon Sep 17 00:00:00 2001 From: Star Zeng Date: Sat, 12 Jan 2019 22:31:06 +0800 Subject: [PATCH] MdeModulePkg VariablePei: Don't check BOOT_IN_RECOVERY_MODE Don't check BOOT_IN_RECOVERY_MODE, but check PcdEmuVariableNvModeEnable which platform can configure flexibly. Cc: Jian J Wang Cc: Hao Wu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng Reviewed-by: Jian J Wang Reviewed-by: Hao Wu Tested-by: Julien Grall Acked-by: Julien Grall --- MdeModulePkg/Universal/Variable/Pei/Variable.c | 8 +++++--- MdeModulePkg/Universal/Variable/Pei/VariablePei.inf | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/MdeModulePkg/Universal/Variable/Pei/Variable.c b/MdeModulePkg/Universal/Variable/Pei/Variable.c index 77b3eaeb21..148c1cfefd 100644 --- a/MdeModulePkg/Universal/Variable/Pei/Variable.c +++ b/MdeModulePkg/Universal/Variable/Pei/Variable.c @@ -2,7 +2,7 @@ Implement ReadOnly Variable Services required by PEIM and install PEI ReadOnly Varaiable2 PPI. These services operates the non volatile storage space. -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -584,9 +584,9 @@ GetVariableStore ( break; case VariableStoreTypeNv: - if (GetBootModeHob () != BOOT_IN_RECOVERY_MODE) { + if (!PcdGetBool (PcdEmuVariableNvModeEnable)) { // - // The content of NV storage for variable is not reliable in recovery boot mode. + // Emulated non-volatile variable mode is not enabled. // NvStorageSize = PcdGet32 (PcdFlashNvStorageVariableSize); @@ -594,6 +594,8 @@ GetVariableStore ( PcdGet64 (PcdFlashNvStorageVariableBase64) : PcdGet32 (PcdFlashNvStorageVariableBase) ); + ASSERT (NvStorageBase != 0); + // // First let FvHeader point to NV storage base. // diff --git a/MdeModulePkg/Universal/Variable/Pei/VariablePei.inf b/MdeModulePkg/Universal/Variable/Pei/VariablePei.inf index 565efdc021..3161617a56 100644 --- a/MdeModulePkg/Universal/Variable/Pei/VariablePei.inf +++ b/MdeModulePkg/Universal/Variable/Pei/VariablePei.inf @@ -3,7 +3,7 @@ # # This module implements ReadOnly Variable Services required by PEIM and installs PEI ReadOnly Varaiable2 PPI. # -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -68,6 +68,7 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase ## SOMETIMES_CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable ## SOMETIMES_CONSUMES [Depex] gEdkiiFaultTolerantWriteGuid -- 2.39.2