+++ /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 - 2010, Intel Corporation. All rights reserved.<BR>\r
-\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
-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 FfsHeader Pointer to the FFS header of the file to load.\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_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 FfsHeader 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_PEI_FILE_HANDLE FfsHeader,\r
- IN CONST EFI_PEI_SERVICES **PeiServices\r
- )\r
-{\r
- //\r
- // This thunk module can only be used together with a PI PEI core, as we \r
- // assume PeiServices Pointer Table can be located in a standard way defined\r
- // in PI spec.\r
- //\r
- ASSERT ((*PeiServices)->Hdr.Revision >= 0x00010000);\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 FfsHeader 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