]> 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 8da77e1628bda11aac553d8efb1a6d2d7d36a1dd..48103490ae963c777404314ad7d0b2e78522f033 100644 (file)
@@ -1,4 +1,14 @@
-/*++\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
+# in MdePkg.\r
+# This module produces EFI_PEI_READ_ONLY_VARIABLE_PPI on top of EFI_PEI_READ_ONLY_VARIABLE2_PPI. \r
+# This module is used on platform when both of these two conditions are true:\r
+# 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
@@ -10,18 +20,14 @@ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 Module Name:\r
 \r
-  Variable.c\r
-\r
-Abstract:\r
-\r
-  PEIM to provide the Variable functionality\r
-\r
---*/\r
+**/\r
 \r
 #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
@@ -84,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