EmbeddedPkg: import Lan91x Ethernet controller driver
[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
5e7c289f
RN
22#include <Protocol/Shell.h>\r
23#include <Protocol/ShellDynamicCommand.h>\r
3d7f1060
OM
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
b0866ad3
OM
130/**\r
131 This is the shell command "dumpfdt" handler function. This function handles\r
132 the command when it is invoked in the shell.\r
133\r
134 @param[in] This The instance of the\r
135 EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.\r
136 @param[in] SystemTable The pointer to the UEFI system table.\r
137 @param[in] ShellParameters The parameters associated with the command.\r
138 @param[in] Shell The instance of the shell protocol used in the\r
139 context of processing this command.\r
140\r
141 @return SHELL_SUCCESS The operation was successful.\r
142 @return SHELL_ABORTED Operation aborted due to internal error.\r
143 @return SHELL_NOT_FOUND Failed to locate the Device Tree into the EFI Configuration Table\r
144 @return SHELL_OUT_OF_RESOURCES A memory allocation failed.\r
145\r
146**/\r
147SHELL_STATUS\r
148EFIAPI\r
149ShellDynCmdDumpFdtHandler (\r
150 IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,\r
151 IN EFI_SYSTEM_TABLE *SystemTable,\r
152 IN EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters,\r
153 IN EFI_SHELL_PROTOCOL *Shell\r
154 );\r
155\r
156/**\r
157 This is the shell command "dumpfdt" help handler function. This\r
158 function returns the formatted help for the "dumpfdt" command.\r
159 The format matchs that in Appendix B of the revision 2.1 of the\r
160 UEFI Shell Specification.\r
161\r
162 @param[in] This The instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.\r
163 @param[in] Language The pointer to the language string to use.\r
164\r
165 @return CHAR16* Pool allocated help string, must be freed by caller.\r
166**/\r
167CHAR16*\r
168EFIAPI\r
169ShellDynCmdDumpFdtGetHelp (\r
170 IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,\r
171 IN CONST CHAR8 *Language\r
172 );\r
173\r
3d7f1060 174#endif /* __FDT_PLATFORM_DXE_H__ */\r