diff --git a/EdkCompatibilityPkg/Compatibility/ReadOnlyVariable2ToReadOnlyVariableThunk/ReadOnlyVariable2ToReadOnlyVariableThunk.c b/EdkCompatibilityPkg/Compatibility/ReadOnlyVariable2ToReadOnlyVariableThunk/ReadOnlyVariable2ToReadOnlyVariableThunk.c index 832dc520e5..ee8156573c 100644 --- a/EdkCompatibilityPkg/Compatibility/ReadOnlyVariable2ToReadOnlyVariableThunk/ReadOnlyVariable2ToReadOnlyVariableThunk.c +++ b/EdkCompatibilityPkg/Compatibility/ReadOnlyVariable2ToReadOnlyVariableThunk/ReadOnlyVariable2ToReadOnlyVariableThunk.c @@ -1,4 +1,15 @@ -/*++ +/** @file +Module produce EFI_PEI_READ_ONLY_VARIABLE2_PPI on top of EFI_PEI_READ_ONLY_VARIABLE_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 +in MdePkg. +This module produces EFI_PEI_READ_ONLY_VARIABLE2_PPI on top of EFI_PEI_READ_ONLY_VARIABLE_PPI. +This module is used on platform when both of these two conditions are true: +1) Framework module produces EFI_PEI_READ_ONLY_VARIABLE_PPI is present. +2) The platform has PI modules that only consumes EFI_PEI_READ_ONLY_VARIABLE2_PPI. + +This module can't be used together with ReadOnlyVariableToReadOnlyVariable2Thunk module. + Copyright (c) 2006 - 2008 Intel Corporation.
All rights reserved. This program and the accompanying materials @@ -10,17 +21,12 @@ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: - Variable.c - -Abstract: - - PEIM to provide the Variable functionality - ---*/ +**/ #include #include #include +#include #include #include #include @@ -62,6 +68,13 @@ EFI_PEI_PPI_DESCRIPTOR mPpiListVariable = { &mVariablePpi }; + +EFI_PEI_PPI_DESCRIPTOR mReadOnlyVariableThunkPresent = { + (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), + &gPeiReadonlyVariableThunkPresentPpiGuid, + NULL + }; + EFI_STATUS EFIAPI PeimInitializeReadOnlyVariable2 ( @@ -86,6 +99,17 @@ Returns: --*/ { + VOID *Interface; + EFI_STATUS Status; + + // + // Make sure ReadOnlyVariable2ToReadOnlyVariable module is not present. If so, the call chain will form a + // infinite loop: ReadOnlyVariable2 -> ReadOnlyVariable -> ReadOnlyVariable2 -> .... + // + Status = PeiServicesLocatePpi (&gPeiReadonlyVariableThunkPresentPpiGuid, 0, NULL, &Interface); + ASSERT (Status == EFI_NOT_FOUND); + + PeiServicesInstallPpi (&mReadOnlyVariableThunkPresent); // // Publish the variable capability to other modules // diff --git a/EdkCompatibilityPkg/Compatibility/ReadOnlyVariable2ToReadOnlyVariableThunk/ReadOnlyVariable2ToReadOnlyVariableThunk.inf b/EdkCompatibilityPkg/Compatibility/ReadOnlyVariable2ToReadOnlyVariableThunk/ReadOnlyVariable2ToReadOnlyVariableThunk.inf index c9b08f1f56..27b4d86fd9 100644 --- a/EdkCompatibilityPkg/Compatibility/ReadOnlyVariable2ToReadOnlyVariableThunk/ReadOnlyVariable2ToReadOnlyVariableThunk.inf +++ b/EdkCompatibilityPkg/Compatibility/ReadOnlyVariable2ToReadOnlyVariableThunk/ReadOnlyVariable2ToReadOnlyVariableThunk.inf @@ -1,5 +1,16 @@ #/** @file -# Component description file for PeiVariable module. +# Module produce EFI_PEI_READ_ONLY_VARIABLE_PPI 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 +# in MdePkg. +# This module produces EFI_PEI_READ_ONLY_VARIABLE2_PPI on top of EFI_PEI_READ_ONLY_VARIABLE_PPI . +# This module is used on platform when both of these two conditions are true: +# 1) Framework module produces EFI_PEI_READ_ONLY_VARIABLE_PPI is present. +# 2) The platform has PI modules that consumes EFI_PEI_READ_ONLY_VARIABLE2_PPI. +# +# This module can't be used together with ReadOnlyVariableToReadOnlyVariable2Thunk module. +# # # PEIM to provide the Variable functionality. # Copyright (c) 2006 - 2007, Intel Corporation @@ -36,6 +47,7 @@ [Packages] MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec IntelFrameworkPkg/IntelFrameworkPkg.dec [LibraryClasses] @@ -47,6 +59,7 @@ [Ppis] gEfiPeiReadOnlyVariablePpiGuid # PPI ALWAYS_CONSUMED gEfiPeiReadOnlyVariable2PpiGuid # PPI ALWAYS_PRODUCED + gPeiReadonlyVariableThunkPresentPpiGuid [Depex] gEfiPeiReadOnlyVariablePpiGuid