]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkCompatibilityPkg/Compatibility/ReadOnlyVariableToReadOnlyVariable2Thunk/ReadOnlyVariableToReadOnlyVariable2Thunk.c
1) Update the file headers
[mirror_edk2.git] / EdkCompatibilityPkg / Compatibility / ReadOnlyVariableToReadOnlyVariable2Thunk / ReadOnlyVariableToReadOnlyVariable2Thunk.c
index 2d3752d3e795611066a201e5c4d58f2d5f09eb9a..48103490ae963c777404314ad7d0b2e78522f033 100644 (file)
@@ -1,4 +1,4 @@
-/**\r
+/** @file\r
 Module produce EFI_PEI_READ_ONLY_VARIABLE_PPI on top of EFI_PEI_READ_ONLY_VARIABLE2_PPI.\r
 UEFI PI Spec supersedes Intel's Framework Specs. \r
 # EFI_PEI_READ_ONLY_VARIABLE_PPI defined in Intel Framework Pkg is replaced by EFI_PEI_READ_ONLY_VARIABLE2_PPI\r
@@ -8,6 +8,8 @@ UEFI PI Spec supersedes Intel's Framework Specs.
 # 1) Framework module consumes EFI_PEI_READ_ONLY_VARIABLE_PPI is present.\r
 # 2) The platform has a PI module that only produces EFI_PEI_READ_ONLY_VARIABLE2_PPI.\r
 \r
+This module can't be used together with ReadOnlyVariable2ToReadOnlyVariableThunk module.\r
+\r
 Copyright (c) 2006 - 2008 Intel Corporation. <BR>\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
@@ -23,7 +25,9 @@ Module Name:
 #include <PiPei.h>\r
 #include <Ppi/ReadOnlyVariable.h>\r
 #include <Ppi/ReadOnlyVariable2.h>\r
+#include <Ppi/ReadOnlyVariableThunkPresent.h>\r
 #include <Library/DebugLib.h>\r
+#include <Library/PeiServicesLib.h>\r
 \r
 //\r
 // Function Prototypes\r
@@ -86,6 +90,16 @@ Returns:
 \r
 --*/\r
 {\r
+  VOID        *Interface;\r
+  EFI_STATUS  Status;\r
+\r
+  //\r
+  // Make sure ReadOnlyVariableToReadOnlyVariable2 module is not present. If so, the call chain will form a\r
+  // infinite loop: ReadOnlyVariable -> ReadOnlyVariable2 -> ReadOnlyVariable -> ....\r
+  //\r
+  Status = PeiServicesLocatePpi (&gPeiReadonlyVariableThunkPresentPpiGuid, 0, NULL, &Interface);\r
+  ASSERT (Status == EFI_NOT_FOUND);\r
+\r
   //\r
   // Publish the variable capability to other modules\r
   //\r