]> git.proxmox.com Git - mirror_edk2.git/blame - EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatform.h
EmbeddedPkg/FdtPlatformDxe: Move 'setfdt' Shell command into a separate file
[mirror_edk2.git] / EmbeddedPkg / Drivers / FdtPlatformDxe / FdtPlatform.h
CommitLineData
3d7f1060
OM
1/** @file\r
2\r
3 Copyright (c) 2015, ARM Ltd. All rights reserved.<BR>\r
4\r
5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef __FDT_PLATFORM_DXE_H__\r
16#define __FDT_PLATFORM_DXE_H__\r
17\r
18#include <Uefi.h>\r
19\r
20#include <Protocol/DevicePathToText.h>\r
21#include <Protocol/DevicePathFromText.h>\r
22#include <Protocol/EfiShell.h>\r
23#include <Protocol/EfiShellDynamicCommand.h>\r
24\r
25#include <Library/DebugLib.h>\r
26#include <Library/HiiLib.h>\r
27#include <Library/MemoryAllocationLib.h>\r
28#include <Library/UefiBootServicesTableLib.h>\r
29#include <Library/UefiLib.h>\r
30#include <Library/ShellLib.h>\r
31#include <Library/UefiRuntimeServicesTableLib.h>\r
32\r
33#include <Guid/Fdt.h>\r
34\r
35#include <libfdt.h>\r
36\r
37extern EFI_HANDLE mFdtPlatformDxeHiiHandle;\r
38\r
39/**\r
40 Transcode one of the EFI return code used by the model into an EFI Shell return code.\r
41\r
42 @param[in] Status EFI return code.\r
43\r
44 @return Transcoded EFI Shell return code.\r
45\r
46**/\r
47SHELL_STATUS\r
48EfiCodeToShellCode (\r
49 IN EFI_STATUS Status\r
50 );\r
51\r
52/**\r
53 Run the FDT installation process.\r
54\r
55 Loop in priority order over the device paths from which the FDT has\r
56 been asked to be retrieved for. For each device path, try to install\r
57 the FDT. Stop as soon as an installation succeeds.\r
58\r
59 @param[in] SuccessfullDevicePath If not NULL, address where to store the\r
60 pointer to the text device path from\r
61 which the FDT was successfully retrieved.\r
62 Not used if the FDT installation failed.\r
63 The returned address is the address of\r
64 an allocated buffer that has to be\r
65 freed by the caller.\r
66\r
67 @retval EFI_SUCCESS The FDT was installed.\r
68 @retval EFI_NOT_FOUND Failed to locate a protocol or a file.\r
69 @retval EFI_INVALID_PARAMETER Invalid device path.\r
70 @retval EFI_UNSUPPORTED Device path not supported.\r
71 @retval EFI_OUT_OF_RESOURCES An allocation failed.\r
72\r
73**/\r
74EFI_STATUS\r
75RunFdtInstallation (\r
76 OUT CHAR16 **SuccessfullDevicePath\r
77 );\r
78\r
79/**\r
80 This is the shell command "setfdt" handler function. This function handles\r
81 the command when it is invoked in the shell.\r
82\r
83 @param[in] This The instance of the\r
84 EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.\r
85 @param[in] SystemTable The pointer to the UEFI system table.\r
86 @param[in] ShellParameters The parameters associated with the command.\r
87 @param[in] Shell The instance of the shell protocol used in the\r
88 context of processing this command.\r
89\r
90 @return SHELL_SUCCESS The operation was successful.\r
91 @return SHELL_ABORTED Operation aborted due to internal error.\r
92 @return SHELL_INVALID_PARAMETER The parameters of the command are not valid.\r
93 @return SHELL_INVALID_PARAMETER The EFI Shell file path is not valid.\r
94 @return SHELL_NOT_FOUND Failed to locate a protocol or a file.\r
95 @return SHELL_UNSUPPORTED Device path not supported.\r
96 @return SHELL_OUT_OF_RESOURCES A memory allocation failed.\r
97 @return SHELL_DEVICE_ERROR The "Fdt" variable could not be saved due to a hardware failure.\r
98 @return SHELL_ACCESS_DENIED The "Fdt" variable is read-only.\r
99 @return SHELL_ACCESS_DENIED The "Fdt" variable cannot be deleted.\r
100 @return SHELL_ACCESS_DENIED The "Fdt" variable could not be written due to security violation.\r
101\r
102**/\r
103SHELL_STATUS\r
104EFIAPI\r
105ShellDynCmdSetFdtHandler (\r
106 IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,\r
107 IN EFI_SYSTEM_TABLE *SystemTable,\r
108 IN EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters,\r
109 IN EFI_SHELL_PROTOCOL *Shell\r
110 );\r
111\r
112/**\r
113 This is the shell command "setfdt" help handler function. This\r
114 function returns the formatted help for the "setfdt" command.\r
115 The format matchs that in Appendix B of the revision 2.1 of the\r
116 UEFI Shell Specification.\r
117\r
118 @param[in] This The instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.\r
119 @param[in] Language The pointer to the language string to use.\r
120\r
121 @return CHAR16* Pool allocated help string, must be freed by caller.\r
122**/\r
123CHAR16*\r
124EFIAPI\r
125ShellDynCmdSetFdtGetHelp (\r
126 IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,\r
127 IN CONST CHAR8 *Language\r
128 );\r
129\r
130#endif /* __FDT_PLATFORM_DXE_H__ */\r