1 /** @file
2   Load image file from fv to memory.
3 
4   Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
5   This program and the accompanying materials
6   are licensed and made available under the terms and conditions of the BSD License
7   which accompanies this distribution.  The full text of the license may be found at
8   http://opensource.org/licenses/bsd-license.php
9 
10   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 
13   @par Revision Reference:
14   This PPI is introduced in PI Version 1.0.
15 
16 **/
17 
18 #ifndef __LOAD_FILE_PPI_H__
19 #define __LOAD_FILE_PPI_H__
20 
21 #define EFI_PEI_LOAD_FILE_PPI_GUID \
22   { 0xb9e0abfe, 0x5979, 0x4914, { 0x97, 0x7f, 0x6d, 0xee, 0x78, 0xc2, 0x78, 0xa6 } }
23 
24 
25 typedef struct _EFI_PEI_LOAD_FILE_PPI EFI_PEI_LOAD_FILE_PPI;
26 
27 /**
28   Loads a PEIM into memory for subsequent execution.
29 
30   This service is the single member function of EFI_LOAD_FILE_PPI.
31   This service separates image loading and relocating from the PEI Foundation.
32 
33   @param This                   Interface pointer that implements
34                                 the Load File PPI instance.
35   @param FileHandle             File handle of the file to load.
36   @param ImageAddress           Pointer to the address of the loaded image.
37   @param ImageSize              Pointer to the size of the loaded image.
38   @param EntryPoint             Pointer to the entry point of the image.
39   @param AuthenticationState    On exit, points to the attestation
40                                 authentication state of the image
41                                 or 0 if no attestation was performed.
42 
43   @retval EFI_SUCCESS           The image was loaded successfully.
44   @retval EFI_OUT_OF_RESOURCES  There was not enough memory.
45   @retval EFI_LOAD_ERROR        There was no supported image in the file.
46   @retval EFI_INVALID_PARAMETER FileHandle was not a valid firmware file handle.
47   @retval EFI_INVALID_PARAMETER EntryPoint was NULL.
48   @retval EFI_UNSUPPORTED       An image requires relocations or is not
49                                 memory mapped.
50   @retval EFI_WARN_BUFFER_TOO_SMALL
51                                 There is not enough heap to allocate the requested size.
52                                 This will not prevent the XIP image from being invoked.
53 
54 **/
55 typedef
56 EFI_STATUS
57 (EFIAPI *EFI_PEI_LOAD_FILE)(
58   IN  CONST  EFI_PEI_LOAD_FILE_PPI   *This,
59   IN  EFI_PEI_FILE_HANDLE            FileHandle,
60   OUT EFI_PHYSICAL_ADDRESS           *ImageAddress,
61   OUT UINT64                         *ImageSize,
62   OUT EFI_PHYSICAL_ADDRESS           *EntryPoint,
63   OUT UINT32                         *AuthenticationState
64 );
65 
66 ///
67 /// This PPI is a pointer to the Load File service.
68 /// This service will be published by a PEIM. The PEI Foundation
69 /// will use this service to launch the known PEI module images.
70 ///
71 struct _EFI_PEI_LOAD_FILE_PPI {
72   EFI_PEI_LOAD_FILE LoadFile;
73 };
74 
75 extern EFI_GUID gEfiPeiLoadFilePpiGuid;
76 
77 #endif
78