3 Copyright (c) 2015, ARM Ltd. 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
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.
15 #ifndef __FDT_PLATFORM_DXE_H__
16 #define __FDT_PLATFORM_DXE_H__
20 #include <Protocol/DevicePathToText.h>
21 #include <Protocol/DevicePathFromText.h>
22 #include <Protocol/Shell.h>
23 #include <Protocol/ShellDynamicCommand.h>
25 #include <Library/DebugLib.h>
26 #include <Library/HiiLib.h>
27 #include <Library/MemoryAllocationLib.h>
28 #include <Library/UefiBootServicesTableLib.h>
29 #include <Library/UefiLib.h>
30 #include <Library/ShellLib.h>
31 #include <Library/UefiRuntimeServicesTableLib.h>
37 extern EFI_HANDLE mFdtPlatformDxeHiiHandle
;
40 Transcode one of the EFI return code used by the model into an EFI Shell return code.
42 @param[in] Status EFI return code.
44 @return Transcoded EFI Shell return code.
53 Run the FDT installation process.
55 Loop in priority order over the device paths from which the FDT has
56 been asked to be retrieved for. For each device path, try to install
57 the FDT. Stop as soon as an installation succeeds.
59 @param[in] SuccessfullDevicePath If not NULL, address where to store the
60 pointer to the text device path from
61 which the FDT was successfully retrieved.
62 Not used if the FDT installation failed.
63 The returned address is the address of
64 an allocated buffer that has to be
67 @retval EFI_SUCCESS The FDT was installed.
68 @retval EFI_NOT_FOUND Failed to locate a protocol or a file.
69 @retval EFI_INVALID_PARAMETER Invalid device path.
70 @retval EFI_UNSUPPORTED Device path not supported.
71 @retval EFI_OUT_OF_RESOURCES An allocation failed.
76 OUT CHAR16
**SuccessfullDevicePath
80 This is the shell command "setfdt" handler function. This function handles
81 the command when it is invoked in the shell.
83 @param[in] This The instance of the
84 EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.
85 @param[in] SystemTable The pointer to the UEFI system table.
86 @param[in] ShellParameters The parameters associated with the command.
87 @param[in] Shell The instance of the shell protocol used in the
88 context of processing this command.
90 @return SHELL_SUCCESS The operation was successful.
91 @return SHELL_ABORTED Operation aborted due to internal error.
92 @return SHELL_INVALID_PARAMETER The parameters of the command are not valid.
93 @return SHELL_INVALID_PARAMETER The EFI Shell file path is not valid.
94 @return SHELL_NOT_FOUND Failed to locate a protocol or a file.
95 @return SHELL_UNSUPPORTED Device path not supported.
96 @return SHELL_OUT_OF_RESOURCES A memory allocation failed.
97 @return SHELL_DEVICE_ERROR The "Fdt" variable could not be saved due to a hardware failure.
98 @return SHELL_ACCESS_DENIED The "Fdt" variable is read-only.
99 @return SHELL_ACCESS_DENIED The "Fdt" variable cannot be deleted.
100 @return SHELL_ACCESS_DENIED The "Fdt" variable could not be written due to security violation.
105 ShellDynCmdSetFdtHandler (
106 IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL
*This
,
107 IN EFI_SYSTEM_TABLE
*SystemTable
,
108 IN EFI_SHELL_PARAMETERS_PROTOCOL
*ShellParameters
,
109 IN EFI_SHELL_PROTOCOL
*Shell
113 This is the shell command "setfdt" help handler function. This
114 function returns the formatted help for the "setfdt" command.
115 The format matchs that in Appendix B of the revision 2.1 of the
116 UEFI Shell Specification.
118 @param[in] This The instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.
119 @param[in] Language The pointer to the language string to use.
121 @return CHAR16* Pool allocated help string, must be freed by caller.
125 ShellDynCmdSetFdtGetHelp (
126 IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL
*This
,
127 IN CONST CHAR8
*Language
131 This is the shell command "dumpfdt" handler function. This function handles
132 the command when it is invoked in the shell.
134 @param[in] This The instance of the
135 EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.
136 @param[in] SystemTable The pointer to the UEFI system table.
137 @param[in] ShellParameters The parameters associated with the command.
138 @param[in] Shell The instance of the shell protocol used in the
139 context of processing this command.
141 @return SHELL_SUCCESS The operation was successful.
142 @return SHELL_ABORTED Operation aborted due to internal error.
143 @return SHELL_NOT_FOUND Failed to locate the Device Tree into the EFI Configuration Table
144 @return SHELL_OUT_OF_RESOURCES A memory allocation failed.
149 ShellDynCmdDumpFdtHandler (
150 IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL
*This
,
151 IN EFI_SYSTEM_TABLE
*SystemTable
,
152 IN EFI_SHELL_PARAMETERS_PROTOCOL
*ShellParameters
,
153 IN EFI_SHELL_PROTOCOL
*Shell
157 This is the shell command "dumpfdt" help handler function. This
158 function returns the formatted help for the "dumpfdt" command.
159 The format matchs that in Appendix B of the revision 2.1 of the
160 UEFI Shell Specification.
162 @param[in] This The instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.
163 @param[in] Language The pointer to the language string to use.
165 @return CHAR16* Pool allocated help string, must be freed by caller.
169 ShellDynCmdDumpFdtGetHelp (
170 IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL
*This
,
171 IN CONST CHAR8
*Language
174 #endif /* __FDT_PLATFORM_DXE_H__ */