1 /** @file
2 *
3 *  Copyright (c) 2014, ARM Ltd. All rights reserved.
4 *
5 *  This program and the accompanying materials are licensed and made available
6 *  under the terms and conditions of the BSD License which accompanies this
7 *  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, WITHOUT
11 *  WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 *
13 **/
14 
15 #ifndef __BOOTMONFS_LOADER_H__
16 #define __BOOTMONFS_LOADER_H__
17 
18 /**
19   Check that loading the file is supported.
20 
21   Not all information is checked, only the properties that matters to us in
22   our simplified loader.
23 
24   BootMonFS file properties is not in a file header but in the file-system
25   metadata, so we need to pass a handle to the file to allow access to the
26   information.
27 
28   @param[in] FileHandle  Handle of the file to check.
29 
30   @retval EFI_SUCCESS on success.
31   @retval EFI_INVALID_PARAMETER if the header is invalid.
32   @retval EFI_UNSUPPORTED if the file type/platform is not supported.
33 **/
34 EFI_STATUS
35 BootMonFsCheckFile (
36   IN  CONST EFI_FILE_HANDLE  FileHandle
37   );
38 
39 /**
40   Load a binary file from BootMonFS.
41 
42   @param[in]  FileHandle    Handle of the file to load.
43 
44   @param[in]  FileData      Address  of the file data in memory.
45 
46   @param[out] EntryPoint    Will be filled with the ELF entry point address.
47 
48   @param[out] ImageSize     Will be filled with the file size in memory. This
49                             will effectively be equal to the sum of the load
50                             region sizes.
51 
52   This function assumes the file is valid and supported as checked with
53   BootMonFsCheckFile().
54 
55   @retval EFI_SUCCESS on success.
56   @retval EFI_INVALID_PARAMETER if the file is invalid.
57 **/
58 EFI_STATUS
59 BootMonFsLoadFile (
60   IN  CONST EFI_FILE_HANDLE   FileHandle,
61   IN  CONST VOID             *FileData,
62   OUT VOID                  **EntryPoint,
63   OUT LIST_ENTRY             *LoadList
64   );
65 
66 #endif // __BOOTMONFS_LOADER_H__
67