diff --git a/EdkCompatibilityPkg/Compatibility/ReadOnlyVariableToReadOnlyVariable2Thunk/ReadOnlyVariableToReadOnlyVariable2Thunk.c b/EdkCompatibilityPkg/Compatibility/ReadOnlyVariableToReadOnlyVariable2Thunk/ReadOnlyVariableToReadOnlyVariable2Thunk.c index 2d3752d3e7..48103490ae 100644 --- a/EdkCompatibilityPkg/Compatibility/ReadOnlyVariableToReadOnlyVariable2Thunk/ReadOnlyVariableToReadOnlyVariable2Thunk.c +++ b/EdkCompatibilityPkg/Compatibility/ReadOnlyVariableToReadOnlyVariable2Thunk/ReadOnlyVariableToReadOnlyVariable2Thunk.c @@ -1,4 +1,4 @@ -/** +/** @file Module produce EFI_PEI_READ_ONLY_VARIABLE_PPI on top of EFI_PEI_READ_ONLY_VARIABLE2_PPI. UEFI PI Spec supersedes Intel's Framework Specs. # EFI_PEI_READ_ONLY_VARIABLE_PPI defined in Intel Framework Pkg is replaced by EFI_PEI_READ_ONLY_VARIABLE2_PPI @@ -8,6 +8,8 @@ UEFI PI Spec supersedes Intel's Framework Specs. # 1) Framework module consumes EFI_PEI_READ_ONLY_VARIABLE_PPI is present. # 2) The platform has a PI module that only produces EFI_PEI_READ_ONLY_VARIABLE2_PPI. +This module can't be used together with ReadOnlyVariable2ToReadOnlyVariableThunk module. + Copyright (c) 2006 - 2008 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 @@ -23,7 +25,9 @@ Module Name: #include #include #include +#include #include +#include // // Function Prototypes @@ -86,6 +90,16 @@ Returns: --*/ { + VOID *Interface; + EFI_STATUS Status; + + // + // Make sure ReadOnlyVariableToReadOnlyVariable2 module is not present. If so, the call chain will form a + // infinite loop: ReadOnlyVariable -> ReadOnlyVariable2 -> ReadOnlyVariable -> .... + // + Status = PeiServicesLocatePpi (&gPeiReadonlyVariableThunkPresentPpiGuid, 0, NULL, &Interface); + ASSERT (Status == EFI_NOT_FOUND); + // // Publish the variable capability to other modules // diff --git a/EdkCompatibilityPkg/Compatibility/ReadOnlyVariableToReadOnlyVariable2Thunk/ReadOnlyVariableToReadOnlyVariable2Thunk.inf b/EdkCompatibilityPkg/Compatibility/ReadOnlyVariableToReadOnlyVariable2Thunk/ReadOnlyVariableToReadOnlyVariable2Thunk.inf index d8f3f735c3..6a891e49a0 100644 --- a/EdkCompatibilityPkg/Compatibility/ReadOnlyVariableToReadOnlyVariable2Thunk/ReadOnlyVariableToReadOnlyVariable2Thunk.inf +++ b/EdkCompatibilityPkg/Compatibility/ReadOnlyVariableToReadOnlyVariable2Thunk/ReadOnlyVariableToReadOnlyVariable2Thunk.inf @@ -8,6 +8,8 @@ # This module is used on platform when both of these two conditions are true: # 1) Framework module consumes EFI_PEI_READ_ONLY_VARIABLE_PPI is present. # 2) The platform has a PI module that only produces EFI_PEI_READ_ONLY_VARIABLE2_PPI. +# This module can't be used together with ReadOnlyVariable2ToReadOnlyVariableThunk module. + # # Copyright (c) 2006 - 2007, Intel Corporation # @@ -43,15 +45,18 @@ [Packages] MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec IntelFrameworkPkg/IntelFrameworkPkg.dec [LibraryClasses] PeimEntryPoint DebugLib + PeiServicesLib [Ppis] gEfiPeiReadOnlyVariable2PpiGuid # PPI ALWAYS_CONSUMED gEfiPeiReadOnlyVariablePpiGuid # PPI ALWAYS_PRODUCED + gPeiReadonlyVariableThunkPresentPpiGuid [Depex] gEfiPeiReadOnlyVariable2PpiGuid