1 /** @file
2 *
3 *  Copyright (c) 2014, ARM Ltd. All rights reserved.<BR>
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,
11 *  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 *
13 **/
14 
15 #ifndef __ARM_SHELL_CMD_RUNAXF__
16 #define __ARM_SHELL_CMD_RUNAXF__
17 
18 #include <ShellBase.h>
19 
20 #include <Protocol/EfiShell.h>
21 #include <Protocol/EfiShellDynamicCommand.h>
22 
23 #include <Library/HiiLib.h>
24 #include <Library/ShellLib.h>
25 #include <Library/UefiBootServicesTableLib.h>
26 
27 extern EFI_GUID      gRunAxfHiiGuid;
28 extern EFI_HANDLE    gRunAxfHiiHandle;
29 extern EFI_HANDLE    gRunAxfImageHandle;
30 
31 // List of data segments to load to memory from AXF/ELF file.
32 typedef struct {
33   LIST_ENTRY  Link;       // This attribute must be the first entry of this
34                           // structure (to avoid pointer computation)
35   UINTN       MemOffset;  // Where the data should go, Dest
36   UINTN       FileOffset; // Where the data is from, Src
37   BOOLEAN     Zeroes;     // A section of Zeroes. Like .bss in ELF
38   UINTN       Length;     // Number of bytes.
39 } RUNAXF_LOAD_LIST;
40 
41 
42 /**
43   This is the shell command handler function pointer callback type. This
44   function handles the command when it is invoked in the shell.
45 
46   @param[in] This             The instance of the
47                               EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.
48   @param[in] SystemTable      The pointer to the system table.
49   @param[in] ShellParameters  The parameters associated with the command.
50   @param[in] Shell            The instance of the shell protocol used in the
51                               context of processing this command.
52 
53   @return EFI_SUCCESS         The operation was successful.
54   @return other               The operation failed.
55 **/
56 SHELL_STATUS
57 EFIAPI
58 ShellDynCmdRunAxfHandler (
59   IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL    *This,
60   IN EFI_SYSTEM_TABLE                      *SystemTable,
61   IN EFI_SHELL_PARAMETERS_PROTOCOL         *ShellParameters,
62   IN EFI_SHELL_PROTOCOL                    *Shell
63   );
64 
65 
66 /**
67   This is the command help handler function pointer callback type. This
68   function is responsible for displaying help information for the associated
69   command.
70 
71   @param[in] This             The instance of the
72                               EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.
73   @param[in] Language         The pointer to the language string to use.
74 
75   @return string              Pool allocated help string, must be freed by
76                               caller.
77 **/
78 CHAR16*
79 EFIAPI
80 ShellDynCmdRunAxfGetHelp (
81   IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL    *This,
82   IN CONST CHAR8                           *Language
83   );
84 
85 #endif //__ARM_SHELL_CMD_RUNAXF__
86