]> git.proxmox.com Git - mirror_edk2.git/blobdiff - InOsEmuPkg/Library/PeiCoreServicesTablePointerLib/PeiServicesTablePointer.c
Added generic EFIABI SEC to InOsEmuPkg. Add library to abstract FV cracking and remov...
[mirror_edk2.git] / InOsEmuPkg / Library / PeiCoreServicesTablePointerLib / PeiServicesTablePointer.c
index 1c689390f82851cf11005e24bc7194015eae0ccd..9b02316af4545eb572b0361568749a1c8a544a9e 100644 (file)
@@ -1,13 +1,10 @@
 /** @file\r
-  PEI Services Table Pointer Library for PEI Core.\r
+  PEI Services Table Pointer Library.\r
   \r
-  This library is used for PEI Core which does executed from flash device directly but\r
-  executed in memory. When the PEI Core does a Set of the PEI Service table pointer \r
-  a PPI is reinstalled so that PEIMs can update the copy of the PEI Services table \r
-  they have cached. \r
+  This library is used for PEIM which does executed from flash device directly but\r
+  executed in memory.\r
 \r
   Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
-  Portiions copyrigth (c) 2011, Apple Inc. All rights reserved. \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
 #include <Library/PeiServicesTablePointerLib.h>\r
 #include <Library/DebugLib.h>\r
 \r
-#include <Ppi/EmuPeiServicesTableUpdate.h>\r
-\r
-\r
-CONST EFI_PEI_SERVICES  **gPeiServices = NULL;\r
+CONST EFI_PEI_SERVICES  **gPeiServices;\r
 \r
 /**\r
   Caches a pointer PEI Services Table. \r
@@ -41,39 +35,11 @@ CONST EFI_PEI_SERVICES  **gPeiServices = NULL;
 VOID\r
 EFIAPI\r
 SetPeiServicesTablePointer (\r
-  IN CONST EFI_PEI_SERVICES **PeiServicesTablePointer\r
+  IN CONST EFI_PEI_SERVICES ** PeiServicesTablePointer\r
   )\r
 {\r
-  EFI_STATUS              Status;\r
-  EFI_PEI_PPI_DESCRIPTOR  *PpiDescriptor;\r
-  VOID                    *NotUsed;\r
-\r
-  gPeiServices = PeiServicesTablePointer; \r
-  \r
-  Status = (*PeiServicesTablePointer)->LocatePpi (\r
-                                        PeiServicesTablePointer,\r
-                                        &gEmuPeiServicesTableUpdatePpiGuid, // GUID\r
-                                        0,                 // INSTANCE\r
-                                        &PpiDescriptor,    // EFI_PEI_PPI_DESCRIPTOR\r
-                                        &NotUsed           // PPI\r
-                                        );\r
-  if (!EFI_ERROR (Status)) {\r
-    //\r
-    // Standard PI Mechanism is to use negative offset from IDT. \r
-    // We can't do that in the emulator, so we make up a constant location\r
-    // that every one can use. The first try may fail as the PEI Core is still\r
-    // initializing its self, but that is OK. \r
-    //\r
-\r
-    // Reinstall PPI to consumers know to update PEI Services pointer\r
-    Status = (*PeiServicesTablePointer)->ReInstallPpi (\r
-                                            PeiServicesTablePointer,\r
-                                            PpiDescriptor,\r
-                                            PpiDescriptor\r
-                                            );\r
-\r
-  }\r
-\r
+  ASSERT (PeiServicesTablePointer != NULL);\r
+  gPeiServices = PeiServicesTablePointer;\r
 }\r
 \r
 /**\r
@@ -95,8 +61,31 @@ GetPeiServicesTablePointer (
   )\r
 {\r
   ASSERT (gPeiServices != NULL);\r
-  ASSERT (*gPeiServices != NULL);\r
   return gPeiServices;\r
 }\r
 \r
 \r
+/**\r
+  The constructor function caches the pointer to PEI services.\r
+  \r
+  The constructor function caches the pointer to PEI services.\r
+  It will always return EFI_SUCCESS.\r
+\r
+  @param  FileHandle   The handle of FFS header the loaded driver.\r
+  @param  PeiServices  The pointer to the PEI services.\r
+\r
+  @retval EFI_SUCCESS  The constructor always returns EFI_SUCCESS.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PeiServicesTablePointerLibConstructor (\r
+  IN EFI_PEI_FILE_HANDLE        FileHandle,\r
+  IN CONST EFI_PEI_SERVICES     **PeiServices\r
+  )\r
+{\r
+  gPeiServices = PeiServices;\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+\r