--- /dev/null
+/** @file\r
+Module produce Framework's EFI_PEI_FV_FILE_LOADER_PPI top of EFI_PEI_LOAD_FILE_PPI.\r
+\r
+UEFI PI Spec supersedes Intel's Framework Specs. \r
+EFI_PEI_FV_FILE_LOADER_PPI defined in Intel Framework Pkg is replaced by EFI_PEI_LOAD_FILE_PPI\r
+in MdePkg.\r
+This module produces EFI_PEI_FV_FILE_LOADER_PPI on top of EFI_PEI_LOAD_FILE_PPI . \r
+This module is used on platform when both of these two conditions are true:\r
+1) Framework module consumes EFI_PEI_FV_FILE_LOADER_PPI is present.\r
+2) The platform has PI modules that produce EFI_PEI_LOAD_FILE_PPI.\r
+\r
+Copyright (c) 2008, Intel Corporation\r
+\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
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+Module Name:\r
+\r
+**/\r
+\r
+#include <PiPei.h>\r
+#include <Ppi/LoadFile.h>\r
+#include <Ppi/FvLoadFile.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/PeiServicesLib.h>\r
+\r
+/**\r
+\r
+ Wrap the call to PI's EFI_PEI_LOAD_FILE_PPI.\r
+\r
+ @param This A pointer to EFI_PEI_FV_FILE_LOADER_PPI.\r
+ @param FileHeader The pointer to the file header to be loaded by the Pe/Coff loader.\r
+ @param ImageAddress The loaded address of the Image.\r
+ @param ImageSize Pointer to the size of the loaded image.\r
+ @param EntryPoint Pointer to the entry point of the image.\r
+\r
+ @retval EFI_SUCCESS The image was loaded successfully.\r
+ @retval EFI_OUT_OF_RESOURCE There was not enought memory.\r
+ @retval EFI_INVALID_PARAMETER The contents of the FFS file did not contain a valid PE/COFF image that could be loaded.\r
+--*/ \r
+EFI_STATUS\r
+EFIAPI\r
+FrameworkLoadFile (\r
+ IN EFI_PEI_FV_FILE_LOADER_PPI *This,\r
+ IN EFI_FFS_FILE_HEADER *FfsHeader,\r
+ OUT EFI_PHYSICAL_ADDRESS *ImageAddress,\r
+ OUT UINT64 *ImageSize,\r
+ OUT EFI_PHYSICAL_ADDRESS *EntryPoint\r
+ )\r
+;\r
+\r
+EFI_PEI_FV_FILE_LOADER_PPI mLoadFilePpi = {\r
+ FrameworkLoadFile\r
+};\r
+\r
+EFI_PEI_PPI_DESCRIPTOR mPpiFrameworkLoadFile = {\r
+ (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
+ &gEfiPeiFvFileLoaderPpiGuid,\r
+ &mLoadFilePpi\r
+};\r
+\r
+/**\r
+ Standard entry point of a PEIM.\r
+\r
+ @param FfsHeadher The FFS file header\r
+ @param PeiServices General purpose services available to every PEIM.\r
+\r
+ @retval EFI_SUCCESS If the gEfiPeiReadOnlyVariablePpiGuid interface could be successfully installed.\r
+\r
+--*/\r
+EFI_STATUS\r
+EFIAPI\r
+InitPeim (\r
+ IN EFI_FFS_FILE_HEADER *FfsHeader,\r
+ IN CONST EFI_PEI_SERVICES **PeiServices\r
+ )\r
+{\r
+ return (*PeiServices)->InstallPpi (PeiServices, &mPpiFrameworkLoadFile);\r
+}\r
+\r
+\r
+/**\r
+\r
+ Wrap the call to PI's EFI_PEI_LOAD_FILE_PPI.\r
+\r
+ @param This A pointer to EFI_PEI_FV_FILE_LOADER_PPI.\r
+ @param FileHeader The pointer to the file header to be loaded by the Pe/Coff loader.\r
+ @param ImageAddress The loaded address of the Image.\r
+ @param ImageSize Pointer to the size of the loaded image.\r
+ @param EntryPoint Pointer to the entry point of the image.\r
+\r
+ @retval EFI_SUCCESS The image was loaded successfully.\r
+ @retval EFI_OUT_OF_RESOURCE There was not enought memory.\r
+ @retval EFI_INVALID_PARAMETER The contents of the FFS file did not contain a valid PE/COFF image that could be loaded.\r
+--*/ \r
+EFI_STATUS\r
+EFIAPI\r
+FrameworkLoadFile (\r
+ IN EFI_PEI_FV_FILE_LOADER_PPI *This,\r
+ IN EFI_FFS_FILE_HEADER *FfsHeader,\r
+ OUT EFI_PHYSICAL_ADDRESS *ImageAddress,\r
+ OUT UINT64 *ImageSize,\r
+ OUT EFI_PHYSICAL_ADDRESS *EntryPoint\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_PEI_LOAD_FILE_PPI *PiLoadFile;\r
+ UINT32 AuthenticationState;\r
+\r
+ Status = PeiServicesLocatePpi (\r
+ &gEfiPeiLoadFilePpiGuid,\r
+ 0,\r
+ NULL,\r
+ (VOID **) &PiLoadFile\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ return PiLoadFile->LoadFile (\r
+ PiLoadFile,\r
+ (EFI_PEI_FILE_HANDLE) FfsHeader,\r
+ ImageAddress,\r
+ ImageSize,\r
+ EntryPoint,\r
+ &AuthenticationState\r
+ );\r
+ \r
+}\r
+\r
--- /dev/null
+#/** @file\r
+# Module produce Framework's EFI_PEI_FV_FILE_LOADER_PPI top of EFI_PEI_LOAD_FILE_PPI.\r
+#\r
+# UEFI PI Spec supersedes Intel's Framework Specs. \r
+# EFI_PEI_FV_FILE_LOADER_PPI defined in Intel Framework Pkg is replaced by EFI_PEI_LOAD_FILE_PPI\r
+# in MdePkg.\r
+# This module produces EFI_PEI_FV_FILE_LOADER_PPI on top of EFI_PEI_LOAD_FILE_PPI . \r
+# This module is used on platform when both of these two conditions are true:\r
+# 1) Framework module consumes EFI_PEI_FV_FILE_LOADER_PPI is present.\r
+# 2) The platform has PI modules that produce EFI_PEI_LOAD_FILE_PPI.\r
+#\r
+# Copyright (c) 2008, Intel Corporation\r
+#\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
+# which accompanies this distribution. The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+#\r
+#**/\r
+\r
+[Defines]\r
+ INF_VERSION = 0x00010005\r
+ BASE_NAME = FvFileLoaderToLoadFileThunk\r
+ FILE_GUID = 6CDDBF28-89AC-4e01-9692-616B8A1009C8\r
+ MODULE_TYPE = PEIM\r
+ VERSION_STRING = 1.0\r
+ EDK_RELEASE_VERSION = 0x00020000\r
+ EFI_SPECIFICATION_VERSION = 0x00020000\r
+\r
+ ENTRY_POINT = InitPeim\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC\r
+#\r
+\r
+[Sources.common]\r
+ FvFileLoaderToLoadFileThunk.c\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+ IntelFrameworkPkg/IntelFrameworkPkg.dec\r
+\r
+[LibraryClasses]\r
+ PeimEntryPoint\r
+ PeiServicesLib\r
+ DebugLib\r
+\r
+[Ppis]\r
+ gEfiPeiLoadFilePpiGuid #ALWAYS_CONSUME\r
+ gEfiPeiFvFileLoaderPpiGuid #ALWAYS_PRODUCE\r
+ \r
+[Depex]\r
+ gEfiPeiLoadFilePpiGuid\r