]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatform.h
EmbeddedPkg/FdtPlatformDxe: Move 'setfdt' Shell command into a separate file
[mirror_edk2.git] / EmbeddedPkg / Drivers / FdtPlatformDxe / FdtPlatform.h
diff --git a/EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatform.h b/EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatform.h
new file mode 100644 (file)
index 0000000..297927a
--- /dev/null
@@ -0,0 +1,130 @@
+/** @file\r
+\r
+  Copyright (c) 2015, ARM Ltd. All rights reserved.<BR>\r
+\r
+  This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef __FDT_PLATFORM_DXE_H__\r
+#define __FDT_PLATFORM_DXE_H__\r
+\r
+#include <Uefi.h>\r
+\r
+#include <Protocol/DevicePathToText.h>\r
+#include <Protocol/DevicePathFromText.h>\r
+#include <Protocol/EfiShell.h>\r
+#include <Protocol/EfiShellDynamicCommand.h>\r
+\r
+#include <Library/DebugLib.h>\r
+#include <Library/HiiLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/UefiLib.h>\r
+#include <Library/ShellLib.h>\r
+#include <Library/UefiRuntimeServicesTableLib.h>\r
+\r
+#include <Guid/Fdt.h>\r
+\r
+#include <libfdt.h>\r
+\r
+extern EFI_HANDLE mFdtPlatformDxeHiiHandle;\r
+\r
+/**\r
+  Transcode one of the EFI return code used by the model into an EFI Shell return code.\r
+\r
+  @param[in]  Status  EFI return code.\r
+\r
+  @return  Transcoded EFI Shell return code.\r
+\r
+**/\r
+SHELL_STATUS\r
+EfiCodeToShellCode (\r
+  IN EFI_STATUS  Status\r
+  );\r
+\r
+/**\r
+  Run the FDT installation process.\r
+\r
+  Loop in priority order over the device paths from which the FDT has\r
+  been asked to be retrieved for. For each device path, try to install\r
+  the FDT. Stop as soon as an installation succeeds.\r
+\r
+  @param[in]  SuccessfullDevicePath  If not NULL, address where to store the\r
+                                     pointer to the text device path from\r
+                                     which the FDT was successfully retrieved.\r
+                                     Not used if the FDT installation failed.\r
+                                     The returned address is the address of\r
+                                     an allocated buffer that has to be\r
+                                     freed by the caller.\r
+\r
+  @retval  EFI_SUCCESS            The FDT was installed.\r
+  @retval  EFI_NOT_FOUND          Failed to locate a protocol or a file.\r
+  @retval  EFI_INVALID_PARAMETER  Invalid device path.\r
+  @retval  EFI_UNSUPPORTED        Device path not supported.\r
+  @retval  EFI_OUT_OF_RESOURCES   An allocation failed.\r
+\r
+**/\r
+EFI_STATUS\r
+RunFdtInstallation (\r
+  OUT CHAR16  **SuccessfullDevicePath\r
+  );\r
+\r
+/**\r
+  This is the shell command "setfdt" handler function. This function handles\r
+  the command when it is invoked in the shell.\r
+\r
+  @param[in]  This             The instance of the\r
+                               EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.\r
+  @param[in]  SystemTable      The pointer to the UEFI system table.\r
+  @param[in]  ShellParameters  The parameters associated with the command.\r
+  @param[in]  Shell            The instance of the shell protocol used in the\r
+                               context of processing this command.\r
+\r
+  @return  SHELL_SUCCESS            The operation was successful.\r
+  @return  SHELL_ABORTED            Operation aborted due to internal error.\r
+  @return  SHELL_INVALID_PARAMETER  The parameters of the command are not valid.\r
+  @return  SHELL_INVALID_PARAMETER  The EFI Shell file path is not valid.\r
+  @return  SHELL_NOT_FOUND          Failed to locate a protocol or a file.\r
+  @return  SHELL_UNSUPPORTED        Device path not supported.\r
+  @return  SHELL_OUT_OF_RESOURCES   A memory allocation failed.\r
+  @return  SHELL_DEVICE_ERROR       The "Fdt" variable could not be saved due to a hardware failure.\r
+  @return  SHELL_ACCESS_DENIED      The "Fdt" variable is read-only.\r
+  @return  SHELL_ACCESS_DENIED      The "Fdt" variable cannot be deleted.\r
+  @return  SHELL_ACCESS_DENIED      The "Fdt" variable could not be written due to security violation.\r
+\r
+**/\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellDynCmdSetFdtHandler (\r
+  IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL  *This,\r
+  IN EFI_SYSTEM_TABLE                    *SystemTable,\r
+  IN EFI_SHELL_PARAMETERS_PROTOCOL       *ShellParameters,\r
+  IN EFI_SHELL_PROTOCOL                  *Shell\r
+  );\r
+\r
+/**\r
+  This is the shell command "setfdt" help handler function. This\r
+  function returns the formatted help for the "setfdt" command.\r
+  The format matchs that in Appendix B of the revision 2.1 of the\r
+  UEFI Shell Specification.\r
+\r
+  @param[in]  This      The instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.\r
+  @param[in]  Language  The pointer to the language string to use.\r
+\r
+  @return  CHAR16*  Pool allocated help string, must be freed by caller.\r
+**/\r
+CHAR16*\r
+EFIAPI\r
+ShellDynCmdSetFdtGetHelp (\r
+  IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL  *This,\r
+  IN CONST CHAR8                         *Language\r
+  );\r
+\r
+#endif /* __FDT_PLATFORM_DXE_H__ */\r